Re: note 26711 added to function.include
| From: | Maxim Maletsky | Date: | Sun, 10 Nov 2002 03:23:56 +0000 |
| Subject: | Re: note 26711 added to function.include | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-39249@lists.php.net to get a copy of this message | ||
It is not really to be within the include area. Why don't you
investigate on this better and, if problem is actually a problem and can
be as easily duplicated, submit it to the bugs.php.net.
--
Maxim Maletsky
maxim@php.net
On 10 Nov 2002 02:58:22 -0000 mgv@fx.ro wrote:
> I'm trying to design an elegant include dependency structure for a large project. My idea
was using return() in libraries if some dependency wasn't loaded, and have an include manager
parse the result and first include the dependency and then *retry* loading the original file after
including the dependencies. To my unpleasant surprise, class definitions below the return()
statement were loaded by PHP even if the return() did execute above it! The code below the return
statement didn't run though, but since the class definition was loaded, retrying to load the
same file resulted in a PHP error saying that I'm trying to duplicate a class!
>
> For instance:
> --- myFile.php ---
> <?
> include("myLib.php");
> if (class_exists("myclass")) {
> echo("It's defined!");
> }
> ?>
>
> --- myLib.php ---
> <?
> return(1);
> echo("Whoaa! return() didn't do a thing!");
> class myClass
> {
> function myClass() {}
> }
> ?>
>
> Executing myFile.php *will* echo "It's defined!" but won't echo
"Whoaa! return() didn't do a thing!".
> --
> http://www.php.net/manual/en/function.include.php
> http://master.php.net/manage/user-notes.php?action=edit+26711
> http://master.php.net/manage/user-notes.php?action=delete+26711
> http://master.php.net/manage/user-notes.php?action=reject+26711
>
>
> --
> PHP Notes Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>