Edit report at http://bugs.php.net/bug.php?id=52400&edit=1

 ID:                 52400
 Updated by:         vr...@php.net
 Reported by:        mat999 at gmail dot com
 Summary:            Object 'named' constructor not called in namespaces
                     only
-Status:             To be documented
+Status:             Bogus
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   linux, debian
 PHP Version:        5.3.3RC3
 Block user comment: N
 Private report:     N

 New Comment:

Already documented at http://php.net/language.oop5.decon



As of PHP 5.3.3, methods with the same name as the last element of a
namespaced class name will no longer be treated as constructor. This
change doesn't affect non-namespaced classes.


Previous Comments:
------------------------------------------------------------------------
[2010-07-22 10:17:25] paj...@php.net

@doc 



Can you check if it is in there already as well as in the manual?

------------------------------------------------------------------------
[2010-07-22 10:09:00] mat999 at gmail dot com

Thanks for the quick reply, can I recomend adding this to the UPGRADING
document?

------------------------------------------------------------------------
[2010-07-22 10:01:36] paj...@php.net

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

Reply via email to