[php-src] Issue #13243: intval() with negative base prefixed string does not detect base

From: Date: Thu, 25 Jan 2024 18:20:57 +0000
Subject: [php-src] Issue #13243: intval() with negative base prefixed string does not detect base
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-246339@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/13243 Author: Girgias ### Description The following code: ```php <?php $s = "-0b11111111111111111111111111111111111111111111111111111111111111111111111111111"; $v1 = intval($s, 2); var_dump($v1); $v2 = intval($s); var_dump($v2); var_dump((int) $s); ``` Resulted in this output: ``` int(-9223372036854775808) int(0) int(0) ``` But I expected this output instead: ``` int(-9223372036854775808) int(-9223372036854775808) int(0) ``` Similarly, if we use `$base = 16` Note the `0o` prefix is not supported (which is what initially led me down this rabbit hole). ### PHP Version PHP 8.3 ### Operating System _No response_

« previous php.bugs (#246339) next »