Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9236 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54934 invoked by uid 1010); 15 Apr 2004 21:30:09 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 54827 invoked from network); 15 Apr 2004 21:30:08 -0000 Received: from unknown (HELO lambserver.nomeaning.net) (63.205.78.98) by pb1.pair.com with SMTP; 15 Apr 2004 21:30:08 -0000 Received: (qmail 5125 invoked from network); 15 Apr 2004 21:22:15 -0000 Received: from unknown (HELO ?192.168.0.188?) (192.168.0.188) by lambserver.nomeaning.net with SMTP; 15 Apr 2004 21:22:15 -0000 To: internals@lists.php.net Content-Type: multipart/mixed; boundary="=-WR4s6FtI3MQlspQtqurV" Message-ID: <1082064607.1351.11.camel@wkstn1> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Thu, 15 Apr 2004 14:30:07 -0700 Subject: [PATCH] fix for inconsistent output of spprintf() (for %p specifier) From: php-lists@nomeaning.net (Eric Lambart) --=-WR4s6FtI3MQlspQtqurV Content-Type: text/plain Content-Transfer-Encoding: 7bit Hello folks, In all functions using spprintf(), the output corresponding to the format conversion specifier "%p" depends on the value of the *previously* converted argument (if any), not just the pointer corresponding to the specifier. 1) If the previously-converted argument was a non-zero integer, the hexadecimal string value will be correctly prefixed with "0x". 2) If there was no previously-converted argument, or if it was zero or a non-integer, the "0x" hexadecimal prefix will be missing. The attached patch fixes this problem, as also reported in bug #28012 http://bugs.php.net/bug.php?id=28012 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! Thanks, Eric Lambart --=-WR4s6FtI3MQlspQtqurV Content-Disposition: attachment; filename=spprintf.c.patch Content-Type: text/x-patch; name=spprintf.c.patch; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Index: spprintf.c =================================================================== RCS file: /repository/php-src/main/spprintf.c,v retrieving revision 1.23 diff -u -r1.23 spprintf.c --- spprintf.c 8 Mar 2004 23:11:44 -0000 1.23 +++ spprintf.c 15 Apr 2004 20:41:46 -0000 @@ -646,7 +646,7 @@ ui_num = (u_wide_int)((size_t) va_arg(ap, char *)); s = ap_php_conv_p2(ui_num, 4, 'x', &num_buf[NUM_BUF_SIZE], &s_len); - if (i_num != 0) { + if (ui_num != 0) { *--s = 'x'; *--s = '0'; s_len += 2; --=-WR4s6FtI3MQlspQtqurV--