diff options
author | David Soria Parra <dsp@php.net> | 2013-09-16 23:36:37 +0200 |
---|---|---|
committer | David Soria Parra <dsp@php.net> | 2013-09-16 23:36:37 +0200 |
commit | 3d6ac70e6652c2c15b180e3f34fdc061e47f68a4 (patch) | |
tree | bf96f616861f6f5b73dccf4d7058fd50ee299ad6 | |
parent | b5283b9b7abecde841eb268c4b158cd76630d53b (diff) | |
parent | 6a0b90da84433ab1b0844a96036f3185d8a29cef (diff) | |
download | php-git-3d6ac70e6652c2c15b180e3f34fdc061e47f68a4.tar.gz |
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
NEWS for #60577
NEWS for bug #64441
Fix bug #64441 (FILTER_VALIDATE_URL rejects fully qualified domain names)
EmptyIterator now implements Countable; fixes bug 60577
News for bugfix #64157
Bug 64157 Changed error message to make sense
-rw-r--r-- | ext/date/lib/parse_date.c | 2 | ||||
-rw-r--r-- | ext/date/lib/parse_date.re | 2 | ||||
-rw-r--r-- | ext/date/tests/bug64157.phpt | 14 | ||||
-rw-r--r-- | ext/filter/logical_filters.c | 4 | ||||
-rw-r--r-- | ext/filter/tests/bug64441.phpt | 11 | ||||
-rw-r--r-- | ext/spl/internal/emptyiterator.inc | 13 | ||||
-rw-r--r-- | ext/spl/spl_iterators.c | 12 | ||||
-rw-r--r-- | ext/spl/tests/bug60577.phpt | 8 |
8 files changed, 58 insertions, 8 deletions
diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c index 9428ce3804..0e99e231d6 100644 --- a/ext/date/lib/parse_date.c +++ b/ext/date/lib/parse_date.c @@ -25002,7 +25002,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim TIMELIB_CHECK_NUMBER; sec = timelib_get_nr_ex((char **) &ptr, 2, &length); if (sec == TIMELIB_UNSET || length != 2) { - add_pbf_error(s, "A two second minute could not be found", string, begin); + add_pbf_error(s, "A two digit second could not be found", string, begin); } else { s->time->s = sec; } diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re index 7efeb430c3..6d91d9ada9 100644 --- a/ext/date/lib/parse_date.re +++ b/ext/date/lib/parse_date.re @@ -2009,7 +2009,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim TIMELIB_CHECK_NUMBER; sec = timelib_get_nr_ex((char **) &ptr, 2, &length); if (sec == TIMELIB_UNSET || length != 2) { - add_pbf_error(s, "A two second minute could not be found", string, begin); + add_pbf_error(s, "A two digit second could not be found", string, begin); } else { s->time->s = sec; } diff --git a/ext/date/tests/bug64157.phpt b/ext/date/tests/bug64157.phpt new file mode 100644 index 0000000000..fb71495430 --- /dev/null +++ b/ext/date/tests/bug64157.phpt @@ -0,0 +1,14 @@ +--TEST-- +Test for bug #64157: DateTime::createFromFormat() reports confusing error message +--CREDITS-- +Boro Sitnikovski <buritomath@yahoo.com> +--INI-- +date.timezone = UTC +--FILE-- +<?php +DateTime::createFromFormat('s', '0'); +$lastErrors = DateTime::getLastErrors(); +print_r($lastErrors['errors'][0]); +?> +--EXPECT-- +A two digit second could not be found diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c index b8df2183b9..9a26cc65d9 100644 --- a/ext/filter/logical_filters.c +++ b/ext/filter/logical_filters.c @@ -484,10 +484,6 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ } s++; } - - if (*(e - 1) == '.') { - goto bad_url; - } } if ( diff --git a/ext/filter/tests/bug64441.phpt b/ext/filter/tests/bug64441.phpt new file mode 100644 index 0000000000..149079ec05 --- /dev/null +++ b/ext/filter/tests/bug64441.phpt @@ -0,0 +1,11 @@ +--TEST-- +bug 64441, FILTER_VALIDATE_URL will invalidate a hostname that ended by dot +--SKIPIF-- +<?php if (!extension_loaded("filter")) die("skip"); ?> +--FILE-- +<?php +var_dump(filter_var('http://example.com./', FILTER_VALIDATE_URL)); +var_dump(filter_var('http://example.com/', FILTER_VALIDATE_URL)); +--EXPECT-- +string(20) "http://example.com./" +string(19) "http://example.com/" diff --git a/ext/spl/internal/emptyiterator.inc b/ext/spl/internal/emptyiterator.inc index ac80e79581..d02b15b999 100644 --- a/ext/spl/internal/emptyiterator.inc +++ b/ext/spl/internal/emptyiterator.inc @@ -15,7 +15,7 @@ * @version 1.0 * @since PHP 5.1 */ -class EmptyIterator implements Iterator +class EmptyIterator implements Iterator, Countable { /** No operation. * @return void @@ -57,6 +57,15 @@ class EmptyIterator implements Iterator { // nothing to do } + + /** + * @return int + */ + function count() + { + return 0; + } + } -?>
\ No newline at end of file +?> diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 30532756cb..476c64e29d 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -3241,12 +3241,23 @@ SPL_METHOD(EmptyIterator, next) } } /* }}} */ +/* {{{ proto int EmptyIterator::count() + Does nothing */ +SPL_METHOD(EmptyIterator, count) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + RETURN_LONG(0); +} /* }}} */ + static const zend_function_entry spl_funcs_EmptyIterator[] = { SPL_ME(EmptyIterator, rewind, arginfo_recursive_it_void, ZEND_ACC_PUBLIC) SPL_ME(EmptyIterator, valid, arginfo_recursive_it_void, ZEND_ACC_PUBLIC) SPL_ME(EmptyIterator, key, arginfo_recursive_it_void, ZEND_ACC_PUBLIC) SPL_ME(EmptyIterator, current, arginfo_recursive_it_void, ZEND_ACC_PUBLIC) SPL_ME(EmptyIterator, next, arginfo_recursive_it_void, ZEND_ACC_PUBLIC) + SPL_ME(EmptyIterator, count, arginfo_recursive_it_void, ZEND_ACC_PUBLIC) PHP_FE_END }; @@ -3707,6 +3718,7 @@ PHP_MINIT_FUNCTION(spl_iterators) REGISTER_SPL_STD_CLASS_EX(EmptyIterator, NULL, spl_funcs_EmptyIterator); REGISTER_SPL_ITERATOR(EmptyIterator); + REGISTER_SPL_IMPLEMENTS(EmptyIterator, Countable); REGISTER_SPL_SUB_CLASS_EX(RecursiveTreeIterator, RecursiveIteratorIterator, spl_RecursiveTreeIterator_new, spl_funcs_RecursiveTreeIterator); REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "BYPASS_CURRENT", RTIT_BYPASS_CURRENT); diff --git a/ext/spl/tests/bug60577.phpt b/ext/spl/tests/bug60577.phpt new file mode 100644 index 0000000000..33fc133d0f --- /dev/null +++ b/ext/spl/tests/bug60577.phpt @@ -0,0 +1,8 @@ +--TEST-- +count(new EmptyIterator) should return zero +--FILE-- +<?php +$it = new EmptyIterator; +var_dump(count($it)); +--EXPECT-- +int(0) |