From: eran at octabox dot com Operating system: Windows XP Professional SP2 PHP version: 5.2.5 PHP Bug Type: Feature/Change Request Bug description: htmlentities returns empty string when operation on a null value
Description: ------------ The htmlentities function returns an empty string when used on a null value. This might seem irrelevant, however the htmlentities is used regularly to escape data before using it in a database query. A null value might be needed in such queries, and it would be preferred if it does not need to be considered a special case if a part of an data escaping routine. For example, the Zend_Filter_Input component of the Zend_Framework uses htmlentities as the default escape filter. Passing null values in an escape routing would result in null values erroneously being converted to empty strings. Reproduce code: --------------- var_dump(htmlentities(null)); Expected result: ---------------- NULL Actual result: -------------- string(0) "" -- Edit bug report at http://bugs.php.net/?id=44585&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44585&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44585&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44585&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44585&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44585&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44585&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=44585&r=needscript Try newer version: http://bugs.php.net/fix.php?id=44585&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44585&r=support Expected behavior: http://bugs.php.net/fix.php?id=44585&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44585&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44585&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44585&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44585&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=44585&r=dst IIS Stability: http://bugs.php.net/fix.php?id=44585&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44585&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44585&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44585&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=44585&r=mysqlcfg
