php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68905 Incorrect printf
Submitted: 2015-01-24 19:29 UTC Modified: 2015-01-27 13:27 UTC
From: bugreports at internot dot info Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.5.21 OS: Linux Ubuntu 14.04
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bugreports at internot dot info
New email:
PHP Version: OS:

 

 [2015-01-24 19:29 UTC] bugreports at internot dot info
Description:
------------
Hi,

In /ext/standard/var.c:

439                tmp_len = spprintf(&tmp_str, 0,"%.*H", PG(serialize_precision), Z_DVAL_PP(struc));


This is wrong on two levels:

the mismatch of arguments(2, instead of 1), and the invalid conversion.


Thanks


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-24 19:31 UTC] bugreports at internot dot info
Same in /ext/pdo/pdo_stmt.c:
                        int len = spprintf(&p, 0, "%.*H", (int) EG(precision), Z_DVAL_P(param->parameter));

and in /ext/json/json.c:
                                        len = spprintf(&d, 0, "%.*k", (int) EG(precision), dbl);


and
                                        int l = spprintf(&tmp, 0, "%.*k", (int) EG(precision), d);
 [2015-01-27 13:27 UTC] johannes@php.net
-Status: Open +Status: Not a bug
 [2015-01-27 13:27 UTC] johannes@php.net
The * in the format indicates that a precision is provided. Thus the code is correct.

See spprintf implementation: http://lxr.php.net/xref/PHP_TRUNK/main/spprintf.c#306
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 09:00:02 2026 UTC