hi Matthew,
thank you very much for your help.

> I haven't checked what will happen when we use the pippo.php as the
> target of a webservice call, when it will be being called at the top
> level again. I will try that tomorrow.

yes, this is the real problem i found: i'm calling it as the target of
a webservice call.

thank you again,
mbertazz

On Mar 14, 6:24 pm, "Matthew Peters" <[EMAIL PROTECTED]>
wrote:
> Hi mbertazz,
> This is a tricky little problem. The essence of the problem is that
> config.php only expects to find itself called from the very top level
> script, where all variables are global. That is why it does not bother
> to do global $CFG itself. However, when we call pippo.php for the
> first time e.g. from a client script like:
> <?php
>   /* client.php */
>   include_once('SCA/SCA.php');
>   $s = SCA::getService('pippo.php');
>   echo $s->m1('a','b');
> ?>
>
> then the require_once(config.php) is being called from a script that
> is already several calls down from in the call stack.
>
> The following fix works for calling the component locally:
> <?php
>   /* client.php */
>   require_once('config.php');
>   include_once('SCA/SCA.php');
>   $s = SCA::getService('pippo.php');
>   echo $s->m1('a','b');
> ?>
>
> whihc gets the call to config.php done nice and early.
>
> I haven't checked what will happen when we use the pippo.php as the
> target of a webservice call, when it will be being called at the top
> level again. I will try that tomorrow.
>
> Hope that helps,
> Matthew
>
> On Mar 14, 12:27 am, "mbertazz" <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi everybody,
> > to be clear i will explain my problem using the code below.
>
> > My problem is: when i use "m1" i obtain this error:
>
> > [Wed Mar 14 01:20:37 2007] [error] PHP Notice:  Fatal: CFG is not
> > configured! Exiting. in /home/messe318/setup.php on line 93
> > /home/messe318/setup.php(93) : Notice - Fatal: CFG is not configured!
> > Exiting.
>
> > why "global $CFG" doesn't wok into setup.php using SCA (if i call
> > setup.php directly it work) ?
>
> > the problem is i can't change config.php and setup.php, i can chage
> > pluto.php and pippo.php.
>
> > thank you in advance.
> > mbertazz
>
> > <?php
> > /* pippo.php */
>
> > include "SCA/SCA.php";
>
> > /**
> >  *
> >  * @service
> >  * @binding.ws
> >  *
> >  */
> > class pippo
> > {
>
> >         /**
> >          *
> >          * @reference
> >          * @binding.php Pluto.php
> >          */
> >          public $pluto;
>
> >         /**
> >          *
> >          * @param string $a
> >          * @param string $b
> >          * @return string
> >          */
> >         function m1($a,$b){
> >                 return $this->pluto->m2($a,$b);
> >         }}
>
> > ?>
>
> > <?php
> > /* Pluto.php */
>
> > require_once('config.php');
>
> > class Pluto
> > {
> >         function m2($a, $b){
> >                 global $CFG;
> >                 m3();
> >                 return $a.$b;
> >         }}
>
> > ?>
>
> > <?php
> > /* config.php */
>
> > unset($CFG);
>
> > $CFG->k    = '123';
> > $CFG->z    = '456';
>
> > require_once("setup.php");
> > ?>
>
> > <?php
> > /* setup.php */
>
> > global $CFG;
>
> > if (!isset($CFG->k)) {
> >         trigger_error('Fatal: CFG is not configured! Exiting.');
> >         die;
> >     }
>
> > function m3()
> > ...
> > ?>- Hide quoted text -
>
> - Show quoted text -


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"phpsoa" group.
To post to this group, send email to phpsoa@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to