Bug #62304 [Opn->Csd]: string cast dont work with zero values

From: Date: Tue, 12 Jun 2012 22:17:48 +0000
Subject: Bug #62304 [Opn->Csd]: string cast dont work with zero values
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-171222@lists.php.net to get a copy of this message
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

« previous php.bugs (#171222) next »