mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-22 00:16:38 +00:00
Compare commits
41
Commits
php-5.5.32
...
php-5.5.36
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
527e8e73c9 | ||
|
|
9a826a3bd9 | ||
|
|
f423e1bb89 | ||
|
|
e955913115 | ||
|
|
7a1aac3343 | ||
|
|
97eff7eb57 | ||
|
|
0da8b8b801 | ||
|
|
41fc3c76e9 | ||
|
|
abd159cce4 | ||
|
|
95ed19ae28 | ||
|
|
a4abd2bed9 | ||
|
|
5c571626e3 | ||
|
|
6058b78878 | ||
|
|
9649ca1630 | ||
|
|
008f983ba6 | ||
|
|
61c7a06e7c | ||
|
|
dccda88f27 | ||
|
|
f856734c67 | ||
|
|
082aecfc3a | ||
|
|
d650063a04 | ||
|
|
fd9689745c | ||
|
|
b15f0ecc0f | ||
|
|
8a4d164c2b | ||
|
|
4b0b1cec00 | ||
|
|
f0120ff878 | ||
|
|
551423c642 | ||
|
|
fe13566c93 | ||
|
|
9c19a08b9d | ||
|
|
3dd82caf57 | ||
|
|
f8dd10508b | ||
|
|
64f42c73ef | ||
|
|
95433e8e33 | ||
|
|
72281f29dd | ||
|
|
914d33c40e | ||
|
|
3c8ccdd9d3 | ||
|
|
54df59b729 | ||
|
|
153a44d6bb | ||
|
|
a6fdc5bb27 | ||
|
|
b1bd4119bc | ||
|
|
377d353c9f | ||
|
|
7d875fb9df |
No files matched your search
@@ -1,7 +1,74 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
** PHP 5.5 is in security-only mode , please do not commit to this branch **
|
||||
?? ??? 2016, PHP 5.5.32
|
||||
|
||||
26 May 2016, PHP 5.5.36
|
||||
|
||||
- Core:
|
||||
. Fixed bug #72114 (Integer underflow / arbitrary null write in
|
||||
fread/gzread). (Stas)
|
||||
. Fixed bug #72135 (Integer Overflow in php_html_entities). (Stas)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #72227 (imagescale out-of-bounds read). (Stas)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #72241 (get_icu_value_internal out-of-bounds read). (Stas)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #71331 (Uninitialized pointer in phar_make_dirstream()).
|
||||
(CVE-2016-4343) (Stas)
|
||||
|
||||
28 Apr 2016, PHP 5.5.35
|
||||
|
||||
- BCMath:
|
||||
. Fixed bug #72093 (bcpowmod accepts negative scale and corrupts _one_
|
||||
definition). (Stas)
|
||||
|
||||
- Exif:
|
||||
. Fixed bug #72094 (Out of bounds heap read access in exif header
|
||||
processing). (Stas)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #71912 (libgd: signedness vulnerability) (CVE-2016-3074). (Stas)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #72061 (Out-of-bounds reads in zif_grapheme_stripos with negative
|
||||
offset). (Stas)
|
||||
|
||||
- XML:
|
||||
. Fixed bug #72099 (xml_parse_into_struct segmentation fault). (Stas)
|
||||
|
||||
31 Mar 2016, PHP 5.5.34
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #71527 (Buffer over-write in finfo_open with malformed magic
|
||||
file). (CVE-2015-8865) (Anatol)
|
||||
|
||||
- Mbstring:
|
||||
. Fixed bug #71906 (AddressSanitizer: negative-size-param (-1) in
|
||||
mbfl_strcut). (CVE-2016-4073) (Stas)
|
||||
|
||||
- ODBC:
|
||||
. Fixed bug #71860 (Invalid memory write in phar on filename with \0 in
|
||||
name). (CVE-2016-4072) (Stas)
|
||||
|
||||
- SNMP:
|
||||
. Fixed bug #71704 (php_snmp_error() Format String Vulnerability).
|
||||
(CVE-2016-4071) (andrew at jmpesp dot org)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #71798 (Integer Overflow in php_raw_url_encode). (CVE-2016-4070)
|
||||
(taoguangchen at icloud dot com, Stas)
|
||||
|
||||
03 Mar 2016, PHP 5.5.33
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #71498 (Out-of-Bound Read in phar_parse_zipfile()). (Stas)
|
||||
|
||||
- WDDX:
|
||||
. Fixed bug #71587 (Use-After-Free / Double-Free in WDDX Deserialize). (Stas)
|
||||
|
||||
04 Feb 2016, PHP 5.5.32
|
||||
|
||||
- Core:
|
||||
. Fixed bug #71039 (exec functions ignore length but look for NULL termination).
|
||||
@@ -10,11 +77,20 @@ PHP NEWS
|
||||
input). (Leo Gaspard)
|
||||
. Fixed bug #71459 (Integer overflow in iptcembed()). (Stas)
|
||||
|
||||
- GD:
|
||||
. Improved the fix for bug #70976. (Remi)
|
||||
|
||||
- PCRE:
|
||||
. Upgraded pcrelib to 8.38. (CVE-2015-8383, CVE-2015-8386, CVE-2015-8387,
|
||||
CVE-2015-8389, CVE-2015-8390, CVE-2015-8391, CVE-2015-8393, CVE-2015-8394)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #71354 (Heap corruption in tar/zip/phar parser). (Stas)
|
||||
. Fixed bug #71354 (Heap corruption in tar/zip/phar parser). (CVE-2016-4342)
|
||||
(Stas)
|
||||
. Fixed bug #71391 (NULL Pointer Dereference in phar_tar_setupmetadata()).
|
||||
(Stas)
|
||||
. Fixed bug #71488 (Stack overflow when decompressing tar archives). (Stas)
|
||||
. Fixed bug #71488 (Stack overflow when decompressing tar archives).
|
||||
(CVE-2016-2554) (Stas)
|
||||
|
||||
- WDDX:
|
||||
. Fixed bug #71335 (Type Confusion in WDDX Packet Deserialization). (Stas)
|
||||
@@ -26,7 +102,7 @@ PHP NEWS
|
||||
|
||||
- GD:
|
||||
. Fixed bug #70976 (Memory Read via gdImageRotateInterpolated Array Index
|
||||
Out of Bounds). (emmanuel dot law at gmail dot com).
|
||||
Out of Bounds). (CVE-2016-1903) (emmanuel dot law at gmail dot com).
|
||||
|
||||
- WDDX:
|
||||
. Fixed bug #70661 (Use After Free Vulnerability in WDDX Packet Deserialization).
|
||||
@@ -41,16 +117,18 @@ PHP NEWS
|
||||
01 Oct 2015, PHP 5.5.30
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #69720 (Null pointer dereference in phar_get_fp_offset()). (Stas)
|
||||
. Fixed bug #69720 (Null pointer dereference in phar_get_fp_offset()).
|
||||
(CVE-2015-7803) (Stas)
|
||||
. Fixed bug #70433 (Uninitialized pointer in phar_make_dirstream when zip
|
||||
entry filename is "/"). (Stas)
|
||||
entry filename is "/"). (CVE-2015-7804) (Stas)
|
||||
|
||||
03 Sep 2015, PHP 5.5.29
|
||||
|
||||
- Core:
|
||||
. Fixed bug #70172 (Use After Free Vulnerability in unserialize()). (Stas)
|
||||
. Fixed bug #70172 (Use After Free Vulnerability in unserialize()).
|
||||
(CVE-2015-6834) (Stas)
|
||||
. Fixed bug #70219 (Use after free vulnerability in session deserializer).
|
||||
(taoguangchen at icloud dot com)
|
||||
(CVE-2015-6835) (taoguangchen at icloud dot com)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #70385 (Buffer over-read in exif_read_data with TIFF IFD tag byte
|
||||
@@ -66,20 +144,21 @@ PHP NEWS
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #70388 (SOAP serialize_function_call() type confusion / RCE).
|
||||
(Stas)
|
||||
(CVE-2015-6836) (Stas)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #70365 (Use-after-free vulnerability in unserialize() with
|
||||
SplObjectStorage). (taoguangchen at icloud dot com)
|
||||
SplObjectStorage). (CVE-2015-6834) (taoguangchen at icloud dot com)
|
||||
. Fixed bug #70366 (Use-after-free vulnerability in unserialize() with
|
||||
SplDoublyLinkedList). (taoguangchen at icloud dot com)
|
||||
SplDoublyLinkedList). (CVE-2015-6834) (taoguangchen at icloud dot com)
|
||||
|
||||
- XSLT:
|
||||
. Fixed bug #69782 (NULL pointer dereference). (Stas)
|
||||
. Fixed bug #69782 (NULL pointer dereference). (CVE-2015-6837, CVE-2015-6838)
|
||||
(Stas)
|
||||
|
||||
- ZIP:
|
||||
. Fixed bug #70350 (ZipArchive::extractTo allows for directory traversal when
|
||||
creating directories). (neal at fb dot com)
|
||||
creating directories). (CVE-2014-9767) (neal at fb dot com)
|
||||
|
||||
06 Aug 2015, PHP 5.5.28
|
||||
|
||||
@@ -94,12 +173,12 @@ PHP NEWS
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #70014 (openssl_random_pseudo_bytes() is not cryptographically
|
||||
secure). (Stas)
|
||||
secure). (CVE-2015-8867) (Stas)
|
||||
|
||||
- Phar:
|
||||
. Improved fix for bug #69441. (Anatol Belski)
|
||||
. Fixed bug #70019 (Files extracted from archive may be placed outside of
|
||||
destination directory). (Anatol Belski)
|
||||
destination directory). (CVE-2015-6833) (Anatol Belski)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #70081 (SoapClient info leak / null pointer dereference via
|
||||
@@ -107,13 +186,13 @@ PHP NEWS
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #70068 (Dangling pointer in the unserialization of ArrayObject
|
||||
items). (sean.heelan)
|
||||
items). (CVE-2015-6832) (sean.heelan)
|
||||
. Fixed bug #70166 (Use After Free Vulnerability in unserialize() with
|
||||
SPLArrayObject). (taoguangchen at icloud dot com)
|
||||
SPLArrayObject). (CVE-2015-6831) (taoguangchen at icloud dot com)
|
||||
. Fixed bug #70168 (Use After Free Vulnerability in unserialize() with
|
||||
SplObjectStorage). (taoguangchen at icloud dot com)
|
||||
SplObjectStorage). (CVE-2015-6831) (taoguangchen at icloud dot com)
|
||||
. Fixed bug #70169 (Use After Free Vulnerability in unserialize() with
|
||||
SplDoublyLinkedList). (taoguangchen at icloud dot com)
|
||||
SplDoublyLinkedList). (CVE-2015-6831) (taoguangchen at icloud dot com)
|
||||
|
||||
9 Jul 2015, PHP 5.5.27
|
||||
|
||||
@@ -184,7 +263,8 @@ PHP NEWS
|
||||
heap overflow). (CVE-2015-4643) (Max Spelsberg)
|
||||
. Fixed bug #69646 (OS command injection vulnerability in escapeshellarg).
|
||||
(CVE-2015-4642) (Anatol Belski)
|
||||
. Fixed bug #69719 (Incorrect handling of paths with NULs). (Stas)
|
||||
. Fixed bug #69719 (Incorrect handling of paths with NULs). (CVE-2015-4598)
|
||||
(Stas)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #69479 (GD fails to build with newer libvpx). (Remi)
|
||||
|
||||
@@ -1254,6 +1254,10 @@ ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2)
|
||||
int length = Z_STRLEN_P(op1) + 1;
|
||||
char *buf;
|
||||
|
||||
if (UNEXPECTED(length < 0)) {
|
||||
zend_error(E_ERROR, "String size overflow");
|
||||
}
|
||||
|
||||
if (IS_INTERNED(Z_STRVAL_P(op1))) {
|
||||
buf = (char *) emalloc(length + 1);
|
||||
memcpy(buf, Z_STRVAL_P(op1), Z_STRLEN_P(op1));
|
||||
@@ -1273,6 +1277,9 @@ ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2
|
||||
int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2);
|
||||
char *buf;
|
||||
|
||||
if (UNEXPECTED(length < 0)) {
|
||||
zend_error(E_ERROR, "String size overflow");
|
||||
}
|
||||
if (IS_INTERNED(Z_STRVAL_P(op1))) {
|
||||
buf = (char *) emalloc(length+1);
|
||||
memcpy(buf, Z_STRVAL_P(op1), Z_STRLEN_P(op1));
|
||||
|
||||
+2
-2
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=5
|
||||
PHP_RELEASE_VERSION=32
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=36
|
||||
PHP_EXTRA_VERSION=""
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
|
||||
+41
-19
@@ -201,6 +201,21 @@ static void php_str2num(bc_num *num, char *str TSRMLS_DC)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ split_bc_num
|
||||
Convert to bc_num detecting scale */
|
||||
static bc_num split_bc_num(bc_num num) {
|
||||
bc_num newnum;
|
||||
if (num->n_refs >= 1) {
|
||||
return num;
|
||||
}
|
||||
newnum = _bc_new_num_ex(0, 0, 0);
|
||||
*newnum = *num;
|
||||
newnum->n_refs = 1;
|
||||
num->n_refs--;
|
||||
return newnum;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string bcadd(string left_operand, string right_operand [, int scale])
|
||||
Returns the sum of two arbitrary precision numbers */
|
||||
PHP_FUNCTION(bcadd)
|
||||
@@ -214,7 +229,7 @@ PHP_FUNCTION(bcadd)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 3) {
|
||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
||||
}
|
||||
@@ -225,11 +240,12 @@ PHP_FUNCTION(bcadd)
|
||||
php_str2num(&first, left TSRMLS_CC);
|
||||
php_str2num(&second, right TSRMLS_CC);
|
||||
bc_add (first, second, &result, scale);
|
||||
|
||||
|
||||
if (result->n_scale > scale) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale;
|
||||
}
|
||||
|
||||
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
@@ -253,7 +269,7 @@ PHP_FUNCTION(bcsub)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 3) {
|
||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
||||
}
|
||||
@@ -266,6 +282,7 @@ PHP_FUNCTION(bcsub)
|
||||
bc_sub (first, second, &result, scale);
|
||||
|
||||
if (result->n_scale > scale) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale;
|
||||
}
|
||||
|
||||
@@ -292,11 +309,11 @@ PHP_FUNCTION(bcmul)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 3) {
|
||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
||||
}
|
||||
|
||||
|
||||
bc_init_num(&first TSRMLS_CC);
|
||||
bc_init_num(&second TSRMLS_CC);
|
||||
bc_init_num(&result TSRMLS_CC);
|
||||
@@ -305,6 +322,7 @@ PHP_FUNCTION(bcmul)
|
||||
bc_multiply (first, second, &result, scale TSRMLS_CC);
|
||||
|
||||
if (result->n_scale > scale) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale;
|
||||
}
|
||||
|
||||
@@ -331,11 +349,11 @@ PHP_FUNCTION(bcdiv)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 3) {
|
||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
||||
}
|
||||
|
||||
|
||||
bc_init_num(&first TSRMLS_CC);
|
||||
bc_init_num(&second TSRMLS_CC);
|
||||
bc_init_num(&result TSRMLS_CC);
|
||||
@@ -345,6 +363,7 @@ PHP_FUNCTION(bcdiv)
|
||||
switch (bc_divide(first, second, &result, scale TSRMLS_CC)) {
|
||||
case 0: /* OK */
|
||||
if (result->n_scale > scale) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale;
|
||||
}
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
@@ -374,13 +393,13 @@ PHP_FUNCTION(bcmod)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &left, &left_len, &right, &right_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
bc_init_num(&first TSRMLS_CC);
|
||||
bc_init_num(&second TSRMLS_CC);
|
||||
bc_init_num(&result TSRMLS_CC);
|
||||
bc_str2num(&first, left, 0 TSRMLS_CC);
|
||||
bc_str2num(&second, right, 0 TSRMLS_CC);
|
||||
|
||||
|
||||
switch (bc_modulo(first, second, &result, 0 TSRMLS_CC)) {
|
||||
case 0:
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
@@ -391,7 +410,7 @@ PHP_FUNCTION(bcmod)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Division by zero");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
@@ -424,8 +443,9 @@ PHP_FUNCTION(bcpowmod)
|
||||
scale_int = (int) ((int)scale < 0) ? 0 : scale;
|
||||
|
||||
if (bc_raisemod(first, second, mod, &result, scale_int TSRMLS_CC) != -1) {
|
||||
if (result->n_scale > scale) {
|
||||
result->n_scale = scale;
|
||||
if (result->n_scale > scale_int) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale_int;
|
||||
}
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
@@ -433,7 +453,7 @@ PHP_FUNCTION(bcpowmod)
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&mod);
|
||||
@@ -455,7 +475,7 @@ PHP_FUNCTION(bcpow)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 3) {
|
||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
||||
}
|
||||
@@ -468,6 +488,7 @@ PHP_FUNCTION(bcpow)
|
||||
bc_raise (first, second, &result, scale TSRMLS_CC);
|
||||
|
||||
if (result->n_scale > scale) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale;
|
||||
}
|
||||
|
||||
@@ -494,16 +515,17 @@ PHP_FUNCTION(bcsqrt)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "s|l", &left, &left_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 2) {
|
||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
||||
}
|
||||
|
||||
bc_init_num(&result TSRMLS_CC);
|
||||
php_str2num(&result, left TSRMLS_CC);
|
||||
|
||||
|
||||
if (bc_sqrt (&result, scale TSRMLS_CC) != 0) {
|
||||
if (result->n_scale > scale) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale;
|
||||
}
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
@@ -531,7 +553,7 @@ PHP_FUNCTION(bccomp)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 3) {
|
||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
||||
}
|
||||
@@ -555,7 +577,7 @@ PHP_FUNCTION(bccomp)
|
||||
PHP_FUNCTION(bcscale)
|
||||
{
|
||||
long new_scale;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &new_scale) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug 72093: bcpowmod accepts negative scale and corrupts _one_ definition
|
||||
--SKIPIF--
|
||||
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(bcpowmod(1, "A", 128, -200));
|
||||
var_dump(bcpowmod(1, 1.2, 1, 1));
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(1) "1"
|
||||
bc math warning: non-zero scale in exponent
|
||||
string(3) "0.0"
|
||||
+15
-2
@@ -2965,7 +2965,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
/* When there are any characters after the first NUL */
|
||||
ImageInfo->CopyrightPhotographer = estrdup(value_ptr);
|
||||
ImageInfo->CopyrightEditor = estrndup(value_ptr+length+1, byte_count-length-1);
|
||||
spprintf(&ImageInfo->Copyright, 0, "%s, %s", value_ptr, value_ptr+length+1);
|
||||
spprintf(&ImageInfo->Copyright, 0, "%s, %s", ImageInfo->CopyrightPhotographer, ImageInfo->CopyrightEditor);
|
||||
/* format = TAG_FMT_UNDEFINED; this musn't be ASCII */
|
||||
/* but we are not supposed to change this */
|
||||
/* keep in mind that image_info does not store editor value */
|
||||
@@ -3134,6 +3134,11 @@ static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start,
|
||||
|
||||
ImageInfo->sections_found |= FOUND_IFD0;
|
||||
|
||||
if ((dir_start + 2) >= (offset_base+IFDlength)) {
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel);
|
||||
|
||||
if ((dir_start+2+NumDirEntries*12) > (offset_base+IFDlength)) {
|
||||
@@ -3157,6 +3162,10 @@ static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start,
|
||||
* Hack to make it process IDF1 I hope
|
||||
* There are 2 IDFs, the second one holds the keys (0x0201 and 0x0202) to the thumbnail
|
||||
*/
|
||||
if ((dir_start+2+12*de + 4) >= (offset_base+IFDlength)) {
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size");
|
||||
return FALSE;
|
||||
}
|
||||
NextDirOffset = php_ifd_get32u(dir_start+2+12*de, ImageInfo->motorola_intel);
|
||||
if (NextDirOffset) {
|
||||
/* the next line seems false but here IFDlength means length of all IFDs */
|
||||
@@ -3206,9 +3215,13 @@ static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, char *CharBuf,
|
||||
}
|
||||
|
||||
/* Check the next two values for correctness. */
|
||||
if (length < 8) {
|
||||
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid TIFF start (1)");
|
||||
return;
|
||||
}
|
||||
exif_value_2a = php_ifd_get16u(CharBuf+2, ImageInfo->motorola_intel);
|
||||
offset_of_ifd = php_ifd_get32u(CharBuf+4, ImageInfo->motorola_intel);
|
||||
if ( exif_value_2a != 0x2a || offset_of_ifd < 0x08) {
|
||||
if (exif_value_2a != 0x2a || offset_of_ifd < 0x08) {
|
||||
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid TIFF start (1)");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
--TEST--
|
||||
Bug #72094: Out of bounds heap read access in exif header processing
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
print_r(exif_read_data(__DIR__ . '/bug72094_1.jpg'));
|
||||
print_r(exif_read_data(__DIR__ . '/bug72094_2.jpg'));
|
||||
print_r(exif_read_data(__DIR__ . '/bug72094_3.jpg'));
|
||||
print_r(exif_read_data(__DIR__ . '/bug72094_4.jpg'));
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
Warning: exif_read_data(bug72094_1.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): Process tag(x8298=Copyright ): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): Illegal IFD offset in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): File structure corrupted in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): Invalid JPEG file in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_2.jpg): Illegal IFD size in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_2.jpg): File structure corrupted in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_2.jpg): Invalid JPEG file in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Illegal IFD size in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): File structure corrupted in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Invalid JPEG file in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_4.jpg): Invalid TIFF start (1) in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_4.jpg): File structure corrupted in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_4.jpg): Invalid JPEG file in %s/bug72094.php on line %d
|
||||
DONE
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -414,7 +414,7 @@ file_check_mem(struct magic_set *ms, unsigned int level)
|
||||
size_t len;
|
||||
|
||||
if (level >= ms->c.len) {
|
||||
len = (ms->c.len += 20) * sizeof(*ms->c.li);
|
||||
len = (ms->c.len = 20 + level) * sizeof(*ms->c.li);
|
||||
ms->c.li = CAST(struct level_info *, (ms->c.li == NULL) ?
|
||||
emalloc(len) :
|
||||
erealloc(ms->c.li, len));
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #71527 Buffer over-write in finfo_open with malformed magic file
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!class_exists('finfo'))
|
||||
die('skip no fileinfo extension');
|
||||
--ENV--
|
||||
USE_ZEND_ALLOC=0
|
||||
--FILE--
|
||||
<?php
|
||||
$finfo = finfo_open(FILEINFO_NONE, dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug71527.magic");
|
||||
$info = finfo_file($finfo, __FILE__);
|
||||
var_dump($info);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: finfo_open(): Failed to load magic database at '%sbug71527.magic'. in %sbug71527.php on line %d
|
||||
|
||||
Warning: finfo_file() expects parameter 1 to be resource, boolean given in %sbug71527.php on line %d
|
||||
bool(false)
|
||||
@@ -145,9 +145,15 @@ static int _gd2GetHeader(gdIOCtxPtr in, int *sx, int *sy, int *cs, int *vers, in
|
||||
cidx = gdCalloc(sidx, 1);
|
||||
for (i = 0; i < nc; i++) {
|
||||
if (gdGetInt(&cidx[i].offset, in) != 1) {
|
||||
gdFree(cidx);
|
||||
goto fail1;
|
||||
}
|
||||
if (gdGetInt(&cidx[i].size, in) != 1) {
|
||||
gdFree(cidx);
|
||||
goto fail1;
|
||||
}
|
||||
if (cidx[i].offset < 0 || cidx[i].size < 0) {
|
||||
gdFree(cidx);
|
||||
goto fail1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,8 @@
|
||||
downscaling using the fixed point implementations are usually much faster
|
||||
than the existing gdImageCopyResampled while having a similar or better
|
||||
quality.
|
||||
|
||||
For image rotations, the optimized versions have a lazy antialiasing for
|
||||
|
||||
For image rotations, the optimized versions have a lazy antialiasing for
|
||||
the edges of the images. For a much better antialiased result, the affine
|
||||
function is recommended.
|
||||
*/
|
||||
@@ -633,7 +633,7 @@ static inline int _color_blend (const int dst, const int src)
|
||||
}
|
||||
}
|
||||
|
||||
static inline int _setEdgePixel(const gdImagePtr src, unsigned int x, unsigned int y, gdFixed coverage, const int bgColor)
|
||||
static inline int _setEdgePixel(const gdImagePtr src, unsigned int x, unsigned int y, gdFixed coverage, const int bgColor)
|
||||
{
|
||||
const gdFixed f_127 = gd_itofx(127);
|
||||
register int c = src->tpixels[y][x];
|
||||
@@ -934,9 +934,6 @@ static inline LineContribType *_gdContributionsCalc(unsigned int line_size, unsi
|
||||
double dTotalWeight = 0.0;
|
||||
int iSrc;
|
||||
|
||||
res->ContribRow[u].Left = iLeft;
|
||||
res->ContribRow[u].Right = iRight;
|
||||
|
||||
/* Cut edge points to fit in filter window in case of spill-off */
|
||||
if (iRight - iLeft + 1 > windows_size) {
|
||||
if (iLeft < ((int)src_size - 1 / 2)) {
|
||||
@@ -946,6 +943,9 @@ static inline LineContribType *_gdContributionsCalc(unsigned int line_size, unsi
|
||||
}
|
||||
}
|
||||
|
||||
res->ContribRow[u].Left = iLeft;
|
||||
res->ContribRow[u].Right = iRight;
|
||||
|
||||
for (iSrc = iLeft; iSrc <= iRight; iSrc++) {
|
||||
dTotalWeight += (res->ContribRow[u].Weights[iSrc-iLeft] = scale_f_d * (*pFilter)(scale_f_d * (dCenter - (double)iSrc)));
|
||||
}
|
||||
@@ -1070,12 +1070,12 @@ gdImagePtr gdImageScaleTwoPass(const gdImagePtr src, const unsigned int src_widt
|
||||
|
||||
dst = gdImageCreateTrueColor(new_width, new_height);
|
||||
if (dst == NULL) {
|
||||
gdFree(tmp_im);
|
||||
gdImageDestroy(tmp_im);
|
||||
return NULL;
|
||||
}
|
||||
gdImageSetInterpolationMethod(dst, src->interpolation_id);
|
||||
_gdScaleVert(tmp_im, new_width, src_height, dst, new_width, new_height);
|
||||
gdFree(tmp_im);
|
||||
gdImageDestroy(tmp_im);
|
||||
|
||||
return dst;
|
||||
}
|
||||
@@ -1093,7 +1093,7 @@ gdImagePtr Scale(const gdImagePtr src, const unsigned int src_width, const unsig
|
||||
_gdScaleHoriz(src, src_width, src_height, tmp_im, new_width, src_height);
|
||||
_gdScaleVert(tmp_im, new_width, src_height, dst, new_width, new_height);
|
||||
|
||||
gdFree(tmp_im);
|
||||
gdImageDestroy(tmp_im);
|
||||
return dst;
|
||||
}
|
||||
|
||||
@@ -2273,7 +2273,7 @@ int gdTransformAffineGetImage(gdImagePtr *dst,
|
||||
if (!src->trueColor) {
|
||||
gdImagePaletteToTrueColor(src);
|
||||
}
|
||||
|
||||
|
||||
/* Translate to dst origin (0,0) */
|
||||
gdAffineTranslate(m, -bbox.x, -bbox.y);
|
||||
gdAffineConcat(m, affine, m);
|
||||
@@ -2332,7 +2332,7 @@ int gdTransformAffineCopy(gdImagePtr dst,
|
||||
if (src->interpolation_id == GD_BILINEAR_FIXED || src->interpolation_id == GD_BICUBIC_FIXED || src->interpolation_id == GD_NEAREST_NEIGHBOUR) {
|
||||
interpolation_id_bak = src->interpolation_id;
|
||||
interpolation_bak = src->interpolation;
|
||||
|
||||
|
||||
gdImageSetInterpolationMethod(src, GD_BICUBIC);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #71912 (libgd: signedness vulnerability)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
if(!function_exists('imagecreatefromgd2')) die('skip imagecreatefromgd2() not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
imagecreatefromgd2(__DIR__."/invalid_neg_size.gd2");
|
||||
?>
|
||||
OK
|
||||
--EXPECTF--
|
||||
|
||||
Warning: imagecreatefromgd2(): '%s/invalid_neg_size.gd2' is not a valid GD2 file in %s/bug71912.php on line %d
|
||||
OK
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #72227: imagescale out-of-bounds read
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die("skip gd extension not available\n");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$img = imagecreatetruecolor ( 100, 100);
|
||||
imagescale($img, 13, 1, IMG_BICUBIC);
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
DONE
|
||||
Binary file not shown.
@@ -112,7 +112,7 @@ PHP_FUNCTION(grapheme_strpos)
|
||||
int haystack_len, needle_len;
|
||||
unsigned char *found;
|
||||
long loffset = 0;
|
||||
int32_t offset = 0;
|
||||
int32_t offset = 0, noffset = 0;
|
||||
int ret_pos;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
|
||||
@@ -132,6 +132,7 @@ PHP_FUNCTION(grapheme_strpos)
|
||||
|
||||
/* we checked that it will fit: */
|
||||
offset = (int32_t) loffset;
|
||||
noffset = offset >= 0 ? offset : haystack_len + offset;
|
||||
|
||||
/* the offset is 'grapheme count offset' so it still might be invalid - we'll check it later */
|
||||
|
||||
@@ -146,7 +147,7 @@ PHP_FUNCTION(grapheme_strpos)
|
||||
/* quick check to see if the string might be there
|
||||
* I realize that 'offset' is 'grapheme count offset' but will work in spite of that
|
||||
*/
|
||||
found = (unsigned char *)php_memnstr((char *)haystack + offset, (char *)needle, needle_len, (char *)haystack + haystack_len);
|
||||
found = (unsigned char *)php_memnstr((char *)haystack + noffset, (char *)needle, needle_len, (char *)haystack + haystack_len);
|
||||
|
||||
/* if it isn't there the we are done */
|
||||
if (!found) {
|
||||
@@ -214,12 +215,13 @@ PHP_FUNCTION(grapheme_stripos)
|
||||
is_ascii = ( grapheme_ascii_check(haystack, haystack_len) >= 0 );
|
||||
|
||||
if ( is_ascii ) {
|
||||
int32_t noffset = offset >= 0 ? offset : haystack_len + offset;
|
||||
needle_dup = (unsigned char *)estrndup((char *)needle, needle_len);
|
||||
php_strtolower((char *)needle_dup, needle_len);
|
||||
haystack_dup = (unsigned char *)estrndup((char *)haystack, haystack_len);
|
||||
php_strtolower((char *)haystack_dup, haystack_len);
|
||||
|
||||
found = (unsigned char*) php_memnstr((char *)haystack_dup + offset, (char *)needle_dup, needle_len, (char *)haystack_dup + haystack_len);
|
||||
found = (unsigned char*) php_memnstr((char *)haystack_dup + noffset, (char *)needle_dup, needle_len, (char *)haystack_dup + haystack_len);
|
||||
|
||||
efree(haystack_dup);
|
||||
efree(needle_dup);
|
||||
@@ -537,7 +539,7 @@ PHP_FUNCTION(grapheme_substr)
|
||||
efree(ustr);
|
||||
}
|
||||
ubrk_close(bi);
|
||||
RETURN_EMPTY_STRING();
|
||||
RETURN_EMPTY_STRING();
|
||||
}
|
||||
|
||||
/* find the end point of the string to return */
|
||||
@@ -576,7 +578,7 @@ PHP_FUNCTION(grapheme_substr)
|
||||
sub_str_end_pos = ustr_len;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(sub_str_start_pos > sub_str_end_pos) {
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_substr: length is beyond start", 1 TSRMLS_CC );
|
||||
|
||||
|
||||
+118
-117
@@ -65,26 +65,26 @@ ZEND_EXTERN_MODULE_GLOBALS( intl )
|
||||
*/
|
||||
static const char * const LOC_GRANDFATHERED[] = {
|
||||
"art-lojban", "i-klingon", "i-lux", "i-navajo", "no-bok", "no-nyn",
|
||||
"cel-gaulish", "en-GB-oed", "i-ami",
|
||||
"i-bnn", "i-default", "i-enochian",
|
||||
"i-mingo", "i-pwn", "i-tao",
|
||||
"cel-gaulish", "en-GB-oed", "i-ami",
|
||||
"i-bnn", "i-default", "i-enochian",
|
||||
"i-mingo", "i-pwn", "i-tao",
|
||||
"i-tay", "i-tsu", "sgn-BE-fr",
|
||||
"sgn-BE-nl", "sgn-CH-de", "zh-cmn",
|
||||
"zh-cmn-Hans", "zh-cmn-Hant", "zh-gan" ,
|
||||
"zh-guoyu", "zh-hakka", "zh-min",
|
||||
"zh-min-nan", "zh-wuu", "zh-xiang",
|
||||
"zh-min-nan", "zh-wuu", "zh-xiang",
|
||||
"zh-yue", NULL
|
||||
};
|
||||
|
||||
/* Based on IANA registry at the time of writing this code
|
||||
* This array lists the preferred values for the grandfathered tags if applicable
|
||||
* This is in sync with the array LOC_GRANDFATHERED
|
||||
* This is in sync with the array LOC_GRANDFATHERED
|
||||
* e.g. the offsets of the grandfathered tags match the offset of the preferred value
|
||||
*/
|
||||
static const int LOC_PREFERRED_GRANDFATHERED_LEN = 6;
|
||||
static const char * const LOC_PREFERRED_GRANDFATHERED[] = {
|
||||
"jbo", "tlh", "lb",
|
||||
"nv", "nb", "nn",
|
||||
"nv", "nb", "nn",
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -122,7 +122,7 @@ static int16_t findOffset(const char* const* list, const char* key)
|
||||
/*}}}*/
|
||||
|
||||
static char* getPreferredTag(const char* gf_tag)
|
||||
{
|
||||
{
|
||||
char* result = NULL;
|
||||
int grOffset = 0;
|
||||
|
||||
@@ -141,15 +141,15 @@ static char* getPreferredTag(const char* gf_tag)
|
||||
}
|
||||
|
||||
/* {{{
|
||||
* returns the position of next token for lookup
|
||||
* returns the position of next token for lookup
|
||||
* or -1 if no token
|
||||
* strtokr equivalent search for token in reverse direction
|
||||
* strtokr equivalent search for token in reverse direction
|
||||
*/
|
||||
static int getStrrtokenPos(char* str, int savedPos)
|
||||
{
|
||||
int result =-1;
|
||||
int i;
|
||||
|
||||
|
||||
for(i=savedPos-1; i>=0; i--) {
|
||||
if(isIDSeparator(*(str+i)) ){
|
||||
/* delimiter found; check for singleton */
|
||||
@@ -171,7 +171,7 @@ static int getStrrtokenPos(char* str, int savedPos)
|
||||
/* }}} */
|
||||
|
||||
/* {{{
|
||||
* returns the position of a singleton if present
|
||||
* returns the position of a singleton if present
|
||||
* returns -1 if no singleton
|
||||
* strtok equivalent search for singleton
|
||||
*/
|
||||
@@ -180,7 +180,7 @@ static int getSingletonPos(const char* str)
|
||||
int result =-1;
|
||||
int i=0;
|
||||
int len = 0;
|
||||
|
||||
|
||||
if( str && ((len=strlen(str))>0) ){
|
||||
for( i=0; i<len ; i++){
|
||||
if( isIDSeparator(*(str+i)) ){
|
||||
@@ -198,7 +198,7 @@ static int getSingletonPos(const char* str)
|
||||
}
|
||||
}
|
||||
}/* end of for */
|
||||
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -224,7 +224,7 @@ PHP_NAMED_FUNCTION(zif_locale_get_default)
|
||||
PHP_NAMED_FUNCTION(zif_locale_set_default)
|
||||
{
|
||||
char* locale_name = NULL;
|
||||
int len=0;
|
||||
int len=0;
|
||||
|
||||
if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s",
|
||||
&locale_name ,&len ) == FAILURE)
|
||||
@@ -240,14 +240,14 @@ PHP_NAMED_FUNCTION(zif_locale_set_default)
|
||||
len = strlen(locale_name);
|
||||
}
|
||||
|
||||
zend_alter_ini_entry(LOCALE_INI_NAME, sizeof(LOCALE_INI_NAME), locale_name, len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_alter_ini_entry(LOCALE_INI_NAME, sizeof(LOCALE_INI_NAME), locale_name, len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{
|
||||
* Gets the value from ICU
|
||||
* Gets the value from ICU
|
||||
* common code shared by get_primary_language,get_script or get_region or get_variant
|
||||
* result = 0 if error, 1 if successful , -1 if no value
|
||||
*/
|
||||
@@ -284,7 +284,7 @@ static char* get_icu_value_internal( const char* loc_name , char* tag_name, int*
|
||||
}
|
||||
}
|
||||
|
||||
singletonPos = getSingletonPos( loc_name );
|
||||
singletonPos = getSingletonPos( loc_name );
|
||||
if( singletonPos == 0){
|
||||
/* singleton at start of script, region , variant etc.
|
||||
* or invalid singleton at start of language */
|
||||
@@ -299,7 +299,7 @@ static char* get_icu_value_internal( const char* loc_name , char* tag_name, int*
|
||||
} /* end of if != LOC_CANONICAL_TAG */
|
||||
|
||||
if( mod_loc_name == NULL){
|
||||
mod_loc_name = estrdup(loc_name );
|
||||
mod_loc_name = estrdup(loc_name );
|
||||
}
|
||||
|
||||
/* Proceed to ICU */
|
||||
@@ -326,6 +326,7 @@ static char* get_icu_value_internal( const char* loc_name , char* tag_name, int*
|
||||
if( U_FAILURE( status ) ) {
|
||||
if( status == U_BUFFER_OVERFLOW_ERROR ) {
|
||||
status = U_ZERO_ERROR;
|
||||
buflen++; /* add space for \0 */
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -366,7 +367,7 @@ static char* get_icu_value_internal( const char* loc_name , char* tag_name, int*
|
||||
* Gets the value from ICU , called when PHP userspace function is called
|
||||
* common code shared by get_primary_language,get_script or get_region or get_variant
|
||||
*/
|
||||
static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS)
|
||||
static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS)
|
||||
{
|
||||
|
||||
const char* loc_name = NULL;
|
||||
@@ -422,37 +423,37 @@ static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto static string Locale::getScript($locale)
|
||||
* gets the script for the $locale
|
||||
/* {{{ proto static string Locale::getScript($locale)
|
||||
* gets the script for the $locale
|
||||
}}} */
|
||||
/* {{{ proto static string locale_get_script($locale)
|
||||
* gets the script for the $locale
|
||||
/* {{{ proto static string locale_get_script($locale)
|
||||
* gets the script for the $locale
|
||||
*/
|
||||
PHP_FUNCTION( locale_get_script )
|
||||
PHP_FUNCTION( locale_get_script )
|
||||
{
|
||||
get_icu_value_src_php( LOC_SCRIPT_TAG , INTERNAL_FUNCTION_PARAM_PASSTHRU );
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto static string Locale::getRegion($locale)
|
||||
* gets the region for the $locale
|
||||
/* {{{ proto static string Locale::getRegion($locale)
|
||||
* gets the region for the $locale
|
||||
}}} */
|
||||
/* {{{ proto static string locale_get_region($locale)
|
||||
* gets the region for the $locale
|
||||
/* {{{ proto static string locale_get_region($locale)
|
||||
* gets the region for the $locale
|
||||
*/
|
||||
PHP_FUNCTION( locale_get_region )
|
||||
PHP_FUNCTION( locale_get_region )
|
||||
{
|
||||
get_icu_value_src_php( LOC_REGION_TAG , INTERNAL_FUNCTION_PARAM_PASSTHRU );
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto static string Locale::getPrimaryLanguage($locale)
|
||||
* gets the primary language for the $locale
|
||||
/* {{{ proto static string Locale::getPrimaryLanguage($locale)
|
||||
* gets the primary language for the $locale
|
||||
}}} */
|
||||
/* {{{ proto static string locale_get_primary_language($locale)
|
||||
* gets the primary language for the $locale
|
||||
/* {{{ proto static string locale_get_primary_language($locale)
|
||||
* gets the primary language for the $locale
|
||||
*/
|
||||
PHP_FUNCTION(locale_get_primary_language )
|
||||
PHP_FUNCTION(locale_get_primary_language )
|
||||
{
|
||||
get_icu_value_src_php( LOC_LANG_TAG , INTERNAL_FUNCTION_PARAM_PASSTHRU );
|
||||
}
|
||||
@@ -460,9 +461,9 @@ PHP_FUNCTION(locale_get_primary_language )
|
||||
|
||||
|
||||
/* {{{
|
||||
* common code shared by display_xyz functions to get the value from ICU
|
||||
* common code shared by display_xyz functions to get the value from ICU
|
||||
}}} */
|
||||
static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS)
|
||||
static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS)
|
||||
{
|
||||
const char* loc_name = NULL;
|
||||
int loc_name_len = 0;
|
||||
@@ -488,7 +489,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME
|
||||
intl_error_reset( NULL TSRMLS_CC );
|
||||
|
||||
if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|s",
|
||||
&loc_name, &loc_name_len ,
|
||||
&loc_name, &loc_name_len ,
|
||||
&disp_loc_name ,&disp_loc_name_len ) == FAILURE)
|
||||
{
|
||||
spprintf(&msg , 0, "locale_get_display_%s : unable to parse input params", tag_name );
|
||||
@@ -525,7 +526,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME
|
||||
if( mod_loc_name==NULL ){
|
||||
mod_loc_name = estrdup( loc_name );
|
||||
}
|
||||
|
||||
|
||||
/* Check if disp_loc_name passed , if not use default locale */
|
||||
if( !disp_loc_name){
|
||||
disp_loc_name = estrdup(intl_locale_get_default(TSRMLS_C));
|
||||
@@ -604,7 +605,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME
|
||||
/* {{{ proto static string get_display_name($locale[, $in_locale = null])
|
||||
* gets the name for the $locale in $in_locale or default_locale
|
||||
*/
|
||||
PHP_FUNCTION(locale_get_display_name)
|
||||
PHP_FUNCTION(locale_get_display_name)
|
||||
{
|
||||
get_icu_disp_value_src_php( DISP_NAME , INTERNAL_FUNCTION_PARAM_PASSTHRU );
|
||||
}
|
||||
@@ -616,7 +617,7 @@ PHP_FUNCTION(locale_get_display_name)
|
||||
/* {{{ proto static string get_display_language($locale[, $in_locale = null])
|
||||
* gets the language for the $locale in $in_locale or default_locale
|
||||
*/
|
||||
PHP_FUNCTION(locale_get_display_language)
|
||||
PHP_FUNCTION(locale_get_display_language)
|
||||
{
|
||||
get_icu_disp_value_src_php( LOC_LANG_TAG , INTERNAL_FUNCTION_PARAM_PASSTHRU );
|
||||
}
|
||||
@@ -628,7 +629,7 @@ PHP_FUNCTION(locale_get_display_language)
|
||||
/* {{{ proto static string get_display_script($locale, $in_locale = null)
|
||||
* gets the script for the $locale in $in_locale or default_locale
|
||||
*/
|
||||
PHP_FUNCTION(locale_get_display_script)
|
||||
PHP_FUNCTION(locale_get_display_script)
|
||||
{
|
||||
get_icu_disp_value_src_php( LOC_SCRIPT_TAG , INTERNAL_FUNCTION_PARAM_PASSTHRU );
|
||||
}
|
||||
@@ -640,7 +641,7 @@ PHP_FUNCTION(locale_get_display_script)
|
||||
/* {{{ proto static string get_display_region($locale, $in_locale = null)
|
||||
* gets the region for the $locale in $in_locale or default_locale
|
||||
*/
|
||||
PHP_FUNCTION(locale_get_display_region)
|
||||
PHP_FUNCTION(locale_get_display_region)
|
||||
{
|
||||
get_icu_disp_value_src_php( LOC_REGION_TAG , INTERNAL_FUNCTION_PARAM_PASSTHRU );
|
||||
}
|
||||
@@ -654,7 +655,7 @@ PHP_FUNCTION(locale_get_display_region)
|
||||
* proto static string get_display_variant($locale, $in_locale = null)
|
||||
* gets the variant for the $locale in $in_locale or default_locale
|
||||
*/
|
||||
PHP_FUNCTION(locale_get_display_variant)
|
||||
PHP_FUNCTION(locale_get_display_variant)
|
||||
{
|
||||
get_icu_disp_value_src_php( LOC_VARIANT_TAG , INTERNAL_FUNCTION_PARAM_PASSTHRU );
|
||||
}
|
||||
@@ -667,7 +668,7 @@ PHP_FUNCTION(locale_get_display_variant)
|
||||
/* {{{ proto static array locale_get_keywords(string $locale) {
|
||||
* return an associative array containing keyword-value
|
||||
* pairs for this locale. The keys are keys to the array (doh!)
|
||||
*/
|
||||
*/
|
||||
PHP_FUNCTION( locale_get_keywords )
|
||||
{
|
||||
UEnumeration* e = NULL;
|
||||
@@ -679,10 +680,10 @@ PHP_FUNCTION( locale_get_keywords )
|
||||
const char* loc_name = NULL;
|
||||
int loc_name_len = 0;
|
||||
|
||||
/*
|
||||
ICU expects the buffer to be allocated before calling the function
|
||||
and so the buffer size has been explicitly specified
|
||||
ICU uloc.h #define ULOC_KEYWORD_AND_VALUES_CAPACITY 100
|
||||
/*
|
||||
ICU expects the buffer to be allocated before calling the function
|
||||
and so the buffer size has been explicitly specified
|
||||
ICU uloc.h #define ULOC_KEYWORD_AND_VALUES_CAPACITY 100
|
||||
hence the kw_value buffer size is 100
|
||||
*/
|
||||
char* kw_value = NULL;
|
||||
@@ -721,7 +722,7 @@ PHP_FUNCTION( locale_get_keywords )
|
||||
kw_value_len=uloc_getKeywordValue( loc_name,kw_key, kw_value, kw_value_len+1 , &status );
|
||||
} else if(!U_FAILURE(status)) {
|
||||
kw_value = erealloc( kw_value , kw_value_len+1);
|
||||
}
|
||||
}
|
||||
if (U_FAILURE(status)) {
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "locale_get_keywords: Error encountered while getting the keyword value for the keyword", 0 TSRMLS_CC );
|
||||
if( kw_value){
|
||||
@@ -740,10 +741,10 @@ PHP_FUNCTION( locale_get_keywords )
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto static string Locale::canonicalize($locale)
|
||||
* @return string the canonicalized locale
|
||||
/* {{{ proto static string Locale::canonicalize($locale)
|
||||
* @return string the canonicalized locale
|
||||
* }}} */
|
||||
/* {{{ proto static string locale_canonicalize(Locale $loc, string $locale)
|
||||
/* {{{ proto static string locale_canonicalize(Locale $loc, string $locale)
|
||||
* @param string $locale The locale string to canonicalize
|
||||
*/
|
||||
PHP_FUNCTION(locale_canonicalize)
|
||||
@@ -752,10 +753,10 @@ PHP_FUNCTION(locale_canonicalize)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ append_key_value
|
||||
/* {{{ append_key_value
|
||||
* Internal function which is called from locale_compose
|
||||
* gets the value for the key_name and appends to the loc_name
|
||||
* returns 1 if successful , -1 if not found ,
|
||||
* returns 1 if successful , -1 if not found ,
|
||||
* 0 if array element is not a string , -2 if buffer-overflow
|
||||
*/
|
||||
static int append_key_value(smart_str* loc_name, HashTable* hash_arr, char* key_name)
|
||||
@@ -767,7 +768,7 @@ static int append_key_value(smart_str* loc_name, HashTable* hash_arr, char* key_
|
||||
/* element value is not a string */
|
||||
return FAILURE;
|
||||
}
|
||||
if(strcmp(key_name, LOC_LANG_TAG) != 0 &&
|
||||
if(strcmp(key_name, LOC_LANG_TAG) != 0 &&
|
||||
strcmp(key_name, LOC_GRANDFATHERED_LANG_TAG)!=0 ) {
|
||||
/* not lang or grandfathered tag */
|
||||
smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1);
|
||||
@@ -792,11 +793,11 @@ static void add_prefix(smart_str* loc_name, char* key_name)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ append_multiple_key_values
|
||||
/* {{{ append_multiple_key_values
|
||||
* Internal function which is called from locale_compose
|
||||
* gets the multiple values for the key_name and appends to the loc_name
|
||||
* used for 'variant','extlang','private'
|
||||
* returns 1 if successful , -1 if not found ,
|
||||
* used for 'variant','extlang','private'
|
||||
* returns 1 if successful , -1 if not found ,
|
||||
* 0 if array element is not a string , -2 if buffer-overflow
|
||||
*/
|
||||
static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr, char* key_name TSRMLS_DC)
|
||||
@@ -850,8 +851,8 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr,
|
||||
|
||||
/* Multiple variant values as variant0, variant1 ,variant2 */
|
||||
isFirstSubtag = 0;
|
||||
for( i=0 ; i< max_value; i++ ){
|
||||
snprintf( cur_key_name , 30, "%s%d", key_name , i);
|
||||
for( i=0 ; i< max_value; i++ ){
|
||||
snprintf( cur_key_name , 30, "%s%d", key_name , i);
|
||||
if( zend_hash_find( hash_arr , cur_key_name , strlen(cur_key_name) + 1,(void **)&ele_value ) == SUCCESS ){
|
||||
if( Z_TYPE_PP(ele_value)!= IS_STRING ){
|
||||
/* variant is not a string */
|
||||
@@ -873,7 +874,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr,
|
||||
|
||||
/*{{{
|
||||
* If applicable sets error message and aborts locale_compose gracefully
|
||||
* returns 0 if locale_compose needs to be aborted
|
||||
* returns 0 if locale_compose needs to be aborted
|
||||
* otherwise returns 1
|
||||
*/
|
||||
static int handleAppendResult( int result, smart_str* loc_name TSRMLS_DC)
|
||||
@@ -890,11 +891,11 @@ static int handleAppendResult( int result, smart_str* loc_name TSRMLS_DC)
|
||||
/* }}} */
|
||||
|
||||
#define RETURN_SMART_STR(s) smart_str_0((s)); RETURN_STRINGL((s)->c, (s)->len, 0)
|
||||
/* {{{ proto static string Locale::composeLocale($array)
|
||||
* Creates a locale by combining the parts of locale-ID passed
|
||||
/* {{{ proto static string Locale::composeLocale($array)
|
||||
* Creates a locale by combining the parts of locale-ID passed
|
||||
* }}} */
|
||||
/* {{{ proto static string compose_locale($array)
|
||||
* Creates a locale by combining the parts of locale-ID passed
|
||||
/* {{{ proto static string compose_locale($array)
|
||||
* Creates a locale by combining the parts of locale-ID passed
|
||||
* }}} */
|
||||
PHP_FUNCTION(locale_compose)
|
||||
{
|
||||
@@ -920,7 +921,7 @@ PHP_FUNCTION(locale_compose)
|
||||
RETURN_FALSE;
|
||||
|
||||
/* Check for grandfathered first */
|
||||
result = append_key_value(loc_name, hash_arr, LOC_GRANDFATHERED_LANG_TAG);
|
||||
result = append_key_value(loc_name, hash_arr, LOC_GRANDFATHERED_LANG_TAG);
|
||||
if( result == SUCCESS){
|
||||
RETURN_SMART_STR(loc_name);
|
||||
}
|
||||
@@ -929,7 +930,7 @@ PHP_FUNCTION(locale_compose)
|
||||
}
|
||||
|
||||
/* Not grandfathered */
|
||||
result = append_key_value(loc_name, hash_arr , LOC_LANG_TAG);
|
||||
result = append_key_value(loc_name, hash_arr , LOC_LANG_TAG);
|
||||
if( result == LOC_NOT_FOUND ){
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
"locale_compose: parameter array does not contain 'language' tag.", 0 TSRMLS_CC );
|
||||
@@ -947,11 +948,11 @@ PHP_FUNCTION(locale_compose)
|
||||
}
|
||||
|
||||
/* Script */
|
||||
result = append_key_value(loc_name, hash_arr , LOC_SCRIPT_TAG);
|
||||
result = append_key_value(loc_name, hash_arr , LOC_SCRIPT_TAG);
|
||||
if( !handleAppendResult( result, loc_name TSRMLS_CC)){
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Region */
|
||||
result = append_key_value( loc_name, hash_arr , LOC_REGION_TAG);
|
||||
if( !handleAppendResult( result, loc_name TSRMLS_CC)){
|
||||
@@ -959,7 +960,7 @@ PHP_FUNCTION(locale_compose)
|
||||
}
|
||||
|
||||
/* Variant */
|
||||
result = append_multiple_key_values( loc_name, hash_arr , LOC_VARIANT_TAG TSRMLS_CC);
|
||||
result = append_multiple_key_values( loc_name, hash_arr , LOC_VARIANT_TAG TSRMLS_CC);
|
||||
if( !handleAppendResult( result, loc_name TSRMLS_CC)){
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -985,16 +986,16 @@ static char* get_private_subtags(const char* loc_name)
|
||||
{
|
||||
char* result =NULL;
|
||||
int singletonPos = 0;
|
||||
int len =0;
|
||||
int len =0;
|
||||
const char* mod_loc_name =NULL;
|
||||
|
||||
if( loc_name && (len = strlen(loc_name)>0 ) ){
|
||||
mod_loc_name = loc_name ;
|
||||
mod_loc_name = loc_name ;
|
||||
len = strlen(mod_loc_name);
|
||||
while( (singletonPos = getSingletonPos(mod_loc_name))!= -1){
|
||||
|
||||
if( singletonPos!=-1){
|
||||
if( (*(mod_loc_name+singletonPos)=='x') || (*(mod_loc_name+singletonPos)=='X') ){
|
||||
if( singletonPos!=-1){
|
||||
if( (*(mod_loc_name+singletonPos)=='x') || (*(mod_loc_name+singletonPos)=='X') ){
|
||||
/* private subtag start found */
|
||||
if( singletonPos + 2 == len){
|
||||
/* loc_name ends with '-x-' ; return NULL */
|
||||
@@ -1019,7 +1020,7 @@ static char* get_private_subtags(const char* loc_name)
|
||||
|
||||
} /* end of while */
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1044,20 +1045,20 @@ static int add_array_entry(const char* loc_name, zval* hash_arr, char* key_name
|
||||
} else {
|
||||
key_value = get_icu_value_internal( loc_name , key_name , &result,1 );
|
||||
}
|
||||
if( (strcmp(key_name , LOC_PRIVATE_TAG)==0) ||
|
||||
if( (strcmp(key_name , LOC_PRIVATE_TAG)==0) ||
|
||||
( strcmp(key_name , LOC_VARIANT_TAG)==0) ){
|
||||
if( result > 0 && key_value){
|
||||
/* Tokenize on the "_" or "-" */
|
||||
token = php_strtok_r( key_value , DELIMITER ,&last_ptr);
|
||||
token = php_strtok_r( key_value , DELIMITER ,&last_ptr);
|
||||
if( cur_key_name ){
|
||||
efree( cur_key_name);
|
||||
}
|
||||
cur_key_name = (char*)ecalloc( 25, 25);
|
||||
sprintf( cur_key_name , "%s%d", key_name , cnt++);
|
||||
sprintf( cur_key_name , "%s%d", key_name , cnt++);
|
||||
add_assoc_string( hash_arr, cur_key_name , token ,TRUE );
|
||||
/* tokenize on the "_" or "-" and stop at singleton if any */
|
||||
while( (token = php_strtok_r(NULL , DELIMITER , &last_ptr)) && (strlen(token)>1) ){
|
||||
sprintf( cur_key_name , "%s%d", key_name , cnt++);
|
||||
sprintf( cur_key_name , "%s%d", key_name , cnt++);
|
||||
add_assoc_string( hash_arr, cur_key_name , token , TRUE );
|
||||
}
|
||||
/*
|
||||
@@ -1077,16 +1078,16 @@ static int add_array_entry(const char* loc_name, zval* hash_arr, char* key_name
|
||||
}
|
||||
/*if( key_name != LOC_PRIVATE_TAG && key_value){*/
|
||||
if( key_value){
|
||||
efree(key_value);
|
||||
efree(key_value);
|
||||
}
|
||||
return cur_result;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto static array Locale::parseLocale($locale)
|
||||
/* {{{ proto static array Locale::parseLocale($locale)
|
||||
* parses a locale-id into an array the different parts of it
|
||||
}}} */
|
||||
/* {{{ proto static array parse_locale($locale)
|
||||
/* {{{ proto static array parse_locale($locale)
|
||||
* parses a locale-id into an array the different parts of it
|
||||
*/
|
||||
PHP_FUNCTION(locale_parse)
|
||||
@@ -1144,7 +1145,7 @@ PHP_FUNCTION(locale_get_all_variants)
|
||||
char* saved_ptr = NULL;
|
||||
|
||||
intl_error_reset( NULL TSRMLS_CC );
|
||||
|
||||
|
||||
if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s",
|
||||
&loc_name, &loc_name_len ) == FAILURE)
|
||||
{
|
||||
@@ -1162,15 +1163,15 @@ PHP_FUNCTION(locale_get_all_variants)
|
||||
array_init( return_value );
|
||||
|
||||
/* If the locale is grandfathered, stop, no variants */
|
||||
if( findOffset( LOC_GRANDFATHERED , loc_name ) >= 0 ){
|
||||
if( findOffset( LOC_GRANDFATHERED , loc_name ) >= 0 ){
|
||||
/* ("Grandfathered Tag. No variants."); */
|
||||
}
|
||||
else {
|
||||
else {
|
||||
/* Call ICU variant */
|
||||
variant = get_icu_value_internal( loc_name , LOC_VARIANT_TAG , &result ,0);
|
||||
if( result > 0 && variant){
|
||||
/* Tokenize on the "_" or "-" */
|
||||
token = php_strtok_r( variant , DELIMITER , &saved_ptr);
|
||||
token = php_strtok_r( variant , DELIMITER , &saved_ptr);
|
||||
add_next_index_stringl( return_value, token , strlen(token) ,TRUE );
|
||||
/* tokenize on the "_" or "-" and stop at singleton if any */
|
||||
while( (token = php_strtok_r(NULL , DELIMITER, &saved_ptr)) && (strlen(token)>1) ){
|
||||
@@ -1181,7 +1182,7 @@ PHP_FUNCTION(locale_get_all_variants)
|
||||
efree( variant );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1220,11 +1221,11 @@ static int strToMatch(const char* str ,char *retstr)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto static boolean Locale::filterMatches(string $langtag, string $locale[, bool $canonicalize])
|
||||
* Checks if a $langtag filter matches with $locale according to RFC 4647's basic filtering algorithm
|
||||
* Checks if a $langtag filter matches with $locale according to RFC 4647's basic filtering algorithm
|
||||
*/
|
||||
/* }}} */
|
||||
/* {{{ proto boolean locale_filter_matches(string $langtag, string $locale[, bool $canonicalize])
|
||||
* Checks if a $langtag filter matches with $locale according to RFC 4647's basic filtering algorithm
|
||||
* Checks if a $langtag filter matches with $locale according to RFC 4647's basic filtering algorithm
|
||||
*/
|
||||
PHP_FUNCTION(locale_filter_matches)
|
||||
{
|
||||
@@ -1243,13 +1244,13 @@ PHP_FUNCTION(locale_filter_matches)
|
||||
char* cur_lang_tag = NULL;
|
||||
char* cur_loc_range = NULL;
|
||||
|
||||
zend_bool boolCanonical = 0;
|
||||
zend_bool boolCanonical = 0;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
intl_error_reset( NULL TSRMLS_CC );
|
||||
|
||||
|
||||
if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "ss|b",
|
||||
&lang_tag, &lang_tag_len , &loc_range , &loc_range_len ,
|
||||
&lang_tag, &lang_tag_len , &loc_range , &loc_range_len ,
|
||||
&boolCanonical) == FAILURE)
|
||||
{
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
@@ -1270,7 +1271,7 @@ PHP_FUNCTION(locale_filter_matches)
|
||||
/* canonicalize loc_range */
|
||||
can_loc_range=get_icu_value_internal( loc_range , LOC_CANONICALIZE_TAG , &result , 0);
|
||||
if( result ==0) {
|
||||
intl_error_set( NULL, status,
|
||||
intl_error_set( NULL, status,
|
||||
"locale_filter_matches : unable to canonicalize loc_range" , 0 TSRMLS_CC );
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -1278,7 +1279,7 @@ PHP_FUNCTION(locale_filter_matches)
|
||||
/* canonicalize lang_tag */
|
||||
can_lang_tag = get_icu_value_internal( lang_tag , LOC_CANONICALIZE_TAG , &result , 0);
|
||||
if( result ==0) {
|
||||
intl_error_set( NULL, status,
|
||||
intl_error_set( NULL, status,
|
||||
"locale_filter_matches : unable to canonicalize lang_tag" , 0 TSRMLS_CC );
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -1306,11 +1307,11 @@ PHP_FUNCTION(locale_filter_matches)
|
||||
|
||||
/* check if prefix */
|
||||
token = strstr( cur_lang_tag , cur_loc_range );
|
||||
|
||||
|
||||
if( token && (token==cur_lang_tag) ){
|
||||
/* check if the char. after match is SEPARATOR */
|
||||
chrcheck = token + (strlen(cur_loc_range));
|
||||
if( isIDSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){
|
||||
if( isIDSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){
|
||||
if( cur_lang_tag){
|
||||
efree( cur_lang_tag );
|
||||
}
|
||||
@@ -1346,7 +1347,7 @@ PHP_FUNCTION(locale_filter_matches)
|
||||
else{
|
||||
/* Convert to lower case for case-insensitive comparison */
|
||||
cur_lang_tag = ecalloc( 1, strlen(lang_tag ) + 1);
|
||||
|
||||
|
||||
result = strToMatch( lang_tag , cur_lang_tag);
|
||||
if( result == 0) {
|
||||
efree( cur_lang_tag );
|
||||
@@ -1362,11 +1363,11 @@ PHP_FUNCTION(locale_filter_matches)
|
||||
|
||||
/* check if prefix */
|
||||
token = strstr( cur_lang_tag , cur_loc_range );
|
||||
|
||||
|
||||
if( token && (token==cur_lang_tag) ){
|
||||
/* check if the char. after match is SEPARATOR */
|
||||
chrcheck = token + (strlen(cur_loc_range));
|
||||
if( isIDSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){
|
||||
if( isIDSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){
|
||||
if( cur_lang_tag){
|
||||
efree( cur_lang_tag );
|
||||
}
|
||||
@@ -1393,7 +1394,7 @@ PHP_FUNCTION(locale_filter_matches)
|
||||
static void array_cleanup( char* arr[] , int arr_size)
|
||||
{
|
||||
int i=0;
|
||||
for( i=0; i< arr_size; i++ ){
|
||||
for( i=0; i< arr_size; i++ ){
|
||||
if( arr[i*2] ){
|
||||
efree( arr[i*2]);
|
||||
}
|
||||
@@ -1403,7 +1404,7 @@ static void array_cleanup( char* arr[] , int arr_size)
|
||||
|
||||
#define LOOKUP_CLEAN_RETURN(value) array_cleanup(cur_arr, cur_arr_len); return (value)
|
||||
/* {{{
|
||||
* returns the lookup result to lookup_loc_range_src_php
|
||||
* returns the lookup result to lookup_loc_range_src_php
|
||||
* internal function
|
||||
*/
|
||||
static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int canonicalize TSRMLS_DC)
|
||||
@@ -1427,7 +1428,7 @@ static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int ca
|
||||
for(zend_hash_internal_pointer_reset(hash_arr);
|
||||
zend_hash_has_more_elements(hash_arr) == SUCCESS;
|
||||
zend_hash_move_forward(hash_arr)) {
|
||||
|
||||
|
||||
if (zend_hash_get_current_data(hash_arr, (void**)&ele_value) == FAILURE) {
|
||||
/* Should never actually fail since the key is known to exist.*/
|
||||
continue;
|
||||
@@ -1436,7 +1437,7 @@ static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int ca
|
||||
/* element value is not a string */
|
||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "lookup_loc_range: locale array element is not a string", 0 TSRMLS_CC);
|
||||
LOOKUP_CLEAN_RETURN(NULL);
|
||||
}
|
||||
}
|
||||
cur_arr[cur_arr_len*2] = estrndup(Z_STRVAL_PP(ele_value), Z_STRLEN_PP(ele_value));
|
||||
result = strToMatch(Z_STRVAL_PP(ele_value), cur_arr[cur_arr_len*2]);
|
||||
if(result == 0) {
|
||||
@@ -1444,12 +1445,12 @@ static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int ca
|
||||
LOOKUP_CLEAN_RETURN(NULL);
|
||||
}
|
||||
cur_arr[cur_arr_len*2+1] = Z_STRVAL_PP(ele_value);
|
||||
cur_arr_len++ ;
|
||||
cur_arr_len++ ;
|
||||
} /* end of for */
|
||||
|
||||
/* Canonicalize array elements */
|
||||
if(canonicalize) {
|
||||
for(i=0; i<cur_arr_len; i++) {
|
||||
for(i=0; i<cur_arr_len; i++) {
|
||||
lang_tag = get_icu_value_internal(cur_arr[i*2], LOC_CANONICALIZE_TAG, &result, 0);
|
||||
if(result != 1 || lang_tag == NULL || !lang_tag[0]) {
|
||||
if(lang_tag) {
|
||||
@@ -1459,7 +1460,7 @@ static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int ca
|
||||
LOOKUP_CLEAN_RETURN(NULL);
|
||||
}
|
||||
cur_arr[i*2] = erealloc(cur_arr[i*2], strlen(lang_tag)+1);
|
||||
result = strToMatch(lang_tag, cur_arr[i*2]);
|
||||
result = strToMatch(lang_tag, cur_arr[i*2]);
|
||||
efree(lang_tag);
|
||||
if(result == 0) {
|
||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "lookup_loc_range: unable to canonicalize lang_tag" , 0 TSRMLS_CC);
|
||||
@@ -1482,11 +1483,11 @@ static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int ca
|
||||
} else {
|
||||
loc_range = can_loc_range;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_loc_range = ecalloc(1, strlen(loc_range)+1);
|
||||
/* convert to lower and replace hyphens */
|
||||
result = strToMatch(loc_range, cur_loc_range);
|
||||
result = strToMatch(loc_range, cur_loc_range);
|
||||
if(can_loc_range) {
|
||||
efree(can_loc_range);
|
||||
}
|
||||
@@ -1498,8 +1499,8 @@ static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int ca
|
||||
/* Lookup for the lang_tag match */
|
||||
saved_pos = strlen(cur_loc_range);
|
||||
while(saved_pos > 0) {
|
||||
for(i=0; i< cur_arr_len; i++){
|
||||
if(cur_arr[i*2] != NULL && strlen(cur_arr[i*2]) == saved_pos && strncmp(cur_loc_range, cur_arr[i*2], saved_pos) == 0) {
|
||||
for(i=0; i< cur_arr_len; i++){
|
||||
if(cur_arr[i*2] != NULL && strlen(cur_arr[i*2]) == saved_pos && strncmp(cur_loc_range, cur_arr[i*2], saved_pos) == 0) {
|
||||
/* Match found */
|
||||
return_value = estrdup(canonicalize?cur_arr[i*2]:cur_arr[i*2+1]);
|
||||
efree(cur_loc_range);
|
||||
@@ -1515,14 +1516,14 @@ static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int ca
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string Locale::lookup(array $langtag, string $locale[, bool $canonicalize[, string $default = null]])
|
||||
/* {{{ proto string Locale::lookup(array $langtag, string $locale[, bool $canonicalize[, string $default = null]])
|
||||
* Searchs the items in $langtag for the best match to the language
|
||||
* range
|
||||
* range
|
||||
*/
|
||||
/* }}} */
|
||||
/* {{{ proto string locale_lookup(array $langtag, string $locale[, bool $canonicalize[, string $default = null]])
|
||||
* Searchs the items in $langtag for the best match to the language
|
||||
* range
|
||||
* range
|
||||
*/
|
||||
PHP_FUNCTION(locale_lookup)
|
||||
{
|
||||
@@ -1552,8 +1553,8 @@ PHP_FUNCTION(locale_lookup)
|
||||
|
||||
if( !hash_arr || zend_hash_num_elements( hash_arr ) == 0 ) {
|
||||
RETURN_EMPTY_STRING();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
result = lookup_loc_range(loc_range, hash_arr, boolCanonical TSRMLS_CC);
|
||||
if(result == NULL || result[0] == '\0') {
|
||||
if( fallback_loc ) {
|
||||
@@ -1590,10 +1591,10 @@ PHP_FUNCTION(locale_accept_from_http)
|
||||
"locale_accept_from_http: unable to parse input parameters", 0 TSRMLS_CC );
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
available = ures_openAvailableLocales(NULL, &status);
|
||||
INTL_CHECK_STATUS(status, "locale_accept_from_http: failed to retrieve locale list");
|
||||
len = uloc_acceptLanguageFromHTTP(resultLocale, INTL_MAX_LOCALE_LEN,
|
||||
len = uloc_acceptLanguageFromHTTP(resultLocale, INTL_MAX_LOCALE_LEN,
|
||||
&outResult, http_accept, available, &status);
|
||||
uenum_close(available);
|
||||
INTL_CHECK_STATUS(status, "locale_accept_from_http: failed to find acceptable locale");
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #72061: Out-of-bounds reads in zif_grapheme_stripos with negative offset
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(grapheme_stripos(str_repeat("ABCD", 16384), "A", -201));
|
||||
var_dump(grapheme_strpos(str_repeat("ABCD", 16384), "A", -201));
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
int(65336)
|
||||
int(65336)
|
||||
DONE
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #72241: get_icu_value_internal out-of-bounds read
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$var1=str_repeat("A", 1000);
|
||||
$out = locale_get_primary_language($var1);
|
||||
echo strlen($out) . PHP_EOL;
|
||||
echo unpack('H*', $out)[1] . PHP_EOL;
|
||||
--EXPECT--
|
||||
1000
|
||||
61616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* Unicode support
|
||||
*
|
||||
* Portions copyright (c) 1999,2000,2001 by the PHP3 internationalization team.
|
||||
@@ -137,7 +137,7 @@ mbfl_buffer_converter_new(
|
||||
mbfl_buffer_converter *
|
||||
mbfl_buffer_converter_new2(
|
||||
const mbfl_encoding *from,
|
||||
const mbfl_encoding *to,
|
||||
const mbfl_encoding *to,
|
||||
int buf_initsz)
|
||||
{
|
||||
mbfl_buffer_converter *convd;
|
||||
@@ -339,7 +339,7 @@ mbfl_buffer_converter_result(mbfl_buffer_converter *convd, mbfl_string *result)
|
||||
}
|
||||
|
||||
mbfl_string *
|
||||
mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *string,
|
||||
mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *string,
|
||||
mbfl_string *result)
|
||||
{
|
||||
if (convd == NULL || string == NULL || result == NULL) {
|
||||
@@ -535,7 +535,7 @@ const mbfl_encoding *mbfl_encoding_detector_judge2(mbfl_encoding_detector *ident
|
||||
}
|
||||
n--;
|
||||
}
|
||||
|
||||
|
||||
/* fallback judge */
|
||||
if (!encoding) {
|
||||
n = identd->filter_list_size - 1;
|
||||
@@ -702,7 +702,7 @@ mbfl_identify_encoding(mbfl_string *string, enum mbfl_no_encoding *elist, int el
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* cleanup */
|
||||
/* dtors should be called in reverse order */
|
||||
i = num; while (--i >= 0) {
|
||||
@@ -785,7 +785,7 @@ mbfl_identify_encoding2(mbfl_string *string, const mbfl_encoding **elist, int el
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* cleanup */
|
||||
/* dtors should be called in reverse order */
|
||||
i = num; while (--i >= 0) {
|
||||
@@ -844,7 +844,7 @@ mbfl_strlen(mbfl_string *string)
|
||||
} else {
|
||||
/* wchar filter */
|
||||
mbfl_convert_filter *filter = mbfl_convert_filter_new(
|
||||
string->no_encoding,
|
||||
string->no_encoding,
|
||||
mbfl_no_encoding_wchar,
|
||||
filter_count_output, 0, &len);
|
||||
if (filter == NULL) {
|
||||
@@ -865,7 +865,7 @@ mbfl_strlen(mbfl_string *string)
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* strpos
|
||||
*/
|
||||
@@ -931,7 +931,7 @@ retry:
|
||||
/*
|
||||
* oddlen
|
||||
*/
|
||||
int
|
||||
int
|
||||
mbfl_oddlen(mbfl_string *string)
|
||||
{
|
||||
int len, n, m, k;
|
||||
@@ -1071,7 +1071,7 @@ mbfl_strpos(
|
||||
++result;
|
||||
} else if ((c & 0xc0) != 0x80) {
|
||||
++result;
|
||||
}
|
||||
}
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
@@ -1116,7 +1116,7 @@ mbfl_strpos(
|
||||
qe = needle_u8_val + needle_u8_len;
|
||||
if (offset < 0) {
|
||||
if (-offset > needle_len) {
|
||||
offset += needle_len;
|
||||
offset += needle_len;
|
||||
while (offset < 0) {
|
||||
unsigned char c;
|
||||
if (p <= e) {
|
||||
@@ -1158,7 +1158,7 @@ mbfl_strpos(
|
||||
++result;
|
||||
} else if ((c & 0xc0) != 0x80) {
|
||||
++result;
|
||||
}
|
||||
}
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
@@ -1501,7 +1501,7 @@ mbfl_strcut(
|
||||
if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) {
|
||||
from &= -2;
|
||||
|
||||
if (from + length >= string->len) {
|
||||
if (length >= string->len - from) {
|
||||
length = string->len - from;
|
||||
}
|
||||
|
||||
@@ -1510,14 +1510,14 @@ mbfl_strcut(
|
||||
} else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) {
|
||||
from &= -4;
|
||||
|
||||
if (from + length >= string->len) {
|
||||
if (length >= string->len - from) {
|
||||
length = string->len - from;
|
||||
}
|
||||
|
||||
start = string->val + from;
|
||||
end = start + (length & -4);
|
||||
} else if ((encoding->flag & MBFL_ENCTYPE_SBCS)) {
|
||||
if (from + length >= string->len) {
|
||||
if (length >= string->len - from) {
|
||||
length = string->len - from;
|
||||
}
|
||||
|
||||
@@ -1539,7 +1539,7 @@ mbfl_strcut(
|
||||
start = p;
|
||||
|
||||
/* search end position */
|
||||
if ((start - string->val) + length >= (int)string->len) {
|
||||
if (length >= (int)string->len - (start - string->val)) {
|
||||
end = string->val + string->len;
|
||||
} else {
|
||||
for (q = p + length; p < q; p += (m = mbtab[*p]));
|
||||
@@ -2024,7 +2024,7 @@ mbfl_ja_jp_hantozen(
|
||||
mbfl_no_encoding_wchar,
|
||||
(int(*)(int, void*))next_filter->filter_function,
|
||||
(int(*)(void*))next_filter->filter_flush,
|
||||
next_filter);
|
||||
next_filter);
|
||||
if (encoder == NULL) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -207,6 +207,7 @@ static php_stream *phar_make_dirstream(char *dir, HashTable *manifest TSRMLS_DC)
|
||||
zend_hash_internal_pointer_reset(manifest);
|
||||
|
||||
while (FAILURE != zend_hash_has_more_elements(manifest)) {
|
||||
keylen = 0;
|
||||
if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(manifest, &key, &keylen, &unused, 0, NULL)) {
|
||||
break;
|
||||
}
|
||||
@@ -214,7 +215,7 @@ static php_stream *phar_make_dirstream(char *dir, HashTable *manifest TSRMLS_DC)
|
||||
PHAR_STR(key, str_key);
|
||||
|
||||
if (keylen <= (uint)dirlen) {
|
||||
if (keylen < (uint)dirlen || !strncmp(str_key, dir, dirlen)) {
|
||||
if (keylen == 0 || keylen < (uint)dirlen || !strncmp(str_key, dir, dirlen)) {
|
||||
PHAR_STR_FREE(str_key);
|
||||
if (SUCCESS != zend_hash_move_forward(manifest)) {
|
||||
break;
|
||||
|
||||
@@ -2261,6 +2261,10 @@ int phar_split_fname(char *filename, int filename_len, char **arch, int *arch_le
|
||||
#endif
|
||||
int ext_len, free_filename = 0;
|
||||
|
||||
if (CHECK_NULL_PATH(filename, filename_len)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (!strncasecmp(filename, "phar://", 7)) {
|
||||
filename += 7;
|
||||
filename_len -= 7;
|
||||
|
||||
+20
-20
@@ -478,7 +478,7 @@ PHP_METHOD(Phar, mount)
|
||||
int fname_len, arch_len, entry_len, path_len, actual_len;
|
||||
phar_archive_data **pphar;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp", &path, &path_len, &actual, &actual_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -960,7 +960,7 @@ PHP_METHOD(Phar, createDefaultStub)
|
||||
int index_len = 0, webindex_len = 0;
|
||||
size_t stub_len;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ss", &index, &index_len, &webindex, &webindex_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|pp", &index, &index_len, &webindex, &webindex_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1004,7 +1004,7 @@ PHP_METHOD(Phar, loadPhar)
|
||||
char *fname, *alias = NULL, *error;
|
||||
int fname_len, alias_len = 0;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!", &fname, &fname_len, &alias, &alias_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|s!", &fname, &fname_len, &alias, &alias_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1083,7 +1083,7 @@ PHP_METHOD(Phar, isValidPharFilename)
|
||||
int fname_len, ext_len, is_executable;
|
||||
zend_bool executable = 1;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &fname, &fname_len, &executable) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &fname, &fname_len, &executable) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1154,11 +1154,11 @@ PHP_METHOD(Phar, __construct)
|
||||
is_data = instanceof_function(Z_OBJCE_P(zobj), phar_ce_data TSRMLS_CC);
|
||||
|
||||
if (is_data) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!l", &fname, &fname_len, &flags, &alias, &alias_len, &format) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ls!l", &fname, &fname_len, &flags, &alias, &alias_len, &format) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!", &fname, &fname_len, &flags, &alias, &alias_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ls!", &fname, &fname_len, &flags, &alias, &alias_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1326,7 +1326,7 @@ PHP_METHOD(Phar, unlinkArchive)
|
||||
int fname_len, zname_len, arch_len, entry_len;
|
||||
phar_archive_data *phar;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &fname, &fname_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1756,7 +1756,7 @@ PHP_METHOD(Phar, buildFromDirectory)
|
||||
return;
|
||||
}
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &dir, &dir_len, ®ex, ®ex_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|s", &dir, &dir_len, ®ex, ®ex_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -2628,7 +2628,7 @@ PHP_METHOD(Phar, delete)
|
||||
return;
|
||||
}
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &fname, &fname_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -3440,7 +3440,7 @@ PHP_METHOD(Phar, copy)
|
||||
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &oldfile, &oldfile_len, &newfile, &newfile_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp", &oldfile, &oldfile_len, &newfile, &newfile_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3546,7 +3546,7 @@ PHP_METHOD(Phar, offsetExists)
|
||||
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &fname, &fname_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3583,7 +3583,7 @@ PHP_METHOD(Phar, offsetGet)
|
||||
phar_entry_info *entry;
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &fname, &fname_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3731,8 +3731,8 @@ PHP_METHOD(Phar, offsetSet)
|
||||
return;
|
||||
}
|
||||
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "sr", &fname, &fname_len, &zresource) == FAILURE
|
||||
&& zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &fname, &fname_len, &cont_str, &cont_len) == FAILURE) {
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "pr", &fname, &fname_len, &zresource) == FAILURE
|
||||
&& zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ps", &fname, &fname_len, &cont_str, &cont_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3770,7 +3770,7 @@ PHP_METHOD(Phar, offsetUnset)
|
||||
return;
|
||||
}
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &fname, &fname_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3817,7 +3817,7 @@ PHP_METHOD(Phar, addEmptyDir)
|
||||
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &dirname, &dirname_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &dirname, &dirname_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3842,7 +3842,7 @@ PHP_METHOD(Phar, addFile)
|
||||
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &fname, &fname_len, &localname, &localname_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|s", &fname, &fname_len, &localname, &localname_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3886,7 +3886,7 @@ PHP_METHOD(Phar, addFromString)
|
||||
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &localname, &localname_len, &cont_str, &cont_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ps", &localname, &localname_len, &cont_str, &cont_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4313,7 +4313,7 @@ PHP_METHOD(Phar, extractTo)
|
||||
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z!b", &pathto, &pathto_len, &zval_files, &overwrite) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|z!b", &pathto, &pathto_len, &zval_files, &overwrite) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4452,7 +4452,7 @@ PHP_METHOD(PharFileInfo, __construct)
|
||||
phar_archive_data *phar_data;
|
||||
zval *zobj = getThis(), arg1;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &fname, &fname_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -356,7 +356,7 @@ bail:
|
||||
entry.filename_len = entry.uncompressed_filesize;
|
||||
|
||||
/* Check for overflow - bug 61065 */
|
||||
if (entry.filename_len == UINT_MAX) {
|
||||
if (entry.filename_len == UINT_MAX || entry.filename_len == 0) {
|
||||
if (error) {
|
||||
spprintf(error, 4096, "phar error: \"%s\" is a corrupted tar file (invalid entry size)", fname);
|
||||
}
|
||||
|
||||
@@ -126,19 +126,19 @@ echo $e->getMessage() . "\n";
|
||||
--EXPECTF--
|
||||
Warning: Phar::mungServer() expects parameter 1 to be array, %string given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: Phar::createDefaultStub() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
|
||||
Warning: Phar::createDefaultStub() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: Phar::loadPhar() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
|
||||
Warning: Phar::loadPhar() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: Phar::canCompress() expects parameter 1 to be long, %string given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: Phar::__construct() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
|
||||
Warning: Phar::__construct() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: Phar::convertToExecutable() expects parameter 1 to be long, array given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: Phar::convertToData() expects parameter 1 to be long, array given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: PharData::delete() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
|
||||
Warning: PharData::delete() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
|
||||
Cannot write out phar archive, phar is read-only
|
||||
Entry oops does not exist and cannot be deleted
|
||||
%sfiles/frontcontroller10.phar
|
||||
@@ -165,18 +165,18 @@ Phar is readonly, cannot change compression
|
||||
Warning: Phar::copy() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
|
||||
Cannot copy "a" to "b", phar is read-only
|
||||
|
||||
Warning: Phar::offsetExists() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
|
||||
Warning: Phar::offsetExists() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: Phar::offsetGet() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
|
||||
Warning: Phar::offsetGet() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: Phar::offsetSet() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: PharData::offsetUnset() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
|
||||
Warning: PharData::offsetUnset() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
|
||||
Write operations disabled by the php.ini setting phar.readonly
|
||||
|
||||
Warning: Phar::addEmptyDir() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
|
||||
Warning: Phar::addEmptyDir() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: Phar::addFile() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
|
||||
Warning: Phar::addFile() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: Phar::addFromString() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
|
||||
Write operations disabled by the php.ini setting phar.readonly
|
||||
|
||||
@@ -48,11 +48,12 @@ try {
|
||||
<?php
|
||||
@unlink(__DIR__."/bug64931.phar");
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
Test
|
||||
CAUGHT: Cannot create any files in magic ".phar" directory
|
||||
CAUGHT: Cannot create any files in magic ".phar" directory
|
||||
CAUGHT: Cannot create any files in magic ".phar" directory
|
||||
CAUGHT: Cannot create any files in magic ".phar" directory
|
||||
CAUGHT: Cannot create any files in magic ".phar" directory
|
||||
===DONE===
|
||||
|
||||
Warning: Phar::addFromString() expects parameter 1 to be a valid path, string given in %s%ebug64931.php on line %d
|
||||
===DONE===
|
||||
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #71331 (Uninitialized pointer in phar_make_dirstream())
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$p = new PharData(__DIR__."/bug71331.tar");
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught exception 'UnexpectedValueException' with message 'phar error: "%s/bug71331.tar" is a corrupted tar file (invalid entry size)' in %s/bug71331.php:2
|
||||
Stack trace:
|
||||
#0 %s/bug71331.php(2): PharData->__construct('%s')
|
||||
#1 {main}
|
||||
thrown in %s/bug71331.php on line 2
|
||||
Binary file not shown.
@@ -7,6 +7,7 @@ Phar: bug #71488: Stack overflow when decompressing tar archives
|
||||
$p = new PharData(__DIR__."/bug71488.tar");
|
||||
$newp = $p->decompress("test");
|
||||
?>
|
||||
|
||||
DONE
|
||||
--CLEAN--
|
||||
<?php
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Phar: bug #71498: Out-of-Bound Read in phar_parse_zipfile()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
try {
|
||||
$p = new PharData(__DIR__."/bug71498.zip");
|
||||
} catch(UnexpectedValueException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
?>
|
||||
|
||||
DONE
|
||||
--EXPECTF--
|
||||
phar error: end of central directory not found in zip-based phar "%s/bug71498.zip"
|
||||
DONE
|
||||
Binary file not shown.
@@ -80,6 +80,5 @@ string(5) "query"
|
||||
11:Error: file_put_contents(phar:///%s): failed to open stream: phar error: invalid path "%s" contains illegal character
|
||||
12:Error: file_put_contents(phar:///%s): failed to open stream: phar error: invalid path "%s" contains illegal character
|
||||
13:Error: file_put_contents(phar:///%s): failed to open stream: phar error: invalid path "%s" contains illegal character
|
||||
Exception: Entry a does not exist and cannot be created: phar error: invalid path "a" contains illegal character
|
||||
===DONE===
|
||||
Error: Phar::offsetSet() expects parameter 1 to be a valid path, string given===DONE===
|
||||
|
||||
@@ -138,7 +138,7 @@ string(3) "hi2"
|
||||
bool(false)
|
||||
Invalid argument, expected a filename (string) or array of filenames
|
||||
|
||||
Warning: Phar::extractTo() expects parameter 1 to be %string, array given in %sphar_extract.php on line %d
|
||||
Warning: Phar::extractTo() expects parameter 1 to be a valid path, array given in %sphar_extract.php on line %d
|
||||
Invalid argument, extraction path must be non-zero length
|
||||
Unable to use path "%soops" for extraction, it is a file, must be a directory
|
||||
Invalid argument, array of filenames to extract contains non-string value
|
||||
|
||||
@@ -76,7 +76,7 @@ var_dump(Phar::isValidPharFilename('dir.phar.php', false));
|
||||
<?php
|
||||
rmdir(dirname(__FILE__) . '/.phar');
|
||||
--EXPECTF--
|
||||
Warning: Phar::isValidPharFilename() expects parameter 1 to be %string, array given in %sphar_isvalidpharfilename.php on line %d
|
||||
Warning: Phar::isValidPharFilename() expects parameter 1 to be a valid path, array given in %sphar_isvalidpharfilename.php on line %d
|
||||
*
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
@@ -90,7 +90,7 @@ Unknown phar archive ""
|
||||
Unknown phar archive "%sphar_unlinkarchive.phar"
|
||||
Unknown phar archive "%sphar_unlinkarchive.phar.tar": internal corruption of phar "%sphar_unlinkarchive.phar.tar" (truncated entry)
|
||||
|
||||
Warning: Phar::unlinkArchive() expects parameter 1 to be %string, array given in %sphar_unlinkarchive.php on line %d
|
||||
Warning: Phar::unlinkArchive() expects parameter 1 to be a valid path, array given in %sphar_unlinkarchive.php on line %d
|
||||
bool(false)
|
||||
string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
|
||||
phar archive "%sphar_unlinkarchive.phar" has open file handles or objects. fclose() all file handles, and unset() all objects prior to calling unlinkArchive()
|
||||
|
||||
@@ -47,7 +47,7 @@ echo $e->getMessage() . "\n";
|
||||
--EXPECTF--
|
||||
Cannot open phar file 'phar://%spharfileinfo_construct.phar/oops': internal corruption of phar "%spharfileinfo_construct.phar" (truncated entry)
|
||||
|
||||
Warning: PharFileInfo::__construct() expects parameter 1 to be %string, array given in %spharfileinfo_construct.php on line %d
|
||||
Warning: PharFileInfo::__construct() expects parameter 1 to be a valid path, array given in %spharfileinfo_construct.php on line %d
|
||||
Cannot access phar file entry '/oops/I/do/not/exist' in archive '%spharfileinfo_construct.phar'
|
||||
Cannot call constructor twice
|
||||
'%spharfileinfo_construct.php' is not a valid phar archive URL (must have at least phar://filename.phar)
|
||||
|
||||
+3
-3
@@ -159,7 +159,7 @@ static void phar_zip_u2d_time(time_t time, char *dtime, char *ddate) /* {{{ */
|
||||
*
|
||||
* Parse a new one and add it to the cache, returning either SUCCESS or
|
||||
* FAILURE, and setting pphar to the pointer to the manifest entry
|
||||
*
|
||||
*
|
||||
* This is used by phar_open_from_fp to process a zip-based phar, but can be called
|
||||
* directly.
|
||||
*/
|
||||
@@ -199,7 +199,7 @@ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias,
|
||||
}
|
||||
|
||||
while ((p=(char *) memchr(p + 1, 'P', (size_t) (size - (p + 1 - buf)))) != NULL) {
|
||||
if (!memcmp(p + 1, "K\5\6", 3)) {
|
||||
if ((p - buf) + sizeof(locator) <= size && !memcmp(p + 1, "K\5\6", 3)) {
|
||||
memcpy((void *)&locator, (void *) p, sizeof(locator));
|
||||
if (PHAR_GET_16(locator.centraldisk) != 0 || PHAR_GET_16(locator.disknumber) != 0) {
|
||||
/* split archives not handled */
|
||||
@@ -1161,7 +1161,7 @@ int phar_zip_flush(phar_archive_data *phar, char *user_stub, long len, int defau
|
||||
static const char newstub[] = "<?php // zip-based phar archive stub file\n__HALT_COMPILER();";
|
||||
char halt_stub[] = "__HALT_COMPILER();";
|
||||
char *tmp;
|
||||
|
||||
|
||||
php_stream *stubfile, *oldfile;
|
||||
php_serialize_data_t metadata_hash;
|
||||
int free_user_stub, closeoldfile = 0;
|
||||
|
||||
+1
-1
@@ -533,7 +533,7 @@ static void php_snmp_error(zval *object, const char *docref TSRMLS_DC, int type,
|
||||
}
|
||||
|
||||
if (object && (snmp_object->exceptions_enabled & type)) {
|
||||
zend_throw_exception_ex(php_snmp_exception_ce, type TSRMLS_CC, snmp_object->snmp_errstr);
|
||||
zend_throw_exception_ex(php_snmp_exception_ce, type TSRMLS_CC, "%s", snmp_object->snmp_errstr);
|
||||
} else {
|
||||
va_start(args, format);
|
||||
php_verror(docref, "", E_WARNING, format, args TSRMLS_CC);
|
||||
|
||||
@@ -50,6 +50,10 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
# include "win32/php_stdint.h"
|
||||
#else
|
||||
@@ -67,6 +71,13 @@ PHP_MINIT_FUNCTION(exec)
|
||||
{
|
||||
#ifdef _SC_ARG_MAX
|
||||
cmd_max_len = sysconf(_SC_ARG_MAX);
|
||||
if (-1 == cmd_max_len) {
|
||||
#ifdef _POSIX_ARG_MAX
|
||||
cmd_max_len = _POSIX_ARG_MAX;
|
||||
#else
|
||||
cmd_max_len = 4096;
|
||||
#endif
|
||||
}
|
||||
#elif defined(ARG_MAX)
|
||||
cmd_max_len = ARG_MAX;
|
||||
#elif defined(PHP_WIN32)
|
||||
|
||||
@@ -1758,6 +1758,12 @@ PHPAPI PHP_FUNCTION(fread)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (len > INT_MAX) {
|
||||
/* string length is int in 5.x so we can not read more than int */
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be no more than %d", INT_MAX);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
Z_STRVAL_P(return_value) = emalloc(len + 1);
|
||||
Z_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len);
|
||||
|
||||
|
||||
+28
-23
@@ -163,7 +163,7 @@ static inline unsigned int get_next_char(
|
||||
else
|
||||
MB_FAILURE(pos, 4);
|
||||
}
|
||||
|
||||
|
||||
this_char = ((c & 0x07) << 18) | ((str[pos + 1] & 0x3f) << 12) | ((str[pos + 2] & 0x3f) << 6) | (str[pos + 3] & 0x3f);
|
||||
if (this_char < 0x10000 || this_char > 0x10FFFF) { /* non-shortest form or outside range */
|
||||
MB_FAILURE(pos, 4);
|
||||
@@ -437,7 +437,7 @@ det_charset:
|
||||
|
||||
if (charset_hint) {
|
||||
int found = 0;
|
||||
|
||||
|
||||
/* now walk the charset map and look for the codeset */
|
||||
for (i = 0; charset_map[i].codeset; i++) {
|
||||
if (len == strlen(charset_map[i].codeset) && strncasecmp(charset_hint, charset_map[i].codeset, len) == 0) {
|
||||
@@ -545,7 +545,7 @@ static inline unsigned char unimap_bsearch(const uni_to_enc *table, unsigned cod
|
||||
return 0;
|
||||
|
||||
code_key = (unsigned short) code_key_a;
|
||||
|
||||
|
||||
while (l <= h) {
|
||||
m = l + (h - l) / 2;
|
||||
if (code_key < m->un_code_point)
|
||||
@@ -571,7 +571,7 @@ static inline int map_from_unicode(unsigned code, enum entity_charset charset, u
|
||||
/* identity mapping of code points to unicode */
|
||||
if (code > 0xFF) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
*res = code;
|
||||
break;
|
||||
|
||||
@@ -590,7 +590,7 @@ static inline int map_from_unicode(unsigned code, enum entity_charset charset, u
|
||||
return FAILURE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case cs_8859_15:
|
||||
if (code < 0xA4 || (code > 0xBE && code <= 0xFF)) {
|
||||
*res = code;
|
||||
@@ -634,7 +634,7 @@ static inline int map_from_unicode(unsigned code, enum entity_charset charset, u
|
||||
case cs_cp866:
|
||||
table = unimap_cp866;
|
||||
table_size = sizeof(unimap_cp866) / sizeof(*unimap_cp866);
|
||||
|
||||
|
||||
table_over_7F:
|
||||
if (code <= 0x7F) {
|
||||
*res = code;
|
||||
@@ -710,7 +710,7 @@ static inline int unicode_cp_is_allowed(unsigned uni_cp, int document_type)
|
||||
* Not sure this is the relevant part for HTML 5, though. I opted to
|
||||
* disallow the characters that would result in a parse error when
|
||||
* preprocessing of the input stream. See also section 8.1.3.
|
||||
*
|
||||
*
|
||||
* It's unclear if XHTML 1.0 allows C1 characters. I'll opt to apply to
|
||||
* XHTML 1.0 the same rules as for XML 1.0.
|
||||
* See <http://cmsmcq.com/2007/C1.xml>.
|
||||
@@ -774,7 +774,7 @@ static inline int numeric_entity_is_allowed(unsigned uni_cp, int document_type)
|
||||
/* {{{ process_numeric_entity
|
||||
* Auxiliary function to traverse_for_entities.
|
||||
* On input, *buf should point to the first character after # and on output, it's the last
|
||||
* byte read, no matter if there was success or insuccess.
|
||||
* byte read, no matter if there was success or insuccess.
|
||||
*/
|
||||
static inline int process_numeric_entity(const char **buf, unsigned *code_point)
|
||||
{
|
||||
@@ -784,7 +784,7 @@ static inline int process_numeric_entity(const char **buf, unsigned *code_point)
|
||||
|
||||
if (hexadecimal && (**buf != '\0'))
|
||||
(*buf)++;
|
||||
|
||||
|
||||
/* strtol allows whitespace and other stuff in the beginning
|
||||
* we're not interested */
|
||||
if ((hexadecimal && !isxdigit(**buf)) ||
|
||||
@@ -969,7 +969,7 @@ static void traverse_for_entities(
|
||||
goto invalid_code;
|
||||
|
||||
/* are we allowed to decode this entity in this document type?
|
||||
* HTML 5 is the only that has a character that cannot be used in
|
||||
* HTML 5 is the only that has a character that cannot be used in
|
||||
* a numeric entity but is allowed literally (U+000D). The
|
||||
* unoptimized version would be ... || !numeric_entity_is_allowed(code) */
|
||||
if (!unicode_cp_is_allowed(code, doctype) ||
|
||||
@@ -996,9 +996,9 @@ static void traverse_for_entities(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
assert(*next == ';');
|
||||
|
||||
|
||||
if (((code == '\'' && !(flags & ENT_HTML_QUOTE_SINGLE)) ||
|
||||
(code == '"' && !(flags & ENT_HTML_QUOTE_DOUBLE)))
|
||||
/* && code2 == '\0' always true for current maps */)
|
||||
@@ -1026,7 +1026,7 @@ invalid_code:
|
||||
*(q++) = *p;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
*q = '\0';
|
||||
*retlen = (size_t)(q - ret);
|
||||
}
|
||||
@@ -1066,7 +1066,7 @@ static entity_table_opt determine_entity_table(int all, int doctype)
|
||||
entity_table_opt retval = {NULL};
|
||||
|
||||
assert(!(doctype == ENT_HTML_DOC_XML1 && all));
|
||||
|
||||
|
||||
if (all) {
|
||||
retval.ms_table = (doctype == ENT_HTML_DOC_HTML5) ?
|
||||
entity_ms_table_html5 : entity_ms_table_html4;
|
||||
@@ -1111,13 +1111,13 @@ PHPAPI char *php_unescape_html_entities(unsigned char *old, size_t oldlen, size_
|
||||
if (retlen == 0) {
|
||||
goto empty_source;
|
||||
}
|
||||
|
||||
|
||||
inverse_map = unescape_inverse_map(all, flags);
|
||||
|
||||
|
||||
/* replace numeric entities */
|
||||
traverse_for_entities(old, oldlen, ret, &retlen, all, flags, inverse_map, charset);
|
||||
|
||||
empty_source:
|
||||
empty_source:
|
||||
*newlen = retlen;
|
||||
return ret;
|
||||
}
|
||||
@@ -1141,7 +1141,7 @@ static inline void find_entity_for_char(
|
||||
{
|
||||
unsigned stage1_idx = ENT_STAGE1_INDEX(k);
|
||||
const entity_stage3_row *c;
|
||||
|
||||
|
||||
if (stage1_idx > 0x1D) {
|
||||
*entity = NULL;
|
||||
*entity_len = 0;
|
||||
@@ -1162,7 +1162,7 @@ static inline void find_entity_for_char(
|
||||
if (!(*cursor < oldlen))
|
||||
goto no_suitable_2nd;
|
||||
|
||||
next_char = get_next_char(charset, old, oldlen, cursor, &status);
|
||||
next_char = get_next_char(charset, old, oldlen, cursor, &status);
|
||||
|
||||
if (status == FAILURE)
|
||||
goto no_suitable_2nd;
|
||||
@@ -1187,7 +1187,7 @@ no_suitable_2nd:
|
||||
*entity = (const unsigned char *)
|
||||
c->data.multicodepoint_table[0].leading_entry.default_entity;
|
||||
*entity_len = c->data.multicodepoint_table[0].leading_entry.default_entity_len;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1255,7 +1255,7 @@ PHPAPI char *php_escape_html_entities_ex(unsigned char *old, size_t oldlen, size
|
||||
|
||||
/* initial estimate */
|
||||
if (oldlen < 64) {
|
||||
maxlen = 128;
|
||||
maxlen = 128;
|
||||
} else {
|
||||
maxlen = 2 * oldlen;
|
||||
if (maxlen < oldlen) {
|
||||
@@ -1423,6 +1423,11 @@ encode_amp:
|
||||
}
|
||||
replaced[len] = '\0';
|
||||
*newlen = len;
|
||||
if(len > INT_MAX) {
|
||||
zend_error_noreturn(E_ERROR, "Escaped string is too long");
|
||||
efree(replaced);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return replaced;
|
||||
}
|
||||
@@ -1577,7 +1582,7 @@ static inline void write_s3row_data(
|
||||
} else {
|
||||
spe_cp = uni_cp;
|
||||
}
|
||||
|
||||
|
||||
written_k2 = write_octet_sequence(&key[written_k1], charset, spe_cp);
|
||||
memcpy(&entity[1], mcpr[i].normal_entry.entity, l);
|
||||
entity[l + 1] = ';';
|
||||
@@ -1615,7 +1620,7 @@ PHP_FUNCTION(get_html_translation_table)
|
||||
LIMIT_ALL(all, doctype, charset);
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
|
||||
entity_table = determine_entity_table(all, doctype);
|
||||
if (all && !CHARSET_UNICODE_COMPAT(charset)) {
|
||||
to_uni_table = enc_to_uni_index[charset];
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #72114 (Integer underflow / arbitrary null write in fread/gzread)
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set('memory_limit', "2500M");
|
||||
$fp = fopen("/dev/zero", "r");
|
||||
fread($fp, 2147483648);
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
Warning: fread(): Length parameter must be no more than 2147483647 in %s/bug72114.php on line %d
|
||||
Done
|
||||
+1
-1
@@ -599,7 +599,7 @@ PHPAPI int php_url_decode(char *str, int len)
|
||||
*/
|
||||
PHPAPI char *php_raw_url_encode(char const *s, int len, int *new_length)
|
||||
{
|
||||
register int x, y;
|
||||
register size_t x, y;
|
||||
unsigned char *str;
|
||||
|
||||
str = (unsigned char *) safe_emalloc(3, len, 1);
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
--TEST--
|
||||
Bug #71587 (Use-After-Free / Double-Free in WDDX Deserialize)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("wddx")) print "skip";
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$xml = <<<EOF
|
||||
<?xml version='1.0' ?>
|
||||
<!DOCTYPE wddxPacket SYSTEM 'wddx_0100.dtd'>
|
||||
<wddxPacket version='1.0'>
|
||||
<array>
|
||||
<var name='ML'></var>
|
||||
<string>manhluat</string>
|
||||
<var name='ML2'></var>
|
||||
<boolean value='a'/>
|
||||
<boolean value='true'/>
|
||||
</array>
|
||||
</wddxPacket>
|
||||
EOF;
|
||||
|
||||
$wddx = wddx_deserialize($xml);
|
||||
var_dump($wddx);
|
||||
// Print mem leak
|
||||
foreach($wddx as $k=>$v)
|
||||
printf("Key: %s\nValue: %s\n",bin2hex($k),bin2hex($v));
|
||||
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(8) "manhluat"
|
||||
[1]=>
|
||||
bool(true)
|
||||
}
|
||||
Key: 30
|
||||
Value: 6d616e686c756174
|
||||
Key: 31
|
||||
Value: 31
|
||||
DONE
|
||||
+15
-4
@@ -936,6 +936,16 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name)
|
||||
!strcmp(name, EL_DATETIME)) {
|
||||
wddx_stack_top(stack, (void**)&ent1);
|
||||
|
||||
if (!ent1->data) {
|
||||
if (stack->top > 1) {
|
||||
stack->top--;
|
||||
} else {
|
||||
stack->done = 1;
|
||||
}
|
||||
efree(ent1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strcmp(name, EL_BINARY)) {
|
||||
int new_len=0;
|
||||
unsigned char *new_str;
|
||||
@@ -1032,6 +1042,7 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name)
|
||||
}
|
||||
} else if (!strcmp(name, EL_VAR) && stack->varname) {
|
||||
efree(stack->varname);
|
||||
stack->varname = NULL;
|
||||
} else if (!strcmp(name, EL_FIELD)) {
|
||||
st_entry *ent;
|
||||
wddx_stack_top(stack, (void **)&ent);
|
||||
@@ -1051,7 +1062,7 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len)
|
||||
|
||||
if (!wddx_stack_is_empty(stack) && !stack->done) {
|
||||
wddx_stack_top(stack, (void**)&ent);
|
||||
switch (Z_TYPE_P(ent)) {
|
||||
switch (ent->type) {
|
||||
case ST_STRING:
|
||||
if (Z_STRLEN_P(ent->data) == 0) {
|
||||
STR_FREE(Z_STRVAL_P(ent->data));
|
||||
@@ -1090,11 +1101,11 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len)
|
||||
} else if (!strcmp(s, "false")) {
|
||||
Z_LVAL_P(ent->data) = 0;
|
||||
} else {
|
||||
stack->top--;
|
||||
zval_ptr_dtor(&ent->data);
|
||||
if (ent->varname)
|
||||
if (ent->varname) {
|
||||
efree(ent->varname);
|
||||
efree(ent);
|
||||
}
|
||||
ent->data = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #72099: xml_parse_into_struct segmentation fault
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once("skipif.inc");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$var1=xml_parser_create_ns();
|
||||
$var2=str_repeat("a", 10);
|
||||
$var3=[];
|
||||
$var4=[];
|
||||
xml_parse_into_struct($var1, $var2, $var3, $var4);
|
||||
var_dump($var3);
|
||||
--EXPECT--
|
||||
array(0) {
|
||||
}
|
||||
+53
-53
@@ -283,7 +283,7 @@ xml_encoding xml_encodings[] = {
|
||||
static XML_Memory_Handling_Suite php_xml_mem_hdlrs;
|
||||
|
||||
/* True globals, no need for thread safety */
|
||||
static int le_xml_parser;
|
||||
static int le_xml_parser;
|
||||
|
||||
/* }}} */
|
||||
|
||||
@@ -343,7 +343,7 @@ PHP_MINIT_FUNCTION(xml)
|
||||
REGISTER_LONG_CONSTANT("XML_OPTION_SKIP_WHITE", PHP_XML_OPTION_SKIP_WHITE, CONST_CS|CONST_PERSISTENT);
|
||||
|
||||
/* this object should not be pre-initialised at compile time,
|
||||
as the order of members may vary */
|
||||
as the order of members may vary */
|
||||
|
||||
php_xml_mem_hdlrs.malloc_fcn = php_xml_malloc_wrapper;
|
||||
php_xml_mem_hdlrs.realloc_fcn = php_xml_realloc_wrapper;
|
||||
@@ -404,7 +404,7 @@ static zval *_xml_xmlchar_zval(const XML_Char *s, int len, const XML_Char *encod
|
||||
{
|
||||
zval *ret;
|
||||
MAKE_STD_ZVAL(ret);
|
||||
|
||||
|
||||
if (s == NULL) {
|
||||
ZVAL_FALSE(ret);
|
||||
return ret;
|
||||
@@ -422,7 +422,7 @@ static zval *_xml_xmlchar_zval(const XML_Char *s, int len, const XML_Char *encod
|
||||
static void xml_parser_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
{
|
||||
xml_parser *parser = (xml_parser *)rsrc->ptr;
|
||||
|
||||
|
||||
if (parser->parser) {
|
||||
XML_ParserFree(parser->parser);
|
||||
}
|
||||
@@ -503,7 +503,7 @@ static void xml_set_handler(zval **handler, zval **data)
|
||||
/* {{{ xml_call_handler() */
|
||||
static zval *xml_call_handler(xml_parser *parser, zval *handler, zend_function *function_ptr, int argc, zval **argv)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (parser && handler && !EG(exception)) {
|
||||
@@ -516,7 +516,7 @@ static zval *xml_call_handler(xml_parser *parser, zval *handler, zend_function *
|
||||
for (i = 0; i < argc; i++) {
|
||||
args[i] = &argv[i];
|
||||
}
|
||||
|
||||
|
||||
fci.size = sizeof(fci);
|
||||
fci.function_table = EG(function_table);
|
||||
fci.function_name = handler;
|
||||
@@ -540,7 +540,7 @@ static zval *xml_call_handler(xml_parser *parser, zval *handler, zend_function *
|
||||
Z_TYPE_PP(obj) == IS_OBJECT &&
|
||||
Z_TYPE_PP(method) == IS_STRING) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s::%s()", Z_OBJCE_PP(obj)->name, Z_STRVAL_PP(method));
|
||||
} else
|
||||
} else
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler");
|
||||
}
|
||||
|
||||
@@ -739,14 +739,14 @@ static void _xml_add_to_info(xml_parser *parser,char *name)
|
||||
|
||||
if (zend_hash_find(Z_ARRVAL_P(parser->info),name,strlen(name) + 1,(void **) &element) == FAILURE) {
|
||||
MAKE_STD_ZVAL(values);
|
||||
|
||||
|
||||
array_init(values);
|
||||
|
||||
|
||||
zend_hash_update(Z_ARRVAL_P(parser->info), name, strlen(name)+1, (void *) &values, sizeof(zval*), (void **) &element);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
add_next_index_long(*element,parser->curtag);
|
||||
|
||||
|
||||
parser->curtag++;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -798,11 +798,11 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch
|
||||
|
||||
efree(att);
|
||||
}
|
||||
|
||||
|
||||
if ((retval = xml_call_handler(parser, parser->startElementHandler, parser->startElementPtr, 3, args))) {
|
||||
zval_ptr_dtor(&retval);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parser->data) {
|
||||
if (parser->level <= XML_MAXLEVEL) {
|
||||
@@ -874,7 +874,7 @@ void _xml_endElementHandler(void *userData, const XML_Char *name)
|
||||
if ((retval = xml_call_handler(parser, parser->endElementHandler, parser->endElementPtr, 2, args))) {
|
||||
zval_ptr_dtor(&retval);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parser->data) {
|
||||
zval *tag;
|
||||
@@ -885,13 +885,13 @@ void _xml_endElementHandler(void *userData, const XML_Char *name)
|
||||
MAKE_STD_ZVAL(tag);
|
||||
|
||||
array_init(tag);
|
||||
|
||||
|
||||
_xml_add_to_info(parser,((char *) tag_name) + parser->toffset);
|
||||
|
||||
add_assoc_string(tag,"tag",((char *) tag_name) + parser->toffset,1); /* cast to avoid gcc-warning */
|
||||
add_assoc_string(tag,"type","close",1);
|
||||
add_assoc_long(tag,"level",parser->level);
|
||||
|
||||
|
||||
zend_hash_next_index_insert(Z_ARRVAL_P(parser->data),&tag,sizeof(zval*),NULL);
|
||||
}
|
||||
|
||||
@@ -923,7 +923,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len)
|
||||
if ((retval = xml_call_handler(parser, parser->characterDataHandler, parser->characterDataPtr, 2, args))) {
|
||||
zval_ptr_dtor(&retval);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parser->data) {
|
||||
int i;
|
||||
@@ -931,7 +931,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len)
|
||||
|
||||
char *decoded_value;
|
||||
int decoded_len;
|
||||
|
||||
|
||||
decoded_value = xml_utf8_decode(s,len,&decoded_len,parser->target_encoding);
|
||||
for (i = 0; i < decoded_len; i++) {
|
||||
switch (decoded_value[i]) {
|
||||
@@ -950,7 +950,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len)
|
||||
if (doprint || (! parser->skipwhite)) {
|
||||
if (parser->lastwasopen) {
|
||||
zval **myval;
|
||||
|
||||
|
||||
/* check if the current tag already has a value - if yes append to that! */
|
||||
if (zend_hash_find(Z_ARRVAL_PP(parser->ctag),"value",sizeof("value"),(void **) &myval) == SUCCESS) {
|
||||
int newlen = Z_STRLEN_PP(myval) + decoded_len;
|
||||
@@ -961,7 +961,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len)
|
||||
} else {
|
||||
add_assoc_string(*(parser->ctag),"value",decoded_value,0);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
zval *tag;
|
||||
zval **curtag, **mytype, **myval;
|
||||
@@ -984,7 +984,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len)
|
||||
}
|
||||
}
|
||||
|
||||
if (parser->level <= XML_MAXLEVEL) {
|
||||
if (parser->level <= XML_MAXLEVEL && parser->level > 0) {
|
||||
MAKE_STD_ZVAL(tag);
|
||||
|
||||
array_init(tag);
|
||||
@@ -1046,8 +1046,8 @@ void _xml_defaultHandler(void *userData, const XML_Char *s, int len)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ _xml_unparsedEntityDeclHandler() */
|
||||
void _xml_unparsedEntityDeclHandler(void *userData,
|
||||
const XML_Char *entityName,
|
||||
void _xml_unparsedEntityDeclHandler(void *userData,
|
||||
const XML_Char *entityName,
|
||||
const XML_Char *base,
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId,
|
||||
@@ -1172,9 +1172,9 @@ static void php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAMETERS, int ns_supp
|
||||
|
||||
char *ns_param = NULL;
|
||||
int ns_param_len = 0;
|
||||
|
||||
|
||||
XML_Char *encoding;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, (ns_support ? "|ss": "|s"), &encoding_param, &encoding_param_len, &ns_param, &ns_param_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -1220,15 +1220,15 @@ static void php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAMETERS, int ns_supp
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource xml_parser_create([string encoding])
|
||||
/* {{{ proto resource xml_parser_create([string encoding])
|
||||
Create an XML parser */
|
||||
PHP_FUNCTION(xml_parser_create)
|
||||
{
|
||||
php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
|
||||
php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource xml_parser_create_ns([string encoding [, string sep]])
|
||||
/* {{{ proto resource xml_parser_create_ns([string encoding [, string sep]])
|
||||
Create an XML parser */
|
||||
PHP_FUNCTION(xml_parser_create_ns)
|
||||
{
|
||||
@@ -1236,7 +1236,7 @@ PHP_FUNCTION(xml_parser_create_ns)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int xml_set_object(resource parser, object &obj)
|
||||
/* {{{ proto int xml_set_object(resource parser, object &obj)
|
||||
Set up object which should be used for callbacks */
|
||||
PHP_FUNCTION(xml_set_object)
|
||||
{
|
||||
@@ -1256,7 +1256,7 @@ PHP_FUNCTION(xml_set_object)
|
||||
|
||||
/* please leave this commented - or ask thies@thieso.net before doing it (again) */
|
||||
/* #ifdef ZEND_ENGINE_2
|
||||
zval_add_ref(&parser->object);
|
||||
zval_add_ref(&parser->object);
|
||||
#endif */
|
||||
|
||||
ALLOC_ZVAL(parser->object);
|
||||
@@ -1266,7 +1266,7 @@ PHP_FUNCTION(xml_set_object)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int xml_set_element_handler(resource parser, string shdl, string ehdl)
|
||||
/* {{{ proto int xml_set_element_handler(resource parser, string shdl, string ehdl)
|
||||
Set up start and end element handlers */
|
||||
PHP_FUNCTION(xml_set_element_handler)
|
||||
{
|
||||
@@ -1286,7 +1286,7 @@ PHP_FUNCTION(xml_set_element_handler)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int xml_set_character_data_handler(resource parser, string hdl)
|
||||
/* {{{ proto int xml_set_character_data_handler(resource parser, string hdl)
|
||||
Set up character data handler */
|
||||
PHP_FUNCTION(xml_set_character_data_handler)
|
||||
{
|
||||
@@ -1305,7 +1305,7 @@ PHP_FUNCTION(xml_set_character_data_handler)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int xml_set_processing_instruction_handler(resource parser, string hdl)
|
||||
/* {{{ proto int xml_set_processing_instruction_handler(resource parser, string hdl)
|
||||
Set up processing instruction (PI) handler */
|
||||
PHP_FUNCTION(xml_set_processing_instruction_handler)
|
||||
{
|
||||
@@ -1324,7 +1324,7 @@ PHP_FUNCTION(xml_set_processing_instruction_handler)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int xml_set_default_handler(resource parser, string hdl)
|
||||
/* {{{ proto int xml_set_default_handler(resource parser, string hdl)
|
||||
Set up default handler */
|
||||
PHP_FUNCTION(xml_set_default_handler)
|
||||
{
|
||||
@@ -1342,7 +1342,7 @@ PHP_FUNCTION(xml_set_default_handler)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int xml_set_unparsed_entity_decl_handler(resource parser, string hdl)
|
||||
/* {{{ proto int xml_set_unparsed_entity_decl_handler(resource parser, string hdl)
|
||||
Set up unparsed entity declaration handler */
|
||||
PHP_FUNCTION(xml_set_unparsed_entity_decl_handler)
|
||||
{
|
||||
@@ -1361,7 +1361,7 @@ PHP_FUNCTION(xml_set_unparsed_entity_decl_handler)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int xml_set_notation_decl_handler(resource parser, string hdl)
|
||||
/* {{{ proto int xml_set_notation_decl_handler(resource parser, string hdl)
|
||||
Set up notation declaration handler */
|
||||
PHP_FUNCTION(xml_set_notation_decl_handler)
|
||||
{
|
||||
@@ -1379,7 +1379,7 @@ PHP_FUNCTION(xml_set_notation_decl_handler)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int xml_set_external_entity_ref_handler(resource parser, string hdl)
|
||||
/* {{{ proto int xml_set_external_entity_ref_handler(resource parser, string hdl)
|
||||
Set up external entity reference handler */
|
||||
PHP_FUNCTION(xml_set_external_entity_ref_handler)
|
||||
{
|
||||
@@ -1397,7 +1397,7 @@ PHP_FUNCTION(xml_set_external_entity_ref_handler)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int xml_set_start_namespace_decl_handler(resource parser, string hdl)
|
||||
/* {{{ proto int xml_set_start_namespace_decl_handler(resource parser, string hdl)
|
||||
Set up character data handler */
|
||||
PHP_FUNCTION(xml_set_start_namespace_decl_handler)
|
||||
{
|
||||
@@ -1416,7 +1416,7 @@ PHP_FUNCTION(xml_set_start_namespace_decl_handler)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int xml_set_end_namespace_decl_handler(resource parser, string hdl)
|
||||
/* {{{ proto int xml_set_end_namespace_decl_handler(resource parser, string hdl)
|
||||
Set up character data handler */
|
||||
PHP_FUNCTION(xml_set_end_namespace_decl_handler)
|
||||
{
|
||||
@@ -1435,7 +1435,7 @@ PHP_FUNCTION(xml_set_end_namespace_decl_handler)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int xml_parse(resource parser, string data [, int isFinal])
|
||||
/* {{{ proto int xml_parse(resource parser, string data [, int isFinal])
|
||||
Start parsing an XML document */
|
||||
PHP_FUNCTION(xml_parse)
|
||||
{
|
||||
@@ -1471,8 +1471,8 @@ PHP_FUNCTION(xml_parse_into_struct)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsZ|Z", &pind, &data, &data_len, &xdata, &info) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (info) {
|
||||
|
||||
if (info) {
|
||||
zval_dtor(*info);
|
||||
array_init(*info);
|
||||
}
|
||||
@@ -1483,11 +1483,11 @@ PHP_FUNCTION(xml_parse_into_struct)
|
||||
array_init(*xdata);
|
||||
|
||||
parser->data = *xdata;
|
||||
|
||||
|
||||
if (info) {
|
||||
parser->info = *info;
|
||||
}
|
||||
|
||||
|
||||
parser->level = 0;
|
||||
parser->ltags = safe_emalloc(XML_MAXLEVEL, sizeof(char *), 0);
|
||||
|
||||
@@ -1503,7 +1503,7 @@ PHP_FUNCTION(xml_parse_into_struct)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int xml_get_error_code(resource parser)
|
||||
/* {{{ proto int xml_get_error_code(resource parser)
|
||||
Get XML parser error code */
|
||||
PHP_FUNCTION(xml_get_error_code)
|
||||
{
|
||||
@@ -1537,7 +1537,7 @@ PHP_FUNCTION(xml_error_string)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int xml_get_current_line_number(resource parser)
|
||||
/* {{{ proto int xml_get_current_line_number(resource parser)
|
||||
Get current line number for an XML parser */
|
||||
PHP_FUNCTION(xml_get_current_line_number)
|
||||
{
|
||||
@@ -1569,7 +1569,7 @@ PHP_FUNCTION(xml_get_current_column_number)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int xml_get_current_byte_index(resource parser)
|
||||
/* {{{ proto int xml_get_current_byte_index(resource parser)
|
||||
Get current byte index for an XML parser */
|
||||
PHP_FUNCTION(xml_get_current_byte_index)
|
||||
{
|
||||
@@ -1585,7 +1585,7 @@ PHP_FUNCTION(xml_get_current_byte_index)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int xml_parser_free(resource parser)
|
||||
/* {{{ proto int xml_parser_free(resource parser)
|
||||
Free an XML parser */
|
||||
PHP_FUNCTION(xml_parser_free)
|
||||
{
|
||||
@@ -1611,7 +1611,7 @@ PHP_FUNCTION(xml_parser_free)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int xml_parser_set_option(resource parser, int option, mixed value)
|
||||
/* {{{ proto int xml_parser_set_option(resource parser, int option, mixed value)
|
||||
Set options in an XML parser */
|
||||
PHP_FUNCTION(xml_parser_set_option)
|
||||
{
|
||||
@@ -1657,7 +1657,7 @@ PHP_FUNCTION(xml_parser_set_option)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int xml_parser_get_option(resource parser, int option)
|
||||
/* {{{ proto int xml_parser_get_option(resource parser, int option)
|
||||
Get options from an XML parser */
|
||||
PHP_FUNCTION(xml_parser_get_option)
|
||||
{
|
||||
@@ -1687,7 +1687,7 @@ PHP_FUNCTION(xml_parser_get_option)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string utf8_encode(string data)
|
||||
/* {{{ proto string utf8_encode(string data)
|
||||
Encodes an ISO-8859-1 string to UTF-8 */
|
||||
PHP_FUNCTION(utf8_encode)
|
||||
{
|
||||
@@ -1707,7 +1707,7 @@ PHP_FUNCTION(utf8_encode)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string utf8_decode(string data)
|
||||
/* {{{ proto string utf8_decode(string data)
|
||||
Converts a UTF-8 encoded string to ISO-8859-1 */
|
||||
PHP_FUNCTION(utf8_decode)
|
||||
{
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@
|
||||
/* edit configure.in to change version number */
|
||||
#define PHP_MAJOR_VERSION 5
|
||||
#define PHP_MINOR_VERSION 5
|
||||
#define PHP_RELEASE_VERSION 32
|
||||
#define PHP_EXTRA_VERSION "-dev"
|
||||
#define PHP_VERSION "5.5.32-dev"
|
||||
#define PHP_VERSION_ID 50532
|
||||
#define PHP_RELEASE_VERSION 36
|
||||
#define PHP_EXTRA_VERSION ""
|
||||
#define PHP_VERSION "5.5.36"
|
||||
#define PHP_VERSION_ID 50536
|
||||
Reference in new issue
Block a user