php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62263 json_decode doesnt take 4 arguments only 3
Submitted: 2012-06-08 09:21 UTC Modified: 2012-06-10 07:59 UTC
From: briankchristensen at gmail dot com Assigned:
Status: Not a bug Package: json (PECL)
PHP Version: 5.3.13 OS: Windows 7
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: briankchristensen at gmail dot com
New email:
PHP Version: OS:

 

 [2012-06-08 09:21 UTC] briankchristensen at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.json-decode#refsect1-function.json-
decode-examples
---
Example #5 from the documentation doesn't work, where the fourth argument is 
given.

Test script:
---------------
<?php
$json = '12345678901234567890';

var_dump(json_decode($json));
var_dump(json_decode($json, false, 512, JSON_BIGINT_AS_STRING));

?>

Expected result:
----------------
float(1.2345678901235E+19)
string(20) "12345678901234567890"

Actual result:
--------------
ErrorException [ Warning ]: json_decode() expects at most 3 parameters, 4 given

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-06-08 12:44 UTC] Sjon at hortensius dot net
The manual always reflects the latest stable version of PHP. Have a look at the 
changelog:

> 5.4.0  The options parameter was added.

I'd say this is not a bug
 [2012-06-08 23:28 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2012-06-08 23:28 UTC] nikic@php.net
Yup, Sjon is right. The parameter was added in 5.4.
 [2012-06-10 07:59 UTC] briankchristensen at gmail dot com
If that is so, it could be creat to mension it in the documentation.
Like this options parameter is available as of PHP 5.4

Thanks for the quick response
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC