php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77162 endless-loop script segfaults instead of exit with a proper error
Submitted: 2018-11-15 10:03 UTC Modified: 2018-11-15 16:11 UTC
From: maggus dot staab at googlemail dot com Assigned: cmb (profile)
Status: Not a bug Package: *General Issues
PHP Version: 7.0.32 OS: ubuntu16 lts
Private report: No CVE-ID: None
 [2018-11-15 10:03 UTC] maggus dot staab at googlemail dot com
Description:
------------
the following code segfaults on the php-cli (and on mod_php) but I expected a proper error to happen


mstaab@mst16:/tmp$ php test.php
Speicherzugriffsfehler (Speicherabzug geschrieben)
mstaab@mst16:/tmp$ php -v
PHP 7.0.32-4+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Nov  4 2018 05:10:29) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.32-4+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies
    with blackfire v1.23.1~linux-x64-non_zts70, https://blackfire.io, by Blackfire


Test script:
---------------
<?php
// test.php

class a {
  private $prop;

  public function __construct() {
    $this->prop = new a();
  }
}

new a();

Expected result:
----------------
no segfault

Actual result:
--------------
segfaults

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-11-15 10:10 UTC] sjon at hortensius dot net
Did you try without extensions? It works pretty good here https://3v4l.org/p07m1
 [2018-11-15 10:38 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2018-11-15 10:38 UTC] cmb@php.net
Please also try with any of the actively supported PHP
versions[1].

[1] <http://php.net/supported-versions.php>
 [2018-11-15 10:46 UTC] nikic@php.net
This is almost certainly due to the blackfire extension, which will hook zend_execute and thus force call stack recursion rather than VM recursion.
 [2018-11-15 15:59 UTC] maggus dot staab at googlemail dot com
running the very same test on ubuntu18 with php7.2 works without a problem.

as soon as I disable blackfire on my php 7.0.x it also works without a segfault.

Will report it to blackfire then.
 [2018-11-15 16:11 UTC] cmb@php.net
-Status: Feedback +Status: Not a bug
 [2018-11-15 16:11 UTC] cmb@php.net
> as soon as I disable blackfire on my php 7.0.x it also works
> without a segfault.

Okay, so this is not a PHP bug.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC