View Ticket
Ticket Hash: | 7412bf040f713c2e6334a14dc40bd1472bc4bdbc | |||
Title: | json_encode fails on transcoding the number 0 | |||
Status: | Closed | Type: | Code_Defect | |
Severity: | Critical | Priority: | Immediate | |
Subsystem: | Resolution: | Fixed | ||
Last Modified: | 2014-04-24 02:42:05 | |||
Version Found In: | 18.1 | |||
Description: | ||||
The json_encode fails to encode the number 0 as it is interpreted as 'false' in the following comparison: #-- strings need some care elseif (is_string($var)) { if (!utf8_decode($var)) { #-- process code here... } } utf8_decode decodes 0 to 0 wich is interpreted as falsy by php. Proposed sollution (could be better, but works): #-- strings need some care elseif (is_string($var)) { if (!utf8_decode($var) && utf8_decode($var) != 0) { #-- process code here... } } Cheers, Diederik. | ||||
User Comments: | ||||
mario added on 2014-04-24 02:42:05:
(text/x-fossil-plain)
Fixed with PCRE /u check. |