Calling a not defined constructor produce an error in PHP 5.3.0 alpha2
(200809070630 snapshot) when it work in php <= 5.2.6 calling the parent one.
Ok using constructor with class name is a compatibility behaviour and
using __construct don't have this issue. But this regression could
introduce breakage of old apps.
Regards
Remi
Simple test :
<?php
class newA {
function __construct () {
echo "from New A\n";
}
}
class newB extends newA {
}
class newC extends newB {
function __construct () {
parent::__construct();
echo "from New C\n";
}
}
class oldA {
function oldA () {
echo "from Old A\n";
}
}
class oldB extends oldA {
}
class oldC extends oldB {
function oldC () {
parent::oldB();
echo "from Old C\n";
}
}
echo "PHP Version : " . phpversion()
. "\n";
$toto = new newC();
$toto = new oldC();
?>
PHP Version : 5.2.6
from New A
from New C
from Old A
from Old C
PHP Version : 5.3.0alpha3-dev
from New A
from New C
PHP Fatal error: Call to undefined method oldB::oldB() in
/home/remif9/test/cons.php on line 24