1--TEST-- 2PDO Common: Bug #52098 Own PDOStatement implementation ignore __call() 3--EXTENSIONS-- 4pdo 5--SKIPIF-- 6<?php 7$dir = getenv('REDIR_TEST_DIR'); 8if (false == $dir) die('skip no driver'); 9require_once $dir . 'pdo_test.inc'; 10PDOTest::skip(); 11?> 12--FILE-- 13<?php 14if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../../pdo/tests/'); 15require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; 16$db = PDOTest::factory(); 17 18$db->exec("CREATE TABLE test52098 (x int)"); 19$db->exec("INSERT INTO test52098 VALUES (1)"); 20 21class MyStatement extends PDOStatement 22{ 23 public function __call($name, $arguments) 24 { 25 echo "Calling object method '$name'" . implode(', ', $arguments). "\n"; 26 } 27} 28/* 29Test prepared statement with PDOStatement class. 30*/ 31$derived = $db->prepare('SELECT * FROM test52098', array(PDO::ATTR_STATEMENT_CLASS=>array('MyStatement'))); 32$derived->execute(); 33$derived->foo(); 34$derived->fetchAll(); 35$derived = null; 36 37/* 38Test regular statement with PDOStatement class. 39*/ 40$db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('MyStatement')); 41$r = $db->query('SELECT * FROM test52098'); 42echo $r->bar(); 43$r->fetchAll(); 44$r = null; 45 46/* 47Test object instance of PDOStatement class. 48*/ 49$obj = new MyStatement; 50echo $obj->lucky(); 51?> 52--CLEAN-- 53<?php 54require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; 55$db = PDOTest::factory(); 56PDOTest::dropTableIfExists($db, "test52098"); 57?> 58--EXPECT-- 59Calling object method 'foo' 60Calling object method 'bar' 61Calling object method 'lucky' 62