Re: [PHP] PHP arguments getting lost in call!?

2011-02-13 Thread Thijs Lensselink
On 02/13/2011 10:00 AM, Florin Jurcovici wrote:
> Me stupid, my bad.
> 
> Turns out the bug isn't in my code, but in the debugger. I'm working
> with the trial version of Zend Studio. When inside the call to the
> static method, everything is undefined. If I look at variables using
> the Expressions view, I can see their values, and they _are_ defined.

Maybe the "break at first line" switch is on in the debug config. If you
step through you should see all variables. Two things i can think of.

1. Your breakpoints are set before the var us initialised
2. something wrong with your IDE/debugger setup

> 
> Still, maybe this thread was not completely useless - others may have
> the same problem when using the same development setup.
> 
> I recall downloading the PDT from somewhere some time ago, and there
> variables in the Variables view were definitely updated upon each step
> through the code.
> 
> Somewhat off topic: wow, that was a fast response! I challenge any
> commercial support service to have such response times - on Sunday!
> 
> On Sun, Feb 13, 2011 at 10:53 AM, Richard Quadling  
> wrote:
>> On 13 February 2011 08:36, Florin Jurcovici  
>> wrote:
>>> Hi.
>>>
>>> The entry point in my php app is a file containing something like:
>>>
>>> require_once("Disptacher.php");
>>>
>>> ...
>>>
>>> Dispatcher:dispatch($arguments);
>>>
>>> ...
>>>
>>>
>>> The file Dispatcher.php is located in the same folder as the file
>>> containing the above code, and contains the following:
>>>
>>> class Dispatcher
>>> {
>>>public static function dispatch($arguments)
>>>{
>>>...
>>>}
>>> }
>>>
>>>
>>> For some reason, although before the call to Dispatcher::dispatch()
>>> the variable $arguments is set, and contains what it is supposed to
>>> contain, inside Dispatcher:dispatch() $arguments is always empty. How
>>> come? What am I doing wrong? How can I call a static method and pass
>>> it arguments?
>>>
>>> br,
>>>
>>> flj
>>>
>>> --
>>> In politics, stupidity is not a handicap. (Napoleon said it, Bush
>>> junior proves it)
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>> What data IS getting through?
>>
>> print_r(func_get_args());
>>
>> will show this.
>>
>> --
>> Richard Quadling
>> Twitter : EE : Zend
>> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
>>
> 
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP arguments getting lost in call!?

2011-02-13 Thread Florin Jurcovici
Me stupid, my bad.

Turns out the bug isn't in my code, but in the debugger. I'm working
with the trial version of Zend Studio. When inside the call to the
static method, everything is undefined. If I look at variables using
the Expressions view, I can see their values, and they _are_ defined.

Still, maybe this thread was not completely useless - others may have
the same problem when using the same development setup.

I recall downloading the PDT from somewhere some time ago, and there
variables in the Variables view were definitely updated upon each step
through the code.

Somewhat off topic: wow, that was a fast response! I challenge any
commercial support service to have such response times - on Sunday!

On Sun, Feb 13, 2011 at 10:53 AM, Richard Quadling  wrote:
> On 13 February 2011 08:36, Florin Jurcovici  
> wrote:
>> Hi.
>>
>> The entry point in my php app is a file containing something like:
>>
>> require_once("Disptacher.php");
>>
>> ...
>>
>> Dispatcher:dispatch($arguments);
>>
>> ...
>>
>>
>> The file Dispatcher.php is located in the same folder as the file
>> containing the above code, and contains the following:
>>
>> class Dispatcher
>> {
>>        public static function dispatch($arguments)
>>        {
>>                ...
>>        }
>> }
>>
>>
>> For some reason, although before the call to Dispatcher::dispatch()
>> the variable $arguments is set, and contains what it is supposed to
>> contain, inside Dispatcher:dispatch() $arguments is always empty. How
>> come? What am I doing wrong? How can I call a static method and pass
>> it arguments?
>>
>> br,
>>
>> flj
>>
>> --
>> In politics, stupidity is not a handicap. (Napoleon said it, Bush
>> junior proves it)
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> What data IS getting through?
>
> print_r(func_get_args());
>
> will show this.
>
> --
> Richard Quadling
> Twitter : EE : Zend
> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
>



-- 
In politics, stupidity is not a handicap. (Napoleon said it, Bush
junior proves it)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP arguments getting lost in call!?

2011-02-13 Thread Richard Quadling
On 13 February 2011 08:36, Florin Jurcovici  wrote:
> Hi.
>
> The entry point in my php app is a file containing something like:
>
> require_once("Disptacher.php");
>
> ...
>
> Dispatcher:dispatch($arguments);
>
> ...
>
>
> The file Dispatcher.php is located in the same folder as the file
> containing the above code, and contains the following:
>
> class Dispatcher
> {
>        public static function dispatch($arguments)
>        {
>                ...
>        }
> }
>
>
> For some reason, although before the call to Dispatcher::dispatch()
> the variable $arguments is set, and contains what it is supposed to
> contain, inside Dispatcher:dispatch() $arguments is always empty. How
> come? What am I doing wrong? How can I call a static method and pass
> it arguments?
>
> br,
>
> flj
>
> --
> In politics, stupidity is not a handicap. (Napoleon said it, Bush
> junior proves it)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

What data IS getting through?

print_r(func_get_args());

will show this.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP arguments getting lost in call!?

2011-02-13 Thread Nilesh Govindarajan
On 02/13/2011 02:06 PM, Florin Jurcovici wrote:
> Hi.
> 
> The entry point in my php app is a file containing something like:
> 
> require_once("Disptacher.php");
> 
> ...
> 
> Dispatcher:dispatch($arguments);
> 
> ...
> 
> 
> The file Dispatcher.php is located in the same folder as the file
> containing the above code, and contains the following:
> 
> class Dispatcher
> {
>   public static function dispatch($arguments)
>   {
>   ...
>   }
> }
> 
> 
> For some reason, although before the call to Dispatcher::dispatch()
> the variable $arguments is set, and contains what it is supposed to
> contain, inside Dispatcher:dispatch() $arguments is always empty. How
> come? What am I doing wrong? How can I call a static method and pass
> it arguments?
> 
> br,
> 
> flj
> 

You are probably misspelling something, just tried out the code like this:

t.php:

require_once "t1.php";

$args = array('f', 'g', 'h');

t1::fn($args);

t1.php:

class t1 {
public static function fn($a) {
var_dump($a);
}
}

And this gives me:

array(3) {
  [0]=>
  string(1) "f"
  [1]=>
  string(1) "g"
  [2]=>
  string(1) "h"
}

which is as expected

-- 
Regards,
Nilesh Govindarajan
Facebook: http://www.facebook.com/nilesh.gr
Twitter: http://twitter.com/_linuxgeek_
Website: http://www.itech7.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP arguments getting lost in call!?

2011-02-13 Thread Florin Jurcovici
Hi.

The entry point in my php app is a file containing something like:

require_once("Disptacher.php");

...

Dispatcher:dispatch($arguments);

...


The file Dispatcher.php is located in the same folder as the file
containing the above code, and contains the following:

class Dispatcher
{
public static function dispatch($arguments)
{
...
}
}


For some reason, although before the call to Dispatcher::dispatch()
the variable $arguments is set, and contains what it is supposed to
contain, inside Dispatcher:dispatch() $arguments is always empty. How
come? What am I doing wrong? How can I call a static method and pass
it arguments?

br,

flj

-- 
In politics, stupidity is not a handicap. (Napoleon said it, Bush
junior proves it)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php