php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74968 PHP crashes when calling mysqli_result::fetch_object with an abstract class
Submitted: 2017-07-22 04:56 UTC Modified: -
From: toto at linux dot com Assigned:
Status: Closed Package: MySQLi related
PHP Version: 7.1.7 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: toto at linux dot com
New email:
PHP Version: OS:

 

 [2017-07-22 04:56 UTC] toto at linux dot com
Description:
------------
So I wrote some faulty code this morning that tried to do $mysqli_result->fetch_object("SomeAbstractClass"); and it ended up crashing the whole PHP.

I tested this also on PHP 7.0.18 on Ubuntu and it also ended up with a segmentation fault.

Test script:
---------------
<?php
$mysqli = new mysqli("127.0.0.1", "xxx", "xxx", "test");
abstract class test {
    public $a;
}
$mysqli->query("SELECT 1 as a")->fetch_object("test");


Expected result:
----------------
PHP should give me some error instead of just crashing.

Actual result:
--------------
Segmentation fault, the whole PHP crashes.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-22 08:37 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e405ff59f9e5873a3aa8dc6b7175708d424007b9
Log: Fixed bug #74968 PHP crashes when calling mysqli_result::fetch_object with an abstract class
 [2017-07-22 08:37 UTC] ab@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jan 30 00:01:33 2025 UTC