php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #528 please ingore above - gettype() now even worse!!!
Submitted: 1998-07-09 08:53 UTC Modified: 1998-07-09 19:01 UTC
From: be at SHonline dot DE Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0 Latest CVS OS: solaris 2.5.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
50 + 17 = ?
Subscribe to this entry?

 
 [1998-07-09 08:53 UTC] be at SHonline dot DE
Now gettype is totally inconsistent:

Now
-------
$b = array();
 
function b() { ; }
 
print gettype($b);
-------

retruns "array" which is perfectly correct.

But
-------
class A { 
 var $a = array();
 function a() { ; }
}
 
$o = new A;
print gettype($o->a);
-------

returns "user function" which is not only false, but also
inconsistent to what gettype() returns in the upper case.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-07-09 19:01 UTC] ssb
What you do above is to first define a property $a and
then immediately replace it to the function a().
This is a side-effect of the way classes are currently
implemented (they share the same name space, and are really
just associative arrays with sugar on top).  It is not
an inconsistency, but the parser probably ought to
croak if you replace properties this way.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 14 16:03:02 2024 UTC