diff options
Diffstat (limited to 'ext')
197 files changed, 2614 insertions, 1077 deletions
diff --git a/ext/curl/interface.c b/ext/curl/interface.c index d7d5c51c4..d75e5c058 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -713,6 +713,14 @@ PHP_MINIT_FUNCTION(curl) #if LIBCURL_VERSION_NUM >= 0x071202 REGISTER_CURL_CONSTANT(CURLINFO_REDIRECT_URL); #endif +#if LIBCURL_VERSION_NUM >= 0x071300 /* 7.19.0 */ + REGISTER_CURL_CONSTANT(CURLINFO_PRIMARY_IP); +#endif +#if LIBCURL_VERSION_NUM >= 0x071500 /* 7.21.0 */ + REGISTER_CURL_CONSTANT(CURLINFO_PRIMARY_PORT); + REGISTER_CURL_CONSTANT(CURLINFO_LOCAL_IP); + REGISTER_CURL_CONSTANT(CURLINFO_LOCAL_PORT); +#endif /* cURL protocol constants (curl_version) */ @@ -1606,9 +1614,9 @@ PHP_FUNCTION(curl_copy_handle) dupch->uses = 0; ch->uses++; if (ch->handlers->write->stream) { - Z_ADDREF_P(dupch->handlers->write->stream); - dupch->handlers->write->stream = ch->handlers->write->stream; + Z_ADDREF_P(ch->handlers->write->stream); } + dupch->handlers->write->stream = ch->handlers->write->stream; dupch->handlers->write->method = ch->handlers->write->method; dupch->handlers->write->type = ch->handlers->write->type; if (ch->handlers->read->stream) { @@ -2447,6 +2455,8 @@ PHP_FUNCTION(curl_getinfo) create_certinfo(ci, listcode TSRMLS_CC); CAAZ("certinfo", listcode); } +#endif +#if LIBCURL_VERSION_NUM >= 0x071300 /* 7.19.0 */ if (curl_easy_getinfo(ch->cp, CURLINFO_PRIMARY_IP, &s_code) == CURLE_OK) { CAAS("primary_ip", s_code); } @@ -2473,10 +2483,10 @@ PHP_FUNCTION(curl_getinfo) } else { switch (option) { /* string variable types */ -#if LIBCURL_VERSION_NUM >= 0x071500 +#if LIBCURL_VERSION_NUM >= 0x071300 /* 7.19.0 */ case CURLINFO_PRIMARY_IP: #endif -#if LIBCURL_VERSION_NUM >= 0x071500 +#if LIBCURL_VERSION_NUM >= 0x071500 /* 7.21.0 */ case CURLINFO_LOCAL_IP: #endif case CURLINFO_PRIVATE: @@ -2496,7 +2506,7 @@ PHP_FUNCTION(curl_getinfo) break; } /* Long variable types */ -#if LIBCURL_VERSION_NUM >= 0x071500 +#if LIBCURL_VERSION_NUM >= 0x071500 /* 7.21.0 */ case CURLINFO_PRIMARY_PORT: case CURLINFO_LOCAL_PORT: #endif diff --git a/ext/curl/multi.c b/ext/curl/multi.c index 034aa65c2..53e97b80f 100644 --- a/ext/curl/multi.c +++ b/ext/curl/multi.c @@ -191,6 +191,9 @@ PHP_FUNCTION(curl_multi_select) FD_ZERO(&exceptfds); curl_multi_fdset(mh->multi, &readfds, &writefds, &exceptfds, &maxfd); + if (maxfd == -1) { + RETURN_LONG(-1); + } RETURN_LONG(select(maxfd + 1, &readfds, &writefds, &exceptfds, &to)); } /* }}} */ diff --git a/ext/curl/streams.c b/ext/curl/streams.c index 19328d886..821c2ecad 100644 --- a/ext/curl/streams.c +++ b/ext/curl/streams.c @@ -162,6 +162,10 @@ static size_t php_curl_stream_read(php_stream *stream, char *buf, size_t count T } do { + FD_ZERO(&curlstream->readfds); + FD_ZERO(&curlstream->writefds); + FD_ZERO(&curlstream->excfds); + /* get the descriptors from curl */ curl_multi_fdset(curlstream->multi, &curlstream->readfds, &curlstream->writefds, &curlstream->excfds, &curlstream->maxfd); diff --git a/ext/curl/tests/bug62839.phpt b/ext/curl/tests/bug62839.phpt new file mode 100644 index 000000000..e6988d6de --- /dev/null +++ b/ext/curl/tests/bug62839.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #62839 (curl_copy_handle segfault with CURLOPT_FILE) +--SKIPIF-- +<?php if (!extension_loaded("curl")) print "skip"; +?> +--FILE-- +<?php +$curl = curl_init(); + +$fd = tmpfile(); +curl_setopt($curl, CURLOPT_FILE, $fd); + +curl_copy_handle($curl); + +echo 'DONE!'; +?> +--EXPECTF-- +DONE! diff --git a/ext/date/lib/astro.c b/ext/date/lib/astro.c index 0438f9890..064700f91 100644 --- a/ext/date/lib/astro.c +++ b/ext/date/lib/astro.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/dow.c b/ext/date/lib/dow.c index b33e8eab7..9cb9c9cd2 100644 --- a/ext/date/lib/dow.c +++ b/ext/date/lib/dow.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/interval.c b/ext/date/lib/interval.c index af150fc80..451b46319 100644 --- a/ext/date/lib/interval.c +++ b/ext/date/lib/interval.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c index 560cf05c1..6bd03f725 100644 --- a/ext/date/lib/parse_date.c +++ b/ext/date/lib/parse_date.c @@ -1,9 +1,9 @@ -/* Generated by re2c 0.13.5 on Mon Dec 5 22:02:27 2011 */ +/* Generated by re2c 0.13.5 on Sun Sep 30 20:14:42 2012 */ /* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -21296,6 +21296,7 @@ yy1387: s->time->is_localtime = 1; s->time->zone_type = TIMELIB_ZONETYPE_OFFSET; s->time->z = 0; + s->time->dst = 0; TIMELIB_DEINIT; return TIMELIB_RELATIVE; @@ -24972,6 +24973,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim s->time->is_localtime = 1; s->time->zone_type = TIMELIB_ZONETYPE_OFFSET; s->time->z = 0; + s->time->dst = 0; break; case 'e': /* timezone */ diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re index 16c45a211..5a8b6134b 100644 --- a/ext/date/lib/parse_date.re +++ b/ext/date/lib/parse_date.re @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -1073,6 +1073,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of s->time->is_localtime = 1; s->time->zone_type = TIMELIB_ZONETYPE_OFFSET; s->time->z = 0; + s->time->dst = 0; TIMELIB_DEINIT; return TIMELIB_RELATIVE; @@ -2077,6 +2078,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim s->time->is_localtime = 1; s->time->zone_type = TIMELIB_ZONETYPE_OFFSET; s->time->z = 0; + s->time->dst = 0; break; case 'e': /* timezone */ diff --git a/ext/date/lib/parse_iso_intervals.c b/ext/date/lib/parse_iso_intervals.c index 34de3b409..d52c24d38 100644 --- a/ext/date/lib/parse_iso_intervals.c +++ b/ext/date/lib/parse_iso_intervals.c @@ -4,7 +4,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/parse_iso_intervals.re b/ext/date/lib/parse_iso_intervals.re index 8610803e3..e52868865 100644 --- a/ext/date/lib/parse_iso_intervals.re +++ b/ext/date/lib/parse_iso_intervals.re @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/parse_tz.c b/ext/date/lib/parse_tz.c index b8d8448c9..009a2ad4e 100644 --- a/ext/date/lib/parse_tz.c +++ b/ext/date/lib/parse_tz.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/timelib.c b/ext/date/lib/timelib.c index 5e65a6e4c..43eedf780 100644 --- a/ext/date/lib/timelib.c +++ b/ext/date/lib/timelib.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/timelib.h b/ext/date/lib/timelib.h index 9667fa2da..671d37fd9 100644 --- a/ext/date/lib/timelib.h +++ b/ext/date/lib/timelib.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/timelib_structs.h b/ext/date/lib/timelib_structs.h index 4f67b7a6c..6662d91b1 100644 --- a/ext/date/lib/timelib_structs.h +++ b/ext/date/lib/timelib_structs.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/tm2unixtime.c b/ext/date/lib/tm2unixtime.c index c4830bbef..6085bb14d 100644 --- a/ext/date/lib/tm2unixtime.c +++ b/ext/date/lib/tm2unixtime.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/unixtime2tm.c b/ext/date/lib/unixtime2tm.c index a76fa8099..48709f42f 100644 --- a/ext/date/lib/unixtime2tm.c +++ b/ext/date/lib/unixtime2tm.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/tests/bug62561.phpt b/ext/date/tests/bug62561.phpt new file mode 100644 index 000000000..0ed32c15a --- /dev/null +++ b/ext/date/tests/bug62561.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #62561 Unixtimestamp may take on local times DST flag (this test will only be valid during EDT) +--FILE-- +<?php +$tz = new DateTimeZone('America/New_York'); +$ts = new DateTime('@1341115200', $tz); +$int = new DateInterval('P1D'); +$dayFromTs = new DateTime('@1341115200', new DateTimeZone('America/New_York')); +$dayFromTs->add($int); + +echo 'ts: '.$ts->format('Y-m-d H:i:s')."\n"; +echo 'day from ts: '.$dayFromTs->format('Y-m-d H:i:s')."\n"; +?> +--EXPECT-- +ts: 2012-07-01 04:00:00 +day from ts: 2012-07-02 04:00:00 diff --git a/ext/date/tests/bug62852.phpt b/ext/date/tests/bug62852.phpt new file mode 100644 index 000000000..26de51021 --- /dev/null +++ b/ext/date/tests/bug62852.phpt @@ -0,0 +1,36 @@ +--TEST-- +Bug #62852 (Unserialize invalid DateTime causes crash) +--INI-- +date.timezone=GMT +--XFAIL-- +bug is not fixed yet +--FILE-- +<?php +$s1 = 'O:8:"DateTime":3:{s:4:"date";s:20:"10007-06-07 03:51:49";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}'; +$s2 = 'O:3:"Foo":3:{s:4:"date";s:20:"10007-06-07 03:51:49";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}'; + +global $foo; + +class Foo extends DateTime { + function __wakeup() { + global $foo; + $foo = $this; + parent::__wakeup(); + } +} + +// Old test case +try { + unserialize( $s1 ); +} catch ( Exception $e ) {} + +// My test case +try { + unserialize( $s2 ); +} catch ( Exception $e ) {} +var_dump( $foo ); + +echo "okey"; +?> +--EXPECTF-- +okey diff --git a/ext/date/tests/bug62896.phpt b/ext/date/tests/bug62896.phpt new file mode 100644 index 000000000..7584546b5 --- /dev/null +++ b/ext/date/tests/bug62896.phpt @@ -0,0 +1,40 @@ +--TEST-- +Bug #62896 Unixtimestamp may take on local times DST flag (this test will only be valid during CEST) +--FILE-- +<?php + $tz = new DateTimeZone('Europe/Berlin'); + + echo "FROM TIMESTAMP, NO TZ:\n"; + + $date = new DateTime('@'.strtotime('2012-08-22 00:00:00 CEST')); + echo $date->format('Y-m-d H:i:s T').' (offset '.$date->getOffset().")\n"; + + $date->modify('+0 days'); + echo $date->format('Y-m-d H:i:s T').' (offset '.$date->getOffset().")\n"; + + echo "FROM TIMESTAMP, WITH TZ:\n"; + + $date = new DateTime('@'.strtotime('2012-08-22 00:00:00 CEST')); + $date->setTimezone($tz); + echo $date->format('Y-m-d H:i:s T').' (offset '.$date->getOffset().")\n"; + + $date->modify('+0 days'); + echo $date->format('Y-m-d H:i:s T').' (offset '.$date->getOffset().")\n"; + + echo "FROM STRING:\n"; + + $date = new DateTime('2012-08-22 00:00:00 CEST', $tz); + echo $date->format('Y-m-d H:i:s T').' (offset '.$date->getOffset().")\n"; + + $date->modify('+0 days'); + echo $date->format('Y-m-d H:i:s T').' (offset '.$date->getOffset().")\n"; +--EXPECT-- +FROM TIMESTAMP, NO TZ: +2012-08-21 22:00:00 GMT+0000 (offset 0) +2012-08-21 22:00:00 GMT+0000 (offset 0) +FROM TIMESTAMP, WITH TZ: +2012-08-22 00:00:00 CEST (offset 7200) +2012-08-22 00:00:00 CEST (offset 7200) +FROM STRING: +2012-08-22 00:00:00 CEST (offset 7200) +2012-08-22 00:00:00 CEST (offset 7200) diff --git a/ext/dba/libcdb/cdb.c b/ext/dba/libcdb/cdb.c index 5c26b4fd9..cfce91e08 100644 --- a/ext/dba/libcdb/cdb.c +++ b/ext/dba/libcdb/cdb.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/dba/libcdb/cdb.h b/ext/dba/libcdb/cdb.h index 3530cb493..7cdca0049 100644 --- a/ext/dba/libcdb/cdb.h +++ b/ext/dba/libcdb/cdb.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/dba/libcdb/cdb_make.c b/ext/dba/libcdb/cdb_make.c index 600b8dd0f..014db032e 100644 --- a/ext/dba/libcdb/cdb_make.c +++ b/ext/dba/libcdb/cdb_make.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/dba/libcdb/cdb_make.h b/ext/dba/libcdb/cdb_make.h index 828abe031..062cffb05 100644 --- a/ext/dba/libcdb/cdb_make.h +++ b/ext/dba/libcdb/cdb_make.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/dba/libcdb/uint32.c b/ext/dba/libcdb/uint32.c index e869d512f..b56cbf26f 100644 --- a/ext/dba/libcdb/uint32.c +++ b/ext/dba/libcdb/uint32.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/dba/libcdb/uint32.h b/ext/dba/libcdb/uint32.h index 692590e22..68ea1c0cd 100644 --- a/ext/dba/libcdb/uint32.h +++ b/ext/dba/libcdb/uint32.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/dba/libflatfile/flatfile.c b/ext/dba/libflatfile/flatfile.c index bf851847d..c17a29543 100644 --- a/ext/dba/libflatfile/flatfile.c +++ b/ext/dba/libflatfile/flatfile.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/dba/libflatfile/flatfile.h b/ext/dba/libflatfile/flatfile.h index e7ce3a764..65d099fbc 100644 --- a/ext/dba/libflatfile/flatfile.h +++ b/ext/dba/libflatfile/flatfile.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/dba/libinifile/inifile.c b/ext/dba/libinifile/inifile.c index 35930d102..cd53f4adf 100644 --- a/ext/dba/libinifile/inifile.c +++ b/ext/dba/libinifile/inifile.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/dba/libinifile/inifile.h b/ext/dba/libinifile/inifile.h index e69fd08b0..5b7e377d8 100644 --- a/ext/dba/libinifile/inifile.h +++ b/ext/dba/libinifile/inifile.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/dom/documenttype.c b/ext/dom/documenttype.c index d61ba796a..eee3b5f88 100644 --- a/ext/dom/documenttype.c +++ b/ext/dom/documenttype.c @@ -205,7 +205,11 @@ int dom_documenttype_internal_subset_read(dom_object *obj, zval **retval TSRMLS_ if (buff != NULL) { xmlNodeDumpOutput (buff, NULL, (xmlNodePtr) intsubset, 0, 0, NULL); xmlOutputBufferFlush(buff); +#ifdef LIBXML2_NEW_BUFFER + ZVAL_STRINGL(*retval, xmlOutputBufferGetContent(buff), xmlOutputBufferGetSize(buff), 1); +#else ZVAL_STRINGL(*retval, buff->buffer->content, buff->buffer->use, 1); +#endif (void)xmlOutputBufferClose(buff); return SUCCESS; } diff --git a/ext/dom/domerrorhandler.c b/ext/dom/domerrorhandler.c index f1ab2871a..e282f3014 100644 --- a/ext/dom/domerrorhandler.c +++ b/ext/dom/domerrorhandler.c @@ -29,7 +29,7 @@ /* {{{ arginfo */ ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_domerrorhandler_handle_error, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, error, DOMError, 0) + ZEND_ARG_OBJ_INFO(0, error, DOMDomError, 0) ZEND_END_ARG_INFO(); /* }}} */ diff --git a/ext/dom/element.c b/ext/dom/element.c index c6a190212..02fded9f1 100644 --- a/ext/dom/element.c +++ b/ext/dom/element.c @@ -832,7 +832,7 @@ PHP_FUNCTION(dom_element_set_attribute_ns) } if (errorcode == 0 && is_xmlns == 0) { - attr = xmlSetNsProp(elemp, nsptr, (xmlChar *)localname, (xmlChar *)value); + xmlSetNsProp(elemp, nsptr, (xmlChar *)localname, (xmlChar *)value); } } else { name_valid = xmlValidateName((xmlChar *) localname, 0); @@ -844,7 +844,7 @@ PHP_FUNCTION(dom_element_set_attribute_ns) if (attr != NULL && attr->type != XML_ATTRIBUTE_DECL) { node_list_unlink(attr->children TSRMLS_CC); } - attr = xmlSetProp(elemp, (xmlChar *)localname, (xmlChar *)value); + xmlSetProp(elemp, (xmlChar *)localname, (xmlChar *)value); } } } diff --git a/ext/dom/node.c b/ext/dom/node.c index 4e58421e4..4dbce4d79 100644 --- a/ext/dom/node.c +++ b/ext/dom/node.c @@ -1895,9 +1895,17 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ RETVAL_FALSE; } else { if (mode == 0) { +#ifdef LIBXML2_NEW_BUFFER + ret = xmlOutputBufferGetSize(buf); +#else ret = buf->buffer->use; +#endif if (ret > 0) { +#ifdef LIBXML2_NEW_BUFFER + RETVAL_STRINGL((char *) xmlOutputBufferGetContent(buf), ret, 1); +#else RETVAL_STRINGL((char *) buf->buffer->content, ret, 1); +#endif } else { RETVAL_EMPTY_STRING(); } diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c index 2d784ebbe..357f3cb03 100755 --- a/ext/enchant/enchant.c +++ b/ext/enchant/enchant.c @@ -730,6 +730,7 @@ PHP_FUNCTION(enchant_dict_quick_check) if (sugg) { zval_dtor(sugg); + array_init(sugg); } PHP_ENCHANT_GET_DICT; @@ -743,8 +744,6 @@ PHP_FUNCTION(enchant_dict_quick_check) RETURN_FALSE; } - array_init(sugg); - suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg_st); memcpy(&n_sugg, &n_sugg_st, sizeof(n_sugg)); if (suggs && n_sugg) { diff --git a/ext/exif/tests/bug60150.phpt b/ext/exif/tests/bug60150.phpt index 63cf0a9da..be01998fd 100755 --- a/ext/exif/tests/bug60150.phpt +++ b/ext/exif/tests/bug60150.phpt @@ -12,7 +12,7 @@ var_dump(exif_read_data($infile)); ?> ===DONE=== --EXPECTF-- -Warning: exif_read_data(bug60150.jpg): Process tag(x9003=DateTimeOri): Illegal pointer offset(x%x + x%x = x%x > x%x) in %s on line %d +Warning: exif_read_data(bug60150.jpg): Process tag(x9003=DateTimeOri): Illegal pointer offset(%s) in %s on line %d Warning: exif_read_data(bug60150.jpg): Error reading from file: got=x%x(=%d) != itemlen-%d=x%x(=%d) in %s on line %d diff --git a/ext/fileinfo/libmagic.patch b/ext/fileinfo/libmagic.patch index 30364fb97..15f6a6dad 100644 --- a/ext/fileinfo/libmagic.patch +++ b/ext/fileinfo/libmagic.patch @@ -1,6 +1,6 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c ---- libmagic.origin/apprentice.c 2012-07-15 18:17:24.802087661 +0800 -+++ libmagic/apprentice.c 2012-07-15 18:22:49.650087425 +0800 +--- libmagic.origin/apprentice.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/apprentice.c 2012-09-11 11:36:51.000000000 +0800 @@ -29,6 +29,8 @@ * apprentice - make one pass through /etc/magic, learning its secrets. */ @@ -317,13 +317,13 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c const char *fn, int action) { - int errs = 0; -+ int errs = 0, mflen = 0; ++ int errs = 0; struct magic_entry *marray; uint32_t marraycount, i, mentrycount = 0, starttest; - size_t slen, files = 0, maxfiles = 0; - char **filearr = NULL, *mfn; + size_t files = 0, maxfiles = 0; -+ char **filearr = NULL, mfn[MAXPATHLEN]; ++ char **filearr = NULL; struct stat st; DIR *dir; struct dirent *d; @@ -341,7 +341,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c marraycount = 0; /* print silly verbose header for USG compat. */ -@@ -778,14 +773,16 @@ +@@ -778,14 +773,18 @@ (void)fprintf(stderr, "%s\n", usg_hdr); /* load directory or file */ @@ -349,6 +349,8 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c + /* FIXME: Read file names and sort them to prevent + non-determinism. See Debian bug #488562. */ + if (php_sys_stat(fn, &st) == 0 && S_ISDIR(st.st_mode)) { ++ int mflen; ++ char mfn[MAXPATHLEN]; dir = opendir(fn); if (!dir) { errs++; @@ -360,7 +362,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c file_oomem(ms, strlen(fn) + strlen(d->d_name) + 2); errs++; -@@ -793,7 +790,6 @@ +@@ -793,7 +792,6 @@ goto out; } if (stat(mfn, &st) == -1 || !S_ISREG(st.st_mode)) { @@ -368,7 +370,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c continue; } if (files >= maxfiles) { -@@ -803,20 +799,19 @@ +@@ -803,20 +801,19 @@ if ((filearr = CAST(char **, realloc(filearr, mlen))) == NULL) { file_oomem(ms, mlen); @@ -379,7 +381,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c } } - filearr[files++] = mfn; -+ filearr[files++] = estrndup(mfn, mflen); ++ filearr[files++] = estrndup(mfn, (mflen > sizeof(mfn) - 1)? sizeof(mfn) - 1: mflen); } closedir(dir); qsort(filearr, files, sizeof(*filearr), cmpstrp); @@ -391,7 +393,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c } free(filearr); } else -@@ -882,12 +877,7 @@ +@@ -882,12 +879,7 @@ for (i = 0; i < marraycount; i++) mentrycount += marray[i].cont_count; @@ -405,7 +407,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c mentrycount = 0; for (i = 0; i < marraycount; i++) { -@@ -896,9 +886,14 @@ +@@ -896,9 +888,14 @@ mentrycount += marray[i].cont_count; } out: @@ -423,7 +425,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c if (errs) { *magicp = NULL; *nmagicp = 0; -@@ -1175,14 +1170,13 @@ +@@ -1175,14 +1172,13 @@ return -1; } me = &(*mentryp)[*nmentryp - 1]; @@ -442,7 +444,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c me->mp = m = nm; me->max_count = CAST(uint32_t, cnt); } -@@ -1194,23 +1188,13 @@ +@@ -1194,23 +1190,13 @@ struct magic_entry *mp; maxmagic += ALLOC_INCR; @@ -469,7 +471,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c me->mp = m; me->max_count = ALLOC_CHUNK; } else -@@ -1353,6 +1337,10 @@ +@@ -1353,6 +1339,10 @@ if (m->type == FILE_INVALID) { if (ms->flags & MAGIC_CHECK) file_magwarn(ms, "type `%s' invalid", l); @@ -480,7 +482,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c return -1; } -@@ -1361,7 +1349,7 @@ +@@ -1361,7 +1351,7 @@ m->mask_op = 0; if (*l == '~') { @@ -489,7 +491,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c m->mask_op |= FILE_OPINVERSE; else if (ms->flags & MAGIC_CHECK) file_magwarn(ms, "'~' invalid for string types"); -@@ -1370,7 +1358,7 @@ +@@ -1370,7 +1360,7 @@ m->str_range = 0; m->str_flags = m->type == FILE_PSTRING ? PSTRING_1_LE : 0; if ((op = get_op(*l)) != -1) { @@ -498,7 +500,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c uint64_t val; ++l; m->mask_op |= op; -@@ -1558,11 +1546,6 @@ +@@ -1558,11 +1548,6 @@ if (check_format(ms, m) == -1) return -1; } @@ -510,7 +512,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c m->mimetype[0] = '\0'; /* initialise MIME type to none */ if (m->cont_level == 0) ++(*nmentryp); /* make room for next */ -@@ -2195,56 +2178,69 @@ +@@ -2195,56 +2180,69 @@ /* * handle a compiled file. @@ -603,7 +605,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c ptr = (uint32_t *)(void *)*magicp; if (*ptr != MAGICNO) { if (swap4(*ptr) != MAGICNO) { -@@ -2259,35 +2255,55 @@ +@@ -2259,35 +2257,55 @@ else version = ptr[1]; if (version != VERSIONNO) { @@ -675,7 +677,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c return -1; } -@@ -2301,42 +2317,49 @@ +@@ -2301,42 +2319,49 @@ apprentice_compile(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, const char *fn) { @@ -736,7 +738,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c return rv; } -@@ -2349,6 +2372,7 @@ +@@ -2349,6 +2374,7 @@ { const char *p, *q; char *buf; @@ -744,7 +746,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c if (strip) { if ((p = strrchr(fn, '/')) != NULL) -@@ -2370,14 +2394,14 @@ +@@ -2370,14 +2396,14 @@ q++; /* Compatibility with old code that looked in .mime */ if (ms->flags & MAGIC_MIME) { @@ -763,7 +765,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c /* Compatibility with old code that looked in .mime */ if (strstr(p, ".mime") != NULL) -@@ -2467,7 +2491,7 @@ +@@ -2467,7 +2493,7 @@ m->offset = swap4((uint32_t)m->offset); m->in_offset = swap4((uint32_t)m->in_offset); m->lineno = swap4((uint32_t)m->lineno); @@ -773,8 +775,8 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c m->str_flags = swap4(m->str_flags); } diff -u libmagic.origin/ascmagic.c libmagic/ascmagic.c ---- libmagic.origin/ascmagic.c 2012-07-15 18:17:24.762087659 +0800 -+++ libmagic/ascmagic.c 2012-07-15 18:20:42.730087520 +0800 +--- libmagic.origin/ascmagic.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/ascmagic.c 2012-09-11 11:33:55.000000000 +0800 @@ -139,10 +139,8 @@ /* malloc size is a conservative overestimate; could be improved, or at least realloced after conversion. */ @@ -799,8 +801,8 @@ diff -u libmagic.origin/ascmagic.c libmagic/ascmagic.c return rv; } diff -u libmagic.origin/cdf.c libmagic/cdf.c ---- libmagic.origin/cdf.c 2012-07-15 18:17:24.822087659 +0800 -+++ libmagic/cdf.c 2012-07-15 18:20:42.730087520 +0800 +--- libmagic.origin/cdf.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/cdf.c 2012-09-11 11:33:55.000000000 +0800 @@ -43,7 +43,17 @@ #include <err.h> #endif @@ -863,8 +865,8 @@ diff -u libmagic.origin/cdf.c libmagic/cdf.c (void)fprintf(stderr, "timestamp %s\n", buf); } else { diff -u libmagic.origin/cdf.h libmagic/cdf.h ---- libmagic.origin/cdf.h 2012-07-15 18:17:25.046087660 +0800 -+++ libmagic/cdf.h 2012-07-15 18:20:42.730087520 +0800 +--- libmagic.origin/cdf.h 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/cdf.h 2012-09-11 11:33:55.000000000 +0800 @@ -35,7 +35,7 @@ #ifndef _H_CDF_ #define _H_CDF_ @@ -901,8 +903,8 @@ diff -u libmagic.origin/cdf.h libmagic/cdf.h void cdf_swap_header(cdf_header_t *); void cdf_unpack_header(cdf_header_t *, char *); diff -u libmagic.origin/cdf_time.c libmagic/cdf_time.c ---- libmagic.origin/cdf_time.c 2012-07-15 18:17:24.734087660 +0800 -+++ libmagic/cdf_time.c 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/cdf_time.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/cdf_time.c 2012-09-11 11:33:55.000000000 +0800 @@ -96,7 +96,7 @@ } @@ -960,8 +962,8 @@ diff -u libmagic.origin/cdf_time.c libmagic/cdf_time.c static const char *ref = "Sat Apr 23 01:30:00 1977"; char *p, *q; diff -u libmagic.origin/compress.c libmagic/compress.c ---- libmagic.origin/compress.c 2012-07-15 18:17:24.730087657 +0800 -+++ libmagic/compress.c 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/compress.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/compress.c 2012-09-11 11:33:55.000000000 +0800 @@ -32,6 +32,7 @@ * uncompress(method, old, n, newch) - uncompress old into new, * using method, return sizeof new @@ -1122,9 +1124,10 @@ diff -u libmagic.origin/compress.c libmagic/compress.c } -#endif +#endif /* if PHP_FILEINFO_UNCOMPRESS */ +Only in libmagic: diff diff -u libmagic.origin/file.h libmagic/file.h ---- libmagic.origin/file.h 2012-07-15 18:17:25.046087660 +0800 -+++ libmagic/file.h 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/file.h 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/file.h 2012-09-11 11:33:55.000000000 +0800 @@ -33,11 +33,9 @@ #ifndef __file_h__ #define __file_h__ @@ -1296,8 +1299,8 @@ diff -u libmagic.origin/file.h libmagic/file.h + #endif /* __file_h__ */ diff -u libmagic.origin/fsmagic.c libmagic/fsmagic.c ---- libmagic.origin/fsmagic.c 2012-07-15 18:17:24.730087657 +0800 -+++ libmagic/fsmagic.c 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/fsmagic.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/fsmagic.c 2012-09-11 11:33:55.000000000 +0800 @@ -59,27 +59,21 @@ # define minor(dev) ((dev) & 0xff) #endif @@ -1508,10 +1511,10 @@ diff -u libmagic.origin/fsmagic.c libmagic/fsmagic.c -#else - if (file_printf(ms, "block special") == -1) - return -1; - #endif +-#endif - } - return 1; --#endif + #endif - /* TODO add code to handle V7 MUX and Blit MUX files */ + #ifdef S_IFIFO @@ -1621,8 +1624,8 @@ diff -u libmagic.origin/fsmagic.c libmagic/fsmagic.c /* diff -u libmagic.origin/funcs.c libmagic/funcs.c ---- libmagic.origin/funcs.c 2012-07-15 18:17:25.046087660 +0800 -+++ libmagic/funcs.c 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/funcs.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/funcs.c 2012-09-11 11:33:55.000000000 +0800 @@ -41,52 +41,42 @@ #if defined(HAVE_WCTYPE_H) #include <wctype.h> @@ -1916,10 +1919,9 @@ diff -u libmagic.origin/funcs.c libmagic/funcs.c + return rep_cnt; } + -Common subdirectories: libmagic.origin/.libs and libmagic/.libs diff -u libmagic.origin/magic.c libmagic/magic.c ---- libmagic.origin/magic.c 2012-07-15 18:17:25.046087660 +0800 -+++ libmagic/magic.c 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/magic.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/magic.c 2012-09-11 11:33:55.000000000 +0800 @@ -25,11 +25,6 @@ * SUCH DAMAGE. */ @@ -2296,8 +2298,8 @@ diff -u libmagic.origin/magic.c libmagic/magic.c public const char * magic_error(struct magic_set *ms) diff -u libmagic.origin/magic.h libmagic/magic.h ---- libmagic.origin/magic.h 2012-07-15 18:17:24.734087660 +0800 -+++ libmagic/magic.h 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/magic.h 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/magic.h 2012-09-11 11:33:55.000000000 +0800 @@ -85,6 +85,7 @@ const char *magic_getpath(const char *, int); @@ -2315,8 +2317,8 @@ diff -u libmagic.origin/magic.h libmagic/magic.h int magic_errno(magic_t); diff -u libmagic.origin/print.c libmagic/print.c ---- libmagic.origin/print.c 2012-07-15 18:21:02.846087501 +0800 -+++ libmagic/print.c 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/print.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/print.c 2012-09-11 11:33:55.000000000 +0800 @@ -29,6 +29,9 @@ * print.c - debugging printout routines */ @@ -2509,206 +2511,9 @@ diff -u libmagic.origin/print.c libmagic/print.c } protected const char * -diff -u libmagic.origin/print.c.rej libmagic/print.c.rej ---- libmagic.origin/print.c.rej 2012-07-15 18:17:24.762087659 +0800 -+++ libmagic/print.c.rej 2012-07-15 18:20:27.186087168 +0800 -@@ -1,12 +1,184 @@ ----- libmagic/print.c 2012-05-29 14:34:03.770376387 +0200 --+++ libmagic.orig/print.c 2012-05-29 14:40:41.710960045 +0200 --@@ -29,9 +29,6 @@ -- * print.c - debugging printout routines -- */ -+--- libmagic.orig/print.c 2012-05-29 14:40:41.710960045 +0200 -++++ libmagic/print.c 2012-05-29 14:34:03.770376387 +0200 -+@@ -48,174 +51,21 @@ - ---#include "php.h" ---#include "main/snprintf.h" -+ #define SZOF(a) (sizeof(a) / sizeof(a[0])) -+ -+-#ifndef COMPILE_ONLY -+-protected void -+-file_mdump(struct magic *m) -+-{ -+- private const char optyp[] = { FILE_OPS }; -+- -+- (void) fprintf(stderr, "%u: %.*s %u", m->lineno, -+- (m->cont_level & 7) + 1, ">>>>>>>>", m->offset); -+- -+- if (m->flag & INDIR) { -+- (void) fprintf(stderr, "(%s,", -+- /* Note: type is unsigned */ -+- (m->in_type < file_nnames) ? -+- file_names[m->in_type] : "*bad*"); -+- if (m->in_op & FILE_OPINVERSE) -+- (void) fputc('~', stderr); -+- (void) fprintf(stderr, "%c%u),", -+- ((size_t)(m->in_op & FILE_OPS_MASK) < -+- SZOF(optyp)) ? -+- optyp[m->in_op & FILE_OPS_MASK] : '?', -+- m->in_offset); -+- } -+- (void) fprintf(stderr, " %s%s", (m->flag & UNSIGNED) ? "u" : "", -+- /* Note: type is unsigned */ -+- (m->type < file_nnames) ? file_names[m->type] : "*bad*"); -+- if (m->mask_op & FILE_OPINVERSE) -+- (void) fputc('~', stderr); -+- -+- if (IS_STRING(m->type)) { -+- if (m->str_flags) { -+- (void) fputc('/', stderr); -+- if (m->str_flags & STRING_COMPACT_WHITESPACE) -+- (void) fputc(CHAR_COMPACT_WHITESPACE, stderr); -+- if (m->str_flags & STRING_COMPACT_OPTIONAL_WHITESPACE) -+- (void) fputc(CHAR_COMPACT_OPTIONAL_WHITESPACE, -+- stderr); -+- if (m->str_flags & STRING_IGNORE_LOWERCASE) -+- (void) fputc(CHAR_IGNORE_LOWERCASE, stderr); -+- if (m->str_flags & STRING_IGNORE_UPPERCASE) -+- (void) fputc(CHAR_IGNORE_UPPERCASE, stderr); -+- if (m->str_flags & REGEX_OFFSET_START) -+- (void) fputc(CHAR_REGEX_OFFSET_START, stderr); -+- if (m->str_flags & STRING_TEXTTEST) -+- (void) fputc(CHAR_TEXTTEST, stderr); -+- if (m->str_flags & STRING_BINTEST) -+- (void) fputc(CHAR_BINTEST, stderr); -+- if (m->str_flags & PSTRING_1_BE) -+- (void) fputc(CHAR_PSTRING_1_BE, stderr); -+- if (m->str_flags & PSTRING_2_BE) -+- (void) fputc(CHAR_PSTRING_2_BE, stderr); -+- if (m->str_flags & PSTRING_2_LE) -+- (void) fputc(CHAR_PSTRING_2_LE, stderr); -+- if (m->str_flags & PSTRING_4_BE) -+- (void) fputc(CHAR_PSTRING_4_BE, stderr); -+- if (m->str_flags & PSTRING_4_LE) -+- (void) fputc(CHAR_PSTRING_4_LE, stderr); -+- if (m->str_flags & PSTRING_LENGTH_INCLUDES_ITSELF) -+- (void) fputc( -+- CHAR_PSTRING_LENGTH_INCLUDES_ITSELF, -+- stderr); -+- } -+- if (m->str_range) -+- (void) fprintf(stderr, "/%u", m->str_range); -+- } -+- else { -+- if ((size_t)(m->mask_op & FILE_OPS_MASK) < SZOF(optyp)) -+- (void) fputc(optyp[m->mask_op & FILE_OPS_MASK], stderr); -+- else -+- (void) fputc('?', stderr); -+- -+- if (m->num_mask) { -+- (void) fprintf(stderr, "%.8llx", -+- (unsigned long long)m->num_mask); -+- } -+- } -+- (void) fprintf(stderr, ",%c", m->reln); -+- -+- if (m->reln != 'x') { -+- switch (m->type) { -+- case FILE_BYTE: -+- case FILE_SHORT: -+- case FILE_LONG: -+- case FILE_LESHORT: -+- case FILE_LELONG: -+- case FILE_MELONG: -+- case FILE_BESHORT: -+- case FILE_BELONG: -+- (void) fprintf(stderr, "%d", m->value.l); -+- break; -+- case FILE_BEQUAD: -+- case FILE_LEQUAD: -+- case FILE_QUAD: -+- (void) fprintf(stderr, "%" INT64_T_FORMAT "d", -+- (unsigned long long)m->value.q); -+- break; -+- case FILE_PSTRING: -+- case FILE_STRING: -+- case FILE_REGEX: -+- case FILE_BESTRING16: -+- case FILE_LESTRING16: -+- case FILE_SEARCH: -+- file_showstr(stderr, m->value.s, (size_t)m->vallen); -+- break; -+- case FILE_DATE: -+- case FILE_LEDATE: -+- case FILE_BEDATE: -+- case FILE_MEDATE: -+- (void)fprintf(stderr, "%s,", -+- file_fmttime(m->value.l, 1)); -+- break; -+- case FILE_LDATE: -+- case FILE_LELDATE: -+- case FILE_BELDATE: -+- case FILE_MELDATE: -+- (void)fprintf(stderr, "%s,", -+- file_fmttime(m->value.l, 0)); -+- break; -+- case FILE_QDATE: -+- case FILE_LEQDATE: -+- case FILE_BEQDATE: -+- (void)fprintf(stderr, "%s,", -+- file_fmttime((uint32_t)m->value.q, 1)); -+- break; -+- case FILE_QLDATE: -+- case FILE_LEQLDATE: -+- case FILE_BEQLDATE: -+- (void)fprintf(stderr, "%s,", -+- file_fmttime((uint32_t)m->value.q, 0)); -+- break; -+- case FILE_FLOAT: -+- case FILE_BEFLOAT: -+- case FILE_LEFLOAT: -+- (void) fprintf(stderr, "%G", m->value.f); -+- break; -+- case FILE_DOUBLE: -+- case FILE_BEDOUBLE: -+- case FILE_LEDOUBLE: -+- (void) fprintf(stderr, "%G", m->value.d); -+- break; -+- case FILE_DEFAULT: -+- /* XXX - do anything here? */ -+- break; -+- default: -+- (void) fputs("*bad*", stderr); -+- break; -+- } -+- } -+- (void) fprintf(stderr, ",\"%s\"]\n", m->desc); -+-} -+-#endif -+- -+ /*VARARGS*/ -+ protected void -+ file_magwarn(struct magic_set *ms, const char *f, ...) -+ { -+ va_list va; -++ char *expanded_format; -++ TSRMLS_FETCH(); -+ -+- /* cuz we use stdout for most, stderr here */ -+- (void) fflush(stdout); - - -- #include "file.h" -+- if (ms->file) -+- (void) fprintf(stderr, "%s, %lu: ", ms->file, -+- (unsigned long)ms->line); -+- (void) fprintf(stderr, "Warning: "); -+ va_start(va, f); -+- (void) vfprintf(stderr, f, va); -++ vasprintf(&expanded_format, f, va); -+ va_end(va); -+- (void) fputc('\n', stderr); -++ -++ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Warning: %s", expanded_format); -++ -++ free(expanded_format); -+ } - -- #ifndef lint -+ protected const char * diff -u libmagic.origin/readcdf.c libmagic/readcdf.c ---- libmagic.origin/readcdf.c 2012-07-15 18:17:24.734087660 +0800 -+++ libmagic/readcdf.c 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/readcdf.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/readcdf.c 2012-09-11 11:33:55.000000000 +0800 @@ -30,7 +30,11 @@ #endif @@ -2755,8 +2560,8 @@ diff -u libmagic.origin/readcdf.c libmagic/readcdf.c if ((ec = strchr(c, '\n')) != NULL) *ec = '\0'; diff -u libmagic.origin/readelf.c libmagic/readelf.c ---- libmagic.origin/readelf.c 2012-07-15 18:17:25.046087660 +0800 -+++ libmagic/readelf.c 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/readelf.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/readelf.c 2012-09-11 11:33:55.000000000 +0800 @@ -49,7 +49,7 @@ off_t, int *, int); private int doshn(struct magic_set *, int, int, int, off_t, int, size_t, @@ -2912,8 +2717,8 @@ diff -u libmagic.origin/readelf.c libmagic/readelf.c if (fstat(fd, &st) == -1) { diff -u libmagic.origin/softmagic.c libmagic/softmagic.c ---- libmagic.origin/softmagic.c 2012-07-15 18:17:24.722087658 +0800 -+++ libmagic/softmagic.c 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/softmagic.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/softmagic.c 2012-09-11 11:33:55.000000000 +0800 @@ -41,6 +41,11 @@ #include <stdlib.h> #include <time.h> diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c index 98bde27a2..d11bd159a 100644 --- a/ext/fileinfo/libmagic/apprentice.c +++ b/ext/fileinfo/libmagic/apprentice.c @@ -753,11 +753,11 @@ private int apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, const char *fn, int action) { - int errs = 0, mflen = 0; + int errs = 0; struct magic_entry *marray; uint32_t marraycount, i, mentrycount = 0, starttest; size_t files = 0, maxfiles = 0; - char **filearr = NULL, mfn[MAXPATHLEN]; + char **filearr = NULL; struct stat st; DIR *dir; struct dirent *d; @@ -776,6 +776,8 @@ apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, /* FIXME: Read file names and sort them to prevent non-determinism. See Debian bug #488562. */ if (php_sys_stat(fn, &st) == 0 && S_ISDIR(st.st_mode)) { + int mflen; + char mfn[MAXPATHLEN]; dir = opendir(fn); if (!dir) { errs++; @@ -804,7 +806,7 @@ apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, goto out; } } - filearr[files++] = estrndup(mfn, mflen); + filearr[files++] = estrndup(mfn, (mflen > sizeof(mfn) - 1)? sizeof(mfn) - 1: mflen); } closedir(dir); qsort(filearr, files, sizeof(*filearr), cmpstrp); diff --git a/ext/filter/filter_private.h b/ext/filter/filter_private.h index daa688b4a..2ec2f62fa 100644 --- a/ext/filter/filter_private.h +++ b/ext/filter/filter_private.h @@ -99,12 +99,14 @@ } \ return; \ -#define PHP_FILTER_TRIM_DEFAULT(p, len) { \ +#define PHP_FILTER_TRIM_DEFAULT(p, len) PHP_FILTER_TRIM_DEFAULT_EX(p, len, 1); + +#define PHP_FILTER_TRIM_DEFAULT_EX(p, len, return_if_empty) { \ while ((len > 0) && (*p == ' ' || *p == '\t' || *p == '\r' || *p == '\v' || *p == '\n')) { \ p++; \ len--; \ } \ - if (len < 1) { \ + if (len < 1 && return_if_empty) { \ RETURN_VALIDATION_FAILED \ } \ while (p[len-1] == ' ' || p[len-1] == '\t' || p[len-1] == '\r' || p[len-1] == '\v' || p[len-1] == '\n') { \ diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c index 5c3811ab2..4de6b83e0 100644 --- a/ext/filter/logical_filters.c +++ b/ext/filter/logical_filters.c @@ -235,12 +235,15 @@ void php_filter_boolean(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ int len = Z_STRLEN_P(value); int ret; - PHP_FILTER_TRIM_DEFAULT(str, len); + PHP_FILTER_TRIM_DEFAULT_EX(str, len, 0); /* returns true for "1", "true", "on" and "yes" * returns false for "0", "false", "off", "no", and "" * null otherwise. */ switch (len) { + case 0: + ret = 0; + break; case 1: if (*str == '1') { ret = 1; @@ -286,7 +289,7 @@ void php_filter_boolean(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ ret = -1; } - if (ret == -1) { + if (ret == -1) { RETURN_VALIDATION_FAILED } else { zval_dtor(value); diff --git a/ext/filter/tests/bug49510.phpt b/ext/filter/tests/bug49510.phpt new file mode 100644 index 000000000..3f365cc43 --- /dev/null +++ b/ext/filter/tests/bug49510.phpt @@ -0,0 +1,36 @@ +--TEST-- +#49510 boolean validation fails with FILTER_NULL_ON_FAILURE +--FILE-- +<?php +var_dump(filter_var(false, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); +var_dump(filter_var(0, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); +var_dump(filter_var("0", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); +var_dump(filter_var("off", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); +var_dump(filter_var("", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); +var_dump(filter_var("false", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); +var_dump(filter_var("no", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); + +var_dump(filter_var(true, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); +var_dump(filter_var(1, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); +var_dump(filter_var("1", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); +var_dump(filter_var("on", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); +var_dump(filter_var("yes", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); + +var_dump(filter_var("invalid", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); +?> +==DONE== +--EXPECT-- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +NULL +==DONE== diff --git a/ext/gd/libgd/xbm.c b/ext/gd/libgd/xbm.c index c83b0ad13..f4165d52b 100644 --- a/ext/gd/libgd/xbm.c +++ b/ext/gd/libgd/xbm.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/gmp/tests/022-win32.phpt b/ext/gmp/tests/022-win32.phpt deleted file mode 100644 index 7abb0e82b..000000000 --- a/ext/gmp/tests/022-win32.phpt +++ /dev/null @@ -1,90 +0,0 @@ ---TEST-- -gmp_gcdext() basic tests ---SKIPIF-- -<?php if (!extension_loaded("gmp")) print "skip"; -if(substr(PHP_OS, 0, 3) != 'WIN' ) { - die('skip windows only test'); -} -?> ---FILE-- -<?php - -$n = gmp_init("34293864345"); -$n1 = gmp_init("23434293864345"); - -$a = array( - array(123,45), - array(4341,9734), - array(23487,333), - array(-234234,-123123), - array(-100,-2234), - array(345,"34587345"), - array(345,"0"), - array("345556456",345873), - array("34545345556456","323432445873"), - array($n, $n1), - ); - -foreach ($a as $val) { - $r = gmp_gcdext($val[0],$val[1]); - var_dump(gmp_strval($r['g'])); - var_dump(gmp_strval($r['s'])); - var_dump(gmp_strval($r['t'])); -} - -var_dump(gmp_gcdext($val[0],array())); -var_dump(gmp_gcdext(array(),array())); -var_dump(gmp_gcdext(array(),array(),1)); -var_dump(gmp_gcdext(array())); -var_dump(gmp_gcdext()); - -echo "Done\n"; -?> ---EXPECTF-- -string(1) "3" -string(2) "41" -string(4) "-112" -string(1) "1" -string(4) "-805" -string(3) "359" -string(1) "3" -string(2) "32" -string(5) "-2257" -string(4) "3003" -string(3) "-10" -string(2) "19" -string(1) "2" -string(2) "67" -string(2) "-3" -string(2) "15" -string(7) "-601519" -string(1) "6" -string(3) "345" -string(1) "1" -string(1) "0" -string(1) "1" -string(5) "84319" -string(9) "-84241831" -string(1) "1" -string(12) "167180205823" -string(15) "-17856272782919" -string(3) "195" -string(15) "-23387298979862" -string(11) "34225091793" - -Warning: gmp_gcdext(): Unable to convert variable to GMP - wrong type in %s on line %d -bool(false) - -Warning: gmp_gcdext(): Unable to convert variable to GMP - wrong type in %s on line %d -bool(false) - -Warning: gmp_gcdext() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: gmp_gcdext() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: gmp_gcdext() expects exactly 2 parameters, 0 given in %s on line %d -NULL -Done - diff --git a/ext/gmp/tests/022.phpt b/ext/gmp/tests/022.phpt index f699e8283..469aa3013 100644 --- a/ext/gmp/tests/022.phpt +++ b/ext/gmp/tests/022.phpt @@ -2,9 +2,6 @@ gmp_gcdext() basic tests --SKIPIF-- <?php if (!extension_loaded("gmp")) print "skip"; -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. only for Non Windows Systems'); -} ?> --FILE-- <?php diff --git a/ext/gmp/tests/gmp_nextprime-win32.phpt b/ext/gmp/tests/gmp_nextprime-win32.phpt deleted file mode 100644 index e725315a1..000000000 --- a/ext/gmp/tests/gmp_nextprime-win32.phpt +++ /dev/null @@ -1,45 +0,0 @@ ---TEST-- -gmp_nextprime() ---SKIPIF-- -<?php if (!extension_loaded("gmp")) print "skip"; -if(substr(PHP_OS, 0, 3) != 'WIN' ) { - die('skip windows only test'); -} -?> ---FILE-- -<?php - -$n = gmp_nextprime(-1); -var_dump(gmp_strval($n)); -$n = gmp_nextprime(0); -var_dump(gmp_strval($n)); -$n = gmp_nextprime(-1000); -var_dump(gmp_strval($n)); -$n = gmp_nextprime(1000); -var_dump(gmp_strval($n)); -$n = gmp_nextprime(100000); -var_dump(gmp_strval($n)); -$n = gmp_nextprime(array()); -var_dump(gmp_strval($n)); -$n = gmp_nextprime(""); -var_dump(gmp_strval($n)); -$n = gmp_nextprime(new stdclass()); -var_dump(gmp_strval($n)); - -echo "Done\n"; -?> ---EXPECTF-- -string(1) "2" -string(1) "2" -string(4) "-997" -string(4) "1009" -string(6) "100003" - -Warning: gmp_nextprime(): Unable to convert variable to GMP - wrong type in %s on line %d -string(1) "0" -string(1) "0" - -Warning: gmp_nextprime(): Unable to convert variable to GMP - wrong type in %s on line %d -string(1) "0" -Done - diff --git a/ext/gmp/tests/gmp_nextprime.phpt b/ext/gmp/tests/gmp_nextprime.phpt index 623ccbed0..5683c8c31 100644 --- a/ext/gmp/tests/gmp_nextprime.phpt +++ b/ext/gmp/tests/gmp_nextprime.phpt @@ -2,9 +2,6 @@ gmp_nextprime() --SKIPIF-- <?php if (!extension_loaded("gmp")) print "skip"; -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. only for Non Windows Systems'); -} ?> --FILE-- <?php diff --git a/ext/intl/collator/collator_class.h b/ext/intl/collator/collator_class.h index 835abd66c..7a56dfce5 100644 --- a/ext/intl/collator/collator_class.h +++ b/ext/intl/collator/collator_class.h @@ -20,8 +20,9 @@ #include <php.h> -#include "intl_common.h" -#include "intl_error.h" +#include "../intl_common.h" +#include "../intl_error.h" +#include "../intl_data.h" #include <unicode/ucol.h> @@ -54,9 +55,7 @@ extern zend_class_entry *Collator_ce_ptr; Collator_object* co = NULL; \ intl_error_reset( NULL TSRMLS_CC ); \ -#define COLLATOR_METHOD_FETCH_OBJECT \ - co = (Collator_object *) zend_object_store_get_object( object TSRMLS_CC ); \ - intl_error_reset( COLLATOR_ERROR_P( co ) TSRMLS_CC ); \ +#define COLLATOR_METHOD_FETCH_OBJECT INTL_METHOD_FETCH_OBJECT(Collator, co) // Macro to check return value of a ucol_* function call. #define COLLATOR_CHECK_STATUS( co, msg ) \ diff --git a/ext/intl/collator/collator_create.c b/ext/intl/collator/collator_create.c index 0f0cc193e..b2a9968af 100644 --- a/ext/intl/collator/collator_create.c +++ b/ext/intl/collator/collator_create.c @@ -45,7 +45,7 @@ static void collator_ctor(INTERNAL_FUNCTION_PARAMETERS) } INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value); - co = (Collator_object *) zend_object_store_get_object( object TSRMLS_CC ); + COLLATOR_METHOD_FETCH_OBJECT; if(locale_len == 0) { locale = INTL_G(default_locale); diff --git a/ext/intl/common/common_error.c b/ext/intl/common/common_error.c index a0ee7c145..282172224 100644 --- a/ext/intl/common/common_error.c +++ b/ext/intl/common/common_error.c @@ -240,7 +240,9 @@ void intl_expose_icu_error_codes( INIT_FUNC_ARGS ) INTL_EXPOSE_CONST( U_IDNA_ACE_PREFIX_ERROR ); INTL_EXPOSE_CONST( U_IDNA_VERIFICATION_ERROR ); INTL_EXPOSE_CONST( U_IDNA_LABEL_TOO_LONG_ERROR ); +#if U_ICU_VERSION_MAJOR_NUM > 3 || U_ICU_VERSION_MAJOR_NUM == 3 && U_ICU_VERSION_MINOR_NUM >= 6 INTL_EXPOSE_CONST( U_IDNA_ZERO_LENGTH_LABEL_ERROR ); +#endif #if U_ICU_VERSION_MAJOR_NUM > 3 || U_ICU_VERSION_MAJOR_NUM == 3 && U_ICU_VERSION_MINOR_NUM >= 8 INTL_EXPOSE_CONST( U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR ); #endif diff --git a/ext/intl/dateformat/dateformat.c b/ext/intl/dateformat/dateformat.c index b399a39fc..8aded18bd 100644 --- a/ext/intl/dateformat/dateformat.c +++ b/ext/intl/dateformat/dateformat.c @@ -108,7 +108,7 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS) goto error; } - DATE_FORMAT_METHOD_FETCH_OBJECT; + DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; if (DATE_FORMAT_OBJECT(dfo) != NULL) { intl_errors_set(INTL_DATA_ERROR_P(dfo), U_ILLEGAL_ARGUMENT_ERROR, diff --git a/ext/intl/dateformat/dateformat_attr.c b/ext/intl/dateformat/dateformat_attr.c index 6131cedc9..b8c5f25e3 100644 --- a/ext/intl/dateformat/dateformat_attr.c +++ b/ext/intl/dateformat/dateformat_attr.c @@ -17,8 +17,9 @@ #include "config.h" #endif -#include "php_intl.h" -#include "intl_convert.h" +#include "../php_intl.h" +#include "dateformat_class.h" +#include "../intl_convert.h" #include "dateformat_class.h" #include "dateformat_attr.h" diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c index a9e06c147..49f316f78 100644 --- a/ext/intl/dateformat/dateformat_class.c +++ b/ext/intl/dateformat/dateformat_class.c @@ -23,6 +23,8 @@ #include "dateformat.h" #include "dateformat_attr.h" +#include <zend_exceptions.h> + zend_class_entry *IntlDateFormatter_ce_ptr = NULL; static zend_object_handlers IntlDateFormatter_handlers; @@ -88,18 +90,23 @@ zend_object_value IntlDateFormatter_object_clone(zval *object TSRMLS_DC) zend_object_handle handle = Z_OBJ_HANDLE_P(object); IntlDateFormatter_object *dfo, *new_dfo; - DATE_FORMAT_METHOD_FETCH_OBJECT; - new_obj_val = IntlDateFormatter_ce_ptr->create_object(IntlDateFormatter_ce_ptr TSRMLS_CC); + DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; + + new_obj_val = IntlDateFormatter_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC); new_dfo = (IntlDateFormatter_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC); /* clone standard parts */ zend_objects_clone_members(&new_dfo->zo, new_obj_val, &dfo->zo, handle TSRMLS_CC); /* clone formatter object */ - DATE_FORMAT_OBJECT(new_dfo) = udat_clone(DATE_FORMAT_OBJECT(dfo), &INTL_DATA_ERROR_CODE(new_dfo)); - if(U_FAILURE(INTL_DATA_ERROR_CODE(new_dfo))) { - /* set up error in case error handler is interested */ - intl_error_set( NULL, INTL_DATA_ERROR_CODE(new_dfo), "Failed to clone IntlDateFormatter object", 0 TSRMLS_CC ); - IntlDateFormatter_object_dtor(new_dfo, new_obj_val.handle TSRMLS_CC); /* free new object */ - zend_error(E_ERROR, "Failed to clone IntlDateFormatter object"); + if (dfo->datef_data.udatf != NULL) { + DATE_FORMAT_OBJECT(new_dfo) = udat_clone(DATE_FORMAT_OBJECT(dfo), &INTL_DATA_ERROR_CODE(dfo)); + if (U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) { + /* set up error in case error handler is interested */ + intl_errors_set(INTL_DATA_ERROR_P(dfo), INTL_DATA_ERROR_CODE(dfo), + "Failed to clone IntlDateFormatter object", 0 TSRMLS_CC ); + zend_throw_exception(NULL, "Failed to clone IntlDateFormatter object", 0 TSRMLS_CC); + } + } else { + zend_throw_exception(NULL, "Cannot clone unconstructed IntlDateFormatter", 0 TSRMLS_CC); } return new_obj_val; } diff --git a/ext/intl/dateformat/dateformat_class.h b/ext/intl/dateformat/dateformat_class.h index 9ad83ee3d..d58abe42f 100644 --- a/ext/intl/dateformat/dateformat_class.h +++ b/ext/intl/dateformat/dateformat_class.h @@ -38,7 +38,15 @@ extern zend_class_entry *IntlDateFormatter_ce_ptr; /* Auxiliary macros */ #define DATE_FORMAT_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(IntlDateFormatter, dfo) -#define DATE_FORMAT_METHOD_FETCH_OBJECT INTL_METHOD_FETCH_OBJECT(IntlDateFormatter, dfo) +#define DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(IntlDateFormatter, dfo) +#define DATE_FORMAT_METHOD_FETCH_OBJECT \ + DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; \ + if (dfo->datef_data.udatf == NULL) \ + { \ + intl_errors_set(&dfo->datef_data.error, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed IntlDateFormatter", 0 TSRMLS_CC); \ + RETURN_FALSE; \ + } + #define DATE_FORMAT_OBJECT(dfo) (dfo)->datef_data.udatf #endif // #ifndef DATE_FORMAT_CLASS_H diff --git a/ext/intl/formatter/formatter_class.c b/ext/intl/formatter/formatter_class.c index 28af14e5d..2246cd29a 100644 --- a/ext/intl/formatter/formatter_class.c +++ b/ext/intl/formatter/formatter_class.c @@ -24,6 +24,8 @@ #include "formatter_main.h" #include "formatter_attr.h" +#include <zend_exceptions.h> + zend_class_entry *NumberFormatter_ce_ptr = NULL; static zend_object_handlers NumberFormatter_handlers; @@ -83,18 +85,23 @@ zend_object_value NumberFormatter_object_clone(zval *object TSRMLS_DC) zend_object_handle handle = Z_OBJ_HANDLE_P(object); NumberFormatter_object *nfo, *new_nfo; - FORMATTER_METHOD_FETCH_OBJECT; - new_obj_val = NumberFormatter_ce_ptr->create_object(NumberFormatter_ce_ptr TSRMLS_CC); + FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK; + new_obj_val = NumberFormatter_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC); new_nfo = (NumberFormatter_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC); /* clone standard parts */ zend_objects_clone_members(&new_nfo->zo, new_obj_val, &nfo->zo, handle TSRMLS_CC); - /* clone formatter object */ - FORMATTER_OBJECT(new_nfo) = unum_clone(FORMATTER_OBJECT(nfo), &INTL_DATA_ERROR_CODE(new_nfo)); - if(U_FAILURE(INTL_DATA_ERROR_CODE(new_nfo))) { - /* set up error in case error handler is interested */ - intl_error_set( NULL, INTL_DATA_ERROR_CODE(new_nfo), "Failed to clone NumberFormatter object", 0 TSRMLS_CC ); - NumberFormatter_object_dtor(new_nfo, new_obj_val.handle TSRMLS_CC); /* free new object */ - zend_error(E_ERROR, "Failed to clone NumberFormatter object"); + /* clone formatter object. It may fail, the destruction code must handle this case */ + if (FORMATTER_OBJECT(nfo) != NULL) { + FORMATTER_OBJECT(new_nfo) = unum_clone(FORMATTER_OBJECT(nfo), + &INTL_DATA_ERROR_CODE(nfo)); + if (U_FAILURE(INTL_DATA_ERROR_CODE(nfo))) { + /* set up error in case error handler is interested */ + intl_errors_set(INTL_DATA_ERROR_P(nfo), INTL_DATA_ERROR_CODE(nfo), + "Failed to clone NumberFormatter object", 0 TSRMLS_CC); + zend_throw_exception(NULL, "Failed to clone NumberFormatter object", 0 TSRMLS_CC); + } + } else { + zend_throw_exception(NULL, "Cannot clone unconstructed NumberFormatter", 0 TSRMLS_CC); } return new_obj_val; } diff --git a/ext/intl/formatter/formatter_class.h b/ext/intl/formatter/formatter_class.h index cf1cb060c..958286666 100644 --- a/ext/intl/formatter/formatter_class.h +++ b/ext/intl/formatter/formatter_class.h @@ -34,8 +34,17 @@ extern zend_class_entry *NumberFormatter_ce_ptr; /* Auxiliary macros */ -#define FORMATTER_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(NumberFormatter, nfo) -#define FORMATTER_METHOD_FETCH_OBJECT INTL_METHOD_FETCH_OBJECT(NumberFormatter, nfo) -#define FORMATTER_OBJECT(nfo) (nfo)->nf_data.unum +#define FORMATTER_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(NumberFormatter, nfo) +#define FORMATTER_OBJECT(nfo) (nfo)->nf_data.unum +#define FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(NumberFormatter, nfo) +#define FORMATTER_METHOD_FETCH_OBJECT \ + FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK; \ + if (FORMATTER_OBJECT(nfo) == NULL) \ + { \ + intl_errors_set(&nfo->nf_data.error, U_ILLEGAL_ARGUMENT_ERROR, \ + "Found unconstructed NumberFormatter", 0 TSRMLS_CC); \ + RETURN_FALSE; \ + } + #endif // #ifndef FORMATTER_CLASS_H diff --git a/ext/intl/formatter/formatter_main.c b/ext/intl/formatter/formatter_main.c index 8fa17560b..5cb648332 100644 --- a/ext/intl/formatter/formatter_main.c +++ b/ext/intl/formatter/formatter_main.c @@ -47,7 +47,7 @@ static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value); object = return_value; - FORMATTER_METHOD_FETCH_OBJECT; + FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK; /* Convert pattern (if specified) to UTF-16. */ if(pattern && pattern_len) { diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index 0a01204fa..e3fb9425a 100644 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -49,7 +49,7 @@ static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) } INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value); - MSG_FORMAT_METHOD_FETCH_OBJECT; + MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; /* Convert pattern (if specified) to UTF-16. */ if(pattern && pattern_len) { diff --git a/ext/intl/msgformat/msgformat_class.c b/ext/intl/msgformat/msgformat_class.c index 8145a46f1..bb3b55f39 100644 --- a/ext/intl/msgformat/msgformat_class.c +++ b/ext/intl/msgformat/msgformat_class.c @@ -24,6 +24,8 @@ #include "msgformat.h" #include "msgformat_attr.h" +#include <zend_exceptions.h> + zend_class_entry *MessageFormatter_ce_ptr = NULL; static zend_object_handlers MessageFormatter_handlers; @@ -81,18 +83,24 @@ zend_object_value MessageFormatter_object_clone(zval *object TSRMLS_DC) zend_object_handle handle = Z_OBJ_HANDLE_P(object); MessageFormatter_object *mfo, *new_mfo; - MSG_FORMAT_METHOD_FETCH_OBJECT; - new_obj_val = MessageFormatter_ce_ptr->create_object(MessageFormatter_ce_ptr TSRMLS_CC); + MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; + new_obj_val = MessageFormatter_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC); new_mfo = (MessageFormatter_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC); /* clone standard parts */ zend_objects_clone_members(&new_mfo->zo, new_obj_val, &mfo->zo, handle TSRMLS_CC); + /* clone formatter object */ - MSG_FORMAT_OBJECT(new_mfo) = umsg_clone(MSG_FORMAT_OBJECT(mfo), &INTL_DATA_ERROR_CODE(new_mfo)); - if(U_FAILURE(INTL_DATA_ERROR_CODE(new_mfo))) { - /* set up error in case error handler is interested */ - intl_error_set( NULL, INTL_DATA_ERROR_CODE(new_mfo), "Failed to clone MessageFormatter object", 0 TSRMLS_CC ); - MessageFormatter_object_dtor(new_mfo, new_obj_val.handle TSRMLS_CC); /* free new object */ - zend_error(E_ERROR, "Failed to clone MessageFormatter object"); + if (MSG_FORMAT_OBJECT(mfo) != NULL) { + MSG_FORMAT_OBJECT(new_mfo) = umsg_clone(MSG_FORMAT_OBJECT(mfo), + &INTL_DATA_ERROR_CODE(mfo)); + + if (U_FAILURE(INTL_DATA_ERROR_CODE(mfo))) { + intl_errors_set(INTL_DATA_ERROR_P(mfo), INTL_DATA_ERROR_CODE(mfo), + "Failed to clone MessageFormatter object", 0 TSRMLS_CC); + zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Failed to clone MessageFormatter object"); + } + } else { + zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Cannot clone unconstructed MessageFormatter"); } return new_obj_val; } diff --git a/ext/intl/msgformat/msgformat_class.h b/ext/intl/msgformat/msgformat_class.h index b6b8e3322..337e04e64 100644 --- a/ext/intl/msgformat/msgformat_class.h +++ b/ext/intl/msgformat/msgformat_class.h @@ -37,7 +37,15 @@ extern zend_class_entry *MessageFormatter_ce_ptr; /* Auxiliary macros */ #define MSG_FORMAT_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(MessageFormatter, mfo) -#define MSG_FORMAT_METHOD_FETCH_OBJECT INTL_METHOD_FETCH_OBJECT(MessageFormatter, mfo) +#define MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(MessageFormatter, mfo) +#define MSG_FORMAT_METHOD_FETCH_OBJECT \ + MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; \ + if (MSG_FORMAT_OBJECT(mfo) == NULL) { \ + intl_errors_set(&mfo->mf_data.error, U_ILLEGAL_ARGUMENT_ERROR, \ + "Found unconstructed MessageFormatter", 0 TSRMLS_CC); \ + RETURN_FALSE; \ + } + #define MSG_FORMAT_OBJECT(mfo) (mfo)->mf_data.umsgf #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM < 48 diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index efe0ddd24..90e3573c1 100644 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -70,7 +70,7 @@ #include "idn/idn.h" -#if U_ICU_VERSION_MAJOR_NUM > 3 && U_ICU_VERSION_MINOR_NUM >=2 +#if U_ICU_VERSION_MAJOR_NUM * 1000 + U_ICU_VERSION_MINOR_NUM >= 4002 # include "spoofchecker/spoofchecker_class.h" # include "spoofchecker/spoofchecker.h" # include "spoofchecker/spoofchecker_create.h" @@ -646,7 +646,7 @@ PHP_MINIT_FUNCTION( intl ) /* Expose IDN constants to PHP scripts. */ idn_register_constants(INIT_FUNC_ARGS_PASSTHRU); -#if U_ICU_VERSION_MAJOR_NUM > 3 && U_ICU_VERSION_MINOR_NUM >=2 +#if U_ICU_VERSION_MAJOR_NUM * 1000 + U_ICU_VERSION_MINOR_NUM >= 4002 /* Register 'Spoofchecker' PHP class */ spoofchecker_register_Spoofchecker_class( TSRMLS_C ); diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c index 23e9449a3..a6a73f5f0 100644 --- a/ext/intl/resourcebundle/resourcebundle_class.c +++ b/ext/intl/resourcebundle/resourcebundle_class.c @@ -261,7 +261,14 @@ PHP_FUNCTION( resourcebundle_get ) /* {{{ resourcebundle_array_count */ int resourcebundle_array_count(zval *object, long *count TSRMLS_DC) { - ResourceBundle_object *rb = (ResourceBundle_object *) zend_object_store_get_object( object TSRMLS_CC); + ResourceBundle_object *rb; + RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK; + + if (rb->me == NULL) { + intl_errors_set(&rb->error, U_ILLEGAL_ARGUMENT_ERROR, + "Found unconstructed ResourceBundle", 0 TSRMLS_CC); + return 0; + } *count = ures_getSize( rb->me ); diff --git a/ext/intl/resourcebundle/resourcebundle_class.h b/ext/intl/resourcebundle/resourcebundle_class.h index 4755d723b..8da3ed9d4 100644 --- a/ext/intl/resourcebundle/resourcebundle_class.h +++ b/ext/intl/resourcebundle/resourcebundle_class.h @@ -33,7 +33,16 @@ typedef struct { } ResourceBundle_object; #define RESOURCEBUNDLE_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(ResourceBundle, rb) -#define RESOURCEBUNDLE_METHOD_FETCH_OBJECT INTL_METHOD_FETCH_OBJECT(ResourceBundle, rb) +#define RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(ResourceBundle, rb) +#define RESOURCEBUNDLE_METHOD_FETCH_OBJECT \ + INTL_METHOD_FETCH_OBJECT(ResourceBundle, rb); \ + if (RESOURCEBUNDLE_OBJECT(rb) == NULL) { \ + intl_errors_set(&rb->error, U_ILLEGAL_ARGUMENT_ERROR, \ + "Found unconstructed ResourceBundle", 0 TSRMLS_CC); \ + RETURN_FALSE; \ + } + + #define RESOURCEBUNDLE_OBJECT(rb) (rb)->me void resourcebundle_register_class( TSRMLS_D ); diff --git a/ext/intl/spoofchecker/spoofchecker_class.c b/ext/intl/spoofchecker/spoofchecker_class.c index 507a2ca98..6c2b79034 100644 --- a/ext/intl/spoofchecker/spoofchecker_class.c +++ b/ext/intl/spoofchecker/spoofchecker_class.c @@ -127,7 +127,7 @@ static zend_object_value spoofchecker_clone_obj(zval *object TSRMLS_DC) /* {{{ * sfo = (Spoofchecker_object *) zend_object_store_get_object(object TSRMLS_CC); intl_error_reset(SPOOFCHECKER_ERROR_P(sfo) TSRMLS_CC); - new_obj_val = Spoofchecker_ce_ptr->create_object(Spoofchecker_ce_ptr TSRMLS_CC); + new_obj_val = Spoofchecker_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC); new_sfo = (Spoofchecker_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC); /* clone standard parts */ zend_objects_clone_members(&new_sfo->zo, new_obj_val, &sfo->zo, handle TSRMLS_CC); diff --git a/ext/intl/spoofchecker/spoofchecker_class.h b/ext/intl/spoofchecker/spoofchecker_class.h index 8db64680e..ec043d9dc 100644 --- a/ext/intl/spoofchecker/spoofchecker_class.h +++ b/ext/intl/spoofchecker/spoofchecker_class.h @@ -22,6 +22,7 @@ #include "intl_common.h" #include "spoofchecker_create.h" #include "intl_error.h" +#include "intl_data.h" #include <unicode/uspoof.h> @@ -55,9 +56,14 @@ extern zend_class_entry *Spoofchecker_ce_ptr; Spoofchecker_object* co = NULL; \ intl_error_reset(NULL TSRMLS_CC); \ -#define SPOOFCHECKER_METHOD_FETCH_OBJECT \ - co = (Spoofchecker_object *) zend_object_store_get_object(object TSRMLS_CC); \ - intl_error_reset(SPOOFCHECKER_ERROR_P(co) TSRMLS_CC); \ +#define SPOOFCHECKER_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(Spoofchecker, co) +#define SPOOFCHECKER_METHOD_FETCH_OBJECT \ + SPOOFCHECKER_METHOD_FETCH_OBJECT_NO_CHECK; \ + if (co->uspoof == NULL) { \ + intl_errors_set(&co->err, U_ILLEGAL_ARGUMENT_ERROR, \ + "Found unconstructed Spoofchecker", 0 TSRMLS_CC); \ + RETURN_FALSE; \ + } // Macro to check return value of a ucol_* function call. #define SPOOFCHECKER_CHECK_STATUS(co, msg) \ diff --git a/ext/intl/spoofchecker/spoofchecker_create.c b/ext/intl/spoofchecker/spoofchecker_create.c index 3659551ed..cf0173f99 100644 --- a/ext/intl/spoofchecker/spoofchecker_create.c +++ b/ext/intl/spoofchecker/spoofchecker_create.c @@ -35,7 +35,7 @@ PHP_METHOD(Spoofchecker, __construct) return; } - SPOOFCHECKER_METHOD_FETCH_OBJECT; + SPOOFCHECKER_METHOD_FETCH_OBJECT_NO_CHECK; co->uspoof = uspoof_open(SPOOFCHECKER_ERROR_CODE_P(co)); INTL_CTOR_CHECK_STATUS(co, "spoofchecker: unable to open ICU Spoof Checker"); diff --git a/ext/intl/tests/bug59597_64.phpt b/ext/intl/tests/bug59597_64.phpt index f96c72da5..eb70995a2 100644 --- a/ext/intl/tests/bug59597_64.phpt +++ b/ext/intl/tests/bug59597_64.phpt @@ -18,4 +18,3 @@ var_dump($value); --EXPECT-- int(2147483647) int(2147483650) - diff --git a/ext/intl/tests/bug62915-2.phpt b/ext/intl/tests/bug62915-2.phpt new file mode 100644 index 000000000..bcb069cab --- /dev/null +++ b/ext/intl/tests/bug62915-2.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #62915: cloning of several classes is defective +--SKIPIF-- +<?php +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- +<?php +class A extends IntlDateFormatter { + static $ARGS = array("en_US" ,IntlDateFormatter::FULL, IntlDateFormatter::FULL, + 'America/Los_Angeles', IntlDateFormatter::GREGORIAN); +} +class B extends NumberFormatter { + static $ARGS = array('de_DE', NumberFormatter::DECIMAL); +} +class C extends MessageFormatter { + static $ARGS = array("en_US", "foo"); +} +class D extends Spoofchecker { + static $ARGS = array(); +} + +foreach (range('A', 'D') as $subclass) { + $rc = new ReflectionClass($subclass); + $obj = $rc->newInstanceArgs($subclass::$ARGS); + $clone = clone $obj; + var_dump(get_class($clone)); +} +--EXPECT-- +string(1) "A" +string(1) "B" +string(1) "C" +string(1) "D" diff --git a/ext/intl/tests/dateformat_clone_bad_obj.phpt b/ext/intl/tests/dateformat_clone_bad_obj.phpt new file mode 100644 index 000000000..5e12b96ae --- /dev/null +++ b/ext/intl/tests/dateformat_clone_bad_obj.phpt @@ -0,0 +1,20 @@ +--TEST-- +Cloning unconstructed IntlDateFormatter +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + +class A extends IntlDateFormatter { + function __construct() {} +} + +$a = new A; +try { + $b = clone $a; +} catch (Exception $e) { + var_dump($e->getMessage()); +} + +--EXPECTF-- +string(%s) "Cannot clone unconstructed IntlDateFormatter" diff --git a/ext/intl/tests/formatter_clone_bad_obj.phpt b/ext/intl/tests/formatter_clone_bad_obj.phpt new file mode 100644 index 000000000..ef7b28a54 --- /dev/null +++ b/ext/intl/tests/formatter_clone_bad_obj.phpt @@ -0,0 +1,20 @@ +--TEST-- +Cloning unconstructed numfmt +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + +class A extends NumberFormatter { + function __construct() {} +} + +$a = new A; +try { + $b = clone $a; +} catch (Exception $e) { + var_dump($e->getMessage()); +} + +--EXPECTF-- +string(42) "Cannot clone unconstructed NumberFormatter" diff --git a/ext/intl/tests/msgfmt_clone_bad_obj.phpt b/ext/intl/tests/msgfmt_clone_bad_obj.phpt new file mode 100644 index 000000000..48321094d --- /dev/null +++ b/ext/intl/tests/msgfmt_clone_bad_obj.phpt @@ -0,0 +1,20 @@ +--TEST-- +Cloning unconstructed MessageFormatter +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + +class A extends MessageFormatter { + function __construct() {} +} + +$a = new A; +try { + $b = clone $a; +} catch (Exception $e) { + var_dump($e->getMessage()); +} + +--EXPECTF-- +string(%d) "Cannot clone unconstructed MessageFormatter" diff --git a/ext/intl/tests/symfony_format_type_double_intl1.phpt b/ext/intl/tests/symfony_format_type_double_intl1.phpt new file mode 100644 index 000000000..13a7ad761 --- /dev/null +++ b/ext/intl/tests/symfony_format_type_double_intl1.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #1 +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + + +// PHP Unit's code to unserialize data passed as args to #testFormatTypeDoubleIntl +$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:1:"1";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeDoubleIntl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + int(1) + [2]=> + string(1) "1" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_double_intl2.phpt b/ext/intl/tests/symfony_format_type_double_intl2.phpt new file mode 100644 index 000000000..6bff7cc35 --- /dev/null +++ b/ext/intl/tests/symfony_format_type_double_intl2.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #2 +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + + +// PHP Unit's code to unserialize data passed as args to #testFormatTypeDoubleIntl +$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:3:"1.1";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeDoubleIntl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(1.1) + [2]=> + string(3) "1.1" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_double_intl3.phpt b/ext/intl/tests/symfony_format_type_double_intl3.phpt new file mode 100644 index 000000000..3b0d576df --- /dev/null +++ b/ext/intl/tests/symfony_format_type_double_intl3.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #3 +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + + +// PHP Unit's code to unserialize data passed as args to #testFormatTypeDoubleIntl +$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:7:"SFD1.00";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeDoubleIntl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + int(1) + [2]=> + string(7) "SFD1.00" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_double_intl4.phpt b/ext/intl/tests/symfony_format_type_double_intl4.phpt new file mode 100644 index 000000000..3476e1089 --- /dev/null +++ b/ext/intl/tests/symfony_format_type_double_intl4.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #4 +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + + +// PHP Unit's code to unserialize data passed as args to #testFormatTypeDoubleIntl +$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:7:"SFD1.10";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeDoubleIntl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(1.1) + [2]=> + string(7) "SFD1.10" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int32_intl1.phpt b/ext/intl/tests/symfony_format_type_int32_intl1.phpt new file mode 100644 index 000000000..2867b3569 --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int32_intl1.phpt @@ -0,0 +1,49 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #1 +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + +// port of Symfony's Symfony\Component\Locale\Tests\Stub\StubNumberFormatterTest#testFormatTypeInt32Intl + + +// Crashes on Windows +// Windows note: the popup '...program has stopped working'(AEDebug Popup) +// doesn't always show if you're rapidly running this test repeatedly. +// regardless of that, the test always crashes every time. +// (it will show up the first time, or if you wait a while before running it again.) +// (the popup may also be disabled, which can be done with a registry setting.) +// you can confirm it crashed by checking the exit code OR +// the message this test prints at the very end (expected output for pass). +// +// Get Exit Code +// Linux: echo $? +// Windows: echo %ErrorLevel% + + + + + +// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl +$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:1:"1";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt32Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + int(1) + [2]=> + string(1) "1" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int32_intl2.phpt b/ext/intl/tests/symfony_format_type_int32_intl2.phpt new file mode 100644 index 000000000..6a65a0a80 --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int32_intl2.phpt @@ -0,0 +1,33 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #2 +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + +// StubNumberFormatterTest#testFormatTypeInt32Intl is tested many times, each with different args. +// there are 7 sets of args that crash PHP (and other args that don't), each of those 7 is now a separate PHPT test +// to ensure that each of the 7 args are always tested. + +// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl +$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:1:"1";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt32Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(1.1) + [2]=> + string(1) "1" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int32_intl3.phpt b/ext/intl/tests/symfony_format_type_int32_intl3.phpt new file mode 100644 index 000000000..5e657db41 --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int32_intl3.phpt @@ -0,0 +1,32 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #3 +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + + +// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl +$unit_test_args = unserialize('a:4:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483648;i:2;s:14:"-2,147,483,648";i:3;s:83:"->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt32Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(4) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(2147483648) + [2]=> + string(14) "-2,147,483,648" + [3]=> + string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range." +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int32_intl4.phpt b/ext/intl/tests/symfony_format_type_int32_intl4.phpt new file mode 100644 index 000000000..54043d92e --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int32_intl4.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #4 +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + + +// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl +$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:7:"SFD1.00";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt32Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + int(1) + [2]=> + string(7) "SFD1.00" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int32_intl5.phpt b/ext/intl/tests/symfony_format_type_int32_intl5.phpt new file mode 100644 index 000000000..d5f78d711 --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int32_intl5.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #5 +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + + +// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl +$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:7:"SFD1.00";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt32Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(1.1) + [2]=> + string(7) "SFD1.00" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int32_intl6.phpt b/ext/intl/tests/symfony_format_type_int32_intl6.phpt new file mode 100644 index 000000000..fa708799d --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int32_intl6.phpt @@ -0,0 +1,32 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #6 +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + + +// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl +$unit_test_args = unserialize('a:4:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483648;i:2;s:21:"(SFD2,147,483,648.00)";i:3;s:83:"->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt32Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(4) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(2147483648) + [2]=> + string(21) "(SFD2,147,483,648.00)" + [3]=> + string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range." +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int32_intl7.phpt b/ext/intl/tests/symfony_format_type_int32_intl7.phpt new file mode 100644 index 000000000..5bbe42667 --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int32_intl7.phpt @@ -0,0 +1,32 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #7 +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + + +// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl +$unit_test_args = unserialize('a:4:{i:0;O:15:"NumberFormatter":0:{}i:1;d:-2147483649;i:2;s:19:"SFD2,147,483,647.00";i:3;s:83:"->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt32Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(4) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(-2147483649) + [2]=> + string(19) "SFD2,147,483,647.00" + [3]=> + string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range." +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int64_intl1.phpt b/ext/intl/tests/symfony_format_type_int64_intl1.phpt new file mode 100644 index 000000000..01f582091 --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int64_intl1.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #1 +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + + +// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl +$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:1:"1";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt64Intl +//$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + int(1) + [2]=> + string(1) "1" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int64_intl2.phpt b/ext/intl/tests/symfony_format_type_int64_intl2.phpt new file mode 100644 index 000000000..13d1cdaee --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int64_intl2.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #2 +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + + +// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl +$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:1:"1";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt64Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(1.1) + [2]=> + string(1) "1" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int64_intl3.phpt b/ext/intl/tests/symfony_format_type_int64_intl3.phpt new file mode 100644 index 000000000..a7c80b34c --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int64_intl3.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #3 +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + + +// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl +$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483648;i:2;s:13:"2,147,483,648";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt64Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(2147483648) + [2]=> + string(13) "2,147,483,648" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int64_intl4.phpt b/ext/intl/tests/symfony_format_type_int64_intl4.phpt new file mode 100644 index 000000000..f1a0801ed --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int64_intl4.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #4 +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + + +// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl +$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:-2147483649;i:2;s:14:"-2,147,483,649";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt64Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(-2147483649) + [2]=> + string(14) "-2,147,483,649" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int64_intl5.phpt b/ext/intl/tests/symfony_format_type_int64_intl5.phpt new file mode 100644 index 000000000..dad8735b8 --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int64_intl5.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #5 +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + + +// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl +$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:7:"SFD1.00";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt64Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + int(1) + [2]=> + string(7) "SFD1.00" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int64_intl6.phpt b/ext/intl/tests/symfony_format_type_int64_intl6.phpt new file mode 100644 index 000000000..f038cbd0c --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int64_intl6.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #6 +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + + +// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl +$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:7:"SFD1.00";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt64Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(1.1) + [2]=> + string(7) "SFD1.00" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int64_intl7.phpt b/ext/intl/tests/symfony_format_type_int64_intl7.phpt new file mode 100644 index 000000000..9c8853caf --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int64_intl7.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #7 +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + + +// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl +$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483648;i:2;s:19:"SFD2,147,483,648.00";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt64Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(2147483648) + [2]=> + string(19) "SFD2,147,483,648.00" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int64_intl8.phpt b/ext/intl/tests/symfony_format_type_int64_intl8.phpt new file mode 100644 index 000000000..50524976a --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int64_intl8.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #8 +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + + +// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl +$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:-2147483649;i:2;s:21:"(SFD2,147,483,649.00)";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt64Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(-2147483649) + [2]=> + string(21) "(SFD2,147,483,649.00)" +} +== didn't crash == diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c index 8d4d0649e..5ef80fb48 100644 --- a/ext/intl/transliterator/transliterator_class.c +++ b/ext/intl/transliterator/transliterator_class.c @@ -162,7 +162,7 @@ static zend_object_value Transliterator_clone_obj( zval *object TSRMLS_DC ) to_orig = zend_object_store_get_object( object TSRMLS_CC ); intl_error_reset( INTL_DATA_ERROR_P( to_orig ) TSRMLS_CC ); - ret_val = Transliterator_ce_ptr->create_object( Transliterator_ce_ptr TSRMLS_CC ); + ret_val = Transliterator_ce_ptr->create_object( Z_OBJCE_P( object ) TSRMLS_CC ); to_new = zend_object_store_get_object_by_handle( ret_val.handle TSRMLS_CC ); zend_objects_clone_members( &to_new->zo, ret_val, diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 0d2b53a7c..76654edbf 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -2715,9 +2715,10 @@ PHP_FUNCTION(mb_substr) char *str, *encoding; long from, len; int mblen, str_len, encoding_len; + zval **z_len = NULL; mbfl_string string, result, *ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|ls", &str, &str_len, &from, &len, &encoding, &encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|Zs", &str, &str_len, &from, &z_len, &encoding, &encoding_len) == FAILURE) { return; } @@ -2736,8 +2737,11 @@ PHP_FUNCTION(mb_substr) string.val = (unsigned char *)str; string.len = str_len; - if (argc < 3) { + if (argc < 3 || Z_TYPE_PP(z_len) == IS_NULL) { len = str_len; + } else { + convert_to_long_ex(z_len); + len = Z_LVAL_PP(z_len); } /* measures length */ @@ -2788,13 +2792,14 @@ PHP_FUNCTION(mb_strcut) char *encoding; long from, len; int encoding_len; + zval **z_len = NULL; mbfl_string string, result, *ret; mbfl_string_init(&string); string.no_language = MBSTRG(language); string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|ls", (char **)&string.val, (int **)&string.len, &from, &len, &encoding, &encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|Zs", (char **)&string.val, (int **)&string.len, &from, &z_len, &encoding, &encoding_len) == FAILURE) { return; } @@ -2806,8 +2811,11 @@ PHP_FUNCTION(mb_strcut) } } - if (argc < 3) { + if (argc < 3 || Z_TYPE_PP(z_len) == IS_NULL) { len = string.len; + } else { + convert_to_long_ex(z_len); + len = Z_LVAL_PP(z_len); } /* if "from" position is negative, count start position from the end diff --git a/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt b/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt index e4a235df3..5fb642f9b 100644 --- a/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt +++ b/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt @@ -28,5 +28,3 @@ baz baz foo ==DONE== ---XFAIL-- -mb functions fail to allow null instead of actual value diff --git a/ext/mcrypt/tests/mcrypt_cbf.phpt b/ext/mcrypt/tests/mcrypt_cfb.phpt index 8ec3cd7d3..54919c858 100644 --- a/ext/mcrypt/tests/mcrypt_cbf.phpt +++ b/ext/mcrypt/tests/mcrypt_cfb.phpt @@ -1,5 +1,5 @@ --TEST-- -mcrypt_cbf +mcrypt_cfb --SKIPIF-- <?php if (!extension_loaded("mcrypt")) print "skip"; ?> --FILE-- @@ -8,7 +8,7 @@ $key = "FooBar"; $secret = "PHP Testfest 2008"; $cipher = MCRYPT_RIJNDAEL_128; -$iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_ECB), MCRYPT_RAND); +$iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_CFB), MCRYPT_RAND); $enc_data = mcrypt_cfb($cipher, $key, $secret, MCRYPT_ENCRYPT, $iv); // we have to trim as AES rounds the blocks and decrypt doesnt detect that @@ -20,4 +20,4 @@ mcrypt_cfb($cipher, $key, $enc_data, MCRYPT_DECRYPT); --EXPECTF-- PHP Testfest 2008 -Warning: mcrypt_cfb(): Attempt to use an empty IV, which is NOT recommend in %s on line %d
\ No newline at end of file +Warning: mcrypt_cfb(): Attempt to use an empty IV, which is NOT recommend in %s on line %d diff --git a/ext/mcrypt/tests/mcrypt_create_iv.phpt b/ext/mcrypt/tests/mcrypt_create_iv.phpt index cf6456fef..1aa48868b 100644 --- a/ext/mcrypt/tests/mcrypt_create_iv.phpt +++ b/ext/mcrypt/tests/mcrypt_create_iv.phpt @@ -5,13 +5,13 @@ mcrypt_create_iv --FILE-- <?php $iv1 = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB), MCRYPT_RAND); -$iv2 = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_192, MCRYPT_MODE_ECB), MCRYPT_DEV_URANDOM); -$iv3 = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_DEV_RANDOM); +$iv2 = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB), MCRYPT_DEV_URANDOM); +$iv3 = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB), MCRYPT_DEV_RANDOM); echo strlen($iv1) . "\n"; echo strlen($iv2) . "\n"; echo strlen($iv3) . "\n"; --EXPECT-- 16 -24 -32 +16 +16 diff --git a/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt b/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt index 339d36c93..aa15f5ca1 100644 --- a/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt +++ b/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt @@ -2,7 +2,6 @@ LOAD DATA INFILE - open_basedir --SKIPIF-- <?php -@include_once("connect.inc"); include_once('skipif.inc'); include_once('skipifconnectfailure.inc'); diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index 0cc124020..7e1b9355d 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -781,6 +781,11 @@ PHP_FUNCTION(mysqli_poll) RETURN_FALSE; } + if (!r_array && !e_array) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "No stream arrays were passed"); + RETURN_FALSE; + } + if (r_array != NULL) { mysqlnd_zval_array_to_mysqlnd_array(r_array, &new_r_array TSRMLS_CC); } diff --git a/ext/mysqli/tests/bug62885.phpt b/ext/mysqli/tests/bug62885.phpt new file mode 100644 index 000000000..9fb0aa0f0 --- /dev/null +++ b/ext/mysqli/tests/bug62885.phpt @@ -0,0 +1,26 @@ +--TEST--
+Bug #62885 (mysqli_poll - Segmentation fault)
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once("connect.inc");
+if (!$IS_MYSQLND) {
+ die("skip mysqlnd only test");
+}
+?>
+--FILE--
+<?php
+error_reporting(E_ALL);
+$tablica = array();
+$test1 = mysqli_poll($test2, $test3, $tablica, null);
+
+$test2 = array();
+$test2 = array();
+$test1 = mysqli_poll($test2, $test3, $tablica, null);
+echo "okey";
+?>
+--EXPECTF--
+Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
+
+Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
+okey
diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4 index 0634e9628..976eb9e84 100644 --- a/ext/oci8/config.m4 +++ b/ext/oci8/config.m4 @@ -49,8 +49,8 @@ AC_DEFUN([AC_OCI8_CHECK_LIB_DIR],[ AC_DEFUN([AC_OCI8IC_VERSION],[ AC_MSG_CHECKING([Oracle Instant Client library version compatibility]) OCI8_LCS_BASE=$PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME - OCI8_LCS=`ls $OCI8_LCS_BASE.*.1 2> /dev/null | tail -1` # Oracle 10g, 11g etc - OCI8_NNZ=`ls $PHP_OCI8_INSTANT_CLIENT/libnnz*.$SHLIB_SUFFIX_NAME 2> /dev/null | tail -1` + OCI8_LCS=`ls $OCI8_LCS_BASE.*.1 2> /dev/null | tail -n1` # Oracle 10g, 11g etc + OCI8_NNZ=`ls $PHP_OCI8_INSTANT_CLIENT/libnnz*.$SHLIB_SUFFIX_NAME 2> /dev/null | tail -n1` if test -f "$OCI8_NNZ" && test -f "$OCI8_LCS"; then if test ! -f "$OCI8_LCS_BASE"; then AC_MSG_ERROR([Link from $OCI8_LCS_BASE to $OCI8_LCS_BASE.*.1 not found]) @@ -65,7 +65,7 @@ AC_DEFUN([AC_OCI8IC_VERSION],[ AC_DEFUN([AC_OCI8_ORACLE_VERSION],[ AC_MSG_CHECKING([Oracle library version compatibility]) OCI8_LCS_BASE=$OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME - OCI8_LCS=`ls $OCI8_LCS_BASE.*.1 2> /dev/null | tail -1` # Oracle 10g, 11g etc + OCI8_LCS=`ls $OCI8_LCS_BASE.*.1 2> /dev/null | tail -n1` # Oracle 10g, 11g etc if test -s "$OCI8_DIR/orainst/unix.rgs"; then OCI8_ORACLE_VERSION=`grep '"ocommon"' $OCI8_DIR/orainst/unix.rgs | $PHP_OCI8_SED 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4` test -z "$OCI8_ORACLE_VERSION" && OCI8_ORACLE_VERSION=7.3 @@ -278,7 +278,7 @@ if test "$PHP_OCI8" != "no"; then dnl user must pass in the library directory. But on Linux we default dnl to the most recent version in /usr/lib which is where the Oracle dnl Instant Client RPM gets installed. - PHP_OCI8_INSTANT_CLIENT=`ls -d /usr/lib/oracle/*/client${PHP_OCI8_IC_LIBDIR_SUFFIX}/lib/libclntsh.* 2> /dev/null | tail -1 | $PHP_OCI8_SED -e 's#/libclntsh[^/]*##'` + PHP_OCI8_INSTANT_CLIENT=`ls -d /usr/lib/oracle/*/client${PHP_OCI8_IC_LIBDIR_SUFFIX}/lib/libclntsh.* 2> /dev/null | tail -n1 | $PHP_OCI8_SED -e 's#/libclntsh[^/]*##'` if test -z "$PHP_OCI8_INSTANT_CLIENT"; then AC_MSG_ERROR([Oracle Instant Client directory /usr/lib/oracle/.../client${PHP_OCI8_IC_LIBDIR_SUFFIX}/lib libraries not found. Try --with-oci8=instantclient,DIR]) fi diff --git a/ext/oci8/package.xml b/ext/oci8/package.xml index d3a912832..eac3f0655 100644 --- a/ext/oci8/package.xml +++ b/ext/oci8/package.xml @@ -37,8 +37,8 @@ http://pear.php.net/dtd/package-2.0.xsd"> <time>12:00:00</time> <version> - <release>1.4.7</release> - <api>1.4.7</api> + <release>1.4.8</release> + <api>1.4.8</api> </version> <stability> <release>stable</release> @@ -46,11 +46,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> </stability> <license uri="http://www.php.net/license">PHP</license> <notes> - Fixed bug #59985 (show normal warning text for OCI_NO_DATA) - Fixed OCI8 part of bug #55748 (CVE-2011-4153: multiple NULL pointer dereferences with zend_strndup) - Fixed OCI8 part of bug #55301 (multiple null pointer dereferences with calloc) - Increased maximum Oracle error message buffer length for new Oracle 11.2.0.3 size - Improve internal initalization failure error messages + Fixed bug #60901 (Improve "tail" syntax for AIX installation) </notes> <contents> <dir name="/"> @@ -416,6 +412,25 @@ http://pear.php.net/dtd/package-2.0.xsd"> <release> <version> + <release>1.4.7</release> + <api>1.4.7</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <license uri="http://www.php.net/license">PHP</license> + <notes> + Fixed bug #59985 (show normal warning text for OCI_NO_DATA) + Fixed OCI8 part of bug #55748 (CVE-2011-4153: multiple NULL pointer dereferences with zend_strndup) + Fixed OCI8 part of bug #55301 (multiple null pointer dereferences with calloc) + Increased maximum Oracle error message buffer length for new Oracle 11.2.0.3 size + Improve internal initalization failure error messages + </notes> +</release> + +<release> + <version> <release>1.4.6</release> <api>1.4.6</api> </version> diff --git a/ext/oci8/tests/bind_char_2_11gR1.phpt b/ext/oci8/tests/bind_char_2_11gR1.phpt index 8bb28733f..edb2a12ff 100644 --- a/ext/oci8/tests/bind_char_2_11gR1.phpt +++ b/ext/oci8/tests/bind_char_2_11gR1.phpt @@ -5,7 +5,7 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR and dates if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -if (preg_match('/Release 11\.1\./', $sv, $matches) !== 1) { +if (preg_match('/Release 11\.1\./', oci_server_version($c), $matches) !== 1) { if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); } diff --git a/ext/oci8/tests/bind_char_3_11gR1.phpt b/ext/oci8/tests/bind_char_3_11gR1.phpt index 4c6241ccf..fea77754d 100644 --- a/ext/oci8/tests/bind_char_3_11gR1.phpt +++ b/ext/oci8/tests/bind_char_3_11gR1.phpt @@ -5,7 +5,7 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to CHAR parameter if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -if (preg_match('/Release 11\.1\./', $sv, $matches) !== 1) { +if (preg_match('/Release 11\.1\./', oci_server_version($c), $matches) !== 1) { if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); } diff --git a/ext/oci8/tests/bind_char_4_11gR1.phpt b/ext/oci8/tests/bind_char_4_11gR1.phpt index 14d587885..2bc2f1424 100644 --- a/ext/oci8/tests/bind_char_4_11gR1.phpt +++ b/ext/oci8/tests/bind_char_4_11gR1.phpt @@ -5,7 +5,7 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to VARCHAR2 parameter if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -if (preg_match('/Release 11\.1\./', $sv, $matches) !== 1) { +if (preg_match('/Release 11\.1\./', oci_server_version($c), $matches) !== 1) { if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); } diff --git a/ext/oci8/tests/details.inc b/ext/oci8/tests/details.inc index 0f03c3a65..9a86c4686 100644 --- a/ext/oci8/tests/details.inc +++ b/ext/oci8/tests/details.inc @@ -45,31 +45,34 @@ if (file_exists(dirname(__FILE__)."/details_local.inc")) { * Used for creating/dropping schema objects used by a test */ -function oci8_test_sql_execute($c, $stmtarray) -{ - foreach ($stmtarray as $stmt) { - $s = oci_parse($c, $stmt); - if (!$s) { - $m = oci_error($c); - echo $stmt . PHP_EOL . $m['message'] . PHP_EOL; - } - else { - $r = @oci_execute($s); - if (!$r) { - $m = oci_error($s); - if (!in_array($m['code'], array( // ignore expected errors - 942 // table or view does not exist - , 1918 // user does not exist - , 2024 // database link not found - , 2289 // sequence does not exist - , 4080 // trigger does not exist - , 38802 // edition does not exist - ))) { - echo $stmt . PHP_EOL . $m['message'] . PHP_EOL; - } - } - } - } +if (!function_exists('oci8_test_sql_execute')) { + function oci8_test_sql_execute($c, $stmtarray) + { + foreach ($stmtarray as $stmt) { + $s = oci_parse($c, $stmt); + if (!$s) { + $m = oci_error($c); + echo $stmt . PHP_EOL . $m['message'] . PHP_EOL; + } + else { + $r = @oci_execute($s); + if (!$r) { + $m = oci_error($s); + if (!in_array($m['code'], array( // ignore expected errors + 942 // table or view does not exist + , 1918 // user does not exist + , 2024 // database link not found + , 2289 // sequence does not exist + , 4080 // trigger does not exist + , 38802 // edition does not exist + ))) { + echo $stmt . PHP_EOL . $m['message'] . PHP_EOL; + } + } + } + } + } + } ?> diff --git a/ext/oci8/tests/pecl_bug10194_blob.phpt b/ext/oci8/tests/pecl_bug10194_blob.phpt index faf87ab3c..96f94bcf4 100644 --- a/ext/oci8/tests/pecl_bug10194_blob.phpt +++ b/ext/oci8/tests/pecl_bug10194_blob.phpt @@ -6,6 +6,9 @@ $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on t require(dirname(__FILE__).'/skipif.inc'); if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only"); if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request'); +if (getenv("USE_ZEND_ALLOC") === "0") { + die("skip Zend MM disabled"); +} ?> --INI-- memory_limit=3M diff --git a/ext/oci8/tests/xmltype_01.phpt b/ext/oci8/tests/xmltype_01.phpt index 21aca6cc1..ebbbb31fa 100644 --- a/ext/oci8/tests/xmltype_01.phpt +++ b/ext/oci8/tests/xmltype_01.phpt @@ -5,6 +5,7 @@ Basic XMLType test if (!extension_loaded("simplexml")) die("skip no simplexml extension"); $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- <?php diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 7187a9601..2b8cfd571 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -69,7 +69,13 @@ #define OPENSSL_ALGO_MD2 4 #endif #define OPENSSL_ALGO_DSS1 5 - +#if OPENSSL_VERSION_NUMBER >= 0x0090708fL +#define OPENSSL_ALGO_SHA224 6 +#define OPENSSL_ALGO_SHA256 7 +#define OPENSSL_ALGO_SHA384 8 +#define OPENSSL_ALGO_SHA512 9 +#define OPENSSL_ALGO_RMD160 10 +#endif #define DEBUG_SMIME 0 /* FIXME: Use the openssl constants instead of @@ -954,6 +960,23 @@ static EVP_MD * php_openssl_get_evp_md_from_algo(long algo) { /* {{{ */ case OPENSSL_ALGO_DSS1: mdtype = (EVP_MD *) EVP_dss1(); break; +#if OPENSSL_VERSION_NUMBER >= 0x0090708fL + case OPENSSL_ALGO_SHA224: + mdtype = (EVP_MD *) EVP_sha224(); + break; + case OPENSSL_ALGO_SHA256: + mdtype = (EVP_MD *) EVP_sha256(); + break; + case OPENSSL_ALGO_SHA384: + mdtype = (EVP_MD *) EVP_sha384(); + break; + case OPENSSL_ALGO_SHA512: + mdtype = (EVP_MD *) EVP_sha512(); + break; + case OPENSSL_ALGO_RMD160: + mdtype = (EVP_MD *) EVP_ripemd160(); + break; +#endif default: return NULL; break; @@ -1048,6 +1071,13 @@ PHP_MINIT_FUNCTION(openssl) REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD2", OPENSSL_ALGO_MD2, CONST_CS|CONST_PERSISTENT); #endif REGISTER_LONG_CONSTANT("OPENSSL_ALGO_DSS1", OPENSSL_ALGO_DSS1, CONST_CS|CONST_PERSISTENT); +#if OPENSSL_VERSION_NUMBER >= 0x0090708fL + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA224", OPENSSL_ALGO_SHA224, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA256", OPENSSL_ALGO_SHA256, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA384", OPENSSL_ALGO_SHA384, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA512", OPENSSL_ALGO_SHA512, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_RMD160", OPENSSL_ALGO_RMD160, CONST_CS|CONST_PERSISTENT); +#endif /* flags for S/MIME */ REGISTER_LONG_CONSTANT("PKCS7_DETACHED", PKCS7_DETACHED, CONST_CS|CONST_PERSISTENT); diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index c9d707280..f61364cde 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -275,7 +275,8 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le get to the end without encountering a delimiter. */ while (isspace((int)*(unsigned char *)p)) p++; if (*p == 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty regular expression"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, + p < regex + regex_len ? "Null byte in regex" : "Empty regular expression"); return NULL; } @@ -292,21 +293,18 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le delimiter = pp[5]; end_delimiter = delimiter; + pp = p; + if (start_delimiter == end_delimiter) { /* We need to iterate through the pattern, searching for the ending delimiter, but skipping the backslashed delimiters. If the ending delimiter is not found, display a warning. */ - pp = p; while (*pp != 0) { if (*pp == '\\' && pp[1] != 0) pp++; else if (*pp == delimiter) break; pp++; } - if (*pp == 0) { - php_error_docref(NULL TSRMLS_CC,E_WARNING, "No ending delimiter '%c' found", delimiter); - return NULL; - } } else { /* We iterate through the pattern, searching for the matching ending * delimiter. For each matching starting delimiter, we increment nesting @@ -314,7 +312,6 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le * reach the end of the pattern without matching, display a warning. */ int brackets = 1; /* brackets nesting level */ - pp = p; while (*pp != 0) { if (*pp == '\\' && pp[1] != 0) pp++; else if (*pp == end_delimiter && --brackets <= 0) @@ -323,10 +320,17 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le brackets++; pp++; } - if (*pp == 0) { - php_error_docref(NULL TSRMLS_CC,E_WARNING, "No ending matching delimiter '%c' found", end_delimiter); - return NULL; + } + + if (*pp == 0) { + if (pp < regex + regex_len) { + php_error_docref(NULL TSRMLS_CC,E_WARNING, "Null byte in regex"); + } else if (start_delimiter == end_delimiter) { + php_error_docref(NULL TSRMLS_CC,E_WARNING, "No ending delimiter '%c' found", delimiter); + } else { + php_error_docref(NULL TSRMLS_CC,E_WARNING, "No ending matching delimiter '%c' found", delimiter); } + return NULL; } /* Make a copy of the actual pattern. */ @@ -337,7 +341,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le /* Parse through the options, setting appropriate flags. Display a warning if we encounter an unknown modifier. */ - while (*pp != 0) { + while (pp < regex + regex_len) { switch (*pp++) { /* Perl compatible options */ case 'i': coptions |= PCRE_CASELESS; break; @@ -368,7 +372,11 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le break; default: - php_error_docref(NULL TSRMLS_CC,E_WARNING, "Unknown modifier '%c'", pp[-1]); + if (pp[-1]) { + php_error_docref(NULL TSRMLS_CC,E_WARNING, "Unknown modifier '%c'", pp[-1]); + } else { + php_error_docref(NULL TSRMLS_CC,E_WARNING, "Null byte in regex"); + } efree(pattern); return NULL; } diff --git a/ext/pcre/tests/null_bytes.phpt b/ext/pcre/tests/null_bytes.phpt new file mode 100644 index 000000000..9a3f433ff --- /dev/null +++ b/ext/pcre/tests/null_bytes.phpt @@ -0,0 +1,42 @@ +--TEST-- +Zero byte test +--FILE-- +<?php + +preg_match("\0//i", ""); +preg_match("/\0/i", ""); +preg_match("//\0i", ""); +preg_match("//i\0", ""); +preg_match("/\\\0/i", ""); + +preg_match("\0[]i", ""); +preg_match("[\0]i", ""); +preg_match("[]\0i", ""); +preg_match("[]i\0", ""); +preg_match("[\\\0]i", ""); + +preg_replace("/foo/e\0/i", "echo('Eek');", ""); + +?> +--EXPECTF-- +Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 3 + +Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 4 + +Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 5 + +Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 6 + +Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 7 + +Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 9 + +Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 10 + +Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 11 + +Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 12 + +Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 13 + +Warning: preg_replace(): Null byte in regex in %snull_bytes.php on line 15 diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index b4f383c94..acdc0dd90 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -700,7 +700,7 @@ static PHP_METHOD(PDO, inTransaction) RETURN_BOOL(dbh->in_txn); } - RETURN_LONG(dbh->methods->in_transaction(dbh TSRMLS_CC)); + RETURN_BOOL(dbh->methods->in_transaction(dbh TSRMLS_CC)); } /* }}} */ diff --git a/ext/pdo/tests/bug_43130.phpt b/ext/pdo/tests/bug_43130.phpt index a35138a07..70f888711 100644 --- a/ext/pdo/tests/bug_43130.phpt +++ b/ext/pdo/tests/bug_43130.phpt @@ -8,6 +8,7 @@ if (false == $dir) die('skip no driver'); if (!strncasecmp(getenv('PDOTEST_DSN'), 'sqlite', strlen('sqlite'))) die('skip not relevant for sqlite driver'); if (!strncasecmp(getenv('PDOTEST_DSN'), 'pgsql', strlen('pgsql'))) die('skip not relevant for pgsql driver'); if (!strncasecmp(getenv('PDOTEST_DSN'), 'oci', strlen('oci'))) die('skip not relevant for oci driver - Hyphen is not legal for bind names in Oracle DB'); +if (!strncasecmp(getenv('PDOTEST_DSN'), 'firebird', strlen('firebird'))) die('skip not relevant for firebird driver'); require_once $dir . 'pdo_test.inc'; PDOTest::skip(); ?> diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 2a47d3d03..cc7eac717 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -2647,11 +2647,8 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert, len = -len; } user_stub = 0; -#if PHP_MAJOR_VERSION >= 6 - if (!(len = php_stream_copy_to_mem(stubfile, (void **) &user_stub, len, 0)) || !user_stub) { -#else + if (!(len = php_stream_copy_to_mem(stubfile, &user_stub, len, 0)) || !user_stub) { -#endif if (closeoldfile) { php_stream_close(oldfile); } diff --git a/ext/phar/phar/pharcommand.inc b/ext/phar/phar/pharcommand.inc index 9e968694c..cb343675b 100755 --- a/ext/phar/phar/pharcommand.inc +++ b/ext/phar/phar/pharcommand.inc @@ -91,7 +91,7 @@ class PharCommand extends CLICommand 'h' => array( 'typ' => 'select', 'val' => NULL, - 'inf' => '<method> Selects the hash algorithmn.', + 'inf' => '<method> Selects the hash algorithm.', 'select' => array('md5' => 'MD5','sha1' => 'SHA1') ), 'i' => array( @@ -107,7 +107,7 @@ class PharCommand extends CLICommand 'l' => array( 'typ' => 'int', 'val' => 0, - 'inf' => '<level> Number of preceeding subdirectories to strip from file entries', + 'inf' => '<level> Number of preceding subdirectories to strip from file entries', ), 'm' => array( 'typ' => 'any', @@ -461,7 +461,7 @@ class PharCommand extends CLICommand 'typ' => 'any', 'val' => NULL, 'required' => 1, - 'inf' => ' Any number of input files and directories. If -i is in use then ONLY files and matching thegiven regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.', + 'inf' => ' Any number of input files and directories. If -i is in use then ONLY files and matching the given regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.', ); return $args; @@ -981,7 +981,7 @@ class PharCommand extends CLICommand 'type' => 'any', 'val' => NULL, 'required' => 1, - 'inf' => ' Any number of input files and directories. If -i is in use then ONLY files and matching thegiven regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.', + 'inf' => ' Any number of input files and directories. If -i is in use then ONLY files and matching the given regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.', ); return $args; } diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index de9fffc11..561ba7bf2 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -58,9 +58,6 @@ static int phar_file_type(HashTable *mimes, char *file, char **mime_type TSRMLS_ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char *basename, int request_uri_len TSRMLS_DC) /* {{{ */ { -#if PHP_MAJOR_VERSION >= 6 - int is_unicode = 0; -#endif HashTable *_SERVER; zval **stuff; char *path_info; @@ -76,18 +73,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char _SERVER = Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]); /* PATH_INFO and PATH_TRANSLATED should always be munged */ -#if PHP_MAJOR_VERSION >= 6 - if (phar_find_key(_SERVER, "PATH_INFO", sizeof("PATH_INFO"), (void **) &stuff TSRMLS_CC)) { - if (Z_TYPE_PP(stuff) == IS_UNICODE) { - is_unicode = 1; - zval_unicode_to_string(*stuff TSRMLS_CC); - } else { - is_unicode = 0; - } -#else if (SUCCESS == zend_hash_find(_SERVER, "PATH_INFO", sizeof("PATH_INFO"), (void **) &stuff)) { -#endif - path_info = Z_STRVAL_PP(stuff); code = Z_STRLEN_PP(stuff); @@ -96,38 +82,19 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char MAKE_STD_ZVAL(temp); ZVAL_STRINGL(temp, path_info, code, 0); -#if PHP_MAJOR_VERSION >= 6 - if (is_unicode) { - zval_string_to_unicode(*stuff TSRMLS_CC); - } -#endif + zend_hash_update(_SERVER, "PHAR_PATH_INFO", sizeof("PHAR_PATH_INFO"), &temp, sizeof(zval **), NULL); } } -#if PHP_MAJOR_VERSION >= 6 - if (phar_find_key(_SERVER, "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"), (void **) &stuff TSRMLS_CC)) { - if (Z_TYPE_PP(stuff) == IS_UNICODE) { - is_unicode = 1; - zval_unicode_to_string(*stuff TSRMLS_CC); - } else { - is_unicode = 0; - } -#else if (SUCCESS == zend_hash_find(_SERVER, "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"), (void **) &stuff)) { -#endif - path_info = Z_STRVAL_PP(stuff); code = Z_STRLEN_PP(stuff); Z_STRLEN_PP(stuff) = spprintf(&(Z_STRVAL_PP(stuff)), 4096, "phar://%s%s", fname, entry); MAKE_STD_ZVAL(temp); ZVAL_STRINGL(temp, path_info, code, 0); -#if PHP_MAJOR_VERSION >= 6 - if (is_unicode) { - zval_string_to_unicode(*stuff TSRMLS_CC); - } -#endif + zend_hash_update(_SERVER, "PHAR_PATH_TRANSLATED", sizeof("PHAR_PATH_TRANSLATED"), (void *) &temp, sizeof(zval **), NULL); } @@ -136,18 +103,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char } if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_REQUEST_URI) { -#if PHP_MAJOR_VERSION >= 6 - if (phar_find_key(_SERVER, "REQUEST_URI", sizeof("REQUEST_URI"), (void **) &stuff TSRMLS_CC)) { - if (Z_TYPE_PP(stuff) == IS_UNICODE) { - is_unicode = 1; - zval_unicode_to_string(*stuff TSRMLS_CC); - } else { - is_unicode = 0; - } -#else if (SUCCESS == zend_hash_find(_SERVER, "REQUEST_URI", sizeof("REQUEST_URI"), (void **) &stuff)) { -#endif - path_info = Z_STRVAL_PP(stuff); code = Z_STRLEN_PP(stuff); @@ -156,29 +112,14 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char MAKE_STD_ZVAL(temp); ZVAL_STRINGL(temp, path_info, code, 0); -#if PHP_MAJOR_VERSION >= 6 - if (is_unicode) { - zval_string_to_unicode(*stuff TSRMLS_CC); - } -#endif + zend_hash_update(_SERVER, "PHAR_REQUEST_URI", sizeof("PHAR_REQUEST_URI"), (void *) &temp, sizeof(zval **), NULL); } } } if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_PHP_SELF) { -#if PHP_MAJOR_VERSION >= 6 - if (phar_find_key(_SERVER, "PHP_SELF", sizeof("PHP_SELF"), (void **) &stuff TSRMLS_CC)) { - if (Z_TYPE_PP(stuff) == IS_UNICODE) { - is_unicode = 1; - zval_unicode_to_string(*stuff TSRMLS_CC); - } else { - is_unicode = 0; - } -#else if (SUCCESS == zend_hash_find(_SERVER, "PHP_SELF", sizeof("PHP_SELF"), (void **) &stuff)) { -#endif - path_info = Z_STRVAL_PP(stuff); code = Z_STRLEN_PP(stuff); @@ -187,68 +128,34 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char MAKE_STD_ZVAL(temp); ZVAL_STRINGL(temp, path_info, code, 0); -#if PHP_MAJOR_VERSION >= 6 - if (is_unicode) { - zval_string_to_unicode(*stuff TSRMLS_CC); - } -#endif + zend_hash_update(_SERVER, "PHAR_PHP_SELF", sizeof("PHAR_PHP_SELF"), (void *) &temp, sizeof(zval **), NULL); } } } if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_SCRIPT_NAME) { -#if PHP_MAJOR_VERSION >= 6 - if (phar_find_key(_SERVER, "SCRIPT_NAME", sizeof("SCRIPT_NAME"), (void **) &stuff TSRMLS_CC)) { - if (Z_TYPE_PP(stuff) == IS_UNICODE) { - is_unicode = 1; - zval_unicode_to_string(*stuff TSRMLS_CC); - } else { - is_unicode = 0; - } -#else if (SUCCESS == zend_hash_find(_SERVER, "SCRIPT_NAME", sizeof("SCRIPT_NAME"), (void **) &stuff)) { -#endif - path_info = Z_STRVAL_PP(stuff); code = Z_STRLEN_PP(stuff); ZVAL_STRINGL(*stuff, entry, entry_len, 1); MAKE_STD_ZVAL(temp); ZVAL_STRINGL(temp, path_info, code, 0); -#if PHP_MAJOR_VERSION >= 6 - if (is_unicode) { - zval_string_to_unicode(*stuff TSRMLS_CC); - } -#endif + zend_hash_update(_SERVER, "PHAR_SCRIPT_NAME", sizeof("PHAR_SCRIPT_NAME"), (void *) &temp, sizeof(zval **), NULL); } } if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_SCRIPT_FILENAME) { -#if PHP_MAJOR_VERSION >= 6 - if (phar_find_key(_SERVER, "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME"), (void **) &stuff TSRMLS_CC)) { - if (Z_TYPE_PP(stuff) == IS_UNICODE) { - is_unicode = 1; - zval_unicode_to_string(*stuff TSRMLS_CC); - } else { - is_unicode = 0; - } -#else if (SUCCESS == zend_hash_find(_SERVER, "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME"), (void **) &stuff)) { -#endif - path_info = Z_STRVAL_PP(stuff); code = Z_STRLEN_PP(stuff); Z_STRLEN_PP(stuff) = spprintf(&(Z_STRVAL_PP(stuff)), 4096, "phar://%s%s", fname, entry); MAKE_STD_ZVAL(temp); ZVAL_STRINGL(temp, path_info, code, 0); -#if PHP_MAJOR_VERSION >= 6 - if (is_unicode) { - zval_string_to_unicode(*stuff TSRMLS_CC); - } -#endif + zend_hash_update(_SERVER, "PHAR_SCRIPT_FILENAME", sizeof("PHAR_SCRIPT_FILENAME"), (void *) &temp, sizeof(zval **), NULL); } } @@ -942,11 +849,7 @@ PHP_METHOD(Phar, webPhar) if (ext) { ++ext; -#if PHP_MAJOR_VERSION >= 6 - if (phar_find_key(Z_ARRVAL_P(mimeoverride), ext, strlen(ext)+1, (void **) &val TSRMLS_CC)) { -#else if (SUCCESS == zend_hash_find(Z_ARRVAL_P(mimeoverride), ext, strlen(ext)+1, (void **) &val)) { -#endif switch (Z_TYPE_PP(val)) { case IS_LONG: if (Z_LVAL_PP(val) == PHAR_MIME_PHP || Z_LVAL_PP(val) == PHAR_MIME_PHPS) { @@ -960,11 +863,6 @@ PHP_METHOD(Phar, webPhar) RETURN_FALSE; } break; -#if PHP_MAJOR_VERSION >= 6 - case IS_UNICODE: - zval_unicode_to_string(*(val) TSRMLS_CC); - /* break intentionally omitted */ -#endif case IS_STRING: mime_type = Z_STRVAL_PP(val); code = PHAR_MIME_OTHER; @@ -1015,26 +913,12 @@ PHP_METHOD(Phar, mungServer) for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(mungvalues)); SUCCESS == zend_hash_has_more_elements(Z_ARRVAL_P(mungvalues)); zend_hash_move_forward(Z_ARRVAL_P(mungvalues))) { zval **data = NULL; -#if PHP_MAJOR_VERSION >= 6 - zval *unicopy = NULL; -#endif if (SUCCESS != zend_hash_get_current_data(Z_ARRVAL_P(mungvalues), (void **) &data)) { zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "unable to retrieve array value in Phar::mungServer()"); return; } -#if PHP_MAJOR_VERSION >= 6 - if (Z_TYPE_PP(data) == IS_UNICODE) { - MAKE_STD_ZVAL(unicopy); - *unicopy = **data; - zval_copy_ctor(unicopy); - INIT_PZVAL(unicopy); - zval_unicode_to_string(unicopy TSRMLS_CC); - data = &unicopy; - } -#endif - if (Z_TYPE_PP(data) != IS_STRING) { zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Non-string value passed to Phar::mungServer(), expecting an array of any of these strings: PHP_SELF, REQUEST_URI, SCRIPT_FILENAME, SCRIPT_NAME"); return; @@ -1056,11 +940,6 @@ PHP_METHOD(Phar, mungServer) if (Z_STRLEN_PP(data) == sizeof("SCRIPT_FILENAME")-1 && !strncmp(Z_STRVAL_PP(data), "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME")-1)) { PHAR_GLOBALS->phar_SERVER_mung_list |= PHAR_MUNG_SCRIPT_FILENAME; } -#if PHP_MAJOR_VERSION >= 6 - if (unicopy) { - zval_ptr_dtor(&unicopy); - } -#endif } } /* }}} */ @@ -5037,11 +4916,7 @@ PHP_METHOD(PharFileInfo, getContent) phar_seek_efp(link, 0, SEEK_SET, 0, 0 TSRMLS_CC); Z_TYPE_P(return_value) = IS_STRING; -#if PHP_MAJOR_VERSION >= 6 - Z_STRLEN_P(return_value) = php_stream_copy_to_mem(fp, (void **) &(Z_STRVAL_P(return_value)), link->uncompressed_filesize, 0); -#else Z_STRLEN_P(return_value) = php_stream_copy_to_mem(fp, &(Z_STRVAL_P(return_value)), link->uncompressed_filesize, 0); -#endif if (!Z_STRVAL_P(return_value)) { Z_STRVAL_P(return_value) = estrndup("", 0); diff --git a/ext/phar/stream.c b/ext/phar/stream.c index 2f7255126..bf0913d68 100644 --- a/ext/phar/stream.c +++ b/ext/phar/stream.c @@ -207,30 +207,19 @@ static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, char *pat fpf = php_stream_alloc(&phar_ops, idata, NULL, mode); php_url_free(resource); efree(internal_file); -#if PHP_MAJOR_VERSION >= 6 - if (context && context->options && phar_find_key(HASH_OF(context->options), "phar", sizeof("phar"), (void**)&pzoption TSRMLS_CC)) { -#else + if (context && context->options && zend_hash_find(HASH_OF(context->options), "phar", sizeof("phar"), (void**)&pzoption) == SUCCESS) { -#endif pharcontext = HASH_OF(*pzoption); if (idata->internal_file->uncompressed_filesize == 0 && idata->internal_file->compressed_filesize == 0 -#if PHP_MAJOR_VERSION >= 6 - && phar_find_key(pharcontext, "compress", sizeof("compress"), (void**)&pzoption TSRMLS_CC) -#else && zend_hash_find(pharcontext, "compress", sizeof("compress"), (void**)&pzoption) == SUCCESS -#endif && Z_TYPE_PP(pzoption) == IS_LONG && (Z_LVAL_PP(pzoption) & ~PHAR_ENT_COMPRESSION_MASK) == 0 ) { idata->internal_file->flags &= ~PHAR_ENT_COMPRESSION_MASK; idata->internal_file->flags |= Z_LVAL_PP(pzoption); } -#if PHP_MAJOR_VERSION >= 6 - if (phar_find_key(pharcontext, "metadata", sizeof("metadata"), (void**)&pzoption TSRMLS_CC)) { -#else if (zend_hash_find(pharcontext, "metadata", sizeof("metadata"), (void**)&pzoption) == SUCCESS) { -#endif if (idata->internal_file->metadata) { zval_ptr_dtor(&idata->internal_file->metadata); idata->internal_file->metadata = NULL; diff --git a/ext/phar/tar.c b/ext/phar/tar.c index 917734c99..43d1ede23 100644 --- a/ext/phar/tar.c +++ b/ext/phar/tar.c @@ -986,11 +986,8 @@ int phar_tar_flush(phar_archive_data *phar, char *user_stub, long len, int defau len = -len; } user_stub = 0; -#if PHP_MAJOR_VERSION >= 6 - if (!(len = php_stream_copy_to_mem(stubfile, (void **) &user_stub, len, 0)) || !user_stub) { -#else + if (!(len = php_stream_copy_to_mem(stubfile, &user_stub, len, 0)) || !user_stub) { -#endif if (error) { spprintf(error, 0, "unable to read resource to copy stub to new tar-based phar \"%s\"", phar->fname); } diff --git a/ext/phar/util.c b/ext/phar/util.c index d5b6a5dd1..5fcb2b657 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -210,8 +210,6 @@ int phar_mount_entry(phar_archive_data *phar, char *filename, int filename_len, return FAILURE; } #endif - - filename_len = strlen(entry.tmp); filename = entry.tmp; /* only check openbasedir for files, not for phar streams */ diff --git a/ext/phar/zip.c b/ext/phar/zip.c index ced975cb3..337262255 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -603,11 +603,7 @@ foundit: php_stream_filter_append(&fp->readfilters, filter); -#if PHP_MAJOR_VERSION >= 6 - if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, (void **) &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { -#else if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { -#endif pefree(entry.filename, entry.is_persistent); #if PHP_VERSION_ID < 50207 PHAR_ZIP_FAIL("unable to read in alias, truncated (PHP 5.2.7 and newer has a potential fix for this problem)"); @@ -628,11 +624,7 @@ foundit: php_stream_filter_append(&fp->readfilters, filter); -#if PHP_MAJOR_VERSION >= 6 - if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, (void **) &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { -#else if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { -#endif pefree(entry.filename, entry.is_persistent); #if PHP_VERSION_ID < 50207 PHAR_ZIP_FAIL("unable to read in alias, truncated (PHP 5.2.7 and newer has a potential fix for this problem)"); @@ -643,11 +635,7 @@ foundit: php_stream_filter_flush(filter, 1); php_stream_filter_remove(filter, 1 TSRMLS_CC); } else { -#if PHP_MAJOR_VERSION >= 6 - if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, (void **) &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { -#else if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { -#endif pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL("unable to read in alias, truncated"); } @@ -1252,11 +1240,7 @@ int phar_zip_flush(phar_archive_data *phar, char *user_stub, long len, int defau user_stub = 0; -#if PHP_MAJOR_VERSION >= 6 - if (!(len = php_stream_copy_to_mem(stubfile, (void **) &user_stub, len, 0)) || !user_stub) { -#else if (!(len = php_stream_copy_to_mem(stubfile, &user_stub, len, 0)) || !user_stub) { -#endif if (error) { spprintf(error, 0, "unable to read resource to copy stub to new zip-based phar \"%s\"", phar->fname); } diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index bcdcdaeea..7c9981924 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1477,11 +1477,6 @@ static parameter_reference *_reflection_param_get_default_param(INTERNAL_FUNCTIO return NULL; } - if (param->offset < param->required) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Parameter is not optional"); - return NULL; - } - return param; } /* }}} */ @@ -1497,7 +1492,7 @@ static zend_op *_reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAMETERS precv = _get_recv_op((zend_op_array*)param->fptr, param->offset); if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2_type == IS_UNUSED) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Internal error"); + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Internal error: Failed to retrieve the default value"); return NULL; } @@ -2568,9 +2563,7 @@ ZEND_METHOD(reflection_parameter, isDefaultValueAvailable) { RETURN_FALSE; } - if (param->offset < param->required) { - RETURN_FALSE; - } + precv = _get_recv_op((zend_op_array*)param->fptr, param->offset); if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2_type == IS_UNUSED) { RETURN_FALSE; @@ -4471,8 +4464,10 @@ ZEND_METHOD(reflection_class, getTraitAliases) int method_name_len; zend_trait_method_reference *cur_ref = ce->trait_aliases[i]->trait_method; - method_name_len = spprintf(&method_name, 0, "%s::%s", cur_ref->class_name, cur_ref->method_name); - add_assoc_stringl_ex(return_value, ce->trait_aliases[i]->alias, ce->trait_aliases[i]->alias_len + 1, method_name, method_name_len, 0); + if (ce->trait_aliases[i]->alias) { + method_name_len = spprintf(&method_name, 0, "%s::%s", cur_ref->class_name, cur_ref->method_name); + add_assoc_stringl_ex(return_value, ce->trait_aliases[i]->alias, ce->trait_aliases[i]->alias_len + 1, method_name, method_name_len, 0); + } i++; } } diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt index 984b06efe..a2c2d2458 100644 --- a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt +++ b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt @@ -18,8 +18,6 @@ foreach($reflect->getParameters() as $param) { } } ?> -==DONE== --EXPECT-- -Parameter is not optional +Internal error: Failed to retrieve the default value CONST_TEST_1 -==DONE== diff --git a/ext/reflection/tests/bug62715.phpt b/ext/reflection/tests/bug62715.phpt new file mode 100644 index 000000000..feb67f614 --- /dev/null +++ b/ext/reflection/tests/bug62715.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong result) +--FILE-- +<?php + +function test(PDO $a = null, $b = 0, array $c) {} +$r = new ReflectionFunction('test'); + +foreach ($r->getParameters() as $p) { + var_dump($p->isDefaultValueAvailable()); +} + +foreach ($r->getParameters() as $p) { + if ($p->isDefaultValueAvailable()) { + var_dump($p->getDefaultValue()); + } +} +?> +--EXPECT-- +bool(true) +bool(true) +bool(false) +NULL +int(0) diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c index 2ff5302f7..84a28d342 100644 --- a/ext/session/mod_user.c +++ b/ext/session/mod_user.c @@ -63,7 +63,7 @@ static zval *ps_call_handler(zval *func, int argc, zval **argv TSRMLS_DC) } #define STDVARS \ - zval *retval; \ + zval *retval = NULL; \ int ret = FAILURE #define PSF(a) PS(mod_user_names).name.ps_##a @@ -99,6 +99,7 @@ PS_OPEN_FUNC(user) PS_CLOSE_FUNC(user) { + zend_bool bailout = 0; STDVARS; if (!PS(mod_user_implemented)) { @@ -106,9 +107,21 @@ PS_CLOSE_FUNC(user) return SUCCESS; } - retval = ps_call_handler(PSF(close), 0, NULL TSRMLS_CC); + zend_try { + retval = ps_call_handler(PSF(close), 0, NULL TSRMLS_CC); + } zend_catch { + bailout = 1; + } zend_end_try(); + PS(mod_user_implemented) = 0; + if (bailout) { + if (retval) { + zval_ptr_dtor(&retval); + } + zend_bailout(); + } + FINISH; } diff --git a/ext/session/tests/bug60634_error_5.phpt b/ext/session/tests/bug60634_error_5.phpt index 376b65f20..8081ab988 100644 --- a/ext/session/tests/bug60634_error_5.phpt +++ b/ext/session/tests/bug60634_error_5.phpt @@ -1,7 +1,5 @@ --TEST-- Bug #60634 (Segmentation fault when trying to die() in SessionHandler::write()) - fatal error in close during exec ---XFAIL-- -Long term low priority bug, working on it --INI-- session.save_path= session.name=PHPSESSID diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 7236b8a1b..5514f0fc8 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -1417,7 +1417,11 @@ 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); +#else RETVAL_STRINGL((char *)outbuf->buffer->content, outbuf->buffer->use, 1); +#endif xmlOutputBufferClose(outbuf); } } else { diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 84d603b59..5addec4ff 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -1818,11 +1818,12 @@ static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, zval * zend_hash_internal_pointer_reset_ex(model->u.content, &pos); while (zend_hash_get_current_data_ex(model->u.content, (void**)&tmp, &pos) == SUCCESS) { - if (!model_to_xml_object(node, *tmp, object, style, (*tmp)->min_occurs > 0 TSRMLS_CC)) { - if ((*tmp)->min_occurs > 0) { + if (!model_to_xml_object(node, *tmp, object, style, strict && ((*tmp)->min_occurs > 0) TSRMLS_CC)) { + if (!strict || (*tmp)->min_occurs > 0) { return 0; } } + strict = 1; zend_hash_move_forward_ex(model->u.content, &pos); } return 1; @@ -1845,7 +1846,7 @@ static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, zval * return ret; } case XSD_CONTENT_GROUP: { - return model_to_xml_object(node, model->u.group->model, object, style, model->min_occurs > 0 TSRMLS_CC); + return model_to_xml_object(node, model->u.group->model, object, style, strict && model->min_occurs > 0 TSRMLS_CC); } default: break; diff --git a/ext/soap/tests/bugs/bug50997.phpt b/ext/soap/tests/bugs/bug50997.phpt new file mode 100644 index 000000000..0508aaccd --- /dev/null +++ b/ext/soap/tests/bugs/bug50997.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #50997 (SOAP Error when trying to submit 2nd Element of a choice) +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--INI-- +soap.wsdl_cache_enabled=0 +--FILE-- +<?php +$soapClient = new SoapClient(__DIR__ . '/bug50997.wsdl', array('trace' => 1, 'exceptions'=>0)); +$params = array('code'=>'foo'); +$soapClient->newOperation($params); +echo $soapClient->__getLastRequest(); +?> +--EXPECT-- +<?xml version="1.0" encoding="UTF-8"?> +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.example.org/service2/"><SOAP-ENV:Body><ns1:NewOperation><code>foo</code></ns1:NewOperation></SOAP-ENV:Body></SOAP-ENV:Envelope> diff --git a/ext/soap/tests/bugs/bug50997.wsdl b/ext/soap/tests/bugs/bug50997.wsdl new file mode 100644 index 000000000..16c6d3675 --- /dev/null +++ b/ext/soap/tests/bugs/bug50997.wsdl @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.example.org/service2/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="service2" targetNamespace="http://www.example.org/service2/"> + <wsdl:types> + <xsd:schema targetNamespace="http://www.example.org/service2/"> + <xsd:element name="NewOperation"> + <xsd:complexType> + <xsd:choice> + <xsd:sequence> + <xsd:element name="firstName" type="xsd:string"> </xsd:element> + <xsd:element name="surName" type="xsd:string"/> + </xsd:sequence> + <xsd:element name="code" type="xsd:string"/> + </xsd:choice> + </xsd:complexType> + </xsd:element> + <xsd:element name="NewOperationResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="out" type="xsd:string"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:schema> + </wsdl:types> + <wsdl:message name="NewOperationRequest"> + <wsdl:part element="tns:NewOperation" name="parameters"/> + </wsdl:message> + <wsdl:message name="NewOperationResponse"> + <wsdl:part element="tns:NewOperationResponse" name="parameters"/> + </wsdl:message> + <wsdl:portType name="service2"> + <wsdl:operation name="NewOperation"> + <wsdl:input message="tns:NewOperationRequest"/> + <wsdl:output message="tns:NewOperationResponse"/> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="service2SOAP" type="tns:service2"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> + <wsdl:operation name="NewOperation"> + <soap:operation soapAction="http://www.example.org/service2/NewOperation"/> + <wsdl:input> + <soap:body use="literal"/> + </wsdl:input> + <wsdl:output> + <soap:body use="literal"/> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="service2"> + <wsdl:port binding="tns:service2SOAP" name="service2SOAP"> + <soap:address location="test://"/> + </wsdl:port> + </wsdl:service> + </wsdl:definitions> diff --git a/ext/sockets/multicast.h b/ext/sockets/multicast.h index ccd9b1d2a..5619c9c7f 100644 --- a/ext/sockets/multicast.h +++ b/ext/sockets/multicast.h @@ -19,11 +19,12 @@ /* $Id$ */ #if defined(MCAST_JOIN_GROUP) && \ - (!defined(PHP_WIN32) || (_WIN32_WINNT >= 0x600 && SOCKETS_ENABLE_VISTA_API)) + (!defined(PHP_WIN32) || (_WIN32_WINNT >= 0x600 && SOCKETS_ENABLE_VISTA_API)) && \ + !defined(__APPLE__) #define RFC3678_API 1 /* has block/unblock and source membership, in this case for both IPv4 and IPv6 */ #define HAS_MCAST_EXT 1 -#elif defined(IP_ADD_SOURCE_MEMBERSHIP) +#elif defined(IP_ADD_SOURCE_MEMBERSHIP) && !defined(__APPLE__) /* has block/unblock and source membership, but only for IPv4 */ #define HAS_MCAST_EXT 1 #endif diff --git a/ext/sockets/tests/bug63000.phpt b/ext/sockets/tests/bug63000.phpt new file mode 100644 index 000000000..c806ba4c0 --- /dev/null +++ b/ext/sockets/tests/bug63000.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #63000: Multicast on OSX +--SKIPIF-- +<?php +if (!extension_loaded('sockets')) { + die('skip sockets extension not available.'); +} +if (PHP_OS !== 'Darwin') { + die('is not OSX.'); +} +--FILE-- +<?php +$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); +socket_bind($socket, '0.0.0.0', 31057); + +$so = socket_set_option($socket, IPPROTO_IP, MCAST_JOIN_GROUP, array( + "group" => '224.0.0.251', + "interface" => 0, +)); +var_dump($so); +--EXPECTF-- +bool(true) diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index e2ea17a3f..3c6b41edb 100755 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -58,6 +58,10 @@ PHPAPI zend_class_entry *spl_ce_RecursiveArrayIterator; #define SPL_ARRAY_INT_MASK 0xFFFF0000 #define SPL_ARRAY_CLONE_MASK 0x0300FFFF +#define SPL_ARRAY_METHOD_NO_ARG 0 +#define SPL_ARRAY_METHOD_USE_ARG 1 +#define SPL_ARRAY_METHOD_MAY_USER_ARG 2 + typedef struct _spl_array_object { zend_object std; zval *array; @@ -302,41 +306,41 @@ static zval **spl_array_get_dimension_ptr_ptr(int check_inherited, zval *object, long index; HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); -/* We cannot get the pointer pointer so we don't allow it here for now - if (check_inherited && intern->fptr_offset_get) { - return zend_call_method_with_1_params(&object, Z_OBJCE_P(object), &intern->fptr_offset_get, "offsetGet", NULL, offset); - }*/ - if (!offset) { return &EG(uninitialized_zval_ptr); } if ((type == BP_VAR_W || type == BP_VAR_RW) && (ht->nApplyCount > 0)) { zend_error(E_WARNING, "Modification of ArrayObject during sorting is prohibited"); - return &EG(uninitialized_zval_ptr);; + return &EG(error_zval_ptr);; } switch(Z_TYPE_P(offset)) { + case IS_NULL: + Z_STRVAL_P(offset) = ""; + Z_STRLEN_P(offset) = 0; case IS_STRING: if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &retval) == FAILURE) { - if (type == BP_VAR_W || type == BP_VAR_RW) { - zval *value; - ALLOC_INIT_ZVAL(value); - zend_symtable_update(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)&value, sizeof(void*), NULL); - if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &retval) != FAILURE) { - return retval; - } else { - return &EG(uninitialized_zval_ptr); + switch (type) { + case BP_VAR_R: + zend_error(E_NOTICE, "Undefined index: %s", Z_STRVAL_P(offset)); + case BP_VAR_UNSET: + case BP_VAR_IS: + retval = &EG(uninitialized_zval_ptr); + break; + case BP_VAR_RW: + zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset)); + case BP_VAR_W: { + zval *value; + ALLOC_INIT_ZVAL(value); + zend_symtable_update(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)&value, sizeof(void*), (void **)&retval); } - } else { - zend_error(E_NOTICE, "Undefined index: %s", Z_STRVAL_P(offset)); - return &EG(uninitialized_zval_ptr); } - } else { - return retval; } - case IS_DOUBLE: + return retval; 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)); + case IS_DOUBLE: case IS_BOOL: case IS_LONG: if (offset->type == IS_DOUBLE) { @@ -345,26 +349,27 @@ static zval **spl_array_get_dimension_ptr_ptr(int check_inherited, zval *object, index = Z_LVAL_P(offset); } if (zend_hash_index_find(ht, index, (void **) &retval) == FAILURE) { - if (type == BP_VAR_W || type == BP_VAR_RW) { - zval *value; - ALLOC_INIT_ZVAL(value); - zend_hash_index_update(ht, index, (void**)&value, sizeof(void*), NULL); - if (zend_hash_index_find(ht, index, (void **) &retval) != FAILURE) { - return retval; - } else { - return &EG(uninitialized_zval_ptr); - } - } else { - zend_error(E_NOTICE, "Undefined offset: %ld", index); - return &EG(uninitialized_zval_ptr); + switch (type) { + case BP_VAR_R: + zend_error(E_NOTICE, "Undefined offset: %ld", index); + case BP_VAR_UNSET: + case BP_VAR_IS: + retval = &EG(uninitialized_zval_ptr); + break; + case BP_VAR_RW: + zend_error(E_NOTICE, "Undefined offset: %ld", index); + case BP_VAR_W: { + zval *value; + ALLOC_INIT_ZVAL(value); + zend_hash_index_update(ht, index, (void**)&value, sizeof(void*), (void **)&retval); + } } - } else { - return retval; } - break; + return retval; default: zend_error(E_WARNING, "Illegal offset type"); - return &EG(uninitialized_zval_ptr); + return (type == BP_VAR_W || type == BP_VAR_RW) ? + &EG(error_zval_ptr) : &EG(uninitialized_zval_ptr); } } /* }}} */ @@ -515,11 +520,11 @@ static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval } if (ht == &EG(symbol_table)) { if (zend_delete_global_variable(Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC)) { - zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset)); + zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset)); } } else { if (zend_symtable_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1) == FAILURE) { - zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset)); + zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset)); } else { spl_array_object *obj = intern; @@ -565,7 +570,7 @@ static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval return; } if (zend_hash_index_del(ht, index) == FAILURE) { - zend_error(E_NOTICE,"Undefined offset: %ld", Z_LVAL_P(offset)); + zend_error(E_NOTICE,"Undefined offset: %ld", Z_LVAL_P(offset)); } break; default: @@ -709,7 +714,6 @@ SPL_METHOD(Array, offsetSet) spl_array_write_dimension_ex(0, getThis(), index, value TSRMLS_CC); } /* }}} */ - void spl_array_iterator_append(zval *object, zval *append_value TSRMLS_DC) /* {{{ */ { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); @@ -1426,26 +1430,36 @@ static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fnam { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC); HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); - zval *tmp, *arg; + zval *tmp, *arg = NULL; zval *retval_ptr = NULL; MAKE_STD_ZVAL(tmp); Z_TYPE_P(tmp) = IS_ARRAY; Z_ARRVAL_P(tmp) = aht; - if (use_arg) { - if (ZEND_NUM_ARGS() != 1 || zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) { + if (!use_arg) { + aht->nApplyCount++; + zend_call_method(NULL, NULL, NULL, fname, fname_len, &retval_ptr, 1, tmp, NULL TSRMLS_CC); + aht->nApplyCount--; + } else if (use_arg == SPL_ARRAY_METHOD_MAY_USER_ARG) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "|z", &arg) == FAILURE) { Z_TYPE_P(tmp) = IS_NULL; zval_ptr_dtor(&tmp); - zend_throw_exception(spl_ce_BadMethodCallException, "Function expects exactly one argument", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_BadMethodCallException, "Function expects one argument at most", 0 TSRMLS_CC); return; } aht->nApplyCount++; - zend_call_method(NULL, NULL, NULL, fname, fname_len, &retval_ptr, 2, tmp, arg TSRMLS_CC); + zend_call_method(NULL, NULL, NULL, fname, fname_len, &retval_ptr, arg? 2 : 1, tmp, arg TSRMLS_CC); aht->nApplyCount--; } else { + if (ZEND_NUM_ARGS() != 1 || zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) { + Z_TYPE_P(tmp) = IS_NULL; + zval_ptr_dtor(&tmp); + zend_throw_exception(spl_ce_BadMethodCallException, "Function expects exactly one argument", 0 TSRMLS_CC); + return; + } aht->nApplyCount++; - zend_call_method(NULL, NULL, NULL, fname, fname_len, &retval_ptr, 1, tmp, NULL TSRMLS_CC); + zend_call_method(NULL, NULL, NULL, fname, fname_len, &retval_ptr, 2, tmp, arg TSRMLS_CC); aht->nApplyCount--; } Z_TYPE_P(tmp) = IS_NULL; /* we want to destroy the zval, not the hashtable */ @@ -1461,35 +1475,35 @@ SPL_METHOD(cname, fname) \ spl_array_method(INTERNAL_FUNCTION_PARAM_PASSTHRU, #fname, sizeof(#fname)-1, use_arg); \ } -/* {{{ proto int ArrayObject::asort() - proto int ArrayIterator::asort() +/* {{{ proto int ArrayObject::asort([int $sort_flags = SORT_REGULAR ]) + proto int ArrayIterator::asort([int $sort_flags = SORT_REGULAR ]) Sort the entries by values. */ -SPL_ARRAY_METHOD(Array, asort, 0) /* }}} */ +SPL_ARRAY_METHOD(Array, asort, SPL_ARRAY_METHOD_MAY_USER_ARG) /* }}} */ -/* {{{ proto int ArrayObject::ksort() - proto int ArrayIterator::ksort() +/* {{{ proto int ArrayObject::ksort([int $sort_flags = SORT_REGULAR ]) + proto int ArrayIterator::ksort([int $sort_flags = SORT_REGULAR ]) Sort the entries by key. */ -SPL_ARRAY_METHOD(Array, ksort, 0) /* }}} */ +SPL_ARRAY_METHOD(Array, ksort, SPL_ARRAY_METHOD_MAY_USER_ARG) /* }}} */ /* {{{ proto int ArrayObject::uasort(callback cmp_function) proto int ArrayIterator::uasort(callback cmp_function) Sort the entries by values user defined function. */ -SPL_ARRAY_METHOD(Array, uasort, 1) /* }}} */ +SPL_ARRAY_METHOD(Array, uasort, SPL_ARRAY_METHOD_USE_ARG) /* }}} */ /* {{{ proto int ArrayObject::uksort(callback cmp_function) proto int ArrayIterator::uksort(callback cmp_function) Sort the entries by key using user defined function. */ -SPL_ARRAY_METHOD(Array, uksort, 1) /* }}} */ +SPL_ARRAY_METHOD(Array, uksort, SPL_ARRAY_METHOD_USE_ARG) /* }}} */ /* {{{ proto int ArrayObject::natsort() proto int ArrayIterator::natsort() Sort the entries by values using "natural order" algorithm. */ -SPL_ARRAY_METHOD(Array, natsort, 0) /* }}} */ +SPL_ARRAY_METHOD(Array, natsort, SPL_ARRAY_METHOD_NO_ARG) /* }}} */ /* {{{ proto int ArrayObject::natcasesort() proto int ArrayIterator::natcasesort() Sort the entries by key using case insensitive "natural order" algorithm. */ -SPL_ARRAY_METHOD(Array, natcasesort, 0) /* }}} */ +SPL_ARRAY_METHOD(Array, natcasesort, SPL_ARRAY_METHOD_NO_ARG) /* }}} */ /* {{{ proto mixed|NULL ArrayIterator::current() Return current array entry */ diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 0fcbd317e..b86e68659 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -433,7 +433,6 @@ static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_ if (file_path && !use_copy) { efree(file_path); } - use_copy = 1; file_path_len = 1; file_path = "/"; #endif diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index 112428554..244bd3e0d 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -223,10 +223,14 @@ static zend_object_value spl_fixedarray_object_new_ex(zend_class_entry *class_ty if (orig && clone_orig) { spl_fixedarray_object *other = (spl_fixedarray_object*)zend_object_store_get_object(orig TSRMLS_CC); intern->ce_get_iterator = other->ce_get_iterator; - - intern->array = emalloc(sizeof(spl_fixedarray)); - spl_fixedarray_init(intern->array, other->array->size TSRMLS_CC); - spl_fixedarray_copy(intern->array, other->array TSRMLS_CC); + if (!other->array) { + /* leave a empty object, will be dtor later by CLONE handler */ + zend_throw_exception(spl_ce_RuntimeException, "The instance wasn't initialized properly", 0 TSRMLS_CC); + } else { + intern->array = emalloc(sizeof(spl_fixedarray)); + spl_fixedarray_init(intern->array, other->array->size TSRMLS_CC); + spl_fixedarray_copy(intern->array, other->array TSRMLS_CC); + } } while (parent) { diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index e5dc03073..098d7dc1e 100755 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -2820,7 +2820,7 @@ SPL_METHOD(CachingIterator, offsetGet) } if (zend_symtable_find(HASH_OF(intern->u.caching.zcache), arKey, nKeyLength+1, (void**)&value) == FAILURE) { - zend_error(E_NOTICE, "Undefined index: %s", arKey); + zend_error(E_NOTICE, "Undefined index: %s", arKey); return; } diff --git a/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt new file mode 100644 index 000000000..f0b2b0182 --- /dev/null +++ b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt @@ -0,0 +1,50 @@ +--TEST-- +RecursiveDirectoryIterator::getBasePath() - basic test +--CREDITS-- +Pawel Krynicki <pawel [dot] krynicki [at] xsolve [dot] pl> +#testfest AmsterdamPHP 2012-06-23 +--FILE-- +<?php +$depth0 = "depth0"; +$depth1 = 'depth1'; +$depth2 = 'depth2'; +$targetDir = __DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . $depth1 . DIRECTORY_SEPARATOR . $depth2; +mkdir($targetDir, 0777, true); +touch($targetDir . DIRECTORY_SEPARATOR . 'getSubPath_test.tmp'); +$iterator = new RecursiveDirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . $depth0); +$it = new RecursiveIteratorIterator($iterator); + +$list = []; +while($it->valid()) { + $list[] = $it->getSubPath(); + $it->next(); +} +asort($list); +foreach ($list as $item) { + echo $item . "\n"; +} +?> +--CLEAN-- +<?php +function rrmdir($dir) { + foreach(glob($dir . '/*') as $file) { + if(is_dir($file)) { + rrmdir($file); + } else { + unlink($file); + } + } + + rmdir($dir); +} + +$targetDir = __DIR__.DIRECTORY_SEPARATOR . "depth0"; +rrmdir($targetDir); +?> + +--EXPECTF-- +depth1 +depth1 +depth1%cdepth2 +depth1%cdepth2 +depth1%cdepth2 diff --git a/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt b/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt new file mode 100644 index 000000000..7b12672e1 --- /dev/null +++ b/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt @@ -0,0 +1,56 @@ +--TEST-- +RecursiveDirectoryIterator::getBasePathname() - basic test +--CREDITS-- +Pawel Krynicki <pawel [dot] krynicki [at] xsolve [dot] pl> +#testfest AmsterdamPHP 2012-06-23 +--FILE-- +<?php +$depth0 = "depth0"; +$depth1 = "depth1"; +$depth2 = "depth2"; +$targetDir = __DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . $depth1 . DIRECTORY_SEPARATOR . $depth2; +mkdir($targetDir, 0777, true); +touch($targetDir . DIRECTORY_SEPARATOR . 'getSubPathname_test_2.tmp'); +touch(__DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . $depth1 . DIRECTORY_SEPARATOR . 'getSubPathname_test_3.tmp'); +touch(__DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . 'getSubPathname_test_1.tmp'); +$iterator = new RecursiveDirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . $depth0); +$it = new RecursiveIteratorIterator($iterator); + +$list = []; +$it->rewind(); //see https://bugs.php.net/bug.php?id=62914 +while($it->valid()) { + $list[] = $it->getSubPathname(); + $it->next(); +} +asort($list); +foreach ($list as $item) { + echo $item . "\n"; +} +?> +--CLEAN-- +<?php +function rrmdir($dir) { + foreach(glob($dir . '/*') as $file) { + if(is_dir($file)) { + rrmdir($file); + } else { + unlink($file); + } + } + + rmdir($dir); +} + +$targetDir = __DIR__ . DIRECTORY_SEPARATOR . "depth0"; +rrmdir($targetDir); +?> +--EXPECTF-- +. +.. +depth1%c. +depth1%c.. +depth1%cdepth2%c. +depth1%cdepth2%c.. +depth1%cdepth2%cgetSubPathname_test_2.tmp +depth1%cgetSubPathname_test_3.tmp +getSubPathname_test_1.tmp diff --git a/ext/spl/tests/arrayObject___construct_basic2.phpt b/ext/spl/tests/arrayObject___construct_basic2.phpt index 9ff0e4257..bd27c4277 100644 --- a/ext/spl/tests/arrayObject___construct_basic2.phpt +++ b/ext/spl/tests/arrayObject___construct_basic2.phpt @@ -63,7 +63,7 @@ bool(true) Notice: Undefined property: ArrayObject::$prop in %s on line 40 -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 NULL NULL - After: @@ -91,7 +91,7 @@ bool(true) Notice: Undefined property: MyArrayObject::$prop in %s on line 40 -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 NULL NULL - After: diff --git a/ext/spl/tests/arrayObject___construct_basic3.phpt b/ext/spl/tests/arrayObject___construct_basic3.phpt index 1abd1a1ab..11a17a6dc 100644 --- a/ext/spl/tests/arrayObject___construct_basic3.phpt +++ b/ext/spl/tests/arrayObject___construct_basic3.phpt @@ -63,7 +63,7 @@ bool(true) Notice: Undefined property: ArrayObject::$prop in %s on line 40 -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 NULL NULL - After: @@ -91,7 +91,7 @@ bool(true) Notice: Undefined property: MyArrayObject::$prop in %s on line 40 -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 NULL NULL - After: diff --git a/ext/spl/tests/arrayObject___construct_basic4.phpt b/ext/spl/tests/arrayObject___construct_basic4.phpt index 80f5e0861..b0809de0d 100644 --- a/ext/spl/tests/arrayObject___construct_basic4.phpt +++ b/ext/spl/tests/arrayObject___construct_basic4.phpt @@ -61,11 +61,11 @@ bool(true) bool(true) - Unset: -Notice: Undefined index: prop in %s on line 39 +Notice: Undefined index: prop in %s on line 39 -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 NULL NULL - After: @@ -91,9 +91,9 @@ bool(true) bool(true) - Unset: -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 NULL NULL - After: diff --git a/ext/spl/tests/arrayObject___construct_basic5.phpt b/ext/spl/tests/arrayObject___construct_basic5.phpt index 5368d250a..8c44ee2ce 100644 --- a/ext/spl/tests/arrayObject___construct_basic5.phpt +++ b/ext/spl/tests/arrayObject___construct_basic5.phpt @@ -61,11 +61,11 @@ bool(true) bool(true) - Unset: -Notice: Undefined index: prop in %s on line 39 +Notice: Undefined index: prop in %s on line 39 -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 NULL NULL - After: @@ -91,9 +91,9 @@ bool(true) bool(true) - Unset: -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 NULL NULL - After: diff --git a/ext/spl/tests/arrayObject_asort_basic1.phpt b/ext/spl/tests/arrayObject_asort_basic1.phpt index ec69049a3..53df1d502 100644 --- a/ext/spl/tests/arrayObject_asort_basic1.phpt +++ b/ext/spl/tests/arrayObject_asort_basic1.phpt @@ -17,12 +17,14 @@ var_dump($ao1->asort()); var_dump($ao1); var_dump($ao2->asort('blah')); var_dump($ao2); +var_dump($ao2->asort(SORT_NUMERIC)); +var_dump($ao2); ?> ===DONE=== --EXPECTF-- *** Testing ArrayObject::asort() : basic functionality *** bool(true) -object(ArrayObject)#1 (1) { +object(ArrayObject)#%d (1) { ["storage":"ArrayObject":private]=> array(3) { [1]=> @@ -33,8 +35,22 @@ object(ArrayObject)#1 (1) { int(4) } } + +Warning: asort() expects parameter 2 to be long, string given in %sarrayObject_asort_basic1.php on line %d +bool(false) +object(ArrayObject)#%d (1) { + ["storage":"ArrayObject":private]=> + array(3) { + ["a"]=> + int(4) + ["b"]=> + int(2) + ["c"]=> + int(3) + } +} bool(true) -object(ArrayObject)#2 (1) { +object(ArrayObject)#%d (1) { ["storage":"ArrayObject":private]=> array(3) { ["b"]=> diff --git a/ext/spl/tests/arrayObject_ksort_basic1.phpt b/ext/spl/tests/arrayObject_ksort_basic1.phpt index 9c8d1e734..8f3793812 100644 --- a/ext/spl/tests/arrayObject_ksort_basic1.phpt +++ b/ext/spl/tests/arrayObject_ksort_basic1.phpt @@ -16,12 +16,14 @@ var_dump($ao1->ksort()); var_dump($ao1); var_dump($ao2->ksort('blah')); var_dump($ao2); +var_dump($ao2->ksort(SORT_STRING)); +var_dump($ao2); ?> ===DONE=== --EXPECTF-- *** Testing ArrayObject::ksort() : basic functionality *** bool(true) -object(ArrayObject)#1 (1) { +object(ArrayObject)#%d (1) { ["storage":"ArrayObject":private]=> array(3) { [0]=> @@ -32,18 +34,34 @@ object(ArrayObject)#1 (1) { int(3) } } -bool(true) + +Warning: ksort() expects parameter 2 to be long, string given in %sarrayObject_ksort_basic1.php on line %d +bool(false) object(ArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> array(4) { - ["a"]=> - int(2) ["b"]=> int(4) + ["a"]=> + int(2) ["q"]=> int(3) [99]=> string(1) "x" } } +bool(true) +object(ArrayObject)#%d (1) { + ["storage":"ArrayObject":private]=> + array(4) { + [99]=> + string(1) "x" + ["a"]=> + int(2) + ["b"]=> + int(4) + ["q"]=> + int(3) + } +} ===DONE=== diff --git a/ext/spl/tests/arrayObject_magicMethods1.phpt b/ext/spl/tests/arrayObject_magicMethods1.phpt index b1de4a951..ec4812f10 100644 --- a/ext/spl/tests/arrayObject_magicMethods1.phpt +++ b/ext/spl/tests/arrayObject_magicMethods1.phpt @@ -102,7 +102,7 @@ object(ArrayObject)#2 (1) { --> Read existent, non-existent and dynamic: string(7) "changed" -Notice: Undefined index: nonexistent in %s on line 42 +Notice: Undefined index: nonexistent in %s on line 42 NULL string(11) "new.changed" Original wrapped object: @@ -171,7 +171,7 @@ object(ArrayObject)#2 (1) { --> Unset existent, non-existent and dynamic: -Notice: Undefined index: nonexistent in %s on line 60 +Notice: Undefined index: nonexistent in %s on line 60 Original wrapped object: object(UsesMagic)#1 (3) { ["b"]=> diff --git a/ext/spl/tests/arrayObject_magicMethods3.phpt b/ext/spl/tests/arrayObject_magicMethods3.phpt index 16a6a3b80..6231ceabb 100644 --- a/ext/spl/tests/arrayObject_magicMethods3.phpt +++ b/ext/spl/tests/arrayObject_magicMethods3.phpt @@ -102,7 +102,7 @@ object(ArrayObject)#2 (1) { --> Read existent, non-existent and dynamic: string(7) "changed" -Notice: Undefined index: nonexistent in %s on line 42 +Notice: Undefined index: nonexistent in %s on line 42 NULL string(11) "new.changed" Original wrapped object: @@ -171,7 +171,7 @@ object(ArrayObject)#2 (1) { --> Unset existent, non-existent and dynamic: -Notice: Undefined index: nonexistent in %s on line 60 +Notice: Undefined index: nonexistent in %s on line 60 Original wrapped object: object(UsesMagic)#1 (3) { ["b"]=> diff --git a/ext/spl/tests/arrayObject_magicMethods4.phpt b/ext/spl/tests/arrayObject_magicMethods4.phpt index 3c9f78781..9580dc5ae 100644 --- a/ext/spl/tests/arrayObject_magicMethods4.phpt +++ b/ext/spl/tests/arrayObject_magicMethods4.phpt @@ -107,7 +107,7 @@ object(UsesMagic)#2 (2) { --> Read existent, non-existent and dynamic: string(7) "changed" -Notice: Undefined index: nonexistent in %s on line 45 +Notice: Undefined index: nonexistent in %s on line 45 NULL string(11) "new.changed" Original wrapped object: @@ -180,7 +180,7 @@ object(UsesMagic)#2 (2) { --> Unset existent, non-existent and dynamic: -Notice: Undefined index: nonexistent in %s on line 63 +Notice: Undefined index: nonexistent in %s on line 63 Original wrapped object: object(C)#1 (3) { ["b"]=> diff --git a/ext/spl/tests/arrayObject_magicMethods6.phpt b/ext/spl/tests/arrayObject_magicMethods6.phpt index 45a0e4a76..b43f56c2b 100644 --- a/ext/spl/tests/arrayObject_magicMethods6.phpt +++ b/ext/spl/tests/arrayObject_magicMethods6.phpt @@ -107,7 +107,7 @@ object(UsesMagic)#2 (2) { --> Read existent, non-existent and dynamic: string(7) "changed" -Notice: Undefined index: nonexistent in %s on line 45 +Notice: Undefined index: nonexistent in %s on line 45 NULL string(11) "new.changed" Original wrapped object: @@ -180,7 +180,7 @@ object(UsesMagic)#2 (2) { --> Unset existent, non-existent and dynamic: -Notice: Undefined index: nonexistent in %s on line 63 +Notice: Undefined index: nonexistent in %s on line 63 Original wrapped object: object(C)#1 (3) { ["b"]=> diff --git a/ext/spl/tests/arrayObject_setFlags_basic1.phpt b/ext/spl/tests/arrayObject_setFlags_basic1.phpt index d8d4f2e96..391b0eeae 100644 --- a/ext/spl/tests/arrayObject_setFlags_basic1.phpt +++ b/ext/spl/tests/arrayObject_setFlags_basic1.phpt @@ -44,8 +44,8 @@ string(21) "array element.changed" --> Remove the array element and try access again: bool(false) -Notice: Undefined index: p in %s on line 10 +Notice: Undefined index: p in %s on line 10 NULL -Notice: Undefined index: p in %s on line 12 +Notice: Undefined index: p in %s on line 12 string(8) ".changed" diff --git a/ext/spl/tests/array_001.phpt b/ext/spl/tests/array_001.phpt index d9fb57c4c..b55fcba1f 100755 --- a/ext/spl/tests/array_001.phpt +++ b/ext/spl/tests/array_001.phpt @@ -79,15 +79,15 @@ object(ArrayObject)#%d (1) { } int(0) -Notice: Undefined offset: 6 in %sarray_001.php on line %d +Notice: Undefined offset: 6 in %sarray_001.php on line %d NULL -Notice: Undefined index: b in %sarray_001.php on line %d +Notice: Undefined index: b in %sarray_001.php on line %d NULL -Notice: Undefined offset: 7 in %sarray_001.php on line %d +Notice: Undefined offset: 7 in %sarray_001.php on line %d -Notice: Undefined index: c in %sarray_001.php on line %d +Notice: Undefined index: c in %sarray_001.php on line %d object(ArrayObject)#%d (1) { ["storage":"ArrayObject":private]=> array(2) { diff --git a/ext/spl/tests/array_010.phpt b/ext/spl/tests/array_010.phpt index 6b331e4b5..d2f3de7f6 100755 --- a/ext/spl/tests/array_010.phpt +++ b/ext/spl/tests/array_010.phpt @@ -94,10 +94,10 @@ int(1) string(3) "3rd" int(4) -Notice: Undefined index: 5th in %sarray_010.php on line %d +Notice: Undefined index: 5th in %sarray_010.php on line %d NULL -Notice: Undefined offset: 6 in %sarray_010.php on line %d +Notice: Undefined offset: 6 in %sarray_010.php on line %d NULL ===offsetSet=== WRITE 1 @@ -128,9 +128,9 @@ array(6) { string(9) "changed 6" } -Notice: Undefined offset: 7 in %sarray_010.php on line %d +Notice: Undefined offset: 7 in %sarray_010.php on line %d -Notice: Undefined index: 8th in %sarray_010.php on line %d +Notice: Undefined index: 8th in %sarray_010.php on line %d array(4) { [0]=> string(3) "1st" diff --git a/ext/spl/tests/bug45622.phpt b/ext/spl/tests/bug45622.phpt index c47b62cbd..a8fe2c464 100644 --- a/ext/spl/tests/bug45622.phpt +++ b/ext/spl/tests/bug45622.phpt @@ -42,7 +42,7 @@ bool(true) --> Remove the array element and try access again: bool(false) -Notice: Undefined index: p in %s on line %d +Notice: Undefined index: p in %s on line %d NULL --> Re-add the real property: diff --git a/ext/spl/tests/bug45622b.phpt b/ext/spl/tests/bug45622b.phpt index 9d4939211..f101a8459 100644 --- a/ext/spl/tests/bug45622b.phpt +++ b/ext/spl/tests/bug45622b.phpt @@ -25,9 +25,9 @@ isset($ao->prop4); --EXPECTF-- Doesn't trigger __get. -Notice: Undefined index: prop1 in %s on line 11 +Notice: Undefined index: prop1 in %s on line 11 Doesn't trigger __set. Doesn't trigger __unset. -Notice: Undefined index: prop3 in %s on line 17 +Notice: Undefined index: prop3 in %s on line 17 Shouldn't trigger __isset.
\ No newline at end of file diff --git a/ext/spl/tests/bug54323.phpt b/ext/spl/tests/bug54323.phpt index 35a16a463..df6416a0f 100644 --- a/ext/spl/tests/bug54323.phpt +++ b/ext/spl/tests/bug54323.phpt @@ -19,6 +19,6 @@ function testAccess($c, $ao) { --EXPECTF-- Notice: Undefined property: C::$prop in %sbug54323.php on line 14 -Notice: Undefined index: prop in %sbug54323.php on line 14 +Notice: Undefined index: prop in %sbug54323.php on line 14 NULL NULL diff --git a/ext/spl/tests/bug62328.phpt b/ext/spl/tests/bug62328.phpt new file mode 100644 index 000000000..33a8aeee9 --- /dev/null +++ b/ext/spl/tests/bug62328.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #62328 (cast_object takes precedence over __toString) +--CREDITS-- +leight at gmail dot com +--FILE-- +<?php + +class SplFileInfo62328 extends SplFileInfo +{ + public function __toString() + { + return '__toString'; + } +} + +$fi = new SplFileInfo62328(__FILE__); + +echo (string)$fi . PHP_EOL; +echo (string)$fi->__toString() . PHP_EOL; + +?> +--EXPECT-- +__toString +__toString diff --git a/ext/spl/tests/bug62904.phpt b/ext/spl/tests/bug62904.phpt new file mode 100644 index 000000000..7e392da9a --- /dev/null +++ b/ext/spl/tests/bug62904.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #62904 (Crash when cloning an object which inherits SplFixedArray) +--FILE-- +<?php + +class foo extends SplFixedArray { + public function __construct($size) { + } +} + +$x = new foo(2); + +try { + $z = clone $x; +} catch (Exception $e) { + var_dump($e->getMessage()); +} +--EXPECTF-- +string(40) "The instance wasn't initialized properly" diff --git a/ext/spl/tests/bug62978.phpt b/ext/spl/tests/bug62978.phpt new file mode 100644 index 000000000..0d91609f8 --- /dev/null +++ b/ext/spl/tests/bug62978.phpt @@ -0,0 +1,50 @@ +--TEST-- +Bug #62987 (Assigning to ArrayObject[null][something] overrides all undefined variables) +--FILE-- +<?php +$a = new ArrayObject(); + +$b = array(); + +$a[null]['hurr'] = 'durr'; + +var_dump($a['epic_magic']); +var_dump($b['epic_magic']); +var_dump($c['epic_magic']); // Undefined var!! + +$d = array(); +var_dump($a['epic_magic']); // more magic! +var_dump($d['epic_magic']); + +$e = 'srsly?'; +var_dump($a['epic_magic']); // srsly. +var_dump(isset($a['epic_magic'])); + +$fp = fopen(__FILE__, 'r'); +var_dump($a[$fp]); + +fclose($fp); +--EXPECTF-- +Notice: Undefined index: epic_magic in %sbug62978.php on line %d +NULL + +Notice: Undefined index: epic_magic in %sbug62978.php on line %d +NULL + +Notice: Undefined variable: c in %sbug62978.php on line %d +NULL + +Notice: Undefined index: epic_magic in %sbug62978.php on line %d +NULL + +Notice: Undefined index: epic_magic in %sbug62978.php on line %d +NULL + +Notice: Undefined index: epic_magic in %sbug62978.php on line %d +NULL +bool(false) + +Strict Standards: Resource ID#%d used as offset, casting to integer (%d) in %sbug62978.php on line %d + +Notice: Undefined offset: %d in %sbug62978.php on line %d +NULL diff --git a/ext/spl/tests/iterator_044.phpt b/ext/spl/tests/iterator_044.phpt index 6d2553117..1271ccaa6 100755 --- a/ext/spl/tests/iterator_044.phpt +++ b/ext/spl/tests/iterator_044.phpt @@ -81,7 +81,7 @@ NULL int(0) bool(false) -Notice: Undefined index: 0 in %siterator_044.php on line %d +Notice: Undefined index: 0 in %siterator_044.php on line %d NULL ===1=== object(stdClass)#%d (0) { @@ -97,31 +97,31 @@ object(MyFoo)#%d (0) { } bool(false) -Notice: Undefined index: foo in %siterator_044.php on line %d +Notice: Undefined index: foo in %siterator_044.php on line %d NULL ===3=== NULL bool(false) -Notice: Undefined index: in %siterator_044.php on line %d +Notice: Undefined index: in %siterator_044.php on line %d NULL ===4=== int(2) bool(false) -Notice: Undefined index: 2 in %siterator_044.php on line %d +Notice: Undefined index: 2 in %siterator_044.php on line %d NULL ===5=== string(3) "foo" bool(false) -Notice: Undefined index: foo in %siterator_044.php on line %d +Notice: Undefined index: foo in %siterator_044.php on line %d NULL ===6=== int(3) bool(false) -Notice: Undefined index: 3 in %siterator_044.php on line %d +Notice: Undefined index: 3 in %siterator_044.php on line %d NULL ===FILL=== ===0=== @@ -146,7 +146,7 @@ int(1) NULL bool(false) -Notice: Undefined index: in %siterator_044.php on line %d +Notice: Undefined index: in %siterator_044.php on line %d NULL ===4=== int(2) @@ -160,6 +160,6 @@ int(1) int(3) bool(false) -Notice: Undefined index: 3 in %siterator_044.php on line %d +Notice: Undefined index: 3 in %siterator_044.php on line %d NULL ===DONE=== diff --git a/ext/standard/assert.c b/ext/standard/assert.c index a2c50d5cb..15fbefd51 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -136,20 +136,20 @@ PHP_MINFO_FUNCTION(assert) /* {{{ */ } /* }}} */ -/* {{{ proto int assert(string|bool assertion) +/* {{{ proto int assert(string|bool assertion[, string description]) Checks if assertion is false */ PHP_FUNCTION(assert) { zval **assertion; - int val; + int val, description_len = 0; char *myeval = NULL; - char *compiled_string_description; + char *compiled_string_description, *description = NULL; if (! ASSERTG(active)) { RETURN_TRUE; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &assertion) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|s", &assertion, &description, &description_len) == FAILURE) { return; } @@ -167,7 +167,11 @@ PHP_FUNCTION(assert) compiled_string_description = zend_make_compiled_string_description("assert code" TSRMLS_CC); if (zend_eval_stringl(myeval, Z_STRLEN_PP(assertion), &retval, compiled_string_description TSRMLS_CC) == FAILURE) { efree(compiled_string_description); - php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s", PHP_EOL, myeval); + if (description_len == 0) { + php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s", PHP_EOL, myeval); + } else { + php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s:\"%s\"", PHP_EOL, description, myeval); + } if (ASSERTG(bail)) { zend_bailout(); } @@ -196,7 +200,7 @@ PHP_FUNCTION(assert) } if (ASSERTG(callback)) { - zval *args[3]; + zval **args = safe_emalloc(description_len == 0 ? 3 : 4, sizeof(zval **), 0); zval *retval; int i; uint lineno = zend_get_executed_lineno(TSRMLS_C); @@ -214,19 +218,38 @@ PHP_FUNCTION(assert) ZVAL_FALSE(retval); /* XXX do we want to check for error here? */ - call_user_function(CG(function_table), NULL, ASSERTG(callback), retval, 3, args TSRMLS_CC); + if (description_len == 0) { + call_user_function(CG(function_table), NULL, ASSERTG(callback), retval, 3, args TSRMLS_CC); + for (i = 0; i <= 2; i++) { + zval_ptr_dtor(&(args[i])); + } + } else { + MAKE_STD_ZVAL(args[3]); + ZVAL_STRINGL(args[3], SAFE_STRING(description), description_len, 1); - for (i = 0; i <= 2; i++) { - zval_ptr_dtor(&(args[i])); + call_user_function(CG(function_table), NULL, ASSERTG(callback), retval, 4, args TSRMLS_CC); + for (i = 0; i <= 3; i++) { + zval_ptr_dtor(&(args[i])); + } } + + efree(args); zval_ptr_dtor(&retval); } if (ASSERTG(warning)) { - if (myeval) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Assertion \"%s\" failed", myeval); + if (description_len == 0) { + if (myeval) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Assertion \"%s\" failed", myeval); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Assertion failed"); + } } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Assertion failed"); + if (myeval) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s: \"%s\" failed", description, myeval); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s failed", description); + } } } @@ -321,3 +344,4 @@ PHP_FUNCTION(assert_options) * vim600: sw=4 ts=4 fdm=marker * vim<600: sw=4 ts=4 */ + diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index e6de34e5f..72f1dc3c7 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -5043,8 +5043,11 @@ void php_free_shutdown_functions(TSRMLS_D) /* {{{ */ zend_hash_destroy(BG(user_shutdown_function_names)); FREE_HASHTABLE(BG(user_shutdown_function_names)); BG(user_shutdown_function_names) = NULL; - } - zend_end_try(); + } zend_catch { + /* maybe shutdown method call exit, we just ignore it */ + FREE_HASHTABLE(BG(user_shutdown_function_names)); + BG(user_shutdown_function_names) = NULL; + } zend_end_try(); } /* }}} */ diff --git a/ext/standard/credits_sapi.h b/ext/standard/credits_sapi.h index 9cc7e6e22..d147d8dea 100644 --- a/ext/standard/credits_sapi.h +++ b/ext/standard/credits_sapi.h @@ -17,7 +17,7 @@ CREDIT_LINE("Apache 2.0 Filter", "Sascha Schumann, Aaron Bannert"); CREDIT_LINE("Apache 2.0 Handler", "Ian Holsman, Justin Erenkrantz (based on Apache 2.0 Filter code)"); CREDIT_LINE("Caudium / Roxen", "David Hedbor"); CREDIT_LINE("CGI / FastCGI", "Rasmus Lerdorf, Stig Bakken, Shane Caraveo, Dmitry Stogov"); -CREDIT_LINE("CLI", "Edin Kadribasic, Marcus Boerger, Johannes Schlueter"); +CREDIT_LINE("CLI", "Edin Kadribasic, Marcus Boerger, Johannes Schlueter, Moriyoshi Koizumi, Xinchen Hui"); CREDIT_LINE("Continuity", "Alex Leigh (based on nsapi code)"); CREDIT_LINE("Embed", "Edin Kadribasic"); CREDIT_LINE("FastCGI Process Manager", "Andrei Nigmatulin, dreamcat4, Antony Dovgal, Jerome Loyet"); diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c index 1ce7eff05..4eb69d7ef 100644 --- a/ext/standard/quot_print.c +++ b/ext/standard/quot_print.c @@ -162,7 +162,10 @@ PHPAPI unsigned char *php_quot_print_encode(const unsigned char *str, size_t len lp = 0; } else { if (iscntrl (c) || (c == 0x7f) || (c & 0x80) || (c == '=') || ((c == ' ') && (*str == '\015'))) { - if ((lp += 3) > PHP_QPRINT_MAXL) { + if ((((lp+= 3) > PHP_QPRINT_MAXL) && (c <= 0x7f)) + || ((c > 0x7f) && (c <= 0xdf) && ((lp + 3) > PHP_QPRINT_MAXL)) + || ((c > 0xdf) && (c <= 0xef) && ((lp + 6) > PHP_QPRINT_MAXL)) + || ((c > 0xef) && (c <= 0xf4) && ((lp + 9) > PHP_QPRINT_MAXL))) { *d++ = '='; *d++ = '\015'; *d++ = '\012'; @@ -283,4 +286,4 @@ PHP_FUNCTION(quoted_printable_encode) * End: * vim600: sw=4 ts=4 fdm=marker * vim<600: sw=4 ts=4 - */ + */
\ No newline at end of file diff --git a/ext/standard/string.c b/ext/standard/string.c index 9a64376c2..9154b3296 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -3930,7 +3930,6 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) new_char_count--; } if (new_char_count > 0) { - char_count=new_char_count; begin=new_begin; } } diff --git a/ext/standard/tests/assert/assert04.phpt b/ext/standard/tests/assert/assert04.phpt index 0da23186e..bffadcb97 100644 --- a/ext/standard/tests/assert/assert04.phpt +++ b/ext/standard/tests/assert/assert04.phpt @@ -15,7 +15,7 @@ assert(1); /* Wrong parameter count in assert */ assert_options(ASSERT_ACTIVE, 1); -assert(2,3); +assert(2, "failure", 3); /* Wrong parameter count in assert_options */ assert_options(ASSERT_ACTIVE, 0, 2); @@ -36,7 +36,7 @@ echo "not reached\n"; ?> --EXPECTF-- -Warning: assert() expects exactly 1 parameter, 2 given in %s on line %d +Warning: assert() expects at most 2 parameters, 3 given in %s on line %d Warning: assert_options() expects at most 2 parameters, 3 given in %s on line %d @@ -45,3 +45,4 @@ Warning: assert_options() expects parameter 1 to be long, %unicode_string_option Warning: assert(): Assertion failed in %s on line %d Warning: assert(): Assertion failed in %s on line %d + diff --git a/ext/standard/tests/assert/assert_basic6.phpt b/ext/standard/tests/assert/assert_basic6.phpt new file mode 100644 index 000000000..2a7371343 --- /dev/null +++ b/ext/standard/tests/assert/assert_basic6.phpt @@ -0,0 +1,26 @@ +--TEST-- +assert() - basic - Test that bailout works +--INI-- +assert.active = 1 +assert.warning = 1 +assert.callback = f1 +assert.quiet_eval = 1 +assert.bail = 0 +--FILE-- +<?php +function f1($message) +{ + echo "f1 called\n"; +} + +//bail out on error +var_dump($rao = assert_options(ASSERT_BAIL, 1)); +$sa = "0 != 0"; +var_dump($r2 = assert($sa, "0 is 0")); +echo "If this is printed BAIL hasn't worked"; +--EXPECTF-- +int(0) +f1 called + +Warning: assert(): 0 is 0: "0 != 0" failed in %s on line 10 + diff --git a/ext/standard/tests/assert/assert_error1.phpt b/ext/standard/tests/assert/assert_error1.phpt index 6211f1c91..657b411f6 100644 --- a/ext/standard/tests/assert/assert_error1.phpt +++ b/ext/standard/tests/assert/assert_error1.phpt @@ -20,19 +20,19 @@ function handler($errno, $errstr) { //Wrong number of parameters for assert_options() assert_options(ASSERT_WARNING, 1); -var_dump($rao=assert_options(ASSERT_CALLBACK,"f1",1)); +var_dump($rao = assert_options(ASSERT_CALLBACK, "f1", 1)); //Unknown option for assert_options() -var_dump($rao=assert_options("F1","f1")); +var_dump($rao=assert_options("F1", "f1")); //Wrong number of parameters for assert() $sa="0 != 0"; -var_dump($r2=assert($sa,1)); +var_dump($r2 = assert($sa, "message", 1)); //Catch recoverable error with handler -var_dump($rc=assert('aa=sd+as+safsafasfaçsafçsafç')); +var_dump($rc = assert('aa=sd+as+safsafasfaçsafçsafç')); --EXPECTF-- Warning: assert_options() expects at most 2 parameters, 3 given in %s on line %d NULL @@ -40,5 +40,6 @@ NULL Warning: assert_options() expects parameter 1 to be long, string given in %s on line %d NULL -Warning: assert() expects exactly 1 parameter, 2 given in %s on line %d +Warning: assert() expects at most 2 parameters, 3 given in %s on line %d NULL + diff --git a/ext/standard/tests/assert/assert_error2.phpt b/ext/standard/tests/assert/assert_error2.phpt new file mode 100644 index 000000000..da7c3d9e0 --- /dev/null +++ b/ext/standard/tests/assert/assert_error2.phpt @@ -0,0 +1,30 @@ +--TEST-- +assert() - basic - Test that bailout works +--INI-- +assert.active = 1 +assert.warning = 1 +assert.callback = f1 +assert.quiet_eval = 1 +assert.bail = 0 +error_reporting = -1 +display_errors = 1 +--FILE-- +<?php +function f1($script, $line, $message, $user_message) +{ + echo "f1 called\n"; +} + +//bail out on error +var_dump($rao = assert_options(ASSERT_BAIL, 1)); +$sa = "0 != 0"; +var_dump($r2 = assert($sa)); +echo "If this is printed BAIL hasn't worked"; +--EXPECTF-- +int(0) + +Warning: Missing argument 4 for f1() in %s on line 2 +f1 called + +Warning: assert(): Assertion "0 != 0" failed in %s on line 10 + diff --git a/ext/standard/tests/assert/assert_error3.phpt b/ext/standard/tests/assert/assert_error3.phpt new file mode 100644 index 000000000..54b91edd3 --- /dev/null +++ b/ext/standard/tests/assert/assert_error3.phpt @@ -0,0 +1,21 @@ +--TEST-- +assert() - basic - Test recoverable error +--INI-- +assert.active = 1 +assert.warning = 1 +assert.callback = f1 +assert.quiet_eval = 0 +assert.bail = 0 +error_reporting = -1 +display_errors = 1 +--FILE-- +<?php +$sa = "0 $ 0"; +var_dump($r2 = assert($sa)); +--EXPECTF-- + +Parse error: syntax error, unexpected '$' in %s(3) : assert code on line 1 + +Catchable fatal error: assert(): Failure evaluating code: +0 $ 0 in %s on line 3 + diff --git a/ext/standard/tests/assert/assert_error4.phpt b/ext/standard/tests/assert/assert_error4.phpt new file mode 100644 index 000000000..264cc8fec --- /dev/null +++ b/ext/standard/tests/assert/assert_error4.phpt @@ -0,0 +1,21 @@ +--TEST-- +assert() - basic - Test recoverable error +--INI-- +assert.active = 1 +assert.warning = 1 +assert.callback = f1 +assert.quiet_eval = 0 +assert.bail = 0 +error_reporting = -1 +display_errors = 1 +--FILE-- +<?php +$sa = "0 $ 0"; +var_dump($r2 = assert($sa, "Describing what was asserted")); +--EXPECTF-- + +Parse error: syntax error, unexpected '$' in %s(3) : assert code on line 1 + +Catchable fatal error: assert(): Failure evaluating code: +Describing what was asserted:"0 $ 0" in %s on line 3 + diff --git a/ext/standard/tests/file/realpath_cache.phpt b/ext/standard/tests/file/realpath_cache.phpt index 2dac21ec4..0eb9dc519 100644 --- a/ext/standard/tests/file/realpath_cache.phpt +++ b/ext/standard/tests/file/realpath_cache.phpt @@ -19,7 +19,7 @@ echo "Done\n"; int(%d) array(4) { ["key"]=> - %s(%s) + %s(%f) ["is_dir"]=> bool(true) ["realpath"]=> diff --git a/ext/standard/tests/general_functions/bug60723.phpt b/ext/standard/tests/general_functions/bug60723.phpt new file mode 100644 index 000000000..07b801bcf --- /dev/null +++ b/ext/standard/tests/general_functions/bug60723.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #60723 (error_log error time has changed to UTC ignoring default timezo) +--INI-- +date.timezone=ASIA/Chongqing +log_errors=On +--FILE-- +<?php +$dir = dirname(__FILE__); +$log = $dir . "/tmp.err"; +ini_set("error_log", $log); +echo $aa; +error_log("dummy"); +readfile($log); +unlink($log); +?> +--EXPECTF-- +Notice: Undefined variable: aa in %sbug60723.php on line %d +[%s ASIA/Chongqing] PHP Notice: Undefined variable: aa in %sbug60723.php on line %d +[%s ASIA/Chongqing] dummy diff --git a/ext/standard/tests/general_functions/var_export_error2.phpt b/ext/standard/tests/general_functions/var_export_error2.phpt index 2b306696a..a6403e610 100644 --- a/ext/standard/tests/general_functions/var_export_error2.phpt +++ b/ext/standard/tests/general_functions/var_export_error2.phpt @@ -15,4 +15,5 @@ var_export($obj, true); ===DONE=== --EXPECTF-- -Fatal error: Nesting level too deep - recursive dependency? in %s on line 9
\ No newline at end of file +Warning: var_export does not handle circular references in %s on line 9 +===DONE=== diff --git a/ext/standard/tests/general_functions/var_export_error3.phpt b/ext/standard/tests/general_functions/var_export_error3.phpt index 03ed496ac..c862691e9 100644 --- a/ext/standard/tests/general_functions/var_export_error3.phpt +++ b/ext/standard/tests/general_functions/var_export_error3.phpt @@ -15,4 +15,5 @@ var_export($a, true); ===DONE=== --EXPECTF-- -Fatal error: Nesting level too deep - recursive dependency? in %s on line 9
\ No newline at end of file +Warning: var_export does not handle circular references in %s on line 9 +===DONE=== diff --git a/ext/standard/tests/network/gethostbyname_basic001.phpt b/ext/standard/tests/network/gethostbyname_basic001.phpt index e917b5992..9171e226a 100644 --- a/ext/standard/tests/network/gethostbyname_basic001.phpt +++ b/ext/standard/tests/network/gethostbyname_basic001.phpt @@ -5,6 +5,7 @@ gethostbyname() function - basic type return test --SKIPIF-- <?php if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +if (getenv("SKIP_ONLINE_TESTS")) die("skip test requiring internet connection"); ?> --FILE-- <?php diff --git a/ext/standard/tests/network/gethostbyname_basic002.phpt b/ext/standard/tests/network/gethostbyname_basic002.phpt deleted file mode 100644 index 983faa929..000000000 --- a/ext/standard/tests/network/gethostbyname_basic002.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -gethostbyname() function - basic invalid parameter test ---CREDITS-- -"Sylvain R." <sracine@phpquebec.org> ---SKIPIF-- -<?php -if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); -?> ---FILE-- -<?php - $ip = gethostbyname("www.php.net"); - var_dump((bool) ip2long($ip)); -?> ---EXPECT-- -bool(true) diff --git a/ext/standard/tests/network/gethostbyname_error004.phpt b/ext/standard/tests/network/gethostbyname_error004.phpt index 7aac17292..274301a23 100644 --- a/ext/standard/tests/network/gethostbyname_error004.phpt +++ b/ext/standard/tests/network/gethostbyname_error004.phpt @@ -5,6 +5,7 @@ gethostbyname() function - basic return valid ip address test --SKIPIF-- <?php if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +if (getenv("SKIP_ONLINE_TESTS")) die("skip test requiring internet connection"); ?> --FILE-- <?php diff --git a/ext/standard/tests/network/getmxrr.phpt b/ext/standard/tests/network/getmxrr.phpt index 29cea1d71..c4a15c52c 100644 --- a/ext/standard/tests/network/getmxrr.phpt +++ b/ext/standard/tests/network/getmxrr.phpt @@ -3,6 +3,7 @@ getmxrr() test --SKIPIF-- <?php if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +if (getenv("SKIP_ONLINE_TESTS")) die("skip test requiring internet connection"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip: no Windows support'); } diff --git a/ext/standard/tests/serialize/bug35895.phpt b/ext/standard/tests/serialize/bug35895.phpt new file mode 100644 index 000000000..22fce0d1f --- /dev/null +++ b/ext/standard/tests/serialize/bug35895.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #35895 (__sleep and private property) +--FILE-- +<?php +class Parents { + private $parents; + public function __sleep() { + return array("parents"); + } +} + +class Child extends Parents { + private $child; + public function __sleep() { + return array_merge(array("child"), parent::__sleep()); + } +} + +$obj = new Child(); +serialize($obj); + +?> +--EXPECTF-- +Notice: serialize(): "parents" returned as member variable from __sleep() but does not exist in %sbug35895.php on line %d diff --git a/ext/standard/tests/serialize/bug62836_1.phpt b/ext/standard/tests/serialize/bug62836_1.phpt new file mode 100644 index 000000000..729104641 --- /dev/null +++ b/ext/standard/tests/serialize/bug62836_1.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #62836 (Seg fault or broken object references on unserialize()) +--FILE-- +<?php +$serialized_object='O:1:"A":4:{s:1:"b";O:1:"B":0:{}s:2:"b1";r:2;s:1:"c";O:1:"B":0:{}s:2:"c1";r:4;}'; +function __autoload($name) { + unserialize("i:4;"); + eval("class $name {} "); +} + +print_r(unserialize($serialized_object)); +echo "okey"; +?> +--EXPECT-- +A Object +( + [b] => B Object + ( + ) + + [b1] => B Object + ( + ) + + [c] => B Object + ( + ) + + [c1] => B Object + ( + ) + +) +okey diff --git a/ext/standard/tests/serialize/bug62836_2.phpt b/ext/standard/tests/serialize/bug62836_2.phpt new file mode 100644 index 000000000..0634b1dac --- /dev/null +++ b/ext/standard/tests/serialize/bug62836_2.phpt @@ -0,0 +1,37 @@ +--TEST-- +Bug #62836 (Seg fault or broken object references on unserialize()) +--FILE-- +<?php +$serialized_object='O:1:"A":4:{s:1:"b";O:1:"B":0:{}s:2:"b1";r:2;s:1:"c";O:1:"B":0:{}s:2:"c1";r:4;}'; + +ini_set('unserialize_callback_func','mycallback'); + +function mycallback($classname) { + unserialize("i:4;"); + eval ("class $classname {} "); +} + +print_r(unserialize($serialized_object)); +echo "okey"; +?> +--EXPECT-- +A Object +( + [b] => B Object + ( + ) + + [b1] => B Object + ( + ) + + [c] => B Object + ( + ) + + [c1] => B Object + ( + ) + +) +okey diff --git a/ext/standard/tests/streams/bug40459.phpt b/ext/standard/tests/streams/bug40459.phpt new file mode 100644 index 000000000..8ee4363ed --- /dev/null +++ b/ext/standard/tests/streams/bug40459.phpt @@ -0,0 +1,103 @@ +--TEST-- +bug 40459 - Test whether the constructor of the user-space stream wrapper is called when stream functions are called +--FILE-- +<?php +// Test whether the constructor of the user-space stream wrapper is called when stream functions are called +class testwrapper { + private $constructorCalled = false; + function __construct() { + $this->constructorCalled = true; + } + + function stream_open($path, $mode, $options, &$opened_path) + { + echo $this->constructorCalled ? 'yes' : 'no'; + return true; + } + + function url_stat($url, $flags) + { + echo $this->constructorCalled ? 'yes' : 'no'; + return array(); + } + + function unlink($url) + { + echo $this->constructorCalled ? 'yes' : 'no'; + } + + function rename($from, $to) + { + echo $this->constructorCalled ? 'yes' : 'no'; + } + + function mkdir($dir, $mode, $options) + { + echo $this->constructorCalled ? 'yes' : 'no'; + } + + function rmdir($dir, $options) + { + echo $this->constructorCalled ? 'yes' : 'no'; + } + + function dir_opendir($url, $options) + { + echo $this->constructorCalled ? 'yes' : 'no'; + return TRUE; + } + function stream_metadata() + { + echo $this->constructorCalled ? 'yes' : 'no'; + return TRUE; + } +} + +stream_wrapper_register('test', 'testwrapper', STREAM_IS_URL); + +echo 'stream_open: '; +fopen('test://test', 'r'); +echo "\n"; + +echo 'url_stat: '; +stat('test://test'); +echo "\n"; + +echo 'dir_opendir: '; +opendir('test://test'); +echo "\n"; + +echo 'rmdir: '; +rmdir('test://test'); +echo "\n"; + +echo 'mkdir: '; +mkdir('test://test'); +echo "\n"; + +echo 'rename: '; +rename('test://test', 'test://test2'); +echo "\n"; + +echo 'unlink: '; +unlink('test://test'); +echo "\n"; + +echo 'touch: '; +touch('test://test', time()); +echo "\n"; + + + +?> +==DONE== +--EXPECT-- +stream_open: yes +url_stat: yes +dir_opendir: yes +rmdir: yes +mkdir: yes +rename: yes +unlink: yes +touch: yes +==DONE== diff --git a/ext/standard/tests/strings/bug62462.phpt b/ext/standard/tests/strings/bug62462.phpt new file mode 100644 index 000000000..c6eb41a54 --- /dev/null +++ b/ext/standard/tests/strings/bug62462.phpt @@ -0,0 +1,17 @@ +--TEST-- +Multibyte characters shouldn't be split by soft line break added by quoted_printable_encode - 4 byte character test +--FILE-- +<?php +echo quoted_printable_encode(str_repeat("\xc4\x85", 77)); +?> + +==DONE== +--EXPECT-- +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85 +==DONE== diff --git a/ext/standard/tests/strings/http_build_query_error.phpt b/ext/standard/tests/strings/http_build_query_error.phpt new file mode 100644 index 000000000..30155e62a --- /dev/null +++ b/ext/standard/tests/strings/http_build_query_error.phpt @@ -0,0 +1,13 @@ +--TEST-- +Testing error on null parameter 1 of http_build_query() +--CREDITS-- +Pawel Krynicki <pawel.krynicki [at] xsolve [dot] pl> +#testfest AmsterdamPHP 2012-06-23 +--FILE-- +<?php + +$result = http_build_query(null); + +?> +--EXPECTF-- +Warning: http_build_query(): Parameter 1 expected to be Array or Object. %s value given in %s on line %d
\ No newline at end of file diff --git a/ext/standard/tests/strings/quoted_printable_encode_002.phpt b/ext/standard/tests/strings/quoted_printable_encode_002.phpt Binary files differindex 5380eb0bf..aaf5608f3 100644 --- a/ext/standard/tests/strings/quoted_printable_encode_002.phpt +++ b/ext/standard/tests/strings/quoted_printable_encode_002.phpt diff --git a/ext/standard/tests/strings/str_pad_variation5.phpt b/ext/standard/tests/strings/str_pad_variation5.phpt index 4b300c471..cd979a1c8 100644 --- a/ext/standard/tests/strings/str_pad_variation5.phpt +++ b/ext/standard/tests/strings/str_pad_variation5.phpt @@ -5,6 +5,9 @@ memory_limit=128M --SKIPIF-- <?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); +if (getenv("USE_ZEND_ALLOC") === "0") { + die("skip Zend MM disabled"); +} ?> --FILE-- <?php diff --git a/ext/standard/tests/url/bug63162.phpt b/ext/standard/tests/url/bug63162.phpt new file mode 100644 index 000000000..ea5205efd --- /dev/null +++ b/ext/standard/tests/url/bug63162.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test parse_url() for bug #63162 +--DESCRIPTION-- +This test covers tests the inputs: +[0]=> http://user:pass@host +[1]=> //user:pass@host +[2]=> //user@host +--FILE-- +<?php +var_dump(parse_url('http://user:pass@host')); +var_dump(parse_url('//user:pass@host')); +var_dump(parse_url('//user@host')); +?> +--EXPECT-- +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(4) "host" + ["user"]=> + string(4) "user" + ["pass"]=> + string(4) "pass" +} +array(3) { + ["host"]=> + string(4) "host" + ["user"]=> + string(4) "user" + ["pass"]=> + string(4) "pass" +} +array(2) { + ["host"]=> + string(4) "host" + ["user"]=> + string(4) "user" +} diff --git a/ext/standard/tests/url/parse_url_relative_scheme.phpt b/ext/standard/tests/url/parse_url_relative_scheme.phpt new file mode 100644 index 000000000..7c8952db7 --- /dev/null +++ b/ext/standard/tests/url/parse_url_relative_scheme.phpt @@ -0,0 +1,11 @@ +--TEST-- +Test parse_url() function: Checks relative URL schemes (e.g. "//example.com") +--FILE-- +<?php +var_dump(parse_url('//example.org')); +--EXPECT-- +array(1) { + ["host"]=> + string(11) "example.org" +} + diff --git a/ext/standard/url.c b/ext/standard/url.c index 8489f4209..c15932283 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -201,9 +201,13 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) STR_FREE(ret->scheme); efree(ret); return NULL; + } else if (*s == '/' && *(s+1) == '/') { /* relative-scheme URL */ + s += 2; } else { goto just_path; } + } else if (*s == '/' && *(s+1) == '/') { /* relative-scheme URL */ + s += 2; } else { just_path: ue = s + length; @@ -220,14 +224,14 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) if (query && fragment) { if (query > fragment) { - p = e = fragment; + e = fragment; } else { - p = e = query; + e = query; } } else if (query) { - p = e = query; + e = query; } else if (fragment) { - p = e = fragment; + e = fragment; } } else { e = p; diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c index 5a15d3a4b..b1dc9d751 100644 --- a/ext/standard/url_scanner_ex.c +++ b/ext/standard/url_scanner_ex.c @@ -1,9 +1,9 @@ /* Generated by re2c 0.13.5 on Mon May 23 12:29:55 2011 */ /* +----------------------------------------------------------------------+ - | PHP Version 6 | + | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re index e7218a14f..2e37cf0ba 100644 --- a/ext/standard/url_scanner_ex.re +++ b/ext/standard/url_scanner_ex.re @@ -1,8 +1,8 @@ /* +----------------------------------------------------------------------+ - | PHP Version 6 | + | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/standard/var.c b/ext/standard/var.c index 735d0a7cb..a4fa262e7 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -453,6 +453,11 @@ PHPAPI void php_var_export_ex(zval **struc, int level, smart_str *buf TSRMLS_DC) break; case IS_ARRAY: myht = Z_ARRVAL_PP(struc); + if(myht && myht->nApplyCount > 0){ + smart_str_appendl(buf, "NULL", 4); + zend_error(E_WARNING, "var_export does not handle circular references"); + return; + } if (level > 1) { smart_str_appendc(buf, '\n'); buffer_append_spaces(buf, level - 1); @@ -469,6 +474,11 @@ PHPAPI void php_var_export_ex(zval **struc, int level, smart_str *buf TSRMLS_DC) case IS_OBJECT: myht = Z_OBJPROP_PP(struc); + if(myht && myht->nApplyCount > 0){ + smart_str_appendl(buf, "NULL", 4); + zend_error(E_WARNING, "var_export does not handle circular references"); + return; + } if (level > 1) { smart_str_appendc(buf, '\n'); buffer_append_spaces(buf, level - 1); @@ -629,6 +639,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt HashPosition pos; int i; zval nval, *nvalp; + HashTable *propers; ZVAL_NULL(&nval); nvalp = &nval; @@ -654,7 +665,8 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt smart_str_appendl(buf,"N;", 2); continue; } - if (zend_hash_find(Z_OBJPROP_P(struc), Z_STRVAL_PP(name), Z_STRLEN_PP(name) + 1, (void *) &d) == SUCCESS) { + propers = Z_OBJPROP_P(struc); + if (zend_hash_find(propers, Z_STRVAL_PP(name), Z_STRLEN_PP(name) + 1, (void *) &d) == SUCCESS) { php_var_serialize_string(buf, Z_STRVAL_PP(name), Z_STRLEN_PP(name)); php_var_serialize_intern(buf, *d, var_hash TSRMLS_CC); } else { @@ -666,7 +678,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt do { zend_mangle_property_name(&priv_name, &prop_name_length, ce->name, ce->name_length, Z_STRVAL_PP(name), Z_STRLEN_PP(name), ce->type & ZEND_INTERNAL_CLASS); - if (zend_hash_find(Z_OBJPROP_P(struc), priv_name, prop_name_length + 1, (void *) &d) == SUCCESS) { + if (zend_hash_find(propers, priv_name, prop_name_length + 1, (void *) &d) == SUCCESS) { php_var_serialize_string(buf, priv_name, prop_name_length); pefree(priv_name, ce->type & ZEND_INTERNAL_CLASS); php_var_serialize_intern(buf, *d, var_hash TSRMLS_CC); @@ -674,7 +686,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt } pefree(priv_name, ce->type & ZEND_INTERNAL_CLASS); zend_mangle_property_name(&prot_name, &prop_name_length, "*", 1, Z_STRVAL_PP(name), Z_STRLEN_PP(name), ce->type & ZEND_INTERNAL_CLASS); - if (zend_hash_find(Z_OBJPROP_P(struc), prot_name, prop_name_length + 1, (void *) &d) == SUCCESS) { + if (zend_hash_find(propers, prot_name, prop_name_length + 1, (void *) &d) == SUCCESS) { php_var_serialize_string(buf, prot_name, prop_name_length); pefree(prot_name, ce->type & ZEND_INTERNAL_CLASS); php_var_serialize_intern(buf, *d, var_hash TSRMLS_CC); diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c index 9a90a1d39..4cd6aafc3 100644 --- a/ext/standard/var_unserializer.c +++ b/ext/standard/var_unserializer.c @@ -612,10 +612,13 @@ yy20: do { /* Try to find class directly */ + BG(serialize_lock) = 1; if (zend_lookup_class(class_name, len2, &pce TSRMLS_CC) == SUCCESS) { + BG(serialize_lock) = 0; ce = *pce; break; } + BG(serialize_lock) = 0; /* Check for unserialize callback */ if ((PG(unserialize_callback_func) == NULL) || (PG(unserialize_callback_func)[0] == '\0')) { @@ -630,7 +633,9 @@ yy20: args[0] = &arg_func_name; MAKE_STD_ZVAL(arg_func_name); ZVAL_STRING(arg_func_name, class_name, 1); + BG(serialize_lock) = 1; if (call_user_function_ex(CG(function_table), NULL, user_func, &retval_ptr, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) { + BG(serialize_lock) = 0; php_error_docref(NULL TSRMLS_CC, E_WARNING, "defined (%s) but not found", user_func->value.str.val); incomplete_class = 1; ce = PHP_IC_ENTRY; @@ -638,6 +643,7 @@ yy20: zval_ptr_dtor(&arg_func_name); break; } + BG(serialize_lock) = 0; if (retval_ptr) { zval_ptr_dtor(&retval_ptr); } diff --git a/ext/xml/tests/bug62328.phpt b/ext/xml/tests/bug62328.phpt new file mode 100644 index 000000000..e4c3c59d3 --- /dev/null +++ b/ext/xml/tests/bug62328.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #62328 (implementing __toString and a cast to string fails) +--SKIPIF-- +<?php +require_once("skipif.inc"); +?> +--FILE-- +<?php +class UberSimpleXML extends SimpleXMLElement { + public function __toString() { + return 'stringification'; + } +} + +$xml = new UberSimpleXML('<xml/>'); + +var_dump((string) $xml); +var_dump($xml->__toString()); +--EXPECT-- +string(15) "stringification" +string(15) "stringification" diff --git a/ext/xmlrpc/tests/bug61264.phpt b/ext/xmlrpc/tests/bug61264.phpt index b1da27f25..24e4b2749 100644 --- a/ext/xmlrpc/tests/bug61264.phpt +++ b/ext/xmlrpc/tests/bug61264.phpt @@ -1,5 +1,7 @@ --TEST-- Bug #61264: xmlrpc_parse_method_descriptions leaks temporary variable +--SKIPIF-- +<?php if (!extension_loaded("xmlrpc")) print "skip"; ?> --FILE-- <?php $xml = <<<XML diff --git a/ext/zip/tests/bug51353.phpt b/ext/zip/tests/bug51353.phpt new file mode 100644 index 000000000..560945f9d --- /dev/null +++ b/ext/zip/tests/bug51353.phpt @@ -0,0 +1,54 @@ +--TEST-- +Bug #51353 ZIP64 problem, archive with 100000 items +--SKIPIF-- +<?php +if(!extension_loaded('zip')) die('skip'); +die('skip the test might get very long, activate it manually'); +--FILE-- +<?php +/* This test might get very long depending on the mashine it's running on. Therefore +adding an explicit skip, remove it to run this test. */ +set_time_limit(0); + +$base_path = dirname(__FILE__); + +/* Either we ship a file with 100000 entries which would be >12M big, + or create it dynamically. */ +$zip = new ZipArchive; +$r = $zip->open("$base_path/51353.zip", ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE); +if ($r) { + for ($i = 0; $i < 100000; $i++) { + $zip->addFromString("$i.txt", '1'); + } + $zip->close(); +} else { + die("failed"); +} + +$zip = new ZipArchive; +$r = $zip->open("$base_path/51353.zip"); +if ($r) { + $zip->extractTo("$base_path/51353_unpack"); + $zip->close(); + + $a = glob("$base_path/51353_unpack/*.txt"); + echo count($a) . "\n"; +} else { + die("failed"); +} + +echo "OK"; +--CLEAN-- +<?php +$base_path = dirname(__FILE__); + +unlink("$base_path/51353.zip"); + +$a = glob("$base_path/51353_unpack/*.txt"); +foreach($a as $f) { + unlink($f); +} +rmdir("$base_path/51353_unpack"); +--EXPECT-- +100000 +OK diff --git a/ext/zlib/tests/bug55544-win.phpt b/ext/zlib/tests/bug55544-win.phpt Binary files differnew file mode 100644 index 000000000..03fd6b1c9 --- /dev/null +++ b/ext/zlib/tests/bug55544-win.phpt diff --git a/ext/zlib/tests/bug55544.phpt b/ext/zlib/tests/bug55544.phpt Binary files differindex ca4214a46..a0d22f4fc 100644 --- a/ext/zlib/tests/bug55544.phpt +++ b/ext/zlib/tests/bug55544.phpt diff --git a/ext/zlib/tests/bug_52944-darwin.phpt b/ext/zlib/tests/bug_52944-darwin.phpt new file mode 100644 index 000000000..c25babadf --- /dev/null +++ b/ext/zlib/tests/bug_52944-darwin.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #52944 (segfault with zlib filter and corrupted data) +--SKIPIF-- +<?php if (!extension_loaded("zlib")) print "skip"; ?> +<?php +if (PHP_OS != 'Darwin') { + die("skip Darwin only"); +} +--INI-- +allow_url_fopen=1 +--FILE-- +<?php +require dirname(__FILE__) . "/bug_52944_corrupted_data.inc"; + +$fp = fopen('data://text/plain;base64,' . $data, 'r'); +stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ); +var_dump(fread($fp,1)); +var_dump(fread($fp,1)); +fclose($fp); +echo "Done.\n"; +--EXPECT-- +string(1) "%" +string(1) "C" +Done. diff --git a/ext/zlib/tests/bug_52944-win.phpt b/ext/zlib/tests/bug_52944-win.phpt new file mode 100644 index 000000000..fa369f8fb --- /dev/null +++ b/ext/zlib/tests/bug_52944-win.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #52944 (segfault with zlib filter and corrupted data) +--SKIPIF-- +<?php if (!extension_loaded("zlib")) print "skip"; ?> +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die("skip windows only"); +} +--INI-- +allow_url_fopen=1 +--FILE-- +<?php +require dirname(__FILE__) . "/bug_52944_corrupted_data.inc"; + +$fp = fopen('data://text/plain;base64,' . $data, 'r'); +stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ); +var_dump(fread($fp,1)); +var_dump(fread($fp,1)); +fclose($fp); +echo "Done.\n"; +--EXPECT-- +string(1) "%" +string(1) "C" +Done. diff --git a/ext/zlib/tests/bug_52944.phpt b/ext/zlib/tests/bug_52944.phpt index c090fe6f5..ed4af3e15 100644 --- a/ext/zlib/tests/bug_52944.phpt +++ b/ext/zlib/tests/bug_52944.phpt @@ -1,162 +1,27 @@ ---TEST--
-Bug #52944 (segfault with zlib filter and corrupted data)
---SKIPIF--
-<?php if (!extension_loaded("zlib")) print "skip"; ?>
-<?php
-include "func.inc";
-if (substr(PHP_OS, 0, 3) == 'WIN' && version_compare(get_zlib_version(), '1.2.7') < 0) {
- die('skip - only for zlib >= 1.2.7 on windows');
-}
---INI--
-allow_url_fopen=1
---FILE--
-<?php
-$data =
-'U3XuBFLaJfQAWt4cqi8u8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E0'.
-'HHcF4NbbzaMTAVnidDQupcVXAV+SL6T3QKmGUnKo0PeNtyJcJmYknHYV9Seyu/KVBlbND09w2LMhX0KdQqeo54GTt5PCp67OPPD1'.
-'2naefOs1Les5FbK+XyA09UgFgY929nNwozi4CqMJOO7VGZ4XEXfdfntlCl50GXbtYwF2TUNAWV0m7u7xu73Nj+cgy/ePC/0M4nyg'.
-'GM7bO3sFES37I8ABKizJzVcABuLq9S546WoW5LY40KbRBFwY8XDtDsfo7bcIA3ohibCLN6rQCcH5RSjFpLqWpD7+XLRgO23tnMvZ'.
-'BcR9H+IJq3fiESmZWBbnilDlCKPe2X5QJA==';
-$fp = fopen('data://text/plain;base64,' . $data, 'r');
-stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ);
-var_dump(fread($fp,1));
-var_dump(fread($fp,1));
-fclose($fp);
-echo "Done.\n";
---EXPECT--
-string(0) ""
-string(0) ""
-Done.
+--TEST-- +Bug #52944 (segfault with zlib filter and corrupted data) +--SKIPIF-- +<?php if (!extension_loaded("zlib")) print "skip"; ?> +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die("skip not for windows"); +} +if (PHP_OS == 'Darwin') { + die("skip not for Darwin"); +} +--INI-- +allow_url_fopen=1 +--FILE-- +<?php +require dirname(__FILE__) . "/bug_52944_corrupted_data.inc"; + +$fp = fopen('data://text/plain;base64,' . $data, 'r'); +stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ); +var_dump(fread($fp,1)); +var_dump(fread($fp,1)); +fclose($fp); +echo "Done.\n"; +--EXPECT-- +string(0) "" +string(0) "" +Done. diff --git a/ext/zlib/tests/bug_52944_corrupted_data.inc b/ext/zlib/tests/bug_52944_corrupted_data.inc new file mode 100644 index 000000000..ed46a36a1 --- /dev/null +++ b/ext/zlib/tests/bug_52944_corrupted_data.inc @@ -0,0 +1,142 @@ +<?php + +// corrupted data +$data = +'U3XuBFLaJfQAWt4cqi8u8ugXxyDcPTZy8VicbJr50gGTEh0d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