From:             homework at aofrozencity dot com
Operating system: Windows 2003 Server
PHP version:      4.3.9
PHP Bug Type:     Strings related
Bug description:  Miscalulcating string length

Description:
------------
'pictures' should be 8 string length. Thought, I got the result. It said
that 'pictures' is 13 string length. It isn't correct. I notice that I use
different words. It shows that string length is added with 5 practically.
You can see that 8 (pcitures) length + 5 add length = 13 string length. I
don't know why it is.

Reproduce code:
---------------
function word_match($a=null,$b=null)
                        {
                                        print("Orginal A: $a<br>");
                                        $a_length = strlen($a);
                                        $b_length = strlen($b);
                                        $search = true;
                                        $length = 0;
                                        while($search)
                                                {
                                                        
if(substr($b,$length,$a_length)==$a)
                                                                {
                                                                        $search 
= false;
                                                                        $result 
= true;
                                                                
}elseif($length>$b_length){
                                                                        
print("<b>Websatellite: A: $a B: $b ($length>$b_length)</b>");
                                                                        $result 
= false;
                                                                        $search 
= false;
                                                                }
                                                        
print("<b><br>Websatellite: ($a_length)
".substr($b,$length,$a_length)."==$a</b>");
                                                        $length++;
                                                }
                                        return $result;
                        }


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

Reply via email to