php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #63588 Duplicate implementation of php_next_utf8_char
Submitted: 2012-11-23 13:27 UTC Modified: 2012-11-24 13:04 UTC
From: remi@php.net Assigned: remi (profile)
Status: Closed Package: json (PECL)
PHP Version: 5.4.9 OS: GNU/Linux (Fedora 18)
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: remi@php.net
New email:
PHP Version: OS:

 

 [2012-11-23 13:27 UTC] remi@php.net
Description:
------------
The json extension provides a duplicate implementation of php_next_utf8_char.

This is also related to Bug #63520

The attached patch use php_next_utf8_char function and allow to drop "utf8_to_utf16.*" non really free files from PHP sources.

All the json unit tests succeed with the patch applied.

It seems, there is also a small performance gain (~5% on very large json_encode)


Patches

php-5.4.9-json.patch (last revision 2012-11-23 14:14 UTC by remi@php.net)
json.patch (last revision 2012-11-23 13:27 UTC by remi)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-23 14:14 UTC] remi@php.net
The following patch has been added/updated:

Patch Name: php-5.4.9-json.patch
Revision:   1353680080
URL:        https://bugs.php.net/patch-display.php?bug=63588&patch=php-5.4.9-json.patch&revision=1353680080
 [2012-11-24 13:04 UTC] pajoye@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: remi
 [2012-11-25 07:20 UTC] remi@php.net
-Status: Assigned +Status: Closed
 [2012-11-25 07:20 UTC] remi@php.net
Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=289bb339c9e722ff3017ec58fdef7300f39b8e6d
Log: Fixed bug #63588 Duplicate implementation of php_next_utf8_char
 [2012-11-25 07:20 UTC] remi@php.net
Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=289bb339c9e722ff3017ec58fdef7300f39b8e6d
Log: Fixed bug #63588 Duplicate implementation of php_next_utf8_char
 [2012-11-25 07:21 UTC] remi@php.net
Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=289bb339c9e722ff3017ec58fdef7300f39b8e6d
Log: Fixed bug #63588 Duplicate implementation of php_next_utf8_char
 [2012-11-25 12:14 UTC] yoram dot b at zend dot com
The patch looks fine, except of testing for true value of utf16 in each iteration. it might be the cause of the performance degradation, if you compiled without proper optimizations.
 [2012-11-26 09:29 UTC] remi@php.net
@yoram: the previous implementation have the same problem.

    for (;;) {
    ...
            if (w) {
    ...

For now, there is no performance degradation, but a small improvement (according to my quick bench, ~5%)

Of course we can optimize this (and probably also the "bits" handling in json_escape_string, avoid the REVERSE code and make it more readable)

   smart_str_appendl(buf, "\\u", 2);
   smart_str_appendc(buf, digits[(us & 0xf000) >> 12]);
   smart_str_appendc(buf, digits[(us & 0xf00)  >> 8]);
   smart_str_appendc(buf, digits[(us & 0xf0)   >> 4]);
   smart_str_appendc(buf, digits[(us & 0xf)]);
 [2012-12-19 17:55 UTC] derick@php.net
Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=289bb339c9e722ff3017ec58fdef7300f39b8e6d
Log: Fixed bug #63588 Duplicate implementation of php_next_utf8_char
 [2014-10-07 23:21 UTC] stas@php.net
Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=289bb339c9e722ff3017ec58fdef7300f39b8e6d
Log: Fixed bug #63588 Duplicate implementation of php_next_utf8_char
 [2014-10-07 23:32 UTC] stas@php.net
Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=289bb339c9e722ff3017ec58fdef7300f39b8e6d
Log: Fixed bug #63588 Duplicate implementation of php_next_utf8_char
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 15:01:30 2024 UTC