Bug #13703 Updated: PHP allows function redefinition

From: Date: Mon, 12 Nov 2001 02:45:05 +0000
Subject: Bug #13703 Updated: PHP allows function redefinition
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-70192@lists.php.net to get a copy of this message
ID: 13703 Updated by: cnewbill Reported By: yasuo_ohgaki@yahoo.com Status: Critical Bug Type: Scripting Engine problem Operating System: linux 2.4.4/glibc 2.2.2 PHP Version: 4.0CVS-2001-10-16 New Comment: Ditto with 4.0.6. -Chris Previous Comments: ------------------------------------------------------------------------ [2001-11-11 21:30:16] sniper@php.net Marking as Critical for now. ------------------------------------------------------------------------ [2001-11-11 21:29:55] sniper@php.net I get "Another A->test()" with latest CVS. Anyone got older (4.0.6) to test this with? --Jani ------------------------------------------------------------------------ [2001-10-17 03:37:04] yasuo_ohgaki@yahoo.com I get only "A->test()" which is the first function definition. I'm not suprised. When I notice this bug in much complex scripts that have relatively complex class strucutre, PHP executed both functions that have the same name. (without error/warning) Does this bug's behaviour depend on configuration? If anyone need configure line, let me know. ------------------------------------------------------------------------ [2001-10-17 02:01:34] mfischer@php.net 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 ------------------------------------------------------------------------ [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 (#70192) next »