[Typo3-dev] PHP problem revived
Tobias Weidelt
tobias at weidelt.de
Mon Apr 26 13:04:12 CEST 2004
Hi,
Martin-no$pam-Kutschker wrote:
>> Tobias Weidelt wrote:
>>> //@ to suppress the error message:
>>>
>>> if (is_array(@$a['a']['b']['c'])) {
>
> The @ in front of the $ ... I don't know, just doesn't look right.
>
> What about this:
>
> if (@is_array($a['a']['b']['c'])) { ... }
I didn't try it, but I think that will not work, because it's not the
is_array-function giving an error, but the usage of an uninitialized
array. Therefore the @ in front of the array.
Hm -- I'm too curious, I will try it, one moment...
Ok, you are right, it works with the @ in front of is_array! :-)
BTW I don't get an error but only a notice when I use an uninitialised
array...
[...]
Sorry, I re-read Kaspers message: error only occours if $a['a'] in the
example above is a variable i.e.
$a['a'] = 'hello'
but not an array. This happens here, too. :-(
You CAN suppress the error in this case, but then PHP "dies" silently
instead; in my example it wouldn't show anything.
It's also not possible to use the new exception handling. Perhaps it
would be possible to convince the PHP coders to convert the error to a
non "fatal" one, so error handling/suppression would be possible.
Sorry that I couldn't help further,
Tobias Weidelt
More information about the TYPO3-dev
mailing list