jani                                     Thu, 23 Jul 2009 14:54:04 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=284649

Log:
- Fixed bug #48802 (printf() returns incorrect outputted length)

Bug: http://bugs.php.net/48802 (Assigned) printf() returns incorrect outputted 
length
      
Changed paths:
    U   php/php-src/branches/PHP_5_2/NEWS
    U   php/php-src/branches/PHP_5_2/ext/standard/formatted_print.c
    U   php/php-src/branches/PHP_5_2/sapi/cli/php_cli.c
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/standard/formatted_print.c
    U   php/php-src/branches/PHP_5_3/sapi/cli/php_cli.c
    U   php/php-src/trunk/ext/standard/formatted_print.c
    U   php/php-src/trunk/sapi/cli/php_cli.c

Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS   2009-07-23 14:42:46 UTC (rev 284648)
+++ php/php-src/branches/PHP_5_2/NEWS   2009-07-23 14:54:04 UTC (rev 284649)
@@ -13,6 +13,7 @@
   option is an array). (David Zülke)
 - Fixed bug #48913 (Too long error code strings in pdo_odbc driver).
   (naf at altlinux dot ru, Felipe)
+- Fixed bug #48802 (printf() returns incorrect outputted length). (Jani)
 - Fixed bug #48788 (RecursiveDirectoryIterator doesn't descend into symlinked
   directories). (Ilia)
 - Fixed bug #48763 (ZipArchive produces corrupt archive). (dani dot church at

Modified: php/php-src/branches/PHP_5_2/ext/standard/formatted_print.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/standard/formatted_print.c 2009-07-23 
14:42:46 UTC (rev 284648)
+++ php/php-src/branches/PHP_5_2/ext/standard/formatted_print.c 2009-07-23 
14:54:04 UTC (rev 284649)
@@ -700,14 +700,14 @@
 PHP_FUNCTION(user_printf)
 {
        char *result;
-       int len;
+       int len, rlen;

        if ((result=php_formatted_print(ht, &len, 0, 0 TSRMLS_CC))==NULL) {
                RETURN_FALSE;
        }
-       PHPWRITE(result, len);
+       rlen = PHPWRITE(result, len);
        efree(result);
-       RETURN_LONG(len);
+       RETURN_LONG(rlen);
 }
 /* }}} */

@@ -716,14 +716,14 @@
 PHP_FUNCTION(vprintf)
 {
        char *result;
-       int len;
+       int len, rlen;

        if ((result=php_formatted_print(ht, &len, 1, 0 TSRMLS_CC))==NULL) {
                RETURN_FALSE;
        }
-       PHPWRITE(result, len);
+       rlen = PHPWRITE(result, len);
        efree(result);
-       RETURN_LONG(len);
+       RETURN_LONG(rlen);
 }
 /* }}} */


Modified: php/php-src/branches/PHP_5_2/sapi/cli/php_cli.c
===================================================================
--- php/php-src/branches/PHP_5_2/sapi/cli/php_cli.c     2009-07-23 14:42:46 UTC 
(rev 284648)
+++ php/php-src/branches/PHP_5_2/sapi/cli/php_cli.c     2009-07-23 14:54:04 UTC 
(rev 284649)
@@ -298,7 +298,7 @@
                remaining -= ret;
        }

-       return str_length;
+       return (ptr - str);
 }
 /* }}} */


Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2009-07-23 14:42:46 UTC (rev 284648)
+++ php/php-src/branches/PHP_5_3/NEWS   2009-07-23 14:54:04 UTC (rev 284649)
@@ -14,17 +14,18 @@
   (Greg)
 - Fixed bug #49018 (phar tar stores long filenames wit prefix/name reversed).
   (Greg)
+- Fixed bug #49014 (dechunked filter broken when serving more than 8192 bytes 
in
+  a chunk). (andreas dot streichardt at globalpark dot com, Ilia)
 - Fixed bug #48962 (cURL does not upload files with specified filename).
   (Ilia)
 - Fixed bug #48929 (Double \r\n after HTTP headers when "header" context
   option is an array). (David Zülke)
-- Fixed bug #49014 (dechunked filter broken when serving more than 8192 bytes 
in
-  a chunk) (andreas dot streichardt at globalpark dot com, Ilia)
 - Fixed bug #48899 (is_callable returns true even if method does not exist in
   parent class). (Felipe)
 - Fixed bug #48893 (Problems compiling with Curl). (Felipe)
 - Fixed bug #48854 (array_merge_recursive modifies arrays after first one).
   (Felipe)
