Bug #13703 Updated: PHP allows function redefinition

From: Date: Wed, 17 Oct 2001 06:01:34 +0000
Subject: Bug #13703 Updated: PHP allows function redefinition
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-68091@lists.php.net to get a copy of this message
ID: 13703 Updated by: mfischer Reported By: yasuo_ohgaki@yahoo.com Old Status: Open Status: Feedback Bug Type: Scripting Engine problem Operating System: linux 2.4.4/glibc 2.2.2 PHP Version: 4.0CVS-2001-10-16 New Comment: When reading your report I get the impression that the script outputs "A->test()\n" because you said "PHP executes first function test()". I get no redefinition error but on my system the second function is called so my output is "Another A->test()". So, two we have two different behaviours here or were your report not accurat? Anyway, it doesn't look good. - Markus Previous Comments: ------------------------------------------------------------------------ [2001-10-16 23:14:30] yasuo_ohgaki@yahoo.com Found this bug while I'm doing copy & paste. Current CVS version (both HEAD and RC) allows redefinition of function (method). I think this should be fixed before 4.1.0 release. Following code compiles/runs. PHP executes first function test(). <?php class A { function test() { echo "A->test()\n"; } function test() { echo "Another A->test()\n"; } } $obj = new A; $obj->test(); ?> ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=13703&edit=1

« previous php.dev (#68091) next »