ID:               25734
 Updated by:       [EMAIL PROTECTED]
 Reported By:      rbotzer at yahoo dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Feature/Change Request
 Operating System: MacOS X
 PHP Version:      4.3.3
 New Comment:

Bad idea - think about backwards compatibility.

And what would be next? Should "no", "off", "nyet", "falsch" and a
bunch of other strings also evaluate to false?


Previous Comments:
------------------------------------------------------------------------

[2003-10-02 12:57:52] rbotzer at yahoo dot com

Description:
------------
When I type-cast the string "false" into a boolean it evaluates to
TRUE.  This is non-sensical.  Can we please change the type-casting so
that it evaluates as FALSE.


Thanks,
Ronen Botzer

Reproduce code:
---------------
<?php
// start example:
$x = "false";

if ($x === "false") {
  print ("the string value of x is evaluating as \"false\" \n");
  var_dump ($x);
  print ("\n");
}

$y = (boolean) $x;
print ("\$x was type-cast into boolean \$y\n\n");
if ($y) {
  print ("the boolean value of x is evaluating as true\n");
  var_dump ($y);
}
// end example
?>

Expected result:
----------------
I expect to only see a printout from the first conditional.  The second
should evaluate as false, and not print.

Actual result:
--------------
the string value of x is evaluating as "false" 
string(5) "false"

$x was type-cast into boolean $y

the boolean value of x is evaluating as true
bool(true)



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


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

Reply via email to