From: dimedrol at tut dot by
Operating system: GNU/Linux i686 2.6.9
PHP version: 5.2.6
PHP Bug Type: Strings related
Bug description: strpos() returns varying results
Description:
------------
When I run short script below I every time receive different values in
output. It may print 7 and may print 11. PHP-file has encoding cp-1251.
Here's version info from my webserver
-bash-2.05b$ /usr/sbin/httpd -V
Server version: Apache/2.0.63
Server built: Jul 22 2008 23:09:16
Architecture: 32-bit
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/prefork"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D HTTPD_ROOT="/usr/local/apache"
-D SUEXEC_BIN="/usr/local/apache/bin/suexec"
-D DEFAULT_PIDLOG="logs/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_LOCKFILE="logs/accept.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"
Reproduce code:
---------------
<?php
print(strpos('вася12hello[b]','[b]'));
?>
it contains cyrillic characters. If I replace them with latin ones
everything works fine
Expected result:
----------------
I expect 11 to be printed
Actual result:
--------------
Actual results is sometimes 11 and sometimes 7. 7 looks like cyrillic
characters are simply omitted during calculation.
--
Edit bug report at http://bugs.php.net/?id=46214&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=46214&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=46214&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=46214&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46214&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=46214&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46214&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46214&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46214&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46214&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46214&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=46214&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=46214&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46214&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46214&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46214&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46214&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46214&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46214&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46214&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46214&r=mysqlcfg