Re: [PATCH] Notice on array to string convertion
| From: | Patrick ALLAERT | Date: | Thu, 02 Jun 2011 13:37:17 +0000 |
| Subject: | Re: [PATCH] Notice on array to string convertion | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-52770@lists.php.net to get a copy of this message | ||
2011/6/2 Rune Kaagaard <rumi.kg@gmail.com>:
>> this conversion should never happen and throw a fatal error since this
>> action is destructive to data and never useful nor will warnings/notices
>> helps in the real world
>
> Unlike i.e. Python its really not the PHP way to go fatal on the
> developer during weird type conversions. I'm also +1 on the E_NOTICE.
Indeed, an error is really not appropriate here as this is seldom used
in some very specific case (like testing php with phpt tests):
To test the method offsetGet(), an echo is made with the call to the
method and the parameters.
That way we see in the expected part that we are calling it with
offsetGet(Array,anIndex)...
function offsetGet($index) {
echo __METHOD__ . "($this->element, $index)\n";
return isset($this->element[$index]) ? $this->element[$index] : NULL;
}