Edit report at https://bugs.php.net/bug.php?id=72351&edit=1
ID: 72351
Updated by: requinix@php.net
Reported by: 1050653098 at qq dot com
Summary: class A function F() class B extends A function F
{$this->F()}
-Status: Open
+Status: Not a bug
Type: Bug
-Package: Documentation problem
+Package: Scripting Engine problem
PHP Version: 5.6.22
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2016-06-07 05:37:04] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72351&edit=1