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
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: roman4e at gmail dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 15:01:34 2025 UTC