From: mkrasuski at infico dot pl Operating system: Windows 7/XP PHP version: 5.3.0 PHP Bug Type: Output Control Bug description: Boolean type casting print problem
Description: ------------ I think, there's a problem with type casting -- to be more specific, with boolean casting. When I was trying to print result of the condition (should be true, or false) I received some unexpected output. Reproduce code: --------------- <?php $b = 2; echo 'Should be false: ' . (!$b); echo '<br />'; echo (string) !$b; echo '<br />'; echo (bool) !$b; echo '<br />'; echo (int) !$b; echo '<br />'; echo 'Should be true: ' . ((bool) $b); echo '<br />'; var_dump(!$b); ?> Expected result: ---------------- Should be false: false false // or 0? false 0 Should be true: true bool(false) Actual result: -------------- Should be false: 0 Should be true: 1 bool(false) -- Edit bug report at http://bugs.php.net/?id=49097&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49097&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49097&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49097&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49097&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49097&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49097&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49097&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49097&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49097&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49097&r=support Expected behavior: http://bugs.php.net/fix.php?id=49097&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49097&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49097&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49097&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49097&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49097&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49097&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49097&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49097&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49097&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49097&r=mysqlcfg
