[aur-dev] [PATCH] RPC: Use JSON_NUMERIC_CHECK when encoding json response
Johannes Löthberg
johannes at kyriasis.com
Sat Jul 4 10:26:47 UTC 2015
On 04/07, Lukas Fleischer wrote:
>On Fri, 03 Jul 2015 at 23:50:31, Johannes Löthberg wrote:
>> JSON_NUMERIC_CHECK has been available since PHP 5.3.3 to encode numeric
>> strings as numbers.
>>
>> Fixes FS#45537.
>>
>> Signed-off-by: Johannes Löthberg <johannes at kyriasis.com>
>> ---
>> web/lib/aurjson.class.php | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php
>> index 7b77da4..a619ee5 100644
>> --- a/web/lib/aurjson.class.php
>> +++ b/web/lib/aurjson.class.php
>> @@ -147,7 +147,7 @@ class AurJSON {
>> $json_array['error'] = $error;
>> }
>>
>> - return json_encode($json_array);
>> + return json_encode($json_array, JSON_NUMERIC_CHECK);
>
>I don't think this is a proper solution. It will turn a "1.23" pkgdesc
>into a float, right? I think we should rather add a $decimal_fields
>array, similar to $numeric_fields.
>
Ah, yes, that's fair.
--
Sincerely,
Johannes Löthberg
PGP Key ID: 0x50FB9B273A9D0BB5
https://theos.kyriasis.com/~kyrias/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1495 bytes
Desc: not available
URL: <https://lists.archlinux.org/pipermail/aur-dev/attachments/20150704/8ef8a630/attachment.asc>
More information about the aur-dev
mailing list