php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72351 class A function F() class B extends A function F {$this->F()}
Submitted: 2016-06-07 05:37 UTC Modified: 2016-06-07 06:13 UTC
From: 1050653098 at qq dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.6.22 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: 1050653098 at qq dot com
New email:
PHP Version: OS:

 

 [2016-06-07 05:37 UTC] 1050653098 at qq dot com
Description:
------------
class A  function F()
class B extends A function F {$this->F()}
//error Fatal error: Allowed memory size of 536870912 bytes
/Fatal error: Allowed memory size of 536870912 bytes
// exhausted (tried to allocate 65488 bytes)
//in D:\weicot\htdocs\dev\test.php on line 29

Test script:
---------------
namespace A;
class A
{
 
    public function  F()
    {
 
    }
 
}
namespace B;
 
use A\A as A;
 
class B extends A
{
 
    public function F()
    {
 
        $this->F();//Fatal error: Allowed memory size of 536870912 bytes
 
    }
}
 
 
$B=new B();
$B->F();
 
<?php
namespace A;
class A
{

    public function  F()
    {

    }

}
namespace B;

use A\A as A;

class B extends A
{

    public function F()
    {

        parent::F();//is note error
    }
}


$B=new B();
$B->F();

Expected result:
----------------
error  die

Actual result:
--------------
error 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-07 06:13 UTC] requinix@php.net
-Status: Open +Status: Not a bug -Package: Documentation problem +Package: Scripting Engine problem
 [2016-06-07 06:13 UTC] requinix@php.net
The first one crashes because you created infinite recursion and PHP ran out of memory before it ran out of stack space.
The second one does not crash because it is not infinite recursion.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 01 10:01:30 2024 UTC