Edit report at https://bugs.php.net/bug.php?id=35746&edit=1

 ID:                 35746
 Updated by:         ni...@php.net
 Reported by:        schapht at verizon dot net
 Summary:            Comparison of scalars & non-scalars w/o typecast
                     should generate an error
-Status:             Open
+Status:             Closed
 Type:               Feature/Change Request
-Package:            Feature/Change Request
+Package:            *General Issues
 Operating System:   Mac OS 10.4.3
 PHP Version:        5.1.1
-Assigned To:        
+Assigned To:        nikic
 Block user comment: N
 Private report:     N

 New Comment:

Not sure since when, but currently this is generating a "Object of class A 
could not be converted to int" notice => Closed :)


Previous Comments:
------------------------------------------------------------------------
[2005-12-20 16:05:21] schapht at verizon dot net

Description:
------------
When developing I find that comparison of a scalar and non-scalar is often 
unintentional and usually indicates a mistake elsewhere in the program.

It would be nice if comparing scalars and non-scalars generated a low-priority 
error message.

Reproduce code:
---------------
<?php

class A {}

$a = new A;
$b = 3;

echo $a > $b;
?>

Expected result:
----------------
Notice: Comparison of scalar and non-scalar without a typecast. in test.php on 
line 8
1

Actual result:
--------------
1


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=35746&edit=1

Reply via email to