bug33491.phpt 760 B

12345678910111213141516171819202122232425262728293031323334
  1. --TEST--
  2. Bug #33491 (extended mysqli class crashes when result is not object)
  3. --INI--
  4. error_reporting=1
  5. --EXTENSIONS--
  6. mysqli
  7. --SKIPIF--
  8. <?php
  9. require_once('skipifconnectfailure.inc');
  10. ?>
  11. --FILE--
  12. <?php
  13. class DB extends mysqli
  14. {
  15. public function query_single($query) {
  16. $result = parent::query($query);
  17. $result->fetch_row(); // <- Here be crash
  18. }
  19. }
  20. require_once("connect.inc");
  21. // Segfault when using the DB class which extends mysqli
  22. $DB = new DB($host, $user, $passwd, $db, $port, $socket);
  23. $DB->query_single('SELECT DATE()');
  24. ?>
  25. --EXPECTF--
  26. Fatal error: Uncaught Error: Call to a member function fetch_row() on bool in %sbug33491.php:%d
  27. Stack trace:
  28. #0 %s(%d): DB->query_single('SELECT DATE()')
  29. #1 {main}
  30. thrown in %sbug33491.php on line %d