On Thursday 16 February 2006 13:45, Jochem Maas wrote:
> if that is the logic being applied in the engine then one might to wonder
> why a function such as array_merge() was changed to emit a warning when any
> of it's arguments are not arrays (whereas sometime in the past it used to
> swallow [and I assume 'autocast'] whatever it was given without a hiccup).
>
> I have been told that such warnings as array_merge() now emits are for my
> own good (in not so many words I was told it was "to protect me from my
> stupid self"), if it's good for me when I use array_merge() why not when an
> object is created implicitly (as in the example above)? actually my
> preference would be to drop the warning in array_merge() in this case (it
> seems like a more php way of doing things, imo)
>
> <!--
>
> unset($a); $a->i = 1;                                 // this is not a problem
> $b = 1; $c = 2; $d = array_merge($b, $c);     // but this is bad programming?
>
> -->
This was my initial thought when I saw the behaviour: "wow - this just wants 
you to do some _lousy_ programmering" and therefor thought that it needed a 
E_NOTICE.. (which I still do, but now I understand why it currently don't do 
so)

If some functions throws notices when they have to "autocast", why doesn't php 
always do this (throws notices)? Or maybe it should just throw E_STRICT and 
let the perfectionists remove those issues if they want to do so...
>
> I'm very interested to learn what people think about this kind of thing in
> general - and obviously if someone knows of material that explains the
> reasoning behind the percieved inconsistency/problem I'd be very grateful.
>
> tar,
> jochem
Regards
  Morten

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to