From: Operating system: Irrelevant PHP version: Irrelevant Package: Scripting Engine problem Bug Type: Feature/Change Request Bug description:Use '0' instead of '' as a result of converting boolean FALSE to string
Description: ------------ I'd like to propose a change in converting booleans to string. It'd be better if (string) FALSE returns '0' instead of empty string (''). Why to do so? a) More logical behavior. b) Using booleans in output would be meaningful. c) Backward-compatible change - as documentation says: "This allows conversion back and forth between boolean and string values." - this behavior is not changed by this, because (bool) '0' is FALSE. Test script: --------------- <?php echo (string) FALSE; //nothing now, '0' requested var_dump((bool) '0'); //FALSE, no change var_dump((string) FALSE === '0'); //FALSE, TRUE requested -- Edit bug report at http://bugs.php.net/bug.php?id=53094&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53094&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53094&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53094&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=53094&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53094&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=53094&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=53094&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=53094&r=needscript Try newer version: http://bugs.php.net/fix.php?id=53094&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=53094&r=support Expected behavior: http://bugs.php.net/fix.php?id=53094&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=53094&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=53094&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=53094&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53094&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=53094&r=dst IIS Stability: http://bugs.php.net/fix.php?id=53094&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=53094&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=53094&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=53094&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=53094&r=mysqlcfg