$x = null;
get_class($x) returns get_class($this) as of 5.3.
I don't recall seeing a discussion of this on the list and
I can't find anything about this change in the archives.
The documentation is currently self-contradictory...

Under "Return Values":

Returns the name of the class of which object is an instance. Returns
FALSE if object is not an object. 

Under "Changelog":

Since 5.3.0      NULL became the default value for object, so passing NULL
to object now has the same result as not passing any value.

(BTW, I don't see that listed in
http://us.php.net/ChangeLog-5.php#5.3.0 )

I guess there hasn't been a lot of screaming about it, so maybe
it isn't a big deal, but it seems like a significant BC break to
me.  Maybe it's just because I've been beating my head against a
wall for so long trying to figure out why my code was behaving so
strangely. ;)  I can't believe it's impossible to differentiate
between receiving an argument and not receiving an argument.  
Would anyone really intentionally pass a null to this function 
to get the result of get_class($this)?

Now that I know about this BC break, I'm OK and can avoid
the issue, but for the sake of the next person to hit this, 
I felt I should post on the topic.  I almost posted a bug
directly, but the behavior is documented, so I thought this
would be the correct place.

- Todd


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

Reply via email to