summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--php-5.4.9-json.patch76
-rw-r--r--php54.spec10
2 files changed, 85 insertions, 1 deletions
diff --git a/php-5.4.9-json.patch b/php-5.4.9-json.patch
new file mode 100644
index 0000000..73db3a9
--- /dev/null
+++ b/php-5.4.9-json.patch
@@ -0,0 +1,76 @@
+diff -up php-5.4.9/ext/json/config.m4.63588 php-5.4.9/ext/json/config.m4
+--- php-5.4.9/ext/json/config.m4.63588 2012-11-23 14:48:42.934043358 +0100
++++ php-5.4.9/ext/json/config.m4 2012-11-23 14:48:58.237102616 +0100
+@@ -9,7 +9,7 @@ if test "$PHP_JSON" != "no"; then
+ AC_DEFINE([HAVE_JSON],1 ,[whether to enable JavaScript Object Serialization support])
+ AC_HEADER_STDC
+
+- PHP_NEW_EXTENSION(json, json.c utf8_to_utf16.c utf8_decode.c JSON_parser.c, $ext_shared)
++ PHP_NEW_EXTENSION(json, json.c utf8_decode.c JSON_parser.c, $ext_shared)
+ PHP_INSTALL_HEADERS([ext/json], [php_json.h])
+ PHP_SUBST(JSON_SHARED_LIBADD)
+ fi
+diff -up php-5.4.9/ext/json/json.c.63588 php-5.4.9/ext/json/json.c
+--- php-5.4.9/ext/json/json.c.63588 2012-11-23 14:48:28.038987099 +0100
++++ php-5.4.9/ext/json/json.c 2012-11-23 14:51:37.780705594 +0100
+@@ -25,8 +25,8 @@
+ #include "php.h"
+ #include "php_ini.h"
+ #include "ext/standard/info.h"
++#include "ext/standard/html.h"
+ #include "ext/standard/php_smart_str.h"
+-#include "utf8_to_utf16.h"
+ #include "JSON_parser.h"
+ #include "php_json.h"
+ #include <zend_exceptions.h>
+@@ -344,6 +344,32 @@ static void json_encode_array(smart_str
+ }
+ /* }}} */
+
++static int json_utf8_to_utf16(unsigned short *utf16, char utf8[], int len) /* {{{ */
++{
++ size_t pos = 0, us;
++ int j, status;
++
++ for (j=0 ; pos < len ; j++) {
++ us = php_next_utf8_char((const unsigned char *)utf8, len, &pos, &status);
++ if (status != SUCCESS) {
++ return -1;
++ }
++ if (utf16) {
++ /* From http://en.wikipedia.org/wiki/UTF16 */
++ if (us >= 0x10000) {
++ us -= 0x10000;
++ utf16[j++] = (unsigned short)((us >> 10) | 0xd800);
++ utf16[j] = (unsigned short)((us & 0x3ff) | 0xdc00);
++ } else {
++ utf16[j] = (unsigned short)us;
++ }
++ }
++ }
++ return j;
++}
++/* }}} */
++
++
+ #define REVERSE16(us) (((us & 0xf) << 12) | (((us >> 4) & 0xf) << 8) | (((us >> 8) & 0xf) << 4) | ((us >> 12) & 0xf))
+
+ static void json_escape_string(smart_str *buf, char *s, int len, int options TSRMLS_DC) /* {{{ */
+@@ -383,7 +409,7 @@ static void json_escape_string(smart_str
+ }
+
+ utf16 = (options & PHP_JSON_UNESCAPED_UNICODE) ? NULL : (unsigned short *) safe_emalloc(len, sizeof(unsigned short), 0);
+- ulen = utf8_to_utf16(utf16, s, len);
++ ulen = json_utf8_to_utf16(utf16, s, len);
+ if (ulen <= 0) {
+ if (utf16) {
+ efree(utf16);
+@@ -628,7 +654,7 @@ PHP_JSON_API void php_json_decode_ex(zva
+
+ utf16 = (unsigned short *) safe_emalloc((str_len+1), sizeof(unsigned short), 1);
+
+- utf16_len = utf8_to_utf16(utf16, str, str_len);
++ utf16_len = json_utf8_to_utf16(utf16, str, str_len);
+ if (utf16_len <= 0) {
+ if (utf16) {
+ efree(utf16);
diff --git a/php54.spec b/php54.spec
index b67d77c..8a259d9 100644
--- a/php54.spec
+++ b/php54.spec
@@ -69,7 +69,7 @@ Version: 5.4.9
%if 0%{?snapdate:1}%{?rcver:1}
Release: 0.5.%{?snapdate}%{?rcver}%{?dist}
%else
-Release: 1%{?dist}
+Release: 2%{?dist}
%endif
# All files licensed under PHP version 3.01, except
# Zend is licensed under Zend
@@ -101,6 +101,8 @@ Patch7: php-5.3.0-recode.patch
Patch8: php-5.4.7-libdb.patch
# https://bugs.php.net/63361 - Header not installed
Patch9: php-5.4.8-mysqli.patch
+# See http://bugs.php.net/63588
+Patch10: php-5.4.9-json.patch
# Fixes for extension modules
# https://bugs.php.net/63126 - DISABLE_AUTHENTICATOR ignores array
@@ -759,6 +761,8 @@ httpd -V | grep -q 'threaded:.*yes' && exit 1
%patch7 -p1 -b .recode
%patch8 -p1 -b .libdb
%patch9 -p1 -b .mysqliheaders
+%patch10 -p1 -b .63588
+rm -f ext/json/utf8_to_utf16.*
%patch20 -p1 -b .imap
%patch21 -p1 -b .odbctimer
@@ -1615,6 +1619,10 @@ fi
%changelog
+* Fri Nov 23 2012 Remi Collet <remi@fedoraproject.org> 5.4.9-2
+- add patch for https://bugs.php.net/63588
+ duplicated implementation of php_next_utf8_char
+
* Thu Nov 22 2012 Remi Collet <remi@fedoraproject.org> 5.4.9-1
- update to 5.4.9