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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2021 The PHP Group
All rights reserved.
Last updated: Sun Mar 07 04:01:23 2021 UTC