Hi Stas,

On Mon, Jul 22, 2013 at 10:14 AM, Stas Malyshev <smalys...@sugarcrm.com>wrote:

> Hi!
>
> Building PHP 5.5 with newer compiler on Mac, I'm getting this warning:
>
> /Users/smalyshev/php-5.5/ext/spl/php_spl.c:803:35: warning: format
> specifies type 'unsigned int' but the argument has type 'intptr_t'
>       (aka 'long') [-Wformat]
>         spprintf(&hex, 32, "%016x%016x", hash_handle, hash_handlers);
>                             ~~~~~        ^~~~~~~~~~~
>                             %016lx
> /Users/smalyshev/php-5.5/ext/spl/php_spl.c:803:48: warning: format
> specifies type 'unsigned int' but the argument has type 'intptr_t'
>       (aka 'long') [-Wformat]
>         spprintf(&hex, 32, "%016x%016x", hash_handle, hash_handlers);
>                                  ~~~~~                ^~~~~~~~~~~~~
>                                  %016lx
>
> Which suggests intptr_t there has wrong size. Looks like on 64-bit
> intptr_t would be too long and hash_handlers may not have chance to be
> in the hash. Anybody knows if there's a reason why this code is there?
>

The code is here to build the payload of what will be hashed to make what
spl_object_hash() returns.

I think it is safe to make it %016lx as suggested. Given the nature of this
function it is BC safe, and may indeed result in less collisions.

Best,

Best,


>
> BTW, llvm compiler produces tons of warnings on PHP source, I'm planning
> to get to them, probably next weekend.
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
> (408)454-6900 ext. 227
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Etienne Kneuss
http://www.colder.ch

Reply via email to