Index: Zend/zend_builtin_functions.c =================================================================== RCS file: /repository/ZendEngine2/zend_builtin_functions.c,v retrieving revision 1.277.2.11 diff -u -p -d -r1.277.2.11 zend_builtin_functions.c --- Zend/zend_builtin_functions.c 28 Mar 2006 19:43:21 -0000 1.277.2.11 +++ Zend/zend_builtin_functions.c 4 Apr 2006 20:57:34 -0000 @@ -314,6 +314,12 @@ ZEND_FUNCTION(strncmp) convert_to_string_ex(s1); convert_to_string_ex(s2); convert_to_long_ex(s3); + + if (Z_LVAL_PP(s3) < 0) { + zend_error(E_WARNING, "Length must be greater than or equal to 0"); + RETURN_FALSE; + } + RETURN_LONG(zend_binary_zval_strncmp(*s1, *s2, *s3)); } /* }}} */ @@ -347,6 +353,12 @@ ZEND_FUNCTION(strncasecmp) convert_to_string_ex(s1); convert_to_string_ex(s2); convert_to_long_ex(s3); + + if (Z_LVAL_PP(s3) < 0) { + zend_error(E_WARNING, "Length must be greater than or equal to 0"); + RETURN_FALSE; + } + RETURN_LONG(zend_binary_zval_strncasecmp(*s1, *s2, *s3)); } /* }}} */