#33491 [Opn->Asn]: extended mysqli class crashes when result is not object

From: Date: Mon, 27 Jun 2005 13:03:36 +0000
Subject: #33491 [Opn->Asn]: extended mysqli class crashes when result is not object
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-81076@lists.php.net to get a copy of this message
ID: 33491 Updated by: sniper@php.net Reported By: sniper@php.net -Status: Open +Status: Assigned Bug Type: MySQLi related Operating System: * PHP Version: 5CVS-2005-06-27 (dev) -Assigned To: +Assigned To: georg New Comment: Georg, I'm not absolutely sure if this is just Mysqli issue, but if you could check this out..:) Previous Comments: ------------------------------------------------------------------------ [2005-06-27 15:01:53] sniper@php.net Description: ------------ (gdb) run tt.php Starting program: /www/php/bin/php tt.php [Thread debugging using libthread_db enabled] [New Thread -1208100640 (LWP 4755)] PHP Fatal error: Call to a member function fetch_row() on a non-object in tt.php on line 8 Fatal error: Call to a member function fetch_row() on a non-object in tt.php on line 8 Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1208100640 (LWP 4755)] 0x0818cac4 in instanceof_function_ex (instance_ce=0x8431fac, ce=0x8409f60, interfaces_only=0 '\0') at /usr/src/php5/Zend/zend_operators.c:1564 1564 if (instanceof_function(instance_ce->interfaces[i], ce TSRMLS_CC)) { (gdb) bt #0 0x0818cac4 in instanceof_function_ex (instance_ce=0x8431fac, ce=0x8409f60, interfaces_only=0 '\0') at /usr/src/php5/Zend/zend_operators.c:1564 #1 0x0818cb2d in instanceof_function (instance_ce=0x8431fac, ce=0x8409f60) at /usr/src/php5/Zend/zend_operators.c:1582 #2 0x08094fc7 in mysqli_objects_free_storage (object=0x8433cfc) at /usr/src/php5/ext/mysqli/mysqli.c:132 #3 0x081a8547 in zend_objects_store_free_object_storage (objects=0x839eeec) at /usr/src/php5/Zend/zend_objects_API.c:82 #4 0x08182b87 in shutdown_executor () at /usr/src/php5/Zend/zend_execute_API.c:272 #5 0x0818f416 in zend_deactivate () at /usr/src/php5/Zend/zend.c:823 #6 0x0814e5fa in php_request_shutdown (dummy=0x0) at /usr/src/php5/main/main.c:1237 #7 0x081fa4b9 in main (argc=2, argv=0xbffff414) at /usr/src/php5/sapi/cli/php_cli.c:1142 Reproduce code: --------------- <?php class DB extends mysqli { public function query_single($query) { $result = parent::query($query); $row = $result->fetch_row(); // <- Here be crash return (isset($row[0]) ? $row[0] : ''); } } // Works when using mysqli class directly /* $DB = new mysqli('localhost', 'root', '', ''); var_dump($DB->query_single('SELECT DATE()')); */ // Segfault when using the DB class which extends mysqli $DB = new DB('localhost', 'root', '', ''); var_dump($DB->query_single('SELECT DATE()')); ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33491&edit=1

« previous php.bugs (#81076) next »