is get_class() case-sensitive now?

php.internals

Greg Beaver

22 years ago
Hi, I just tried a test parse of phpDocumentor CVS using a fresh compile of HEAD on windows xp. It went bananas with warnings and a fatal error. Tracking down the error turned up get_class() returning "parserDesc" instead of "parserdesc", which ruins every time I test whether get_class($a) == 'parserdesc', for example. This is such a huge BC break with php 4.x, I would have to fork the package just because of the numerous get_class() statements. Is case-sensitive get_class() here to stay? Greg

Marcus Börger

22 years ago
Hello Greg, Wednesday, January 14, 2004, 10:18:01 PM, you wrote:
> Hi,
> I just tried a test parse of phpDocumentor CVS using a fresh compile of > HEAD on windows xp. It went bananas with warnings and a fatal error. > Tracking down the error turned up get_class() returning "parserDesc" > instead of "parserdesc", which ruins every time I test whether > get_class($a) == 'parserdesc', for example.
> This is such a huge BC break with php 4.x, I would have to fork the > package just because of the numerous get_class() statements.
> Is case-sensitive get_class() here to stay?
Yes. We now report classes, methods and functions with their real name. Otherwise studlyCaps and such would have no sense at all.
-- Best regards, Marcus mailto:helly@php.net

Chuck Hagenbuch

22 years ago
> > I just tried a test parse of phpDocumentor CVS using a fresh compile of > > HEAD on windows xp. It went bananas with warnings and a fatal error. > > Tracking down the error turned up get_class() returning "parserDesc" > > instead of "parserdesc", which ruins every time I test whether > > get_class($a) == 'parserdesc', for example.
is_a($a, 'parserDesc') would work for you in both 4 and 5 (well, I assume in 5). -chuck
-- Charles Hagenbuch, <chuck@horde.org> "Here, I brought some cole slaw. It's made from peeeooople! Just kidding."

Adam Maccabee Trachtenberg

22 years ago
On Wed, 14 Jan 2004, Marcus Boerger wrote:
> > This is such a huge BC break with php 4.x, I would have to fork the > > package just because of the numerous get_class() statements.
You could always strtolower() them.
> > Is case-sensitive get_class() here to stay? > > Yes. We now report classes, methods and functions with their real name. > Otherwise studlyCaps and such would have no sense at all.
However, you still can't have class foo and class FOO, so strtolower(get_class()) still uniquely identifies a class. -adam
-- adam@trachtenberg.com author of o'reilly's php cookbook avoid the holiday rush, buy your copy today!

Michael Walter

22 years ago
It seems to me the certain amounts of case insensitivity which are still part of PHP start making less and less sense. Cheers, Michael