You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@apr.apache.org by bu...@apache.org on 2014/02/07 22:07:57 UTC

[Bug 56120] New: Add support for 'z' (size_t) to snprintf

https://issues.apache.org/bugzilla/show_bug.cgi?id=56120

            Bug ID: 56120
           Summary: Add support for 'z' (size_t) to snprintf
           Product: APR
           Version: HEAD
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: APR
          Assignee: bugs@apr.apache.org
          Reporter: aharrison@gmail.com

I noticed this while trying to use %{mod_php_memory_usage} in a LogFormat
directive. The PHP source (sapi_apache2.c) calls apr_psprintf using a %zu
format. Instead of expanding, %zu is written in plain text to the log file.

Doesn't look like many other people have stumbled on this issue, I only turned
up one with this specific problem:

http://stackoverflow.com/questions/21549852/apache-mod-php-memory-usage-prints-zu-instead-of-useful-data

I looked at the glibc source, but %z has existed there for 10+ years.  So I
went looking at the php source. Here is the php commit from May 16, 2011 that
implemented the %zu, but the comment isn't terribly descriptive:  

https://github.com/php/php-src/commit/e0df4e3dba7c4ab92442b9e82c1de01fdbaa3cce

I see that you've implemented other characters to expand over time, so I
thought this would be a good one to add to the list.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


[Bug 56120] Add support for 'z' (size_t) to snprintf

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56120

Jeff Trawick <tr...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|minor                       |enhancement

--- Comment #1 from Jeff Trawick <tr...@apache.org> ---
The z prefix is standard with C99, so it would be nice for APR to support that
in a future release (i.e., starting with APR 1.6 or 2.0).

PHP should be using APR_SIZE_T_FMT, as in the following call:

apr_psprintf(ctx->r->pool, "%" APR_SIZE_T_FMT, zend_memory_peak_usage(1
TSRMLS_CC)));

I posted that to the PHP folks via https://github.com/php/php-src/pull/641.

We'll leave this APR issue open as an enhancement request.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org