Description
In the strcmp() doc it says:
8.2.0 This function now returns -1 or 1, where it previously returned a negative or positive number.
However I the following code:
<?php echo strcmp("3", "1")."\n";
Resulted in this output:
But I expected this output instead:
The same problem exists for strncmp() and strncasecmp().
A fix is to change this line in zend_binary_strcmp() and zend_binary_strncmp() in zend_operators.c:
return retval;
to
return retval<0?-1:1;
PHP Version
PHP 8.4.1
Operating System
Debian bookworm