#46214 [Opn->Bgs]: strpos() returns varying results

From: Date: Tue, 07 Oct 2008 12:25:25 +0000
Subject: #46214 [Opn->Bgs]: strpos() returns varying results
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-129537@lists.php.net to get a copy of this message
ID: 46214 Updated by: jani@php.net Reported By: dimedrol at tut dot by -Status: Open +Status: Bogus Bug Type: Strings related Operating System: GNU/Linux i686 2.6.9 PHP Version: 5.2.6 New Comment: Yes, use mbstring. No bug here. Previous Comments: ------------------------------------------------------------------------ [2008-10-01 18:13:55] dimedrol at tut dot by In my sample code cyrillic characters were replaced by unicode escape sequences. Please note that originally they were single-byte cp-1251 characters. ------------------------------------------------------------------------ [2008-10-01 18:11:55] dimedrol at tut dot by 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('&#1074;&#1072;&#1089;&#1103;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 this bug report at http://bugs.php.net/?id=46214&edit=1

« previous php.bugs (#129537) next »