????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 18.191.167.79 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/home/b8009/php-5.6.22/ext/pdo_mysql/tests/ |
Upload File : |
--TEST-- MySQL PDO: PDOStatement->fetchObject() --SKIPIF-- <?php require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc'); require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); MySQLPDOTest::skip(); $db = MySQLPDOTest::factory(); try { $query = "SELECT '', NULL, \"\" FROM DUAL"; $stmt = $db->prepare($query); $ok = @$stmt->execute(); } catch (PDOException $e) { die("skip: Test cannot be run with SQL mode ANSI"); } if (!$ok) die("skip: Test cannot be run with SQL mode ANSI"); ?> --FILE-- <?php require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); $db = MySQLPDOTest::factory(); MySQLPDOTest::createTestTable($db); try { $query = "SELECT id, '', NULL, \"\" FROM test ORDER BY id ASC LIMIT 3"; $stmt = $db->prepare($query); class myclass { private $set_calls = 0; protected static $static_set_calls = 0; // NOTE: PDO does not care about protected protected $grp; // NOTE: PDO does not care about private and calls __construct() after __set() private function __construct($param1, $param2) { printf("myclass::__construct(%s, %s): %d / %d\n", $param1, $param2, self::$static_set_calls, $this->set_calls); } // NOTE: PDO will call __set() prior to calling __construct() public function __set($prop, $value) { $this->not_a_magic_one(); printf("myclass::__set(%s, -%s-) %d\n", $prop, var_export($value, true), $this->set_calls, self::$static_set_calls); if ("" != $prop) $this->{$prop} = $value; } // NOTE: PDO can call regular methods prior to calling __construct() public function not_a_magic_one() { $this->set_calls++; self::$static_set_calls++; } } $stmt->execute(); $rowno = 0; $rows[] = array(); while (is_object($rows[] = $stmt->fetchObject('myclass', array($rowno++, $rowno)))) ; var_dump($rows[$rowno - 1]); } catch (PDOException $e) { // we should never get here, we use warnings, but never trust a system... printf("[001] %s, [%s} %s\n", $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo())); } print "done!"; ?> --CLEAN-- <?php require dirname(__FILE__) . '/mysql_pdo_test.inc'; MySQLPDOTest::dropTestTable(); ?> --EXPECTF-- myclass::__set(id, -'1'-) 1 myclass::__set(, -''-) 2 myclass::__set(null, -NULL-) 3 myclass::__set(, -''-) 4 myclass::__construct(0, 1): 4 / 4 myclass::__set(id, -'2'-) 1 myclass::__set(, -''-) 2 myclass::__set(null, -NULL-) 3 myclass::__set(, -''-) 4 myclass::__construct(1, 2): 8 / 4 myclass::__set(id, -'3'-) 1 myclass::__set(, -''-) 2 myclass::__set(null, -NULL-) 3 myclass::__set(, -''-) 4 myclass::__construct(2, 3): 12 / 4 object(myclass)#%d (4) { [%u|b%"set_calls":"myclass":private]=> int(4) [%u|b%"grp":protected]=> NULL [%u|b%"id"]=> %unicode|string%(1) "3" [%u|b%"null"]=> NULL } done!