Bug #13339 Updated: sscanf returns wrong result

From: Date: Tue, 18 Sep 2001 06:34:17 +0000
Subject: Bug #13339 Updated: sscanf returns wrong result
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-66158@lists.php.net to get a copy of this message
ID: 13339 Updated by: derick Reported By: dev@generalprotectionfault.de Old Status: Closed Status: Open Bug Type: Variables related Operating System: Windows NT 4.0 PHP Version: 4.0.6 New Comment: Please use the Web system for answerring. User update: You said php4 uses signed integers, so please explain that: // - - - - - - - - - - - - - - - - - - list($x) = sscanf( 'ffffffff', '%x' ); printf("%x<br>",$x); $x = pow(2,32)-1; echo $x , "<br>"; $y = ( $x >> 16 ) & 0xFFFF ; $x &= 0xFFFF; printf("%x%x<br>",$y,$x); // - - - - - - - - - - - - - - - - - - Result: 7fffffff 4294967295 ffffffff Previous Comments: ------------------------------------------------------------------------ [2001-09-17 05:53:29] derick@php.net This is not weird, PHP's int are signed integers. 0xac00000 is too large for that. Derick ------------------------------------------------------------------------ [2001-09-17 05:50:38] dev@generalprotectionfault.de I've tried this: list($x) = sscanf( 'ac100000', '%x' ); printf("%x",$x); And I got "7fffffff", weird. ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=13339&edit=1

« previous php.dev (#66158) next »