[pmwiki-users] Irreproducible behavior - maybe a bug
Joachim Durchholz
jo at durchholz.org
Wed May 11 16:05:30 CDT 2005
Patrick R. Michaud wrote:
> On Wed, May 11, 2005 at 10:27:10PM +0200, Joachim Durchholz wrote:
>
>>Oh, and looking on http://www.php.net/language.types.type-juggling I
>>found this:
>>"Note: The behaviour of an automatic conversion to array is currently
>>undefined."
>>In the light of this remark, I find the stability of PmWiki remarkable -
>>after all, there are 64 occurrences of (array) in the PmWiki code. Seems
>>like the conversion isn't *that* undefined, just long-standingly buggy
>>and nobody ever cared to fix it...
>
> Well, except that this isn't an example of an automatic conversion
> to an array. Because of the (array) in front, it's *not* automatic,
> it's a type cast, and typecasting is very well defined -- see
> http://us3.php.net/manual/en/language.types.array.php#language.types.array.casting
Ah, right.
Then it's probably just a bug in PHP :-/
> An "automatic conversion" would be where someone sends a
> non-array value to a function or operator that can only work
> on arrays, but doesn't use a cast.
Strange if automatic conversion would be a problem and explicit one
wouldn't... but well.
> I'm thinking it must be something in the code other than
> the (array) itself that is causing the problem. It might be
> an operator precedence issue -- try changing the line to read:
>
> foreach((array)(@$MarkupTable[$id]['dep']) as $i=>$m)
>
> and see if that resolves the problem or gives a useful
> error message. It would explain a lot.
No, that doesn't help.
I'll see whether I can come up with something else.
Regards,
Jo
More information about the pmwiki-users
mailing list