php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33273 Use of certain kanji characters make PHP crash
Submitted: 2005-06-08 10:47 UTC Modified: 2005-06-08 16:27 UTC
From: lars dot jensen at careercross dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.0.3 OS: FreeBSD 5.3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: lars dot jensen at careercross dot com
New email:
PHP Version: OS:

 

 [2005-06-08 10:47 UTC] lars dot jensen at careercross dot com
Description:
------------
Certain Kanji direct in source seems to be a problem - wanted to use a small array for some simple language changes between english / japanese, but with these given kanji's it fail.

Viewing the Kanji's as ascii, they both hold " in it, but closing the array strings using ', it shouldnt affect the strings.

Example provided at http://www.ebenkyo.com/bug.php

/ Lars

Reproduce code:
---------------
As the code holds kanji characters, use this page to see the source. Please ensure to see the page using shift_jis encoding

http://www.ebenkyo.com/bug_source.php

Expected result:
----------------
The array not to fail with given Kanji's. Most Kanji sequences seem to work.

Actual result:
--------------
Parse error: parse error, unexpected T_STRING, expecting ')' in /usr/local/www/www.ebenkyo.com/bug.php on line 4

or similar

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-08 16:17 UTC] nick dot telford at ntlworld dot com
If that source is causing that error it's not because of the kanji sequences. You've got an extra comma (,) at the end of your array() statement.

Your code:
$foo = array (
         'One Text' => 'some kanji',
         'Another Text' => 'more kanji',
       );

The last comma, should not be present, as PHP expects another argument to follow it. Simply remove it:
$foo = array (
         'One Text' => 'some kanji',
         'Another Text' => 'more kanji'
       );

On a related note, if you wish to code using non-western character sets, full Unicode support is being added into PHP5 (most likely, the next major release after 5.1 will have it). This should be of great use to you when it's released.

Nicholas Telford
 [2005-06-08 16:20 UTC] derick@php.net
Nicholas, that is bullshit. You can have trailing comma's in arrays - just like in C. And Unicode is also not added in PHP 5 or PHp 5.1. Please refrain from commenting if you're not 100% sure about things.
 [2005-06-08 16:21 UTC] lars dot jensen at careercross dot com
This was a very stripped down version, if I exchange the kanji with say "abc", it works fine. It also works with other kanji sequences, katakana, hiragana ect. 

These two samples is the only two out of about 75 causing problems
 [2005-06-08 16:23 UTC] derick@php.net
It's because in latin one it looks like this:
'One Text'=>'‹@”\',

you see the \ in the last char 能 escaping the '.
 [2005-06-08 16:24 UTC] derick@php.net
So this is not a bug as PHP simply doesn't support this yet.
 [2005-06-08 16:27 UTC] lars dot jensen at careercross dot com
Any idea when to expect support for this ? 
Will need to develop a workaround tomorrow anyway as we need the given kanji's in the included language file
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 09:01:26 2024 UTC