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?
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
Hi Stas,
On Mon, Jul 22, 2013 at 10:14 AM, Stas Malyshev smalyshev@sugarcrm.comwrote:
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);
~~~~~ ^~~~~~~~~~~~~
%016lxWhich 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--
--
Etienne Kneuss
http://www.colder.ch