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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: be at SHonline dot DE
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 06 11:02:27 2025 UTC