php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73300 crashe on late state binding call parent non static method
Submitted: 2016-10-12 09:55 UTC Modified: 2016-10-12 15:33 UTC
From: roman4e at gmail dot com Assigned: cmb (profile)
Status: Not a bug Package: Reproducible crash
PHP Version: 7.0.11 OS: Linux mint
Private report: No CVE-ID: None
 [2016-10-12 09:55 UTC] roman4e at gmail dot com
Description:
------------
Trying to access parent method which overloaded in child with late state binding gets segmentation fault.

Test script:
---------------
<?php

class A {
  protected $data = [1,2,3,5];

  public function data() { return $this->data; }
}

class B extends A {
  protected $data = [5,6,7,89];
  public function data() { return static::data(); }
}

$b = new B();
var_dump($b->data());


Expected result:
----------------
Do not known

Actual result:
--------------
Segmentation fault


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-10-12 14:09 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2016-10-12 14:09 UTC] cmb@php.net
This is expected behavior, because the script causes infinite
recursion, see <https://3v4l.org/c1lM1>, what is a programmer
error.
 [2016-10-12 14:34 UTC] roman4e at gmail dot com
I think it should not be a segfault error but fatal error like "memory exceed" or too deep recursion, does it?
 [2016-10-12 15:33 UTC] cmb@php.net
PHP does not check for infinite recursion for performance reasons.
See also <http://php.net/manual/en/functions.user-defined.php>.

You can install Xdebug in your development environment(s), and set
xdebug.max_nesting_level to an appropriate value.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Sep 22 14:01:23 2020 UTC