diff options
Diffstat (limited to 'ext')
129 files changed, 3452 insertions, 1858 deletions
diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 043e14fdab..dc9071f352 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -1486,8 +1486,12 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) ZVAL_RES(&argv[0], ch->res); Z_ADDREF(argv[0]); - ZVAL_RES(&argv[1], t->res); - Z_ADDREF(argv[1]); + if (t->res) { + ZVAL_RES(&argv[1], t->res); + Z_ADDREF(argv[1]); + } else { + ZVAL_NULL(&argv[1]); + } ZVAL_LONG(&argv[2], (int)size * nmemb); fci.size = sizeof(fci); diff --git a/ext/curl/multi.c b/ext/curl/multi.c index adab5fa219..e3db38b207 100644 --- a/ext/curl/multi.c +++ b/ext/curl/multi.c @@ -105,6 +105,10 @@ void _php_curl_multi_cleanup_list(void *data) /* {{{ */ return; } + if (Z_RES_P(z_ch)->ptr == NULL) { + return; + } + ch = zend_fetch_resource(z_ch, -1, le_curl_name, NULL, 1, le_curl); if (!ch) { return; @@ -341,9 +345,11 @@ void _php_curl_multi_close(zend_resource *rsrc) /* {{{ */ for (pz_ch = (zval *)zend_llist_get_first_ex(&mh->easyh, &pos); pz_ch; pz_ch = (zval *)zend_llist_get_next_ex(&mh->easyh, &pos)) { - - ch = (php_curl *) zend_fetch_resource(pz_ch, -1, le_curl_name, NULL, 1, le_curl); - _php_curl_verify_handlers(ch, 0); + /* ptr is NULL means it already be freed */ + if (Z_RES_P(pz_ch)->ptr) { + ch = (php_curl *) zend_fetch_resource(pz_ch, -1, le_curl_name, NULL, 1, le_curl); + _php_curl_verify_handlers(ch, 0); + } } curl_multi_cleanup(mh->multi); diff --git a/ext/curl/tests/bug68937.phpt b/ext/curl/tests/bug68937.phpt new file mode 100644 index 0000000000..a661ec01ce --- /dev/null +++ b/ext/curl/tests/bug68937.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug # #68937 (Segfault in curl_multi_exec) +--SKIPIF-- +<?php +if (getenv("SKIP_ONLINE_TESTS")) die("skip online test"); +include 'skipif.inc'; +?> +--FILE-- +<?php + +$ch = curl_init('http://www.google.com/'); +curl_setopt_array($ch, array( + CURLOPT_HEADER => false, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_POST => true, + CURLOPT_INFILESIZE => 1, + CURLOPT_HTTPHEADER => array( + 'Content-Length: 1', + ), + CURLOPT_READFUNCTION => 'curl_read' +)); + +function curl_read($ch, $fp, $len) { + var_dump($fp); + exit; +} + +curl_exec($ch); +curl_close($ch); +?> +--EXPECTF-- +NULL diff --git a/ext/curl/tests/bug68937_2.phpt b/ext/curl/tests/bug68937_2.phpt new file mode 100644 index 0000000000..418a96dc8d --- /dev/null +++ b/ext/curl/tests/bug68937_2.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug # #68937 (Segfault in curl_multi_exec) +--SKIPIF-- +<?php +if (getenv("SKIP_ONLINE_TESTS")) die("skip online test"); +include 'skipif.inc'; +?> +--FILE-- +<?php + +$ch = curl_init('http://www.google.com/'); +curl_setopt_array($ch, array( + CURLOPT_HEADER => false, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_POST => true, + CURLOPT_INFILESIZE => filesize(__FILE__), + CURLOPT_INFILE => fopen(__FILE__, 'r'), + CURLOPT_HTTPHEADER => array( + 'Content-Length: 1', + ), + CURLOPT_READFUNCTION => 'curl_read' +)); + +function curl_read($ch, $fp, $len) { + var_dump($fp); + exit; +} + +curl_exec($ch); +curl_close($ch); +?> +--EXPECTF-- +resource(%d) of type (stream) diff --git a/ext/curl/tests/curl_multi_close_reference.phpt b/ext/curl/tests/curl_multi_close_reference.phpt new file mode 100644 index 0000000000..95f565bb28 --- /dev/null +++ b/ext/curl/tests/curl_multi_close_reference.phpt @@ -0,0 +1,20 @@ +--TEST-- +curl_multi_close closed by cleanup functions +--SKIPIF-- +<?php +if (!extension_loaded('curl')) print 'skip'; +?> +--FILE-- +<?php +$mh = curl_multi_init(); +$array = array($mh); +$array[] = &$array; + +curl_multi_add_handle($mh, curl_init()); +curl_multi_add_handle($mh, curl_init()); +curl_multi_add_handle($mh, curl_init()); +curl_multi_add_handle($mh, curl_init()); +echo "okey"; +?> +--EXPECT-- +okey diff --git a/ext/date/lib/timezonedb.h b/ext/date/lib/timezonedb.h index 6cef9526ca..8d84c7dd9c 100644 --- a/ext/date/lib/timezonedb.h +++ b/ext/date/lib/timezonedb.h @@ -88,503 +88,503 @@ const timelib_tzdb_index_entry timezonedb_idx_builtin[583] = { { "America/Cambridge_Bay" , 0x005A32 }, { "America/Campo_Grande" , 0x005D5A }, { "America/Cancun" , 0x006049 }, - { "America/Caracas" , 0x00628B }, - { "America/Catamarca" , 0x0062F2 }, - { "America/Cayenne" , 0x006498 }, - { "America/Cayman" , 0x0064FA }, - { "America/Chicago" , 0x00654F }, - { "America/Chihuahua" , 0x006A66 }, - { "America/Coral_Harbour" , 0x006CD1 }, - { "America/Cordoba" , 0x006D63 }, - { "America/Costa_Rica" , 0x006F09 }, - { "America/Creston" , 0x006F93 }, - { "America/Cuiaba" , 0x00701F }, - { "America/Curacao" , 0x0072FD }, - { "America/Danmarkshavn" , 0x007363 }, - { "America/Dawson" , 0x0074A7 }, - { "America/Dawson_Creek" , 0x0077C4 }, - { "America/Denver" , 0x00799E }, - { "America/Detroit" , 0x007D24 }, - { "America/Dominica" , 0x008083 }, - { "America/Edmonton" , 0x0080D8 }, - { "America/Eirunepe" , 0x008490 }, - { "America/El_Salvador" , 0x0085A8 }, - { "America/Ensenada" , 0x00861D }, - { "America/Fort_Wayne" , 0x008AC4 }, - { "America/Fortaleza" , 0x008986 }, - { "America/Glace_Bay" , 0x008D2E }, - { "America/Godthab" , 0x0090A5 }, - { "America/Goose_Bay" , 0x009369 }, - { "America/Grand_Turk" , 0x009826 }, - { "America/Grenada" , 0x009A05 }, - { "America/Guadeloupe" , 0x009A5A }, - { "America/Guatemala" , 0x009AAF }, - { "America/Guayaquil" , 0x009B38 }, - { "America/Guyana" , 0x009B95 }, - { "America/Halifax" , 0x009C16 }, - { "America/Havana" , 0x00A12C }, - { "America/Hermosillo" , 0x00A49F }, - { "America/Indiana/Indianapolis" , 0x00A57D }, - { "America/Indiana/Knox" , 0x00A80E }, - { "America/Indiana/Marengo" , 0x00ABA5 }, - { "America/Indiana/Petersburg" , 0x00AE4B }, - { "America/Indiana/Tell_City" , 0x00B398 }, - { "America/Indiana/Vevay" , 0x00B631 }, - { "America/Indiana/Vincennes" , 0x00B86C }, - { "America/Indiana/Winamac" , 0x00BB20 }, - { "America/Indianapolis" , 0x00B12E }, - { "America/Inuvik" , 0x00BDD9 }, - { "America/Iqaluit" , 0x00C0D0 }, - { "America/Jamaica" , 0x00C3F2 }, - { "America/Jujuy" , 0x00C4B7 }, - { "America/Juneau" , 0x00C661 }, - { "America/Kentucky/Louisville" , 0x00C9DF }, - { "America/Kentucky/Monticello" , 0x00CDFD }, - { "America/Knox_IN" , 0x00D182 }, - { "America/Kralendijk" , 0x00D4F3 }, - { "America/La_Paz" , 0x00D559 }, - { "America/Lima" , 0x00D5C0 }, - { "America/Los_Angeles" , 0x00D668 }, - { "America/Louisville" , 0x00DA79 }, - { "America/Lower_Princes" , 0x00DE6E }, - { "America/Maceio" , 0x00DED4 }, - { "America/Managua" , 0x00E00E }, - { "America/Manaus" , 0x00E0C1 }, - { "America/Marigot" , 0x00E1C3 }, - { "America/Martinique" , 0x00E218 }, - { "America/Matamoros" , 0x00E284 }, - { "America/Mazatlan" , 0x00E4DD }, - { "America/Mendoza" , 0x00E74A }, - { "America/Menominee" , 0x00E8FE }, - { "America/Merida" , 0x00EC7F }, - { "America/Metlakatla" , 0x00EEBA }, - { "America/Mexico_City" , 0x00EFF5 }, - { "America/Miquelon" , 0x00F270 }, - { "America/Moncton" , 0x00F4E2 }, - { "America/Monterrey" , 0x00F979 }, - { "America/Montevideo" , 0x00FBDC }, - { "America/Montreal" , 0x00FEEE }, - { "America/Montserrat" , 0x0103DE }, - { "America/Nassau" , 0x010433 }, - { "America/New_York" , 0x010778 }, - { "America/Nipigon" , 0x010C83 }, - { "America/Nome" , 0x010FD4 }, - { "America/Noronha" , 0x011352 }, - { "America/North_Dakota/Beulah" , 0x011482 }, - { "America/North_Dakota/Center" , 0x011816 }, - { "America/North_Dakota/New_Salem" , 0x011BAA }, - { "America/Ojinaga" , 0x011F53 }, - { "America/Panama" , 0x0121B4 }, - { "America/Pangnirtung" , 0x012209 }, - { "America/Paramaribo" , 0x01253F }, - { "America/Phoenix" , 0x0125D1 }, - { "America/Port-au-Prince" , 0x01268F }, - { "America/Port_of_Spain" , 0x0129B3 }, - { "America/Porto_Acre" , 0x0128AF }, - { "America/Porto_Velho" , 0x012A08 }, - { "America/Puerto_Rico" , 0x012AFE }, - { "America/Rainy_River" , 0x012B69 }, - { "America/Rankin_Inlet" , 0x012EA1 }, - { "America/Recife" , 0x013187 }, - { "America/Regina" , 0x0132B1 }, - { "America/Resolute" , 0x01346F }, - { "America/Rio_Branco" , 0x013757 }, - { "America/Rosario" , 0x01385F }, - { "America/Santa_Isabel" , 0x013A05 }, - { "America/Santarem" , 0x013DA8 }, - { "America/Santiago" , 0x013EAD }, - { "America/Santo_Domingo" , 0x014256 }, - { "America/Sao_Paulo" , 0x01431C }, - { "America/Scoresbysund" , 0x01462B }, - { "America/Shiprock" , 0x014919 }, - { "America/Sitka" , 0x014C92 }, - { "America/St_Barthelemy" , 0x01501A }, - { "America/St_Johns" , 0x01506F }, - { "America/St_Kitts" , 0x0155C2 }, - { "America/St_Lucia" , 0x015617 }, - { "America/St_Thomas" , 0x01566C }, - { "America/St_Vincent" , 0x0156C1 }, - { "America/Swift_Current" , 0x015716 }, - { "America/Tegucigalpa" , 0x015837 }, - { "America/Thule" , 0x0158B6 }, - { "America/Thunder_Bay" , 0x015AFD }, - { "America/Tijuana" , 0x015E46 }, - { "America/Toronto" , 0x0161DF }, - { "America/Tortola" , 0x0166FF }, - { "America/Vancouver" , 0x016754 }, - { "America/Virgin" , 0x016B91 }, - { "America/Whitehorse" , 0x016BE6 }, - { "America/Winnipeg" , 0x016F03 }, - { "America/Yakutat" , 0x017343 }, - { "America/Yellowknife" , 0x0176AE }, - { "Antarctica/Casey" , 0x0179BE }, - { "Antarctica/Davis" , 0x017A5C }, - { "Antarctica/DumontDUrville" , 0x017AFD }, - { "Antarctica/Macquarie" , 0x017B8E }, - { "Antarctica/Mawson" , 0x017DDB }, - { "Antarctica/McMurdo" , 0x017E57 }, - { "Antarctica/Palmer" , 0x018202 }, - { "Antarctica/Rothera" , 0x01851E }, - { "Antarctica/South_Pole" , 0x018594 }, - { "Antarctica/Syowa" , 0x018912 }, - { "Antarctica/Troll" , 0x018980 }, - { "Antarctica/Vostok" , 0x018B52 }, - { "Arctic/Longyearbyen" , 0x018BC3 }, - { "Asia/Aden" , 0x018EF5 }, - { "Asia/Almaty" , 0x018F4A }, - { "Asia/Amman" , 0x0190C9 }, - { "Asia/Anadyr" , 0x01937F }, - { "Asia/Aqtau" , 0x019581 }, - { "Asia/Aqtobe" , 0x019780 }, - { "Asia/Ashgabat" , 0x019938 }, - { "Asia/Ashkhabad" , 0x019A55 }, - { "Asia/Baghdad" , 0x019B72 }, - { "Asia/Bahrain" , 0x019CE7 }, - { "Asia/Baku" , 0x019D4D }, - { "Asia/Bangkok" , 0x01A035 }, - { "Asia/Beirut" , 0x01A08A }, - { "Asia/Bishkek" , 0x01A397 }, - { "Asia/Brunei" , 0x01A543 }, - { "Asia/Calcutta" , 0x01A5A5 }, - { "Asia/Chita" , 0x01A61E }, - { "Asia/Choibalsan" , 0x01A833 }, - { "Asia/Chongqing" , 0x01A9AC }, - { "Asia/Chungking" , 0x01AA4C }, - { "Asia/Colombo" , 0x01AAEC }, - { "Asia/Dacca" , 0x01AB88 }, - { "Asia/Damascus" , 0x01AC2E }, - { "Asia/Dhaka" , 0x01AF7E }, - { "Asia/Dili" , 0x01B024 }, - { "Asia/Dubai" , 0x01B0AE }, - { "Asia/Dushanbe" , 0x01B103 }, - { "Asia/Gaza" , 0x01B206 }, - { "Asia/Harbin" , 0x01B559 }, - { "Asia/Hebron" , 0x01B5F9 }, - { "Asia/Ho_Chi_Minh" , 0x01B955 }, - { "Asia/Hong_Kong" , 0x01B9F7 }, - { "Asia/Hovd" , 0x01BBB9 }, - { "Asia/Irkutsk" , 0x01BD31 }, - { "Asia/Istanbul" , 0x01BF1C }, - { "Asia/Jakarta" , 0x01C309 }, - { "Asia/Jayapura" , 0x01C3B3 }, - { "Asia/Jerusalem" , 0x01C450 }, - { "Asia/Kabul" , 0x01C77F }, - { "Asia/Kamchatka" , 0x01C7D0 }, - { "Asia/Karachi" , 0x01C9C9 }, - { "Asia/Kashgar" , 0x01CA7E }, - { "Asia/Kathmandu" , 0x01CAD3 }, - { "Asia/Katmandu" , 0x01CB39 }, - { "Asia/Khandyga" , 0x01CB9F }, - { "Asia/Kolkata" , 0x01CDC9 }, - { "Asia/Krasnoyarsk" , 0x01CE42 }, - { "Asia/Kuala_Lumpur" , 0x01D02F }, - { "Asia/Kuching" , 0x01D0EC }, - { "Asia/Kuwait" , 0x01D1DA }, - { "Asia/Macao" , 0x01D22F }, - { "Asia/Macau" , 0x01D36A }, - { "Asia/Magadan" , 0x01D4A5 }, - { "Asia/Makassar" , 0x01D6A9 }, - { "Asia/Manila" , 0x01D76E }, - { "Asia/Muscat" , 0x01D7F3 }, - { "Asia/Nicosia" , 0x01D848 }, - { "Asia/Novokuznetsk" , 0x01DB30 }, - { "Asia/Novosibirsk" , 0x01DD50 }, - { "Asia/Omsk" , 0x01DF40 }, - { "Asia/Oral" , 0x01E12C }, - { "Asia/Phnom_Penh" , 0x01E2FC }, - { "Asia/Pontianak" , 0x01E351 }, - { "Asia/Pyongyang" , 0x01E413 }, - { "Asia/Qatar" , 0x01E498 }, - { "Asia/Qyzylorda" , 0x01E4FE }, - { "Asia/Rangoon" , 0x01E6D4 }, - { "Asia/Riyadh" , 0x01E74C }, - { "Asia/Saigon" , 0x01E7A1 }, - { "Asia/Sakhalin" , 0x01E843 }, - { "Asia/Samarkand" , 0x01EA40 }, - { "Asia/Seoul" , 0x01EB76 }, - { "Asia/Shanghai" , 0x01EC69 }, - { "Asia/Singapore" , 0x01ED15 }, - { "Asia/Srednekolymsk" , 0x01EDCC }, - { "Asia/Taipei" , 0x01EFCC }, - { "Asia/Tashkent" , 0x01F0FD }, - { "Asia/Tbilisi" , 0x01F22E }, - { "Asia/Tehran" , 0x01F3E8 }, - { "Asia/Tel_Aviv" , 0x01F656 }, - { "Asia/Thimbu" , 0x01F985 }, - { "Asia/Thimphu" , 0x01F9EB }, - { "Asia/Tokyo" , 0x01FA51 }, - { "Asia/Ujung_Pandang" , 0x01FADB }, - { "Asia/Ulaanbaatar" , 0x01FB58 }, - { "Asia/Ulan_Bator" , 0x01FCB3 }, - { "Asia/Urumqi" , 0x01FE00 }, - { "Asia/Ust-Nera" , 0x01FE62 }, - { "Asia/Vientiane" , 0x020074 }, - { "Asia/Vladivostok" , 0x0200C9 }, - { "Asia/Yakutsk" , 0x0202B3 }, - { "Asia/Yekaterinburg" , 0x02049D }, - { "Asia/Yerevan" , 0x0206BE }, - { "Atlantic/Azores" , 0x0208BE }, - { "Atlantic/Bermuda" , 0x020DC1 }, - { "Atlantic/Canary" , 0x0210A2 }, - { "Atlantic/Cape_Verde" , 0x021378 }, - { "Atlantic/Faeroe" , 0x0213F1 }, - { "Atlantic/Faroe" , 0x021695 }, - { "Atlantic/Jan_Mayen" , 0x021939 }, - { "Atlantic/Madeira" , 0x021C6B }, - { "Atlantic/Reykjavik" , 0x022174 }, - { "Atlantic/South_Georgia" , 0x02232D }, - { "Atlantic/St_Helena" , 0x02253F }, - { "Atlantic/Stanley" , 0x022371 }, - { "Australia/ACT" , 0x022594 }, - { "Australia/Adelaide" , 0x0228B7 }, - { "Australia/Brisbane" , 0x022BE9 }, - { "Australia/Broken_Hill" , 0x022CB6 }, - { "Australia/Canberra" , 0x022FFA }, - { "Australia/Currie" , 0x02331D }, - { "Australia/Darwin" , 0x023656 }, - { "Australia/Eucla" , 0x0236E2 }, - { "Australia/Hobart" , 0x0237BE }, - { "Australia/LHI" , 0x023B22 }, - { "Australia/Lindeman" , 0x023DC3 }, - { "Australia/Lord_Howe" , 0x023EAA }, - { "Australia/Melbourne" , 0x02415B }, - { "Australia/North" , 0x024486 }, - { "Australia/NSW" , 0x024500 }, - { "Australia/Perth" , 0x024823 }, - { "Australia/Queensland" , 0x024901 }, - { "Australia/South" , 0x0249B3 }, - { "Australia/Sydney" , 0x024CD6 }, - { "Australia/Tasmania" , 0x025019 }, - { "Australia/Victoria" , 0x025364 }, - { "Australia/West" , 0x025687 }, - { "Australia/Yancowinna" , 0x025743 }, - { "Brazil/Acre" , 0x025A6B }, - { "Brazil/DeNoronha" , 0x025B6F }, - { "Brazil/East" , 0x025C8F }, - { "Brazil/West" , 0x025F6C }, - { "Canada/Atlantic" , 0x026064 }, - { "Canada/Central" , 0x02654C }, - { "Canada/East-Saskatchewan" , 0x026E56 }, - { "Canada/Eastern" , 0x026966 }, - { "Canada/Mountain" , 0x026FDF }, - { "Canada/Newfoundland" , 0x027355 }, - { "Canada/Pacific" , 0x027880 }, - { "Canada/Saskatchewan" , 0x027C99 }, - { "Canada/Yukon" , 0x027E22 }, - { "CET" , 0x028125 }, - { "Chile/Continental" , 0x02842E }, - { "Chile/EasterIsland" , 0x0287C9 }, - { "CST6CDT" , 0x028B0B }, - { "Cuba" , 0x028E5C }, - { "EET" , 0x0291CF }, - { "Egypt" , 0x029482 }, - { "Eire" , 0x029869 }, - { "EST" , 0x029D7A }, - { "EST5EDT" , 0x029DBE }, - { "Etc/GMT" , 0x02A10F }, - { "Etc/GMT+0" , 0x02A1DB }, - { "Etc/GMT+1" , 0x02A265 }, - { "Etc/GMT+10" , 0x02A2F2 }, - { "Etc/GMT+11" , 0x02A380 }, - { "Etc/GMT+12" , 0x02A40E }, - { "Etc/GMT+2" , 0x02A529 }, - { "Etc/GMT+3" , 0x02A5B5 }, - { "Etc/GMT+4" , 0x02A641 }, - { "Etc/GMT+5" , 0x02A6CD }, - { "Etc/GMT+6" , 0x02A759 }, - { "Etc/GMT+7" , 0x02A7E5 }, - { "Etc/GMT+8" , 0x02A871 }, - { "Etc/GMT+9" , 0x02A8FD }, - { "Etc/GMT-0" , 0x02A197 }, - { "Etc/GMT-1" , 0x02A21F }, - { "Etc/GMT-10" , 0x02A2AB }, - { "Etc/GMT-11" , 0x02A339 }, - { "Etc/GMT-12" , 0x02A3C7 }, - { "Etc/GMT-13" , 0x02A455 }, - { "Etc/GMT-14" , 0x02A49C }, - { "Etc/GMT-2" , 0x02A4E3 }, - { "Etc/GMT-3" , 0x02A56F }, - { "Etc/GMT-4" , 0x02A5FB }, - { "Etc/GMT-5" , 0x02A687 }, - { "Etc/GMT-6" , 0x02A713 }, - { "Etc/GMT-7" , 0x02A79F }, - { "Etc/GMT-8" , 0x02A82B }, - { "Etc/GMT-9" , 0x02A8B7 }, - { "Etc/GMT0" , 0x02A153 }, - { "Etc/Greenwich" , 0x02A943 }, - { "Etc/UCT" , 0x02A987 }, - { "Etc/Universal" , 0x02A9CB }, - { "Etc/UTC" , 0x02AA0F }, - { "Etc/Zulu" , 0x02AA53 }, - { "Europe/Amsterdam" , 0x02AA97 }, - { "Europe/Andorra" , 0x02AED5 }, - { "Europe/Athens" , 0x02B151 }, - { "Europe/Belfast" , 0x02B494 }, - { "Europe/Belgrade" , 0x02B9CB }, - { "Europe/Berlin" , 0x02BC94 }, - { "Europe/Bratislava" , 0x02BFF8 }, - { "Europe/Brussels" , 0x02C32A }, - { "Europe/Bucharest" , 0x02C761 }, - { "Europe/Budapest" , 0x02CA8B }, - { "Europe/Busingen" , 0x02CDF4 }, - { "Europe/Chisinau" , 0x02D0AB }, - { "Europe/Copenhagen" , 0x02D439 }, - { "Europe/Dublin" , 0x02D743 }, - { "Europe/Gibraltar" , 0x02DC54 }, - { "Europe/Guernsey" , 0x02E0AB }, - { "Europe/Helsinki" , 0x02E5E2 }, - { "Europe/Isle_of_Man" , 0x02E898 }, - { "Europe/Istanbul" , 0x02EDCF }, - { "Europe/Jersey" , 0x02F1BC }, - { "Europe/Kaliningrad" , 0x02F6F3 }, - { "Europe/Kiev" , 0x02F95E }, - { "Europe/Lisbon" , 0x02FC7A }, - { "Europe/Ljubljana" , 0x03017E }, - { "Europe/London" , 0x030447 }, - { "Europe/Luxembourg" , 0x03097E }, - { "Europe/Madrid" , 0x030DD4 }, - { "Europe/Malta" , 0x03119A }, - { "Europe/Mariehamn" , 0x031553 }, - { "Europe/Minsk" , 0x031809 }, - { "Europe/Monaco" , 0x031A1C }, - { "Europe/Moscow" , 0x031E57 }, - { "Europe/Nicosia" , 0x0320B1 }, - { "Europe/Oslo" , 0x032399 }, - { "Europe/Paris" , 0x0326CB }, - { "Europe/Podgorica" , 0x032B11 }, - { "Europe/Prague" , 0x032DDA }, - { "Europe/Riga" , 0x03310C }, - { "Europe/Rome" , 0x033451 }, - { "Europe/Samara" , 0x033814 }, - { "Europe/San_Marino" , 0x033A7D }, - { "Europe/Sarajevo" , 0x033E40 }, - { "Europe/Simferopol" , 0x034109 }, - { "Europe/Skopje" , 0x03435A }, - { "Europe/Sofia" , 0x034623 }, - { "Europe/Stockholm" , 0x03492B }, - { "Europe/Tallinn" , 0x034BDA }, - { "Europe/Tirane" , 0x034F14 }, - { "Europe/Tiraspol" , 0x03521A }, - { "Europe/Uzhgorod" , 0x0355A8 }, - { "Europe/Vaduz" , 0x0358BF }, - { "Europe/Vatican" , 0x035B6E }, - { "Europe/Vienna" , 0x035F31 }, - { "Europe/Vilnius" , 0x03625E }, - { "Europe/Volgograd" , 0x03659D }, - { "Europe/Warsaw" , 0x0367BE }, - { "Europe/Zagreb" , 0x036B9F }, - { "Europe/Zaporozhye" , 0x036E68 }, - { "Europe/Zurich" , 0x0371A9 }, - { "Factory" , 0x037458 }, - { "GB" , 0x0374C9 }, - { "GB-Eire" , 0x037A00 }, - { "GMT" , 0x037F37 }, - { "GMT+0" , 0x038003 }, - { "GMT-0" , 0x037FBF }, - { "GMT0" , 0x037F7B }, - { "Greenwich" , 0x038047 }, - { "Hongkong" , 0x03808B }, - { "HST" , 0x03824D }, - { "Iceland" , 0x038291 }, - { "Indian/Antananarivo" , 0x03844A }, - { "Indian/Chagos" , 0x0384C9 }, - { "Indian/Christmas" , 0x03852B }, - { "Indian/Cocos" , 0x03856F }, - { "Indian/Comoro" , 0x0385B3 }, - { "Indian/Kerguelen" , 0x038632 }, - { "Indian/Mahe" , 0x038687 }, - { "Indian/Maldives" , 0x0386DC }, - { "Indian/Mauritius" , 0x038731 }, - { "Indian/Mayotte" , 0x0387A7 }, - { "Indian/Reunion" , 0x038826 }, - { "Iran" , 0x03887B }, - { "Israel" , 0x038AE9 }, - { "Jamaica" , 0x038E18 }, - { "Japan" , 0x038EDD }, - { "Kwajalein" , 0x038F67 }, - { "Libya" , 0x038FCA }, - { "MET" , 0x0390D3 }, - { "Mexico/BajaNorte" , 0x0393DC }, - { "Mexico/BajaSur" , 0x039745 }, - { "Mexico/General" , 0x03998A }, - { "MST" , 0x039BE8 }, - { "MST7MDT" , 0x039C2C }, - { "Navajo" , 0x039F7D }, - { "NZ" , 0x03A2F6 }, - { "NZ-CHAT" , 0x03A674 }, - { "Pacific/Apia" , 0x03A958 }, - { "Pacific/Auckland" , 0x03AAF4 }, - { "Pacific/Bougainville" , 0x03AE80 }, - { "Pacific/Chatham" , 0x03AEF7 }, - { "Pacific/Chuuk" , 0x03B1EA }, - { "Pacific/Easter" , 0x03B243 }, - { "Pacific/Efate" , 0x03B592 }, - { "Pacific/Enderbury" , 0x03B658 }, - { "Pacific/Fakaofo" , 0x03B6C6 }, - { "Pacific/Fiji" , 0x03B717 }, - { "Pacific/Funafuti" , 0x03B8AA }, - { "Pacific/Galapagos" , 0x03B8EE }, - { "Pacific/Gambier" , 0x03B966 }, - { "Pacific/Guadalcanal" , 0x03B9CB }, - { "Pacific/Guam" , 0x03BA20 }, - { "Pacific/Honolulu" , 0x03BA76 }, - { "Pacific/Johnston" , 0x03BAED }, - { "Pacific/Kiritimati" , 0x03BB6C }, - { "Pacific/Kosrae" , 0x03BBD7 }, - { "Pacific/Kwajalein" , 0x03BC34 }, - { "Pacific/Majuro" , 0x03BCA0 }, - { "Pacific/Marquesas" , 0x03BCFF }, - { "Pacific/Midway" , 0x03BD66 }, - { "Pacific/Nauru" , 0x03BDF0 }, - { "Pacific/Niue" , 0x03BE68 }, - { "Pacific/Norfolk" , 0x03BEC6 }, - { "Pacific/Noumea" , 0x03BF1B }, - { "Pacific/Pago_Pago" , 0x03BFAB }, - { "Pacific/Palau" , 0x03C022 }, - { "Pacific/Pitcairn" , 0x03C066 }, - { "Pacific/Pohnpei" , 0x03C0BB }, - { "Pacific/Ponape" , 0x03C110 }, - { "Pacific/Port_Moresby" , 0x03C155 }, - { "Pacific/Rarotonga" , 0x03C1A7 }, - { "Pacific/Saipan" , 0x03C283 }, - { "Pacific/Samoa" , 0x03C2E6 }, - { "Pacific/Tahiti" , 0x03C35D }, - { "Pacific/Tarawa" , 0x03C3C2 }, - { "Pacific/Tongatapu" , 0x03C416 }, - { "Pacific/Truk" , 0x03C4A2 }, - { "Pacific/Wake" , 0x03C4E7 }, - { "Pacific/Wallis" , 0x03C537 }, - { "Pacific/Yap" , 0x03C57B }, - { "Poland" , 0x03C5C0 }, - { "Portugal" , 0x03C9A1 }, - { "PRC" , 0x03CE9D }, - { "PST8PDT" , 0x03CF3D }, - { "ROC" , 0x03D28E }, - { "ROK" , 0x03D3BF }, - { "Singapore" , 0x03D4B2 }, - { "Turkey" , 0x03D569 }, - { "UCT" , 0x03D956 }, - { "Universal" , 0x03D99A }, - { "US/Alaska" , 0x03D9DE }, - { "US/Aleutian" , 0x03DD47 }, - { "US/Arizona" , 0x03E0AD }, - { "US/Central" , 0x03E13B }, - { "US/East-Indiana" , 0x03EB45 }, - { "US/Eastern" , 0x03E646 }, - { "US/Hawaii" , 0x03EDAF }, - { "US/Indiana-Starke" , 0x03EE20 }, - { "US/Michigan" , 0x03F191 }, - { "US/Mountain" , 0x03F4C8 }, - { "US/Pacific" , 0x03F841 }, - { "US/Pacific-New" , 0x03FC46 }, - { "US/Samoa" , 0x04004B }, - { "UTC" , 0x0400C2 }, - { "W-SU" , 0x0403B9 }, - { "WET" , 0x040106 }, - { "Zulu" , 0x0405FC }, + { "America/Caracas" , 0x0061B3 }, + { "America/Catamarca" , 0x00621A }, + { "America/Cayenne" , 0x0063C0 }, + { "America/Cayman" , 0x006422 }, + { "America/Chicago" , 0x006477 }, + { "America/Chihuahua" , 0x00698E }, + { "America/Coral_Harbour" , 0x006BF9 }, + { "America/Cordoba" , 0x006C8B }, + { "America/Costa_Rica" , 0x006E31 }, + { "America/Creston" , 0x006EBB }, + { "America/Cuiaba" , 0x006F47 }, + { "America/Curacao" , 0x007225 }, + { "America/Danmarkshavn" , 0x00728B }, + { "America/Dawson" , 0x0073CF }, + { "America/Dawson_Creek" , 0x0076EC }, + { "America/Denver" , 0x0078C6 }, + { "America/Detroit" , 0x007C4C }, + { "America/Dominica" , 0x007FAB }, + { "America/Edmonton" , 0x008000 }, + { "America/Eirunepe" , 0x0083B8 }, + { "America/El_Salvador" , 0x0084D0 }, + { "America/Ensenada" , 0x008545 }, + { "America/Fort_Wayne" , 0x0089EC }, + { "America/Fortaleza" , 0x0088AE }, + { "America/Glace_Bay" , 0x008C56 }, + { "America/Godthab" , 0x008FCD }, + { "America/Goose_Bay" , 0x009291 }, + { "America/Grand_Turk" , 0x00974E }, + { "America/Grenada" , 0x00992D }, + { "America/Guadeloupe" , 0x009982 }, + { "America/Guatemala" , 0x0099D7 }, + { "America/Guayaquil" , 0x009A60 }, + { "America/Guyana" , 0x009ABD }, + { "America/Halifax" , 0x009B3E }, + { "America/Havana" , 0x00A054 }, + { "America/Hermosillo" , 0x00A3C7 }, + { "America/Indiana/Indianapolis" , 0x00A4A5 }, + { "America/Indiana/Knox" , 0x00A736 }, + { "America/Indiana/Marengo" , 0x00AACD }, + { "America/Indiana/Petersburg" , 0x00AD73 }, + { "America/Indiana/Tell_City" , 0x00B2C0 }, + { "America/Indiana/Vevay" , 0x00B559 }, + { "America/Indiana/Vincennes" , 0x00B794 }, + { "America/Indiana/Winamac" , 0x00BA48 }, + { "America/Indianapolis" , 0x00B056 }, + { "America/Inuvik" , 0x00BD01 }, + { "America/Iqaluit" , 0x00BFF8 }, + { "America/Jamaica" , 0x00C31A }, + { "America/Jujuy" , 0x00C3DF }, + { "America/Juneau" , 0x00C589 }, + { "America/Kentucky/Louisville" , 0x00C907 }, + { "America/Kentucky/Monticello" , 0x00CD25 }, + { "America/Knox_IN" , 0x00D0AA }, + { "America/Kralendijk" , 0x00D41B }, + { "America/La_Paz" , 0x00D481 }, + { "America/Lima" , 0x00D4E8 }, + { "America/Los_Angeles" , 0x00D590 }, + { "America/Louisville" , 0x00D9A1 }, + { "America/Lower_Princes" , 0x00DD96 }, + { "America/Maceio" , 0x00DDFC }, + { "America/Managua" , 0x00DF36 }, + { "America/Manaus" , 0x00DFE9 }, + { "America/Marigot" , 0x00E0EB }, + { "America/Martinique" , 0x00E140 }, + { "America/Matamoros" , 0x00E1AC }, + { "America/Mazatlan" , 0x00E405 }, + { "America/Mendoza" , 0x00E672 }, + { "America/Menominee" , 0x00E826 }, + { "America/Merida" , 0x00EBA7 }, + { "America/Metlakatla" , 0x00EDE2 }, + { "America/Mexico_City" , 0x00EF1D }, + { "America/Miquelon" , 0x00F198 }, + { "America/Moncton" , 0x00F40A }, + { "America/Monterrey" , 0x00F8A1 }, + { "America/Montevideo" , 0x00FB04 }, + { "America/Montreal" , 0x00FE16 }, + { "America/Montserrat" , 0x010306 }, + { "America/Nassau" , 0x01035B }, + { "America/New_York" , 0x0106A0 }, + { "America/Nipigon" , 0x010BAB }, + { "America/Nome" , 0x010EFC }, + { "America/Noronha" , 0x01127A }, + { "America/North_Dakota/Beulah" , 0x0113AA }, + { "America/North_Dakota/Center" , 0x01173E }, + { "America/North_Dakota/New_Salem" , 0x011AD2 }, + { "America/Ojinaga" , 0x011E7B }, + { "America/Panama" , 0x0120DC }, + { "America/Pangnirtung" , 0x012131 }, + { "America/Paramaribo" , 0x012467 }, + { "America/Phoenix" , 0x0124F9 }, + { "America/Port-au-Prince" , 0x0125B7 }, + { "America/Port_of_Spain" , 0x0128DB }, + { "America/Porto_Acre" , 0x0127D7 }, + { "America/Porto_Velho" , 0x012930 }, + { "America/Puerto_Rico" , 0x012A26 }, + { "America/Rainy_River" , 0x012A91 }, + { "America/Rankin_Inlet" , 0x012DC9 }, + { "America/Recife" , 0x0130AF }, + { "America/Regina" , 0x0131D9 }, + { "America/Resolute" , 0x013397 }, + { "America/Rio_Branco" , 0x01367F }, + { "America/Rosario" , 0x013787 }, + { "America/Santa_Isabel" , 0x01392D }, + { "America/Santarem" , 0x013CD0 }, + { "America/Santiago" , 0x013DD5 }, + { "America/Santo_Domingo" , 0x0140A5 }, + { "America/Sao_Paulo" , 0x01416B }, + { "America/Scoresbysund" , 0x01447A }, + { "America/Shiprock" , 0x014768 }, + { "America/Sitka" , 0x014AE1 }, + { "America/St_Barthelemy" , 0x014E69 }, + { "America/St_Johns" , 0x014EBE }, + { "America/St_Kitts" , 0x015411 }, + { "America/St_Lucia" , 0x015466 }, + { "America/St_Thomas" , 0x0154BB }, + { "America/St_Vincent" , 0x015510 }, + { "America/Swift_Current" , 0x015565 }, + { "America/Tegucigalpa" , 0x015686 }, + { "America/Thule" , 0x015705 }, + { "America/Thunder_Bay" , 0x01594C }, + { "America/Tijuana" , 0x015C95 }, + { "America/Toronto" , 0x01602E }, + { "America/Tortola" , 0x01654E }, + { "America/Vancouver" , 0x0165A3 }, + { "America/Virgin" , 0x0169E0 }, + { "America/Whitehorse" , 0x016A35 }, + { "America/Winnipeg" , 0x016D52 }, + { "America/Yakutat" , 0x017192 }, + { "America/Yellowknife" , 0x0174FD }, + { "Antarctica/Casey" , 0x01780D }, + { "Antarctica/Davis" , 0x0178AB }, + { "Antarctica/DumontDUrville" , 0x01794C }, + { "Antarctica/Macquarie" , 0x0179DD }, + { "Antarctica/Mawson" , 0x017C2A }, + { "Antarctica/McMurdo" , 0x017CA6 }, + { "Antarctica/Palmer" , 0x018051 }, + { "Antarctica/Rothera" , 0x018294 }, + { "Antarctica/South_Pole" , 0x01830A }, + { "Antarctica/Syowa" , 0x018688 }, + { "Antarctica/Troll" , 0x0186F6 }, + { "Antarctica/Vostok" , 0x0188C8 }, + { "Arctic/Longyearbyen" , 0x018939 }, + { "Asia/Aden" , 0x018C6B }, + { "Asia/Almaty" , 0x018CC0 }, + { "Asia/Amman" , 0x018E3F }, + { "Asia/Anadyr" , 0x0190F5 }, + { "Asia/Aqtau" , 0x0192F7 }, + { "Asia/Aqtobe" , 0x0194F6 }, + { "Asia/Ashgabat" , 0x0196AE }, + { "Asia/Ashkhabad" , 0x0197CB }, + { "Asia/Baghdad" , 0x0198E8 }, + { "Asia/Bahrain" , 0x019A5D }, + { "Asia/Baku" , 0x019AC3 }, + { "Asia/Bangkok" , 0x019DAB }, + { "Asia/Beirut" , 0x019E00 }, + { "Asia/Bishkek" , 0x01A10D }, + { "Asia/Brunei" , 0x01A2B9 }, + { "Asia/Calcutta" , 0x01A31B }, + { "Asia/Chita" , 0x01A394 }, + { "Asia/Choibalsan" , 0x01A5A9 }, + { "Asia/Chongqing" , 0x01A722 }, + { "Asia/Chungking" , 0x01A7C2 }, + { "Asia/Colombo" , 0x01A862 }, + { "Asia/Dacca" , 0x01A8FE }, + { "Asia/Damascus" , 0x01A9A4 }, + { "Asia/Dhaka" , 0x01ACF4 }, + { "Asia/Dili" , 0x01AD9A }, + { "Asia/Dubai" , 0x01AE24 }, + { "Asia/Dushanbe" , 0x01AE79 }, + { "Asia/Gaza" , 0x01AF7C }, + { "Asia/Harbin" , 0x01B2CF }, + { "Asia/Hebron" , 0x01B36F }, + { "Asia/Ho_Chi_Minh" , 0x01B6CB }, + { "Asia/Hong_Kong" , 0x01B76D }, + { "Asia/Hovd" , 0x01B92F }, + { "Asia/Irkutsk" , 0x01BAA7 }, + { "Asia/Istanbul" , 0x01BC92 }, + { "Asia/Jakarta" , 0x01C07F }, + { "Asia/Jayapura" , 0x01C129 }, + { "Asia/Jerusalem" , 0x01C1C6 }, + { "Asia/Kabul" , 0x01C4F5 }, + { "Asia/Kamchatka" , 0x01C546 }, + { "Asia/Karachi" , 0x01C73F }, + { "Asia/Kashgar" , 0x01C7F4 }, + { "Asia/Kathmandu" , 0x01C849 }, + { "Asia/Katmandu" , 0x01C8AF }, + { "Asia/Khandyga" , 0x01C915 }, + { "Asia/Kolkata" , 0x01CB3F }, + { "Asia/Krasnoyarsk" , 0x01CBB8 }, + { "Asia/Kuala_Lumpur" , 0x01CDA5 }, + { "Asia/Kuching" , 0x01CE62 }, + { "Asia/Kuwait" , 0x01CF50 }, + { "Asia/Macao" , 0x01CFA5 }, + { "Asia/Macau" , 0x01D0E0 }, + { "Asia/Magadan" , 0x01D21B }, + { "Asia/Makassar" , 0x01D41F }, + { "Asia/Manila" , 0x01D4E4 }, + { "Asia/Muscat" , 0x01D569 }, + { "Asia/Nicosia" , 0x01D5BE }, + { "Asia/Novokuznetsk" , 0x01D8A6 }, + { "Asia/Novosibirsk" , 0x01DAC6 }, + { "Asia/Omsk" , 0x01DCB6 }, + { "Asia/Oral" , 0x01DEA2 }, + { "Asia/Phnom_Penh" , 0x01E072 }, + { "Asia/Pontianak" , 0x01E0C7 }, + { "Asia/Pyongyang" , 0x01E189 }, + { "Asia/Qatar" , 0x01E20E }, + { "Asia/Qyzylorda" , 0x01E274 }, + { "Asia/Rangoon" , 0x01E44A }, + { "Asia/Riyadh" , 0x01E4C2 }, + { "Asia/Saigon" , 0x01E517 }, + { "Asia/Sakhalin" , 0x01E5B9 }, + { "Asia/Samarkand" , 0x01E7B6 }, + { "Asia/Seoul" , 0x01E8EC }, + { "Asia/Shanghai" , 0x01E9DF }, + { "Asia/Singapore" , 0x01EA8B }, + { "Asia/Srednekolymsk" , 0x01EB42 }, + { "Asia/Taipei" , 0x01ED42 }, + { "Asia/Tashkent" , 0x01EE73 }, + { "Asia/Tbilisi" , 0x01EFA4 }, + { "Asia/Tehran" , 0x01F15E }, + { "Asia/Tel_Aviv" , 0x01F3CC }, + { "Asia/Thimbu" , 0x01F6FB }, + { "Asia/Thimphu" , 0x01F761 }, + { "Asia/Tokyo" , 0x01F7C7 }, + { "Asia/Ujung_Pandang" , 0x01F851 }, + { "Asia/Ulaanbaatar" , 0x01F8CE }, + { "Asia/Ulan_Bator" , 0x01FA29 }, + { "Asia/Urumqi" , 0x01FB76 }, + { "Asia/Ust-Nera" , 0x01FBD8 }, + { "Asia/Vientiane" , 0x01FDEA }, + { "Asia/Vladivostok" , 0x01FE3F }, + { "Asia/Yakutsk" , 0x020029 }, + { "Asia/Yekaterinburg" , 0x020213 }, + { "Asia/Yerevan" , 0x020434 }, + { "Atlantic/Azores" , 0x020634 }, + { "Atlantic/Bermuda" , 0x020B37 }, + { "Atlantic/Canary" , 0x020E18 }, + { "Atlantic/Cape_Verde" , 0x0210EE }, + { "Atlantic/Faeroe" , 0x021167 }, + { "Atlantic/Faroe" , 0x02140B }, + { "Atlantic/Jan_Mayen" , 0x0216AF }, + { "Atlantic/Madeira" , 0x0219E1 }, + { "Atlantic/Reykjavik" , 0x021EEA }, + { "Atlantic/South_Georgia" , 0x0220B7 }, + { "Atlantic/St_Helena" , 0x0222C9 }, + { "Atlantic/Stanley" , 0x0220FB }, + { "Australia/ACT" , 0x02231E }, + { "Australia/Adelaide" , 0x022641 }, + { "Australia/Brisbane" , 0x022973 }, + { "Australia/Broken_Hill" , 0x022A40 }, + { "Australia/Canberra" , 0x022D84 }, + { "Australia/Currie" , 0x0230A7 }, + { "Australia/Darwin" , 0x0233E0 }, + { "Australia/Eucla" , 0x02346C }, + { "Australia/Hobart" , 0x023548 }, + { "Australia/LHI" , 0x0238AC }, + { "Australia/Lindeman" , 0x023B4D }, + { "Australia/Lord_Howe" , 0x023C34 }, + { "Australia/Melbourne" , 0x023EE5 }, + { "Australia/North" , 0x024210 }, + { "Australia/NSW" , 0x02428A }, + { "Australia/Perth" , 0x0245AD }, + { "Australia/Queensland" , 0x02468B }, + { "Australia/South" , 0x02473D }, + { "Australia/Sydney" , 0x024A60 }, + { "Australia/Tasmania" , 0x024DA3 }, + { "Australia/Victoria" , 0x0250EE }, + { "Australia/West" , 0x025411 }, + { "Australia/Yancowinna" , 0x0254CD }, + { "Brazil/Acre" , 0x0257F5 }, + { "Brazil/DeNoronha" , 0x0258F9 }, + { "Brazil/East" , 0x025A19 }, + { "Brazil/West" , 0x025CF6 }, + { "Canada/Atlantic" , 0x025DEE }, + { "Canada/Central" , 0x0262D6 }, + { "Canada/East-Saskatchewan" , 0x026BE0 }, + { "Canada/Eastern" , 0x0266F0 }, + { "Canada/Mountain" , 0x026D69 }, + { "Canada/Newfoundland" , 0x0270DF }, + { "Canada/Pacific" , 0x02760A }, + { "Canada/Saskatchewan" , 0x027A23 }, + { "Canada/Yukon" , 0x027BAC }, + { "CET" , 0x027EAF }, + { "Chile/Continental" , 0x0281B8 }, + { "Chile/EasterIsland" , 0x02847A }, + { "CST6CDT" , 0x0286E8 }, + { "Cuba" , 0x028A39 }, + { "EET" , 0x028DAC }, + { "Egypt" , 0x02905F }, + { "Eire" , 0x029446 }, + { "EST" , 0x029957 }, + { "EST5EDT" , 0x02999B }, + { "Etc/GMT" , 0x029CEC }, + { "Etc/GMT+0" , 0x029DB8 }, + { "Etc/GMT+1" , 0x029E42 }, + { "Etc/GMT+10" , 0x029ECF }, + { "Etc/GMT+11" , 0x029F5D }, + { "Etc/GMT+12" , 0x029FEB }, + { "Etc/GMT+2" , 0x02A106 }, + { "Etc/GMT+3" , 0x02A192 }, + { "Etc/GMT+4" , 0x02A21E }, + { "Etc/GMT+5" , 0x02A2AA }, + { "Etc/GMT+6" , 0x02A336 }, + { "Etc/GMT+7" , 0x02A3C2 }, + { "Etc/GMT+8" , 0x02A44E }, + { "Etc/GMT+9" , 0x02A4DA }, + { "Etc/GMT-0" , 0x029D74 }, + { "Etc/GMT-1" , 0x029DFC }, + { "Etc/GMT-10" , 0x029E88 }, + { "Etc/GMT-11" , 0x029F16 }, + { "Etc/GMT-12" , 0x029FA4 }, + { "Etc/GMT-13" , 0x02A032 }, + { "Etc/GMT-14" , 0x02A079 }, + { "Etc/GMT-2" , 0x02A0C0 }, + { "Etc/GMT-3" , 0x02A14C }, + { "Etc/GMT-4" , 0x02A1D8 }, + { "Etc/GMT-5" , 0x02A264 }, + { "Etc/GMT-6" , 0x02A2F0 }, + { "Etc/GMT-7" , 0x02A37C }, + { "Etc/GMT-8" , 0x02A408 }, + { "Etc/GMT-9" , 0x02A494 }, + { "Etc/GMT0" , 0x029D30 }, + { "Etc/Greenwich" , 0x02A520 }, + { "Etc/UCT" , 0x02A564 }, + { "Etc/Universal" , 0x02A5A8 }, + { "Etc/UTC" , 0x02A5EC }, + { "Etc/Zulu" , 0x02A630 }, + { "Europe/Amsterdam" , 0x02A674 }, + { "Europe/Andorra" , 0x02AAB2 }, + { "Europe/Athens" , 0x02AD2E }, + { "Europe/Belfast" , 0x02B071 }, + { "Europe/Belgrade" , 0x02B5A8 }, + { "Europe/Berlin" , 0x02B871 }, + { "Europe/Bratislava" , 0x02BBD5 }, + { "Europe/Brussels" , 0x02BF07 }, + { "Europe/Bucharest" , 0x02C33E }, + { "Europe/Budapest" , 0x02C668 }, + { "Europe/Busingen" , 0x02C9D1 }, + { "Europe/Chisinau" , 0x02CC88 }, + { "Europe/Copenhagen" , 0x02D016 }, + { "Europe/Dublin" , 0x02D320 }, + { "Europe/Gibraltar" , 0x02D831 }, + { "Europe/Guernsey" , 0x02DC88 }, + { "Europe/Helsinki" , 0x02E1BF }, + { "Europe/Isle_of_Man" , 0x02E475 }, + { "Europe/Istanbul" , 0x02E9AC }, + { "Europe/Jersey" , 0x02ED99 }, + { "Europe/Kaliningrad" , 0x02F2D0 }, + { "Europe/Kiev" , 0x02F53B }, + { "Europe/Lisbon" , 0x02F857 }, + { "Europe/Ljubljana" , 0x02FD5B }, + { "Europe/London" , 0x030024 }, + { "Europe/Luxembourg" , 0x03055B }, + { "Europe/Madrid" , 0x0309B1 }, + { "Europe/Malta" , 0x030D77 }, + { "Europe/Mariehamn" , 0x031130 }, + { "Europe/Minsk" , 0x0313E6 }, + { "Europe/Monaco" , 0x0315F9 }, + { "Europe/Moscow" , 0x031A34 }, + { "Europe/Nicosia" , 0x031C8E }, + { "Europe/Oslo" , 0x031F76 }, + { "Europe/Paris" , 0x0322A8 }, + { "Europe/Podgorica" , 0x0326EE }, + { "Europe/Prague" , 0x0329B7 }, + { "Europe/Riga" , 0x032CE9 }, + { "Europe/Rome" , 0x03302E }, + { "Europe/Samara" , 0x0333F1 }, + { "Europe/San_Marino" , 0x03365A }, + { "Europe/Sarajevo" , 0x033A1D }, + { "Europe/Simferopol" , 0x033CE6 }, + { "Europe/Skopje" , 0x033F37 }, + { "Europe/Sofia" , 0x034200 }, + { "Europe/Stockholm" , 0x034508 }, + { "Europe/Tallinn" , 0x0347B7 }, + { "Europe/Tirane" , 0x034AF1 }, + { "Europe/Tiraspol" , 0x034DF7 }, + { "Europe/Uzhgorod" , 0x035185 }, + { "Europe/Vaduz" , 0x03549C }, + { "Europe/Vatican" , 0x03574B }, + { "Europe/Vienna" , 0x035B0E }, + { "Europe/Vilnius" , 0x035E3B }, + { "Europe/Volgograd" , 0x03617A }, + { "Europe/Warsaw" , 0x03639B }, + { "Europe/Zagreb" , 0x03677C }, + { "Europe/Zaporozhye" , 0x036A45 }, + { "Europe/Zurich" , 0x036D86 }, + { "Factory" , 0x037035 }, + { "GB" , 0x0370A6 }, + { "GB-Eire" , 0x0375DD }, + { "GMT" , 0x037B14 }, + { "GMT+0" , 0x037BE0 }, + { "GMT-0" , 0x037B9C }, + { "GMT0" , 0x037B58 }, + { "Greenwich" , 0x037C24 }, + { "Hongkong" , 0x037C68 }, + { "HST" , 0x037E2A }, + { "Iceland" , 0x037E6E }, + { "Indian/Antananarivo" , 0x03803B }, + { "Indian/Chagos" , 0x0380BA }, + { "Indian/Christmas" , 0x03811C }, + { "Indian/Cocos" , 0x038160 }, + { "Indian/Comoro" , 0x0381A4 }, + { "Indian/Kerguelen" , 0x038223 }, + { "Indian/Mahe" , 0x038278 }, + { "Indian/Maldives" , 0x0382CD }, + { "Indian/Mauritius" , 0x038322 }, + { "Indian/Mayotte" , 0x038398 }, + { "Indian/Reunion" , 0x038417 }, + { "Iran" , 0x03846C }, + { "Israel" , 0x0386DA }, + { "Jamaica" , 0x038A09 }, + { "Japan" , 0x038ACE }, + { "Kwajalein" , 0x038B58 }, + { "Libya" , 0x038BBB }, + { "MET" , 0x038CC4 }, + { "Mexico/BajaNorte" , 0x038FCD }, + { "Mexico/BajaSur" , 0x039336 }, + { "Mexico/General" , 0x03957B }, + { "MST" , 0x0397D9 }, + { "MST7MDT" , 0x03981D }, + { "Navajo" , 0x039B6E }, + { "NZ" , 0x039EE7 }, + { "NZ-CHAT" , 0x03A265 }, + { "Pacific/Apia" , 0x03A549 }, + { "Pacific/Auckland" , 0x03A6E5 }, + { "Pacific/Bougainville" , 0x03AA71 }, + { "Pacific/Chatham" , 0x03AAE8 }, + { "Pacific/Chuuk" , 0x03ADDB }, + { "Pacific/Easter" , 0x03AE34 }, + { "Pacific/Efate" , 0x03B0AF }, + { "Pacific/Enderbury" , 0x03B175 }, + { "Pacific/Fakaofo" , 0x03B1E3 }, + { "Pacific/Fiji" , 0x03B234 }, + { "Pacific/Funafuti" , 0x03B3C7 }, + { "Pacific/Galapagos" , 0x03B40B }, + { "Pacific/Gambier" , 0x03B483 }, + { "Pacific/Guadalcanal" , 0x03B4E8 }, + { "Pacific/Guam" , 0x03B53D }, + { "Pacific/Honolulu" , 0x03B593 }, + { "Pacific/Johnston" , 0x03B60A }, + { "Pacific/Kiritimati" , 0x03B689 }, + { "Pacific/Kosrae" , 0x03B6F4 }, + { "Pacific/Kwajalein" , 0x03B751 }, + { "Pacific/Majuro" , 0x03B7BD }, + { "Pacific/Marquesas" , 0x03B81C }, + { "Pacific/Midway" , 0x03B883 }, + { "Pacific/Nauru" , 0x03B90D }, + { "Pacific/Niue" , 0x03B985 }, + { "Pacific/Norfolk" , 0x03B9E3 }, + { "Pacific/Noumea" , 0x03BA38 }, + { "Pacific/Pago_Pago" , 0x03BAC8 }, + { "Pacific/Palau" , 0x03BB3F }, + { "Pacific/Pitcairn" , 0x03BB83 }, + { "Pacific/Pohnpei" , 0x03BBD8 }, + { "Pacific/Ponape" , 0x03BC2D }, + { "Pacific/Port_Moresby" , 0x03BC72 }, + { "Pacific/Rarotonga" , 0x03BCC4 }, + { "Pacific/Saipan" , 0x03BDA0 }, + { "Pacific/Samoa" , 0x03BE03 }, + { "Pacific/Tahiti" , 0x03BE7A }, + { "Pacific/Tarawa" , 0x03BEDF }, + { "Pacific/Tongatapu" , 0x03BF33 }, + { "Pacific/Truk" , 0x03BFBF }, + { "Pacific/Wake" , 0x03C004 }, + { "Pacific/Wallis" , 0x03C054 }, + { "Pacific/Yap" , 0x03C098 }, + { "Poland" , 0x03C0DD }, + { "Portugal" , 0x03C4BE }, + { "PRC" , 0x03C9BA }, + { "PST8PDT" , 0x03CA5A }, + { "ROC" , 0x03CDAB }, + { "ROK" , 0x03CEDC }, + { "Singapore" , 0x03CFCF }, + { "Turkey" , 0x03D086 }, + { "UCT" , 0x03D473 }, + { "Universal" , 0x03D4B7 }, + { "US/Alaska" , 0x03D4FB }, + { "US/Aleutian" , 0x03D864 }, + { "US/Arizona" , 0x03DBCA }, + { "US/Central" , 0x03DC58 }, + { "US/East-Indiana" , 0x03E662 }, + { "US/Eastern" , 0x03E163 }, + { "US/Hawaii" , 0x03E8CC }, + { "US/Indiana-Starke" , 0x03E93D }, + { "US/Michigan" , 0x03ECAE }, + { "US/Mountain" , 0x03EFE5 }, + { "US/Pacific" , 0x03F35E }, + { "US/Pacific-New" , 0x03F763 }, + { "US/Samoa" , 0x03FB68 }, + { "UTC" , 0x03FBDF }, + { "W-SU" , 0x03FED6 }, + { "WET" , 0x03FC23 }, + { "Zulu" , 0x040119 }, }; /* This is a generated file, do not modify */ -const unsigned char timelib_timezone_db_data_builtin[263744] = { +const unsigned char timelib_timezone_db_data_builtin[262493] = { /* Africa/Abidjan */ @@ -2353,7 +2353,7 @@ const unsigned char timelib_timezone_db_data_builtin[263744] = { /* America/Cancun */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x4D, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x14, 0xA5, 0xB6, 0xDA, 0x60, +0x00, 0x00, 0x00, 0x2A, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x14, 0xA5, 0xB6, 0xDA, 0x60, 0x16, 0x86, 0xD5, 0x60, 0x31, 0x67, 0x67, 0xF0, 0x32, 0x72, 0xFA, 0x60, 0x33, 0x47, 0x49, 0xF0, 0x34, 0x52, 0xDC, 0x60, 0x35, 0x27, 0x2B, 0xF0, 0x35, 0xC4, 0x00, 0x60, 0x36, 0x32, 0xCC, 0x70, 0x37, 0x07, 0x1C, 0x00, 0x38, 0x1B, 0xE8, 0xF0, 0x38, 0xE6, 0xFE, 0x00, 0x39, 0xFB, 0xCA, 0xF0, @@ -2364,30 +2364,16 @@ const unsigned char timelib_timezone_db_data_builtin[263744] = { 0x49, 0xD8, 0x65, 0x00, 0x4A, 0xE3, 0xF7, 0x70, 0x4B, 0xB8, 0x47, 0x00, 0x4C, 0xCD, 0x13, 0xF0, 0x4D, 0x98, 0x29, 0x00, 0x4E, 0xAC, 0xF5, 0xF0, 0x4F, 0x78, 0x0B, 0x00, 0x50, 0x8C, 0xD7, 0xF0, 0x51, 0x61, 0x27, 0x80, 0x52, 0x6C, 0xB9, 0xF0, 0x53, 0x41, 0x09, 0x80, 0x54, 0x4C, 0x9B, 0xF0, -0x55, 0x20, 0xEB, 0x80, 0x56, 0x2C, 0x7D, 0xF0, 0x57, 0x00, 0xCD, 0x80, 0x58, 0x15, 0x9A, 0x70, -0x58, 0xE0, 0xAF, 0x80, 0x59, 0xF5, 0x7C, 0x70, 0x5A, 0xC0, 0x91, 0x80, 0x5B, 0xD5, 0x5E, 0x70, -0x5C, 0xA9, 0xAE, 0x00, 0x5D, 0xB5, 0x40, 0x70, 0x5E, 0x89, 0x90, 0x00, 0x5F, 0x95, 0x22, 0x70, -0x60, 0x69, 0x72, 0x00, 0x61, 0x7E, 0x3E, 0xF0, 0x62, 0x49, 0x54, 0x00, 0x63, 0x5E, 0x20, 0xF0, -0x64, 0x29, 0x36, 0x00, 0x65, 0x3E, 0x02, 0xF0, 0x66, 0x12, 0x52, 0x80, 0x67, 0x1D, 0xE4, 0xF0, -0x67, 0xF2, 0x34, 0x80, 0x68, 0xFD, 0xC6, 0xF0, 0x69, 0xD2, 0x16, 0x80, 0x6A, 0xDD, 0xA8, 0xF0, -0x6B, 0xB1, 0xF8, 0x80, 0x6C, 0xC6, 0xC5, 0x70, 0x6D, 0x91, 0xDA, 0x80, 0x6E, 0xA6, 0xA7, 0x70, -0x6F, 0x71, 0xBC, 0x80, 0x70, 0x86, 0x89, 0x70, 0x71, 0x5A, 0xD9, 0x00, 0x72, 0x66, 0x6B, 0x70, -0x73, 0x3A, 0xBB, 0x00, 0x74, 0x46, 0x4D, 0x70, 0x75, 0x1A, 0x9D, 0x00, 0x76, 0x2F, 0x69, 0xF0, -0x76, 0xFA, 0x7F, 0x00, 0x78, 0x0F, 0x4B, 0xF0, 0x78, 0xDA, 0x61, 0x00, 0x79, 0xEF, 0x2D, 0xF0, -0x7A, 0xBA, 0x43, 0x00, 0x7B, 0xCF, 0x0F, 0xF0, 0x7C, 0xA3, 0x5F, 0x80, 0x7D, 0xAE, 0xF1, 0xF0, -0x7E, 0x83, 0x41, 0x80, 0x7F, 0x8E, 0xD3, 0xF0, 0x01, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x04, -0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, -0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, +0x54, 0xCD, 0xDD, 0x00, 0x01, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, -0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, -0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0xFF, -0xFF, 0xAE, 0xA8, 0x00, 0x00, 0xFF, 0xFF, 0xAB, 0xA0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, -0x08, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x0C, 0xFF, 0xFF, 0xB9, 0xB0, 0x01, 0x10, 0x4C, 0x4D, 0x54, -0x00, 0x43, 0x53, 0x54, 0x00, 0x45, 0x44, 0x54, 0x00, 0x45, 0x53, 0x54, 0x00, 0x43, 0x44, 0x54, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA9, 0x7F, 0xED, 0x00, -0x8E, 0x43, 0x45, 0x00, 0x00, 0x00, 0x1B, 0x43, 0x65, 0x6E, 0x74, 0x72, 0x61, 0x6C, 0x20, 0x54, -0x69, 0x6D, 0x65, 0x20, 0x2D, 0x20, 0x51, 0x75, 0x69, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x20, 0x52, -0x6F, 0x6F, +0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x01, 0x03, 0xFF, 0xFF, +0xAE, 0xA8, 0x00, 0x00, 0xFF, 0xFF, 0xAB, 0xA0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x08, +0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x0C, 0xFF, 0xFF, 0xB9, 0xB0, 0x01, 0x10, 0x4C, 0x4D, 0x54, 0x00, +0x43, 0x53, 0x54, 0x00, 0x45, 0x44, 0x54, 0x00, 0x45, 0x53, 0x54, 0x00, 0x43, 0x44, 0x54, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA9, 0x7F, 0xED, 0x00, 0x8E, +0x43, 0x45, 0x00, 0x00, 0x00, 0x24, 0x45, 0x61, 0x73, 0x74, 0x65, 0x72, 0x6E, 0x20, 0x53, 0x74, +0x61, 0x6E, 0x64, 0x61, 0x72, 0x64, 0x20, 0x54, 0x69, 0x6D, 0x65, 0x20, 0x2D, 0x20, 0x51, 0x75, +0x69, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x20, 0x52, 0x6F, 0x6F, /* America/Caracas */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x56, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -6180,8 +6166,8 @@ const unsigned char timelib_timezone_db_data_builtin[263744] = { /* America/Santiago */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x43, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x9E, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x0D, 0x8F, 0x24, 0x69, 0xC6, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0D, 0x8F, 0x24, 0x69, 0xC6, 0x9B, 0x5C, 0xE5, 0x50, 0x9F, 0x71, 0x05, 0x46, 0xA1, 0x00, 0x71, 0xC0, 0xB0, 0x5E, 0x77, 0xC6, 0xB1, 0x77, 0x3D, 0x40, 0xB2, 0x41, 0x00, 0xD0, 0xB3, 0x58, 0x70, 0xC0, 0xB4, 0x22, 0x34, 0x50, 0xB5, 0x39, 0xA4, 0x40, 0xB6, 0x03, 0x67, 0xD0, 0xB7, 0x1A, 0xD7, 0xC0, 0xB7, 0xE4, 0x9B, 0x50, @@ -6210,34 +6196,21 @@ const unsigned char timelib_timezone_db_data_builtin[263744] = { 0x4A, 0xD1, 0x58, 0x40, 0x4B, 0xB8, 0x00, 0xB0, 0x4C, 0xB1, 0x3A, 0x40, 0x4D, 0xC6, 0x07, 0x30, 0x4E, 0x50, 0x82, 0xC0, 0x4F, 0x9C, 0xAE, 0xB0, 0x50, 0x42, 0xD9, 0xC0, 0x51, 0x7C, 0x90, 0xB0, 0x52, 0x2B, 0xF6, 0x40, 0x53, 0x5C, 0x72, 0xB0, 0x54, 0x0B, 0xD8, 0x40, 0x55, 0x3C, 0x54, 0xB0, -0x55, 0xEB, 0xBA, 0x40, 0x57, 0x1C, 0x36, 0xB0, 0x57, 0xCB, 0x9C, 0x40, 0x58, 0xFC, 0x18, 0xB0, -0x59, 0xAB, 0x7E, 0x40, 0x5A, 0xE5, 0x35, 0x30, 0x5B, 0x8B, 0x60, 0x40, 0x5C, 0xC5, 0x17, 0x30, -0x5D, 0x74, 0x7C, 0xC0, 0x5E, 0xA4, 0xF9, 0x30, 0x5F, 0x54, 0x5E, 0xC0, 0x60, 0x84, 0xDB, 0x30, -0x61, 0x34, 0x40, 0xC0, 0x62, 0x64, 0xBD, 0x30, 0x63, 0x14, 0x22, 0xC0, 0x64, 0x44, 0x9F, 0x30, -0x64, 0xF4, 0x04, 0xC0, 0x66, 0x2D, 0xBB, 0xB0, 0x66, 0xDD, 0x21, 0x40, 0x68, 0x0D, 0x9D, 0xB0, -0x68, 0xBD, 0x03, 0x40, 0x69, 0xED, 0x7F, 0xB0, 0x6A, 0x9C, 0xE5, 0x40, 0x6B, 0xCD, 0x61, 0xB0, -0x6C, 0x7C, 0xC7, 0x40, 0x6D, 0xAD, 0x43, 0xB0, 0x6E, 0x5C, 0xA9, 0x40, 0x6F, 0x96, 0x60, 0x30, -0x70, 0x3C, 0x8B, 0x40, 0x71, 0x76, 0x42, 0x30, 0x72, 0x25, 0xA7, 0xC0, 0x73, 0x56, 0x24, 0x30, -0x74, 0x05, 0x89, 0xC0, 0x75, 0x36, 0x06, 0x30, 0x75, 0xE5, 0x6B, 0xC0, 0x77, 0x15, 0xE8, 0x30, -0x77, 0xC5, 0x4D, 0xC0, 0x78, 0xF5, 0xCA, 0x30, 0x79, 0xA5, 0x2F, 0xC0, 0x7A, 0xDE, 0xE6, 0xB0, -0x7B, 0x85, 0x11, 0xC0, 0x7C, 0xBE, 0xC8, 0xB0, 0x7D, 0x6E, 0x2E, 0x40, 0x7E, 0x9E, 0xAA, 0xB0, -0x7F, 0x4E, 0x10, 0x40, 0x01, 0x00, 0x02, 0x00, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, -0x03, 0x01, 0x03, 0x04, 0x05, 0x04, 0x02, 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, 0x06, 0x07, 0x06, -0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, +0x01, 0x00, 0x02, 0x00, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x04, +0x05, 0x04, 0x02, 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, 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, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, -0x07, 0x06, 0xFF, 0xFF, 0xBD, 0xBA, 0x00, 0x00, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x04, 0xFF, 0xFF, -0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x08, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x04, -0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xC7, 0xC0, -0x00, 0x04, 0x53, 0x4D, 0x54, 0x00, 0x43, 0x4C, 0x54, 0x00, 0x43, 0x4C, 0x53, 0x54, 0x00, 0x00, -0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, -0x56, 0x49, 0xD8, 0x00, 0xA6, 0xD4, 0x55, 0x00, 0x00, 0x00, 0x0E, 0x6D, 0x6F, 0x73, 0x74, 0x20, -0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73, +0x08, 0xFF, 0xFF, 0xBD, 0xBA, 0x00, 0x00, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, +0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x08, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x04, 0xFF, +0xFF, 0xC7, 0xC0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, +0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0x53, 0x4D, 0x54, 0x00, 0x43, 0x4C, 0x54, 0x00, 0x43, +0x4C, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, +0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x56, 0x49, 0xD8, 0x00, 0xA6, 0xD4, 0x55, 0x00, 0x00, +0x00, 0x0E, 0x6D, 0x6F, 0x73, 0x74, 0x20, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73, + /* America/Santo_Domingo */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x44, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -7336,8 +7309,8 @@ const unsigned char timelib_timezone_db_data_builtin[263744] = { /* Antarctica/Palmer */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x41, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x7D, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0xF6, 0x98, 0xAD, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x16, 0xF6, 0x98, 0xAD, 0x00, 0xF6, 0xE6, 0x9F, 0xB0, 0xF8, 0x13, 0x43, 0xC0, 0xF8, 0xC7, 0xD3, 0x30, 0xF9, 0xF4, 0x77, 0x40, 0xFA, 0xD3, 0x36, 0xB0, 0xFB, 0xC3, 0x35, 0xC0, 0xFC, 0xBC, 0x53, 0x30, 0xFD, 0xAC, 0x52, 0x40, 0xFE, 0x9C, 0x35, 0x30, 0xFF, 0x8C, 0x34, 0x40, 0x07, 0xA3, 0x4A, 0xB0, 0x08, 0x24, 0x6F, 0xA0, @@ -7357,34 +7330,21 @@ const unsigned char timelib_timezone_db_data_builtin[263744] = { 0x47, 0xEF, 0x02, 0x30, 0x48, 0xF1, 0x76, 0x40, 0x49, 0xBC, 0x6F, 0x30, 0x4A, 0xD1, 0x58, 0x40, 0x4B, 0xB8, 0x00, 0xB0, 0x4C, 0xB1, 0x3A, 0x40, 0x4D, 0xC6, 0x07, 0x30, 0x4E, 0x50, 0x82, 0xC0, 0x4F, 0x9C, 0xAE, 0xB0, 0x50, 0x42, 0xD9, 0xC0, 0x51, 0x7C, 0x90, 0xB0, 0x52, 0x2B, 0xF6, 0x40, -0x53, 0x5C, 0x72, 0xB0, 0x54, 0x0B, 0xD8, 0x40, 0x55, 0x3C, 0x54, 0xB0, 0x55, 0xEB, 0xBA, 0x40, -0x57, 0x1C, 0x36, 0xB0, 0x57, 0xCB, 0x9C, 0x40, 0x58, 0xFC, 0x18, 0xB0, 0x59, 0xAB, 0x7E, 0x40, -0x5A, 0xE5, 0x35, 0x30, 0x5B, 0x8B, 0x60, 0x40, 0x5C, 0xC5, 0x17, 0x30, 0x5D, 0x74, 0x7C, 0xC0, -0x5E, 0xA4, 0xF9, 0x30, 0x5F, 0x54, 0x5E, 0xC0, 0x60, 0x84, 0xDB, 0x30, 0x61, 0x34, 0x40, 0xC0, -0x62, 0x64, 0xBD, 0x30, 0x63, 0x14, 0x22, 0xC0, 0x64, 0x44, 0x9F, 0x30, 0x64, 0xF4, 0x04, 0xC0, -0x66, 0x2D, 0xBB, 0xB0, 0x66, 0xDD, 0x21, 0x40, 0x68, 0x0D, 0x9D, 0xB0, 0x68, 0xBD, 0x03, 0x40, -0x69, 0xED, 0x7F, 0xB0, 0x6A, 0x9C, 0xE5, 0x40, 0x6B, 0xCD, 0x61, 0xB0, 0x6C, 0x7C, 0xC7, 0x40, -0x6D, 0xAD, 0x43, 0xB0, 0x6E, 0x5C, 0xA9, 0x40, 0x6F, 0x96, 0x60, 0x30, 0x70, 0x3C, 0x8B, 0x40, -0x71, 0x76, 0x42, 0x30, 0x72, 0x25, 0xA7, 0xC0, 0x73, 0x56, 0x24, 0x30, 0x74, 0x05, 0x89, 0xC0, -0x75, 0x36, 0x06, 0x30, 0x75, 0xE5, 0x6B, 0xC0, 0x77, 0x15, 0xE8, 0x30, 0x77, 0xC5, 0x4D, 0xC0, -0x78, 0xF5, 0xCA, 0x30, 0x79, 0xA5, 0x2F, 0xC0, 0x7A, 0xDE, 0xE6, 0xB0, 0x7B, 0x85, 0x11, 0xC0, -0x7C, 0xBE, 0xC8, 0xB0, 0x7D, 0x6E, 0x2E, 0x40, 0x7E, 0x9E, 0xAA, 0xB0, 0x7F, 0x4E, 0x10, 0x40, -0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x04, 0x03, 0x04, 0x07, 0x05, 0x06, -0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, -0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, +0x53, 0x5C, 0x72, 0xB0, 0x54, 0x0B, 0xD8, 0x40, 0x55, 0x3C, 0x54, 0xB0, 0x02, 0x01, 0x02, 0x01, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x04, 0x03, 0x04, 0x07, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, -0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, -0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, -0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, -0x0D, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x12, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x12, 0x7A, 0x7A, 0x7A, -0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00, 0x43, 0x4C, 0x53, 0x54, 0x00, 0x43, -0x4C, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x01, 0x01, 0x00, 0x00, 0x26, 0x73, 0xC0, 0x00, 0xB0, 0xD9, 0x70, 0x00, 0x00, 0x00, 0x1D, 0x50, -0x61, 0x6C, 0x6D, 0x65, 0x72, 0x20, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x2C, 0x20, 0x41, -0x6E, 0x76, 0x65, 0x72, 0x73, 0x20, 0x49, 0x73, 0x6C, 0x61, 0x6E, 0x64, +0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x08, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, +0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x0D, +0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x12, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x12, 0xFF, 0xFF, 0xD5, 0xD0, +0x00, 0x12, 0x7A, 0x7A, 0x7A, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00, 0x43, +0x4C, 0x53, 0x54, 0x00, 0x43, 0x4C, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, +0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x26, 0x73, 0xC0, 0x00, 0xB0, +0xD9, 0x70, 0x00, 0x00, 0x00, 0x1D, 0x50, 0x61, 0x6C, 0x6D, 0x65, 0x72, 0x20, 0x53, 0x74, 0x61, +0x74, 0x69, 0x6F, 0x6E, 0x2C, 0x20, 0x41, 0x6E, 0x76, 0x65, 0x72, 0x73, 0x20, 0x49, 0x73, 0x6C, +0x61, 0x6E, 0x64, /* Antarctica/Rothera */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x41, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -7562,8 +7522,8 @@ const unsigned char timelib_timezone_db_data_builtin[263744] = { /* Asia/Aden */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x59, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0xDA, 0x61, 0x38, 0x56, -0x01, 0x00, 0x00, 0x2A, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x04, 0x4C, 0x4D, 0x54, +0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0xD5, 0x1B, 0x36, 0xB4, +0x01, 0x00, 0x00, 0x2B, 0xCC, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9C, 0xC8, 0xB8, 0x01, 0x57, 0xA0, 0xC0, 0x00, 0x00, 0x00, 0x00, @@ -7807,8 +7767,8 @@ const unsigned char timelib_timezone_db_data_builtin[263744] = { /* Asia/Bahrain */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x42, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0xA1, 0xF2, 0x9E, 0x14, -0x04, 0x8A, 0x92, 0xC0, 0x01, 0x02, 0x00, 0x00, 0x2F, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x38, 0x40, +0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0xA1, 0xF2, 0x9D, 0x30, +0x04, 0x8A, 0x92, 0xC0, 0x01, 0x02, 0x00, 0x00, 0x30, 0x50, 0x00, 0x00, 0x00, 0x00, 0x38, 0x40, 0x00, 0x04, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x08, 0x4C, 0x4D, 0x54, 0x00, 0x47, 0x53, 0x54, 0x00, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB1, 0x96, 0x3D, 0x01, 0x5F, 0xD7, 0x9D, 0x00, 0x00, 0x00, 0x00, @@ -8756,8 +8716,8 @@ const unsigned char timelib_timezone_db_data_builtin[263744] = { /* Asia/Kuwait */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x4B, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0xDA, 0x61, 0x35, 0x84, -0x01, 0x00, 0x00, 0x2C, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x04, 0x4C, 0x4D, 0x54, +0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0xD5, 0x1B, 0x36, 0xB4, +0x01, 0x00, 0x00, 0x2B, 0xCC, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB6, 0x16, 0x95, 0x01, 0x5B, 0xDF, 0xFD, 0x00, 0x00, 0x00, 0x00, @@ -8869,8 +8829,8 @@ const unsigned char timelib_timezone_db_data_builtin[263744] = { /* Asia/Muscat */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x4F, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0xA1, 0xF2, 0x96, 0x90, -0x01, 0x00, 0x00, 0x36, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x38, 0x40, 0x00, 0x04, 0x4C, 0x4D, 0x54, +0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0xA1, 0xF2, 0x99, 0xA8, +0x01, 0x00, 0x00, 0x33, 0xD8, 0x00, 0x00, 0x00, 0x00, 0x38, 0x40, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x47, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAD, 0x57, 0x00, 0x01, 0x6C, 0x0C, 0x9D, 0x00, 0x00, 0x00, 0x00, @@ -10166,9 +10126,10 @@ const unsigned char timelib_timezone_db_data_builtin[263744] = { /* Atlantic/Reykjavik */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x49, 0x53, 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, -0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x11, 0x8B, 0x60, 0x83, 0x94, +0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x11, 0x8B, 0x60, 0x83, 0xA0, 0x9C, 0x91, 0x1E, 0x00, 0x9D, 0xD1, 0x88, 0x90, 0x9E, 0x72, 0x51, 0x80, 0x9F, 0xD5, 0x03, 0x10, -0xC6, 0x4D, 0x1A, 0x00, 0xC7, 0x66, 0x05, 0xA0, 0xC7, 0xDA, 0x17, 0xB0, 0xC9, 0x26, 0x43, 0xA0, +0xA0, 0x53, 0x85, 0x00, 0xA1, 0xB6, 0x36, 0x90, 0xA4, 0x3C, 0x27, 0x80, 0xA4, 0xB9, 0x74, 0x10, +0xC6, 0x4D, 0x1A, 0x00, 0xC7, 0x3D, 0x27, 0x20, 0xC7, 0xDA, 0x17, 0xB0, 0xC9, 0x26, 0x43, 0xA0, 0xC9, 0xC3, 0x26, 0x20, 0xCB, 0x06, 0x25, 0xA0, 0xCB, 0xAC, 0x42, 0xA0, 0xCC, 0xDC, 0xCD, 0x20, 0xCD, 0x8C, 0x24, 0xA0, 0xCE, 0xBC, 0xAF, 0x20, 0xCF, 0x6C, 0x06, 0xA0, 0xD0, 0x9C, 0x91, 0x20, 0xD1, 0x4B, 0xE8, 0xA0, 0xD2, 0x85, 0xAD, 0xA0, 0xD3, 0x2B, 0xCA, 0xA0, 0xD4, 0x65, 0x8F, 0xA0, @@ -10183,15 +10144,15 @@ const unsigned char timelib_timezone_db_data_builtin[263744] = { 0xF3, 0x53, 0xA0, 0xA0, 0xF4, 0x5F, 0x41, 0x20, 0xF5, 0x33, 0x82, 0xA0, 0xF6, 0x3F, 0x23, 0x20, 0xF7, 0x13, 0x64, 0xA0, 0xF8, 0x1F, 0x05, 0x20, 0xF8, 0xF3, 0x46, 0xA0, 0xF9, 0xFE, 0xE7, 0x20, 0xFA, 0xD3, 0x28, 0xA0, 0xFB, 0xE8, 0x03, 0xA0, 0xFC, 0xBC, 0x45, 0x20, 0x02, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x01, 0x02, 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, 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, 0x03, 0x04, 0x05, 0xFF, 0xFF, 0xEB, 0x6C, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0xFF, 0xFF, 0xF1, 0xF0, 0x00, 0x09, 0x00, 0x00, -0x00, 0x00, 0x01, 0x04, 0xFF, 0xFF, 0xF1, 0xF0, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, -0x52, 0x4D, 0x54, 0x00, 0x49, 0x53, 0x53, 0x54, 0x00, 0x49, 0x53, 0x54, 0x00, 0x47, 0x4D, 0x54, -0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEB, 0x36, -0xD8, 0x00, 0xF1, 0x51, 0x58, 0x00, 0x00, 0x00, 0x00, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 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, 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, 0x03, 0x04, 0x03, 0x05, +0xFF, 0xFF, 0xEB, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0xFF, 0xFF, 0xF1, 0xF0, +0x00, 0x09, 0xFF, 0xFF, 0xF1, 0xF0, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, +0x00, 0x00, 0x00, 0x0D, 0x4C, 0x4D, 0x54, 0x00, 0x49, 0x53, 0x53, 0x54, 0x00, 0x49, 0x53, 0x54, +0x00, 0x47, 0x4D, 0x54, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xEB, 0x36, 0xD8, 0x00, 0xF1, 0x51, 0x58, 0x00, 0x00, 0x00, 0x00, /* Atlantic/South_Georgia */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x47, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -11850,8 +11811,8 @@ const unsigned char timelib_timezone_db_data_builtin[263744] = { /* Chile/Continental */ 0x50, 0x48, 0x50, 0x31, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x9E, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x0D, 0x8F, 0x24, 0x69, 0xC6, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0D, 0x8F, 0x24, 0x69, 0xC6, 0x9B, 0x5C, 0xE5, 0x50, 0x9F, 0x71, 0x05, 0x46, 0xA1, 0x00, 0x71, 0xC0, 0xB0, 0x5E, 0x77, 0xC6, 0xB1, 0x77, 0x3D, 0x40, 0xB2, 0x41, 0x00, 0xD0, 0xB3, 0x58, 0x70, 0xC0, 0xB4, 0x22, 0x34, 0x50, 0xB5, 0x39, 0xA4, 0x40, 0xB6, 0x03, 0x67, 0xD0, 0xB7, 0x1A, 0xD7, 0xC0, 0xB7, 0xE4, 0x9B, 0x50, @@ -11880,38 +11841,25 @@ const unsigned char timelib_timezone_db_data_builtin[263744] = { 0x4A, 0xD1, 0x58, 0x40, 0x4B, 0xB8, 0x00, 0xB0, 0x4C, 0xB1, 0x3A, 0x40, 0x4D, 0xC6, 0x07, 0x30, 0x4E, 0x50, 0x82, 0xC0, 0x4F, 0x9C, 0xAE, 0xB0, 0x50, 0x42, 0xD9, 0xC0, 0x51, 0x7C, 0x90, 0xB0, 0x52, 0x2B, 0xF6, 0x40, 0x53, 0x5C, 0x72, 0xB0, 0x54, 0x0B, 0xD8, 0x40, 0x55, 0x3C, 0x54, 0xB0, -0x55, 0xEB, 0xBA, 0x40, 0x57, 0x1C, 0x36, 0xB0, 0x57, 0xCB, 0x9C, 0x40, 0x58, 0xFC, 0x18, 0xB0, -0x59, 0xAB, 0x7E, 0x40, 0x5A, 0xE5, 0x35, 0x30, 0x5B, 0x8B, 0x60, 0x40, 0x5C, 0xC5, 0x17, 0x30, -0x5D, 0x74, 0x7C, 0xC0, 0x5E, 0xA4, 0xF9, 0x30, 0x5F, 0x54, 0x5E, 0xC0, 0x60, 0x84, 0xDB, 0x30, -0x61, 0x34, 0x40, 0xC0, 0x62, 0x64, 0xBD, 0x30, 0x63, 0x14, 0x22, 0xC0, 0x64, 0x44, 0x9F, 0x30, -0x64, 0xF4, 0x04, 0xC0, 0x66, 0x2D, 0xBB, 0xB0, 0x66, 0xDD, 0x21, 0x40, 0x68, 0x0D, 0x9D, 0xB0, -0x68, 0xBD, 0x03, 0x40, 0x69, 0xED, 0x7F, 0xB0, 0x6A, 0x9C, 0xE5, 0x40, 0x6B, 0xCD, 0x61, 0xB0, -0x6C, 0x7C, 0xC7, 0x40, 0x6D, 0xAD, 0x43, 0xB0, 0x6E, 0x5C, 0xA9, 0x40, 0x6F, 0x96, 0x60, 0x30, -0x70, 0x3C, 0x8B, 0x40, 0x71, 0x76, 0x42, 0x30, 0x72, 0x25, 0xA7, 0xC0, 0x73, 0x56, 0x24, 0x30, -0x74, 0x05, 0x89, 0xC0, 0x75, 0x36, 0x06, 0x30, 0x75, 0xE5, 0x6B, 0xC0, 0x77, 0x15, 0xE8, 0x30, -0x77, 0xC5, 0x4D, 0xC0, 0x78, 0xF5, 0xCA, 0x30, 0x79, 0xA5, 0x2F, 0xC0, 0x7A, 0xDE, 0xE6, 0xB0, -0x7B, 0x85, 0x11, 0xC0, 0x7C, 0xBE, 0xC8, 0xB0, 0x7D, 0x6E, 0x2E, 0x40, 0x7E, 0x9E, 0xAA, 0xB0, -0x7F, 0x4E, 0x10, 0x40, 0x01, 0x00, 0x02, 0x00, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, -0x03, 0x01, 0x03, 0x04, 0x05, 0x04, 0x02, 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, 0x06, 0x07, 0x06, -0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, +0x01, 0x00, 0x02, 0x00, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x04, +0x05, 0x04, 0x02, 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, 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, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, -0x07, 0x06, 0xFF, 0xFF, 0xBD, 0xBA, 0x00, 0x00, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x04, 0xFF, 0xFF, -0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x08, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x04, -0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xC7, 0xC0, -0x00, 0x04, 0x53, 0x4D, 0x54, 0x00, 0x43, 0x4C, 0x54, 0x00, 0x43, 0x4C, 0x53, 0x54, 0x00, 0x00, -0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, -0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, 0x00, 0x00, 0x00, 0x00, +0x08, 0xFF, 0xFF, 0xBD, 0xBA, 0x00, 0x00, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, +0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x08, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x04, 0xFF, +0xFF, 0xC7, 0xC0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, +0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0x53, 0x4D, 0x54, 0x00, 0x43, 0x4C, 0x54, 0x00, 0x43, +0x4C, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, +0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, 0x00, 0x00, +0x00, 0x00, /* Chile/EasterIsland */ 0x50, 0x48, 0x50, 0x31, 0x00, 0x3F, 0x3F, 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, -0x00, 0x00, 0x00, 0x8F, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0F, 0xB9, 0xC7, 0x40, 0x88, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0F, 0xB9, 0xC7, 0x40, 0x88, 0xCC, 0x1C, 0x6E, 0x40, 0xCC, 0x6C, 0xE7, 0xD0, 0xD4, 0x1B, 0xC9, 0xB0, 0xFD, 0xD1, 0x3C, 0x40, 0xFE, 0x92, 0xFA, 0xB0, 0xFF, 0xCC, 0xCD, 0xC0, 0x00, 0x72, 0xDC, 0xB0, 0x01, 0x75, 0x50, 0xC0, 0x02, 0x40, 0x49, 0xB0, 0x03, 0x55, 0x32, 0xC0, 0x04, 0x20, 0x2B, 0xB0, 0x05, 0x3E, 0x4F, 0x40, @@ -11919,49 +11867,35 @@ const unsigned char timelib_timezone_db_data_builtin[263744] = { 0x09, 0xBF, 0xD1, 0xB0, 0x0A, 0xDD, 0xF5, 0x40, 0x0B, 0xA8, 0xEE, 0x30, 0x0C, 0xBD, 0xD7, 0x40, 0x0D, 0x88, 0xD0, 0x30, 0x0E, 0x9D, 0xB9, 0x40, 0x0F, 0x68, 0xB2, 0x30, 0x10, 0x86, 0xD5, 0xC0, 0x11, 0x48, 0x94, 0x30, 0x12, 0x66, 0xB7, 0xC0, 0x13, 0x28, 0x76, 0x30, 0x14, 0x46, 0x99, 0xC0, -0x15, 0x11, 0x92, 0xB0, 0x16, 0x26, 0x7B, 0xC0, 0x16, 0xF1, 0x74, 0xB0, 0x18, 0x06, 0x5D, 0xC0, -0x18, 0xD1, 0x56, 0xB0, 0x19, 0xE6, 0x3F, 0xC0, 0x1A, 0xB1, 0x38, 0xB0, 0x1B, 0xCF, 0x5C, 0x40, -0x1C, 0x91, 0x1A, 0xB0, 0x1D, 0xAF, 0x3E, 0x40, 0x1E, 0x70, 0xFC, 0xB0, 0x1F, 0x8F, 0x20, 0x40, -0x20, 0x7F, 0x03, 0x30, 0x21, 0x6F, 0x02, 0x40, 0x22, 0x39, 0xFB, 0x30, 0x23, 0x45, 0xA9, 0xC0, -0x24, 0x19, 0xDD, 0x30, 0x25, 0x38, 0x00, 0xC0, 0x26, 0x02, 0xF9, 0xB0, 0x26, 0xF2, 0xF8, 0xC0, -0x27, 0xD9, 0xA1, 0x30, 0x28, 0xF7, 0xC4, 0xC0, 0x29, 0xC2, 0xBD, 0xB0, 0x2A, 0xD7, 0xA6, 0xC0, -0x2B, 0xA2, 0x9F, 0xB0, 0x2C, 0xB7, 0x88, 0xC0, 0x2D, 0x82, 0x81, 0xB0, 0x2E, 0x97, 0x6A, 0xC0, -0x2F, 0x62, 0x63, 0xB0, 0x30, 0x80, 0x87, 0x40, 0x31, 0x42, 0x45, 0xB0, 0x32, 0x60, 0x69, 0x40, -0x33, 0x3D, 0xD7, 0x30, 0x34, 0x40, 0x4B, 0x40, 0x35, 0x0B, 0x44, 0x30, 0x36, 0x0D, 0xB8, 0x40, -0x37, 0x06, 0xD5, 0xB0, 0x38, 0x00, 0x0F, 0x40, 0x38, 0xCB, 0x08, 0x30, 0x39, 0xE9, 0x2B, 0xC0, -0x3A, 0xAA, 0xEA, 0x30, 0x3B, 0xC9, 0x0D, 0xC0, 0x3C, 0x8A, 0xCC, 0x30, 0x3D, 0xA8, 0xEF, 0xC0, -0x3E, 0x6A, 0xAE, 0x30, 0x3F, 0x88, 0xD1, 0xC0, 0x40, 0x53, 0xCA, 0xB0, 0x41, 0x68, 0xB3, 0xC0, -0x42, 0x33, 0xAC, 0xB0, 0x43, 0x48, 0x95, 0xC0, 0x44, 0x13, 0x8E, 0xB0, 0x45, 0x31, 0xB2, 0x40, -0x45, 0xF3, 0x70, 0xB0, 0x47, 0x11, 0x94, 0x40, 0x47, 0xEF, 0x02, 0x30, 0x48, 0xF1, 0x76, 0x40, -0x49, 0xBC, 0x6F, 0x30, 0x4A, 0xD1, 0x58, 0x40, 0x4B, 0xB8, 0x00, 0xB0, 0x4C, 0xB1, 0x3A, 0x40, -0x4D, 0xC6, 0x07, 0x30, 0x4E, 0x50, 0x82, 0xC0, 0x4F, 0x9C, 0xAE, 0xB0, 0x50, 0x42, 0xD9, 0xC0, -0x51, 0x7C, 0x90, 0xB0, 0x52, 0x2B, 0xF6, 0x40, 0x53, 0x5C, 0x72, 0xB0, 0x54, 0x0B, 0xD8, 0x40, -0x55, 0x3C, 0x54, 0xB0, 0x55, 0xEB, 0xBA, 0x40, 0x57, 0x1C, 0x36, 0xB0, 0x57, 0xCB, 0x9C, 0x40, -0x58, 0xFC, 0x18, 0xB0, 0x59, 0xAB, 0x7E, 0x40, 0x5A, 0xE5, 0x35, 0x30, 0x5B, 0x8B, 0x60, 0x40, -0x5C, 0xC5, 0x17, 0x30, 0x5D, 0x74, 0x7C, 0xC0, 0x5E, 0xA4, 0xF9, 0x30, 0x5F, 0x54, 0x5E, 0xC0, -0x60, 0x84, 0xDB, 0x30, 0x61, 0x34, 0x40, 0xC0, 0x62, 0x64, 0xBD, 0x30, 0x63, 0x14, 0x22, 0xC0, -0x64, 0x44, 0x9F, 0x30, 0x64, 0xF4, 0x04, 0xC0, 0x66, 0x2D, 0xBB, 0xB0, 0x66, 0xDD, 0x21, 0x40, -0x68, 0x0D, 0x9D, 0xB0, 0x68, 0xBD, 0x03, 0x40, 0x69, 0xED, 0x7F, 0xB0, 0x6A, 0x9C, 0xE5, 0x40, -0x6B, 0xCD, 0x61, 0xB0, 0x6C, 0x7C, 0xC7, 0x40, 0x6D, 0xAD, 0x43, 0xB0, 0x6E, 0x5C, 0xA9, 0x40, -0x6F, 0x96, 0x60, 0x30, 0x70, 0x3C, 0x8B, 0x40, 0x71, 0x76, 0x42, 0x30, 0x72, 0x25, 0xA7, 0xC0, -0x73, 0x56, 0x24, 0x30, 0x74, 0x05, 0x89, 0xC0, 0x75, 0x36, 0x06, 0x30, 0x75, 0xE5, 0x6B, 0xC0, -0x77, 0x15, 0xE8, 0x30, 0x77, 0xC5, 0x4D, 0xC0, 0x78, 0xF5, 0xCA, 0x30, 0x79, 0xA5, 0x2F, 0xC0, -0x7A, 0xDE, 0xE6, 0xB0, 0x7B, 0x85, 0x11, 0xC0, 0x7C, 0xBE, 0xC8, 0xB0, 0x7D, 0x6E, 0x2E, 0x40, -0x7E, 0x9E, 0xAA, 0xB0, 0x7F, 0x4E, 0x10, 0x40, 0x03, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x15, 0x11, 0x92, 0xB0, 0x16, 0x26, 0x7B, 0xC0, 0x16, 0xF0, 0x23, 0x30, 0x16, 0xF1, 0x74, 0xB0, +0x18, 0x06, 0x5D, 0xC0, 0x18, 0xD1, 0x56, 0xB0, 0x19, 0xE6, 0x3F, 0xC0, 0x1A, 0xB1, 0x38, 0xB0, +0x1B, 0xCF, 0x5C, 0x40, 0x1C, 0x91, 0x1A, 0xB0, 0x1D, 0xAF, 0x3E, 0x40, 0x1E, 0x70, 0xFC, 0xB0, +0x1F, 0x8F, 0x20, 0x40, 0x20, 0x7F, 0x03, 0x30, 0x21, 0x6F, 0x02, 0x40, 0x22, 0x39, 0xFB, 0x30, +0x23, 0x45, 0xA9, 0xC0, 0x24, 0x19, 0xDD, 0x30, 0x25, 0x38, 0x00, 0xC0, 0x26, 0x02, 0xF9, 0xB0, +0x26, 0xF2, 0xF8, 0xC0, 0x27, 0xD9, 0xA1, 0x30, 0x28, 0xF7, 0xC4, 0xC0, 0x29, 0xC2, 0xBD, 0xB0, +0x2A, 0xD7, 0xA6, 0xC0, 0x2B, 0xA2, 0x9F, 0xB0, 0x2C, 0xB7, 0x88, 0xC0, 0x2D, 0x82, 0x81, 0xB0, +0x2E, 0x97, 0x6A, 0xC0, 0x2F, 0x62, 0x63, 0xB0, 0x30, 0x80, 0x87, 0x40, 0x31, 0x42, 0x45, 0xB0, +0x32, 0x60, 0x69, 0x40, 0x33, 0x3D, 0xD7, 0x30, 0x34, 0x40, 0x4B, 0x40, 0x35, 0x0B, 0x44, 0x30, +0x36, 0x0D, 0xB8, 0x40, 0x37, 0x06, 0xD5, 0xB0, 0x38, 0x00, 0x0F, 0x40, 0x38, 0xCB, 0x08, 0x30, +0x39, 0xE9, 0x2B, 0xC0, 0x3A, 0xAA, 0xEA, 0x30, 0x3B, 0xC9, 0x0D, 0xC0, 0x3C, 0x8A, 0xCC, 0x30, +0x3D, 0xA8, 0xEF, 0xC0, 0x3E, 0x6A, 0xAE, 0x30, 0x3F, 0x88, 0xD1, 0xC0, 0x40, 0x53, 0xCA, 0xB0, +0x41, 0x68, 0xB3, 0xC0, 0x42, 0x33, 0xAC, 0xB0, 0x43, 0x48, 0x95, 0xC0, 0x44, 0x13, 0x8E, 0xB0, +0x45, 0x31, 0xB2, 0x40, 0x45, 0xF3, 0x70, 0xB0, 0x47, 0x11, 0x94, 0x40, 0x47, 0xEF, 0x02, 0x30, +0x48, 0xF1, 0x76, 0x40, 0x49, 0xBC, 0x6F, 0x30, 0x4A, 0xD1, 0x58, 0x40, 0x4B, 0xB8, 0x00, 0xB0, +0x4C, 0xB1, 0x3A, 0x40, 0x4D, 0xC6, 0x07, 0x30, 0x4E, 0x50, 0x82, 0xC0, 0x4F, 0x9C, 0xAE, 0xB0, +0x50, 0x42, 0xD9, 0xC0, 0x51, 0x7C, 0x90, 0xB0, 0x52, 0x2B, 0xF6, 0x40, 0x53, 0x5C, 0x72, 0xB0, +0x54, 0x0B, 0xD8, 0x40, 0x55, 0x3C, 0x54, 0xB0, 0x03, 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, 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, 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, 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, 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, 0x04, -0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0xFF, 0xFF, 0x99, 0x78, 0x00, 0x00, 0xFF, 0xFF, 0x9D, -0x90, 0x00, 0x04, 0xFF, 0xFF, 0xAB, 0xA0, 0x01, 0x09, 0xFF, 0xFF, 0xAB, 0xA0, 0x01, 0x09, 0xFF, -0xFF, 0xAB, 0xA0, 0x00, 0x04, 0xFF, 0xFF, 0xB9, 0xB0, 0x01, 0x09, 0x45, 0x4D, 0x54, 0x00, 0x45, -0x41, 0x53, 0x54, 0x00, 0x45, 0x41, 0x53, 0x53, 0x54, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, -0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, 0x00, 0x00, -0x00, 0x00, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 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, 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, 0x04, 0x05, 0x04, 0x05, +0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x06, 0xFF, 0xFF, 0x99, 0x78, 0x00, +0x00, 0xFF, 0xFF, 0x9D, 0x90, 0x00, 0x04, 0xFF, 0xFF, 0xAB, 0xA0, 0x01, 0x09, 0xFF, 0xFF, 0xAB, +0xA0, 0x01, 0x09, 0xFF, 0xFF, 0xAB, 0xA0, 0x00, 0x04, 0xFF, 0xFF, 0xB9, 0xB0, 0x01, 0x09, 0xFF, +0xFF, 0xB9, 0xB0, 0x00, 0x04, 0x45, 0x4D, 0x54, 0x00, 0x45, 0x41, 0x53, 0x54, 0x00, 0x45, 0x41, +0x53, 0x53, 0x54, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, +0x01, 0x01, 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, 0x00, 0x00, 0x00, 0x00, /* CST6CDT */ 0x50, 0x48, 0x50, 0x31, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -16215,9 +16149,10 @@ const unsigned char timelib_timezone_db_data_builtin[263744] = { /* Iceland */ 0x50, 0x48, 0x50, 0x31, 0x00, 0x3F, 0x3F, 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, -0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x11, 0x8B, 0x60, 0x83, 0x94, +0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x11, 0x8B, 0x60, 0x83, 0xA0, 0x9C, 0x91, 0x1E, 0x00, 0x9D, 0xD1, 0x88, 0x90, 0x9E, 0x72, 0x51, 0x80, 0x9F, 0xD5, 0x03, 0x10, -0xC6, 0x4D, 0x1A, 0x00, 0xC7, 0x66, 0x05, 0xA0, 0xC7, 0xDA, 0x17, 0xB0, 0xC9, 0x26, 0x43, 0xA0, +0xA0, 0x53, 0x85, 0x00, 0xA1, 0xB6, 0x36, 0x90, 0xA4, 0x3C, 0x27, 0x80, 0xA4, 0xB9, 0x74, 0x10, +0xC6, 0x4D, 0x1A, 0x00, 0xC7, 0x3D, 0x27, 0x20, 0xC7, 0xDA, 0x17, 0xB0, 0xC9, 0x26, 0x43, 0xA0, 0xC9, 0xC3, 0x26, 0x20, 0xCB, 0x06, 0x25, 0xA0, 0xCB, 0xAC, 0x42, 0xA0, 0xCC, 0xDC, 0xCD, 0x20, 0xCD, 0x8C, 0x24, 0xA0, 0xCE, 0xBC, 0xAF, 0x20, 0xCF, 0x6C, 0x06, 0xA0, 0xD0, 0x9C, 0x91, 0x20, 0xD1, 0x4B, 0xE8, 0xA0, 0xD2, 0x85, 0xAD, 0xA0, 0xD3, 0x2B, 0xCA, 0xA0, 0xD4, 0x65, 0x8F, 0xA0, @@ -16232,15 +16167,15 @@ const unsigned char timelib_timezone_db_data_builtin[263744] = { 0xF3, 0x53, 0xA0, 0xA0, 0xF4, 0x5F, 0x41, 0x20, 0xF5, 0x33, 0x82, 0xA0, 0xF6, 0x3F, 0x23, 0x20, 0xF7, 0x13, 0x64, 0xA0, 0xF8, 0x1F, 0x05, 0x20, 0xF8, 0xF3, 0x46, 0xA0, 0xF9, 0xFE, 0xE7, 0x20, 0xFA, 0xD3, 0x28, 0xA0, 0xFB, 0xE8, 0x03, 0xA0, 0xFC, 0xBC, 0x45, 0x20, 0x02, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x01, 0x02, 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, 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, 0x03, 0x04, 0x05, 0xFF, 0xFF, 0xEB, 0x6C, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0xFF, 0xFF, 0xF1, 0xF0, 0x00, 0x09, 0x00, 0x00, -0x00, 0x00, 0x01, 0x04, 0xFF, 0xFF, 0xF1, 0xF0, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, -0x52, 0x4D, 0x54, 0x00, 0x49, 0x53, 0x53, 0x54, 0x00, 0x49, 0x53, 0x54, 0x00, 0x47, 0x4D, 0x54, -0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x54, -0x40, 0x01, 0x12, 0xA8, 0x80, 0x00, 0x00, 0x00, 0x00, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 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, 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, 0x03, 0x04, 0x03, 0x05, +0xFF, 0xFF, 0xEB, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0xFF, 0xFF, 0xF1, 0xF0, +0x00, 0x09, 0xFF, 0xFF, 0xF1, 0xF0, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, +0x00, 0x00, 0x00, 0x0D, 0x4C, 0x4D, 0x54, 0x00, 0x49, 0x53, 0x53, 0x54, 0x00, 0x49, 0x53, 0x54, +0x00, 0x47, 0x4D, 0x54, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, 0x00, 0x00, 0x00, 0x00, /* Indian/Antananarivo */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x4D, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -17057,8 +16992,8 @@ const unsigned char timelib_timezone_db_data_builtin[263744] = { /* Pacific/Easter */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x43, 0x4C, 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, -0x00, 0x00, 0x00, 0x8F, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0F, 0xB9, 0xC7, 0x40, 0x88, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0F, 0xB9, 0xC7, 0x40, 0x88, 0xCC, 0x1C, 0x6E, 0x40, 0xCC, 0x6C, 0xE7, 0xD0, 0xD4, 0x1B, 0xC9, 0xB0, 0xFD, 0xD1, 0x3C, 0x40, 0xFE, 0x92, 0xFA, 0xB0, 0xFF, 0xCC, 0xCD, 0xC0, 0x00, 0x72, 0xDC, 0xB0, 0x01, 0x75, 0x50, 0xC0, 0x02, 0x40, 0x49, 0xB0, 0x03, 0x55, 0x32, 0xC0, 0x04, 0x20, 0x2B, 0xB0, 0x05, 0x3E, 0x4F, 0x40, @@ -17066,49 +17001,36 @@ const unsigned char timelib_timezone_db_data_builtin[263744] = { 0x09, 0xBF, 0xD1, 0xB0, 0x0A, 0xDD, 0xF5, 0x40, 0x0B, 0xA8, 0xEE, 0x30, 0x0C, 0xBD, 0xD7, 0x40, 0x0D, 0x88, 0xD0, 0x30, 0x0E, 0x9D, 0xB9, 0x40, 0x0F, 0x68, 0xB2, 0x30, 0x10, 0x86, 0xD5, 0xC0, 0x11, 0x48, 0x94, 0x30, 0x12, 0x66, 0xB7, 0xC0, 0x13, 0x28, 0x76, 0x30, 0x14, 0x46, 0x99, 0xC0, -0x15, 0x11, 0x92, 0xB0, 0x16, 0x26, 0x7B, 0xC0, 0x16, 0xF1, 0x74, 0xB0, 0x18, 0x06, 0x5D, 0xC0, -0x18, 0xD1, 0x56, 0xB0, 0x19, 0xE6, 0x3F, 0xC0, 0x1A, 0xB1, 0x38, 0xB0, 0x1B, 0xCF, 0x5C, 0x40, -0x1C, 0x91, 0x1A, 0xB0, 0x1D, 0xAF, 0x3E, 0x40, 0x1E, 0x70, 0xFC, 0xB0, 0x1F, 0x8F, 0x20, 0x40, -0x20, 0x7F, 0x03, 0x30, 0x21, 0x6F, 0x02, 0x40, 0x22, 0x39, 0xFB, 0x30, 0x23, 0x45, 0xA9, 0xC0, -0x24, 0x19, 0xDD, 0x30, 0x25, 0x38, 0x00, 0xC0, 0x26, 0x02, 0xF9, 0xB0, 0x26, 0xF2, 0xF8, 0xC0, -0x27, 0xD9, 0xA1, 0x30, 0x28, 0xF7, 0xC4, 0xC0, 0x29, 0xC2, 0xBD, 0xB0, 0x2A, 0xD7, 0xA6, 0xC0, -0x2B, 0xA2, 0x9F, 0xB0, 0x2C, 0xB7, 0x88, 0xC0, 0x2D, 0x82, 0x81, 0xB0, 0x2E, 0x97, 0x6A, 0xC0, -0x2F, 0x62, 0x63, 0xB0, 0x30, 0x80, 0x87, 0x40, 0x31, 0x42, 0x45, 0xB0, 0x32, 0x60, 0x69, 0x40, -0x33, 0x3D, 0xD7, 0x30, 0x34, 0x40, 0x4B, 0x40, 0x35, 0x0B, 0x44, 0x30, 0x36, 0x0D, 0xB8, 0x40, -0x37, 0x06, 0xD5, 0xB0, 0x38, 0x00, 0x0F, 0x40, 0x38, 0xCB, 0x08, 0x30, 0x39, 0xE9, 0x2B, 0xC0, -0x3A, 0xAA, 0xEA, 0x30, 0x3B, 0xC9, 0x0D, 0xC0, 0x3C, 0x8A, 0xCC, 0x30, 0x3D, 0xA8, 0xEF, 0xC0, -0x3E, 0x6A, 0xAE, 0x30, 0x3F, 0x88, 0xD1, 0xC0, 0x40, 0x53, 0xCA, 0xB0, 0x41, 0x68, 0xB3, 0xC0, -0x42, 0x33, 0xAC, 0xB0, 0x43, 0x48, 0x95, 0xC0, 0x44, 0x13, 0x8E, 0xB0, 0x45, 0x31, 0xB2, 0x40, -0x45, 0xF3, 0x70, 0xB0, 0x47, 0x11, 0x94, 0x40, 0x47, 0xEF, 0x02, 0x30, 0x48, 0xF1, 0x76, 0x40, -0x49, 0xBC, 0x6F, 0x30, 0x4A, 0xD1, 0x58, 0x40, 0x4B, 0xB8, 0x00, 0xB0, 0x4C, 0xB1, 0x3A, 0x40, -0x4D, 0xC6, 0x07, 0x30, 0x4E, 0x50, 0x82, 0xC0, 0x4F, 0x9C, 0xAE, 0xB0, 0x50, 0x42, 0xD9, 0xC0, -0x51, 0x7C, 0x90, 0xB0, 0x52, 0x2B, 0xF6, 0x40, 0x53, 0x5C, 0x72, 0xB0, 0x54, 0x0B, 0xD8, 0x40, -0x55, 0x3C, 0x54, 0xB0, 0x55, 0xEB, 0xBA, 0x40, 0x57, 0x1C, 0x36, 0xB0, 0x57, 0xCB, 0x9C, 0x40, -0x58, 0xFC, 0x18, 0xB0, 0x59, 0xAB, 0x7E, 0x40, 0x5A, 0xE5, 0x35, 0x30, 0x5B, 0x8B, 0x60, 0x40, -0x5C, 0xC5, 0x17, 0x30, 0x5D, 0x74, 0x7C, 0xC0, 0x5E, 0xA4, 0xF9, 0x30, 0x5F, 0x54, 0x5E, 0xC0, -0x60, 0x84, 0xDB, 0x30, 0x61, 0x34, 0x40, 0xC0, 0x62, 0x64, 0xBD, 0x30, 0x63, 0x14, 0x22, 0xC0, -0x64, 0x44, 0x9F, 0x30, 0x64, 0xF4, 0x04, 0xC0, 0x66, 0x2D, 0xBB, 0xB0, 0x66, 0xDD, 0x21, 0x40, -0x68, 0x0D, 0x9D, 0xB0, 0x68, 0xBD, 0x03, 0x40, 0x69, 0xED, 0x7F, 0xB0, 0x6A, 0x9C, 0xE5, 0x40, -0x6B, 0xCD, 0x61, 0xB0, 0x6C, 0x7C, 0xC7, 0x40, 0x6D, 0xAD, 0x43, 0xB0, 0x6E, 0x5C, 0xA9, 0x40, -0x6F, 0x96, 0x60, 0x30, 0x70, 0x3C, 0x8B, 0x40, 0x71, 0x76, 0x42, 0x30, 0x72, 0x25, 0xA7, 0xC0, -0x73, 0x56, 0x24, 0x30, 0x74, 0x05, 0x89, 0xC0, 0x75, 0x36, 0x06, 0x30, 0x75, 0xE5, 0x6B, 0xC0, -0x77, 0x15, 0xE8, 0x30, 0x77, 0xC5, 0x4D, 0xC0, 0x78, 0xF5, 0xCA, 0x30, 0x79, 0xA5, 0x2F, 0xC0, -0x7A, 0xDE, 0xE6, 0xB0, 0x7B, 0x85, 0x11, 0xC0, 0x7C, 0xBE, 0xC8, 0xB0, 0x7D, 0x6E, 0x2E, 0x40, -0x7E, 0x9E, 0xAA, 0xB0, 0x7F, 0x4E, 0x10, 0x40, 0x03, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x15, 0x11, 0x92, 0xB0, 0x16, 0x26, 0x7B, 0xC0, 0x16, 0xF0, 0x23, 0x30, 0x16, 0xF1, 0x74, 0xB0, +0x18, 0x06, 0x5D, 0xC0, 0x18, 0xD1, 0x56, 0xB0, 0x19, 0xE6, 0x3F, 0xC0, 0x1A, 0xB1, 0x38, 0xB0, +0x1B, 0xCF, 0x5C, 0x40, 0x1C, 0x91, 0x1A, 0xB0, 0x1D, 0xAF, 0x3E, 0x40, 0x1E, 0x70, 0xFC, 0xB0, +0x1F, 0x8F, 0x20, 0x40, 0x20, 0x7F, 0x03, 0x30, 0x21, 0x6F, 0x02, 0x40, 0x22, 0x39, 0xFB, 0x30, +0x23, 0x45, 0xA9, 0xC0, 0x24, 0x19, 0xDD, 0x30, 0x25, 0x38, 0x00, 0xC0, 0x26, 0x02, 0xF9, 0xB0, +0x26, 0xF2, 0xF8, 0xC0, 0x27, 0xD9, 0xA1, 0x30, 0x28, 0xF7, 0xC4, 0xC0, 0x29, 0xC2, 0xBD, 0xB0, +0x2A, 0xD7, 0xA6, 0xC0, 0x2B, 0xA2, 0x9F, 0xB0, 0x2C, 0xB7, 0x88, 0xC0, 0x2D, 0x82, 0x81, 0xB0, +0x2E, 0x97, 0x6A, 0xC0, 0x2F, 0x62, 0x63, 0xB0, 0x30, 0x80, 0x87, 0x40, 0x31, 0x42, 0x45, 0xB0, +0x32, 0x60, 0x69, 0x40, 0x33, 0x3D, 0xD7, 0x30, 0x34, 0x40, 0x4B, 0x40, 0x35, 0x0B, 0x44, 0x30, +0x36, 0x0D, 0xB8, 0x40, 0x37, 0x06, 0xD5, 0xB0, 0x38, 0x00, 0x0F, 0x40, 0x38, 0xCB, 0x08, 0x30, +0x39, 0xE9, 0x2B, 0xC0, 0x3A, 0xAA, 0xEA, 0x30, 0x3B, 0xC9, 0x0D, 0xC0, 0x3C, 0x8A, 0xCC, 0x30, +0x3D, 0xA8, 0xEF, 0xC0, 0x3E, 0x6A, 0xAE, 0x30, 0x3F, 0x88, 0xD1, 0xC0, 0x40, 0x53, 0xCA, 0xB0, +0x41, 0x68, 0xB3, 0xC0, 0x42, 0x33, 0xAC, 0xB0, 0x43, 0x48, 0x95, 0xC0, 0x44, 0x13, 0x8E, 0xB0, +0x45, 0x31, 0xB2, 0x40, 0x45, 0xF3, 0x70, 0xB0, 0x47, 0x11, 0x94, 0x40, 0x47, 0xEF, 0x02, 0x30, +0x48, 0xF1, 0x76, 0x40, 0x49, 0xBC, 0x6F, 0x30, 0x4A, 0xD1, 0x58, 0x40, 0x4B, 0xB8, 0x00, 0xB0, +0x4C, 0xB1, 0x3A, 0x40, 0x4D, 0xC6, 0x07, 0x30, 0x4E, 0x50, 0x82, 0xC0, 0x4F, 0x9C, 0xAE, 0xB0, +0x50, 0x42, 0xD9, 0xC0, 0x51, 0x7C, 0x90, 0xB0, 0x52, 0x2B, 0xF6, 0x40, 0x53, 0x5C, 0x72, 0xB0, +0x54, 0x0B, 0xD8, 0x40, 0x55, 0x3C, 0x54, 0xB0, 0x03, 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, 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, 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, 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, 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, 0x04, -0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0xFF, 0xFF, 0x99, 0x78, 0x00, 0x00, 0xFF, 0xFF, 0x9D, -0x90, 0x00, 0x04, 0xFF, 0xFF, 0xAB, 0xA0, 0x01, 0x09, 0xFF, 0xFF, 0xAB, 0xA0, 0x01, 0x09, 0xFF, -0xFF, 0xAB, 0xA0, 0x00, 0x04, 0xFF, 0xFF, 0xB9, 0xB0, 0x01, 0x09, 0x45, 0x4D, 0x54, 0x00, 0x45, -0x41, 0x53, 0x54, 0x00, 0x45, 0x41, 0x53, 0x53, 0x54, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, -0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x5F, 0xE6, 0xC8, 0x00, 0x6B, 0xAD, 0x1A, 0x00, 0x00, -0x00, 0x0D, 0x45, 0x61, 0x73, 0x74, 0x65, 0x72, 0x20, 0x49, 0x73, 0x6C, 0x61, 0x6E, 0x64, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 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, 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, 0x04, 0x05, 0x04, 0x05, +0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x06, 0xFF, 0xFF, 0x99, 0x78, 0x00, +0x00, 0xFF, 0xFF, 0x9D, 0x90, 0x00, 0x04, 0xFF, 0xFF, 0xAB, 0xA0, 0x01, 0x09, 0xFF, 0xFF, 0xAB, +0xA0, 0x01, 0x09, 0xFF, 0xFF, 0xAB, 0xA0, 0x00, 0x04, 0xFF, 0xFF, 0xB9, 0xB0, 0x01, 0x09, 0xFF, +0xFF, 0xB9, 0xB0, 0x00, 0x04, 0x45, 0x4D, 0x54, 0x00, 0x45, 0x41, 0x53, 0x54, 0x00, 0x45, 0x41, +0x53, 0x53, 0x54, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, +0x01, 0x01, 0x00, 0x5F, 0xE6, 0xC8, 0x00, 0x6B, 0xAD, 0x1A, 0x00, 0x00, 0x00, 0x0D, 0x45, 0x61, +0x73, 0x74, 0x65, 0x72, 0x20, 0x49, 0x73, 0x6C, 0x61, 0x6E, 0x64, /* Pacific/Efate */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x56, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -18565,6 +18487,6 @@ const unsigned char timelib_timezone_db_data_builtin[263744] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x54, 0x43, 0x00, 0x00, 0x00, 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, -0x00, 0x00, 0x00, 0x00, }; +0x00, 0x00, 0x00, 0x00,}; -const timelib_tzdb timezonedb_builtin = { "2014.10", 583, timezonedb_idx_builtin, timelib_timezone_db_data_builtin }; +const timelib_tzdb timezonedb_builtin = { "2015.1", 583, timezonedb_idx_builtin, timelib_timezone_db_data_builtin }; diff --git a/ext/date/php_date.c b/ext/date/php_date.c index c6db35b709..a00c4c5a94 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1441,7 +1441,7 @@ PHPAPI zend_long php_parse_date(char *string, zend_long *now) Convert string representation of date and time to a timestamp */ PHP_FUNCTION(strtotime) { - char *times, *initial_ts; + char *times; size_t time_len; int error1, error2; struct timelib_error_container *error; diff --git a/ext/dom/documenttype.c b/ext/dom/documenttype.c index 8b40d51065..c65902e759 100644 --- a/ext/dom/documenttype.c +++ b/ext/dom/documenttype.c @@ -191,7 +191,7 @@ int dom_documenttype_internal_subset_read(dom_object *obj, zval *retval) xmlOutputBufferFlush(buff); #ifdef LIBXML2_NEW_BUFFER - smart_str_appendl(&ret_buf, xmlOutputBufferGetContent(buff), xmlOutputBufferGetSize(buff)); + smart_str_appendl(&ret_buf, (const char *) xmlOutputBufferGetContent(buff), xmlOutputBufferGetSize(buff)); #else smart_str_appendl(&ret_buf, buff->buffer->content, buff->buffer->use); #endif diff --git a/ext/dom/nodelist.c b/ext/dom/nodelist.c index f9ecb17ca4..a5f6c63f7d 100644 --- a/ext/dom/nodelist.c +++ b/ext/dom/nodelist.c @@ -153,7 +153,7 @@ PHP_FUNCTION(dom_nodelist_item) } else { nodep = nodep->children; } - itemnode = dom_get_elements_by_tag_name_ns_raw(nodep, objmap->ns, objmap->local, &count, index); + itemnode = dom_get_elements_by_tag_name_ns_raw(nodep, (char *) objmap->ns, (char *) objmap->local, &count, index); } } } diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c index 91ab756e97..ab13ce52f9 100644 --- a/ext/filter/logical_filters.c +++ b/ext/filter/logical_filters.c @@ -427,8 +427,7 @@ void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ { zval *option_val; zend_string *regexp; - zend_long option_flags; - int regexp_set, option_flags_set; + int regexp_set; pcre *re = NULL; pcre_extra *pcre_extra = NULL; int preg_options = 0; @@ -437,7 +436,6 @@ void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ /* Parse options */ FETCH_STR_OPTION(regexp, "regexp"); - FETCH_LONG_OPTION(option_flags, "flags"); if (!regexp_set) { php_error_docref(NULL, E_WARNING, "'regexp' option missing"); diff --git a/ext/filter/sanitizing_filters.c b/ext/filter/sanitizing_filters.c index d9cb7baeb7..f786f29ce7 100644 --- a/ext/filter/sanitizing_filters.c +++ b/ext/filter/sanitizing_filters.c @@ -88,8 +88,8 @@ static void php_filter_encode_url(zval *value, const unsigned char* chars, const } */ str = zend_string_alloc(3 * Z_STRLEN_P(value), 0); - p = str->val; - s = Z_STRVAL_P(value); + p = (unsigned char *) str->val; + s = (unsigned char *) Z_STRVAL_P(value); e = s + Z_STRLEN_P(value); while (s < e) { @@ -264,7 +264,7 @@ void php_filter_full_special_chars(PHP_INPUT_FILTER_PARAM_DECL) } else { quotes = ENT_NOQUOTES; } - buf = php_escape_html_entities_ex(Z_STRVAL_P(value), Z_STRLEN_P(value), 1, quotes, SG(default_charset), 0); + buf = php_escape_html_entities_ex((unsigned char *) Z_STRVAL_P(value), Z_STRLEN_P(value), 1, quotes, SG(default_charset), 0); zval_ptr_dtor(value); ZVAL_STR(value, buf); } diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index 486f65d622..b9fb10bdec 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -1338,7 +1338,9 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn ini_in_p = in_p; for (out_size = (char_cnt - 2) / 3; out_size > 0;) { +#if !ICONV_SUPPORTS_ERRNO size_t prev_out_left; +#endif nbytes_required = 0; @@ -1374,8 +1376,9 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn } #endif } - +#if !ICONV_SUPPORTS_ERRNO prev_out_left = out_left; +#endif if (iconv(cd, NULL, NULL, (char **) &out_p, &out_left) == (size_t)-1) { #if ICONV_SUPPORTS_ERRNO if (errno != E2BIG) { diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 0e3ec533a6..ceaa53afcf 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -1235,7 +1235,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) imap_stream = mail_open(NIL, mailbox->val, flags); if (imap_stream == NIL) { - php_error_docref(NULL, E_WARNING, "Couldn't open stream %s", mailbox); + php_error_docref(NULL, E_WARNING, "Couldn't open stream %s", mailbox->val); efree(IMAPG(imap_user)); IMAPG(imap_user) = 0; efree(IMAPG(imap_password)); IMAPG(imap_password) = 0; RETURN_FALSE; @@ -1340,6 +1340,7 @@ PHP_FUNCTION(imap_append) } } + zend_string_free(regex); ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap); INIT (&st, mail_string, (void *) message->val, message->len); @@ -4045,7 +4046,7 @@ PHP_FUNCTION(imap_search) int argc = ZEND_NUM_ARGS(); SEARCHPGM *pgm = NIL; - if (zend_parse_parameters(argc, "rs|lS", &streamind, &criteria, &flags, &charset) == FAILURE) { + if (zend_parse_parameters(argc, "rS|lS", &streamind, &criteria, &flags, &charset) == FAILURE) { return; } diff --git a/ext/imap/tests/imap_fetchstructure_basic.phpt b/ext/imap/tests/imap_fetchstructure_basic.phpt index 7ad4fc5622..dcf6148a1e 100644 --- a/ext/imap/tests/imap_fetchstructure_basic.phpt +++ b/ext/imap/tests/imap_fetchstructure_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -imap_fetchstructure() function : basic functionality +imap_fetchstructure() function : basic functionality --CREDITS-- Olivier Doucet --SKIPIF-- @@ -34,12 +34,13 @@ var_dump($z->type); var_dump($z->encoding); var_dump($z->bytes); var_dump($z->lines); -var_dump(is_object($z->parameters)); +var_dump($z->ifparameters); +var_dump(is_object($z->parameters[0])); imap_close($stream_id); ?> --CLEAN-- -<?php +<?php require_once('clean.inc'); ?> --EXPECTF-- @@ -67,4 +68,5 @@ int(%d) int(%d) int(%d) int(%d) -bool(true)
\ No newline at end of file +int(1) +bool(true) diff --git a/ext/imap/tests/imap_include.inc b/ext/imap/tests/imap_include.inc index b33a10e5e8..110a449cd5 100644 --- a/ext/imap/tests/imap_include.inc +++ b/ext/imap/tests/imap_include.inc @@ -1,6 +1,6 @@ <?php // Change these to make tests run successfully -$server = '{localhost/norsh}'; +$server = '{127.0.0.1/norsh}'; $default_mailbox = $server . "INBOX"; $domain = "something.com"; $admin_user = "webmaster"; // a user with admin access diff --git a/ext/interbase/interbase.c b/ext/interbase/interbase.c index 8f88d6017a..c12e045dc3 100644 --- a/ext/interbase/interbase.c +++ b/ext/interbase/interbase.c @@ -523,11 +523,7 @@ void _php_ibase_module_error(char *msg, ...) /* {{{ */ { va_list ap; -#ifdef ZTS - va_start(ap, ); -#else va_start(ap, msg); -#endif /* vsnprintf NUL terminates the buf and writes at most n-1 chars+NUL */ vsnprintf(IBG(errmsg), MAX_ERRMSG, msg, ap); diff --git a/ext/interbase/tests/ibase_trans_001.phpt b/ext/interbase/tests/ibase_trans_001.phpt index cceb60e9a1..d8b7c81a1b 100644 --- a/ext/interbase/tests/ibase_trans_001.phpt +++ b/ext/interbase/tests/ibase_trans_001.phpt @@ -18,4 +18,6 @@ var_dump(ibase_close($x)); resource(%d) of type (Firebird/InterBase transaction) resource(%d) of type (Firebird/InterBase transaction) bool(true) -bool(true) + +Warning: ibase_close(): supplied resource is not a valid Firebird/InterBase link resource in %s on line %d +bool(false) diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp index e359bacf41..c112134124 100644 --- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp @@ -104,7 +104,6 @@ U_CFUNC PHP_METHOD(IntlRuleBasedBreakIterator, __construct) if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) { zend_object_store_ctor_failed(Z_OBJ(orig_this)); - zval_dtor(&orig_this); ZEND_CTOR_MAKE_NULL(); } } diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index 40f1ff2f01..0b5b0c134d 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -1246,7 +1246,7 @@ U_CFUNC PHP_FUNCTION(intlcal_to_date_time) int64_t ts; char ts_str[sizeof("@-9223372036854775808")]; int ts_str_len; - zval ts_tmp, ts_zval, tmp; + zval ts_zval, tmp; INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed"); diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp index 2cb46e4a83..2ae5737227 100644 --- a/ext/intl/calendar/gregoriancalendar_methods.cpp +++ b/ext/intl/calendar/gregoriancalendar_methods.cpp @@ -198,7 +198,6 @@ U_CFUNC PHP_METHOD(IntlGregorianCalendar, __construct) if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) { zend_object_store_ctor_failed(Z_OBJ(orig_this)); - zval_dtor(&orig_this); ZEND_CTOR_MAKE_NULL(); } } diff --git a/ext/intl/collator/collator_create.c b/ext/intl/collator/collator_create.c index dd81ebe8f7..b2058422c2 100644 --- a/ext/intl/collator/collator_create.c +++ b/ext/intl/collator/collator_create.c @@ -79,7 +79,6 @@ PHP_METHOD( Collator, __construct ) if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) { zend_object_store_ctor_failed(Z_OBJ(orig_this)); - zval_dtor(&orig_this); ZEND_CTOR_MAKE_NULL(); } } diff --git a/ext/intl/dateformat/dateformat_create.cpp b/ext/intl/dateformat/dateformat_create.cpp index 2ceee460ce..f8cf77641f 100644 --- a/ext/intl/dateformat/dateformat_create.cpp +++ b/ext/intl/dateformat/dateformat_create.cpp @@ -196,7 +196,6 @@ U_CFUNC PHP_METHOD( IntlDateFormatter, __construct ) if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) { zend_object_store_ctor_failed(Z_OBJ(orig_this)); - zval_dtor(&orig_this); ZEND_CTOR_MAKE_NULL(); } } diff --git a/ext/intl/formatter/formatter_main.c b/ext/intl/formatter/formatter_main.c index 59629a68f9..60db673ff2 100644 --- a/ext/intl/formatter/formatter_main.c +++ b/ext/intl/formatter/formatter_main.c @@ -97,7 +97,6 @@ PHP_METHOD( NumberFormatter, __construct ) if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) { zend_object_store_ctor_failed(Z_OBJ(orig_this)); - zval_dtor(&orig_this); ZEND_CTOR_MAKE_NULL(); } } diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index bda8b573ce..707b38bd95 100644 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -115,7 +115,6 @@ PHP_METHOD( MessageFormatter, __construct ) if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) { zend_object_store_ctor_failed(Z_OBJ(orig_this)); - zval_dtor(&orig_this); ZEND_CTOR_MAKE_NULL(); } } diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c index 01823d7a73..9ce33736bb 100644 --- a/ext/intl/resourcebundle/resourcebundle_class.c +++ b/ext/intl/resourcebundle/resourcebundle_class.c @@ -146,7 +146,6 @@ PHP_METHOD( ResourceBundle, __construct ) if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) { zend_object_store_ctor_failed(Z_OBJ(orig_this)); - zval_dtor(&orig_this); ZEND_CTOR_MAKE_NULL(); } } diff --git a/ext/json/json.c b/ext/json/json.c index b1de42a577..0f8fdfb132 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -246,6 +246,7 @@ static PHP_FUNCTION(json_decode) JSON_G(error_code) = 0; if (!str_len) { + JSON_G(error_code) = PHP_JSON_ERROR_SYNTAX; RETURN_NULL(); } diff --git a/ext/json/tests/bug54484.phpt b/ext/json/tests/bug54484.phpt index d698ab5416..e56d8bd86b 100644 --- a/ext/json/tests/bug54484.phpt +++ b/ext/json/tests/bug54484.phpt @@ -15,11 +15,16 @@ json_decode("invalid json"); var_dump(json_last_error()); +json_decode("\001 invalid json"); +var_dump(json_last_error()); + + json_decode(""); var_dump(json_last_error()); ?> --EXPECT-- int(0) -int(0) int(4) -int(0) +int(4) +int(3) +int(4) diff --git a/ext/json/tests/bug68938.phpt b/ext/json/tests/bug68938.phpt new file mode 100644 index 0000000000..f6291ffe62 --- /dev/null +++ b/ext/json/tests/bug68938.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #68938 (json_decode() decodes empty string without indicating error) +--SKIPIF-- +<?php if (!extension_loaded("json")) print "skip"; ?> +--FILE-- +<?php +json_decode(""); +var_dump(json_last_error()); +?> +--EXPECT-- +int(4) diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index 1ed6e97e8d..e8e84fc7a5 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -860,6 +860,12 @@ static PHP_RINIT_FUNCTION(libxml) xmlSetGenericErrorFunc(NULL, php_libxml_error_handler); xmlParserInputBufferCreateFilenameDefault(php_libxml_input_buffer_create_filename); xmlOutputBufferCreateFilenameDefault(php_libxml_output_buffer_create_filename); + + /* Enable the entity loader by default. This ensures that + * other threads/requests that might have disabled the loader + * do not affect the current request. + */ + LIBXML(entity_loader_disabled) = 0; } return SUCCESS; } diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 7f2209fb12..504a5e697f 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -3891,7 +3891,7 @@ static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t int state = 0; int crlf_state = -1; char *token = NULL; - size_t token_pos; + size_t token_pos = 0; zend_string *fld_name, *fld_val; ps = str; @@ -3917,7 +3917,7 @@ static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t } if (state == 0 || state == 1) { - if(token) { + if(token && token_pos > 0) { fld_name = zend_string_init(token, token_pos, 0); } state = 2; @@ -3983,7 +3983,7 @@ static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t case 3: if (crlf_state == -1) { - if(token) { + if(token && token_pos > 0) { fld_val = zend_string_init(token, token_pos, 0); } @@ -4032,7 +4032,7 @@ out: state = 3; } if (state == 3) { - if(token) { + if(token && token_pos > 0) { fld_val = zend_string_init(token, token_pos, 0); } if (fld_name != NULL && fld_val != NULL) { diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index 59238fda39..783a8c98a5 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -810,7 +810,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp OnigUChar *pos; OnigUChar *string_lim; char *description = NULL; - char pat_buf[2]; + char pat_buf[4]; const mbfl_encoding *enc; @@ -861,6 +861,8 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp convert_to_long_ex(arg_pattern_zval); pat_buf[0] = (char)Z_LVAL_P(arg_pattern_zval); pat_buf[1] = '\0'; + pat_buf[2] = '\0'; + pat_buf[3] = '\0'; arg_pattern = pat_buf; arg_pattern_len = 1; diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c index e17c8b06b9..4208097cf7 100644 --- a/ext/mysqlnd/mysqlnd_result.c +++ b/ext/mysqlnd/mysqlnd_result.c @@ -556,7 +556,7 @@ mysqlnd_query_read_result_set_header(MYSQLND_CONN_DATA * conn, MYSQLND_STMT * s) conn->current_result = NULL; } else { stmt->result = NULL; - memset(stmt, 0, sizeof(MYSQLND_STMT)); + memset(stmt, 0, sizeof(*stmt)); stmt->state = MYSQLND_STMT_INITTED; } } else { diff --git a/ext/opcache/Optimizer/zend_optimizer_internal.h b/ext/opcache/Optimizer/zend_optimizer_internal.h index cff6b7fb3e..2bdffcaac3 100644 --- a/ext/opcache/Optimizer/zend_optimizer_internal.h +++ b/ext/opcache/Optimizer/zend_optimizer_internal.h @@ -32,10 +32,19 @@ #define INV_COND_EX(op) ((op) == ZEND_JMPZ ? ZEND_JMPNZ_EX : ZEND_JMPZ_EX) #define INV_EX_COND_EX(op) ((op) == ZEND_JMPZ_EX ? ZEND_JMPNZ_EX : ZEND_JMPZ_EX) -#define MAKE_NOP(opline) { (opline)->opcode = ZEND_NOP; memset(&(opline)->result, 0, sizeof((opline)->result)); memset(&(opline)->op1, 0, sizeof((opline)->op1)); memset(&(opline)->op2, 0, sizeof((opline)->op2));(opline)->result_type=(opline)->op1_type=(opline)->op2_type=IS_UNUSED; (opline)->handler = zend_opcode_handlers[ZEND_NOP]; } -#define RESULT_USED(op) (((op->result_type & IS_VAR) && !(op->result_type & EXT_TYPE_UNUSED)) || op->result_type == IS_TMP_VAR) +#undef MAKE_NOP + +#define MAKE_NOP(opline) do { \ + (opline)->opcode = ZEND_NOP; \ + memset(&(opline)->result, 0, sizeof((opline)->result)); \ + memset(&(opline)->op1, 0, sizeof((opline)->op1)); \ + memset(&(opline)->op2, 0, sizeof((opline)->op2)); \ + (opline)->result_type = (opline)->op1_type = (opline)->op2_type=IS_UNUSED; \ + (opline)->handler = zend_opcode_handlers[ZEND_NOP]; \ +} while (0); +#define RESULT_USED(op) (((op->result_type & IS_VAR) && !(op->result_type & EXT_TYPE_UNUSED)) || op->result_type == IS_TMP_VAR) #define RESULT_UNUSED(op) ((op->result_type & EXT_TYPE_UNUSED) != 0) -#define SAME_VAR(op1, op2) ((((op1 ## _type & IS_VAR) && (op2 ## _type & IS_VAR)) || (op1 ## _type == IS_TMP_VAR && op2 ## _type == IS_TMP_VAR)) && op1.var == op2.var) +#define SAME_VAR(op1, op2) ((((op1 ## _type & IS_VAR) && (op2 ## _type & IS_VAR)) || (op1 ## _type == IS_TMP_VAR && op2 ## _type == IS_TMP_VAR)) && op1.var == op2.var) typedef struct _zend_optimizer_ctx { zend_arena *arena; diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index 7997deaa95..625fe65d4e 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -282,7 +282,7 @@ static int filename_is_in_cache(char *filename, int filename_len) { char *key; int key_length; - zend_file_handle handle = {0}; + zend_file_handle handle = {{0}, NULL, NULL, 0, 0}; zend_persistent_script *persistent_script; handle.filename = filename; diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index 1e157e18c3..3d63f96e34 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -414,27 +414,36 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc } if (op_array->arg_info) { + zend_arg_info *arg_info = op_array->arg_info; + uint32_t num_args = op_array->num_args; + + if (op_array->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) { + arg_info--; + num_args++; + } if (already_stored) { - zend_arg_info *new_ptr = zend_shared_alloc_get_xlat_entry(op_array->arg_info); - ZEND_ASSERT(new_ptr != NULL); - op_array->arg_info = new_ptr; + arg_info = zend_shared_alloc_get_xlat_entry(arg_info); + ZEND_ASSERT(arg_info != NULL); } else { - uint32_t i, num_args; + uint32_t i; - num_args = op_array->num_args; if (op_array->fn_flags & ZEND_ACC_VARIADIC) { num_args++; } - zend_accel_store(op_array->arg_info, sizeof(zend_arg_info) * num_args); + zend_accel_store(arg_info, sizeof(zend_arg_info) * num_args); for (i = 0; i < num_args; i++) { - if (op_array->arg_info[i].name) { - zend_accel_store_interned_string(op_array->arg_info[i].name); + if (arg_info[i].name) { + zend_accel_store_interned_string(arg_info[i].name); } - if (op_array->arg_info[i].class_name) { - zend_accel_store_interned_string(op_array->arg_info[i].class_name); + if (arg_info[i].class_name) { + zend_accel_store_interned_string(arg_info[i].class_name); } } } + if (op_array->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) { + arg_info++; + } + op_array->arg_info = arg_info; } if (op_array->brk_cont_array) { diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c index 31ec320141..c5523e7d89 100644 --- a/ext/opcache/zend_persist_calc.c +++ b/ext/opcache/zend_persist_calc.c @@ -194,21 +194,27 @@ static void zend_persist_op_array_calc_ex(zend_op_array *op_array) } if (op_array->arg_info) { - uint32_t i, num_args; + zend_arg_info *arg_info = op_array->arg_info; + uint32_t num_args = op_array->num_args; + uint32_t i; num_args = op_array->num_args; if (op_array->fn_flags & ZEND_ACC_VARIADIC) { num_args++; } + if (op_array->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) { + arg_info--; + num_args++; + } ADD_DUP_SIZE(op_array->arg_info, sizeof(zend_arg_info) * num_args); + ADD_DUP_SIZE(arg_info, sizeof(zend_arg_info) * num_args); for (i = 0; i < num_args; i++) { - if (op_array->arg_info[i].name) { - ADD_INTERNED_STRING(op_array->arg_info[i].name, 1); + if (arg_info[i].name) { + ADD_INTERNED_STRING(arg_info[i].name, 1); } - if (op_array->arg_info[i].class_name) { - ADD_INTERNED_STRING(op_array->arg_info[i].class_name, 1); + if (arg_info[i].class_name) { + ADD_INTERNED_STRING(arg_info[i].class_name, 1); } - } } diff --git a/ext/opcache/zend_shared_alloc.h b/ext/opcache/zend_shared_alloc.h index da9bc3c0f4..01de10d90f 100644 --- a/ext/opcache/zend_shared_alloc.h +++ b/ext/opcache/zend_shared_alloc.h @@ -102,7 +102,7 @@ typedef struct _zend_smm_shared_globals { /* Amount of free shared memory */ size_t shared_free; /* Amount of shared memory allocated by garbage */ - int wasted_shared_memory; + size_t wasted_shared_memory; /* No more shared memory flag */ zend_bool memory_exhausted; /* Saved Shared Allocator State */ diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 5fb7737728..58f1cb5316 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -845,13 +845,30 @@ static int add_oid_section(struct php_x509_request * req) /* {{{ */ #define SET_OPTIONAL_LONG_ARG(key, varname, defval) \ if (optional_args && (item = zend_hash_str_find(Z_ARRVAL_P(optional_args), key, sizeof(key)-1)) != NULL && Z_TYPE_P(item) == IS_LONG) \ - varname = Z_LVAL_P(item); \ + varname = (int)Z_LVAL_P(item); \ else \ varname = defval static const EVP_CIPHER * php_openssl_get_evp_cipher_from_algo(zend_long algo); -int openssl_spki_cleanup(const char *src, char *dest); +/* {{{ strip line endings from spkac */ +static int openssl_spki_cleanup(const char *src, char *dest) +{ + int removed=0; + + while (*src) { + if (*src!='\n'&&*src!='\r') { + *dest++=*src; + } else { + ++removed; + } + ++src; + } + *dest=0; + return removed; +} +/* }}} */ + static int php_openssl_parse_config(struct php_x509_request * req, zval * optional_args) /* {{{ */ { @@ -1377,7 +1394,7 @@ static X509 * php_openssl_x509_from_zval(zval * val, int makeresource, zend_reso } else { BIO *in; - in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRLEN_P(val)); + in = BIO_new_mem_buf(Z_STRVAL_P(val), (int)Z_STRLEN_P(val)); if (in == NULL) { return NULL; } @@ -1493,7 +1510,10 @@ PHP_FUNCTION(openssl_spki_new) } if (challenge) { - ASN1_STRING_set(spki->spkac->challenge, challenge, challenge_len); + if (!ASN1_STRING_set(spki->spkac->challenge, challenge, (int)challenge_len)) { + php_error_docref(NULL, E_WARNING, "Unable to set challenge data"); + goto cleanup; + } } if (!NETSCAPE_SPKI_set_pubkey(spki, pkey)) { @@ -1546,7 +1566,7 @@ cleanup: PHP_FUNCTION(openssl_spki_verify) { size_t spkstr_len; - int i = 0; + int i = 0, spkstr_cleaned_len = 0; char *spkstr = NULL, * spkstr_cleaned = NULL; EVP_PKEY *pkey = NULL; @@ -1563,14 +1583,14 @@ PHP_FUNCTION(openssl_spki_verify) } spkstr_cleaned = emalloc(spkstr_len + 1); - openssl_spki_cleanup(spkstr, spkstr_cleaned); + spkstr_cleaned_len = (int)(spkstr_len - openssl_spki_cleanup(spkstr, spkstr_cleaned)); - if (strlen(spkstr_cleaned)<=0) { + if (spkstr_cleaned_len == 0) { php_error_docref(NULL, E_WARNING, "Invalid SPKAC"); goto cleanup; } - spki = NETSCAPE_SPKI_b64_decode(spkstr_cleaned, strlen(spkstr_cleaned)); + spki = NETSCAPE_SPKI_b64_decode(spkstr_cleaned, spkstr_cleaned_len); if (spki == NULL) { php_error_docref(NULL, E_WARNING, "Unable to decode supplied SPKAC"); goto cleanup; @@ -1608,6 +1628,7 @@ PHP_FUNCTION(openssl_spki_export) { size_t spkstr_len; char *spkstr = NULL, * spkstr_cleaned = NULL, * s = NULL; + int spkstr_cleaned_len; EVP_PKEY *pkey = NULL; NETSCAPE_SPKI *spki = NULL; @@ -1624,9 +1645,14 @@ PHP_FUNCTION(openssl_spki_export) } spkstr_cleaned = emalloc(spkstr_len + 1); - openssl_spki_cleanup(spkstr, spkstr_cleaned); + spkstr_cleaned_len = (int)(spkstr_len - openssl_spki_cleanup(spkstr, spkstr_cleaned)); - spki = NETSCAPE_SPKI_b64_decode(spkstr_cleaned, strlen(spkstr_cleaned)); + if (spkstr_cleaned_len == 0) { + php_error_docref(NULL, E_WARNING, "Invalid SPKAC"); + goto cleanup; + } + + spki = NETSCAPE_SPKI_b64_decode(spkstr_cleaned, spkstr_cleaned_len); if (spki == NULL) { php_error_docref(NULL, E_WARNING, "Unable to decode supplied SPKAC"); goto cleanup; @@ -1668,6 +1694,7 @@ PHP_FUNCTION(openssl_spki_export_challenge) { size_t spkstr_len; char *spkstr = NULL, * spkstr_cleaned = NULL; + int spkstr_cleaned_len; NETSCAPE_SPKI *spki = NULL; @@ -1682,9 +1709,14 @@ PHP_FUNCTION(openssl_spki_export_challenge) } spkstr_cleaned = emalloc(spkstr_len + 1); - openssl_spki_cleanup(spkstr, spkstr_cleaned); + spkstr_cleaned_len = (int)(spkstr_len - openssl_spki_cleanup(spkstr, spkstr_cleaned)); + + if (spkstr_cleaned_len == 0) { + php_error_docref(NULL, E_WARNING, "Invalid SPKAC"); + goto cleanup; + } - spki = NETSCAPE_SPKI_b64_decode(spkstr_cleaned, strlen(spkstr_cleaned)); + spki = NETSCAPE_SPKI_b64_decode(spkstr_cleaned, spkstr_cleaned_len); if (spki == NULL) { php_error_docref(NULL, E_WARNING, "Unable to decode SPKAC"); goto cleanup; @@ -1700,24 +1732,6 @@ cleanup: } /* }}} */ -/* {{{ strip line endings from spkac */ -int openssl_spki_cleanup(const char *src, char *dest) -{ - int removed=0; - - while (*src) { - if (*src!='\n'&&*src!='\r') { - *dest++=*src; - } else { - ++removed; - } - ++src; - } - *dest=0; - return removed; -} -/* }}} */ - /* {{{ proto bool openssl_x509_export(mixed x509, string &out [, bool notext = true]) Exports a CERT to file or a var */ PHP_FUNCTION(openssl_x509_export) @@ -2162,7 +2176,7 @@ PHP_FUNCTION(openssl_x509_checkpurpose) goto clean_exit; } - ret = check_cert(cainfo, cert, untrustedchain, purpose); + ret = check_cert(cainfo, cert, untrustedchain, (int)purpose); if (ret != 0 && ret != 1) { RETVAL_LONG(ret); } else { @@ -2519,7 +2533,7 @@ PHP_FUNCTION(openssl_pkcs12_read) bio_in = BIO_new(BIO_s_mem()); - if(!BIO_write(bio_in, zp12, zp12_len)) + if(0 >= BIO_write(bio_in, zp12, (int)zp12_len)) goto cleanup; if(d2i_PKCS12_bio(bio_in, &p12)) { @@ -2660,7 +2674,7 @@ static int php_openssl_make_REQ(struct php_x509_request * req, X509_REQ * csr, z v = sk_CONF_VALUE_value(dn_sk, i); type = v->name; - len = strlen(type); + len = (int)strlen(type); if (len < sizeof("_default")) { continue; } @@ -2776,7 +2790,7 @@ static X509_REQ * php_openssl_csr_from_zval(zval * val, int makeresource, zend_r } in = BIO_new_file(filename, "r"); } else { - in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRLEN_P(val)); + in = BIO_new_mem_buf(Z_STRVAL_P(val), (int)Z_STRLEN_P(val)); } csr = PEM_read_bio_X509_REQ(in, NULL,NULL,NULL); BIO_free(in); @@ -2950,7 +2964,7 @@ PHP_FUNCTION(openssl_csr_sign) goto cleanup; - ASN1_INTEGER_set(X509_get_serialNumber(new_cert), serial); + ASN1_INTEGER_set(X509_get_serialNumber(new_cert), (long)serial); X509_set_subject_name(new_cert, X509_REQ_get_subject_name(csr)); @@ -2961,7 +2975,7 @@ PHP_FUNCTION(openssl_csr_sign) goto cleanup; } X509_gmtime_adj(X509_get_notBefore(new_cert), 0); - X509_gmtime_adj(X509_get_notAfter(new_cert), (long)60*60*24*num_days); + X509_gmtime_adj(X509_get_notAfter(new_cert), 60*60*24*(long)num_days); i = X509_set_pubkey(new_cert, key); if (!i) { goto cleanup; @@ -3274,7 +3288,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval * val, int public_key, char * p if (filename) { in = BIO_new_file(filename, "r"); } else { - in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRLEN_P(val)); + in = BIO_new_mem_buf(Z_STRVAL_P(val), (int)Z_STRLEN_P(val)); } if (in == NULL) { TMP_CLEAN; @@ -3292,7 +3306,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval * val, int public_key, char * p } in = BIO_new_file(filename, "r"); } else { - in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRLEN_P(val)); + in = BIO_new_mem_buf(Z_STRVAL_P(val), (int)Z_STRLEN_P(val)); } if (in == NULL) { @@ -3468,7 +3482,7 @@ static int php_openssl_is_private_key(EVP_PKEY* pkey) Z_TYPE_P(bn) == IS_STRING) { \ _type->_name = BN_bin2bn( \ (unsigned char*)Z_STRVAL_P(bn), \ - Z_STRLEN_P(bn), NULL); \ + (int)Z_STRLEN_P(bn), NULL); \ } \ } while (0); @@ -3631,11 +3645,11 @@ PHP_FUNCTION(openssl_pkey_export_to_file) switch (EVP_PKEY_type(key->type)) { #ifdef HAVE_EVP_PKEY_EC case EVP_PKEY_EC: - pem_write = PEM_write_bio_ECPrivateKey(bio_out, EVP_PKEY_get1_EC_KEY(key), cipher, (unsigned char *)passphrase, passphrase_len, NULL, NULL); + pem_write = PEM_write_bio_ECPrivateKey(bio_out, EVP_PKEY_get1_EC_KEY(key), cipher, (unsigned char *)passphrase, (int)passphrase_len, NULL, NULL); break; #endif default: - pem_write = PEM_write_bio_PrivateKey(bio_out, key, cipher, (unsigned char *)passphrase, passphrase_len, NULL, NULL); + pem_write = PEM_write_bio_PrivateKey(bio_out, key, cipher, (unsigned char *)passphrase, (int)passphrase_len, NULL, NULL); break; } @@ -3699,11 +3713,11 @@ PHP_FUNCTION(openssl_pkey_export) switch (EVP_PKEY_type(key->type)) { #ifdef HAVE_EVP_PKEY_EC case EVP_PKEY_EC: - pem_write = PEM_write_bio_ECPrivateKey(bio_out, EVP_PKEY_get1_EC_KEY(key), cipher, (unsigned char *)passphrase, passphrase_len, NULL, NULL); + pem_write = PEM_write_bio_ECPrivateKey(bio_out, EVP_PKEY_get1_EC_KEY(key), cipher, (unsigned char *)passphrase, (int)passphrase_len, NULL, NULL); break; #endif default: - pem_write = PEM_write_bio_PrivateKey(bio_out, key, cipher, (unsigned char *)passphrase, passphrase_len, NULL, NULL); + pem_write = PEM_write_bio_PrivateKey(bio_out, key, cipher, (unsigned char *)passphrase, (int)passphrase_len, NULL, NULL); break; } @@ -3965,7 +3979,7 @@ PHP_FUNCTION(openssl_pbkdf2) out_buffer = zend_string_alloc(key_length, 0); - if (PKCS5_PBKDF2_HMAC(password, password_len, (unsigned char *)salt, salt_len, iterations, digest, key_length, (unsigned char*)out_buffer->val) == 1) { + if (PKCS5_PBKDF2_HMAC(password, (int)password_len, (unsigned char *)salt, (int)salt_len, (int)iterations, digest, (int)key_length, (unsigned char*)out_buffer->val) == 1) { out_buffer->val[key_length] = 0; RETURN_STR(out_buffer); } else { @@ -4052,7 +4066,7 @@ PHP_FUNCTION(openssl_pkcs7_verify) zend_printf("Calling PKCS7 verify\n"); #endif - if (PKCS7_verify(p7, others, store, datain, dataout, flags)) { + if (PKCS7_verify(p7, others, store, datain, dataout, (int)flags)) { RETVAL_TRUE; @@ -4066,7 +4080,7 @@ PHP_FUNCTION(openssl_pkcs7_verify) certout = BIO_new_file(signersfilename, "w"); if (certout) { int i; - signers = PKCS7_get0_signers(p7, NULL, flags); + signers = PKCS7_get0_signers(p7, NULL, (int)flags); for(i = 0; i < sk_X509_num(signers); i++) { PEM_write_bio_X509(certout, sk_X509_value(signers, i)); @@ -4182,7 +4196,7 @@ PHP_FUNCTION(openssl_pkcs7_encrypt) goto clean_exit; } - p7 = PKCS7_encrypt(recipcerts, infile, (EVP_CIPHER*)cipher, flags); + p7 = PKCS7_encrypt(recipcerts, infile, (EVP_CIPHER*)cipher, (int)flags); if (p7 == NULL) { goto clean_exit; @@ -4204,7 +4218,7 @@ PHP_FUNCTION(openssl_pkcs7_encrypt) (void)BIO_reset(infile); /* write the encrypted data */ - SMIME_write_PKCS7(outfile, p7, infile, flags); + SMIME_write_PKCS7(outfile, p7, infile, (int)flags); RETVAL_TRUE; @@ -4284,7 +4298,7 @@ PHP_FUNCTION(openssl_pkcs7_sign) goto clean_exit; } - p7 = PKCS7_sign(cert, privkey, others, infile, flags); + p7 = PKCS7_sign(cert, privkey, others, infile, (int)flags); if (p7 == NULL) { php_error_docref(NULL, E_WARNING, "error creating PKCS7 structure!"); goto clean_exit; @@ -4305,7 +4319,7 @@ PHP_FUNCTION(openssl_pkcs7_sign) } ZEND_HASH_FOREACH_END(); } /* write the signed data */ - SMIME_write_PKCS7(outfile, p7, infile, flags); + SMIME_write_PKCS7(outfile, p7, infile, (int)flags); RETVAL_TRUE; @@ -4421,6 +4435,9 @@ PHP_FUNCTION(openssl_private_encrypt) if (pkey == NULL) { php_error_docref(NULL, E_WARNING, "key param is not a valid private key"); RETURN_FALSE; + } else if (INT_MAX < data_len) { + php_error_docref(NULL, E_WARNING, "data is too long"); + RETURN_FALSE; } cryptedlen = EVP_PKEY_size(pkey); @@ -4429,11 +4446,11 @@ PHP_FUNCTION(openssl_private_encrypt) switch (pkey->type) { case EVP_PKEY_RSA: case EVP_PKEY_RSA2: - successful = (RSA_private_encrypt(data_len, + successful = (RSA_private_encrypt((int)data_len, (unsigned char *)data, (unsigned char *)cryptedbuf->val, pkey->pkey.rsa, - padding) == cryptedlen); + (int)padding) == cryptedlen); break; default: php_error_docref(NULL, E_WARNING, "key type not supported in this PHP build!"); @@ -4479,6 +4496,9 @@ PHP_FUNCTION(openssl_private_decrypt) if (pkey == NULL) { php_error_docref(NULL, E_WARNING, "key parameter is not a valid private key"); RETURN_FALSE; + } else if (INT_MAX < data_len) { + php_error_docref(NULL, E_WARNING, "data is too long"); + RETURN_FALSE; } cryptedlen = EVP_PKEY_size(pkey); @@ -4487,11 +4507,11 @@ PHP_FUNCTION(openssl_private_decrypt) switch (pkey->type) { case EVP_PKEY_RSA: case EVP_PKEY_RSA2: - cryptedlen = RSA_private_decrypt(data_len, + cryptedlen = RSA_private_decrypt((int)data_len, (unsigned char *)data, crypttemp, pkey->pkey.rsa, - padding); + (int)padding); if (cryptedlen != -1) { cryptedbuf = zend_string_alloc(cryptedlen, 0); memcpy(cryptedbuf->val, crypttemp, cryptedlen); @@ -4543,6 +4563,9 @@ PHP_FUNCTION(openssl_public_encrypt) if (pkey == NULL) { php_error_docref(NULL, E_WARNING, "key parameter is not a valid public key"); RETURN_FALSE; + } else if (INT_MAX < data_len) { + php_error_docref(NULL, E_WARNING, "data is too long"); + RETURN_FALSE; } cryptedlen = EVP_PKEY_size(pkey); @@ -4551,11 +4574,11 @@ PHP_FUNCTION(openssl_public_encrypt) switch (pkey->type) { case EVP_PKEY_RSA: case EVP_PKEY_RSA2: - successful = (RSA_public_encrypt(data_len, + successful = (RSA_public_encrypt((int)data_len, (unsigned char *)data, (unsigned char *)cryptedbuf->val, pkey->pkey.rsa, - padding) == cryptedlen); + (int)padding) == cryptedlen); break; default: php_error_docref(NULL, E_WARNING, "key type not supported in this PHP build!"); @@ -4602,6 +4625,9 @@ PHP_FUNCTION(openssl_public_decrypt) if (pkey == NULL) { php_error_docref(NULL, E_WARNING, "key parameter is not a valid public key"); RETURN_FALSE; + } else if (INT_MAX < data_len) { + php_error_docref(NULL, E_WARNING, "data is too long"); + RETURN_FALSE; } cryptedlen = EVP_PKEY_size(pkey); @@ -4610,11 +4636,11 @@ PHP_FUNCTION(openssl_public_decrypt) switch (pkey->type) { case EVP_PKEY_RSA: case EVP_PKEY_RSA2: - cryptedlen = RSA_public_decrypt(data_len, + cryptedlen = RSA_public_decrypt((int)data_len, (unsigned char *)data, crypttemp, pkey->pkey.rsa, - padding); + (int)padding); if (cryptedlen != -1) { cryptedbuf = zend_string_alloc(cryptedlen, 0); memcpy(cryptedbuf->val, crypttemp, cryptedlen); @@ -4774,7 +4800,7 @@ PHP_FUNCTION(openssl_verify) EVP_VerifyInit (&md_ctx, mdtype); EVP_VerifyUpdate (&md_ctx, data, data_len); - err = EVP_VerifyFinal (&md_ctx, (unsigned char *)signature, signature_len, pkey); + err = EVP_VerifyFinal (&md_ctx, (unsigned char *)signature, (int)signature_len, pkey); EVP_MD_CTX_cleanup(&md_ctx); if (keyresource == NULL) { @@ -4809,6 +4835,9 @@ PHP_FUNCTION(openssl_seal) if (!nkeys) { php_error_docref(NULL, E_WARNING, "Fourth argument to openssl_seal() must be a non-empty array"); RETURN_FALSE; + } else if (INT_MAX < data_len) { + php_error_docref(NULL, E_WARNING, "data is too long"); + RETURN_FALSE; } if (method) { @@ -4825,8 +4854,8 @@ PHP_FUNCTION(openssl_seal) eksl = safe_emalloc(nkeys, sizeof(*eksl), 0); eks = safe_emalloc(nkeys, sizeof(*eks), 0); memset(eks, 0, sizeof(*eks) * nkeys); - key_resources = safe_emalloc(nkeys, sizeof(zend_resource), 0); - memset(key_resources, 0, sizeof(zend_resource) * nkeys); + key_resources = safe_emalloc(nkeys, sizeof(zend_resource*), 0); + memset(key_resources, 0, sizeof(zend_resource*) * nkeys); /* get the public keys we are using to seal this data */ i = 0; @@ -4856,7 +4885,7 @@ PHP_FUNCTION(openssl_seal) buf = emalloc(data_len + EVP_CIPHER_CTX_block_size(&ctx)); EVP_CIPHER_CTX_cleanup(&ctx); - if (!EVP_SealInit(&ctx, cipher, eks, eksl, NULL, pkeys, nkeys) || !EVP_SealUpdate(&ctx, buf, &len1, (unsigned char *)data, data_len)) { + if (!EVP_SealInit(&ctx, cipher, eks, eksl, NULL, pkeys, nkeys) || !EVP_SealUpdate(&ctx, buf, &len1, (unsigned char *)data, (int)data_len)) { RETVAL_FALSE; efree(buf); EVP_CIPHER_CTX_cleanup(&ctx); @@ -4938,6 +4967,12 @@ PHP_FUNCTION(openssl_open) if (pkey == NULL) { php_error_docref(NULL, E_WARNING, "unable to coerce parameter 4 into a private key"); RETURN_FALSE; + } else if (INT_MAX < ekey_len) { + php_error_docref(NULL, E_WARNING, "ekey is too long"); + RETURN_FALSE; + } else if (INT_MAX < data_len) { + php_error_docref(NULL, E_WARNING, "data is too long"); + RETURN_FALSE; } if (method) { @@ -4952,7 +4987,7 @@ PHP_FUNCTION(openssl_open) buf = emalloc(data_len + 1); - if (EVP_OpenInit(&ctx, cipher, (unsigned char *)ekey, ekey_len, NULL, pkey) && EVP_OpenUpdate(&ctx, buf, &len1, (unsigned char *)data, data_len)) { + if (EVP_OpenInit(&ctx, cipher, (unsigned char *)ekey, (int)ekey_len, NULL, pkey) && EVP_OpenUpdate(&ctx, buf, &len1, (unsigned char *)data, (int)data_len)) { if (!EVP_OpenFinal(&ctx, buf + len1, &len2) || (len1 + len2 == 0)) { efree(buf); RETVAL_FALSE; @@ -5067,7 +5102,7 @@ PHP_FUNCTION(openssl_digest) } /* }}} */ -static zend_bool php_openssl_validate_iv(char **piv, int *piv_len, int iv_required_len) +static zend_bool php_openssl_validate_iv(char **piv, size_t *piv_len, size_t iv_required_len) { char *iv_new; @@ -5078,7 +5113,7 @@ static zend_bool php_openssl_validate_iv(char **piv, int *piv_len, int iv_requir iv_new = ecalloc(1, iv_required_len + 1); - if (*piv_len <= 0) { + if (*piv_len == 0) { /* BC behavior */ *piv_len = iv_required_len; *piv = iv_new; @@ -5122,6 +5157,9 @@ PHP_FUNCTION(openssl_encrypt) if (!cipher_type) { php_error_docref(NULL, E_WARNING, "Unknown cipher algorithm"); RETURN_FALSE; + } else if (INT_MAX < data_len) { + php_error_docref(NULL, E_WARNING, "data is too long"); + RETURN_FALSE; } keylen = EVP_CIPHER_key_length(cipher_type); @@ -5134,24 +5172,24 @@ PHP_FUNCTION(openssl_encrypt) } max_iv_len = EVP_CIPHER_iv_length(cipher_type); - if (iv_len <= 0 && max_iv_len > 0) { + if (iv_len == 0 && max_iv_len > 0) { php_error_docref(NULL, E_WARNING, "Using an empty Initialization Vector (iv) is potentially insecure and not recommended"); } - free_iv = php_openssl_validate_iv(&iv, (int *)&iv_len, max_iv_len); + free_iv = php_openssl_validate_iv(&iv, &iv_len, max_iv_len); - outlen = data_len + EVP_CIPHER_block_size(cipher_type); + outlen = (int)data_len + EVP_CIPHER_block_size(cipher_type); outbuf = zend_string_alloc(outlen, 0); EVP_EncryptInit(&cipher_ctx, cipher_type, NULL, NULL); if (password_len > keylen) { - EVP_CIPHER_CTX_set_key_length(&cipher_ctx, password_len); + EVP_CIPHER_CTX_set_key_length(&cipher_ctx, (int)password_len); } EVP_EncryptInit_ex(&cipher_ctx, NULL, NULL, key, (unsigned char *)iv); if (options & OPENSSL_ZERO_PADDING) { EVP_CIPHER_CTX_set_padding(&cipher_ctx, 0); } if (data_len > 0) { - EVP_EncryptUpdate(&cipher_ctx, (unsigned char*)outbuf->val, &i, (unsigned char *)data, data_len); + EVP_EncryptUpdate(&cipher_ctx, (unsigned char*)outbuf->val, &i, (unsigned char *)data, (int)data_len); } outlen = i; if (EVP_EncryptFinal(&cipher_ctx, (unsigned char *)outbuf->val + i, &i)) { @@ -5203,6 +5241,9 @@ PHP_FUNCTION(openssl_decrypt) if (!method_len) { php_error_docref(NULL, E_WARNING, "Unknown cipher algorithm"); RETURN_FALSE; + } else if (INT_MAX < data_len) { + php_error_docref(NULL, E_WARNING, "data is too long"); + RETURN_FALSE; } cipher_type = EVP_get_cipherbyname(method); @@ -5212,7 +5253,7 @@ PHP_FUNCTION(openssl_decrypt) } if (!(options & OPENSSL_RAW_DATA)) { - base64_str = php_base64_decode((unsigned char*)data, data_len); + base64_str = php_base64_decode((unsigned char*)data, (int)data_len); if (!base64_str) { php_error_docref(NULL, E_WARNING, "Failed to base64 decode the input"); RETURN_FALSE; @@ -5230,20 +5271,20 @@ PHP_FUNCTION(openssl_decrypt) key = (unsigned char*)password; } - free_iv = php_openssl_validate_iv(&iv, (int *)&iv_len, EVP_CIPHER_iv_length(cipher_type)); + free_iv = php_openssl_validate_iv(&iv, &iv_len, EVP_CIPHER_iv_length(cipher_type)); - outlen = data_len + EVP_CIPHER_block_size(cipher_type); + outlen = (int)data_len + EVP_CIPHER_block_size(cipher_type); outbuf = zend_string_alloc(outlen, 0); EVP_DecryptInit(&cipher_ctx, cipher_type, NULL, NULL); if (password_len > keylen) { - EVP_CIPHER_CTX_set_key_length(&cipher_ctx, password_len); + EVP_CIPHER_CTX_set_key_length(&cipher_ctx, (int)password_len); } EVP_DecryptInit_ex(&cipher_ctx, NULL, NULL, key, (unsigned char *)iv); if (options & OPENSSL_ZERO_PADDING) { EVP_CIPHER_CTX_set_padding(&cipher_ctx, 0); } - EVP_DecryptUpdate(&cipher_ctx, (unsigned char*)outbuf->val, &i, (unsigned char *)data, data_len); + EVP_DecryptUpdate(&cipher_ctx, (unsigned char*)outbuf->val, &i, (unsigned char *)data, (int)data_len); outlen = i; if (EVP_DecryptFinal(&cipher_ctx, (unsigned char *)outbuf->val + i, &i)) { outlen += i; @@ -5314,7 +5355,7 @@ PHP_FUNCTION(openssl_dh_compute_key) RETURN_FALSE; } - pub = BN_bin2bn((unsigned char*)pub_str, pub_len, NULL); + pub = BN_bin2bn((unsigned char*)pub_str, (int)pub_len, NULL); data = zend_string_alloc(DH_size(pkey->pkey.dh), 0); len = DH_compute_key((unsigned char*)data->val, pub, pkey->pkey.dh); diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index 0b83fb1678..c9a46a8c20 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -149,7 +149,7 @@ static int handle_ssl_error(php_stream *stream, int nr_bytes, zend_bool is_init) int err = SSL_get_error(sslsock->ssl_handle, nr_bytes); char esbuf[512]; smart_str ebuf = {0}; - zend_ulong ecode; + unsigned long ecode; int retry = 1; switch(err) { @@ -314,7 +314,8 @@ static zend_bool php_x509_fingerprint_match(X509 *peer, zval *val) static zend_bool matches_wildcard_name(const char *subjectname, const char *certname) /* {{{ */ { char *wildcard = NULL; - int prefix_len, suffix_len, subject_len; + ptrdiff_t prefix_len; + size_t suffix_len, subject_len; if (strcasecmp(subjectname, certname) == 0) { return 1; @@ -517,7 +518,7 @@ static int passwd_callback(char *buf, int num, int verify, void *data) /* {{{ */ if (passphrase) { if (Z_STRLEN_P(val) < num - 1) { memcpy(buf, Z_STRVAL_P(val), Z_STRLEN_P(val)+1); - return Z_STRLEN_P(val); + return (int)Z_STRLEN_P(val); } } return 0; @@ -925,9 +926,9 @@ static const SSL_METHOD *php_select_crypto_method(zend_long method_value, int is } /* }}} */ -static zend_long php_get_crypto_method_ctx_flags(zend_long method_flags) /* {{{ */ +static int php_get_crypto_method_ctx_flags(int method_flags) /* {{{ */ { - zend_long ssl_ctx_options = SSL_OP_ALL; + int ssl_ctx_options = SSL_OP_ALL; #ifndef OPENSSL_NO_SSL2 if (!(method_flags & STREAM_CRYPTO_METHOD_SSLv2)) { @@ -1296,7 +1297,9 @@ static int enable_server_sni(php_stream *stream, php_openssl_netstream_data_t *s sizeof(php_openssl_sni_cert_t), 0, php_stream_is_persistent(stream) ); - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(val), key_index,key, current) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(val), key_index, key, current) { + (void) key_index; + if (!key) { php_error_docref(NULL, E_WARNING, "SNI_server_certs array requires string host name keys" @@ -1376,8 +1379,8 @@ int php_openssl_setup_crypto(php_stream *stream, ) /* {{{ */ { const SSL_METHOD *method; - long ssl_ctx_options; - long method_flags; + int ssl_ctx_options; + int method_flags; char *cipherlist = NULL; zval *val; @@ -1755,7 +1758,6 @@ static size_t php_openssl_sockop_read(php_stream *stream, char *buf, size_t coun static size_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, size_t count) /* {{{ */ { php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; - int nr_bytes = 0; /* Only do this if SSL is active. */ if (sslsock->ssl_active) { @@ -1764,6 +1766,12 @@ static size_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, siz *timeout; int blocked = sslsock->s.is_blocked, has_timeout = 0; + int nr_bytes = 0; + + /* prevent overflow in openssl */ + if (count > INT_MAX) { + count = INT_MAX; + } /* Begin by making the socket non-blocking. This allows us to check the timeout. */ if (SUCCESS == php_set_sock_blocking(sslsock->s.socket, 0)) { @@ -1803,7 +1811,7 @@ static size_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, siz /* Now, do the IO operation. Don't block if we can't complete... */ if (read) { - nr_bytes = SSL_read(sslsock->ssl_handle, buf, count); + nr_bytes = SSL_read(sslsock->ssl_handle, buf, (int)count); if (sslsock->reneg && sslsock->reneg->should_close) { /* renegotiation rate limiting triggered */ @@ -1813,7 +1821,7 @@ static size_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, siz break; } } else { - nr_bytes = SSL_write(sslsock->ssl_handle, buf, count); + nr_bytes = SSL_write(sslsock->ssl_handle, buf, (int)count); } /* Now, how much time until we time out? */ @@ -1829,10 +1837,13 @@ static size_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, siz retry = handle_ssl_error(stream, nr_bytes, 0); /* If we get this (the above doesn't check) then we'll retry as well. */ - if (errno == EAGAIN && ( err == SSL_ERROR_WANT_READ || SSL_ERROR_WANT_WRITE ) ) { + if (errno == EAGAIN && err == SSL_ERROR_WANT_READ && read) { retry = 1; } - + if (errno == EAGAIN && SSL_ERROR_WANT_WRITE && read == 0) { + retry = 1; + } + /* Also, on reads, we may get this condition on an EOF. We should check properly. */ if (read) { stream->eof = (retry == 0 && errno != EAGAIN && !SSL_pending(sslsock->ssl_handle)); @@ -1855,11 +1866,12 @@ static size_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, siz int err = SSL_get_error(sslsock->ssl_handle, nr_bytes ); /* If we didn't get any error, then let's return it to PHP. */ - if (err == SSL_ERROR_NONE) + if (err == SSL_ERROR_NONE) { break; + } /* Otherwise, we need to wait again (up to time_left or we get an error) */ - if (blocked) + if (blocked) { if (read) { php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_WRITE) ? (POLLOUT|POLLPRI) : (POLLIN|POLLPRI), has_timeout ? &left_time : NULL); @@ -1867,10 +1879,12 @@ static size_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, siz php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_READ) ? (POLLIN|POLLPRI) : (POLLOUT|POLLPRI), has_timeout ? &left_time : NULL); } + } } - /* Finally, we keep going until we got data, and an SSL_ERROR_NONE, unless we had an error. */ - } while (retry); + /* Finally, we keep going until we got data, and an SSL_ERROR_NONE, unless we had an error. */ + } while (retry); + /* Tell PHP if we read / wrote bytes. */ if (nr_bytes > 0) { php_stream_notify_progress_increment(PHP_STREAM_CONTEXT(stream), nr_bytes, 0); @@ -1881,7 +1895,11 @@ static size_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, siz php_set_sock_blocking(sslsock->s.socket, 1); sslsock->s.is_blocked = 1; } + + return 0 > nr_bytes ? 0 : nr_bytes; } else { + size_t nr_bytes = 0; + /* * This block is if we had no timeout... We will just sit and wait forever on the IO operation. */ @@ -1890,14 +1908,9 @@ static size_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, siz } else { nr_bytes = php_stream_socket_ops.write(stream, buf, count); } - } - /* PHP doesn't expect a negative return. */ - if (nr_bytes < 0) { - nr_bytes = 0; + return nr_bytes; } - - return nr_bytes; } /* }}} */ @@ -2085,7 +2098,11 @@ static int php_openssl_sockop_set_option(php_stream *stream, int option, int val if (value == -1) { if (sslsock->s.timeout.tv_sec == -1) { - tv.tv_sec = FG(default_socket_timeout); +#ifdef _WIN32 + tv.tv_sec = (long)FG(default_socket_timeout); +#else + tv.tv_sec = (time_t)FG(default_socket_timeout); +#endif tv.tv_usec = 0; } else { tv = sslsock->connect_timeout; @@ -2298,7 +2315,11 @@ php_stream *php_openssl_ssl_socket_factory(const char *proto, size_t protolen, sslsock->s.is_blocked = 1; /* this timeout is used by standard stream funcs, therefor it should use the default value */ - sslsock->s.timeout.tv_sec = FG(default_socket_timeout); +#ifdef _WIN32 + sslsock->s.timeout.tv_sec = (long)FG(default_socket_timeout); +#else + sslsock->s.timeout.tv_sec = (time_t)FG(default_socket_timeout); +#endif sslsock->s.timeout.tv_usec = 0; /* use separate timeout for our private funcs */ diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 3e5d96eb90..baf9941764 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -986,88 +986,6 @@ static zend_string *preg_do_repl_func(zval *function, char *subject, int *offset } /* }}} */ -/* {{{ preg_do_eval - */ -static zend_string *preg_do_eval(char *eval_str, int eval_str_len, char *subject, - int *offsets, int count) -{ - zval retval; /* Return value from evaluation */ - char *eval_str_end, /* End of eval string */ - *match, /* Current match for a backref */ - *walk, /* Used to walk the code string */ - *segment, /* Start of segment to append while walking */ - walk_last; /* Last walked character */ - int match_len; /* Length of the match */ - int backref; /* Current backref */ - zend_string *esc_match; /* Quote-escaped match */ - zend_string *result_str; - char *compiled_string_description; - smart_str code = {0}; - - eval_str_end = eval_str + eval_str_len; - walk = segment = eval_str; - walk_last = 0; - - while (walk < eval_str_end) { - /* If found a backreference.. */ - if ('\\' == *walk || '$' == *walk) { - smart_str_appendl(&code, segment, walk - segment); - if (walk_last == '\\') { - code.s->val[code.s->len-1] = *walk++; - segment = walk; - walk_last = 0; - continue; - } - segment = walk; - if (preg_get_backref(&walk, &backref)) { - if (backref < count) { - /* Find the corresponding string match and substitute it - in instead of the backref */ - match = subject + offsets[backref<<1]; - match_len = offsets[(backref<<1)+1] - offsets[backref<<1]; - if (match_len) { - esc_match = php_addslashes(zend_string_init(match, match_len, 0), 1); - } else { - esc_match = zend_string_init(match, match_len, 0); - } - } else { - esc_match = STR_EMPTY_ALLOC(); - } - smart_str_appendl(&code, esc_match->val, esc_match->len); - - segment = walk; - - /* Clean up and reassign */ - zend_string_release(esc_match); - continue; - } - } - walk++; - walk_last = walk[-1]; - } - smart_str_appendl(&code, segment, walk - segment); - smart_str_0(&code); - - compiled_string_description = zend_make_compiled_string_description("regexp code"); - /* Run the code */ - if (zend_eval_stringl(code.s->val, code.s->len, &retval, compiled_string_description) == FAILURE) { - efree(compiled_string_description); - php_error_docref(NULL,E_ERROR, "Failed evaluating code: %s%s", PHP_EOL, code.s->val); - /* zend_error() does not return in this case */ - } - efree(compiled_string_description); - - /* Save the return string */ - result_str = zval_get_string(&retval); - - /* Clean up */ - zval_dtor(&retval); - smart_str_free(&code); - - return result_str; -} -/* }}} */ - /* {{{ php_pcre_replace */ PHPAPI zend_string *php_pcre_replace(zend_string *regex, @@ -1103,7 +1021,6 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int alloc_len; /* Actual allocated length */ int match_len; /* Length of the current match */ int backref; /* Backreference number */ - int eval; /* If the replacement string should be eval'ed */ int start_offset; /* Where the new search starts */ int g_notempty=0; /* If the match should not be empty */ int replace_len=0; /* Length of replacement string */ @@ -1117,7 +1034,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int result_len; /* Length of result */ unsigned char *mark = NULL; /* Target for MARK name */ zend_string *result; /* Result of replacement */ - zend_string *eval_result=NULL; /* Result of eval or custom function */ + zend_string *eval_result=NULL; /* Result of custom function */ ALLOCA_FLAG(use_heap); if (extra == NULL) { @@ -1127,22 +1044,16 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, extra->match_limit = (unsigned long)PCRE_G(backtrack_limit); extra->match_limit_recursion = (unsigned long)PCRE_G(recursion_limit); - eval = pce->preg_options & PREG_REPLACE_EVAL; - if (is_callable_replace) { - if (eval) { - php_error_docref(NULL, E_WARNING, "Modifier /e cannot be used with replacement callback"); - return NULL; - } - } else { + if (pce->preg_options & PREG_REPLACE_EVAL) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The /e modifier is no longer supported, use preg_replace_callback instead"); + return NULL; + } + if (!is_callable_replace) { replace = Z_STRVAL_P(replace_val); replace_len = (int)Z_STRLEN_P(replace_val); replace_end = replace + replace_len; } - if (eval) { - php_error_docref(NULL, E_DEPRECATED, "The /e modifier is deprecated, use preg_replace_callback instead"); - } - /* Calculate the size of the offsets array, and allocate memory for it. */ num_subpats = pce->capture_count + 1; size_offsets = num_subpats * 3; @@ -1201,13 +1112,8 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, match = subject + offsets[0]; new_len = result_len + offsets[0] - start_offset; /* part before the match */ - - /* If evaluating, do it and add the return string's length */ - if (eval) { - eval_result = preg_do_eval(replace, replace_len, subject, - offsets, count); - new_len += (int)eval_result->len; - } else if (is_callable_replace) { + + if (is_callable_replace) { /* Use custom function to get replacement string and its length. */ eval_result = preg_do_repl_func(replace_val, subject, offsets, subpat_names, count, mark); new_len += (int)eval_result->len; @@ -1243,10 +1149,9 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, /* copy replacement and backrefs */ walkbuf = result->val + result_len; - - /* If evaluating or using custom function, copy result to the buffer - * and clean up. */ - if (eval || is_callable_replace) { + + /* If using custom function, copy result to the buffer and clean up. */ + if (is_callable_replace) { memcpy(walkbuf, eval_result->val, eval_result->len); result_len += (int)eval_result->len; if (eval_result) zend_string_release(eval_result); diff --git a/ext/pcre/tests/002.phpt b/ext/pcre/tests/002.phpt index fd245633d3..42b63c7d1b 100644 --- a/ext/pcre/tests/002.phpt +++ b/ext/pcre/tests/002.phpt @@ -34,9 +34,5 @@ string(12) "a${1b${1c${1" Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 8 in %s002.php on line 11 NULL -Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in %s on line 12 - -Parse error: %s in %s002.php(12) : regexp code on line 1 - -Fatal error: preg_replace(): Failed evaluating code: -for ($ in %s002.php on line 12 +Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in %s on line 12 +NULL diff --git a/ext/pcre/tests/004.phpt b/ext/pcre/tests/004.phpt index 1fae406b16..11361d1b32 100644 --- a/ext/pcre/tests/004.phpt +++ b/ext/pcre/tests/004.phpt @@ -12,8 +12,6 @@ var_dump($m); var_dump(preg_match_all('/zend_parse_parameters(?:_ex\s*\([^,]+,[^,]+|\s*\([^,]+),\s*"([^"]*)"\s*,\s*([^{;]*)/S', 'zend_parse_parameters( 0, "addd|s/", a, b, &c);', $m, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)); var_dump($m); -var_dump(preg_replace(array('@//.*@S', '@/\*.*\*/@SsUe'), array('', 'preg_replace("/[^\r\n]+/S", "", \'$0\')'), "hello\n//x \n/*\ns\n*/")); - var_dump(preg_split('/PHP_(?:NAMED_)?(?:FUNCTION|METHOD)\s*\((\w+(?:,\s*\w+)?)\)/S', "PHP_FUNCTION(s, preg_match)\n{\nlalala", -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE)); ?> --EXPECTF-- @@ -117,13 +115,6 @@ array(1) { } } } - -Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in %s on line %d -string(9) "hello - - - -" array(3) { [0]=> array(2) { diff --git a/ext/pcre/tests/preg_replace.phpt b/ext/pcre/tests/preg_replace.phpt index f7b5f74157..092857c57e 100644 --- a/ext/pcre/tests/preg_replace.phpt +++ b/ext/pcre/tests/preg_replace.phpt @@ -8,18 +8,8 @@ var_dump(preg_replace('{{\D+}}', 'ddd', 'abcd')); var_dump(preg_replace('/(ab)(c)(d)(e)(f)(g)(h)(i)(j)(k)/', 'a${1}2$103', 'zabcdefghijkl')); -var_dump(preg_replace_callback('//e', '', '')); - -var_dump(preg_replace_callback('//e', 'strtolower', '')); - ?> --EXPECTF-- string(1) "x" string(4) "abcd" string(8) "zaab2k3l" - -Warning: preg_replace_callback(): Requires argument 2, '', to be a valid callback in %spreg_replace.php on line 8 -string(0) "" - -Warning: preg_replace_callback(): Modifier /e cannot be used with replacement callback in %spreg_replace.php on line 10 -NULL diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 5d1a2ff2d2..1e282d0b43 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -962,9 +962,9 @@ static PHP_METHOD(PDO, lastInsertId) pdo_raise_impl_error(dbh, NULL, "IM001", "driver does not support lastInsertId()"); RETURN_FALSE; } else { - int id_len; + size_t id_len; char *id; - id = dbh->methods->last_id(dbh, name, (unsigned int *)&id_len); + id = dbh->methods->last_id(dbh, name, &id_len); if (!id) { PDO_HANDLE_DBH_ERR(); RETURN_FALSE; @@ -1136,7 +1136,7 @@ static PHP_METHOD(PDO, quote) size_t str_len; zend_long paramtype = PDO_PARAM_STR; char *qstr; - int qlen; + size_t qlen; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &str, &str_len, ¶mtype)) { RETURN_FALSE; diff --git a/ext/pdo/pdo_sql_parser.c b/ext/pdo/pdo_sql_parser.c index 55320da740..d29e3b13b7 100644 --- a/ext/pdo/pdo_sql_parser.c +++ b/ext/pdo/pdo_sql_parser.c @@ -1,4 +1,5 @@ -/* Generated by re2c 0.13.5 */ +/* Generated by re2c 0.13.7.5 */ +#line 1 "ext/pdo/pdo_sql_parser.re" /* +----------------------------------------------------------------------+ | PHP Version 7 | @@ -46,9 +47,11 @@ static int scan(Scanner *s) char *cursor = s->cur; s->tok = cursor; + #line 55 "ext/pdo/pdo_sql_parser.re" - + +#line 55 "ext/pdo/pdo_sql_parser.c" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -67,16 +70,19 @@ static int scan(Scanner *s) } yy2: YYCURSOR = YYMARKER; - switch (yyaccept) { - case 0: goto yy4; - case 1: goto yy10; + if (yyaccept == 0) { + goto yy4; + } else { + goto yy10; } yy3: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); if (yych >= 0x01) goto yy43; yy4: +#line 63 "ext/pdo/pdo_sql_parser.re" { SKIP_ONE(PDO_PARSER_TEXT); } +#line 86 "ext/pdo/pdo_sql_parser.c" yy5: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); @@ -158,7 +164,9 @@ yy7: default: goto yy8; } yy8: +#line 62 "ext/pdo/pdo_sql_parser.re" { RET(PDO_PARSER_BIND_POS); } +#line 170 "ext/pdo/pdo_sql_parser.c" yy9: ++YYCURSOR; switch ((yych = *YYCURSOR)) { @@ -166,7 +174,9 @@ yy9: default: goto yy13; } yy10: +#line 65 "ext/pdo/pdo_sql_parser.re" { RET(PDO_PARSER_TEXT); } +#line 180 "ext/pdo/pdo_sql_parser.c" yy11: yych = *++YYCURSOR; switch (yych) { @@ -201,7 +211,9 @@ yy14: default: goto yy14; } yy16: +#line 64 "ext/pdo/pdo_sql_parser.re" { RET(PDO_PARSER_TEXT); } +#line 217 "ext/pdo/pdo_sql_parser.c" yy17: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -279,7 +291,9 @@ yy29: default: goto yy31; } yy31: +#line 60 "ext/pdo/pdo_sql_parser.re" { RET(PDO_PARSER_TEXT); } +#line 297 "ext/pdo/pdo_sql_parser.c" yy32: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -351,7 +365,9 @@ yy32: default: goto yy34; } yy34: +#line 61 "ext/pdo/pdo_sql_parser.re" { RET(PDO_PARSER_BIND); } +#line 371 "ext/pdo/pdo_sql_parser.c" yy35: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -379,7 +395,9 @@ yy39: goto yy37; yy40: ++YYCURSOR; +#line 59 "ext/pdo/pdo_sql_parser.re" { RET(PDO_PARSER_TEXT); } +#line 401 "ext/pdo/pdo_sql_parser.c" yy42: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -399,17 +417,20 @@ yy44: goto yy42; yy45: ++YYCURSOR; +#line 58 "ext/pdo/pdo_sql_parser.re" { RET(PDO_PARSER_TEXT); } +#line 423 "ext/pdo/pdo_sql_parser.c" } +#line 66 "ext/pdo/pdo_sql_parser.re" } struct placeholder { char *pos; - char *quoted; /* quoted value */ - int len; + size_t len; int bindno; - int qlen; /* quoted length of value */ + size_t qlen; /* quoted length of value */ + char *quoted; /* quoted value */ int freeq; struct placeholder *next; }; @@ -418,15 +439,15 @@ static void free_param_name(zval *el) { efree(Z_PTR_P(el)); } -PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, - char **outquery, int *outquery_len) +PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, size_t inquery_len, + char **outquery, size_t *outquery_len) { Scanner s; char *ptr, *newbuffer; int t; int bindno = 0; int ret = 0; - int newbuffer_len; + size_t newbuffer_len; HashTable *params; struct pdo_bound_param_data *param; int query_type = PDO_PLACEHOLDER_NONE; diff --git a/ext/pdo/pdo_sql_parser.re b/ext/pdo/pdo_sql_parser.re index 17f51e5c25..ef989d35c4 100644 --- a/ext/pdo/pdo_sql_parser.re +++ b/ext/pdo/pdo_sql_parser.re @@ -68,9 +68,9 @@ static int scan(Scanner *s) struct placeholder { char *pos; - int len; + size_t len; int bindno; - int qlen; /* quoted length of value */ + size_t qlen; /* quoted length of value */ char *quoted; /* quoted value */ int freeq; struct placeholder *next; @@ -80,15 +80,15 @@ static void free_param_name(zval *el) { efree(Z_PTR_P(el)); } -PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, - char **outquery, int *outquery_len) +PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, size_t inquery_len, + char **outquery, size_t *outquery_len) { Scanner s; char *ptr, *newbuffer; int t; int bindno = 0; int ret = 0; - int newbuffer_len; + size_t newbuffer_len; HashTable *params; struct pdo_bound_param_data *param; int query_type = PDO_PLACEHOLDER_NONE; diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 7ae888cfe1..dc1201ccda 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -1543,7 +1543,7 @@ static PHP_METHOD(PDOStatement, fetchAll) static int register_bound_param(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, int is_param) /* {{{ */ { - struct pdo_bound_param_data param = {0}; + struct pdo_bound_param_data param = {{{0}}}; zend_long param_type = PDO_PARAM_STR; zval *parameter; @@ -1582,7 +1582,7 @@ static int register_bound_param(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, bind an input parameter to the value of a PHP variable. $paramno is the 1-based position of the placeholder in the SQL statement (but can be the parameter name for drivers that support named placeholders). It should be called prior to execute(). */ static PHP_METHOD(PDOStatement, bindValue) { - struct pdo_bound_param_data param = {0}; + struct pdo_bound_param_data param = {{{0}}}; zend_long param_type = PDO_PARAM_STR; zval *parameter; PHP_STMT_GET_OBJ; diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h index 58dcabd060..899208eb22 100644 --- a/ext/pdo/php_pdo_driver.h +++ b/ext/pdo/php_pdo_driver.h @@ -46,7 +46,7 @@ PDO_API char *php_pdo_int64_to_str(pdo_int64_t i64); # define FALSE 0 #endif -#define PDO_DRIVER_API 20080721 +#define PDO_DRIVER_API 20150127 enum pdo_param_type { PDO_PARAM_NULL, @@ -219,8 +219,8 @@ static inline char *pdo_attr_strval(zval *options, enum pdo_attribute_type optio /* This structure is registered with PDO when a PDO driver extension is * initialized */ typedef struct { - const char *driver_name; - zend_ulong driver_name_len; + const char *driver_name; + size_t driver_name_len; zend_ulong api_version; /* needs to be compatible with PDO */ #define PDO_DRIVER_HEADER(name) \ @@ -244,13 +244,13 @@ typedef struct { typedef int (*pdo_dbh_close_func)(pdo_dbh_t *dbh); /* prepare a statement and stash driver specific portion into stmt */ -typedef int (*pdo_dbh_prepare_func)(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, pdo_stmt_t *stmt, zval *driver_options); +typedef int (*pdo_dbh_prepare_func)(pdo_dbh_t *dbh, const char *sql, size_t sql_len, pdo_stmt_t *stmt, zval *driver_options); /* execute a statement (that does not return a result set) */ -typedef zend_long (*pdo_dbh_do_func)(pdo_dbh_t *dbh, const char *sql, zend_long sql_len); +typedef zend_long (*pdo_dbh_do_func)(pdo_dbh_t *dbh, const char *sql, size_t sql_len); /* quote a string */ -typedef int (*pdo_dbh_quote_func)(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type paramtype); +typedef int (*pdo_dbh_quote_func)(pdo_dbh_t *dbh, const char *unquoted, size_t unquotedlen, char **quoted, size_t *quotedlen, enum pdo_param_type paramtype); /* transaction related */ typedef int (*pdo_dbh_txn_func)(pdo_dbh_t *dbh); @@ -260,7 +260,7 @@ typedef int (*pdo_dbh_set_attr_func)(pdo_dbh_t *dbh, zend_long attr, zval *val); /* return last insert id. NULL indicates error condition, otherwise, the return value * MUST be an emalloc'd NULL terminated string. */ -typedef char *(*pdo_dbh_last_id_func)(pdo_dbh_t *dbh, const char *name, unsigned int *len); +typedef char *(*pdo_dbh_last_id_func)(pdo_dbh_t *dbh, const char *name, size_t *len); /* fetch error information. if stmt is not null, fetch information pertaining * to the statement, otherwise fetch global error information. The driver @@ -341,7 +341,7 @@ typedef int (*pdo_stmt_describe_col_func)(pdo_stmt_t *stmt, int colno); * If the driver sets caller_frees, ptr should point to emalloc'd memory * and PDO will free it as soon as it is done using it. */ -typedef int (*pdo_stmt_get_col_data_func)(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulong *len, int *caller_frees); +typedef int (*pdo_stmt_get_col_data_func)(pdo_stmt_t *stmt, int colno, char **ptr, size_t *len, int *caller_frees); /* hook for bound params */ enum pdo_param_event { @@ -469,7 +469,7 @@ struct _pdo_dbh_t { /* data source string used to open this handle */ const char *data_source; - zend_ulong data_source_len; + size_t data_source_len; /* the global error code. */ pdo_error_type error_code; @@ -480,7 +480,7 @@ struct _pdo_dbh_t { /* persistent hash key associated with this handle */ const char *persistent_id; - int persistent_id_len; + size_t persistent_id_len; unsigned int refcount; /* driver specific "class" methods for the dbh and stmt */ @@ -528,10 +528,10 @@ static inline pdo_dbh_object_t *php_pdo_dbh_fetch_object(zend_object *obj) { /* describes a column */ struct pdo_column_data { char *name; - zend_ulong maxlen; + size_t maxlen; zend_ulong precision; enum pdo_param_type param_type; - int namelen; + size_t namelen; /* don't touch this unless your name is dbdo */ void *dbdo_data; @@ -598,11 +598,11 @@ struct _pdo_stmt_t { /* used to hold the statement's current query */ char *query_string; - int query_stringlen; + size_t query_stringlen; /* the copy of the query with expanded binds ONLY for emulated-prepare drivers */ char *active_query_string; - int active_query_stringlen; + size_t active_query_stringlen; /* the cursor specific error code. */ pdo_error_type error_code; @@ -678,8 +678,8 @@ PDO_API int php_pdo_parse_data_source(const char *data_source, PDO_API zend_class_entry *php_pdo_get_dbh_ce(void); PDO_API zend_class_entry *php_pdo_get_exception(void); -PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, - char **outquery, int *outquery_len); +PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, size_t inquery_len, + char **outquery, size_t *outquery_len); PDO_API void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *sqlstate, const char *supp); diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c index e6bd19f4e9..b3014a9fc0 100644 --- a/ext/pdo_dblib/dblib_driver.c +++ b/ext/pdo_dblib/dblib_driver.c @@ -92,7 +92,7 @@ static int dblib_handle_closer(pdo_dbh_t *dbh) return 0; } -static int dblib_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, pdo_stmt_t *stmt, zval *driver_options) +static int dblib_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_len, pdo_stmt_t *stmt, zval *driver_options) { pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data; pdo_dblib_stmt *S = ecalloc(1, sizeof(*S)); @@ -106,7 +106,7 @@ static int dblib_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_ return 1; } -static zend_long dblib_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len) +static zend_long dblib_handle_doer(pdo_dbh_t *dbh, const char *sql, size_t sql_len) { pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data; RETCODE ret, resret; @@ -142,7 +142,7 @@ static zend_long dblib_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sq return DBCOUNT(H->link); } -static int dblib_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type paramtype) +static int dblib_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, size_t unquotedlen, char **quoted, size_t *quotedlen, enum pdo_param_type paramtype) { int useBinaryEncoding = 0; @@ -230,7 +230,7 @@ static int dblib_handle_rollback(pdo_dbh_t *dbh) return pdo_dblib_transaction_cmd("ROLLBACK TRANSACTION", dbh); } -char *dblib_handle_last_id(pdo_dbh_t *dbh, const char *name, unsigned int *len) +char *dblib_handle_last_id(pdo_dbh_t *dbh, const char *name, size_t *len) { pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data; diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c index 100dbb40d8..4bba4b6b1f 100644 --- a/ext/pdo_firebird/firebird_driver.c +++ b/ext/pdo_firebird/firebird_driver.c @@ -31,7 +31,7 @@ #include "php_pdo_firebird.h" #include "php_pdo_firebird_int.h" -static int firebird_alloc_prepare_stmt(pdo_dbh_t*, const char*, zend_long, XSQLDA*, isc_stmt_handle*, +static int firebird_alloc_prepare_stmt(pdo_dbh_t*, const char*, size_t, XSQLDA*, isc_stmt_handle*, HashTable*); /* map driver specific error message to PDO error */ @@ -130,7 +130,7 @@ static int firebird_handle_closer(pdo_dbh_t *dbh) /* {{{ */ /* }}} */ /* called by PDO to prepare an SQL query */ -static int firebird_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, /* {{{ */ +static int firebird_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_len, /* {{{ */ pdo_stmt_t *stmt, zval *driver_options) { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; @@ -216,7 +216,7 @@ static int firebird_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long s /* }}} */ /* called by PDO to execute a statement that doesn't produce a result set */ -static zend_long firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len) /* {{{ */ +static zend_long firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, size_t sql_len) /* {{{ */ { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; isc_stmt_handle stmt = NULL; @@ -270,8 +270,8 @@ static zend_long firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long /* }}} */ /* called by the PDO SQL parser to add quotes to values that are copied into SQL */ -static int firebird_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, /* {{{ */ - char **quoted, int *quotedlen, enum pdo_param_type paramtype) +static int firebird_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, size_t unquotedlen, /* {{{ */ + char **quoted, size_t *quotedlen, enum pdo_param_type paramtype) { int qcount = 0; char const *co, *l, *r; @@ -389,7 +389,7 @@ static int firebird_handle_rollback(pdo_dbh_t *dbh) /* {{{ */ /* }}} */ /* used by prepare and exec to allocate a statement handle and prepare the SQL */ -static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, /* {{{ */ +static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, size_t sql_len, /* {{{ */ XSQLDA *out_sqlda, isc_stmt_handle *s, HashTable *named_params) { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index 467298ef1d..4f55d96d00 100644 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -161,18 +161,18 @@ static int mysql_handle_closer(pdo_dbh_t *dbh) /* }}} */ /* {{{ mysql_handle_preparer */ -static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, pdo_stmt_t *stmt, zval *driver_options) +static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_len, pdo_stmt_t *stmt, zval *driver_options) { pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; pdo_mysql_stmt *S = ecalloc(1, sizeof(pdo_mysql_stmt)); char *nsql = NULL; - int nsql_len = 0; + size_t nsql_len = 0; int ret; int server_version; PDO_DBG_ENTER("mysql_handle_preparer"); PDO_DBG_INF_FMT("dbh=%p", dbh); - PDO_DBG_INF_FMT("sql=%.*s", sql_len, sql); + PDO_DBG_INF_FMT("sql=%.*s", (int)sql_len, sql); S->H = H; stmt->driver_data = S; @@ -253,12 +253,12 @@ end: /* }}} */ /* {{{ mysql_handle_doer */ -static zend_long mysql_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len) +static zend_long mysql_handle_doer(pdo_dbh_t *dbh, const char *sql, size_t sql_len) { pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; PDO_DBG_ENTER("mysql_handle_doer"); PDO_DBG_INF_FMT("dbh=%p", dbh); - PDO_DBG_INF_FMT("sql=%.*s", sql_len, sql); + PDO_DBG_INF_FMT("sql=%.*s", (int)sql_len, sql); if (mysql_real_query(H->server, sql, sql_len)) { pdo_mysql_error(dbh); @@ -288,7 +288,7 @@ static zend_long mysql_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sq /* }}} */ /* {{{ pdo_mysql_last_insert_id */ -static char *pdo_mysql_last_insert_id(pdo_dbh_t *dbh, const char *name, unsigned int *len) +static char *pdo_mysql_last_insert_id(pdo_dbh_t *dbh, const char *name, size_t *len) { pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; char *id = php_pdo_int64_to_str(mysql_insert_id(H->server)); @@ -299,17 +299,17 @@ static char *pdo_mysql_last_insert_id(pdo_dbh_t *dbh, const char *name, unsigned /* }}} */ /* {{{ mysql_handle_quoter */ -static int mysql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type paramtype ) +static int mysql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, size_t unquotedlen, char **quoted, size_t *quotedlen, enum pdo_param_type paramtype ) { pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; PDO_DBG_ENTER("mysql_handle_quoter"); PDO_DBG_INF_FMT("dbh=%p", dbh); - PDO_DBG_INF_FMT("unquoted=%.*s", unquotedlen, unquoted); + PDO_DBG_INF_FMT("unquoted=%.*s", (int)unquotedlen, unquoted); *quoted = safe_emalloc(2, unquotedlen, 3); *quotedlen = mysql_real_escape_string(H->server, *quoted + 1, unquoted, unquotedlen); (*quoted)[0] =(*quoted)[++*quotedlen] = '\''; (*quoted)[++*quotedlen] = '\0'; - PDO_DBG_INF_FMT("quoted=%.*s", *quotedlen, *quoted); + PDO_DBG_INF_FMT("quoted=%.*s", (int)*quotedlen, *quoted); PDO_DBG_RETURN(1); } /* }}} */ @@ -559,8 +559,8 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options) #endif ; #if defined(PDO_USE_MYSQLND) - int dbname_len = 0; - int password_len = 0; + size_t dbname_len = 0; + size_t password_len = 0; #endif #ifdef CLIENT_MULTI_STATEMENTS diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index 40d6fd032b..56728ed92d 100644 --- a/ext/pdo_mysql/mysql_statement.c +++ b/ext/pdo_mysql/mysql_statement.c @@ -722,7 +722,7 @@ static int pdo_mysql_stmt_describe(pdo_stmt_t *stmt, int colno) /* {{{ */ } /* }}} */ -static int pdo_mysql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulong *len, int *caller_frees) /* {{{ */ +static int pdo_mysql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, size_t *len, int *caller_frees) /* {{{ */ { pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c index b98fb22cb7..53edee0d33 100644 --- a/ext/pdo_oci/oci_driver.c +++ b/ext/pdo_oci/oci_driver.c @@ -248,13 +248,13 @@ static int oci_handle_closer(pdo_dbh_t *dbh) /* {{{ */ } /* }}} */ -static int oci_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, zval *driver_options) /* {{{ */ +static int oci_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_len, pdo_stmt_t *stmt, zval *driver_options) /* {{{ */ { pdo_oci_db_handle *H = (pdo_oci_db_handle *)dbh->driver_data; pdo_oci_stmt *S = ecalloc(1, sizeof(*S)); ub4 prefetch; char *nsql = NULL; - int nsql_len = 0; + size_t nsql_len = 0; int ret; #if HAVE_OCISTMTFETCH2 @@ -324,7 +324,7 @@ static int oci_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pd } /* }}} */ -static long oci_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len) /* {{{ */ +static long oci_handle_doer(pdo_dbh_t *dbh, const char *sql, size_t sql_len) /* {{{ */ { pdo_oci_db_handle *H = (pdo_oci_db_handle *)dbh->driver_data; OCIStmt *stmt; @@ -368,7 +368,7 @@ static long oci_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len) /* {{ } /* }}} */ -static int oci_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type paramtype ) /* {{{ */ +static int oci_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, size_t unquotedlen, char **quoted, size_t *quotedlen, enum pdo_param_type paramtype ) /* {{{ */ { int qcount = 0; char const *cu, *l, *r; diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c index e47db9fa1a..54440d0068 100644 --- a/ext/pdo_odbc/odbc_driver.c +++ b/ext/pdo_odbc/odbc_driver.c @@ -142,7 +142,7 @@ static int odbc_handle_closer(pdo_dbh_t *dbh) return 0; } -static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, pdo_stmt_t *stmt, zval *driver_options) +static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_len, pdo_stmt_t *stmt, zval *driver_options) { RETCODE rc; pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; @@ -150,7 +150,7 @@ static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_l enum pdo_cursor_type cursor_type = PDO_CURSOR_FWDONLY; int ret; char *nsql = NULL; - int nsql_len = 0; + size_t nsql_len = 0; S->H = H; S->assume_utf8 = H->assume_utf8; @@ -220,7 +220,7 @@ static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_l return 1; } -static zend_long odbc_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len) +static zend_long odbc_handle_doer(pdo_dbh_t *dbh, const char *sql, size_t sql_len) { pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; RETCODE rc; @@ -261,7 +261,7 @@ out: return row_count; } -static int odbc_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type param_type ) +static int odbc_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, size_t unquotedlen, char **quoted, size_t *quotedlen, enum pdo_param_type param_type ) { /* pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; */ /* TODO: figure it out */ @@ -440,7 +440,7 @@ static int pdo_odbc_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{ if (strchr(dbh->data_source, ';')) { char dsnbuf[1024]; - short dsnbuflen; + SQLSMALLINT dsnbuflen; use_direct = 1; diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index a581fecfcf..e4e202c9f9 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -214,14 +214,14 @@ static int pgsql_handle_closer(pdo_dbh_t *dbh) /* {{{ */ } /* }}} */ -static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, pdo_stmt_t *stmt, zval *driver_options) +static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_len, pdo_stmt_t *stmt, zval *driver_options) { pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; pdo_pgsql_stmt *S = ecalloc(1, sizeof(pdo_pgsql_stmt)); int scrollable; int ret; char *nsql = NULL; - int nsql_len = 0; + size_t nsql_len = 0; int emulate = 0; int execute_only = 0; @@ -287,7 +287,7 @@ static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_ return 1; } -static zend_long pgsql_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len) +static zend_long pgsql_handle_doer(pdo_dbh_t *dbh, const char *sql, size_t sql_len) { pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; PGresult *res; @@ -316,7 +316,7 @@ static zend_long pgsql_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sq return ret; } -static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type paramtype) +static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, size_t unquotedlen, char **quoted, size_t *quotedlen, enum pdo_param_type paramtype) { unsigned char *escaped; pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; @@ -325,8 +325,8 @@ static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquote switch (paramtype) { case PDO_PARAM_LOB: /* escapedlen returned by PQescapeBytea() accounts for trailing 0 */ - escaped = PQescapeByteaConn(H->server, (unsigned char *)unquoted, (size_t)unquotedlen, &tmp_len); - *quotedlen = (int)tmp_len + 1; + escaped = PQescapeByteaConn(H->server, (unsigned char *)unquoted, unquotedlen, &tmp_len); + *quotedlen = tmp_len + 1; *quoted = emalloc(*quotedlen + 1); memcpy((*quoted)+1, escaped, *quotedlen-2); (*quoted)[0] = '\''; @@ -337,7 +337,7 @@ static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquote default: *quoted = safe_emalloc(2, unquotedlen, 3); (*quoted)[0] = '\''; - *quotedlen = PQescapeStringConn(H->server, *quoted + 1, unquoted, (size_t)unquotedlen, NULL); + *quotedlen = PQescapeStringConn(H->server, *quoted + 1, unquoted, unquotedlen, NULL); (*quoted)[*quotedlen + 1] = '\''; (*quoted)[*quotedlen + 2] = '\0'; *quotedlen += 2; @@ -345,7 +345,7 @@ static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquote return 1; } -static char *pdo_pgsql_last_insert_id(pdo_dbh_t *dbh, const char *name, unsigned int *len) +static char *pdo_pgsql_last_insert_id(pdo_dbh_t *dbh, const char *name, size_t *len) { pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; char *id = NULL; @@ -590,12 +590,12 @@ static PHP_METHOD(PDO, pgsqlCopyFromArray) if (status == PGRES_COPY_IN && pgsql_result) { int command_failed = 0; - int buffer_len = 0; + size_t buffer_len = 0; zval *tmp; PQclear(pgsql_result); ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pg_rows), tmp) { - int query_len; + size_t query_len; convert_to_string_ex(tmp); if (buffer_len < Z_STRLEN_P(tmp)) { diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index 1aa7979cd3..decc9dc438 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -175,7 +175,7 @@ static int sqlite_handle_closer(pdo_dbh_t *dbh) /* {{{ */ } /* }}} */ -static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, pdo_stmt_t *stmt, zval *driver_options) +static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_len, pdo_stmt_t *stmt, zval *driver_options) { pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; pdo_sqlite_stmt *S = ecalloc(1, sizeof(pdo_sqlite_stmt)); @@ -203,7 +203,7 @@ static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql return 0; } -static zend_long sqlite_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len) +static zend_long sqlite_handle_doer(pdo_dbh_t *dbh, const char *sql, size_t sql_len) { pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; char *errmsg = NULL; @@ -219,7 +219,7 @@ static zend_long sqlite_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long s } } -static char *pdo_sqlite_last_insert_id(pdo_dbh_t *dbh, const char *name, unsigned int *len) +static char *pdo_sqlite_last_insert_id(pdo_dbh_t *dbh, const char *name, size_t *len) { pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; char *id; @@ -230,7 +230,7 @@ static char *pdo_sqlite_last_insert_id(pdo_dbh_t *dbh, const char *name, unsigne } /* NB: doesn't handle binary strings... use prepared stmts for that */ -static int sqlite_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type paramtype ) +static int sqlite_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, size_t unquotedlen, char **quoted, size_t *quotedlen, enum pdo_param_type paramtype ) { *quoted = safe_emalloc(2, unquotedlen, 3); sqlite3_snprintf(2*unquotedlen + 3, *quoted, "'%q'", unquoted); diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index f58d125cf2..0b173d1e0b 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -2115,8 +2115,8 @@ static zend_object *phar_rename_archive(phar_archive_data *phar, char *ext, zend } its_ok: if (SUCCESS == php_stream_stat_path(newpath, &ssb)) { - efree(oldpath); zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "phar \"%s\" exists and must be unlinked prior to conversion", newpath); + efree(oldpath); return NULL; } if (!phar->is_data) { diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index c95ec0d81e..9f5ad8cdd4 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -907,6 +907,24 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry } _function_parameter_string(str, fptr, param_indent.buf->val); string_free(¶m_indent); + if (fptr->op_array.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) { + string_printf(str, " %s- Return [ ", indent); + if (fptr->common.arg_info[-1].class_name) { + string_printf(str, "%s ", + (fptr->type == ZEND_INTERNAL_FUNCTION) ? + ((zend_internal_arg_info*)(fptr->common.arg_info - 1))->class_name : + fptr->common.arg_info[-1].class_name->val); + if (fptr->common.arg_info[-1].allow_null) { + string_printf(str, "or NULL "); + } + } else if (fptr->common.arg_info[-1].type_hint) { + string_printf(str, "%s ", zend_get_type_by_const(fptr->common.arg_info[-1].type_hint)); + if (fptr->common.arg_info[-1].allow_null) { + string_printf(str, "or NULL "); + } + } + string_printf(str, "]\n"); + } string_printf(str, "%s}\n", indent); } /* }}} */ @@ -3978,6 +3996,7 @@ static int _adddynproperty(zval *ptr, int num_args, va_list args, zend_hash_key if (zend_get_property_info(ce, hash_key->key, 1) == NULL) { zend_property_info property_info; + property_info.doc_comment = NULL; property_info.flags = ZEND_ACC_IMPLICIT_PUBLIC; property_info.name = hash_key->key; property_info.ce = ce; diff --git a/ext/reflection/tests/bug67068.phpt b/ext/reflection/tests/bug67068.phpt new file mode 100644 index 0000000000..35c1b1674f --- /dev/null +++ b/ext/reflection/tests/bug67068.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #67068 (ReflectionFunction::getClosure returns something that doesn't report as a closure) +--FILE-- +<?php +class MyClass { + public function method() {} +} + +$object = new MyClass; +$reflector = new \ReflectionMethod($object, 'method'); +$closure = $reflector->getClosure($object); + +$closureReflector = new \ReflectionFunction($closure); + +var_dump($closureReflector->isClosure()); +?> +--EXPECT-- +bool(true)
\ No newline at end of file diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index 1d6686a5d9..561d216adf 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -16,7 +16,41 @@ +----------------------------------------------------------------------+ */ -/* $Id$ */ +/************************************************************************** + * Files save handler should be used as reference implementations of session + * save handlers. PS_* functions are called as follows with standard usage. + * + * PS_OPEN_FUNC() - Create module data that manages save handler. + * PS_CREATE_SID() and/or PS_VALIDATE_SID() + * - PS_CREATE_ID() is called if session ID(key) is not + * provided or invalid. PS_VALIDATE_SID() is called to + * verify session ID already exists or not to mitigate + * session adoption vulunerabilty risk. + * PS_READ_FUNC() - Read data from storage. + * PS_GC_FUNC() - Perform GC. Called by probability + * (session.gc_probability/session.gc_divisor). + * PS_WRITE_FUNC() or PS_UPDATE_TIMESTAMP() + * - Write session data or update session data timestamp. + * It depends on session data change. + * PS_CLOSE_FUNC() - Clean up module data created by PS_OPEN_FUNC(). + * + * Session module gurantees PS_OPEN_FUNC() is called before calling other + * PS_*_FUNC() functions. Other than this, session module may call any + * PS_*_FUNC() at any time. You may assume non null *mod_data created by + * PS_OPEN_FUNC() is passed to PS_*_FUNC(). + * + * NOTE: + * - Save handlers _MUST_NOT_ change/refer PS() values. + * i.e. PS(id), PS(session_status), PS(mod) and any other PS() values. + * Use only function parameters passed from session module. + * - Save handler _MUST_ use PS_GET_MOD_DATA()/PS_SET_MOD_DATA() macro to + * set/get save handler module data(mod_data). mod_data contains + * data required by PS modules. It will not be NULL except PS_OPEN_FUNC(). + * - Refer to PS_* macros in php_session.h for function/parameter defitions. + * - Returning FAILURE state from PS_* function results in raising errors. + * Avoid failure state as much as possible. + * - Use static ps_[module name]_[function name] functions for internal use. + *************************************************************************/ #include "php.h" @@ -67,7 +101,8 @@ typedef struct { } ps_files; ps_module ps_mod_files = { - PS_MOD_SID(files) + /* New save handlers MUST use PS_MOD_UPDATE_TIMESTAMP macro */ + PS_MOD_UPDATE_TIMESTAMP(files) }; @@ -182,6 +217,42 @@ static void ps_files_open(ps_files *data, const char *key) } } +static int ps_files_write(ps_files *data, zend_string *key, zend_string *val) +{ + zend_long n; + + /* PS(id) may be changed by calling session_regenerate_id(). + Re-initialization should be tried here. ps_files_open() checks + data->lastkey and reopen when it is needed. */ + ps_files_open(data, key->val); + if (data->fd < 0) { + return FAILURE; + } + + /* Truncate file if the amount of new data is smaller than the existing data set. */ + if (val->len < (int)data->st_size) { + php_ignore_value(ftruncate(data->fd, 0)); + } + +#if defined(HAVE_PWRITE) + n = pwrite(data->fd, val->val, val->len, 0); +#else + lseek(data->fd, 0, SEEK_SET); + n = write(data->fd, val->val, val->len); +#endif + + if (n != val->len) { + if (n == -1) { + php_error_docref(NULL, E_WARNING, "write failed: %s (%d)", strerror(errno), errno); + } else { + php_error_docref(NULL, E_WARNING, "write wrote less bytes than requested"); + } + return FAILURE; + } + + return SUCCESS; +} + static int ps_files_cleanup_dir(const char *dirname, int maxlifetime) { DIR *dir; @@ -220,7 +291,7 @@ static int ps_files_cleanup_dir(const char *dirname, int maxlifetime) /* NUL terminate it and */ buf[dirname_len + entry_len + 1] = '\0'; - /* check whether its last access was more than maxlifet ago */ + /* check whether its last access was more than maxlifetime ago */ if (VCWD_STAT(buf, &sbuf) == 0 && (now - sbuf.st_mtime) > maxlifetime) { VCWD_UNLINK(buf); @@ -252,6 +323,18 @@ static int ps_files_key_exists(ps_files *data, const char *key) #define PS_FILES_DATA ps_files *data = PS_GET_MOD_DATA() + +/* + * Open save handler. Setup resources that are needed by the handler. + * PARAMETERS: PS_OPEN_ARGS in php_session.h + * RETURN VALUE: SUCCESS or FAILURE. Must set non-NULL valid module data + * (void **mod_data) with SUCCESS, NULL(default) for FAILUREs. + * + * Files save handler checks/create save_path directory and setup ps_files data. + * Note that files save handler supports splitting session data into multiple + * directories. + * *mod_data, *save_path, *session_name are guranteed to have non-NULL values. + */ PS_OPEN_FUNC(files) { ps_files *data; @@ -316,6 +399,17 @@ PS_OPEN_FUNC(files) return SUCCESS; } + +/* + * Clean up opened resources. + * PARAMETERS: PS_CLOSE_ARGS in php_session.h + * RETURN VALUE: SUCCESS. Must set PS module data(void **mod_data) to NULL. + * + * Files save handler closes open files and it's memory. + * *mod_data is guranteed to have non-NULL value. + * PS_CLOSE_FUNC() must set *mod_data to NULL. PS_CLOSE_FUNC() should not + * fail. + */ PS_CLOSE_FUNC(files) { PS_FILES_DATA; @@ -333,32 +427,24 @@ PS_CLOSE_FUNC(files) return SUCCESS; } + +/* + * Read session data from opened resource. + * PARAMETERS: PS_READ_ARGS in php_session.h + * RETURN VALUE: SUCCESS or FAILURE. Must set non-NULL session data to (zend_string **val) + * for SUCCESS. NULL(default) for FAILUREs. + * + * Files save handler supports splitting session data into multiple + * directories. + * *mod_data, *key are guranteed to have non-NULL values. + */ PS_READ_FUNC(files) { zend_long n; zend_stat_t sbuf; PS_FILES_DATA; - /* If strict mode, check session id existence */ - if (PS(use_strict_mode) && - ps_files_key_exists(data, key? key->val : NULL) == FAILURE) { - /* key points to PS(id), but cannot change here. */ - if (key) { - zend_string_release(PS(id)); - PS(id) = NULL; - } - PS(id) = PS(mod)->s_create_sid((void **)&data); - if (!PS(id)) { - return FAILURE; - } - if (PS(use_cookies)) { - PS(send_cookie) = 1; - } - php_session_reset_id(); - PS(session_status) = php_session_active; - } - - ps_files_open(data, PS(id)->val); + ps_files_open(data, key->val); if (data->fd < 0) { return FAILURE; } @@ -390,47 +476,82 @@ PS_READ_FUNC(files) php_error_docref(NULL, E_WARNING, "read returned less bytes than requested"); } zend_string_release(*val); + *val = STR_EMPTY_ALLOC(); return FAILURE; } return SUCCESS; } + +/* + * Write session data. + * PARAMETERS: PS_WRITE_ARGS in php_session.h + * RETURN VALUE: SUCCESS or FAILURE. + * + * PS_WRITE_FUNC() must write session data(zend_string *val) unconditionally. + * *mod_data, *key, *val are guranteed to have non-NULL values. + */ PS_WRITE_FUNC(files) { - zend_long n; PS_FILES_DATA; - ps_files_open(data, key->val); - if (data->fd < 0) { - return FAILURE; - } + return ps_files_write(data, key, val); +} - /* Truncate file if the amount of new data is smaller than the existing data set. */ - if (val->len < (int)data->st_size) { - php_ignore_value(ftruncate(data->fd, 0)); +/* + * Update session data modification/access time stamp. + * PARAMETERS: PS_UPDATE_TIMESTAMP_ARGS in php_session.h + * RETURN VALUE: SUCCESS or FAILURE. + * + * PS_UPDATE_TIMESTAMP_FUNC() updates time stamp(mtime) so that active session + * data files will not be purged by GC. If session data storage does not need to + * update timestamp, it should return SUCCESS simply. (e.g. Memcache) + * *mod_data, *key, *val are guranteed to have non-NULL values. + * + * NOTE: Updating access timestamp at PS_READ_FUNC() may extend life of obsolete + * session data. Use of PS_UPDATE_TIMESTAMP_FUNC() is prefered whenenver it is + * possible. + */ +PS_UPDATE_TIMESTAMP_FUNC(files) +{ + char buf[MAXPATHLEN]; + struct utimbuf newtimebuf; + struct utimbuf *newtime = &newtimebuf; + int ret; + PS_FILES_DATA; + + if (!ps_files_path_create(buf, sizeof(buf), data, key->val)) { + return FAILURE; } -#if defined(HAVE_PWRITE) - n = pwrite(data->fd, val->val, val->len, 0); + /* Update mtime */ +#ifdef HAVE_UTIME_NULL + newtime = NULL; #else - lseek(data->fd, 0, SEEK_SET); - n = write(data->fd, val->val, val->len); + newtime->modtime = newtime->actime = time(NULL); #endif - - if (n != val->len) { - if (n == -1) { - php_error_docref(NULL, E_WARNING, "write failed: %s (%d)", strerror(errno), errno); - } else { - php_error_docref(NULL, E_WARNING, "write wrote less bytes than requested"); - } - return FAILURE; + ret = VCWD_UTIME(buf, newtime); + if (ret == -1) { + /* New session ID, create data file */ + return ps_files_write(data, key, val); } return SUCCESS; } + +/* + * Delete session data. + * PARAMETERS: PS_DESTROY_ARGS in php_session.h + * RETURN VALUE: SUCCESS or FAILURE. + * + * PS_DESTROY_FUNC() must remove the session data specified by *key from + * session data storage unconditionally. It must not return FAILURE for + * non-existent session data. + * *mod_data, *key are guranteed to have non-NULL values. + */ PS_DESTROY_FUNC(files) { char buf[MAXPATHLEN]; @@ -455,11 +576,23 @@ PS_DESTROY_FUNC(files) return SUCCESS; } + +/* + * Cleanup expired session data. + * PARAMETERS: PS_GC_ARGS in php_session.h + * RETURN VALUE: SUCCESS or FAILURE. Number of deleted records(int *nrdels(default=-1)). + * + * PS_GC_FUNC() must remove session data that are not accessed + * 'session.maxlifetime'(seconds). If storage does not need manual GC, it + * may return SUCCESS simply. (e.g. Memcache) It must set number of records + * deleted(nrdels). + * *mod_data is guranteed to have non-NULL value. + */ PS_GC_FUNC(files) { PS_FILES_DATA; - /* we don't perform any cleanup, if dirdepth is larger than 0. + /* We don't perform any cleanup, if dirdepth is larger than 0. we return SUCCESS, since all cleanup should be handled by an external entity (i.e. find -ctime x | xargs rm) */ @@ -470,6 +603,20 @@ PS_GC_FUNC(files) return SUCCESS; } + +/* + * Create session ID. + * PARAMETERS: PS_CREATE_SID_ARGS in php_session.h + * RETURN VALUE: Valid session ID(zend_string *) or NULL for FAILURE. + * + * PS_CREATE_SID_FUNC() must check collision. i.e. Check session data if + * new sid exists already. + * *mod_data is guranteed to have non-NULL value. + * NOTE: Default php_session_create_id() does not check collision. If + * NULL is returned, session module create new ID by using php_session_create_id(). + * If php_session_create_id() fails due to invalid configuration, it raises E_ERROR. + * NULL return value checks from php_session_create_id() is not required generally. + */ PS_CREATE_SID_FUNC(files) { zend_string *sid; @@ -478,13 +625,21 @@ PS_CREATE_SID_FUNC(files) do { sid = php_session_create_id((void**)&data); + if (!sid) { + if (--maxfail < 0) { + return NULL; + } else { + continue; + } + } /* Check collision */ - if (data && ps_files_key_exists(data, sid? sid->val : NULL) == SUCCESS) { + /* FIXME: mod_data(data) should not be NULL (User handler could be NULL) */ + if (data && ps_files_key_exists(data, sid->val) == SUCCESS) { if (sid) { zend_string_release(sid); sid = NULL; } - if (!(maxfail--)) { + if (--maxfail < 0) { return NULL; } } @@ -495,6 +650,22 @@ PS_CREATE_SID_FUNC(files) /* + * Check session ID existence for use_strict_mode support. + * PARAMETERS: PS_VALIDATE_SID_ARGS in php_session.h + * RETURN VALUE: SUCCESS or FAILURE. + * + * Return SUCCESS for valid key(already exsting session). + * Return FAILURE for invalid key(non-existing session). + * *mod_data, *key are guranteed to have non-NULL values. + */ +PS_VALIDATE_SID_FUNC(files) +{ + PS_FILES_DATA; + + return ps_files_key_exists(data, key->val); +} + +/* * Local variables: * tab-width: 4 * c-basic-offset: 4 diff --git a/ext/session/mod_files.h b/ext/session/mod_files.h index 9b068e6828..e0a706ff31 100644 --- a/ext/session/mod_files.h +++ b/ext/session/mod_files.h @@ -24,6 +24,6 @@ extern ps_module ps_mod_files; #define ps_files_ptr &ps_mod_files -PS_FUNCS_SID(files); +PS_FUNCS_UPDATE_TIMESTAMP(files); #endif diff --git a/ext/session/mod_files.sh b/ext/session/mod_files.sh index 4fc4f20f7f..75ac6a2fd7 100644 --- a/ext/session/mod_files.sh +++ b/ext/session/mod_files.sh @@ -1,4 +1,4 @@ -#! /bin/sh +#!/usr/bin/env bash if [[ "$2" = "" ]] || [[ "$3" = "" ]]; then echo "Usage: $0 BASE_DIRECTORY DEPTH HASH_BITS" @@ -61,5 +61,5 @@ echo "Creating session path in $directory with a depth of $depth for session.has for i in $hash_chars; do newpath="$directory/$i" mkdir $newpath || exit 1 - sh $0 $newpath `expr $depth - 1` $hashbits recurse + bash $0 $newpath `expr $depth - 1` $hashbits recurse done diff --git a/ext/session/mod_mm.c b/ext/session/mod_mm.c index 7eba7ac922..63aaf3c6f7 100644 --- a/ext/session/mod_mm.c +++ b/ext/session/mod_mm.c @@ -356,13 +356,13 @@ PS_READ_FUNC(mm) /* If there is an ID and strict mode, verify existence */ if (PS(use_strict_mode) - && ps_mm_key_exists(data, key) == FAILURE) { + && ps_mm_key_exists(data, key->val) == FAILURE) { /* key points to PS(id), but cannot change here. */ if (key) { efree(PS(id)); PS(id) = NULL; } - PS(id) = PS(mod)->s_create_sid((void **)&data, NULL); + PS(id) = PS(mod)->s_create_sid((void **)&data); if (!PS(id)) { return FAILURE; } @@ -373,12 +373,9 @@ PS_READ_FUNC(mm) PS(session_status) = php_session_active; } - sd = ps_sd_lookup(data, PS(id), 0); + sd = ps_sd_lookup(data, PS(id)->val, 0); if (sd) { - *vallen = sd->datalen; - *val = emalloc(sd->datalen + 1); - memcpy(*val, sd->data, sd->datalen); - (*val)[sd->datalen] = '\0'; + *val = zend_string_init(sd->data, sd->datalen, 0); ret = SUCCESS; } @@ -394,18 +391,18 @@ PS_WRITE_FUNC(mm) mm_lock(data->mm, MM_LOCK_RW); - sd = ps_sd_lookup(data, key, 1); + sd = ps_sd_lookup(data, key->val, 1); if (!sd) { - sd = ps_sd_new(data, key); - ps_mm_debug(("new entry for %s\n", key)); + sd = ps_sd_new(data, key->val); + ps_mm_debug(("new entry for %s\n", key->val)); } if (sd) { - if (vallen >= sd->alloclen) { + if (val->len >= sd->alloclen) { if (data->mm) { mm_free(data->mm, sd->data); } - sd->alloclen = vallen + 1; + sd->alloclen = val->len + 1; sd->data = mm_malloc(data->mm, sd->alloclen); if (!sd->data) { @@ -415,8 +412,8 @@ PS_WRITE_FUNC(mm) } } if (sd) { - sd->datalen = vallen; - memcpy(sd->data, val, vallen); + sd->datalen = val->len; + memcpy(sd->data, val->val, val->len); time(&sd->ctime); } } @@ -433,7 +430,7 @@ PS_DESTROY_FUNC(mm) mm_lock(data->mm, MM_LOCK_RW); - sd = ps_sd_lookup(data, key, 0); + sd = ps_sd_lookup(data, key->val, 0); if (sd) { ps_sd_destroy(data, sd); } @@ -478,16 +475,16 @@ PS_GC_FUNC(mm) PS_CREATE_SID_FUNC(mm) { - char *sid; + zend_string *sid; int maxfail = 3; PS_MM_DATA; do { - sid = php_session_create_id((void **)&data, newlen); + sid = php_session_create_id((void **)&data); /* Check collision */ - if (ps_mm_key_exists(data, sid) == SUCCESS) { + if (ps_mm_key_exists(data, sid->val) == SUCCESS) { if (sid) { - efree(sid); + zend_string_release(sid); sid = NULL; } if (!(maxfail--)) { diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c index 47aafc8417..89a3eca205 100644 --- a/ext/session/mod_user.c +++ b/ext/session/mod_user.c @@ -23,29 +23,9 @@ #include "mod_user.h" ps_module ps_mod_user = { - PS_MOD_SID(user) + PS_MOD_UPDATE_TIMESTAMP(user) }; -#define SESS_ZVAL_LONG(val, a) \ -{ \ - ZVAL_LONG(a, val); \ -} - -#define SESS_ZVAL_STRING(vl, a) \ -{ \ - char *__vl = vl; \ - SESS_ZVAL_STRINGN(__vl, strlen(__vl), a); \ -} - -#define SESS_ZVAL_STRINGN(vl, ln, a) \ -{ \ - ZVAL_STRINGL(a, vl, ln); \ -} - -#define SESS_ZVAL_STR(vl, a) \ -{ \ - ZVAL_STR_COPY(a, vl); \ -} static void ps_call_handler(zval *func, int argc, zval *argv, zval *retval) { @@ -102,8 +82,8 @@ PS_OPEN_FUNC(user) return FAILURE; } - SESS_ZVAL_STRING((char*)save_path, &args[0]); - SESS_ZVAL_STRING((char*)session_name, &args[1]); + ZVAL_STRING(&args[0], (char*)save_path); + ZVAL_STRING(&args[1], (char*)session_name); ps_call_handler(&PSF(open), 2, args, &retval); PS(mod_user_implemented) = 1; @@ -144,7 +124,7 @@ PS_READ_FUNC(user) zval args[1]; STDVARS; - SESS_ZVAL_STR(key, &args[0]); + ZVAL_STR_COPY(&args[0], key); ps_call_handler(&PSF(read), 1, args, &retval); @@ -164,8 +144,8 @@ PS_WRITE_FUNC(user) zval args[2]; STDVARS; - SESS_ZVAL_STR(key, &args[0]); - SESS_ZVAL_STR(val, &args[1]); + ZVAL_STR_COPY(&args[0], key); + ZVAL_STR_COPY(&args[1], val); ps_call_handler(&PSF(write), 2, args, &retval); @@ -177,7 +157,7 @@ PS_DESTROY_FUNC(user) zval args[1]; STDVARS; - SESS_ZVAL_STR(key, &args[0]); + ZVAL_STR_COPY(&args[0], key); ps_call_handler(&PSF(destroy), 1, args, &retval); @@ -189,7 +169,7 @@ PS_GC_FUNC(user) zval args[1]; STDVARS; - SESS_ZVAL_LONG(maxlifetime, &args[0]); + ZVAL_LONG(&args[0], maxlifetime); ps_call_handler(&PSF(gc), 1, args, &retval); @@ -227,6 +207,42 @@ PS_CREATE_SID_FUNC(user) return php_session_create_id(mod_data); } +PS_VALIDATE_SID_FUNC(user) +{ + /* maintain backwards compatibility */ + if (!Z_ISUNDEF(PSF(validate_sid))) { + zval args[1]; + STDVARS; + + ZVAL_STR_COPY(&args[0], key); + + ps_call_handler(&PSF(validate_sid), 1, args, &retval); + + FINISH; + } + + /* dummy function defined by PS_MOD */ + return php_session_validate_sid(mod_data, key TSRMLS_CC); +} + +PS_UPDATE_TIMESTAMP_FUNC(user) +{ + zval args[2]; + STDVARS; + + ZVAL_STR_COPY(&args[0], key); + ZVAL_STR_COPY(&args[1], val); + + /* maintain backwards compatibility */ + if (!Z_ISUNDEF(PSF(update_timestamp))) { + ps_call_handler(&PSF(update_timestamp), 2, args, &retval); + } else { + ps_call_handler(&PSF(write), 2, args, &retval); + } + + FINISH; +} + /* * Local variables: * tab-width: 4 diff --git a/ext/session/mod_user.h b/ext/session/mod_user.h index 1a315b70da..592b223c60 100644 --- a/ext/session/mod_user.h +++ b/ext/session/mod_user.h @@ -24,6 +24,6 @@ extern ps_module ps_mod_user; #define ps_user_ptr &ps_mod_user -PS_FUNCS_SID(user); +PS_FUNCS_UPDATE_TIMESTAMP(user); #endif diff --git a/ext/session/mod_user_class.c b/ext/session/mod_user_class.c index 419fd03f61..328416c02e 100644 --- a/ext/session/mod_user_class.c +++ b/ext/session/mod_user_class.c @@ -155,3 +155,37 @@ PHP_METHOD(SessionHandler, create_sid) RETURN_STR(id); } /* }}} */ + +/* {{{ proto char SessionUpdateTimestampHandler::validateId(string id) + Simply return TRUE */ +PHP_METHOD(SessionHandler, validateId) +{ + zend_string *key; + + PS_SANITY_CHECK_IS_OPEN; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &key) == FAILURE) { + return; + } + + /* Legacy save handler may not support validate_sid API. Return TRUE. */ + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool SessionUpdateTimestampHandler::updateTimestamp(string id, string data) + Simply call update_timestamp */ +PHP_METHOD(SessionHandler, updateTimestamp) +{ + zend_string *key, *val; + + PS_SANITY_CHECK_IS_OPEN; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &key, &val) == FAILURE) { + return; + } + + /* Legacy save handler may not support update_timestamp API. Just write. */ + RETVAL_BOOL(SUCCESS == PS(default_mod)->s_write(&PS(mod_data), key, val)); +} +/* }}} */ diff --git a/ext/session/php_session.h b/ext/session/php_session.h index c384b1f97b..2c3e0cf798 100644 --- a/ext/session/php_session.h +++ b/ext/session/php_session.h @@ -27,21 +27,19 @@ # include "ext/hash/php_hash.h" #endif -#define PHP_SESSION_API 20020330 - -/* To check php_session_valid_key()/php_session_reset_id() */ -#define PHP_SESSION_STRICT 1 - -#define PS_OPEN_ARGS void **mod_data, const char *save_path, const char *session_name -#define PS_CLOSE_ARGS void **mod_data -#define PS_READ_ARGS void **mod_data, zend_string *key, zend_string **val -#define PS_WRITE_ARGS void **mod_data, zend_string *key, zend_string *val -#define PS_DESTROY_ARGS void **mod_data, zend_string *key -#define PS_GC_ARGS void **mod_data, int maxlifetime, int *nrdels +#define PHP_SESSION_API 20150121 + +/* save handler macros */ +#define PS_NUM_APIS 9 +#define PS_OPEN_ARGS void **mod_data, const char *save_path, const char *session_name +#define PS_CLOSE_ARGS void **mod_data +#define PS_READ_ARGS void **mod_data, zend_string *key, zend_string **val +#define PS_WRITE_ARGS void **mod_data, zend_string *key, zend_string *val +#define PS_DESTROY_ARGS void **mod_data, zend_string *key +#define PS_GC_ARGS void **mod_data, int maxlifetime, int *nrdels #define PS_CREATE_SID_ARGS void **mod_data - -/* default create id function */ -PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS); +#define PS_VALIDATE_SID_ARGS void **mod_data, zend_string *key +#define PS_UPDATE_TIMESTAMP_ARGS void **mod_data, zend_string *key, zend_string *val typedef struct ps_module_struct { const char *s_name; @@ -52,6 +50,8 @@ typedef struct ps_module_struct { int (*s_destroy)(PS_DESTROY_ARGS); int (*s_gc)(PS_GC_ARGS); zend_string *(*s_create_sid)(PS_CREATE_SID_ARGS); + int (*s_validate_sid)(PS_VALIDATE_SID_ARGS); + int (*s_update_timestamp)(PS_UPDATE_TIMESTAMP_ARGS); } ps_module; #define PS_GET_MOD_DATA() *mod_data @@ -64,7 +64,10 @@ typedef struct ps_module_struct { #define PS_DESTROY_FUNC(x) int ps_delete_##x(PS_DESTROY_ARGS) #define PS_GC_FUNC(x) int ps_gc_##x(PS_GC_ARGS) #define PS_CREATE_SID_FUNC(x) zend_string *ps_create_sid_##x(PS_CREATE_SID_ARGS) +#define PS_VALIDATE_SID_FUNC(x) int ps_validate_sid_##x(PS_VALIDATE_SID_ARGS) +#define PS_UPDATE_TIMESTAMP_FUNC(x) int ps_update_timestamp_##x(PS_UPDATE_TIMESTAMP_ARGS) +/* Legacy save handler module definitions */ #define PS_FUNCS(x) \ PS_OPEN_FUNC(x); \ PS_CLOSE_FUNC(x); \ @@ -76,9 +79,10 @@ typedef struct ps_module_struct { #define PS_MOD(x) \ #x, ps_open_##x, ps_close_##x, ps_read_##x, ps_write_##x, \ - ps_delete_##x, ps_gc_##x, php_session_create_id + ps_delete_##x, ps_gc_##x, php_session_create_id, \ + php_session_validate_sid, php_session_update_timestamp -/* SID creation enabled module handler definitions */ +/* Legacy SID creation enabled save handler module definitions */ #define PS_FUNCS_SID(x) \ PS_OPEN_FUNC(x); \ PS_CLOSE_FUNC(x); \ @@ -86,11 +90,33 @@ typedef struct ps_module_struct { PS_WRITE_FUNC(x); \ PS_DESTROY_FUNC(x); \ PS_GC_FUNC(x); \ - PS_CREATE_SID_FUNC(x) + PS_CREATE_SID_FUNC(x); \ + PS_VALIDATE_SID_FUNC(x); \ + PS_UPDATE_TIMESTAMP_FUNC(x); #define PS_MOD_SID(x) \ #x, ps_open_##x, ps_close_##x, ps_read_##x, ps_write_##x, \ - ps_delete_##x, ps_gc_##x, ps_create_sid_##x + ps_delete_##x, ps_gc_##x, ps_create_sid_##x, \ + php_session_validate_sid, php_session_update_timestamp + +/* Update timestamp enabled save handler module definitions + New save handlers should use this API */ +#define PS_FUNCS_UPDATE_TIMESTAMP(x) \ + PS_OPEN_FUNC(x); \ + PS_CLOSE_FUNC(x); \ + PS_READ_FUNC(x); \ + PS_WRITE_FUNC(x); \ + PS_DESTROY_FUNC(x); \ + PS_GC_FUNC(x); \ + PS_CREATE_SID_FUNC(x); \ + PS_VALIDATE_SID_FUNC(x); \ + PS_UPDATE_TIMESTAMP_FUNC(x); + +#define PS_MOD_UPDATE_TIMESTAMP(x) \ + #x, ps_open_##x, ps_close_##x, ps_read_##x, ps_write_##x, \ + ps_delete_##x, ps_gc_##x, ps_create_sid_##x, \ + ps_validate_sid_##x, ps_update_timestamp_##x + typedef enum { php_session_disabled, @@ -99,7 +125,6 @@ typedef enum { } php_session_status; typedef struct _php_session_rfc1867_progress { - size_t sname_len; zval sid; smart_str key; @@ -141,7 +166,7 @@ typedef struct _php_ps_globals { int module_number; zend_long cache_expire; union { - zval names[7]; + zval names[PS_NUM_APIS]; struct { zval ps_open; zval ps_close; @@ -150,6 +175,8 @@ typedef struct _php_ps_globals { zval ps_destroy; zval ps_gc; zval ps_create_sid; + zval ps_validate_sid; + zval ps_update_timestamp; } name; } mod_user_names; int mod_user_implemented; @@ -159,8 +186,7 @@ typedef struct _php_ps_globals { zend_bool auto_start; zend_bool use_cookies; zend_bool use_only_cookies; - zend_bool use_trans_sid; /* contains the INI value of whether to use trans-sid */ - zend_bool apply_trans_sid; /* whether or not to enable trans-sid for the current request */ + zend_bool use_trans_sid; /* contains the INI value of whether to use trans-sid */ zend_long hash_func; #if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH) @@ -169,7 +195,6 @@ typedef struct _php_ps_globals { zend_long hash_bits_per_character; int send_cookie; int define_sid; - zend_bool invalid_session_id; /* allows the driver to report about an invalid session id and request id regeneration */ php_session_rfc1867_progress *rfc1867_progress; zend_bool rfc1867_enabled; /* session.upload_progress.enabled */ @@ -180,7 +205,8 @@ typedef struct _php_ps_globals { double rfc1867_min_freq; /* session.upload_progress.min_freq */ zend_bool use_strict_mode; /* whether or not PHP accepts unknown session ids */ - unsigned char session_data_hash[16]; /* binary MD5 hash length */ + zend_bool lazy_write; /* omit session write when it is possible */ + zend_string *session_vars; /* serialized original session data */ } php_ps_globals; typedef php_ps_globals zend_ps_globals; @@ -221,6 +247,12 @@ typedef struct ps_serializer_struct { #define PS_SERIALIZER_ENTRY(x) \ { #x, PS_SERIALIZER_ENCODE_NAME(x), PS_SERIALIZER_DECODE_NAME(x) } +/* default create id function */ +PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS); +/* Dummy PS module functions */ +PHPAPI int php_session_validate_sid(PS_VALIDATE_SID_ARGS); +PHPAPI int php_session_update_timestamp(PS_UPDATE_TIMESTAMP_ARGS); + PHPAPI void session_adapt_url(const char *, size_t, char **, size_t *); PHPAPI void php_add_session_var(zend_string *name); @@ -288,6 +320,9 @@ extern zend_class_entry *php_session_iface_entry; #define PS_SID_IFACE_NAME "SessionIdInterface" extern zend_class_entry *php_session_id_iface_entry; +#define PS_UPDATE_TIMESTAMP_IFACE_NAME "SessionUpdateTimestampHandlerInterface" +extern zend_class_entry *php_session_update_timestamp_iface_entry; + extern PHP_METHOD(SessionHandler, open); extern PHP_METHOD(SessionHandler, close); extern PHP_METHOD(SessionHandler, read); @@ -295,5 +330,7 @@ extern PHP_METHOD(SessionHandler, write); extern PHP_METHOD(SessionHandler, destroy); extern PHP_METHOD(SessionHandler, gc); extern PHP_METHOD(SessionHandler, create_sid); +extern PHP_METHOD(SessionHandler, validateId); +extern PHP_METHOD(SessionHandler, updateTimestamp); #endif diff --git a/ext/session/session.c b/ext/session/session.c index ab328573be..010de352b9 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -74,6 +74,12 @@ zend_class_entry *php_session_iface_entry; /* SessionIdInterface */ zend_class_entry *php_session_id_iface_entry; +/* SessionUpdateTimestampHandler class */ +zend_class_entry *php_session_update_timestamp_class_entry; + +/* SessionUpdateTimestampInterface */ +zend_class_entry *php_session_update_timestamp_iface_entry; + /* *********** * Helpers * *********** */ @@ -87,16 +93,20 @@ zend_class_entry *php_session_id_iface_entry; return FAILURE; \ } +#define APPLY_TRANS_SID (PS(use_trans_sid) && !PS(use_only_cookies)) + static void php_session_send_cookie(void); /* Dispatched by RINIT and by php_session_destroy */ static inline void php_rinit_session_globals(void) /* {{{ */ { + /* Do NOT init PS(mod_user_names) here! */ PS(id) = NULL; PS(session_status) = php_session_none; PS(mod_data) = NULL; PS(mod_user_is_open) = 0; - /* Do NOT init PS(mod_user_names) here! */ + PS(define_sid) = 1; + PS(session_vars) = NULL; ZVAL_UNDEF(&PS(http_session_vars)); } /* }}} */ @@ -104,11 +114,11 @@ static inline void php_rinit_session_globals(void) /* {{{ */ /* Dispatched by RSHUTDOWN and by php_session_destroy */ static inline void php_rshutdown_session_globals(void) /* {{{ */ { + /* Do NOT destroy PS(mod_user_names) here! */ if (!Z_ISUNDEF(PS(http_session_vars))) { zval_ptr_dtor(&PS(http_session_vars)); ZVAL_UNDEF(&PS(http_session_vars)); } - /* Do NOT destroy PS(mod_user_names) here! */ if (PS(mod_data) || PS(mod_user_implemented)) { zend_try { PS(mod)->s_close(&PS(mod_data)); @@ -117,6 +127,9 @@ static inline void php_rshutdown_session_globals(void) /* {{{ */ if (PS(id)) { zend_string_release(PS(id)); } + if (PS(session_vars)) { + zend_string_release(PS(session_vars)); + } } /* }}} */ @@ -212,16 +225,18 @@ static zend_string *php_session_encode(void) /* {{{ */ } /* }}} */ -static void php_session_decode(const char *val, int vallen) /* {{{ */ +static int php_session_decode(zend_string *data) /* {{{ */ { if (!PS(serializer)) { php_error_docref(NULL, E_WARNING, "Unknown session.serialize_handler. Failed to decode session object"); - return; + return FAILURE; } - if (PS(serializer)->decode(val, vallen) == FAILURE) { + if (PS(serializer)->decode(data->val, data->len) == FAILURE) { php_session_destroy(); php_error_docref(NULL, E_WARNING, "Failed to decode session object. Session has been destroyed"); + return FAILURE; } + return SUCCESS; } /* }}} */ @@ -286,7 +301,7 @@ PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */ void *hash_context = NULL; #endif unsigned char *digest; - int digest_len; + size_t digest_len; char *buf; struct timeval tv; zval *array; @@ -321,8 +336,8 @@ PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */ #if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH) case PS_HASH_FUNC_OTHER: if (!PS(hash_ops)) { - php_error_docref(NULL, E_ERROR, "Invalid session hash function"); efree(buf); + php_error_docref(NULL, E_ERROR, "Invalid session hash function"); return NULL; } @@ -333,8 +348,8 @@ PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */ break; #endif /* HAVE_HASH_EXT */ default: - php_error_docref(NULL, E_ERROR, "Invalid session hash function"); efree(buf); + php_error_docref(NULL, E_ERROR, "Invalid session hash function"); return NULL; } efree(buf); @@ -417,7 +432,7 @@ PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */ } outid = zend_string_alloc((digest_len + 2) * ((8.0f / PS(hash_bits_per_character) + 0.5)), 0); - outid->len = (int)(bin_to_readable((char *)digest, digest_len, outid->val, (char)PS(hash_bits_per_character)) - (char *)&outid->val); + outid->len = (size_t)(bin_to_readable((char *)digest, digest_len, outid->val, (char)PS(hash_bits_per_character)) - (char *)&outid->val); efree(digest); return outid; @@ -468,7 +483,9 @@ static void php_session_initialize(void) /* {{{ */ } /* Open session handler first */ - if (PS(mod)->s_open(&PS(mod_data), PS(save_path), PS(session_name)) == FAILURE) { + if (PS(mod)->s_open(&PS(mod_data), PS(save_path), PS(session_name)) == FAILURE + /* || PS(mod_data) == NULL */ /* FIXME: open must set valid PS(mod_data) with success */ + ) { php_error_docref(NULL, E_ERROR, "Failed to initialize storage module: %s (path: %s)", PS(mod)->s_name, PS(save_path)); return; } @@ -483,13 +500,22 @@ static void php_session_initialize(void) /* {{{ */ if (PS(use_cookies)) { PS(send_cookie) = 1; } + } else if (PS(use_strict_mode) && PS(mod)->s_validate_sid && + PS(mod)->s_validate_sid(&PS(mod_data), PS(id)) == FAILURE) { + if (PS(id)) { + zend_string_release(PS(id)); + } + PS(id) = PS(mod)->s_create_sid(&PS(mod_data)); + if (!PS(id)) { + PS(id) = php_session_create_id(NULL); + } + if (PS(use_cookies)) { + PS(send_cookie) = 1; + } } - /* Set session ID for compatibility for older/3rd party save handlers */ - if (!PS(use_strict_mode)) { - php_session_reset_id(); - PS(session_status) = php_session_active; - } + php_session_reset_id(); + PS(session_status) = php_session_active; /* Read data */ php_session_track_init(); @@ -500,48 +526,54 @@ static void php_session_initialize(void) /* {{{ */ php_error_docref(NULL, E_NOTICE, "Failed to read session data: %s (path: %s)", PS(mod)->s_name, PS(save_path)); */ } - /* Set session ID if session read didn't activated session */ - if (PS(use_strict_mode) && PS(session_status) != php_session_active) { - php_session_reset_id(); - PS(session_status) = php_session_active; + if (PS(session_vars)) { + zend_string_release(PS(session_vars)); + PS(session_vars) = NULL; } if (val) { - php_session_decode(val->val, val->len); - zend_string_release(val); - } - - if (!PS(use_cookies) && PS(send_cookie)) { - if (PS(use_trans_sid) && !PS(use_only_cookies)) { - PS(apply_trans_sid) = 1; + if (PS(lazy_write)) { + PS(session_vars) = zend_string_copy(val); } - PS(send_cookie) = 0; + php_session_decode(val); + zend_string_release(val); } } /* }}} */ -static void php_session_save_current_state(void) /* {{{ */ +static void php_session_save_current_state(int write) /* {{{ */ { int ret = FAILURE; - IF_SESSION_VARS() { - if (PS(mod_data) || PS(mod_user_implemented)) { - zend_string *val; - - val = php_session_encode(); - if (val) { - ret = PS(mod)->s_write(&PS(mod_data), PS(id), val); - zend_string_release(val); - } else { - ret = PS(mod)->s_write(&PS(mod_data), PS(id), STR_EMPTY_ALLOC()); + if (write) { + IF_SESSION_VARS() { + if (PS(mod_data) || PS(mod_user_implemented)) { + zend_string *val; + + val = php_session_encode(); + if (val) { + if (PS(lazy_write) && PS(session_vars) + && PS(mod)->s_update_timestamp + && PS(mod)->s_update_timestamp != php_session_update_timestamp + && val->len == PS(session_vars)->len + && !memcmp(val->val, PS(session_vars)->val, val->len) + ) { + ret = PS(mod)->s_update_timestamp(&PS(mod_data), PS(id), val); + } else { + ret = PS(mod)->s_write(&PS(mod_data), PS(id), val); + } + zend_string_release(val); + } else { + ret = PS(mod)->s_write(&PS(mod_data), PS(id), STR_EMPTY_ALLOC()); + } } - } - if ((ret == FAILURE) && !EG(exception)) { - php_error_docref(NULL, E_WARNING, "Failed to write session data (%s). Please " - "verify that the current setting of session.save_path " - "is correct (%s)", - PS(mod)->s_name, - PS(save_path)); + if ((ret == FAILURE) && !EG(exception)) { + php_error_docref(NULL, E_WARNING, "Failed to write session data (%s). Please " + "verify that the current setting of session.save_path " + "is correct (%s)", + PS(mod)->s_name, + PS(save_path)); + } } } @@ -786,6 +818,7 @@ PHP_INI_BEGIN() PHP_INI_ENTRY("session.use_trans_sid", "0", PHP_INI_ALL, OnUpdateTransSid) PHP_INI_ENTRY("session.hash_function", "0", PHP_INI_ALL, OnUpdateHashFunc) STD_PHP_INI_ENTRY("session.hash_bits_per_character", "4", PHP_INI_ALL, OnUpdateLong, hash_bits_per_character, php_ps_globals, ps_globals) + STD_PHP_INI_BOOLEAN("session.lazy_write", "1", PHP_INI_ALL, OnUpdateBool, lazy_write, php_ps_globals, ps_globals) /* Upload progress */ STD_PHP_INI_BOOLEAN("session.upload_progress.enabled", @@ -813,9 +846,11 @@ PS_SERIALIZER_ENCODE_FUNC(php_serialize) /* {{{ */ smart_str buf = {0}; php_serialize_data_t var_hash; - PHP_VAR_SERIALIZE_INIT(var_hash); - php_var_serialize(&buf, Z_REFVAL(PS(http_session_vars)), &var_hash); - PHP_VAR_SERIALIZE_DESTROY(var_hash); + IF_SESSION_VARS() { + PHP_VAR_SERIALIZE_INIT(var_hash); + php_var_serialize(&buf, Z_REFVAL(PS(http_session_vars)), &var_hash); + PHP_VAR_SERIALIZE_DESTROY(var_hash); + } return buf.s; } /* }}} */ @@ -829,7 +864,7 @@ PS_SERIALIZER_DECODE_FUNC(php_serialize) /* {{{ */ ZVAL_NULL(&session_vars); PHP_VAR_UNSERIALIZE_INIT(var_hash); - php_var_unserialize(&session_vars, (const unsigned char **)&val, endptr, &var_hash); + php_var_unserialize(&session_vars, (const unsigned char **)&val, (const unsigned char *)endptr, &var_hash); PHP_VAR_UNSERIALIZE_DESTROY(var_hash); if (!Z_ISUNDEF(PS(http_session_vars))) { zval_ptr_dtor(&PS(http_session_vars)); @@ -1053,7 +1088,7 @@ PHPAPI int php_session_register_serializer(const char *name, zend_string *(*enco * Storage Modules * ******************* */ -#define MAX_MODULES 10 +#define MAX_MODULES 32 #define PREDEFINED_MODULES 2 static ps_module *ps_modules[MAX_MODULES + 1] = { @@ -1077,6 +1112,17 @@ PHPAPI int php_session_register_module(ps_module *ptr) /* {{{ */ } /* }}} */ +/* Dummy PS module function */ +PHPAPI int php_session_validate_sid(PS_VALIDATE_SID_ARGS) { + return SUCCESS; +} + +/* Dummy PS module function */ +PHPAPI int php_session_update_timestamp(PS_UPDATE_TIMESTAMP_ARGS) { + return SUCCESS; +} + + /* ****************** * Cache Limiters * ****************** */ @@ -1247,8 +1293,8 @@ static void php_session_remove_cookie(void) { zend_llist_element *current; char *session_cookie; zend_string *e_session_name; - int session_cookie_len; - uint len = sizeof("Set-Cookie")-1; + size_t session_cookie_len; + size_t len = sizeof("Set-Cookie")-1; e_session_name = php_url_encode(PS(session_name), strlen(PS(session_name))); spprintf(&session_cookie, 0, "Set-Cookie: %s=", e_session_name->val); @@ -1388,19 +1434,19 @@ PHPAPI const ps_serializer *_php_find_ps_serializer(char *name) /* {{{ */ /* }}} */ static void ppid2sid(zval *ppid) { - if (Z_TYPE_P(ppid) != IS_STRING) { - PS(id) = NULL; - PS(send_cookie) = 1; - } else { - convert_to_string(ppid); + if (Z_TYPE_P(ppid) == IS_STRING) { PS(id) = zend_string_init(Z_STRVAL_P(ppid), Z_STRLEN_P(ppid), 0); PS(send_cookie) = 0; + } else { + PS(id) = NULL; + PS(send_cookie) = 1; } } PHPAPI void php_session_reset_id(void) /* {{{ */ { int module_number = PS(module_number); + zval *sid; if (!PS(id)) { php_error_docref(NULL, E_WARNING, "Cannot set session ID - session ID is not initialized"); @@ -1412,8 +1458,10 @@ PHPAPI void php_session_reset_id(void) /* {{{ */ PS(send_cookie) = 0; } - /* if the SID constant exists, destroy it. */ - zend_hash_str_del(EG(zend_constants), "sid", sizeof("sid") - 1); + /* If the SID constant exists, destroy it. */ + /* We must not delete any items in EG(zend_contants) */ + /* zend_hash_str_del(EG(zend_constants), "sid", sizeof("sid") - 1); */ + sid = zend_get_constant_str("SID", sizeof("SID") - 1); if (PS(define_sid)) { smart_str var = {0}; @@ -1422,14 +1470,24 @@ PHPAPI void php_session_reset_id(void) /* {{{ */ smart_str_appendc(&var, '='); smart_str_appends(&var, PS(id)->val); smart_str_0(&var); - REGISTER_STRINGL_CONSTANT("SID", var.s->val, var.s->len, 0); - smart_str_free(&var); + if (sid) { + zend_string_release(Z_STR_P(sid)); + ZVAL_STR(sid, var.s); + } else { + REGISTER_STRINGL_CONSTANT("SID", var.s->val, var.s->len, 0); + smart_str_free(&var); + } } else { - REGISTER_STRINGL_CONSTANT("SID", "", 0, 0); + if (sid) { + zend_string_release(Z_STR_P(sid)); + ZVAL_EMPTY_STRING(sid); + } else { + REGISTER_STRINGL_CONSTANT("SID", "", 0, 0); + } } - if (PS(apply_trans_sid)) { - php_url_scanner_reset_vars(); + if (APPLY_TRANS_SID) { + /* php_url_scanner_reset_vars(); */ php_url_scanner_add_var(PS(session_name), strlen(PS(session_name)), PS(id)->val, PS(id)->len, 1); } } @@ -1441,13 +1499,7 @@ PHPAPI void php_session_start(void) /* {{{ */ zval *data; char *p, *value; int nrand; - int lensess; - - if (PS(use_only_cookies)) { - PS(apply_trans_sid) = 0; - } else { - PS(apply_trans_sid) = PS(use_trans_sid); - } + size_t lensess; switch (PS(session_status)) { case php_session_active: @@ -1477,14 +1529,20 @@ PHPAPI void php_session_start(void) /* {{{ */ default: case php_session_none: - PS(define_sid) = 1; - PS(send_cookie) = 1; + /* Setup internal flags */ + PS(define_sid) = !PS(use_only_cookies); /* SID constant is defined when non-cookie ID is used */ + PS(send_cookie) = PS(use_cookies) || PS(use_only_cookies); } lensess = strlen(PS(session_name)); - /* Cookies are preferred, because initially - * cookie and get variables will be available. */ + /* + * Cookies are preferred, because initially cookie and get + * variables will be available. + * URL/POST session ID may be used when use_only_cookies=Off. + * session.use_strice_mode=On prevents session adoption. + * Session based file upload progress uses non-cookie ID. + */ if (!PS(id)) { if (PS(use_cookies) && (data = zend_hash_str_find(&EG(symbol_table).ht, "_COOKIE", sizeof("_COOKIE") - 1)) && @@ -1492,11 +1550,10 @@ PHPAPI void php_session_start(void) /* {{{ */ (ppid = zend_hash_str_find(Z_ARRVAL_P(data), PS(session_name), lensess)) ) { ppid2sid(ppid); - PS(apply_trans_sid) = 0; - PS(define_sid) = 0; + PS(send_cookie) = 0; } - if (!PS(use_only_cookies) && !PS(id) && + if (PS(define_sid) && !PS(id) && (data = zend_hash_str_find(&EG(symbol_table).ht, "_GET", sizeof("_GET") - 1)) && Z_TYPE_P(data) == IS_ARRAY && (ppid = zend_hash_str_find(Z_ARRVAL_P(data), PS(session_name), lensess)) @@ -1504,50 +1561,42 @@ PHPAPI void php_session_start(void) /* {{{ */ ppid2sid(ppid); } - if (!PS(use_only_cookies) && !PS(id) && + if (PS(define_sid) && !PS(id) && (data = zend_hash_str_find(&EG(symbol_table).ht, "_POST", sizeof("_POST") - 1)) && Z_TYPE_P(data) == IS_ARRAY && (ppid = zend_hash_str_find(Z_ARRVAL_P(data), PS(session_name), lensess)) ) { ppid2sid(ppid); } - } - - /* Check the REQUEST_URI symbol for a string of the form - * '<session-name>=<session-id>' to allow URLs of the form - * http://yoursite/<session-name>=<session-id>/script.php */ - if (!PS(use_only_cookies) && !PS(id) && !Z_ISUNDEF(PG(http_globals)[TRACK_VARS_SERVER]) && + /* Check the REQUEST_URI symbol for a string of the form + * '<session-name>=<session-id>' to allow URLs of the form + * http://yoursite/<session-name>=<session-id>/script.php */ + if (PS(define_sid) && !PS(id) && (data = zend_hash_str_find(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "REQUEST_URI", sizeof("REQUEST_URI") - 1)) && Z_TYPE_P(data) == IS_STRING && (p = strstr(Z_STRVAL_P(data), PS(session_name))) && p[lensess] == '=' - ) { - char *q; - - p += lensess + 1; - if ((q = strpbrk(p, "/?\\"))) { - PS(id) = zend_string_init(p, q - p, 0); - PS(send_cookie) = 0; + ) { + char *q; + p += lensess + 1; + if ((q = strpbrk(p, "/?\\"))) { + PS(id) = zend_string_init(p, q - p, 0); + } } - } - - /* Check whether the current request was referred to by - * an external site which invalidates the previously found id. */ - if (PS(id) && + /* Check whether the current request was referred to by + * an external site which invalidates the previously found id. */ + if (PS(define_sid) && PS(id) && PS(extern_referer_chk)[0] != '\0' && !Z_ISUNDEF(PG(http_globals)[TRACK_VARS_SERVER]) && (data = zend_hash_str_find(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_REFERER", sizeof("HTTP_REFERER") - 1)) && Z_TYPE_P(data) == IS_STRING && Z_STRLEN_P(data) != 0 && strstr(Z_STRVAL_P(data), PS(extern_referer_chk)) == NULL - ) { - zend_string_release(PS(id)); - PS(id) = NULL; - PS(send_cookie) = 1; - if (PS(use_trans_sid) && !PS(use_only_cookies)) { - PS(apply_trans_sid) = 1; + ) { + zend_string_release(PS(id)); + PS(id) = NULL; } } @@ -1577,11 +1626,11 @@ PHPAPI void php_session_start(void) /* {{{ */ } /* }}} */ -static void php_session_flush(void) /* {{{ */ +static void php_session_flush(int write) /* {{{ */ { if (PS(session_status) == php_session_active) { PS(session_status) = php_session_none; - php_session_save_current_state(); + php_session_save_current_state(write); } } /* }}} */ @@ -1606,10 +1655,13 @@ static void php_session_reset(void) /* {{{ */ /* }}} */ +/* This API is not used by any PHP modules including session currently. + session_adapt_url() may be used to set Session ID to target url without + starting "URL-Rewriter" output handler. */ PHPAPI void session_adapt_url(const char *url, size_t urllen, char **new, size_t *newlen) /* {{{ */ { - if (PS(apply_trans_sid) && (PS(session_status) == php_session_active)) { - *new = php_url_scanner_adapt_single_url(url, urllen, PS(session_name), PS(id)->val, newlen); + if (APPLY_TRANS_SID && (PS(session_status) == php_session_active)) { + *new = php_url_scanner_adapt_single_url(url, urllen, PS(session_name), PS(id)->val, newlen, 1); } } /* }}} */ @@ -1762,6 +1814,7 @@ static PHP_FUNCTION(session_set_save_handler) RETURN_FALSE; } + /* For compatibility reason, implemeted interface is not checked */ /* Find implemented methods - SessionHandlerInterface */ i = 0; ZEND_HASH_FOREACH_STR_KEY(&php_session_iface_entry->function_table, func_name) { @@ -1788,16 +1841,39 @@ static PHP_FUNCTION(session_set_save_handler) if (!Z_ISUNDEF(PS(mod_user_names).names[i])) { zval_ptr_dtor(&PS(mod_user_names).names[i]); } - array_init_size(&PS(mod_user_names).names[i], 2); Z_ADDREF_P(obj); add_next_index_zval(&PS(mod_user_names).names[i], obj); add_next_index_str(&PS(mod_user_names).names[i], zend_string_copy(func_name)); + } else { + if (!Z_ISUNDEF(PS(mod_user_names).names[i])) { + zval_ptr_dtor(&PS(mod_user_names).names[i]); + ZVAL_UNDEF(&PS(mod_user_names).names[i]); + } } ++i; } ZEND_HASH_FOREACH_END(); + /* Find implemented methods - SessionUpdateTimestampInterface (optional) */ + ZEND_HASH_FOREACH_STR_KEY(&php_session_update_timestamp_iface_entry->function_table, func_name) { + if ((current_mptr = zend_hash_find_ptr(&Z_OBJCE_P(obj)->function_table, func_name))) { + if (!Z_ISUNDEF(PS(mod_user_names).names[i])) { + zval_ptr_dtor(&PS(mod_user_names).names[i]); + } + array_init_size(&PS(mod_user_names).names[i], 2); + Z_ADDREF_P(obj); + add_next_index_zval(&PS(mod_user_names).names[i], obj); + add_next_index_str(&PS(mod_user_names).names[i], zend_string_copy(func_name)); + } else { + if (!Z_ISUNDEF(PS(mod_user_names).names[i])) { + zval_ptr_dtor(&PS(mod_user_names).names[i]); + ZVAL_UNDEF(&PS(mod_user_names).names[i]); + } + } + ++i; + } ZEND_HASH_FOREACH_END(); + if (register_shutdown) { /* create shutdown function */ php_shutdown_function_entry shutdown_function_entry; @@ -1818,7 +1894,7 @@ static PHP_FUNCTION(session_set_save_handler) remove_user_shutdown_function("session_shutdown", sizeof("session_shutdown") - 1); } - if (PS(mod) && PS(session_status) == php_session_none && PS(mod) != &ps_mod_user) { + if (PS(mod) && PS(session_status) != php_session_active && PS(mod) != &ps_mod_user) { ini_name = zend_string_init("session.save_handler", sizeof("session.save_handler") - 1, 0); ini_val = zend_string_init("user", sizeof("user") - 1, 0); zend_alter_ini_entry(ini_name, ini_val, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); @@ -1829,7 +1905,8 @@ static PHP_FUNCTION(session_set_save_handler) RETURN_TRUE; } - if (argc != 6 && argc != 7) { + /* Set procedural save handler functions */ + if (argc < 6 || PS_NUM_APIS < argc) { WRONG_PARAM_COUNT; } @@ -1840,7 +1917,7 @@ static PHP_FUNCTION(session_set_save_handler) /* remove shutdown function */ remove_user_shutdown_function("session_shutdown", sizeof("session_shutdown") - 1); - /* at this point argc can only be 6 or 7 */ + /* At this point argc can only be between 6 and PS_NUM_APIS */ for (i = 0; i < argc; i++) { if (!zend_is_callable(&args[i], 0, &name)) { php_error_docref(NULL, E_WARNING, "Argument %d is not a valid callback", i+1); @@ -1950,6 +2027,7 @@ static PHP_FUNCTION(session_regenerate_id) RETURN_FALSE; } zend_string_release(PS(id)); + PS(id) = NULL; } PS(id) = PS(mod)->s_create_sid(&PS(mod_data)); @@ -1965,6 +2043,47 @@ static PHP_FUNCTION(session_regenerate_id) } /* }}} */ +/* {{{ proto void session_create_id([string prefix]) + Generate new session ID. Intended for user save handlers. */ +static PHP_FUNCTION(session_create_id) +{ + zend_string *prefix = NULL, *new_id; + smart_str id = {0}; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &prefix) == FAILURE) { + return; + } + + if (prefix && prefix->len) { + if (php_session_valid_key(prefix->val) == FAILURE) { + /* E_ERROR raised for security reason. */ + php_error_docref(NULL, E_WARNING, "Prefix cannot contain special characters. Only aphanumeric, ',', '-' are allowed"); + RETURN_FALSE; + } else { + smart_str_append(&id, prefix); + } + } + + if (PS(session_status) == php_session_active) { + new_id = PS(mod)->s_create_sid(&PS(mod_data)); + } else { + new_id = php_session_create_id(NULL); + } + + if (new_id) { + smart_str_append(&id, new_id); + zend_string_release(new_id); + } else { + smart_str_free(&id); + php_error_docref(NULL, E_WARNING, "Failed to create new ID"); + RETURN_FALSE; + } + smart_str_0(&id); + RETVAL_STR(id.s); + smart_str_free(&id); +} +/* }}} */ + /* {{{ proto string session_cache_limiter([string new_cache_limiter]) Return the current cache limiter. If new_cache_limited is given, the current cache_limiter is replaced with new_cache_limiter */ static PHP_FUNCTION(session_cache_limiter) @@ -2031,33 +2150,89 @@ static PHP_FUNCTION(session_encode) Deserializes data and reinitializes the variables */ static PHP_FUNCTION(session_decode) { - char *str; - size_t str_len; + zend_string *str = NULL; - if (PS(session_status) == php_session_none) { + if (PS(session_status) != php_session_active) { + php_error_docref(NULL, E_WARNING, "Session is not active. You cannot decode session data"); RETURN_FALSE; } - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) { return; } - php_session_decode(str, str_len); - + if (php_session_decode(str) == FAILURE) { + /* FIXME: session_decode() should return FALSE */ + /* RETURN_FALSE; */ + } RETURN_TRUE; } /* }}} */ -/* {{{ proto bool session_start(void) - Begin session - reinitializes freezed variables, registers browsers etc */ +static int php_session_start_set_ini(zend_string *varname, zend_string *new_value) { + int ret; + smart_str buf ={0}; + smart_str_appends(&buf, "session"); + smart_str_appendc(&buf, '.'); + smart_str_append(&buf, varname); + smart_str_0(&buf); + ret = zend_alter_ini_entry_ex(buf.s, new_value, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0); + smart_str_free(&buf); + return ret; +} + +/* {{{ proto bool session_start([array options]) ++ Begin session */ static PHP_FUNCTION(session_start) { - /* skipping check for non-zero args for performance reasons here ?*/ + zval *options = NULL; + zval *value; + zend_ulong num_idx; + zend_string *str_idx; + int read_and_close = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|a", &options) == FAILURE) { + RETURN_FALSE; + } + + /* set options */ + if (options) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(options), num_idx, str_idx, value) { + if (str_idx) { + switch(Z_TYPE_P(value)) { + case IS_STRING: + case IS_TRUE: + case IS_FALSE: + case IS_LONG: + if (zend_string_equals_literal(str_idx, "read_and_close")) { + read_and_close = zval_get_long(value); + } else { + zend_string *val = zval_get_string(value); + if (php_session_start_set_ini(str_idx, val) == FAILURE) { + php_error_docref(NULL, E_WARNING, "Setting option '%s' failed", str_idx->val); + } + zend_string_release(val); + } + break; + default: + php_error_docref(NULL, E_WARNING, "Option(%s) value must be string, boolean or long", str_idx->val); + break; + } + } + (void) num_idx; + } ZEND_HASH_FOREACH_END(); + } + php_session_start(); if (PS(session_status) != php_session_active) { RETURN_FALSE; } + + if (read_and_close) { + php_session_flush(0); + } + RETURN_TRUE; } /* }}} */ @@ -2078,7 +2253,7 @@ static PHP_FUNCTION(session_destroy) Unset all registered variables */ static PHP_FUNCTION(session_unset) { - if (PS(session_status) == php_session_none) { + if (PS(session_status) != php_session_active) { RETURN_FALSE; } @@ -2095,7 +2270,7 @@ static PHP_FUNCTION(session_unset) Write session data and end session */ static PHP_FUNCTION(session_write_close) { - php_session_flush(); + php_session_flush(1); } /* }}} */ @@ -2155,7 +2330,7 @@ static PHP_FUNCTION(session_register_shutdown) * If the user does have a later shutdown function which needs the * session then tough luck. */ - php_session_flush(); + php_session_flush(1); php_error_docref(NULL, E_WARNING, "Unable to register session flush function"); } } @@ -2197,6 +2372,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_session_set_save_handler, 0, 0, 1) ZEND_ARG_INFO(0, destroy) ZEND_ARG_INFO(0, gc) ZEND_ARG_INFO(0, create_sid) + ZEND_ARG_INFO(0, validate_sid) + ZEND_ARG_INFO(0, update_timestamp) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_session_cache_limiter, 0, 0, 0) @@ -2242,6 +2419,15 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_session_class_create_sid, 0) ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_session_class_validateId, 0) + ZEND_ARG_INFO(0, key) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_session_class_updateTimestamp, 0) + ZEND_ARG_INFO(0, key) + ZEND_ARG_INFO(0, val) +ZEND_END_ARG_INFO() /* }}} */ /* {{{ session_functions[] @@ -2293,6 +2479,15 @@ static const zend_function_entry php_session_id_iface_functions[] = { }; /* }}} */ +/* {{{ SessionUpdateTimestampHandler functions[] + */ +static const zend_function_entry php_session_update_timestamp_iface_functions[] = { + PHP_ABSTRACT_ME(SessionUpdateTimestampHandlerInterface, validateId, arginfo_session_class_validateId) + PHP_ABSTRACT_ME(SessionUpdateTimestampHandlerInterface, updateTimestamp, arginfo_session_class_updateTimestamp) + { NULL, NULL, NULL } +}; +/* }}} */ + /* {{{ SessionHandler functions[] */ static const zend_function_entry php_session_class_functions[] = { @@ -2357,12 +2552,12 @@ static PHP_RSHUTDOWN_FUNCTION(session) /* {{{ */ int i; zend_try { - php_session_flush(); + php_session_flush(1); } zend_end_try(); php_rshutdown_session_globals(); /* this should NOT be done in php_rshutdown_session_globals() */ - for (i = 0; i < 7; i++) { + for (i = 0; i < PS_NUM_APIS; i++) { if (!Z_ISUNDEF(PS(mod_user_names).names[i])) { zval_ptr_dtor(&PS(mod_user_names).names[i]); ZVAL_UNDEF(&PS(mod_user_names).names[i]); @@ -2391,7 +2586,8 @@ static PHP_GINIT_FUNCTION(ps) /* {{{ */ ps_globals->default_mod = NULL; ps_globals->mod_user_implemented = 0; ps_globals->mod_user_is_open = 0; - for (i = 0; i < 7; i++) { + ps_globals->session_vars = NULL; + for (i = 0; i < PS_NUM_APIS; i++) { ZVAL_UNDEF(&ps_globals->mod_user_names.names[i]); } ZVAL_UNDEF(&ps_globals->http_session_vars); @@ -2424,6 +2620,10 @@ static PHP_MINIT_FUNCTION(session) /* {{{ */ php_session_id_iface_entry = zend_register_internal_class(&ce); php_session_id_iface_entry->ce_flags |= ZEND_ACC_INTERFACE; + INIT_CLASS_ENTRY(ce, PS_UPDATE_TIMESTAMP_IFACE_NAME, php_session_update_timestamp_iface_functions); + php_session_update_timestamp_iface_entry = zend_register_internal_class(&ce TSRMLS_CC); + php_session_update_timestamp_iface_entry->ce_flags |= ZEND_ACC_INTERFACE; + /* Register base class */ INIT_CLASS_ENTRY(ce, PS_CLASS_NAME, php_session_class_functions); php_session_class_entry = zend_register_internal_class(&ce); @@ -2598,7 +2798,7 @@ static void php_session_rfc1867_update(php_session_rfc1867_progress *progress, i if (Z_REFCOUNTED(progress->data)) Z_ADDREF(progress->data); zend_hash_update(Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))), progress->key.s, &progress->data); } - php_session_flush(); + php_session_flush(1); } /* }}} */ static void php_session_rfc1867_cleanup(php_session_rfc1867_progress *progress) /* {{{ */ @@ -2608,7 +2808,7 @@ static void php_session_rfc1867_cleanup(php_session_rfc1867_progress *progress) IF_SESSION_VARS() { zend_hash_del(Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))), progress->key.s); } - php_session_flush(); + php_session_flush(1); } /* }}} */ static int php_session_rfc1867_callback(unsigned int event, void *event_data, void **extra) /* {{{ */ @@ -2661,7 +2861,7 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo smart_str_appendl(&progress->key, *data->value, value_len); smart_str_0(&progress->key); - progress->apply_trans_sid = PS(use_trans_sid); + progress->apply_trans_sid = APPLY_TRANS_SID; php_session_rfc1867_early_find_sid(progress); } } @@ -2700,7 +2900,11 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo php_rinit_session(0); PS(id) = zend_string_init(Z_STRVAL(progress->sid), Z_STRLEN(progress->sid), 0); - PS(apply_trans_sid) = progress->apply_trans_sid; + if (progress->apply_trans_sid) { + /* Enable trans sid by modifying flags */ + PS(use_trans_sid) = 1; + PS(use_only_cookies) = 0; + } PS(send_cookie) = 0; } diff --git a/ext/session/tests/029.phpt b/ext/session/tests/029.phpt index ff1adbaec8..23676ecbda 100644 --- a/ext/session/tests/029.phpt +++ b/ext/session/tests/029.phpt @@ -9,9 +9,12 @@ session.cache_limiter= <?php error_reporting(E_ALL); -@session_decode("garbage data and no session started"); -@session_decode("userid|s:5:\"mazen\";chatRoom|s:1:\"1\";"); +session_decode("garbage data and no session started"); +session_decode("userid|s:5:\"mazen\";chatRoom|s:1:\"1\";"); print "I live\n"; ?> ---EXPECT-- +--EXPECTF-- +Warning: session_decode(): Session is not active. You cannot decode session data in %s on line %d + +Warning: session_decode(): Session is not active. You cannot decode session data in %s on line %d I live diff --git a/ext/session/tests/bug61470.phpt b/ext/session/tests/bug61470.phpt new file mode 100644 index 0000000000..8be1a540b5 --- /dev/null +++ b/ext/session/tests/bug61470.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #61470 (session_regenerate_id() does not create session file) +--SKIPIF-- +<?php include('skipif.inc'); ?> +--XFAIL-- +Semantecs of create id seems changed. Will be fixed soon. +--INI-- +--FILE-- +<?php +ob_start(); +ini_set('session.save_path', __DIR__); +$path = ini_get('session.save_path') . '/sess_'; +session_start(); +// starts session & creates and locks file +$file1 = $path . session_id(); +var_dump(is_file($file1)); + +session_regenerate_id(); +// starts new session, but file is not create! +$file2 = $path . session_id(); +var_dump(is_file($file2)); + +// cleanup +unlink($file1); +unlink($file2); +--EXPECT-- +bool(true); +bool(true); + diff --git a/ext/session/tests/bug67694.phpt b/ext/session/tests/bug67694.phpt index 08a296923f..bf7089f2c2 100644 --- a/ext/session/tests/bug67694.phpt +++ b/ext/session/tests/bug67694.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #67694 Regression in session_regenerate_id() +Bug #67694 Regression in session_regenerate_id() --INI-- session.save_handler = files session.name=PHPSESSID diff --git a/ext/session/tests/save_handler.inc b/ext/session/tests/save_handler.inc index d271748259..79ebaaabb0 100644 --- a/ext/session/tests/save_handler.inc +++ b/ext/session/tests/save_handler.inc @@ -20,6 +20,8 @@ function read($id) { $session_id = $id; echo "Read [${session_save_path},${id}]\n"; $session_file = "$session_save_path/".SESSION_FILE_PREFIX.$id; + // read MUST create file. Otherwise, strict mode will not work + touch($session_file); return (string) @file_get_contents($session_file); } @@ -31,7 +33,7 @@ function write($id, $session_data) { if ($fp = fopen($session_file, "w")) { $return = fwrite($fp, $session_data); fclose($fp); - return (bool)$return; + return $return === FALSE ? FALSE : TRUE; } return false; } @@ -60,5 +62,42 @@ function gc($maxlifetime) { return true; } +function create_sid() { + $id = ('PHPT-'.time()); + echo "CreateID [${id}]\n"; + return $id; +} + +function validate_sid($id) { + global $session_save_path, $name; + echo "ValidateID [${session_save_path},${id}]\n"; + $session_file = "$session_save_path/".SESSION_FILE_PREFIX.$id; + $ret = file_exists($session_file); + return $ret; +} + +function update($id, $session_data) { + global $session_save_path, $name; + echo "Update [${session_save_path},${id}]\n"; + $session_file = "$session_save_path/".SESSION_FILE_PREFIX.$id; + $ret = touch($session_file); + return $ret; +} + + +function feature() { + /* NOT IMPLEMENTED YET */ + /* TYPES: gc, create_sid, use_strict_mode, minizie_lock, lazy_write + /* VALUES: 0=unknown, 1=supported, 2=partially supported, 3=unsupported */ + return array('gc'=>0, + 'create_sid'=>1, + 'use_strict_mode'=>2, + 'minimize_lock'=>3, + 'lazy_write'=>4, + 'invalid'=>5, + 'another invalid'=>6 + ); +} + ?> diff --git a/ext/session/tests/session_basic1.phpt b/ext/session/tests/session_basic1.phpt new file mode 100644 index 0000000000..8a8f436610 --- /dev/null +++ b/ext/session/tests/session_basic1.phpt @@ -0,0 +1,72 @@ +--TEST-- +Test basic function : variation1 +--INI-- +session.use_strict_mode=0 +session.save_handler=files +session.gc_probability=1 +session.gc_divisor=1000 +session.gc_maxlifetime=300 +session.save_path= +session.name=PHPSESSID +--SKIPIF-- +<?php include('skipif.inc'); ?> +--FILE-- +<?php + +ob_start(); + +/* + * Prototype : session.use_strict_mode=0 + * Description : Test basic functionality. + * Source code : ext/session/session.c, ext/session/mod_files.c + */ + +echo "*** Testing basic session functionality : variation1 ***\n"; + +$session_id = 'testid'; +session_id($session_id); +$path = dirname(__FILE__); +var_dump(session_save_path($path)); + +echo "*** Without lazy_write ***\n"; +var_dump(session_id($session_id)); +$config = ['lazy_write'=>FALSE]; +var_dump(session_start($config)); +var_dump($config); +var_dump(session_write_close()); +var_dump(session_id()); + +echo "*** With lazy_write ***\n"; +var_dump(session_id($session_id)); +var_dump(session_start(['lazy_write'=>TRUE])); +var_dump(session_commit()); +var_dump(session_id()); + +echo "*** Cleanup ***\n"; +var_dump(session_id($session_id)); +var_dump(session_start()); +var_dump(session_destroy()); + +ob_end_flush(); +?> +--EXPECT-- +*** Testing basic session functionality : variation1 *** +string(0) "" +*** Without lazy_write *** +string(6) "testid" +bool(true) +array(1) { + ["lazy_write"]=> + bool(false) +} +NULL +string(6) "testid" +*** With lazy_write *** +string(6) "testid" +bool(true) +NULL +string(6) "testid" +*** Cleanup *** +string(6) "testid" +bool(true) +bool(true) diff --git a/ext/session/tests/session_basic2.phpt b/ext/session/tests/session_basic2.phpt new file mode 100644 index 0000000000..179b82971e --- /dev/null +++ b/ext/session/tests/session_basic2.phpt @@ -0,0 +1,83 @@ +--TEST-- +Test basic function : variation2 +--INI-- +session.use_strict_mode=1 +session.save_handler=files +session.hash_bits_per_character=4 +session.hash_function=0 +session.gc_probability=1 +session.gc_divisor=1000 +session.gc_maxlifetime=300 +session.save_path= +session.name=PHPSESSID +--SKIPIF-- +<?php include('skipif.inc'); ?> +--FILE-- +<?php + +ob_start(); + +/* + * Prototype : session.use_strict_mode=1 + * Description : Test basic functionality. + * Source code : ext/session/session.c, ext/session/mod_files.c + */ + +echo "*** Testing basic session functionality : variation2 ***\n"; + +$session_id = 'testid'; +session_id($session_id); +$path = dirname(__FILE__); +var_dump(session_save_path($path)); + +echo "*** Without lazy_write ***\n"; +var_dump(session_id($session_id)); +var_dump(session_start(['lazy_write'=>FALSE])); +$session_id_new1 = session_id(); +var_dump($session_id_new1 !== $session_id); +var_dump(session_write_close()); +var_dump(session_id()); + +echo "*** With lazy_write ***\n"; +var_dump(session_id($session_id)); +var_dump(session_start(['lazy_write'=>TRUE])); +$session_id_new2 = session_id(); +var_dump($session_id_new1 !== $session_id_new2); +var_dump(session_commit()); +var_dump(session_id()); + +echo "*** Cleanup ***\n"; +ini_set('session.use_strict_mode',0); +var_dump(session_id($session_id_new1)); +var_dump(session_start()); +var_dump(session_destroy()); +var_dump(session_id($session_id_new2)); +var_dump(session_start()); +var_dump(session_destroy()); + +ob_end_flush(); +?> +--EXPECTF-- +*** Testing basic session functionality : variation2 *** +string(0) "" +*** Without lazy_write *** +string(6) "testid" +bool(true) +bool(true) +NULL +string(32) "%s" +*** With lazy_write *** +string(32) "%s" +bool(true) +bool(true) +NULL +string(32) "%s" +*** Cleanup *** +string(32) "%s" +bool(true) +bool(true) +string(0) "" +bool(true) +bool(true) + + diff --git a/ext/session/tests/session_basic3.phpt b/ext/session/tests/session_basic3.phpt new file mode 100644 index 0000000000..08e3aae295 --- /dev/null +++ b/ext/session/tests/session_basic3.phpt @@ -0,0 +1,248 @@ +--TEST-- +Test basic function : variation3 use_trans_sid +--INI-- +session.use_strict_mode=0 +session.use_only_cookies=0 +session.use_trans_sid=1 +session.save_handler=files +session.hash_bits_per_character=4 +session.hash_function=0 +session.gc_probability=1 +session.gc_divisor=1000 +session.gc_maxlifetime=300 +session.save_path= +session.name=PHPSESSID +--XFAIL-- +Waiting url_scanner_ex.re fix. https://bugs.php.net/bug.php?id=68970 +--SKIPIF-- +<?php include('skipif.inc'); ?> +--FILE-- +<?php + +ob_start(); + +/* + * Prototype : session.use_trans_sid=1 + * Description : Test basic functionality. + * Source code : ext/session/session.c + */ + +echo "*** Testing basic session functionality : variation3 use_trans_sid ***\n"; + +/* +echo "*** test output_add_rewrite_var() ***\n"; +output_add_rewrite_var('var', 'value'); +echo ' +<a href="/">test</a> +<a href="/#bar">test</a> +<a href="/?foo">test</a> +<a href="/?foo#bar">test</a> +<a href="/?foo=var">test</a> +<a href="/?foo=var#bar">test</a> +<a href="file.php">test</a> +<a href="file.php?foo">test</a> +<a href="file.php?foo=var">test</a> +<a href="http://php.net">test</a> +<a href="http://php.net/">test</a> +<a href="http://php.net/#bar">test</a> +<a href="http://php.net/?foo">test</a> +<a href="http://php.net/?foo#bar">test</a> +<a href="http://php.net/?foo=var">test</a> +<a href="http://php.net/?foo=var#bar">test</a> +<a href="http://php.net/file.php">test</a> +<a href="http://php.net/file.php#bar">test</a> +<a href="http://php.net/file.php?foo">test</a> +<a href="http://php.net/file.php?foo#bar">test</a> +<a href="http://php.net/file.php?foo=var">test</a> +<a href="http://php.net/file.php?foo=var#bar">test</a> +<a href="http://php.net/some/path/file.php">test</a> +<a href="http://php.net/some/path/file.php?foo">test</a> +<a href="http://php.net/some/path/file.php?foo=var">test</a> +<a href="http://php.net/some/path/file.php?foo=var#bar">test</a> +<a href="https://php.net">test</a> +<a href="https://php.net/">test</a> +<a href="https://php.net/?foo=var#bar">test</a> +<a href="https://php.net/file.php">test</a> +<a href="https://php.net/file.php?foo=var#bar">test</a> +<a href="https://php.net/some/path/file.php">test</a> +<a href="https://php.net/some/path/file.php?foo=var#bar">test</a> +<a href="https://php.net:8443">test</a> +<a href="https://php.net:8443/">test</a> +<a href="https://php.net:8443/?foo=var#bar">test</a> +<a href="https://php.net:8443/file.php">test</a> +<a href="https://php.net:8443/file.php?foo=var#bar">test</a> +<a href="https://php.net:8443/some/path/file.php">test</a> +<a href="https://php.net:8443/some/path/file.php?foo=var#bar">test</a> +<a href="//php.net">test</a> +<a href="//php.net/">test</a> +<a href="//php.net/#bar">test</a> +<a href="//php.net/?foo">test</a> +<a href="//php.net/?foo#bar">test</a> +<a href="//php.net/?foo=var">test</a> +<a href="//php.net/?foo=var#bar">test</a> +<a href="//php.net/file.php">test</a> +<a href="//php.net/file.php#bar">test</a> +<a href="//php.net/file.php?foo">test</a> +<a href="//php.net/file.php?foo#bar">test</a> +<a href="//php.net/file.php?foo=var">test</a> +<a href="//php.net/file.php?foo=var#bar">test</a> +<a href="//php.net/some/path/file.php">test</a> +<a href="//php.net/some/path/file.php?foo">test</a> +<a href="//php.net/some/path/file.php?foo=var">test</a> +<a href="//php.net/some/path/file.php?foo=var#bar">test</a> +<form action="script.php" method="post"> + <input type="text" name="test1"></input> + <input type="text" name="test2" /> +</form> +'; +output_reset_rewrite_vars(); +*/ + +echo "*** Test trans sid ***\n"; +ob_start(); +$session_id = 'testid'; +session_id($session_id); +session_start(); +// Should add session ID to relative URL only for SECURITY +echo ' +<a href="/">test</a> +<a href="/#bar">test</a> +<a href="/?foo">test</a> +<a href="/?foo#bar">test</a> +<a href="/?foo=var">test</a> +<a href="/?foo=var#bar">test</a> +<a href="file.php">test</a> +<a href="file.php?foo">test</a> +<a href="file.php?foo=var">test</a> +<a href="http://php.net">test</a> +<a href="http://php.net/">test</a> +<a href="http://php.net/#bar">test</a> +<a href="http://php.net/?foo">test</a> +<a href="http://php.net/?foo#bar">test</a> +<a href="http://php.net/?foo=var">test</a> +<a href="http://php.net/?foo=var#bar">test</a> +<a href="http://php.net/file.php">test</a> +<a href="http://php.net/file.php#bar">test</a> +<a href="http://php.net/file.php?foo">test</a> +<a href="http://php.net/file.php?foo#bar">test</a> +<a href="http://php.net/file.php?foo=var">test</a> +<a href="http://php.net/file.php?foo=var#bar">test</a> +<a href="http://php.net/some/path/file.php">test</a> +<a href="http://php.net/some/path/file.php?foo">test</a> +<a href="http://php.net/some/path/file.php?foo=var">test</a> +<a href="http://php.net/some/path/file.php?foo=var#bar">test</a> +<a href="https://php.net">test</a> +<a href="https://php.net/">test</a> +<a href="https://php.net/?foo=var#bar">test</a> +<a href="https://php.net/file.php">test</a> +<a href="https://php.net/file.php?foo=var#bar">test</a> +<a href="https://php.net/some/path/file.php">test</a> +<a href="https://php.net/some/path/file.php?foo=var#bar">test</a> +<a href="https://php.net:8443">test</a> +<a href="https://php.net:8443/">test</a> +<a href="https://php.net:8443/?foo=var#bar">test</a> +<a href="https://php.net:8443/file.php">test</a> +<a href="https://php.net:8443/file.php?foo=var#bar">test</a> +<a href="https://php.net:8443/some/path/file.php">test</a> +<a href="https://php.net:8443/some/path/file.php?foo=var#bar">test</a> +<a href="//php.net">test</a> +<a href="//php.net/">test</a> +<a href="//php.net/#bar">test</a> +<a href="//php.net/?foo">test</a> +<a href="//php.net/?foo#bar">test</a> +<a href="//php.net/?foo=var">test</a> +<a href="//php.net/?foo=var#bar">test</a> +<a href="//php.net/file.php">test</a> +<a href="//php.net/file.php#bar">test</a> +<a href="//php.net/file.php?foo">test</a> +<a href="//php.net/file.php?foo#bar">test</a> +<a href="//php.net/file.php?foo=var">test</a> +<a href="//php.net/file.php?foo=var#bar">test</a> +<a href="//php.net/some/path/file.php">test</a> +<a href="//php.net/some/path/file.php?foo">test</a> +<a href="//php.net/some/path/file.php?foo=var">test</a> +<a href="//php.net/some/path/file.php?foo=var#bar">test</a> +<form action="script.php" method="post"> + <input type="text" name="test1"></input> + <input type="text" name="test2" /> +</form> +'; +var_dump(session_commit()); + +echo "*** Cleanup ***\n"; +var_dump(session_start()); +var_dump(session_id()); +var_dump(session_destroy()); + +ob_end_flush(); +?> +--EXPECT-- +*** Testing basic session functionality : variation3 use_trans_sid *** +*** Test trans sid *** + +<a href="/?PHPSESSID=testid&PHPSESSID=testid">test</a> +<a href="/?PHPSESSID=testid&PHPSESSID=testid#bar">test</a> +<a href="/?foo&PHPSESSID=testid&PHPSESSID=testid">test</a> +<a href="/?foo&PHPSESSID=testid&PHPSESSID=testid#bar">test</a> +<a href="/?foo=var&PHPSESSID=testid&PHPSESSID=testid">test</a> +<a href="/?foo=var&PHPSESSID=testid&PHPSESSID=testid#bar">test</a> +<a href="file.php?PHPSESSID=testid&PHPSESSID=testid">test</a> +<a href="file.php?foo&PHPSESSID=testid&PHPSESSID=testid">test</a> +<a href="file.php?foo=var&PHPSESSID=testid&PHPSESSID=testid">test</a> +<a href="http://php.net">test</a> +<a href="http://php.net/">test</a> +<a href="http://php.net/#bar">test</a> +<a href="http://php.net/?foo">test</a> +<a href="http://php.net/?foo#bar">test</a> +<a href="http://php.net/?foo=var">test</a> +<a href="http://php.net/?foo=var#bar">test</a> +<a href="http://php.net/file.php">test</a> +<a href="http://php.net/file.php#bar">test</a> +<a href="http://php.net/file.php?foo">test</a> +<a href="http://php.net/file.php?foo#bar">test</a> +<a href="http://php.net/file.php?foo=var">test</a> +<a href="http://php.net/file.php?foo=var#bar">test</a> +<a href="http://php.net/some/path/file.php">test</a> +<a href="http://php.net/some/path/file.php?foo">test</a> +<a href="http://php.net/some/path/file.php?foo=var">test</a> +<a href="http://php.net/some/path/file.php?foo=var#bar">test</a> +<a href="https://php.net">test</a> +<a href="https://php.net/">test</a> +<a href="https://php.net/?foo=var#bar">test</a> +<a href="https://php.net/file.php">test</a> +<a href="https://php.net/file.php?foo=var#bar">test</a> +<a href="https://php.net/some/path/file.php">test</a> +<a href="https://php.net/some/path/file.php?foo=var#bar">test</a> +<a href="https://php.net:8443">test</a> +<a href="https://php.net:8443/">test</a> +<a href="https://php.net:8443/?foo=var#bar">test</a> +<a href="https://php.net:8443/file.php">test</a> +<a href="https://php.net:8443/file.php?foo=var#bar">test</a> +<a href="https://php.net:8443/some/path/file.php">test</a> +<a href="https://php.net:8443/some/path/file.php?foo=var#bar">test</a> +<a href="//php.net">test</a> +<a href="//php.net/">test</a> +<a href="//php.net/#bar">test</a> +<a href="//php.net/?foo">test</a> +<a href="//php.net/?foo#bar">test</a> +<a href="//php.net/?foo=var">test</a> +<a href="//php.net/?foo=var#bar">test</a> +<a href="//php.net/file.php">test</a> +<a href="//php.net/file.php#bar">test</a> +<a href="//php.net/file.php?foo">test</a> +<a href="//php.net/file.php?foo#bar">test</a> +<a href="//php.net/file.php?foo=var">test</a> +<a href="//php.net/file.php?foo=var#bar">test</a> +<a href="//php.net/some/path/file.php">test</a> +<a href="//php.net/some/path/file.php?foo">test</a> +<a href="//php.net/some/path/file.php?foo=var">test</a> +<a href="//php.net/some/path/file.php?foo=var#bar">test</a> +<form action="script.php" method="post"><input type="hidden" name="PHPSESSID" value="testid" /><input type="hidden" name="PHPSESSID" value="testid" /> + <input type="text" name="test1"></input> + <input type="text" name="test2" /> +</form> +NULL +*** Cleanup *** +bool(true) +string(6) "testid" +bool(true)
\ No newline at end of file diff --git a/ext/session/tests/session_commit_variation3.phpt b/ext/session/tests/session_commit_variation3.phpt index 4cee2f4d58..998e60340f 100644 --- a/ext/session/tests/session_commit_variation3.phpt +++ b/ext/session/tests/session_commit_variation3.phpt @@ -1,5 +1,5 @@ --TEST-- -Test session_start() function : variation +Test session_commit() function : variation --SKIPIF-- <?php include('skipif.inc'); ?> --INI-- diff --git a/ext/session/tests/session_commit_variation4.phpt b/ext/session/tests/session_commit_variation4.phpt index 69854a6cf9..fdc4ca5186 100644 --- a/ext/session/tests/session_commit_variation4.phpt +++ b/ext/session/tests/session_commit_variation4.phpt @@ -9,20 +9,22 @@ session.use_strict_mode=0 ob_start(); -/* +/* * Prototype : bool session_commit(void) * Description : Write session data and end session - * Source code : ext/session/session.c + * Source code : ext/session/session.c */ echo "*** Testing session_commit() : variation ***\n"; +var_dump(ini_get('session.use_strict_mode')); var_dump(session_id("test")); var_dump(session_start()); var_dump(session_id()); var_dump(session_commit()); var_dump(session_id()); var_dump(session_start()); +var_dump(ini_get('session.use_strict_mode')); var_dump(session_id()); var_dump(session_commit()); var_dump(session_id()); @@ -32,18 +34,21 @@ var_dump(session_commit()); var_dump(session_id()); var_dump(session_start()); var_dump(session_destroy()); +var_dump(ini_get('session.use_strict_mode')); echo "Done"; ob_end_flush(); ?> --EXPECTF-- *** Testing session_commit() : variation *** +string(1) "0" string(0) "" bool(true) string(4) "test" NULL string(4) "test" bool(true) +string(1) "0" string(4) "test" NULL string(4) "test" @@ -53,5 +58,6 @@ NULL string(4) "test" bool(true) bool(true) +string(1) "0" Done diff --git a/ext/session/tests/session_commit_variation5.phpt b/ext/session/tests/session_commit_variation5.phpt new file mode 100644 index 0000000000..62bd1c1511 --- /dev/null +++ b/ext/session/tests/session_commit_variation5.phpt @@ -0,0 +1,70 @@ +--TEST-- +Test session_commit() function : variation +--SKIPIF-- +<?php include('skipif.inc'); ?> +--INI-- +session.use_strict_mode=0 +--FILE-- +<?php + +ob_start(); + +/* + * Prototype : bool session_commit(void) + * Description : Write session data and end session + * Source code : ext/session/session.c + */ + +echo "*** Testing session_commit() : variation ***\n"; + +$id = md5(uniqid()); +var_dump(session_id($id)); +var_dump(session_start()); +var_dump(session_id()); +var_dump($id === session_id()); +var_dump(session_commit()); +var_dump($id === session_id()); +var_dump(session_id()); +var_dump(session_start()); +var_dump($id === session_id()); +var_dump(session_id()); +var_dump(session_commit()); +var_dump($id === session_id()); +var_dump(session_id()); +var_dump(session_start()); +var_dump($id === session_id()); +var_dump(session_id()); +var_dump(session_commit()); +var_dump($id === session_id()); +var_dump(session_id()); +var_dump(session_start()); +var_dump(session_destroy()); + +echo "Done"; +ob_end_flush(); +?> +--EXPECTF-- +*** Testing session_commit() : variation *** +string(0) "" +bool(true) +string(32) "%s" +bool(true) +NULL +bool(true) +string(32) "%s" +bool(true) +bool(true) +string(32) "%s" +NULL +bool(true) +string(32) "%s" +bool(true) +bool(true) +string(32) "%s" +NULL +bool(true) +string(32) "%s" +bool(true) +bool(true) +Done + diff --git a/ext/session/tests/session_decode_variation3.phpt b/ext/session/tests/session_decode_variation3.phpt index 4a6f768713..3557efa46d 100644 --- a/ext/session/tests/session_decode_variation3.phpt +++ b/ext/session/tests/session_decode_variation3.phpt @@ -48,8 +48,8 @@ array(3) { float(123.456) } -Warning: session_decode(): Unknown session.serialize_handler. Failed to decode session object in %s on line %d -bool(true) +Warning: session_decode(): Session is not active. You cannot decode session data in %s on line %d +bool(false) array(3) { ["foo"]=> int(1234567890) diff --git a/ext/session/tests/session_regenerate_id_fastshutdown.phpt b/ext/session/tests/session_regenerate_id_fastshutdown.phpt new file mode 100644 index 0000000000..961965fb74 --- /dev/null +++ b/ext/session/tests/session_regenerate_id_fastshutdown.phpt @@ -0,0 +1,14 @@ +--TEST-- +Test session_regenerate_id() function : basic functionality +--SKIPIF-- +<?php include('skipif.inc'); ?> +--INI-- +opcache.fast_shutdown=1 +--FILE-- +<?php +session_start(); +define ("user", "foo"); +var_dump(session_regenerate_id()); +?> +--EXPECT-- +bool(true) diff --git a/ext/session/tests/session_set_save_handler_basic.phpt b/ext/session/tests/session_set_save_handler_basic.phpt index e8496e8afb..5342acc92d 100644 --- a/ext/session/tests/session_set_save_handler_basic.phpt +++ b/ext/session/tests/session_set_save_handler_basic.phpt @@ -29,6 +29,7 @@ session_save_path($path); session_set_save_handler("open", "close", "read", "write", "destroy", "gc"); session_start(); +$session_id = session_id(); $_SESSION["Blah"] = "Hello World!"; $_SESSION["Foo"] = FALSE; $_SESSION["Guff"] = 1234567890; @@ -46,6 +47,11 @@ var_dump($_SESSION); $_SESSION['Bar'] = 'Foo'; session_write_close(); +echo "Cleanup..\n"; +session_id($session_id); +session_start(); +session_destroy(); + ob_end_flush(); ?> --EXPECTF-- @@ -94,3 +100,8 @@ array(3) { } Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;Bar|s:3:"Foo";] Close [%s,PHPSESSID] +Cleanup.. +Open [%s,PHPSESSID] +Read [%s,%s] +Destroy [%s,%s] +Close [%s,PHPSESSID] diff --git a/ext/session/tests/session_set_save_handler_class_001.phpt b/ext/session/tests/session_set_save_handler_class_001.phpt index 83e899a2bc..f1656c3b5b 100644 --- a/ext/session/tests/session_set_save_handler_class_001.phpt +++ b/ext/session/tests/session_set_save_handler_class_001.phpt @@ -1,6 +1,7 @@ --TEST-- Test session_set_save_handler() : basic class wrapping existing handler --INI-- +session.use_strict_mode=1 session.save_handler=files session.name=PHPSESSID --SKIPIF-- @@ -25,11 +26,51 @@ class MySession extends SessionHandler { echo 'Open ', session_id(), "\n"; return parent::open($path, $name); } + public function create_sid() { + // This method should be removed when 5.5 become unsupported. + ++$this->i; + echo 'Old Create SID ', session_id(), "\n"; + return parent::create_sid(); + } public function read($key) { ++$this->i; echo 'Read ', session_id(), "\n"; return parent::read($key); } + public function write($key, $data) { + ++$this->i; + echo 'Write ', session_id(), "\n"; + return parent::write($key, $data); + } + public function close() { + ++$this->i; + echo 'Close ', session_id(), "\n"; + return parent::close(); + } + public function createSid() { + // User should use this rather than create_sid() + // If both create_sid() and createSid() exists, + // createSid() is used. + ++$this->i; + echo 'New Create ID ', session_id(), "\n"; + return parent::create_sid(); + } + public function validateId($key) { + ++$this->i; + echo 'Validate ID ', session_id(), "\n"; + return TRUE; + // User must implement their own method and + // cannot call parent as follows. + // return parent::validateSid($key); + } + public function updateTimestamp($key, $data) { + ++$this->i; + echo 'Update Timestamp ', session_id(), "\n"; + return parent::write($key, $data); + // User must implement their own method and + // cannot call parent as follows + // return parent::updateTimestamp($key, $data); + } } $oldHandler = ini_get('session.save_handler'); @@ -49,20 +90,28 @@ var_dump($_SESSION); session_write_close(); session_unset(); +var_dump($handler->i); --EXPECTF-- *** Testing session_set_save_handler() : basic class wrapping existing handler *** Open +Old Create SID Read %s string(%d) "%s" string(5) "files" string(4) "user" -int(2) +int(3) array(0) { } +Write %s +Close %s Open %s +Validate ID %s Read %s array(1) { ["foo"]=> string(5) "hello" } +Update Timestamp %s +Close %s +int(10) diff --git a/ext/session/tests/session_set_save_handler_class_018.phpt b/ext/session/tests/session_set_save_handler_class_018.phpt new file mode 100644 index 0000000000..7ff06e38cb --- /dev/null +++ b/ext/session/tests/session_set_save_handler_class_018.phpt @@ -0,0 +1,94 @@ +--TEST-- +Test session_set_save_handler() function: class with validate_sid +--INI-- +session.save_handler=files +session.name=PHPSESSID +--SKIPIF-- +<?php include('skipif.inc'); ?> +--FILE-- +<?php + +ob_start(); + +/* + * Prototype : bool session_set_save_handler(SessionHandlerInterface $handler [, bool $register_shutdown_function = true]) + * Description : Sets user-level session storage functions + * Source code : ext/session/session.c + */ + +echo "*** Testing session_set_save_handler() function: class with validate_sid ***\n"; + +class MySession2 extends SessionHandler { + public $path; + + public function open($path, $name) { + if (!$path) { + $path = sys_get_temp_dir(); + } + $this->path = $path . '/u_sess_' . $name; + return true; + } + + public function close() { + return true; + } + + public function read($id) { + return @file_get_contents($this->path . $id); + } + + public function write($id, $data) { + return file_put_contents($this->path . $id, $data)===FALSE ? FALSE : TRUE ; + } + + public function destroy($id) { + @unlink($this->path . $id); + } + + public function gc($maxlifetime) { + foreach (glob($this->path . '*') as $filename) { + if (filemtime($filename) + $maxlifetime < time()) { + @unlink($filename); + } + } + return true; + } + + public function create_sid() { + return 'my_sid'; + } + + public function validate_sid($id) { + return 'my_sid'===$id; + } +} + +$handler = new MySession2; +session_set_save_handler($handler); +session_start(); + +$_SESSION['foo'] = "hello"; + +var_dump(session_id(), ini_get('session.save_handler'), $_SESSION); + +session_write_close(); +session_unset(); + +session_start(); +var_dump($_SESSION); + +session_write_close(); +session_unset(); + +--EXPECTF-- +*** Testing session_set_save_handler() function: class with validate_sid *** +string(%d) "my_sid" +string(4) "user" +array(1) { + ["foo"]=> + string(5) "hello" +} +array(1) { + ["foo"]=> + string(5) "hello" +} diff --git a/ext/session/tests/session_set_save_handler_variation4.phpt b/ext/session/tests/session_set_save_handler_variation4.phpt index c34eb9cd9f..56b8a67f2a 100644 --- a/ext/session/tests/session_set_save_handler_variation4.phpt +++ b/ext/session/tests/session_set_save_handler_variation4.phpt @@ -23,7 +23,7 @@ echo "*** Testing session_set_save_handler() : variation ***\n"; function noisy_gc($maxlifetime) { echo("GC [".$maxlifetime."]\n"); - gc($maxlifetime); + echo gc($maxlifetime)." deleted\n"; return true; } @@ -54,6 +54,7 @@ ob_end_flush(); Open [%s,PHPSESSID] Read [%s,%s] GC [0] +1 deleted array(3) { ["Blah"]=> string(12) "Hello World!" @@ -68,6 +69,7 @@ NULL Open [%s,PHPSESSID] Read [%s,%s] GC [0] +1 deleted array(3) { ["Blah"]=> string(12) "Hello World!" diff --git a/ext/session/tests/session_set_save_handler_variation5.phpt b/ext/session/tests/session_set_save_handler_variation5.phpt new file mode 100644 index 0000000000..c721e2a46d --- /dev/null +++ b/ext/session/tests/session_set_save_handler_variation5.phpt @@ -0,0 +1,99 @@ +--TEST-- +Test session_set_save_handler() function : variation +--INI-- +session.use_strict_mode=1 +session.gc_probability=1 +session.gc_divisor=1 +session.gc_maxlifetime=0 +session.save_path= +session.name=PHPSESSID +--SKIPIF-- +<?php include('skipif.inc'); ?> +--FILE-- +<?php + +ob_start(); + +/* + * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc) + * Description : Sets user-level session storage functions with validate_id() and update() + * Source code : ext/session/session.c + */ + +function noisy_gc($maxlifetime) { + echo("GC [".$maxlifetime."]\n"); + echo gc($maxlifetime)." deleted\n"; + return true; +} + +echo "*** Testing session_set_save_handler() : variation ***\n"; + +require_once "save_handler.inc"; +$path = dirname(__FILE__); +var_dump(session_save_path($path)); + +echo "*** Without lazy_write ***\n"; +var_dump(session_set_save_handler("open", "close", "read", "write", "destroy", "noisy_gc", "create_sid", "validate_sid", "update")); +var_dump(session_start(['lazy_write'=>FALSE])); +$session_id = session_id(); +var_dump(session_id()); +var_dump(session_write_close()); +var_dump(session_id()); + +echo "*** With lazy_write ***\n"; +var_dump(session_id($session_id)); +var_dump(session_set_save_handler("open", "close", "read", "write", "destroy", "noisy_gc", "create_sid", "validate_sid", "update")); +var_dump(session_start(['lazy_write'=>TRUE])); +var_dump(session_commit()); +var_dump(session_id()); + +echo "*** Cleanup ***\n"; +var_dump(session_id($session_id)); +var_dump(session_start()); +var_dump(session_destroy()); + +ob_end_flush(); +?> +--EXPECTF-- +*** Testing session_set_save_handler() : variation *** + +string(0) "" +*** Without lazy_write *** +bool(true) +Open [%s,PHPSESSID] +CreateID [PHPT-%d] +Read [%s,PHPT-%d] +GC [0] +1 deleted +bool(true) +string(%d) "PHPT-%d" +Write [%s,PHPT-%d,] +Close [%s,PHPSESSID] +NULL +string(%d) "PHPT-%d" +*** With lazy_write *** +string(%d) "PHPT-%d" +bool(true) +Open [%s,PHPSESSID] +ValidateID [%s,PHPT-%d] +Read [%s,PHPT-%d] +GC [0] +1 deleted +bool(true) +Write [%s,PHPT-%d,] +Close [%s,PHPSESSID] +NULL +string(%d) "PHPT-%d" +*** Cleanup *** +string(%d) "PHPT-%d" +Open [%s,PHPSESSID] +ValidateID [%s,PHPT-%d] +Read [%s,PHPT-%d] +GC [0] +1 deleted +bool(true) +Destroy [%s,PHPT-%d] + +Warning: unlink(%s/session_test_PHPT-%s): No such file or directory in %s/save_handler.inc on line %d +Close [%s,PHPSESSID] +bool(true) diff --git a/ext/session/tests/session_set_save_handler_write_short_circuit.phpt b/ext/session/tests/session_set_save_handler_variation6.phpt index 08da29a8fd..3b4fe1ddf9 100644 --- a/ext/session/tests/session_set_save_handler_write_short_circuit.phpt +++ b/ext/session/tests/session_set_save_handler_variation6.phpt @@ -1,11 +1,11 @@ --TEST-- -Test session_set_save_handler() function : test write short circuit +Test session_set_save_handler() function : test lazy_write --INI-- +session.lazy_write=1 session.save_path= session.name=PHPSESSID --SKIPIF-- <?php include('skipif.inc'); ?> -skip - Waiting RFC patch merge --FILE-- <?php @@ -22,7 +22,7 @@ echo "*** Testing session_set_save_handler() : test write short circuit ***\n"; require_once "save_handler.inc"; $path = dirname(__FILE__); session_save_path($path); -session_set_save_handler("open", "close", "read", "write", "destroy", "gc"); +session_set_save_handler("open", "close", "read", "write", "destroy", "gc", "create_sid", "validate_sid", "update"); session_start(); $session_id = session_id(); @@ -37,7 +37,7 @@ var_dump($_SESSION); echo "Starting session again..!\n"; session_id($session_id); -session_set_save_handler("open", "close", "read", "write", "destroy", "gc"); +session_set_save_handler("open", "close", "read", "write", "destroy", "gc", "create_sid", "validate_sid", "update"); session_start(); var_dump($_SESSION); $_SESSION['Bar'] = 'Foo'; @@ -45,18 +45,23 @@ session_write_close(); echo "Starting session again..!\n"; session_id($session_id); -session_set_save_handler("open", "close", "read", "write", "destroy", "gc"); +session_set_save_handler("open", "close", "read", "write", "destroy", "gc", "create_sid", "validate_sid", "update"); session_start(); var_dump($_SESSION); // $_SESSION should be the same and should skip write() session_write_close(); +echo "Cleanup\n"; +session_start(); +session_destroy(); + ob_end_flush(); ?> --EXPECTF-- *** Testing session_set_save_handler() : test write short circuit *** Open [%s,PHPSESSID] +CreateID [PHPT-%s] Read [%s,%s] array(3) { ["Blah"]=> @@ -102,4 +107,10 @@ array(4) { ["Bar"]=> string(3) "Foo" } -Close [%s,PHPSESSID]
\ No newline at end of file +Update [%s,PHPT-%d] +Close [%s,PHPSESSID] +Cleanup +Open [%s,PHPSESSID] +Read [%s,PHPT-%d] +Destroy [%s,PHPT-%d] +Close [%s,PHPSESSID] diff --git a/ext/session/tests/session_start_error.phpt b/ext/session/tests/session_start_error.phpt index 8cbf42c860..5a0bcefc2a 100644 --- a/ext/session/tests/session_start_error.phpt +++ b/ext/session/tests/session_start_error.phpt @@ -97,99 +97,194 @@ ob_end_flush(); *** Testing session_start() : error functionality *** -- Iteration 1 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 2 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 3 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 4 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, integer given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 5 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, float given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 6 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, float given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 7 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, float given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 8 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, float given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 9 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, float given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 10 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 11 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 12 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 13 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 14 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 15 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, boolean given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 16 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 17 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 18 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 19 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 20 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, string given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 21 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, object given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 22 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 23 -- -bool(true) -bool(true) + +Warning: session_start() expects parameter 1 to be array, null given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) -- Iteration 24 -- -bool(true) -bool(true) -Done +Warning: session_start() expects parameter 1 to be array, resource given in %s on line %d +bool(false) + +Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d +bool(false) +Done diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 96182816fc..ceba129560 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -789,7 +789,7 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend } } if (exists && check_empty == 1 && - (!attr->children || !attr->children->content || !attr->children->content[0] || !xmlStrcmp(attr->children->content, "0")) ) { + (!attr->children || !attr->children->content || !attr->children->content[0] || !xmlStrcmp(attr->children->content, (const xmlChar *) "0")) ) { /* Attribute with no content in it's text node */ exists = 0; } @@ -817,7 +817,7 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend exists = 1; if (check_empty == 1 && (!node->children || (node->children->type == XML_TEXT_NODE && !node->children->next && - (!node->children->content || !node->children->content[0] || !xmlStrcmp(node->children->content, "0")))) ) { + (!node->children->content || !node->children->content[0] || !xmlStrcmp(node->children->content, (const xmlChar *) "0")))) ) { exists = 0; } } @@ -1388,7 +1388,7 @@ SXE_METHOD(asXML) if (node) { if (node->parent && (XML_DOCUMENT_NODE == node->parent->type)) { - xmlDocDumpMemoryEnc((xmlDocPtr) sxe->document->ptr, &strval, &strval_len, ((xmlDocPtr) sxe->document->ptr)->encoding); + xmlDocDumpMemoryEnc((xmlDocPtr) sxe->document->ptr, &strval, &strval_len, (const char *) ((xmlDocPtr) sxe->document->ptr)->encoding); RETVAL_STRINGL((char *)strval, strval_len); xmlFree(strval); } else { @@ -1399,7 +1399,7 @@ SXE_METHOD(asXML) RETURN_FALSE; } - xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, ((xmlDocPtr) sxe->document->ptr)->encoding); + xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, (const char *) ((xmlDocPtr) sxe->document->ptr)->encoding); xmlOutputBufferFlush(outbuf); #ifdef LIBXML2_NEW_BUFFER RETVAL_STRINGL((char *)xmlOutputBufferGetContent(outbuf), xmlOutputBufferGetSize(outbuf)); diff --git a/ext/sockets/config.w32 b/ext/sockets/config.w32 index d3455b05dd..e6c4cfea68 100644 --- a/ext/sockets/config.w32 +++ b/ext/sockets/config.w32 @@ -9,7 +9,7 @@ if (PHP_SOCKETS != "no") { && CHECK_HEADER_ADD_INCLUDE("winsock.h", "CFLAGS_SOCKETS")) { EXTENSION('sockets', 'sockets.c multicast.c conversions.c sockaddr_conv.c sendrecvmsg.c', PHP_SOCKETS_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); AC_DEFINE('HAVE_SOCKETS', 1); - PHP_INSTALL_HEADERS("ext/sockets", "php_sockets.h"); + PHP_INSTALL_HEADERS("ext/sockets", "php_sockets.h windows_common.h"); } else { WARNING("sockets not enabled; libraries and headers not found"); } diff --git a/ext/sockets/sockaddr_conv.c b/ext/sockets/sockaddr_conv.c index db1c2f1111..344c806049 100644 --- a/ext/sockets/sockaddr_conv.c +++ b/ext/sockets/sockaddr_conv.c @@ -9,7 +9,7 @@ #include <arpa/inet.h> #endif -extern int php_string_to_if_index(const char *val, unsigned *out); +extern int php_string_to_if_index(const char *val, unsigned *out TSRMLS_DC); #if HAVE_IPV6 /* Sets addr by hostname, or by ip in string form (AF_INET6) */ @@ -90,7 +90,7 @@ int php_set_inet_addr(struct sockaddr_in *sin, char *string, php_socket *php_soc if (inet_aton(string, &tmp)) { sin->sin_addr.s_addr = tmp.s_addr; } else { - if (! (host_entry = gethostbyname(string))) { + if (strlen(string) > MAXFQDNLEN || ! (host_entry = gethostbyname(string))) { /* Note: < -10000 indicates a host lookup error */ #ifdef PHP_WIN32 PHP_SOCKET_ERROR(php_sock, "Host lookup failed", WSAGetLastError()); diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index faebd7a0f4..e2a836bfa3 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -963,7 +963,6 @@ SPL_METHOD(DirectoryIterator, getExtension) p = zend_memrchr(fname->val, '.', fname->len); if (p) { - assert(p > fname->val); idx = (int)(p - fname->val); RETVAL_STRINGL(fname->val + idx + 1, fname->len - idx - 1); zend_string_release(fname); diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index a52ff46651..da51ee9885 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -100,6 +100,12 @@ #define PHP_CRYPT_RAND php_rand() +/* Used to check DES salts to ensure that they contain only valid characters */ +#define IS_VALID_SALT_CHARACTER(c) (((c) >= '.' && (c) <= '9') || ((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z')) + +#define DES_INVALID_SALT_ERROR "Supplied salt is not valid for DES. Possible bug in provided salt format." + + PHP_MINIT_FUNCTION(crypt) /* {{{ */ { REGISTER_LONG_CONSTANT("CRYPT_SALT_LENGTH", PHP_MAX_SALT_LEN, CONST_CS | CONST_PERSISTENT); @@ -196,10 +202,7 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch } else if ( salt[0] == '$' && salt[1] == '2' && - salt[3] == '$' && - salt[4] >= '0' && salt[4] <= '3' && - salt[5] >= '0' && salt[5] <= '9' && - salt[6] == '$') { + salt[3] == '$') { char output[PHP_MAX_SALT_LEN + 1]; memset(output, 0, PHP_MAX_SALT_LEN + 1); @@ -213,7 +216,19 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch ZEND_SECURE_ZERO(output, PHP_MAX_SALT_LEN + 1); return result; } + } else if (salt[0] == '*' && (salt[1] == '0' || salt[1] == '1')) { + return NULL; } else { + /* DES Fallback */ + + /* Only check the salt if it's not EXT_DES */ + if (salt[0] != '_') { + /* DES style hashes */ + if (!IS_VALID_SALT_CHARACTER(salt[0]) || !IS_VALID_SALT_CHARACTER(salt[1])) { + php_error_docref(NULL, E_DEPRECATED, DES_INVALID_SALT_ERROR); + } + } + memset(&buffer, 0, sizeof(buffer)); _crypt_extended_init_r(); @@ -238,6 +253,10 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch # else # error Data struct used by crypt_r() is unknown. Please report. # endif + if (salt[0] != '$' && salt[0] != '_' && (!IS_VALID_SALT_CHARACTER(salt[0]) || !IS_VALID_SALT_CHARACTER(salt[1]))) { + /* error consistently about invalid DES fallbacks */ + php_error_docref(NULL, E_DEPRECATED, DES_INVALID_SALT_ERROR); + } crypt_res = crypt_r(password, salt, &buffer); if (!crypt_res || (salt[0] == '*' && salt[1] == '0')) { return NULL; diff --git a/ext/standard/dl.c b/ext/standard/dl.c index 682200e91f..cadbc140cc 100644 --- a/ext/standard/dl.c +++ b/ext/standard/dl.c @@ -70,18 +70,6 @@ PHPAPI PHP_FUNCTION(dl) RETURN_FALSE; } - if ((strncmp(sapi_module.name, "cgi", 3) != 0) && - (strcmp(sapi_module.name, "cli") != 0) && - (strncmp(sapi_module.name, "embed", 5) != 0) - ) { -#ifdef ZTS - php_error_docref(NULL, E_WARNING, "Not supported in multithreaded Web servers - use extension=%s in your php.ini", filename); - RETURN_FALSE; -#else - php_error_docref(NULL, E_DEPRECATED, "dl() is deprecated - use extension=%s in your php.ini", filename); -#endif - } - php_dl(filename, MODULE_TEMPORARY, return_value, 0); if (Z_LVAL_P(return_value) == 1) { EG(full_tables_cleanup) = 1; @@ -182,46 +170,12 @@ PHPAPI int php_load_extension(char *filename, int type, int start_now) } module_entry = get_module(); if (module_entry->zend_api != ZEND_MODULE_API_NO) { - /* Check for pre-4.1.0 module which has a slightly different module_entry structure :( */ - struct pre_4_1_0_module_entry { - char *name; - zend_function_entry *functions; - int (*module_startup_func)(INIT_FUNC_ARGS); - int (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS); - int (*request_startup_func)(INIT_FUNC_ARGS); - int (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS); - void (*info_func)(ZEND_MODULE_INFO_FUNC_ARGS); - int (*global_startup_func)(void); - int (*global_shutdown_func)(void); - int globals_id; - int module_started; - unsigned char type; - void *handle; - int module_number; - unsigned char zend_debug; - unsigned char zts; - unsigned int zend_api; - }; - - const char *name; - int zend_api; - - if ((((struct pre_4_1_0_module_entry *)module_entry)->zend_api > 20000000) && - (((struct pre_4_1_0_module_entry *)module_entry)->zend_api < 20010901) - ) { - name = ((struct pre_4_1_0_module_entry *)module_entry)->name; - zend_api = ((struct pre_4_1_0_module_entry *)module_entry)->zend_api; - } else { - name = module_entry->name; - zend_api = module_entry->zend_api; - } - php_error_docref(NULL, error_type, "%s: Unable to initialize module\n" "Module compiled with module API=%d\n" "PHP compiled with module API=%d\n" "These options need to match\n", - name, zend_api, ZEND_MODULE_API_NO); + module_entry->name, module_entry->zend_api, ZEND_MODULE_API_NO); DL_UNLOAD(handle); return FAILURE; } diff --git a/ext/standard/dns.c b/ext/standard/dns.c index b5cfb1d3e4..3bc8a239c2 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -221,6 +221,12 @@ PHP_FUNCTION(gethostbyname) return; } + if(hostname_len > MAXFQDNLEN) { + /* name too long, protect from CVE-2015-0235 */ + php_error_docref(NULL, E_WARNING, "Host name is too long, the limit is %d characters", MAXFQDNLEN); + RETURN_STRINGL(hostname, hostname_len); + } + RETURN_STR(php_gethostbyname(hostname)); } /* }}} */ @@ -239,6 +245,12 @@ PHP_FUNCTION(gethostbynamel) return; } + if(hostname_len > MAXFQDNLEN) { + /* name too long, protect from CVE-2015-0235 */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Host name is too long, the limit is %d characters", MAXFQDNLEN); + RETURN_FALSE; + } + hp = gethostbyname(hostname); if (hp == NULL || hp->h_addr_list == NULL) { RETURN_FALSE; @@ -457,6 +469,7 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t add_assoc_string(subarray, "host", name); add_assoc_string(subarray, "class", "IN"); add_assoc_long(subarray, "ttl", ttl); + (void) class; if (raw) { add_assoc_long(subarray, "type", type); diff --git a/ext/standard/file.c b/ext/standard/file.c index 27053fe271..eee56700d5 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -364,7 +364,11 @@ PHP_FUNCTION(flock) /* flock_values contains all possible actions if (operation & 4) we won't block on the lock */ act = flock_values[act - 1] | (operation & PHP_LOCK_NB ? LOCK_NB : 0); if (php_stream_lock(stream, act)) { +#ifdef PHP_WIN32 + if (operation && errno == ERROR_INVALID_BLOCK && wouldblock) { +#else if (operation && errno == EWOULDBLOCK && wouldblock) { +#endif ZVAL_LONG(wouldblock, 1); } RETURN_FALSE; diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c index 923ba6642e..1c83a9434c 100644 --- a/ext/standard/ftp_fopen_wrapper.c +++ b/ext/standard/ftp_fopen_wrapper.c @@ -233,7 +233,7 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char } #define PHP_FTP_CNTRL_CHK(val, val_len, err_msg) { \ - unsigned char *s = val, *e = s + val_len; \ + unsigned char *s = (unsigned char *) val, *e = (unsigned char *) s + val_len; \ while (s < e) { \ if (iscntrl(*s)) { \ php_stream_wrapper_log_error(wrapper, options, err_msg, val); \ diff --git a/ext/standard/html.c b/ext/standard/html.c index 16abac0b08..c8e36b8d45 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -1187,7 +1187,7 @@ static inline void find_entity_for_char( * at most two entries... */ for ( ; s <= e; s++) { if (s->normal_entry.second_cp == next_char) { - *entity = s->normal_entry.entity; + *entity = (const unsigned char *) s->normal_entry.entity; *entity_len = s->normal_entry.entity_len; return; } @@ -1215,7 +1215,7 @@ static inline void find_entity_for_char_basic( return; } - *entity = table[k].data.ent.entity; + *entity = (const unsigned char *) table[k].data.ent.entity; *entity_len = table[k].data.ent.entity_len; } /* }}} */ @@ -1400,7 +1400,7 @@ encode_amp: ent_len = pos - (char*)&old[cursor]; } else { /* named entity */ /* check for vality of named entity */ - const char *start = &old[cursor], + const char *start = (const char *) &old[cursor], *next = start; unsigned dummy1, dummy2; diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index 7c48c45bc0..454cd04d5b 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -751,7 +751,7 @@ finish: if (!strncasecmp(http_header_line, "Location: ", 10)) { if (context && (tmpzval = php_stream_context_get_option(context, "http", "follow_location")) != NULL) { follow_location = zval_is_true(tmpzval); - } else if (!(response_code >= 300 && response_code < 304 || 307 == response_code || 308 == response_code)) { + } else if (!((response_code >= 300 && response_code < 304) || 307 == response_code || 308 == response_code)) { /* we shouldn't redirect automatically if follow_location isn't set and response_code not in (300, 301, 302, 303 and 307) see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.1 diff --git a/ext/standard/image.c b/ext/standard/image.c index d5ab529071..e1fa27e41b 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -367,7 +367,7 @@ static unsigned short php_read2(php_stream * stream) unsigned char a[2]; /* return 0 if we couldn't read enough data */ - if((php_stream_read(stream, a, sizeof(a))) < sizeof(a)) return 0; + if((php_stream_read(stream, (char *) a, sizeof(a))) < sizeof(a)) return 0; return (((unsigned short)a[0]) << 8) + ((unsigned short)a[1]); } @@ -604,7 +604,6 @@ static unsigned int php_read4(php_stream * stream) static struct gfxinfo *php_handle_jpc(php_stream * stream) { struct gfxinfo *result = NULL; - unsigned short dummy_short; int highest_bit_depth, bit_depth; unsigned char first_marker_id; unsigned int i; @@ -627,8 +626,8 @@ static struct gfxinfo *php_handle_jpc(php_stream * stream) result = (struct gfxinfo *)ecalloc(1, sizeof(struct gfxinfo)); - dummy_short = php_read2(stream); /* Lsiz */ - dummy_short = php_read2(stream); /* Rsiz */ + php_read2(stream); /* Lsiz */ + php_read2(stream); /* Rsiz */ result->width = php_read4(stream); /* Xsiz */ result->height = php_read4(stream); /* Ysiz */ @@ -647,7 +646,7 @@ static struct gfxinfo *php_handle_jpc(php_stream * stream) #endif result->channels = php_read2(stream); /* Csiz */ - if (result->channels == 0 && php_stream_eof(stream) || result->channels > 256) { + if ((result->channels == 0 && php_stream_eof(stream)) || result->channels > 256) { efree(result); return NULL; } @@ -831,7 +830,7 @@ static struct gfxinfo *php_handle_tiff (php_stream * stream, zval *info, int mot /* now we have the directory we can look how long it should be */ ifd_size = dir_size; for(i=0;i<num_entries;i++) { - dir_entry = ifd_data+2+i*12; + dir_entry = (unsigned char *) ifd_data+2+i*12; entry_tag = php_ifd_get16u(dir_entry+0, motorola_intel); entry_type = php_ifd_get16u(dir_entry+2, motorola_intel); switch(entry_type) { @@ -889,10 +888,10 @@ static struct gfxinfo *php_handle_iff(php_stream * stream) int size; short width, height, bits; - if (php_stream_read(stream, a, 8) != 8) { + if (php_stream_read(stream, (char *) a, 8) != 8) { return NULL; } - if (strncmp(a+4, "ILBM", 4) && strncmp(a+4, "PBM ", 4)) { + if (strncmp((char *) a+4, "ILBM", 4) && strncmp((char *) a+4, "PBM ", 4)) { return NULL; } @@ -1088,7 +1087,7 @@ static struct gfxinfo *php_handle_ico(php_stream * stream) unsigned char dim[16]; int num_icons = 0; - if (php_stream_read(stream, dim, 2) != 2) + if (php_stream_read(stream, (char *) dim, 2) != 2) return NULL; num_icons = (((unsigned int)dim[1]) << 8) + ((unsigned int) dim[0]); @@ -1100,7 +1099,7 @@ static struct gfxinfo *php_handle_ico(php_stream * stream) while (num_icons > 0) { - if (php_stream_read(stream, dim, sizeof(dim)) != sizeof(dim)) + if (php_stream_read(stream, (char *) dim, sizeof(dim)) != sizeof(dim)) break; if ((((unsigned int)dim[7]) << 8) + ((unsigned int)dim[6]) >= result->bits) diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c index 0e01acbe26..929d495023 100644 --- a/ext/standard/iptc.c +++ b/ext/standard/iptc.c @@ -286,7 +286,7 @@ PHP_FUNCTION(iptcembed) if (spool < 2) { // TODO: avoid reallocation ??? - RETVAL_STRINGL(spoolbuf, poi - spoolbuf); + RETVAL_STRINGL((char *) spoolbuf, poi - spoolbuf); efree(spoolbuf); } else { RETURN_TRUE; @@ -358,7 +358,7 @@ PHP_FUNCTION(iptcparse) element = zend_hash_str_update(Z_ARRVAL_P(return_value), key, strlen(key), &values); } - add_next_index_stringl(element, buffer+inx, len); + add_next_index_stringl(element, (char *) buffer+inx, len); inx += len; tagsfound++; } diff --git a/ext/standard/link.c b/ext/standard/link.c index a80e48f6a0..b7fe1ae495 100644 --- a/ext/standard/link.c +++ b/ext/standard/link.c @@ -86,7 +86,7 @@ PHP_FUNCTION(linkinfo) { char *link; char *dirname; - size_t link_len, dir_len; + size_t link_len; zend_stat_t sb; int ret; @@ -95,7 +95,7 @@ PHP_FUNCTION(linkinfo) } dirname = estrndup(link, link_len); - dir_len = php_dirname(dirname, link_len); + php_dirname(dirname, link_len); if (php_check_open_basedir(dirname)) { efree(dirname); diff --git a/ext/standard/metaphone.c b/ext/standard/metaphone.c index 59ef78baf6..cc94b0372f 100644 --- a/ext/standard/metaphone.c +++ b/ext/standard/metaphone.c @@ -117,7 +117,7 @@ char _codes[26] = /* Look two letters down. It makes sure you don't walk off the string. */ #define After_Next_Letter (Next_Letter != '\0' ? toupper(word[w_idx+2]) \ : '\0') -#define Look_Ahead_Letter(n) (toupper(Lookahead(word+w_idx, n))) +#define Look_Ahead_Letter(n) (toupper(Lookahead((char *) word+w_idx, n))) /* Allows us to safely look ahead an arbitrary # of letters */ diff --git a/ext/standard/string.c b/ext/standard/string.c index e22dba3967..65f80fd38c 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -3958,7 +3958,8 @@ static zend_long php_str_replace_in_subject(zval *search, zval *replace, zval *s { zval *search_entry, *replace_entry = NULL; - zend_string *tmp_result; + zend_string *tmp_result, + *replace_entry_str = NULL; char *replace_value = NULL; size_t replace_len = 0; zend_long replace_count = 0; @@ -3990,7 +3991,8 @@ static zend_long php_str_replace_in_subject(zval *search, zval *replace, zval *s /* For each entry in the search array, get the entry */ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(search), search_entry) { /* Make sure we're dealing with strings. */ - SEPARATE_ZVAL(search_entry); + ZVAL_DEREF(search_entry); + SEPARATE_ZVAL_NOREF(search_entry); convert_to_string(search_entry); if (Z_STRLEN_P(search_entry) == 0) { if (Z_TYPE_P(replace) == IS_ARRAY) { @@ -4004,11 +4006,11 @@ static zend_long php_str_replace_in_subject(zval *search, zval *replace, zval *s /* Get current entry */ if ((replace_entry = zend_hash_get_current_data_ex(Z_ARRVAL_P(replace), &pos)) != NULL) { /* Make sure we're dealing with strings. */ - convert_to_string_ex(replace_entry); + replace_entry_str = zval_get_string(replace_entry); /* Set replacement value to the one we got from array */ - replace_value = Z_STRVAL_P(replace_entry); - replace_len = Z_STRLEN_P(replace_entry); + replace_value = replace_entry_str->val; + replace_len = replace_entry_str->len; zend_hash_move_forward_ex(Z_ARRVAL_P(replace), &pos); } else { @@ -4051,6 +4053,10 @@ static zend_long php_str_replace_in_subject(zval *search, zval *replace, zval *s } } + if (replace_entry_str) { + zend_string_release(replace_entry_str); + replace_entry_str = NULL; + } zend_string_release(Z_STR_P(result)); ZVAL_STR(result, tmp_result); diff --git a/ext/standard/tests/array/array_udiff_assoc_variation.phpt b/ext/standard/tests/array/array_udiff_assoc_variation.phpt index 84e8841b2c..465c5008fd 100644 --- a/ext/standard/tests/array/array_udiff_assoc_variation.phpt +++ b/ext/standard/tests/array/array_udiff_assoc_variation.phpt @@ -14,7 +14,7 @@ include('compare_function.inc'); $key_compare_function = 'compare_function'; // Initialise all required variables -$arr1 = array("one" => "one", "02" => "two", '3' => "three", "four", "0.5" => 5, 6.0 => 6, "seven" => "0x7"); +$arr1 = array("one" => "one", "02" => "two", '3' => "three", "four", "0.5" => 5, 6.0 => 6, "seven" => "07"); $arr2 = array("one" => "one", "02" => "two", '3' => "three"); $arr3 = array("four", "0.5" => "five", 6 => 6, "seven" => 7); $arr4 = array("four", "0.5" => "five", 6 => 6, "seven" => 7); diff --git a/ext/standard/tests/crypt/bcrypt_invalid_algorithm.phpt b/ext/standard/tests/crypt/bcrypt_invalid_algorithm.phpt new file mode 100644 index 0000000000..58504e4604 --- /dev/null +++ b/ext/standard/tests/crypt/bcrypt_invalid_algorithm.phpt @@ -0,0 +1,12 @@ +--TEST-- +Test BCRYPT with invalid algorithm +--FILE-- +<?php +var_dump(crypt("test", "$23$04$1234567890123456789012345")); +var_dump(crypt("test", "$20$04$1234567890123456789012345")); +var_dump(crypt("test", "$2g$04$1234567890123456789012345")); +?> +--EXPECTF-- +string(2) "*0" +string(2) "*0" +string(2) "*0" diff --git a/ext/standard/tests/crypt/bcrypt_invalid_cost.phpt b/ext/standard/tests/crypt/bcrypt_invalid_cost.phpt new file mode 100644 index 0000000000..f5ae7c8291 --- /dev/null +++ b/ext/standard/tests/crypt/bcrypt_invalid_cost.phpt @@ -0,0 +1,20 @@ +--TEST-- +Test BCRYPT with invalid cost +--FILE-- +<?php +var_dump(crypt("test", "$2a$4$1234567891234567891234567")); +var_dump(crypt("test", "$2a$00$1234567891234567891234567")); +var_dump(crypt("test", "$2a$01$1234567891234567891234567")); +var_dump(crypt("test", "$2a$02$1234567891234567891234567")); +var_dump(crypt("test", "$2a$03$1234567891234567891234567")); +var_dump(crypt("test", "$2a$32$1234567891234567891234567")); +var_dump(crypt("test", "$2a$40$1234567891234567891234567")); +?> +--EXPECTF-- +string(2) "*0" +string(2) "*0" +string(2) "*0" +string(2) "*0" +string(2) "*0" +string(2) "*0" +string(2) "*0"
\ No newline at end of file diff --git a/ext/standard/tests/crypt/des_fallback_invalid_salt.phpt b/ext/standard/tests/crypt/des_fallback_invalid_salt.phpt new file mode 100644 index 0000000000..7ef5ec631f --- /dev/null +++ b/ext/standard/tests/crypt/des_fallback_invalid_salt.phpt @@ -0,0 +1,15 @@ +--TEST-- +Test DES with invalid fallback +--FILE-- +<?php + +var_dump(crypt("test", "$#")); +var_dump(crypt("test", "$5zd$01")); + +?> +--EXPECTF-- +Deprecated: crypt(): Supplied salt is not valid for DES. Possible bug in provided salt format. in %s on line %d +string(13) "$#8MWASl5pGIk" + +Deprecated: crypt(): Supplied salt is not valid for DES. Possible bug in provided salt format. in %s on line %d +string(13) "$54mkQyGCLvHs"
\ No newline at end of file diff --git a/ext/standard/tests/file/bug65272.phpt b/ext/standard/tests/file/bug65272.phpt new file mode 100644 index 0000000000..04a5c2d5d5 --- /dev/null +++ b/ext/standard/tests/file/bug65272.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #65272: flock() correctly sets wouldblock out param in windows +--SKIPIF-- +<?php +if (stripos(PHP_OS, 'win') !== 0) die("skip windows required"); +?> +--FILE-- +<?php + +$file = dirname(__FILE__)."/flock.dat"; + +$fp1 = fopen($file, "w"); +var_dump(flock($fp1, LOCK_SH)); + +$fp2 = fopen($file, "r"); +var_dump(flock($fp2, LOCK_EX|LOCK_NB, $wouldblock)); +var_dump($wouldblock); + +@unlink($file); +echo "Done\n"; +?> +--EXPECTF-- +bool(true) +bool(false) +int(1) +Done diff --git a/ext/standard/tests/general_functions/is_numeric.phpt b/ext/standard/tests/general_functions/is_numeric.phpt index 9857c94223..415ce069e9 100644 --- a/ext/standard/tests/general_functions/is_numeric.phpt +++ b/ext/standard/tests/general_functions/is_numeric.phpt @@ -80,8 +80,6 @@ $numerics = array( ' 1', '2974394749328742328432', '-1e-2', - "0xff", - '0xff', "0123", '0123', "-0123", @@ -109,6 +107,7 @@ unset ($unset_var); // other types in a array $not_numerics = array( + "0x80001", "-0x80001", "+0x80001", "-0x80001.5", @@ -314,10 +313,6 @@ bool(true) bool(true) -- Iteration 76 -- bool(true) --- Iteration 77 -- -bool(true) --- Iteration 78 -- -bool(true) *** Testing is_numeric() on non numeric types *** -- Iteration 1 -- @@ -376,6 +371,8 @@ bool(false) bool(false) -- Iteration 28 -- bool(false) +-- Iteration 29 -- +bool(false) *** Testing error conditions *** diff --git a/ext/standard/tests/math/ceil_basic.phpt b/ext/standard/tests/math/ceil_basic.phpt index 679460533d..e90afd3388 100644 --- a/ext/standard/tests/math/ceil_basic.phpt +++ b/ext/standard/tests/math/ceil_basic.phpt @@ -31,7 +31,6 @@ $values = array(0, "3.95E3", "-3.95E3", "039", - "0x5F", true, false, null, @@ -63,7 +62,6 @@ float(-10) float(3950) float(-3950) float(39) -float(95) float(1) float(0) float(0) diff --git a/ext/standard/tests/math/exp_basic.phpt b/ext/standard/tests/math/exp_basic.phpt index 9526c66fa4..135705507c 100644 --- a/ext/standard/tests/math/exp_basic.phpt +++ b/ext/standard/tests/math/exp_basic.phpt @@ -13,7 +13,6 @@ $values = array(10, "3950.5", "3.9505e3", "039", - "0x5F", true, false, null, @@ -58,14 +57,11 @@ float(INF) float(8.6593400423994E+16) -- Iteration 10 -- -float(1.811239082889E+41) - --- Iteration 11 -- float(2.718281828459) --- Iteration 12 -- +-- Iteration 11 -- float(1) --- Iteration 13 -- +-- Iteration 12 -- float(1) -===Done===
\ No newline at end of file +===Done=== diff --git a/ext/standard/tests/math/expm1_basic.phpt b/ext/standard/tests/math/expm1_basic.phpt index fa1d571db4..320b01a27d 100644 --- a/ext/standard/tests/math/expm1_basic.phpt +++ b/ext/standard/tests/math/expm1_basic.phpt @@ -20,7 +20,6 @@ $values = array(10, "3950.5", "3.9505e3", "039", - "0x5F", true, false, null, @@ -66,14 +65,11 @@ float(INF) float(8.6593400423994E+16) -- Iteration 10 -- -float(1.811239082889E+41) - --- Iteration 11 -- float(1.718281828459) --- Iteration 12 -- +-- Iteration 11 -- float(0) --- Iteration 13 -- +-- Iteration 12 -- float(0) -===Done===
\ No newline at end of file +===Done=== diff --git a/ext/standard/tests/math/floor_basic.phpt b/ext/standard/tests/math/floor_basic.phpt index bbb8a2aa57..2b6d2f75c8 100644 --- a/ext/standard/tests/math/floor_basic.phpt +++ b/ext/standard/tests/math/floor_basic.phpt @@ -27,7 +27,6 @@ $values = array(0, "3.95E3", "-3.95E3", "039", - "0x5F", true, false, null, @@ -94,9 +93,6 @@ float(-3950) -- floor 039 -- float(39) --- floor 0x5F -- -float(95) - -- floor 1 -- float(1) @@ -105,4 +101,4 @@ float(0) -- floor -- float(0) -===Done===
\ No newline at end of file +===Done=== diff --git a/ext/standard/tests/math/mt_rand_basic.phpt b/ext/standard/tests/math/mt_rand_basic.phpt index 8b6b3cb2ce..0f7b8a8b6e 100644 --- a/ext/standard/tests/math/mt_rand_basic.phpt +++ b/ext/standard/tests/math/mt_rand_basic.phpt @@ -56,15 +56,13 @@ $min = array(true, false, null, "10", - "0x10", "10.5"); -// Eexepcted numerical equivalent of above non-numerics +// Expected numerical equivalent of above non-numerics $minval = array(1, 0, 0, 10, - 0, 10); for ($x = 0; $x < count($min); $x++) { for ($i = 0; $i < 100; $i++) { @@ -98,5 +96,4 @@ PASSED range min = 1 max = 100 PASSED range min = 0 max = 100 PASSED range min = 0 max = 100 PASSED range min = 10 max = 100 -PASSED range min = 0 max = 100 PASSED range min = 10 max = 100 diff --git a/ext/standard/tests/math/rand_basic.phpt b/ext/standard/tests/math/rand_basic.phpt index 525956017e..8dc9fb862c 100644 --- a/ext/standard/tests/math/rand_basic.phpt +++ b/ext/standard/tests/math/rand_basic.phpt @@ -56,7 +56,6 @@ $min = array(true, false, null, "10", - "0x10", "10.5"); // Eexepcted numerical equivalent of above non-numerics @@ -64,7 +63,6 @@ $minval = array(1, 0, 0, 10, - 0, 10); for ($x = 0; $x < count($min); $x++) { for ($i = 0; $i < 100; $i++) { @@ -99,5 +97,4 @@ PASSED range min = 1 max = 100 PASSED range min = 0 max = 100 PASSED range min = 0 max = 100 PASSED range min = 10 max = 100 -PASSED range min = 0 max = 100 PASSED range min = 10 max = 100 diff --git a/ext/standard/tests/math/round_basic.phpt b/ext/standard/tests/math/round_basic.phpt index dd4725f244..d4b94ec056 100644 --- a/ext/standard/tests/math/round_basic.phpt +++ b/ext/standard/tests/math/round_basic.phpt @@ -20,8 +20,7 @@ $values = array(123456789, 0x234567, 067777777, "1.234567", - "2.3456789e8", - "0x1234CDEF"); + "2.3456789e8"); $precision = array(2, 8, @@ -29,7 +28,6 @@ $precision = array(2, 04, 3.6, "2", - "0x03", "04", "3.6", "2.1e1", @@ -56,7 +54,6 @@ round: 123456789 ...with precision 4-> float(123456789) ...with precision 3.6-> float(123456789) ...with precision 2-> float(123456789) -...with precision 0x03-> float(123456789) ...with precision 04-> float(123456789) ...with precision 3.6-> float(123456789) ...with precision 2.1e1-> float(123456789) @@ -70,7 +67,6 @@ round: 123.456789 ...with precision 4-> float(123.4568) ...with precision 3.6-> float(123.457) ...with precision 2-> float(123.46) -...with precision 0x03-> float(123.457) ...with precision 04-> float(123.4568) ...with precision 3.6-> float(123.457) ...with precision 2.1e1-> float(123.456789) @@ -84,7 +80,6 @@ round: -4.5679123 ...with precision 4-> float(-4.5679) ...with precision 3.6-> float(-4.568) ...with precision 2-> float(-4.57) -...with precision 0x03-> float(-4.568) ...with precision 04-> float(-4.5679) ...with precision 3.6-> float(-4.568) ...with precision 2.1e1-> float(-4.5679123) @@ -98,7 +93,6 @@ round: 12300 ...with precision 4-> float(12300) ...with precision 3.6-> float(12300) ...with precision 2-> float(12300) -...with precision 0x03-> float(12300) ...with precision 04-> float(12300) ...with precision 3.6-> float(12300) ...with precision 2.1e1-> float(12300) @@ -112,7 +106,6 @@ round: -4567 ...with precision 4-> float(-4567) ...with precision 3.6-> float(-4567) ...with precision 2-> float(-4567) -...with precision 0x03-> float(-4567) ...with precision 04-> float(-4567) ...with precision 3.6-> float(-4567) ...with precision 2.1e1-> float(-4567) @@ -126,7 +119,6 @@ round: 2311527 ...with precision 4-> float(2311527) ...with precision 3.6-> float(2311527) ...with precision 2-> float(2311527) -...with precision 0x03-> float(2311527) ...with precision 04-> float(2311527) ...with precision 3.6-> float(2311527) ...with precision 2.1e1-> float(2311527) @@ -140,7 +132,6 @@ round: 14680063 ...with precision 4-> float(14680063) ...with precision 3.6-> float(14680063) ...with precision 2-> float(14680063) -...with precision 0x03-> float(14680063) ...with precision 04-> float(14680063) ...with precision 3.6-> float(14680063) ...with precision 2.1e1-> float(14680063) @@ -154,7 +145,6 @@ round: 1.234567 ...with precision 4-> float(1.2346) ...with precision 3.6-> float(1.235) ...with precision 2-> float(1.23) -...with precision 0x03-> float(1.235) ...with precision 04-> float(1.2346) ...with precision 3.6-> float(1.235) ...with precision 2.1e1-> float(1.234567) @@ -168,25 +158,10 @@ round: 2.3456789e8 ...with precision 4-> float(234567890) ...with precision 3.6-> float(234567890) ...with precision 2-> float(234567890) -...with precision 0x03-> float(234567890) ...with precision 04-> float(234567890) ...with precision 3.6-> float(234567890) ...with precision 2.1e1-> float(234567890) ...with precision -> float(234567890) ...with precision 1-> float(234567890) ...with precision -> float(234567890) -round: 0x1234CDEF -...with precision 2-> float(305450479) -...with precision 8-> float(305450479) -...with precision 3-> float(305450479) -...with precision 4-> float(305450479) -...with precision 3.6-> float(305450479) -...with precision 2-> float(305450479) -...with precision 0x03-> float(305450479) -...with precision 04-> float(305450479) -...with precision 3.6-> float(305450479) -...with precision 2.1e1-> float(305450479) -...with precision -> float(305450479) -...with precision 1-> float(305450479) -...with precision -> float(305450479) -===Done===
\ No newline at end of file +===Done=== diff --git a/ext/standard/tests/network/bug68925.phpt b/ext/standard/tests/network/bug68925.phpt new file mode 100644 index 0000000000..2638dd331d --- /dev/null +++ b/ext/standard/tests/network/bug68925.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #68925 (CVE-2015-0235 – GHOST: glibc gethostbyname buffer overflow) +--FILE-- +<?php +var_dump(gethostbyname(str_repeat("0", 2501))); +var_dump(gethostbynamel(str_repeat("0", 2501))); +?> +--EXPECTF-- +Warning: gethostbyname(): Host name is too long, the limit is %d characters in %s/bug68925.php on line %d +string(2501) "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + +Warning: gethostbynamel(): Host name is too long, the limit is %d characters in %s/bug68925.php on line %d +bool(false) diff --git a/ext/standard/tests/serialize/bug31402.phpt b/ext/standard/tests/serialize/bug31402.phpt index 59cc52f5f4..404d57eb3e 100644 --- a/ext/standard/tests/serialize/bug31402.phpt +++ b/ext/standard/tests/serialize/bug31402.phpt @@ -1,7 +1,7 @@ --TEST-- Bug #31402 (unserialize() generates references when it should not) --INI-- -error_reporting=E_ALL&~E_STRICT&~E_DEPRECATED +error_reporting=E_ALL --FILE-- <?php @@ -19,7 +19,8 @@ class TestY { function __construct() { $this->A[1] = new TestX(1); - $this->A[2] = & new TestX(2); + $obj = new TestX(2); + $this->A[2] = & $obj; $this->A[3] = & $this->A[2]; $this->B = $this->A[1]; } diff --git a/ext/standard/tests/streams/stream_multi_filters_close.phpt b/ext/standard/tests/streams/stream_multi_filters_close.phpt new file mode 100644 index 0000000000..f1eb18a15c --- /dev/null +++ b/ext/standard/tests/streams/stream_multi_filters_close.phpt @@ -0,0 +1,56 @@ +--TEST-- +Check if multiple filters are closed correctly and never called again after close +--FILE-- +<?php + +class FirstFilter extends php_user_filter { + public function filter($in, $out, &$consumed, $closing) { + static $closed = 0; + + while ($bucket = stream_bucket_make_writeable($in)) { + stream_bucket_append($out, stream_bucket_new($this->stream, $bucket->data)); + } + + if ($closing) { + $closed++; + } + + if ($closed > 0) { + var_dump($closed++); + } + return PSFS_PASS_ON; + } +} + +class SecondFilter extends php_user_filter { + public function filter($in, $out, &$consumed, $closing) { + static $closed = 0; + + while ($bucket = stream_bucket_make_writeable($in)) { + stream_bucket_append($out, stream_bucket_new($this->stream, $bucket->data)); + } + + if ($closing) { + $closed++; + } + + if ($closed > 0) { + var_dump($closed++); + } + return PSFS_PASS_ON; + } +} + +$r = fopen("php://stdout", "w+"); +stream_filter_register("first", "FirstFilter"); +stream_filter_register("second", "SecondFilter"); +$first = stream_filter_prepend($r, "first", STREAM_FILTER_WRITE, []); +$second = stream_filter_prepend($r, "second", STREAM_FILTER_WRITE, []); +fwrite($r, "test\n"); +stream_filter_remove($second); +stream_filter_remove($first); +?> +--EXPECT-- +test +int(1) +int(1) diff --git a/ext/standard/tests/strings/crypt_blowfish_variation2.phpt b/ext/standard/tests/strings/crypt_blowfish_variation2.phpt index 21bedc10c6..9db9e21424 100644 --- a/ext/standard/tests/strings/crypt_blowfish_variation2.phpt +++ b/ext/standard/tests/strings/crypt_blowfish_variation2.phpt @@ -1,10 +1,10 @@ --TEST-- -Test Blowfish crypt() falls back to DES when rounds are not specified, +Test Blowfish crypt() does not fall back to DES when rounds are not specified, or Blowfish is not available. --FILE-- <?php $crypt = crypt(b'U*U', b'$2a$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW'); -if ($crypt===b'$2SHYF.wPGyfE') { +if ($crypt==='*0') { echo "OK\n"; } else { echo "Not OK\n"; diff --git a/ext/standard/tests/strings/hebrev_variation2.phpt b/ext/standard/tests/strings/hebrev_variation2.phpt index 501791f9e5..5698cde793 100644 --- a/ext/standard/tests/strings/hebrev_variation2.phpt +++ b/ext/standard/tests/strings/hebrev_variation2.phpt @@ -259,18 +259,10 @@ string(109) ".The hebrev function converts logical Hebrew text to visual text .The function tries to avoid breaking words " -- Iteration 23 -- -string(109) "textual vis -to -textrew Heb -icallog -ertsconvion unctf -brevhe -.Therds -wo -kingbreaoid av -to -riest -tionfuncThe . + +Notice: A non well formed numeric value encountered in %s on line %d +string(109) ".The hebrev function converts logical Hebrew text to visual text +.The function tries to avoid breaking words " -- Iteration 24 -- @@ -288,4 +280,4 @@ string(109) ".The hebrev function converts logical Hebrew text to visual text string(109) ".The hebrev function converts logical Hebrew text to visual text .The function tries to avoid breaking words " -===DONE===
\ No newline at end of file +===DONE=== diff --git a/ext/standard/tests/strings/hebrevc_variation2.phpt b/ext/standard/tests/strings/hebrevc_variation2.phpt index 373cf806fe..e6a6013931 100644 --- a/ext/standard/tests/strings/hebrevc_variation2.phpt +++ b/ext/standard/tests/strings/hebrevc_variation2.phpt @@ -381,29 +381,13 @@ string(241) ".The hebrevcc function converts logical Hebrew text to visual text< .The function tries to avoid breaking words<br /> " -- Iteration 23 -- -string(349) "textual vis<br /> -to<br /> -textrew Heb<br /> -icallog<br /> -ertsconvion unctf<br /> -evcchebrThe .<br /> -inesnewlrts onvec<br /> -it<br /> -thatnce feredif<br /> -the<br /> -withc() brevhe<br /> -to<br /> -ilarsim<br /> -is<br /> -tionfunchis ) T<br /> -(<br /> -'<br<to .'<br /> -<br /> -ordsw<br /> -kingbreaoid av<br /> -to<br /> -riest<br /> -tionfuncThe .<br /> + +Notice: A non well formed numeric value encountered in %s on line %d +string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> +) This function is similar to hebrevc() with the difference that it converts newlines<br /> +<to '<br (<br /> +.'<br /> +.The function tries to avoid breaking words<br /> " -- Iteration 24 -- diff --git a/ext/standard/tests/strings/money_format_variation2.phpt b/ext/standard/tests/strings/money_format_variation2.phpt index 01fd44d66c..6e01bf03dd 100644 --- a/ext/standard/tests/strings/money_format_variation2.phpt +++ b/ext/standard/tests/strings/money_format_variation2.phpt @@ -156,6 +156,8 @@ NULL Warning: money_format() expects parameter 2 to be float, string given in %s on line %d NULL -- Iteration 21 -- + +Notice: A non well formed numeric value encountered in %s on line %d string -- Iteration 22 -- diff --git a/ext/standard/tests/strings/str_pad_variation4.phpt b/ext/standard/tests/strings/str_pad_variation4.phpt index 124d064576..585d79edb3 100644 --- a/ext/standard/tests/strings/str_pad_variation4.phpt +++ b/ext/standard/tests/strings/str_pad_variation4.phpt @@ -132,7 +132,9 @@ NULL -- Iteration 12 -- string(20) "****Test string*****" -- Iteration 13 -- -string(20) "****Test string*****" + +Notice: A non well formed numeric value encountered in %s on line %d +string(20) "*********Test string" -- Iteration 14 -- string(20) "****Test string*****" -- Iteration 15 -- diff --git a/ext/standard/tests/strings/str_replace_array_refs.phpt b/ext/standard/tests/strings/str_replace_array_refs.phpt new file mode 100644 index 0000000000..102bcfa8fe --- /dev/null +++ b/ext/standard/tests/strings/str_replace_array_refs.phpt @@ -0,0 +1,17 @@ +--TEST-- +Test str_replace() function and array refs +--INI-- +precision=14 +--FILE-- +<?php +$data = ['a' => 'b', 'numeric' => 1]; +$ref = &$data; +$b = &$ref['a']; +$numeric = &$ref['numeric']; +var_dump(str_replace(array_keys($data), $data, "a numeric")); +var_dump($numeric); +var_dump($data['numeric']); +--EXPECTF-- +string(3) "b 1" +int(1) +int(1) diff --git a/ext/standard/tests/strings/str_replace_array_refs2.phpt b/ext/standard/tests/strings/str_replace_array_refs2.phpt new file mode 100644 index 0000000000..788c738344 --- /dev/null +++ b/ext/standard/tests/strings/str_replace_array_refs2.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test str_replace() function and array refs, more cases +--FILE-- +<?php +$closure = function (array $array, array $keys, $value) +{ + $current = &$array; + foreach ($keys as $key) + $current = &$current[$key]; + $current = $value; + return $array; +}; + +class SomeClass { public $prop; } + +$obj = new SomeClass; +$obj->prop = ['x' => 'property']; +$obj->prop = $closure($obj->prop, ['x'], 'a'); +var_dump(str_replace(array_keys($obj->prop), $obj->prop, "x property")); + +$array = ['x' => 'property']; +$array = $closure($array, ['x'], 'a'); +var_dump(str_replace(array_keys($array), $array, "x property")); + +--EXPECTF-- +string(10) "a property" +string(10) "a property" diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c index 5b9bbd57ae..0014027872 100644 --- a/ext/standard/url_scanner_ex.c +++ b/ext/standard/url_scanner_ex.c @@ -123,38 +123,38 @@ scan: { YYCTYPE yych; static const unsigned char yybm[] = { - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 0, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 0, 128, 128, 128, 128, 0, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 0, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 0, 128, 128, 128, 128, 0, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, }; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -378,38 +378,38 @@ state_plain: { YYCTYPE yych; static const unsigned char yybm[] = { - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 0, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 0, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, }; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; @@ -441,38 +441,38 @@ state_tag: { YYCTYPE yych; static const unsigned char yybm[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 128, 0, 0, 0, 0, 0, - 0, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 0, 0, 0, 0, 0, - 0, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 128, 0, 0, 0, 0, 0, + 0, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 0, 0, 0, 0, 0, + 0, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, }; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; @@ -519,38 +519,38 @@ state_next_arg: { YYCTYPE yych; static const unsigned char yybm[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 128, 128, 128, 0, 128, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 128, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 128, 128, 128, 0, 128, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 128, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, }; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; @@ -629,38 +629,38 @@ state_arg: { YYCTYPE yych; static const unsigned char yybm[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 128, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 0, 0, 0, 0, 0, - 0, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 128, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 0, 0, 0, 0, 0, + 0, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, }; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; @@ -701,38 +701,38 @@ state_before_val: { YYCTYPE yych; static const unsigned char yybm[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 128, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 128, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, }; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; @@ -787,38 +787,38 @@ state_val: { YYCTYPE yych; static const unsigned char yybm[] = { - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 192, 192, 224, 224, 192, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 192, 224, 64, 224, 224, 224, 224, 128, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 0, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 192, 192, 224, 224, 192, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 192, 224, 64, 224, 224, 224, 224, 128, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 0, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, }; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; @@ -918,18 +918,32 @@ stop: ctx->buf.s->len = rest; } -char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen) + +PHPAPI char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen, int urlencode) { char *result; smart_str surl = {0}; smart_str buf = {0}; smart_str url_app = {0}; + zend_string *encoded; - smart_str_setl(&surl, url, urllen); + smart_str_appendl(&surl, url, urllen); - smart_str_appends(&url_app, name); + if (urlencode) { + encoded = php_raw_url_encode(name, strlen(name)); + smart_str_appendl(&url_app, encoded->val, encoded->len); + zend_string_free(encoded); + } else { + smart_str_appends(&url_app, name); + } smart_str_appendc(&url_app, '='); - smart_str_appends(&url_app, value); + if (urlencode) { + encoded = php_raw_url_encode(value, strlen(value)); + smart_str_appendl(&url_app, encoded->val, encoded->len); + zend_string_free(encoded); + } else { + smart_str_appends(&url_app, value); + } append_modified_url(&surl, &buf, &url_app, PG(arg_separator).output); @@ -1028,7 +1042,8 @@ static void php_url_scanner_output_handler(char *output, size_t output_len, char PHPAPI int php_url_scanner_add_var(char *name, size_t name_len, char *value, size_t value_len, int urlencode) { - smart_str val = {0}; + smart_str sname = {0}; + smart_str svalue = {0}; zend_string *encoded; if (!BG(url_adapt_state_ex).active) { @@ -1037,32 +1052,34 @@ PHPAPI int php_url_scanner_add_var(char *name, size_t name_len, char *value, siz BG(url_adapt_state_ex).active = 1; } - if (BG(url_adapt_state_ex).url_app.s && BG(url_adapt_state_ex).url_app.s->len != 0) { smart_str_appends(&BG(url_adapt_state_ex).url_app, PG(arg_separator).output); } if (urlencode) { - encoded = php_url_encode(value, value_len); - smart_str_setl(&val, encoded->val, encoded->len); + encoded = php_raw_url_encode(name, name_len); + smart_str_appendl(&sname, encoded->val, encoded->len); + zend_string_free(encoded); + encoded = php_raw_url_encode(value, value_len); + smart_str_appendl(&svalue, encoded->val, encoded->len); + zend_string_free(encoded); } else { - smart_str_setl(&val, value, value_len); + smart_str_appendl(&sname, name, name_len); + smart_str_appendl(&svalue, value, value_len); } - smart_str_appendl(&BG(url_adapt_state_ex).url_app, name, name_len); + smart_str_append_smart_str(&BG(url_adapt_state_ex).url_app, &sname); smart_str_appendc(&BG(url_adapt_state_ex).url_app, '='); - smart_str_append_smart_str(&BG(url_adapt_state_ex).url_app, &val); + smart_str_append_smart_str(&BG(url_adapt_state_ex).url_app, &svalue); smart_str_appends(&BG(url_adapt_state_ex).form_app, "<input type=\"hidden\" name=\""); - smart_str_appendl(&BG(url_adapt_state_ex).form_app, name, name_len); + smart_str_append_smart_str(&BG(url_adapt_state_ex).form_app, &sname); smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" value=\""); - smart_str_append_smart_str(&BG(url_adapt_state_ex).form_app, &val); + smart_str_append_smart_str(&BG(url_adapt_state_ex).form_app, &svalue); smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" />"); - if (urlencode) { - zend_string_free(encoded); - } - smart_str_free(&val); + smart_str_free(&sname); + smart_str_free(&svalue); return SUCCESS; } diff --git a/ext/standard/url_scanner_ex.h b/ext/standard/url_scanner_ex.h index 43902c14c0..a69a3257fa 100644 --- a/ext/standard/url_scanner_ex.h +++ b/ext/standard/url_scanner_ex.h @@ -27,7 +27,7 @@ PHP_MSHUTDOWN_FUNCTION(url_scanner_ex); PHP_RINIT_FUNCTION(url_scanner_ex); PHP_RSHUTDOWN_FUNCTION(url_scanner_ex); -PHPAPI char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen); +PHPAPI char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen, int urlencode); PHPAPI int php_url_scanner_add_var(char *name, size_t name_len, char *value, size_t value_len, int urlencode); PHPAPI int php_url_scanner_reset_vars(void); diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re index bb1d1e6cb6..48a6d8db62 100644 --- a/ext/standard/url_scanner_ex.re +++ b/ext/standard/url_scanner_ex.re @@ -370,18 +370,32 @@ stop: ctx->buf.s->len = rest; } -char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen) + +PHPAPI char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen, int urlencode) { char *result; smart_str surl = {0}; smart_str buf = {0}; smart_str url_app = {0}; + zend_string *encoded; - smart_str_setl(&surl, url, urllen); + smart_str_appendl(&surl, url, urllen); - smart_str_appends(&url_app, name); + if (urlencode) { + encoded = php_raw_url_encode(name, strlen(name)); + smart_str_appendl(&url_app, encoded->val, encoded->len); + zend_string_free(encoded); + } else { + smart_str_appends(&url_app, name); + } smart_str_appendc(&url_app, '='); - smart_str_appends(&url_app, value); + if (urlencode) { + encoded = php_raw_url_encode(value, strlen(value)); + smart_str_appendl(&url_app, encoded->val, encoded->len); + zend_string_free(encoded); + } else { + smart_str_appends(&url_app, value); + } append_modified_url(&surl, &buf, &url_app, PG(arg_separator).output); @@ -480,7 +494,8 @@ static void php_url_scanner_output_handler(char *output, size_t output_len, char PHPAPI int php_url_scanner_add_var(char *name, size_t name_len, char *value, size_t value_len, int urlencode) { - smart_str val = {0}; + smart_str sname = {0}; + smart_str svalue = {0}; zend_string *encoded; if (!BG(url_adapt_state_ex).active) { @@ -489,32 +504,34 @@ PHPAPI int php_url_scanner_add_var(char *name, size_t name_len, char *value, siz BG(url_adapt_state_ex).active = 1; } - if (BG(url_adapt_state_ex).url_app.s && BG(url_adapt_state_ex).url_app.s->len != 0) { smart_str_appends(&BG(url_adapt_state_ex).url_app, PG(arg_separator).output); } if (urlencode) { - encoded = php_url_encode(value, value_len); - smart_str_setl(&val, encoded->val, encoded->len); + encoded = php_raw_url_encode(name, name_len); + smart_str_appendl(&sname, encoded->val, encoded->len); + zend_string_free(encoded); + encoded = php_raw_url_encode(value, value_len); + smart_str_appendl(&svalue, encoded->val, encoded->len); + zend_string_free(encoded); } else { - smart_str_setl(&val, value, value_len); + smart_str_appendl(&sname, name, name_len); + smart_str_appendl(&svalue, value, value_len); } - smart_str_appendl(&BG(url_adapt_state_ex).url_app, name, name_len); + smart_str_append_smart_str(&BG(url_adapt_state_ex).url_app, &sname); smart_str_appendc(&BG(url_adapt_state_ex).url_app, '='); - smart_str_append_smart_str(&BG(url_adapt_state_ex).url_app, &val); + smart_str_append_smart_str(&BG(url_adapt_state_ex).url_app, &svalue); smart_str_appends(&BG(url_adapt_state_ex).form_app, "<input type=\"hidden\" name=\""); - smart_str_appendl(&BG(url_adapt_state_ex).form_app, name, name_len); + smart_str_append_smart_str(&BG(url_adapt_state_ex).form_app, &sname); smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" value=\""); - smart_str_append_smart_str(&BG(url_adapt_state_ex).form_app, &val); + smart_str_append_smart_str(&BG(url_adapt_state_ex).form_app, &svalue); smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" />"); - if (urlencode) { - zend_string_free(encoded); - } - smart_str_free(&val); + smart_str_free(&sname); + smart_str_free(&svalue); return SUCCESS; } |