[spip-dev] spip et apc

Coucou,

avec APC on a parfois une erreur de type

Fatal error: Call to undefined function: init_factory() in
/home/site/public_html/ecrire/inc_objet_base.php3 on line 308

La réponse semble se trouver ci-dessous (merci Antoine) mais, hum, je pige
pas ce qu'il faut faire...

http://apc.communityconnect.com/faq.html

6. Why do I get "call to undefined function" PHP errors with APC but not
without it?

Your code creates a conflict in the global namespace, but PHP manages to
deal with it. APC, however, will fail to correctly cache the conflicting
modules if it finds a namespace conflict. Here is an example of how this can
occur:

        File A.php includes file B.php, which
        defines the function foobar and sets some variable,
        say, $B_INCLUDED, to indicate that it has been included.

        File A.php now includes file C.php, which
        also defines a function named foobar. Before it gets to
        the function definition, though, C.php returns if
        $B_INCLUDED is true.

PHP permits this kind of conditional inclusion, but it will fail with APC
because C.php is always included and compiled, even though it never reaches
the statement that declares foobar for the second time. We made the
(possibly questionable) decision to designate this a programming error, so
you must "correct" your code before you can use APC."

Ah! J'ai trouvé, je crois... le

if (defined("_ECRIRE_INC_OBJET")) return;
define("_ECRIRE_INC_OBJET", "1");

était dans inc_objet_base.php3, et il n'y avait rien dans inc_objet.php3

enfin... c'est une correction un peu à l'aveuglette, je l'avoue...

@ Fil <fil@rezo.net> :

Coucou,

avec APC on a parfois une erreur de type

>Fatal error: Call to undefined function: init_factory() in
>/home/site/public_html/ecrire/inc_objet_base.php3 on line 308

La réponse semble se trouver ci-dessous (merci Antoine) mais, hum, je pige
pas ce qu'il faut faire...

>>>>>>>>>

http://apc.communityconnect.com/faq.html

6. Why do I get "call to undefined function" PHP errors with APC but not
without it?

Your code creates a conflict in the global namespace, but PHP manages to
deal with it. APC, however, will fail to correctly cache the conflicting
modules if it finds a namespace conflict. Here is an example of how this can
occur:

        File A.php includes file B.php, which
        defines the function foobar and sets some variable,
        say, $B_INCLUDED, to indicate that it has been included.

        File A.php now includes file C.php, which
        also defines a function named foobar. Before it gets to
        the function definition, though, C.php returns if
        $B_INCLUDED is true.

PHP permits this kind of conditional inclusion, but it will fail with APC
because C.php is always included and compiled, even though it never reaches
the statement that declares foobar for the second time. We made the
(possibly questionable) decision to designate this a programming error, so
you must "correct" your code before you can use APC."

_______________________________________________
spip-dev@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-dev

-- Fil