diff options
| author | Joe Watkins <krakjoe@php.net> | 2017-01-02 09:44:02 +0000 |
|---|---|---|
| committer | Joe Watkins <krakjoe@php.net> | 2017-01-02 09:44:02 +0000 |
| commit | 3e798c4a5f143ca46feab994d5f446c15aef8e98 (patch) | |
| tree | e1196b654c889dc5de45fda5c99a2d1873a4008f /ext | |
| parent | e077735b03fd2339b2d663d29557cfb5ab2d5eff (diff) | |
| parent | 935b5cb11ed672c42b2a77e10be752702e474e7f (diff) | |
| download | php-git-3e798c4a5f143ca46feab994d5f446c15aef8e98.tar.gz | |
Merge branch 'PHP-7.0' of git.php.net:/php-src into PHP-7.0
* 'PHP-7.0' of git.php.net:/php-src: (146 commits)
Flush stderr on win32 in cli_log_message
Fixed bug #73154
FIx bug #70213
Fix dom class can't be inherited by the internal class
Another try at making concat_003 more reliable
Fix flaky openssl_pkey_new test
Make Opcache tests using the cli server more reliable
Revert "Fix #73530: Unsetting result set may reset other result set"
define php_ap_map_http_request_error function for older httpd only
add old versions of httpd support
Disable AppVeyor fast_finish
Makes the sapi web server and curl tests more reliable
Fixes the curl tests to be more reliable in Travis CI
Interpretation of curl_setopt values for boolean parameters
Fixes #65689. PDO_Firebrid / exec() does not free allocated statement.
Fix alpn_ctx leaking in openssl
Fixed bug #73373 (deflate_add does not verify that output was not truncated)
Fix IS_UNDEF comparisons in opcache
Fixed bug #73704 (phpdbg shows the wrong line in files with shebang)
Increase timing quota for small string concat test
...
Diffstat (limited to 'ext')
101 files changed, 2736 insertions, 1501 deletions
diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c index ec1c72191c..fd6d98306b 100644 --- a/ext/com_dotnet/com_com.c +++ b/ext/com_dotnet/com_com.c @@ -52,6 +52,7 @@ PHP_FUNCTION(com_create_instance) RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, &authid, EOAC_NONE }; + zend_long cp = GetACP(); php_com_initialize(); obj = CDNO_FETCH(object); @@ -59,16 +60,22 @@ PHP_FUNCTION(com_create_instance) if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "s|s!ls", &module_name, &module_name_len, &server_name, &server_name_len, - &obj->code_page, &typelib_name, &typelib_name_len) && + &cp, &typelib_name, &typelib_name_len) && FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "sa|ls", - &module_name, &module_name_len, &server_params, &obj->code_page, + &module_name, &module_name_len, &server_params, &cp, &typelib_name, &typelib_name_len)) { php_com_throw_exception(E_INVALIDARG, "Could not create COM object - invalid arguments!"); return; } + if (Z_L(0) > cp || ZEND_LONG_INT_OVFL(cp)) { + php_com_throw_exception(E_INVALIDARG, "Could not create COM object - invalid codepage!"); + return; + } + obj->code_page = (int)cp; + if (server_name) { ctx = CLSCTX_REMOTE_SERVER; } else if (server_params) { diff --git a/ext/com_dotnet/com_dotnet.c b/ext/com_dotnet/com_dotnet.c index c8e2bc105b..195ba63916 100644 --- a/ext/com_dotnet/com_dotnet.c +++ b/ext/com_dotnet/com_dotnet.c @@ -196,6 +196,7 @@ PHP_FUNCTION(com_dotnet_create_instance) int ret = FAILURE; char *where = ""; IUnknown *unk = NULL; + zend_long cp = GetACP(); php_com_initialize(); stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff); @@ -245,11 +246,17 @@ PHP_FUNCTION(com_dotnet_create_instance) if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l", &assembly_name, &assembly_name_len, &datatype_name, &datatype_name_len, - &obj->code_page)) { + &cp)) { php_com_throw_exception(E_INVALIDARG, "Could not create .Net object - invalid arguments!"); return; } + if (Z_L(0) > cp || ZEND_LONG_INT_OVFL(cp)) { + php_com_throw_exception(E_INVALIDARG, "Could not create .Net object - invalid codepage!"); + return; + } + obj->code_page = (int)cp; + oletype = php_com_string_to_olestring(datatype_name, datatype_name_len, obj->code_page); oleassembly = php_com_string_to_olestring(assembly_name, assembly_name_len, obj->code_page); oletype_sys = SysAllocString(oletype); diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c index 5752a7d705..12c82a41bc 100644 --- a/ext/com_dotnet/com_handlers.c +++ b/ext/com_dotnet/com_handlers.c @@ -656,5 +656,7 @@ zend_object* php_com_object_new(zend_class_entry *ce) zend_object_std_init(&obj->zo, ce); obj->zo.handlers = &php_com_object_handlers; + obj->typeinfo = NULL; + return (zend_object*)obj; } diff --git a/ext/com_dotnet/tests/bug73679.phpt b/ext/com_dotnet/tests/bug73679.phpt new file mode 100644 index 0000000000..6f46d87d7f --- /dev/null +++ b/ext/com_dotnet/tests/bug73679.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #73679 DOTNET read access violation using invalid codepage +--SKIPIF-- +<?php # vim:ft=php +if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present"; ?> +--FILE-- +<?php + +$stack = new DOTNET("mscorlib", "System.Collections.Stack", -2200000000); +$stack->Push(".Net"); +$stack->Push("Hello "); +echo $stack->Pop() . $stack->Pop(); + +?> +--EXPECTF-- +Fatal error: Uncaught com_exception: Could not create .Net object - invalid codepage! in %sbug73679.php:%d +Stack trace: +#0 %sbug73679.php(%d): dotnet->dotnet('mscorlib', 'System.Collecti...', -2200000000) +#1 {main} + thrown in %sbug73679.php on line %d diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 65539d1acc..8a354a371f 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -2302,8 +2302,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{ error = curl_easy_setopt(ch->cp, option, lval); break; case CURLOPT_SAFE_UPLOAD: - lval = zval_get_long(zvalue); - if (lval == 0) { + if (!zend_is_true(zvalue)) { php_error_docref(NULL, E_WARNING, "Disabling safe uploads is no longer supported"); return FAILURE; } @@ -2639,13 +2638,11 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{ break; case CURLOPT_FOLLOWLOCATION: - lval = zval_get_long(zvalue); + lval = zend_is_true(zvalue); #if LIBCURL_VERSION_NUM < 0x071304 - if (PG(open_basedir) && *PG(open_basedir)) { - if (lval != 0) { - php_error_docref(NULL, E_WARNING, "CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set"); - return FAILURE; - } + if (lval && PG(open_basedir) && *PG(open_basedir)) { + php_error_docref(NULL, E_WARNING, "CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set"); + return FAILURE; } #endif error = curl_easy_setopt(ch->cp, option, lval); @@ -2801,8 +2798,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{ break; case CURLOPT_RETURNTRANSFER: - lval = zval_get_long(zvalue); - if (lval) { + if (zend_is_true(zvalue)) { ch->handlers->write->method = PHP_CURL_RETURN; } else { ch->handlers->write->method = PHP_CURL_STDOUT; @@ -2878,8 +2874,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{ } case CURLINFO_HEADER_OUT: - lval = zval_get_long(zvalue); - if (lval == 1) { + if (zend_is_true(zvalue)) { curl_easy_setopt(ch->cp, CURLOPT_DEBUGFUNCTION, curl_debug); curl_easy_setopt(ch->cp, CURLOPT_DEBUGDATA, (void *)ch); curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 1); diff --git a/ext/curl/tests/bug48203-win32.phpt b/ext/curl/tests/bug48203-win32.phpt new file mode 100644 index 0000000000..947c33a3d1 --- /dev/null +++ b/ext/curl/tests/bug48203-win32.phpt @@ -0,0 +1,36 @@ +--TEST-- +Bug #48203 (Crash when CURLOPT_STDERR is set to regular file) +--SKIPIF-- +<?php include 'skipif.inc'; ?> +<?php +if(substr(PHP_OS, 0, 3) != 'WIN' ) { + die('skip Windows only test'); +} +?> +--FILE-- +<?php +include 'server.inc'; +$fp = fopen(dirname(__FILE__) . '/bug48203.tmp', 'w'); + +$ch = curl_init(); + +curl_setopt($ch, CURLOPT_VERBOSE, 1); +curl_setopt($ch, CURLOPT_STDERR, $fp); +curl_setopt($ch, CURLOPT_URL, curl_cli_server_start()); + +fclose($fp); // <-- premature close of $fp caused a crash! + +curl_exec($ch); +curl_close($ch); + +echo "Ok\n"; + +?> +--CLEAN-- +<?php @unlink(dirname(__FILE__) . '/bug48203.tmp'); ?> +--EXPECTF-- +Warning: curl_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %s on line %d +Hello World! +Hello World!Ok +%A + diff --git a/ext/curl/tests/bug48203.phpt b/ext/curl/tests/bug48203.phpt index aae7fc51a4..fc8b4091fc 100644 --- a/ext/curl/tests/bug48203.phpt +++ b/ext/curl/tests/bug48203.phpt @@ -2,6 +2,11 @@ Bug #48203 (Crash when CURLOPT_STDERR is set to regular file) --SKIPIF-- <?php include 'skipif.inc'; ?> +<?php +if(substr(PHP_OS, 0, 3) == 'WIN' ) { + die('skip now for Windows'); +} +?> --FILE-- <?php include 'server.inc'; diff --git a/ext/curl/tests/bug48203_multi.phpt b/ext/curl/tests/bug48203_multi.phpt index e28c990e93..5f9e2ba6b2 100644 --- a/ext/curl/tests/bug48203_multi.phpt +++ b/ext/curl/tests/bug48203_multi.phpt @@ -7,7 +7,7 @@ include 'skipif.inc'; --FILE-- <?php include 'server.inc'; -function checkForClosedFilePointer($curl_option, $description) { +function checkForClosedFilePointer($target_url, $curl_option, $description) { $fp = fopen(dirname(__FILE__) . '/bug48203.tmp', 'w'); $ch1 = curl_init(); @@ -16,7 +16,7 @@ function checkForClosedFilePointer($curl_option, $description) { $options = array( CURLOPT_RETURNTRANSFER => 1, $curl_option => $fp, - CURLOPT_URL => curl_cli_server_start() + CURLOPT_URL => $target_url, ); // we also need to set CURLOPT_VERBOSE to test CURLOPT_STDERR properly @@ -47,6 +47,10 @@ function checkForClosedFilePointer($curl_option, $description) { curl_multi_remove_handle($mh, $ch2); curl_multi_close($mh); + // Force curl to output results + fflush(STDERR); + fflush(STDOUT); + echo "Ok for $description\n"; } @@ -54,31 +58,34 @@ $options_to_check = array( "CURLOPT_STDERR", "CURLOPT_WRITEHEADER", "CURLOPT_FILE", "CURLOPT_INFILE" ); +$target_url = curl_cli_server_start(); foreach($options_to_check as $option) { - checkForClosedFilePointer(constant($option), $option); + checkForClosedFilePointer($target_url, constant($option), $option); } ?> --CLEAN-- <?php @unlink(dirname(__FILE__) . '/bug48203.tmp'); ?> --EXPECTF-- -Warning: curl_multi_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %sbug48203_multi.php on line 36 +Warning: curl_multi_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %s on line %d -Warning: curl_multi_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %sbug48203_multi.php on line 36 +Warning: curl_multi_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %s on line %d %A Ok for CURLOPT_STDERR -%A -Warning: curl_multi_exec(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in %sbug48203_multi.php on line 36 -Warning: curl_multi_exec(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in %sbug48203_multi.php on line 36 +Warning: curl_multi_exec(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in %s on line %d + +Warning: curl_multi_exec(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in %s on line %d Ok for CURLOPT_WRITEHEADER -Warning: curl_multi_exec(): CURLOPT_FILE resource has gone away, resetting to default in %sbug48203_multi.php on line 36 +Warning: curl_multi_exec(): CURLOPT_FILE resource has gone away, resetting to default in %s on line %d -Warning: curl_multi_exec(): CURLOPT_FILE resource has gone away, resetting to default in %sbug48203_multi.php on line 36 -%AOk for CURLOPT_FILE +Warning: curl_multi_exec(): CURLOPT_FILE resource has gone away, resetting to default in %s on line %d +Hello World! +Hello World!Hello World! +Hello World!Ok for CURLOPT_FILE -Warning: curl_multi_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %sbug48203_multi.php on line 36 +Warning: curl_multi_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %s on line %d -Warning: curl_multi_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %sbug48203_multi.php on line 36 +Warning: curl_multi_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %s on line %d Ok for CURLOPT_INFILE diff --git a/ext/curl/tests/bug54798-win32.phpt b/ext/curl/tests/bug54798-win32.phpt new file mode 100644 index 0000000000..c3b240dea7 --- /dev/null +++ b/ext/curl/tests/bug54798-win32.phpt @@ -0,0 +1,68 @@ +--TEST-- +Bug #54798 (Segfault when CURLOPT_STDERR file pointer is closed before calling curl_exec) +--SKIPIF-- +<?php +include 'skipif.inc'; +if(substr(PHP_OS, 0, 3) != 'WIN' ) { + die('skip Windows only'); +} +?> +--FILE-- +<?php + +function checkForClosedFilePointer($host, $curl_option, $description) { + $fp = fopen(dirname(__FILE__) . '/bug54798.tmp', 'w+'); + + $ch = curl_init(); + + // we also need CURLOPT_VERBOSE to be set to test CURLOPT_STDERR properly + if (CURLOPT_STDERR == $curl_option) { + curl_setopt($ch, CURLOPT_VERBOSE, 1); + } + + if (CURLOPT_INFILE == $curl_option) { + curl_setopt($ch, CURLOPT_UPLOAD, 1); + } + + curl_setopt($ch, $curl_option, $fp); + + curl_setopt($ch, CURLOPT_URL, $host); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + + fclose($fp); // <-- premature close of $fp caused a crash! + + curl_exec($ch); + + curl_close($ch); + + echo "Ok for $description\n"; +} + +$options_to_check = array( + "CURLOPT_STDERR", + "CURLOPT_WRITEHEADER", + "CURLOPT_FILE", + "CURLOPT_INFILE" +); + +include 'server.inc'; +$host = curl_cli_server_start(); +foreach($options_to_check as $option) { + checkForClosedFilePointer($host, constant($option), $option); +} + +?> +===DONE=== +--CLEAN-- +<?php @unlink(dirname(__FILE__) . '/bug54798.tmp'); ?> +--EXPECTF-- +%AOk for CURLOPT_STDERR + +%AOk for CURLOPT_WRITEHEADER + +%AHello World! +Hello World!Ok for CURLOPT_FILE + +%AOk for CURLOPT_INFILE +===DONE=== +%A diff --git a/ext/curl/tests/bug54798.phpt b/ext/curl/tests/bug54798.phpt index 4a9b999940..d2542815d4 100644 --- a/ext/curl/tests/bug54798.phpt +++ b/ext/curl/tests/bug54798.phpt @@ -3,6 +3,9 @@ Bug #54798 (Segfault when CURLOPT_STDERR file pointer is closed before calling c --SKIPIF-- <?php include 'skipif.inc'; +if(substr(PHP_OS, 0, 3) == 'WIN' ) { + die('skip not for Windows'); +} ?> --FILE-- <?php diff --git a/ext/curl/tests/bug61948-win32.phpt b/ext/curl/tests/bug61948-win32.phpt index 00f498f910..b91ccb7815 100644 --- a/ext/curl/tests/bug61948-win32.phpt +++ b/ext/curl/tests/bug61948-win32.phpt @@ -5,19 +5,28 @@ Bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction) if(substr(PHP_OS, 0, 3) != 'WIN' ) die("skip Not Valid for Linux"); ?> ---INI-- -open_basedir="c:/tmp" --FILE-- <?php + $base_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug61948"; + mkdir($base_dir . DIRECTORY_SEPARATOR . "foo", 0755, true); + + ini_set("open_basedir", $base_dir); + $ch = curl_init(); var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, "")); - var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, "c:/tmp/foo")); + var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, "$base_dir/foo")); var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, "c:/xxx/bar")); curl_close($ch); ?> +--CLEAN-- +<?php + $base_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug61948"; + rmdir("$base_dir/foo"); + rmdir($base_dir); +?> --EXPECTF-- %a bool(true) -Warning: curl_setopt(): open_basedir restriction in effect. File(c:/xxx/bar) is not within the allowed path(s): (c:/tmp) in %sbug61948-win32.php on line %d +Warning: curl_setopt(): open_basedir restriction in effect. File(c:/xxx/bar) is not within the allowed path(s): (%sbug61948) in %sbug61948-win32.php on line %d bool(false) diff --git a/ext/curl/tests/server.inc b/ext/curl/tests/server.inc index 6d96a9850c..315fd68cc4 100644 --- a/ext/curl/tests/server.inc +++ b/ext/curl/tests/server.inc @@ -9,48 +9,64 @@ function curl_cli_server_start() { return getenv('PHP_CURL_HTTP_REMOTE_SERVER'); } - $php_executable = getenv('TEST_PHP_EXECUTABLE'); - $doc_root = __DIR__; - $router = "responder/get.php"; - - $descriptorspec = array( - 0 => STDIN, - 1 => STDOUT, - 2 => STDERR, - ); - - if (substr(PHP_OS, 0, 3) == 'WIN') { - $cmd = "{$php_executable} -t {$doc_root} -n -S " . PHP_CURL_SERVER_ADDRESS; + $php_executable = getenv('TEST_PHP_EXECUTABLE'); + $doc_root = __DIR__; + $router = "responder/get.php"; + + $descriptorspec = array( + 0 => STDIN, + 1 => STDOUT, + 2 => STDERR, + ); + + if (substr(PHP_OS, 0, 3) == 'WIN') { + $cmd = "{$php_executable} -t {$doc_root} -n -S " . PHP_CURL_SERVER_ADDRESS; + $cmd .= " {$router}"; + $handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array("bypass_shell" => true, "suppress_errors" => true)); + } else { + $cmd = "exec {$php_executable} -t {$doc_root} -n -S " . PHP_CURL_SERVER_ADDRESS; $cmd .= " {$router}"; - $handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array("bypass_shell" => true, "suppress_errors" => true)); - } else { - $cmd = "exec {$php_executable} -t {$doc_root} -n -S " . PHP_CURL_SERVER_ADDRESS; - $cmd .= " {$router}"; - $cmd .= " 2>/dev/null"; - - $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root); - } + $cmd .= " 2>/dev/null"; + + $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root); + } - // note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.' - // it might not be listening yet...need to wait until fsockopen() call returns - $i = 0; - while (($i++ < 30) && !($fp = @fsockopen(PHP_CURL_SERVER_HOSTNAME, PHP_CURL_SERVER_PORT))) { - usleep(10000); + // note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.' + // it might not be listening yet...need to wait until fsockopen() call returns + $error = "Unable to connect to servers\n"; + for ($i=0; $i < 60; $i++) { + usleep(25000); // 25ms per try + $status = proc_get_status($handle); + $fp = @fsockopen(PHP_CURL_SERVER_HOSTNAME, PHP_CURL_SERVER_PORT); + // Failure, the server is no longer running + if (!($status && $status['running'])) { + $error = "Server is not running\n"; + break; + } + // Success, Connected to servers + if ($fp) { + $error = ''; + break; + } } if ($fp) { fclose($fp); } - register_shutdown_function( - function($handle) use($router) { - proc_terminate($handle); - }, - $handle - ); - // don't bother sleeping, server is already up - // server can take a variable amount of time to be up, so just sleeping a guessed amount of time - // does not work. this is why tests sometimes pass and sometimes fail. to get a reliable pass - // sleeping doesn't work. + if ($error) { + echo $error; + proc_terminate($handle); + exit(1); + } + + register_shutdown_function( + function($handle) use($router) { + proc_terminate($handle); + }, + $handle + ); + return PHP_CURL_SERVER_ADDRESS; } + diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c index a23dc81db2..ce7e58d950 100644 --- a/ext/date/lib/parse_date.c +++ b/ext/date/lib/parse_date.c @@ -828,7 +828,7 @@ std: -#line 832 "<stdout>" +#line 832 "ext/date/lib/parse_date.c" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -976,7 +976,7 @@ yy3: TIMELIB_DEINIT; return TIMELIB_TIMEZONE; } -#line 980 "<stdout>" +#line 980 "ext/date/lib/parse_date.c" yy4: yych = *++YYCURSOR; if (yych <= 'E') { @@ -1281,7 +1281,7 @@ yy12: add_error(s, "Unexpected character"); goto std; } -#line 1285 "<stdout>" +#line 1285 "ext/date/lib/parse_date.c" yy13: yych = *++YYCURSOR; if (yych <= 'R') { @@ -2299,7 +2299,7 @@ yy49: { goto std; } -#line 2303 "<stdout>" +#line 2303 "ext/date/lib/parse_date.c" yy50: yych = *++YYCURSOR; goto yy49; @@ -2310,7 +2310,7 @@ yy51: s->pos = cursor; s->line++; goto std; } -#line 2314 "<stdout>" +#line 2314 "ext/date/lib/parse_date.c" yy53: yych = *++YYCURSOR; goto yy12; @@ -2692,7 +2692,7 @@ yy72: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 2696 "<stdout>" +#line 2696 "ext/date/lib/parse_date.c" yy73: yych = *++YYCURSOR; if (yych == 'D') goto yy74; @@ -3377,7 +3377,7 @@ yy166: TIMELIB_DEINIT; return TIMELIB_WEEKDAY; } -#line 3381 "<stdout>" +#line 3381 "ext/date/lib/parse_date.c" yy167: yych = *++YYCURSOR; if (yych <= 'K') { @@ -3879,7 +3879,7 @@ yy193: TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 3883 "<stdout>" +#line 3883 "ext/date/lib/parse_date.c" yy194: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 21) YYFILL(21); @@ -3938,7 +3938,7 @@ yy198: TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 3942 "<stdout>" +#line 3942 "ext/date/lib/parse_date.c" yy199: yyaccept = 6; yych = *(YYMARKER = ++YYCURSOR); @@ -4212,7 +4212,7 @@ yy222: TIMELIB_DEINIT; return TIMELIB_SHORTDATE_WITH_TIME; } -#line 4216 "<stdout>" +#line 4216 "ext/date/lib/parse_date.c" yy223: yyaccept = 7; yych = *(YYMARKER = ++YYCURSOR); @@ -4877,7 +4877,7 @@ yy277: TIMELIB_DEINIT; return TIMELIB_SHORTDATE_WITH_TIME; } -#line 4881 "<stdout>" +#line 4881 "ext/date/lib/parse_date.c" yy279: yych = *++YYCURSOR; if (yych <= 0x1F) { @@ -5052,7 +5052,7 @@ yy294: TIMELIB_DEINIT; return TIMELIB_DATE_NO_DAY; } -#line 5056 "<stdout>" +#line 5056 "ext/date/lib/parse_date.c" yy295: yych = *++YYCURSOR; if (yych <= '/') { @@ -6216,7 +6216,7 @@ yy363: TIMELIB_DEINIT; return TIMELIB_PG_TEXT; } -#line 6220 "<stdout>" +#line 6220 "ext/date/lib/parse_date.c" yy364: yych = *++YYCURSOR; if (yych <= '/') goto yy363; @@ -6845,7 +6845,7 @@ yy392: TIMELIB_DEINIT; return TIMELIB_AGO; } -#line 6849 "<stdout>" +#line 6849 "ext/date/lib/parse_date.c" yy393: yyaccept = 5; yych = *(YYMARKER = ++YYCURSOR); @@ -8544,7 +8544,7 @@ yy454: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 8548 "<stdout>" +#line 8548 "ext/date/lib/parse_date.c" yy455: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); @@ -9091,7 +9091,7 @@ yy475: TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 9095 "<stdout>" +#line 9095 "ext/date/lib/parse_date.c" yy476: yyaccept = 10; yych = *(YYMARKER = ++YYCURSOR); @@ -9235,7 +9235,7 @@ yy487: TIMELIB_DEINIT; return TIMELIB_TIME12; } -#line 9239 "<stdout>" +#line 9239 "ext/date/lib/parse_date.c" yy489: yyaccept = 11; yych = *(YYMARKER = ++YYCURSOR); @@ -9271,7 +9271,7 @@ yy490: TIMELIB_DEINIT; return TIMELIB_TIME24_WITH_ZONE; } -#line 9275 "<stdout>" +#line 9275 "ext/date/lib/parse_date.c" yy491: yyaccept = 11; yych = *(YYMARKER = ++YYCURSOR); @@ -9567,7 +9567,7 @@ yy522: TIMELIB_DEINIT; return TIMELIB_TIME24_WITH_ZONE; } -#line 9571 "<stdout>" +#line 9571 "ext/date/lib/parse_date.c" yy524: yyaccept = 11; YYMARKER = ++YYCURSOR; @@ -9676,7 +9676,7 @@ yy534: TIMELIB_DEINIT; return TIMELIB_DATE_FULL; } -#line 9680 "<stdout>" +#line 9680 "ext/date/lib/parse_date.c" yy535: yych = *++YYCURSOR; if (yych == 'M') goto yy536; @@ -10351,7 +10351,7 @@ yy604: TIMELIB_DEINIT; return TIMELIB_DATE_FULL_POINTED; } -#line 10355 "<stdout>" +#line 10355 "ext/date/lib/parse_date.c" yy607: yyaccept = 11; yych = *(YYMARKER = ++YYCURSOR); @@ -10395,7 +10395,7 @@ yy611: TIMELIB_DEINIT; return TIMELIB_DATE_FULL_POINTED; } -#line 10399 "<stdout>" +#line 10399 "ext/date/lib/parse_date.c" yy612: yyaccept = 11; yych = *(YYMARKER = ++YYCURSOR); @@ -11004,7 +11004,7 @@ yy656: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 11008 "<stdout>" +#line 11008 "ext/date/lib/parse_date.c" yy657: yyaccept = 13; yych = *(YYMARKER = ++YYCURSOR); @@ -11115,7 +11115,7 @@ yy666: TIMELIB_DEINIT; return TIMELIB_AMERICAN; } -#line 11119 "<stdout>" +#line 11119 "ext/date/lib/parse_date.c" yy667: yyaccept = 14; yych = *(YYMARKER = ++YYCURSOR); @@ -11334,7 +11334,7 @@ yy700: TIMELIB_DEINIT; return TIMELIB_CLF; } -#line 11338 "<stdout>" +#line 11338 "ext/date/lib/parse_date.c" yy701: yych = *++YYCURSOR; if (yych <= '5') { @@ -11834,7 +11834,7 @@ yy763: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 11838 "<stdout>" +#line 11838 "ext/date/lib/parse_date.c" yy764: yych = *++YYCURSOR; if (yych == 'C') goto yy765; @@ -11878,7 +11878,7 @@ yy770: TIMELIB_DEINIT; return TIMELIB_PG_TEXT; } -#line 11882 "<stdout>" +#line 11882 "ext/date/lib/parse_date.c" yy772: yych = *++YYCURSOR; if (yych == 'V') goto yy765; @@ -12011,7 +12011,7 @@ yy783: TIMELIB_DEINIT; return TIMELIB_CLF; } -#line 12015 "<stdout>" +#line 12015 "ext/date/lib/parse_date.c" yy784: yych = *++YYCURSOR; switch (yych) { @@ -12162,7 +12162,7 @@ yy793: TIMELIB_DEINIT; return TIMELIB_DATE_NO_DAY; } -#line 12166 "<stdout>" +#line 12166 "ext/date/lib/parse_date.c" yy794: yych = *++YYCURSOR; if (yych == 'I') goto yy927; @@ -12374,7 +12374,7 @@ yy814: TIMELIB_DEINIT; return TIMELIB_ISO_WEEK; } -#line 12378 "<stdout>" +#line 12378 "ext/date/lib/parse_date.c" yy815: yych = *++YYCURSOR; if (yych <= '/') goto yy56; @@ -12399,7 +12399,7 @@ yy816: TIMELIB_DEINIT; return TIMELIB_ISO_WEEK; } -#line 12403 "<stdout>" +#line 12403 "ext/date/lib/parse_date.c" yy818: yych = *++YYCURSOR; if (yych <= '/') goto yy60; @@ -12472,7 +12472,7 @@ yy821: TIMELIB_DEINIT; return TIMELIB_PG_YEARDAY; } -#line 12476 "<stdout>" +#line 12476 "ext/date/lib/parse_date.c" yy822: yych = *++YYCURSOR; if (yych <= '/') goto yy60; @@ -12579,7 +12579,7 @@ yy842: TIMELIB_DEINIT; return TIMELIB_XMLRPC_SOAP; } -#line 12583 "<stdout>" +#line 12583 "ext/date/lib/parse_date.c" yy843: yych = *++YYCURSOR; if (yych <= '2') { @@ -12846,7 +12846,7 @@ yy848: TIMELIB_DEINIT; return TIMELIB_DATE_NOCOLON; } -#line 12850 "<stdout>" +#line 12850 "ext/date/lib/parse_date.c" yy849: yych = *++YYCURSOR; if (yych <= 'H') { @@ -13653,7 +13653,7 @@ yy973: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 13657 "<stdout>" +#line 13657 "ext/date/lib/parse_date.c" yy974: yyaccept = 22; yych = *(YYMARKER = ++YYCURSOR); @@ -14587,7 +14587,7 @@ yy1067: TIMELIB_DEINIT; return TIMELIB_GNU_NOCOLON; } -#line 14591 "<stdout>" +#line 14591 "ext/date/lib/parse_date.c" yy1068: yych = *++YYCURSOR; if (yych <= '/') goto yy60; @@ -14690,7 +14690,7 @@ yy1075: TIMELIB_DEINIT; return TIMELIB_ISO_NOCOLON; } -#line 14694 "<stdout>" +#line 14694 "ext/date/lib/parse_date.c" yy1076: yyaccept = 25; yych = *(YYMARKER = ++YYCURSOR); @@ -15562,7 +15562,7 @@ yy1117: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 15566 "<stdout>" +#line 15566 "ext/date/lib/parse_date.c" yy1118: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -15625,7 +15625,7 @@ yy1125: TIMELIB_DEINIT; return TIMELIB_WEEK_DAY_OF_MONTH; } -#line 15629 "<stdout>" +#line 15629 "ext/date/lib/parse_date.c" yy1127: yyaccept = 26; yych = *(YYMARKER = ++YYCURSOR); @@ -15741,7 +15741,7 @@ yy1141: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 15745 "<stdout>" +#line 15745 "ext/date/lib/parse_date.c" yy1142: yych = *++YYCURSOR; goto yy1117; @@ -18287,7 +18287,7 @@ yy1294: TIMELIB_DEINIT; return TIMELIB_LF_DAY_OF_MONTH; } -#line 18291 "<stdout>" +#line 18291 "ext/date/lib/parse_date.c" yy1295: yyaccept = 28; yych = *(YYMARKER = ++YYCURSOR); @@ -18542,7 +18542,7 @@ yy1315: TIMELIB_DEINIT; return TIMELIB_LF_DAY_OF_MONTH; } -#line 18546 "<stdout>" +#line 18546 "ext/date/lib/parse_date.c" yy1317: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); @@ -19927,7 +19927,7 @@ yy1387: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 19931 "<stdout>" +#line 19931 "ext/date/lib/parse_date.c" yy1388: yych = *++YYCURSOR; if (yych <= 'N') { @@ -20344,7 +20344,7 @@ yy1417: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 20348 "<stdout>" +#line 20348 "ext/date/lib/parse_date.c" yy1418: yych = *++YYCURSOR; if (yych <= 'Y') { @@ -20385,7 +20385,7 @@ yy1420: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 20389 "<stdout>" +#line 20389 "ext/date/lib/parse_date.c" yy1421: yych = *++YYCURSOR; if (yych <= 'S') { @@ -22325,7 +22325,7 @@ yy1500: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 22329 "<stdout>" +#line 22329 "ext/date/lib/parse_date.c" yy1501: yych = *++YYCURSOR; if (yych <= 'N') { @@ -22467,7 +22467,7 @@ yy1508: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 22471 "<stdout>" +#line 22471 "ext/date/lib/parse_date.c" yy1509: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); @@ -22988,7 +22988,7 @@ yy1531: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 22992 "<stdout>" +#line 22992 "ext/date/lib/parse_date.c" yy1532: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); diff --git a/ext/date/lib/timezonedb.h b/ext/date/lib/timezonedb.h index 2ae2e9a5d3..9f483bf750 100644 --- a/ext/date/lib/timezonedb.h +++ b/ext/date/lib/timezonedb.h @@ -1,5 +1,5 @@ /* This is a generated file, do not modify */ -const timelib_tzdb_index_entry timezonedb_idx_builtin[591] = { +const timelib_tzdb_index_entry timezonedb_idx_builtin[593] = { #ifdef TIMELIB_SUPPORTS_V2DATA # define FOR_V2(v2,v1) v2 #else @@ -242,365 +242,367 @@ const timelib_tzdb_index_entry timezonedb_idx_builtin[591] = { { "Asia/Amman" , FOR_V2(0x0416C3, 0x0197FF) }, { "Asia/Anadyr" , FOR_V2(0x041E24, 0x019ABA) }, { "Asia/Aqtau" , FOR_V2(0x042309, 0x019CB3) }, - { "Asia/Aqtobe" , FOR_V2(0x04273A, 0x019E7B) }, - { "Asia/Ashgabat" , FOR_V2(0x042B6A, 0x01A031) }, - { "Asia/Ashkhabad" , FOR_V2(0x042E01, 0x01A148) }, - { "Asia/Baghdad" , FOR_V2(0x043098, 0x01A25F) }, - { "Asia/Bahrain" , FOR_V2(0x043480, 0x01A3E5) }, - { "Asia/Baku" , FOR_V2(0x04355D, 0x01A450) }, - { "Asia/Bangkok" , FOR_V2(0x043A5E, 0x01A646) }, - { "Asia/Barnaul" , FOR_V2(0x043B36, 0x01A6AC) }, - { "Asia/Beirut" , FOR_V2(0x044037, 0x01A8AB) }, - { "Asia/Bishkek" , FOR_V2(0x0448C2, 0x01ABC9) }, - { "Asia/Brunei" , FOR_V2(0x044CE3, 0x01AD6F) }, - { "Asia/Calcutta" , FOR_V2(0x044DB8, 0x01ADD6) }, - { "Asia/Chita" , FOR_V2(0x044EE7, 0x01AE60) }, - { "Asia/Choibalsan" , FOR_V2(0x0453F0, 0x01B068) }, - { "Asia/Chongqing" , FOR_V2(0x045A3F, 0x01B2D4) }, - { "Asia/Chungking" , FOR_V2(0x045BE9, 0x01B385) }, - { "Asia/Colombo" , FOR_V2(0x045D93, 0x01B436) }, - { "Asia/Dacca" , FOR_V2(0x045F3C, 0x01B4F3) }, - { "Asia/Damascus" , FOR_V2(0x0460CE, 0x01B5AA) }, - { "Asia/Dhaka" , FOR_V2(0x0469EA, 0x01B8FF) }, - { "Asia/Dili" , FOR_V2(0x046B7C, 0x01B9B6) }, - { "Asia/Dubai" , FOR_V2(0x046CBD, 0x01BA4D) }, - { "Asia/Dushanbe" , FOR_V2(0x046D74, 0x01BAA7) }, - { "Asia/Famagusta" , FOR_V2(0x046FED, 0x01BBB1) }, - { "Asia/Gaza" , FOR_V2(0x0475AD, 0x01BDEC) }, - { "Asia/Harbin" , FOR_V2(0x047ECA, 0x01C150) }, - { "Asia/Hebron" , FOR_V2(0x048074, 0x01C201) }, - { "Asia/Ho_Chi_Minh" , FOR_V2(0x0489AC, 0x01C56E) }, - { "Asia/Hong_Kong" , FOR_V2(0x048B2D, 0x01C61D) }, - { "Asia/Hovd" , FOR_V2(0x048FDE, 0x01C7EC) }, - { "Asia/Irkutsk" , FOR_V2(0x0495FE, 0x01CA4F) }, - { "Asia/Istanbul" , FOR_V2(0x049B20, 0x01CC64) }, - { "Asia/Jakarta" , FOR_V2(0x04A3A2, 0x01CF9C) }, - { "Asia/Jayapura" , FOR_V2(0x04A52D, 0x01D056) }, - { "Asia/Jerusalem" , FOR_V2(0x04A660, 0x01D105) }, - { "Asia/Kabul" , FOR_V2(0x04AF45, 0x01D44D) }, - { "Asia/Kamchatka" , FOR_V2(0x04B018, 0x01D4AF) }, - { "Asia/Karachi" , FOR_V2(0x04B4E4, 0x01D69B) }, - { "Asia/Kashgar" , FOR_V2(0x04B683, 0x01D755) }, - { "Asia/Kathmandu" , FOR_V2(0x04B73A, 0x01D7AF) }, - { "Asia/Katmandu" , FOR_V2(0x04B81A, 0x01D81A) }, - { "Asia/Khandyga" , FOR_V2(0x04B8FA, 0x01D885) }, - { "Asia/Kolkata" , FOR_V2(0x04BE43, 0x01DAB0) }, - { "Asia/Krasnoyarsk" , FOR_V2(0x04BF72, 0x01DB3A) }, - { "Asia/Kuala_Lumpur" , FOR_V2(0x04C472, 0x01DD42) }, - { "Asia/Kuching" , FOR_V2(0x04C620, 0x01DE11) }, - { "Asia/Kuwait" , FOR_V2(0x04C841, 0x01DF03) }, - { "Asia/Macao" , FOR_V2(0x04C8F8, 0x01DF5D) }, - { "Asia/Macau" , FOR_V2(0x04CC1F, 0x01E09D) }, - { "Asia/Magadan" , FOR_V2(0x04CF46, 0x01E1DD) }, - { "Asia/Makassar" , FOR_V2(0x04D44C, 0x01E3E1) }, - { "Asia/Manila" , FOR_V2(0x04D5B9, 0x01E4B4) }, - { "Asia/Muscat" , FOR_V2(0x04D72E, 0x01E552) }, - { "Asia/Nicosia" , FOR_V2(0x04D7E5, 0x01E5AC) }, - { "Asia/Novokuznetsk" , FOR_V2(0x04DFE4, 0x01E8AC) }, - { "Asia/Novosibirsk" , FOR_V2(0x04E4AE, 0x01EA97) }, - { "Asia/Omsk" , FOR_V2(0x04E9B5, 0x01EC9C) }, - { "Asia/Oral" , FOR_V2(0x04EEA9, 0x01EE98) }, - { "Asia/Phnom_Penh" , FOR_V2(0x04F2CB, 0x01F048) }, - { "Asia/Pontianak" , FOR_V2(0x04F3A3, 0x01F0AE) }, - { "Asia/Pyongyang" , FOR_V2(0x04F53C, 0x01F176) }, - { "Asia/Qatar" , FOR_V2(0x04F680, 0x01F20D) }, - { "Asia/Qyzylorda" , FOR_V2(0x04F75D, 0x01F278) }, - { "Asia/Rangoon" , FOR_V2(0x04FB9D, 0x01F43E) }, - { "Asia/Riyadh" , FOR_V2(0x04FCC6, 0x01F4C7) }, - { "Asia/Saigon" , FOR_V2(0x04FD7D, 0x01F521) }, - { "Asia/Sakhalin" , FOR_V2(0x04FEFE, 0x01F5D0) }, - { "Asia/Samarkand" , FOR_V2(0x0503F4, 0x01F7D0) }, - { "Asia/Seoul" , FOR_V2(0x05067C, 0x01F8E8) }, - { "Asia/Shanghai" , FOR_V2(0x0508C3, 0x01F9E0) }, - { "Asia/Singapore" , FOR_V2(0x050A79, 0x01FA9D) }, - { "Asia/Srednekolymsk" , FOR_V2(0x050C31, 0x01FB65) }, - { "Asia/Taipei" , FOR_V2(0x05113B, 0x01FD76) }, - { "Asia/Tashkent" , FOR_V2(0x051467, 0x01FEB8) }, - { "Asia/Tbilisi" , FOR_V2(0x0516FF, 0x01FFD8) }, - { "Asia/Tehran" , FOR_V2(0x051B43, 0x02018B) }, - { "Asia/Tel_Aviv" , FOR_V2(0x0521DD, 0x020406) }, - { "Asia/Thimbu" , FOR_V2(0x052AC2, 0x02074E) }, - { "Asia/Thimphu" , FOR_V2(0x052B9F, 0x0207B9) }, - { "Asia/Tokyo" , FOR_V2(0x052C7C, 0x020824) }, - { "Asia/Tomsk" , FOR_V2(0x052DEB, 0x0208BB) }, - { "Asia/Ujung_Pandang" , FOR_V2(0x0532EC, 0x020ABA) }, - { "Asia/Ulaanbaatar" , FOR_V2(0x053410, 0x020B44) }, - { "Asia/Ulan_Bator" , FOR_V2(0x053A1A, 0x020D91) }, - { "Asia/Urumqi" , FOR_V2(0x05400F, 0x020FC9) }, - { "Asia/Ust-Nera" , FOR_V2(0x0540D3, 0x021030) }, - { "Asia/Vientiane" , FOR_V2(0x0545FD, 0x021248) }, - { "Asia/Vladivostok" , FOR_V2(0x0546D5, 0x0212AE) }, - { "Asia/Yakutsk" , FOR_V2(0x054BD0, 0x0214B0) }, - { "Asia/Yangon" , FOR_V2(0x0550CA, 0x0216B2) }, - { "Asia/Yekaterinburg" , FOR_V2(0x0551F3, 0x02173B) }, - { "Asia/Yerevan" , FOR_V2(0x05570E, 0x021949) }, - { "Atlantic/Azores" , FOR_V2(0x055BC9, 0x021B26) }, - { "Atlantic/Bermuda" , FOR_V2(0x05697B, 0x02203A) }, - { "Atlantic/Canary" , FOR_V2(0x05715B, 0x022320) }, - { "Atlantic/Cape_Verde" , FOR_V2(0x0578EE, 0x0225FB) }, - { "Atlantic/Faeroe" , FOR_V2(0x0579F8, 0x022679) }, - { "Atlantic/Faroe" , FOR_V2(0x058129, 0x022922) }, - { "Atlantic/Jan_Mayen" , FOR_V2(0x05885A, 0x022BCB) }, - { "Atlantic/Madeira" , FOR_V2(0x059131, 0x022F0E) }, - { "Atlantic/Reykjavik" , FOR_V2(0x059EE2, 0x023428) }, - { "Atlantic/South_Georgia" , FOR_V2(0x05A394, 0x0235FA) }, - { "Atlantic/St_Helena" , FOR_V2(0x05A434, 0x02363E) }, - { "Atlantic/Stanley" , FOR_V2(0x05A4EA, 0x023698) }, - { "Australia/ACT" , FOR_V2(0x05A9D4, 0x02387F) }, - { "Australia/Adelaide" , FOR_V2(0x05B28F, 0x023BB3) }, - { "Australia/Brisbane" , FOR_V2(0x05BB68, 0x023EF2) }, - { "Australia/Broken_Hill" , FOR_V2(0x05BD4F, 0x023FCC) }, - { "Australia/Canberra" , FOR_V2(0x05C659, 0x02431D) }, - { "Australia/Currie" , FOR_V2(0x05CF14, 0x024651) }, - { "Australia/Darwin" , FOR_V2(0x05D7E5, 0x02499B) }, - { "Australia/Eucla" , FOR_V2(0x05D946, 0x024A34) }, - { "Australia/Hobart" , FOR_V2(0x05DB52, 0x024B1C) }, - { "Australia/LHI" , FOR_V2(0x05E492, 0x024E8D) }, - { "Australia/Lindeman" , FOR_V2(0x05EBE1, 0x02513F) }, - { "Australia/Lord_Howe" , FOR_V2(0x05EE16, 0x02523A) }, - { "Australia/Melbourne" , FOR_V2(0x05F575, 0x0254FC) }, - { "Australia/North" , FOR_V2(0x05FE38, 0x025838) }, - { "Australia/NSW" , FOR_V2(0x05FF87, 0x0258BF) }, - { "Australia/Perth" , FOR_V2(0x060842, 0x025BF3) }, - { "Australia/Queensland" , FOR_V2(0x060A4B, 0x025CDE) }, - { "Australia/South" , FOR_V2(0x060C1B, 0x025DA1) }, - { "Australia/Sydney" , FOR_V2(0x0614E5, 0x0260D1) }, - { "Australia/Tasmania" , FOR_V2(0x061DBC, 0x026421) }, - { "Australia/Victoria" , FOR_V2(0x0626E7, 0x02677D) }, - { "Australia/West" , FOR_V2(0x062FA2, 0x026AB1) }, - { "Australia/Yancowinna" , FOR_V2(0x06318D, 0x026B7E) }, - { "Brazil/Acre" , FOR_V2(0x063A7B, 0x026EB3) }, - { "Brazil/DeNoronha" , FOR_V2(0x063D17, 0x026FC4) }, - { "Brazil/East" , FOR_V2(0x063FFB, 0x0270E9) }, - { "Brazil/West" , FOR_V2(0x0647E6, 0x0273CB) }, - { "Canada/Atlantic" , FOR_V2(0x064A5A, 0x0274C8) }, - { "Canada/Central" , FOR_V2(0x0657D4, 0x0279B5) }, - { "Canada/East-Saskatchewan" , FOR_V2(0x06632B, 0x027DE0) }, - { "Canada/Eastern" , FOR_V2(0x066719, 0x027F6E) }, - { "Canada/Mountain" , FOR_V2(0x0674D4, 0x02846F) }, - { "Canada/Newfoundland" , FOR_V2(0x067E42, 0x0287EA) }, - { "Canada/Pacific" , FOR_V2(0x068C9E, 0x028D2E) }, - { "Canada/Saskatchewan" , FOR_V2(0x0697FF, 0x029158) }, - { "Canada/Yukon" , FOR_V2(0x069BED, 0x0292E6) }, - { "CET" , FOR_V2(0x06A426, 0x0295FA) }, - { "Chile/Continental" , FOR_V2(0x06AC68, 0x029903) }, - { "Chile/EasterIsland" , FOR_V2(0x06B647, 0x029CA7) }, - { "CST6CDT" , FOR_V2(0x06BF04, 0x029FE1) }, - { "Cuba" , FOR_V2(0x06C806, 0x02A332) }, - { "EET" , FOR_V2(0x06D197, 0x02A6B6) }, - { "Egypt" , FOR_V2(0x06D8F7, 0x02A969) }, - { "Eire" , FOR_V2(0x06E0B7, 0x02AC49) }, - { "EST" , FOR_V2(0x06EEAA, 0x02B16B) }, - { "EST5EDT" , FOR_V2(0x06EF35, 0x02B1AF) }, - { "Etc/GMT" , FOR_V2(0x06F837, 0x02B500) }, - { "Etc/GMT+0" , FOR_V2(0x06F8C2, 0x02B544) }, - { "Etc/GMT+1" , FOR_V2(0x06F94D, 0x02B588) }, - { "Etc/GMT+10" , FOR_V2(0x06F9ED, 0x02B5D6) }, - { "Etc/GMT+11" , FOR_V2(0x06FA8E, 0x02B624) }, - { "Etc/GMT+12" , FOR_V2(0x06FB2F, 0x02B672) }, - { "Etc/GMT+2" , FOR_V2(0x06FBD0, 0x02B6C0) }, - { "Etc/GMT+3" , FOR_V2(0x06FC70, 0x02B70E) }, - { "Etc/GMT+4" , FOR_V2(0x06FD10, 0x02B75C) }, - { "Etc/GMT+5" , FOR_V2(0x06FDB0, 0x02B7AA) }, - { "Etc/GMT+6" , FOR_V2(0x06FE50, 0x02B7F8) }, - { "Etc/GMT+7" , FOR_V2(0x06FEF0, 0x02B846) }, - { "Etc/GMT+8" , FOR_V2(0x06FF90, 0x02B894) }, - { "Etc/GMT+9" , FOR_V2(0x070030, 0x02B8E2) }, - { "Etc/GMT-0" , FOR_V2(0x0700D0, 0x02B930) }, - { "Etc/GMT-1" , FOR_V2(0x07015B, 0x02B974) }, - { "Etc/GMT-10" , FOR_V2(0x0701FC, 0x02B9C2) }, - { "Etc/GMT-11" , FOR_V2(0x07029E, 0x02BA10) }, - { "Etc/GMT-12" , FOR_V2(0x070340, 0x02BA5E) }, - { "Etc/GMT-13" , FOR_V2(0x0703E2, 0x02BAAC) }, - { "Etc/GMT-14" , FOR_V2(0x070484, 0x02BAFA) }, - { "Etc/GMT-2" , FOR_V2(0x070526, 0x02BB48) }, - { "Etc/GMT-3" , FOR_V2(0x0705C7, 0x02BB96) }, - { "Etc/GMT-4" , FOR_V2(0x070668, 0x02BBE4) }, - { "Etc/GMT-5" , FOR_V2(0x070709, 0x02BC32) }, - { "Etc/GMT-6" , FOR_V2(0x0707AA, 0x02BC80) }, - { "Etc/GMT-7" , FOR_V2(0x07084B, 0x02BCCE) }, - { "Etc/GMT-8" , FOR_V2(0x0708EC, 0x02BD1C) }, - { "Etc/GMT-9" , FOR_V2(0x07098D, 0x02BD6A) }, - { "Etc/GMT0" , FOR_V2(0x070A2E, 0x02BDB8) }, - { "Etc/Greenwich" , FOR_V2(0x070AB9, 0x02BDFC) }, - { "Etc/UCT" , FOR_V2(0x070B44, 0x02BE40) }, - { "Etc/Universal" , FOR_V2(0x070BCF, 0x02BE84) }, - { "Etc/UTC" , FOR_V2(0x070C5A, 0x02BEC8) }, - { "Etc/Zulu" , FOR_V2(0x070CE5, 0x02BF0C) }, - { "Europe/Amsterdam" , FOR_V2(0x070D70, 0x02BF50) }, - { "Europe/Andorra" , FOR_V2(0x0718FB, 0x02C39F) }, - { "Europe/Astrakhan" , FOR_V2(0x071FDE, 0x02C62C) }, - { "Europe/Athens" , FOR_V2(0x0724A9, 0x02C818) }, - { "Europe/Belfast" , FOR_V2(0x072D94, 0x02CB6C) }, - { "Europe/Belgrade" , FOR_V2(0x073C07, 0x02D0B4) }, - { "Europe/Berlin" , FOR_V2(0x0743B8, 0x02D38E) }, - { "Europe/Bratislava" , FOR_V2(0x074CF7, 0x02D709) }, - { "Europe/Brussels" , FOR_V2(0x0755E3, 0x02DA4C) }, - { "Europe/Bucharest" , FOR_V2(0x076189, 0x02DE94) }, - { "Europe/Budapest" , FOR_V2(0x076A42, 0x02E1CF) }, - { "Europe/Busingen" , FOR_V2(0x0773B3, 0x02E549) }, - { "Europe/Chisinau" , FOR_V2(0x077B45, 0x02E811) }, - { "Europe/Copenhagen" , FOR_V2(0x0784DE, 0x02EBB5) }, - { "Europe/Dublin" , FOR_V2(0x078D5A, 0x02EED0) }, - { "Europe/Gibraltar" , FOR_V2(0x079B4D, 0x02F3F2) }, - { "Europe/Guernsey" , FOR_V2(0x07A74E, 0x02F85A) }, - { "Europe/Helsinki" , FOR_V2(0x07B5C1, 0x02FDA2) }, - { "Europe/Isle_of_Man" , FOR_V2(0x07BD42, 0x030069) }, - { "Europe/Istanbul" , FOR_V2(0x07CBB5, 0x0305B1) }, - { "Europe/Jersey" , FOR_V2(0x07D437, 0x0308E9) }, - { "Europe/Kaliningrad" , FOR_V2(0x07E2AA, 0x030E31) }, - { "Europe/Kiev" , FOR_V2(0x07E8B8, 0x0310A2) }, - { "Europe/Kirov" , FOR_V2(0x07F109, 0x0313D5) }, - { "Europe/Lisbon" , FOR_V2(0x07F5B2, 0x0315B0) }, - { "Europe/Ljubljana" , FOR_V2(0x08034E, 0x031AC4) }, - { "Europe/London" , FOR_V2(0x080AFF, 0x031D9E) }, - { "Europe/Luxembourg" , FOR_V2(0x081972, 0x0322E6) }, - { "Europe/Madrid" , FOR_V2(0x08251C, 0x032741) }, - { "Europe/Malta" , FOR_V2(0x082F73, 0x032B20) }, - { "Europe/Mariehamn" , FOR_V2(0x0839C4, 0x032EEA) }, - { "Europe/Minsk" , FOR_V2(0x084145, 0x0331B1) }, - { "Europe/Monaco" , FOR_V2(0x0846AB, 0x0333D5) }, - { "Europe/Moscow" , FOR_V2(0x085240, 0x033821) }, - { "Europe/Nicosia" , FOR_V2(0x085868, 0x033AA1) }, - { "Europe/Oslo" , FOR_V2(0x086054, 0x033D8E) }, - { "Europe/Paris" , FOR_V2(0x08692B, 0x0340D1) }, - { "Europe/Podgorica" , FOR_V2(0x0874D2, 0x034528) }, - { "Europe/Prague" , FOR_V2(0x087C83, 0x034802) }, - { "Europe/Riga" , FOR_V2(0x08856F, 0x034B45) }, - { "Europe/Rome" , FOR_V2(0x088E36, 0x034E9B) }, - { "Europe/Samara" , FOR_V2(0x0898C6, 0x035274) }, - { "Europe/San_Marino" , FOR_V2(0x089DD0, 0x035483) }, - { "Europe/Sarajevo" , FOR_V2(0x08A860, 0x03585C) }, - { "Europe/Simferopol" , FOR_V2(0x08B011, 0x035B36) }, - { "Europe/Skopje" , FOR_V2(0x08B5FE, 0x035D98) }, - { "Europe/Sofia" , FOR_V2(0x08BDAF, 0x036072) }, - { "Europe/Stockholm" , FOR_V2(0x08C60D, 0x03638B) }, - { "Europe/Tallinn" , FOR_V2(0x08CD97, 0x03664B) }, - { "Europe/Tirane" , FOR_V2(0x08D62E, 0x036991) }, - { "Europe/Tiraspol" , FOR_V2(0x08DE6C, 0x036C9C) }, - { "Europe/Ulyanovsk" , FOR_V2(0x08E805, 0x037040) }, - { "Europe/Uzhgorod" , FOR_V2(0x08ED24, 0x037252) }, - { "Europe/Vaduz" , FOR_V2(0x08F56F, 0x03757A) }, - { "Europe/Vatican" , FOR_V2(0x08FCF9, 0x03783A) }, - { "Europe/Vienna" , FOR_V2(0x090789, 0x037C13) }, - { "Europe/Vilnius" , FOR_V2(0x091052, 0x037F51) }, - { "Europe/Volgograd" , FOR_V2(0x0918F5, 0x0382A1) }, - { "Europe/Warsaw" , FOR_V2(0x091DAB, 0x038489) }, - { "Europe/Zagreb" , FOR_V2(0x092848, 0x03887B) }, - { "Europe/Zaporozhye" , FOR_V2(0x092FF9, 0x038B55) }, - { "Europe/Zurich" , FOR_V2(0x093872, 0x038EA7) }, - { "Factory" , FOR_V2(0x093FFC, 0x039167) }, - { "GB" , FOR_V2(0x09409C, 0x0391B5) }, - { "GB-Eire" , FOR_V2(0x094F0F, 0x0396FD) }, - { "GMT" , FOR_V2(0x095D82, 0x039C45) }, - { "GMT+0" , FOR_V2(0x095E0D, 0x039C89) }, - { "GMT-0" , FOR_V2(0x095E98, 0x039CCD) }, - { "GMT0" , FOR_V2(0x095F23, 0x039D11) }, - { "Greenwich" , FOR_V2(0x095FAE, 0x039D55) }, - { "Hongkong" , FOR_V2(0x096039, 0x039D99) }, - { "HST" , FOR_V2(0x0964EA, 0x039F68) }, - { "Iceland" , FOR_V2(0x096576, 0x039FAC) }, - { "Indian/Antananarivo" , FOR_V2(0x096A28, 0x03A17E) }, - { "Indian/Chagos" , FOR_V2(0x096B4F, 0x03A20A) }, - { "Indian/Christmas" , FOR_V2(0x096C24, 0x03A271) }, - { "Indian/Cocos" , FOR_V2(0x096CC5, 0x03A2B5) }, - { "Indian/Comoro" , FOR_V2(0x096D69, 0x03A2F9) }, - { "Indian/Kerguelen" , FOR_V2(0x096E90, 0x03A385) }, - { "Indian/Mahe" , FOR_V2(0x096F57, 0x03A3E4) }, - { "Indian/Maldives" , FOR_V2(0x09700E, 0x03A43E) }, - { "Indian/Mauritius" , FOR_V2(0x0970E6, 0x03A4A4) }, - { "Indian/Mayotte" , FOR_V2(0x0971EF, 0x03A51F) }, - { "Indian/Reunion" , FOR_V2(0x097316, 0x03A5AB) }, - { "Iran" , FOR_V2(0x0973CD, 0x03A605) }, - { "Israel" , FOR_V2(0x097A67, 0x03A880) }, - { "Jamaica" , FOR_V2(0x09834C, 0x03ABC8) }, - { "Japan" , FOR_V2(0x098553, 0x03AC9E) }, - { "Kwajalein" , FOR_V2(0x0986C2, 0x03AD35) }, - { "Libya" , FOR_V2(0x0987BB, 0x03ADA9) }, - { "MET" , FOR_V2(0x098A56, 0x03AEB7) }, - { "Mexico/BajaNorte" , FOR_V2(0x099298, 0x03B1C0) }, - { "Mexico/BajaSur" , FOR_V2(0x099BD8, 0x03B52E) }, - { "Mexico/General" , FOR_V2(0x09A200, 0x03B780) }, - { "MST" , FOR_V2(0x09A85E, 0x03B9E3) }, - { "MST7MDT" , FOR_V2(0x09A8E9, 0x03BA27) }, - { "Navajo" , FOR_V2(0x09B1EB, 0x03BD78) }, - { "NZ" , FOR_V2(0x09BB8C, 0x03C102) }, - { "NZ-CHAT" , FOR_V2(0x09C534, 0x03C491) }, - { "Pacific/Apia" , FOR_V2(0x09CD49, 0x03C786) }, - { "Pacific/Auckland" , FOR_V2(0x09D1A3, 0x03C92F) }, - { "Pacific/Bougainville" , FOR_V2(0x09DB63, 0x03CCD6) }, - { "Pacific/Chatham" , FOR_V2(0x09DC93, 0x03CD5F) }, - { "Pacific/Chuuk" , FOR_V2(0x09E4B7, 0x03D063) }, - { "Pacific/Easter" , FOR_V2(0x09E56B, 0x03D0B7) }, - { "Pacific/Efate" , FOR_V2(0x09EE35, 0x03D3FE) }, - { "Pacific/Enderbury" , FOR_V2(0x09F01F, 0x03D4C9) }, - { "Pacific/Fakaofo" , FOR_V2(0x09F120, 0x03D548) }, - { "Pacific/Fiji" , FOR_V2(0x09F1F1, 0x03D5AA) }, - { "Pacific/Funafuti" , FOR_V2(0x09F62E, 0x03D742) }, - { "Pacific/Galapagos" , FOR_V2(0x09F6D0, 0x03D786) }, - { "Pacific/Gambier" , FOR_V2(0x09F7C0, 0x03D803) }, - { "Pacific/Guadalcanal" , FOR_V2(0x09F888, 0x03D86D) }, - { "Pacific/Guam" , FOR_V2(0x09F940, 0x03D8C7) }, - { "Pacific/Honolulu" , FOR_V2(0x09FA2D, 0x03D92E) }, - { "Pacific/Johnston" , FOR_V2(0x09FB53, 0x03D9B6) }, - { "Pacific/Kiritimati" , FOR_V2(0x09FC81, 0x03DA46) }, - { "Pacific/Kosrae" , FOR_V2(0x09FD7F, 0x03DAC2) }, - { "Pacific/Kwajalein" , FOR_V2(0x09FE77, 0x03DB38) }, - { "Pacific/Majuro" , FOR_V2(0x09FF79, 0x03DBB5) }, - { "Pacific/Marquesas" , FOR_V2(0x0A0067, 0x03DC34) }, - { "Pacific/Midway" , FOR_V2(0x0A0134, 0x03DCA0) }, - { "Pacific/Nauru" , FOR_V2(0x0A025E, 0x03DD32) }, - { "Pacific/Niue" , FOR_V2(0x0A0368, 0x03DDAF) }, - { "Pacific/Norfolk" , FOR_V2(0x0A0456, 0x03DE1E) }, - { "Pacific/Noumea" , FOR_V2(0x0A0583, 0x03DEA8) }, - { "Pacific/Pago_Pago" , FOR_V2(0x0A06C9, 0x03DF3D) }, - { "Pacific/Palau" , FOR_V2(0x0A07E5, 0x03DFC1) }, - { "Pacific/Pitcairn" , FOR_V2(0x0A0886, 0x03E005) }, - { "Pacific/Pohnpei" , FOR_V2(0x0A095D, 0x03E06B) }, - { "Pacific/Ponape" , FOR_V2(0x0A0A10, 0x03E0BE) }, - { "Pacific/Port_Moresby" , FOR_V2(0x0A0AB5, 0x03E103) }, - { "Pacific/Rarotonga" , FOR_V2(0x0A0B8A, 0x03E164) }, - { "Pacific/Saipan" , FOR_V2(0x0A0DD4, 0x03E251) }, - { "Pacific/Samoa" , FOR_V2(0x0A0EC1, 0x03E2B8) }, - { "Pacific/Tahiti" , FOR_V2(0x0A0FDD, 0x03E33C) }, - { "Pacific/Tarawa" , FOR_V2(0x0A10A6, 0x03E3A6) }, - { "Pacific/Tongatapu" , FOR_V2(0x0A115A, 0x03E3FA) }, - { "Pacific/Truk" , FOR_V2(0x0A1543, 0x03E578) }, - { "Pacific/Wake" , FOR_V2(0x0A15E8, 0x03E5BD) }, - { "Pacific/Wallis" , FOR_V2(0x0A1698, 0x03E60D) }, - { "Pacific/Yap" , FOR_V2(0x0A173A, 0x03E651) }, - { "Poland" , FOR_V2(0x0A17DF, 0x03E696) }, - { "Portugal" , FOR_V2(0x0A227C, 0x03EA88) }, - { "PRC" , FOR_V2(0x0A3005, 0x03EF89) }, - { "PST8PDT" , FOR_V2(0x0A31AF, 0x03F03A) }, - { "ROC" , FOR_V2(0x0A3AB1, 0x03F38B) }, - { "ROK" , FOR_V2(0x0A3DDD, 0x03F4CD) }, - { "Singapore" , FOR_V2(0x0A4024, 0x03F5C5) }, - { "Turkey" , FOR_V2(0x0A41DC, 0x03F68D) }, - { "UCT" , FOR_V2(0x0A4A5E, 0x03F9C5) }, - { "Universal" , FOR_V2(0x0A4AE9, 0x03FA09) }, - { "US/Alaska" , FOR_V2(0x0A4B74, 0x03FA4D) }, - { "US/Aleutian" , FOR_V2(0x0A54D0, 0x03FDC7) }, - { "US/Arizona" , FOR_V2(0x0A5E19, 0x040138) }, - { "US/Central" , FOR_V2(0x0A5F86, 0x0401D7) }, - { "US/East-Indiana" , FOR_V2(0x0A6D93, 0x0406FB) }, - { "US/Eastern" , FOR_V2(0x0A742A, 0x040976) }, - { "US/Hawaii" , FOR_V2(0x0A820F, 0x040E86) }, - { "US/Indiana-Starke" , FOR_V2(0x0A832F, 0x040F08) }, - { "US/Michigan" , FOR_V2(0x0A8CC0, 0x041292) }, - { "US/Mountain" , FOR_V2(0x0A9574, 0x0415CE) }, - { "US/Pacific" , FOR_V2(0x0A9F15, 0x041958) }, - { "US/Pacific-New" , FOR_V2(0x0AAA3E, 0x041D6E) }, - { "US/Samoa" , FOR_V2(0x0AB567, 0x042184) }, - { "UTC" , FOR_V2(0x0AB683, 0x042208) }, - { "W-SU" , FOR_V2(0x0AB70E, 0x04224C) }, - { "WET" , FOR_V2(0x0ABD22, 0x0424B8) }, - { "Zulu" , FOR_V2(0x0AC47F, 0x04276B) }, + { "Asia/Aqtobe" , FOR_V2(0x042723, 0x019E64) }, + { "Asia/Ashgabat" , FOR_V2(0x042B53, 0x01A01A) }, + { "Asia/Ashkhabad" , FOR_V2(0x042DEA, 0x01A131) }, + { "Asia/Atyrau" , FOR_V2(0x043081, 0x01A248) }, + { "Asia/Baghdad" , FOR_V2(0x04349B, 0x01A3F9) }, + { "Asia/Bahrain" , FOR_V2(0x043883, 0x01A57F) }, + { "Asia/Baku" , FOR_V2(0x043960, 0x01A5EA) }, + { "Asia/Bangkok" , FOR_V2(0x043E61, 0x01A7E0) }, + { "Asia/Barnaul" , FOR_V2(0x043F39, 0x01A846) }, + { "Asia/Beirut" , FOR_V2(0x04443A, 0x01AA45) }, + { "Asia/Bishkek" , FOR_V2(0x044CC5, 0x01AD63) }, + { "Asia/Brunei" , FOR_V2(0x0450E6, 0x01AF09) }, + { "Asia/Calcutta" , FOR_V2(0x0451BB, 0x01AF70) }, + { "Asia/Chita" , FOR_V2(0x0452EA, 0x01AFFA) }, + { "Asia/Choibalsan" , FOR_V2(0x0457F3, 0x01B202) }, + { "Asia/Chongqing" , FOR_V2(0x045E42, 0x01B46E) }, + { "Asia/Chungking" , FOR_V2(0x045FEC, 0x01B51F) }, + { "Asia/Colombo" , FOR_V2(0x046196, 0x01B5D0) }, + { "Asia/Dacca" , FOR_V2(0x04633F, 0x01B68D) }, + { "Asia/Damascus" , FOR_V2(0x0464D1, 0x01B744) }, + { "Asia/Dhaka" , FOR_V2(0x046DED, 0x01BA99) }, + { "Asia/Dili" , FOR_V2(0x046F7F, 0x01BB50) }, + { "Asia/Dubai" , FOR_V2(0x0470C0, 0x01BBE7) }, + { "Asia/Dushanbe" , FOR_V2(0x047177, 0x01BC41) }, + { "Asia/Famagusta" , FOR_V2(0x0473F0, 0x01BD4B) }, + { "Asia/Gaza" , FOR_V2(0x0479B0, 0x01BF86) }, + { "Asia/Harbin" , FOR_V2(0x0482BD, 0x01C2E2) }, + { "Asia/Hebron" , FOR_V2(0x048467, 0x01C393) }, + { "Asia/Ho_Chi_Minh" , FOR_V2(0x048D8F, 0x01C6F8) }, + { "Asia/Hong_Kong" , FOR_V2(0x048F10, 0x01C7A7) }, + { "Asia/Hovd" , FOR_V2(0x0493C1, 0x01C976) }, + { "Asia/Irkutsk" , FOR_V2(0x0499E1, 0x01CBD9) }, + { "Asia/Istanbul" , FOR_V2(0x049F03, 0x01CDEE) }, + { "Asia/Jakarta" , FOR_V2(0x04A785, 0x01D126) }, + { "Asia/Jayapura" , FOR_V2(0x04A910, 0x01D1E0) }, + { "Asia/Jerusalem" , FOR_V2(0x04AA43, 0x01D28F) }, + { "Asia/Kabul" , FOR_V2(0x04B328, 0x01D5D7) }, + { "Asia/Kamchatka" , FOR_V2(0x04B3FB, 0x01D639) }, + { "Asia/Karachi" , FOR_V2(0x04B8C7, 0x01D825) }, + { "Asia/Kashgar" , FOR_V2(0x04BA66, 0x01D8DF) }, + { "Asia/Kathmandu" , FOR_V2(0x04BB1D, 0x01D939) }, + { "Asia/Katmandu" , FOR_V2(0x04BBFD, 0x01D9A4) }, + { "Asia/Khandyga" , FOR_V2(0x04BCDD, 0x01DA0F) }, + { "Asia/Kolkata" , FOR_V2(0x04C226, 0x01DC3A) }, + { "Asia/Krasnoyarsk" , FOR_V2(0x04C355, 0x01DCC4) }, + { "Asia/Kuala_Lumpur" , FOR_V2(0x04C855, 0x01DECC) }, + { "Asia/Kuching" , FOR_V2(0x04CA03, 0x01DF9B) }, + { "Asia/Kuwait" , FOR_V2(0x04CC24, 0x01E08D) }, + { "Asia/Macao" , FOR_V2(0x04CCDB, 0x01E0E7) }, + { "Asia/Macau" , FOR_V2(0x04D002, 0x01E227) }, + { "Asia/Magadan" , FOR_V2(0x04D329, 0x01E367) }, + { "Asia/Makassar" , FOR_V2(0x04D82F, 0x01E56B) }, + { "Asia/Manila" , FOR_V2(0x04D99C, 0x01E63E) }, + { "Asia/Muscat" , FOR_V2(0x04DB11, 0x01E6DC) }, + { "Asia/Nicosia" , FOR_V2(0x04DBC8, 0x01E736) }, + { "Asia/Novokuznetsk" , FOR_V2(0x04E3C7, 0x01EA36) }, + { "Asia/Novosibirsk" , FOR_V2(0x04E891, 0x01EC21) }, + { "Asia/Omsk" , FOR_V2(0x04ED98, 0x01EE26) }, + { "Asia/Oral" , FOR_V2(0x04F28C, 0x01F022) }, + { "Asia/Phnom_Penh" , FOR_V2(0x04F6AE, 0x01F1D2) }, + { "Asia/Pontianak" , FOR_V2(0x04F786, 0x01F238) }, + { "Asia/Pyongyang" , FOR_V2(0x04F91F, 0x01F300) }, + { "Asia/Qatar" , FOR_V2(0x04FA63, 0x01F397) }, + { "Asia/Qyzylorda" , FOR_V2(0x04FB40, 0x01F402) }, + { "Asia/Rangoon" , FOR_V2(0x04FF80, 0x01F5C8) }, + { "Asia/Riyadh" , FOR_V2(0x0500A9, 0x01F651) }, + { "Asia/Saigon" , FOR_V2(0x050160, 0x01F6AB) }, + { "Asia/Sakhalin" , FOR_V2(0x0502E1, 0x01F75A) }, + { "Asia/Samarkand" , FOR_V2(0x0507D7, 0x01F95A) }, + { "Asia/Seoul" , FOR_V2(0x050A5F, 0x01FA72) }, + { "Asia/Shanghai" , FOR_V2(0x050CA6, 0x01FB6A) }, + { "Asia/Singapore" , FOR_V2(0x050E5C, 0x01FC27) }, + { "Asia/Srednekolymsk" , FOR_V2(0x051014, 0x01FCEF) }, + { "Asia/Taipei" , FOR_V2(0x05151E, 0x01FF00) }, + { "Asia/Tashkent" , FOR_V2(0x05184A, 0x020042) }, + { "Asia/Tbilisi" , FOR_V2(0x051AE2, 0x020162) }, + { "Asia/Tehran" , FOR_V2(0x051F26, 0x020315) }, + { "Asia/Tel_Aviv" , FOR_V2(0x0525C0, 0x020590) }, + { "Asia/Thimbu" , FOR_V2(0x052EA5, 0x0208D8) }, + { "Asia/Thimphu" , FOR_V2(0x052F82, 0x020943) }, + { "Asia/Tokyo" , FOR_V2(0x05305F, 0x0209AE) }, + { "Asia/Tomsk" , FOR_V2(0x0531CE, 0x020A45) }, + { "Asia/Ujung_Pandang" , FOR_V2(0x0536CF, 0x020C44) }, + { "Asia/Ulaanbaatar" , FOR_V2(0x0537F3, 0x020CCE) }, + { "Asia/Ulan_Bator" , FOR_V2(0x053DFD, 0x020F1B) }, + { "Asia/Urumqi" , FOR_V2(0x0543F2, 0x021153) }, + { "Asia/Ust-Nera" , FOR_V2(0x0544B6, 0x0211BA) }, + { "Asia/Vientiane" , FOR_V2(0x0549E0, 0x0213D2) }, + { "Asia/Vladivostok" , FOR_V2(0x054AB8, 0x021438) }, + { "Asia/Yakutsk" , FOR_V2(0x054FB3, 0x02163A) }, + { "Asia/Yangon" , FOR_V2(0x0554AD, 0x02183C) }, + { "Asia/Yekaterinburg" , FOR_V2(0x0555D6, 0x0218C5) }, + { "Asia/Yerevan" , FOR_V2(0x055AF1, 0x021AD3) }, + { "Atlantic/Azores" , FOR_V2(0x055FAC, 0x021CB0) }, + { "Atlantic/Bermuda" , FOR_V2(0x056D5E, 0x0221C4) }, + { "Atlantic/Canary" , FOR_V2(0x05753E, 0x0224AA) }, + { "Atlantic/Cape_Verde" , FOR_V2(0x057CD1, 0x022785) }, + { "Atlantic/Faeroe" , FOR_V2(0x057DDB, 0x022803) }, + { "Atlantic/Faroe" , FOR_V2(0x05850C, 0x022AAC) }, + { "Atlantic/Jan_Mayen" , FOR_V2(0x058C3D, 0x022D55) }, + { "Atlantic/Madeira" , FOR_V2(0x059514, 0x023098) }, + { "Atlantic/Reykjavik" , FOR_V2(0x05A2C5, 0x0235B2) }, + { "Atlantic/South_Georgia" , FOR_V2(0x05A777, 0x023784) }, + { "Atlantic/St_Helena" , FOR_V2(0x05A817, 0x0237C8) }, + { "Atlantic/Stanley" , FOR_V2(0x05A8CD, 0x023822) }, + { "Australia/ACT" , FOR_V2(0x05ADB7, 0x023A09) }, + { "Australia/Adelaide" , FOR_V2(0x05B672, 0x023D3D) }, + { "Australia/Brisbane" , FOR_V2(0x05BF4B, 0x02407C) }, + { "Australia/Broken_Hill" , FOR_V2(0x05C132, 0x024156) }, + { "Australia/Canberra" , FOR_V2(0x05CA3C, 0x0244A7) }, + { "Australia/Currie" , FOR_V2(0x05D2F7, 0x0247DB) }, + { "Australia/Darwin" , FOR_V2(0x05DBC8, 0x024B25) }, + { "Australia/Eucla" , FOR_V2(0x05DD29, 0x024BBE) }, + { "Australia/Hobart" , FOR_V2(0x05DF35, 0x024CA6) }, + { "Australia/LHI" , FOR_V2(0x05E875, 0x025017) }, + { "Australia/Lindeman" , FOR_V2(0x05EFC4, 0x0252C9) }, + { "Australia/Lord_Howe" , FOR_V2(0x05F1F9, 0x0253C4) }, + { "Australia/Melbourne" , FOR_V2(0x05F958, 0x025686) }, + { "Australia/North" , FOR_V2(0x06021B, 0x0259C2) }, + { "Australia/NSW" , FOR_V2(0x06036A, 0x025A49) }, + { "Australia/Perth" , FOR_V2(0x060C25, 0x025D7D) }, + { "Australia/Queensland" , FOR_V2(0x060E2E, 0x025E68) }, + { "Australia/South" , FOR_V2(0x060FFE, 0x025F2B) }, + { "Australia/Sydney" , FOR_V2(0x0618C8, 0x02625B) }, + { "Australia/Tasmania" , FOR_V2(0x06219F, 0x0265AB) }, + { "Australia/Victoria" , FOR_V2(0x062ACA, 0x026907) }, + { "Australia/West" , FOR_V2(0x063385, 0x026C3B) }, + { "Australia/Yancowinna" , FOR_V2(0x063570, 0x026D08) }, + { "Brazil/Acre" , FOR_V2(0x063E5E, 0x02703D) }, + { "Brazil/DeNoronha" , FOR_V2(0x0640FA, 0x02714E) }, + { "Brazil/East" , FOR_V2(0x0643DE, 0x027273) }, + { "Brazil/West" , FOR_V2(0x064BC9, 0x027555) }, + { "Canada/Atlantic" , FOR_V2(0x064E3D, 0x027652) }, + { "Canada/Central" , FOR_V2(0x065BB7, 0x027B3F) }, + { "Canada/East-Saskatchewan" , FOR_V2(0x06670E, 0x027F6A) }, + { "Canada/Eastern" , FOR_V2(0x066AFC, 0x0280F8) }, + { "Canada/Mountain" , FOR_V2(0x0678B7, 0x0285F9) }, + { "Canada/Newfoundland" , FOR_V2(0x068225, 0x028974) }, + { "Canada/Pacific" , FOR_V2(0x069081, 0x028EB8) }, + { "Canada/Saskatchewan" , FOR_V2(0x069BE2, 0x0292E2) }, + { "Canada/Yukon" , FOR_V2(0x069FD0, 0x029470) }, + { "CET" , FOR_V2(0x06A809, 0x029784) }, + { "Chile/Continental" , FOR_V2(0x06B04B, 0x029A8D) }, + { "Chile/EasterIsland" , FOR_V2(0x06BA2A, 0x029E31) }, + { "CST6CDT" , FOR_V2(0x06C2E7, 0x02A16B) }, + { "Cuba" , FOR_V2(0x06CBE9, 0x02A4BC) }, + { "EET" , FOR_V2(0x06D57A, 0x02A840) }, + { "Egypt" , FOR_V2(0x06DCDA, 0x02AAF3) }, + { "Eire" , FOR_V2(0x06E49A, 0x02ADD3) }, + { "EST" , FOR_V2(0x06F28D, 0x02B2F5) }, + { "EST5EDT" , FOR_V2(0x06F318, 0x02B339) }, + { "Etc/GMT" , FOR_V2(0x06FC1A, 0x02B68A) }, + { "Etc/GMT+0" , FOR_V2(0x06FCA5, 0x02B6CE) }, + { "Etc/GMT+1" , FOR_V2(0x06FD30, 0x02B712) }, + { "Etc/GMT+10" , FOR_V2(0x06FDD0, 0x02B760) }, + { "Etc/GMT+11" , FOR_V2(0x06FE71, 0x02B7AE) }, + { "Etc/GMT+12" , FOR_V2(0x06FF12, 0x02B7FC) }, + { "Etc/GMT+2" , FOR_V2(0x06FFB3, 0x02B84A) }, + { "Etc/GMT+3" , FOR_V2(0x070053, 0x02B898) }, + { "Etc/GMT+4" , FOR_V2(0x0700F3, 0x02B8E6) }, + { "Etc/GMT+5" , FOR_V2(0x070193, 0x02B934) }, + { "Etc/GMT+6" , FOR_V2(0x070233, 0x02B982) }, + { "Etc/GMT+7" , FOR_V2(0x0702D3, 0x02B9D0) }, + { "Etc/GMT+8" , FOR_V2(0x070373, 0x02BA1E) }, + { "Etc/GMT+9" , FOR_V2(0x070413, 0x02BA6C) }, + { "Etc/GMT-0" , FOR_V2(0x0704B3, 0x02BABA) }, + { "Etc/GMT-1" , FOR_V2(0x07053E, 0x02BAFE) }, + { "Etc/GMT-10" , FOR_V2(0x0705DF, 0x02BB4C) }, + { "Etc/GMT-11" , FOR_V2(0x070681, 0x02BB9A) }, + { "Etc/GMT-12" , FOR_V2(0x070723, 0x02BBE8) }, + { "Etc/GMT-13" , FOR_V2(0x0707C5, 0x02BC36) }, + { "Etc/GMT-14" , FOR_V2(0x070867, 0x02BC84) }, + { "Etc/GMT-2" , FOR_V2(0x070909, 0x02BCD2) }, + { "Etc/GMT-3" , FOR_V2(0x0709AA, 0x02BD20) }, + { "Etc/GMT-4" , FOR_V2(0x070A4B, 0x02BD6E) }, + { "Etc/GMT-5" , FOR_V2(0x070AEC, 0x02BDBC) }, + { "Etc/GMT-6" , FOR_V2(0x070B8D, 0x02BE0A) }, + { "Etc/GMT-7" , FOR_V2(0x070C2E, 0x02BE58) }, + { "Etc/GMT-8" , FOR_V2(0x070CCF, 0x02BEA6) }, + { "Etc/GMT-9" , FOR_V2(0x070D70, 0x02BEF4) }, + { "Etc/GMT0" , FOR_V2(0x070E11, 0x02BF42) }, + { "Etc/Greenwich" , FOR_V2(0x070E9C, 0x02BF86) }, + { "Etc/UCT" , FOR_V2(0x070F27, 0x02BFCA) }, + { "Etc/Universal" , FOR_V2(0x070FB2, 0x02C00E) }, + { "Etc/UTC" , FOR_V2(0x07103D, 0x02C052) }, + { "Etc/Zulu" , FOR_V2(0x0710C8, 0x02C096) }, + { "Europe/Amsterdam" , FOR_V2(0x071153, 0x02C0DA) }, + { "Europe/Andorra" , FOR_V2(0x071CDE, 0x02C529) }, + { "Europe/Astrakhan" , FOR_V2(0x0723C1, 0x02C7B6) }, + { "Europe/Athens" , FOR_V2(0x07288C, 0x02C9A2) }, + { "Europe/Belfast" , FOR_V2(0x073177, 0x02CCF6) }, + { "Europe/Belgrade" , FOR_V2(0x073FEA, 0x02D23E) }, + { "Europe/Berlin" , FOR_V2(0x07479B, 0x02D518) }, + { "Europe/Bratislava" , FOR_V2(0x0750DA, 0x02D893) }, + { "Europe/Brussels" , FOR_V2(0x0759C6, 0x02DBD6) }, + { "Europe/Bucharest" , FOR_V2(0x07656C, 0x02E01E) }, + { "Europe/Budapest" , FOR_V2(0x076E25, 0x02E359) }, + { "Europe/Busingen" , FOR_V2(0x077796, 0x02E6D3) }, + { "Europe/Chisinau" , FOR_V2(0x077F28, 0x02E99B) }, + { "Europe/Copenhagen" , FOR_V2(0x0788C1, 0x02ED3F) }, + { "Europe/Dublin" , FOR_V2(0x07913D, 0x02F05A) }, + { "Europe/Gibraltar" , FOR_V2(0x079F30, 0x02F57C) }, + { "Europe/Guernsey" , FOR_V2(0x07AB31, 0x02F9E4) }, + { "Europe/Helsinki" , FOR_V2(0x07B9A4, 0x02FF2C) }, + { "Europe/Isle_of_Man" , FOR_V2(0x07C125, 0x0301F3) }, + { "Europe/Istanbul" , FOR_V2(0x07CF98, 0x03073B) }, + { "Europe/Jersey" , FOR_V2(0x07D81A, 0x030A73) }, + { "Europe/Kaliningrad" , FOR_V2(0x07E68D, 0x030FBB) }, + { "Europe/Kiev" , FOR_V2(0x07EC9B, 0x03122C) }, + { "Europe/Kirov" , FOR_V2(0x07F4EC, 0x03155F) }, + { "Europe/Lisbon" , FOR_V2(0x07F995, 0x03173A) }, + { "Europe/Ljubljana" , FOR_V2(0x080731, 0x031C4E) }, + { "Europe/London" , FOR_V2(0x080EE2, 0x031F28) }, + { "Europe/Luxembourg" , FOR_V2(0x081D55, 0x032470) }, + { "Europe/Madrid" , FOR_V2(0x0828FF, 0x0328CB) }, + { "Europe/Malta" , FOR_V2(0x083356, 0x032CAA) }, + { "Europe/Mariehamn" , FOR_V2(0x083DA7, 0x033074) }, + { "Europe/Minsk" , FOR_V2(0x084528, 0x03333B) }, + { "Europe/Monaco" , FOR_V2(0x084A8E, 0x03355F) }, + { "Europe/Moscow" , FOR_V2(0x085623, 0x0339AB) }, + { "Europe/Nicosia" , FOR_V2(0x085C4B, 0x033C2B) }, + { "Europe/Oslo" , FOR_V2(0x086437, 0x033F18) }, + { "Europe/Paris" , FOR_V2(0x086D0E, 0x03425B) }, + { "Europe/Podgorica" , FOR_V2(0x0878B5, 0x0346B2) }, + { "Europe/Prague" , FOR_V2(0x088066, 0x03498C) }, + { "Europe/Riga" , FOR_V2(0x088952, 0x034CCF) }, + { "Europe/Rome" , FOR_V2(0x089219, 0x035025) }, + { "Europe/Samara" , FOR_V2(0x089CA9, 0x0353FE) }, + { "Europe/San_Marino" , FOR_V2(0x08A1B3, 0x03560D) }, + { "Europe/Sarajevo" , FOR_V2(0x08AC43, 0x0359E6) }, + { "Europe/Saratov" , FOR_V2(0x08B3F4, 0x035CC0) }, + { "Europe/Simferopol" , FOR_V2(0x08B8BD, 0x035EAA) }, + { "Europe/Skopje" , FOR_V2(0x08BEAA, 0x03610C) }, + { "Europe/Sofia" , FOR_V2(0x08C65B, 0x0363E6) }, + { "Europe/Stockholm" , FOR_V2(0x08CEB9, 0x0366FF) }, + { "Europe/Tallinn" , FOR_V2(0x08D643, 0x0369BF) }, + { "Europe/Tirane" , FOR_V2(0x08DEDA, 0x036D05) }, + { "Europe/Tiraspol" , FOR_V2(0x08E718, 0x037010) }, + { "Europe/Ulyanovsk" , FOR_V2(0x08F0B1, 0x0373B4) }, + { "Europe/Uzhgorod" , FOR_V2(0x08F5D0, 0x0375C6) }, + { "Europe/Vaduz" , FOR_V2(0x08FE1B, 0x0378EE) }, + { "Europe/Vatican" , FOR_V2(0x0905A5, 0x037BAE) }, + { "Europe/Vienna" , FOR_V2(0x091035, 0x037F87) }, + { "Europe/Vilnius" , FOR_V2(0x0918FE, 0x0382C5) }, + { "Europe/Volgograd" , FOR_V2(0x0921A1, 0x038615) }, + { "Europe/Warsaw" , FOR_V2(0x09264E, 0x0387F4) }, + { "Europe/Zagreb" , FOR_V2(0x0930EB, 0x038BE6) }, + { "Europe/Zaporozhye" , FOR_V2(0x09389C, 0x038EC0) }, + { "Europe/Zurich" , FOR_V2(0x094115, 0x039212) }, + { "Factory" , FOR_V2(0x09489F, 0x0394D2) }, + { "GB" , FOR_V2(0x09493F, 0x039520) }, + { "GB-Eire" , FOR_V2(0x0957B2, 0x039A68) }, + { "GMT" , FOR_V2(0x096625, 0x039FB0) }, + { "GMT+0" , FOR_V2(0x0966B0, 0x039FF4) }, + { "GMT-0" , FOR_V2(0x09673B, 0x03A038) }, + { "GMT0" , FOR_V2(0x0967C6, 0x03A07C) }, + { "Greenwich" , FOR_V2(0x096851, 0x03A0C0) }, + { "Hongkong" , FOR_V2(0x0968DC, 0x03A104) }, + { "HST" , FOR_V2(0x096D8D, 0x03A2D3) }, + { "Iceland" , FOR_V2(0x096E19, 0x03A317) }, + { "Indian/Antananarivo" , FOR_V2(0x0972CB, 0x03A4E9) }, + { "Indian/Chagos" , FOR_V2(0x0973F2, 0x03A575) }, + { "Indian/Christmas" , FOR_V2(0x0974C7, 0x03A5DC) }, + { "Indian/Cocos" , FOR_V2(0x097568, 0x03A620) }, + { "Indian/Comoro" , FOR_V2(0x09760C, 0x03A664) }, + { "Indian/Kerguelen" , FOR_V2(0x097733, 0x03A6F0) }, + { "Indian/Mahe" , FOR_V2(0x0977FA, 0x03A74F) }, + { "Indian/Maldives" , FOR_V2(0x0978B1, 0x03A7A9) }, + { "Indian/Mauritius" , FOR_V2(0x097989, 0x03A80F) }, + { "Indian/Mayotte" , FOR_V2(0x097A92, 0x03A88A) }, + { "Indian/Reunion" , FOR_V2(0x097BB9, 0x03A916) }, + { "Iran" , FOR_V2(0x097C70, 0x03A970) }, + { "Israel" , FOR_V2(0x09830A, 0x03ABEB) }, + { "Jamaica" , FOR_V2(0x098BEF, 0x03AF33) }, + { "Japan" , FOR_V2(0x098DF6, 0x03B009) }, + { "Kwajalein" , FOR_V2(0x098F65, 0x03B0A0) }, + { "Libya" , FOR_V2(0x09905E, 0x03B114) }, + { "MET" , FOR_V2(0x0992F9, 0x03B222) }, + { "Mexico/BajaNorte" , FOR_V2(0x099B3B, 0x03B52B) }, + { "Mexico/BajaSur" , FOR_V2(0x09A47B, 0x03B899) }, + { "Mexico/General" , FOR_V2(0x09AAA3, 0x03BAEB) }, + { "MST" , FOR_V2(0x09B101, 0x03BD4E) }, + { "MST7MDT" , FOR_V2(0x09B18C, 0x03BD92) }, + { "Navajo" , FOR_V2(0x09BA8E, 0x03C0E3) }, + { "NZ" , FOR_V2(0x09C42F, 0x03C46D) }, + { "NZ-CHAT" , FOR_V2(0x09CDD7, 0x03C7FC) }, + { "Pacific/Apia" , FOR_V2(0x09D5EC, 0x03CAF1) }, + { "Pacific/Auckland" , FOR_V2(0x09DA46, 0x03CC9A) }, + { "Pacific/Bougainville" , FOR_V2(0x09E406, 0x03D041) }, + { "Pacific/Chatham" , FOR_V2(0x09E536, 0x03D0CA) }, + { "Pacific/Chuuk" , FOR_V2(0x09ED5A, 0x03D3CE) }, + { "Pacific/Easter" , FOR_V2(0x09EE0E, 0x03D422) }, + { "Pacific/Efate" , FOR_V2(0x09F6D8, 0x03D769) }, + { "Pacific/Enderbury" , FOR_V2(0x09F8C2, 0x03D834) }, + { "Pacific/Fakaofo" , FOR_V2(0x09F9C3, 0x03D8B3) }, + { "Pacific/Fiji" , FOR_V2(0x09FA94, 0x03D915) }, + { "Pacific/Funafuti" , FOR_V2(0x09FED1, 0x03DAAD) }, + { "Pacific/Galapagos" , FOR_V2(0x09FF73, 0x03DAF1) }, + { "Pacific/Gambier" , FOR_V2(0x0A0063, 0x03DB6E) }, + { "Pacific/Guadalcanal" , FOR_V2(0x0A012B, 0x03DBD8) }, + { "Pacific/Guam" , FOR_V2(0x0A01E3, 0x03DC32) }, + { "Pacific/Honolulu" , FOR_V2(0x0A02D0, 0x03DC99) }, + { "Pacific/Johnston" , FOR_V2(0x0A03F6, 0x03DD21) }, + { "Pacific/Kiritimati" , FOR_V2(0x0A0524, 0x03DDB1) }, + { "Pacific/Kosrae" , FOR_V2(0x0A0622, 0x03DE2D) }, + { "Pacific/Kwajalein" , FOR_V2(0x0A071A, 0x03DEA3) }, + { "Pacific/Majuro" , FOR_V2(0x0A081C, 0x03DF20) }, + { "Pacific/Marquesas" , FOR_V2(0x0A090A, 0x03DF9F) }, + { "Pacific/Midway" , FOR_V2(0x0A09D7, 0x03E00B) }, + { "Pacific/Nauru" , FOR_V2(0x0A0B01, 0x03E09D) }, + { "Pacific/Niue" , FOR_V2(0x0A0C0B, 0x03E11A) }, + { "Pacific/Norfolk" , FOR_V2(0x0A0CF9, 0x03E189) }, + { "Pacific/Noumea" , FOR_V2(0x0A0E26, 0x03E213) }, + { "Pacific/Pago_Pago" , FOR_V2(0x0A0F6C, 0x03E2A8) }, + { "Pacific/Palau" , FOR_V2(0x0A1088, 0x03E32C) }, + { "Pacific/Pitcairn" , FOR_V2(0x0A1129, 0x03E370) }, + { "Pacific/Pohnpei" , FOR_V2(0x0A1200, 0x03E3D6) }, + { "Pacific/Ponape" , FOR_V2(0x0A12B3, 0x03E429) }, + { "Pacific/Port_Moresby" , FOR_V2(0x0A1358, 0x03E46E) }, + { "Pacific/Rarotonga" , FOR_V2(0x0A142D, 0x03E4CF) }, + { "Pacific/Saipan" , FOR_V2(0x0A1677, 0x03E5BC) }, + { "Pacific/Samoa" , FOR_V2(0x0A1764, 0x03E623) }, + { "Pacific/Tahiti" , FOR_V2(0x0A1880, 0x03E6A7) }, + { "Pacific/Tarawa" , FOR_V2(0x0A1949, 0x03E711) }, + { "Pacific/Tongatapu" , FOR_V2(0x0A19FD, 0x03E765) }, + { "Pacific/Truk" , FOR_V2(0x0A1DE6, 0x03E8E3) }, + { "Pacific/Wake" , FOR_V2(0x0A1E8B, 0x03E928) }, + { "Pacific/Wallis" , FOR_V2(0x0A1F3B, 0x03E978) }, + { "Pacific/Yap" , FOR_V2(0x0A1FDD, 0x03E9BC) }, + { "Poland" , FOR_V2(0x0A2082, 0x03EA01) }, + { "Portugal" , FOR_V2(0x0A2B1F, 0x03EDF3) }, + { "PRC" , FOR_V2(0x0A38A8, 0x03F2F4) }, + { "PST8PDT" , FOR_V2(0x0A3A52, 0x03F3A5) }, + { "ROC" , FOR_V2(0x0A4354, 0x03F6F6) }, + { "ROK" , FOR_V2(0x0A4680, 0x03F838) }, + { "Singapore" , FOR_V2(0x0A48C7, 0x03F930) }, + { "Turkey" , FOR_V2(0x0A4A7F, 0x03F9F8) }, + { "UCT" , FOR_V2(0x0A5301, 0x03FD30) }, + { "Universal" , FOR_V2(0x0A538C, 0x03FD74) }, + { "US/Alaska" , FOR_V2(0x0A5417, 0x03FDB8) }, + { "US/Aleutian" , FOR_V2(0x0A5D73, 0x040132) }, + { "US/Arizona" , FOR_V2(0x0A66BC, 0x0404A3) }, + { "US/Central" , FOR_V2(0x0A6829, 0x040542) }, + { "US/East-Indiana" , FOR_V2(0x0A7636, 0x040A66) }, + { "US/Eastern" , FOR_V2(0x0A7CCD, 0x040CE1) }, + { "US/Hawaii" , FOR_V2(0x0A8AB2, 0x0411F1) }, + { "US/Indiana-Starke" , FOR_V2(0x0A8BD2, 0x041273) }, + { "US/Michigan" , FOR_V2(0x0A9563, 0x0415FD) }, + { "US/Mountain" , FOR_V2(0x0A9E17, 0x041939) }, + { "US/Pacific" , FOR_V2(0x0AA7B8, 0x041CC3) }, + { "US/Pacific-New" , FOR_V2(0x0AB2E1, 0x0420D9) }, + { "US/Samoa" , FOR_V2(0x0ABE0A, 0x0424EF) }, + { "UTC" , FOR_V2(0x0ABF26, 0x042573) }, + { "W-SU" , FOR_V2(0x0ABFB1, 0x0425B7) }, + { "WET" , FOR_V2(0x0AC5C5, 0x042823) }, + { "Zulu" , FOR_V2(0x0ACD22, 0x042AD6) }, }; #ifdef TIMELIB_SUPPORTS_V2DATA -const unsigned char timelib_timezone_db_data_builtin[705802] = { +const unsigned char timelib_timezone_db_data_builtin[708013] = { #else -const unsigned char timelib_timezone_db_data_builtin[272303] = { +const unsigned char timelib_timezone_db_data_builtin[273178] = { #endif @@ -18848,10 +18850,9 @@ const unsigned char timelib_timezone_db_data_builtin[272303] = { 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x3C, 0x2B, 0x30, 0x35, 0x3E, 0x2D, 0x35, 0x0A, #endif -0x00, 0xCD, 0x41, 0x92, 0x01, 0x5F, 0x5B, 0xEA, 0x00, 0x00, 0x00, 0x2C, 0x41, 0x74, 0x79, 0x72, -0x61, 0x75, 0x2F, 0x41, 0x74, 0x69, 0x72, 0x61, 0x75, 0x2F, 0x47, 0x75, 0x72, 0x27, 0x79, 0x65, -0x76, 0x2C, 0x20, 0x4D, 0x61, 0x6E, 0x67, 0x67, 0x68, 0x79, 0x73, 0x74, 0x61, 0x75, 0x2F, 0x4D, -0x61, 0x6E, 0x6B, 0x69, 0x73, 0x74, 0x61, 0x75, +0x00, 0xCD, 0x41, 0x92, 0x01, 0x5F, 0x5B, 0xEA, 0x00, 0x00, 0x00, 0x15, 0x4D, 0x61, 0x6E, 0x67, +0x67, 0x68, 0x79, 0x73, 0x74, 0x61, 0x75, 0x2F, 0x4D, 0x61, 0x6E, 0x6B, 0x69, 0x73, 0x74, 0x61, +0x75, /* Asia/Aqtobe */ 0x50, 0x48, 0x50, 0x32, 0x01, 0x4B, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -19017,6 +19018,77 @@ const unsigned char timelib_timezone_db_data_builtin[272303] = { #endif 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, 0x00, 0x00, 0x00, 0x00, +/* Asia/Atyrau */ +0x50, 0x48, 0x50, 0x32, 0x01, 0x4B, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x10, 0x80, 0x00, 0x00, 0x00, +0xAA, 0x19, 0x93, 0x50, 0xB5, 0xA3, 0xFD, 0x40, 0x16, 0x18, 0xCE, 0x30, 0x17, 0x08, 0xB1, 0x20, +0x17, 0xF9, 0xF3, 0xA0, 0x18, 0xE9, 0xF2, 0xB0, 0x19, 0xDB, 0x27, 0x20, 0x1A, 0xCC, 0x77, 0xB0, +0x1B, 0xBC, 0x84, 0xD0, 0x1C, 0xAC, 0x75, 0xD0, 0x1D, 0x9C, 0x66, 0xD0, 0x1E, 0x8C, 0x57, 0xD0, +0x1F, 0x7C, 0x48, 0xD0, 0x20, 0x6C, 0x39, 0xD0, 0x21, 0x5C, 0x2A, 0xD0, 0x22, 0x4C, 0x1B, 0xD0, +0x23, 0x3C, 0x0C, 0xD0, 0x24, 0x2B, 0xFD, 0xD0, 0x25, 0x1B, 0xEE, 0xD0, 0x26, 0x0B, 0xDF, 0xD0, +0x27, 0x05, 0x0B, 0x50, 0x27, 0xF4, 0xFC, 0x50, 0x28, 0xE4, 0xFB, 0x60, 0x29, 0x78, 0xA3, 0x60, +0x29, 0xD4, 0xDE, 0x50, 0x2A, 0xC4, 0xCF, 0x50, 0x2B, 0xB4, 0xC0, 0x50, 0x2C, 0xA4, 0xB1, 0x50, +0x2D, 0x94, 0xA2, 0x50, 0x2E, 0x84, 0x93, 0x50, 0x2F, 0x74, 0x84, 0x50, 0x30, 0x64, 0x75, 0x50, +0x31, 0x5D, 0xA0, 0xD0, 0x32, 0x72, 0x7B, 0xD0, 0x33, 0x3D, 0x82, 0xD0, 0x34, 0x52, 0x5D, 0xD0, +0x35, 0x1D, 0x64, 0xD0, 0x36, 0x32, 0x3F, 0xD0, 0x36, 0xFD, 0x46, 0xD0, 0x38, 0x1B, 0x6A, 0x60, +0x38, 0xDD, 0x36, 0xE0, 0x39, 0xFB, 0x4C, 0x60, 0x3A, 0xBD, 0x18, 0xE0, 0x3B, 0xDB, 0x2E, 0x60, +0x3C, 0xA6, 0x35, 0x60, 0x3D, 0xBB, 0x10, 0x60, 0x3E, 0x86, 0x17, 0x60, 0x3F, 0x9A, 0xF2, 0x60, +0x40, 0x65, 0xF9, 0x60, 0x41, 0x84, 0x0E, 0xE0, 0x7F, 0xFF, 0xFF, 0xFF, 0x00, 0x01, 0x02, 0x03, +0x04, 0x02, 0x04, 0x02, 0x04, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, +0x06, 0x05, 0x07, 0x08, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, +0x05, 0x06, 0x05, 0x07, 0x08, 0x07, 0x08, 0x07, 0x08, 0x07, 0x08, 0x07, 0x08, 0x07, 0x05, 0x05, +0x00, 0x00, 0x30, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x38, 0x40, 0x00, 0x04, 0x00, 0x00, 0x46, 0x50, +0x00, 0x08, 0x00, 0x00, 0x54, 0x60, 0x00, 0x0C, 0x00, 0x00, 0x54, 0x60, 0x01, 0x0C, 0x00, 0x00, +0x46, 0x50, 0x00, 0x08, 0x00, 0x00, 0x54, 0x60, 0x01, 0x0C, 0x00, 0x00, 0x46, 0x50, 0x01, 0x08, +0x00, 0x00, 0x38, 0x40, 0x00, 0x04, 0x00, 0x00, 0x46, 0x50, 0x00, 0x08, 0x4C, 0x4D, 0x54, 0x00, +0x2B, 0x30, 0x34, 0x00, 0x2B, 0x30, 0x35, 0x00, 0x2B, 0x30, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +#ifdef TIMELIB_SUPPORTS_V2DATA +0x54, 0x5A, 0x69, 0x66, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x10, 0xF8, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xAA, 0x19, 0x93, 0x50, 0xFF, 0xFF, 0xFF, 0xFF, +0xB5, 0xA3, 0xFD, 0x40, 0x00, 0x00, 0x00, 0x00, 0x16, 0x18, 0xCE, 0x30, 0x00, 0x00, 0x00, 0x00, +0x17, 0x08, 0xB1, 0x20, 0x00, 0x00, 0x00, 0x00, 0x17, 0xF9, 0xF3, 0xA0, 0x00, 0x00, 0x00, 0x00, +0x18, 0xE9, 0xF2, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x19, 0xDB, 0x27, 0x20, 0x00, 0x00, 0x00, 0x00, +0x1A, 0xCC, 0x77, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x1B, 0xBC, 0x84, 0xD0, 0x00, 0x00, 0x00, 0x00, +0x1C, 0xAC, 0x75, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x9C, 0x66, 0xD0, 0x00, 0x00, 0x00, 0x00, +0x1E, 0x8C, 0x57, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x7C, 0x48, 0xD0, 0x00, 0x00, 0x00, 0x00, +0x20, 0x6C, 0x39, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x21, 0x5C, 0x2A, 0xD0, 0x00, 0x00, 0x00, 0x00, +0x22, 0x4C, 0x1B, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x23, 0x3C, 0x0C, 0xD0, 0x00, 0x00, 0x00, 0x00, +0x24, 0x2B, 0xFD, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x25, 0x1B, 0xEE, 0xD0, 0x00, 0x00, 0x00, 0x00, +0x26, 0x0B, 0xDF, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x27, 0x05, 0x0B, 0x50, 0x00, 0x00, 0x00, 0x00, +0x27, 0xF4, 0xFC, 0x50, 0x00, 0x00, 0x00, 0x00, 0x28, 0xE4, 0xFB, 0x60, 0x00, 0x00, 0x00, 0x00, +0x29, 0x78, 0xA3, 0x60, 0x00, 0x00, 0x00, 0x00, 0x29, 0xD4, 0xDE, 0x50, 0x00, 0x00, 0x00, 0x00, +0x2A, 0xC4, 0xCF, 0x50, 0x00, 0x00, 0x00, 0x00, 0x2B, 0xB4, 0xC0, 0x50, 0x00, 0x00, 0x00, 0x00, +0x2C, 0xA4, 0xB1, 0x50, 0x00, 0x00, 0x00, 0x00, 0x2D, 0x94, 0xA2, 0x50, 0x00, 0x00, 0x00, 0x00, +0x2E, 0x84, 0x93, 0x50, 0x00, 0x00, 0x00, 0x00, 0x2F, 0x74, 0x84, 0x50, 0x00, 0x00, 0x00, 0x00, +0x30, 0x64, 0x75, 0x50, 0x00, 0x00, 0x00, 0x00, 0x31, 0x5D, 0xA0, 0xD0, 0x00, 0x00, 0x00, 0x00, +0x32, 0x72, 0x7B, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x33, 0x3D, 0x82, 0xD0, 0x00, 0x00, 0x00, 0x00, +0x34, 0x52, 0x5D, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x35, 0x1D, 0x64, 0xD0, 0x00, 0x00, 0x00, 0x00, +0x36, 0x32, 0x3F, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x36, 0xFD, 0x46, 0xD0, 0x00, 0x00, 0x00, 0x00, +0x38, 0x1B, 0x6A, 0x60, 0x00, 0x00, 0x00, 0x00, 0x38, 0xDD, 0x36, 0xE0, 0x00, 0x00, 0x00, 0x00, +0x39, 0xFB, 0x4C, 0x60, 0x00, 0x00, 0x00, 0x00, 0x3A, 0xBD, 0x18, 0xE0, 0x00, 0x00, 0x00, 0x00, +0x3B, 0xDB, 0x2E, 0x60, 0x00, 0x00, 0x00, 0x00, 0x3C, 0xA6, 0x35, 0x60, 0x00, 0x00, 0x00, 0x00, +0x3D, 0xBB, 0x10, 0x60, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x86, 0x17, 0x60, 0x00, 0x00, 0x00, 0x00, +0x3F, 0x9A, 0xF2, 0x60, 0x00, 0x00, 0x00, 0x00, 0x40, 0x65, 0xF9, 0x60, 0x00, 0x00, 0x00, 0x00, +0x41, 0x84, 0x0E, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0x00, 0x01, 0x02, 0x03, +0x04, 0x02, 0x04, 0x02, 0x04, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, +0x06, 0x05, 0x07, 0x08, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, +0x05, 0x06, 0x05, 0x07, 0x08, 0x07, 0x08, 0x07, 0x08, 0x07, 0x08, 0x07, 0x08, 0x07, 0x05, 0x05, +0x00, 0x00, 0x30, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x38, 0x40, 0x00, 0x04, 0x00, 0x00, 0x46, 0x50, +0x00, 0x08, 0x00, 0x00, 0x54, 0x60, 0x00, 0x0C, 0x00, 0x00, 0x54, 0x60, 0x01, 0x0C, 0x00, 0x00, +0x46, 0x50, 0x00, 0x08, 0x00, 0x00, 0x54, 0x60, 0x01, 0x0C, 0x00, 0x00, 0x46, 0x50, 0x01, 0x08, +0x00, 0x00, 0x38, 0x40, 0x00, 0x04, 0x00, 0x00, 0x46, 0x50, 0x00, 0x08, 0x4C, 0x4D, 0x54, 0x00, +0x2B, 0x30, 0x34, 0x00, 0x2B, 0x30, 0x35, 0x00, 0x2B, 0x30, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0A, 0x3C, 0x2B, 0x30, 0x35, 0x3E, 0x2D, 0x35, 0x0A, +#endif +0x00, 0xD1, 0x39, 0x32, 0x01, 0x61, 0xE6, 0xF5, 0x00, 0x00, 0x00, 0x15, 0x41, 0x74, 0x79, 0x72, +0x61, 0x75, 0x2F, 0x41, 0x74, 0x69, 0x72, 0x61, 0x75, 0x2F, 0x47, 0x75, 0x72, 0x27, 0x79, 0x65, +0x76, + /* Asia/Baghdad */ 0x50, 0x48, 0x50, 0x32, 0x01, 0x49, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, @@ -20233,8 +20305,8 @@ const unsigned char timelib_timezone_db_data_builtin[272303] = { /* Asia/Gaza */ 0x50, 0x48, 0x50, 0x32, 0x01, 0x50, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x15, 0x80, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x15, 0x80, 0x00, 0x00, 0x00, 0xC8, 0x59, 0xB2, 0xE0, 0xCC, 0xE5, 0xC1, 0x50, 0xCD, 0xAC, 0xFE, 0x00, 0xCE, 0xC6, 0xF4, 0xD0, 0xCF, 0x8F, 0x66, 0xE0, 0xD0, 0xA9, 0x79, 0xD0, 0xD1, 0x84, 0x60, 0xE0, 0xD2, 0x8A, 0xC9, 0x70, 0xD3, 0x65, 0xB0, 0x80, 0xD4, 0x6B, 0xE0, 0xD0, 0xE8, 0x36, 0x63, 0x60, 0xE8, 0xF4, 0x2D, 0x50, @@ -20271,24 +20343,24 @@ const unsigned char timelib_timezone_db_data_builtin[272303] = { 0x75, 0x0F, 0x92, 0x70, 0x76, 0x2D, 0x99, 0xE0, 0x76, 0xEF, 0x74, 0x70, 0x78, 0x0D, 0x7B, 0xE0, 0x78, 0xCF, 0x56, 0x70, 0x79, 0xED, 0x5D, 0xE0, 0x7A, 0xB8, 0x72, 0xF0, 0x7B, 0xCD, 0x3F, 0xE0, 0x7C, 0x98, 0x54, 0xF0, 0x7D, 0xAD, 0x21, 0xE0, 0x7E, 0x78, 0x36, 0xF0, 0x7F, 0x96, 0x3E, 0x60, -0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, -0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, -0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, -0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x02, 0x03, 0x06, 0x03, 0x06, -0x03, 0x06, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, -0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, -0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, -0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, -0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, +0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x02, 0x01, 0x05, 0x01, 0x05, +0x01, 0x05, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x00, 0x00, 0x20, 0x50, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x04, 0x00, 0x00, 0x1C, -0x20, 0x00, 0x04, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x08, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x0D, 0x00, -0x00, 0x1C, 0x20, 0x00, 0x11, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x45, -0x45, 0x54, 0x00, 0x45, 0x45, 0x53, 0x54, 0x00, 0x49, 0x44, 0x54, 0x00, 0x49, 0x53, 0x54, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x20, 0x00, 0x09, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x0D, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x11, 0x00, +0x00, 0x1C, 0x20, 0x00, 0x09, 0x4C, 0x4D, 0x54, 0x00, 0x45, 0x45, 0x53, 0x54, 0x00, 0x45, 0x45, +0x54, 0x00, 0x49, 0x44, 0x54, 0x00, 0x49, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, #ifdef TIMELIB_SUPPORTS_V2DATA 0x54, 0x5A, 0x69, 0x66, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x15, 0xF8, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x15, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x7D, 0xBD, 0x4A, 0xB0, 0xFF, 0xFF, 0xFF, 0xFF, 0xC8, 0x59, 0xB2, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xCC, 0xE5, 0xC1, 0x50, 0xFF, 0xFF, 0xFF, 0xFF, 0xCD, 0xAC, 0xFE, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xCE, 0xC6, 0xF4, 0xD0, 0xFF, 0xFF, 0xFF, 0xFF, @@ -20362,22 +20434,22 @@ const unsigned char timelib_timezone_db_data_builtin[272303] = { 0x7A, 0xB8, 0x72, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x7B, 0xCD, 0x3F, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x98, 0x54, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x7D, 0xAD, 0x21, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x78, 0x36, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x96, 0x3E, 0x60, 0x00, 0x02, 0x01, 0x02, -0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, -0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x05, 0x04, 0x05, -0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, -0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x02, 0x03, 0x06, 0x03, 0x06, 0x03, 0x06, 0x02, -0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, -0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, -0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, -0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, -0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x00, 0x00, -0x20, 0x50, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x04, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, -0x00, 0x00, 0x2A, 0x30, 0x01, 0x08, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x0D, 0x00, 0x00, 0x1C, 0x20, -0x00, 0x11, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x45, 0x45, 0x54, 0x00, -0x45, 0x45, 0x53, 0x54, 0x00, 0x49, 0x44, 0x54, 0x00, 0x49, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x45, 0x45, 0x54, 0x2D, -0x32, 0x45, 0x45, 0x53, 0x54, 0x2C, 0x4D, 0x33, 0x2E, 0x35, 0x2E, 0x36, 0x2F, 0x31, 0x2C, 0x4D, -0x31, 0x30, 0x2E, 0x35, 0x2E, 0x36, 0x2F, 0x31, 0x0A, +0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, +0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x04, 0x03, 0x04, +0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, +0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x02, 0x01, 0x05, 0x01, 0x05, 0x01, 0x05, 0x02, +0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, +0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, +0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, +0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, +0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x00, 0x00, +0x20, 0x50, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x04, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x09, +0x00, 0x00, 0x2A, 0x30, 0x01, 0x0D, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x11, 0x00, 0x00, 0x1C, 0x20, +0x00, 0x09, 0x4C, 0x4D, 0x54, 0x00, 0x45, 0x45, 0x53, 0x54, 0x00, 0x45, 0x45, 0x54, 0x00, 0x49, +0x44, 0x54, 0x00, 0x49, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x0A, 0x45, 0x45, 0x54, 0x2D, 0x32, 0x45, 0x45, 0x53, 0x54, 0x2C, 0x4D, 0x33, +0x2E, 0x35, 0x2E, 0x36, 0x2F, 0x31, 0x2C, 0x4D, 0x31, 0x30, 0x2E, 0x35, 0x2E, 0x36, 0x2F, 0x31, +0x0A, #endif 0x00, 0xB9, 0x64, 0xF0, 0x01, 0x47, 0x40, 0x0A, 0x00, 0x00, 0x00, 0x0A, 0x47, 0x61, 0x7A, 0x61, 0x20, 0x53, 0x74, 0x72, 0x69, 0x70, @@ -20416,8 +20488,8 @@ const unsigned char timelib_timezone_db_data_builtin[272303] = { /* Asia/Hebron */ 0x50, 0x48, 0x50, 0x32, 0x01, 0x50, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x15, 0x80, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x15, 0x80, 0x00, 0x00, 0x00, 0xC8, 0x59, 0xB2, 0xE0, 0xCC, 0xE5, 0xC1, 0x50, 0xCD, 0xAC, 0xFE, 0x00, 0xCE, 0xC6, 0xF4, 0xD0, 0xCF, 0x8F, 0x66, 0xE0, 0xD0, 0xA9, 0x79, 0xD0, 0xD1, 0x84, 0x60, 0xE0, 0xD2, 0x8A, 0xC9, 0x70, 0xD3, 0x65, 0xB0, 0x80, 0xD4, 0x6B, 0xE0, 0xD0, 0xE8, 0x36, 0x63, 0x60, 0xE8, 0xF4, 0x2D, 0x50, @@ -20455,24 +20527,23 @@ const unsigned char timelib_timezone_db_data_builtin[272303] = { 0x76, 0xEF, 0x74, 0x70, 0x78, 0x0D, 0x7B, 0xE0, 0x78, 0xCF, 0x56, 0x70, 0x79, 0xED, 0x5D, 0xE0, 0x7A, 0xB8, 0x72, 0xF0, 0x7B, 0xCD, 0x3F, 0xE0, 0x7C, 0x98, 0x54, 0xF0, 0x7D, 0xAD, 0x21, 0xE0, 0x7E, 0x78, 0x36, 0xF0, 0x7F, 0x96, 0x3E, 0x60, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, -0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, -0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, -0x05, 0x04, 0x05, 0x02, 0x03, 0x06, 0x03, 0x06, 0x03, 0x06, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, -0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, -0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, -0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, -0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, -0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x00, 0x00, 0x20, 0xE7, 0x00, -0x00, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x04, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x00, 0x00, 0x2A, -0x30, 0x01, 0x08, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x0D, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x11, 0x00, -0x00, 0x1C, 0x20, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x45, 0x45, 0x54, 0x00, 0x45, 0x45, 0x53, -0x54, 0x00, 0x49, 0x44, 0x54, 0x00, 0x49, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, +0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, +0x04, 0x03, 0x04, 0x02, 0x01, 0x05, 0x01, 0x05, 0x01, 0x05, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x00, 0x00, 0x20, 0xE7, 0x00, +0x00, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x04, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x09, 0x00, 0x00, 0x2A, +0x30, 0x01, 0x0D, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x11, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x09, 0x4C, +0x4D, 0x54, 0x00, 0x45, 0x45, 0x53, 0x54, 0x00, 0x45, 0x45, 0x54, 0x00, 0x49, 0x44, 0x54, 0x00, +0x49, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, #ifdef TIMELIB_SUPPORTS_V2DATA 0x54, 0x5A, 0x69, 0x66, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x15, 0xF8, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x15, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x7D, 0xBD, 0x4A, 0x19, 0xFF, 0xFF, 0xFF, 0xFF, 0xC8, 0x59, 0xB2, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xCC, 0xE5, 0xC1, 0x50, 0xFF, 0xFF, 0xFF, 0xFF, 0xCD, 0xAC, 0xFE, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xCE, 0xC6, 0xF4, 0xD0, 0xFF, 0xFF, 0xFF, 0xFF, @@ -20547,22 +20618,22 @@ const unsigned char timelib_timezone_db_data_builtin[272303] = { 0x7A, 0xB8, 0x72, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x7B, 0xCD, 0x3F, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x98, 0x54, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x7D, 0xAD, 0x21, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x78, 0x36, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x96, 0x3E, 0x60, 0x00, 0x02, 0x01, 0x02, -0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, -0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x05, 0x04, 0x05, -0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, -0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x02, 0x03, 0x06, 0x03, 0x06, 0x03, 0x06, 0x02, -0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, -0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, -0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, -0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, -0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, +0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, +0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x04, 0x03, 0x04, +0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, +0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x02, 0x01, 0x05, 0x01, 0x05, 0x01, 0x05, 0x02, +0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, +0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, +0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, +0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, +0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x00, 0x00, 0x20, 0xE7, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x04, 0x00, 0x00, 0x1C, 0x20, -0x00, 0x04, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x08, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x0D, 0x00, 0x00, -0x1C, 0x20, 0x00, 0x11, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x45, 0x45, -0x54, 0x00, 0x45, 0x45, 0x53, 0x54, 0x00, 0x49, 0x44, 0x54, 0x00, 0x49, 0x53, 0x54, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x45, 0x45, -0x54, 0x2D, 0x32, 0x45, 0x45, 0x53, 0x54, 0x2C, 0x4D, 0x33, 0x2E, 0x35, 0x2E, 0x36, 0x2F, 0x31, -0x2C, 0x4D, 0x31, 0x30, 0x2E, 0x35, 0x2E, 0x36, 0x2F, 0x31, 0x0A, +0x00, 0x09, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x0D, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x11, 0x00, 0x00, +0x1C, 0x20, 0x00, 0x09, 0x4C, 0x4D, 0x54, 0x00, 0x45, 0x45, 0x53, 0x54, 0x00, 0x45, 0x45, 0x54, +0x00, 0x49, 0x44, 0x54, 0x00, 0x49, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x45, 0x45, 0x54, 0x2D, 0x32, 0x45, 0x45, 0x53, 0x54, 0x2C, +0x4D, 0x33, 0x2E, 0x35, 0x2E, 0x36, 0x2F, 0x31, 0x2C, 0x4D, 0x31, 0x30, 0x2E, 0x35, 0x2E, 0x36, +0x2F, 0x31, 0x0A, #endif 0x00, 0xB9, 0x71, 0xF5, 0x01, 0x48, 0x35, 0x7C, 0x00, 0x00, 0x00, 0x09, 0x57, 0x65, 0x73, 0x74, 0x20, 0x42, 0x61, 0x6E, 0x6B, @@ -22253,7 +22324,7 @@ const unsigned char timelib_timezone_db_data_builtin[272303] = { 0x37, 0x0A, #endif 0x00, 0xDD, 0x4D, 0xA5, 0x01, 0x91, 0x2D, 0xD2, 0x00, 0x00, 0x00, 0x14, 0x4D, 0x53, 0x4B, 0x2B, -0x30, 0x33, 0x20, 0x2D, 0x20, 0x4E, 0x6F, 0x76, 0x6F, 0x73, 0x69, 0x62, 0x69, 0x72, 0x73, 0x6B, +0x30, 0x34, 0x20, 0x2D, 0x20, 0x4E, 0x6F, 0x76, 0x6F, 0x73, 0x69, 0x62, 0x69, 0x72, 0x73, 0x6B, /* Asia/Omsk */ @@ -38639,6 +38710,87 @@ const unsigned char timelib_timezone_db_data_builtin[272303] = { #endif 0x00, 0xCC, 0x43, 0xAA, 0x01, 0x2E, 0xC2, 0x82, 0x00, 0x00, 0x00, 0x00, +/* Europe/Saratov */ +0x50, 0x48, 0x50, 0x32, 0x01, 0x52, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x10, 0x80, 0x00, 0x00, 0x00, +0xA1, 0x00, 0x39, 0x80, 0xB5, 0xA4, 0x0B, 0x50, 0x15, 0x27, 0x99, 0xC0, 0x16, 0x18, 0xCE, 0x30, +0x17, 0x08, 0xCD, 0x40, 0x17, 0xFA, 0x01, 0xB0, 0x18, 0xEA, 0x00, 0xC0, 0x19, 0xDB, 0x35, 0x30, +0x1A, 0xCC, 0x85, 0xC0, 0x1B, 0xBC, 0x92, 0xE0, 0x1C, 0xAC, 0x83, 0xE0, 0x1D, 0x9C, 0x74, 0xE0, +0x1E, 0x8C, 0x65, 0xE0, 0x1F, 0x7C, 0x56, 0xE0, 0x20, 0x6C, 0x47, 0xE0, 0x21, 0x5C, 0x38, 0xE0, +0x22, 0x4C, 0x29, 0xE0, 0x23, 0x3C, 0x28, 0xF0, 0x24, 0x2C, 0x19, 0xF0, 0x25, 0x1C, 0x0A, 0xF0, +0x26, 0x0B, 0xFB, 0xF0, 0x27, 0x05, 0x27, 0x70, 0x27, 0xF5, 0x18, 0x70, 0x29, 0xD4, 0xEC, 0x60, +0x2A, 0xC4, 0xEB, 0x70, 0x2B, 0xB4, 0xDC, 0x70, 0x2C, 0xA4, 0xCD, 0x70, 0x2D, 0x94, 0xBE, 0x70, +0x2E, 0x84, 0xAF, 0x70, 0x2F, 0x74, 0xA0, 0x70, 0x30, 0x64, 0x91, 0x70, 0x31, 0x5D, 0xBC, 0xF0, +0x32, 0x72, 0x97, 0xF0, 0x33, 0x3D, 0x9E, 0xF0, 0x34, 0x52, 0x79, 0xF0, 0x35, 0x1D, 0x80, 0xF0, +0x36, 0x32, 0x5B, 0xF0, 0x36, 0xFD, 0x62, 0xF0, 0x38, 0x1B, 0x78, 0x70, 0x38, 0xDD, 0x44, 0xF0, +0x39, 0xFB, 0x5A, 0x70, 0x3A, 0xBD, 0x26, 0xF0, 0x3B, 0xDB, 0x3C, 0x70, 0x3C, 0xA6, 0x43, 0x70, +0x3D, 0xBB, 0x1E, 0x70, 0x3E, 0x86, 0x25, 0x70, 0x3F, 0x9B, 0x00, 0x70, 0x40, 0x66, 0x07, 0x70, +0x41, 0x84, 0x1C, 0xF0, 0x42, 0x45, 0xE9, 0x70, 0x43, 0x63, 0xFE, 0xF0, 0x44, 0x25, 0xCB, 0x70, +0x45, 0x43, 0xE0, 0xF0, 0x46, 0x05, 0xAD, 0x70, 0x47, 0x23, 0xC2, 0xF0, 0x47, 0xEE, 0xC9, 0xF0, +0x49, 0x03, 0xA4, 0xF0, 0x49, 0xCE, 0xAB, 0xF0, 0x4A, 0xE3, 0x86, 0xF0, 0x4B, 0xAE, 0x8D, 0xF0, +0x4C, 0xCC, 0xA3, 0x70, 0x4D, 0x8E, 0x6F, 0xF0, 0x54, 0x4C, 0x1D, 0x60, 0x58, 0x43, 0x4E, 0x70, +0x7F, 0xFF, 0xFF, 0xFF, 0x00, 0x01, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x04, 0x05, +0x04, 0x05, 0x04, 0x05, 0x04, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x04, 0x06, 0x07, 0x06, 0x07, +0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, +0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, +0x06, 0x07, 0x04, 0x07, 0x04, 0x04, 0x00, 0x00, 0x2B, 0x32, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, +0x00, 0x04, 0x00, 0x00, 0x46, 0x50, 0x01, 0x08, 0x00, 0x00, 0x38, 0x40, 0x00, 0x0C, 0x00, 0x00, +0x38, 0x40, 0x00, 0x0C, 0x00, 0x00, 0x46, 0x50, 0x01, 0x08, 0x00, 0x00, 0x38, 0x40, 0x01, 0x0C, +0x00, 0x00, 0x2A, 0x30, 0x00, 0x04, 0x00, 0x00, 0x38, 0x40, 0x00, 0x0C, 0x4C, 0x4D, 0x54, 0x00, +0x2B, 0x30, 0x33, 0x00, 0x2B, 0x30, 0x35, 0x00, 0x2B, 0x30, 0x34, 0x00, 0x00, 0x01, 0x00, 0x00, +0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +#ifdef TIMELIB_SUPPORTS_V2DATA +0x54, 0x5A, 0x69, 0x66, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x10, 0xF8, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xA1, 0x00, 0x39, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, +0xB5, 0xA4, 0x0B, 0x50, 0x00, 0x00, 0x00, 0x00, 0x15, 0x27, 0x99, 0xC0, 0x00, 0x00, 0x00, 0x00, +0x16, 0x18, 0xCE, 0x30, 0x00, 0x00, 0x00, 0x00, 0x17, 0x08, 0xCD, 0x40, 0x00, 0x00, 0x00, 0x00, +0x17, 0xFA, 0x01, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x18, 0xEA, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, +0x19, 0xDB, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x1A, 0xCC, 0x85, 0xC0, 0x00, 0x00, 0x00, 0x00, +0x1B, 0xBC, 0x92, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x1C, 0xAC, 0x83, 0xE0, 0x00, 0x00, 0x00, 0x00, +0x1D, 0x9C, 0x74, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x8C, 0x65, 0xE0, 0x00, 0x00, 0x00, 0x00, +0x1F, 0x7C, 0x56, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x20, 0x6C, 0x47, 0xE0, 0x00, 0x00, 0x00, 0x00, +0x21, 0x5C, 0x38, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x22, 0x4C, 0x29, 0xE0, 0x00, 0x00, 0x00, 0x00, +0x23, 0x3C, 0x28, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x24, 0x2C, 0x19, 0xF0, 0x00, 0x00, 0x00, 0x00, +0x25, 0x1C, 0x0A, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x26, 0x0B, 0xFB, 0xF0, 0x00, 0x00, 0x00, 0x00, +0x27, 0x05, 0x27, 0x70, 0x00, 0x00, 0x00, 0x00, 0x27, 0xF5, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, +0x29, 0xD4, 0xEC, 0x60, 0x00, 0x00, 0x00, 0x00, 0x2A, 0xC4, 0xEB, 0x70, 0x00, 0x00, 0x00, 0x00, +0x2B, 0xB4, 0xDC, 0x70, 0x00, 0x00, 0x00, 0x00, 0x2C, 0xA4, 0xCD, 0x70, 0x00, 0x00, 0x00, 0x00, +0x2D, 0x94, 0xBE, 0x70, 0x00, 0x00, 0x00, 0x00, 0x2E, 0x84, 0xAF, 0x70, 0x00, 0x00, 0x00, 0x00, +0x2F, 0x74, 0xA0, 0x70, 0x00, 0x00, 0x00, 0x00, 0x30, 0x64, 0x91, 0x70, 0x00, 0x00, 0x00, 0x00, +0x31, 0x5D, 0xBC, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x32, 0x72, 0x97, 0xF0, 0x00, 0x00, 0x00, 0x00, +0x33, 0x3D, 0x9E, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x34, 0x52, 0x79, 0xF0, 0x00, 0x00, 0x00, 0x00, +0x35, 0x1D, 0x80, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x36, 0x32, 0x5B, 0xF0, 0x00, 0x00, 0x00, 0x00, +0x36, 0xFD, 0x62, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x38, 0x1B, 0x78, 0x70, 0x00, 0x00, 0x00, 0x00, +0x38, 0xDD, 0x44, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x39, 0xFB, 0x5A, 0x70, 0x00, 0x00, 0x00, 0x00, +0x3A, 0xBD, 0x26, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x3B, 0xDB, 0x3C, 0x70, 0x00, 0x00, 0x00, 0x00, +0x3C, 0xA6, 0x43, 0x70, 0x00, 0x00, 0x00, 0x00, 0x3D, 0xBB, 0x1E, 0x70, 0x00, 0x00, 0x00, 0x00, +0x3E, 0x86, 0x25, 0x70, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x9B, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, +0x40, 0x66, 0x07, 0x70, 0x00, 0x00, 0x00, 0x00, 0x41, 0x84, 0x1C, 0xF0, 0x00, 0x00, 0x00, 0x00, +0x42, 0x45, 0xE9, 0x70, 0x00, 0x00, 0x00, 0x00, 0x43, 0x63, 0xFE, 0xF0, 0x00, 0x00, 0x00, 0x00, +0x44, 0x25, 0xCB, 0x70, 0x00, 0x00, 0x00, 0x00, 0x45, 0x43, 0xE0, 0xF0, 0x00, 0x00, 0x00, 0x00, +0x46, 0x05, 0xAD, 0x70, 0x00, 0x00, 0x00, 0x00, 0x47, 0x23, 0xC2, 0xF0, 0x00, 0x00, 0x00, 0x00, +0x47, 0xEE, 0xC9, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x49, 0x03, 0xA4, 0xF0, 0x00, 0x00, 0x00, 0x00, +0x49, 0xCE, 0xAB, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x4A, 0xE3, 0x86, 0xF0, 0x00, 0x00, 0x00, 0x00, +0x4B, 0xAE, 0x8D, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x4C, 0xCC, 0xA3, 0x70, 0x00, 0x00, 0x00, 0x00, +0x4D, 0x8E, 0x6F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x54, 0x4C, 0x1D, 0x60, 0x00, 0x00, 0x00, 0x00, +0x58, 0x43, 0x4E, 0x70, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0x00, 0x01, 0x03, 0x02, +0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x06, 0x07, 0x06, +0x07, 0x06, 0x07, 0x04, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, +0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, +0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x04, 0x07, 0x04, 0x04, 0x00, 0x00, +0x2B, 0x32, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x04, 0x00, 0x00, 0x46, 0x50, 0x01, 0x08, +0x00, 0x00, 0x38, 0x40, 0x00, 0x0C, 0x00, 0x00, 0x38, 0x40, 0x00, 0x0C, 0x00, 0x00, 0x46, 0x50, +0x01, 0x08, 0x00, 0x00, 0x38, 0x40, 0x01, 0x0C, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x04, 0x00, 0x00, +0x38, 0x40, 0x00, 0x0C, 0x4C, 0x4D, 0x54, 0x00, 0x2B, 0x30, 0x33, 0x00, 0x2B, 0x30, 0x35, 0x00, +0x2B, 0x30, 0x34, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x3C, 0x2B, 0x30, 0x34, 0x3E, 0x2D, 0x34, 0x0A, +#endif +0x00, 0xD8, 0x03, 0x7A, 0x01, 0x58, 0xE6, 0x45, 0x00, 0x00, 0x00, 0x10, 0x4D, 0x53, 0x4B, 0x2B, +0x30, 0x31, 0x20, 0x2D, 0x20, 0x53, 0x61, 0x72, 0x61, 0x74, 0x6F, 0x76, + /* Europe/Simferopol */ 0x50, 0x48, 0x50, 0x32, 0x01, 0x52, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, @@ -40464,9 +40616,8 @@ const unsigned char timelib_timezone_db_data_builtin[272303] = { 0x00, 0x2B, 0x30, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x3C, 0x2B, 0x30, 0x33, 0x3E, 0x2D, 0x33, 0x0A, #endif -0x00, 0xD3, 0xB0, 0xB5, 0x01, 0x56, 0x6E, 0xC2, 0x00, 0x00, 0x00, 0x1B, 0x4D, 0x53, 0x4B, 0x2B, -0x30, 0x30, 0x20, 0x2D, 0x20, 0x56, 0x6F, 0x6C, 0x67, 0x6F, 0x67, 0x72, 0x61, 0x64, 0x2C, 0x20, -0x53, 0x61, 0x72, 0x61, 0x74, 0x6F, 0x76, +0x00, 0xD3, 0xB0, 0xB5, 0x01, 0x56, 0x6E, 0xC2, 0x00, 0x00, 0x00, 0x12, 0x4D, 0x53, 0x4B, 0x2B, +0x30, 0x30, 0x20, 0x2D, 0x20, 0x56, 0x6F, 0x6C, 0x67, 0x6F, 0x67, 0x72, 0x61, 0x64, /* Europe/Warsaw */ 0x50, 0x48, 0x50, 0x32, 0x01, 0x50, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -47815,4 +47966,4 @@ const unsigned char timelib_timezone_db_data_builtin[272303] = { #endif 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, 0x00, 0x00, 0x00, 0x00,}; -const timelib_tzdb timezonedb_builtin = { "2016.9", 591, timezonedb_idx_builtin, timelib_timezone_db_data_builtin }; +const timelib_tzdb timezonedb_builtin = { "2016.10", 593, timezonedb_idx_builtin, timelib_timezone_db_data_builtin }; diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index b6dc791d3d..9984356c30 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -1075,7 +1075,7 @@ static dom_object* dom_objects_set_class(zend_class_entry *class_type, zend_bool dom_object *intern = ecalloc(1, sizeof(dom_object) + zend_object_properties_size(class_type)); zend_class_entry *base_class = class_type; - while (base_class->type != ZEND_INTERNAL_CLASS && base_class->parent != NULL) { + while ((base_class->type != ZEND_INTERNAL_CLASS || base_class->info.internal.module->module_number != dom_module_entry.module_number) && base_class->parent != NULL) { base_class = base_class->parent; } diff --git a/ext/fileinfo/tests/bug57547.phpt b/ext/fileinfo/tests/bug57547.phpt new file mode 100644 index 0000000000..512d4c030a --- /dev/null +++ b/ext/fileinfo/tests/bug57547.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #57547 Settings options on file doesn't give same result as constructor options +--SKIPIF-- +<?php +if (!class_exists('finfo')) + die('skip no fileinfo extension'); +--FILE-- +<?php + +$filenames = array("..", __FILE__); + +foreach ($filenames as $filename) { + $finfo = new finfo(FILEINFO_MIME); + var_dump($finfo->file($filename)); + + $finfo2 = new finfo(); + var_dump($finfo2->file($filename, FILEINFO_MIME)); +} + +?> +===DONE=== +--EXPECT-- +string(9) "directory" +string(9) "directory" +string(28) "text/x-php; charset=us-ascii" +string(28) "text/x-php; charset=us-ascii" +===DONE=== diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 2aa03a9551..88c90487f5 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -1036,7 +1036,7 @@ void php_gd_error_method(int type, const char *format, va_list args) default: type = E_ERROR; } - php_verror(NULL, "", type, format, args TSRMLS_CC); + php_verror(NULL, "", type, format, args); } /* }}} */ #endif @@ -3040,7 +3040,7 @@ PHP_FUNCTION(imagegammacorrect) } if ( input <= 0.0 || output <= 0.0 ) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Gamma values should be positive"); + php_error_docref(NULL, E_WARNING, "Gamma values should be positive"); RETURN_FALSE; } @@ -4668,7 +4668,7 @@ PHP_FUNCTION(imagecropauto) case GD_CROP_THRESHOLD: if (color < 0 || (!gdImageTrueColor(im) && color >= gdImageColorsTotal(im))) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Color argument missing with threshold mode"); + php_error_docref(NULL, E_WARNING, "Color argument missing with threshold mode"); RETURN_FALSE; } im_crop = gdImageCropThreshold(im, color, (float) threshold); diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c index da825671d6..206e4554f8 100644 --- a/ext/gd/gd_ctx.c +++ b/ext/gd/gd_ctx.c @@ -58,6 +58,16 @@ static int _php_image_stream_putbuf(struct gdIOCtx *ctx, const void* buf, int l) static void _php_image_stream_ctxfree(struct gdIOCtx *ctx) /* {{{ */ { + if(ctx->data) { + ctx->data = NULL; + } + if(ctx) { + efree(ctx); + } +} /* }}} */ + +static void _php_image_stream_ctxfreeandclose(struct gdIOCtx *ctx) /* {{{ */ +{ if(ctx->data) { php_stream_close((php_stream *) ctx->data); @@ -82,6 +92,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, gdIOCtx *ctx = NULL; zval *to_zval = NULL; php_stream *stream; + int close_stream = 1; /* The third (quality) parameter for Wbmp stands for the threshold when called from image2wbmp(). * The third (quality) parameter for Wbmp and Xbm stands for the foreground color index when called @@ -120,6 +131,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, if (stream == NULL) { RETURN_FALSE; } + close_stream = 0; } else if (Z_TYPE_P(to_zval) == IS_STRING) { if (CHECK_ZVAL_NULL_PATH(to_zval)) { php_error_docref(NULL, E_WARNING, "Invalid 2nd parameter, filename must not contain null bytes"); @@ -156,7 +168,11 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, ctx = emalloc(sizeof(gdIOCtx)); ctx->putC = _php_image_stream_putc; ctx->putBuf = _php_image_stream_putbuf; - ctx->gd_free = _php_image_stream_ctxfree; + if (close_stream) { + ctx->gd_free = _php_image_stream_ctxfreeandclose; + } else { + ctx->gd_free = _php_image_stream_ctxfree; + } ctx->data = (void *)stream; } diff --git a/ext/gd/tests/bug73549.phpt b/ext/gd/tests/bug73549.phpt new file mode 100644 index 0000000000..e0cc6cf42e --- /dev/null +++ b/ext/gd/tests/bug73549.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #73549 (Use after free when stream is passed to imagepng) +--SKIPIF-- +<?php +if (!extension_loaded('gd')) die('skip gd extension not available'); +?> +--FILE-- +<?php +$stream = fopen(__DIR__ . DIRECTORY_SEPARATOR . 'bug73549.png', 'w'); +$im = imagecreatetruecolor(8, 8); +var_dump(imagepng($im, $stream)); +var_dump($stream); +?> +===DONE=== +--EXPECTF-- +bool(true) +resource(%d) of type (stream) +===DONE=== +--CLEAN-- +<?php +unlink(__DIR__ . DIRECTORY_SEPARATOR . 'bug73549.png'); +?> diff --git a/ext/gd/tests/imagettftext_charmap_order.phpt b/ext/gd/tests/imagettftext_charmap_order.phpt index 2be20b7697..221e6b851a 100644 --- a/ext/gd/tests/imagettftext_charmap_order.phpt +++ b/ext/gd/tests/imagettftext_charmap_order.phpt @@ -4,6 +4,7 @@ Font charmap order is deterministic based on order in the font, use the selected <?php if(!extension_loaded('gd')){ die('skip gd extension not available'); } if(!function_exists('imagettftext')) die('skip imagettftext() not available'); + if(gd_info()['JIS-mapped Japanese Font Support']) die('skip JIS-mapped Japanese Font Support not supported'); ?> --FILE-- <?php diff --git a/ext/intl/grapheme/grapheme_string.c b/ext/intl/grapheme/grapheme_string.c index 5687e3e260..f69500429d 100644 --- a/ext/intl/grapheme/grapheme_string.c +++ b/ext/intl/grapheme/grapheme_string.c @@ -676,8 +676,10 @@ PHP_FUNCTION(grapheme_stristr) static inline int32_t grapheme_extract_charcount_iter(UBreakIterator *bi, int32_t csize, unsigned char *pstr, int32_t str_len) { - int pos = 0, prev_pos = 0; - int ret_pos = 0, prev_ret_pos = 0; + int pos = 0; + int ret_pos = 0; + int break_pos, prev_break_pos; + int count = 0; while ( 1 ) { pos = ubrk_next(bi); @@ -686,23 +688,24 @@ grapheme_extract_charcount_iter(UBreakIterator *bi, int32_t csize, unsigned char break; } - /* if we are beyond our limit, then the loop is done */ - if ( pos > csize ) { - break; - } + for ( break_pos = ret_pos; break_pos < pos; ) { + count++; + prev_break_pos = break_pos; + U8_FWD_1(pstr, break_pos, str_len); - /* update our pointer in the original UTF-8 buffer by as many characters - as ubrk_next iterated over */ - - prev_ret_pos = ret_pos; - U8_FWD_N(pstr, ret_pos, str_len, pos - prev_pos); + if ( prev_break_pos == break_pos ) { + /* something wrong - malformed utf8? */ + csize = 0; + break; + } + } - if ( prev_ret_pos == ret_pos ) { - /* something wrong - malformed utf8? */ + /* if we are beyond our limit, then the loop is done */ + if ( count > csize ) { break; } - prev_pos = pos; + ret_pos = break_pos; } return ret_pos; @@ -713,8 +716,8 @@ grapheme_extract_charcount_iter(UBreakIterator *bi, int32_t csize, unsigned char static inline int32_t grapheme_extract_bytecount_iter(UBreakIterator *bi, int32_t bsize, unsigned char *pstr, int32_t str_len) { - int pos = 0, prev_pos = 0; - int ret_pos = 0, prev_ret_pos = 0; + int pos = 0; + int ret_pos = 0; while ( 1 ) { pos = ubrk_next(bi); @@ -723,20 +726,11 @@ grapheme_extract_bytecount_iter(UBreakIterator *bi, int32_t bsize, unsigned char break; } - prev_ret_pos = ret_pos; - U8_FWD_N(pstr, ret_pos, str_len, pos - prev_pos); - - if ( ret_pos > bsize ) { - ret_pos = prev_ret_pos; - break; - } - - if ( prev_ret_pos == ret_pos ) { - /* something wrong - malformed utf8? */ + if ( pos > bsize ) { break; } - prev_pos = pos; + ret_pos = pos; } return ret_pos; @@ -747,7 +741,7 @@ grapheme_extract_bytecount_iter(UBreakIterator *bi, int32_t bsize, unsigned char static inline int32_t grapheme_extract_count_iter(UBreakIterator *bi, int32_t size, unsigned char *pstr, int32_t str_len) { - int pos = 0, next_pos = 0; + int next_pos = 0; int ret_pos = 0; while ( size ) { @@ -756,16 +750,10 @@ grapheme_extract_count_iter(UBreakIterator *bi, int32_t size, unsigned char *pst if ( UBRK_DONE == next_pos ) { break; } - pos = next_pos; + ret_pos = next_pos; size--; } - /* pos is one past the last UChar - and represent the number of code units to - advance in the utf-8 buffer - */ - - U8_FWD_N(pstr, ret_pos, str_len, pos); - return ret_pos; } /* }}} */ @@ -785,9 +773,8 @@ static grapheme_extract_iter grapheme_extract_iters[] = { PHP_FUNCTION(grapheme_extract) { char *str, *pstr; - UChar *ustr; + UText ut = UTEXT_INITIALIZER; size_t str_len; - int32_t ustr_len; zend_long size; /* maximum number of grapheme clusters, bytes, or characters (based on extract_type) to return */ zend_long lstart = 0; /* starting position in str in bytes */ int32_t start = 0; @@ -871,21 +858,15 @@ PHP_FUNCTION(grapheme_extract) RETURN_STRINGL(pstr, nsize); } - /* convert the strings to UTF-16. */ - ustr = NULL; - ustr_len = 0; status = U_ZERO_ERROR; - intl_convert_utf8_to_utf16(&ustr, &ustr_len, pstr, str_len, &status ); + utext_openUTF8(&ut, pstr, str_len, &status); if ( U_FAILURE( status ) ) { /* Set global error code. */ intl_error_set_code( NULL, status ); /* Set error messages. */ - intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 ); - - if ( NULL != ustr ) - efree( ustr ); + intl_error_set_custom_msg( NULL, "Error opening UTF-8 text", 0 ); RETURN_FALSE; } @@ -894,8 +875,7 @@ PHP_FUNCTION(grapheme_extract) status = U_ZERO_ERROR; bi = grapheme_get_break_iterator(u_break_iterator_buffer, &status ); - ubrk_setText(bi, ustr, ustr_len, &status); - + ubrk_setUText(bi, &ut, &status); /* if the caller put us in the middle of a grapheme, we can't detect it in all cases since we can't back up. So, we will not do anything. */ @@ -903,9 +883,7 @@ PHP_FUNCTION(grapheme_extract) /* it's ok to convert str_len to in32_t since if it were too big intl_convert_utf8_to_utf16 above would fail */ ret_pos = (*grapheme_extract_iters[extract_type])(bi, size, (unsigned char *)pstr, (int32_t)str_len); - if (ustr) { - efree(ustr); - } + utext_close(&ut); ubrk_close(bi); if ( NULL != next ) { diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index 12cf6c1ce3..247262ad19 100644 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -1628,7 +1628,7 @@ PHP_FUNCTION(locale_accept_from_http) len = end ? end-start : http_accept_len-(start-http_accept); if(len > ULOC_FULLNAME_CAPACITY) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "locale_accept_from_http: locale string too long", 0 TSRMLS_CC ); + "locale_accept_from_http: locale string too long", 0 ); RETURN_FALSE; } if(end) { diff --git a/ext/intl/tests/bug68447.phpt b/ext/intl/tests/bug68447.phpt new file mode 100644 index 0000000000..f320276df2 --- /dev/null +++ b/ext/intl/tests/bug68447.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #68447: grapheme_extract take an extra trailing character +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php +$katsushikaku = "è‘›ó „飾区"; +echo grapheme_extract($katsushikaku, 1) . "\n"; + +$haiyore = "é€™ó „€ã„よれ"; +echo grapheme_extract($haiyore, 1, GRAPHEME_EXTR_COUNT) . "\n"; +echo grapheme_extract($haiyore, 2, GRAPHEME_EXTR_COUNT) . "\n"; +echo grapheme_extract($haiyore, 6, GRAPHEME_EXTR_MAXBYTES) . "\n"; +echo grapheme_extract($haiyore, 9, GRAPHEME_EXTR_MAXBYTES) . "\n"; +echo grapheme_extract($haiyore, 12, GRAPHEME_EXTR_MAXBYTES) . "\n"; +echo grapheme_extract($haiyore, 1, GRAPHEME_EXTR_MAXCHARS) . "\n"; +echo grapheme_extract($haiyore, 2, GRAPHEME_EXTR_MAXCHARS) . "\n"; +echo grapheme_extract($haiyore, 3, GRAPHEME_EXTR_MAXCHARS) . "\n"; +--EXPECT-- +è‘›ó „ +é€™ó „€ +é€™ó „€ã„ + +é€™ó „€ +é€™ó „€ã„ + +é€™ó „€ +é€™ó „€ã„ diff --git a/ext/json/json.c b/ext/json/json.c index 61445ee114..01319d5f5b 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -148,7 +148,7 @@ static PHP_GINIT_FUNCTION(json) #endif json_globals->encoder_depth = 0; json_globals->error_code = 0; - json_globals->encode_max_depth = 0; + json_globals->encode_max_depth = PHP_JSON_PARSER_DEFAULT_DEPTH; } /* }}} */ @@ -261,12 +261,12 @@ static PHP_FUNCTION(json_decode) } if (depth <= 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Depth must be greater than zero"); + php_error_docref(NULL, E_WARNING, "Depth must be greater than zero"); RETURN_NULL(); } if (depth > INT_MAX) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Depth must be lower than %d", INT_MAX); + php_error_docref(NULL, E_WARNING, "Depth must be lower than %d", INT_MAX); RETURN_NULL(); } diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c b/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c index 29782f5931..eae05953b2 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c +++ b/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c @@ -146,6 +146,10 @@ mbfl_memory_device_output(int c, void *data) unsigned char *tmp; newlen = device->length + device->allocsz; + if (newlen <= 0) { + /* overflow */ + return -1; + } tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); if (tmp == NULL) { return -1; @@ -169,6 +173,10 @@ mbfl_memory_device_output2(int c, void *data) unsigned char *tmp; newlen = device->length + device->allocsz; + if (newlen <= 0) { + /* overflow */ + return -1; + } tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); if (tmp == NULL) { return -1; @@ -194,6 +202,10 @@ mbfl_memory_device_output4(int c, void* data) unsigned char *tmp; newlen = device->length + device->allocsz; + if (newlen <= 0) { + /* overflow */ + return -1; + } tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); if (tmp == NULL) { return -1; @@ -227,7 +239,12 @@ mbfl_memory_device_strcat(mbfl_memory_device *device, const char *psrc) if ((device->pos + len) >= device->length) { /* reallocate buffer */ int newlen = device->length + (len + MBFL_MEMORY_DEVICE_ALLOC_SIZE)*sizeof(unsigned char); - unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); + unsigned char *tmp; + if (newlen <= 0) { + /* overflow */ + return -1; + } + tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); if (tmp == NULL) { return -1; } @@ -254,7 +271,12 @@ mbfl_memory_device_strncat(mbfl_memory_device *device, const char *psrc, int len if ((device->pos + len) >= device->length) { /* reallocate buffer */ int newlen = device->length + len + MBFL_MEMORY_DEVICE_ALLOC_SIZE; - unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); + unsigned char *tmp; + if (newlen <= 0) { + /* overflow */ + return -1; + } + tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); if (tmp == NULL) { return -1; } @@ -281,7 +303,12 @@ mbfl_memory_device_devcat(mbfl_memory_device *dest, mbfl_memory_device *src) if ((dest->pos + src->pos) >= dest->length) { /* reallocate buffer */ int newlen = dest->length + src->pos + MBFL_MEMORY_DEVICE_ALLOC_SIZE; - unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)dest->buffer, newlen*sizeof(unsigned char)); + unsigned char *tmp; + if (newlen <= 0) { + /* overflow */ + return -1; + } + tmp = (unsigned char *)mbfl_realloc((void *)dest->buffer, newlen*sizeof(unsigned char)); if (tmp == NULL) { return -1; } @@ -336,6 +363,10 @@ mbfl_wchar_device_output(int c, void *data) unsigned int *tmp; newlen = device->length + device->allocsz; + if (newlen <= 0) { + /* overflow */ + return -1; + } tmp = (unsigned int *)mbfl_realloc((void *)device->buffer, newlen*sizeof(int)); if (tmp == NULL) { return -1; diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 7ae96f597a..d5af96a5a1 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -3825,7 +3825,7 @@ detect_end: if (elist != NULL) { efree((void *)elist); } - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot handle recursive references"); + php_error_docref(NULL, E_WARNING, "Cannot handle recursive references"); RETURN_FALSE; } efree(stack); @@ -3942,7 +3942,7 @@ conv_end: } } efree(stack); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot handle recursive references"); + php_error_docref(NULL, E_WARNING, "Cannot handle recursive references"); RETURN_FALSE; } efree(stack); diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c index e7bdd43c9b..aa0abbd879 100644 --- a/ext/mcrypt/mcrypt.c +++ b/ext/mcrypt/mcrypt.c @@ -642,7 +642,7 @@ PHP_FUNCTION(mcrypt_generic) block_size = mcrypt_enc_get_block_size(pm->td); data_size = ((((int)data_len - 1) / block_size) + 1) * block_size; if (data_size <= 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Integer overflow in data size"); + php_error_docref(NULL, E_WARNING, "Integer overflow in data size"); RETURN_FALSE; } data_str = zend_string_alloc(data_size, 0); @@ -696,7 +696,7 @@ PHP_FUNCTION(mdecrypt_generic) block_size = mcrypt_enc_get_block_size(pm->td); data_size = ((((int)data_len - 1) / block_size) + 1) * block_size; if (data_size <= 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Integer overflow in data size"); + php_error_docref(NULL, E_WARNING, "Integer overflow in data size"); RETURN_FALSE; } data_s = emalloc((size_t)data_size + 1); diff --git a/ext/mysqli/tests/bug68077.phpt b/ext/mysqli/tests/bug68077.phpt index 3b6fa92ae3..0652e68c9b 100644 --- a/ext/mysqli/tests/bug68077.phpt +++ b/ext/mysqli/tests/bug68077.phpt @@ -41,7 +41,7 @@ open_basedir= if (!$link->query("SELECT 1 FROM DUAL")) printf("[005] [%d] %s\n", $link->errno, $link->error); - if (!$link->query("LOAD DATA LOCAL INFILE '" . __DIR__ . "/bug53503.data' INTO TABLE test")) { + if (!$link->query("LOAD DATA LOCAL INFILE '" . str_replace("\\", "/", __DIR__) . "/bug53503.data' INTO TABLE test")) { printf("[006] [%d] %s\n", $link->errno, $link->error); echo "bug\n"; } else { diff --git a/ext/mysqli/tests/bug_bits.phpt b/ext/mysqli/tests/bug_bits.phpt new file mode 100644 index 0000000000..8a56469772 --- /dev/null +++ b/ext/mysqli/tests/bug_bits.phpt @@ -0,0 +1,101 @@ +--TEST-- +Bug (Incorrectly decoding bit values / Malformed server packet. Field length pointing) +--SKIPIF-- +<?php +require_once('skipif.inc'); +require_once('skipifconnectfailure.inc'); +?> +--FILE-- +<?php + +require_once("connect.inc"); +if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); +} + +if (!$link->query("DROP TABLE IF EXISTS bug_bits")) { + printf("[002] [%d] %s\n", $link->errno, $link->error); +} + +if (!$link->query("CREATE TABLE `bug_bits` (`inty` bigint(20) unsigned NOT NULL DEFAULT '0', `bitty` bit(64) NOT NULL DEFAULT b'0')")) { + printf("[003] [%d] %s\n", $link->errno, $link->error); +} + +$insertQuery = "INSERT INTO `bug_bits` VALUES (18446744073709551615, 18446744073709551615)". + ",(18446744073709551614, 18446744073709551614)". + ",(4294967296, 4294967296)". + ",(4294967295, 4294967295)". + ",(2147483648, 2147483648)". + ",(2147483647, 2147483647)". + ",(1, 1)"; +if (!$link->query($insertQuery)) { + printf("[004] [%d] %s\n", $link->errno, $link->error); +} + +if (!($res = $link->query("SELECT * FROM `bug_bits`"))) { + printf("[005] [%d] %s\n", $link->errno, $link->error); +} + +while ($row = $res->fetch_assoc()) { + var_dump($row); +} + +$link->close(); + +echo "Done\n"; +?> +--CLEAN-- +<?php +require_once("connect.inc"); +if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + +if (!mysqli_query($link, "DROP TABLE IF EXISTS bug_bits")) + printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + +mysqli_close($link); +?> +--EXPECT-- +array(2) { + ["inty"]=> + string(20) "18446744073709551615" + ["bitty"]=> + string(20) "18446744073709551615" +} +array(2) { + ["inty"]=> + string(20) "18446744073709551614" + ["bitty"]=> + string(20) "18446744073709551614" +} +array(2) { + ["inty"]=> + string(10) "4294967296" + ["bitty"]=> + string(10) "4294967296" +} +array(2) { + ["inty"]=> + string(10) "4294967295" + ["bitty"]=> + string(10) "4294967295" +} +array(2) { + ["inty"]=> + string(10) "2147483648" + ["bitty"]=> + string(10) "2147483648" +} +array(2) { + ["inty"]=> + string(10) "2147483647" + ["bitty"]=> + string(10) "2147483647" +} +array(2) { + ["inty"]=> + string(1) "1" + ["bitty"]=> + string(1) "1" +} +Done diff --git a/ext/mysqli/tests/mysqli_expire_password.phpt b/ext/mysqli/tests/mysqli_expire_password.phpt index 4fdf902c79..6ce5eeaacc 100644 --- a/ext/mysqli/tests/mysqli_expire_password.phpt +++ b/ext/mysqli/tests/mysqli_expire_password.phpt @@ -127,10 +127,10 @@ if (!mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO expiretest@'% ?> --EXPECTF-- -Warning: mysqli_real_connect(): (HY000/1862): %s in %s on line %d +Warning: mysqli%sconnect(): (HY000/1862): %s in %s on line %d [001] Cannot connect [1862] %s -Warning: mysqli_real_connect(): (HY000/1862): %s in %s on line %d +Warning: mysqli%sconnect(): (HY000/1862): %s in %s on line %d [003] Cannot connect [1862] %s [006] Connect allowed, query fail, [1820] %s [008] Connect allowed, pw set, [0%A diff --git a/ext/mysqlnd/mysqlnd_ps_codec.c b/ext/mysqlnd/mysqlnd_ps_codec.c index e0b6c5630f..da2436310e 100644 --- a/ext/mysqlnd/mysqlnd_ps_codec.c +++ b/ext/mysqlnd/mysqlnd_ps_codec.c @@ -88,6 +88,7 @@ ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, unsigne } else { DBG_INF("stringify"); tmp_len = sprintf((char *)&tmp, MYSQLND_LLU_SPEC, uval); + DBG_INF_FMT("value=%s", tmp); } } } else { diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index 5871c3c346..9f2aafab2e 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -1607,7 +1607,8 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, zval *current_field, *end_field, *start_field; zend_uchar * p = row_buffer->ptr; size_t data_size = row_buffer->app; - zend_uchar * bit_area = (zend_uchar*) row_buffer->ptr + data_size + 1; /* we allocate from here */ + /* we allocate from here. In pre-7.0 it was +1, as there was an additional \0 for the last string in the packet - because of the zval optimizations - using no-copy */ + zend_uchar * bit_area = (zend_uchar*) row_buffer->ptr + data_size; const zend_uchar * const packet_end = (zend_uchar*) row_buffer->ptr + data_size; DBG_ENTER("php_mysqlnd_rowp_read_text_protocol_aux"); @@ -1734,9 +1735,25 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, */ p -= len; if (Z_TYPE_P(current_field) == IS_LONG) { + /* + Andrey : See below. No need of bit_area, as we can use on stack for this. + The bit area should be removed - the `prealloc_more_bytes` in php_mysqlnd_read_row_ex() + + char tmp[22]; + const size_t tmp_len = sprintf((char *)&tmp, MYSQLND_LLU_SPEC, Z_LVAL_P(current_field)); + ZVAL_STRINGL(current_field, tmp, tmp_len); + */ bit_area += 1 + sprintf((char *)start, ZEND_LONG_FMT, Z_LVAL_P(current_field)); ZVAL_STRINGL(current_field, (char *) start, bit_area - start - 1); - } else if (Z_TYPE_P(current_field) == IS_STRING){ + } else if (Z_TYPE_P(current_field) == IS_STRING) { + /* + Andrey : This is totally sensless, but I am not gonna remove it in a production version. + This copies the data from the zval to the bit area. The destroys the original value + and creates the same one from the bit area. No need. It was making sense in pre-7.0 + when we used zval IS_STRING with no-copy that referred to the bit area. + The bit area has no sense in both the case of IS_LONG and IS_STRING as 7.0 zval + IS_STRING always copies. + */ memcpy(bit_area, Z_STRVAL_P(current_field), Z_STRLEN_P(current_field)); bit_area += Z_STRLEN_P(current_field); *bit_area++ = '\0'; @@ -1815,7 +1832,15 @@ php_mysqlnd_rowp_read(void * _packet, MYSQLND_CONN_DATA * conn) packet_type_to_statistic_packet_count[PROT_ROW_PACKET], 1); - /* packet->row_buffer->ptr is of size 'data_size + 1' */ + /* + packet->row_buffer->ptr is of size 'data_size' + in pre-7.0 it was really 'data_size + 1' although it was counted as 'data_size' + The +1 was for the additional byte needed to \0 terminate the last string in the row. + This was needed as the zvals of pre-7.0 could use external memory (no copy param to ZVAL_STRINGL). + However, in 7.0+ the strings always copy. Thus this +1 byte was removed. Also the optimization or \0 + terminating every string, which did overwrite the lengths from the packet. For this reason we needed + to keep (and copy) the lengths externally. + */ packet->header.size = data_size; packet->row_buffer->app = data_size; diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 1491c88097..676e3939a8 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -582,7 +582,7 @@ static void accel_use_shm_interned_strings(void) for (j = 0; j < ce->constants_table.nNumUsed; j++) { q = ce->constants_table.arData + j; - if (!Z_TYPE(q->val) == IS_UNDEF) continue; + if (Z_TYPE(q->val) == IS_UNDEF) continue; if (q->key) { q->key = accel_new_interned_string(q->key); } @@ -592,7 +592,7 @@ static void accel_use_shm_interned_strings(void) /* constant hash keys */ for (idx = 0; idx < EG(zend_constants)->nNumUsed; idx++) { p = EG(zend_constants)->arData + idx; - if (!Z_TYPE(p->val) == IS_UNDEF) continue; + if (Z_TYPE(p->val) == IS_UNDEF) continue; if (p->key) { p->key = accel_new_interned_string(p->key); } @@ -1769,10 +1769,10 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type) file_handle->type == ZEND_HANDLE_FILENAME && UNEXPECTED(access(ZSTR_VAL(persistent_script->full_path), R_OK) != 0)) { if (type == ZEND_REQUIRE) { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename TSRMLS_CC); + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename); zend_bailout(); } else { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename TSRMLS_CC); + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename); } return NULL; } diff --git a/ext/opcache/tests/php_cli_server.inc b/ext/opcache/tests/php_cli_server.inc index 0878bfafc0..ca6854f553 100644 --- a/ext/opcache/tests/php_cli_server.inc +++ b/ext/opcache/tests/php_cli_server.inc @@ -20,28 +20,43 @@ function php_cli_server_start($ini = "") { $cmd = "exec {$php_executable} -t {$doc_root} $ini -S " . PHP_CLI_SERVER_ADDRESS . " 2>/dev/null"; $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root); } - + // note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.' // it might not be listening yet...need to wait until fsockopen() call returns - $i = 0; - while (($i++ < 30) && !($fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT))) { - usleep(10000); - } + $error = "Unable to connect to servers\n"; + for ($i=0; $i < 60; $i++) { + usleep(25000); // 25ms per try + $status = proc_get_status($handle); + $fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT); + // Failure, the server is no longer running + if (!($status && $status['running'])) { + $error = "Server is not running\n"; + break; + } + // Success, Connected to servers + if ($fp) { + $error = ''; + break; + } + } - if ($fp) { - fclose($fp); - } + if ($fp) { + fclose($fp); + } + + if ($error) { + echo $error; + proc_terminate($handle); + exit(1); + } register_shutdown_function( function($handle) { proc_terminate($handle); }, - $handle - ); - // don't bother sleeping, server is already up - // server can take a variable amount of time to be up, so just sleeping a guessed amount of time - // does not work. this is why tests sometimes pass and sometimes fail. to get a reliable pass - // sleeping doesn't work. + $handle + ); + } ?> diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index b6c8e13fd8..cbc3f24583 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -107,8 +107,6 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption) #else char *base = (char *) ts_resource(*((int *) mh_arg2)); #endif - zend_long megabyte, overflow; - double dummy; /* keep the compiler happy */ (void)entry; (void)mh_arg2; (void)mh_arg3; (void)stage; @@ -132,10 +130,10 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption) ini_entry->value = zend_string_init(new_new_value, 1, 1); } - megabyte = 1024 * 1024; - ZEND_SIGNED_MULTIPLY_LONG(memsize, megabyte, *p, dummy, overflow); - if (UNEXPECTED(overflow)) { + if (UNEXPECTED(memsize > ZEND_ULONG_MAX / (1024 * 1024))) { *p = ZEND_ULONG_MAX; + } else { + *p = memsize * (1024 * 1024); } return SUCCESS; } diff --git a/ext/openssl/tests/ServerClientTestCase.inc b/ext/openssl/tests/ServerClientTestCase.inc index 03e0c2de87..fe46300389 100644 --- a/ext/openssl/tests/ServerClientTestCase.inc +++ b/ext/openssl/tests/ServerClientTestCase.inc @@ -48,8 +48,12 @@ class ServerClientTestCase private function spawnWorkerProcess($code) { - $cmd = sprintf('%s "%s" %s', PHP_BINARY, __FILE__, WORKER_ARGV_VALUE); - + if (defined("PHP_WINDOWS_VERSION_MAJOR")) { + $ini = php_ini_loaded_file(); + $cmd = sprintf('%s %s "%s" %s', PHP_BINARY, $ini ? "-n -c $ini" : "", __FILE__, WORKER_ARGV_VALUE); + } else { + $cmd = sprintf('%s "%s" %s', PHP_BINARY, __FILE__, WORKER_ARGV_VALUE); + } $this->workerHandle = proc_open($cmd, [['pipe', 'r'], ['pipe', 'w'], STDERR], $pipes); $this->workerStdIn = $pipes[0]; $this->workerStdOut = $pipes[1]; diff --git a/ext/openssl/tests/openssl_pkey_new_basic.phpt b/ext/openssl/tests/openssl_pkey_new_basic.phpt index b0fd530975..b73b1f580c 100644 --- a/ext/openssl/tests/openssl_pkey_new_basic.phpt +++ b/ext/openssl/tests/openssl_pkey_new_basic.phpt @@ -89,7 +89,7 @@ var_dump($dh_details['g']); var_dump(strlen($dh_details['pub_key'])); var_dump(strlen($dh_details['priv_key'])); ?> ---EXPECT-- +--EXPECTF-- int(0) int(0) int(0) @@ -98,9 +98,9 @@ int(0) int(0) int(0) int(0) -int(20) -int(128) +int(%d) +int(%d) int(0) string(1) "2" -int(128) -int(128) +int(%d) +int(%d) diff --git a/ext/openssl/tests/openssl_x509_parse_basic.phpt b/ext/openssl/tests/openssl_x509_parse_basic.phpt index 00e32c3b60..9c2669e73b 100644 --- a/ext/openssl/tests/openssl_x509_parse_basic.phpt +++ b/ext/openssl/tests/openssl_x509_parse_basic.phpt @@ -3,6 +3,14 @@ openssl_x509_parse() tests --SKIPIF-- <?php if (!extension_loaded("openssl")) print "skip"; if (OPENSSL_VERSION_NUMBER < 0x10000000) die("skip Output requires OpenSSL 1.0"); +if(substr(PHP_OS, 0, 3) == 'WIN') { + $exp = "W. Europe Standard Time"; + $cmd = "powershell -command [System.TimeZoneInfo]::Local.Id"; + $r = trim(shell_exec($cmd)); + if ($exp !== $r) { + die("skip expect '$exp', got '$r'"); + } +} ?> --FILE-- <?php diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index 208aafcd7b..f9697d0483 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -1599,8 +1599,8 @@ int php_openssl_setup_crypto(php_stream *stream, if (sslsock->is_client) { SSL_CTX_set_alpn_protos(sslsock->ctx, alpn, alpn_len); } else { - sslsock->alpn_ctx = (php_openssl_alpn_ctx *) emalloc(sizeof(php_openssl_alpn_ctx)); - sslsock->alpn_ctx->data = (unsigned char*)estrndup((const char*)alpn, alpn_len); + sslsock->alpn_ctx = (php_openssl_alpn_ctx *) pemalloc(sizeof(php_openssl_alpn_ctx), php_stream_is_persistent(stream)); + sslsock->alpn_ctx->data = (unsigned char *) pestrndup((const char*)alpn, alpn_len, php_stream_is_persistent(stream)); sslsock->alpn_ctx->len = alpn_len; SSL_CTX_set_alpn_select_cb(sslsock->ctx, server_alpn_callback, sslsock); } @@ -1632,6 +1632,13 @@ int php_openssl_setup_crypto(php_stream *stream, php_error_docref(NULL, E_WARNING, "SSL handle creation failure"); SSL_CTX_free(sslsock->ctx); sslsock->ctx = NULL; +#ifdef HAVE_TLS_ALPN + if (sslsock->alpn_ctx) { + pefree(sslsock->alpn_ctx->data, php_stream_is_persistent(stream)); + pefree(sslsock->alpn_ctx, php_stream_is_persistent(stream)); + sslsock->alpn_ctx = NULL; + } +#endif return FAILURE; } else { SSL_set_ex_data(sslsock->ssl_handle, php_openssl_get_ssl_stream_data_index(), stream); @@ -2137,6 +2144,12 @@ static int php_openssl_sockop_close(php_stream *stream, int close_handle) /* {{{ SSL_CTX_free(sslsock->ctx); sslsock->ctx = NULL; } +#ifdef HAVE_TLS_ALPN + if (sslsock->alpn_ctx) { + pefree(sslsock->alpn_ctx->data, php_stream_is_persistent(stream)); + pefree(sslsock->alpn_ctx, php_stream_is_persistent(stream)); + } +#endif #ifdef PHP_WIN32 if (sslsock->s.socket == -1) sslsock->s.socket = SOCK_ERR; diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index b1ffe7f228..af1916aa45 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -114,9 +114,6 @@ static void php_free_pcre_cache(zval *data) /* {{{ */ } #if HAVE_SETLOCALE if ((void*)pce->tables) pefree((void*)pce->tables, 1); - if (pce->locale) { - zend_string_release(pce->locale); - } #endif pefree(pce, 1); } @@ -320,27 +317,30 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) pcre_cache_entry *pce; pcre_cache_entry new_entry; int rc; + zend_string *key; + +#if HAVE_SETLOCALE + if (BG(locale_string) && + (ZSTR_LEN(BG(locale_string)) != 1 && ZSTR_VAL(BG(locale_string))[0] != 'C')) { + key = zend_string_alloc(ZSTR_LEN(regex) + ZSTR_LEN(BG(locale_string)) + 1, 0); + memcpy(ZSTR_VAL(key), ZSTR_VAL(BG(locale_string)), ZSTR_LEN(BG(locale_string)) + 1); + memcpy(ZSTR_VAL(key) + ZSTR_LEN(BG(locale_string)), ZSTR_VAL(regex), ZSTR_LEN(regex) + 1); + } else +#endif + { + key = regex; + } /* Try to lookup the cached regex entry, and if successful, just pass back the compiled pattern, otherwise go on and compile it. */ - pce = zend_hash_find_ptr(&PCRE_G(pcre_cache), regex); + pce = zend_hash_find_ptr(&PCRE_G(pcre_cache), key); if (pce) { #if HAVE_SETLOCALE - if (pce->locale == BG(locale_string) || - (pce->locale && BG(locale_string) && - ZSTR_LEN(pce->locale) == ZSTR_LEN(BG(locale_string)) && - !memcmp(ZSTR_VAL(pce->locale), ZSTR_VAL(BG(locale_string)), ZSTR_LEN(pce->locale))) || - (!pce->locale && - ZSTR_LEN(BG(locale_string)) == 1 && - ZSTR_VAL(BG(locale_string))[0] == 'C') || - (!BG(locale_string) && - ZSTR_LEN(pce->locale) == 1 && - ZSTR_VAL(pce->locale)[0] == 'C')) { - return pce; + if (key != regex) { + zend_string_release(key); } -#else - return pce; #endif + return pce; } p = ZSTR_VAL(regex); @@ -349,6 +349,11 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) get to the end without encountering a delimiter. */ while (isspace((int)*(unsigned char *)p)) p++; if (*p == 0) { +#if HAVE_SETLOCALE + if (key != regex) { + zend_string_release(key); + } +#endif php_error_docref(NULL, E_WARNING, p < ZSTR_VAL(regex) + ZSTR_LEN(regex) ? "Null byte in regex" : "Empty regular expression"); return NULL; @@ -358,6 +363,11 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) or a backslash. */ delimiter = *p++; if (isalnum((int)*(unsigned char *)&delimiter) || delimiter == '\\') { +#if HAVE_SETLOCALE + if (key != regex) { + zend_string_release(key); + } +#endif php_error_docref(NULL,E_WARNING, "Delimiter must not be alphanumeric or backslash"); return NULL; } @@ -397,6 +407,11 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) } if (*pp == 0) { +#if HAVE_SETLOCALE + if (key != regex) { + zend_string_release(key); + } +#endif if (pp < ZSTR_VAL(regex) + ZSTR_LEN(regex)) { php_error_docref(NULL,E_WARNING, "Null byte in regex"); } else if (start_delimiter == end_delimiter) { @@ -453,13 +468,17 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) php_error_docref(NULL,E_WARNING, "Null byte in regex"); } efree(pattern); +#if HAVE_SETLOCALE + if (key != regex) { + zend_string_release(key); + } +#endif return NULL; } } #if HAVE_SETLOCALE - if (BG(locale_string) && - (ZSTR_LEN(BG(locale_string)) != 1 || ZSTR_VAL(BG(locale_string))[0] != 'C')) { + if (key != regex) { tables = pcre_maketables(); } #endif @@ -472,6 +491,11 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) tables); if (re == NULL) { +#if HAVE_SETLOCALE + if (key != regex) { + zend_string_release(key); + } +#endif php_error_docref(NULL,E_WARNING, "Compilation failed: %s at offset %d", error, erroffset); efree(pattern); if (tables) { @@ -516,7 +540,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) * these are supposedly the oldest ones (but not necessarily the least used * ones). */ - if (zend_hash_num_elements(&PCRE_G(pcre_cache)) == PCRE_CACHE_SIZE) { + if (!pce && zend_hash_num_elements(&PCRE_G(pcre_cache)) == PCRE_CACHE_SIZE) { int num_clean = PCRE_CACHE_SIZE / 8; zend_hash_apply_with_argument(&PCRE_G(pcre_cache), pcre_clean_cache, &num_clean); } @@ -527,23 +551,29 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) new_entry.preg_options = poptions; new_entry.compile_options = coptions; #if HAVE_SETLOCALE - new_entry.locale = BG(locale_string) ? - ((GC_FLAGS(BG(locale_string)) & IS_STR_PERSISTENT) ? - zend_string_copy(BG(locale_string)) : - zend_string_init(ZSTR_VAL(BG(locale_string)), ZSTR_LEN(BG(locale_string)), 1)) : - NULL; + new_entry.locale = NULL; new_entry.tables = tables; #endif new_entry.refcount = 0; rc = pcre_fullinfo(re, extra, PCRE_INFO_CAPTURECOUNT, &new_entry.capture_count); if (rc < 0) { +#if HAVE_SETLOCALE + if (key != regex) { + zend_string_release(key); + } +#endif php_error_docref(NULL, E_WARNING, "Internal pcre_fullinfo() error %d", rc); return NULL; } rc = pcre_fullinfo(re, extra, PCRE_INFO_NAMECOUNT, &new_entry.name_count); if (rc < 0) { +#if HAVE_SETLOCALE + if (key != regex) { + zend_string_release(key); + } +#endif php_error_docref(NULL, E_WARNING, "Internal pcre_fullinfo() error %d", rc); return NULL; } @@ -556,15 +586,18 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) * as hash keys especually for this table. * See bug #63180 */ - if (!ZSTR_IS_INTERNED(regex) || !(GC_FLAGS(regex) & IS_STR_PERMANENT)) { - zend_string *str = zend_string_init(ZSTR_VAL(regex), ZSTR_LEN(regex), 1); - GC_REFCOUNT(str) = 0; /* will be incremented by zend_hash_update_mem() */ - ZSTR_H(str) = ZSTR_H(regex); - regex = str; + if (!ZSTR_IS_INTERNED(key) || !(GC_FLAGS(key) & IS_STR_PERMANENT)) { + pce = zend_hash_str_update_mem(&PCRE_G(pcre_cache), + ZSTR_VAL(key), ZSTR_LEN(key), &new_entry, sizeof(pcre_cache_entry)); +#if HAVE_SETLOCALE + if (key != regex) { + zend_string_release(key); + } +#endif + } else { + pce = zend_hash_update_mem(&PCRE_G(pcre_cache), key, &new_entry, sizeof(pcre_cache_entry)); } - pce = zend_hash_update_mem(&PCRE_G(pcre_cache), regex, &new_entry, sizeof(pcre_cache_entry)); - return pce; } /* }}} */ @@ -693,7 +726,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec /* Overwrite the passed-in value for subpatterns with an empty array. */ if (subpats != NULL) { - zval_dtor(subpats); + zval_ptr_dtor(subpats); array_init(subpats); } @@ -1559,7 +1592,7 @@ static PHP_FUNCTION(preg_replace) replace_count = preg_replace_impl(return_value, regex, replace, subject, limit, 0, 0); if (zcount) { - zval_dtor(zcount); + zval_ptr_dtor(zcount); ZVAL_LONG(zcount, replace_count); } } @@ -1594,7 +1627,7 @@ static PHP_FUNCTION(preg_replace_callback) replace_count = preg_replace_impl(return_value, regex, replace, subject, limit, 1, 0); if (zcount) { - zval_dtor(zcount); + zval_ptr_dtor(zcount); ZVAL_LONG(zcount, replace_count); } } @@ -1656,7 +1689,7 @@ static PHP_FUNCTION(preg_replace_callback_array) } ZEND_HASH_FOREACH_END(); if (zcount) { - zval_dtor(zcount); + zval_ptr_dtor(zcount); ZVAL_LONG(zcount, replace_count); } } @@ -1687,7 +1720,7 @@ static PHP_FUNCTION(preg_filter) replace_count = preg_replace_impl(return_value, regex, replace, subject, limit, 0, 1); if (zcount) { - zval_dtor(zcount); + zval_ptr_dtor(zcount); ZVAL_LONG(zcount, replace_count); } } diff --git a/ext/pcre/tests/bug73483.phpt b/ext/pcre/tests/bug73483.phpt new file mode 100644 index 0000000000..fd10702527 --- /dev/null +++ b/ext/pcre/tests/bug73483.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #73483 (Segmentation fault on pcre_replace_callback) +--FILE-- +<?php +$regex = "#dummy#"; +setlocale(LC_ALL, "C"); +var_dump(preg_replace_callback($regex, function (array $matches) use($regex) { + setlocale(LC_ALL, "en_US"); + $ret = preg_replace($regex, "okey", $matches[0]); + setlocale(LC_ALL, "C"); + return $ret; +}, "dummy")); +?> +--EXPECT-- +string(4) "okey" diff --git a/ext/pcre/tests/bug73612.phpt b/ext/pcre/tests/bug73612.phpt new file mode 100644 index 0000000000..707e10bce6 --- /dev/null +++ b/ext/pcre/tests/bug73612.phpt @@ -0,0 +1,27 @@ +--TEST--
+Bug #73612 (preg_*() may leak memory)
+--FILE--
+<?php
+$obj = new stdClass;
+$obj->obj = $obj;
+preg_match('/./', 'x', $obj);
+
+$obj = new stdClass;
+$obj->obj = $obj;
+preg_replace('/./', '', 'x', -1, $obj);
+
+$obj = new stdClass;
+$obj->obj = $obj;
+preg_replace_callback('/./', 'count', 'x', -1, $obj);
+
+$obj = new stdClass;
+$obj->obj = $obj;
+preg_replace_callback_array(['/./' => 'count'], 'x', -1, $obj);
+
+$obj = new stdClass;
+$obj->obj = $obj;
+preg_filter('/./', '', 'x', -1, $obj);
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 0ff8a04000..a33bc2158c 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -2568,7 +2568,7 @@ static int row_prop_exists(zval *object, zval *member, int check_empty, void **c int res; zval val; - fetch_value(stmt, &val, colno, NULL TSRMLS_CC); + fetch_value(stmt, &val, colno, NULL); res = check_empty ? i_zend_is_true(&val) : Z_TYPE(val) != IS_NULL; zval_dtor(&val); diff --git a/ext/pdo/tests/bug_60665.phpt b/ext/pdo/tests/bug_60665.phpt index 28c1482154..bae3d603d7 100644 --- a/ext/pdo/tests/bug_60665.phpt +++ b/ext/pdo/tests/bug_60665.phpt @@ -13,8 +13,12 @@ PDOTest::skip(); if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/'); require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); - -$statement = $db->prepare("SELECT NULL AS null_value, 0 AS zero, 1 AS one"); +switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { + case 'oci': $from = 'from dual'; break; + case 'firebird': $from = 'from rdb$database'; break; + default: $from = ''; break; +} +$statement = $db->prepare("SELECT NULL AS null_value, 0 AS zero, 1 AS one $from"); $statement->execute(); $row = $statement->fetch(PDO::FETCH_LAZY); var_dump( diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c index b26939ccd2..91cd3593ea 100644 --- a/ext/pdo_firebird/firebird_driver.c +++ b/ext/pdo_firebird/firebird_driver.c @@ -238,14 +238,16 @@ static zend_long firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, size_t sq /* execute the statement */ if (isc_dsql_execute2(H->isc_status, &H->tr, &stmt, PDO_FB_SQLDA_VERSION, &in_sqlda, &out_sqlda)) { RECORD_ERROR(dbh); - return -1; + ret = -1; + goto free_statement; } /* find out how many rows were affected */ if (isc_dsql_sql_info(H->isc_status, &stmt, sizeof(info_count), const_cast(info_count), sizeof(result), result)) { RECORD_ERROR(dbh); - return -1; + ret = -1; + goto free_statement; } if (result[0] == isc_info_sql_records) { @@ -265,6 +267,12 @@ static zend_long firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, size_t sq RECORD_ERROR(dbh); } +free_statement: + + if (isc_dsql_free_statement(H->isc_status, &stmt, DSQL_drop)) { + RECORD_ERROR(dbh); + } + return ret; } /* }}} */ diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c index 994e92864c..64968428bd 100644 --- a/ext/pdo_firebird/firebird_statement.c +++ b/ext/pdo_firebird/firebird_statement.c @@ -98,9 +98,22 @@ static int firebird_stmt_execute(pdo_stmt_t *stmt) /* {{{ */ break; } S->cursor_open = 0; - /* assume all params have been bound */ - if (isc_dsql_execute(H->isc_status, &H->tr, &S->stmt, PDO_FB_SQLDA_VERSION, S->in_sqlda)) { + /* allocate storage for the output data */ + if (S->out_sqlda.sqld) { + unsigned int i; + for (i = 0; i < S->out_sqlda.sqld; i++) { + XSQLVAR *var = &S->out_sqlda.sqlvar[i]; + var->sqlind = (void*)ecalloc(1, var->sqllen + 2 * sizeof(short)); + var->sqldata = &((char*)var->sqlind)[sizeof(short)]; + } + } + + if (S->statement_type == isc_info_sql_stmt_exec_procedure) { + if (isc_dsql_execute2(H->isc_status, &H->tr, &S->stmt, PDO_FB_SQLDA_VERSION, S->in_sqlda, &S->out_sqlda)) { + break; + } + } else if (isc_dsql_execute(H->isc_status, &H->tr, &S->stmt, PDO_FB_SQLDA_VERSION, S->in_sqlda)) { break; } @@ -139,8 +152,8 @@ static int firebird_stmt_execute(pdo_stmt_t *stmt) /* {{{ */ } *S->name = 0; - S->cursor_open = (S->out_sqlda.sqln > 0); /* A cursor is opened, when more than zero columns returned */ - S->exhausted = !S->cursor_open; + S->cursor_open = S->out_sqlda.sqln && (S->statement_type != isc_info_sql_stmt_exec_procedure); + S->exhausted = !S->out_sqlda.sqln; /* There are data to fetch */ return 1; } while (0); @@ -162,6 +175,11 @@ static int firebird_stmt_fetch(pdo_stmt_t *stmt, /* {{{ */ strcpy(stmt->error_code, "HY000"); H->last_app_error = "Cannot fetch from a closed cursor"; } else if (!S->exhausted) { + if (S->statement_type == isc_info_sql_stmt_exec_procedure) { + stmt->row_count = 1; + S->exhausted = 1; + return 1; + } if (isc_dsql_fetch(H->isc_status, &S->stmt, PDO_FB_SQLDA_VERSION, &S->out_sqlda)) { if (H->isc_status[0] && H->isc_status[1]) { RECORD_ERROR(stmt); @@ -169,9 +187,6 @@ static int firebird_stmt_fetch(pdo_stmt_t *stmt, /* {{{ */ S->exhausted = 1; return 0; } - if (S->statement_type == isc_info_sql_stmt_exec_procedure) { - S->exhausted = 1; - } stmt->row_count++; return 1; } @@ -188,10 +203,6 @@ static int firebird_stmt_describe(pdo_stmt_t *stmt, int colno) /* {{{ */ int colname_len; char *cp; - /* allocate storage for the column */ - var->sqlind = (void*)ecalloc(1, var->sqllen + 2*sizeof(short)); - var->sqldata = &((char*)var->sqlind)[sizeof(short)]; - colname_len = (S->H->fetch_table_names && var->relname_length) ? (var->aliasname_length + var->relname_length + 1) : (var->aliasname_length); diff --git a/ext/pdo_firebird/tests/bug_72931.phpt b/ext/pdo_firebird/tests/bug_72931.phpt new file mode 100644 index 0000000000..ecbde6a109 --- /dev/null +++ b/ext/pdo_firebird/tests/bug_72931.phpt @@ -0,0 +1,24 @@ +--TEST-- +PDO_Firebird: Bug 72931 Insert returning fails on Firebird 3 +--SKIPIF-- +<?php if (!extension_loaded('interbase') || !extension_loaded('pdo_firebird')) die('skip'); ?> +--FILE-- +<?php +require 'testdb.inc'; +$C = new PDO('firebird:dbname='.$test_base, $user, $password) or die; +$C->exec('create table tablea (id integer)'); +$S = $C->prepare('insert into tablea (id) values (1) returning id'); +$S->execute(); +$D = $S->fetch(PDO::FETCH_NUM); +echo $D[0][0]; +unset($S); +unset($C); +?> +--CLEAN-- +<?php +require 'testdb.inc'; +$C = new PDO('firebird:dbname='.$test_base, $user, $password) or die; +$C->exec('DROP table tablea'); +?> +--EXPECT-- +1 diff --git a/ext/pdo_firebird/tests/bug_aaa.phpt b/ext/pdo_firebird/tests/bug_aaa.phpt new file mode 100644 index 0000000000..821d59afd2 --- /dev/null +++ b/ext/pdo_firebird/tests/bug_aaa.phpt @@ -0,0 +1,19 @@ +--TEST-- +PDO_Firebird: cursor should not be marked as opened on singleton statements +--SKIPIF-- +<?php if (!extension_loaded('interbase') || !extension_loaded('pdo_firebird')) die('skip'); ?> +--FILE-- +<?php +require 'testdb.inc'; +$C = new PDO('firebird:dbname='.$test_base, $user, $password, [PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING]) or die; +@$C->exec('drop table ta_table'); +$C->exec('create table ta_table (id integer)'); +$S = $C->prepare('insert into ta_table (id) values (:id) returning id'); +$S->execute(['id' => 1]); +$S->execute(['id' => 2]); +unset($S); +unset($C); +echo 'OK'; +?> +--EXPECT-- +OK
\ No newline at end of file diff --git a/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt b/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt index ebf22ef61b..38b49b6efa 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt @@ -16,6 +16,17 @@ if (count($tmp) < 2) if (($tmp[1] !== 'localhost') && ($tmp[1] !== '127.0.0.1')) die("skip Test cannot be run against remote database server"); +$stmt = $db->query("SHOW VARIABLES LIKE 'secure_file_priv'"); +if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) { + if (!is_writable($row['value'])) + die("skip secure_file_priv directory not writable: {$row['value']}"); + + $filename = $row['value'] . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv"; + + if (file_exists($filename) && !is_writable($filename)) + die("skip {$filename} not writable"); +} + ?> --FILE-- <?php diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt index 37d9cbdb77..9b07ac2479 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt @@ -16,6 +16,17 @@ if (count($tmp) < 2) if (($tmp[1] !== 'localhost') && ($tmp[1] !== '127.0.0.1')) die("skip Test cannot be run against remote database server"); +$stmt = $db->query("SHOW VARIABLES LIKE 'secure_file_priv'"); +if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) { + if (!is_writable($row['value'])) + die("skip secure_file_priv directory not writable: {$row['value']}"); + + $filename = $row['value'] . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv"; + + if (file_exists($filename) && !is_writable($filename)) + die("skip {$filename} not writable"); +} + ?> --FILE-- <?php @@ -115,4 +126,4 @@ Warning: PDOStatement::execute(): SQLSTATE[HY000]: General error: %s in %s on li 1 => %d, 2 => %s, ) -done!
\ No newline at end of file +done! diff --git a/ext/pdo_pgsql/tests/getnotify.phpt b/ext/pdo_pgsql/tests/getnotify.phpt index c54a31604d..27eef9d740 100644 --- a/ext/pdo_pgsql/tests/getnotify.phpt +++ b/ext/pdo_pgsql/tests/getnotify.phpt @@ -71,7 +71,7 @@ var_dump($db->pgsqlGetNotify()); $t = microtime(1); $notify = $db->pgsqlGetNotify(PDO::FETCH_ASSOC, 1000); $diff = microtime(1) - $t; -var_dump($diff >= 1 || 1 - abs($diff) < .01); +var_dump($diff >= 1 || 1 - abs($diff) < .05); var_dump($notify); // Test second parameter, should return immediately because a notify is queued @@ -79,7 +79,7 @@ $db->exec("NOTIFY notifies_phpt"); $t = microtime(1); $notify = $db->pgsqlGetNotify(PDO::FETCH_ASSOC, 5000); $diff = microtime(1) - $t; -var_dump($diff < 1 || abs(1 - abs($diff)) < .01); +var_dump($diff < 1 || abs(1 - abs($diff)) < .05); var_dump(count($notify)); ?> diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 570e9ec735..46cf2fa262 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -4096,7 +4096,7 @@ PHP_FUNCTION(pg_copy_to) free_pg_null = 1; } - spprintf(&query, 0, "COPY %s TO STDOUT DELIMITERS E'%c' WITH NULL AS E'%s'", table_name, *pg_delim, pg_null_as); + spprintf(&query, 0, "COPY %s TO STDOUT DELIMITER E'%c' NULL AS E'%s'", table_name, *pg_delim, pg_null_as); while ((pgsql_result = PQgetResult(pgsql))) { PQclear(pgsql_result); @@ -4229,7 +4229,7 @@ PHP_FUNCTION(pg_copy_from) pg_null_as_free = 1; } - spprintf(&query, 0, "COPY %s FROM STDIN DELIMITERS E'%c' WITH NULL AS E'%s'", table_name, *pg_delim, pg_null_as); + spprintf(&query, 0, "COPY %s FROM STDIN DELIMITER E'%c' NULL AS E'%s'", table_name, *pg_delim, pg_null_as); while ((pgsql_result = PQgetResult(pgsql))) { PQclear(pgsql_result); } diff --git a/ext/pgsql/tests/01createdb.phpt b/ext/pgsql/tests/01createdb.phpt index 8f7a262841..aa2e43748f 100644 --- a/ext/pgsql/tests/01createdb.phpt +++ b/ext/pgsql/tests/01createdb.phpt @@ -29,6 +29,9 @@ else { echo pg_last_error()."\n"; } +// Create view here +pg_query($db,$view_def); + pg_close($db); echo "OK"; diff --git a/ext/pgsql/tests/06_bug73498.phpt b/ext/pgsql/tests/06_bug73498.phpt new file mode 100644 index 0000000000..fdb2af2f97 --- /dev/null +++ b/ext/pgsql/tests/06_bug73498.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug 73498 Incorrect DELIMITER syntax for pg_copy_to() +--SKIPIF-- +<?php include("skipif.inc"); ?> +--FILE-- +<?php + +include('config.inc'); + +$db = pg_connect($conn_str); + +$rows = pg_copy_to($db, "(select * from {$view_name})"); + +var_dump(gettype($rows)); +var_dump(count($rows) > 0); + +?> +--EXPECT-- +string(5) "array" +bool(true) diff --git a/ext/pgsql/tests/9999dropdb.phpt b/ext/pgsql/tests/9999dropdb.phpt index 8cb178b2bf..80502e54b6 100644 --- a/ext/pgsql/tests/9999dropdb.phpt +++ b/ext/pgsql/tests/9999dropdb.phpt @@ -9,6 +9,7 @@ PostgreSQL drop db include('config.inc'); $db = pg_connect($conn_str); +pg_query($db, "DROP VIEW {$view_name}"); pg_query($db, "DROP TABLE ".$table_name); @pg_query($db, "DROP TABLE ".$table_name_92); diff --git a/ext/pgsql/tests/config.inc b/ext/pgsql/tests/config.inc index 7be1e242ad..fbe58588a2 100644 --- a/ext/pgsql/tests/config.inc +++ b/ext/pgsql/tests/config.inc @@ -11,6 +11,10 @@ $table_name = "php_pgsql_test"; // test table that will be created $table_name_92 = "php_pgsql_test_92"; // test table that will be created $num_test_record = 1000; // Number of records to create +// Test view +$view_name = "php_pgsql_viewtest"; +$view_def = "CREATE VIEW {$view_name} AS SELECT * FROM {$table_name};"; + // Test table $table_def = "CREATE TABLE ${table_name} (num int, str text, bin bytea);"; $table_def_92 = "CREATE TABLE ${table_name_92} (textary text[], jsn json);"; diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 860f5132d4..d4ec1c7977 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -3287,19 +3287,33 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type) /* zip or tar-based phar */ spprintf(&name, 4096, "phar://%s/%s", file_handle->filename, ".phar/stub.php"); - if (SUCCESS == phar_orig_zend_open((const char *)name, file_handle)) { + if (SUCCESS == phar_orig_zend_open((const char *)name, &f)) { + efree(name); name = NULL; - file_handle->filename = f.filename; - if (file_handle->opened_path) { - efree(file_handle->opened_path); + + f.filename = file_handle->filename; + if (f.opened_path) { + efree(f.opened_path); + } + f.opened_path = file_handle->opened_path; + f.free_filename = file_handle->free_filename; + + switch (file_handle->type) { + case ZEND_HANDLE_STREAM: + case ZEND_HANDLE_MAPPED: + if (file_handle->handle.stream.closer && file_handle->handle.stream.handle) { + file_handle->handle.stream.closer(file_handle->handle.stream.handle); + } + file_handle->handle.stream.handle = NULL; + break; + default: + break; } - file_handle->opened_path = f.opened_path; - file_handle->free_filename = f.free_filename; - } else { *file_handle = f; } } else if (phar->flags & PHAR_FILE_COMPRESSION_MASK) { + zend_file_handle_dtor(file_handle); /* compressed phar */ file_handle->type = ZEND_HANDLE_STREAM; /* we do our own reading directly from the phar, don't change the next line */ diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index c57bdef3c6..fc31a7e536 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -61,8 +61,8 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char HashTable *_SERVER; zval *stuff; char *path_info; - int basename_len = strlen(basename); - int code; + size_t basename_len = strlen(basename); + size_t code; zval temp; /* "tweak" $_SERVER variables requested in earlier call to Phar::mungServer() */ @@ -150,7 +150,7 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char sapi_header_line ctr = {0}; size_t got; zval dummy; - int name_len; + size_t name_len; zend_file_handle file_handle; zend_op_array *new_op_array; zval result; @@ -162,9 +162,9 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char efree(basename); /* highlight source */ if (entry[0] == '/') { - name_len = spprintf(&name, 4096, "phar://%s%s", arch, entry); + spprintf(&name, 4096, "phar://%s%s", arch, entry); } else { - name_len = spprintf(&name, 4096, "phar://%s/%s", arch, entry); + spprintf(&name, 4096, "phar://%s/%s", arch, entry); } php_get_highlight_struct(&syntax_highlighter_ini); @@ -248,10 +248,10 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char PHAR_G(cwd_len) = 0; PHAR_G(cwd) = NULL; } else if (entry[0] == '/') { - PHAR_G(cwd_len) = cwd - (entry + 1); + PHAR_G(cwd_len) = (int)(cwd - (entry + 1)); PHAR_G(cwd) = estrndup(entry + 1, PHAR_G(cwd_len)); } else { - PHAR_G(cwd_len) = cwd - entry; + PHAR_G(cwd_len) = (int)(cwd - entry); PHAR_G(cwd) = estrndup(entry, PHAR_G(cwd_len)); } } @@ -322,7 +322,7 @@ static void phar_do_403(char *entry, int entry_len) /* {{{ */ } /* }}} */ -static void phar_do_404(phar_archive_data *phar, char *fname, int fname_len, char *f404, size_t f404_len, char *entry, size_t entry_len) /* {{{ */ +static void phar_do_404(phar_archive_data *phar, char *fname, int fname_len, char *f404, int f404_len, char *entry, size_t entry_len) /* {{{ */ { sapi_header_line ctr = {0}; phar_entry_info *info; @@ -398,7 +398,7 @@ static void phar_postprocess_ru_web(char *fname, int fname_len, char **entry, in } u[0] = '\0'; - u_len = strlen(u + 1); + u_len = (int)strlen(u + 1); e_len -= u_len + 1; if (e_len < 0) { @@ -426,7 +426,7 @@ PHP_METHOD(Phar, running) } fname = (char*)zend_get_executed_filename(); - fname_len = strlen(fname); + fname_len = (int)strlen(fname); if (fname_len > 7 && !memcmp(fname, "phar://", 7) && SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) { efree(entry); @@ -463,8 +463,12 @@ PHP_METHOD(Phar, mount) return; } + if (ZEND_SIZE_T_INT_OVFL(path_len) || ZEND_SIZE_T_INT_OVFL(actual_len)) { + RETURN_FALSE; + } + fname = (char*)zend_get_executed_filename(); - fname_len = strlen(fname); + fname_len = (int)strlen(fname); #ifdef PHP_WIN32 phar_unixify_path_separators(fname, fname_len); @@ -495,7 +499,7 @@ carry_on2: return; } carry_on: - if (SUCCESS != phar_mount_entry(pphar, actual, actual_len, path, path_len)) { + if (SUCCESS != phar_mount_entry(pphar, actual, (int)actual_len, path, (int)path_len)) { zend_throw_exception_ex(phar_ce_PharException, 0, "Mounting of %s to %s within phar %s failed", path, actual, arch); if (path && path == entry) { efree(entry); @@ -525,7 +529,7 @@ carry_on: } goto carry_on; - } else if (SUCCESS == phar_split_fname(path, path_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) { + } else if (SUCCESS == phar_split_fname(path, (int)path_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) { path = entry; path_len = entry_len; goto carry_on2; @@ -564,7 +568,12 @@ PHP_METHOD(Phar, webPhar) fname = (char*)zend_get_executed_filename(); fname_len = strlen(fname); - if (phar_open_executed_filename(alias, alias_len, &error) != SUCCESS) { + if (ZEND_SIZE_T_INT_OVFL(alias_len) + || ZEND_SIZE_T_INT_OVFL(f404_len) || ZEND_SIZE_T_INT_OVFL(index_php_len)) { + RETURN_FALSE; + } + + if (phar_open_executed_filename(alias, (int)alias_len, &error) != SUCCESS) { if (error) { zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error); efree(error); @@ -605,7 +614,7 @@ PHP_METHOD(Phar, webPhar) if (NULL != (z_path_info = zend_hash_str_find(_server, "PATH_INFO", sizeof("PATH_INFO")-1)) && IS_STRING == Z_TYPE_P(z_path_info)) { - entry_len = Z_STRLEN_P(z_path_info); + entry_len = (int)Z_STRLEN_P(z_path_info); entry = estrndup(Z_STRVAL_P(z_path_info), entry_len); path_info = emalloc(Z_STRLEN_P(z_script_name) + entry_len + 1); memcpy(path_info, Z_STRVAL_P(z_script_name), Z_STRLEN_P(z_script_name)); @@ -632,7 +641,7 @@ PHP_METHOD(Phar, webPhar) if (path_info) { entry = path_info; - entry_len = strlen(entry); + entry_len = (int)strlen(entry); spprintf(&path_info, 0, "%s%s", testit, path_info); free_pathinfo = 1; } else { @@ -653,7 +662,7 @@ PHP_METHOD(Phar, webPhar) return; } - entry_len = strlen(path_info); + entry_len = (int)strlen(path_info); entry_len -= (pt - path_info) + (fname_len - (basename - fname)); entry = estrndup(pt + (fname_len - (basename - fname)), entry_len); @@ -706,8 +715,12 @@ PHP_METHOD(Phar, webPhar) switch (Z_TYPE(retval)) { case IS_STRING: efree(entry); + if (ZEND_SIZE_T_INT_OVFL(Z_STRLEN_P(fci.retval))) { + zend_throw_exception_ex(phar_ce_PharException, 0, "phar error: rewrite callback returned oversized value"); + return; + } entry = estrndup(Z_STRVAL_P(fci.retval), Z_STRLEN_P(fci.retval)); - entry_len = Z_STRLEN_P(fci.retval); + entry_len = (int)Z_STRLEN_P(fci.retval); break; case IS_TRUE: case IS_FALSE: @@ -730,7 +743,7 @@ PHP_METHOD(Phar, webPhar) } if (entry_len) { - phar_postprocess_ru_web(fname, fname_len, &entry, &entry_len, &ru, &ru_len); + phar_postprocess_ru_web(fname, (int)fname_len, &entry, &entry_len, &ru, &ru_len); } if (!entry_len || (entry_len == 1 && entry[0] == '/')) { @@ -738,7 +751,7 @@ PHP_METHOD(Phar, webPhar) /* direct request */ if (index_php_len) { entry = index_php; - entry_len = index_php_len; + entry_len = (int)index_php_len; if (entry[0] != '/') { spprintf(&entry, 0, "/%s", index_php); ++entry_len; @@ -749,9 +762,9 @@ PHP_METHOD(Phar, webPhar) entry_len = sizeof("/index.php")-1; } - if (FAILURE == phar_get_archive(&phar, fname, fname_len, NULL, 0, NULL) || + if (FAILURE == phar_get_archive(&phar, fname, (int)fname_len, NULL, 0, NULL) || (info = phar_get_entry_info(phar, entry, entry_len, NULL, 0)) == NULL) { - phar_do_404(phar, fname, fname_len, f404, f404_len, entry, entry_len); + phar_do_404(phar, fname, (int)fname_len, f404, (int)f404_len, entry, entry_len); if (free_pathinfo) { efree(path_info); @@ -795,9 +808,9 @@ PHP_METHOD(Phar, webPhar) } } - if (FAILURE == phar_get_archive(&phar, fname, fname_len, NULL, 0, NULL) || + if (FAILURE == phar_get_archive(&phar, fname, (int)fname_len, NULL, 0, NULL) || (info = phar_get_entry_info(phar, entry, entry_len, NULL, 0)) == NULL) { - phar_do_404(phar, fname, fname_len, f404, f404_len, entry, entry_len); + phar_do_404(phar, fname, (int)fname_len, f404, (int)f404_len, entry, entry_len); #ifdef PHP_WIN32 efree(fname); #endif @@ -816,7 +829,7 @@ PHP_METHOD(Phar, webPhar) case IS_LONG: if (Z_LVAL_P(val) == PHAR_MIME_PHP || Z_LVAL_P(val) == PHAR_MIME_PHPS) { mime_type = ""; - code = Z_LVAL_P(val); + code = (int)Z_LVAL_P(val); } else { zend_throw_exception_ex(phar_ce_PharException, 0, "Unknown mime type specifier used, only Phar::PHP, Phar::PHPS and a mime type string are allowed"); if (free_pathinfo) { @@ -965,9 +978,12 @@ PHP_METHOD(Phar, mapPhar) return; } + if (ZEND_SIZE_T_INT_OVFL(alias_len)) { + RETURN_FALSE; + } phar_request_initialize(); - RETVAL_BOOL(phar_open_executed_filename(alias, alias_len, &error) == SUCCESS); + RETVAL_BOOL(phar_open_executed_filename(alias, (int)alias_len, &error) == SUCCESS); if (error) { zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error); @@ -986,9 +1002,12 @@ PHP_METHOD(Phar, loadPhar) return; } + if (ZEND_SIZE_T_INT_OVFL(alias_len) || ZEND_SIZE_T_INT_OVFL(fname_len)) { + RETURN_FALSE; + } phar_request_initialize(); - RETVAL_BOOL(phar_open_from_filename(fname, fname_len, alias, alias_len, REPORT_ERRORS, NULL, &error) == SUCCESS); + RETVAL_BOOL(phar_open_from_filename(fname, (int)fname_len, alias, (int)alias_len, REPORT_ERRORS, NULL, &error) == SUCCESS); if (error) { zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error); @@ -1066,8 +1085,12 @@ PHP_METHOD(Phar, isValidPharFilename) return; } + if (ZEND_SIZE_T_INT_OVFL(fname_len)) { + RETURN_FALSE; + } + is_executable = executable; - RETVAL_BOOL(phar_detect_phar_fname_ext(fname, fname_len, &ext_str, &ext_len, is_executable, 2, 1) == SUCCESS); + RETVAL_BOOL(phar_detect_phar_fname_ext(fname, (int)fname_len, &ext_str, &ext_len, is_executable, 2, 1) == SUCCESS); } /* }}} */ @@ -1143,6 +1166,9 @@ PHP_METHOD(Phar, __construct) } } + if (ZEND_SIZE_T_INT_OVFL(alias_len) || ZEND_SIZE_T_INT_OVFL(fname_len)) { + RETURN_FALSE; + } if (phar_obj->archive) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot call constructor twice"); return; @@ -1166,7 +1192,7 @@ PHP_METHOD(Phar, __construct) #endif } - if (phar_open_or_create_filename(fname, fname_len, alias, alias_len, is_data, REPORT_ERRORS, &phar_data, &error) == FAILURE) { + if (phar_open_or_create_filename(fname, (int)fname_len, alias, (int)alias_len, is_data, REPORT_ERRORS, &phar_data, &error) == FAILURE) { if (fname == arch && fname != save_fname) { efree(arch); @@ -1311,12 +1337,15 @@ PHP_METHOD(Phar, unlinkArchive) RETURN_FALSE; } + if (ZEND_SIZE_T_INT_OVFL(fname_len)) { + RETURN_FALSE; + } if (!fname_len) { zend_throw_exception_ex(phar_ce_PharException, 0, "Unknown phar archive \"\""); return; } - if (FAILURE == phar_open_from_filename(fname, fname_len, NULL, 0, REPORT_ERRORS, &phar, &error)) { + if (FAILURE == phar_open_from_filename(fname, (int)fname_len, NULL, 0, REPORT_ERRORS, &phar, &error)) { if (error) { zend_throw_exception_ex(phar_ce_PharException, 0, "Unknown phar archive \"%s\": %s", fname, error); efree(error); @@ -1327,7 +1356,7 @@ PHP_METHOD(Phar, unlinkArchive) } zname = (char*)zend_get_executed_filename(); - zname_len = strlen(zname); + zname_len = (int)strlen(zname); if (zname_len > 7 && !memcmp(zname, "phar://", 7) && SUCCESS == phar_split_fname(zname, zname_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) { if (arch_len == fname_len && !memcmp(arch, fname, arch_len)) { @@ -1403,9 +1432,10 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */ zval *value; zend_bool close_fp = 1; struct _phar_t *p_obj = (struct _phar_t*) puser; - uint str_key_len, base_len = p_obj->l, fname_len; + uint base_len = p_obj->l, str_key_len; phar_entry_data *data; php_stream *fp; + php_stat_len fname_len; size_t contents_len; char *fname, *error = NULL, *base = p_obj->b, *save = NULL, *temp = NULL; zend_string *opened; @@ -1450,7 +1480,13 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */ return ZEND_HASH_APPLY_STOP; } - str_key_len = Z_STRLEN(key); + if (ZEND_SIZE_T_INT_OVFL(Z_STRLEN(key))) { + zval_dtor(&key); + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid key (too long)", ZSTR_VAL(ce->name)); + return ZEND_HASH_APPLY_STOP; + } + + str_key_len = (int)Z_STRLEN(key); str_key = estrndup(Z_STRVAL(key), str_key_len); save = str_key; @@ -1477,7 +1513,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */ switch (intern->type) { case SPL_FS_DIR: test = spl_filesystem_object_get_path(intern, NULL); - fname_len = spprintf(&fname, 0, "%s%c%s", test, DEFAULT_SLASH, intern->u.dir.entry.d_name); + fname_len = (php_stat_len)spprintf(&fname, 0, "%s%c%s", test, DEFAULT_SLASH, intern->u.dir.entry.d_name); php_stat(fname, fname_len, FS_IS_DIR, &dummy); if (Z_TYPE(dummy) == IS_TRUE) { @@ -1491,7 +1527,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */ if (test) { fname = test; - fname_len = strlen(fname); + fname_len = (php_stat_len)strlen(fname); } else { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Could not resolve file path"); return ZEND_HASH_APPLY_STOP; @@ -1507,7 +1543,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */ return ZEND_HASH_APPLY_STOP; } - fname_len = strlen(fname); + fname_len = (php_stat_len)strlen(fname); save = fname; goto phar_spl_fileinfo; } @@ -1519,7 +1555,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */ } fname = Z_STRVAL_P(value); - fname_len = Z_STRLEN_P(value); + fname_len = (php_stat_len)Z_STRLEN_P(value); phar_spl_fileinfo: if (base_len) { @@ -1533,7 +1569,7 @@ phar_spl_fileinfo: } base = temp; - base_len = strlen(base); + base_len = (int)strlen(base); if (strstr(fname, base)) { str_key_len = fname_len - base_len; @@ -1578,7 +1614,13 @@ phar_spl_fileinfo: return ZEND_HASH_APPLY_STOP; } - str_key_len = Z_STRLEN(key); + if (ZEND_SIZE_T_INT_OVFL(Z_STRLEN(key))) { + zval_dtor(&key); + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid key (too long)", ZSTR_VAL(ce->name)); + return ZEND_HASH_APPLY_STOP; + } + + str_key_len = (int)Z_STRLEN(key); str_key = estrndup(Z_STRVAL(key), str_key_len); save = str_key; @@ -1743,6 +1785,10 @@ PHP_METHOD(Phar, buildFromDirectory) RETURN_FALSE; } + if (ZEND_SIZE_T_UINT_OVFL(dir_len)) { + RETURN_FALSE; + } + if (SUCCESS != object_init_ex(&iter, spl_ce_RecursiveDirectoryIterator)) { zval_ptr_dtor(&iter); zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Unable to instantiate directory iterator for %s", phar_obj->archive->fname); @@ -1801,7 +1847,7 @@ PHP_METHOD(Phar, buildFromDirectory) pass.c = apply_reg ? Z_OBJCE(regexiter) : Z_OBJCE(iteriter); pass.p = phar_obj; pass.b = dir; - pass.l = dir_len; + pass.l = (uint)dir_len; pass.count = 0; pass.ret = return_value; pass.fp = php_stream_fopen_tmpfile(); @@ -1875,6 +1921,10 @@ PHP_METHOD(Phar, buildFromIterator) RETURN_FALSE; } + if (ZEND_SIZE_T_UINT_OVFL(base_len)) { + RETURN_FALSE; + } + if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) { zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname); return; @@ -1885,7 +1935,7 @@ PHP_METHOD(Phar, buildFromIterator) pass.c = Z_OBJCE_P(obj); pass.p = phar_obj; pass.b = base; - pass.l = base_len; + pass.l = (uint)base_len; pass.ret = return_value; pass.count = 0; pass.fp = php_stream_fopen_tmpfile(); @@ -2008,7 +2058,7 @@ static zend_object *phar_rename_archive(phar_archive_data **sphar, char *ext, ze char *error; const char *pcr_error; int ext_len = ext ? strlen(ext) : 0; - int oldname_len; + size_t new_len, oldname_len; phar_archive_data *pphar = NULL; php_stream_statbuf ssb; @@ -2084,10 +2134,16 @@ static zend_object *phar_rename_archive(phar_archive_data **sphar, char *ext, ze spprintf(&newname, 0, "%s.%s", strtok(basename, "."), ext); efree(basename); - - basepath = estrndup(oldpath, (strlen(oldpath) - oldname_len)); - phar->fname_len = spprintf(&newpath, 0, "%s%s", basepath, newname); + new_len = spprintf(&newpath, 0, "%s%s", basepath, newname); + if (ZEND_SIZE_T_INT_OVFL(new_len)) { + efree(oldpath); + efree(basepath); + efree(newpath); + zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "New name is too long"); + return NULL; + } + phar->fname_len = (int)new_len; phar->fname = newpath; phar->ext = newpath + phar->fname_len - strlen(ext) - 1; efree(basepath); @@ -2140,7 +2196,7 @@ its_ok: phar->alias_len = 0; } else { phar->alias = estrndup(newpath, strlen(newpath)); - phar->alias_len = strlen(newpath); + phar->alias_len = (int)strlen(newpath); phar->is_temporary_alias = 1; zend_hash_str_update_ptr(&(PHAR_G(phar_alias_map)), newpath, phar->fname_len, phar); } @@ -2403,7 +2459,7 @@ PHP_METHOD(Phar, convertToExecutable) is_data = phar_obj->archive->is_data; phar_obj->archive->is_data = 0; - ret = phar_convert_to_other(phar_obj->archive, format, ext, flags); + ret = phar_convert_to_other(phar_obj->archive, (int)format, ext, flags); phar_obj->archive->is_data = is_data; if (ret) { @@ -2506,7 +2562,7 @@ PHP_METHOD(Phar, convertToData) is_data = phar_obj->archive->is_data; phar_obj->archive->is_data = 1; - ret = phar_convert_to_other(phar_obj->archive, format, ext, flags); + ret = phar_convert_to_other(phar_obj->archive, (int)format, ext, flags); phar_obj->archive->is_data = is_data; if (ret) { @@ -2687,12 +2743,15 @@ PHP_METHOD(Phar, setAlias) } if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &alias, &alias_len) == SUCCESS) { + if (ZEND_SIZE_T_INT_OVFL(alias_len)) { + RETURN_FALSE; + } if (alias_len == phar_obj->archive->alias_len && memcmp(phar_obj->archive->alias, alias, alias_len) == 0) { RETURN_TRUE; } if (alias_len && NULL != (fd_ptr = zend_hash_str_find_ptr(&(PHAR_G(phar_alias_map)), alias, alias_len))) { spprintf(&error, 0, "alias \"%s\" is already used for archive \"%s\" and cannot be used for other archives", alias, fd_ptr->fname); - if (SUCCESS == phar_free_alias(fd_ptr, alias, alias_len)) { + if (SUCCESS == phar_free_alias(fd_ptr, alias, (int)alias_len)) { efree(error); goto valid_alias; } @@ -2700,7 +2759,7 @@ PHP_METHOD(Phar, setAlias) efree(error); RETURN_FALSE; } - if (!phar_validate_alias(alias, alias_len)) { + if (!phar_validate_alias(alias, (int)alias_len)) { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Invalid alias \"%s\" specified for phar \"%s\"", alias, phar_obj->archive->fname); RETURN_FALSE; @@ -2725,13 +2784,13 @@ valid_alias: phar_obj->archive->alias = NULL; } - phar_obj->archive->alias_len = alias_len; + phar_obj->archive->alias_len = (int)alias_len; phar_obj->archive->is_temporary_alias = 0; phar_flush(phar_obj->archive, NULL, 0, 0, &error); if (error) { phar_obj->archive->alias = oldalias; - phar_obj->archive->alias_len = oldalias_len; + phar_obj->archive->alias_len = (int)oldalias_len; phar_obj->archive->is_temporary_alias = old_temp; zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error); if (readd) { @@ -3003,6 +3062,11 @@ PHP_METHOD(Phar, setSignatureAlgorithm) if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "l|s", &algo, &key, &key_len) != SUCCESS) { return; } + if (ZEND_SIZE_T_INT_OVFL(key_len)) { + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, + "Cannot set signature algorithm, key too long"); + return; + } switch (algo) { case PHAR_SIG_SHA256: @@ -3019,10 +3083,10 @@ PHP_METHOD(Phar, setSignatureAlgorithm) zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname); return; } - phar_obj->archive->sig_flags = algo; + phar_obj->archive->sig_flags = (php_uint32)algo; phar_obj->archive->is_modified = 1; PHAR_G(openssl_privatekey) = key; - PHAR_G(openssl_privatekey_len) = key_len; + PHAR_G(openssl_privatekey_len) = (int)key_len; phar_flush(phar_obj->archive, 0, 0, 0, &error); if (error) { @@ -3403,7 +3467,9 @@ PHP_METHOD(Phar, copy) if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &oldfile, &oldfile_len, &newfile, &newfile_len) == FAILURE) { return; } - + if (ZEND_SIZE_T_INT_OVFL(newfile_len)) { + RETURN_FALSE; + } if (PHAR_G(readonly) && !phar_obj->archive->is_data) { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Cannot copy \"%s\" to \"%s\", phar is read-only", oldfile, newfile); @@ -3463,7 +3529,7 @@ PHP_METHOD(Phar, copy) } newentry.filename = estrndup(newfile, newfile_len); - newentry.filename_len = newfile_len; + newentry.filename_len = (int)newfile_len; newentry.fp_refcount = 0; if (oldentry->fp_type != PHAR_FP) { @@ -3503,6 +3569,9 @@ PHP_METHOD(Phar, offsetExists) if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &fname, &fname_len) == FAILURE) { return; } + if (ZEND_SIZE_T_INT_OVFL(fname_len)) { + RETURN_FALSE; + } if (zend_hash_str_exists(&phar_obj->archive->manifest, fname, (uint) fname_len)) { if (NULL != (entry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, fname, (uint) fname_len))) { @@ -3542,8 +3611,12 @@ PHP_METHOD(Phar, offsetGet) return; } + if (ZEND_SIZE_T_INT_OVFL(fname_len)) { + RETURN_FALSE; + } + /* security is 0 here so that we can get a better error message than "entry doesn't exist" */ - if (!(entry = phar_get_entry_info_dir(phar_obj->archive, fname, fname_len, 1, &error, 0))) { + if (!(entry = phar_get_entry_info_dir(phar_obj->archive, fname, (int)fname_len, 1, &error, 0))) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Entry %s does not exist%s%s", fname, error?", ":"", error?error:""); } else { if (fname_len == sizeof(".phar/stub.php")-1 && !memcmp(fname, ".phar/stub.php", sizeof(".phar/stub.php")-1)) { @@ -3689,7 +3762,9 @@ PHP_METHOD(Phar, offsetSet) && zend_parse_parameters(ZEND_NUM_ARGS(), "ps", &fname, &fname_len, &cont_str, &cont_len) == FAILURE) { return; } - + if (ZEND_SIZE_T_INT_OVFL(fname_len)) { + RETURN_FALSE; + } if (fname_len == sizeof(".phar/stub.php")-1 && !memcmp(fname, ".phar/stub.php", sizeof(".phar/stub.php")-1)) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot set stub \".phar/stub.php\" directly in phar \"%s\", use setStub", phar_obj->archive->fname); return; @@ -3705,7 +3780,7 @@ PHP_METHOD(Phar, offsetSet) return; } - phar_add_file(&(phar_obj->archive), fname, fname_len, cont_str, cont_len, zresource); + phar_add_file(&(phar_obj->archive), fname, (int)fname_len, cont_str, cont_len, zresource); } /* }}} */ @@ -3727,6 +3802,9 @@ PHP_METHOD(Phar, offsetUnset) if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &fname, &fname_len) == FAILURE) { return; } + if (ZEND_SIZE_T_INT_OVFL(fname_len)) { + RETURN_FALSE; + } if (zend_hash_str_exists(&phar_obj->archive->manifest, fname, (uint) fname_len)) { if (NULL != (entry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, fname, (uint) fname_len))) { @@ -3774,13 +3852,16 @@ PHP_METHOD(Phar, addEmptyDir) if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &dirname, &dirname_len) == FAILURE) { return; } + if (ZEND_SIZE_T_INT_OVFL(dirname_len)) { + RETURN_FALSE; + } if (dirname_len >= sizeof(".phar")-1 && !memcmp(dirname, ".phar", sizeof(".phar")-1)) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot create a directory in magic \".phar\" directory"); return; } - phar_mkdir(&phar_obj->archive, dirname, dirname_len); + phar_mkdir(&phar_obj->archive, dirname, (int)dirname_len); } /* }}} */ @@ -3799,6 +3880,9 @@ PHP_METHOD(Phar, addFile) if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|s", &fname, &fname_len, &localname, &localname_len) == FAILURE) { return; } + if (ZEND_SIZE_T_INT_OVFL(fname_len)) { + RETURN_FALSE; + } #if PHP_API_VERSION < 20100412 if (PG(safe_mode) && (!php_checkuid(fname, NULL, CHECKUID_ALLOW_ONLY_FILE))) { @@ -3823,7 +3907,7 @@ PHP_METHOD(Phar, addFile) } php_stream_to_zval(resource, &zresource); - phar_add_file(&(phar_obj->archive), fname, fname_len, NULL, 0, &zresource); + phar_add_file(&(phar_obj->archive), fname, (int)fname_len, NULL, 0, &zresource); zval_ptr_dtor(&zresource); } /* }}} */ @@ -3841,8 +3925,11 @@ PHP_METHOD(Phar, addFromString) if (zend_parse_parameters(ZEND_NUM_ARGS(), "ps", &localname, &localname_len, &cont_str, &cont_len) == FAILURE) { return; } + if (ZEND_SIZE_T_INT_OVFL(localname_len)) { + RETURN_FALSE; + } - phar_add_file(&(phar_obj->archive), localname, localname_len, cont_str, cont_len, NULL); + phar_add_file(&(phar_obj->archive), localname, (int)localname_len, cont_str, cont_len, NULL); } /* }}} */ @@ -4063,7 +4150,7 @@ PHP_METHOD(Phar, delMetadata) static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *dest, int dest_len, char **error) /* {{{ */ { php_stream_statbuf ssb; - int len; + size_t len; php_stream *fp; char *fullpath; const char *slash; @@ -4333,7 +4420,7 @@ PHP_METHOD(Phar, extractTo) zend_throw_exception_ex(phar_ce_PharException, 0, "Phar Error: attempted to extract non-existent file \"%s\" from phar \"%s\"", Z_STRVAL_P(zval_file), phar_obj->archive->fname); } - if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error)) { + if (FAILURE == phar_extract_file(overwrite, entry, pathto, (int)pathto_len, &error)) { zend_throw_exception_ex(phar_ce_PharException, 0, "Extraction from phar \"%s\" failed: %s", phar_obj->archive->fname, error); efree(error); @@ -4354,7 +4441,7 @@ PHP_METHOD(Phar, extractTo) return; } - if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error)) { + if (FAILURE == phar_extract_file(overwrite, entry, pathto, (int)pathto_len, &error)) { zend_throw_exception_ex(phar_ce_PharException, 0, "Extraction from phar \"%s\" failed: %s", phar_obj->archive->fname, error); efree(error); @@ -4370,7 +4457,7 @@ all_files: } ZEND_HASH_FOREACH_PTR(&phar->manifest, entry) { - if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error)) { + if (FAILURE == phar_extract_file(overwrite, entry, pathto, (int)pathto_len, &error)) { zend_throw_exception_ex(phar_ce_PharException, 0, "Extraction from phar \"%s\" failed: %s", phar->fname, error); efree(error); diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index b24f9c691d..1c13aa5090 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -344,6 +344,15 @@ static void reflection_free_objects_storage(zend_object *object) /* {{{ */ } /* }}} */ +static HashTable *reflection_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */ +{ + reflection_object *intern = Z_REFLECTION_P(obj); + *gc_data = &intern->obj; + *gc_data_count = 1; + return zend_std_get_properties(obj); +} +/* }}} */ + static zend_object *reflection_objects_new(zend_class_entry *class_type) /* {{{ */ { reflection_object *intern; @@ -6524,6 +6533,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ reflection_object_handlers.free_obj = reflection_free_objects_storage; reflection_object_handlers.clone_obj = NULL; reflection_object_handlers.write_property = _reflection_write_property; + reflection_object_handlers.get_gc = reflection_get_gc; INIT_CLASS_ENTRY(_reflection_entry, "ReflectionException", reflection_exception_functions); reflection_exception_ptr = zend_register_internal_class_ex(&_reflection_entry, zend_ce_exception); diff --git a/ext/reflection/tests/bug46103.phpt b/ext/reflection/tests/bug46103.phpt new file mode 100644 index 0000000000..978a9c2c46 --- /dev/null +++ b/ext/reflection/tests/bug46103.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #46103: ReflectionObject memory leak +--FILE-- +<?php + +$obj = new stdClass; +$obj->r = new ReflectionObject($obj); +var_dump($obj); + +?> +--EXPECT-- +object(stdClass)#1 (1) { + ["r"]=> + object(ReflectionObject)#2 (1) { + ["name"]=> + string(8) "stdClass" + } +} diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index b33f07e69e..7c25657616 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -175,7 +175,7 @@ static void ps_files_open(ps_files *data, const char *key) } if (!ps_files_path_create(buf, sizeof(buf), data, key)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to create session data file path. Too short session ID, invalid save_path or path lentgth exceeds MAXPATHLEN(%d)", MAXPATHLEN); + php_error_docref(NULL, E_WARNING, "Failed to create session data file path. Too short session ID, invalid save_path or path lentgth exceeds MAXPATHLEN(%d)", MAXPATHLEN); return; } @@ -200,7 +200,7 @@ static void ps_files_open(ps_files *data, const char *key) if (fstat(data->fd, &sbuf) || (sbuf.st_uid != 0 && sbuf.st_uid != getuid() && sbuf.st_uid != geteuid())) { close(data->fd); data->fd = -1; - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Session data file is not created by your uid"); + php_error_docref(NULL, E_WARNING, "Session data file is not created by your uid"); return; } #endif diff --git a/ext/session/tests/bug66481-win32.phpt b/ext/session/tests/bug66481-win32.phpt deleted file mode 100644 index cf06cb6b95..0000000000 --- a/ext/session/tests/bug66481-win32.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Bug #66481: Calls to session_name() segfault when session.name is null, Windows. ---INI-- -session.name= ---SKIPIF-- -<?php include('skipif.inc'); ?> -<?php if(substr(PHP_OS, 0, 3) != "WIN") die("skip Windows only"); ?> ---FILE-- -<?php - -var_dump(session_name("foo")); -var_dump(session_name("bar")); ---EXPECTF-- -Warning: PHP Startup: session.name cannot be a numeric or empty '' in Unknown on line 0 -string(9) "PHPSESSID" -string(3) "foo" -PHP Warning: PHP Startup: session.name cannot be a numeric or empty '' in Unknown on line 0 diff --git a/ext/session/tests/bug66481.phpt b/ext/session/tests/bug66481.phpt index 5525ae8a38..cf6ad6a8d6 100644 --- a/ext/session/tests/bug66481.phpt +++ b/ext/session/tests/bug66481.phpt @@ -4,7 +4,6 @@ Bug #66481: Calls to session_name() segfault when session.name is null. session.name= --SKIPIF-- <?php include('skipif.inc'); ?> -<?php if(substr(PHP_OS, 0, 3) == "WIN") die("skip Not for Windows"); ?> --FILE-- <?php diff --git a/ext/session/tests/rfc1867_invalid_settings-win.phpt b/ext/session/tests/rfc1867_invalid_settings-win.phpt deleted file mode 100644 index ed854e8898..0000000000 --- a/ext/session/tests/rfc1867_invalid_settings-win.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -session rfc1867 invalid settings ---INI-- -session.upload_progress.freq=-1 -error_log= ---SKIPIF-- -<?php -include('skipif.inc'); -if(substr(PHP_OS, 0, 3) != "WIN") - die("skip windows only test"); -?> ---FILE-- -<?php -var_dump(ini_get("session.upload_progress.freq")); -?> ---EXPECTF-- -Warning: PHP Startup: session.upload_progress.freq must be greater than or equal to zero in %s -string(2) "1%" -PHP Warning: PHP Startup: session.upload_progress.freq must be greater than or equal to zero in %s diff --git a/ext/session/tests/rfc1867_invalid_settings.phpt b/ext/session/tests/rfc1867_invalid_settings.phpt index 640c4d2436..1a989e979b 100644 --- a/ext/session/tests/rfc1867_invalid_settings.phpt +++ b/ext/session/tests/rfc1867_invalid_settings.phpt @@ -6,8 +6,6 @@ error_log= --SKIPIF-- <?php include('skipif.inc'); -if(substr(PHP_OS, 0, 3) == "WIN") - die("skip Not for Windows"); ?> --FILE-- <?php diff --git a/ext/session/tests/rfc1867_invalid_settings_2-win.phpt b/ext/session/tests/rfc1867_invalid_settings_2-win.phpt deleted file mode 100644 index f8e6b6d208..0000000000 --- a/ext/session/tests/rfc1867_invalid_settings_2-win.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -session rfc1867 invalid settings 2 ---INI-- -session.upload_progress.freq=200% -error_log= ---SKIPIF-- -<?php -include('skipif.inc'); -if(substr(PHP_OS, 0, 3) != "WIN") - die("skip windows only test"); -?> ---FILE-- -<?php -var_dump(ini_get("session.upload_progress.freq")); -?> ---EXPECTF-- -Warning: PHP Startup: session.upload_progress.freq cannot be over 100% in %s -string(2) "1%" -PHP Warning: PHP Startup: session.upload_progress.freq cannot be over 100% in %s diff --git a/ext/session/tests/rfc1867_invalid_settings_2.phpt b/ext/session/tests/rfc1867_invalid_settings_2.phpt index c2a0c6ac4e..9246e1dbbc 100644 --- a/ext/session/tests/rfc1867_invalid_settings_2.phpt +++ b/ext/session/tests/rfc1867_invalid_settings_2.phpt @@ -6,8 +6,6 @@ error_log= --SKIPIF-- <?php include('skipif.inc'); -if(substr(PHP_OS, 0, 3) == "WIN") - die("skip Not for Windows"); ?> --FILE-- <?php diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index 63e8095ed7..2cfb345a24 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -2071,11 +2071,11 @@ static int php_snmp_has_property(zval *object, zval *member, int has_set_exists, } /* }}} */ -static HashTable *php_snmp_get_gc(zval *object, zval ***gc_data, int *gc_data_count TSRMLS_DC) /* {{{ */ +static HashTable *php_snmp_get_gc(zval *object, zval ***gc_data, int *gc_data_count) /* {{{ */ { *gc_data = NULL; *gc_data_count = 0; - return zend_std_get_properties(object TSRMLS_CC); + return zend_std_get_properties(object); } /* }}} */ diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 7947b4cea3..245f1b3e61 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -283,6 +283,16 @@ static encodePtr find_encoder_by_type_name(sdlPtr sdl, const char *type) return NULL; } +static zval *soap_hash_str_find_deref(HashTable *ht, const char *str, size_t len) { + zval *zv = zend_hash_str_find(ht, str, len); + if (!zv) { + return NULL; + } + + ZVAL_DEREF(zv); + return zv; +} + static zend_bool soap_check_zval_ref(zval *data, xmlNodePtr node) { xmlNodePtr node_ptr; @@ -380,6 +390,10 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml xmlNodePtr node = NULL; int add_type = 0; + if (data) { + ZVAL_DEREF(data); + } + /* Special handling of class SoapVar */ if (data && Z_TYPE_P(data) == IS_OBJECT && @@ -388,14 +402,14 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml encodePtr enc = NULL; HashTable *ht = Z_OBJPROP_P(data); - if ((ztype = zend_hash_str_find(ht, "enc_type", sizeof("enc_type")-1)) == NULL || + if ((ztype = soap_hash_str_find_deref(ht, "enc_type", sizeof("enc_type")-1)) == NULL || Z_TYPE_P(ztype) != IS_LONG) { soap_error0(E_ERROR, "Encoding: SoapVar has no 'enc_type' property"); } - if ((zstype = zend_hash_str_find(ht, "enc_stype", sizeof("enc_stype")-1)) != NULL && + if ((zstype = soap_hash_str_find_deref(ht, "enc_stype", sizeof("enc_stype")-1)) != NULL && Z_TYPE_P(zstype) == IS_STRING) { - if ((zns = zend_hash_str_find(ht, "enc_ns", sizeof("enc_ns")-1)) != NULL && + if ((zns = soap_hash_str_find_deref(ht, "enc_ns", sizeof("enc_ns")-1)) != NULL && Z_TYPE_P(zns) == IS_STRING) { enc = get_encoder(SOAP_GLOBAL(sdl), Z_STRVAL_P(zns), Z_STRVAL_P(zstype)); } else { @@ -422,13 +436,13 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml enc = encode; } - zdata = zend_hash_str_find(ht, "enc_value", sizeof("enc_value")-1); + zdata = soap_hash_str_find_deref(ht, "enc_value", sizeof("enc_value")-1); node = master_to_xml(enc, zdata, style, parent); if (style == SOAP_ENCODED || (SOAP_GLOBAL(sdl) && encode != enc)) { - if ((zstype = zend_hash_str_find(ht, "enc_stype", sizeof("enc_stype")-1)) != NULL && + if ((zstype = soap_hash_str_find_deref(ht, "enc_stype", sizeof("enc_stype")-1)) != NULL && Z_TYPE_P(zstype) == IS_STRING) { - if ((zns = zend_hash_str_find(ht, "enc_ns", sizeof("enc_ns")-1)) != NULL && + if ((zns = soap_hash_str_find_deref(ht, "enc_ns", sizeof("enc_ns")-1)) != NULL && Z_TYPE_P(zns) == IS_STRING) { set_ns_and_type_ex(node, Z_STRVAL_P(zns), Z_STRVAL_P(zstype)); } else { @@ -437,11 +451,11 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml } } - if ((zname = zend_hash_str_find(ht, "enc_name", sizeof("enc_name")-1)) != NULL && + if ((zname = soap_hash_str_find_deref(ht, "enc_name", sizeof("enc_name")-1)) != NULL && Z_TYPE_P(zname) == IS_STRING) { xmlNodeSetName(node, BAD_CAST(Z_STRVAL_P(zname))); } - if ((znamens = zend_hash_str_find(ht, "enc_namens", sizeof("enc_namens")-1)) != NULL && + if ((znamens = soap_hash_str_find_deref(ht, "enc_namens", sizeof("enc_namens")-1)) != NULL && Z_TYPE_P(znamens) == IS_STRING) { xmlNsPtr nsp = encode_add_ns(node, Z_STRVAL_P(znamens)); xmlSetNs(node, nsp); @@ -455,6 +469,7 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml zend_string *type_name; ZEND_HASH_FOREACH_STR_KEY_VAL(SOAP_GLOBAL(class_map), type_name, tmp) { + ZVAL_DEREF(tmp); if (Z_TYPE_P(tmp) == IS_STRING && ZSTR_LEN(ce->name) == Z_STRLEN_P(tmp) && zend_binary_strncasecmp(ZSTR_VAL(ce->name), ZSTR_LEN(ce->name), Z_STRVAL_P(tmp), ZSTR_LEN(ce->name), ZSTR_LEN(ce->name)) == 0 && @@ -1193,6 +1208,7 @@ static zval* get_zval_property(zval* object, char* name, zval *rv) if (property_info != ZEND_WRONG_PROPERTY_INFO && property_info && zend_hash_exists(Z_OBJPROP_P(object), property_info->name)) { zval_ptr_dtor(&member); + ZVAL_DEREF(data); return data; } zval_ptr_dtor(&member); @@ -1200,13 +1216,10 @@ static zval* get_zval_property(zval* object, char* name, zval *rv) } zval_ptr_dtor(&member); EG(scope) = old_scope; + ZVAL_DEREF(data); return data; } else if (Z_TYPE_P(object) == IS_ARRAY) { - zval *data_ptr; - - if ((data_ptr = zend_hash_str_find(Z_ARRVAL_P(object), name, strlen(name))) != NULL) { - return data_ptr; - } + return soap_hash_str_find_deref(Z_ARRVAL_P(object), name, strlen(name)); } return NULL; } @@ -1421,7 +1434,7 @@ static zval *to_zval_object_ex(zval *ret, encodeTypePtr type, xmlNodePtr data, z zval *classname; zend_class_entry *tmp; - if ((classname = zend_hash_str_find(SOAP_GLOBAL(class_map), type->type_str, strlen(type->type_str))) != NULL && + if ((classname = soap_hash_str_find_deref(SOAP_GLOBAL(class_map), type->type_str, strlen(type->type_str))) != NULL && Z_TYPE_P(classname) == IS_STRING && (tmp = zend_fetch_class(Z_STR_P(classname), ZEND_FETCH_CLASS_AUTO)) != NULL) { ce = tmp; @@ -1642,6 +1655,7 @@ static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, zval * zval *val; ZEND_HASH_FOREACH_VAL(ht, val) { + ZVAL_DEREF(val); if (Z_TYPE_P(val) == IS_NULL && model->u.element->nillable) { property = xmlNewNode(NULL, BAD_CAST("BOGUS")); xmlAddChild(node, property); @@ -1896,6 +1910,7 @@ static xmlNodePtr to_xml_object(encodeTypePtr type, zval *data, int style, xmlNo ZEND_HASH_FOREACH_VAL(prop, val) { xmlNodePtr property; + ZVAL_DEREF(val); if (Z_TYPE_P(val) == IS_NULL && array_el->nillable) { property = xmlNewNode(NULL, BAD_CAST("BOGUS")); xmlAddChild(xmlParam, property); @@ -2327,6 +2342,7 @@ iterator_done: ZEND_HASH_FOREACH_VAL_IND(Z_ARRVAL_P(el), el) { break; } ZEND_HASH_FOREACH_END(); + ZVAL_DEREF(el); if (Z_TYPE_P(el) == IS_ARRAY) { dims[i] = zend_hash_num_elements(Z_ARRVAL_P(el)); } else { @@ -3520,20 +3536,20 @@ static encodePtr get_array_type(xmlNodePtr node, zval *array, smart_str *type) Z_OBJCE_P(tmp) == soap_var_class_entry) { zval *ztype; - if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_type", sizeof("enc_type")-1)) == NULL || + if ((ztype = soap_hash_str_find_deref(Z_OBJPROP_P(tmp), "enc_type", sizeof("enc_type")-1)) == NULL || Z_TYPE_P(ztype) != IS_LONG) { soap_error0(E_ERROR, "Encoding: SoapVar has no 'enc_type' property"); } cur_type = Z_LVAL_P(ztype); - if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_stype", sizeof("enc_stype")-1)) != NULL && + if ((ztype = soap_hash_str_find_deref(Z_OBJPROP_P(tmp), "enc_stype", sizeof("enc_stype")-1)) != NULL && Z_TYPE_P(ztype) == IS_STRING) { cur_stype = Z_STRVAL_P(ztype); } else { cur_stype = NULL; } - if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_ns", sizeof("enc_ns")-1)) != NULL && + if ((ztype = soap_hash_str_find_deref(Z_OBJPROP_P(tmp), "enc_ns", sizeof("enc_ns")-1)) != NULL && Z_TYPE_P(ztype) == IS_STRING) { cur_ns = Z_STRVAL_P(ztype); } else { diff --git a/ext/soap/soap.c b/ext/soap/soap.c index a2170283c8..ffa988472c 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -3209,12 +3209,8 @@ PHP_METHOD(SoapClient, __setSoapHeaders) if (headers == NULL || Z_TYPE_P(headers) == IS_NULL) { zend_hash_str_del(Z_OBJPROP_P(this_ptr), "__default_headers", sizeof("__default_headers")-1); } else if (Z_TYPE_P(headers) == IS_ARRAY) { - zval *default_headers; - verify_soap_headers_array(Z_ARRVAL_P(headers)); - if ((default_headers = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "__default_headers", sizeof("__default_headers")-1)) == NULL) { - add_property_zval(this_ptr, "__default_headers", headers); - } + add_property_zval(this_ptr, "__default_headers", headers); } else if (Z_TYPE_P(headers) == IS_OBJECT && instanceof_function(Z_OBJCE_P(headers), soap_header_class_entry)) { zval default_headers; diff --git a/ext/soap/tests/bug73452.phpt b/ext/soap/tests/bug73452.phpt new file mode 100644 index 0000000000..75f8c27016 --- /dev/null +++ b/ext/soap/tests/bug73452.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #73452 Segfault (Regression for #69152) +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php + +$data = 'O:9:"SoapFault":4:{s:9:"faultcode";i:4298448493;s:11:"faultstring";i:4298448543;s:7:"'."\0*\0".'file";i:4298447319;s:7:"'."\0*\0".'line";s:4:"ryat";}'; +echo unserialize($data); + +?> +==DONE== +--EXPECTF-- +SoapFault exception: [4298448493] 4298448543 in :0 +Stack trace: +#0 %sbug73452.php(4): unserialize('O:9:"SoapFault"...') +#1 {main}==DONE== diff --git a/ext/soap/tests/bugs/bug31422-win.phpt b/ext/soap/tests/bugs/bug31422-win.phpt deleted file mode 100644 index ba8df0726c..0000000000 --- a/ext/soap/tests/bugs/bug31422-win.phpt +++ /dev/null @@ -1,47 +0,0 @@ ---TEST-- -Bug #31422 (No Error-Logging on SoapServer-Side) ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip not valid for non windows'); -} -require_once('skipif.inc'); -?> ---INI-- -log_errors=1 ---FILE-- -<?php -function Add($x,$y) { - fopen(); - user_error("Hello", E_USER_ERROR); - return $x+$y; -} - -$server = new SoapServer(null,array('uri'=>"http://testuri.org")); -$server->addfunction("Add"); - -$HTTP_RAW_POST_DATA = <<<EOF -<?xml version="1.0" encoding="ISO-8859-1"?> -<SOAP-ENV:Envelope - SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" - xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:si="http://soapinterop.org/xsd"> - <SOAP-ENV:Body> - <ns1:Add xmlns:ns1="http://testuri.org"> - <x xsi:type="xsd:int">22</x> - <y xsi:type="xsd:int">33</y> - </ns1:Add> - </SOAP-ENV:Body> -</SOAP-ENV:Envelope> -EOF; - -$server->handle($HTTP_RAW_POST_DATA); -echo "ok\n"; -?> ---EXPECTF-- -<?xml version="1.0" encoding="UTF-8"?> -<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>Hello</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope> -PHP Warning: fopen() expects at least 2 parameters, 0 given in %sbug31422-win.php on line %d -PHP Fatal error: Hello in %sbug31422-win.php on line %d diff --git a/ext/soap/tests/bugs/bug31422.phpt b/ext/soap/tests/bugs/bug31422.phpt index c8ddcfe092..4889b10d8e 100644 --- a/ext/soap/tests/bugs/bug31422.phpt +++ b/ext/soap/tests/bugs/bug31422.phpt @@ -2,9 +2,6 @@ Bug #31422 (No Error-Logging on SoapServer-Side) --SKIPIF-- <?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip not valid for windows'); -} require_once('skipif.inc'); ?> --INI-- diff --git a/ext/soap/tests/bugs/bug73538.phpt b/ext/soap/tests/bugs/bug73538.phpt new file mode 100644 index 0000000000..1bf0372419 --- /dev/null +++ b/ext/soap/tests/bugs/bug73538.phpt @@ -0,0 +1,35 @@ +--TEST-- +SOAP: SoapClient::__setHeaders array overrides previous headers +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php + +$client = new SoapClient(null, [ + "location" => "test://", + "uri" => "test://", + "exceptions" => false, + "trace" => true, +]); +$client->__setSoapHeaders(new \SoapHeader('ns', 'Header', ['something' => 1])); +$client->__setSoapHeaders(new \SoapHeader('ns', 'Header', ['something' => 2])); +$client->test(); +echo $client->__getLastRequest(); + +$client = new SoapClient(null, [ + "location" => "test://", + "uri" => "test://", + "exceptions" => false, + "trace" => true, +]); +$client->__setSoapHeaders([new \SoapHeader('ns', 'Header', ['something' => 1])]); +$client->__setSoapHeaders([new \SoapHeader('ns', 'Header', ['something' => 2])]); +$client->test(); +echo $client->__getLastRequest(); + +?> +--EXPECT-- +<?xml version="1.0" encoding="UTF-8"?> +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="test://" xmlns:ns2="ns" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header><ns2:Header><item><key>something</key><value>2</value></item></ns2:Header></SOAP-ENV:Header><SOAP-ENV:Body><ns1:test/></SOAP-ENV:Body></SOAP-ENV:Envelope> +<?xml version="1.0" encoding="UTF-8"?> +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="test://" xmlns:ns2="ns" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header><ns2:Header><item><key>something</key><value>2</value></item></ns2:Header></SOAP-ENV:Header><SOAP-ENV:Body><ns1:test/></SOAP-ENV:Body></SOAP-ENV:Envelope> diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 63674c50d7..78c7652349 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -2370,7 +2370,7 @@ PHP_FUNCTION(socket_export_stream) char *protocol = NULL; size_t protocollen = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zsocket) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zsocket) == FAILURE) { return; } if ((socket = (php_socket *) zend_fetch_resource(Z_RES_P(zsocket), le_socket_name, le_socket)) == NULL) { diff --git a/ext/spl/tests/observer_010.phpt b/ext/spl/tests/observer_010.phpt new file mode 100644 index 0000000000..5cedff8c7c --- /dev/null +++ b/ext/spl/tests/observer_010.phpt @@ -0,0 +1,15 @@ +--TEST-- +SPL: SplObjectStorage null coalescing operator memory leak +--FILE-- +<?php +// In maintainer zts mode, this should no longer +// detect memory leaks for the objects +$a = new stdClass(); +$b = new stdClass(); +$map = new SplObjectStorage(); +$map[$a] = 'foo'; +var_dump($map[$b] ?? null); +var_dump($map[$a] ?? null); +--EXPECTF-- +NULL +string(3) "foo" diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index b3f0a29f5c..23d0b97b43 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -2167,6 +2167,9 @@ static void php_sqlite3_result_object_free_storage(zend_object *object) /* {{{ * } if (!Z_ISNULL(intern->stmt_obj_zval)) { + if (intern->stmt_obj && intern->stmt_obj->initialised) { + sqlite3_reset(intern->stmt_obj->stmt); + } zval_ptr_dtor(&intern->stmt_obj_zval); } diff --git a/ext/standard/dns.c b/ext/standard/dns.c index de40649e69..de277a3035 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -761,7 +761,7 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t } /* }}} */ -/* {{{ proto array|false dns_get_record(string hostname [, int type[, array authns, array addtl]]) +/* {{{ proto array|false dns_get_record(string hostname [, int type[, array &authns[, array &addtl[, bool raw]]]]) Get any Resource Record corresponding to a given Internet host name */ PHP_FUNCTION(dns_get_record) { @@ -785,7 +785,7 @@ PHP_FUNCTION(dns_get_record) int type, first_query = 1, store_results = 1; zend_bool raw = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|lz!z!b", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|lz/!z/!b", &hostname, &hostname_len, &type_param, &authns, &addtl, &raw) == FAILURE) { return; } diff --git a/ext/standard/dns_win32.c b/ext/standard/dns_win32.c index f28977ab6a..d63bfd6a66 100644 --- a/ext/standard/dns_win32.c +++ b/ext/standard/dns_win32.c @@ -341,18 +341,18 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, } /* }}} */ -/* {{{ proto array|false dns_get_record(string hostname [, int type[, array authns, array addtl]]) +/* {{{ proto array|false dns_get_record(string hostname [, int type[, array &authns[, array &addtl[, bool raw]]]]) Get any Resource Record corresponding to a given Internet host name */ PHP_FUNCTION(dns_get_record) { char *hostname; size_t hostname_len; - long type_param = PHP_DNS_ANY; + zend_long type_param = PHP_DNS_ANY; zval *authns = NULL, *addtl = NULL; int type, type_to_fetch, first_query = 1, store_results = 1; zend_bool raw = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|lz!z!b", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|lz/!z/!b", &hostname, &hostname_len, &type_param, &authns, &addtl, &raw) == FAILURE) { return; } diff --git a/ext/standard/string.c b/ext/standard/string.c index 491e97a070..246f452913 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -20,8 +20,6 @@ /* $Id$ */ -/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ - #include <stdio.h> #include "php.h" #include "php_rand.h" diff --git a/ext/standard/tests/file/bug47767.phpt b/ext/standard/tests/file/bug47767.phpt index 312476aa55..37db3b18fc 100644 --- a/ext/standard/tests/file/bug47767.phpt +++ b/ext/standard/tests/file/bug47767.phpt @@ -11,7 +11,9 @@ if(PHP_WINDOWS_VERSION_MAJOR < 6) { die('skip windows version 6.0+ only test'); } -$ret = exec('mklink rename_variation13tmp.lnk ' . __FILE__ .' 2>&1', $out); +$fn = "bug47767.lnk"; +$ret = exec("mklink $fn " . __FILE__ .' 2>&1', $out); +@unlink($fn); if (strpos($ret, 'privilege')) { die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.'); } @@ -47,4 +49,4 @@ rmdir($junctionname); Testing include_once using file symbolic link I am included Testing include_once using directory symbolic link -Testing include_once using junction points
\ No newline at end of file +Testing include_once using junction points diff --git a/ext/standard/tests/file/rename_variation6-win32.phpt b/ext/standard/tests/file/rename_variation6-win32.phpt index 9aab0a7a83..dfb57f2e19 100644 --- a/ext/standard/tests/file/rename_variation6-win32.phpt +++ b/ext/standard/tests/file/rename_variation6-win32.phpt @@ -4,7 +4,9 @@ Test rename() function: usage variations-6 <?php if (substr(PHP_OS, 0, 3) != 'WIN') die('skip.. for Windows'); if (!function_exists("symlink")) die("skip symlinks are not supported"); -$ret = exec('mklink rename_variation13tmp.lnk ' . __FILE__ .' 2>&1', $out); +$fn = "rename_variation6tmp.lnk"; +$ret = exec("mklink $fn " . __FILE__ .' 2>&1', $out); +@unlink($fn); if (strpos($ret, 'privilege')) { die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.'); } diff --git a/ext/standard/tests/filters/bug73586.phpt b/ext/standard/tests/filters/bug73586.phpt new file mode 100644 index 0000000000..3cae4662bf --- /dev/null +++ b/ext/standard/tests/filters/bug73586.phpt @@ -0,0 +1,45 @@ +--TEST-- +Bug #73586 (php_user_filter::$stream is not set to the stream the filter is working on). +--FILE-- +<?php +class append_filter extends php_user_filter { + public $stream; + function filter($in, $out, &$consumed, $closing) { + while ($bucket = stream_bucket_make_writeable($in)) { + $consumed += $bucket->datalen; + stream_bucket_append($out, $bucket); + } + if ($closing) { + $bucket = stream_bucket_new($this->stream, "FooBar\n"); + stream_bucket_append($out, $bucket); + } + return PSFS_PASS_ON; + } +} +stream_filter_register("append", "append_filter"); +$fin = fopen(__FILE__, 'rb'); +stream_filter_append($fin, 'append', STREAM_FILTER_READ); +stream_copy_to_stream($fin, STDOUT); +?> +--EXPECT-- +<?php +class append_filter extends php_user_filter { + public $stream; + function filter($in, $out, &$consumed, $closing) { + while ($bucket = stream_bucket_make_writeable($in)) { + $consumed += $bucket->datalen; + stream_bucket_append($out, $bucket); + } + if ($closing) { + $bucket = stream_bucket_new($this->stream, "FooBar\n"); + stream_bucket_append($out, $bucket); + } + return PSFS_PASS_ON; + } +} +stream_filter_register("append", "append_filter"); +$fin = fopen(__FILE__, 'rb'); +stream_filter_append($fin, 'append', STREAM_FILTER_READ); +stream_copy_to_stream($fin, STDOUT); +?> +FooBar diff --git a/ext/standard/tests/misc/get_browser_variation2.phpt b/ext/standard/tests/misc/get_browser_variation2.phpt new file mode 100644 index 0000000000..5c4d2ecd6e --- /dev/null +++ b/ext/standard/tests/misc/get_browser_variation2.phpt @@ -0,0 +1,94 @@ +--TEST-- +Test get_browser() function variation : Return data as object +--INI-- +browscap={PWD}/browscap.ini +--SKIPIF-- +<?php + /** + * Basic test, it would be pretty much coincidence if there's + * a browscap.ini on another place that isn't valid. + */ + if(! is_readable( ini_get( 'browscap' ) ) ) { + die( 'skip: browscap.ini file ' . ini_get('browscap') . " not readable" ); + } +?> +--FILE-- +<?php + +$agent = "Opera/7.11 (Windows NT 5.1; U) [en]"; +var_dump(get_browser($agent)); + +?> +--EXPECT-- +object(stdClass)#1 (35) { + ["browser_name_regex"]=> + string(41) "~^opera/7\.1.* \(windows nt 5\.1; .\).*$~" + ["browser_name_pattern"]=> + string(31) "Opera/7.1* (Windows NT 5.1; ?)*" + ["parent"]=> + string(9) "Opera 7.1" + ["platform"]=> + string(5) "WinXP" + ["win32"]=> + string(1) "1" + ["browser"]=> + string(5) "Opera" + ["version"]=> + string(3) "7.1" + ["majorver"]=> + string(1) "7" + ["minorver"]=> + string(1) "1" + ["frames"]=> + string(1) "1" + ["iframes"]=> + string(1) "1" + ["tables"]=> + string(1) "1" + ["cookies"]=> + string(1) "1" + ["backgroundsounds"]=> + string(1) "1" + ["javaapplets"]=> + string(1) "1" + ["javascript"]=> + string(1) "1" + ["css"]=> + string(1) "2" + ["cssversion"]=> + string(1) "2" + ["supportscss"]=> + string(1) "1" + ["alpha"]=> + string(0) "" + ["beta"]=> + string(0) "" + ["win16"]=> + string(0) "" + ["win64"]=> + string(0) "" + ["authenticodeupdate"]=> + string(0) "" + ["cdf"]=> + string(0) "" + ["vbscript"]=> + string(0) "" + ["activexcontrols"]=> + string(0) "" + ["stripper"]=> + string(0) "" + ["isbanned"]=> + string(0) "" + ["wap"]=> + string(0) "" + ["ismobiledevice"]=> + string(0) "" + ["issyndicationreader"]=> + string(0) "" + ["crawler"]=> + string(0) "" + ["aol"]=> + string(0) "" + ["aolversion"]=> + string(1) "0" +} diff --git a/ext/standard/tests/misc/time_sleep_until_basic.phpt b/ext/standard/tests/misc/time_sleep_until_basic.phpt index 05cc0e6de4..2be972a134 100644 --- a/ext/standard/tests/misc/time_sleep_until_basic.phpt +++ b/ext/standard/tests/misc/time_sleep_until_basic.phpt @@ -23,7 +23,9 @@ Michele Orselli mo@ideato.it // passes for up to .5 milliseconds less, fails for more than .5 milliseconds // should be fine since time_sleep_until() on Windows is accurate to the // millisecond(.5 rounded up is 1 millisecond) - $now = round($now, 3); + // In practice, on slower machines even that can fail, so giving yet 50ms or more. + $tmp = round($now, 3); + $now = $tmp >= (int)$time ? $tmp : $tmp + .05; } var_dump($now >= (int)$time); ?> diff --git a/ext/standard/tests/network/bug73594.phpt b/ext/standard/tests/network/bug73594.phpt new file mode 100644 index 0000000000..a3068360ce --- /dev/null +++ b/ext/standard/tests/network/bug73594.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #73594 (dns_get_record() does not populate $additional out parameter) +--SKIPIF-- +<?php +if (getenv("SKIP_ONLINE_TESTS")) die("skip test requiring internet connection"); + +$out = array(); +$ret = 0; +exec("dig -tmx php.net +noall +additional 2>/dev/null", $out, $ret); + +if ($ret != 0) die("skip dig command is not present or failed to run"); + +// skip empty and header lines +$out = preg_grep("/^(?!($|;))/", $out); + +if (empty($out)) die("skip local resolver does not return additional records"); +?> +--FILE-- +<?php +$auth = array(); +$additional = array(); +dns_get_record('php.net', DNS_MX, $auth, $additional); +var_dump(empty($additional)); +?> +--EXPECT-- +bool(false) diff --git a/ext/standard/tests/network/bug73594a.phpt b/ext/standard/tests/network/bug73594a.phpt new file mode 100644 index 0000000000..a0a08e4a9e --- /dev/null +++ b/ext/standard/tests/network/bug73594a.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #73594 (dns_get_record() does not populate $additional out parameter - $authns parameter) +--SKIPIF-- +<?php +if (getenv("SKIP_ONLINE_TESTS")) die("skip test requiring internet connection"); + +$out = array(); +$ret = 0; +exec("dig -tmx php.net +noall +authority 2>/dev/null", $out, $ret); + +if ($ret != 0) die("skip dig command is not present or failed to run"); + +// skip empty and header lines +$out = preg_grep("/^(?!($|;))/", $out); + +if (empty($out)) die("skip local resolver does not return authority records"); +?> +--FILE-- +<?php +$auth = array(); +dns_get_record('php.net', DNS_MX, $auth); +var_dump(empty($auth)); +?> +--EXPECT-- +bool(false) diff --git a/ext/standard/tests/serialize/bug70213.phpt b/ext/standard/tests/serialize/bug70213.phpt new file mode 100644 index 0000000000..c01d362be0 --- /dev/null +++ b/ext/standard/tests/serialize/bug70213.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #70213: Unserialize context shared on double class lookup +--FILE-- +<?php + +ini_set('unserialize_callback_func', 'evil'); + +function evil() { + function __autoload($arg) { + var_dump(unserialize('R:1;')); + } +} + +var_dump(unserialize('a:2:{i:0;i:42;i:1;O:4:"evil":0:{}}')); + +?> +--EXPECTF-- +Notice: unserialize(): Error at offset 4 of 4 bytes in %s on line %d +bool(false) + +Warning: unserialize(): Function evil() hasn't defined the class it was called for in %s on line %d +array(2) { + [0]=> + int(42) + [1]=> + object(__PHP_Incomplete_Class)#1 (1) { + ["__PHP_Incomplete_Class_Name"]=> + string(4) "evil" + } +} diff --git a/ext/standard/tests/serialize/bug73154.phpt b/ext/standard/tests/serialize/bug73154.phpt new file mode 100644 index 0000000000..8d0f188bf7 --- /dev/null +++ b/ext/standard/tests/serialize/bug73154.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #73154: serialize object with __sleep function crash +--FILE-- +<?php +class a { + public $a; + public function __sleep() { + $this->a=null; + return array(); + } +} +$s = 'a:1:{i:0;O:1:"a":1:{s:1:"a";R:2;}}'; +var_dump(serialize(unserialize($s))); +?> +--EXPECT-- +string(22) "a:1:{i:0;O:1:"a":0:{}}" diff --git a/ext/standard/tests/strings/bug65769.phpt b/ext/standard/tests/strings/bug65769.phpt index 23eeda9fd1..1a81d487c9 100644 --- a/ext/standard/tests/strings/bug65769.phpt +++ b/ext/standard/tests/strings/bug65769.phpt @@ -5,6 +5,9 @@ Bug #65769 localeconv() broken in TS builds if (substr(PHP_OS, 0, 3) != 'WIN') { die('skip Windows only'); } +if (PHP_WINDOWS_VERSION_MAJOR < 10) { + die("skip for Windows 10 and above"); +} ?> --FILE-- <?php diff --git a/ext/standard/url.c b/ext/standard/url.c index 5b281c795c..05500475ce 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -104,7 +104,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length) ue = s + length; /* parse scheme */ - if ((e = memchr(s, ':', length)) && (e - s)) { + if ((e = memchr(s, ':', length)) && e != s) { /* validate scheme */ p = s; while (p < e) { @@ -119,10 +119,10 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length) p++; } - if (*(e + 1) == '\0') { /* only scheme is available */ + if (e + 1 == ue) { /* only scheme is available */ ret->scheme = estrndup(s, (e - s)); php_replace_controlchars_ex(ret->scheme, (e - s)); - goto end; + return ret; } /* @@ -134,46 +134,39 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length) * correctly parse things like a.com:80 */ p = e + 1; - while (isdigit(*p)) { + while (p < ue && isdigit(*p)) { p++; } - if ((*p == '\0' || *p == '/') && (p - e) < 7) { + if ((p == ue || *p == '/') && (p - e) < 7) { goto parse_port; } ret->scheme = estrndup(s, (e-s)); php_replace_controlchars_ex(ret->scheme, (e - s)); - length -= ++e - s; - s = e; + s = e + 1; goto just_path; } else { ret->scheme = estrndup(s, (e-s)); php_replace_controlchars_ex(ret->scheme, (e - s)); - if (*(e+2) == '/') { + if (e + 2 < ue && *(e + 2) == '/') { s = e + 3; if (!strncasecmp("file", ret->scheme, sizeof("file"))) { - if (*(e + 3) == '/') { + if (e + 3 < ue && *(e + 3) == '/') { /* support windows drive letters as in: file:///c:/somedir/file.txt */ - if (*(e + 5) == ':') { + if (e + 5 < ue && *(e + 5) == ':') { s = e + 4; } - goto nohost; + goto just_path; } } } else { - if (!strncasecmp("file", ret->scheme, sizeof("file"))) { - s = e + 1; - goto nohost; - } else { - length -= ++e - s; - s = e; - goto just_path; - } + s = e + 1; + goto just_path; } } } else if (e) { /* no scheme; starts with colon: look for port */ @@ -181,18 +174,18 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length) p = e + 1; pp = p; - while (pp-p < 6 && isdigit(*pp)) { + while (pp < ue && pp - p < 6 && isdigit(*pp)) { pp++; } - if (pp - p > 0 && pp - p < 6 && (*pp == '/' || *pp == '\0')) { + if (pp - p > 0 && pp - p < 6 && (pp == ue || *pp == '/')) { zend_long port; memcpy(port_buf, p, (pp - p)); port_buf[pp - p] = '\0'; port = ZEND_STRTOL(port_buf, NULL, 10); if (port > 0 && port <= 65535) { ret->port = (unsigned short) port; - if (*s == '/' && *(s + 1) == '/') { /* relative-scheme URL */ + if (s + 1 < ue && *s == '/' && *(s + 1) == '/') { /* relative-scheme URL */ s += 2; } } else { @@ -200,24 +193,32 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length) efree(ret); return NULL; } - } else if (p == pp && *pp == '\0') { + } else if (p == pp && pp == ue) { if (ret->scheme) efree(ret->scheme); efree(ret); return NULL; - } else if (*s == '/' && *(s + 1) == '/') { /* relative-scheme URL */ + } else if (s + 1 < ue && *s == '/' && *(s + 1) == '/') { /* relative-scheme URL */ s += 2; } else { goto just_path; } - } else if (*s == '/' && *(s + 1) == '/') { /* relative-scheme URL */ + } else if (s + 1 < ue && *s == '/' && *(s + 1) == '/') { /* relative-scheme URL */ s += 2; } else { - just_path: - ue = s + length; - goto nohost; + goto just_path; } - e = s + strcspn(s, "/?#"); + /* Binary-safe strcspn(s, "/?#") */ + e = ue; + if ((p = memchr(s, '/', e - s))) { + e = p; + } + if ((p = memchr(s, '?', e - s))) { + e = p; + } + if ((p = memchr(s, '#', e - s))) { + e = p; + } /* check for login and password */ if ((p = zend_memrchr(s, '@', (e-s)))) { @@ -237,18 +238,16 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length) } /* check for port */ - if (*s == '[' && *(e-1) == ']') { + if (s < ue && *s == '[' && *(e-1) == ']') { /* Short circuit portscan, we're dealing with an IPv6 embedded address */ - p = s; + p = NULL; } else { - /* memrchr is a GNU specific extension - Emulate for wide compatibility */ - for(p = e; p >= s && *p != ':'; p--); + p = zend_memrchr(s, ':', (e-s)); } - if (p >= s && *p == ':') { + if (p) { if (!ret->port) { p++; if (e-p > 5) { /* port cannot be longer then 5 characters */ @@ -296,54 +295,34 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length) s = e; - nohost: - - if ((p = memchr(s, '?', (ue - s)))) { - pp = memchr(s, '#', (ue - s)); - - if (pp && pp < p) { - if (pp - s) { - ret->path = estrndup(s, (pp-s)); - php_replace_controlchars_ex(ret->path, (pp - s)); - } - p = pp; - goto label_parse; - } + just_path: - if (p - s) { - ret->path = estrndup(s, (p-s)); - php_replace_controlchars_ex(ret->path, (p - s)); - } - - if (pp) { - if (pp - ++p) { - ret->query = estrndup(p, (pp-p)); - php_replace_controlchars_ex(ret->query, (pp - p)); - } - p = pp; - goto label_parse; - } else if (++p - ue) { - ret->query = estrndup(p, (ue-p)); - php_replace_controlchars_ex(ret->query, (ue - p)); - } - } else if ((p = memchr(s, '#', (ue - s)))) { - if (p - s) { - ret->path = estrndup(s, (p-s)); - php_replace_controlchars_ex(ret->path, (p - s)); + e = ue; + p = memchr(s, '#', (e - s)); + if (p) { + p++; + if (p < e) { + ret->fragment = estrndup(p, (e - p)); + php_replace_controlchars_ex(ret->fragment, (e - p)); } + e = p-1; + } - label_parse: + p = memchr(s, '?', (e - s)); + if (p) { p++; - - if (ue - p) { - ret->fragment = estrndup(p, (ue-p)); - php_replace_controlchars_ex(ret->fragment, (ue - p)); + if (p < e) { + ret->query = estrndup(p, (e - p)); + php_replace_controlchars_ex(ret->query, (e - p)); } - } else { - ret->path = estrndup(s, (ue-s)); - php_replace_controlchars_ex(ret->path, (ue - s)); + e = p-1; } -end: + + if (s < e || s == ue) { + ret->path = estrndup(s, (e - s)); + php_replace_controlchars_ex(ret->path, (e - s)); + } + return ret; } /* }}} */ diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c index 2da03cd276..19aff782fd 100644 --- a/ext/standard/user_filters.c +++ b/ext/standard/user_filters.c @@ -175,7 +175,7 @@ php_stream_filter_status_t userfilter_filter( return ret; } - if (!zend_hash_str_exists(Z_OBJPROP_P(obj), "stream", sizeof("stream")-1)) { + if (!zend_hash_str_exists_ind(Z_OBJPROP_P(obj), "stream", sizeof("stream")-1)) { zval tmp; /* Give the userfilter class a hook back to the stream */ diff --git a/ext/standard/var.c b/ext/standard/var.c index 88719ccb64..c04afae4dc 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -860,9 +860,6 @@ again: return; case IS_OBJECT: { - zval retval; - zval fname; - int res; zend_class_entry *ce = Z_OBJCE_P(struc); if (ce->serialize != NULL) { @@ -891,32 +888,39 @@ again: } if (ce != PHP_IC_ENTRY && zend_hash_str_exists(&ce->function_table, "__sleep", sizeof("__sleep")-1)) { + zval fname, tmp, retval; + int res; + + ZVAL_COPY(&tmp, struc); ZVAL_STRINGL(&fname, "__sleep", sizeof("__sleep") - 1); BG(serialize_lock)++; - res = call_user_function_ex(CG(function_table), struc, &fname, &retval, 0, 0, 1, NULL); + res = call_user_function_ex(CG(function_table), &tmp, &fname, &retval, 0, 0, 1, NULL); BG(serialize_lock)--; zval_dtor(&fname); if (EG(exception)) { zval_ptr_dtor(&retval); + zval_ptr_dtor(&tmp); return; } if (res == SUCCESS) { if (Z_TYPE(retval) != IS_UNDEF) { if (HASH_OF(&retval)) { - php_var_serialize_class(buf, struc, &retval, var_hash); + php_var_serialize_class(buf, &tmp, &retval, var_hash); } else { php_error_docref(NULL, E_NOTICE, "__sleep should return an array only containing the names of instance-variables to serialize"); /* we should still add element even if it's not OK, * since we already wrote the length of the array before */ smart_str_appendl(buf,"N;", 2); } - zval_ptr_dtor(&retval); } + zval_ptr_dtor(&retval); + zval_ptr_dtor(&tmp); return; } zval_ptr_dtor(&retval); + zval_ptr_dtor(&tmp); } /* fall-through */ diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c index 6b33d84bd2..d1eb7b4bb0 100644 --- a/ext/standard/var_unserializer.c +++ b/ext/standard/var_unserializer.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.7.5 */ +/* Generated by re2c 0.16 */ #line 1 "ext/standard/var_unserializer.re" /* +----------------------------------------------------------------------+ @@ -587,112 +587,510 @@ static int php_var_unserialize_internal(UNSERIALIZE_PARAMETER) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; - if ((YYLIMIT - YYCURSOR) < 7) YYFILL(7); yych = *YYCURSOR; switch (yych) { case 'C': - case 'O': goto yy13; + case 'O': goto yy4; case 'N': goto yy5; - case 'R': goto yy2; - case 'S': goto yy10; - case 'a': goto yy11; - case 'b': goto yy6; - case 'd': goto yy8; - case 'i': goto yy7; + case 'R': goto yy6; + case 'S': goto yy7; + case 'a': goto yy8; + case 'b': goto yy9; + case 'd': goto yy10; + case 'i': goto yy11; case 'o': goto yy12; - case 'r': goto yy4; - case 's': goto yy9; - case '}': goto yy14; - default: goto yy16; + case 'r': goto yy13; + case 's': goto yy14; + case '}': goto yy15; + default: goto yy2; } yy2: - yych = *(YYMARKER = ++YYCURSOR); - if (yych == ':') goto yy95; + ++YYCURSOR; yy3: -#line 884 "ext/standard/var_unserializer.re" +#line 922 "ext/standard/var_unserializer.re" { return 0; } -#line 580 "ext/standard/var_unserializer.c" +#line 614 "ext/standard/var_unserializer.c" yy4: yych = *(YYMARKER = ++YYCURSOR); - if (yych == ':') goto yy89; + if (yych == ':') goto yy17; goto yy3; yy5: yych = *++YYCURSOR; - if (yych == ';') goto yy87; + if (yych == ';') goto yy19; goto yy3; yy6: yych = *(YYMARKER = ++YYCURSOR); - if (yych == ':') goto yy83; + if (yych == ':') goto yy21; goto yy3; yy7: yych = *(YYMARKER = ++YYCURSOR); - if (yych == ':') goto yy77; + if (yych == ':') goto yy22; goto yy3; yy8: yych = *(YYMARKER = ++YYCURSOR); - if (yych == ':') goto yy53; + if (yych == ':') goto yy23; goto yy3; yy9: yych = *(YYMARKER = ++YYCURSOR); - if (yych == ':') goto yy46; + if (yych == ':') goto yy24; goto yy3; yy10: yych = *(YYMARKER = ++YYCURSOR); - if (yych == ':') goto yy39; + if (yych == ':') goto yy25; goto yy3; yy11: yych = *(YYMARKER = ++YYCURSOR); - if (yych == ':') goto yy32; + if (yych == ':') goto yy26; goto yy3; yy12: yych = *(YYMARKER = ++YYCURSOR); - if (yych == ':') goto yy25; + if (yych == ':') goto yy27; goto yy3; yy13: yych = *(YYMARKER = ++YYCURSOR); - if (yych == ':') goto yy17; + if (yych == ':') goto yy28; goto yy3; yy14: + yych = *(YYMARKER = ++YYCURSOR); + if (yych == ':') goto yy29; + goto yy3; +yy15: ++YYCURSOR; -#line 878 "ext/standard/var_unserializer.re" +#line 916 "ext/standard/var_unserializer.re" { /* this is the case where we have less data than planned */ php_error_docref(NULL, E_NOTICE, "Unexpected end of serialized data"); return 0; /* not sure if it should be 0 or 1 here? */ } -#line 629 "ext/standard/var_unserializer.c" -yy16: - yych = *++YYCURSOR; - goto yy3; +#line 667 "ext/standard/var_unserializer.c" yy17: yych = *++YYCURSOR; if (yybm[0+yych] & 128) { - goto yy20; + goto yy31; } - if (yych == '+') goto yy19; + if (yych == '+') goto yy30; yy18: YYCURSOR = YYMARKER; goto yy3; yy19: + ++YYCURSOR; +#line 609 "ext/standard/var_unserializer.re" + { + *p = YYCURSOR; + ZVAL_NULL(rval); + return 1; +} +#line 685 "ext/standard/var_unserializer.c" +yy21: + yych = *++YYCURSOR; + if (yych <= ',') { + if (yych == '+') goto yy33; + goto yy18; + } else { + if (yych <= '-') goto yy33; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy34; + goto yy18; + } +yy22: + yych = *++YYCURSOR; + if (yych == '+') goto yy36; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy37; + goto yy18; +yy23: + yych = *++YYCURSOR; + if (yych == '+') goto yy39; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy40; + goto yy18; +yy24: + yych = *++YYCURSOR; + if (yych <= '/') goto yy18; + if (yych <= '1') goto yy42; + goto yy18; +yy25: + yych = *++YYCURSOR; + if (yych <= '/') { + if (yych <= ',') { + if (yych == '+') goto yy43; + goto yy18; + } else { + if (yych <= '-') goto yy44; + if (yych <= '.') goto yy45; + goto yy18; + } + } else { + if (yych <= 'I') { + if (yych <= '9') goto yy46; + if (yych <= 'H') goto yy18; + goto yy48; + } else { + if (yych == 'N') goto yy49; + goto yy18; + } + } +yy26: + yych = *++YYCURSOR; + if (yych <= ',') { + if (yych == '+') goto yy50; + goto yy18; + } else { + if (yych <= '-') goto yy50; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy51; + goto yy18; + } +yy27: + yych = *++YYCURSOR; + if (yych <= ',') { + if (yych == '+') goto yy53; + goto yy18; + } else { + if (yych <= '-') goto yy53; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy54; + goto yy18; + } +yy28: + yych = *++YYCURSOR; + if (yych <= ',') { + if (yych == '+') goto yy56; + goto yy18; + } else { + if (yych <= '-') goto yy56; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy57; + goto yy18; + } +yy29: + yych = *++YYCURSOR; + if (yych == '+') goto yy59; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy60; + goto yy18; +yy30: yych = *++YYCURSOR; if (yybm[0+yych] & 128) { - goto yy20; + goto yy31; } goto yy18; -yy20: +yy31: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yybm[0+yych] & 128) { - goto yy20; + goto yy31; } if (yych <= '/') goto yy18; - if (yych >= ';') goto yy18; + if (yych <= ':') goto yy62; + goto yy18; +yy33: + yych = *++YYCURSOR; + if (yych <= '/') goto yy18; + if (yych >= ':') goto yy18; +yy34: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy34; + if (yych == ';') goto yy63; + goto yy18; +yy36: + yych = *++YYCURSOR; + if (yych <= '/') goto yy18; + if (yych >= ':') goto yy18; +yy37: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy37; + if (yych <= ':') goto yy65; + goto yy18; +yy39: + yych = *++YYCURSOR; + if (yych <= '/') goto yy18; + if (yych >= ':') goto yy18; +yy40: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy40; + if (yych <= ':') goto yy66; + goto yy18; +yy42: + yych = *++YYCURSOR; + if (yych == ';') goto yy67; + goto yy18; +yy43: + yych = *++YYCURSOR; + if (yych == '.') goto yy45; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy46; + goto yy18; +yy44: + yych = *++YYCURSOR; + if (yych <= '/') { + if (yych != '.') goto yy18; + } else { + if (yych <= '9') goto yy46; + if (yych == 'I') goto yy48; + goto yy18; + } +yy45: + yych = *++YYCURSOR; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy69; + goto yy18; +yy46: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); + yych = *YYCURSOR; + if (yych <= ':') { + if (yych <= '.') { + if (yych <= '-') goto yy18; + goto yy69; + } else { + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy46; + goto yy18; + } + } else { + if (yych <= 'E') { + if (yych <= ';') goto yy71; + if (yych <= 'D') goto yy18; + goto yy73; + } else { + if (yych == 'e') goto yy73; + goto yy18; + } + } +yy48: + yych = *++YYCURSOR; + if (yych == 'N') goto yy74; + goto yy18; +yy49: + yych = *++YYCURSOR; + if (yych == 'A') goto yy75; + goto yy18; +yy50: + yych = *++YYCURSOR; + if (yych <= '/') goto yy18; + if (yych >= ':') goto yy18; +yy51: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy51; + if (yych == ';') goto yy76; + goto yy18; +yy53: + yych = *++YYCURSOR; + if (yych <= '/') goto yy18; + if (yych >= ':') goto yy18; +yy54: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy54; + if (yych <= ':') goto yy78; + goto yy18; +yy56: + yych = *++YYCURSOR; + if (yych <= '/') goto yy18; + if (yych >= ':') goto yy18; +yy57: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy57; + if (yych == ';') goto yy79; + goto yy18; +yy59: + yych = *++YYCURSOR; + if (yych <= '/') goto yy18; + if (yych >= ':') goto yy18; +yy60: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy60; + if (yych <= ':') goto yy81; + goto yy18; +yy62: + yych = *++YYCURSOR; + if (yych == '"') goto yy82; + goto yy18; +yy63: + ++YYCURSOR; +#line 558 "ext/standard/var_unserializer.re" + { + zend_long id; + + *p = YYCURSOR; + if (!var_hash) return 0; + + id = parse_iv(start + 2) - 1; + if (id == -1 || (rval_ref = var_access(var_hash, id)) == NULL) { + return 0; + } + + zval_ptr_dtor(rval); + if (Z_ISUNDEF_P(rval_ref) || (Z_ISREF_P(rval_ref) && Z_ISUNDEF_P(Z_REFVAL_P(rval_ref)))) { + ZVAL_UNDEF(rval); + return 1; + } + if (Z_ISREF_P(rval_ref)) { + ZVAL_COPY(rval, rval_ref); + } else { + ZVAL_NEW_REF(rval_ref, rval_ref); + ZVAL_COPY(rval, rval_ref); + } + + return 1; +} +#line 961 "ext/standard/var_unserializer.c" +yy65: + yych = *++YYCURSOR; + if (yych == '"') goto yy84; + goto yy18; +yy66: yych = *++YYCURSOR; - if (yych != '"') goto yy18; + if (yych == '{') goto yy86; + goto yy18; +yy67: ++YYCURSOR; -#line 733 "ext/standard/var_unserializer.re" +#line 615 "ext/standard/var_unserializer.re" + { + *p = YYCURSOR; + ZVAL_BOOL(rval, parse_iv(start + 2)); + return 1; +} +#line 978 "ext/standard/var_unserializer.c" +yy69: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); + yych = *YYCURSOR; + if (yych <= ';') { + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy69; + if (yych <= ':') goto yy18; + } else { + if (yych <= 'E') { + if (yych <= 'D') goto yy18; + goto yy73; + } else { + if (yych == 'e') goto yy73; + goto yy18; + } + } +yy71: + ++YYCURSOR; +#line 663 "ext/standard/var_unserializer.re" + { +#if SIZEOF_ZEND_LONG == 4 +use_double: +#endif + *p = YYCURSOR; + ZVAL_DOUBLE(rval, zend_strtod((const char *)start + 2, NULL)); + return 1; +} +#line 1007 "ext/standard/var_unserializer.c" +yy73: + yych = *++YYCURSOR; + if (yych <= ',') { + if (yych == '+') goto yy88; + goto yy18; + } else { + if (yych <= '-') goto yy88; + if (yych <= '/') goto yy18; + if (yych <= '9') goto yy89; + goto yy18; + } +yy74: + yych = *++YYCURSOR; + if (yych == 'F') goto yy91; + goto yy18; +yy75: + yych = *++YYCURSOR; + if (yych == 'N') goto yy91; + goto yy18; +yy76: + ++YYCURSOR; +#line 621 "ext/standard/var_unserializer.re" + { +#if SIZEOF_ZEND_LONG == 4 + int digits = YYCURSOR - start - 3; + + if (start[2] == '-' || start[2] == '+') { + digits--; + } + + /* Use double for large zend_long values that were serialized on a 64-bit system */ + if (digits >= MAX_LENGTH_OF_LONG - 1) { + if (digits == MAX_LENGTH_OF_LONG - 1) { + int cmp = strncmp((char*)YYCURSOR - MAX_LENGTH_OF_LONG, long_min_digits, MAX_LENGTH_OF_LONG - 1); + + if (!(cmp < 0 || (cmp == 0 && start[2] == '-'))) { + goto use_double; + } + } else { + goto use_double; + } + } +#endif + *p = YYCURSOR; + ZVAL_LONG(rval, parse_iv(start + 2)); + return 1; +} +#line 1055 "ext/standard/var_unserializer.c" +yy78: + yych = *++YYCURSOR; + if (yych == '"') goto yy92; + goto yy18; +yy79: + ++YYCURSOR; +#line 584 "ext/standard/var_unserializer.re" + { + zend_long id; + + *p = YYCURSOR; + if (!var_hash) return 0; + + id = parse_iv(start + 2) - 1; + if (id == -1 || (rval_ref = var_access(var_hash, id)) == NULL) { + return 0; + } + + if (rval_ref == rval) { + return 0; + } + + if (Z_ISUNDEF_P(rval_ref) || (Z_ISREF_P(rval_ref) && Z_ISUNDEF_P(Z_REFVAL_P(rval_ref)))) { + ZVAL_UNDEF(rval); + return 1; + } + + ZVAL_COPY(rval, rval_ref); + + return 1; +} +#line 1087 "ext/standard/var_unserializer.c" +yy81: + yych = *++YYCURSOR; + if (yych == '"') goto yy94; + goto yy18; +yy82: + ++YYCURSOR; +#line 769 "ext/standard/var_unserializer.re" { size_t len, len2, len3, maxlen; zend_long elements; @@ -803,11 +1201,13 @@ yy20: } /* The callback function may have defined the class */ + BG(serialize_lock)++; if ((ce = zend_lookup_class(class_name)) == NULL) { php_error_docref(NULL, E_WARNING, "Function %s() hasn't defined the class it was called for", Z_STRVAL(user_func)); incomplete_class = 1; ce = PHP_IC_ENTRY; } + BG(serialize_lock)--; zval_ptr_dtor(&user_func); zval_ptr_dtor(&args[0]); @@ -837,105 +1237,10 @@ yy20: return object_common2(UNSERIALIZE_PASSTHRU, elements); } -#line 805 "ext/standard/var_unserializer.c" -yy25: - yych = *++YYCURSOR; - if (yych <= ',') { - if (yych != '+') goto yy18; - } else { - if (yych <= '-') goto yy26; - if (yych <= '/') goto yy18; - if (yych <= '9') goto yy27; - goto yy18; - } -yy26: - yych = *++YYCURSOR; - if (yych <= '/') goto yy18; - if (yych >= ':') goto yy18; -yy27: - ++YYCURSOR; - if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); - yych = *YYCURSOR; - if (yych <= '/') goto yy18; - if (yych <= '9') goto yy27; - if (yych >= ';') goto yy18; - yych = *++YYCURSOR; - if (yych != '"') goto yy18; - ++YYCURSOR; -#line 726 "ext/standard/var_unserializer.re" - { - if (!var_hash) return 0; - - return object_common2(UNSERIALIZE_PASSTHRU, - object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR)); -} -#line 837 "ext/standard/var_unserializer.c" -yy32: - yych = *++YYCURSOR; - if (yych == '+') goto yy33; - if (yych <= '/') goto yy18; - if (yych <= '9') goto yy34; - goto yy18; -yy33: - yych = *++YYCURSOR; - if (yych <= '/') goto yy18; - if (yych >= ':') goto yy18; -yy34: - ++YYCURSOR; - if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); - yych = *YYCURSOR; - if (yych <= '/') goto yy18; - if (yych <= '9') goto yy34; - if (yych >= ';') goto yy18; - yych = *++YYCURSOR; - if (yych != '{') goto yy18; - ++YYCURSOR; -#line 702 "ext/standard/var_unserializer.re" - { - zend_long elements = parse_iv(start + 2); - /* use iv() not uiv() in order to check data range */ - *p = YYCURSOR; - if (!var_hash) return 0; - - if (elements < 0) { - return 0; - } - - array_init_size(rval, elements); - if (elements) { - /* we can't convert from packed to hash during unserialization, because - reference to some zvals might be keept in var_hash (to support references) */ - zend_hash_real_init(Z_ARRVAL_P(rval), 0); - } - - if (!process_nested_data(UNSERIALIZE_PASSTHRU, Z_ARRVAL_P(rval), elements, 0)) { - return 0; - } - - return finish_nested_data(UNSERIALIZE_PASSTHRU); -} -#line 882 "ext/standard/var_unserializer.c" -yy39: - yych = *++YYCURSOR; - if (yych == '+') goto yy40; - if (yych <= '/') goto yy18; - if (yych <= '9') goto yy41; - goto yy18; -yy40: - yych = *++YYCURSOR; - if (yych <= '/') goto yy18; - if (yych >= ':') goto yy18; -yy41: - ++YYCURSOR; - if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); - yych = *YYCURSOR; - if (yych <= '/') goto yy18; - if (yych <= '9') goto yy41; - if (yych >= ';') goto yy18; - yych = *++YYCURSOR; - if (yych != '"') goto yy18; +#line 1241 "ext/standard/var_unserializer.c" +yy84: ++YYCURSOR; -#line 668 "ext/standard/var_unserializer.re" +#line 704 "ext/standard/var_unserializer.re" { size_t len, maxlen; zend_string *str; @@ -969,407 +1274,127 @@ yy41: ZVAL_STR(rval, str); return 1; } -#line 937 "ext/standard/var_unserializer.c" -yy46: - yych = *++YYCURSOR; - if (yych == '+') goto yy47; - if (yych <= '/') goto yy18; - if (yych <= '9') goto yy48; - goto yy18; -yy47: - yych = *++YYCURSOR; - if (yych <= '/') goto yy18; - if (yych >= ':') goto yy18; -yy48: - ++YYCURSOR; - if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); - yych = *YYCURSOR; - if (yych <= '/') goto yy18; - if (yych <= '9') goto yy48; - if (yych >= ';') goto yy18; - yych = *++YYCURSOR; - if (yych != '"') goto yy18; +#line 1278 "ext/standard/var_unserializer.c" +yy86: ++YYCURSOR; -#line 636 "ext/standard/var_unserializer.re" +#line 738 "ext/standard/var_unserializer.re" { - size_t len, maxlen; - char *str; + zend_long elements = parse_iv(start + 2); + /* use iv() not uiv() in order to check data range */ + *p = YYCURSOR; + if (!var_hash) return 0; - len = parse_uiv(start + 2); - maxlen = max - YYCURSOR; - if (maxlen < len) { - *p = start + 2; + if (elements < 0) { return 0; } - str = (char*)YYCURSOR; - - YYCURSOR += len; - - if (*(YYCURSOR) != '"') { - *p = YYCURSOR; - return 0; + array_init_size(rval, elements); + if (elements) { + /* we can't convert from packed to hash during unserialization, because + reference to some zvals might be keept in var_hash (to support references) */ + zend_hash_real_init(Z_ARRVAL_P(rval), 0); } - if (*(YYCURSOR + 1) != ';') { - *p = YYCURSOR + 1; + if (!process_nested_data(UNSERIALIZE_PASSTHRU, Z_ARRVAL_P(rval), elements, 0)) { return 0; } - YYCURSOR += 2; - *p = YYCURSOR; - - ZVAL_STRINGL(rval, str, len); - return 1; -} -#line 990 "ext/standard/var_unserializer.c" -yy53: - yych = *++YYCURSOR; - if (yych <= '/') { - if (yych <= ',') { - if (yych == '+') goto yy57; - goto yy18; - } else { - if (yych <= '-') goto yy55; - if (yych <= '.') goto yy60; - goto yy18; - } - } else { - if (yych <= 'I') { - if (yych <= '9') goto yy58; - if (yych <= 'H') goto yy18; - goto yy56; - } else { - if (yych != 'N') goto yy18; - } - } - yych = *++YYCURSOR; - if (yych == 'A') goto yy76; - goto yy18; -yy55: - yych = *++YYCURSOR; - if (yych <= '/') { - if (yych == '.') goto yy60; - goto yy18; - } else { - if (yych <= '9') goto yy58; - if (yych != 'I') goto yy18; - } -yy56: - yych = *++YYCURSOR; - if (yych == 'N') goto yy72; - goto yy18; -yy57: - yych = *++YYCURSOR; - if (yych == '.') goto yy60; - if (yych <= '/') goto yy18; - if (yych >= ':') goto yy18; -yy58: - ++YYCURSOR; - if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); - yych = *YYCURSOR; - if (yych <= ':') { - if (yych <= '.') { - if (yych <= '-') goto yy18; - goto yy70; - } else { - if (yych <= '/') goto yy18; - if (yych <= '9') goto yy58; - goto yy18; - } - } else { - if (yych <= 'E') { - if (yych <= ';') goto yy63; - if (yych <= 'D') goto yy18; - goto yy65; - } else { - if (yych == 'e') goto yy65; - goto yy18; - } - } -yy60: - yych = *++YYCURSOR; - if (yych <= '/') goto yy18; - if (yych >= ':') goto yy18; -yy61: - ++YYCURSOR; - if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); - yych = *YYCURSOR; - if (yych <= ';') { - if (yych <= '/') goto yy18; - if (yych <= '9') goto yy61; - if (yych <= ':') goto yy18; - } else { - if (yych <= 'E') { - if (yych <= 'D') goto yy18; - goto yy65; - } else { - if (yych == 'e') goto yy65; - goto yy18; - } - } -yy63: - ++YYCURSOR; -#line 627 "ext/standard/var_unserializer.re" - { -#if SIZEOF_ZEND_LONG == 4 -use_double: -#endif - *p = YYCURSOR; - ZVAL_DOUBLE(rval, zend_strtod((const char *)start + 2, NULL)); - return 1; + return finish_nested_data(UNSERIALIZE_PASSTHRU); } -#line 1087 "ext/standard/var_unserializer.c" -yy65: +#line 1305 "ext/standard/var_unserializer.c" +yy88: yych = *++YYCURSOR; if (yych <= ',') { - if (yych != '+') goto yy18; - } else { - if (yych <= '-') goto yy66; - if (yych <= '/') goto yy18; - if (yych <= '9') goto yy67; - goto yy18; - } -yy66: - yych = *++YYCURSOR; - if (yych <= ',') { - if (yych == '+') goto yy69; + if (yych == '+') goto yy96; goto yy18; } else { - if (yych <= '-') goto yy69; + if (yych <= '-') goto yy96; if (yych <= '/') goto yy18; if (yych >= ':') goto yy18; } -yy67: +yy89: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= '/') goto yy18; - if (yych <= '9') goto yy67; - if (yych == ';') goto yy63; + if (yych <= '9') goto yy89; + if (yych == ';') goto yy71; goto yy18; -yy69: +yy91: yych = *++YYCURSOR; - if (yych <= '/') goto yy18; - if (yych <= '9') goto yy67; + if (yych == ';') goto yy97; goto yy18; -yy70: - ++YYCURSOR; - if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); - yych = *YYCURSOR; - if (yych <= ';') { - if (yych <= '/') goto yy18; - if (yych <= '9') goto yy70; - if (yych <= ':') goto yy18; - goto yy63; - } else { - if (yych <= 'E') { - if (yych <= 'D') goto yy18; - goto yy65; - } else { - if (yych == 'e') goto yy65; - goto yy18; - } - } -yy72: - yych = *++YYCURSOR; - if (yych != 'F') goto yy18; -yy73: - yych = *++YYCURSOR; - if (yych != ';') goto yy18; +yy92: ++YYCURSOR; -#line 611 "ext/standard/var_unserializer.re" +#line 762 "ext/standard/var_unserializer.re" { - *p = YYCURSOR; - - if (!strncmp((char*)start + 2, "NAN", 3)) { - ZVAL_DOUBLE(rval, php_get_nan()); - } else if (!strncmp((char*)start + 2, "INF", 3)) { - ZVAL_DOUBLE(rval, php_get_inf()); - } else if (!strncmp((char*)start + 2, "-INF", 4)) { - ZVAL_DOUBLE(rval, -php_get_inf()); - } else { - ZVAL_NULL(rval); - } + if (!var_hash) return 0; - return 1; + return object_common2(UNSERIALIZE_PASSTHRU, + object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR)); } -#line 1162 "ext/standard/var_unserializer.c" -yy76: - yych = *++YYCURSOR; - if (yych == 'N') goto yy73; - goto yy18; -yy77: - yych = *++YYCURSOR; - if (yych <= ',') { - if (yych != '+') goto yy18; - } else { - if (yych <= '-') goto yy78; - if (yych <= '/') goto yy18; - if (yych <= '9') goto yy79; - goto yy18; - } -yy78: - yych = *++YYCURSOR; - if (yych <= '/') goto yy18; - if (yych >= ':') goto yy18; -yy79: +#line 1337 "ext/standard/var_unserializer.c" +yy94: ++YYCURSOR; - if (YYLIMIT <= YYCURSOR) YYFILL(1); - yych = *YYCURSOR; - if (yych <= '/') goto yy18; - if (yych <= '9') goto yy79; - if (yych != ';') goto yy18; - ++YYCURSOR; -#line 585 "ext/standard/var_unserializer.re" +#line 672 "ext/standard/var_unserializer.re" { -#if SIZEOF_ZEND_LONG == 4 - int digits = YYCURSOR - start - 3; + size_t len, maxlen; + char *str; - if (start[2] == '-' || start[2] == '+') { - digits--; + len = parse_uiv(start + 2); + maxlen = max - YYCURSOR; + if (maxlen < len) { + *p = start + 2; + return 0; } - /* Use double for large zend_long values that were serialized on a 64-bit system */ - if (digits >= MAX_LENGTH_OF_LONG - 1) { - if (digits == MAX_LENGTH_OF_LONG - 1) { - int cmp = strncmp((char*)YYCURSOR - MAX_LENGTH_OF_LONG, long_min_digits, MAX_LENGTH_OF_LONG - 1); - - if (!(cmp < 0 || (cmp == 0 && start[2] == '-'))) { - goto use_double; - } - } else { - goto use_double; - } - } -#endif - *p = YYCURSOR; - ZVAL_LONG(rval, parse_iv(start + 2)); - return 1; -} -#line 1215 "ext/standard/var_unserializer.c" -yy83: - yych = *++YYCURSOR; - if (yych <= '/') goto yy18; - if (yych >= '2') goto yy18; - yych = *++YYCURSOR; - if (yych != ';') goto yy18; - ++YYCURSOR; -#line 579 "ext/standard/var_unserializer.re" - { - *p = YYCURSOR; - ZVAL_BOOL(rval, parse_iv(start + 2)); - return 1; -} -#line 1229 "ext/standard/var_unserializer.c" -yy87: - ++YYCURSOR; -#line 573 "ext/standard/var_unserializer.re" - { - *p = YYCURSOR; - ZVAL_NULL(rval); - return 1; -} -#line 1238 "ext/standard/var_unserializer.c" -yy89: - yych = *++YYCURSOR; - if (yych <= ',') { - if (yych != '+') goto yy18; - } else { - if (yych <= '-') goto yy90; - if (yych <= '/') goto yy18; - if (yych <= '9') goto yy91; - goto yy18; - } -yy90: - yych = *++YYCURSOR; - if (yych <= '/') goto yy18; - if (yych >= ':') goto yy18; -yy91: - ++YYCURSOR; - if (YYLIMIT <= YYCURSOR) YYFILL(1); - yych = *YYCURSOR; - if (yych <= '/') goto yy18; - if (yych <= '9') goto yy91; - if (yych != ';') goto yy18; - ++YYCURSOR; -#line 548 "ext/standard/var_unserializer.re" - { - zend_long id; + str = (char*)YYCURSOR; - *p = YYCURSOR; - if (!var_hash) return 0; + YYCURSOR += len; - id = parse_iv(start + 2) - 1; - if (id == -1 || (rval_ref = var_access(var_hash, id)) == NULL) { + if (*(YYCURSOR) != '"') { + *p = YYCURSOR; return 0; } - if (rval_ref == rval) { + if (*(YYCURSOR + 1) != ';') { + *p = YYCURSOR + 1; return 0; } - if (Z_ISUNDEF_P(rval_ref) || (Z_ISREF_P(rval_ref) && Z_ISUNDEF_P(Z_REFVAL_P(rval_ref)))) { - ZVAL_UNDEF(rval); - return 1; - } - - ZVAL_COPY(rval, rval_ref); + YYCURSOR += 2; + *p = YYCURSOR; + ZVAL_STRINGL(rval, str, len); return 1; } -#line 1286 "ext/standard/var_unserializer.c" -yy95: - yych = *++YYCURSOR; - if (yych <= ',') { - if (yych != '+') goto yy18; - } else { - if (yych <= '-') goto yy96; - if (yych <= '/') goto yy18; - if (yych <= '9') goto yy97; - goto yy18; - } +#line 1372 "ext/standard/var_unserializer.c" yy96: yych = *++YYCURSOR; if (yych <= '/') goto yy18; - if (yych >= ':') goto yy18; + if (yych <= '9') goto yy89; + goto yy18; yy97: ++YYCURSOR; - if (YYLIMIT <= YYCURSOR) YYFILL(1); - yych = *YYCURSOR; - if (yych <= '/') goto yy18; - if (yych <= '9') goto yy97; - if (yych != ';') goto yy18; - ++YYCURSOR; -#line 522 "ext/standard/var_unserializer.re" +#line 647 "ext/standard/var_unserializer.re" { - zend_long id; - - *p = YYCURSOR; - if (!var_hash) return 0; - - id = parse_iv(start + 2) - 1; - if (id == -1 || (rval_ref = var_access(var_hash, id)) == NULL) { - return 0; - } + *p = YYCURSOR; - zval_ptr_dtor(rval); - if (Z_ISUNDEF_P(rval_ref) || (Z_ISREF_P(rval_ref) && Z_ISUNDEF_P(Z_REFVAL_P(rval_ref)))) { - ZVAL_UNDEF(rval); - return 1; - } - if (Z_ISREF_P(rval_ref)) { - ZVAL_COPY(rval, rval_ref); + if (!strncmp((char*)start + 2, "NAN", 3)) { + ZVAL_DOUBLE(rval, php_get_nan()); + } else if (!strncmp((char*)start + 2, "INF", 3)) { + ZVAL_DOUBLE(rval, php_get_inf()); + } else if (!strncmp((char*)start + 2, "-INF", 4)) { + ZVAL_DOUBLE(rval, -php_get_inf()); } else { - ZVAL_NEW_REF(rval_ref, rval_ref); - ZVAL_COPY(rval, rval_ref); + ZVAL_NULL(rval); } return 1; } -#line 1335 "ext/standard/var_unserializer.c" +#line 1396 "ext/standard/var_unserializer.c" } -#line 886 "ext/standard/var_unserializer.re" +#line 924 "ext/standard/var_unserializer.re" return 0; diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re index 9051894643..978f401ac2 100644 --- a/ext/standard/var_unserializer.re +++ b/ext/standard/var_unserializer.re @@ -876,11 +876,13 @@ object ":" uiv ":" ["] { } /* The callback function may have defined the class */ + BG(serialize_lock)++; if ((ce = zend_lookup_class(class_name)) == NULL) { php_error_docref(NULL, E_WARNING, "Function %s() hasn't defined the class it was called for", Z_STRVAL(user_func)); incomplete_class = 1; ce = PHP_IC_ENTRY; } + BG(serialize_lock)--; zval_ptr_dtor(&user_func); zval_ptr_dtor(&args[0]); diff --git a/ext/standard/versioning.c b/ext/standard/versioning.c index 688f25afad..29f421c72f 100644 --- a/ext/standard/versioning.c +++ b/ext/standard/versioning.c @@ -12,7 +12,7 @@ | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Author: Stig Sæther Bakken <ssb@php.net> | + | Author: Stig Sæther Bakken <ssb@php.net> | +----------------------------------------------------------------------+ */ @@ -33,7 +33,7 @@ PHPAPI char * php_canonicalize_version(const char *version) { - int len = strlen(version); + size_t len = strlen(version); char *buf = safe_emalloc(len, 2, 1), *q, lp, lq; const char *p; diff --git a/ext/wddx/tests/bug73631.phpt b/ext/wddx/tests/bug73631.phpt new file mode 100644 index 0000000000..1fcde72dfe --- /dev/null +++ b/ext/wddx/tests/bug73631.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #73631 (Memory leak due to invalid wddx stack processing) +--SKIPIF-- +<?php if (!extension_loaded("wddx")) print "skip"; ?> +--FILE-- +<?php +$xml = <<<EOF +<?xml version="1.0" ?> +<wddxPacket version="1.0"> +<number>1234</number> +<binary><boolean/></binary> +</wddxPacket> +EOF; +$wddx = wddx_deserialize($xml); +var_dump($wddx); +?> +--EXPECTF-- +int(1234) diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index b188e8929e..d58a564593 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -772,6 +772,11 @@ static void php_wddx_push_element(void *user_data, const XML_Char *name, const X php_wddx_process_data(user_data, atts[i+1], strlen((char *)atts[i+1])); break; } + } else { + ent.type = ST_BOOLEAN; + SET_STACK_VARNAME; + ZVAL_FALSE(&ent.data); + wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); } } else if (!strcmp((char *)name, EL_NULL)) { ent.type = ST_NULL; @@ -902,8 +907,13 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name) } if (!strcmp((char *)name, EL_BINARY)) { - zend_string *new_str = php_base64_decode( - (unsigned char *)Z_STRVAL(ent1->data), Z_STRLEN(ent1->data)); + zend_string *new_str = NULL; + + if (ZSTR_EMPTY_ALLOC() != Z_STR(ent1->data)) { + new_str = php_base64_decode( + (unsigned char *)Z_STRVAL(ent1->data), Z_STRLEN(ent1->data)); + } + zval_ptr_dtor(&ent1->data); if (new_str) { ZVAL_STR(&ent1->data, new_str); diff --git a/ext/xml/xml.c b/ext/xml/xml.c index 43086934a5..f3ca5d3047 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -1610,7 +1610,7 @@ PHP_FUNCTION(xml_parser_set_option) convert_to_long_ex(val); parser->toffset = Z_LVAL_P(val); if (parser->toffset < 0) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "tagstart ignored, because it is out of range"); + php_error_docref(NULL, E_NOTICE, "tagstart ignored, because it is out of range"); parser->toffset = 0; } break; diff --git a/ext/zlib/tests/deflate_add_buffer_full.phpt b/ext/zlib/tests/deflate_add_buffer_full.phpt new file mode 100644 index 0000000000..a2b3fc4ab0 --- /dev/null +++ b/ext/zlib/tests/deflate_add_buffer_full.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test deflate_add() buffer issue with data that fills deflate buffer while using ZLIB_SYNC_FLUSH on ZLIB_ENCODING_RAW. +--SKIPIF-- +<?php +if (!extension_loaded("zlib")) { + print "skip - ZLIB extension not loaded"; +} +?> +--FILE-- +<?php + +/* + * When using ZLIB_ENCODING_RAW, the deflated buffer should always end in 00 00 ff ff + * Many streaming deflate users rely on this behaviour. + * example: websocket permessage-deflate extension + * (https://tools.ietf.org/html/draft-ietf-hybi-permessage-compression-28#section-7.2.1) + * + * Prior to fixing, the output buffer size was not being checked. According to the zlib + * manual, deflate must be called again with more buffer space. + */ + +$deflateContext = deflate_init(ZLIB_ENCODING_RAW); + +$deflated = deflate_add( + $deflateContext, + hex2bin("255044462d312e320a25c7ec8fa20a362030206f626a0a3c3c2f4c656e6774682037203020522f46696c746572202f466c6174654465636f64653e3e0a737472"), + ZLIB_SYNC_FLUSH +); + +echo bin2hex(substr($deflated, strlen($deflated) - 4)) . "\n"; + +$deflated = deflate_add( + $deflateContext, + hex2bin("65616d0a789c7d53c16ed43010bde7c037f85824766a7bc6767c2ca8a00a016a1b2edcb2dbecaed1266937d98afe3d6327363794439437e3f17b6f5e242821e3"), + ZLIB_SYNC_FLUSH +); + +echo bin2hex(substr($deflated, strlen($deflated) - 4)) . "\n"; + +$deflated = deflate_add( + $deflateContext, + hex2bin("b3be777df5525d3f90384cd58b50a9945fbb5e7c6cb8c89fca8156c688665f2de794504a81f75658a7c1d54a347d7575fb6e17ba617edffcae9c84da3aee6c9e"), + ZLIB_SYNC_FLUSH +); + +echo bin2hex(substr($deflated, strlen($deflated) - 4)) . "\n"; +?> +===DONE=== +--EXPECTF-- +0000ffff +0000ffff +0000ffff +===DONE=== diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index d9d6be1638..bbe1334ca9 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -1115,7 +1115,7 @@ PHP_FUNCTION(deflate_add) { zend_string *out; char *in_buf; - size_t in_len, out_size; + size_t in_len, out_size, buffer_used; zval *res; z_stream *ctx; zend_long flush_type = Z_SYNC_FLUSH; @@ -1157,6 +1157,7 @@ PHP_FUNCTION(deflate_add) out_size = PHP_ZLIB_BUFFER_SIZE_GUESS(ctx->total_in + in_len); out_size = (ctx->total_out >= out_size) ? 16 : (out_size - ctx->total_out); out_size = (out_size < 16) ? 16 : out_size; + out_size += 64; out = zend_string_alloc(out_size, 0); ctx->next_in = (Bytef *) in_buf; @@ -1164,7 +1165,21 @@ PHP_FUNCTION(deflate_add) ctx->avail_in = in_len; ctx->avail_out = ZSTR_LEN(out); - status = deflate(ctx, flush_type); + buffer_used = 0; + + do { + if (ctx->avail_out == 0) { + /* more output buffer space needed; realloc and try again */ + /* adding 64 more bytes solved every issue I have seen */ + /* the + 1 is for the string terminator added below */ + out = zend_string_realloc(out, ZSTR_LEN(out) + 64 + 1, 0); + ctx->avail_out = 64; + ctx->next_out = (Bytef *) ZSTR_VAL(out) + buffer_used; + } + status = deflate(ctx, flush_type); + buffer_used = ZSTR_LEN(out) - ctx->avail_out; + } while (status == Z_OK && ctx->avail_out == 0); + switch (status) { case Z_OK: ZSTR_LEN(out) = (char *) ctx->next_out - ZSTR_VAL(out); |
