Browse Source

Merge branch 'PHP-5.5'

* PHP-5.5:
  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
pull/452/merge
David Soria Parra 12 years ago
parent
commit
ca75e6f760
  1. 2
      ext/date/lib/parse_date.c
  2. 2
      ext/date/lib/parse_date.re
  3. 14
      ext/date/tests/bug64157.phpt
  4. 4
      ext/filter/logical_filters.c
  5. 11
      ext/filter/tests/bug64441.phpt
  6. 13
      ext/spl/internal/emptyiterator.inc
  7. 12
      ext/spl/spl_iterators.c
  8. 8
      ext/spl/tests/bug60577.phpt

2
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;
}

2
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;
}

14
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

4
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 (

11
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/"

13
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;
}
}
?>
?>

12
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);

8
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)
Loading…
Cancel
Save