Re: [PHP] lost return value during a static call

2011-09-16 Thread Johan Lidström
On 15 September 2011 15:57, Robert Williams rewilli...@thesba.com wrote:


 On Sep 15, 2011, at 6:03, chamila gayan cgcham...@gmail.com wrote:

  when it goes through 2 static methods, at some point it stops returning
  value to the calling method. (please see comments in-line).

 The getArray() method and the 'else' portion of the getChild() method both
 lack a return statement, so they're basically just tossing out whatever
 value they come up with.

 --
 Bob Williams

 Notice: This communication, including attachments, may contain information
 that is confidential. It constitutes non-public information intended to be
 conveyed only to the designated recipient(s). If the reader or recipient of
 this communication is not the intended recipient, an employee or agent of
 the intended recipient who is responsible for delivering it to the intended
 recipient, or if you believe that you have received this communication in
 error, please notify the sender immediately by return e-mail and promptly
 delete this e-mail, including attachments without reading or saving them in
 any manner. The unauthorized use, dissemination, distribution, or
 reproduction of this e-mail, including attachments, is prohibited and may be
 unlawful. If you have received this email in error, please notify us
 immediately by e-mail or telephone and delete the e-mail and the attachments
 (if any).

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


Confirmed, putting a return statement on lines 16 and 26 yields the expected
result.

-- 
It is not possible to simultaneously understand and appreciate the Intel
architecture --Ben Scott


[PHP] lost return value during a static call

2011-09-15 Thread chamila gayan
hi All,

I'm seeing a weired behavior in following code http://pastebin.com/B5q8i1RY

when it goes through 2 static methods, at some point it stops returning
value to the calling method. (please see comments in-line).

may be I'm doing this in a wrong way so your suggestions are  welcome. And I
really appreciate if someone can explain how 'return' behaves with static
methods specially when they are called recursively.   thanks a bunch

chamila


Re: [PHP] lost return value during a static call

2011-09-15 Thread Robert Williams

On Sep 15, 2011, at 6:03, chamila gayan cgcham...@gmail.com wrote:

 when it goes through 2 static methods, at some point it stops returning
 value to the calling method. (please see comments in-line).

The getArray() method and the 'else' portion of the getChild() method both lack 
a return statement, so they're basically just tossing out whatever value they 
come up with.

--
Bob Williams

Notice: This communication, including attachments, may contain information that 
is confidential. It constitutes non-public information intended to be conveyed 
only to the designated recipient(s). If the reader or recipient of this 
communication is not the intended recipient, an employee or agent of the 
intended recipient who is responsible for delivering it to the intended 
recipient, or if you believe that you have received this communication in 
error, please notify the sender immediately by return e-mail and promptly 
delete this e-mail, including attachments without reading or saving them in any 
manner. The unauthorized use, dissemination, distribution, or reproduction of 
this e-mail, including attachments, is prohibited and may be unlawful. If you 
have received this email in error, please notify us immediately by e-mail or 
telephone and delete the e-mail and the attachments (if any).

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



Re: [PHP] lost return value during a static call

2011-09-15 Thread Richard Quadling
On 15 September 2011 14:01, chamila gayan cgcham...@gmail.com wrote:
 hi All,

 I'm seeing a weired behavior in following code http://pastebin.com/B5q8i1RY

 when it goes through 2 static methods, at some point it stops returning
 value to the calling method. (please see comments in-line).

 may be I'm doing this in a wrong way so your suggestions are  welcome. And I
 really appreciate if someone can explain how 'return' behaves with static
 methods specially when they are called recursively.   thanks a bunch

 chamila


New pastie http://pastebin.com/AnZ1r7yR
Output is ...
Z:\ppp.php 108parentclass::getChild 29parentclass::getChild
40parentclass::getArray 22parentclass::getChild
29parentclass::getChild 32parentclass::childload
6parentclass::childload 9childA::__construct 54childA::setA
67childA::setA 69childA::__construct 56parentclass::getChild 34childA
Object(   [a:childA:private] = 1)parentclass::getArray
24parentclass::getChild 42parentclass::getChild 44Z:\ppp.php
110Z:\ppp.php 112
Using PHP 5.3.9-dev on Win32.


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

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