ID: 28796
Comment by: derrickbtan dot lists at gmail dot com
Reported By: felix at trilithium dot de
Status: No Feedback
Bug Type: Apache related
Operating System: Linux version 2.4.21-199-default
PHP Version: 5.0.0RC3
New Comment:
Shouldn't this invalid syntax be caught @ compile/run time? I ran into
the same mistake when my IDE added $this-> to the function name during
autocompletion. . . Since essentially the parent:: is ignored,
shouldn't this syntax be considered invalid??
Previous Comments:
------------------------------------------------------------------------
[2004-09-16 01:00:08] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2004-09-08 05:41:49] [EMAIL PROTECTED]
parent::$this->__construct makes no sense, are you sure you didn't mean
parent parent::__construct()
------------------------------------------------------------------------
[2004-06-18 17:41:46] benjcarson at digitaljunkies dot ca
$this->__construct() is a recursive call to secondClass' constructor.
Since the constructor never returns, the recursion never bottoms out;
it is effectively an infinite loop. Each call consumes space on the
stack, so eventually PHP chews up all available memory and dies.
You would see the same behaviour if secondClass' constructor was:
function __construct() {
$this->__construct();
}
What you really want, as alex dot pagnoni at solarix dot it has pointed
out is:
function __construct() {
parent::__construct();
}
------------------------------------------------------------------------
[2004-06-17 13:38:32] alex dot pagnoni at solarix dot it
is parent::$this->__construct() the correct syntax? Wasn't
it supposed to be parent::__construct()?
------------------------------------------------------------------------
[2004-06-15 17:03:13] felix at trilithium dot de
Description:
------------
Apache eat all memory when your try the example code
Reproduce code:
---------------
class firstClass{
function __construct(){
echo __CLASS__."::".__FUNCTION__."<br>";
}
function test(){
echo __CLASS__."::".__FUNCTION__."<br>";
return $this;
}
}
class secondClass extends firstClass{
function __construct(){
echo __CLASS__."::".__FUNCTION__."<br>";
parent::$this->__construct(); //<-here Apache eat all memory
//parent::$this->test(); // this works
}
}
$e= new secondClass;
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28796&edit=1