I suppose PHP can't autodetect SJIS encoding and needs a hint

for 5.4

$ php -d zend.multibyte=1 -d zend.script_encoding=SJIS sjis.php

5.3 must be compiled with --enable-zend-multibyte, then

$ php -d mbstring.script_encoding=SJIS for 5.3

(I've just tested 5.4 but not 5.3. Just don't have 5.3 compiled with --enable-zend-multibyte).

Thanks. Dmitry.


On 11/03/2011 12:12 PM, Yasuo Ohgaki wrote:
Hi Dimity&  Rui,

I was trying to see if PHP 5.4 and trunk was also affected by this bug report.

--with-zend-multibyte and --enable-debug reports LEAK with run-test.php
https://bugs.php.net/bug.php?id=60194

So I configured as "./configure --enable-debug"

Sorry for being a lazy reader. I could turn on zend.multibyte with
"--enable-mbstring".
Now I see PHP 5.3 doesn't have dependency to mbstring, but PHP 5.4+ has.
I haven't read the last sentence.Thanks.

It looks like php-src-5.4 doesn't has leaks as PHP 5.3 does.
(I haven't completed the test, since it seems zend.multibyte is NOT working)

$ TEST_PHP_EXECUTABLE=./sapi/cli/php ./run-tests.php -m -c ./php.ini

=====================================================================
PHP         : ./sapi/cli/php
PHP_SAPI    : cli
PHP_VERSION : 5.4.0RC1-dev
ZEND_VERSION: 2.4.0
PHP_OS      : Linux - Linux dev.inter.es-i.jp 2.6.35.14-2m.mo7.x86_64
#1 SMP Mon Sep 12 11:09:50 JST 2011 x86_64
INI actual  : /home/yohgaki/ext/svn/oss/php.net/php-src-5.4/php.ini
More .INIs  :
CWD         : /home/yohgaki/ext/svn/oss/php.net/php-src-5.4
Extra dirs  :
VALGRIND    : valgrind-3.6.1
=====================================================================
TIME START 2011-11-03 16:36:57
=====================================================================
PASS EXPECT [tests/run-test/test001.phpt]
PASS EXPECTF [tests/run-test/test002.phpt]
PASS EXPECTREGEX [tests/run-test/test003.phpt]
.....

However, I got the same parse error, as Rui mentioned, with SJIS source script.

sjis.php
----
<?php
echo '表';
----
(You cannot copy&paste, since this would be UTF-8. If you need
  file, let me know. I'll directly mail you.)

表 is valid SJIS char code and has \ as second byte.
Since PHP complains with parse error, it seems zend.multibyte is not working on
PHP 5.4.

$ ./sapi/cli/php -i | grep multibyte
zend.multibyte =>  On =>  On
$ ./sapi/cli/php /usr/local/apache2.0/htdocs/sjis.php
PHP Parse error:  syntax error, unexpected ''�\';'
(T_ENCAPSED_AND_WHITESPACE) in /usr/local/apache2.0/htdocs/sjis.php on
line 2

It seems like working with zend.multibyte=Off.

Regards,

--
Yasuo Ohgaki
yohg...@ohgaki.net


On Thu, Nov 3, 2011 at 4:09 PM, Dmitry Stogov<dmi...@zend.com>  wrote:
Hi Yasuo,

how did you see that "Zend Multibyte Support" weren't enabled?

$ sapi/cli/php -d zend.multibyte=1 -i | grep -i multibyte

Zend Multibyte Support =>  provided by mbstring
zend.multibyte =>  On =>  On ******
Multibyte Support =>  enabled
Multibyte string engine =>  libmbfl
Multibyte (japanese) regex support =>  enabled
Multibyte regex (oniguruma) backtrack check =>  On
Multibyte regex (oniguruma) version =>  4.7.1

Thanks. Dmitry.


On 11/03/2011 04:32 AM, Yasuo Ohgaki wrote:

Hi all,

I noticed that "Zend Multibyte Support" won't be on with

./sapi/cli/php -d zend.multibyte=1
nor
zend.multibyte=on (in php.ini)

This happens both php-src and php-src-5.4.

According to php.ini-production from php-src:
; If enabled, scripts may be written in encodings that are incompatible
with
; the scanner.  CP936, Big5, CP949 and Shift_JIS are the examples of such
; encodings.  To use this feature, mbstring extension must be enabled.
; Default: Off
;zend.multibyte = Off

I thought it became runtime option.
Is this a bug or am I missing something?

--
Yasuo Ohgaki
yohg...@ohgaki.net





--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to