Re: [PHP4BETA] Testing ... PHP 4.0RC2 tarball
| From: | Stanislav Malyshev | Date: | Sat, 06 May 2000 13:51:13 +0000 |
| Subject: | Re: [PHP4BETA] Testing ... PHP 4.0RC2 tarball | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-14587@lists.php.net to get a copy of this message | ||
NM>> > It probably should warn about using NULL as an
NM>> > object,
NM>>
NM>> That is the point! In PHP 3 there will be a warning. We have got very
NM>> big code segments (>40000 lines) which uses this Beta 3 feature (it is a
NM>> feature not a bug :-) ). Without warnings it is very hard to debug such
This is a bug. You should not use NULL as an object, whatever behaviour
PHP shows in this case.
NM>> code and changing it to the > Beta 3 status.
NM>>
NM>> >but I'm almost sure it shouldn't be able to use NULL as a valid
NM>> > object.
NM>>
NM>> Why not ? There is no reason for it! With the great PHP array behaviour
Because NULL is nothing. Not object. Not string. Not number. Nothing. You
can't take attributes of nothing - because it's nothing.
NM>> it is the same: $myarray["test"]="something" works without
This implicitly creates an array. You cannot implicitly create object -
you need class for it. Anyway, you can count this as initialization (for
an array). Objects are initialized differently - with "new" keyword.
NM>> initialization too. It would result in a bit more elegant and smaller
NM>> PHP code.
Elegant???? You call using non-initialized variables and depending on
detals of particular implementation of some obscure case, which was never
defined and never promised to work from the start, being elegant? That
should be some new meaning for the work "elegant", previously unknown to
me.
And this "elegant and smaller" solution of yours will bring you enormous
maintenance headaches (did already, actually).
I still agreen there should be warning in this case or at least
notice. Did you have notices turned on?
--
Stanislav Malyshev stas@zend.com
+972-3-6139665