From:             llongo at sata-hts dot com
Operating system: Linux CentOS 5
PHP version:      5.2.8
PHP Bug Type:     Strings related
Bug description:  strlen return wrong character number with one chars sequense

Description:
------------
Passing to strlen a string with a particular sequence of characters
(binary + ascii), strlen returns the wrong number of characters.

The architecture of the host where the problem has happened is x86_64

The php configure is:
./configure --with-openssl --with-zlib --enable-zip --with-pear --with-
mysql --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-shmop
--enable-pcntl --enable-bcmath --with-apxs
2 --with-gettext --with-gdbm --enable-sockets --enable-mbstring
--with-imap-ssl --with-libdir=lib64

Reproduce code:
---------------
$pack_str = pack("N",240); // binary string
$msg = "<msg>"; // ascii string
echo "pack_str: ".strlen($pack_str)."\n"; // OK
echo "msg: ".strlen($msg)."\n"; // OK
$new_str = $pack_str.$msg;
echo "strlen: ".strlen($new_str)."\n"; // KO

Expected result:
----------------
The expected result of last echo is:
strlen: 9

Actual result:
--------------
The actual result of last echo is:
strlen: 6

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

Reply via email to