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 in
>PHP
> > > 4.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() {
> > >     print "Function test()\n";
> > >   }
> > > }
> > > ?>
> >
> > 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: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to