PHP Bugs  
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #27443 defined() wrong return type
Submitted:1 Mar 2004 1:40am UTC Modified: 1 Mar 2004 3:05am UTC
From:talmage at cableone dot net Assigned to:
Status:Closed Category:Unknown/Other Function
Version:4.3.4 OS:Debian Linux
Votes:3 Avg. Score:2.7 ± 1.7 Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%) Same OS:1 (33.3%)
View/Vote Developer Edit Submission

[1 Mar 2004 1:40am UTC] talmage at cableone dot net
Description:
------------
defined() does not return boolean, it returns an integer according to
gettype()

If you do a gettype() on isset(), it returns the type as boolean. If you
do a gettype() on defined() it returns an integer.

The docs state defined() returns boolean and it makes logical sense to
have defined() return boolean type.

Reproduce code:
---------------
echo gettype(isset($test));
echo "<br>";
echo gettype(defined("test"));

Expected result:
----------------
boolean
boolean

Actual result:
--------------
boolean
integer
[1 Mar 2004 3:05am UTC] derick@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

RSS feed | show source 

PHP Copyright © 2001-2009 The PHP Group
All rights reserved.
Last updated: Sat Nov 21 10:30:49 2009 UTC