Edit report at http://bugs.php.net/bug.php?id=52400&edit=1
ID: 52400
Comment by: mat999 at gmail dot com
Reported by: mat999 at gmail dot com
Summary: Object 'named' constructor not called in namespaces
only
Status: Bogus
Type: Bug
Package: *General Issues
Operating System: linux, debian
PHP Version: 5.3.3RC3
New Comment:
Thanks for the quick reply, can I recomend adding this to the UPGRADING
document?
Previous Comments:
------------------------------------------------------------------------
[2010-07-22 10:01:36] [email protected]
By design, bug fix.
Methods with the same name as the last element of a namespaced class
name will not be treated as constructor anymore. This change doesn't
affect non-namespaced classes.
Use the recommended __construct instead.
------------------------------------------------------------------------
[2010-07-22 09:58:43] mat999 at gmail dot com
Description:
------------
Very big bad bug, suprised it escaped test until now. Only tested on
php-fpm, not cli.
Test script:
---------------
namespace NS1 {
class Test {
function Test($t){
die('called');
}
}
}
namespace {
new \NS1\Test($t);
die(':(');
}
Expected result:
----------------
called
Actual result:
--------------
:(
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52400&edit=1