+- Fixed bug #48802 (printf() returns incorrect outputted length). (Jani)
 - Fixed bug #48788 (RecursiveDirectoryIterator doesn't descend into symlinked
   directories). (Ilia)
 - Fixed bug #48771 (rename() between volumes fails and reports no error on

Modified: php/php-src/branches/PHP_5_3/ext/standard/formatted_print.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/formatted_print.c 2009-07-23 
14:42:46 UTC (rev 284648)
+++ php/php-src/branches/PHP_5_3/ext/standard/formatted_print.c 2009-07-23 
14:54:04 UTC (rev 284649)
@@ -697,14 +697,14 @@
 PHP_FUNCTION(user_printf)
 {
        char *result;
-       int len;
+       int len, rlen;

        if ((result=php_formatted_print(ht, &len, 0, 0 TSRMLS_CC))==NULL) {
                RETURN_FALSE;
        }
-       PHPWRITE(result, len);
+       rlen = PHPWRITE(result, len);
        efree(result);
-       RETURN_LONG(len);
+       RETURN_LONG(rlen);
 }
 /* }}} */

@@ -713,14 +713,14 @@
 PHP_FUNCTION(vprintf)
 {
        char *result;
-       int len;
+       int len, rlen;

        if ((result=php_formatted_print(ht, &len, 1, 0 TSRMLS_CC))==NULL) {
                RETURN_FALSE;
        }
-       PHPWRITE(result, len);
+       rlen = PHPWRITE(result, len);
        efree(result);
-       RETURN_LONG(len);
+       RETURN_LONG(rlen);
 }
 /* }}} */


Modified: php/php-src/branches/PHP_5_3/sapi/cli/php_cli.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/cli/php_cli.c     2009-07-23 14:42:46 UTC 
(rev 284648)
+++ php/php-src/branches/PHP_5_3/sapi/cli/php_cli.c     2009-07-23 14:54:04 UTC 
(rev 284649)
@@ -298,7 +298,7 @@
                remaining -= ret;
        }

-       return str_length;
+       return (ptr - str);
 }
 /* }}} */


Modified: php/php-src/trunk/ext/standard/formatted_print.c
===================================================================
--- php/php-src/trunk/ext/standard/formatted_print.c    2009-07-23 14:42:46 UTC 
(rev 284648)
+++ php/php-src/trunk/ext/standard/formatted_print.c    2009-07-23 14:54:04 UTC 
(rev 284649)
@@ -1299,7 +1299,7 @@
    Output a formatted string */
 PHP_FUNCTION(user_printf)
 {
-       int len;
+       int len, rlen;
        zstr result;

        result = php_u_formatted_print(ht, &len, 0, 0, PHP_OUTPUT TSRMLS_CC);
@@ -1307,9 +1307,9 @@
                RETURN_FALSE;
        }

-       PHPWRITE(result.s, len);
+       rlen = PHPWRITE(result.s, len);
        efree(result.v);
-       RETURN_LONG(len);
+       RETURN_LONG(rlen);
 }
 /* }}} */

@@ -1317,7 +1317,7 @@
    Output a formatted string */
 PHP_FUNCTION(vprintf)
 {
-       int len;
+       int len, rlen;
        zstr result;

        result = php_u_formatted_print(ht, &len, 1, 0, PHP_OUTPUT TSRMLS_CC);
@@ -1325,9 +1325,9 @@
                RETURN_FALSE;
        }

-       PHPWRITE(result.s, len);
+       rlen = PHPWRITE(result.s, len);
        efree(result.v);
-       RETURN_LONG(len);
+       RETURN_LONG(rlen);
 }
 /* }}} */


Modified: php/php-src/trunk/sapi/cli/php_cli.c
===================================================================
--- php/php-src/trunk/sapi/cli/php_cli.c        2009-07-23 14:42:46 UTC (rev 
284648)
+++ php/php-src/trunk/sapi/cli/php_cli.c        2009-07-23 14:54:04 UTC (rev 
284649)
@@ -302,7 +302,7 @@
                remaining -= ret;
        }

-       return str_length;
+       return (ptr - str);
 }
 /* }}} */


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to