php-src/ext/standard/tests/strings/bug36944.phpt
Antony Dovgal 522a5e128f ok, let's make this test to work on all systems
currently it fails at least on Linux PPC and Solaris, probably because of different strncmp/strncasecmp implementations.
2006-04-14 20:30:11 +00:00

27 lines
567 B
PHP

--TEST--
Bug #36944 (strncmp & strncasecmp do not return false on negative string length)
--FILE--
<?php
var_dump(strncmp("test ", "e", -1));
var_dump(strncmp("test ", "e", 10));
var_dump(strncmp("test ", "e", 0));
var_dump(strncasecmp("test ", "E", -1));
var_dump(strncasecmp("test ", "E", 10));
var_dump(strncasecmp("test ", "E", 0));
echo "Done\n";
?>
--EXPECTF--
Warning: Length must be greater than or equal to 0 in %s on line %d
bool(false)
int(%d)
int(0)
Warning: Length must be greater than or equal to 0 in %s on line %d
bool(false)
int(%d)
int(0)
Done