|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-08-28 17:11 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 09:00:02 2025 UTC |
Description: ------------ when executing the code below, PHP will crash with a segmentation fault. Note: To reproduce the crash, the database "test" must exist and contain a table "user" with an entry with id=1 (or to put it differently: the query must at least return one result). Versions of software used: mysql 5.0.18 php 5.1.6 Reproduce code: --------------- <?php class test { protected static $dbh; protected function connect() { self::$dbh = new PDO('mysql:host=localhost;dbname=test', 'test', 'test'); } public function read($uid) { self::connect(); $stmt = self::$dbh->prepare("SELECT * FROM user WHERE id = :uid"); $result = $stmt->execute(array(':uid' => 1)); $rows = $result->fetchAll(PDO::FETCH_OBJ); var_dump($result, $rows); } } $t = new test(); $t->read(1); Expected result: ---------------- some error messages, but no segfault Actual result: -------------- segmentation fault: PHP Fatal error: Call to a member function fetchAll() on a non-object in /home/chris/workspace/testing/crash.php on line 19 Fatal error: Call to a member function fetchAll() on a non-object in /home/chris/workspace/testing/crash.php on line 19 Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1216100688 (LWP 20861)] 0xb7a9cc07 in mysql_more_results () from /usr/lib/mysql/libmysqlclient.so.15 (gdb) bt #0 0xb7a9cc07 in mysql_more_results () from /usr/lib/mysql/libmysqlclient.so.15 #1 0x0818cdf1 in pdo_row_new () #2 0x0818cf6d in pdo_dbstmt_free_storage () #3 0x082ddef2 in zend_objects_store_free_object_storage () #4 0x082b6cd9 in shutdown_executor () #5 0x082c2671 in zend_deactivate () #6 0x082809d4 in php_request_shutdown () #7 0x08344908 in main ()