From:             sivann at cs dot ntua dot gr
Operating system: Linux
PHP version:      5.1.4
PHP Bug Type:     Unknown/Other Function
Bug description:  erroneous parameter check in substr_compare 

Description:
------------
substr_compare shouldn't output warning and return FALSE if the "length"
parameter *equals* the length of main_str. It should do that only if
length > strlen(main_str). 

Moreover an invalid error is returned: "The start position cannot exceed
initial string length" even if specifying start position 0.

This error didn't exist in version 5.1.0.

Reproduce code:
---------------
echo substr_compare("abcd","abcd",0,4);




Expected result:
----------------
it should do the same as this (return 0):
echo substr_compare("abcd","abcd",0);


Actual result:
--------------
Warning: substr_compare() [function.substr-compare]: The start position
cannot exceed initial string length in ...

-- 
Edit bug report at http://bugs.php.net/?id=37394&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=37394&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=37394&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=37394&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=37394&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=37394&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=37394&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=37394&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=37394&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=37394&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=37394&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=37394&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=37394&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=37394&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37394&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=37394&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=37394&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=37394&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37394&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=37394&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=37394&r=mysqlcfg

Reply via email to