Compare commits

..
Author SHA1 Message Date
Julien Pauli 0c3302fb21 5.5.16RC1 2014-08-06 11:02:17 +02:00
113 changed files with 1845 additions and 3659 deletions

No files matched your search

+6 -90
View File
@@ -1,86 +1,6 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
16 Oct 2014, PHP 5.5.18
- Core:
. Fixed bug #67985 (Incorrect last used array index copied to new array after
unset). (Tjerk)
. Fixed bug #67739 (Windows 8.1/Server 2012 R2 OS build number reported
as 6.2 (instead of 6.3)). (Christian Wenz)
. Fixed bug #67633 (A foreach on an array returned from a function not doing
copy-on-write). (Nikita)
. Fixed bug #51800 (proc_open on Windows hangs forever). (Anatol)
. Fixed bug #68044 (Integer overflow in unserialize() (32-bits only)).
(CVE-2014-3669) (Stas)
- cURL:
. Fixed bug #68089 (NULL byte injection - cURL lib). (Stas)
- EXIF:
. Fixed bug #68113 (Heap corruption in exif_thumbnail()). (CVE-2014-3670)
(Stas)
- FPM:
. Fixed bug #65641 (PHP-FPM incorrectly defines the SCRIPT_NAME variable
when using Apache, mod_proxy-fcgi and ProxyPass). (Remi)
- OpenSSL:
. Revert regression introduced by fix of bug #41631
- Reflection:
. Fixed bug #68103 (Duplicate entry in Reflection for class alias). (Remi)
- Session:
. Fixed bug #67972 (SessionHandler Invalid memory read create_sid()). (Adam)
- XMLRPC:
. Fixed bug #68027 (Global buffer overflow in mkgmtime() function).
(CVE-2014-3668) (Stas)
18 Sep 2014, PHP 5.5.17
- Core:
. Fixed bug #47358 (glob returns error, should be empty array()). (Pierre)
. Fixed bug #65463 (SIGSEGV during zend_shutdown()). (Keyur Govande)
. Fixed bug #66036 (Crash on SIGTERM in apache process). (Keyur Govande)
. Fixed bug #67878 (program_prefix not honoured in man pages). (Remi)
- COM:
. Fixed bug #41577 (DOTNET is successful once per server run)
(Aidas Kasparas)
- FPM:
. Fixed #67606 (FPM with mod_fastcgi/apache2.4 is broken). (David Zuelke)
- OpenSSL:
. Fixed bug #41631 (socket timeouts not honored in blocking SSL reads).
(Daniel Lowrey)
. Fixed bug #67850 (extension won't build if openssl compiled without SSLv3)
(Daniel Lowrey)
- SPL:
. Fixed bug #67813 (CachingIterator::__construct InvalidArgumentException
wrong message). (tim_siebels_aurich at yahoo dot de)
- Date:
. Fixed bug #66091 (memory leaks in DateTime constructor). (Tjerk)
. Fixed bug #66985 (Some timezones are no longer valid in PHP 5.5.10).
(Derick)
. Fixed bug #67109 (First uppercase letter breaks date string parsing).
(Derick)
- GD
. Made fontFetch's path parser thread-safe. (Sara).
- MySQLi:
. Fixed bug #67839 (mysqli does not handle 4-byte floats correctly). (Keyur)
- Zlib:
. Fixed bug #67724 (chained zlib filters silently fail with large amounts of
data). (Mike)
. Fixed bug #67865 (internal corruption phar error). Mike
21 Aug 2014, PHP 5.5.16
08 Aug 2014, PHP 5.5.16RC1
- COM:
. Fixed missing type checks in com_event_sink (Yussuf Khalil, Stas).
@@ -88,7 +8,6 @@ PHP NEWS
- Fileinfo:
. Fixed bug #67705 (extensive backtracking in rule regular expression).
(CVE-2014-3538) (Remi)
. Fixed bug #67716 (Segfault in cdf.c). (CVE-2014-3587) (Remi)
- FPM:
. Fixed bug #67635 (php links to systemd libraries without using pkg-config).
@@ -97,17 +16,12 @@ PHP NEWS
- GD:
. Fixed bug #66901 (php-gd 'c_color' NULL pointer dereference).
(CVE-2014-2497) (Remi)
. Fixed bug #67730 (Null byte injection possible with imagexxx functions).
(CVE-2014-5120) (Ryan Mauger)
- Milter:
. Fixed bug #67715 (php-milter does not build and crashes randomly). (Mike)
- Network:
. Fixed bug #67717 (segfault in dns_get_record). (CVE-2014-3597) (Remi)
- OpenSSL:
. Fixed missing type checks in OpenSSL options. (Yussuf Khalil, Stas)
. Fixed missing type checks in OpenSSL options (Yussuf Khalil, Stas).
- readline:
. Fixed bug #55496 (Interactive mode doesn't force a newline before the
@@ -125,6 +39,10 @@ PHP NEWS
. Fixed bug #60616 (odbc_fetch_into returns junk data at end of multi-byte
char fields). (Keyur)
- Zlib:
. Fixed bug #67724 (chained zlib filters silently fail with large amounts of
data). (Mike)
24 Jul 2014, PHP 5.5.15
- Core:
@@ -237,8 +155,6 @@ PHP NEWS
. Fixed bug #66127 (Segmentation fault with ArrayObject unset). (Stas)
. Fixed bug #67359 (Segfault in recursiveDirectoryIterator). (Laruence)
. Fixed bug #67360 (Missing element after ArrayObject::getIterator). (Adam)
. Fixed bug #67492 (unserialize() SPL ArrayObject / SPLObjectStorage Type
Confusion). (CVE-2014-3515) (Stefan Esser)
29 May 2014, PHP 5.5.13
+4 -8
View File
@@ -45,16 +45,15 @@ Currently we have the following branches in use::
master The active development branch.
PHP-5.6 Is used to release the PHP 5.6.x series. This is a current
stable version and is open for bugfixes only.
PHP-5.5 Is used to release the PHP 5.5.x series. This is a current
stable version and is open for bugfixes only.
PHP-5.4 Is used to release the PHP 5.4.x series. This is a current
stable version and is open for bugfixes only.
PHP-5.3 This branch is closed.
PHP-5.3 Is used to release the PHP 5.3.x series. This is currently
in extended support and open forsecurity fixes only. Triaged
via security@php.net
PHP-5.2 This branch is closed.
@@ -62,12 +61,9 @@ Currently we have the following branches in use::
PHP-4.4 This branch is closed.
PHP-X.Y.Z These branches are used for the release managers for tagging
the releases, hence they are closed to the general public.
The next few rules are more of a technical nature::
1. All changes should first go to the lowest branch (i.e. 5.4) and then
1. All changes should first go to the lowest branch (i.e. 5.3) and then
get merged up to all other branches. If a change is not needed for
later branches (i.e. fixes for features which where dropped from later
branches) an empty merge should be done.
-44
View File
@@ -1,44 +0,0 @@
--TEST--
Bug #67633: A foreach on an array returned from a function not doing copy-on-write
--FILE--
<?php
function id($x) {
return $x;
}
function &ref_id(&$x) {
return $x;
}
$c = 'c';
$array = ['a', 'b', $c];
foreach(id($array) as &$v) {
$v .= 'q';
}
var_dump($array);
foreach(ref_id($array) as &$v) {
$v .= 'q';
}
var_dump($array);
?>
--EXPECT--
array(3) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(1) "c"
}
array(3) {
[0]=>
string(2) "aq"
[1]=>
string(2) "bq"
[2]=>
&string(2) "cq"
}
-16
View File
@@ -1,16 +0,0 @@
--TEST--
Bug #67985 - Last used array index not copied to new array at assignment
--FILE--
<?php
$a = ['zero', 'one', 'two'];
unset($a[2]);
$b = $a;
$a[] = 'three';
$b[] = 'three';
var_dump($a === $b);
?>
--EXPECT--
bool(true)
-14
View File
@@ -814,20 +814,6 @@ void zend_shutdown(TSRMLS_D) /* {{{ */
zend_shutdown_timeout_thread();
#endif
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
if (EG(active))
{
/*
* The order of destruction is important here.
* See bugs #65463 and 66036.
*/
zend_hash_reverse_apply(GLOBAL_FUNCTION_TABLE, (apply_func_t) zend_cleanup_function_data_full TSRMLS_CC);
zend_hash_reverse_apply(GLOBAL_CLASS_TABLE, (apply_func_t) zend_cleanup_user_class_data TSRMLS_CC);
zend_cleanup_internal_classes(TSRMLS_C);
zend_hash_reverse_apply(GLOBAL_FUNCTION_TABLE, (apply_func_t) clean_non_persistent_function_full TSRMLS_CC);
zend_hash_reverse_apply(GLOBAL_CLASS_TABLE, (apply_func_t) clean_non_persistent_class_full TSRMLS_CC);
}
zend_destroy_modules();
zend_hash_destroy(GLOBAL_FUNCTION_TABLE);
-9
View File
@@ -6231,15 +6231,6 @@ void zend_do_foreach_begin(znode *foreach_token, znode *open_brackets_token, zno
/* save the location of FETCH_W instruction(s) */
open_brackets_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
zend_do_end_variable_parse(array, BP_VAR_W, 0 TSRMLS_CC);
if (zend_is_function_or_method_call(array)) {
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
opline->opcode = ZEND_SEPARATE;
SET_NODE(opline->op1, array);
SET_UNUSED(opline->op2);
opline->result_type = IS_VAR;
opline->result.var = opline->op1.var;
}
} else {
is_variable = 0;
open_brackets_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
-2
View File
@@ -666,8 +666,6 @@ ZEND_API void zend_cleanup_internal_class_data(zend_class_entry *ce TSRMLS_DC);
ZEND_API void zend_cleanup_internal_classes(TSRMLS_D);
ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC);
ZEND_API int zend_cleanup_function_data_full(zend_function *function TSRMLS_DC);
ZEND_API int clean_non_persistent_function_full(zend_function *function TSRMLS_DC);
ZEND_API int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC);
ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC);
ZEND_API void zend_function_dtor(zend_function *function);
+2 -2
View File
@@ -109,7 +109,7 @@ static int clean_non_persistent_function(zend_function *function TSRMLS_DC) /* {
}
/* }}} */
ZEND_API int clean_non_persistent_function_full(zend_function *function TSRMLS_DC) /* {{{ */
static int clean_non_persistent_function_full(zend_function *function TSRMLS_DC) /* {{{ */
{
return (function->type == ZEND_INTERNAL_FUNCTION) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
}
@@ -121,7 +121,7 @@ static int clean_non_persistent_class(zend_class_entry **ce TSRMLS_DC) /* {{{ */
}
/* }}} */
ZEND_API int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC) /* {{{ */
static int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC) /* {{{ */
{
return ((*ce)->type == ZEND_INTERNAL_CLASS) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
}
-1
View File
@@ -136,7 +136,6 @@ ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC)
ALLOC_HASHTABLE_REL(tmp_ht);
zend_hash_init(tmp_ht, zend_hash_num_elements(original_ht), NULL, ZVAL_PTR_DTOR, 0);
zend_hash_copy(tmp_ht, original_ht, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
tmp_ht->nNextFreeElement = original_ht->nNextFreeElement;
zvalue->value.ht = tmp_ht;
}
break;
+1 -1
View File
@@ -2800,7 +2800,7 @@ AC_DEFUN([PHP_DETECT_ICC],
dnl PHP_DETECT_SUNCC
dnl Detect if the systems default compiler is suncc.
dnl We also set some useful CFLAGS if the user didn't set any
dnl We also set some usefull CFLAGS if the user didn't set any
AC_DEFUN([PHP_DETECT_SUNCC],[
SUNCC="no"
AC_MSG_CHECKING([for suncc])
+3 -9
View File
@@ -615,7 +615,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
s390*-*linux*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -629,10 +629,7 @@ s390*-*linux*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_i386"
;;
powerpc64le-*linux*)
LD="${LD-ld} -m elf32lppclinux"
;;
powerpc64-*linux*)
ppc64-*linux*|powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -651,10 +648,7 @@ s390*-*linux*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*linux*)
LD="${LD-ld} -m elf64lppc"
;;
powerpc-*linux*)
ppc*-*linux*|powerpc*-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*)
-6
View File
@@ -982,12 +982,6 @@ EOF
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit ;;
ppc64le:Linux:*:*)
echo powerpc64le-unknown-linux-gnu
exit ;;
ppcle:Linux:*:*)
echo powerpcle-unknown-linux-gnu
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
exit ;;
+10 -24
View File
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=5
PHP_MINOR_VERSION=5
PHP_RELEASE_VERSION=18
PHP_EXTRA_VERSION=""
PHP_RELEASE_VERSION=16
PHP_EXTRA_VERSION="RC1"
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
@@ -784,12 +784,7 @@ if test "$PHP_GCOV" = "yes"; then
AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
fi
dnl min: 1.5 (i.e. 105, major * 100 + minor for easier comparison)
ltp_version_min="105"
dnl non-working versions, e.g. "1.8 1.18";
dnl remove "none" when introducing the first incompatible LTP version an
dnl separate any following additions by spaces
ltp_version_exclude="1.8"
ltp_version_list="1.5 1.6 1.7 1.9 1.10"
AC_CHECK_PROG(LTP, lcov, lcov)
AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
@@ -799,30 +794,21 @@ if test "$PHP_GCOV" = "yes"; then
if test "$LTP"; then
AC_CACHE_CHECK([for ltp version], php_cv_ltp_version, [
php_cv_ltp_version=invalid
ltp_version_vars=`$LTP -v 2>/dev/null | $SED -e 's/^.* //' -e 's/\./ /g' | tr -d a-z`
if test -n "$ltp_version_vars"; then
set $ltp_version_vars
ltp_version="${1}.${2}"
ltp_version_num="`expr ${1} \* 100 + ${2}`"
if test $ltp_version_num -ge $ltp_version_min; then
php_cv_ltp_version="$ltp_version (ok)"
for ltp_check_version in $ltp_version_exclude; do
if test "$ltp_version" = "$ltp_check_version"; then
php_cv_ltp_version=invalid
break
fi
done
ltp_version=`$LTP -v 2>/dev/null | $SED -e 's/^.* //'`
for ltp_check_version in $ltp_version_list; do
if test "$ltp_version" = "$ltp_check_version"; then
php_cv_ltp_version="$ltp_check_version (ok)"
fi
fi
done
])
else
ltp_msg="To enable code coverage reporting you must have LTP installed"
ltp_msg="To enable code coverage reporting you must have one of the following LTP versions installed: $ltp_version_list"
AC_MSG_ERROR([$ltp_msg])
fi
case $php_cv_ltp_version in
""|invalid[)]
ltp_msg="This LTP version is not supported (found: $ltp_version, min: $ltp_version_min, excluded: $ltp_version_exclude)."
ltp_msg="You must have one of the following versions of LTP: $ltp_version_list (found: $ltp_version)."
AC_MSG_ERROR([$ltp_msg])
LTP="exit 0;"
;;
+3 -30
View File
@@ -198,8 +198,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
IUnknown *unk = NULL;
php_com_initialize(TSRMLS_C);
stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff);
if (stuff == NULL) {
if (COMG(dotnet_runtime_stuff) == NULL) {
hr = dotnet_init(&where TSRMLS_CC);
if (FAILED(hr)) {
char buf[1024];
@@ -211,36 +210,10 @@ PHP_FUNCTION(com_dotnet_create_instance)
ZVAL_NULL(object);
return;
}
stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff);
} else if (stuff->dotnet_domain == NULL) {
where = "ICorRuntimeHost_GetDefaultDomain";
hr = ICorRuntimeHost_GetDefaultDomain(stuff->dotnet_host, &unk);
if (FAILED(hr)) {
char buf[1024];
char *err = php_win32_error_to_msg(hr);
snprintf(buf, sizeof(buf), "Failed to re-init .Net domain [%s] %s", where, err);
if (err)
LocalFree(err);
php_com_throw_exception(hr, buf TSRMLS_CC);
ZVAL_NULL(object);
return;
}
where = "QI: System._AppDomain";
hr = IUnknown_QueryInterface(unk, &IID_mscorlib_System_AppDomain, (LPVOID*)&stuff->dotnet_domain);
if (FAILED(hr)) {
char buf[1024];
char *err = php_win32_error_to_msg(hr);
snprintf(buf, sizeof(buf), "Failed to re-init .Net domain [%s] %s", where, err);
if (err)
LocalFree(err);
php_com_throw_exception(hr, buf TSRMLS_CC);
ZVAL_NULL(object);
return;
}
}
stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff);
obj = CDNO_FETCH(object);
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l",
-5
View File
@@ -169,11 +169,6 @@ static int php_curl_option_str(php_curl *ch, long option, const char *str, const
{
CURLcode error = CURLE_OK;
if (strlen(str) != len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Curl option contains invalid characters (\\0)");
return FAILURE;
}
#if LIBCURL_VERSION_NUM >= 0x071100
if (make_copy) {
#endif
-18
View File
@@ -1,18 +0,0 @@
--TEST--
Bug #68089 (NULL byte injection - cURL lib)
--SKIPIF--
<?php
include 'skipif.inc';
?>
--FILE--
<?php
$url = "file:///etc/passwd\0http://google.com";
$ch = curl_init();
var_dump(curl_setopt($ch, CURLOPT_URL, $url));
?>
Done
--EXPECTF--
Warning: curl_setopt(): Curl option contains invalid characters (\0) in %s/bug68089.php on line 4
bool(false)
Done
+1 -1
View File
@@ -28,7 +28,7 @@ Features
AsynchDNS => Yes
CharConv => No
Debug => No
GSS-Negotiate => No
GSS-Negotiate => Yes
IDN => Yes
IPv6 => Yes
krb4 => No
+136 -110
View File
@@ -1,4 +1,4 @@
/* Generated by re2c 0.13.5 on Mon Aug 18 18:28:27 2014 */
/* Generated by re2c 0.13.5 on Thu Jul 31 14:33:37 2014 */
#line 1 "ext/date/lib/parse_date.re"
/*
+----------------------------------------------------------------------+
@@ -670,7 +670,7 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, S
}
}
const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffset, int isdst)
const static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffset, int isdst)
{
int first_found = 0;
const timelib_tz_lookup_table *tp, *first_found_elem = NULL;
@@ -698,6 +698,25 @@ const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffs
return first_found_elem;
}
for (tp = timelib_timezone_lookup; tp->name; tp++) {
if (tp->full_tz_name && strcasecmp(word, tp->full_tz_name) == 0) {
if (!first_found) {
first_found = 1;
first_found_elem = tp;
if (gmtoffset == -1) {
return tp;
}
}
if (tp->gmtoffset == gmtoffset) {
return tp;
}
}
}
if (first_found) {
return first_found_elem;
}
/* Still didn't find anything, let's find the zone solely based on
* offset/isdst then */
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
@@ -708,7 +727,7 @@ const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffs
return NULL;
}
static long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found)
static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found)
{
char *word;
char *begin = *ptr, *end;
@@ -722,7 +741,7 @@ static long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found
word = calloc(1, end - begin + 1);
memcpy(word, begin, end - begin);
if ((tp = abbr_search(word, -1, 0))) {
if ((tp = zone_search(word, -1, 0))) {
value = -tp->gmtoffset / 60;
*dst = tp->type;
value += tp->type * 60;
@@ -766,26 +785,33 @@ long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found
retval = timelib_parse_tz_cor(ptr);
} else {
int found = 0;
long offset = 0;
long offset;
char *tz_abbr;
t->is_localtime = 1;
/* First, we lookup by abbreviation only */
offset = timelib_lookup_abbr(ptr, dst, &tz_abbr, &found);
offset = timelib_lookup_zone(ptr, dst, &tz_abbr, &found);
if (found) {
t->zone_type = TIMELIB_ZONETYPE_ABBR;
timelib_time_tz_abbr_update(t, tz_abbr);
}
/* Otherwise, we look if we have a TimeZone identifier */
if (!found || strcmp("UTC", tz_abbr) == 0) {
#if 0
/* If we found a TimeZone identifier, use it */
if (tz_name) {
t->tz_info = timelib_parse_tzfile(tz_name);
t->zone_type = TIMELIB_ZONETYPE_ID;
}
#endif
/* If we have a TimeZone identifier to start with, use it */
if (strstr(tz_abbr, "/") || strcmp(tz_abbr, "UTC") == 0) {
if ((res = tz_wrapper(tz_abbr, tzdb)) != NULL) {
t->tz_info = res;
t->zone_type = TIMELIB_ZONETYPE_ID;
found++;
}
}
if (found && t->zone_type != TIMELIB_ZONETYPE_ID) {
timelib_time_tz_abbr_update(t, tz_abbr);
}
free(tz_abbr);
*tz_not_found = (found == 0);
retval = offset;
@@ -814,11 +840,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
std:
s->tok = cursor;
s->len = 0;
#line 940 "ext/date/lib/parse_date.re"
#line 966 "ext/date/lib/parse_date.re"
#line 822 "ext/date/lib/parse_date.c"
#line 848 "ext/date/lib/parse_date.c"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -958,7 +984,7 @@ yy2:
}
yy3:
YYDEBUG(3, *YYCURSOR);
#line 1620 "ext/date/lib/parse_date.re"
#line 1646 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
@@ -971,7 +997,7 @@ yy3:
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
}
#line 975 "ext/date/lib/parse_date.c"
#line 1001 "ext/date/lib/parse_date.c"
yy4:
YYDEBUG(4, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1282,12 +1308,12 @@ yy11:
if (yych <= '9') goto yy1385;
yy12:
YYDEBUG(12, *YYCURSOR);
#line 1715 "ext/date/lib/parse_date.re"
#line 1741 "ext/date/lib/parse_date.re"
{
add_error(s, "Unexpected character");
goto std;
}
#line 1291 "ext/date/lib/parse_date.c"
#line 1317 "ext/date/lib/parse_date.c"
yy13:
YYDEBUG(13, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2344,11 +2370,11 @@ yy48:
if (yych <= '9') goto yy54;
yy49:
YYDEBUG(49, *YYCURSOR);
#line 1704 "ext/date/lib/parse_date.re"
#line 1730 "ext/date/lib/parse_date.re"
{
goto std;
}
#line 2352 "ext/date/lib/parse_date.c"
#line 2378 "ext/date/lib/parse_date.c"
yy50:
YYDEBUG(50, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2357,12 +2383,12 @@ yy51:
YYDEBUG(51, *YYCURSOR);
++YYCURSOR;
YYDEBUG(52, *YYCURSOR);
#line 1709 "ext/date/lib/parse_date.re"
#line 1735 "ext/date/lib/parse_date.re"
{
s->pos = cursor; s->line++;
goto std;
}
#line 2366 "ext/date/lib/parse_date.c"
#line 2392 "ext/date/lib/parse_date.c"
yy53:
YYDEBUG(53, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2749,7 +2775,7 @@ yy71:
if (yych == 's') goto yy73;
yy72:
YYDEBUG(72, *YYCURSOR);
#line 1688 "ext/date/lib/parse_date.re"
#line 1714 "ext/date/lib/parse_date.re"
{
timelib_ull i;
DEBUG_OUTPUT("relative");
@@ -2764,7 +2790,7 @@ yy72:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 2768 "ext/date/lib/parse_date.c"
#line 2794 "ext/date/lib/parse_date.c"
yy73:
YYDEBUG(73, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3526,7 +3552,7 @@ yy165:
}
yy166:
YYDEBUG(166, *YYCURSOR);
#line 1551 "ext/date/lib/parse_date.re"
#line 1577 "ext/date/lib/parse_date.re"
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("daytext");
@@ -3543,7 +3569,7 @@ yy166:
TIMELIB_DEINIT;
return TIMELIB_WEEKDAY;
}
#line 3547 "ext/date/lib/parse_date.c"
#line 3573 "ext/date/lib/parse_date.c"
yy167:
YYDEBUG(167, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4063,7 +4089,7 @@ yy192:
}
yy193:
YYDEBUG(193, *YYCURSOR);
#line 1610 "ext/date/lib/parse_date.re"
#line 1636 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("monthtext");
TIMELIB_INIT;
@@ -4072,7 +4098,7 @@ yy193:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 4076 "ext/date/lib/parse_date.c"
#line 4102 "ext/date/lib/parse_date.c"
yy194:
YYDEBUG(194, *YYCURSOR);
++YYCURSOR;
@@ -4123,7 +4149,7 @@ yy197:
}
yy198:
YYDEBUG(198, *YYCURSOR);
#line 1356 "ext/date/lib/parse_date.re"
#line 1382 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datetextual | datenoyear");
@@ -4136,7 +4162,7 @@ yy198:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 4140 "ext/date/lib/parse_date.c"
#line 4166 "ext/date/lib/parse_date.c"
yy199:
YYDEBUG(199, *YYCURSOR);
yyaccept = 6;
@@ -4405,7 +4431,7 @@ yy221:
}
yy222:
YYDEBUG(222, *YYCURSOR);
#line 1658 "ext/date/lib/parse_date.re"
#line 1684 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
@@ -4434,7 +4460,7 @@ yy222:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 4438 "ext/date/lib/parse_date.c"
#line 4464 "ext/date/lib/parse_date.c"
yy223:
YYDEBUG(223, *YYCURSOR);
yyaccept = 7;
@@ -5132,7 +5158,7 @@ yy277:
YYDEBUG(277, *YYCURSOR);
++YYCURSOR;
YYDEBUG(278, *YYCURSOR);
#line 1634 "ext/date/lib/parse_date.re"
#line 1660 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
TIMELIB_INIT;
@@ -5155,7 +5181,7 @@ yy277:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 5159 "ext/date/lib/parse_date.c"
#line 5185 "ext/date/lib/parse_date.c"
yy279:
YYDEBUG(279, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5333,7 +5359,7 @@ yy293:
++YYCURSOR;
yy294:
YYDEBUG(294, *YYCURSOR);
#line 1328 "ext/date/lib/parse_date.re"
#line 1354 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenoday");
@@ -5346,7 +5372,7 @@ yy294:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 5350 "ext/date/lib/parse_date.c"
#line 5376 "ext/date/lib/parse_date.c"
yy295:
YYDEBUG(295, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6566,7 +6592,7 @@ yy361:
if (yych <= '9') goto yy364;
yy363:
YYDEBUG(363, *YYCURSOR);
#line 1472 "ext/date/lib/parse_date.re"
#line 1498 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextshort");
@@ -6579,7 +6605,7 @@ yy363:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 6583 "ext/date/lib/parse_date.c"
#line 6609 "ext/date/lib/parse_date.c"
yy364:
YYDEBUG(364, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7217,7 +7243,7 @@ yy391:
}
yy392:
YYDEBUG(392, *YYCURSOR);
#line 1530 "ext/date/lib/parse_date.re"
#line 1556 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
@@ -7237,7 +7263,7 @@ yy392:
TIMELIB_DEINIT;
return TIMELIB_AGO;
}
#line 7241 "ext/date/lib/parse_date.c"
#line 7267 "ext/date/lib/parse_date.c"
yy393:
YYDEBUG(393, *YYCURSOR);
yyaccept = 5;
@@ -8987,7 +9013,7 @@ yy453:
++YYCURSOR;
yy454:
YYDEBUG(454, *YYCURSOR);
#line 1233 "ext/date/lib/parse_date.re"
#line 1259 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
TIMELIB_INIT;
@@ -8998,7 +9024,7 @@ yy454:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 9002 "ext/date/lib/parse_date.c"
#line 9028 "ext/date/lib/parse_date.c"
yy455:
YYDEBUG(455, *YYCURSOR);
yyaccept = 0;
@@ -9558,7 +9584,7 @@ yy474:
}
yy475:
YYDEBUG(475, *YYCURSOR);
#line 1370 "ext/date/lib/parse_date.re"
#line 1396 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
@@ -9569,7 +9595,7 @@ yy475:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 9573 "ext/date/lib/parse_date.c"
#line 9599 "ext/date/lib/parse_date.c"
yy476:
YYDEBUG(476, *YYCURSOR);
yyaccept = 10;
@@ -9710,7 +9736,7 @@ yy487:
YYDEBUG(487, *YYCURSOR);
++YYCURSOR;
YYDEBUG(488, *YYCURSOR);
#line 1088 "ext/date/lib/parse_date.re"
#line 1114 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
TIMELIB_INIT;
@@ -9726,7 +9752,7 @@ yy487:
TIMELIB_DEINIT;
return TIMELIB_TIME12;
}
#line 9730 "ext/date/lib/parse_date.c"
#line 9756 "ext/date/lib/parse_date.c"
yy489:
YYDEBUG(489, *YYCURSOR);
yyaccept = 11;
@@ -9739,7 +9765,7 @@ yy489:
}
yy490:
YYDEBUG(490, *YYCURSOR);
#line 1125 "ext/date/lib/parse_date.re"
#line 1151 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long");
@@ -9764,7 +9790,7 @@ yy490:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 9768 "ext/date/lib/parse_date.c"
#line 9794 "ext/date/lib/parse_date.c"
yy491:
YYDEBUG(491, *YYCURSOR);
yyaccept = 11;
@@ -10074,7 +10100,7 @@ yy522:
YYDEBUG(522, *YYCURSOR);
++YYCURSOR;
YYDEBUG(523, *YYCURSOR);
#line 1105 "ext/date/lib/parse_date.re"
#line 1131 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("mssqltime");
TIMELIB_INIT;
@@ -10093,7 +10119,7 @@ yy522:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 10097 "ext/date/lib/parse_date.c"
#line 10123 "ext/date/lib/parse_date.c"
yy524:
YYDEBUG(524, *YYCURSOR);
yyaccept = 11;
@@ -10199,7 +10225,7 @@ yy533:
if (yych <= '9') goto yy540;
yy534:
YYDEBUG(534, *YYCURSOR);
#line 1287 "ext/date/lib/parse_date.re"
#line 1313 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datefull");
@@ -10213,7 +10239,7 @@ yy534:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL;
}
#line 10217 "ext/date/lib/parse_date.c"
#line 10243 "ext/date/lib/parse_date.c"
yy535:
YYDEBUG(535, *YYCURSOR);
yych = *++YYCURSOR;
@@ -10950,7 +10976,7 @@ yy604:
YYDEBUG(605, *YYCURSOR);
++YYCURSOR;
YYDEBUG(606, *YYCURSOR);
#line 1302 "ext/date/lib/parse_date.re"
#line 1328 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pointed date YYYY");
TIMELIB_INIT;
@@ -10961,7 +10987,7 @@ yy604:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 10965 "ext/date/lib/parse_date.c"
#line 10991 "ext/date/lib/parse_date.c"
yy607:
YYDEBUG(607, *YYCURSOR);
yyaccept = 11;
@@ -10997,7 +11023,7 @@ yy610:
if (yych <= '9') goto yy604;
yy611:
YYDEBUG(611, *YYCURSOR);
#line 1314 "ext/date/lib/parse_date.re"
#line 1340 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pointed date YY");
@@ -11010,7 +11036,7 @@ yy611:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 11014 "ext/date/lib/parse_date.c"
#line 11040 "ext/date/lib/parse_date.c"
yy612:
YYDEBUG(612, *YYCURSOR);
yyaccept = 11;
@@ -11651,7 +11677,7 @@ yy655:
}
yy656:
YYDEBUG(656, *YYCURSOR);
#line 1273 "ext/date/lib/parse_date.re"
#line 1299 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshort");
@@ -11664,7 +11690,7 @@ yy656:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 11668 "ext/date/lib/parse_date.c"
#line 11694 "ext/date/lib/parse_date.c"
yy657:
YYDEBUG(657, *YYCURSOR);
yyaccept = 13;
@@ -11770,7 +11796,7 @@ yy665:
}
yy666:
YYDEBUG(666, *YYCURSOR);
#line 1217 "ext/date/lib/parse_date.re"
#line 1243 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("americanshort | american");
@@ -11785,7 +11811,7 @@ yy666:
TIMELIB_DEINIT;
return TIMELIB_AMERICAN;
}
#line 11789 "ext/date/lib/parse_date.c"
#line 11815 "ext/date/lib/parse_date.c"
yy667:
YYDEBUG(667, *YYCURSOR);
yyaccept = 14;
@@ -12018,7 +12044,7 @@ yy699:
if (yych <= ':') goto yy703;
yy700:
YYDEBUG(700, *YYCURSOR);
#line 1500 "ext/date/lib/parse_date.re"
#line 1526 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("clf");
@@ -12038,7 +12064,7 @@ yy700:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 12042 "ext/date/lib/parse_date.c"
#line 12068 "ext/date/lib/parse_date.c"
yy701:
YYDEBUG(701, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12590,7 +12616,7 @@ yy762:
}
yy763:
YYDEBUG(763, *YYCURSOR);
#line 1245 "ext/date/lib/parse_date.re"
#line 1271 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("iso8601date2");
@@ -12603,7 +12629,7 @@ yy763:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 12607 "ext/date/lib/parse_date.c"
#line 12633 "ext/date/lib/parse_date.c"
yy764:
YYDEBUG(764, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12642,7 +12668,7 @@ yy770:
YYDEBUG(770, *YYCURSOR);
++YYCURSOR;
YYDEBUG(771, *YYCURSOR);
#line 1486 "ext/date/lib/parse_date.re"
#line 1512 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextreverse");
@@ -12655,7 +12681,7 @@ yy770:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 12659 "ext/date/lib/parse_date.c"
#line 12685 "ext/date/lib/parse_date.c"
yy772:
YYDEBUG(772, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12793,7 +12819,7 @@ yy782:
}
yy783:
YYDEBUG(783, *YYCURSOR);
#line 1521 "ext/date/lib/parse_date.re"
#line 1547 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
@@ -12801,7 +12827,7 @@ yy783:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 12805 "ext/date/lib/parse_date.c"
#line 12831 "ext/date/lib/parse_date.c"
yy784:
YYDEBUG(784, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12952,7 +12978,7 @@ yy792:
}
yy793:
YYDEBUG(793, *YYCURSOR);
#line 1342 "ext/date/lib/parse_date.re"
#line 1368 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenodayrev");
@@ -12965,7 +12991,7 @@ yy793:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 12969 "ext/date/lib/parse_date.c"
#line 12995 "ext/date/lib/parse_date.c"
yy794:
YYDEBUG(794, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13180,7 +13206,7 @@ yy813:
if (yych <= '7') goto yy816;
yy814:
YYDEBUG(814, *YYCURSOR);
#line 1453 "ext/date/lib/parse_date.re"
#line 1479 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
@@ -13198,7 +13224,7 @@ yy814:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 13202 "ext/date/lib/parse_date.c"
#line 13228 "ext/date/lib/parse_date.c"
yy815:
YYDEBUG(815, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13208,7 +13234,7 @@ yy816:
YYDEBUG(816, *YYCURSOR);
++YYCURSOR;
YYDEBUG(817, *YYCURSOR);
#line 1434 "ext/date/lib/parse_date.re"
#line 1460 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
@@ -13226,7 +13252,7 @@ yy816:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 13230 "ext/date/lib/parse_date.c"
#line 13256 "ext/date/lib/parse_date.c"
yy818:
YYDEBUG(818, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13290,7 +13316,7 @@ yy820:
}
yy821:
YYDEBUG(821, *YYCURSOR);
#line 1420 "ext/date/lib/parse_date.re"
#line 1446 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgydotd");
@@ -13303,7 +13329,7 @@ yy821:
TIMELIB_DEINIT;
return TIMELIB_PG_YEARDAY;
}
#line 13307 "ext/date/lib/parse_date.c"
#line 13333 "ext/date/lib/parse_date.c"
yy822:
YYDEBUG(822, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13406,7 +13432,7 @@ yy841:
++YYCURSOR;
yy842:
YYDEBUG(842, *YYCURSOR);
#line 1394 "ext/date/lib/parse_date.re"
#line 1420 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
@@ -13431,7 +13457,7 @@ yy842:
TIMELIB_DEINIT;
return TIMELIB_XMLRPC_SOAP;
}
#line 13435 "ext/date/lib/parse_date.c"
#line 13461 "ext/date/lib/parse_date.c"
yy843:
YYDEBUG(843, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13693,7 +13719,7 @@ yy847:
}
yy848:
YYDEBUG(848, *YYCURSOR);
#line 1382 "ext/date/lib/parse_date.re"
#line 1408 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
@@ -13704,7 +13730,7 @@ yy848:
TIMELIB_DEINIT;
return TIMELIB_DATE_NOCOLON;
}
#line 13708 "ext/date/lib/parse_date.c"
#line 13734 "ext/date/lib/parse_date.c"
yy849:
YYDEBUG(849, *YYCURSOR);
yych = *++YYCURSOR;
@@ -14624,7 +14650,7 @@ yy972:
if (yych <= '9') goto yy995;
yy973:
YYDEBUG(973, *YYCURSOR);
#line 1259 "ext/date/lib/parse_date.re"
#line 1285 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshorter");
@@ -14637,7 +14663,7 @@ yy973:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 14641 "ext/date/lib/parse_date.c"
#line 14667 "ext/date/lib/parse_date.c"
yy974:
YYDEBUG(974, *YYCURSOR);
yyaccept = 22;
@@ -15646,7 +15672,7 @@ yy1065:
}
yy1067:
YYDEBUG(1067, *YYCURSOR);
#line 1151 "ext/date/lib/parse_date.re"
#line 1177 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("gnunocolon");
TIMELIB_INIT;
@@ -15668,7 +15694,7 @@ yy1067:
TIMELIB_DEINIT;
return TIMELIB_GNU_NOCOLON;
}
#line 15672 "ext/date/lib/parse_date.c"
#line 15698 "ext/date/lib/parse_date.c"
yy1068:
YYDEBUG(1068, *YYCURSOR);
yych = *++YYCURSOR;
@@ -15760,7 +15786,7 @@ yy1074:
}
yy1075:
YYDEBUG(1075, *YYCURSOR);
#line 1197 "ext/date/lib/parse_date.re"
#line 1223 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("iso8601nocolon");
@@ -15779,7 +15805,7 @@ yy1075:
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
}
#line 15783 "ext/date/lib/parse_date.c"
#line 15809 "ext/date/lib/parse_date.c"
yy1076:
YYDEBUG(1076, *YYCURSOR);
yyaccept = 25;
@@ -16677,7 +16703,7 @@ yy1116:
}
yy1117:
YYDEBUG(1117, *YYCURSOR);
#line 1593 "ext/date/lib/parse_date.re"
#line 1619 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -16693,7 +16719,7 @@ yy1117:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 16697 "ext/date/lib/parse_date.c"
#line 16723 "ext/date/lib/parse_date.c"
yy1118:
YYDEBUG(1118, *YYCURSOR);
++YYCURSOR;
@@ -16744,7 +16770,7 @@ yy1125:
YYDEBUG(1125, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1126, *YYCURSOR);
#line 1066 "ext/date/lib/parse_date.re"
#line 1092 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -16765,7 +16791,7 @@ yy1125:
TIMELIB_DEINIT;
return TIMELIB_WEEK_DAY_OF_MONTH;
}
#line 16769 "ext/date/lib/parse_date.c"
#line 16795 "ext/date/lib/parse_date.c"
yy1127:
YYDEBUG(1127, *YYCURSOR);
yyaccept = 26;
@@ -16873,7 +16899,7 @@ yy1140:
}
yy1141:
YYDEBUG(1141, *YYCURSOR);
#line 1569 "ext/date/lib/parse_date.re"
#line 1595 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -16896,7 +16922,7 @@ yy1141:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 16900 "ext/date/lib/parse_date.c"
#line 16926 "ext/date/lib/parse_date.c"
yy1142:
YYDEBUG(1142, *YYCURSOR);
yych = *++YYCURSOR;
@@ -19573,7 +19599,7 @@ yy1293:
goto yy1297;
yy1294:
YYDEBUG(1294, *YYCURSOR);
#line 1043 "ext/date/lib/parse_date.re"
#line 1069 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("backof | frontof");
TIMELIB_INIT;
@@ -19595,7 +19621,7 @@ yy1294:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 19599 "ext/date/lib/parse_date.c"
#line 19625 "ext/date/lib/parse_date.c"
yy1295:
YYDEBUG(1295, *YYCURSOR);
yyaccept = 28;
@@ -19856,14 +19882,14 @@ yy1315:
YYDEBUG(1315, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1316, *YYCURSOR);
#line 1026 "ext/date/lib/parse_date.re"
#line 1052 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("firstdayof | lastdayof");
TIMELIB_INIT;
TIMELIB_HAVE_RELATIVE();
/* skip "last day of" or "first day of" */
if (*ptr == 'l' || *ptr == 'L') {
if (*ptr == 'l') {
s->time->relative.first_last_day_of = 2;
} else {
s->time->relative.first_last_day_of = 1;
@@ -19872,7 +19898,7 @@ yy1315:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 19876 "ext/date/lib/parse_date.c"
#line 19902 "ext/date/lib/parse_date.c"
yy1317:
YYDEBUG(1317, *YYCURSOR);
yyaccept = 0;
@@ -21303,7 +21329,7 @@ yy1385:
if (yych <= '9') goto yy1385;
yy1387:
YYDEBUG(1387, *YYCURSOR);
#line 1000 "ext/date/lib/parse_date.re"
#line 1026 "ext/date/lib/parse_date.re"
{
timelib_ull i;
@@ -21328,7 +21354,7 @@ yy1387:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 21332 "ext/date/lib/parse_date.c"
#line 21358 "ext/date/lib/parse_date.c"
yy1388:
YYDEBUG(1388, *YYCURSOR);
yych = *++YYCURSOR;
@@ -21764,7 +21790,7 @@ yy1416:
++YYCURSOR;
yy1417:
YYDEBUG(1417, *YYCURSOR);
#line 988 "ext/date/lib/parse_date.re"
#line 1014 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("tomorrow");
TIMELIB_INIT;
@@ -21775,7 +21801,7 @@ yy1417:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 21779 "ext/date/lib/parse_date.c"
#line 21805 "ext/date/lib/parse_date.c"
yy1418:
YYDEBUG(1418, *YYCURSOR);
yych = *++YYCURSOR;
@@ -21810,7 +21836,7 @@ yy1419:
}
yy1420:
YYDEBUG(1420, *YYCURSOR);
#line 978 "ext/date/lib/parse_date.re"
#line 1004 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("midnight | today");
TIMELIB_INIT;
@@ -21819,7 +21845,7 @@ yy1420:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 21823 "ext/date/lib/parse_date.c"
#line 21849 "ext/date/lib/parse_date.c"
yy1421:
YYDEBUG(1421, *YYCURSOR);
yych = *++YYCURSOR;
@@ -23831,7 +23857,7 @@ yy1499:
}
yy1500:
YYDEBUG(1500, *YYCURSOR);
#line 957 "ext/date/lib/parse_date.re"
#line 983 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("now");
TIMELIB_INIT;
@@ -23839,7 +23865,7 @@ yy1500:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 23843 "ext/date/lib/parse_date.c"
#line 23869 "ext/date/lib/parse_date.c"
yy1501:
YYDEBUG(1501, *YYCURSOR);
yych = *++YYCURSOR;
@@ -23978,7 +24004,7 @@ yy1507:
}
yy1508:
YYDEBUG(1508, *YYCURSOR);
#line 966 "ext/date/lib/parse_date.re"
#line 992 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("noon");
TIMELIB_INIT;
@@ -23989,7 +24015,7 @@ yy1508:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 23993 "ext/date/lib/parse_date.c"
#line 24019 "ext/date/lib/parse_date.c"
yy1509:
YYDEBUG(1509, *YYCURSOR);
yyaccept = 0;
@@ -24522,7 +24548,7 @@ yy1530:
++YYCURSOR;
yy1531:
YYDEBUG(1531, *YYCURSOR);
#line 945 "ext/date/lib/parse_date.re"
#line 971 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("yesterday");
TIMELIB_INIT;
@@ -24533,7 +24559,7 @@ yy1531:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 24537 "ext/date/lib/parse_date.c"
#line 24563 "ext/date/lib/parse_date.c"
yy1532:
YYDEBUG(1532, *YYCURSOR);
yyaccept = 0;
@@ -24706,7 +24732,7 @@ yy1537:
goto yy1531;
}
}
#line 1719 "ext/date/lib/parse_date.re"
#line 1745 "ext/date/lib/parse_date.re"
}
@@ -25197,7 +25223,7 @@ char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst)
{
const timelib_tz_lookup_table *tp;
tp = abbr_search(abbr, gmtoffset, isdst);
tp = zone_search(abbr, gmtoffset, isdst);
if (tp) {
return (tp->full_tz_name);
} else {
+38 -12
View File
@@ -668,7 +668,7 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, S
}
}
const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffset, int isdst)
const static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffset, int isdst)
{
int first_found = 0;
const timelib_tz_lookup_table *tp, *first_found_elem = NULL;
@@ -696,6 +696,25 @@ const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffs
return first_found_elem;
}
for (tp = timelib_timezone_lookup; tp->name; tp++) {
if (tp->full_tz_name && strcasecmp(word, tp->full_tz_name) == 0) {
if (!first_found) {
first_found = 1;
first_found_elem = tp;
if (gmtoffset == -1) {
return tp;
}
}
if (tp->gmtoffset == gmtoffset) {
return tp;
}
}
}
if (first_found) {
return first_found_elem;
}
/* Still didn't find anything, let's find the zone solely based on
* offset/isdst then */
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
@@ -706,7 +725,7 @@ const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffs
return NULL;
}
static long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found)
static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found)
{
char *word;
char *begin = *ptr, *end;
@@ -720,7 +739,7 @@ static long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found
word = calloc(1, end - begin + 1);
memcpy(word, begin, end - begin);
if ((tp = abbr_search(word, -1, 0))) {
if ((tp = zone_search(word, -1, 0))) {
value = -tp->gmtoffset / 60;
*dst = tp->type;
value += tp->type * 60;
@@ -764,26 +783,33 @@ long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found
retval = timelib_parse_tz_cor(ptr);
} else {
int found = 0;
long offset = 0;
long offset;
char *tz_abbr;
t->is_localtime = 1;
/* First, we lookup by abbreviation only */
offset = timelib_lookup_abbr(ptr, dst, &tz_abbr, &found);
offset = timelib_lookup_zone(ptr, dst, &tz_abbr, &found);
if (found) {
t->zone_type = TIMELIB_ZONETYPE_ABBR;
timelib_time_tz_abbr_update(t, tz_abbr);
}
/* Otherwise, we look if we have a TimeZone identifier */
if (!found || strcmp("UTC", tz_abbr) == 0) {
#if 0
/* If we found a TimeZone identifier, use it */
if (tz_name) {
t->tz_info = timelib_parse_tzfile(tz_name);
t->zone_type = TIMELIB_ZONETYPE_ID;
}
#endif
/* If we have a TimeZone identifier to start with, use it */
if (strstr(tz_abbr, "/") || strcmp(tz_abbr, "UTC") == 0) {
if ((res = tz_wrapper(tz_abbr, tzdb)) != NULL) {
t->tz_info = res;
t->zone_type = TIMELIB_ZONETYPE_ID;
found++;
}
}
if (found && t->zone_type != TIMELIB_ZONETYPE_ID) {
timelib_time_tz_abbr_update(t, tz_abbr);
}
free(tz_abbr);
*tz_not_found = (found == 0);
retval = offset;
@@ -1029,7 +1055,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
TIMELIB_HAVE_RELATIVE();
/* skip "last day of" or "first day of" */
if (*ptr == 'l' || *ptr == 'L') {
if (*ptr == 'l') {
s->time->relative.first_last_day_of = 2;
} else {
s->time->relative.first_last_day_of = 1;
@@ -2206,7 +2232,7 @@ char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst)
{
const timelib_tz_lookup_table *tp;
tp = abbr_search(abbr, gmtoffset, isdst);
tp = zone_search(abbr, gmtoffset, isdst);
if (tp) {
return (tp->full_tz_name);
} else {
+1439 -1500
View File
File diff suppressed because it is too large. Load diff
+16 -32
View File
@@ -2534,7 +2534,11 @@ static void date_object_free_storage_period(void *object TSRMLS_DC)
/* Advanced Interface */
PHPAPI zval *php_date_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC)
{
Z_TYPE_P(object) = IS_OBJECT;
object_init_ex(object, pce);
Z_SET_REFCOUNT_P(object, 1);
Z_UNSET_ISREF_P(object);
return object;
}
@@ -2642,19 +2646,14 @@ PHP_FUNCTION(date_create)
zval *timezone_object = NULL;
char *time_str = NULL;
int time_str_len = 0;
zval datetime_object;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) {
RETURN_FALSE;
}
php_date_instantiate(date_ce_date, &datetime_object TSRMLS_CC);
if (!php_date_initialize(zend_object_store_get_object(&datetime_object TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 0 TSRMLS_CC)) {
zval_dtor(&datetime_object);
php_date_instantiate(date_ce_date, return_value TSRMLS_CC);
if (!php_date_initialize(zend_object_store_get_object(return_value TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 0 TSRMLS_CC)) {
RETURN_FALSE;
} else {
zval *datetime_object_ptr = &datetime_object;
RETVAL_ZVAL(datetime_object_ptr, 0, 0);
}
}
/* }}} */
@@ -2667,19 +2666,14 @@ PHP_FUNCTION(date_create_immutable)
zval *timezone_object = NULL;
char *time_str = NULL;
int time_str_len = 0;
zval datetime_object;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) {
RETURN_FALSE;
}
php_date_instantiate(date_ce_immutable, &datetime_object TSRMLS_CC);
if (!php_date_initialize(zend_object_store_get_object(&datetime_object TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 0 TSRMLS_CC)) {
zval_dtor(&datetime_object);
php_date_instantiate(date_ce_immutable, return_value TSRMLS_CC);
if (!php_date_initialize(zend_object_store_get_object(return_value TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 0 TSRMLS_CC)) {
RETURN_FALSE;
} else {
zval *datetime_object_ptr = &datetime_object;
RETVAL_ZVAL(datetime_object_ptr, 0, 0);
}
}
/* }}} */
@@ -2692,19 +2686,14 @@ PHP_FUNCTION(date_create_from_format)
zval *timezone_object = NULL;
char *time_str = NULL, *format_str = NULL;
int time_str_len = 0, format_str_len = 0;
zval datetime_object;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|O", &format_str, &format_str_len, &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) {
RETURN_FALSE;
}
php_date_instantiate(date_ce_date, &datetime_object TSRMLS_CC);
if (!php_date_initialize(zend_object_store_get_object(&datetime_object TSRMLS_CC), time_str, time_str_len, format_str, timezone_object, 0 TSRMLS_CC)) {
zval_dtor(&datetime_object);
php_date_instantiate(date_ce_date, return_value TSRMLS_CC);
if (!php_date_initialize(zend_object_store_get_object(return_value TSRMLS_CC), time_str, time_str_len, format_str, timezone_object, 0 TSRMLS_CC)) {
RETURN_FALSE;
} else {
zval *datetime_object_ptr = &datetime_object;
RETVAL_ZVAL(datetime_object_ptr, 0, 0);
}
}
/* }}} */
@@ -2717,19 +2706,14 @@ PHP_FUNCTION(date_create_immutable_from_format)
zval *timezone_object = NULL;
char *time_str = NULL, *format_str = NULL;
int time_str_len = 0, format_str_len = 0;
zval datetime_object;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|O", &format_str, &format_str_len, &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) {
RETURN_FALSE;
}
php_date_instantiate(date_ce_immutable, &datetime_object TSRMLS_CC);
if (!php_date_initialize(zend_object_store_get_object(&datetime_object TSRMLS_CC), time_str, time_str_len, format_str, timezone_object, 0 TSRMLS_CC)) {
zval_dtor(&datetime_object);
php_date_instantiate(date_ce_immutable, return_value TSRMLS_CC);
if (!php_date_initialize(zend_object_store_get_object(return_value TSRMLS_CC), time_str, time_str_len, format_str, timezone_object, 0 TSRMLS_CC)) {
RETURN_FALSE;
} else {
zval *datetime_object_ptr = &datetime_object;
RETVAL_ZVAL(datetime_object_ptr, 0, 0);
}
}
/* }}} */
@@ -2770,7 +2754,7 @@ PHP_METHOD(DateTimeImmutable, __construct)
}
/* }}} */
static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht TSRMLS_DC)
static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dateobj, HashTable *myht TSRMLS_DC)
{
zval **z_date = NULL;
zval **z_timezone = NULL;
@@ -2840,7 +2824,7 @@ PHP_METHOD(DateTime, __set_state)
php_date_instantiate(date_ce_date, return_value TSRMLS_CC);
dateobj = (php_date_obj *) zend_object_store_get_object(return_value TSRMLS_CC);
if (!php_date_initialize_from_hash(&dateobj, myht TSRMLS_CC)) {
if (!php_date_initialize_from_hash(&return_value, &dateobj, myht TSRMLS_CC)) {
php_error(E_ERROR, "Invalid serialization data for DateTime object");
}
}
@@ -2862,7 +2846,7 @@ PHP_METHOD(DateTimeImmutable, __set_state)
php_date_instantiate(date_ce_immutable, return_value TSRMLS_CC);
dateobj = (php_date_obj *) zend_object_store_get_object(return_value TSRMLS_CC);
if (!php_date_initialize_from_hash(&dateobj, myht TSRMLS_CC)) {
if (!php_date_initialize_from_hash(&return_value, &dateobj, myht TSRMLS_CC)) {
php_error(E_ERROR, "Invalid serialization data for DateTimeImmutable object");
}
}
@@ -2880,7 +2864,7 @@ PHP_METHOD(DateTime, __wakeup)
myht = Z_OBJPROP_P(object);
if (!php_date_initialize_from_hash(&dateobj, myht TSRMLS_CC)) {
if (!php_date_initialize_from_hash(&return_value, &dateobj, myht TSRMLS_CC)) {
php_error(E_ERROR, "Invalid serialization data for DateTime object");
}
}
+6 -6
View File
@@ -95,18 +95,18 @@ result = Monday 2037-10-05 00:00:00 NZDT
wanted = Monday 00:00:00
Australia/Adelaide
ts = Friday 1971-01-01 17:17:17 ACST
result = Monday 1971-01-04 00:00:00 ACST
ts = Friday 1971-01-01 17:17:17 CST
result = Monday 1971-01-04 00:00:00 CST
wanted = Monday 00:00:00
Australia/Darwin
ts = Monday 1971-03-29 17:17:17 ACST
result = Monday 1971-04-05 00:00:00 ACST
ts = Monday 1971-03-29 17:17:17 CST
result = Monday 1971-04-05 00:00:00 CST
wanted = Monday 00:00:00
Australia/Perth
ts = Friday 1971-01-01 17:17:17 AWST
result = Monday 1971-01-04 00:00:00 AWST
ts = Friday 1971-01-01 17:17:17 WST
result = Monday 1971-01-04 00:00:00 WST
wanted = Monday 00:00:00
America/Aruba
+2 -2
View File
@@ -233,8 +233,8 @@ result=Saturday 1970-01-03 00:00:00 CAT 0
wanted=Saturday 00:00:00
TZ=Asia/Kashgar - Is it OK for this to be 3 AM? yes
tStamp=Thursday 1980-04-24 17:17:17 XJT 0
result=Thursday 1980-05-01 00:00:00 XJT 0
tStamp=Thursday 1980-04-24 17:17:17 KAST 0
result=Thursday 1980-05-01 03:00:00 CST 0
wanted=Thursday 03:00:00
TZ=Indian/Christmas - Is it OK for this to be 7 AM? Note: does
+2 -2
View File
@@ -39,5 +39,5 @@ datestr 10:00:00 AM July 1 2005 UTC
Setting TZ
input 10:00:00 AM July 1 2005
strftime 10:00:00 AM July 1 2005 AEST +1000
datestr 10:00:00 AM July 1 2005 AEST
strftime 10:00:00 AM July 1 2005 EST +1000
datestr 10:00:00 AM July 1 2005 EST
+4 -4
View File
@@ -44,7 +44,7 @@ array(4) {
string(6) "Y-m-d+"
string(19) "2001-11-29 13:20:01"
object(DateTime)#%d (3) {
object(DateTime)#2 (3) {
["date"]=>
string(26) "2001-11-29 %d:%d:%d.%d"
["timezone_type"]=>
@@ -70,7 +70,7 @@ array(4) {
string(7) "Y-m-d +"
string(19) "2001-11-29 13:20:01"
object(DateTime)#%d (3) {
object(DateTime)#3 (3) {
["date"]=>
string(26) "2001-11-29 %d:%d:%d.%d"
["timezone_type"]=>
@@ -96,7 +96,7 @@ array(4) {
string(6) "Y-m-d+"
string(10) "2001-11-29"
object(DateTime)#%d (3) {
object(DateTime)#2 (3) {
["date"]=>
string(26) "2001-11-29 %d:%d:%d.%d"
["timezone_type"]=>
@@ -139,7 +139,7 @@ array(4) {
string(7) "Y-m-d +"
string(11) "2001-11-29 "
object(DateTime)#%d (3) {
object(DateTime)#2 (3) {
["date"]=>
string(26) "2001-11-29 %d:%d:%d.%d"
["timezone_type"]=>
-175
View File
@@ -1,175 +0,0 @@
--TEST--
Bug #66986 (Some timezones are no longer valid in PHP 5.5.10)
--FILE--
<?php
$zones = array(
"CST6CDT", "Cuba", "Egypt", "Eire", "EST5EDT", "Factory", "GB-Eire",
"GMT0", "Greenwich", "Hongkong", "Iceland", "Iran", "Israel", "Jamaica",
"Japan", "Kwajalein", "Libya", "MST7MDT", "Navajo", "NZ-CHAT", "Poland",
"Portugal", "PST8PDT", "Singapore", "Turkey", "Universal", "W-SU",
"UTC", "GMT", "GMT+0100", "-0230",
);
foreach ( $zones as $zone )
{
$d = new DateTimeZone( $zone );
print_r($d);
}
?>
--EXPECT--
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => CST6CDT
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => Cuba
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => Egypt
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => Eire
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => EST5EDT
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => Factory
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => GB-Eire
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => GMT0
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => Greenwich
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => Hongkong
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => Iceland
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => Iran
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => Israel
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => Jamaica
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => Japan
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => Kwajalein
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => Libya
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => MST7MDT
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => Navajo
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => NZ-CHAT
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => Poland
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => Portugal
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => PST8PDT
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => Singapore
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => Turkey
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => Universal
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => W-SU
)
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => UTC
)
DateTimeZone Object
(
[timezone_type] => 2
[timezone] => GMT
)
DateTimeZone Object
(
[timezone_type] => 1
[timezone] => +01:00
)
DateTimeZone Object
(
[timezone_type] => 1
[timezone] => -02:30
)
-14
View File
@@ -1,14 +0,0 @@
--TEST--
Bug #67109 (First uppercase letter breaks date string parsing)
--INI--
date.timezone=UTC
--FILE--
<?php
var_dump(date('d.m.Y',strtotime('last day of april')));
var_dump(date('d.m.Y',strtotime('Last day of april')));
var_dump(date('d.m.Y',strtotime('lAst Day of April')));
?>
--EXPECTF--
string(10) "30.04.%d"
string(10) "30.04.%d"
string(10) "30.04.%d"
+1 -1
View File
@@ -518,7 +518,7 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp TSRMLS_DC
value = null_value;
} else if (Z_TYPE_P(value) == IS_OBJECT) {
/* these are zvalues create on demand, with refcount and is_ref
* status left in an uninitialized stated */
* status left in an uninitalized stated */
zval_dtor(value);
efree(value);
+1 -1
View File
@@ -9,7 +9,7 @@ Test eregi() function : basic functionality - confirm case insensitivity
*/
/*
* Test basic functionality of eregi()
* Test basic funtionality of eregi()
*/
echo "*** Testing eregi() : basic functionality ***\n";
+2 -2
View File
@@ -2426,11 +2426,11 @@ static void* exif_ifd_make_value(image_info_data *info_data, int motorola_intel
data_ptr += 8;
break;
case TAG_FMT_SINGLE:
memmove(data_ptr, &info_value->f, 4);
memmove(data_ptr, &info_data->value.f, byte_count);
data_ptr += 4;
break;
case TAG_FMT_DOUBLE:
memmove(data_ptr, &info_value->d, 8);
memmove(data_ptr, &info_data->value.d, byte_count);
data_ptr += 8;
break;
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 368 B

-17
View File
@@ -1,17 +0,0 @@
--TEST--
Bug #68113 (Heap corruption in exif_thumbnail())
--SKIPIF--
<?php
extension_loaded("exif") or die("skip need exif");
?>
--FILE--
<?php
var_dump(exif_thumbnail(__DIR__."/bug68113.jpg"));
?>
Done
--EXPECTF--
Warning: exif_thumbnail(bug68113.jpg): File structure corrupted in %s/bug68113.php on line 2
Warning: exif_thumbnail(bug68113.jpg): Invalid JPEG file in %s/bug68113.php on line 2
bool(false)
Done
+2 -2
View File
@@ -156,12 +156,12 @@ if test "\$PHP_$EXTNAME" != "no"; then
dnl PHP_CHECK_LIBRARY(\$LIBNAME,\$LIBSYMBOL,
dnl [
dnl PHP_ADD_LIBRARY_WITH_PATH(\$LIBNAME, \$${EXTNAME}_DIR/\$PHP_LIBDIR, ${EXTNAME}_SHARED_LIBADD)
dnl PHP_ADD_LIBRARY_WITH_PATH(\$LIBNAME, \$${EXTNAME}_DIR/lib, ${EXTNAME}_SHARED_LIBADD)
dnl AC_DEFINE(HAVE_${EXTNAME}LIB,1,[ ])
dnl ],[
dnl AC_MSG_ERROR([wrong $extname lib version or lib not found])
dnl ],[
dnl -L\$${EXTNAME}_DIR/\$PHP_LIBDIR -lm
dnl -L\$${EXTNAME}_DIR/lib -lm
dnl ])
dnl
dnl PHP_SUBST(${EXTNAME}_SHARED_LIBADD)
+1 -1
View File
@@ -1269,7 +1269,7 @@ file_signextend(struct magic_set *ms, struct magic *m, uint64_t v)
* the sign extension must have happened.
*/
case FILE_BYTE:
v = (signed char) v;
v = (char) v;
break;
case FILE_SHORT:
case FILE_BESHORT:
+1 -1
View File
@@ -820,7 +820,7 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
q = (const uint8_t *)(const void *)
((const char *)(const void *)p + ofs
- 2 * sizeof(uint32_t));
if (q < p || q > e) {
if (q > e) {
DPRINTF(("Ran of the end %p > %p\n", q, e));
goto out;
}
-5
View File
@@ -124,11 +124,6 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
RETURN_FALSE;
}
} else if (Z_TYPE_P(to_zval) == IS_STRING) {
if (CHECK_ZVAL_NULL_PATH(to_zval)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid 2nd parameter, filename must not contain null bytes");
RETURN_FALSE;
}
stream = php_stream_open_wrapper(Z_STRVAL_P(to_zval), "wb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL);
if (stream == NULL) {
RETURN_FALSE;
+2 -4
View File
@@ -370,10 +370,9 @@ static void *fontFetch (char **error, void *key)
fontlist = gdEstrdup(a->fontlist);
/*
* Must use gd_strtok_r becasuse strtok() isn't thread safe
* Must use gd_strtok_r else pointer corrupted by strtok in nested loop.
*/
for (name = gd_strtok_r (fontlist, LISTSEPARATOR, &strtok_ptr); name; name = gd_strtok_r (0, LISTSEPARATOR, &strtok_ptr)) {
char *strtok_ptr_path;
/* make a fresh copy each time - strtok corrupts it. */
path = gdEstrdup (fontsearchpath);
@@ -389,8 +388,7 @@ static void *fontFetch (char **error, void *key)
break;
}
}
for (dir = gd_strtok_r (path, PATHSEPARATOR, &strtok_ptr_path); dir;
dir = gd_strtok_r (0, PATHSEPARATOR, &strtok_ptr_path)) {
for (dir = strtok (path, PATHSEPARATOR); dir; dir = strtok (0, PATHSEPARATOR)) {
if (!strcmp(dir, ".")) {
TSRMLS_FETCH();
#if HAVE_GETCWD
+2 -2
View File
@@ -20,6 +20,6 @@ echo '(' . $bbox[6] . ', ' . $bbox[7] . ")\n";
?>
--EXPECTF--
(-1, 15)
(15%d, 15)
(15%d, -48)
(156, 15)
(156, -48)
(-1, -48)
@@ -1,31 +0,0 @@
--TEST--
Testing null byte injection in imagegd2
--CLEAN--
$tempdir = sys_get_temp_dir(). '/php-gdtest';
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
rmdir($tempdir);
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
$tempdir = sys_get_temp_dir(). '/php-gdtest';
if (!file_exists($tempdir) && !is_dir($tempdir)) {
mkdir ($tempdir, 0777, true);
}
$userinput = "1\0"; // from post or get data
$temp = $tempdir. "/test" . $userinput .".tmp";
echo "\nimagegd2 TEST\n";
imagegd2($image, $temp);
var_dump(file_exists($tempdir. "/test1"));
var_dump(file_exists($tempdir. "/test1.tmp"));
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
--EXPECTF--
imagegd2 TEST
Warning: imagegd2() expects parameter 2 to be a valid path, string given in %s on line %d
bool(false)
bool(false)
@@ -1,31 +0,0 @@
--TEST--
Testing null byte injection in imagegd
--CLEAN--
$tempdir = sys_get_temp_dir(). '/php-gdtest';
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
rmdir($tempdir);
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
$tempdir = sys_get_temp_dir(). '/php-gdtest';
if (!file_exists($tempdir) && !is_dir($tempdir)) {
mkdir ($tempdir, 0777, true);
}
$userinput = "1\0"; // from post or get data
$temp = $tempdir. "/test" . $userinput .".tmp";
echo "\nimagegd TEST\n";
imagegd($image, $temp);
var_dump(file_exists($tempdir. "/test1"));
var_dump(file_exists($tempdir. "/test1.tmp"));
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
--EXPECTF--
imagegd TEST
Warning: imagegd() expects parameter 2 to be a valid path, string given in %s on line %d
bool(false)
bool(false)
@@ -1,38 +0,0 @@
--TEST--
Testing null byte injection in imagegif
--CLEAN--
$tempdir = sys_get_temp_dir(). '/php-gdtest';
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
rmdir($tempdir);
--SKIPIF--
<?php
$support = gd_info();
if (!isset($support['GIF Create Support']) || $support['GIF Create Support'] === false) {
print 'skip gif support not available';
}
?>
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
$tempdir = sys_get_temp_dir(). '/php-gdtest';
if (!file_exists($tempdir) && !is_dir($tempdir)) {
mkdir ($tempdir, 0777, true);
}
$userinput = "1\0"; // from post or get data
$temp = $tempdir. "/test" . $userinput .".tmp";
echo "\nimagegif TEST\n";
imagegif($image, $temp);
var_dump(file_exists($tempdir. "/test1"));
var_dump(file_exists($tempdir. "/test1.tmp"));
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
--EXPECTF--
imagegif TEST
Warning: imagegif(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
bool(false)
bool(false)
@@ -1,38 +0,0 @@
--TEST--
Testing null byte injection in imagejpeg
--CLEAN--
$tempdir = sys_get_temp_dir(). '/php-gdtest';
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
rmdir($tempdir);
--SKIPIF--
<?php
$support = gd_info();
if (!isset($support['JPEG Support']) || $support['JPEG Support'] === false) {
print 'skip jpeg support not available';
}
?>
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
$tempdir = sys_get_temp_dir(). '/php-gdtest';
if (!file_exists($tempdir) && !is_dir($tempdir)) {
mkdir ($tempdir, 0777, true);
}
$userinput = "1\0"; // from post or get data
$temp = $tempdir. "/test" . $userinput .".tmp";
echo "\nimagejpeg TEST\n";
imagejpeg($image, $temp);
var_dump(file_exists($tempdir. "/test1"));
var_dump(file_exists($tempdir. "/test1.tmp"));
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
--EXPECTF--
imagejpeg TEST
Warning: imagejpeg(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
bool(false)
bool(false)
@@ -1,38 +0,0 @@
--TEST--
Testing null byte injection in imagepng
--CLEAN--
$tempdir = sys_get_temp_dir(). '/php-gdtest';
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
rmdir($tempdir);
--SKIPIF--
<?php
$support = gd_info();
if (!isset($support['PNG Support']) || $support['PNG Support'] === false) {
print 'skip png support not available';
}
?>
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
$tempdir = sys_get_temp_dir(). '/php-gdtest';
if (!file_exists($tempdir) && !is_dir($tempdir)) {
mkdir ($tempdir, 0777, true);
}
$userinput = "1\0"; // from post or get data
$temp = $tempdir. "/test" . $userinput .".tmp";
echo "\nimagepng TEST\n";
imagepng($image, $temp);
var_dump(file_exists($tempdir. "/test1"));
var_dump(file_exists($tempdir. "/test1.tmp"));
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
--EXPECTF--
imagepng TEST
Warning: imagepng(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
bool(false)
bool(false)
@@ -1,38 +0,0 @@
--TEST--
Testing null byte injection in imagewbmp
--CLEAN--
$tempdir = sys_get_temp_dir(). '/php-gdtest';
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
rmdir($tempdir);
--SKIPIF--
<?php
$support = gd_info();
if (!isset($support['WBMP Support']) || $support['WBMP Support'] === false) {
print 'skip wbmp support not available';
}
?>
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
$tempdir = sys_get_temp_dir(). '/php-gdtest';
if (!file_exists($tempdir) && !is_dir($tempdir)) {
mkdir ($tempdir, 0777, true);
}
$userinput = "1\0"; // from post or get data
$temp = $tempdir. "/test" . $userinput .".tmp";
echo "\nimagewbmp TEST\n";
imagewbmp($image, $temp);
var_dump(file_exists($tempdir. "/test1"));
var_dump(file_exists($tempdir. "/test1.tmp"));
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
--EXPECTF--
imagewbmp TEST
Warning: imagewbmp(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
bool(false)
bool(false)
@@ -1,38 +0,0 @@
--TEST--
Testing null byte injection in imagewebp
--CLEAN--
$tempdir = sys_get_temp_dir(). '/php-gdtest';
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
rmdir($tempdir);
--SKIPIF--
<?php
$support = gd_info();
if (!isset($support['WEBP Support']) || $support['WEBP Support'] === false) {
print 'skip webp support not available';
}
?>
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
$tempdir = sys_get_temp_dir(). '/php-gdtest';
if (!file_exists($tempdir) && !is_dir($tempdir)) {
mkdir ($tempdir, 0777, true);
}
$userinput = "1\0"; // from post or get data
$temp = $tempdir. "/test" . $userinput .".tmp";
echo "\nimagewebp TEST\n";
imagewebp($image, $temp);
var_dump(file_exists($tempdir. "/test1"));
var_dump(file_exists($tempdir. "/test1.tmp"));
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
--EXPECTF--
imagewbmp TEST
Warning: imagewebp(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
bool(false)
bool(false)
+1 -1
View File
@@ -382,7 +382,7 @@ static int json_utf8_to_utf16(unsigned short *utf16, char utf8[], int len) /* {{
}
}
} else {
/* Only check if utf8 string is valid, and compute utf16 length */
/* Only check if utf8 string is valid, and compute utf16 lenght */
for (j=0 ; pos < len ; j++) {
us = php_next_utf8_char((const unsigned char *)utf8, len, &pos, &status);
if (status != SUCCESS) {
+2 -21
View File
@@ -385,23 +385,6 @@ static int _get_lderrno(LDAP *ldap)
}
/* }}} */
/* {{{ _set_lderrno
*/
static void _set_lderrno(LDAP *ldap, int lderr)
{
#if !HAVE_NSLDAP
#if LDAP_API_VERSION > 2000 || HAVE_ORALDAP
/* New versions of OpenLDAP do it this way */
ldap_set_option(ldap, LDAP_OPT_ERROR_NUMBER, &lderr);
#else
ldap->ld_errno = lderr;
#endif
#else
ldap_set_lderrno(ldap, lderr, NULL, NULL);
#endif
}
/* }}} */
/* {{{ proto bool ldap_bind(resource link [, string dn [, string password]])
Bind to LDAP directory */
PHP_FUNCTION(ldap_bind)
@@ -416,20 +399,18 @@ PHP_FUNCTION(ldap_bind)
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
if (ldap_bind_dn != NULL && memchr(ldap_bind_dn, '\0', ldap_bind_dnlen) != NULL) {
_set_lderrno(ld->link, LDAP_INVALID_CREDENTIALS);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "DN contains a null byte");
RETURN_FALSE;
}
if (ldap_bind_pw != NULL && memchr(ldap_bind_pw, '\0', ldap_bind_pwlen) != NULL) {
_set_lderrno(ld->link, LDAP_INVALID_CREDENTIALS);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Password contains a null byte");
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
if ((rc = ldap_bind_s(ld->link, ldap_bind_dn, ldap_bind_pw, LDAP_AUTH_SIMPLE)) != LDAP_SUCCESS) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to bind to server: %s", ldap_err2string(rc));
RETURN_FALSE;
+1 -1
View File
@@ -260,7 +260,7 @@ const mbfl_encoding *_php_mb_encoding_handler_ex(const php_mb_encoding_handler_i
goto out;
}
num = n; /* make sure to process initialized vars only */
num = n; /* make sure to process initilized vars only */
/* initialize converter */
if (info->num_from_encodings <= 0) {
+6 -6
View File
@@ -62,18 +62,18 @@ mysqli_close($link);
--EXPECT--
array(7) {
[0]=>
float(3.141593)
float(3.14159274101)
[1]=>
float(-1.0E-6)
float(-9.99999997475E-7)
[2]=>
float(0)
[3]=>
float(1.0E+12)
float(999999995904)
[4]=>
float(0.5646425)
float(0.564642488956)
[5]=>
float(1)
[6]=>
float(8.888889E+14)
float(8.88888914608E+14)
}
done!
done!
+2 -2
View File
@@ -67,7 +67,7 @@ array(8) {
[3]=>
int(4999999)
[4]=>
float(2345.6)
float(2345.60009766)
[5]=>
float(5678.89563)
[6]=>
@@ -75,4 +75,4 @@ array(8) {
[7]=>
%unicode|string%(11) "mysql rulez"
}
done!
done!
+2 -2
View File
@@ -66,7 +66,7 @@ array(8) {
[3]=>
int(54)
[4]=>
float(2.6)
float(2.59999990463)
[5]=>
float(58.89)
[6]=>
@@ -74,4 +74,4 @@ array(8) {
[7]=>
%unicode|string%(3) "6.7"
}
done!
done!
-58
View File
@@ -1,58 +0,0 @@
--TEST--
mysqli_float_handling - ensure 4 byte float is handled correctly
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifemb.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require('connect.inc');
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
die();
}
if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
die();
}
if (!mysqli_query($link, "CREATE TABLE test(id INT PRIMARY KEY, fp4 FLOAT, fp8 DOUBLE) ENGINE = InnoDB")) {
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
die();
}
// Insert via string to make sure the real floating number gets to the DB
if (!mysqli_query($link, "INSERT INTO test(id, fp4, fp8) VALUES (1, 9.9999, 9.9999)")) {
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
die();
}
if (!($stmt = mysqli_prepare($link, "SELECT id, fp4, fp8 FROM test"))) {
printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
die();
}
if (!mysqli_stmt_execute($stmt)) {
printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
die();
}
if (!($result = mysqli_stmt_get_result($stmt))) {
printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
die();
}
$data = mysqli_fetch_assoc($result);
print $data['id'] . ": " . $data['fp4'] . ": " . $data['fp8'] . "\n";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECTF--
1: 9.9999: 9.9999
+1 -6
View File
@@ -41,11 +41,6 @@ require_once('skipifconnectfailure.inc');
if (false !== ($tmp = mysqli_change_user($link, $user, $passwd, $db . '_unknown_really')))
printf("[009] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
// Reconnect because after 3 failed change_user attempts, the server blocks you off.
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1'))
printf("[010] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
@@ -114,4 +109,4 @@ require_once('skipifconnectfailure.inc');
print "done!";
?>
--EXPECTF--
done!
done!
+1 -9
View File
@@ -48,14 +48,6 @@ if (mysqli_get_server_version($link) >= 50600)
if (false !== ($tmp = mysqli_change_user($link, $user, $passwd, $db . '_unknown_really')))
printf("[009] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
// Reconnect because Percona and MariaDB block any commands after 3 failed
// change_user commands
mysqli_close($link);
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[020] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
}
if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1'))
printf("[010] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
@@ -124,4 +116,4 @@ if (mysqli_get_server_version($link) >= 50600)
print "done!";
?>
--EXPECTF--
done!
done!
+1 -6
View File
@@ -43,11 +43,6 @@ if (!$IS_MYSQLND && (mysqli_get_server_version($link) < 50118 && mysqli_get_serv
if (false !== ($tmp = $mysqli->change_user($user, $passwd, $db . '_unknown_really')))
printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
// Reconnect because after 3 failed change_user attempts, the server blocks you off.
if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
if (!$mysqli->query('SET @mysqli_change_user_test_var=1'))
printf("[009] Failed to set test variable: [%d] %s\n", $mysqli->errno, $mysqli->error);
@@ -86,4 +81,4 @@ if (!$IS_MYSQLND && (mysqli_get_server_version($link) < 50118 && mysqli_get_serv
print "done!";
?>
--EXPECTF--
done!
done!
@@ -36,7 +36,7 @@ $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
mysqli_error($link));
}
if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(3), PRIMARY
if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY
KEY(id)) ENGINE=' . $engine . " DEFAULT CHARSET=gbk")) {
printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
-120
View File
@@ -1,120 +0,0 @@
--TEST--
Multiple result set with PS
--SKIPIF--
<?php
require_once('skipif.inc');
require_once("connect.inc");
if (!$IS_MYSQLND) {
die("skip mysqlnd only test");
}
require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require('table.inc');
$stmt = mysqli_stmt_init($link);
if (!$link->query('DROP PROCEDURE IF EXISTS p123')) {
printf("[001] [%d] %s\n", $link->error, $link->errno);
}
if (!$link->query("CREATE PROCEDURE p123() BEGIN SELECT id+12, CONCAT_WS('-',label,'ahoi') FROM test ORDER BY id LIMIT 1; SELECT id + 42, CONCAT_WS('---',label, label) FROM test ORDER BY id LIMIT 1; END")) {
printf("[002] [%d] %s\n", $link->error, $link->errno);
}
if (!($stmt = $link->prepare("CALL p123"))) {
printf("[003] [%d] %s\n", $stmt->error, $stmt->errno);
}
if (!$stmt->execute()) {
printf("[005] [%d] %s\n", $stmt->error, $stmt->errno);
}
$c_id = NULL;
$c_label = NULL;
if (!$stmt->bind_result($c_id, $c_label)) {
printf("[004] [%d] %s\n", $stmt->error, $stmt->errno);
}
var_dump("pre:",$c_id, $c_label);
if (!$stmt->fetch()) {
printf("[006] [%d] %s\n", $stmt->error, $stmt->errno);
}
var_dump("post:",$c_id, $c_label);
if ($stmt->fetch()) {
printf("[007] Shouldn't have fetched anything\n");
var_dump($c_id, $c_label);
}
if ($stmt->fetch()) {
printf("[008] No more rows expected\n");
}
if (!$stmt->more_results()) {
printf("[009] Expected more results\n");
} else {
var_dump("[009] next_result:", $stmt->next_result());
}
if (!$stmt->bind_result($c_id, $c_label)) {
printf("[010] [%d] %s\n", $stmt->error, $stmt->errno);
}
var_dump("pre:",$c_id, $c_label);
if (!$stmt->fetch()) {
printf("[011] [%d] %s\n", $stmt->error, $stmt->errno);
}
var_dump("post:",$c_id, $c_label);
if ($stmt->fetch()) {
printf("[012] No more rows expected\n");
}
if (!$stmt->more_results()) {
printf("[013] Expected more results\n");
} else {
var_dump("[013] next_result:", $stmt->next_result());
}
if ($stmt->more_results()) {
printf("[014] No more results expected\n");
} else {
printf("[014] No result, as expected\n");
}
$stmt->close();
$link->close();
echo "done";
?>
--CLEAN--
<?php
require_once("connect.inc");
if (!$link->query('DROP PROCEDURE IF EXISTS p123')) {
printf("[001] [%d] %s\n", $link->error, $link->errno);
}
?>
--EXPECTF--
string(4) "pre:"
NULL
NULL
string(5) "post:"
int(13)
string(6) "a-ahoi"
string(18) "[009] next_result:"
bool(true)
string(4) "pre:"
int(13)
string(6) "a-ahoi"
string(5) "post:"
int(43)
string(5) "a---a"
string(18) "[013] next_result:"
bool(true)
[014] No result, as expected
done
+1 -6
View File
@@ -12,11 +12,6 @@ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
exit(1);
}
if (!mysqli_query($link, 'SET SESSION sql_mode=\'\'')) {
printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
exit(1);
}
if (!mysqli_query($link, 'CREATE TABLE test(id INT DEFAULT 0, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine)) {
printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
exit(1);
@@ -25,4 +20,4 @@ if (!mysqli_query($link, 'CREATE TABLE test(id INT DEFAULT 0, label CHAR(1), PRI
if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f')")) {
printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
?>
?>
-26
View File
@@ -61,29 +61,3 @@ if test "$PHP_MYSQLND" != "no" || test "$PHP_MYSQLND_ENABLED" = "yes" || test "$
#endif
])
fi
dnl
dnl Check if the compiler supports Decimal32/64/128 types from the IEEE-754 2008 version
dnl References: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1657.pdf
dnl http://speleotrove.com/decimal/
dnl
AC_CACHE_CHECK([whether whether compiler supports Decimal32/64/128 types], ac_cv_decimal_fp_supported,[
AC_TRY_RUN( [
#include <stdio.h>
int main(int argc, char **argv) {
typedef float dec32 __attribute__((mode(SD)));
dec32 k = 99.49f;
double d2 = (double)k;
return 0;
}
],[
ac_cv_decimal_fp_supported=yes
],[
ac_cv_decimal_fp_supported=no
],[
ac_cv_decimal_fp_supported=no
])])
if test "$ac_cv_decimal_fp_supported" = "yes"; then
AC_DEFINE(HAVE_DECIMAL_FP_SUPPORT, 1, [Define if the compiler supports Decimal32/64/128 types.])
fi
+1 -1
View File
@@ -929,7 +929,7 @@ MYSQLND_METHOD(mysqlnd_net, enable_ssl)(MYSQLND_NET * const net TSRMLS_DC)
DBG_RETURN(PASS);
#else
DBG_ENTER("mysqlnd_net::enable_ssl");
DBG_INF("MYSQLND_SSL_SUPPORTED is not defined");
DBG_INFO("MYSQLND_SSL_SUPPORTED is not defined");
DBG_RETURN(PASS);
#endif
}
+17 -34
View File
@@ -50,7 +50,6 @@ enum_func_status mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES *result, void *param,
static void mysqlnd_stmt_separate_result_bind(MYSQLND_STMT * const stmt TSRMLS_DC);
static void mysqlnd_stmt_separate_one_result_bind(MYSQLND_STMT * const stmt, unsigned int param_no TSRMLS_DC);
static void MYSQLND_METHOD(mysqlnd_stmt, free_stmt_result)(MYSQLND_STMT * const s TSRMLS_DC);
/* {{{ mysqlnd_stmt::store_result */
static MYSQLND_RES *
@@ -227,7 +226,7 @@ MYSQLND_METHOD(mysqlnd_stmt, next_result)(MYSQLND_STMT * s TSRMLS_DC)
DBG_INF_FMT("server_status=%u cursor=%u", stmt->upsert_status->server_status, stmt->upsert_status->server_status & SERVER_STATUS_CURSOR_EXISTS);
/* Free space for next result */
MYSQLND_METHOD(mysqlnd_stmt, free_stmt_result)(s TSRMLS_CC);
s->m->free_stmt_content(s TSRMLS_CC);
{
enum_func_status ret = s->m->parse_execute_response(s TSRMLS_CC);
DBG_RETURN(ret);
@@ -2062,37 +2061,6 @@ mysqlnd_stmt_separate_one_result_bind(MYSQLND_STMT * const s, unsigned int param
/* }}} */
/* {{{ mysqlnd_stmt::free_stmt_result */
static void
MYSQLND_METHOD(mysqlnd_stmt, free_stmt_result)(MYSQLND_STMT * const s TSRMLS_DC)
{
MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
DBG_ENTER("mysqlnd_stmt::free_stmt_result");
if (!stmt) {
DBG_VOID_RETURN;
}
/*
First separate the bound variables, which point to the result set, then
destroy the set.
*/
mysqlnd_stmt_separate_result_bind(s TSRMLS_CC);
/* Not every statement has a result set attached */
if (stmt->result) {
stmt->result->m.free_result_internal(stmt->result TSRMLS_CC);
stmt->result = NULL;
}
if (stmt->error_info->error_list) {
zend_llist_clean(stmt->error_info->error_list);
mnd_pefree(stmt->error_info->error_list, s->persistent);
stmt->error_info->error_list = NULL;
}
DBG_VOID_RETURN;
}
/* }}} */
/* {{{ mysqlnd_stmt::free_stmt_content */
static void
MYSQLND_METHOD(mysqlnd_stmt, free_stmt_content)(MYSQLND_STMT * const s TSRMLS_DC)
@@ -2125,7 +2093,22 @@ MYSQLND_METHOD(mysqlnd_stmt, free_stmt_content)(MYSQLND_STMT * const s TSRMLS_DC
stmt->param_bind = NULL;
}
MYSQLND_METHOD(mysqlnd_stmt, free_stmt_result)(s TSRMLS_CC);
/*
First separate the bound variables, which point to the result set, then
destroy the set.
*/
mysqlnd_stmt_separate_result_bind(s TSRMLS_CC);
/* Not every statement has a result set attached */
if (stmt->result) {
stmt->result->m.free_result_internal(stmt->result TSRMLS_CC);
stmt->result = NULL;
}
if (stmt->error_info->error_list) {
zend_llist_clean(stmt->error_info->error_list);
mnd_pefree(stmt->error_info->error_list, s->persistent);
stmt->error_info->error_list = NULL;
}
DBG_VOID_RETURN;
}
/* }}} */
+4 -55
View File
@@ -174,63 +174,12 @@ ps_fetch_int64(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_l
static void
ps_fetch_float(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row TSRMLS_DC)
{
float fval;
double dval;
float value;
DBG_ENTER("ps_fetch_float");
float4get(fval, *row);
float4get(value, *row);
ZVAL_DOUBLE(zv, value);
(*row)+= 4;
DBG_INF_FMT("value=%f", fval);
/*
* The following is needed to correctly support 4-byte floats.
* Otherwise, a value of 9.99 in a FLOAT column comes out of mysqli
* as 9.9998998641968.
*
* For GCC, we use the built-in decimal support to "up-convert" a
* 4-byte float to a 8-byte double.
* When that is not available, we fall back to converting the float
* to a string and then converting the string to a double. This mimics
* what MySQL does.
*/
#ifdef HAVE_DECIMAL_FP_SUPPORT
{
typedef float dec32 __attribute__((mode(SD)));
dec32 d32val = fval;
/* The following cast is guaranteed to do the right thing */
dval = (double) d32val;
}
#elif defined(PHP_WIN32)
{
/* float datatype on Winows is already 4 byte but has a precision of 7 digits */
char num_buf[2048];
(void)_gcvt_s(num_buf, 2048, fval, field->decimals >= 31 ? 7 : field->decimals);
dval = zend_strtod(num_buf, NULL);
}
#else
{
char num_buf[2048]; /* Over allocated */
char *s;
#ifndef FLT_DIG
# define FLT_DIG 6
#endif
/* Convert to string. Ignoring localization, etc.
* Following MySQL's rules. If precision is undefined (NOT_FIXED_DEC i.e. 31)
* or larger than 31, the value is limited to 6 (FLT_DIG).
*/
s = php_gcvt(fval,
field->decimals >= 31 ? FLT_DIG : field->decimals,
'.',
'e',
num_buf);
/* And now convert back to double */
dval = zend_strtod(s, NULL);
}
#endif
ZVAL_DOUBLE(zv, dval);
DBG_INF_FMT("value=%f", value);
DBG_VOID_RETURN;
}
/* }}} */
+1 -1
View File
@@ -1151,7 +1151,7 @@ MYSQLND_METHOD(mysqlnd_res, store_result_fetch_data)(MYSQLND_CONN_DATA * const c
No need to FREE_ALLOCA as we can reuse the
'lengths' and 'fields' arrays. For lengths its absolutely safe.
'fields' is reused because the ownership of the strings has been
transferred above.
transfered above.
*/
}
/* Overflow ? */
+1 -10
View File
@@ -171,6 +171,7 @@ static int handle_ssl_error(php_stream *stream, int nr_bytes, zend_bool is_init
return retry;
}
static size_t php_openssl_sockop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
{
php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract;
@@ -338,14 +339,9 @@ static inline int php_openssl_setup_crypto(php_stream *stream,
break;
#endif
case STREAM_CRYPTO_METHOD_SSLv3_CLIENT:
#ifdef OPENSSL_NO_SSL3
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSLv3 support is not compiled into the OpenSSL library PHP is linked against");
return -1;
#else
sslsock->is_client = 1;
method = SSLv3_client_method();
break;
#endif
case STREAM_CRYPTO_METHOD_TLS_CLIENT:
sslsock->is_client = 1;
method = TLSv1_client_method();
@@ -355,14 +351,9 @@ static inline int php_openssl_setup_crypto(php_stream *stream,
method = SSLv23_server_method();
break;
case STREAM_CRYPTO_METHOD_SSLv3_SERVER:
#ifdef OPENSSL_NO_SSL3
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSLv3 support is not compiled into the OpenSSL library PHP is linked against");
return -1;
#else
sslsock->is_client = 0;
method = SSLv3_server_method();
break;
#endif
case STREAM_CRYPTO_METHOD_SSLv2_SERVER:
#ifdef OPENSSL_NO_SSL2
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSLv2 support is not compiled into the OpenSSL library PHP is linked against");
+1 -1
View File
@@ -5311,7 +5311,7 @@ by an auxiliary program - but can then be edited by hand if required. There are
now no calls to isalnum(), isspace(), isdigit(), isxdigit(), tolower() or
toupper() in the code.
7. Turn the malloc/free functions variables into pcre_malloc and pcre_free and
7. Turn the malloc/free funtions variables into pcre_malloc and pcre_free and
make them global. Abolish the function for setting them, as the caller can now
set them directly.
@@ -3,7 +3,6 @@ Phar front controller $_SERVER munging success [cache_list]
--INI--
default_charset=UTF-8
phar.cache_list={PWD}/frontcontroller21.php
cgi.fix_pathinfo=1
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@@ -23,4 +22,4 @@ string(18) "/index.php?test=hi"
string(32) "/frontcontroller21.php/index.php"
string(22) "/frontcontroller21.php"
string(%d) "%sfrontcontroller21.php"
string(40) "/frontcontroller21.php/index.php?test=hi"
string(40) "/frontcontroller21.php/index.php?test=hi"
+1 -2
View File
@@ -2,7 +2,6 @@
Phar front controller $_SERVER munging success
--INI--
default_charset=UTF-8
cgi.fix_pathinfo=1
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@@ -22,4 +21,4 @@ string(18) "/index.php?test=hi"
string(32) "/frontcontroller21.php/index.php"
string(22) "/frontcontroller21.php"
string(%d) "%sfrontcontroller21.php"
string(40) "/frontcontroller21.php/index.php?test=hi"
string(40) "/frontcontroller21.php/index.php?test=hi"
@@ -2,7 +2,6 @@
Phar front controller $_SERVER munging success tar-based
--INI--
default_charset=UTF-8
cgi.fix_pathinfo=1
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@@ -22,4 +21,4 @@ string(18) "/index.php?test=hi"
string(37) "/frontcontroller21.phar.php/index.php"
string(27) "/frontcontroller21.phar.php"
string(%d) "%sfrontcontroller21.phar.php"
string(45) "/frontcontroller21.phar.php/index.php?test=hi"
string(45) "/frontcontroller21.phar.php/index.php?test=hi"
@@ -2,7 +2,6 @@
Phar front controller $_SERVER munging success zip-based
--INI--
default_charset=UTF-8
cgi.fix_pathinfo=1
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
<?php if (!extension_loaded("zlib")) die("skip zlib not available"); ?>
@@ -23,4 +22,4 @@ string(18) "/index.php?test=hi"
string(37) "/frontcontroller21.phar.php/index.php"
string(27) "/frontcontroller21.phar.php"
string(%d) "%sfrontcontroller21.phar.php"
string(45) "/frontcontroller21.phar.php/index.php?test=hi"
string(45) "/frontcontroller21.phar.php/index.php?test=hi"
+5 -20
View File
@@ -1007,12 +1007,9 @@ static int _extension_class_string(zend_class_entry **pce TSRMLS_DC, int num_arg
int *num_classes = va_arg(args, int*);
if (((*pce)->type == ZEND_INTERNAL_CLASS) && (*pce)->info.internal.module && !strcasecmp((*pce)->info.internal.module->name, module->name)) {
/* dump class if it is not an alias */
if (!zend_binary_strcasecmp((*pce)->name, (*pce)->name_length, hash_key->arKey, hash_key->nKeyLength-1)) {
string_printf(str, "\n");
_class_string(str, *pce, NULL, indent TSRMLS_CC);
(*num_classes)++;
}
string_printf(str, "\n");
_class_string(str, *pce, NULL, indent TSRMLS_CC);
(*num_classes)++;
}
return ZEND_HASH_APPLY_KEEP;
}
@@ -5363,24 +5360,12 @@ static int add_extension_class(zend_class_entry **pce TSRMLS_DC, int num_args, v
int add_reflection_class = va_arg(args, int);
if (((*pce)->type == ZEND_INTERNAL_CLASS) && (*pce)->info.internal.module && !strcasecmp((*pce)->info.internal.module->name, module->name)) {
const char *name;
int nlen;
if (zend_binary_strcasecmp((*pce)->name, (*pce)->name_length, hash_key->arKey, hash_key->nKeyLength-1)) {
/* This is an class alias, use alias name */
name = hash_key->arKey;
nlen = hash_key->nKeyLength-1;
} else {
/* Use class name */
name = (*pce)->name;
nlen = (*pce)->name_length;
}
if (add_reflection_class) {
ALLOC_ZVAL(zclass);
zend_reflection_class_factory(*pce, zclass TSRMLS_CC);
add_assoc_zval_ex(class_array, name, nlen+1, zclass);
add_assoc_zval_ex(class_array, (*pce)->name, (*pce)->name_length + 1, zclass);
} else {
add_next_index_stringl(class_array, name, nlen, 1);
add_next_index_stringl(class_array, (*pce)->name, (*pce)->name_length, 1);
}
}
return ZEND_HASH_APPLY_KEEP;
-2
View File
@@ -148,8 +148,6 @@ PHP_METHOD(SessionHandler, create_sid)
{
char *id;
PS_SANITY_CHECK;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
-10
View File
@@ -1,10 +0,0 @@
--TEST--
Bug #67972: SessionHandler Invalid memory read create_sid()
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
<?php
(new SessionHandler)->create_sid();
--EXPECTF--
Fatal error: SessionHandler::create_sid(): Cannot call default session handler in %s on line %d
+1 -1
View File
@@ -373,7 +373,7 @@ class Interop_Client
}
$soap =& $endpoint_info['client'];
# XXX how do we determine a failure on retrieving/parsing wsdl?
# XXX how do we determine a failure on retreiving/parsing wsdl?
if ($soap->wsdl->fault) {
$fault = $soap->wsdl->fault;
$soap_test->setResult(0,'WSDL',
+1 -1
View File
@@ -326,7 +326,7 @@ PHP_FUNCTION(spl_autoload)
RETURN_FALSE;
}
if (file_exts == NULL) { /* autoload_extensions is not initialized, set to defaults */
if (file_exts == NULL) { /* autoload_extensions is not intialzed, set to defaults */
copy = pos1 = estrndup(SPL_DEFAULT_FILE_EXTENSIONS, sizeof(SPL_DEFAULT_FILE_EXTENSIONS)-1);
} else {
copy = pos1 = estrndup(file_exts, file_exts_len);
+1 -1
View File
@@ -1414,7 +1414,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
return NULL;
}
if (spl_cit_check_flags(flags) != SUCCESS) {
zend_throw_exception(spl_ce_InvalidArgumentException, "Flags must contain only one of CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT, TOSTRING_USE_INNER", 0 TSRMLS_CC);
zend_throw_exception(spl_ce_InvalidArgumentException, "Flags must contain only one of CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT, TOSTRING_USE_CURRENT", 0 TSRMLS_CC);
zend_restore_error_handling(&error_handling TSRMLS_CC);
return NULL;
}
@@ -21,5 +21,5 @@ $test = new CachingIterator($arrayIterator, 3); // this throws an exception
?>
===DONE===
--EXPECTF--
Flags must contain only one of CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT, TOSTRING_USE_INNER
Flags must contain only one of CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT, TOSTRING_USE_CURRENT
===DONE===
+3 -8
View File
@@ -491,18 +491,13 @@ PHP_FUNCTION(glob)
/* now catch the FreeBSD style of "no matches" */
if (!globbuf.gl_pathc || !globbuf.gl_pathv) {
no_results:
#ifndef PHP_WIN32
/* Paths containing '*', '?' and some other chars are
illegal on Windows but legit on other platforms. For
this reason the direct basedir check against the glob
query is senseless on windows. For instance while *.txt
is a pretty valid filename on EXT3, it's invalid on NTFS. */
if (PG(open_basedir) && *PG(open_basedir)) {
if (php_check_open_basedir_ex(pattern, 0 TSRMLS_CC)) {
struct stat s;
if (0 != VCWD_STAT(pattern, &s) || S_IFDIR != (s.st_mode & S_IFMT)) {
RETURN_FALSE;
}
}
#endif
array_init(return_value);
return;
}
+24 -60
View File
@@ -412,14 +412,8 @@ PHP_FUNCTION(dns_check_record)
#if HAVE_FULL_DNS_FUNCS
#define CHECKCP(n) do { \
if (cp + n > end) { \
return NULL; \
} \
} while (0)
/* {{{ php_parserr */
static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_to_fetch, int store, int raw, zval **subarray)
static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int store, int raw, zval **subarray)
{
u_short type, class, dlen;
u_long ttl;
@@ -431,18 +425,16 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
*subarray = NULL;
n = dn_expand(answer->qb2, end, cp, name, sizeof(name) - 2);
n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, sizeof(name) - 2);
if (n < 0) {
return NULL;
}
cp += n;
CHECKCP(10);
GETSHORT(type, cp);
GETSHORT(class, cp);
GETLONG(ttl, cp);
GETSHORT(dlen, cp);
CHECKCP(dlen);
if (type_to_fetch != T_ANY && type != type_to_fetch) {
cp += dlen;
return cp;
@@ -469,14 +461,12 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
switch (type) {
case DNS_T_A:
CHECKCP(4);
add_assoc_string(*subarray, "type", "A", 1);
snprintf(name, sizeof(name), "%d.%d.%d.%d", cp[0], cp[1], cp[2], cp[3]);
add_assoc_string(*subarray, "ip", name, 1);
cp += dlen;
break;
case DNS_T_MX:
CHECKCP(2);
add_assoc_string(*subarray, "type", "MX", 1);
GETSHORT(n, cp);
add_assoc_long(*subarray, "pri", n);
@@ -495,7 +485,7 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
if (type == DNS_T_PTR) {
add_assoc_string(*subarray, "type", "PTR", 1);
}
n = dn_expand(answer->qb2, end, cp, name, (sizeof name) - 2);
n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2);
if (n < 0) {
return NULL;
}
@@ -505,22 +495,18 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
case DNS_T_HINFO:
/* See RFC 1010 for values */
add_assoc_string(*subarray, "type", "HINFO", 1);
CHECKCP(1);
n = *cp & 0xFF;
cp++;
CHECKCP(n);
add_assoc_stringl(*subarray, "cpu", (char*)cp, n, 1);
cp += n;
CHECKCP(1);
n = *cp & 0xFF;
cp++;
CHECKCP(n);
add_assoc_stringl(*subarray, "os", (char*)cp, n, 1);
cp += n;
break;
case DNS_T_TXT:
{
int l1 = 0, l2 = 0;
int ll = 0;
zval *entries = NULL;
add_assoc_string(*subarray, "type", "TXT", 1);
@@ -529,41 +515,37 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
MAKE_STD_ZVAL(entries);
array_init(entries);
while (l1 < dlen) {
n = cp[l1];
if ((l1 + n) >= dlen) {
while (ll < dlen) {
n = cp[ll];
if ((ll + n) >= dlen) {
// Invalid chunk length, truncate
n = dlen - (l1 + 1);
n = dlen - (ll + 1);
}
if (n) {
memcpy(tp + l2 , cp + l1 + 1, n);
add_next_index_stringl(entries, cp + l1 + 1, n, 1);
}
l1 = l1 + n + 1;
l2 = l2 + n;
memcpy(tp + ll , cp + ll + 1, n);
add_next_index_stringl(entries, cp + ll + 1, n, 1);
ll = ll + n + 1;
}
tp[l2] = '\0';
tp[dlen] = '\0';
cp += dlen;
add_assoc_stringl(*subarray, "txt", tp, l2, 0);
add_assoc_stringl(*subarray, "txt", tp, (dlen>0)?dlen - 1:0, 0);
add_assoc_zval(*subarray, "entries", entries);
}
break;
case DNS_T_SOA:
add_assoc_string(*subarray, "type", "SOA", 1);
n = dn_expand(answer->qb2, end, cp, name, (sizeof name) -2);
n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) -2);
if (n < 0) {
return NULL;
}
cp += n;
add_assoc_string(*subarray, "mname", name, 1);
n = dn_expand(answer->qb2, end, cp, name, (sizeof name) -2);
n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) -2);
if (n < 0) {
return NULL;
}
cp += n;
add_assoc_string(*subarray, "rname", name, 1);
CHECKCP(5*4);
GETLONG(n, cp);
add_assoc_long(*subarray, "serial", n);
GETLONG(n, cp);
@@ -577,7 +559,6 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
break;
case DNS_T_AAAA:
tp = (u_char*)name;
CHECKCP(8*2);
for(i=0; i < 8; i++) {
GETSHORT(s, cp);
if (s != 0) {
@@ -612,7 +593,6 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
case DNS_T_A6:
p = cp;
add_assoc_string(*subarray, "type", "A6", 1);
CHECKCP(1);
n = ((int)cp[0]) & 0xFF;
cp++;
add_assoc_long(*subarray, "masklen", n);
@@ -648,7 +628,6 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
cp++;
}
for (i = (n + 8) / 16; i < 8; i++) {
CHECKCP(2);
GETSHORT(s, cp);
if (s != 0) {
if (tp > (u_char *)name) {
@@ -678,7 +657,7 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
tp[0] = '\0';
add_assoc_string(*subarray, "ipv6", name, 1);
if (cp < p + dlen) {
n = dn_expand(answer->qb2, end, cp, name, (sizeof name) - 2);
n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2);
if (n < 0) {
return NULL;
}
@@ -687,7 +666,6 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
}
break;
case DNS_T_SRV:
CHECKCP(3*2);
add_assoc_string(*subarray, "type", "SRV", 1);
GETSHORT(n, cp);
add_assoc_long(*subarray, "pri", n);
@@ -695,7 +673,7 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
add_assoc_long(*subarray, "weight", n);
GETSHORT(n, cp);
add_assoc_long(*subarray, "port", n);
n = dn_expand(answer->qb2, end, cp, name, (sizeof name) - 2);
n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2);
if (n < 0) {
return NULL;
}
@@ -703,35 +681,21 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
add_assoc_string(*subarray, "target", name, 1);
break;
case DNS_T_NAPTR:
CHECKCP(2*2);
add_assoc_string(*subarray, "type", "NAPTR", 1);
GETSHORT(n, cp);
add_assoc_long(*subarray, "order", n);
GETSHORT(n, cp);
add_assoc_long(*subarray, "pref", n);
CHECKCP(1);
n = (cp[0] & 0xFF);
cp++;
CHECKCP(n);
add_assoc_stringl(*subarray, "flags", (char*)cp, n, 1);
add_assoc_stringl(*subarray, "flags", (char*)++cp, n, 1);
cp += n;
CHECKCP(1);
n = (cp[0] & 0xFF);
cp++;
CHECKCP(n);
add_assoc_stringl(*subarray, "services", (char*)cp, n, 1);
add_assoc_stringl(*subarray, "services", (char*)++cp, n, 1);
cp += n;
CHECKCP(1);
n = (cp[0] & 0xFF);
cp++;
CHECKCP(n);
add_assoc_stringl(*subarray, "regex", (char*)cp, n, 1);
add_assoc_stringl(*subarray, "regex", (char*)++cp, n, 1);
cp += n;
n = dn_expand(answer->qb2, end, cp, name, (sizeof name) - 2);
n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2);
if (n < 0) {
return NULL;
}
@@ -924,7 +888,7 @@ PHP_FUNCTION(dns_get_record)
while (an-- && cp && cp < end) {
zval *retval;
cp = php_parserr(cp, end, &answer, type_to_fetch, store_results, raw, &retval);
cp = php_parserr(cp, &answer, type_to_fetch, store_results, raw, &retval);
if (retval != NULL && store_results) {
add_next_index_zval(return_value, retval);
}
@@ -937,7 +901,7 @@ PHP_FUNCTION(dns_get_record)
while (ns-- > 0 && cp && cp < end) {
zval *retval = NULL;
cp = php_parserr(cp, end, &answer, DNS_T_ANY, authns != NULL, raw, &retval);
cp = php_parserr(cp, &answer, DNS_T_ANY, authns != NULL, raw, &retval);
if (retval != NULL) {
add_next_index_zval(authns, retval);
}
@@ -949,7 +913,7 @@ PHP_FUNCTION(dns_get_record)
while (ar-- > 0 && cp && cp < end) {
zval *retval = NULL;
cp = php_parserr(cp, end, &answer, DNS_T_ANY, 1, raw, &retval);
cp = php_parserr(cp, &answer, DNS_T_ANY, 1, raw, &retval);
if (retval != NULL) {
add_next_index_zval(addtl, retval);
}
+3 -3
View File
@@ -365,8 +365,8 @@ static unsigned short php_read2(php_stream * stream TSRMLS_DC)
{
unsigned char a[2];
/* return 0 if we couldn't read enough data */
if((php_stream_read(stream, a, sizeof(a))) < sizeof(a)) return 0;
/* just return 0 if we hit the end-of-file */
if((php_stream_read(stream, a, sizeof(a))) <= 0) return 0;
return (((unsigned short)a[0]) << 8) + ((unsigned short)a[1]);
}
@@ -646,7 +646,7 @@ static struct gfxinfo *php_handle_jpc(php_stream * stream TSRMLS_DC)
#endif
result->channels = php_read2(stream TSRMLS_CC); /* Csiz */
if (result->channels == 0 && php_stream_eof(stream) || result->channels > 256) {
if (result->channels < 0 || result->channels > 256) {
efree(result);
return NULL;
}
+4 -19
View File
@@ -5,30 +5,15 @@ Test glob() function: ensure no platform difference
$path = dirname(__FILE__);
ini_set('open_basedir', NULL);
var_dump(glob("$path/*.none"));
var_dump(glob("$path/?.none"));
var_dump(glob("$path/*{hello,world}.none"));
var_dump(glob("$path/*/nothere"));
var_dump(glob("$path/[aoeu]*.none"));
var_dump(glob("$path/directly_not_exists"));
$b = ini_get('open_basedir');
var_dump(empty($b));
ini_set('open_basedir', $path);
var_dump(glob("$path/*.none"));
?>
==DONE==
--EXPECT--
array(0) {
}
array(0) {
}
array(0) {
}
array(0) {
}
array(0) {
}
array(0) {
}
bool(true)
bool(false)
==DONE==
@@ -1,33 +0,0 @@
--TEST--
Test glob() function: ensure no platform difference, variation 2
--FILE--
<?php
$path = dirname(__FILE__);
ini_set('open_basedir', $path);
var_dump(glob("$path/*.none"));
var_dump(glob("$path/?.none"));
var_dump(glob("$path/*{hello,world}.none"));
var_dump(glob("$path/*/nothere"));
var_dump(glob("$path/[aoeu]*.none"));
var_dump(glob("$path/directly_not_exists"));
var_dump($path == ini_get('open_basedir'));
?>
==DONE==
--EXPECT--
array(0) {
}
array(0) {
}
array(0) {
}
array(0) {
}
array(0) {
}
array(0) {
}
bool(true)
==DONE==
@@ -1,29 +0,0 @@
--TEST--
Test glob() function: ensure no platform difference, variation 3
--SKIPIF--
<?php if( substr(PHP_OS, 0, 3) == "WIN" ) {die('skip not valid on Windows');} ?>
--FILE--
<?php
$path = dirname(__FILE__);
ini_set('open_basedir', '/tmp');
var_dump(glob("$path/*.none"));
var_dump(glob("$path/?.none"));
var_dump(glob("$path/*{hello,world}.none"));
var_dump(glob("$path/*/nothere"));
var_dump(glob("$path/[aoeu]*.none"));
var_dump(glob("$path/directly_not_exists"));
var_dump('/tmp' == ini_get('open_basedir'));
?>
==DONE==
--EXPECT--
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(true)
==DONE==
@@ -1,35 +0,0 @@
--TEST--
Test glob() function: ensure no platform difference, variation 4
--SKIPIF--
<?php if( substr(PHP_OS, 0, 3) != "WIN" ) {die('skip only valid on Windows');} ?>
--FILE--
<?php
$path = dirname(__FILE__);
ini_set('open_basedir', 'c:\\windows');
var_dump(glob("$path/*.none"));
var_dump(glob("$path/?.none"));
var_dump(glob("$path/*{hello,world}.none"));
var_dump(glob("$path/*/nothere"));
var_dump(glob("$path/[aoeu]*.none"));
var_dump(glob("$path/directly_not_exists"));
var_dump('c:\\windows' == ini_get('open_basedir'));
?>
==DONE==
--EXPECT--
array(0) {
}
array(0) {
}
array(0) {
}
array(0) {
}
array(0) {
}
array(0) {
}
bool(true)
==DONE==
@@ -1,12 +0,0 @@
--TEST--
Bug #68044 Integer overflow in unserialize() (32-bits only)
--FILE--
<?php
echo unserialize('C:3:"XYZ":18446744075857035259:{}');
?>
===DONE==
--EXPECTF--
Warning: Insufficient data for unserializing - %d required, 1 present in %s/bug68044.php on line 2
Notice: unserialize(): Error at offset 32 of 33 bytes in %s/bug68044.php on line 2
===DONE==
@@ -1,95 +0,0 @@
--TEST--
Bug #51800 proc_open on Windows hangs forever
--SKIPIF--
<?php
echo 'skip expected to fail or take too long';
if (getenv("SKIP_SLOW_TESTS")) {
die("skip slow test");
}
?>
--XFAIL--
pipes have to be read/written simultaneously
--FILE--
<?php
/* This is the wrong way to do it. The parent will block till it has read all the STDIN.
The smaller the pipe buffer is, the longer it will take. It might even pass at the end,
after taking inappropriately long. Pipes have to be read simultaneously in smaller chunks,
so then the pipe buffer is emptied more often and the child has chance to continue its
write. The behaviour might look some better if write/read in a separate thread, however
this is much more resource greedy and complexer to integrate into the user script. */
$callee = dirname(__FILE__) . "/process_proc_open_bug51800.php";
$php = PHP_BINARY;
$cmd = "$php $callee";
$status;
$stdout = "";
$stderr = "";
$pipes = array();
$descriptors = array(
0 => array("pipe", "rb"), // stdin
1 => array("pipe", "wb"), // stdout
2 => array("pipe", "wb") // stderr
);
/* create the proc file */
$r = file_put_contents($callee, '<?php
$how_much = 10000;
$data0 = str_repeat("a", $how_much);
$data1 = str_repeat("b", $how_much);
fwrite(STDOUT, $data0);
fwrite(STDERR, $data1);
exit(0);
');
if (!$r) {
die("couldn't create helper script '$callee'");
}
$process = proc_open($cmd, $descriptors, $pipes);
if (is_resource($process))
{
fclose($pipes[0]);
while (!feof($pipes[1]))
$stdout .= fread($pipes[1], 1024);
fclose($pipes[1]);
while (!feof($pipes[2]))
$stderr .= fread($pipes[2], 1024);
fclose($pipes[2]);
$status = proc_close($process);
}
var_dump(array(
"status" => $status,
"stdout" => $stdout,
"stderr" => $stderr,
), strlen($stdout), strlen($stderr));
?>
===DONE===
--CLEAN--
<?php
$callee = dirname(__FILE__) . "/process_proc_open_bug51800.php";
unlink($callee);
?>
--EXPECTF--
array(3) {
["status"]=>
int(0)
["stdout"]=>
string(10000) "a%s"
["stderr"]=>
string(10000) "b%s"
}
int(10000)
int(10000)
===DONE===
@@ -1,78 +0,0 @@
--TEST--
Bug #51800 proc_open on Windows hangs forever, the right way to do it
--FILE--
<?php
$callee = dirname(__FILE__) . "/process_proc_open_bug51800_right.php";
$php = PHP_BINARY;
$cmd = "$php $callee";
$status;
$stdout = "";
$stderr = "";
$pipes = array();
$descriptors = array(
0 => array("pipe", "rb"), // stdin
1 => array("pipe", "wb"), // stdout
2 => array("pipe", "wb") // stderr
);
/* create the proc file */
$r = file_put_contents($callee, '<?php
$how_much = 10000;
$data0 = str_repeat("a", $how_much);
$data1 = str_repeat("b", $how_much);
fwrite(STDOUT, $data0);
fwrite(STDERR, $data1);
exit(0);
');
if (!$r) {
die("couldn't create helper script '$callee'");
}
$process = proc_open($cmd, $descriptors, $pipes);
if (is_resource($process))
{
fclose($pipes[0]);
while (!feof($pipes[1]) || !feof($pipes[2])) {
$stdout .= fread($pipes[1], 1024);
$stderr .= fread($pipes[2], 1024);
}
fclose($pipes[1]);
fclose($pipes[2]);
$status = proc_close($process);
}
var_dump(array(
"status" => $status,
"stdout" => $stdout,
"stderr" => $stderr,
), strlen($stdout), strlen($stderr));
?>
===DONE===
--CLEAN--
<?php
$callee = dirname(__FILE__) . "/process_proc_open_bug51800_right.php";
unlink($callee);
?>
--EXPECTF--
array(3) {
["status"]=>
int(0)
["stdout"]=>
string(10000) "a%s"
["stderr"]=>
string(10000) "b%s"
}
int(10000)
int(10000)
===DONE===
@@ -1,84 +0,0 @@
--TEST--
Bug #51800 proc_open on Windows hangs forever, the right way to do it with more data
--FILE--
<?php
$callee = dirname(__FILE__) . "/process_proc_open_bug51800_right2.php";
$php = PHP_BINARY;
$cmd = "$php $callee";
$status;
$stdout = "";
$stderr = "";
$pipes = array();
$descriptors = array(
0 => array("pipe", "rb"), // stdin
1 => array("pipe", "wb"), // stdout
2 => array("pipe", "wb") // stderr
);
/* create the proc file */
$r = file_put_contents($callee, '<?php
$how_much = 1000000;
$data0 = str_repeat("a", $how_much);
$data1 = str_repeat("b", $how_much);
$i0 = $i1 = 0;
$step = 1024;
while ($i0 < strlen($data0) && $i1 < strlen($data1)) {
fwrite(STDOUT, substr($data0, $i0, $step));
fwrite(STDERR, substr($data1, $i1, $step));
$i0 += $step;
$i1 += $step;
}
exit(0);
');
if (!$r) {
die("couldn't create helper script '$callee'");
}
$process = proc_open($cmd, $descriptors, $pipes);
if (is_resource($process))
{
fclose($pipes[0]);
while (!feof($pipes[1]) || !feof($pipes[2])) {
$stdout .= fread($pipes[1], 1024);
$stderr .= fread($pipes[2], 1024);
}
fclose($pipes[1]);
fclose($pipes[2]);
$status = proc_close($process);
}
var_dump(array(
"status" => $status,
"stdout" => $stdout,
"stderr" => $stderr,
), strlen($stdout), strlen($stderr));
?>
===DONE===
--CLEAN--
<?php
$callee = dirname(__FILE__) . "/process_proc_open_bug51800_right2.php";
unlink($callee);
?>
--EXPECTF--
array(3) {
["status"]=>
int(0)
["stdout"]=>
string(1000000) "a%s"
["stderr"]=>
string(1000000) "b%s"
}
int(1000000)
int(1000000)
===DONE===
@@ -1,71 +0,0 @@
--TEST--
Bug #60120 proc_open hangs with stdin/out with 2048+ bytes
--FILE--
<?php
error_reporting(E_ALL);
if (substr(PHP_OS, 0, 3) == 'WIN') {
$cmd = PHP_BINARY . ' -n -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"';
} else {
$cmd = PHP_BINARY . ' -n -r \'fwrite(STDOUT, $in = file_get_contents("php://stdin")); fwrite(STDERR, $in);\'';
}
$descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
$stdin = str_repeat('*', 1024 * 16) . '!';
$stdin = str_repeat('*', 2049 );
$options = array_merge(array('suppress_errors' => true, 'binary_pipes' => true, 'bypass_shell' => false));
$process = proc_open($cmd, $descriptors, $pipes, getcwd(), array(), $options);
foreach ($pipes as $pipe) {
stream_set_blocking($pipe, false);
}
$writePipes = array($pipes[0]);
$stdinLen = strlen($stdin);
$stdinOffset = 0;
unset($pipes[0]);
while ($pipes || $writePipes) {
$r = $pipes;
$w = $writePipes;
$e = null;
$n = stream_select($r, $w, $e, 60);
if (false === $n) {
break;
} elseif ($n === 0) {
proc_terminate($process);
}
if ($w) {
$written = fwrite($writePipes[0], (binary)substr($stdin, $stdinOffset), 8192);
if (false !== $written) {
$stdinOffset += $written;
}
if ($stdinOffset >= $stdinLen) {
fclose($writePipes[0]);
$writePipes = null;
}
}
foreach ($r as $pipe) {
$type = array_search($pipe, $pipes);
$data = fread($pipe, 8192);
var_dump($data);
if (false === $data || feof($pipe)) {
fclose($pipe);
unset($pipes[$type]);
}
}
}
?>
===DONE===
--EXPECTF--
string(2049) "%s"
string(2049) "%s"
string(0) ""
string(0) ""
===DONE===
@@ -1,70 +0,0 @@
--TEST--
Bug #64438 proc_open hangs with stdin/out with 4097+ bytes
--FILE--
<?php
error_reporting(E_ALL);
if (substr(PHP_OS, 0, 3) == 'WIN') {
$cmd = PHP_BINARY . ' -n -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"';
} else {
$cmd = PHP_BINARY . ' -n -r \'fwrite(STDOUT, $in = file_get_contents("php://stdin")); fwrite(STDERR, $in);\'';
}
$descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
$stdin = str_repeat('*', 4097);
$options = array_merge(array('suppress_errors' => true, 'binary_pipes' => true, 'bypass_shell' => false));
$process = proc_open($cmd, $descriptors, $pipes, getcwd(), array(), $options);
foreach ($pipes as $pipe) {
stream_set_blocking($pipe, false);
}
$writePipes = array($pipes[0]);
$stdinLen = strlen($stdin);
$stdinOffset = 0;
unset($pipes[0]);
while ($pipes || $writePipes) {
$r = $pipes;
$w = $writePipes;
$e = null;
$n = stream_select($r, $w, $e, 60);
if (false === $n) {
break;
} elseif ($n === 0) {
proc_terminate($process);
}
if ($w) {
$written = fwrite($writePipes[0], (binary)substr($stdin, $stdinOffset), 8192);
if (false !== $written) {
$stdinOffset += $written;
}
if ($stdinOffset >= $stdinLen) {
fclose($writePipes[0]);
$writePipes = null;
}
}
foreach ($r as $pipe) {
$type = array_search($pipe, $pipes);
$data = fread($pipe, 8192);
var_dump($data);
if (false === $data || feof($pipe)) {
fclose($pipe);
unset($pipes[$type]);
}
}
}
?>
===DONE===
--EXPECTF--
string(4097) "%s"
string(4097) "%s"
string(0) ""
string(0) ""
===DONE===
@@ -1,5 +1,5 @@
--TEST--
Test dirname() function : basic functionality
Test dirname() function : basic funtionality
--FILE--
<?php
/* Prototype: string dirname ( string $path );
+1 -1
View File
@@ -266,7 +266,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
p = s;
} else {
/* memrchr is a GNU specific extension
Emulate for wide compatibility */
Emulate for wide compatability */
for(p = e; p >= s && *p != ':'; p--);
}
+2 -2
View File
@@ -1,4 +1,4 @@
/* Generated by re2c 0.13.5 */
/* Generated by re2c 0.13.5 on Sat Jun 21 21:27:56 2014 */
#line 1 "ext/standard/var_unserializer.re"
/*
+----------------------------------------------------------------------+
@@ -372,7 +372,7 @@ static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
(*p) += 2;
if (datalen < 0 || (max - (*p)) <= datalen) {
if (datalen < 0 || (*p) + datalen >= max) {
zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %ld present", datalen, (long)(max - (*p)));
return 0;
}
+1 -1
View File
@@ -376,7 +376,7 @@ static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
(*p) += 2;
if (datalen < 0 || (max - (*p)) <= datalen) {
if (datalen < 0 || (*p) + datalen >= max) {
zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %ld present", datalen, (long)(max - (*p)));
return 0;
}
@@ -1,7 +1,9 @@
--TEST--
Bug #62328 (implementing __toString and a cast to string fails)
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
<?php
require_once("skipif.inc");
?>
--FILE--
<?php
class UberSimpleXML extends SimpleXMLElement {
+5 -8
View File
@@ -219,19 +219,16 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
n = 10;
tm.tm_mon = 0;
for(i = 0; i < 2; i++) {
XMLRPC_IS_NUMBER(text[i+4])
XMLRPC_IS_NUMBER(text[i])
tm.tm_mon += (text[i+4]-'0')*n;
n /= 10;
}
tm.tm_mon --;
if(tm.tm_mon < 0 || tm.tm_mon > 11) {
return -1;
}
n = 10;
tm.tm_mday = 0;
for(i = 0; i < 2; i++) {
XMLRPC_IS_NUMBER(text[i+6])
XMLRPC_IS_NUMBER(text[i])
tm.tm_mday += (text[i+6]-'0')*n;
n /= 10;
}
@@ -239,7 +236,7 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
n = 10;
tm.tm_hour = 0;
for(i = 0; i < 2; i++) {
XMLRPC_IS_NUMBER(text[i+9])
XMLRPC_IS_NUMBER(text[i])
tm.tm_hour += (text[i+9]-'0')*n;
n /= 10;
}
@@ -247,7 +244,7 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
n = 10;
tm.tm_min = 0;
for(i = 0; i < 2; i++) {
XMLRPC_IS_NUMBER(text[i+12])
XMLRPC_IS_NUMBER(text[i])
tm.tm_min += (text[i+12]-'0')*n;
n /= 10;
}
@@ -255,7 +252,7 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
n = 10;
tm.tm_sec = 0;
for(i = 0; i < 2; i++) {
XMLRPC_IS_NUMBER(text[i+15])
XMLRPC_IS_NUMBER(text[i])
tm.tm_sec += (text[i+15]-'0')*n;
n /= 10;
}
-44
View File
@@ -1,44 +0,0 @@
--TEST--
Bug #68027 (buffer overflow in mkgmtime() function)
--SKIPIF--
<?php
if (!extension_loaded("xmlrpc")) print "skip";
?>
--FILE--
<?php
$d = '6-01-01 20:00:00';
xmlrpc_set_type($d, 'datetime');
var_dump($d);
$datetime = "2001-0-08T21:46:40-0400";
$obj = xmlrpc_decode("<?xml version=\"1.0\"?><methodResponse><params><param><value><dateTime.iso8601>$datetime</dateTime.iso8601></value></param></params></methodResponse>");
print_r($obj);
$datetime = "34770-0-08T21:46:40-0400";
$obj = xmlrpc_decode("<?xml version=\"1.0\"?><methodResponse><params><param><value><dateTime.iso8601>$datetime</dateTime.iso8601></value></param></params></methodResponse>");
print_r($obj);
echo "Done\n";
?>
--EXPECTF--
object(stdClass)#1 (3) {
["scalar"]=>
string(16) "6-01-01 20:00:00"
["xmlrpc_type"]=>
string(8) "datetime"
["timestamp"]=>
int(%d)
}
stdClass Object
(
[scalar] => 2001-0-08T21:46:40-0400
[xmlrpc_type] => datetime
[timestamp] => %s
)
stdClass Object
(
[scalar] => 34770-0-08T21:46:40-0400
[xmlrpc_type] => datetime
[timestamp] => %d
)
Done
+2 -1
View File
@@ -302,7 +302,8 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
data->strm.zalloc = (alloc_func) php_zlib_alloc;
data->strm.zfree = (free_func) php_zlib_free;
data->strm.avail_out = data->outbuf_len = data->inbuf_len = 0x8000;
data->strm.avail_out = data->outbuf_len = 0x8000;
data->inbuf_len = 2048;
data->strm.next_in = data->inbuf = (Bytef *) pemalloc(data->inbuf_len, persistent);
if (!data->inbuf) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %zd bytes", data->inbuf_len);
-2
View File
@@ -992,7 +992,6 @@ PHPAPI char *php_socket_strerror(long err, char *buf, size_t bufsize)
buf = estrdup(errstr);
} else {
strncpy(buf, errstr, bufsize);
buf[bufsize?(bufsize-1):0] = 0;
}
return buf;
#else
@@ -1017,7 +1016,6 @@ PHPAPI char *php_socket_strerror(long err, char *buf, size_t bufsize)
buf = estrdup(sysbuf);
} else {
strncpy(buf, sysbuf, bufsize);
buf[bufsize?(bufsize-1):0] = 0;
}
if (free_it) {
+4 -4
View File
@@ -2,7 +2,7 @@
/* edit configure.in to change version number */
#define PHP_MAJOR_VERSION 5
#define PHP_MINOR_VERSION 5
#define PHP_RELEASE_VERSION 18
#define PHP_EXTRA_VERSION ""
#define PHP_VERSION "5.5.18"
#define PHP_VERSION_ID 50518
#define PHP_RELEASE_VERSION 16
#define PHP_EXTRA_VERSION "RC1"
#define PHP_VERSION "5.5.16RC1"
#define PHP_VERSION_ID 50516
-28
View File
@@ -348,34 +348,6 @@ static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count TSRMLS
assert(data != NULL);
if (data->fd >= 0) {
#ifdef PHP_WIN32
php_stdio_stream_data *self = (php_stdio_stream_data*)stream->abstract;
if (self->is_pipe || self->is_process_pipe) {
HANDLE ph = (HANDLE)_get_osfhandle(data->fd);
int retry = 0;
DWORD avail_read = 0;
do {
/* Look ahead to get the available data amount to read. Do the same
as read() does, however not blocking forever. In case it failed,
no data will be read (better than block). */
if (!PeekNamedPipe(ph, NULL, 0, NULL, &avail_read, NULL)) {
break;
}
/* If there's nothing to read, wait in 100ms periods. */
if (0 == avail_read) {
usleep(100000);
}
} while (0 == avail_read && retry++ < 320);
/* Reduce the required data amount to what is available, otherwise read()
will block.*/
if (avail_read < count) {
count = avail_read;
}
}
#endif
ret = read(data->fd, buf, count);
if (ret == (size_t)-1 && errno == EINTR) {
Loaded 100 of 113 files, more files were not shown because too many files have changed in this diff. Show more