]> granicus.if.org Git - php/commitdiff
add test
authorAntony Dovgal <tony2001@php.net>
Wed, 5 Apr 2006 12:29:35 +0000 (12:29 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 5 Apr 2006 12:29:35 +0000 (12:29 +0000)
ext/standard/tests/strings/bug36944.phpt [new file with mode: 0644]

diff --git a/ext/standard/tests/strings/bug36944.phpt b/ext/standard/tests/strings/bug36944.phpt
new file mode 100644 (file)
index 0000000..bbcc8a2
--- /dev/null
@@ -0,0 +1,26 @@
+--TEST--
+fix #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(1)
+int(0)
+
+Warning: Length must be greater than or equal to 0 in %s on line %d
+bool(false)
+int(15)
+int(0)
+Done