Re: __toString() must return a string value
| From: | Piotr Pokora | Date: | Sun, 22 Feb 2009 11:06:35 +0000 |
| Subject: | Re: __toString() must return a string value | ||
| References: | 1 2 3 4 5 6 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-6146@lists.php.net to get a copy of this message | ||
Johannes Schlüter writes:
> I didn't check the code, before, but go up 3 or 4 lines and you read
> RETURN_FALSE in case arguement parsing fails - usually we return null in
> that case ...
"Usually" is the key word, isn't it? ;)
> php_printf("before calling zend_call_method: %x\n", return_value);
> zend_call_method_with_1_params(&zend_object,
> Z_OBJCE_P(zend_object), NULL, "format", &return_value, fmt);
> php_printf("after calling zend_call_method: %x\n", return_value);
>
> You will see that return_value is different there, whereas with
Hmm... is it documented?
> php_printf("before setting retval: %x\n", return_value);
> RETVAL_STRING("a new return value", 1);
> php_printf("after setting retval: %x\n", return_value);
>
> the address will be the same.
That's a macro, so it's obvious for me at least.
> And no the problem is not within Zend/PHP APIs but C pointer stuff.
As long as developer knows what API does with the pointers. Yes.
Thank you Johannes! It clarified many things for me.
Piotras