mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-26 02:15:42 +00:00
Compare commits
127
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e89e72feb | ||
|
|
2d19c92fc2 | ||
|
|
f0f68c7274 | ||
|
|
9befad6fc2 | ||
|
|
3e45385903 | ||
|
|
0796db97d4 | ||
|
|
644e290fcd | ||
|
|
d36d4c70d3 | ||
|
|
850c1095ab | ||
|
|
1d352645fc | ||
|
|
4805be1db6 | ||
|
|
0da5cb5fb6 | ||
|
|
55980684f6 | ||
|
|
e44deba1e9 | ||
|
|
c2d6ffb85f | ||
|
|
c4f1c20d80 | ||
|
|
49030f2a25 | ||
|
|
eba5e276c7 | ||
|
|
aec1a5eccc | ||
|
|
6122526cea | ||
|
|
9849c97b1b | ||
|
|
935d922114 | ||
|
|
8202b97077 | ||
|
|
a91f3d475e | ||
|
|
eb570294a2 | ||
|
|
ecba563f2f | ||
|
|
e922d89f66 | ||
|
|
87673d6e99 | ||
|
|
d6d08f97cd | ||
|
|
33766347cb | ||
|
|
493b2bff02 | ||
|
|
b044a7429e | ||
|
|
617f38b0e0 | ||
|
|
40f7fea897 | ||
|
|
1fd18821e0 | ||
|
|
ccb91cde94 | ||
|
|
99b242a6d0 | ||
|
|
2eacb53fc4 | ||
|
|
863d37ea66 | ||
|
|
6499581af7 | ||
|
|
ef75ddd4f9 | ||
|
|
9b3a1e00ab | ||
|
|
cd13d0260a | ||
|
|
4f5a755b9d | ||
|
|
f74d7d92c8 | ||
|
|
6045de69c7 | ||
|
|
6558559bcc | ||
|
|
86e603a664 | ||
|
|
e1f5b6d8df | ||
|
|
f7bf9650aa | ||
|
|
cc08cbc84d | ||
|
|
43ccf23d70 | ||
|
|
689a9b8def | ||
|
|
082d1f2375 | ||
|
|
c1112ff323 | ||
|
|
21452a5401 | ||
|
|
85a22a0af0 | ||
|
|
96a8cf8e1b | ||
|
|
8822f7c9f0 | ||
|
|
8259130b6b | ||
|
|
4165d97606 | ||
|
|
256b150a96 | ||
|
|
fc989fc6e7 | ||
|
|
b92216b97d | ||
|
|
3c5742ebd7 | ||
|
|
b061fa909d | ||
|
|
bc3a0b82b8 | ||
|
|
1c468ee044 | ||
|
|
07546496b1 | ||
|
|
d946d10293 | ||
|
|
d3eb58332a | ||
|
|
a10d03ac16 | ||
|
|
085dfca02b | ||
|
|
8ea01d5f19 | ||
|
|
631173aa5c | ||
|
|
ef801b9bf9 | ||
|
|
40e7baab3c | ||
|
|
f9d4b1a3f1 | ||
|
|
9acfb1a3a5 | ||
|
|
c0219b323e | ||
|
|
91fd4bf000 | ||
|
|
e72165bb86 | ||
|
|
da7e89cde8 | ||
|
|
29e2a204fb | ||
|
|
703c247c7d | ||
|
|
6a544f2d1e | ||
|
|
1f5412982c | ||
|
|
40b8105cca | ||
|
|
99bf19c177 | ||
|
|
4f0960a800 | ||
|
|
66baefec44 | ||
|
|
1c0e9126fb | ||
|
|
0e6fe3a4c9 | ||
|
|
e1709b7e58 | ||
|
|
c696bc8cfa | ||
|
|
c596b02a5b | ||
|
|
8f5eda4bf6 | ||
|
|
709731797c | ||
|
|
c7936ead8f | ||
|
|
1da79a6c6e | ||
|
|
075aa911ff | ||
|
|
28887fe41b | ||
|
|
f9a699f6c3 | ||
|
|
9a2a45c1df | ||
|
|
a22175b06f | ||
|
|
807004a446 | ||
|
|
726c5999eb | ||
|
|
49c3fa43ad | ||
|
|
4397306b32 | ||
|
|
33a8af0510 | ||
|
|
4dd70b6e2f | ||
|
|
fc2cadca2d | ||
|
|
56fa36b0a8 | ||
|
|
1ed4b13fb6 | ||
|
|
6682673070 | ||
|
|
01c7c6b152 | ||
|
|
ac07008bb7 | ||
|
|
46df064261 | ||
|
|
3c117d4136 | ||
|
|
55237fe153 | ||
|
|
1d7484077a | ||
|
|
7bfb7b62b1 | ||
|
|
36df4f8419 | ||
|
|
09eb6ed35e | ||
|
|
5880428dac | ||
|
|
f5f94d9c08 | ||
|
|
9f25f736ed |
No files matched your search
@@ -1,11 +1,92 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2016, PHP 5.6.27
|
||||
24 Nov 2016, PHP 5.6.29RC1
|
||||
|
||||
- Mysqlnd:
|
||||
. Fixed bug #64526 (Add missing mysqlnd.* parameters to php.ini-*). (cmb)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #73402 (Opcache segfault when using class constant to call a
|
||||
method). (Laruence)
|
||||
. Fixed bug #69090 (check cached files permissions)
|
||||
|
||||
- OpenSSL
|
||||
. Fixed bug #72776 (Invalid parameter in memcpy function trough
|
||||
openssl_pbkdf2). (Jakub Zelenka)
|
||||
|
||||
- Postgres:
|
||||
. Fixed bug #73498 (Incorrect SQL generated for pg_copy_to()). (Craig Duncan)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #73452 (Segfault (Regression for #69152)). (Dmitry)
|
||||
|
||||
- SQLite3:
|
||||
. Fixed bug #73530 (Unsetting result set may reset other result set). (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #73297 (HTTP stream wrapper should ignore HTTP 100 Continue).
|
||||
(rowan dot collins at gmail dot com)
|
||||
|
||||
10 Nov 2016, PHP 5.6.28
|
||||
|
||||
- Core:
|
||||
. Fixed bug #73337 (try/catch not working with two exceptions inside a same
|
||||
operation). (Dmitry)
|
||||
|
||||
- Bz2:
|
||||
. Fixed bug #73356 (crash in bzcompress function). (Stas)
|
||||
|
||||
-GD:
|
||||
. Fixed bug #73213 (Integer overflow in imageline() with antialiasing). (cmb)
|
||||
. Fixed bug #73272 (imagescale() is not affected by, but affects
|
||||
imagesetinterpolation()). (cmb)
|
||||
. Fixed bug #73279 (Integer overflow in gdImageScaleBilinearPalette()). (cmb)
|
||||
. Fixed bug #73280 (Stack Buffer Overflow in GD dynamicGetbuf). (cmb)
|
||||
. Fixed bug #72482 (Illegal write/read access caused by gdImageAALine overflow).
|
||||
(cmb)
|
||||
. Fixed bug #72696 (imagefilltoborder stackoverflow on truecolor images). (cmb)
|
||||
|
||||
- Imap:
|
||||
. Fixed bug #73418 (Integer Overflow in "_php_imap_mail" leads Heap Overflow).
|
||||
(Anatol)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #73144 (Use-after-free in ArrayObject Deserialization). (Stas)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #73037 (SoapServer reports Bad Request when gzipped). (Anatol)
|
||||
|
||||
- SQLite3:
|
||||
. Fixed bug #73333 (2147483647 is fetched as string). (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #73203 (passing additional_parameters causes mail to fail). (cmb)
|
||||
. Fixed bug #73188 (use after free in userspace streams). (Sara)
|
||||
. Fixed bug #73192 (parse_url return wrong hostname). (Nikita)
|
||||
|
||||
- Wddx:
|
||||
. Fixed bug #73331 (NULL Pointer Dereference in WDDX Packet Deserialization
|
||||
with PDORow). (Stas)
|
||||
|
||||
13 Oct 2016, PHP 5.6.27
|
||||
|
||||
- Core:
|
||||
. Fixed bug #73025 (Heap Buffer Overflow in virtual_popen of
|
||||
zend_virtual_cwd.c). (cmb)
|
||||
. Fixed bug #73058 (crypt broken when salt is 'too' long). (Anatol)
|
||||
. Fixed bug #72703 (Out of bounds global memory read in BF_crypt triggered by
|
||||
password_verify). (Anatol)
|
||||
. Fixed bug #73189 (Memcpy negative size parameter php_resolve_path). (Stas)
|
||||
. Fixed bug #73147 (Use After Free in unserialize()). (Stas)
|
||||
|
||||
- BCmath:
|
||||
. Fixed bug #73190 (memcpy negative parameter _bc_new_num_ex). (Stas)
|
||||
|
||||
- DOM:
|
||||
. Fixed bug #73150 (missing NULL check in dom_document_save_html). (Stas)
|
||||
|
||||
- Ereg:
|
||||
. Fixed bug #73284 (heap overflow in php_ereg_replace function). (Stas)
|
||||
|
||||
- Filter:
|
||||
. Fixed bug #72972 (Bad filter for the flags FILTER_FLAG_NO_RES_RANGE and
|
||||
@@ -18,12 +99,34 @@ PHP NEWS
|
||||
- GD:
|
||||
. Fixed bug #67325 (imagetruecolortopalette: white is duplicated in palette).
|
||||
(cmb)
|
||||
. Fixed bug #50194 (imagettftext broken on transparent background w/o
|
||||
alphablending). (cmb)
|
||||
. Fixed bug #73003 (Integer Overflow in gdImageWebpCtx of gd_webp.c). (trylab,
|
||||
cmb)
|
||||
. Fixed bug #53504 (imagettfbbox gives incorrect values for bounding box).
|
||||
(Mark Plomer, cmb)
|
||||
. Fixed bug #73157 (imagegd2() ignores 3rd param if 4 are given). (cmb)
|
||||
. Fixed bug #73155 (imagegd2() writes wrong chunk sizes on boundaries). (cmb)
|
||||
. Fixed bug #73159 (imagegd2(): unrecognized formats may result in corrupted
|
||||
files). (cmb)
|
||||
. Fixed bug #73161 (imagecreatefromgd2() may leak memory). (cmb)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #73218 (add mitigation for ICU int overflow). (Stas)
|
||||
|
||||
- Imap:
|
||||
. Fixed bug #73208 (integer overflow in imap_8bit caused heap corruption).
|
||||
(Stas)
|
||||
|
||||
- Mbstring:
|
||||
. Fixed bug #72994 (mbc_to_code() out of bounds read). (Laruence, cmb)
|
||||
. Fixed bug #66964 (mb_convert_variables() cannot detect recursion). (Yasuo)
|
||||
. Fixed bug #72992 (mbstring.internal_encoding doesn't inherit default_charset).
|
||||
(Yasuo)
|
||||
. Fixed bug #73082 (string length overflow in mb_encode_* function). (Stas)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #73174 (heap overflow in php_pcre_replace_impl). (Stas)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #72590 (Opcache restart with kill_all_lockers does not work).
|
||||
@@ -32,10 +135,29 @@ PHP NEWS
|
||||
- OpenSSL:
|
||||
. Fixed bug #73072 (Invalid path SNI_server_certs causes segfault).
|
||||
(Jakub Zelenka)
|
||||
. Fixed bug #73275 (crash in openssl_encrypt function). (Stas)
|
||||
. Fixed bug #73276 (crash in openssl_random_pseudo_bytes function). (Stas)
|
||||
|
||||
- Session:
|
||||
. Fixed bug #68015 (Session does not report invalid uid for files save handler).
|
||||
(Yasuo)
|
||||
. Fixed bug #73100 (session_destroy null dereference in ps_files_path_create).
|
||||
(cmb)
|
||||
|
||||
- SimpleXML:
|
||||
. Fixed bug #73293 (NULL pointer dereference in SimpleXMLElement::asXML()).
|
||||
(Stas)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #73073 (CachingIterator null dereference when convert to string).
|
||||
(Stas)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #73240 (Write out of bounds at number_format). (Stas)
|
||||
. Fixed bug #73017 (memory corruption in wordwrap function). (Stas)
|
||||
|
||||
- Stream:
|
||||
. Fixed bug #73069 (readfile() mangles files larger than 2G). (Laruence)
|
||||
|
||||
- Zip:
|
||||
. Fixed bug #70752 (Depacking with wrong password leaves 0 length files).
|
||||
@@ -46,8 +168,6 @@ PHP NEWS
|
||||
- Core:
|
||||
. Fixed bug #72907 (null pointer deref, segfault in gc_remove_zval_from_buffer
|
||||
(zend_gc.c:260)). (Laruence)
|
||||
. Fixed bug #72703 (Out of bounds global memory read in BF_crypt triggered by
|
||||
password_verify). (Anatol)
|
||||
|
||||
- Dba:
|
||||
. Fixed bug #71514 (Bad dba_replace condition because of wrong API usage).
|
||||
@@ -55,6 +175,10 @@ PHP NEWS
|
||||
. Fixed bug #70825 (Cannot fetch multiple values with group in ini file).
|
||||
(cmb)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #72926 (Uninitialized Thumbail Data Leads To Memory Leakage in
|
||||
exif_process_IFD_in_TIFF). (Stas)
|
||||
|
||||
- FTP:
|
||||
. Fixed bug #70195 (Cannot upload file using ftp_put to FTPES with
|
||||
require_ssl_reuse). (Benedict Singer)
|
||||
@@ -66,15 +190,29 @@ PHP NEWS
|
||||
images). (cmb)
|
||||
. Fixed bug #68716 (possible resource leaks in _php_image_convert()). (cmb)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #73007 (add locale length check). (Stas)
|
||||
|
||||
- JSON:
|
||||
. Fixed bug #72787 (json_decode reads out of bounds). (Jakub Zelenka)
|
||||
|
||||
- mbstring:
|
||||
. Fixed bug #66797 (mb_substr only takes 32-bit signed integer). (cmb)
|
||||
. Fixed bug #72910 (Out of bounds heap read in mbc_to_code() / triggered by
|
||||
mb_ereg_match()). (Stas)
|
||||
|
||||
- MSSQL:
|
||||
. Fixed bug #72039 (Use of uninitialised value on mssql_guid_string). (Kalle)
|
||||
|
||||
- Mysqlnd:
|
||||
. Fixed bug #72293 (Heap overflow in mysqlnd related to BIT fields). (Stas)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #72928 (Out of bound when verify signature of zip phar in
|
||||
phar_parse_zipfile). (Stas)
|
||||
. Fixed bug #73035 (Out of bound when verify signature of tar phar in
|
||||
phar_parse_tarfile). (Stas)
|
||||
|
||||
- PDO:
|
||||
. Fixed bug #60665 (call to empty() on NULL result using PDO::FETCH_LAZY
|
||||
returns false). (cmb)
|
||||
@@ -84,6 +222,9 @@ PHP NEWS
|
||||
specifying a sequence). (Pablo Santiago Sánchez, Matteo)
|
||||
. Fixed bug #72759 (Regression in pgo_pgsql). (Anatol)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #73029 (Missing type check when unserializing SplArray). (Stas)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #72823 (strtr out-of-bound access). (cmb)
|
||||
. Fixed bug #72278 (getimagesize returning FALSE on valid jpg). (cmb)
|
||||
@@ -91,12 +232,22 @@ PHP NEWS
|
||||
(cmb)
|
||||
. Fixed bug #71882 (Negative ftruncate() on php://memory exhausts memory).
|
||||
(cmb)
|
||||
. Fixed bug #73011 (integer overflow in fgets cause heap corruption). (Stas)
|
||||
. Fixed bug #73017 (memory corruption in wordwrap function). (Stas)
|
||||
. Fixed bug #73045 (integer overflow in fgetcsv caused heap corruption). (Stas)
|
||||
. Fixed bug #73052 (Memory Corruption in During Deserialized-object Destruction)
|
||||
(Stas)
|
||||
|
||||
- Streams:
|
||||
. Fixed bug #72853 (stream_set_blocking doesn't work). (Laruence)
|
||||
|
||||
- Wddx:
|
||||
. Fixed bug #72860 (wddx_deserialize use-after-free). (Stas)
|
||||
. Fixed bug #73065 (Out-Of-Bounds Read in php_wddx_push_element). (Stas)
|
||||
|
||||
- XML:
|
||||
. Fixed bug #72085 (SEGV on unknown address zif_xml_parse). (cmb)
|
||||
. Fixed bug #72927 (integer overflow in xml_utf8_encode). (Stas)
|
||||
|
||||
- ZIP:
|
||||
. Fixed bug #68302 (impossible to compile php with zip support). (cmb)
|
||||
@@ -167,6 +318,8 @@ PHP NEWS
|
||||
. Fixed bug #72697 (select_colors write out-of-bounds). (Stas)
|
||||
. Fixed bug #72709 (imagesetstyle() causes OOB read for empty $styles). (cmb)
|
||||
. Fixed bug #72730 (imagegammacorrect allows arbitrary write access). (Stas)
|
||||
. Fixed bug #72494 (imagecropauto out-of-bounds access). (Fernando, Pierre,
|
||||
cmb)
|
||||
|
||||
- Intl:
|
||||
. Partially fixed #72506 (idn_to_ascii for UTS #46 incorrect for long domain
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Next free element may overflow in array literals
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$i = PHP_INT_MAX;
|
||||
$array = [$i => 42, new stdClass];
|
||||
var_dump($array);
|
||||
|
||||
const FOO = [PHP_INT_MAX => 42, "foo"];
|
||||
var_dump(FOO);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
|
||||
array(1) {
|
||||
[%d]=>
|
||||
int(42)
|
||||
}
|
||||
|
||||
Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
|
||||
array(1) {
|
||||
[%d]=>
|
||||
int(42)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #73337 (try/catch not working with two exceptions inside a same operation)
|
||||
--FILE--
|
||||
<?php
|
||||
class d { function __destruct() { throw new Exception; } }
|
||||
try { new d + new d; } catch (Exception $e) { print "Exception properly caught\n"; }
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Object of class d could not be converted to int in %sbug73337.php on line 3
|
||||
|
||||
Notice: Object of class d could not be converted to int in %sbug73337.php on line 3
|
||||
Exception properly caught
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Constexpr arrays should be able to handle resource keys
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
const FOO = [STDIN => 42];
|
||||
var_dump(FOO);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Strict Standards: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
|
||||
array(1) {
|
||||
[%d]=>
|
||||
int(42)
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
Testing __debugInfo() magic method with bad returns RESOURCE
|
||||
--INI--
|
||||
allow_url_fopen=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
+31
-1
@@ -1805,6 +1805,12 @@ ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC) /* {{{
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int zend_startup_module_int(zend_module_entry *module TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return (zend_startup_module_ex(module TSRMLS_CC) == SUCCESS) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void zend_sort_modules(void *base, size_t count, size_t siz, compare_func_t compare TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
Bucket **b1 = base;
|
||||
@@ -1921,7 +1927,7 @@ ZEND_API void zend_collect_module_handlers(TSRMLS_D) /* {{{ */
|
||||
ZEND_API int zend_startup_modules(TSRMLS_D) /* {{{ */
|
||||
{
|
||||
zend_hash_sort(&module_registry, zend_sort_modules, NULL, 0 TSRMLS_CC);
|
||||
zend_hash_apply(&module_registry, (apply_func_t)zend_startup_module_ex TSRMLS_CC);
|
||||
zend_hash_apply(&module_registry, (apply_func_t)zend_startup_module_int TSRMLS_CC);
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -3770,6 +3776,30 @@ ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API void zend_unset_property(zend_class_entry *scope, zval *object, const char *name, int name_length TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zval *property;
|
||||
zend_class_entry *old_scope = EG(scope);
|
||||
|
||||
EG(scope) = scope;
|
||||
|
||||
if (!Z_OBJ_HT_P(object)->unset_property) {
|
||||
const char *class_name;
|
||||
zend_uint class_name_len;
|
||||
|
||||
zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC);
|
||||
|
||||
zend_error(E_CORE_ERROR, "Property %s of class %s cannot be unset", name, class_name);
|
||||
}
|
||||
MAKE_STD_ZVAL(property);
|
||||
ZVAL_STRINGL(property, name, name_length, 1);
|
||||
Z_OBJ_HT_P(object)->unset_property(object, property, 0 TSRMLS_CC);
|
||||
zval_ptr_dtor(&property);
|
||||
|
||||
EG(scope) = old_scope;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, const char *name, int name_length TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
+3
-1
@@ -330,6 +330,7 @@ ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, c
|
||||
ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, const char *name, int name_length, double value TSRMLS_DC);
|
||||
ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value TSRMLS_DC);
|
||||
ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value, int value_length TSRMLS_DC);
|
||||
ZEND_API void zend_unset_property(zend_class_entry *scope, zval *object, const char *name, int name_length TSRMLS_DC);
|
||||
|
||||
ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *name, int name_length, zval *value TSRMLS_DC);
|
||||
ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const char *name, int name_length TSRMLS_DC);
|
||||
@@ -664,8 +665,9 @@ END_EXTERN_C()
|
||||
} \
|
||||
RETURN_FALSE; \
|
||||
} \
|
||||
RETVAL_STRINGL((s), __len, (dup)); \
|
||||
RETVAL_STRINGL((s), (int)__len, (dup)); \
|
||||
} while (0)
|
||||
#define RETURN_STRINGL_CHECK(s, len, dup) { RETVAL_STRINGL_CHECK(s, len, dup); return; }
|
||||
|
||||
|
||||
#define SET_VAR_STRING(n, v) { \
|
||||
|
||||
+2
-2
@@ -2735,9 +2735,9 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals TSRMLS_DC)
|
||||
alloc_globals->mm_heap = malloc(sizeof(struct _zend_mm_heap));
|
||||
memset(alloc_globals->mm_heap, 0, sizeof(struct _zend_mm_heap));
|
||||
alloc_globals->mm_heap->use_zend_alloc = 0;
|
||||
alloc_globals->mm_heap->_malloc = malloc;
|
||||
alloc_globals->mm_heap->_malloc = __zend_malloc;
|
||||
alloc_globals->mm_heap->_free = free;
|
||||
alloc_globals->mm_heap->_realloc = realloc;
|
||||
alloc_globals->mm_heap->_realloc = __zend_realloc;
|
||||
} else {
|
||||
alloc_globals->mm_heap = zend_mm_startup();
|
||||
}
|
||||
|
||||
+8
-2
@@ -5929,7 +5929,7 @@ void zend_do_add_array_element(znode *result, const znode *expr, const znode *of
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_do_add_static_array_element(zval *result, zval *offset, const zval *expr) /* {{{ */
|
||||
void zend_do_add_static_array_element(zval *result, zval *offset, zval *expr) /* {{{ */
|
||||
{
|
||||
if (offset) {
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
@@ -5940,6 +5940,9 @@ void zend_do_add_static_array_element(zval *result, zval *offset, const zval *ex
|
||||
case IS_NULL:
|
||||
zend_symtable_update(Z_ARRVAL_P(result), "", 1, &expr, sizeof(zval *), NULL);
|
||||
break;
|
||||
case IS_RESOURCE:
|
||||
zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%ld)", Z_LVAL_P(offset), Z_LVAL_P(offset));
|
||||
/* break missing intentionally */
|
||||
case IS_LONG:
|
||||
case IS_BOOL:
|
||||
zend_hash_index_update(Z_ARRVAL_P(result), Z_LVAL_P(offset), &expr, sizeof(zval *), NULL);
|
||||
@@ -5952,7 +5955,10 @@ void zend_do_add_static_array_element(zval *result, zval *offset, const zval *ex
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL_P(result), &expr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL_P(result), &expr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
+1
-1
@@ -598,7 +598,7 @@ void zend_do_shell_exec(znode *result, const znode *cmd TSRMLS_DC);
|
||||
|
||||
void zend_do_init_array(znode *result, const znode *expr, const znode *offset, zend_bool is_ref TSRMLS_DC);
|
||||
void zend_do_add_array_element(znode *result, const znode *expr, const znode *offset, zend_bool is_ref TSRMLS_DC);
|
||||
void zend_do_add_static_array_element(zval *result, zval *offset, const zval *expr);
|
||||
void zend_do_add_static_array_element(zval *result, zval *offset, zval *expr);
|
||||
void zend_do_list_init(TSRMLS_D);
|
||||
void zend_do_list_end(znode *result, znode *expr TSRMLS_DC);
|
||||
void zend_do_add_list_element(const znode *element TSRMLS_DC);
|
||||
|
||||
+26
-10
@@ -229,13 +229,9 @@ ZEND_METHOD(exception, __construct)
|
||||
/* {{{ proto Exception::__wakeup()
|
||||
Exception unserialize checks */
|
||||
#define CHECK_EXC_TYPE(name, type) \
|
||||
value = zend_read_property(default_exception_ce, object, name, sizeof(name)-1, 0 TSRMLS_CC); \
|
||||
value = zend_read_property(default_exception_ce, object, name, sizeof(name)-1, 1 TSRMLS_CC); \
|
||||
if (value && Z_TYPE_P(value) != IS_NULL && Z_TYPE_P(value) != type) { \
|
||||
zval *tmp; \
|
||||
MAKE_STD_ZVAL(tmp); \
|
||||
ZVAL_STRINGL(tmp, name, sizeof(name)-1, 1); \
|
||||
Z_OBJ_HANDLER_P(object, unset_property)(object, tmp, 0 TSRMLS_CC); \
|
||||
zval_ptr_dtor(&tmp); \
|
||||
zend_unset_property(default_exception_ce, object, name, sizeof(name)-1 TSRMLS_CC); \
|
||||
}
|
||||
|
||||
ZEND_METHOD(exception, __wakeup)
|
||||
@@ -248,7 +244,12 @@ ZEND_METHOD(exception, __wakeup)
|
||||
CHECK_EXC_TYPE("file", IS_STRING);
|
||||
CHECK_EXC_TYPE("line", IS_LONG);
|
||||
CHECK_EXC_TYPE("trace", IS_ARRAY);
|
||||
CHECK_EXC_TYPE("previous", IS_OBJECT);
|
||||
value = zend_read_property(default_exception_ce, object, "previous", sizeof("previous")-1, 1 TSRMLS_CC);
|
||||
if (value && Z_TYPE_P(value) != IS_NULL && (Z_TYPE_P(value) != IS_OBJECT ||
|
||||
!instanceof_function(Z_OBJCE_P(value), default_exception_ce TSRMLS_CC) ||
|
||||
value == object)) {
|
||||
zend_unset_property(default_exception_ce, object, "previous", sizeof("previous")-1 TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -727,7 +728,11 @@ ZEND_METHOD(exception, __toString)
|
||||
zval_dtor(&file);
|
||||
zval_dtor(&line);
|
||||
|
||||
exception = zend_read_property(default_exception_ce, exception, "previous", sizeof("previous")-1, 0 TSRMLS_CC);
|
||||
Z_OBJPROP_P(exception)->nApplyCount++;
|
||||
exception = zend_read_property(default_exception_ce, exception, "previous", sizeof("previous")-1, 1 TSRMLS_CC);
|
||||
if (exception && Z_TYPE_P(exception) == IS_OBJECT && Z_OBJPROP_P(exception)->nApplyCount > 0) {
|
||||
exception = NULL;
|
||||
}
|
||||
|
||||
if (trace) {
|
||||
zval_ptr_dtor(&trace);
|
||||
@@ -736,6 +741,17 @@ ZEND_METHOD(exception, __toString)
|
||||
}
|
||||
zval_dtor(&fname);
|
||||
|
||||
/* Reset apply counts */
|
||||
exception = getThis();
|
||||
while (exception && Z_TYPE_P(exception) == IS_OBJECT && instanceof_function(Z_OBJCE_P(exception), default_exception_ce TSRMLS_CC)) {
|
||||
if(Z_OBJPROP_P(exception)->nApplyCount) {
|
||||
Z_OBJPROP_P(exception)->nApplyCount--;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
exception = zend_read_property(default_exception_ce, exception, "previous", sizeof("previous")-1, 1 TSRMLS_CC);
|
||||
}
|
||||
|
||||
/* We store the result in the private property string so we can access
|
||||
* the result in uncaught exception handlers without memleaks. */
|
||||
zend_update_property_string(default_exception_ce, getThis(), "string", sizeof("string")-1, str TSRMLS_CC);
|
||||
@@ -893,11 +909,10 @@ static void zend_error_va(int type, const char *file, uint lineno, const char *f
|
||||
ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_class_entry *ce_exception = Z_OBJCE_P(exception);
|
||||
EG(exception) = NULL;
|
||||
if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) {
|
||||
zval *str, *file, *line;
|
||||
|
||||
EG(exception) = NULL;
|
||||
|
||||
zend_call_method_with_0_params(&exception, ce_exception, NULL, "__tostring", &str);
|
||||
if (!EG(exception)) {
|
||||
if (Z_TYPE_P(str) != IS_STRING) {
|
||||
@@ -936,6 +951,7 @@ ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* {
|
||||
} else {
|
||||
zend_error(severity, "Uncaught exception '%s'", ce_exception->name);
|
||||
}
|
||||
zval_ptr_dtor(&exception);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -826,7 +826,10 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
if (EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) {
|
||||
*fci->retval_ptr_ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC);
|
||||
} else {
|
||||
const zend_op *current_opline_before_exception = EG(opline_before_exception);
|
||||
|
||||
zend_execute(EG(active_op_array) TSRMLS_CC);
|
||||
EG(opline_before_exception) = current_opline_before_exception;
|
||||
}
|
||||
|
||||
if (!fci->symbol_table && EG(active_symbol_table)) {
|
||||
|
||||
+4
-1
@@ -3879,7 +3879,10 @@ ZEND_VM_C_LABEL(num_index):
|
||||
}
|
||||
FREE_OP2();
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr_ptr);
|
||||
}
|
||||
}
|
||||
if ((OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) && opline->extended_value) {
|
||||
FREE_OP1_VAR_PTR();
|
||||
|
||||
+80
-20
@@ -4119,7 +4119,10 @@ num_index:
|
||||
}
|
||||
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr_ptr);
|
||||
}
|
||||
}
|
||||
if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) {
|
||||
|
||||
@@ -5030,7 +5033,10 @@ num_index:
|
||||
}
|
||||
zval_dtor(free_op2.var);
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr_ptr);
|
||||
}
|
||||
}
|
||||
if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) {
|
||||
|
||||
@@ -5894,7 +5900,10 @@ num_index:
|
||||
}
|
||||
zval_ptr_dtor_nogc(&free_op2.var);
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr_ptr);
|
||||
}
|
||||
}
|
||||
if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) {
|
||||
|
||||
@@ -6614,7 +6623,10 @@ num_index:
|
||||
}
|
||||
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr_ptr);
|
||||
}
|
||||
}
|
||||
if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) {
|
||||
|
||||
@@ -7547,7 +7559,10 @@ num_index:
|
||||
}
|
||||
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr_ptr);
|
||||
}
|
||||
}
|
||||
if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) {
|
||||
|
||||
@@ -9447,7 +9462,10 @@ num_index:
|
||||
}
|
||||
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr_ptr);
|
||||
}
|
||||
}
|
||||
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) {
|
||||
|
||||
@@ -10314,7 +10332,10 @@ num_index:
|
||||
}
|
||||
zval_dtor(free_op2.var);
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr_ptr);
|
||||
}
|
||||
}
|
||||
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) {
|
||||
|
||||
@@ -11180,7 +11201,10 @@ num_index:
|
||||
}
|
||||
zval_ptr_dtor_nogc(&free_op2.var);
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr_ptr);
|
||||
}
|
||||
}
|
||||
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) {
|
||||
|
||||
@@ -11775,7 +11799,10 @@ num_index:
|
||||
}
|
||||
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr_ptr);
|
||||
}
|
||||
}
|
||||
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) {
|
||||
|
||||
@@ -12624,7 +12651,10 @@ num_index:
|
||||
}
|
||||
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr_ptr);
|
||||
}
|
||||
}
|
||||
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) {
|
||||
|
||||
@@ -16107,7 +16137,10 @@ num_index:
|
||||
}
|
||||
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr_ptr);
|
||||
}
|
||||
}
|
||||
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) {
|
||||
if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
|
||||
@@ -18387,7 +18420,10 @@ num_index:
|
||||
}
|
||||
zval_dtor(free_op2.var);
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr_ptr);
|
||||
}
|
||||
}
|
||||
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) {
|
||||
if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
|
||||
@@ -20725,7 +20761,10 @@ num_index:
|
||||
}
|
||||
zval_ptr_dtor_nogc(&free_op2.var);
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr_ptr);
|
||||
}
|
||||
}
|
||||
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) {
|
||||
if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
|
||||
@@ -22165,7 +22204,10 @@ num_index:
|
||||
}
|
||||
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr_ptr);
|
||||
}
|
||||
}
|
||||
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) {
|
||||
if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
|
||||
@@ -24220,7 +24262,10 @@ num_index:
|
||||
}
|
||||
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr_ptr);
|
||||
}
|
||||
}
|
||||
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) {
|
||||
if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
|
||||
@@ -33574,7 +33619,10 @@ num_index:
|
||||
}
|
||||
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr_ptr);
|
||||
}
|
||||
}
|
||||
if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) {
|
||||
|
||||
@@ -35717,7 +35765,10 @@ num_index:
|
||||
}
|
||||
zval_dtor(free_op2.var);
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr_ptr);
|
||||
}
|
||||
}
|
||||
if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) {
|
||||
|
||||
@@ -37917,7 +37968,10 @@ num_index:
|
||||
}
|
||||
zval_ptr_dtor_nogc(&free_op2.var);
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr_ptr);
|
||||
}
|
||||
}
|
||||
if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) {
|
||||
|
||||
@@ -39225,7 +39279,10 @@ num_index:
|
||||
}
|
||||
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr_ptr);
|
||||
}
|
||||
}
|
||||
if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) {
|
||||
|
||||
@@ -41125,7 +41182,10 @@ num_index:
|
||||
}
|
||||
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
zval_ptr_dtor(&expr_ptr);
|
||||
}
|
||||
}
|
||||
if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) {
|
||||
|
||||
|
||||
+2
-2
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=6
|
||||
PHP_RELEASE_VERSION=27
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=29
|
||||
PHP_EXTRA_VERSION="RC1"
|
||||
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`
|
||||
|
||||
|
||||
@@ -49,7 +49,10 @@ _bc_new_num_ex (length, scale, persistent)
|
||||
int length, scale, persistent;
|
||||
{
|
||||
bc_num temp;
|
||||
|
||||
/* PHP Change: add length check */
|
||||
if ((size_t)length+(size_t)scale > INT_MAX) {
|
||||
zend_error(E_ERROR, "Result too long, max is %d", INT_MAX);
|
||||
}
|
||||
/* PHP Change: malloc() -> pemalloc(), removed free_list code */
|
||||
temp = (bc_num) safe_pemalloc (1, sizeof(bc_struct)+length, scale, persistent);
|
||||
#if 0
|
||||
|
||||
@@ -41,6 +41,5 @@
|
||||
|
||||
void bc_out_of_memory (void)
|
||||
{
|
||||
(void) fprintf (stderr, "bcmath: out of memory!\n");
|
||||
exit (1);
|
||||
zend_error(E_ERROR, "bcmath: out of memory!");
|
||||
}
|
||||
+2
-2
@@ -513,7 +513,7 @@ static PHP_FUNCTION(bzcompress)
|
||||
dest_len = (unsigned int) (source_len + (0.01 * source_len) + 600);
|
||||
|
||||
/* Allocate the destination buffer */
|
||||
dest = emalloc(dest_len + 1);
|
||||
dest = safe_emalloc(dest_len, 1, 1);
|
||||
|
||||
/* Handle the optional arguments */
|
||||
if (argc > 1) {
|
||||
@@ -533,7 +533,7 @@ static PHP_FUNCTION(bzcompress)
|
||||
so we erealloc() the buffer to the proper size */
|
||||
dest = erealloc(dest, dest_len + 1);
|
||||
dest[dest_len] = 0;
|
||||
RETURN_STRINGL(dest, dest_len, 0);
|
||||
RETURN_STRINGL_CHECK(dest, dest_len, 0);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -137,7 +137,10 @@ ZEND_METHOD(CURLFile, setPostFilename)
|
||||
Unserialization handler */
|
||||
ZEND_METHOD(CURLFile, __wakeup)
|
||||
{
|
||||
zend_update_property_string(curl_CURLFile_class, getThis(), "name", sizeof("name")-1, "" TSRMLS_CC);
|
||||
zval *_this = getThis();
|
||||
|
||||
zend_unset_property(curl_CURLFile_class, _this, "name", sizeof("name")-1 TSRMLS_CC);
|
||||
zend_update_property_string(curl_CURLFile_class, _this, "name", sizeof("name")-1, "" TSRMLS_CC);
|
||||
zend_throw_exception(NULL, "Unserialization of CURLFile instances is not allowed", 0 TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #73147: Use After Free in PHP7 unserialize()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
exit("skip curl extension not loaded");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$poc = 'a:1:{i:0;O:8:"CURLFile":1:{s:4:"name";R:1;}}';
|
||||
try {
|
||||
var_dump(unserialize($poc));
|
||||
} catch(Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
Unserialization of CURLFile instances is not allowed
|
||||
+104
-100
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 0.15.3 on Sun Jul 24 14:49:45 2016 */
|
||||
/* Generated by re2c 0.15.3 on Fri Sep 30 20:18:29 2016 */
|
||||
#line 1 "ext/date/lib/parse_date.re"
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
@@ -396,8 +396,12 @@ static timelib_sll timelib_meridian(char **ptr, timelib_sll h)
|
||||
}
|
||||
++*ptr;
|
||||
if (**ptr == '.') {
|
||||
*ptr += 3;
|
||||
} else {
|
||||
++*ptr;
|
||||
}
|
||||
if (**ptr == 'M' || **ptr == 'm') {
|
||||
++*ptr;
|
||||
}
|
||||
if (**ptr == '.') {
|
||||
++*ptr;
|
||||
}
|
||||
return retval;
|
||||
@@ -820,11 +824,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
|
||||
std:
|
||||
s->tok = cursor;
|
||||
s->len = 0;
|
||||
#line 946 "ext/date/lib/parse_date.re"
|
||||
#line 950 "ext/date/lib/parse_date.re"
|
||||
|
||||
|
||||
|
||||
#line 828 "<stdout>"
|
||||
#line 832 "<stdout>"
|
||||
{
|
||||
YYCTYPE yych;
|
||||
unsigned int yyaccept = 0;
|
||||
@@ -959,7 +963,7 @@ yy2:
|
||||
}
|
||||
}
|
||||
yy3:
|
||||
#line 1626 "ext/date/lib/parse_date.re"
|
||||
#line 1630 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("tzcorrection | tz");
|
||||
@@ -972,7 +976,7 @@ yy3:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIMEZONE;
|
||||
}
|
||||
#line 976 "<stdout>"
|
||||
#line 980 "<stdout>"
|
||||
yy4:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'E') {
|
||||
@@ -1272,12 +1276,12 @@ yy11:
|
||||
if (yych <= '/') goto yy12;
|
||||
if (yych <= '9') goto yy1385;
|
||||
yy12:
|
||||
#line 1721 "ext/date/lib/parse_date.re"
|
||||
#line 1725 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
add_error(s, "Unexpected character");
|
||||
goto std;
|
||||
}
|
||||
#line 1281 "<stdout>"
|
||||
#line 1285 "<stdout>"
|
||||
yy13:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'R') {
|
||||
@@ -2291,22 +2295,22 @@ yy48:
|
||||
if (yych <= '/') goto yy49;
|
||||
if (yych <= '9') goto yy54;
|
||||
yy49:
|
||||
#line 1710 "ext/date/lib/parse_date.re"
|
||||
#line 1714 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
goto std;
|
||||
}
|
||||
#line 2299 "<stdout>"
|
||||
#line 2303 "<stdout>"
|
||||
yy50:
|
||||
yych = *++YYCURSOR;
|
||||
goto yy49;
|
||||
yy51:
|
||||
++YYCURSOR;
|
||||
#line 1715 "ext/date/lib/parse_date.re"
|
||||
#line 1719 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
s->pos = cursor; s->line++;
|
||||
goto std;
|
||||
}
|
||||
#line 2310 "<stdout>"
|
||||
#line 2314 "<stdout>"
|
||||
yy53:
|
||||
yych = *++YYCURSOR;
|
||||
goto yy12;
|
||||
@@ -2673,7 +2677,7 @@ yy71:
|
||||
if (yych == 'S') goto yy73;
|
||||
if (yych == 's') goto yy73;
|
||||
yy72:
|
||||
#line 1694 "ext/date/lib/parse_date.re"
|
||||
#line 1698 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_ull i;
|
||||
DEBUG_OUTPUT("relative");
|
||||
@@ -2688,7 +2692,7 @@ yy72:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 2692 "<stdout>"
|
||||
#line 2696 "<stdout>"
|
||||
yy73:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych == 'D') goto yy74;
|
||||
@@ -3356,7 +3360,7 @@ yy165:
|
||||
}
|
||||
}
|
||||
yy166:
|
||||
#line 1557 "ext/date/lib/parse_date.re"
|
||||
#line 1561 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
const timelib_relunit* relunit;
|
||||
DEBUG_OUTPUT("daytext");
|
||||
@@ -3373,7 +3377,7 @@ yy166:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_WEEKDAY;
|
||||
}
|
||||
#line 3377 "<stdout>"
|
||||
#line 3381 "<stdout>"
|
||||
yy167:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'K') {
|
||||
@@ -3866,7 +3870,7 @@ yy192:
|
||||
}
|
||||
}
|
||||
yy193:
|
||||
#line 1616 "ext/date/lib/parse_date.re"
|
||||
#line 1620 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("monthtext");
|
||||
TIMELIB_INIT;
|
||||
@@ -3875,7 +3879,7 @@ yy193:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_TEXT;
|
||||
}
|
||||
#line 3879 "<stdout>"
|
||||
#line 3883 "<stdout>"
|
||||
yy194:
|
||||
++YYCURSOR;
|
||||
if ((YYLIMIT - YYCURSOR) < 21) YYFILL(21);
|
||||
@@ -3921,7 +3925,7 @@ yy197:
|
||||
}
|
||||
}
|
||||
yy198:
|
||||
#line 1362 "ext/date/lib/parse_date.re"
|
||||
#line 1366 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datetextual | datenoyear");
|
||||
@@ -3934,7 +3938,7 @@ yy198:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_TEXT;
|
||||
}
|
||||
#line 3938 "<stdout>"
|
||||
#line 3942 "<stdout>"
|
||||
yy199:
|
||||
yyaccept = 6;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -4179,7 +4183,7 @@ yy221:
|
||||
if (yych <= ':') goto yy224;
|
||||
}
|
||||
yy222:
|
||||
#line 1664 "ext/date/lib/parse_date.re"
|
||||
#line 1668 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
|
||||
@@ -4208,7 +4212,7 @@ yy222:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_SHORTDATE_WITH_TIME;
|
||||
}
|
||||
#line 4212 "<stdout>"
|
||||
#line 4216 "<stdout>"
|
||||
yy223:
|
||||
yyaccept = 7;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -4850,7 +4854,7 @@ yy276:
|
||||
}
|
||||
yy277:
|
||||
++YYCURSOR;
|
||||
#line 1640 "ext/date/lib/parse_date.re"
|
||||
#line 1644 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
|
||||
TIMELIB_INIT;
|
||||
@@ -4873,7 +4877,7 @@ yy277:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_SHORTDATE_WITH_TIME;
|
||||
}
|
||||
#line 4877 "<stdout>"
|
||||
#line 4881 "<stdout>"
|
||||
yy279:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 0x1F) {
|
||||
@@ -5035,7 +5039,7 @@ yy292:
|
||||
yy293:
|
||||
++YYCURSOR;
|
||||
yy294:
|
||||
#line 1334 "ext/date/lib/parse_date.re"
|
||||
#line 1338 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datenoday");
|
||||
@@ -5048,7 +5052,7 @@ yy294:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_NO_DAY;
|
||||
}
|
||||
#line 5052 "<stdout>"
|
||||
#line 5056 "<stdout>"
|
||||
yy295:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') {
|
||||
@@ -6199,7 +6203,7 @@ yy361:
|
||||
if ((yych = *YYCURSOR) <= '/') goto yy363;
|
||||
if (yych <= '9') goto yy364;
|
||||
yy363:
|
||||
#line 1478 "ext/date/lib/parse_date.re"
|
||||
#line 1482 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pgtextshort");
|
||||
@@ -6212,7 +6216,7 @@ yy363:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PG_TEXT;
|
||||
}
|
||||
#line 6216 "<stdout>"
|
||||
#line 6220 "<stdout>"
|
||||
yy364:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy363;
|
||||
@@ -6821,7 +6825,7 @@ yy391:
|
||||
if (yych <= 'z') goto yy142;
|
||||
}
|
||||
yy392:
|
||||
#line 1536 "ext/date/lib/parse_date.re"
|
||||
#line 1540 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("ago");
|
||||
TIMELIB_INIT;
|
||||
@@ -6841,7 +6845,7 @@ yy392:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_AGO;
|
||||
}
|
||||
#line 6845 "<stdout>"
|
||||
#line 6849 "<stdout>"
|
||||
yy393:
|
||||
yyaccept = 5;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -8529,7 +8533,7 @@ yy452:
|
||||
yy453:
|
||||
++YYCURSOR;
|
||||
yy454:
|
||||
#line 1239 "ext/date/lib/parse_date.re"
|
||||
#line 1243 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
|
||||
TIMELIB_INIT;
|
||||
@@ -8540,7 +8544,7 @@ yy454:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 8544 "<stdout>"
|
||||
#line 8548 "<stdout>"
|
||||
yy455:
|
||||
yyaccept = 0;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -9076,7 +9080,7 @@ yy474:
|
||||
}
|
||||
}
|
||||
yy475:
|
||||
#line 1376 "ext/date/lib/parse_date.re"
|
||||
#line 1380 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("datenoyearrev");
|
||||
TIMELIB_INIT;
|
||||
@@ -9087,7 +9091,7 @@ yy475:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_TEXT;
|
||||
}
|
||||
#line 9091 "<stdout>"
|
||||
#line 9095 "<stdout>"
|
||||
yy476:
|
||||
yyaccept = 10;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -9215,7 +9219,7 @@ yy485:
|
||||
}
|
||||
yy487:
|
||||
++YYCURSOR;
|
||||
#line 1094 "ext/date/lib/parse_date.re"
|
||||
#line 1098 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
|
||||
TIMELIB_INIT;
|
||||
@@ -9231,7 +9235,7 @@ yy487:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIME12;
|
||||
}
|
||||
#line 9235 "<stdout>"
|
||||
#line 9239 "<stdout>"
|
||||
yy489:
|
||||
yyaccept = 11;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -9242,7 +9246,7 @@ yy489:
|
||||
if (yych <= ':') goto yy492;
|
||||
}
|
||||
yy490:
|
||||
#line 1131 "ext/date/lib/parse_date.re"
|
||||
#line 1135 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long");
|
||||
@@ -9267,7 +9271,7 @@ yy490:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIME24_WITH_ZONE;
|
||||
}
|
||||
#line 9271 "<stdout>"
|
||||
#line 9275 "<stdout>"
|
||||
yy491:
|
||||
yyaccept = 11;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -9544,7 +9548,7 @@ yy520:
|
||||
}
|
||||
yy522:
|
||||
++YYCURSOR;
|
||||
#line 1111 "ext/date/lib/parse_date.re"
|
||||
#line 1115 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("mssqltime");
|
||||
TIMELIB_INIT;
|
||||
@@ -9563,7 +9567,7 @@ yy522:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIME24_WITH_ZONE;
|
||||
}
|
||||
#line 9567 "<stdout>"
|
||||
#line 9571 "<stdout>"
|
||||
yy524:
|
||||
yyaccept = 11;
|
||||
YYMARKER = ++YYCURSOR;
|
||||
@@ -9658,7 +9662,7 @@ yy533:
|
||||
if ((yych = *YYCURSOR) <= '/') goto yy534;
|
||||
if (yych <= '9') goto yy540;
|
||||
yy534:
|
||||
#line 1293 "ext/date/lib/parse_date.re"
|
||||
#line 1297 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datefull");
|
||||
@@ -9672,7 +9676,7 @@ yy534:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_FULL;
|
||||
}
|
||||
#line 9676 "<stdout>"
|
||||
#line 9680 "<stdout>"
|
||||
yy535:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych == 'M') goto yy536;
|
||||
@@ -10336,7 +10340,7 @@ yy604:
|
||||
if (yych <= '/') goto yy56;
|
||||
if (yych >= ':') goto yy56;
|
||||
++YYCURSOR;
|
||||
#line 1308 "ext/date/lib/parse_date.re"
|
||||
#line 1312 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("pointed date YYYY");
|
||||
TIMELIB_INIT;
|
||||
@@ -10347,7 +10351,7 @@ yy604:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_FULL_POINTED;
|
||||
}
|
||||
#line 10351 "<stdout>"
|
||||
#line 10355 "<stdout>"
|
||||
yy607:
|
||||
yyaccept = 11;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -10378,7 +10382,7 @@ yy610:
|
||||
if (yych <= '/') goto yy611;
|
||||
if (yych <= '9') goto yy604;
|
||||
yy611:
|
||||
#line 1320 "ext/date/lib/parse_date.re"
|
||||
#line 1324 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pointed date YY");
|
||||
@@ -10391,7 +10395,7 @@ yy611:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_FULL_POINTED;
|
||||
}
|
||||
#line 10395 "<stdout>"
|
||||
#line 10399 "<stdout>"
|
||||
yy612:
|
||||
yyaccept = 11;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -10987,7 +10991,7 @@ yy655:
|
||||
}
|
||||
}
|
||||
yy656:
|
||||
#line 1279 "ext/date/lib/parse_date.re"
|
||||
#line 1283 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("gnudateshort");
|
||||
@@ -11000,7 +11004,7 @@ yy656:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 11004 "<stdout>"
|
||||
#line 11008 "<stdout>"
|
||||
yy657:
|
||||
yyaccept = 13;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -11096,7 +11100,7 @@ yy665:
|
||||
}
|
||||
}
|
||||
yy666:
|
||||
#line 1223 "ext/date/lib/parse_date.re"
|
||||
#line 1227 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("americanshort | american");
|
||||
@@ -11111,7 +11115,7 @@ yy666:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_AMERICAN;
|
||||
}
|
||||
#line 11115 "<stdout>"
|
||||
#line 11119 "<stdout>"
|
||||
yy667:
|
||||
yyaccept = 14;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -11310,7 +11314,7 @@ yy699:
|
||||
if (yych <= '9') goto yy702;
|
||||
if (yych <= ':') goto yy703;
|
||||
yy700:
|
||||
#line 1506 "ext/date/lib/parse_date.re"
|
||||
#line 1510 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("clf");
|
||||
@@ -11330,7 +11334,7 @@ yy700:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_CLF;
|
||||
}
|
||||
#line 11334 "<stdout>"
|
||||
#line 11338 "<stdout>"
|
||||
yy701:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '5') {
|
||||
@@ -11817,7 +11821,7 @@ yy762:
|
||||
if (yych <= 't') goto yy662;
|
||||
}
|
||||
yy763:
|
||||
#line 1251 "ext/date/lib/parse_date.re"
|
||||
#line 1255 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("iso8601date2");
|
||||
@@ -11830,7 +11834,7 @@ yy763:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 11834 "<stdout>"
|
||||
#line 11838 "<stdout>"
|
||||
yy764:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych == 'C') goto yy765;
|
||||
@@ -11861,7 +11865,7 @@ yy769:
|
||||
if (yych >= '2') goto yy56;
|
||||
yy770:
|
||||
++YYCURSOR;
|
||||
#line 1492 "ext/date/lib/parse_date.re"
|
||||
#line 1496 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pgtextreverse");
|
||||
@@ -11874,7 +11878,7 @@ yy770:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PG_TEXT;
|
||||
}
|
||||
#line 11878 "<stdout>"
|
||||
#line 11882 "<stdout>"
|
||||
yy772:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych == 'V') goto yy765;
|
||||
@@ -11999,7 +12003,7 @@ yy782:
|
||||
default: goto yy783;
|
||||
}
|
||||
yy783:
|
||||
#line 1527 "ext/date/lib/parse_date.re"
|
||||
#line 1531 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("year4");
|
||||
TIMELIB_INIT;
|
||||
@@ -12007,7 +12011,7 @@ yy783:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_CLF;
|
||||
}
|
||||
#line 12011 "<stdout>"
|
||||
#line 12015 "<stdout>"
|
||||
yy784:
|
||||
yych = *++YYCURSOR;
|
||||
switch (yych) {
|
||||
@@ -12145,7 +12149,7 @@ yy792:
|
||||
if (yych <= 'X') goto yy883;
|
||||
}
|
||||
yy793:
|
||||
#line 1348 "ext/date/lib/parse_date.re"
|
||||
#line 1352 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datenodayrev");
|
||||
@@ -12158,7 +12162,7 @@ yy793:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_NO_DAY;
|
||||
}
|
||||
#line 12162 "<stdout>"
|
||||
#line 12166 "<stdout>"
|
||||
yy794:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych == 'I') goto yy927;
|
||||
@@ -12352,7 +12356,7 @@ yy813:
|
||||
if (yych <= '/') goto yy814;
|
||||
if (yych <= '7') goto yy816;
|
||||
yy814:
|
||||
#line 1459 "ext/date/lib/parse_date.re"
|
||||
#line 1463 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll w, d;
|
||||
DEBUG_OUTPUT("isoweek");
|
||||
@@ -12370,14 +12374,14 @@ yy814:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_WEEK;
|
||||
}
|
||||
#line 12374 "<stdout>"
|
||||
#line 12378 "<stdout>"
|
||||
yy815:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy56;
|
||||
if (yych >= '8') goto yy56;
|
||||
yy816:
|
||||
++YYCURSOR;
|
||||
#line 1440 "ext/date/lib/parse_date.re"
|
||||
#line 1444 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll w, d;
|
||||
DEBUG_OUTPUT("isoweekday");
|
||||
@@ -12395,7 +12399,7 @@ yy816:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_WEEK;
|
||||
}
|
||||
#line 12399 "<stdout>"
|
||||
#line 12403 "<stdout>"
|
||||
yy818:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy60;
|
||||
@@ -12455,7 +12459,7 @@ yy820:
|
||||
}
|
||||
}
|
||||
yy821:
|
||||
#line 1426 "ext/date/lib/parse_date.re"
|
||||
#line 1430 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pgydotd");
|
||||
@@ -12468,7 +12472,7 @@ yy821:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PG_YEARDAY;
|
||||
}
|
||||
#line 12472 "<stdout>"
|
||||
#line 12476 "<stdout>"
|
||||
yy822:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy60;
|
||||
@@ -12550,7 +12554,7 @@ yy840:
|
||||
yy841:
|
||||
++YYCURSOR;
|
||||
yy842:
|
||||
#line 1400 "ext/date/lib/parse_date.re"
|
||||
#line 1404 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
|
||||
@@ -12575,7 +12579,7 @@ yy842:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_XMLRPC_SOAP;
|
||||
}
|
||||
#line 12579 "<stdout>"
|
||||
#line 12583 "<stdout>"
|
||||
yy843:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '2') {
|
||||
@@ -12831,7 +12835,7 @@ yy847:
|
||||
}
|
||||
}
|
||||
yy848:
|
||||
#line 1388 "ext/date/lib/parse_date.re"
|
||||
#line 1392 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("datenocolon");
|
||||
TIMELIB_INIT;
|
||||
@@ -12842,7 +12846,7 @@ yy848:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_NOCOLON;
|
||||
}
|
||||
#line 12846 "<stdout>"
|
||||
#line 12850 "<stdout>"
|
||||
yy849:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'H') {
|
||||
@@ -13636,7 +13640,7 @@ yy972:
|
||||
if (yych <= '/') goto yy973;
|
||||
if (yych <= '9') goto yy995;
|
||||
yy973:
|
||||
#line 1265 "ext/date/lib/parse_date.re"
|
||||
#line 1269 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("gnudateshorter");
|
||||
@@ -13649,7 +13653,7 @@ yy973:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 13653 "<stdout>"
|
||||
#line 13657 "<stdout>"
|
||||
yy974:
|
||||
yyaccept = 22;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -14561,7 +14565,7 @@ yy1065:
|
||||
default: goto yy1067;
|
||||
}
|
||||
yy1067:
|
||||
#line 1157 "ext/date/lib/parse_date.re"
|
||||
#line 1161 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("gnunocolon");
|
||||
TIMELIB_INIT;
|
||||
@@ -14583,7 +14587,7 @@ yy1067:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_GNU_NOCOLON;
|
||||
}
|
||||
#line 14587 "<stdout>"
|
||||
#line 14591 "<stdout>"
|
||||
yy1068:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy60;
|
||||
@@ -14667,7 +14671,7 @@ yy1074:
|
||||
}
|
||||
}
|
||||
yy1075:
|
||||
#line 1203 "ext/date/lib/parse_date.re"
|
||||
#line 1207 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("iso8601nocolon");
|
||||
@@ -14686,7 +14690,7 @@ yy1075:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_NOCOLON;
|
||||
}
|
||||
#line 14690 "<stdout>"
|
||||
#line 14694 "<stdout>"
|
||||
yy1076:
|
||||
yyaccept = 25;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -15542,7 +15546,7 @@ yy1116:
|
||||
}
|
||||
}
|
||||
yy1117:
|
||||
#line 1599 "ext/date/lib/parse_date.re"
|
||||
#line 1603 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll i;
|
||||
int behavior = 0;
|
||||
@@ -15558,7 +15562,7 @@ yy1117:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 15562 "<stdout>"
|
||||
#line 15566 "<stdout>"
|
||||
yy1118:
|
||||
++YYCURSOR;
|
||||
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
|
||||
@@ -15600,7 +15604,7 @@ yy1124:
|
||||
if (yych != 'f') goto yy56;
|
||||
yy1125:
|
||||
++YYCURSOR;
|
||||
#line 1072 "ext/date/lib/parse_date.re"
|
||||
#line 1076 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll i;
|
||||
int behavior = 0;
|
||||
@@ -15621,7 +15625,7 @@ yy1125:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_WEEK_DAY_OF_MONTH;
|
||||
}
|
||||
#line 15625 "<stdout>"
|
||||
#line 15629 "<stdout>"
|
||||
yy1127:
|
||||
yyaccept = 26;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -15714,7 +15718,7 @@ yy1140:
|
||||
}
|
||||
}
|
||||
yy1141:
|
||||
#line 1575 "ext/date/lib/parse_date.re"
|
||||
#line 1579 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll i;
|
||||
int behavior = 0;
|
||||
@@ -15737,7 +15741,7 @@ yy1141:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 15741 "<stdout>"
|
||||
#line 15745 "<stdout>"
|
||||
yy1142:
|
||||
yych = *++YYCURSOR;
|
||||
goto yy1117;
|
||||
@@ -18261,7 +18265,7 @@ yy1293:
|
||||
if (yych <= '9') goto yy1296;
|
||||
goto yy1297;
|
||||
yy1294:
|
||||
#line 1049 "ext/date/lib/parse_date.re"
|
||||
#line 1053 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("backof | frontof");
|
||||
TIMELIB_INIT;
|
||||
@@ -18283,7 +18287,7 @@ yy1294:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_LF_DAY_OF_MONTH;
|
||||
}
|
||||
#line 18287 "<stdout>"
|
||||
#line 18291 "<stdout>"
|
||||
yy1295:
|
||||
yyaccept = 28;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -18522,7 +18526,7 @@ yy1314:
|
||||
if (yych != 'f') goto yy56;
|
||||
yy1315:
|
||||
++YYCURSOR;
|
||||
#line 1032 "ext/date/lib/parse_date.re"
|
||||
#line 1036 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("firstdayof | lastdayof");
|
||||
TIMELIB_INIT;
|
||||
@@ -18538,7 +18542,7 @@ yy1315:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_LF_DAY_OF_MONTH;
|
||||
}
|
||||
#line 18542 "<stdout>"
|
||||
#line 18546 "<stdout>"
|
||||
yy1317:
|
||||
yyaccept = 0;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -19898,7 +19902,7 @@ yy1385:
|
||||
if (yych <= '/') goto yy1387;
|
||||
if (yych <= '9') goto yy1385;
|
||||
yy1387:
|
||||
#line 1006 "ext/date/lib/parse_date.re"
|
||||
#line 1010 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_ull i;
|
||||
|
||||
@@ -19923,7 +19927,7 @@ yy1387:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 19927 "<stdout>"
|
||||
#line 19931 "<stdout>"
|
||||
yy1388:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'N') {
|
||||
@@ -20329,7 +20333,7 @@ yy1415:
|
||||
yy1416:
|
||||
++YYCURSOR;
|
||||
yy1417:
|
||||
#line 994 "ext/date/lib/parse_date.re"
|
||||
#line 998 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("tomorrow");
|
||||
TIMELIB_INIT;
|
||||
@@ -20340,7 +20344,7 @@ yy1417:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 20344 "<stdout>"
|
||||
#line 20348 "<stdout>"
|
||||
yy1418:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'Y') {
|
||||
@@ -20372,7 +20376,7 @@ yy1419:
|
||||
if (yych <= 'z') goto yy144;
|
||||
}
|
||||
yy1420:
|
||||
#line 984 "ext/date/lib/parse_date.re"
|
||||
#line 988 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("midnight | today");
|
||||
TIMELIB_INIT;
|
||||
@@ -20381,7 +20385,7 @@ yy1420:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 20385 "<stdout>"
|
||||
#line 20389 "<stdout>"
|
||||
yy1421:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'S') {
|
||||
@@ -22313,7 +22317,7 @@ yy1499:
|
||||
if (yych <= 'z') goto yy142;
|
||||
}
|
||||
yy1500:
|
||||
#line 963 "ext/date/lib/parse_date.re"
|
||||
#line 967 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("now");
|
||||
TIMELIB_INIT;
|
||||
@@ -22321,7 +22325,7 @@ yy1500:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 22325 "<stdout>"
|
||||
#line 22329 "<stdout>"
|
||||
yy1501:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'N') {
|
||||
@@ -22452,7 +22456,7 @@ yy1507:
|
||||
if (yych <= 'z') goto yy143;
|
||||
}
|
||||
yy1508:
|
||||
#line 972 "ext/date/lib/parse_date.re"
|
||||
#line 976 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("noon");
|
||||
TIMELIB_INIT;
|
||||
@@ -22463,7 +22467,7 @@ yy1508:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 22467 "<stdout>"
|
||||
#line 22471 "<stdout>"
|
||||
yy1509:
|
||||
yyaccept = 0;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -22973,7 +22977,7 @@ yy1529:
|
||||
yy1530:
|
||||
++YYCURSOR;
|
||||
yy1531:
|
||||
#line 951 "ext/date/lib/parse_date.re"
|
||||
#line 955 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("yesterday");
|
||||
TIMELIB_INIT;
|
||||
@@ -22984,7 +22988,7 @@ yy1531:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 22988 "<stdout>"
|
||||
#line 22992 "<stdout>"
|
||||
yy1532:
|
||||
yyaccept = 0;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -23149,7 +23153,7 @@ yy1537:
|
||||
goto yy1531;
|
||||
}
|
||||
}
|
||||
#line 1725 "ext/date/lib/parse_date.re"
|
||||
#line 1729 "ext/date/lib/parse_date.re"
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -394,8 +394,12 @@ static timelib_sll timelib_meridian(char **ptr, timelib_sll h)
|
||||
}
|
||||
++*ptr;
|
||||
if (**ptr == '.') {
|
||||
*ptr += 3;
|
||||
} else {
|
||||
++*ptr;
|
||||
}
|
||||
if (**ptr == 'M' || **ptr == 'm') {
|
||||
++*ptr;
|
||||
}
|
||||
if (**ptr == '.') {
|
||||
++*ptr;
|
||||
}
|
||||
return retval;
|
||||
|
||||
+2818
-2783
File diff suppressed because it is too large.
Load diff
@@ -75,8 +75,8 @@ result = Monday 1983-04-18 01:00:00 CEST
|
||||
wanted = Monday 00:00:00
|
||||
|
||||
Asia/Yerevan
|
||||
ts = Monday 2037-10-19 17:17:17 AMT
|
||||
result = Monday 2037-10-26 00:00:00 AMT
|
||||
ts = Monday 2037-10-19 17:17:17 +04
|
||||
result = Monday 2037-10-26 00:00:00 +04
|
||||
wanted = Monday 00:00:00
|
||||
|
||||
America/Curacao
|
||||
@@ -115,8 +115,8 @@ result = Monday 1971-04-05 00:00:00 AST
|
||||
wanted = Monday 00:00:00
|
||||
|
||||
Asia/Baku
|
||||
ts = Friday 1971-01-01 17:17:17 BAKT
|
||||
result = Monday 1971-01-04 00:00:00 BAKT
|
||||
ts = Friday 1971-01-01 17:17:17 +04
|
||||
result = Monday 1971-01-04 00:00:00 +04
|
||||
wanted = Monday 00:00:00
|
||||
|
||||
Europe/Sarajevo
|
||||
@@ -165,6 +165,6 @@ result = Monday 1980-04-07 00:00:00 CEST
|
||||
wanted = Monday 00:00:00
|
||||
|
||||
Asia/Baku
|
||||
ts = Monday 1995-12-25 17:17:17 AZT
|
||||
result = Monday 1996-01-01 00:00:00 AZT
|
||||
ts = Monday 1995-12-25 17:17:17 +04
|
||||
result = Monday 1996-01-01 00:00:00 +04
|
||||
wanted = Monday 00:00:00
|
||||
@@ -226,8 +226,8 @@ result=Thursday 1980-04-10 00:00:00 CEST 1
|
||||
wanted=Thursday 00:00:00
|
||||
|
||||
TZ=Asia/Baku - wrong day.
|
||||
tStamp=Sunday 1992-09-20 17:17:17 AZST 1
|
||||
result=Monday 1992-09-28 00:00:00 AZT 0
|
||||
tStamp=Sunday 1992-09-20 17:17:17 +04 1
|
||||
result=Monday 1992-09-28 00:00:00 +04 0
|
||||
wanted=Monday 00:00:00
|
||||
|
||||
TZ=America/Noronha - wrong day.
|
||||
|
||||
@@ -28,6 +28,6 @@ result=Monday 1990-10-22 00:00:00 WART 0
|
||||
wanted=Monday 00:00:00
|
||||
|
||||
TZ=Asia/Tbilisi - Is it OK for this to be 2 AM?
|
||||
tStamp=Sunday 2005-03-20 17:17:17 GET 0
|
||||
result=Sunday 2005-03-27 00:00:00 GET 0
|
||||
tStamp=Sunday 2005-03-20 17:17:17 +03 0
|
||||
result=Sunday 2005-03-27 00:00:00 +03 0
|
||||
wanted=Sunday 00:00:00
|
||||
+2
-2
@@ -1792,7 +1792,7 @@ PHP_FUNCTION(dom_document_savexml)
|
||||
if (options & LIBXML_SAVE_NOEMPTYTAG) {
|
||||
xmlSaveNoEmptyTags = saveempty;
|
||||
}
|
||||
if (!size) {
|
||||
if (!size || !mem) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETVAL_STRINGL(mem, size, 1);
|
||||
@@ -2327,7 +2327,7 @@ PHP_FUNCTION(dom_document_save_html)
|
||||
#else
|
||||
htmlDocDumpMemory(docp, &mem, &size);
|
||||
#endif
|
||||
if (!size) {
|
||||
if (!size || !mem) {
|
||||
RETVAL_FALSE;
|
||||
} else {
|
||||
RETVAL_STRINGL((const char*) mem, size, 1);
|
||||
|
||||
+22
-22
@@ -14,7 +14,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Rasmus Lerdorf <rasmus@php.net> |
|
||||
| Jim Winstead <jimw@php.net> |
|
||||
| Jaakko Hyvätti <jaakko@hyvatti.iki.fi> |
|
||||
| Jaakko Hyvätti <jaakko@hyvatti.iki.fi> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
/* $Id$ */
|
||||
@@ -29,7 +29,7 @@
|
||||
/* {{{ arginfo */
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_ereg, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, pattern)
|
||||
ZEND_ARG_INFO(0, string)
|
||||
ZEND_ARG_INFO(0, string)
|
||||
ZEND_ARG_INFO(1, registers) /* ARRAY_INFO(1, registers, 1) */
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
@@ -41,8 +41,8 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_split, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, pattern)
|
||||
ZEND_ARG_INFO(0, string)
|
||||
ZEND_ARG_INFO(0, limit)
|
||||
ZEND_ARG_INFO(0, string)
|
||||
ZEND_ARG_INFO(0, limit)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_sql_regcase, 0)
|
||||
@@ -204,7 +204,7 @@ static int _php_regcomp(regex_t *preg, const char *pattern, int cflags TSRMLS_DC
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void _free_ereg_cache(reg_cache *rc)
|
||||
static void _free_ereg_cache(reg_cache *rc)
|
||||
{
|
||||
regfree(&rc->preg);
|
||||
}
|
||||
@@ -309,7 +309,7 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
|
||||
if (icase) {
|
||||
copts |= REG_ICASE;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 2) {
|
||||
copts |= REG_NOSUB;
|
||||
}
|
||||
@@ -337,7 +337,7 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
|
||||
|
||||
/* allocate storage for (sub-)expression-matches */
|
||||
subs = (regmatch_t *)ecalloc(sizeof(regmatch_t),re.re_nsub+1);
|
||||
|
||||
|
||||
/* actually execute the regular expression */
|
||||
err = regexec(&re, string, re.re_nsub+1, subs, 0);
|
||||
if (err && err != REG_NOMATCH) {
|
||||
@@ -409,8 +409,8 @@ PHP_EREG_API char *php_ereg_replace(const char *pattern, const char *replace, co
|
||||
*nbuf, /* nbuf is used when we grow the buffer */
|
||||
*walkbuf; /* used to walk buf when replacing backrefs */
|
||||
const char *walk; /* used to walk replacement string for backrefs */
|
||||
int buf_len;
|
||||
int pos, tmp, string_len, new_l;
|
||||
size_t buf_len, new_l;
|
||||
int pos, tmp, string_len;
|
||||
int err, copts = 0;
|
||||
|
||||
string_len = strlen(string);
|
||||
@@ -434,8 +434,8 @@ PHP_EREG_API char *php_ereg_replace(const char *pattern, const char *replace, co
|
||||
|
||||
/* start with a buffer that is twice the size of the stringo
|
||||
we're doing replacements in */
|
||||
buf = safe_emalloc(string_len, 2, 1);
|
||||
buf_len = 2 * string_len + 1;
|
||||
buf = safe_emalloc(buf_len, sizeof(char), 0);
|
||||
|
||||
err = pos = 0;
|
||||
buf[0] = '\0';
|
||||
@@ -472,8 +472,8 @@ PHP_EREG_API char *php_ereg_replace(const char *pattern, const char *replace, co
|
||||
}
|
||||
}
|
||||
if (new_l + 1 > buf_len) {
|
||||
nbuf = safe_emalloc(new_l + 1, 2, buf_len);
|
||||
buf_len = 1 + buf_len + 2 * new_l;
|
||||
nbuf = emalloc(buf_len);
|
||||
strncpy(nbuf, buf, buf_len - 1);
|
||||
nbuf[buf_len - 1] = '\0';
|
||||
efree(buf);
|
||||
@@ -491,7 +491,7 @@ PHP_EREG_API char *php_ereg_replace(const char *pattern, const char *replace, co
|
||||
if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1
|
||||
/* this next case shouldn't happen. it does. */
|
||||
&& subs[walk[1] - '0'].rm_so <= subs[walk[1] - '0'].rm_eo) {
|
||||
|
||||
|
||||
tmp = subs[walk[1] - '0'].rm_eo - subs[walk[1] - '0'].rm_so;
|
||||
memcpy (walkbuf, &string[pos + subs[walk[1] - '0'].rm_so], tmp);
|
||||
walkbuf += tmp;
|
||||
@@ -510,8 +510,8 @@ PHP_EREG_API char *php_ereg_replace(const char *pattern, const char *replace, co
|
||||
}
|
||||
new_l = strlen (buf) + 1;
|
||||
if (new_l + 1 > buf_len) {
|
||||
nbuf = safe_emalloc(new_l + 1, 2, buf_len);
|
||||
buf_len = 1 + buf_len + 2 * new_l;
|
||||
nbuf = safe_emalloc(buf_len, sizeof(char), 0);
|
||||
strncpy(nbuf, buf, buf_len-1);
|
||||
efree(buf);
|
||||
buf = nbuf;
|
||||
@@ -526,7 +526,7 @@ PHP_EREG_API char *php_ereg_replace(const char *pattern, const char *replace, co
|
||||
new_l = strlen(buf) + strlen(&string[pos]);
|
||||
if (new_l + 1 > buf_len) {
|
||||
buf_len = new_l + 1; /* now we know exactly how long it is */
|
||||
nbuf = safe_emalloc(buf_len, sizeof(char), 0);
|
||||
nbuf = safe_emalloc(new_l, 1, 1);
|
||||
strncpy(nbuf, buf, buf_len-1);
|
||||
efree(buf);
|
||||
buf = nbuf;
|
||||
@@ -556,7 +556,7 @@ static void php_do_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase)
|
||||
char *replace;
|
||||
char *ret;
|
||||
int arg_string_len;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZs", &arg_pattern, &arg_replace, &arg_string, &arg_string_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -598,7 +598,7 @@ static void php_do_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase)
|
||||
if (ret == (char *) -1) {
|
||||
RETVAL_FALSE;
|
||||
} else {
|
||||
RETVAL_STRING(ret, 1);
|
||||
RETVAL_STRINGL_CHECK(ret, strlen(ret), 1);
|
||||
STR_FREE(ret);
|
||||
}
|
||||
|
||||
@@ -664,9 +664,9 @@ static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase)
|
||||
} else if (subs[0].rm_so == 0 && subs[0].rm_eo == 0) {
|
||||
/* No more matches */
|
||||
regfree(&re);
|
||||
|
||||
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Regular Expression");
|
||||
|
||||
|
||||
zend_hash_destroy(Z_ARRVAL_P(return_value));
|
||||
efree(Z_ARRVAL_P(return_value));
|
||||
RETURN_FALSE;
|
||||
@@ -675,7 +675,7 @@ static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase)
|
||||
|
||||
/* make a copy of the substring */
|
||||
size = subs[0].rm_so;
|
||||
|
||||
|
||||
/* add it to the array */
|
||||
add_next_index_stringl(return_value, strp, size, 1);
|
||||
|
||||
@@ -701,7 +701,7 @@ static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase)
|
||||
|
||||
/* otherwise we just have one last element to add to the array */
|
||||
size = endp - strp;
|
||||
|
||||
|
||||
add_next_index_stringl(return_value, strp, size, 1);
|
||||
|
||||
regfree(&re);
|
||||
@@ -738,9 +738,9 @@ PHP_EREG_API PHP_FUNCTION(sql_regcase)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, &string_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
tmp = safe_emalloc(string_len, 4, 1);
|
||||
|
||||
|
||||
for (i = j = 0; i < string_len; i++) {
|
||||
c = (unsigned char) string[i];
|
||||
if ( j >= INT_MAX - 1 || (isalpha(c) && j >= INT_MAX - 4)) {
|
||||
|
||||
+9
-6
@@ -2614,11 +2614,11 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
|
||||
|
||||
if (argc > 1) {
|
||||
fn = file;
|
||||
if (argc == 3) {
|
||||
if (argc >= 3) {
|
||||
q = quality;
|
||||
}
|
||||
if (argc == 4) {
|
||||
t = type;
|
||||
if (argc == 4) {
|
||||
t = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3854,7 +3854,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
|
||||
{
|
||||
zval *IM, *EXT = NULL;
|
||||
gdImagePtr im=NULL;
|
||||
long col = -1, x = -1, y = -1;
|
||||
long col = -1, x = 0, y = 0;
|
||||
int str_len, fontname_len, i, brect[8];
|
||||
double ptsize, angle;
|
||||
char *str = NULL, *fontname = NULL;
|
||||
@@ -5175,7 +5175,7 @@ PHP_FUNCTION(imagescale)
|
||||
gdImagePtr im_scaled = NULL;
|
||||
int new_width, new_height;
|
||||
long tmp_w, tmp_h=-1, tmp_m = GD_BILINEAR_FIXED;
|
||||
gdInterpolationMethod method;
|
||||
gdInterpolationMethod method, old_method;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|ll", &IM, &tmp_w, &tmp_h, &tmp_m) == FAILURE) {
|
||||
return;
|
||||
@@ -5202,9 +5202,12 @@ PHP_FUNCTION(imagescale)
|
||||
new_width = tmp_w;
|
||||
new_height = tmp_h;
|
||||
|
||||
/* gdImageGetInterpolationMethod() is only available as of GD 2.1.1 */
|
||||
old_method = im->interpolation_id;
|
||||
if (gdImageSetInterpolationMethod(im, method)) {
|
||||
im_scaled = gdImageScale(im, new_width, new_height);
|
||||
}
|
||||
gdImageSetInterpolationMethod(im, old_method);
|
||||
|
||||
if (im_scaled == NULL) {
|
||||
RETURN_FALSE;
|
||||
|
||||
+33
-66
@@ -1117,7 +1117,7 @@ void gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
|
||||
}
|
||||
|
||||
/* 2.0.10: Nick Atty: clip to edges of drawing rectangle, return if no points need to be drawn */
|
||||
if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im))) {
|
||||
if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)-1) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im)-1)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1298,58 +1298,13 @@ inline static void gdImageSetAAPixelColor(gdImagePtr im, int x, int y, int color
|
||||
void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col)
|
||||
{
|
||||
/* keep them as 32bits */
|
||||
long x, y, inc;
|
||||
long x, y, inc, frac;
|
||||
long dx, dy,tmp;
|
||||
|
||||
if (y1 < 0 && y2 < 0) {
|
||||
/* 2.0.10: Nick Atty: clip to edges of drawing rectangle, return if no points need to be drawn */
|
||||
if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)-1) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im)-1)) {
|
||||
return;
|
||||
}
|
||||
if (y1 < 0) {
|
||||
x1 += (y1 * (x1 - x2)) / (y2 - y1);
|
||||
y1 = 0;
|
||||
}
|
||||
if (y2 < 0) {
|
||||
x2 += (y2 * (x1 - x2)) / (y2 - y1);
|
||||
y2 = 0;
|
||||
}
|
||||
|
||||
/* bottom edge */
|
||||
if (y1 >= im->sy && y2 >= im->sy) {
|
||||
return;
|
||||
}
|
||||
if (y1 >= im->sy) {
|
||||
x1 -= ((im->sy - y1) * (x1 - x2)) / (y2 - y1);
|
||||
y1 = im->sy - 1;
|
||||
}
|
||||
if (y2 >= im->sy) {
|
||||
x2 -= ((im->sy - y2) * (x1 - x2)) / (y2 - y1);
|
||||
y2 = im->sy - 1;
|
||||
}
|
||||
|
||||
/* left edge */
|
||||
if (x1 < 0 && x2 < 0) {
|
||||
return;
|
||||
}
|
||||
if (x1 < 0) {
|
||||
y1 += (x1 * (y1 - y2)) / (x2 - x1);
|
||||
x1 = 0;
|
||||
}
|
||||
if (x2 < 0) {
|
||||
y2 += (x2 * (y1 - y2)) / (x2 - x1);
|
||||
x2 = 0;
|
||||
}
|
||||
/* right edge */
|
||||
if (x1 >= im->sx && x2 >= im->sx) {
|
||||
return;
|
||||
}
|
||||
if (x1 >= im->sx) {
|
||||
y1 -= ((im->sx - x1) * (y1 - y2)) / (x2 - x1);
|
||||
x1 = im->sx - 1;
|
||||
}
|
||||
if (x2 >= im->sx) {
|
||||
y2 -= ((im->sx - x2) * (y1 - y2)) / (x2 - x1);
|
||||
x2 = im->sx - 1;
|
||||
}
|
||||
|
||||
dx = x2 - x1;
|
||||
dy = y2 - y1;
|
||||
@@ -1368,16 +1323,22 @@ void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col)
|
||||
dx = x2 - x1;
|
||||
dy = y2 - y1;
|
||||
}
|
||||
x = x1 << 16;
|
||||
y = y1 << 16;
|
||||
y = y1;
|
||||
inc = (dy * 65536) / dx;
|
||||
while ((x >> 16) <= x2) {
|
||||
gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (y >> 8) & 0xFF);
|
||||
if ((y >> 16) + 1 < im->sy) {
|
||||
gdImageSetAAPixelColor(im, x >> 16, (y >> 16) + 1,col, (~y >> 8) & 0xFF);
|
||||
frac = 0;
|
||||
for (x = x1; x <= x2; x++) {
|
||||
gdImageSetAAPixelColor(im, x, y, col, (frac >> 8) & 0xFF);
|
||||
if (y + 1 < im->sy) {
|
||||
gdImageSetAAPixelColor(im, x, y + 1, col, (~frac >> 8) & 0xFF);
|
||||
}
|
||||
frac += inc;
|
||||
if (frac >= 65536) {
|
||||
frac -= 65536;
|
||||
y++;
|
||||
} else if (frac < 0) {
|
||||
frac += 65536;
|
||||
y--;
|
||||
}
|
||||
x += (1 << 16);
|
||||
y += inc;
|
||||
}
|
||||
} else {
|
||||
if (dy < 0) {
|
||||
@@ -1390,16 +1351,22 @@ void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col)
|
||||
dx = x2 - x1;
|
||||
dy = y2 - y1;
|
||||
}
|
||||
x = x1 << 16;
|
||||
y = y1 << 16;
|
||||
x = x1;
|
||||
inc = (dx * 65536) / dy;
|
||||
while ((y>>16) <= y2) {
|
||||
gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (x >> 8) & 0xFF);
|
||||
if ((x >> 16) + 1 < im->sx) {
|
||||
gdImageSetAAPixelColor(im, (x >> 16) + 1, (y >> 16),col, (~x >> 8) & 0xFF);
|
||||
frac = 0;
|
||||
for (y = y1; y <= y2; y++) {
|
||||
gdImageSetAAPixelColor(im, x, y, col, (frac >> 8) & 0xFF);
|
||||
if (x + 1 < im->sx) {
|
||||
gdImageSetAAPixelColor(im, x + 1, y, col, (~frac >> 8) & 0xFF);
|
||||
}
|
||||
frac += inc;
|
||||
if (frac >= 65536) {
|
||||
frac -= 65536;
|
||||
x++;
|
||||
} else if (frac < 0) {
|
||||
frac += 65536;
|
||||
x--;
|
||||
}
|
||||
x += inc;
|
||||
y += (1<<16);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1780,7 +1747,7 @@ void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color)
|
||||
int leftLimit = -1, rightLimit;
|
||||
int i, restoreAlphaBlending = 0;
|
||||
|
||||
if (border < 0) {
|
||||
if (border < 0 || color < 0) {
|
||||
/* Refuse to fill to a non-solid border */
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -243,6 +243,10 @@ gdImagePtr gdImageCropThreshold(gdImagePtr im, const unsigned int color, const f
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!gdImageTrueColor(im) && color >= gdImageColorsTotal(im)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* TODO: Add gdImageGetRowPtr and works with ptr at the row level
|
||||
* for the true color and palette images
|
||||
* new formats will simply work with ptr
|
||||
|
||||
@@ -191,21 +191,21 @@ static gdImagePtr _gd2CreateFromFile (gdIOCtxPtr in, int *sx, int *sy, int *cs,
|
||||
}
|
||||
if (im == NULL) {
|
||||
GD2_DBG(php_gd_error("Could not create gdImage"));
|
||||
goto fail1;
|
||||
goto fail2;
|
||||
}
|
||||
|
||||
if (!_gdGetColors(in, im, (*vers) == 2)) {
|
||||
GD2_DBG(php_gd_error("Could not read color palette"));
|
||||
goto fail2;
|
||||
goto fail3;
|
||||
}
|
||||
GD2_DBG(php_gd_error("Image palette completed: %d colours", im->colorsTotal));
|
||||
|
||||
return im;
|
||||
|
||||
fail2:
|
||||
fail3:
|
||||
gdImageDestroy(im);
|
||||
return 0;
|
||||
|
||||
fail2:
|
||||
gdFree(*cidx);
|
||||
fail1:
|
||||
return 0;
|
||||
}
|
||||
@@ -670,7 +670,7 @@ static void _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt)
|
||||
|
||||
/* Force fmt to a valid value since we don't return anything. */
|
||||
if ((fmt != GD2_FMT_RAW) && (fmt != GD2_FMT_COMPRESSED)) {
|
||||
fmt = im->trueColor ? GD2_FMT_TRUECOLOR_COMPRESSED : GD2_FMT_COMPRESSED;
|
||||
fmt = GD2_FMT_COMPRESSED;
|
||||
}
|
||||
if (im->trueColor) {
|
||||
fmt += 2;
|
||||
@@ -689,8 +689,8 @@ static void _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt)
|
||||
}
|
||||
|
||||
/* Work out number of chunks. */
|
||||
ncx = im->sx / cs + 1;
|
||||
ncy = im->sy / cs + 1;
|
||||
ncx = (im->sx + cs - 1) / cs;
|
||||
ncy = (im->sy + cs - 1) / cs;
|
||||
|
||||
/* Write the standard header. */
|
||||
_gd2PutHeader (im, out, cs, fmt, ncx, ncy);
|
||||
|
||||
@@ -1331,10 +1331,10 @@ static gdImagePtr gdImageScaleBilinearPalette(gdImagePtr im, const unsigned int
|
||||
f_a4 = gd_itofx(gdTrueColorGetAlpha(pixel4));
|
||||
|
||||
{
|
||||
const char red = (char) gd_fxtoi(gd_mulfx(f_w1, f_r1) + gd_mulfx(f_w2, f_r2) + gd_mulfx(f_w3, f_r3) + gd_mulfx(f_w4, f_r4));
|
||||
const char green = (char) gd_fxtoi(gd_mulfx(f_w1, f_g1) + gd_mulfx(f_w2, f_g2) + gd_mulfx(f_w3, f_g3) + gd_mulfx(f_w4, f_g4));
|
||||
const char blue = (char) gd_fxtoi(gd_mulfx(f_w1, f_b1) + gd_mulfx(f_w2, f_b2) + gd_mulfx(f_w3, f_b3) + gd_mulfx(f_w4, f_b4));
|
||||
const char alpha = (char) gd_fxtoi(gd_mulfx(f_w1, f_a1) + gd_mulfx(f_w2, f_a2) + gd_mulfx(f_w3, f_a3) + gd_mulfx(f_w4, f_a4));
|
||||
const unsigned char red = (unsigned char) gd_fxtoi(gd_mulfx(f_w1, f_r1) + gd_mulfx(f_w2, f_r2) + gd_mulfx(f_w3, f_r3) + gd_mulfx(f_w4, f_r4));
|
||||
const unsigned char green = (unsigned char) gd_fxtoi(gd_mulfx(f_w1, f_g1) + gd_mulfx(f_w2, f_g2) + gd_mulfx(f_w3, f_g3) + gd_mulfx(f_w4, f_g4));
|
||||
const unsigned char blue = (unsigned char) gd_fxtoi(gd_mulfx(f_w1, f_b1) + gd_mulfx(f_w2, f_b2) + gd_mulfx(f_w3, f_b3) + gd_mulfx(f_w4, f_b4));
|
||||
const unsigned char alpha = (unsigned char) gd_fxtoi(gd_mulfx(f_w1, f_a1) + gd_mulfx(f_w2, f_a2) + gd_mulfx(f_w3, f_a3) + gd_mulfx(f_w4, f_a4));
|
||||
|
||||
new_img->tpixels[dst_offset_v][dst_offset_h] = gdTrueColorAlpha(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ static int dynamicGetbuf (gdIOCtxPtr ctx, void *buf, int len)
|
||||
if (remain >= len) {
|
||||
rlen = len;
|
||||
} else {
|
||||
if (remain == 0) {
|
||||
if (remain <= 0) {
|
||||
return EOF;
|
||||
}
|
||||
rlen = remain;
|
||||
|
||||
@@ -180,6 +180,15 @@ void gdImageWebpCtx (gdImagePtr im, gdIOCtx * outfile, int quantization)
|
||||
/* Conversion to Y,U,V buffer */
|
||||
yuv_width = (width + 1) >> 1;
|
||||
yuv_height = (height + 1) >> 1;
|
||||
|
||||
if (overflow2(width, height)) {
|
||||
return;
|
||||
}
|
||||
/* simplification possible, because WebP must not be larger than 16384**2 */
|
||||
if (overflow2(width * height, 2 * sizeof(unsigned char))) {
|
||||
return;
|
||||
}
|
||||
|
||||
yuv_nbytes = width * height + 2 * yuv_width * yuv_height;
|
||||
|
||||
if ((Y = (unsigned char *)gdCalloc(yuv_nbytes, sizeof(unsigned char))) == NULL) {
|
||||
|
||||
+71
-56
@@ -659,6 +659,8 @@ static char * gdft_draw_bitmap (gdCache_head_t *tc_cache, gdImage * im, int fg,
|
||||
} else {
|
||||
return "Unsupported ft_pixel_mode";
|
||||
}
|
||||
if (level == 0) /* if background */
|
||||
continue;
|
||||
if ((fg >= 0) && (im->trueColor)) {
|
||||
/* Consider alpha in the foreground color itself to be an
|
||||
* upper bound on how opaque things get, when truecolor is
|
||||
@@ -748,9 +750,9 @@ static char * gdft_draw_bitmap (gdCache_head_t *tc_cache, gdImage * im, int fg,
|
||||
}
|
||||
|
||||
static int
|
||||
gdroundupdown (FT_F26Dot6 v1, int updown)
|
||||
gdroundupdown (FT_F26Dot6 v1, int roundup)
|
||||
{
|
||||
return (!updown) ? (v1 < 0 ? ((v1 - 63) >> 6) : v1 >> 6) : (v1 > 0 ? ((v1 + 63) >> 6) : v1 >> 6);
|
||||
return (!roundup) ? v1 >> 6 : (v1 + 63) >> 6;
|
||||
}
|
||||
|
||||
void gdFontCacheShutdown()
|
||||
@@ -820,8 +822,6 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
|
||||
double cos_a = cos (angle);
|
||||
int len, i = 0, ch;
|
||||
int x1 = 0, y1 = 0;
|
||||
int xb = x, yb = y;
|
||||
int yd = 0;
|
||||
font_t *font;
|
||||
fontkey_t fontkey;
|
||||
char *next;
|
||||
@@ -982,9 +982,6 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
|
||||
penf.y = (penf.y - 32) & -64; /* round to next pixel row */
|
||||
x1 = (int)(- penf.y * sin_a + 32) / 64;
|
||||
y1 = (int)(- penf.y * cos_a + 32) / 64;
|
||||
xb = x + x1;
|
||||
yb = y + y1;
|
||||
yd = 0;
|
||||
pen.x = pen.y = 0;
|
||||
previous = 0; /* clear kerning flag */
|
||||
continue;
|
||||
@@ -1074,23 +1071,32 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
|
||||
/* retrieve kerning distance and move pen position */
|
||||
if (use_kerning && previous && glyph_index) {
|
||||
FT_Get_Kerning(face, previous, glyph_index, ft_kerning_default, &delta);
|
||||
pen.x += delta.x;
|
||||
pen.x += (int)(delta.x * cos_a);
|
||||
pen.y -= (int)(delta.x * sin_a);
|
||||
penf.x += delta.x;
|
||||
}
|
||||
|
||||
/* load glyph image into the slot (erase previous one) */
|
||||
if (FT_Load_Glyph(face, glyph_index, render_mode)) {
|
||||
if (tmpstr) {
|
||||
gdFree(tmpstr);
|
||||
}
|
||||
gdCacheDelete(tc_cache);
|
||||
gdMutexUnlock(gdFontCacheMutex);
|
||||
return "Problem loading glyph";
|
||||
}
|
||||
|
||||
/* transform glyph image */
|
||||
FT_Get_Glyph(slot, &image);
|
||||
if (brect) { /* only if need brect */
|
||||
/* load glyph image into the slot (erase previous one) */
|
||||
if (FT_Load_Glyph(face, glyph_index, render_mode | FT_LOAD_IGNORE_TRANSFORM)) {
|
||||
if (tmpstr) {
|
||||
gdFree(tmpstr);
|
||||
}
|
||||
gdCacheDelete(tc_cache);
|
||||
gdMutexUnlock(gdFontCacheMutex);
|
||||
return "Problem loading glyph";
|
||||
}
|
||||
|
||||
/* transform glyph image */
|
||||
if (FT_Get_Glyph(slot, &image)) {
|
||||
if (tmpstr) {
|
||||
gdFree(tmpstr);
|
||||
}
|
||||
gdCacheDelete(tc_cache);
|
||||
gdMutexUnlock(gdFontCacheMutex);
|
||||
return "Problem loading glyph";
|
||||
}
|
||||
|
||||
FT_Glyph_Get_CBox(image, ft_glyph_bbox_gridfit, &glyph_bbox);
|
||||
glyph_bbox.xMin += penf.x;
|
||||
glyph_bbox.yMin += penf.y;
|
||||
@@ -1100,17 +1106,11 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
|
||||
glyph_bbox.xMax += slot->metrics.horiAdvance;
|
||||
}
|
||||
if (!i) { /* if first character, init BB corner values */
|
||||
yd = slot->metrics.height - slot->metrics.horiBearingY;
|
||||
bbox.xMin = glyph_bbox.xMin;
|
||||
bbox.yMin = glyph_bbox.yMin;
|
||||
bbox.xMax = glyph_bbox.xMax;
|
||||
bbox.yMax = glyph_bbox.yMax;
|
||||
} else {
|
||||
FT_Pos desc;
|
||||
|
||||
if ( (desc = (slot->metrics.height - slot->metrics.horiBearingY)) > yd) {
|
||||
yd = desc;
|
||||
}
|
||||
if (bbox.xMin > glyph_bbox.xMin) {
|
||||
bbox.xMin = glyph_bbox.xMin;
|
||||
}
|
||||
@@ -1127,7 +1127,35 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
|
||||
i++;
|
||||
}
|
||||
|
||||
/* increment (unrotated) pen position */
|
||||
penf.x += slot->metrics.horiAdvance;
|
||||
|
||||
if (render) {
|
||||
if (!brect || angle != 0) {
|
||||
/* reload the rotated glyph (for bbox we needed FT_LOAD_IGNORE_TRANSFORM - bbox is rotated later) */
|
||||
FT_Done_Glyph(image);
|
||||
|
||||
/* load glyph image into the slot (erase previous one) */
|
||||
if (FT_Load_Glyph(face, glyph_index, render_mode)) {
|
||||
if (tmpstr) {
|
||||
gdFree(tmpstr);
|
||||
}
|
||||
gdCacheDelete(tc_cache);
|
||||
gdMutexUnlock(gdFontCacheMutex);
|
||||
return "Problem loading glyph";
|
||||
}
|
||||
|
||||
/* transform glyph image */
|
||||
if (FT_Get_Glyph(slot, &image)) {
|
||||
if (tmpstr) {
|
||||
gdFree(tmpstr);
|
||||
}
|
||||
gdCacheDelete(tc_cache);
|
||||
gdMutexUnlock(gdFontCacheMutex);
|
||||
return "Problem loading glyph";
|
||||
}
|
||||
}
|
||||
|
||||
if (image->format != ft_glyph_format_bitmap && FT_Glyph_To_Bitmap(&image, ft_render_mode_normal, 0, 1)) {
|
||||
FT_Done_Glyph(image);
|
||||
if (tmpstr) {
|
||||
@@ -1150,8 +1178,6 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
|
||||
pen.x += image->advance.x >> 10;
|
||||
pen.y -= image->advance.y >> 10;
|
||||
|
||||
penf.x += slot->metrics.horiAdvance;
|
||||
|
||||
FT_Done_Glyph(image);
|
||||
}
|
||||
|
||||
@@ -1160,36 +1186,25 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
|
||||
double d1 = sin (angle + 0.78539816339744830962);
|
||||
double d2 = sin (angle - 0.78539816339744830962);
|
||||
|
||||
/* make the center of rotation at (0, 0) */
|
||||
FT_BBox normbox;
|
||||
|
||||
normbox.xMin = 0;
|
||||
normbox.yMin = 0;
|
||||
normbox.xMax = bbox.xMax - bbox.xMin;
|
||||
normbox.yMax = bbox.yMax - bbox.yMin;
|
||||
|
||||
brect[0] = brect[2] = brect[4] = brect[6] = (int) (yd * sin_a);
|
||||
brect[1] = brect[3] = brect[5] = brect[7] = (int)(- yd * cos_a);
|
||||
|
||||
/* rotate bounding rectangle */
|
||||
brect[0] += (int) (normbox.xMin * cos_a - normbox.yMin * sin_a);
|
||||
brect[1] += (int) (normbox.xMin * sin_a + normbox.yMin * cos_a);
|
||||
brect[2] += (int) (normbox.xMax * cos_a - normbox.yMin * sin_a);
|
||||
brect[3] += (int) (normbox.xMax * sin_a + normbox.yMin * cos_a);
|
||||
brect[4] += (int) (normbox.xMax * cos_a - normbox.yMax * sin_a);
|
||||
brect[5] += (int) (normbox.xMax * sin_a + normbox.yMax * cos_a);
|
||||
brect[6] += (int) (normbox.xMin * cos_a - normbox.yMax * sin_a);
|
||||
brect[7] += (int) (normbox.xMin * sin_a + normbox.yMax * cos_a);
|
||||
/* rotate bounding rectangle (at 0, 0) */
|
||||
brect[0] = (int) (bbox.xMin * cos_a - bbox.yMin * sin_a);
|
||||
brect[1] = (int) (bbox.xMin * sin_a + bbox.yMin * cos_a);
|
||||
brect[2] = (int) (bbox.xMax * cos_a - bbox.yMin * sin_a);
|
||||
brect[3] = (int) (bbox.xMax * sin_a + bbox.yMin * cos_a);
|
||||
brect[4] = (int) (bbox.xMax * cos_a - bbox.yMax * sin_a);
|
||||
brect[5] = (int) (bbox.xMax * sin_a + bbox.yMax * cos_a);
|
||||
brect[6] = (int) (bbox.xMin * cos_a - bbox.yMax * sin_a);
|
||||
brect[7] = (int) (bbox.xMin * sin_a + bbox.yMax * cos_a);
|
||||
|
||||
/* scale, round and offset brect */
|
||||
brect[0] = xb + gdroundupdown(brect[0], d2 > 0);
|
||||
brect[1] = yb - gdroundupdown(brect[1], d1 < 0);
|
||||
brect[2] = xb + gdroundupdown(brect[2], d1 > 0);
|
||||
brect[3] = yb - gdroundupdown(brect[3], d2 > 0);
|
||||
brect[4] = xb + gdroundupdown(brect[4], d2 < 0);
|
||||
brect[5] = yb - gdroundupdown(brect[5], d1 > 0);
|
||||
brect[6] = xb + gdroundupdown(brect[6], d1 < 0);
|
||||
brect[7] = yb - gdroundupdown(brect[7], d2 < 0);
|
||||
brect[0] = x + gdroundupdown(brect[0], d2 > 0);
|
||||
brect[1] = y - gdroundupdown(brect[1], d1 < 0);
|
||||
brect[2] = x + gdroundupdown(brect[2], d1 > 0);
|
||||
brect[3] = y - gdroundupdown(brect[3], d2 > 0);
|
||||
brect[4] = x + gdroundupdown(brect[4], d2 < 0);
|
||||
brect[5] = y - gdroundupdown(brect[5], d1 > 0);
|
||||
brect[6] = x + gdroundupdown(brect[6], d1 < 0);
|
||||
brect[7] = y - gdroundupdown(brect[7], d2 < 0);
|
||||
}
|
||||
|
||||
if (tmpstr) {
|
||||
|
||||
+48
-24
@@ -1,29 +1,53 @@
|
||||
--TEST--
|
||||
Bug #43073 (TrueType bounding box is wrong for angle<>0) freetype < 2.4.10
|
||||
Bug #43073 (TrueType bounding box is wrong for angle<>0)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
if(!function_exists('imagettftext')) die('skip imagettftext() not available');
|
||||
|
||||
include dirname(__FILE__) . '/func.inc';
|
||||
if(version_compare(get_freetype_version(), '2.4.10') >= 0) die('skip for freetype < 2.4.10');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$exp = [
|
||||
[501,400, 611,400, 611,376, 501,376],
|
||||
[492,361, 595,319, 586,296, 483,338],
|
||||
[470,329, 549,251, 531,233, 453,312],
|
||||
[439,307, 481,204, 458,195, 416,297],
|
||||
[400,299, 400,189, 376,189, 376,299],
|
||||
[361,307, 319,204, 296,213, 338,316],
|
||||
[329,329, 251,250, 233,267, 311,346],
|
||||
[307,360, 204,318, 195,341, 297,383],
|
||||
[299,400, 189,400, 189,424, 299,424],
|
||||
[307,438, 204,480, 213,503, 316,461],
|
||||
[329,470, 250,548, 267,566, 346,488],
|
||||
[360,492, 318,595, 341,604, 383,502],
|
||||
[400,501, 400,611, 424,611, 424,501],
|
||||
[438,492, 480,595, 503,586, 461,483],
|
||||
[470,470, 548,549, 566,532, 488,453],
|
||||
[492,439, 595,481, 604,458, 502,416]
|
||||
];
|
||||
$cwd = dirname(__FILE__);
|
||||
$font = "$cwd/Tuffy.ttf";
|
||||
$delta_t = 360.0 / 16; # Make 16 steps around
|
||||
$g = imagecreate(800, 800);
|
||||
$bgnd = imagecolorallocate($g, 255, 255, 255);
|
||||
$black = imagecolorallocate($g, 0, 0, 0);
|
||||
$red = imagecolorallocate($g, 255, 0, 0);
|
||||
$x = 100;
|
||||
$y = 0;
|
||||
$cos_t = cos(deg2rad($delta_t));
|
||||
$sin_t = sin(deg2rad($delta_t));
|
||||
for ($angle = 0.0; $angle < 360.0; $angle += $delta_t) {
|
||||
for ($angle = 0.0, $i = 0; $angle < 360.0; $angle += $delta_t, $i++) {
|
||||
$bbox = imagettftext($g, 24, $angle, 400+$x, 400+$y, $black, $font, 'ABCDEF');
|
||||
$s = vsprintf("(%d, %d), (%d, %d), (%d, %d), (%d, %d)\n", $bbox);
|
||||
echo $s;
|
||||
imagepolygon($g, $bbox, 4, $red);
|
||||
printf("%2d: ", $i);
|
||||
for ($j = 0; $j < 8; $j++) {
|
||||
if ($bbox[$j] >= $exp[$i][$j] - 1 && $bbox[$j] <= $exp[$i][$j] + 1) {
|
||||
echo '.';
|
||||
} else {
|
||||
echo "(expected $exp[$i][$j], got $bbox[$j])";
|
||||
}
|
||||
}
|
||||
echo "\n";
|
||||
$temp = $cos_t * $x + $sin_t * $y;
|
||||
$y = $cos_t * $y - $sin_t * $x;
|
||||
$x = $temp;
|
||||
@@ -32,20 +56,20 @@ imagepng($g, "$cwd/bug43073.png");
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php @unlink(dirname(__FILE__) . '/bug43073.png'); ?>
|
||||
--EXPECTF--
|
||||
(500, 40%d), (610, 40%d), (610, 376), (500, 376)
|
||||
(492, 363), (591, 322), (580, 295), (480, 336)
|
||||
(470, 331), (548, 254), (527, 233), (449, 310)
|
||||
(439, 309), (483, 202), (461, 193), (416, 299)
|
||||
(40%d, 300), (40%d, 183), (38%d, 183), (38%d, 300)
|
||||
(362, 307), (316, 195), (291, 205), (337, 318)
|
||||
(330, 329), (246, 244), (224, 265), (308, 350)
|
||||
(308, 360), (202, 316), (190, 344), (296, 388)
|
||||
(300, %d), (18%d, %d), (18%d, 425), (%d, 425)
|
||||
(306, 437), (195, 483), (206, 510), (318, 464)
|
||||
(328, 469), (240, 557), (260, 578), (349, 491)
|
||||
(359, 491), (312, 607), (334, 616), (382, 501)
|
||||
(%d, 500), (%d, 618), (41%d, 618), (41%d, 500)
|
||||
(436, 493), (483, 607), (507, 597), (461, 482)
|
||||
(468, 471), (555, 558), (577, 538), (490, 450)
|
||||
(490, 440), (600, 485), (611, 457), (502, 412)
|
||||
--EXPECT--
|
||||
0: ........
|
||||
1: ........
|
||||
2: ........
|
||||
3: ........
|
||||
4: ........
|
||||
5: ........
|
||||
6: ........
|
||||
7: ........
|
||||
8: ........
|
||||
9: ........
|
||||
10: ........
|
||||
11: ........
|
||||
12: ........
|
||||
13: ........
|
||||
14: ........
|
||||
15: ........
|
||||
@@ -1,51 +0,0 @@
|
||||
--TEST--
|
||||
Bug #43073 (TrueType bounding box is wrong for angle<>0) freetype >= 2.4.10
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
if(!function_exists('imagettftext')) die('skip imagettftext() not available');
|
||||
|
||||
include dirname(__FILE__) . '/func.inc';
|
||||
if(version_compare(get_freetype_version(), '2.4.10') == -1) die('skip for freetype >= 2.4.10');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$cwd = dirname(__FILE__);
|
||||
$font = "$cwd/Tuffy.ttf";
|
||||
$delta_t = 360.0 / 16; # Make 16 steps around
|
||||
$g = imagecreate(800, 800);
|
||||
$bgnd = imagecolorallocate($g, 255, 255, 255);
|
||||
$black = imagecolorallocate($g, 0, 0, 0);
|
||||
$x = 100;
|
||||
$y = 0;
|
||||
$cos_t = cos(deg2rad($delta_t));
|
||||
$sin_t = sin(deg2rad($delta_t));
|
||||
for ($angle = 0.0; $angle < 360.0; $angle += $delta_t) {
|
||||
$bbox = imagettftext($g, 24, $angle, 400+$x, 400+$y, $black, $font, 'ABCDEF');
|
||||
$s = vsprintf("(%d, %d), (%d, %d), (%d, %d), (%d, %d)\n", $bbox);
|
||||
echo $s;
|
||||
$temp = $cos_t * $x + $sin_t * $y;
|
||||
$y = $cos_t * $y - $sin_t * $x;
|
||||
$x = $temp;
|
||||
}
|
||||
imagepng($g, "$cwd/bug43073.png");
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php @unlink(dirname(__FILE__) . '/bug43073.png'); ?>
|
||||
--EXPECTF--
|
||||
(500, 400), (610, 400), (610, 376), (500, 376)
|
||||
(492, 363), (591, 322), (580, 295), (480, 336)
|
||||
(470, 331), (548, 254), (527, 233), (449, 310)
|
||||
(439, 309), (483, 202), (461, 193), (416, 299)
|
||||
(400, 300), (400, 183), (380, 183), (380, 300)
|
||||
(362, 307), (316, 195), (291, 205), (337, 318)
|
||||
(330, 329), (246, 244), (224, 265), (308, 350)
|
||||
(308, 360), (202, 316), (190, 344), (296, 388)
|
||||
(300, 400), (187, 400), (187, 425), (300, 425)
|
||||
(306, 437), (195, 483), (206, 510), (318, 464)
|
||||
(328, 469), (240, 557), (260, 578), (349, 491)
|
||||
(359, 491), (312, 607), (334, 616), (382, 501)
|
||||
(400, 500), (400, 618), (419, 618), (419, 500)
|
||||
(436, 493), (483, 607), (507, 597), (461, 482)
|
||||
(468, 471), (555, 558), (577, 538), (490, 450)
|
||||
(490, 440), (600, 485), (611, 457), (502, 412)
|
||||
@@ -19,4 +19,4 @@ echo 'Left Bottom: (' . $bbox[0] . ', ' . $bbox[1] . ')';
|
||||
--CLEAN--
|
||||
<?php @unlink(dirname(__FILE__) . '/bug48732.png'); ?>
|
||||
--EXPECTF--
|
||||
Left Bottom: (0, 47)
|
||||
Left Bottom: (0, 46)
|
||||
@@ -1,12 +1,9 @@
|
||||
--TEST--
|
||||
Bug #48801 (Problem with imagettfbbox) freetype < 2.4.10
|
||||
Bug #48801 (Problem with imagettfbbox)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
if(!function_exists('imageftbbox')) die('skip imageftbbox() not available');
|
||||
|
||||
include dirname(__FILE__) . '/func.inc';
|
||||
if(version_compare(get_freetype_version(), '2.4.10') >= 0) die('skip for freetype < 2.4.10');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
@@ -18,8 +15,8 @@ echo '(' . $bbox[2] . ', ' . $bbox[3] . ")\n";
|
||||
echo '(' . $bbox[4] . ', ' . $bbox[5] . ")\n";
|
||||
echo '(' . $bbox[6] . ', ' . $bbox[7] . ")\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
(-1, 15)
|
||||
(15%d, 15)
|
||||
(15%d, -48)
|
||||
(-1, -48)
|
||||
--EXPECTREGEX--
|
||||
\(4, 15\)
|
||||
\(16[0-1], 15\)
|
||||
\(16[0-1], -4[7-8]\)
|
||||
\(4, -4[7-8]\)
|
||||
@@ -1,25 +0,0 @@
|
||||
--TEST--
|
||||
Bug #48801 (Problem with imagettfbbox) freetype >= 2.4.10
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
if(!function_exists('imageftbbox')) die('skip imageftbbox() not available');
|
||||
|
||||
include dirname(__FILE__) . '/func.inc';
|
||||
if(version_compare(get_freetype_version(), '2.4.10') == -1) die('skip for freetype >= 2.4.10');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$cwd = dirname(__FILE__);
|
||||
$font = "$cwd/Tuffy.ttf";
|
||||
$bbox = imageftbbox(50, 0, $font, "image");
|
||||
echo '(' . $bbox[0] . ', ' . $bbox[1] . ")\n";
|
||||
echo '(' . $bbox[2] . ', ' . $bbox[3] . ")\n";
|
||||
echo '(' . $bbox[4] . ', ' . $bbox[5] . ")\n";
|
||||
echo '(' . $bbox[6] . ', ' . $bbox[7] . ")\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
(-1, 15)
|
||||
(15%d, 15)
|
||||
(15%d, -48)
|
||||
(-1, -48)
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Bug #50194 (imagettftext broken on transparent background w/o alphablending)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
if (!function_exists('imagettftext')) die('skip imagettftext() not available');
|
||||
//die('skip freetype issues');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
||||
|
||||
$im = imagecreatetruecolor(240, 55);
|
||||
$background = imagecolorallocatealpha($im, 60, 60, 60, 0); // no tranparency
|
||||
$black = imagecolorallocate($im, 0, 0, 0);
|
||||
imagealphablending($im, false);
|
||||
imagefilledrectangle($im, 0, 0, 239, 54, $background);
|
||||
$text = 'Testing ... ';
|
||||
$font = __DIR__ . DIRECTORY_SEPARATOR . 'Tuffy.ttf';
|
||||
imagettftext($im, 40, 0, 10, 40, $black, $font, $text);
|
||||
imagesavealpha($im, true);
|
||||
|
||||
ob_start();
|
||||
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug50194.png', $im);
|
||||
$output = ob_get_clean();
|
||||
assert(preg_match('/The images are equal|The images differ in (\d+) pixels/', $output, $matches));
|
||||
if (isset($matches[1]) && $matches[1] > 2000) {
|
||||
echo "The images differ in {$matches[1]} pixels.\n";
|
||||
} else {
|
||||
echo "The images are similar.\n";
|
||||
}
|
||||
|
||||
imagedestroy($im);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
The images are similar.
|
||||
===DONE===
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
@@ -0,0 +1,107 @@
|
||||
--TEST--
|
||||
Bug #53504 imagettfbbox/imageftbbox gives incorrect values for bounding box
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
if(!function_exists('imageftbbox')) die('skip imageftbbox() not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$cwd = dirname(__FILE__);
|
||||
$font = "$cwd/Tuffy.ttf";
|
||||
|
||||
$g = imagecreate(800, 800);
|
||||
$bgnd = imagecolorallocate($g, 255, 255, 255);
|
||||
$black = imagecolorallocate($g, 0, 0, 0);
|
||||
$red = imagecolorallocate($g, 255, 0, 0);
|
||||
$blue = imagecolorallocate($g, 0, 0, 255);
|
||||
|
||||
$tests = [
|
||||
// Kerning examples (unfortunately not available in "Tuffy" test font):
|
||||
['fontSize' => 50, 'angle' => 0, 'x' => 20, 'y' => 70, 'text' => 'AV Teg', 'exp' => [2,15, 208,15, 208,-48, 2,-48]],
|
||||
['fontSize' => 50, 'angle' => 90, 'x' => 70, 'y' => 350, 'text' => 'AV Teg', 'exp' => [15,-1, 15,-208, -48,-208, -48,-2]],
|
||||
['fontSize' => 50, 'angle' => 40, 'x' => 130, 'y' => 280, 'text' => 'AV Teg', 'exp' => [11,11, 169,-122, 129,-171, -30,-39]],
|
||||
|
||||
// Shift-Test:
|
||||
['fontSize' => 100, 'angle' => 0, 'x' => 350, 'y' => 110, 'text' => 'H-Shift', 'exp' => [8,2, 386,2, 386,-97, 8,-97]],
|
||||
|
||||
// Small/single chars:
|
||||
['fontSize' => 100, 'angle' => 0, 'x' => 350, 'y' => 220, 'text' => '-', 'exp' => [7,-37, 51,-37, 51,-46, 7,-46]],
|
||||
['fontSize' => 100, 'angle' => 0, 'x' => 430, 'y' => 220, 'text' => ',', 'exp' => [7,15, 21,15, 21,-13, 7,-13]],
|
||||
['fontSize' => 100, 'angle' => 0, 'x' => 510, 'y' => 220, 'text' => '.', 'exp' => [7,1, 21,1, 21,-13, 7,-13]],
|
||||
['fontSize' => 100, 'angle' => 0, 'x' => 590, 'y' => 220, 'text' => '|', 'exp' => [8,0, 17,0, 17,-95, 8,-95]],
|
||||
['fontSize' => 100, 'angle' => 0, 'x' => 670, 'y' => 220, 'text' => 'g', 'exp' => [5,29, 60,29, 60,-72, 5,-72]],
|
||||
|
||||
// Multi-Line + rotation:
|
||||
['fontSize' => 30, 'angle' => 0, 'x' => 20, 'y' => 400, 'text' => "Multi\nLine\nTest", 'exp' => [2,107, 80,107, 80,-29, 2,-29]],
|
||||
['fontSize' => 30, 'angle' => 40, 'x' => 150, 'y' => 420, 'text' => "Multi\nLine\nTest", 'exp' => [70,81, 131,31, 43,-74, -18,-24]],
|
||||
['fontSize' => 30, 'angle' => 90, 'x' => 250, 'y' => 340, 'text' => "Multi\nLine\nTest", 'exp' => [107,-1, 107,-80, -29,-80, -29,-2]],
|
||||
|
||||
// Some edge case glyphs:
|
||||
['fontSize' => 50, 'angle' => 90, 'x' => 70, 'y' => 750, 'text' => "iiiiiiiiiiii", 'exp' => [0,-4, 0,-165, -47,-165, -47,-4]],
|
||||
['fontSize' => 50, 'angle' => 90, 'x' => 150, 'y' => 750, 'text' => "~~~~~~~", 'exp' => [-19,-2, -18,-167, -29,-167, -29,-2]],
|
||||
['fontSize' => 50, 'angle' => 50, 'x' => 210, 'y' => 750, 'text' => "iiiiiiiiiiii", 'exp' => [3,-3, 107,-127, 70,-157, -34,-33]],
|
||||
['fontSize' => 50, 'angle' => 50, 'x' => 300, 'y' => 750, 'text' => "~~~~~~~", 'exp' => [-13,-13, 93,-141, 85,-147, -21,-20]],
|
||||
['fontSize' => 50, 'angle' => 0, 'x' => 430, 'y' => 650, 'text' => "iiiiiiiiiiii", 'exp' => [4,0, 165,0, 165,-47, 4,-47]],
|
||||
['fontSize' => 50, 'angle' => 0, 'x' => 430, 'y' => 750, 'text' => "~~~~~~~", 'exp' => [2,-19, 167,-19, 167,-29, 2,-29]],
|
||||
|
||||
// "Big" test:
|
||||
['fontSize' => 200, 'angle' => 0, 'x' => 400, 'y' => 500, 'text' => "Big", 'exp' => [16,59, 329,59, 329,-190, 16,-190]],
|
||||
];
|
||||
|
||||
foreach ($tests as $testnum => $test) {
|
||||
$bbox = imageftbbox($test['fontSize'], $test['angle'], $font, $test['text']);
|
||||
printf('%2d: ', $testnum);
|
||||
for ($i = 0; $i < 8; $i++) {
|
||||
$exp = $test['exp'][$i];
|
||||
if ($bbox[$i] >= $exp - 2 && $bbox[$i] <= $exp + 2) {
|
||||
echo '.';
|
||||
} else {
|
||||
echo "(expected $exp, got $bbox[$i])";
|
||||
}
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
$bboxDrawn = imagefttext($g, $test['fontSize'], $test['angle'],
|
||||
$test['x'], $test['y'], $black, $font, $test['text']);
|
||||
|
||||
// check if both bboxes match when adding x/y offset:
|
||||
for ($i = 0; $i < count($bbox); $i += 2) {
|
||||
if ($bbox[$i] + $test['x'] !== $bboxDrawn[$i]) echo "imageftbbox and imagefttext differ!\n";
|
||||
if ($bbox[$i + 1] + $test['y'] !== $bboxDrawn[$i + 1]) echo "imageftbbox and imagefttext differ!\n";
|
||||
}
|
||||
|
||||
// draw bounding box:
|
||||
imagepolygon($g, $bboxDrawn, 4, $red);
|
||||
|
||||
// draw baseline:
|
||||
$width = sqrt(pow($bboxDrawn[2] - $bboxDrawn[0], 2) + pow($bboxDrawn[3] - $bboxDrawn[1], 2));
|
||||
imageline($g, $test['x'], $test['y'],
|
||||
$test['x'] + $width * cos(deg2rad($test['angle'])),
|
||||
$test['y'] - $width * sin(deg2rad($test['angle'])), $blue);
|
||||
}
|
||||
|
||||
imagepng($g, "$cwd/bug53504.png");
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php @unlink(dirname(__FILE__) . '/bug53504.png'); ?>
|
||||
--EXPECT--
|
||||
0: ........
|
||||
1: ........
|
||||
2: ........
|
||||
3: ........
|
||||
4: ........
|
||||
5: ........
|
||||
6: ........
|
||||
7: ........
|
||||
8: ........
|
||||
9: ........
|
||||
10: ........
|
||||
11: ........
|
||||
12: ........
|
||||
13: ........
|
||||
14: ........
|
||||
15: ........
|
||||
16: ........
|
||||
17: ........
|
||||
18: ........
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #72482 (Ilegal write/read access caused by gdImageAALine overflow)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$img = imagecreatetruecolor(13, 1007);
|
||||
imageantialias($img, true);
|
||||
imageline($img, 0, 0, 1073745919, 1073745919, 4096);
|
||||
|
||||
$img = imagecreatetruecolor(100, 100);
|
||||
imageantialias($img, true);
|
||||
imageline($img, 1094795585, 0, 2147483647, 255, 0xff);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug 72482 (Ilegal write/read access caused by gdImageAALine overflow)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
||||
|
||||
$im = imagecreatetruecolor(10, 10);
|
||||
imagefilledrectangle($im, 0, 0, 9, 9, imagecolorallocate($im, 255, 255, 255));
|
||||
imageantialias($im, true);
|
||||
imageline($im, 0, 0, 10, 10, imagecolorallocate($im, 0, 0, 0));
|
||||
|
||||
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug72482_2.png', $im);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
The images are equal.
|
||||
===DONE===
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 118 B |
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #72494 (imagecropauto out-of-bounds access)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreate(10,10);
|
||||
imagecropauto($im, IMG_CROP_THRESHOLD, 0, 1337);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: imagecropauto(): Color argument missing with threshold mode in %s on line %d
|
||||
===DONE===
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #72696 (imagefilltoborder stackoverflow on truecolor images)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreatetruecolor(10, 10);
|
||||
imagefilltoborder($im, 0, 0, 1, -2);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
Bug #73155 (imagegd2() writes wrong chunk sizes on boundaries)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreate(64, 64);
|
||||
imagecolorallocate($im, 0, 0, 0);
|
||||
|
||||
ob_start();
|
||||
imagegd2($im, null, 64, IMG_GD2_RAW);
|
||||
$buffer = ob_get_clean();
|
||||
|
||||
$header = unpack('@10/nchunk_size/nformat/nx_count/ny_count', $buffer);
|
||||
printf("chunk size: %d\n", $header['chunk_size']);
|
||||
printf("x chunk count: %d\n", $header['x_count']);
|
||||
printf("y chunk count: %d\n", $header['y_count']);
|
||||
printf("file size: %d\n", strlen($buffer));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
chunk size: 64
|
||||
x chunk count: 1
|
||||
y chunk count: 1
|
||||
file size: 5145
|
||||
===DONE===
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #73157 (imagegd2() ignores 3rd param if 4 are given)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreate(8, 8);
|
||||
imagecolorallocate($im, 0, 0, 0);
|
||||
|
||||
ob_start();
|
||||
imagegd2($im, null, 256, IMG_GD2_RAW);
|
||||
$buffer = ob_get_clean();
|
||||
|
||||
$header = unpack('@10/nchunk_size', $buffer);
|
||||
printf("chunk size: %d\n", $header['chunk_size']);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
chunk size: 256
|
||||
===DONE===
|
||||
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #73159 (imagegd2(): unrecognized formats may result in corrupted files)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreatetruecolor(10, 10);
|
||||
|
||||
ob_start();
|
||||
imagegd2($im, null, 128, 0);
|
||||
$buffer = ob_get_clean();
|
||||
|
||||
$header = unpack('@12/nformat', $buffer);
|
||||
printf("format: %d\n", $header['format']);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
format: 4
|
||||
===DONE===
|
||||
Binary file not shown.
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #73161 (imagecreatefromgd2() may leak memory)
|
||||
--DESCRIPTION--
|
||||
We're testing for a memory leak that might not even show up with valgrind.
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . 'bug73161.gd2');
|
||||
var_dump($im);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: imagecreatefromgd2(): '%s' is not a valid GD2 file in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #73213 (Integer overflow in imageline() with antialiasing)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
||||
|
||||
$im = imagecreatetruecolor(32768, 1);
|
||||
$black = imagecolorallocate($im, 0, 0, 0);
|
||||
imageantialias($im, true);
|
||||
|
||||
imageline($im, 0,0, 32767,0, $black);
|
||||
|
||||
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug73213.png', $im);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
The images are equal.
|
||||
===DONE===
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 195 B |
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #73272 (imagescale() is not affected by, but affects imagesetinterpolation())
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
||||
|
||||
$src = imagecreatetruecolor(100, 100);
|
||||
imagefilledrectangle($src, 0,0, 99,99, 0xFFFFFF);
|
||||
imageellipse($src, 49,49, 40,40, 0x000000);
|
||||
|
||||
imagesetinterpolation($src, IMG_NEAREST_NEIGHBOUR);
|
||||
imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
|
||||
$dst = imagerotate($src, 60, 0xFFFFFF);
|
||||
|
||||
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug73272.png', $dst);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
The images are equal.
|
||||
===DONE===
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 739 B |
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.4', '<')) {
|
||||
die('skip only for bundled libgd or external libgd >= 2.2.4');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$src = imagecreate(100, 100);
|
||||
imagecolorallocate($src, 255, 255, 255);
|
||||
$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
|
||||
printf("color: %x\n", imagecolorat($dst, 99, 99));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
color: ffffff
|
||||
===DONE===
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
if (GD_BUNDLED || version_compare(GD_VERSION, '2.2.4', '>=')) {
|
||||
die('skip only for external libgd < 2.2.4');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$src = imagecreate(100, 100);
|
||||
imagecolorallocate($src, 255, 255, 255);
|
||||
$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
|
||||
printf("color: %x\n", imagecolorat($dst, 99, 99));
|
||||
?>
|
||||
===DONE===
|
||||
--XFAIL--
|
||||
Bug #330 has not yet been fixed
|
||||
--EXPECT--
|
||||
color: ffffff
|
||||
===DONE===
|
||||
+21
-2
@@ -82,7 +82,9 @@ function test_image_equals_file($filename, $actual)
|
||||
save_actual_image($actual);
|
||||
return;
|
||||
}
|
||||
$actual = test_to_truecolor($actual);
|
||||
$expected = imagecreatefrompng($filename);
|
||||
$expected = test_to_truecolor($expected);
|
||||
$exp_x = imagesx($expected);
|
||||
$exp_y = imagesy($expected);
|
||||
$act_x = imagesx($actual);
|
||||
@@ -90,7 +92,6 @@ function test_image_equals_file($filename, $actual)
|
||||
if ($exp_x != $act_x || $exp_y != $act_y) {
|
||||
echo "The image size differs: expected {$exp_x}x{$exp_y}, got {$act_x}x{$act_y}.\n";
|
||||
save_actual_image($actual);
|
||||
imagedestroy($expected);
|
||||
return;
|
||||
}
|
||||
$pixels_changed = 0;
|
||||
@@ -109,7 +110,25 @@ function test_image_equals_file($filename, $actual)
|
||||
echo "The images differ in {$pixels_changed} pixels.\n";
|
||||
save_actual_image($actual);
|
||||
}
|
||||
imagedestroy($expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the truecolor version of an image.
|
||||
*
|
||||
* @param resource $image
|
||||
* @return resource
|
||||
*/
|
||||
function test_to_truecolor($image)
|
||||
{
|
||||
if (imageistruecolor($image)) {
|
||||
return $image;
|
||||
} else {
|
||||
$width = imagesx($image);
|
||||
$height = imagesy($image);
|
||||
$result = imagecreatetruecolor($width, $height);
|
||||
imagecopy($result, $image, 0,0, 0,0, $width, $height);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
--TEST--
|
||||
test_image_equals_file(): comparing palette images
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
||||
|
||||
$im = imagecreate(10, 10);
|
||||
imagecolorallocate($im, 255, 255, 255);
|
||||
$red = imagecolorallocate($im, 255, 0, 0);
|
||||
imagefilledrectangle($im, 3,3, 7,7, $red);
|
||||
|
||||
$filename = __DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png';
|
||||
imagepng($im, $filename);
|
||||
|
||||
$im = imagecreate(10, 10);
|
||||
imagecolorallocate($im, 255, 255, 255);
|
||||
$blue = imagecolorallocate($im, 0, 0, 255);
|
||||
imagefilledrectangle($im, 3,3, 7,7, $blue);
|
||||
|
||||
test_image_equals_file($filename, $im);
|
||||
|
||||
$im = imagecreate(10, 10);
|
||||
imagecolorallocate($im, 255, 255, 255);
|
||||
imagecolorallocate($im, 0, 0, 0);
|
||||
$red = imagecolorallocate($im, 255, 0, 0);
|
||||
imagefilledrectangle($im, 3,3, 7,7, $red);
|
||||
|
||||
test_image_equals_file($filename, $im);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
The images differ in 25 pixels.
|
||||
The images are equal.
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(__DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png');
|
||||
?>
|
||||
+1
-1
@@ -2491,7 +2491,7 @@ PHP_NAMED_FUNCTION(php_if_iconv)
|
||||
&out_buffer, &out_len, out_charset, in_charset);
|
||||
_php_iconv_show_error(err, out_charset, in_charset TSRMLS_CC);
|
||||
if (err == PHP_ICONV_ERR_SUCCESS && out_buffer != NULL) {
|
||||
RETVAL_STRINGL(out_buffer, out_len, 0);
|
||||
RETVAL_STRINGL_CHECK(out_buffer, out_len, 0);
|
||||
} else {
|
||||
if (out_buffer != NULL) {
|
||||
efree(out_buffer);
|
||||
|
||||
+3
-3
@@ -2523,7 +2523,7 @@ PHP_FUNCTION(imap_8bit)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETVAL_STRINGL(decode, newlength, 1);
|
||||
RETVAL_STRINGL_CHECK(decode, newlength, 1);
|
||||
fs_give((void**) &decode);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -3900,7 +3900,7 @@ int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *
|
||||
char *tsm_errmsg = NULL;
|
||||
ADDRESS *addr;
|
||||
char *bufferTo = NULL, *bufferCc = NULL, *bufferBcc = NULL, *bufferHeader = NULL;
|
||||
int offset, bufferLen = 0;
|
||||
size_t offset, bufferLen = 0;
|
||||
size_t bt_len;
|
||||
|
||||
if (headers) {
|
||||
@@ -3916,7 +3916,7 @@ int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *
|
||||
#define PHP_IMAP_CLEAN if (bufferTo) efree(bufferTo); if (bufferCc) efree(bufferCc); if (bufferBcc) efree(bufferBcc); if (bufferHeader) efree(bufferHeader);
|
||||
#define PHP_IMAP_BAD_DEST PHP_IMAP_CLEAN; efree(tempMailTo); return (BAD_MSG_DESTINATION);
|
||||
|
||||
bufferHeader = (char *)emalloc(bufferLen + 1);
|
||||
bufferHeader = (char *)safe_emalloc(bufferLen, 1, 1);
|
||||
memset(bufferHeader, 0, bufferLen);
|
||||
if (to && *to) {
|
||||
strlcat(bufferHeader, "To: ", bufferLen + 1);
|
||||
|
||||
@@ -182,7 +182,7 @@ static void _breakiterator_parts_move_forward(zend_object_iterator *iter TSRMLS_
|
||||
}
|
||||
assert(next <= slen && next >= cur);
|
||||
len = next - cur;
|
||||
res = static_cast<char*>(emalloc(len + 1));
|
||||
res = static_cast<char*>(safe_emalloc(len, 1, 1));
|
||||
|
||||
memcpy(res, &s[cur], len);
|
||||
res[len] = '\0';
|
||||
|
||||
@@ -49,7 +49,7 @@ void intl_convert_utf8_to_utf16(
|
||||
UErrorCode* status )
|
||||
{
|
||||
UChar* dst_buf = NULL;
|
||||
int32_t dst_len = 0;
|
||||
uint32_t dst_len = 0;
|
||||
|
||||
/* If *target is NULL determine required destination buffer size (pre-flighting).
|
||||
* Otherwise, attempt to convert source string; if *target buffer is not large enough
|
||||
|
||||
@@ -263,6 +263,9 @@ static char* get_icu_value_internal( const char* loc_name , char* tag_name, int*
|
||||
int32_t buflen = 512;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
if (strlen(loc_name) > INTL_MAX_LOCALE_LEN) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( strcmp(tag_name, LOC_CANONICALIZE_TAG) != 0 ){
|
||||
/* Handle grandfathered languages */
|
||||
@@ -396,6 +399,8 @@ static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS)
|
||||
loc_name = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
|
||||
INTL_CHECK_LOCALE_LEN(strlen(loc_name));
|
||||
|
||||
/* Call ICU get */
|
||||
tag_value = get_icu_value_internal( loc_name , tag_name , &result ,0);
|
||||
|
||||
@@ -700,6 +705,8 @@ PHP_FUNCTION( locale_get_keywords )
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
INTL_CHECK_LOCALE_LEN(strlen(loc_name));
|
||||
|
||||
if(loc_name_len == 0) {
|
||||
loc_name = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
@@ -1107,6 +1114,8 @@ PHP_FUNCTION(locale_parse)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
INTL_CHECK_LOCALE_LEN(strlen(loc_name));
|
||||
|
||||
if(loc_name_len == 0) {
|
||||
loc_name = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
@@ -1159,6 +1168,7 @@ PHP_FUNCTION(locale_get_all_variants)
|
||||
loc_name = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
|
||||
INTL_CHECK_LOCALE_LEN(strlen(loc_name));
|
||||
|
||||
array_init( return_value );
|
||||
|
||||
@@ -1267,6 +1277,9 @@ PHP_FUNCTION(locale_filter_matches)
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
||||
INTL_CHECK_LOCALE_LEN(strlen(loc_range));
|
||||
INTL_CHECK_LOCALE_LEN(strlen(lang_tag));
|
||||
|
||||
if( boolCanonical ){
|
||||
/* canonicalize loc_range */
|
||||
can_loc_range=get_icu_value_internal( loc_range , LOC_CANONICALIZE_TAG , &result , 0);
|
||||
@@ -1549,6 +1562,8 @@ PHP_FUNCTION(locale_lookup)
|
||||
loc_range = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
|
||||
INTL_CHECK_LOCALE_LEN(strlen(loc_range));
|
||||
|
||||
hash_arr = HASH_OF(arr);
|
||||
|
||||
if( !hash_arr || zend_hash_num_elements( hash_arr ) == 0 ) {
|
||||
|
||||
@@ -80,10 +80,10 @@ msgformat_data* msgformat_data_create( TSRMLS_D )
|
||||
/* }}} */
|
||||
|
||||
#ifdef MSG_FORMAT_QUOTE_APOS
|
||||
int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *ec)
|
||||
int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *ec)
|
||||
{
|
||||
if(*spattern && *spattern_len && u_strchr(*spattern, (UChar)'\'')) {
|
||||
UChar *npattern = emalloc(sizeof(UChar)*(2*(*spattern_len)+1));
|
||||
UChar *npattern = safe_emalloc(sizeof(UChar)*2, *spattern_len, sizeof(UChar));
|
||||
uint32_t npattern_len;
|
||||
npattern_len = umsg_autoQuoteApostrophe(*spattern, *spattern_len, npattern, 2*(*spattern_len)+1, ec);
|
||||
efree(*spattern);
|
||||
|
||||
@@ -77,7 +77,7 @@ static zend_object_value ResourceBundle_object_create( zend_class_entry *ce TSRM
|
||||
/* }}} */
|
||||
|
||||
/* {{{ ResourceBundle_ctor */
|
||||
static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
||||
static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
||||
{
|
||||
const char *bundlename;
|
||||
int bundlename_len = 0;
|
||||
@@ -90,7 +90,7 @@ static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
||||
|
||||
intl_error_reset( NULL TSRMLS_CC );
|
||||
|
||||
if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s!s!|b",
|
||||
if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s!s!|b",
|
||||
&locale, &locale_len, &bundlename, &bundlename_len, &fallback ) == FAILURE )
|
||||
{
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
@@ -100,11 +100,18 @@ static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
||||
}
|
||||
|
||||
INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value);
|
||||
|
||||
|
||||
if (locale == NULL) {
|
||||
locale = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
|
||||
if (bundlename_len >= MAXPATHLEN) {
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "Bundle name too long", 0 TSRMLS_CC );
|
||||
zval_dtor(return_value);
|
||||
ZVAL_NULL(return_value);
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
if (fallback) {
|
||||
rb->me = ures_open(bundlename, locale, &INTL_DATA_ERROR_CODE(rb));
|
||||
} else {
|
||||
@@ -151,7 +158,7 @@ PHP_METHOD( ResourceBundle, __construct )
|
||||
/* {{{ proto ResourceBundle ResourceBundle::create( string $locale [, string $bundlename [, bool $fallback = true ]] )
|
||||
proto ResourceBundle resourcebundle_create( string $locale [, string $bundlename [, bool $fallback = true ]] )
|
||||
*/
|
||||
PHP_FUNCTION( resourcebundle_create )
|
||||
PHP_FUNCTION( resourcebundle_create )
|
||||
{
|
||||
object_init_ex( return_value, ResourceBundle_ce_ptr );
|
||||
resourcebundle_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU);
|
||||
@@ -159,7 +166,7 @@ PHP_FUNCTION( resourcebundle_create )
|
||||
/* }}} */
|
||||
|
||||
/* {{{ resourcebundle_array_fetch */
|
||||
static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_value, int fallback TSRMLS_DC)
|
||||
static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_value, int fallback TSRMLS_DC)
|
||||
{
|
||||
int32_t meindex = 0;
|
||||
char * mekey = NULL;
|
||||
@@ -167,7 +174,7 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_
|
||||
char *pbuf;
|
||||
ResourceBundle_object *rb;
|
||||
|
||||
intl_error_reset( NULL TSRMLS_CC );
|
||||
intl_error_reset( NULL TSRMLS_CC );
|
||||
RESOURCEBUNDLE_METHOD_FETCH_OBJECT;
|
||||
|
||||
if(Z_TYPE_P(offset) == IS_LONG) {
|
||||
@@ -178,12 +185,12 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_
|
||||
mekey = Z_STRVAL_P(offset);
|
||||
rb->child = ures_getByKey(rb->me, mekey, rb->child, &INTL_DATA_ERROR_CODE(rb) );
|
||||
} else {
|
||||
intl_errors_set(INTL_DATA_ERROR_P(rb), U_ILLEGAL_ARGUMENT_ERROR,
|
||||
intl_errors_set(INTL_DATA_ERROR_P(rb), U_ILLEGAL_ARGUMENT_ERROR,
|
||||
"resourcebundle_get: index should be integer or string", 0 TSRMLS_CC);
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
intl_error_set_code( NULL, INTL_DATA_ERROR_CODE(rb) TSRMLS_CC );
|
||||
intl_error_set_code( NULL, INTL_DATA_ERROR_CODE(rb) TSRMLS_CC );
|
||||
if (U_FAILURE(INTL_DATA_ERROR_CODE(rb))) {
|
||||
if (is_numeric) {
|
||||
spprintf( &pbuf, 0, "Cannot load resource element %d", meindex );
|
||||
@@ -213,7 +220,7 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_
|
||||
/* }}} */
|
||||
|
||||
/* {{{ resourcebundle_array_get */
|
||||
zval *resourcebundle_array_get(zval *object, zval *offset, int type TSRMLS_DC)
|
||||
zval *resourcebundle_array_get(zval *object, zval *offset, int type TSRMLS_DC)
|
||||
{
|
||||
zval *retval;
|
||||
|
||||
@@ -246,7 +253,7 @@ PHP_FUNCTION( resourcebundle_get )
|
||||
zval * object;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oz|b", &object, ResourceBundle_ce_ptr, &offset, &fallback ) == FAILURE) {
|
||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
"resourcebundle_get: unable to parse input params", 0 TSRMLS_CC);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -256,7 +263,7 @@ PHP_FUNCTION( resourcebundle_get )
|
||||
/* }}} */
|
||||
|
||||
/* {{{ resourcebundle_array_count */
|
||||
int resourcebundle_array_count(zval *object, long *count TSRMLS_DC)
|
||||
int resourcebundle_array_count(zval *object, long *count TSRMLS_DC)
|
||||
{
|
||||
ResourceBundle_object *rb;
|
||||
RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK;
|
||||
@@ -288,7 +295,7 @@ PHP_FUNCTION( resourcebundle_count )
|
||||
RESOURCEBUNDLE_METHOD_INIT_VARS;
|
||||
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, ResourceBundle_ce_ptr ) == FAILURE ) {
|
||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
"resourcebundle_count: unable to parse input params", 0 TSRMLS_CC);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -322,21 +329,26 @@ PHP_FUNCTION( resourcebundle_locales )
|
||||
|
||||
if( zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &bundlename, &bundlename_len ) == FAILURE )
|
||||
{
|
||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
"resourcebundle_locales: unable to parse input params", 0 TSRMLS_CC);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (bundlename_len >= MAXPATHLEN) {
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "resourcebundle_locales: bundle name too long", 0 TSRMLS_CC );
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if(bundlename_len == 0) {
|
||||
// fetch default locales list
|
||||
bundlename = NULL;
|
||||
}
|
||||
|
||||
icuenum = ures_openAvailableLocales( bundlename, &icuerror );
|
||||
INTL_CHECK_STATUS(icuerror, "Cannot fetch locales list");
|
||||
INTL_CHECK_STATUS(icuerror, "Cannot fetch locales list");
|
||||
|
||||
uenum_reset( icuenum, &icuerror );
|
||||
INTL_CHECK_STATUS(icuerror, "Cannot iterate locales list");
|
||||
INTL_CHECK_STATUS(icuerror, "Cannot iterate locales list");
|
||||
|
||||
array_init( return_value );
|
||||
while ((entry = uenum_next( icuenum, &entry_len, &icuerror ))) {
|
||||
|
||||
@@ -9,6 +9,4 @@ $out = locale_get_primary_language($var1);
|
||||
echo strlen($out) . PHP_EOL;
|
||||
echo unpack('H*', $out)[1] . PHP_EOL;
|
||||
--EXPECT--
|
||||
1000
|
||||
61616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161
|
||||
|
||||
0
|
||||
+3
-1
@@ -589,7 +589,9 @@ static void json_encode_serializable_object(smart_str *buf, zval *val, int optio
|
||||
ZVAL_STRING(&fname, "jsonSerialize", 0);
|
||||
|
||||
if (FAILURE == call_user_function_ex(EG(function_table), &val, &fname, &retval, 0, NULL, 1, NULL TSRMLS_CC) || !retval) {
|
||||
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Failed calling %s::jsonSerialize()", ce->name);
|
||||
if (!EG(exception)) {
|
||||
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Failed calling %s::jsonSerialize()", ce->name);
|
||||
}
|
||||
smart_str_appendl(buf, "null", sizeof("null") - 1);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #73113 (Segfault with throwing JsonSerializable)
|
||||
Also test that the custom exception is not wrapped by ext/json
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("json")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class JsonSerializableObject implements \JsonSerializable
|
||||
{
|
||||
public function jsonSerialize()
|
||||
{
|
||||
throw new \Exception('This error is expected');
|
||||
}
|
||||
}
|
||||
|
||||
$obj = new JsonSerializableObject();
|
||||
try {
|
||||
echo json_encode($obj);
|
||||
} catch (\Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
--EXPECTF--
|
||||
This error is expected
|
||||
+48
-48
@@ -213,7 +213,7 @@ static const struct mb_overload_def mb_ovld[] = {
|
||||
{MB_OVERLOAD_REGEX, "split", "mb_split", "mb_orig_split"},
|
||||
#endif
|
||||
{0, NULL, NULL, NULL}
|
||||
};
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
/* {{{ arginfo */
|
||||
@@ -648,7 +648,7 @@ static void *_php_mb_allocators_calloc(unsigned int nelems, unsigned int szelem)
|
||||
static void _php_mb_allocators_free(void *ptr)
|
||||
{
|
||||
efree(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
static void *_php_mb_allocators_pmalloc(unsigned int sz)
|
||||
{
|
||||
@@ -663,7 +663,7 @@ static void *_php_mb_allocators_prealloc(void *ptr, unsigned int sz)
|
||||
static void _php_mb_allocators_pfree(void *ptr)
|
||||
{
|
||||
pefree(ptr, 1);
|
||||
}
|
||||
}
|
||||
|
||||
static mbfl_allocators _php_mb_allocators = {
|
||||
_php_mb_allocators_malloc,
|
||||
@@ -686,7 +686,7 @@ static sapi_post_entry mbstr_post_entries[] = {
|
||||
|
||||
/* {{{ static int php_mb_parse_encoding_list()
|
||||
* Return 0 if input contains any illegal encoding, otherwise 1.
|
||||
* Even if any illegal encoding is detected the result may contain a list
|
||||
* Even if any illegal encoding is detected the result may contain a list
|
||||
* of parsed encodings.
|
||||
*/
|
||||
static int
|
||||
@@ -805,7 +805,7 @@ php_mb_parse_encoding_list(const char *value, size_t value_length, const mbfl_en
|
||||
|
||||
/* {{{ static int php_mb_parse_encoding_array()
|
||||
* Return 0 if input contains any illegal encoding, otherwise 1.
|
||||
* Even if any illegal encoding is detected the result may contain a list
|
||||
* Even if any illegal encoding is detected the result may contain a list
|
||||
* of parsed encodings.
|
||||
*/
|
||||
static int
|
||||
@@ -960,7 +960,7 @@ static size_t php_mb_zend_encoding_converter(unsigned char **to, size_t *to_leng
|
||||
if (!mbfl_buffer_converter_result(convd, &result)) {
|
||||
mbfl_buffer_converter_delete(convd);
|
||||
return (size_t)-1;
|
||||
}
|
||||
}
|
||||
|
||||
*to = result.val;
|
||||
*to_length = result.len;
|
||||
@@ -1192,7 +1192,7 @@ static char *php_mb_rfc1867_basename(const zend_encoding *encoding, char *filena
|
||||
* to nill or problem is fixed this code must remain enabled for all systems. */
|
||||
s = php_mb_safe_strrchr_ex(filename, '\\', filename_len, (const mbfl_encoding *)encoding);
|
||||
s2 = php_mb_safe_strrchr_ex(filename, '/', filename_len, (const mbfl_encoding *)encoding);
|
||||
|
||||
|
||||
if (s && s2) {
|
||||
if (s > s2) {
|
||||
return ++s;
|
||||
@@ -1476,13 +1476,13 @@ PHP_INI_BEGIN()
|
||||
PHP_INI_ENTRY("mbstring.http_output", NULL, PHP_INI_ALL, OnUpdate_mbstring_http_output)
|
||||
STD_PHP_INI_ENTRY("mbstring.internal_encoding", NULL, PHP_INI_ALL, OnUpdate_mbstring_internal_encoding, internal_encoding_name, zend_mbstring_globals, mbstring_globals)
|
||||
PHP_INI_ENTRY("mbstring.substitute_character", NULL, PHP_INI_ALL, OnUpdate_mbstring_substitute_character)
|
||||
STD_PHP_INI_ENTRY("mbstring.func_overload", "0",
|
||||
STD_PHP_INI_ENTRY("mbstring.func_overload", "0",
|
||||
PHP_INI_SYSTEM, OnUpdateLong, func_overload, zend_mbstring_globals, mbstring_globals)
|
||||
|
||||
STD_PHP_INI_BOOLEAN("mbstring.encoding_translation", "0",
|
||||
PHP_INI_SYSTEM | PHP_INI_PERDIR,
|
||||
OnUpdate_mbstring_encoding_translation,
|
||||
encoding_translation, zend_mbstring_globals, mbstring_globals)
|
||||
OnUpdate_mbstring_encoding_translation,
|
||||
encoding_translation, zend_mbstring_globals, mbstring_globals)
|
||||
PHP_INI_ENTRY("mbstring.http_output_conv_mimetypes",
|
||||
"^(text/|application/xhtml\\+xml)",
|
||||
PHP_INI_ALL,
|
||||
@@ -1624,21 +1624,21 @@ PHP_RINIT_FUNCTION(mbstring)
|
||||
/* override original function. */
|
||||
if (MBSTRG(func_overload)){
|
||||
p = &(mb_ovld[0]);
|
||||
|
||||
|
||||
while (p->type > 0) {
|
||||
if ((MBSTRG(func_overload) & p->type) == p->type &&
|
||||
if ((MBSTRG(func_overload) & p->type) == p->type &&
|
||||
zend_hash_find(EG(function_table), p->save_func,
|
||||
strlen(p->save_func)+1, (void **)&orig) != SUCCESS) {
|
||||
|
||||
zend_hash_find(EG(function_table), p->ovld_func, strlen(p->ovld_func)+1 , (void **)&func);
|
||||
|
||||
|
||||
if (zend_hash_find(EG(function_table), p->orig_func, strlen(p->orig_func)+1, (void **)&orig) != SUCCESS) {
|
||||
php_error_docref("ref.mbstring" TSRMLS_CC, E_WARNING, "mbstring couldn't find function %s.", p->orig_func);
|
||||
return FAILURE;
|
||||
} else {
|
||||
zend_hash_add(EG(function_table), p->save_func, strlen(p->save_func)+1, orig, sizeof(zend_function), NULL);
|
||||
|
||||
if (zend_hash_update(EG(function_table), p->orig_func, strlen(p->orig_func)+1, func, sizeof(zend_function),
|
||||
if (zend_hash_update(EG(function_table), p->orig_func, strlen(p->orig_func)+1, func, sizeof(zend_function),
|
||||
NULL) == FAILURE) {
|
||||
php_error_docref("ref.mbstring" TSRMLS_CC, E_WARNING, "mbstring couldn't replace function %s.", p->orig_func);
|
||||
return FAILURE;
|
||||
@@ -1685,10 +1685,10 @@ PHP_RSHUTDOWN_FUNCTION(mbstring)
|
||||
if (MBSTRG(func_overload)){
|
||||
p = &(mb_ovld[0]);
|
||||
while (p->type > 0) {
|
||||
if ((MBSTRG(func_overload) & p->type) == p->type &&
|
||||
if ((MBSTRG(func_overload) & p->type) == p->type &&
|
||||
zend_hash_find(EG(function_table), p->save_func,
|
||||
strlen(p->save_func)+1, (void **)&orig) == SUCCESS) {
|
||||
|
||||
|
||||
zend_hash_update(EG(function_table), p->orig_func, strlen(p->orig_func)+1, orig, sizeof(zend_function), NULL);
|
||||
zend_hash_del(EG(function_table), p->save_func, strlen(p->save_func)+1);
|
||||
}
|
||||
@@ -1710,7 +1710,7 @@ PHP_MINFO_FUNCTION(mbstring)
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_row(2, "Multibyte Support", "enabled");
|
||||
php_info_print_table_row(2, "Multibyte string engine", "libmbfl");
|
||||
php_info_print_table_row(2, "HTTP input encoding translation", MBSTRG(encoding_translation) ? "enabled": "disabled");
|
||||
php_info_print_table_row(2, "HTTP input encoding translation", MBSTRG(encoding_translation) ? "enabled": "disabled");
|
||||
{
|
||||
char tmp[256];
|
||||
snprintf(tmp, sizeof(tmp), "%d.%d.%d", MBFL_VERSION_MAJOR, MBFL_VERSION_MINOR, MBFL_VERSION_TEENY);
|
||||
@@ -1846,7 +1846,7 @@ PHP_FUNCTION(mb_http_input)
|
||||
temp = list;
|
||||
spprintf(&list, 0, "%s,%s", temp, (*entry)->name);
|
||||
efree(temp);
|
||||
if (!list) {
|
||||
if (!list) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@@ -2078,12 +2078,12 @@ PHP_FUNCTION(mb_parse_str)
|
||||
encstr = estrndup(encstr, encstr_len);
|
||||
|
||||
info.data_type = PARSE_STRING;
|
||||
info.separator = PG(arg_separator).input;
|
||||
info.separator = PG(arg_separator).input;
|
||||
info.report_errors = 1;
|
||||
info.to_encoding = MBSTRG(current_internal_encoding);
|
||||
info.to_language = MBSTRG(language);
|
||||
info.from_encodings = MBSTRG(http_input_list);
|
||||
info.num_from_encodings = MBSTRG(http_input_list_size);
|
||||
info.num_from_encodings = MBSTRG(http_input_list_size);
|
||||
info.from_language = MBSTRG(language);
|
||||
|
||||
if (track_vars_array != NULL) {
|
||||
@@ -2093,8 +2093,8 @@ PHP_FUNCTION(mb_parse_str)
|
||||
if (!EG(active_symbol_table)) {
|
||||
zend_rebuild_symbol_table(TSRMLS_C);
|
||||
}
|
||||
Z_ARRVAL(tmp) = EG(active_symbol_table);
|
||||
detected = _php_mb_encoding_handler_ex(&info, &tmp, encstr TSRMLS_CC);
|
||||
Z_ARRVAL(tmp) = EG(active_symbol_table);
|
||||
detected = _php_mb_encoding_handler_ex(&info, &tmp, encstr TSRMLS_CC);
|
||||
}
|
||||
|
||||
MBSTRG(http_input_identify) = detected;
|
||||
@@ -2158,7 +2158,7 @@ PHP_FUNCTION(mb_output_handler)
|
||||
if (SG(sapi_headers).send_default_content_type || send_text_mimetype) {
|
||||
charset = encoding->mime_name;
|
||||
if (charset) {
|
||||
len = spprintf( &p, 0, "Content-Type: %s; charset=%s", mimetype, charset );
|
||||
len = spprintf( &p, 0, "Content-Type: %s; charset=%s", mimetype, charset );
|
||||
if (sapi_add_header(p, len, 0) != FAILURE) {
|
||||
SG(sapi_headers).send_default_content_type = 0;
|
||||
}
|
||||
@@ -2181,7 +2181,7 @@ PHP_FUNCTION(mb_output_handler)
|
||||
/* mode */
|
||||
mbfl_buffer_converter_illegal_mode(MBSTRG(outconv), MBSTRG(current_filter_illegal_mode));
|
||||
mbfl_buffer_converter_illegal_substchar(MBSTRG(outconv), MBSTRG(current_filter_illegal_substchar));
|
||||
|
||||
|
||||
/* feed the string */
|
||||
mbfl_string_init(&string);
|
||||
/* these are not needed. convd has encoding info.
|
||||
@@ -2193,11 +2193,11 @@ PHP_FUNCTION(mb_output_handler)
|
||||
mbfl_buffer_converter_feed(MBSTRG(outconv), &string);
|
||||
if (last_feed) {
|
||||
mbfl_buffer_converter_flush(MBSTRG(outconv));
|
||||
}
|
||||
}
|
||||
/* get the converter output, and return it */
|
||||
mbfl_buffer_converter_result(MBSTRG(outconv), &result);
|
||||
RETVAL_STRINGL((char *)result.val, result.len, 0); /* the string is already strdup()'ed */
|
||||
|
||||
|
||||
/* delete the converter if it is the last feed. */
|
||||
if (last_feed) {
|
||||
MBSTRG(illegalchars) += mbfl_buffer_illegalchars(MBSTRG(outconv));
|
||||
@@ -3156,7 +3156,7 @@ PHP_FUNCTION(mb_convert_case)
|
||||
|
||||
if (newstr) {
|
||||
RETVAL_STRINGL(newstr, ret_len, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -3380,7 +3380,7 @@ PHP_FUNCTION(mb_encode_mimeheader)
|
||||
mbfl_string_init(&result);
|
||||
ret = mbfl_mime_header_encode(&string, &result, charset, transenc, linefeed, indent);
|
||||
if (ret != NULL) {
|
||||
RETVAL_STRINGL((char *)ret->val, ret->len, 0); /* the string is already strdup()'ed */
|
||||
RETVAL_STRINGL_CHECK((char *)ret->val, ret->len, 0); /* the string is already strdup()'ed */
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
@@ -3507,7 +3507,7 @@ PHP_FUNCTION(mb_convert_kana)
|
||||
|
||||
ret = mbfl_ja_jp_hantozen(&string, &result, opt);
|
||||
if (ret != NULL) {
|
||||
RETVAL_STRINGL((char *)ret->val, ret->len, 0); /* the string is already strdup()'ed */
|
||||
RETVAL_STRINGL_CHECK((char *)ret->val, ret->len, 0); /* the string is already strdup()'ed */
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
@@ -3841,7 +3841,7 @@ php_mb_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type)
|
||||
|
||||
ret = mbfl_html_numeric_entity(&string, &result, convmap, mapsize, type);
|
||||
if (ret != NULL) {
|
||||
RETVAL_STRINGL((char *)ret->val, ret->len, 0);
|
||||
RETVAL_STRINGL_CHECK((char *)ret->val, ret->len, 0);
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
@@ -3929,12 +3929,12 @@ static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t
|
||||
|
||||
/*
|
||||
* C o n t e n t - T y p e : t e x t / h t m l \r\n
|
||||
* ^ ^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^ ^^^^
|
||||
* state 0 1 2 3
|
||||
* ^ ^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^ ^^^^
|
||||
* state 0 1 2 3
|
||||
*
|
||||
* C o n t e n t - T y p e : t e x t / h t m l \r\n
|
||||
* ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^
|
||||
* crlf_state -1 0 1 -1
|
||||
* ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^
|
||||
* crlf_state -1 0 1 -1
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -4000,7 +4000,7 @@ static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t
|
||||
token.a = 0;
|
||||
state = 1;
|
||||
break;
|
||||
|
||||
|
||||
case 2:
|
||||
if (crlf_state != -1) {
|
||||
token.c = (char *)ps;
|
||||
@@ -4177,14 +4177,14 @@ PHP_FUNCTION(mb_send_mail)
|
||||
if ((param_name = php_strtok_r(p, "= ", &tmp)) != NULL) {
|
||||
if (strcasecmp(param_name, "charset") == 0) {
|
||||
enum mbfl_no_encoding _tran_cs = tran_cs;
|
||||
|
||||
|
||||
charset = php_strtok_r(NULL, "= \"", &tmp);
|
||||
if (charset != NULL) {
|
||||
_tran_cs = mbfl_name2no_encoding(charset);
|
||||
}
|
||||
|
||||
if (_tran_cs == mbfl_no_encoding_invalid) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported charset \"%s\" - will be regarded as ascii", charset);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported charset \"%s\" - will be regarded as ascii", charset);
|
||||
_tran_cs = mbfl_no_encoding_ascii;
|
||||
}
|
||||
tran_cs = _tran_cs;
|
||||
@@ -4209,7 +4209,7 @@ PHP_FUNCTION(mb_send_mail)
|
||||
break;
|
||||
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported transfer encoding \"%s\" - will be regarded as 8bit", s->c);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported transfer encoding \"%s\" - will be regarded as 8bit", s->c);
|
||||
body_enc = mbfl_no_encoding_8bit;
|
||||
break;
|
||||
}
|
||||
@@ -4342,7 +4342,7 @@ PHP_FUNCTION(mb_send_mail)
|
||||
extra_cmd = php_escape_shell_cmd(force_extra_parameters);
|
||||
} else if (extra_cmd) {
|
||||
extra_cmd = php_escape_shell_cmd(extra_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
if (!err && php_mail(to_r, subject, message, headers, extra_cmd TSRMLS_CC)) {
|
||||
RETVAL_TRUE;
|
||||
@@ -4441,7 +4441,7 @@ PHP_FUNCTION(mb_get_info)
|
||||
}
|
||||
if ((name = (char *)mbfl_no_language2name(MBSTRG(language))) != NULL) {
|
||||
add_assoc_string(return_value, "language", name, 1);
|
||||
}
|
||||
}
|
||||
n = MBSTRG(current_detect_order_list_size);
|
||||
entry = MBSTRG(current_detect_order_list);
|
||||
if (n > 0) {
|
||||
@@ -4471,15 +4471,15 @@ PHP_FUNCTION(mb_get_info)
|
||||
} else if (!strcasecmp("internal_encoding", typ)) {
|
||||
if (MBSTRG(current_internal_encoding)) {
|
||||
RETVAL_STRING((char *)MBSTRG(current_internal_encoding)->name, 1);
|
||||
}
|
||||
}
|
||||
} else if (!strcasecmp("http_input", typ)) {
|
||||
if (MBSTRG(http_input_identify)) {
|
||||
RETVAL_STRING((char *)MBSTRG(http_input_identify)->name, 1);
|
||||
}
|
||||
}
|
||||
} else if (!strcasecmp("http_output", typ)) {
|
||||
if (MBSTRG(current_http_output_encoding)) {
|
||||
RETVAL_STRING((char *)MBSTRG(current_http_output_encoding)->name, 1);
|
||||
}
|
||||
}
|
||||
} else if (!strcasecmp("http_output_conv_mimetypes", typ)) {
|
||||
if ((name = (char *)zend_ini_string("mbstring.http_output_conv_mimetypes", sizeof("mbstring.http_output_conv_mimetypes"), 0)) != NULL) {
|
||||
RETVAL_STRING(name, 1);
|
||||
@@ -4522,7 +4522,7 @@ PHP_FUNCTION(mb_get_info)
|
||||
} else if (!strcasecmp("language", typ)) {
|
||||
if ((name = (char *)mbfl_no_language2name(MBSTRG(language))) != NULL) {
|
||||
RETVAL_STRING(name, 1);
|
||||
}
|
||||
}
|
||||
} else if (!strcasecmp("detect_order", typ)) {
|
||||
n = MBSTRG(current_detect_order_list_size);
|
||||
entry = MBSTRG(current_detect_order_list);
|
||||
@@ -4589,9 +4589,9 @@ PHP_FUNCTION(mb_check_encoding)
|
||||
if (convd == NULL) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create converter");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
mbfl_buffer_converter_illegal_mode(convd, MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE);
|
||||
mbfl_buffer_converter_illegal_substchar(convd, 0);
|
||||
mbfl_buffer_converter_illegal_substchar(convd, 0);
|
||||
|
||||
/* initialize string */
|
||||
mbfl_string_init_set(&string, mbfl_no_language_neutral, encoding->no_encoding);
|
||||
@@ -4642,7 +4642,7 @@ static void php_mb_populate_current_detect_order_list(TSRMLS_D)
|
||||
}
|
||||
|
||||
/* {{{ static int php_mb_encoding_translation() */
|
||||
static int php_mb_encoding_translation(TSRMLS_D)
|
||||
static int php_mb_encoding_translation(TSRMLS_D)
|
||||
{
|
||||
return MBSTRG(encoding_translation);
|
||||
}
|
||||
@@ -4768,7 +4768,7 @@ MBSTRING_API int php_mb_stripos(int mode, const char *old_haystack, unsigned int
|
||||
|
||||
{
|
||||
int haystack_char_len = mbfl_strlen(&haystack);
|
||||
|
||||
|
||||
if (mode) {
|
||||
if ((offset > 0 && offset > haystack_char_len) ||
|
||||
(offset < 0 && -offset > haystack_char_len)) {
|
||||
|
||||
@@ -1310,6 +1310,7 @@ static void php_mcrypt_do_crypt(char* cipher, const char *key, int key_len, cons
|
||||
}
|
||||
|
||||
if (mcrypt_generic_init(td, (void *) key, key_len, (void *) iv) < 0) {
|
||||
efree(data_s);
|
||||
php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Mcrypt initialisation failed");
|
||||
mcrypt_module_close(td);
|
||||
RETURN_FALSE;
|
||||
|
||||
@@ -1610,7 +1610,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
|
||||
const unsigned long len = php_mysqlnd_net_field_length(&p);
|
||||
|
||||
if (len != MYSQLND_NULL_LENGTH && ((p + len) > packet_end)) {
|
||||
php_error_docref(NULL, E_WARNING, "Malformed server packet. Field length pointing "MYSQLND_SZ_T_SPEC
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Malformed server packet. Field length pointing "MYSQLND_SZ_T_SPEC
|
||||
" bytes after end of packet", (p + len) - packet_end - 1);
|
||||
DBG_RETURN(FAIL);
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ static void update_op1_const(zend_op_array *op_array,
|
||||
opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1);
|
||||
op_array->literals[opline->op1.constant].cache_slot = op_array->last_cache_slot++;
|
||||
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
Z_STRVAL_P(val) = zend_str_tolower_dup(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
op_array->literals[opline->op1.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op1.constant+1].constant), Z_STRLEN(op_array->literals[opline->op1.constant+1].constant) + 1);
|
||||
break;
|
||||
@@ -205,13 +205,13 @@ static void update_op2_const(zend_op_array *op_array,
|
||||
case ZEND_ADD_INTERFACE:
|
||||
case ZEND_ADD_TRAIT:
|
||||
op_array->literals[opline->op2.constant].cache_slot = op_array->last_cache_slot++;
|
||||
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
Z_STRVAL_P(val) = zend_str_tolower_dup(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op2.constant+1].constant), Z_STRLEN(op_array->literals[opline->op2.constant+1].constant) + 1);
|
||||
break;
|
||||
case ZEND_INIT_METHOD_CALL:
|
||||
case ZEND_INIT_STATIC_METHOD_CALL:
|
||||
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
Z_STRVAL_P(val) = zend_str_tolower_dup(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op2.constant+1].constant), Z_STRLEN(op_array->literals[opline->op2.constant+1].constant) + 1);
|
||||
/* break missing intentionally */
|
||||
|
||||
@@ -102,6 +102,16 @@ opcache.validate_timestamps (default "1")
|
||||
The frequency of the check is controlled by the directive
|
||||
"opcache.revalidate_freq".
|
||||
|
||||
opcache.validate_permission (default "0")
|
||||
Leads OPcache to check file readability on each access to cached file.
|
||||
This directive should be enabled in shared hosting environment, when few
|
||||
users (PHP-FPM pools) reuse the common OPcache shared memory.
|
||||
|
||||
opcache.validate_root (default "0")
|
||||
This directive prevents file name collisions in different "chroot"
|
||||
environments. It should be enabled for sites that may serve requests in
|
||||
different "chroot" environments.
|
||||
|
||||
opcache.revalidate_freq (default "2")
|
||||
How often (in seconds) to check file timestamps for changes to the shared
|
||||
memory storage allocation. ("1" means validate once per second, but only
|
||||
|
||||
@@ -1592,6 +1592,28 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T
|
||||
persistent_script = NULL;
|
||||
}
|
||||
|
||||
/* Revalidate acessibility of cached file */
|
||||
if (EXPECTED(persistent_script != NULL) &&
|
||||
UNEXPECTED(ZCG(accel_directives).validate_permission) &&
|
||||
file_handle->type == ZEND_HANDLE_FILENAME &&
|
||||
UNEXPECTED(access(persistent_script->full_path, R_OK) != 0)) {
|
||||
if (type == ZEND_REQUIRE) {
|
||||
#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
|
||||
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename);
|
||||
#else
|
||||
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename TSRMLS_CC);
|
||||
#endif
|
||||
zend_bailout();
|
||||
} else {
|
||||
#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
|
||||
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename);
|
||||
#else
|
||||
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename TSRMLS_CC);
|
||||
#endif
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SHM_UNPROTECT();
|
||||
|
||||
/* If script is found then validate_timestamps if option is enabled */
|
||||
@@ -2126,6 +2148,27 @@ static void accel_activate(void)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef ZEND_WIN32
|
||||
if (ZCG(accel_directives).validate_root) {
|
||||
struct stat buf;
|
||||
|
||||
if (stat("/", &buf) != 0) {
|
||||
ZCG(root_hash) = 0;
|
||||
} else {
|
||||
ZCG(root_hash) = buf.st_ino;
|
||||
if (sizeof(buf.st_ino) > sizeof(ZCG(root_hash))) {
|
||||
if (ZCG(root_hash) != buf.st_ino) {
|
||||
zend_alter_ini_entry("opcache.enable", sizeof("opcache.enable"), "0", 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_RUNTIME);
|
||||
zend_accel_error(ACCEL_LOG_WARNING, "Can't cache files in chroot() directory with too big inode");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ZCG(root_hash) = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
SHM_UNPROTECT();
|
||||
/* PHP-5.4 and above return "double", but we use 1 sec precision */
|
||||
ZCG(request_time) = (time_t)sapi_get_request_time(TSRMLS_C);
|
||||
|
||||
@@ -230,6 +230,10 @@ typedef struct _zend_accel_directives {
|
||||
zend_bool file_override_enabled;
|
||||
zend_bool inherited_hack;
|
||||
zend_bool enable_cli;
|
||||
zend_bool validate_permission;
|
||||
#ifndef ZEND_WIN32
|
||||
zend_bool validate_root;
|
||||
#endif
|
||||
unsigned long revalidate_freq;
|
||||
unsigned long file_update_protection;
|
||||
char *error_log;
|
||||
@@ -264,6 +268,9 @@ typedef struct _zend_accel_globals {
|
||||
int include_path_len; /* "include_path" string length */
|
||||
int include_path_check;
|
||||
time_t request_time;
|
||||
#ifndef ZEND_WIN32
|
||||
unsigned long root_hash;
|
||||
#endif
|
||||
/* preallocated shared-memory block to save current script */
|
||||
void *mem;
|
||||
/* cache to save hash lookup on the same INCLUDE opcode */
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
Bug #73402 (Opcache segfault when using class constant to call a method)
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
class Logger {
|
||||
public function info($msg) {
|
||||
echo $msg;
|
||||
}
|
||||
}
|
||||
|
||||
class B
|
||||
{
|
||||
const LOG_LEVEL = 'Info';
|
||||
public function test()
|
||||
{
|
||||
$logger = new \Logger();
|
||||
$logger->{self::LOG_LEVEL}('test');
|
||||
}
|
||||
}
|
||||
|
||||
$b = new B;
|
||||
$b->test();
|
||||
--EXPECT--
|
||||
test
|
||||
@@ -77,6 +77,9 @@ zend_accel_hash_entry* zend_accel_hash_update(zend_accel_hash *accel_hash, char
|
||||
zend_ulong index;
|
||||
zend_accel_hash_entry *entry;
|
||||
zend_accel_hash_entry *indirect_bucket = NULL;
|
||||
#ifndef ZEND_WIN32
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
if (indirect) {
|
||||
indirect_bucket = (zend_accel_hash_entry*)data;
|
||||
@@ -86,6 +89,9 @@ zend_accel_hash_entry* zend_accel_hash_update(zend_accel_hash *accel_hash, char
|
||||
}
|
||||
|
||||
hash_value = zend_inline_hash_func(key, key_length);
|
||||
#ifndef ZEND_WIN32
|
||||
hash_value ^= ZCG(root_hash);
|
||||
#endif
|
||||
index = hash_value % accel_hash->max_num_entries;
|
||||
|
||||
/* try to see if the element already exists in the hash */
|
||||
@@ -145,8 +151,14 @@ void* zend_accel_hash_find(zend_accel_hash *accel_hash, char *key, zend_uint key
|
||||
zend_ulong hash_value;
|
||||
zend_ulong index;
|
||||
zend_accel_hash_entry *entry;
|
||||
#ifndef ZEND_WIN32
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
hash_value = zend_inline_hash_func(key, key_length);
|
||||
#ifndef ZEND_WIN32
|
||||
hash_value ^= ZCG(root_hash);
|
||||
#endif
|
||||
index = hash_value % accel_hash->max_num_entries;
|
||||
|
||||
entry = accel_hash->hash_table[index];
|
||||
@@ -173,8 +185,14 @@ zend_accel_hash_entry* zend_accel_hash_find_entry(zend_accel_hash *accel_hash, c
|
||||
zend_ulong hash_value;
|
||||
zend_ulong index;
|
||||
zend_accel_hash_entry *entry;
|
||||
#ifndef ZEND_WIN32
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
hash_value = zend_inline_hash_func(key, key_length);
|
||||
#ifndef ZEND_WIN32
|
||||
hash_value ^= ZCG(root_hash);
|
||||
#endif
|
||||
index = hash_value % accel_hash->max_num_entries;
|
||||
|
||||
entry = accel_hash->hash_table[index];
|
||||
@@ -198,8 +216,14 @@ int zend_accel_hash_unlink(zend_accel_hash *accel_hash, char *key, zend_uint key
|
||||
zend_ulong hash_value;
|
||||
zend_ulong index;
|
||||
zend_accel_hash_entry *entry, *last_entry=NULL;
|
||||
#ifndef ZEND_WIN32
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
hash_value = zend_inline_hash_func(key, key_length);
|
||||
#ifndef ZEND_WIN32
|
||||
hash_value ^= ZCG(root_hash);
|
||||
#endif
|
||||
index = hash_value % accel_hash->max_num_entries;
|
||||
|
||||
entry = accel_hash->hash_table[index];
|
||||
|
||||
@@ -255,6 +255,10 @@ ZEND_INI_BEGIN()
|
||||
STD_PHP_INI_BOOLEAN("opcache.enable" , "1", PHP_INI_ALL, OnEnable, enabled , zend_accel_globals, accel_globals)
|
||||
STD_PHP_INI_BOOLEAN("opcache.use_cwd" , "1", PHP_INI_SYSTEM, OnUpdateBool, accel_directives.use_cwd , zend_accel_globals, accel_globals)
|
||||
STD_PHP_INI_BOOLEAN("opcache.validate_timestamps", "1", PHP_INI_ALL , OnUpdateBool, accel_directives.validate_timestamps, zend_accel_globals, accel_globals)
|
||||
STD_PHP_INI_BOOLEAN("opcache.validate_permission", "0", PHP_INI_SYSTEM, OnUpdateBool, accel_directives.validate_permission, zend_accel_globals, accel_globals)
|
||||
#ifndef ZEND_WIN32
|
||||
STD_PHP_INI_BOOLEAN("opcache.validate_root" , "0", PHP_INI_SYSTEM, OnUpdateBool, accel_directives.validate_root , zend_accel_globals, accel_globals)
|
||||
#endif
|
||||
STD_PHP_INI_BOOLEAN("opcache.inherited_hack" , "1", PHP_INI_SYSTEM, OnUpdateBool, accel_directives.inherited_hack , zend_accel_globals, accel_globals)
|
||||
STD_PHP_INI_BOOLEAN("opcache.dups_fix" , "0", PHP_INI_ALL , OnUpdateBool, accel_directives.ignore_dups , zend_accel_globals, accel_globals)
|
||||
STD_PHP_INI_BOOLEAN("opcache.revalidate_path" , "0", PHP_INI_ALL , OnUpdateBool, accel_directives.revalidate_path , zend_accel_globals, accel_globals)
|
||||
@@ -663,6 +667,10 @@ static ZEND_FUNCTION(opcache_get_configuration)
|
||||
add_assoc_bool(directives, "opcache.enable_cli", ZCG(accel_directives).enable_cli);
|
||||
add_assoc_bool(directives, "opcache.use_cwd", ZCG(accel_directives).use_cwd);
|
||||
add_assoc_bool(directives, "opcache.validate_timestamps", ZCG(accel_directives).validate_timestamps);
|
||||
add_assoc_bool(directives, "opcache.validate_permission", ZCG(accel_directives).validate_permission);
|
||||
#ifndef ZEND_WIN32
|
||||
add_assoc_bool(directives, "opcache.validate_root", ZCG(accel_directives).validate_root);
|
||||
#endif
|
||||
add_assoc_bool(directives, "opcache.inherited_hack", ZCG(accel_directives).inherited_hack);
|
||||
add_assoc_bool(directives, "opcache.dups_fix", ZCG(accel_directives).ignore_dups);
|
||||
add_assoc_bool(directives, "opcache.revalidate_path", ZCG(accel_directives).revalidate_path);
|
||||
|
||||
+13
-9
@@ -4059,7 +4059,7 @@ PHP_FUNCTION(openssl_pbkdf2)
|
||||
return;
|
||||
}
|
||||
|
||||
if (key_length <= 0) {
|
||||
if (key_length <= 0 || key_length > INT_MAX) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -5260,7 +5260,7 @@ PHP_FUNCTION(openssl_encrypt)
|
||||
free_iv = php_openssl_validate_iv(&iv, &iv_len, max_iv_len TSRMLS_CC);
|
||||
|
||||
outlen = data_len + EVP_CIPHER_block_size(cipher_type);
|
||||
outbuf = emalloc(outlen + 1);
|
||||
outbuf = safe_emalloc(outlen, 1, 1);
|
||||
|
||||
EVP_EncryptInit(&cipher_ctx, cipher_type, NULL, NULL);
|
||||
if (password_len > keylen) {
|
||||
@@ -5278,14 +5278,18 @@ PHP_FUNCTION(openssl_encrypt)
|
||||
outlen += i;
|
||||
if (options & OPENSSL_RAW_DATA) {
|
||||
outbuf[outlen] = '\0';
|
||||
RETVAL_STRINGL((char *)outbuf, outlen, 0);
|
||||
RETVAL_STRINGL_CHECK((char *)outbuf, outlen, 0);
|
||||
} else {
|
||||
int base64_str_len;
|
||||
char *base64_str;
|
||||
|
||||
base64_str = (char*)php_base64_encode(outbuf, outlen, &base64_str_len);
|
||||
efree(outbuf);
|
||||
RETVAL_STRINGL(base64_str, base64_str_len, 0);
|
||||
if (!base64_str) {
|
||||
RETVAL_FALSE;
|
||||
} else {
|
||||
RETVAL_STRINGL(base64_str, base64_str_len, 0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
efree(outbuf);
|
||||
@@ -5462,16 +5466,16 @@ PHP_FUNCTION(openssl_random_pseudo_bytes)
|
||||
return;
|
||||
}
|
||||
|
||||
if (buffer_length <= 0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (zstrong_result_returned) {
|
||||
zval_dtor(zstrong_result_returned);
|
||||
ZVAL_BOOL(zstrong_result_returned, 0);
|
||||
}
|
||||
|
||||
buffer = emalloc(buffer_length + 1);
|
||||
if (buffer_length <= 0 || buffer_length > INT_MAX) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
buffer = safe_emalloc(buffer_length, 1, 1);
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
/* random/urandom equivalent on Windows */
|
||||
|
||||
+14
-8
@@ -1075,8 +1075,8 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
|
||||
char **subpat_names; /* Array for named subpatterns */
|
||||
int num_subpats; /* Number of captured subpatterns */
|
||||
int size_offsets; /* Size of the offsets array */
|
||||
int new_len; /* Length of needed storage */
|
||||
int alloc_len; /* Actual allocated length */
|
||||
size_t new_len; /* Length of needed storage */
|
||||
size_t alloc_len; /* Actual allocated length */
|
||||
int eval_result_len=0; /* Length of the eval'ed or
|
||||
function-returned string */
|
||||
int match_len; /* Length of the current match */
|
||||
@@ -1146,8 +1146,8 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
|
||||
|
||||
offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
|
||||
|
||||
alloc_len = 2 * subject_len + 1;
|
||||
result = safe_emalloc(alloc_len, sizeof(char), 0);
|
||||
result = safe_emalloc(subject_len, 2*sizeof(char), 1);
|
||||
alloc_len = 2 * (size_t)subject_len + 1;
|
||||
|
||||
/* Initialize */
|
||||
match = NULL;
|
||||
@@ -1212,8 +1212,8 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
|
||||
}
|
||||
|
||||
if (new_len + 1 > alloc_len) {
|
||||
alloc_len = 1 + alloc_len + 2 * new_len;
|
||||
new_buf = emalloc(alloc_len);
|
||||
new_buf = safe_emalloc(2, new_len + 1, alloc_len);
|
||||
alloc_len = 1 + alloc_len + 2 * (size_t)new_len;
|
||||
memcpy(new_buf, result, *result_len);
|
||||
efree(result);
|
||||
result = new_buf;
|
||||
@@ -1276,8 +1276,8 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
|
||||
} else {
|
||||
new_len = *result_len + subject_len - start_offset;
|
||||
if (new_len + 1 > alloc_len) {
|
||||
alloc_len = new_len + 1; /* now we know exactly how long it is */
|
||||
new_buf = safe_emalloc(alloc_len, sizeof(char), 0);
|
||||
new_buf = safe_emalloc(new_len, sizeof(char), 1);
|
||||
alloc_len = (size_t)new_len + 1; /* now we know exactly how long it is */
|
||||
memcpy(new_buf, result, *result_len);
|
||||
efree(result);
|
||||
result = new_buf;
|
||||
@@ -1308,6 +1308,12 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
|
||||
efree(offsets);
|
||||
efree(subpat_names);
|
||||
|
||||
if(result && (size_t)(*result_len) > INT_MAX) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Result is too big, max is %d", INT_MAX);
|
||||
efree(result);
|
||||
result = NULL;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -2338,6 +2338,7 @@ void pdo_stmt_init(TSRMLS_D)
|
||||
pdo_row_ce->ce_flags |= ZEND_ACC_FINAL_CLASS; /* when removing this a lot of handlers need to be redone */
|
||||
pdo_row_ce->create_object = pdo_row_new;
|
||||
pdo_row_ce->serialize = pdo_row_serialize;
|
||||
pdo_row_ce->unserialize = zend_class_unserialize_deny;
|
||||
}
|
||||
|
||||
static void free_statement(pdo_stmt_t *stmt TSRMLS_DC)
|
||||
|
||||
+2
-2
@@ -4054,7 +4054,7 @@ PHP_FUNCTION(pg_copy_to)
|
||||
free_pg_null = 1;
|
||||
}
|
||||
|
||||
spprintf(&query, 0, "COPY %s TO STDOUT DELIMITERS E'%c' WITH NULL AS E'%s'", table_name, *pg_delim, pg_null_as);
|
||||
spprintf(&query, 0, "COPY %s TO STDOUT DELIMITER E'%c' NULL AS E'%s'", table_name, *pg_delim, pg_null_as);
|
||||
|
||||
while ((pgsql_result = PQgetResult(pgsql))) {
|
||||
PQclear(pgsql_result);
|
||||
@@ -4187,7 +4187,7 @@ PHP_FUNCTION(pg_copy_from)
|
||||
pg_null_as_free = 1;
|
||||
}
|
||||
|
||||
spprintf(&query, 0, "COPY %s FROM STDIN DELIMITERS E'%c' WITH NULL AS E'%s'", table_name, *pg_delim, pg_null_as);
|
||||
spprintf(&query, 0, "COPY %s FROM STDIN DELIMITER E'%c' NULL AS E'%s'", table_name, *pg_delim, pg_null_as);
|
||||
while ((pgsql_result = PQgetResult(pgsql))) {
|
||||
PQclear(pgsql_result);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,9 @@ else {
|
||||
echo pg_last_error()."\n";
|
||||
}
|
||||
|
||||
// Create view here
|
||||
pg_query($db,$view_def);
|
||||
|
||||
pg_close($db);
|
||||
|
||||
echo "OK";
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug 73498 Incorrect DELIMITER syntax for pg_copy_to()
|
||||
--SKIPIF--
|
||||
<?php include("skipif.inc"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
include('config.inc');
|
||||
|
||||
$db = pg_connect($conn_str);
|
||||
|
||||
$rows = pg_copy_to($db, "(select * from {$view_name})");
|
||||
|
||||
var_dump(gettype($rows));
|
||||
var_dump(count($rows) > 0);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(5) "array"
|
||||
bool(true)
|
||||
@@ -9,6 +9,7 @@ PostgreSQL drop db
|
||||
include('config.inc');
|
||||
|
||||
$db = pg_connect($conn_str);
|
||||
pg_query($db, "DROP VIEW {$view_name}");
|
||||
pg_query($db, "DROP TABLE ".$table_name);
|
||||
@pg_query($db, "DROP TABLE ".$table_name_92);
|
||||
|
||||
|
||||
@@ -11,6 +11,10 @@ $table_name = "php_pgsql_test"; // test table that will be created
|
||||
$table_name_92 = "php_pgsql_test_92"; // test table that will be created
|
||||
$num_test_record = 1000; // Number of records to create
|
||||
|
||||
// Test view
|
||||
$view_name = "php_pgsql_viewtest";
|
||||
$view_def = "CREATE VIEW {$view_name} AS SELECT * FROM {$table_name};";
|
||||
|
||||
// Test table
|
||||
$table_def = "CREATE TABLE ${table_name} (num int, str text, bin bytea);";
|
||||
$table_def_92 = "CREATE TABLE ${table_name_92} (textary text[], jsn json);";
|
||||
|
||||
@@ -79,7 +79,7 @@ static char *ps_files_path_create(char *buf, size_t buflen, ps_files *data, cons
|
||||
int n;
|
||||
|
||||
key_len = strlen(key);
|
||||
if (key_len <= data->dirdepth ||
|
||||
if (!data || key_len <= data->dirdepth ||
|
||||
buflen < (strlen(data->basedir) + 2 * data->dirdepth + key_len + 5 + sizeof(FILE_PREFIX))) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #73100 (session_destroy null dereference in ps_files_path_create)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('session')) die('skip session extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
ob_start();
|
||||
var_dump(session_start());
|
||||
session_module_name("user");
|
||||
var_dump(session_destroy());
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
|
||||
Warning: session_module_name(): A session is active. You cannot change the session module's ini settings at this time in %s on line %d
|
||||
|
||||
Warning: session_destroy(): Session object destruction failed in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
||||
+23
-10
@@ -989,7 +989,7 @@ static inline char * sxe_xmlNodeListGetString(xmlDocPtr doc, xmlNodePtr list, in
|
||||
{
|
||||
xmlChar *tmp = xmlNodeListGetString(doc, list, inLine);
|
||||
char *res;
|
||||
|
||||
|
||||
if (tmp) {
|
||||
res = estrdup((char*)tmp);
|
||||
xmlFree(tmp);
|
||||
@@ -1147,7 +1147,7 @@ static HashTable * sxe_get_prop_hash(zval *object, int is_debug TSRMLS_DC) /* {{
|
||||
} else {
|
||||
if (node->type == XML_TEXT_NODE) {
|
||||
const xmlChar *cur = node->content;
|
||||
|
||||
|
||||
if (*cur != 0) {
|
||||
MAKE_STD_ZVAL(value);
|
||||
ZVAL_STRING(value, sxe_xmlNodeListGetString(node->doc, node, 1), 0);
|
||||
@@ -1198,7 +1198,7 @@ next_iter:
|
||||
static HashTable * sxe_get_gc(zval *object, zval ***table, int *n TSRMLS_DC) /* {{{ */ {
|
||||
php_sxe_object *sxe;
|
||||
sxe = php_sxe_fetch_object(object TSRMLS_CC);
|
||||
|
||||
|
||||
*table = NULL;
|
||||
*n = 0;
|
||||
return sxe->properties;
|
||||
@@ -1302,7 +1302,7 @@ SXE_METHOD(xpath)
|
||||
result = retval->nodesetval;
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
|
||||
if (result != NULL) {
|
||||
for (i = 0; i < result->nodeNr; ++i) {
|
||||
nodeptr = result->nodeTab[i];
|
||||
@@ -1412,9 +1412,15 @@ SXE_METHOD(asXML)
|
||||
if (node) {
|
||||
if (node->parent && (XML_DOCUMENT_NODE == node->parent->type)) {
|
||||
xmlDocDumpMemoryEnc((xmlDocPtr) sxe->document->ptr, &strval, &strval_len, ((xmlDocPtr) sxe->document->ptr)->encoding);
|
||||
RETVAL_STRINGL((char *)strval, strval_len, 1);
|
||||
if (!strval) {
|
||||
RETVAL_FALSE;
|
||||
} else {
|
||||
RETVAL_STRINGL((char *)strval, strval_len, 1);
|
||||
}
|
||||
xmlFree(strval);
|
||||
} else {
|
||||
char *return_content;
|
||||
size_t return_len;
|
||||
/* Should we be passing encoding information instead of NULL? */
|
||||
outbuf = xmlAllocOutputBuffer(NULL);
|
||||
|
||||
@@ -1425,10 +1431,17 @@ SXE_METHOD(asXML)
|
||||
xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, ((xmlDocPtr) sxe->document->ptr)->encoding);
|
||||
xmlOutputBufferFlush(outbuf);
|
||||
#ifdef LIBXML2_NEW_BUFFER
|
||||
RETVAL_STRINGL((char *)xmlOutputBufferGetContent(outbuf), xmlOutputBufferGetSize(outbuf), 1);
|
||||
return_content = (char *)xmlOutputBufferGetContent(outbuf);
|
||||
return_len = xmlOutputBufferGetSize(outbuf);
|
||||
#else
|
||||
RETVAL_STRINGL((char *)outbuf->buffer->content, outbuf->buffer->use, 1);
|
||||
return_content = (char *)outbuf->buffer->content;
|
||||
return_len = outbuf->buffer->use;
|
||||
#endif
|
||||
if (!return_content) {
|
||||
RETVAL_FALSE;
|
||||
} else {
|
||||
RETVAL_STRINGL_CHECK(return_content, return_len, 1);
|
||||
}
|
||||
xmlOutputBufferClose(outbuf);
|
||||
}
|
||||
} else {
|
||||
@@ -1542,11 +1555,11 @@ SXE_METHOD(getDocNamespaces)
|
||||
}else{
|
||||
GET_NODE(sxe, node);
|
||||
}
|
||||
|
||||
|
||||
if (node == NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
array_init(return_value);
|
||||
sxe_add_registered_namespaces(sxe, node, recursive, return_value TSRMLS_CC);
|
||||
}
|
||||
@@ -1933,7 +1946,7 @@ SXE_METHOD(count)
|
||||
}
|
||||
|
||||
php_sxe_count_elements_helper(sxe, &count TSRMLS_CC);
|
||||
|
||||
|
||||
RETURN_LONG(count);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
+26
-5
@@ -904,6 +904,7 @@ PHP_METHOD(SoapFault, SoapFault)
|
||||
PHP_METHOD(SoapFault, __toString)
|
||||
{
|
||||
zval *faultcode, *faultstring, *file, *line, *trace;
|
||||
zval *faultcode_cp, *faultstring_cp, *file_cp, *line_cp;
|
||||
char *str;
|
||||
int len;
|
||||
zend_fcall_info fci;
|
||||
@@ -932,16 +933,36 @@ PHP_METHOD(SoapFault, __toString)
|
||||
|
||||
zend_call_function(&fci, NULL TSRMLS_CC);
|
||||
|
||||
convert_to_string(faultcode);
|
||||
convert_to_string(faultstring);
|
||||
convert_to_string(file);
|
||||
convert_to_long(line);
|
||||
ALLOC_ZVAL(faultcode_cp);
|
||||
INIT_PZVAL_COPY(faultcode_cp, faultcode);
|
||||
zval_copy_ctor(faultcode_cp);
|
||||
|
||||
ALLOC_ZVAL(faultstring_cp);
|
||||
INIT_PZVAL_COPY(faultstring_cp, faultstring);
|
||||
zval_copy_ctor(faultstring_cp);
|
||||
|
||||
ALLOC_ZVAL(file_cp);
|
||||
INIT_PZVAL_COPY(file_cp, file);
|
||||
zval_copy_ctor(file_cp);
|
||||
|
||||
ALLOC_ZVAL(line_cp);
|
||||
INIT_PZVAL_COPY(line_cp, line);
|
||||
zval_copy_ctor(line_cp);
|
||||
|
||||
convert_to_string(faultcode_cp);
|
||||
convert_to_string(faultstring_cp);
|
||||
convert_to_string(file_cp);
|
||||
convert_to_long(line_cp);
|
||||
convert_to_string(trace);
|
||||
|
||||
len = spprintf(&str, 0, "SoapFault exception: [%s] %s in %s:%ld\nStack trace:\n%s",
|
||||
Z_STRVAL_P(faultcode), Z_STRVAL_P(faultstring), Z_STRVAL_P(file), Z_LVAL_P(line),
|
||||
Z_STRVAL_P(faultcode_cp), Z_STRVAL_P(faultstring_cp), Z_STRVAL_P(file_cp), Z_LVAL_P(line_cp),
|
||||
Z_STRLEN_P(trace) ? Z_STRVAL_P(trace) : "#0 {main}\n");
|
||||
|
||||
zval_ptr_dtor(&faultcode_cp);
|
||||
zval_ptr_dtor(&faultstring_cp);
|
||||
zval_ptr_dtor(&file_cp);
|
||||
zval_ptr_dtor(&line_cp);
|
||||
zval_ptr_dtor(&trace);
|
||||
|
||||
RETURN_STRINGL(str, len, 0);
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
--TEST--
|
||||
Bug #73037 SoapServer reports Bad Request when gzipped, var 0
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
if (!extension_loaded("zlib")) {
|
||||
echo "skip zlib is required for this test";
|
||||
}
|
||||
|
||||
if (!file_exists(dirname(__FILE__) . "/../../../sapi/cli/tests/php_cli_server.inc")) {
|
||||
echo "skip sapi/cli/tests/php_cli_server.inc required but not found";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
include dirname(__FILE__) . "/../../../sapi/cli/tests/php_cli_server.inc";
|
||||
|
||||
function get_data($max)
|
||||
{
|
||||
$piece = "<CD>
|
||||
<TITLE>Empire Burlesque</TITLE>
|
||||
<ARTIST>Bob Dylan</ARTIST>
|
||||
<COUNTRY>USA</COUNTRY>
|
||||
<COMPANY>Columbia</COMPANY>
|
||||
<PRICE>10.90</PRICE>
|
||||
<YEAR>1985</YEAR>
|
||||
</CD>";
|
||||
|
||||
$begin = '<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><CATALOG>';
|
||||
$end = '</CATALOG></soapenv:Body></soapenv:Envelope>';
|
||||
|
||||
$min = strlen($begin) + strlen($piece) + strlen($end);
|
||||
$max = $max < $min ? $min : $max;
|
||||
|
||||
$data = $begin;
|
||||
$data .= $piece;
|
||||
while (strlen($data) + strlen($end) < $max) {
|
||||
/* Randomize a bit, taking gzip in account. */
|
||||
$tmp = str_replace(
|
||||
array(
|
||||
"Empire Burlesque",
|
||||
"Bob Dylan",
|
||||
),
|
||||
array(
|
||||
md5(uniqid()),
|
||||
sha1(uniqid()),
|
||||
),
|
||||
$piece
|
||||
);
|
||||
|
||||
if (strlen($begin) + strlen($tmp) + strlen($end) > $max) {
|
||||
break;
|
||||
}
|
||||
|
||||
$data .= $tmp;
|
||||
}
|
||||
$data .= $end;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
$router = "bug73037_server.php";
|
||||
$args = substr(PHP_OS, 0, 3) == 'WIN' ? "-d extension_dir=" . ini_get("extension_dir") . " -d extension=php_soap.dll" : "";
|
||||
$code = <<<'PHP'
|
||||
$s = new SoapServer(NULL, array('uri' => 'http://here'));
|
||||
$s->setObject(new stdclass());
|
||||
$s->handle();
|
||||
PHP;
|
||||
|
||||
php_cli_server_start($code, $router, $args);
|
||||
|
||||
foreach (array(1024-1, 1024*8-3, 1024*9+1, 1024*16-1, 1024*32-5, 1024*64+3, 1024*128-7) as $k => $i) {
|
||||
echo "Iteration $k\n\n";
|
||||
|
||||
/* with and without compression */
|
||||
foreach (array(false, true) as $b) {
|
||||
$data = get_data($i);
|
||||
if ($b) {
|
||||
$data = gzencode($data);
|
||||
}
|
||||
$len = strlen($data);
|
||||
|
||||
//echo "len=$len\n";
|
||||
|
||||
$hdrs = <<<HDRS
|
||||
POST /bug73037_server.php HTTP/1.1
|
||||
Content-Type: application/soap+xml; charset=UTF-8
|
||||
Accept: application/soap+xml, application/dime, multipart/related, text/*
|
||||
SOAPAction: "urn:adressen#adressen#SetAda"
|
||||
Expect: 100-continue
|
||||
Content-Length: ${len}
|
||||
HDRS;
|
||||
if ($b) {
|
||||
$hdrs .="\nContent-Encoding: gzip";
|
||||
}
|
||||
//echo "Headers sent:\n$hdrs\n\n";
|
||||
$fp = fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT, $errno, $errstr, 5);
|
||||
if (!$fp) {
|
||||
die("connect failed");
|
||||
}
|
||||
|
||||
if(fwrite($fp, "$hdrs\n\n$data")) {
|
||||
$out = "";
|
||||
while (!feof($fp)) {
|
||||
$out .= fread($fp, 1024);
|
||||
}
|
||||
|
||||
$pos = strpos($out, "<env:Text>");
|
||||
if (false === $pos) {
|
||||
echo $out;
|
||||
goto cleanup;
|
||||
}
|
||||
$pos0 = $pos + strlen("<env:Text>");
|
||||
$pos = strpos($out, "</env:Text>");
|
||||
if (false === $pos) {
|
||||
echo $out;
|
||||
goto cleanup;
|
||||
}
|
||||
$len = $pos - $pos0;
|
||||
echo substr($out, $pos0, $len);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
fclose($fp);
|
||||
|
||||
echo "\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug73037_server.php");
|
||||
?>
|
||||
--EXPECT--
|
||||
Iteration 0
|
||||
|
||||
Function 'CATALOG' doesn't exist
|
||||
|
||||
Function 'CATALOG' doesn't exist
|
||||
|
||||
Iteration 1
|
||||
|
||||
Function 'CATALOG' doesn't exist
|
||||
|
||||
Function 'CATALOG' doesn't exist
|
||||
|
||||
Iteration 2
|
||||
|
||||
Function 'CATALOG' doesn't exist
|
||||
|
||||
Function 'CATALOG' doesn't exist
|
||||
|
||||
Iteration 3
|
||||
|
||||
Function 'CATALOG' doesn't exist
|
||||
|
||||
Function 'CATALOG' doesn't exist
|
||||
|
||||
Iteration 4
|
||||
|
||||
Function 'CATALOG' doesn't exist
|
||||
|
||||
Function 'CATALOG' doesn't exist
|
||||
|
||||
Iteration 5
|
||||
|
||||
Function 'CATALOG' doesn't exist
|
||||
|
||||
Function 'CATALOG' doesn't exist
|
||||
|
||||
Iteration 6
|
||||
|
||||
Function 'CATALOG' doesn't exist
|
||||
|
||||
Function 'CATALOG' doesn't exist
|
||||
|
||||
==DONE==
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #73452 Segfault (Regression for #69152)
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$data = 'O:9:"SoapFault":4:{s:9:"faultcode";i:4298448493;s:11:"faultstring";i:4298448543;s:7:"'."\0*\0".'file";i:4298447319;s:7:"'."\0*\0".'line";s:4:"ryat";}';
|
||||
echo unserialize($data);
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECTF--
|
||||
SoapFault exception: [4298448493] 4298448543 in :0
|
||||
Stack trace:
|
||||
#0 %sbug73452.php(4): unserialize('O:9:"SoapFault"...')
|
||||
#1 {main}==DONE==
|
||||
+1
-1
@@ -1812,7 +1812,7 @@ SPL_METHOD(Array, unserialize)
|
||||
ALLOC_INIT_ZVAL(intern->array);
|
||||
if (!php_var_unserialize(&intern->array, &p, s + buf_len, &var_hash TSRMLS_CC)
|
||||
|| (Z_TYPE_P(intern->array) != IS_ARRAY && Z_TYPE_P(intern->array) != IS_OBJECT)) {
|
||||
zval_ptr_dtor(&intern->array);
|
||||
// zval_ptr_dtor(&intern->array);
|
||||
goto outexcept;
|
||||
}
|
||||
var_push_dtor(&var_hash, &intern->array);
|
||||
|
||||
+131
-124
@@ -195,7 +195,7 @@ static int spl_recursive_it_valid_ex(spl_recursive_it_object *object, zval *zthi
|
||||
static int spl_recursive_it_valid(zend_object_iterator *iter TSRMLS_DC)
|
||||
{
|
||||
spl_recursive_it_object *object = (spl_recursive_it_object*)iter->data;
|
||||
|
||||
|
||||
return spl_recursive_it_valid_ex(object, ((spl_recursive_it_iterator*)iter)->zobject TSRMLS_CC);
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ static void spl_recursive_it_get_current_data(zend_object_iterator *iter, zval *
|
||||
{
|
||||
spl_recursive_it_object *object = (spl_recursive_it_object*)iter->data;
|
||||
zend_object_iterator *sub_iter = object->iterators[object->level].iterator;
|
||||
|
||||
|
||||
sub_iter->funcs->get_current_data(sub_iter, data TSRMLS_CC);
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ next_step:
|
||||
if (iterator->funcs->valid(iterator TSRMLS_CC) == FAILURE) {
|
||||
break;
|
||||
}
|
||||
object->iterators[object->level].state = RS_TEST;
|
||||
object->iterators[object->level].state = RS_TEST;
|
||||
/* break; */
|
||||
case RS_TEST:
|
||||
ce = object->iterators[object->level].ce;
|
||||
@@ -394,7 +394,7 @@ next_step:
|
||||
static void spl_recursive_it_rewind_ex(spl_recursive_it_object *object, zval *zthis TSRMLS_DC)
|
||||
{
|
||||
zend_object_iterator *sub_iter;
|
||||
|
||||
|
||||
SPL_FETCH_SUB_ITERATOR(sub_iter, object);
|
||||
|
||||
while (object->level) {
|
||||
@@ -606,7 +606,7 @@ SPL_METHOD(RecursiveIteratorIterator, __construct)
|
||||
SPL_METHOD(RecursiveIteratorIterator, rewind)
|
||||
{
|
||||
spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -654,7 +654,7 @@ SPL_METHOD(RecursiveIteratorIterator, current)
|
||||
spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
zend_object_iterator *iterator;
|
||||
zval **data;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -672,7 +672,7 @@ SPL_METHOD(RecursiveIteratorIterator, current)
|
||||
SPL_METHOD(RecursiveIteratorIterator, next)
|
||||
{
|
||||
spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -685,11 +685,11 @@ SPL_METHOD(RecursiveIteratorIterator, next)
|
||||
SPL_METHOD(RecursiveIteratorIterator, getDepth)
|
||||
{
|
||||
spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
RETURN_LONG(object->level);
|
||||
} /* }}} */
|
||||
|
||||
@@ -700,7 +700,7 @@ SPL_METHOD(RecursiveIteratorIterator, getSubIterator)
|
||||
spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
long level = object->level;
|
||||
zval *zobject;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &level) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -723,7 +723,7 @@ SPL_METHOD(RecursiveIteratorIterator, getInnerIterator)
|
||||
{
|
||||
spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
zval *zobject;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -760,7 +760,7 @@ SPL_METHOD(RecursiveIteratorIterator, callHasChildren)
|
||||
spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
zend_class_entry *ce;
|
||||
zval *retval, *zobject;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -791,7 +791,7 @@ SPL_METHOD(RecursiveIteratorIterator, callGetChildren)
|
||||
spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
zend_class_entry *ce;
|
||||
zval *retval, *zobject;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -845,7 +845,7 @@ SPL_METHOD(RecursiveIteratorIterator, setMaxDepth)
|
||||
{
|
||||
spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
long max_depth = -1;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &max_depth) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -865,7 +865,7 @@ SPL_METHOD(RecursiveIteratorIterator, getMaxDepth)
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (object->max_depth == -1) {
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
@@ -982,7 +982,7 @@ static zend_object_value spl_RecursiveTreeIterator_new(zend_class_entry *class_t
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_recursive_it___construct, 0, 0, 1)
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_recursive_it___construct, 0, 0, 1)
|
||||
ZEND_ARG_OBJ_INFO(0, iterator, Traversable, 0)
|
||||
ZEND_ARG_INFO(0, mode)
|
||||
ZEND_ARG_INFO(0, flags)
|
||||
@@ -1025,7 +1025,7 @@ static void spl_recursive_tree_iterator_get_prefix(spl_recursive_it_object *obje
|
||||
int level;
|
||||
|
||||
smart_str_appendl(&str, object->prefix[0].c, object->prefix[0].len);
|
||||
|
||||
|
||||
for (level = 0; level < object->level; ++level) {
|
||||
zend_call_method_with_0_params(&object->iterators[level].zobject, object->iterators[level].ce, NULL, "hasnext", &has_next);
|
||||
if (has_next) {
|
||||
@@ -1094,7 +1094,7 @@ SPL_METHOD(RecursiveTreeIterator, setPrefixPart)
|
||||
long part;
|
||||
char* prefix;
|
||||
int prefix_len;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &part, &prefix, &prefix_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1102,7 +1102,7 @@ SPL_METHOD(RecursiveTreeIterator, setPrefixPart)
|
||||
zend_throw_exception_ex(spl_ce_OutOfRangeException, 0 TSRMLS_CC, "Use RecursiveTreeIterator::PREFIX_* constant");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
smart_str_free(&object->prefix[part]);
|
||||
smart_str_appendl(&object->prefix[part], prefix, prefix_len);
|
||||
} /* }}} */
|
||||
@@ -1121,8 +1121,8 @@ SPL_METHOD(RecursiveTreeIterator, getPrefix)
|
||||
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC,
|
||||
"The object is in an invalid state as the parent constructor was not called");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
spl_recursive_tree_iterator_get_prefix(object, return_value TSRMLS_CC);
|
||||
} /* }}} */
|
||||
|
||||
@@ -1157,7 +1157,7 @@ SPL_METHOD(RecursiveTreeIterator, getEntry)
|
||||
"The object is in an invalid state as the parent constructor was not called");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
spl_recursive_tree_iterator_get_entry(object, return_value TSRMLS_CC);
|
||||
} /* }}} */
|
||||
|
||||
@@ -1176,7 +1176,7 @@ SPL_METHOD(RecursiveTreeIterator, getPostfix)
|
||||
"The object is in an invalid state as the parent constructor was not called");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
spl_recursive_tree_iterator_get_postfix(object, return_value TSRMLS_CC);
|
||||
} /* }}} */
|
||||
|
||||
@@ -1188,7 +1188,7 @@ SPL_METHOD(RecursiveTreeIterator, current)
|
||||
zval prefix, entry, postfix;
|
||||
char *str, *ptr;
|
||||
size_t str_len;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1197,7 +1197,7 @@ SPL_METHOD(RecursiveTreeIterator, current)
|
||||
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC,
|
||||
"The object is in an invalid state as the parent constructor was not called");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (object->flags & RTIT_BYPASS_CURRENT) {
|
||||
zend_object_iterator *iterator;
|
||||
@@ -1251,7 +1251,7 @@ SPL_METHOD(RecursiveTreeIterator, key)
|
||||
zval prefix, key, postfix, key_copy;
|
||||
char *str, *ptr;
|
||||
size_t str_len;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1301,7 +1301,7 @@ SPL_METHOD(RecursiveTreeIterator, key)
|
||||
RETVAL_STRINGL(str, str_len, 0);
|
||||
} /* }}} */
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_recursive_tree_it___construct, 0, 0, 1)
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_recursive_tree_it___construct, 0, 0, 1)
|
||||
ZEND_ARG_OBJ_INFO(0, iterator, Traversable, 0)
|
||||
ZEND_ARG_INFO(0, flags)
|
||||
ZEND_ARG_INFO(0, caching_it_flags)
|
||||
@@ -1405,14 +1405,14 @@ int spl_dual_it_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
|
||||
|
||||
if (call_user_function_ex(EG(function_table), NULL, &func, &retval_ptr, arg_count, func_params, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) {
|
||||
RETURN_ZVAL(retval_ptr, 0, 1);
|
||||
|
||||
|
||||
success = SUCCESS;
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to call %s::%s()", intern->inner.ce->name, method);
|
||||
success = FAILURE;
|
||||
}
|
||||
|
||||
efree(func_params);
|
||||
efree(func_params);
|
||||
return success;
|
||||
}
|
||||
#endif
|
||||
@@ -1436,7 +1436,7 @@ static inline int spl_cit_check_flags(int flags)
|
||||
cnt += (flags & CIT_TOSTRING_USE_KEY) ? 1 : 0;
|
||||
cnt += (flags & CIT_TOSTRING_USE_CURRENT) ? 1 : 0;
|
||||
cnt += (flags & CIT_TOSTRING_USE_INNER) ? 1 : 0;
|
||||
|
||||
|
||||
return cnt <= 1 ? SUCCESS : FAILURE;
|
||||
}
|
||||
|
||||
@@ -1449,7 +1449,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
|
||||
zend_error_handling error_handling;
|
||||
|
||||
intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
||||
if (intern->dit_type != DIT_Unknown) {
|
||||
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%s::getIterator() must be called exactly once per instance", ce_base->name);
|
||||
return NULL;
|
||||
@@ -1507,7 +1507,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
|
||||
ce = Z_OBJCE_P(zobject);
|
||||
if (!instanceof_function(ce, zend_ce_iterator TSRMLS_CC)) {
|
||||
if (ZEND_NUM_ARGS() > 1) {
|
||||
if (zend_lookup_class(class_name, class_name_len, &pce_cast TSRMLS_CC) == FAILURE
|
||||
if (zend_lookup_class(class_name, class_name_len, &pce_cast TSRMLS_CC) == FAILURE
|
||||
|| !instanceof_function(ce, *pce_cast TSRMLS_CC)
|
||||
|| !(*pce_cast)->get_iterator
|
||||
) {
|
||||
@@ -1616,21 +1616,21 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
|
||||
return intern;
|
||||
}
|
||||
|
||||
/* {{{ proto void FilterIterator::__construct(Iterator it)
|
||||
/* {{{ proto void FilterIterator::__construct(Iterator it)
|
||||
Create an Iterator from another iterator */
|
||||
SPL_METHOD(FilterIterator, __construct)
|
||||
{
|
||||
spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_FilterIterator, zend_ce_iterator, DIT_FilterIterator);
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto void CallbackFilterIterator::__construct(Iterator it, callback)
|
||||
/* {{{ proto void CallbackFilterIterator::__construct(Iterator it, callback)
|
||||
Create an Iterator from another iterator */
|
||||
SPL_METHOD(CallbackFilterIterator, __construct)
|
||||
{
|
||||
spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_CallbackFilterIterator, zend_ce_iterator, DIT_CallbackFilterIterator);
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto Iterator FilterIterator::getInnerIterator()
|
||||
/* {{{ proto Iterator FilterIterator::getInnerIterator()
|
||||
proto Iterator CachingIterator::getInnerIterator()
|
||||
proto Iterator LimitIterator::getInnerIterator()
|
||||
proto Iterator ParentIterator::getInnerIterator()
|
||||
@@ -1638,11 +1638,11 @@ SPL_METHOD(CallbackFilterIterator, __construct)
|
||||
SPL_METHOD(dual_it, getInnerIterator)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
|
||||
|
||||
if (intern->inner.zobject) {
|
||||
@@ -1747,13 +1747,13 @@ static inline void spl_dual_it_next(spl_dual_it_object *intern, int do_free TSRM
|
||||
SPL_METHOD(dual_it, rewind)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
|
||||
|
||||
|
||||
spl_dual_it_rewind(intern TSRMLS_CC);
|
||||
spl_dual_it_fetch(intern, 1 TSRMLS_CC);
|
||||
} /* }}} */
|
||||
@@ -1770,7 +1770,7 @@ SPL_METHOD(dual_it, valid)
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
|
||||
|
||||
RETURN_BOOL(intern->current.data);
|
||||
@@ -1791,7 +1791,7 @@ SPL_METHOD(dual_it, key)
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
|
||||
|
||||
if (intern->current.key) {
|
||||
@@ -1811,7 +1811,7 @@ SPL_METHOD(dual_it, key)
|
||||
SPL_METHOD(dual_it, current)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1832,7 +1832,7 @@ SPL_METHOD(dual_it, current)
|
||||
SPL_METHOD(dual_it, next)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1881,7 +1881,7 @@ static inline void spl_filter_it_next(zval *zthis, spl_dual_it_object *intern TS
|
||||
SPL_METHOD(FilterIterator, rewind)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1895,7 +1895,7 @@ SPL_METHOD(FilterIterator, rewind)
|
||||
SPL_METHOD(FilterIterator, next)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1925,7 +1925,7 @@ SPL_METHOD(RecursiveFilterIterator, hasChildren)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
zval *retval;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1946,7 +1946,7 @@ SPL_METHOD(RecursiveFilterIterator, getChildren)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
zval *retval;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1968,7 +1968,7 @@ SPL_METHOD(RecursiveCallbackFilterIterator, getChildren)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
zval *retval;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1991,7 +1991,7 @@ SPL_METHOD(ParentIterator, __construct)
|
||||
} /* }}} */
|
||||
|
||||
#if HAVE_PCRE || HAVE_BUNDLED_PCRE
|
||||
/* {{{ proto void RegexIterator::__construct(Iterator it, string regex [, int mode [, int flags [, int preg_flags]]])
|
||||
/* {{{ proto void RegexIterator::__construct(Iterator it, string regex [, int mode [, int flags [, int preg_flags]]])
|
||||
Create an RegexIterator from another iterator and a regular expression */
|
||||
SPL_METHOD(RegexIterator, __construct)
|
||||
{
|
||||
@@ -2044,22 +2044,23 @@ SPL_METHOD(RegexIterator, accept)
|
||||
char *subject, *result;
|
||||
int subject_len, use_copy, count = 0, result_len;
|
||||
zval *subject_ptr, subject_copy, zcount, *replacement, tmp_replacement;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
|
||||
|
||||
|
||||
if (intern->current.data == NULL) {
|
||||
RETURN_FALSE;
|
||||
} else if (Z_TYPE_P(intern->current.data) == IS_ARRAY) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (intern->u.regex.flags & REGIT_USE_KEY) {
|
||||
subject_ptr = intern->current.key;
|
||||
} else {
|
||||
if (Z_TYPE_P(intern->current.data) == IS_ARRAY) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
subject_ptr = intern->current.data;
|
||||
}
|
||||
|
||||
@@ -2088,7 +2089,7 @@ SPL_METHOD(RegexIterator, accept)
|
||||
}
|
||||
zval_ptr_dtor(&intern->current.data);
|
||||
ALLOC_INIT_ZVAL(intern->current.data);
|
||||
php_pcre_match_impl(intern->u.regex.pce, subject, subject_len, &zcount,
|
||||
php_pcre_match_impl(intern->u.regex.pce, subject, subject_len, &zcount,
|
||||
intern->current.data, intern->u.regex.mode == REGIT_MODE_ALL_MATCHES, intern->u.regex.use_flags, intern->u.regex.preg_flags, 0 TSRMLS_CC);
|
||||
RETVAL_BOOL(Z_LVAL(zcount) > 0);
|
||||
break;
|
||||
@@ -2114,7 +2115,7 @@ SPL_METHOD(RegexIterator, accept)
|
||||
replacement = &tmp_replacement;
|
||||
}
|
||||
result = php_pcre_replace_impl(intern->u.regex.pce, subject, subject_len, replacement, 0, &result_len, -1, &count TSRMLS_CC);
|
||||
|
||||
|
||||
if (intern->u.regex.flags & REGIT_USE_KEY) {
|
||||
zval_ptr_dtor(&intern->current.key);
|
||||
MAKE_STD_ZVAL(intern->current.key);
|
||||
@@ -2162,9 +2163,9 @@ SPL_METHOD(RegexIterator, getMode)
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
|
||||
|
||||
|
||||
RETURN_LONG(intern->u.regex.mode);
|
||||
} /* }}} */
|
||||
|
||||
@@ -2183,7 +2184,7 @@ SPL_METHOD(RegexIterator, setMode)
|
||||
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Illegal mode %ld", mode);
|
||||
return;/* NULL */
|
||||
}
|
||||
|
||||
|
||||
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
|
||||
|
||||
intern->u.regex.mode = mode;
|
||||
@@ -2198,9 +2199,9 @@ SPL_METHOD(RegexIterator, getFlags)
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
|
||||
|
||||
|
||||
RETURN_LONG(intern->u.regex.flags);
|
||||
} /* }}} */
|
||||
|
||||
@@ -2214,7 +2215,7 @@ SPL_METHOD(RegexIterator, setFlags)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
|
||||
|
||||
intern->u.regex.flags = flags;
|
||||
@@ -2225,11 +2226,11 @@ SPL_METHOD(RegexIterator, setFlags)
|
||||
SPL_METHOD(RegexIterator, getPregFlags)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
|
||||
|
||||
if (intern->u.regex.use_flags) {
|
||||
@@ -2249,14 +2250,14 @@ SPL_METHOD(RegexIterator, setPregFlags)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &preg_flags) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
|
||||
|
||||
intern->u.regex.preg_flags = preg_flags;
|
||||
intern->u.regex.use_flags = 1;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto void RecursiveRegexIterator::__construct(RecursiveIterator it, string regex [, int mode [, int flags [, int preg_flags]]])
|
||||
/* {{{ proto void RecursiveRegexIterator::__construct(RecursiveIterator it, string regex [, int mode [, int flags [, int preg_flags]]])
|
||||
Create an RecursiveRegexIterator from another recursive iterator and a regular expression */
|
||||
SPL_METHOD(RecursiveRegexIterator, __construct)
|
||||
{
|
||||
@@ -2269,7 +2270,7 @@ SPL_METHOD(RecursiveRegexIterator, getChildren)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
zval *retval;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2360,7 +2361,7 @@ static void spl_dual_it_free_storage(void *_object TSRMLS_DC)
|
||||
if (object->inner.zobject) {
|
||||
zval_ptr_dtor(&object->inner.zobject);
|
||||
}
|
||||
|
||||
|
||||
if (object->dit_type == DIT_AppendIterator) {
|
||||
object->u.append.iterator->funcs->dtor(object->u.append.iterator TSRMLS_CC);
|
||||
if (object->u.append.zarrayit) {
|
||||
@@ -2423,7 +2424,7 @@ static zend_object_value spl_dual_it_new(zend_class_entry *class_type TSRMLS_DC)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_filter_it___construct, 0)
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_filter_it___construct, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
@@ -2439,7 +2440,7 @@ static const zend_function_entry spl_funcs_FilterIterator[] = {
|
||||
PHP_FE_END
|
||||
};
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_callback_filter_it___construct, 0)
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_callback_filter_it___construct, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
|
||||
ZEND_ARG_INFO(0, callback)
|
||||
ZEND_END_ARG_INFO();
|
||||
@@ -2450,7 +2451,7 @@ static const zend_function_entry spl_funcs_CallbackFilterIterator[] = {
|
||||
PHP_FE_END
|
||||
};
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_recursive_callback_filter_it___construct, 0)
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_recursive_callback_filter_it___construct, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, iterator, RecursiveIterator, 0)
|
||||
ZEND_ARG_INFO(0, callback)
|
||||
ZEND_END_ARG_INFO();
|
||||
@@ -2462,7 +2463,7 @@ static const zend_function_entry spl_funcs_RecursiveCallbackFilterIterator[] = {
|
||||
PHP_FE_END
|
||||
};
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_parent_it___construct, 0)
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_parent_it___construct, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, iterator, RecursiveIterator, 0)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
@@ -2480,7 +2481,7 @@ static const zend_function_entry spl_funcs_ParentIterator[] = {
|
||||
};
|
||||
|
||||
#if HAVE_PCRE || HAVE_BUNDLED_PCRE
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_regex_it___construct, 0, 0, 2)
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_regex_it___construct, 0, 0, 2)
|
||||
ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
|
||||
ZEND_ARG_INFO(0, regex)
|
||||
ZEND_ARG_INFO(0, mode)
|
||||
@@ -2488,15 +2489,15 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_regex_it___construct, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, preg_flags)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_regex_it_set_mode, 0, 0, 1)
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_regex_it_set_mode, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, mode)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_regex_it_set_flags, 0, 0, 1)
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_regex_it_set_flags, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, flags)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_regex_it_set_preg_flags, 0, 0, 1)
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_regex_it_set_preg_flags, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, preg_flags)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
@@ -2513,7 +2514,7 @@ static const zend_function_entry spl_funcs_RegexIterator[] = {
|
||||
PHP_FE_END
|
||||
};
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_rec_regex_it___construct, 0, 0, 2)
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_rec_regex_it___construct, 0, 0, 2)
|
||||
ZEND_ARG_OBJ_INFO(0, iterator, RecursiveIterator, 0)
|
||||
ZEND_ARG_INFO(0, regex)
|
||||
ZEND_ARG_INFO(0, mode)
|
||||
@@ -2587,7 +2588,7 @@ SPL_METHOD(LimitIterator, __construct)
|
||||
spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_LimitIterator, zend_ce_iterator, DIT_LimitIterator);
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto void LimitIterator::rewind()
|
||||
/* {{{ proto void LimitIterator::rewind()
|
||||
Rewind the iterator to the specified starting offset */
|
||||
SPL_METHOD(LimitIterator, rewind)
|
||||
{
|
||||
@@ -2649,7 +2650,7 @@ SPL_METHOD(LimitIterator, getPosition)
|
||||
RETURN_LONG(intern->current.pos);
|
||||
} /* }}} */
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_seekable_it_seek, 0)
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_seekable_it_seek, 0)
|
||||
ZEND_ARG_INFO(0, position)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
@@ -2658,13 +2659,13 @@ static const zend_function_entry spl_funcs_SeekableIterator[] = {
|
||||
PHP_FE_END
|
||||
};
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_limit_it___construct, 0, 0, 1)
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_limit_it___construct, 0, 0, 1)
|
||||
ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
|
||||
ZEND_ARG_INFO(0, offset)
|
||||
ZEND_ARG_INFO(0, count)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_limit_it_seek, 0)
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_limit_it_seek, 0)
|
||||
ZEND_ARG_INFO(0, position)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
@@ -2699,7 +2700,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern TSRMLS_DC)
|
||||
if (intern->u.caching.flags & CIT_FULL_CACHE) {
|
||||
zval *zcacheval;
|
||||
zval *key = intern->current.key;
|
||||
|
||||
|
||||
MAKE_STD_ZVAL(zcacheval);
|
||||
ZVAL_ZVAL(zcacheval, intern->current.data, 1, 0);
|
||||
|
||||
@@ -2770,7 +2771,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern TSRMLS_DC)
|
||||
zval_copy_ctor(intern->u.caching.zstr);
|
||||
}
|
||||
}
|
||||
spl_dual_it_next(intern, 0 TSRMLS_CC);
|
||||
spl_dual_it_next(intern, 0 TSRMLS_CC);
|
||||
} else {
|
||||
intern->u.caching.flags &= ~CIT_VALID;
|
||||
}
|
||||
@@ -2795,7 +2796,7 @@ SPL_METHOD(CachingIterator, __construct)
|
||||
SPL_METHOD(CachingIterator, rewind)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2810,7 +2811,7 @@ SPL_METHOD(CachingIterator, rewind)
|
||||
SPL_METHOD(CachingIterator, valid)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2825,7 +2826,7 @@ SPL_METHOD(CachingIterator, valid)
|
||||
SPL_METHOD(CachingIterator, next)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2840,7 +2841,7 @@ SPL_METHOD(CachingIterator, next)
|
||||
SPL_METHOD(CachingIterator, hasNext)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2863,10 +2864,16 @@ SPL_METHOD(CachingIterator, __toString)
|
||||
return;
|
||||
}
|
||||
if (intern->u.caching.flags & CIT_TOSTRING_USE_KEY) {
|
||||
if (!intern->current.key) {
|
||||
RETURN_EMPTY_STRING();
|
||||
}
|
||||
MAKE_COPY_ZVAL(&intern->current.key, return_value);
|
||||
convert_to_string(return_value);
|
||||
return;
|
||||
} else if (intern->u.caching.flags & CIT_TOSTRING_USE_CURRENT) {
|
||||
if (!intern->current.data) {
|
||||
RETURN_EMPTY_STRING();
|
||||
}
|
||||
MAKE_COPY_ZVAL(&intern->current.data, return_value);
|
||||
convert_to_string(return_value);
|
||||
return;
|
||||
@@ -2874,7 +2881,7 @@ SPL_METHOD(CachingIterator, __toString)
|
||||
if (intern->u.caching.zstr) {
|
||||
RETURN_STRINGL(Z_STRVAL_P(intern->u.caching.zstr), Z_STRLEN_P(intern->u.caching.zstr), 1);
|
||||
} else {
|
||||
RETURN_NULL();
|
||||
RETURN_EMPTY_STRING();
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
@@ -2927,7 +2934,7 @@ SPL_METHOD(CachingIterator, offsetGet)
|
||||
zend_error(E_NOTICE, "Undefined index: %s", arKey);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
RETURN_ZVAL(*value, 1, 0);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2962,14 +2969,14 @@ SPL_METHOD(CachingIterator, offsetExists)
|
||||
spl_dual_it_object *intern;
|
||||
char *arKey;
|
||||
uint nKeyLength;
|
||||
|
||||
|
||||
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
|
||||
|
||||
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
|
||||
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%s does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arKey, &nKeyLength) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2983,11 +2990,11 @@ SPL_METHOD(CachingIterator, offsetExists)
|
||||
SPL_METHOD(CachingIterator, getCache)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
|
||||
|
||||
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
|
||||
@@ -3008,7 +3015,7 @@ SPL_METHOD(CachingIterator, getFlags)
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
|
||||
|
||||
RETURN_LONG(intern->u.caching.flags);
|
||||
@@ -3057,7 +3064,7 @@ SPL_METHOD(CachingIterator, count)
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
|
||||
|
||||
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
|
||||
@@ -3069,12 +3076,12 @@ SPL_METHOD(CachingIterator, count)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_caching_it___construct, 0, 0, 1)
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_caching_it___construct, 0, 0, 1)
|
||||
ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
|
||||
ZEND_ARG_INFO(0, flags)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_caching_it_setFlags, 0)
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_caching_it_setFlags, 0)
|
||||
ZEND_ARG_INFO(0, flags)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
@@ -3124,7 +3131,7 @@ SPL_METHOD(RecursiveCachingIterator, hasChildren)
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
|
||||
|
||||
RETURN_BOOL(intern->u.caching.zchildren);
|
||||
@@ -3135,7 +3142,7 @@ SPL_METHOD(RecursiveCachingIterator, hasChildren)
|
||||
SPL_METHOD(RecursiveCachingIterator, getChildren)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -3149,7 +3156,7 @@ SPL_METHOD(RecursiveCachingIterator, getChildren)
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_caching_rec_it___construct, 0, ZEND_RETURN_VALUE, 1)
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_caching_rec_it___construct, 0, ZEND_RETURN_VALUE, 1)
|
||||
ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
|
||||
ZEND_ARG_INFO(0, flags)
|
||||
ZEND_END_ARG_INFO();
|
||||
@@ -3168,7 +3175,7 @@ SPL_METHOD(IteratorIterator, __construct)
|
||||
spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_IteratorIterator, zend_ce_traversable, DIT_IteratorIterator);
|
||||
} /* }}} */
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_iterator_it___construct, 0)
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_iterator_it___construct, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, iterator, Traversable, 0)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
@@ -3205,7 +3212,7 @@ SPL_METHOD(NoRewindIterator, rewind)
|
||||
SPL_METHOD(NoRewindIterator, valid)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -3219,7 +3226,7 @@ SPL_METHOD(NoRewindIterator, valid)
|
||||
SPL_METHOD(NoRewindIterator, key)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -3239,7 +3246,7 @@ SPL_METHOD(NoRewindIterator, current)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
zval **data;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -3256,7 +3263,7 @@ SPL_METHOD(NoRewindIterator, current)
|
||||
SPL_METHOD(NoRewindIterator, next)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -3265,7 +3272,7 @@ SPL_METHOD(NoRewindIterator, next)
|
||||
intern->inner.iterator->funcs->move_forward(intern->inner.iterator TSRMLS_CC);
|
||||
} /* }}} */
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_norewind_it___construct, 0)
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_norewind_it___construct, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
@@ -3292,7 +3299,7 @@ SPL_METHOD(InfiniteIterator, __construct)
|
||||
SPL_METHOD(InfiniteIterator, next)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -3459,13 +3466,13 @@ SPL_METHOD(AppendIterator, append)
|
||||
SPL_METHOD(AppendIterator, rewind)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
|
||||
|
||||
|
||||
intern->u.append.iterator->funcs->rewind(intern->u.append.iterator TSRMLS_CC);
|
||||
if (spl_append_it_next_iterator(intern TSRMLS_CC) == SUCCESS) {
|
||||
spl_append_it_fetch(intern TSRMLS_CC);
|
||||
@@ -3481,7 +3488,7 @@ SPL_METHOD(AppendIterator, valid)
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
|
||||
|
||||
RETURN_BOOL(intern->current.data);
|
||||
@@ -3492,13 +3499,13 @@ SPL_METHOD(AppendIterator, valid)
|
||||
SPL_METHOD(AppendIterator, next)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
|
||||
|
||||
|
||||
spl_append_it_next(intern TSRMLS_CC);
|
||||
} /* }}} */
|
||||
|
||||
@@ -3507,7 +3514,7 @@ SPL_METHOD(AppendIterator, next)
|
||||
SPL_METHOD(AppendIterator, getIteratorIndex)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -3523,7 +3530,7 @@ SPL_METHOD(AppendIterator, getIteratorIndex)
|
||||
SPL_METHOD(AppendIterator, getArrayIterator)
|
||||
{
|
||||
spl_dual_it_object *intern;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -3533,7 +3540,7 @@ SPL_METHOD(AppendIterator, getArrayIterator)
|
||||
RETURN_ZVAL(intern->u.append.zarrayit, 1, 0);
|
||||
} /* }}} */
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_append_it_append, 0)
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_append_it_append, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
@@ -3636,7 +3643,7 @@ static int spl_iterator_to_values_apply(zend_object_iterator *iter, void *puser
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array iterator_to_array(Traversable it [, bool use_keys = true])
|
||||
/* {{{ proto array iterator_to_array(Traversable it [, bool use_keys = true])
|
||||
Copy the iterator into an array */
|
||||
PHP_FUNCTION(iterator_to_array)
|
||||
{
|
||||
@@ -3662,7 +3669,7 @@ static int spl_iterator_count_apply(zend_object_iterator *iter, void *puser TSRM
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int iterator_count(Traversable it)
|
||||
/* {{{ proto int iterator_count(Traversable it)
|
||||
Count the elements in an iterator */
|
||||
PHP_FUNCTION(iterator_count)
|
||||
{
|
||||
@@ -3672,7 +3679,7 @@ PHP_FUNCTION(iterator_count)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &obj, zend_ce_traversable) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (spl_iterator_apply(obj, spl_iterator_count_apply, (void*)&count TSRMLS_CC) == SUCCESS) {
|
||||
RETURN_LONG(count);
|
||||
}
|
||||
@@ -3755,7 +3762,7 @@ PHP_MINIT_FUNCTION(spl_iterators)
|
||||
spl_handlers_dual_it.get_method = spl_dual_it_get_method;
|
||||
/*spl_handlers_dual_it.call_method = spl_dual_it_call_method;*/
|
||||
spl_handlers_dual_it.clone_obj = NULL;
|
||||
|
||||
|
||||
spl_ce_RecursiveIteratorIterator->get_iterator = spl_recursive_it_get_iterator;
|
||||
spl_ce_RecursiveIteratorIterator->iterator_funcs.funcs = &spl_recursive_it_iterator_funcs;
|
||||
|
||||
@@ -3795,16 +3802,16 @@ PHP_MINIT_FUNCTION(spl_iterators)
|
||||
REGISTER_SPL_IMPLEMENTS(CachingIterator, ArrayAccess);
|
||||
REGISTER_SPL_IMPLEMENTS(CachingIterator, Countable);
|
||||
|
||||
REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "CALL_TOSTRING", CIT_CALL_TOSTRING);
|
||||
REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "CATCH_GET_CHILD", CIT_CATCH_GET_CHILD);
|
||||
REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "CALL_TOSTRING", CIT_CALL_TOSTRING);
|
||||
REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "CATCH_GET_CHILD", CIT_CATCH_GET_CHILD);
|
||||
REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "TOSTRING_USE_KEY", CIT_TOSTRING_USE_KEY);
|
||||
REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "TOSTRING_USE_CURRENT", CIT_TOSTRING_USE_CURRENT);
|
||||
REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "TOSTRING_USE_INNER", CIT_TOSTRING_USE_INNER);
|
||||
REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "FULL_CACHE", CIT_FULL_CACHE);
|
||||
REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "FULL_CACHE", CIT_FULL_CACHE);
|
||||
|
||||
REGISTER_SPL_SUB_CLASS_EX(RecursiveCachingIterator, CachingIterator, spl_dual_it_new, spl_funcs_RecursiveCachingIterator);
|
||||
REGISTER_SPL_IMPLEMENTS(RecursiveCachingIterator, RecursiveIterator);
|
||||
|
||||
|
||||
REGISTER_SPL_SUB_CLASS_EX(NoRewindIterator, IteratorIterator, spl_dual_it_new, spl_funcs_NoRewindIterator);
|
||||
|
||||
REGISTER_SPL_SUB_CLASS_EX(AppendIterator, IteratorIterator, spl_dual_it_new, spl_funcs_AppendIterator);
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #68128 - RecursiveRegexIterator raises "Array to string conversion" notice
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$arrayIterator = new ArrayIterator(array('key 1' => 'value 1', 'key 2' => ['value 2']));
|
||||
$regexIterator = new RegexIterator($arrayIterator, '/^key/', RegexIterator::MATCH, RegexIterator::USE_KEY);
|
||||
|
||||
foreach ($regexIterator as $key => $value) {
|
||||
var_dump($key, $value);
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(5) "key 1"
|
||||
string(7) "value 1"
|
||||
string(5) "key 2"
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(7) "value 2"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
--TEST--
|
||||
Bug #73073: CachingIterator null dereference when convert to string
|
||||
--FILE--
|
||||
<?php
|
||||
$it = new CachingIterator(new ArrayIterator(array()), CachingIterator::TOSTRING_USE_KEY);
|
||||
var_dump((string)$it);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(0) ""
|
||||
Loaded 100 of 152 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user