#28012 [Opn->Csd]: spprintf() output inconsistent for %p (fix included)
| From: | helly@php.net | Date: | Thu, 15 Apr 2004 23:08:11 +0000 |
| Subject: | #28012 [Opn->Csd]: spprintf() output inconsistent for %p (fix included) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-58214@lists.php.net to get a copy of this message | ||
ID: 28012
Updated by: helly@php.net
Reported By: php-lists at nomeaning dot net
-Status: Open
+Status: Closed
Bug Type: Output Control
Operating System: linux RH 9
PHP Version: 5CVS-2004-04-15 (dev)
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2004-04-15 17:23:23] php-lists at nomeaning dot net
Having read README.SUBMITTING_PATCHES more carefully, I am emailing the
patch to internals@lists.php.net. Sorry for the confusion.
------------------------------------------------------------------------
[2004-04-15 17:15:56] php-lists at nomeaning dot net
Hmmmm... no place to attach a patch, eh? Perhaps I'm blind or need full
CVS access. Well, it's short and sweet but I'll just post a link to
the patches rather than pasting them in here.
http://www.nomeaning.net/temp/spprintf.tgz
The contents of the .tgz are:
1) The proposed fix, in spprintf.c.patch
2) The temporary patch to php_var_dump(), which you may or may not want
to bother with, in var.c.patch.
It's clearly the most minor of minor bugs but the output of %p has
puzzled me for a while and I decided today to track it down. Hope this
helps!
------------------------------------------------------------------------
[2004-04-15 17:07:21] php-lists at nomeaning dot net
Description:
------------
In all functions using spprintf(), the output corresponding to the
format conversion specifier "%p" depends on the value of the *previous*
argument (if any).
If the previously-converted argument was a non-zero integer, the string
output will be prefixed with "0x", as intended.
If the previously-converted argument was zero or a non-integer, the
prefix will be missing.
Reproduce code:
---------------
I suspect you'll be able to clearly see this problem when examining the
attached patch (fix), but I will attach a second patch which may be
temporarily applied to php-src/ext/standard/var.c which causes
php_var_dump to display the addresses of zval*s for the values
displayed in a dump.
To reproduce the error, simply (in a PHP script) assign several numeric
and non-numeric values to elements in an array, then use var_dump to
display the contents of the array.
Expected result:
----------------
"0x" should prefix every pointer value, to indicate a hexadecimal
address.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28012&edit=1