From:             datibbaw
Operating system: NA
PHP version:      Irrelevant
Package:          Unknown/Other Function
Bug Type:         Feature/Change Request
Bug description:substr_compare and case sensitivity

Description:
------------
The $length parameter of this function is optional in the documentation,
but 
currently it can't be skipped to only set the case sensitivity flag. Values
like 
null or false get converted into 0 which causes a warning and the function
returns 
false.

Using null to skip the $length parameter would be nice.

Test script:
---------------
<?php

// should output: 0
echo substr_compare("hello World", "world", 6, null, true), PHP_EOL;

?>

Expected result:
----------------
0

Actual result:
--------------
Warning: substr_compare(): The length must be greater than zero

-- 
Edit bug report at https://bugs.php.net/bug.php?id=55451&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=55451&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=55451&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=55451&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=55451&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=55451&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=55451&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=55451&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=55451&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=55451&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=55451&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=55451&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=55451&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=55451&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=55451&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=55451&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=55451&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=55451&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=55451&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=55451&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=55451&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=55451&r=mysqlcfg

Reply via email to