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

 ID:                 62304
 User updated by:    zkizzik at gmail dot com
 Reported by:        zkizzik at gmail dot com
 Summary:            string cast dont work with zero values
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Filter related
 Operating System:   All
 PHP Version:        5.4.3
 Block user comment: N
 Private report:     N

 New Comment:

Invalid. x__x


Previous Comments:
------------------------------------------------------------------------
[2012-06-12 22:08:59] zkizzik at gmail dot com

Description:
------------
string cast dont work with zero values.

Test script:
---------------
// test.php?price=0
$price = $_GET['price'];
echo htmlspecialchars((string)$price, ENT_QUOTES); // empty
// cast (string) for prevent errors with arrays, for example 
test.php?price[][][][]=disclosureHere

Expected result:
----------------
0 not empty

Patch in php:
// test.php?price=0
$price = $_GET['price'];
echo (($price === '0') ? '0' : htmlspecialchars((string)$price, ENT_QUOTES));

Actual result:
--------------
empty value :-/


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



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

Reply via email to