Re: New zend_compile.c to solve all of the duplicate function problems
| From: | Zeev Suraski | Date: | Fri, 19 Oct 2001 16:49:25 +0000 |
| Subject: | Re: New zend_compile.c to solve all of the duplicate function problems | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-68425@lists.php.net to get a copy of this message | ||
Clearly, you shouldn't be getting function redefinitions with the way you wrote the code. I'm not sure why Rasmus is getting them, Rasmus - are you sure you're running an exact copy&paste of his code?
Basically, unless the functions are in the top-level scope, there won't be any problems, because their definitions is delayed until run-time. Since they're within an if block, there should be no problems.
That said, I've been thinking about it for almost a day now, and I don't see any overwhelmingly-serious problems with the patch Brian suggested. Problems I do see:
- Even with no protection at all, function redefinitions will not be reported. That's kind of ugly.
- Won't work with URL includes (didn't look that one up thoroughly).
I'm still in favour of reverting to the old 4.0.6 behavior for now, and sorting it out in 4.2.0, rather than 4.1.0.
Zeev
At 12:52 19-10-01, Edin Kadribasic wrote:
I guess I do not understand. The following example works just fine inPHP4.1.0RC1: test.php ===== <?php include 'testlib.php'; include 'testlib.php'; test(); ?> testlib.php ====== <?php if (!defined('_TESTLIB_PHP')) { define ('_TESTLIB_PHP', 1); function test() {Doesn't work in my 4.1 here. I get redefined function errors. Now that's totally weird. I get output like this: [ek@scpno test]$ ../php -v 4.1.0RC1 [ek@scpno test]$ ../php -q test.php Function test() Can anyone reproduce this? Edin -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.netprint "Function test()\n";} } ?>