summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/date/lib/timezonedb.h773
-rw-r--r--ext/fileinfo/libmagic.patch767
-rw-r--r--ext/fileinfo/libmagic/readcdf.c6
-rw-r--r--ext/fileinfo/libmagic/readelf.c7
-rw-r--r--ext/gmp/gmp.c2
-rw-r--r--ext/opcache/Optimizer/block_pass.c2
-rw-r--r--ext/opcache/Optimizer/compact_literals.c6
-rw-r--r--ext/opcache/Optimizer/zend_optimizer.c2
-rw-r--r--ext/opcache/ZendAccelerator.c4
-rw-r--r--ext/opcache/zend_accelerator_util_funcs.c58
-rw-r--r--ext/opcache/zend_accelerator_util_funcs.h1
-rw-r--r--ext/pdo_dblib/README31
-rw-r--r--ext/pdo_dblib/dblib_driver.c104
-rw-r--r--ext/pdo_dblib/dblib_stmt.c23
-rw-r--r--ext/pdo_dblib/pdo_dblib.c28
-rw-r--r--ext/pdo_dblib/php_pdo_dblib_int.h6
-rw-r--r--ext/phar/phar.c1
-rw-r--r--ext/simplexml/simplexml.c16
-rw-r--r--ext/soap/php_encoding.c35
-rw-r--r--ext/spl/php_spl.c4
-rw-r--r--ext/standard/array.c44
-rw-r--r--ext/standard/assert.c18
-rw-r--r--ext/standard/basic_functions.c36
-rw-r--r--ext/standard/basic_functions.h4
-rw-r--r--ext/standard/crypt.c2
-rw-r--r--ext/standard/crypt_sha256.c10
-rw-r--r--ext/standard/dir.c4
-rw-r--r--ext/standard/dl.c2
-rw-r--r--ext/standard/dns_win32.c4
-rw-r--r--ext/standard/exec.c15
-rw-r--r--ext/standard/file.c23
-rw-r--r--ext/standard/filestat.c2
-rw-r--r--ext/standard/filters.c16
-rw-r--r--ext/standard/formatted_print.c2
-rw-r--r--ext/standard/fsock.c17
-rw-r--r--ext/standard/ftp_fopen_wrapper.c16
-rw-r--r--ext/standard/head.c8
-rw-r--r--ext/standard/head.h2
-rw-r--r--ext/standard/html.c8
-rw-r--r--ext/standard/http.c12
-rw-r--r--ext/standard/http_fopen_wrapper.c29
-rw-r--r--ext/standard/info.c12
-rw-r--r--ext/standard/levenshtein.c13
-rw-r--r--ext/standard/mail.c2
-rw-r--r--ext/standard/math.c26
-rw-r--r--ext/standard/pack.c6
-rw-r--r--ext/standard/password.c9
-rw-r--r--ext/standard/php_fopen_wrapper.c4
-rw-r--r--ext/standard/php_http.h6
-rw-r--r--ext/standard/proc_open.c12
-rw-r--r--ext/standard/quot_print.c2
-rw-r--r--ext/standard/soundex.c4
-rw-r--r--ext/standard/streamsfuncs.c42
-rw-r--r--ext/standard/string.c26
-rw-r--r--ext/standard/tests/serialize/bug68044.phpt4
-rw-r--r--ext/standard/type.c2
-rw-r--r--ext/standard/url.c12
-rw-r--r--ext/standard/url.h11
-rw-r--r--ext/standard/uuencode.c5
-rw-r--r--ext/standard/var.c8
-rw-r--r--ext/tidy/tidy.c4
61 files changed, 1313 insertions, 1047 deletions
diff --git a/ext/date/lib/timezonedb.h b/ext/date/lib/timezonedb.h
index 98e7b2292c..0fd9bfbe10 100644
--- a/ext/date/lib/timezonedb.h
+++ b/ext/date/lib/timezonedb.h
@@ -1,4 +1,4 @@
-const timelib_tzdb_index_entry timezonedb_idx_builtin[582] = {
+const timelib_tzdb_index_entry timezonedb_idx_builtin[583] = {
{ "Africa/Abidjan" , 0x000000 },
{ "Africa/Accra" , 0x000055 },
{ "Africa/Addis_Ababa" , 0x00019D },
@@ -261,329 +261,330 @@ const timelib_tzdb_index_entry timezonedb_idx_builtin[582] = {
{ "Asia/Harbin" , 0x01B474 },
{ "Asia/Hebron" , 0x01B514 },
{ "Asia/Ho_Chi_Minh" , 0x01B870 },
- { "Asia/Hong_Kong" , 0x01B8E8 },
- { "Asia/Hovd" , 0x01BAAA },
- { "Asia/Irkutsk" , 0x01BC22 },
- { "Asia/Istanbul" , 0x01BE0D },
- { "Asia/Jakarta" , 0x01C1FA },
- { "Asia/Jayapura" , 0x01C2A4 },
- { "Asia/Jerusalem" , 0x01C341 },
- { "Asia/Kabul" , 0x01C670 },
- { "Asia/Kamchatka" , 0x01C6C1 },
- { "Asia/Karachi" , 0x01C8BA },
- { "Asia/Kashgar" , 0x01C96F },
- { "Asia/Kathmandu" , 0x01C9C4 },
- { "Asia/Katmandu" , 0x01CA2A },
- { "Asia/Khandyga" , 0x01CA90 },
- { "Asia/Kolkata" , 0x01CCBA },
- { "Asia/Krasnoyarsk" , 0x01CD33 },
- { "Asia/Kuala_Lumpur" , 0x01CF20 },
- { "Asia/Kuching" , 0x01CFDD },
- { "Asia/Kuwait" , 0x01D0CB },
- { "Asia/Macao" , 0x01D120 },
- { "Asia/Macau" , 0x01D25B },
- { "Asia/Magadan" , 0x01D396 },
- { "Asia/Makassar" , 0x01D59A },
- { "Asia/Manila" , 0x01D65F },
- { "Asia/Muscat" , 0x01D6E4 },
- { "Asia/Nicosia" , 0x01D739 },
- { "Asia/Novokuznetsk" , 0x01DA21 },
- { "Asia/Novosibirsk" , 0x01DC41 },
- { "Asia/Omsk" , 0x01DE31 },
- { "Asia/Oral" , 0x01E01D },
- { "Asia/Phnom_Penh" , 0x01E1ED },
- { "Asia/Pontianak" , 0x01E265 },
- { "Asia/Pyongyang" , 0x01E327 },
- { "Asia/Qatar" , 0x01E3B7 },
- { "Asia/Qyzylorda" , 0x01E41D },
- { "Asia/Rangoon" , 0x01E5F3 },
- { "Asia/Riyadh" , 0x01E66B },
- { "Asia/Saigon" , 0x01E6C0 },
- { "Asia/Sakhalin" , 0x01E738 },
- { "Asia/Samarkand" , 0x01E935 },
- { "Asia/Seoul" , 0x01EA6B },
- { "Asia/Shanghai" , 0x01EB32 },
- { "Asia/Singapore" , 0x01EBDE },
- { "Asia/Srednekolymsk" , 0x01EC95 },
- { "Asia/Taipei" , 0x01EE95 },
- { "Asia/Tashkent" , 0x01EFC6 },
- { "Asia/Tbilisi" , 0x01F0F7 },
- { "Asia/Tehran" , 0x01F2B1 },
- { "Asia/Tel_Aviv" , 0x01F51F },
- { "Asia/Thimbu" , 0x01F84E },
- { "Asia/Thimphu" , 0x01F8B4 },
- { "Asia/Tokyo" , 0x01F91A },
- { "Asia/Ujung_Pandang" , 0x01F9A4 },
- { "Asia/Ulaanbaatar" , 0x01FA21 },
- { "Asia/Ulan_Bator" , 0x01FB7C },
- { "Asia/Urumqi" , 0x01FCC9 },
- { "Asia/Ust-Nera" , 0x01FD2B },
- { "Asia/Vientiane" , 0x01FF3D },
- { "Asia/Vladivostok" , 0x01FFB5 },
- { "Asia/Yakutsk" , 0x02019F },
- { "Asia/Yekaterinburg" , 0x020389 },
- { "Asia/Yerevan" , 0x0205AA },
- { "Atlantic/Azores" , 0x0207AA },
- { "Atlantic/Bermuda" , 0x020CAD },
- { "Atlantic/Canary" , 0x020F8E },
- { "Atlantic/Cape_Verde" , 0x021264 },
- { "Atlantic/Faeroe" , 0x0212DD },
- { "Atlantic/Faroe" , 0x021581 },
- { "Atlantic/Jan_Mayen" , 0x021825 },
- { "Atlantic/Madeira" , 0x021B57 },
- { "Atlantic/Reykjavik" , 0x022060 },
- { "Atlantic/South_Georgia" , 0x022219 },
- { "Atlantic/St_Helena" , 0x02242B },
- { "Atlantic/Stanley" , 0x02225D },
- { "Australia/ACT" , 0x022480 },
- { "Australia/Adelaide" , 0x0227A3 },
- { "Australia/Brisbane" , 0x022AD5 },
- { "Australia/Broken_Hill" , 0x022BA2 },
- { "Australia/Canberra" , 0x022EE6 },
- { "Australia/Currie" , 0x023209 },
- { "Australia/Darwin" , 0x023542 },
- { "Australia/Eucla" , 0x0235CE },
- { "Australia/Hobart" , 0x0236AA },
- { "Australia/LHI" , 0x023A0E },
- { "Australia/Lindeman" , 0x023CAF },
- { "Australia/Lord_Howe" , 0x023D96 },
- { "Australia/Melbourne" , 0x024047 },
- { "Australia/North" , 0x024372 },
- { "Australia/NSW" , 0x0243EC },
- { "Australia/Perth" , 0x02470F },
- { "Australia/Queensland" , 0x0247ED },
- { "Australia/South" , 0x02489F },
- { "Australia/Sydney" , 0x024BC2 },
- { "Australia/Tasmania" , 0x024F05 },
- { "Australia/Victoria" , 0x025250 },
- { "Australia/West" , 0x025573 },
- { "Australia/Yancowinna" , 0x02562F },
- { "Brazil/Acre" , 0x025957 },
- { "Brazil/DeNoronha" , 0x025A5B },
- { "Brazil/East" , 0x025B7B },
- { "Brazil/West" , 0x025E58 },
- { "Canada/Atlantic" , 0x025F50 },
- { "Canada/Central" , 0x026438 },
- { "Canada/East-Saskatchewan" , 0x026D42 },
- { "Canada/Eastern" , 0x026852 },
- { "Canada/Mountain" , 0x026ECB },
- { "Canada/Newfoundland" , 0x027241 },
- { "Canada/Pacific" , 0x02776C },
- { "Canada/Saskatchewan" , 0x027B85 },
- { "Canada/Yukon" , 0x027D0E },
- { "CET" , 0x028011 },
- { "Chile/Continental" , 0x02831A },
- { "Chile/EasterIsland" , 0x0286B5 },
- { "CST6CDT" , 0x0289F7 },
- { "Cuba" , 0x028D48 },
- { "EET" , 0x0290BB },
- { "Egypt" , 0x02936E },
- { "Eire" , 0x029755 },
- { "EST" , 0x029C66 },
- { "EST5EDT" , 0x029CAA },
- { "Etc/GMT" , 0x029FFB },
- { "Etc/GMT+0" , 0x02A0C7 },
- { "Etc/GMT+1" , 0x02A151 },
- { "Etc/GMT+10" , 0x02A1DE },
- { "Etc/GMT+11" , 0x02A26C },
- { "Etc/GMT+12" , 0x02A2FA },
- { "Etc/GMT+2" , 0x02A415 },
- { "Etc/GMT+3" , 0x02A4A1 },
- { "Etc/GMT+4" , 0x02A52D },
- { "Etc/GMT+5" , 0x02A5B9 },
- { "Etc/GMT+6" , 0x02A645 },
- { "Etc/GMT+7" , 0x02A6D1 },
- { "Etc/GMT+8" , 0x02A75D },
- { "Etc/GMT+9" , 0x02A7E9 },
- { "Etc/GMT-0" , 0x02A083 },
- { "Etc/GMT-1" , 0x02A10B },
- { "Etc/GMT-10" , 0x02A197 },
- { "Etc/GMT-11" , 0x02A225 },
- { "Etc/GMT-12" , 0x02A2B3 },
- { "Etc/GMT-13" , 0x02A341 },
- { "Etc/GMT-14" , 0x02A388 },
- { "Etc/GMT-2" , 0x02A3CF },
- { "Etc/GMT-3" , 0x02A45B },
- { "Etc/GMT-4" , 0x02A4E7 },
- { "Etc/GMT-5" , 0x02A573 },
- { "Etc/GMT-6" , 0x02A5FF },
- { "Etc/GMT-7" , 0x02A68B },
- { "Etc/GMT-8" , 0x02A717 },
- { "Etc/GMT-9" , 0x02A7A3 },
- { "Etc/GMT0" , 0x02A03F },
- { "Etc/Greenwich" , 0x02A82F },
- { "Etc/UCT" , 0x02A873 },
- { "Etc/Universal" , 0x02A8B7 },
- { "Etc/UTC" , 0x02A8FB },
- { "Etc/Zulu" , 0x02A93F },
- { "Europe/Amsterdam" , 0x02A983 },
- { "Europe/Andorra" , 0x02ADC1 },
- { "Europe/Athens" , 0x02B03D },
- { "Europe/Belfast" , 0x02B380 },
- { "Europe/Belgrade" , 0x02B8B7 },
- { "Europe/Berlin" , 0x02BB80 },
- { "Europe/Bratislava" , 0x02BEE4 },
- { "Europe/Brussels" , 0x02C216 },
- { "Europe/Bucharest" , 0x02C64D },
- { "Europe/Budapest" , 0x02C977 },
- { "Europe/Busingen" , 0x02CCE0 },
- { "Europe/Chisinau" , 0x02CF97 },
- { "Europe/Copenhagen" , 0x02D325 },
- { "Europe/Dublin" , 0x02D62F },
- { "Europe/Gibraltar" , 0x02DB40 },
- { "Europe/Guernsey" , 0x02DF97 },
- { "Europe/Helsinki" , 0x02E4CE },
- { "Europe/Isle_of_Man" , 0x02E784 },
- { "Europe/Istanbul" , 0x02ECBB },
- { "Europe/Jersey" , 0x02F0A8 },
- { "Europe/Kaliningrad" , 0x02F5DF },
- { "Europe/Kiev" , 0x02F84A },
- { "Europe/Lisbon" , 0x02FB66 },
- { "Europe/Ljubljana" , 0x03006A },
- { "Europe/London" , 0x030333 },
- { "Europe/Luxembourg" , 0x03086A },
- { "Europe/Madrid" , 0x030CC0 },
- { "Europe/Malta" , 0x031086 },
- { "Europe/Mariehamn" , 0x03143F },
- { "Europe/Minsk" , 0x0316F5 },
- { "Europe/Monaco" , 0x031903 },
- { "Europe/Moscow" , 0x031D3E },
- { "Europe/Nicosia" , 0x031F98 },
- { "Europe/Oslo" , 0x032280 },
- { "Europe/Paris" , 0x0325B2 },
- { "Europe/Podgorica" , 0x0329F8 },
- { "Europe/Prague" , 0x032CC1 },
- { "Europe/Riga" , 0x032FF3 },
- { "Europe/Rome" , 0x033338 },
- { "Europe/Samara" , 0x0336FB },
- { "Europe/San_Marino" , 0x033964 },
- { "Europe/Sarajevo" , 0x033D27 },
- { "Europe/Simferopol" , 0x033FF0 },
- { "Europe/Skopje" , 0x034241 },
- { "Europe/Sofia" , 0x03450A },
- { "Europe/Stockholm" , 0x034812 },
- { "Europe/Tallinn" , 0x034AC1 },
- { "Europe/Tirane" , 0x034DFB },
- { "Europe/Tiraspol" , 0x035101 },
- { "Europe/Uzhgorod" , 0x03548F },
- { "Europe/Vaduz" , 0x0357A6 },
- { "Europe/Vatican" , 0x035A55 },
- { "Europe/Vienna" , 0x035E18 },
- { "Europe/Vilnius" , 0x036145 },
- { "Europe/Volgograd" , 0x036484 },
- { "Europe/Warsaw" , 0x0366A5 },
- { "Europe/Zagreb" , 0x036A86 },
- { "Europe/Zaporozhye" , 0x036D4F },
- { "Europe/Zurich" , 0x037090 },
- { "Factory" , 0x03733F },
- { "GB" , 0x0373B0 },
- { "GB-Eire" , 0x0378E7 },
- { "GMT" , 0x037E1E },
- { "GMT+0" , 0x037EEA },
- { "GMT-0" , 0x037EA6 },
- { "GMT0" , 0x037E62 },
- { "Greenwich" , 0x037F2E },
- { "Hongkong" , 0x037F72 },
- { "HST" , 0x038134 },
- { "Iceland" , 0x038178 },
- { "Indian/Antananarivo" , 0x038331 },
- { "Indian/Chagos" , 0x0383A5 },
- { "Indian/Christmas" , 0x038407 },
- { "Indian/Cocos" , 0x03844B },
- { "Indian/Comoro" , 0x03848F },
- { "Indian/Kerguelen" , 0x0384E4 },
- { "Indian/Mahe" , 0x038539 },
- { "Indian/Maldives" , 0x03858E },
- { "Indian/Mauritius" , 0x0385E3 },
- { "Indian/Mayotte" , 0x038659 },
- { "Indian/Reunion" , 0x0386AE },
- { "Iran" , 0x038703 },
- { "Israel" , 0x038971 },
- { "Jamaica" , 0x038CA0 },
- { "Japan" , 0x038D65 },
- { "Kwajalein" , 0x038DEF },
- { "Libya" , 0x038E52 },
- { "MET" , 0x038F5B },
- { "Mexico/BajaNorte" , 0x039264 },
- { "Mexico/BajaSur" , 0x0395CD },
- { "Mexico/General" , 0x039812 },
- { "MST" , 0x039A70 },
- { "MST7MDT" , 0x039AB4 },
- { "Navajo" , 0x039E05 },
- { "NZ" , 0x03A17E },
- { "NZ-CHAT" , 0x03A4FC },
- { "Pacific/Apia" , 0x03A7E0 },
- { "Pacific/Auckland" , 0x03A97C },
- { "Pacific/Chatham" , 0x03AD08 },
- { "Pacific/Chuuk" , 0x03AFFB },
- { "Pacific/Easter" , 0x03B054 },
- { "Pacific/Efate" , 0x03B3A3 },
- { "Pacific/Enderbury" , 0x03B469 },
- { "Pacific/Fakaofo" , 0x03B4D7 },
- { "Pacific/Fiji" , 0x03B528 },
- { "Pacific/Funafuti" , 0x03B6BB },
- { "Pacific/Galapagos" , 0x03B6FF },
- { "Pacific/Gambier" , 0x03B777 },
- { "Pacific/Guadalcanal" , 0x03B7DC },
- { "Pacific/Guam" , 0x03B831 },
- { "Pacific/Honolulu" , 0x03B887 },
- { "Pacific/Johnston" , 0x03B8FE },
- { "Pacific/Kiritimati" , 0x03B97D },
- { "Pacific/Kosrae" , 0x03B9E8 },
- { "Pacific/Kwajalein" , 0x03BA45 },
- { "Pacific/Majuro" , 0x03BAB1 },
- { "Pacific/Marquesas" , 0x03BB10 },
- { "Pacific/Midway" , 0x03BB77 },
- { "Pacific/Nauru" , 0x03BC01 },
- { "Pacific/Niue" , 0x03BC79 },
- { "Pacific/Norfolk" , 0x03BCD7 },
- { "Pacific/Noumea" , 0x03BD2C },
- { "Pacific/Pago_Pago" , 0x03BDBC },
- { "Pacific/Palau" , 0x03BE33 },
- { "Pacific/Pitcairn" , 0x03BE77 },
- { "Pacific/Pohnpei" , 0x03BECC },
- { "Pacific/Ponape" , 0x03BF21 },
- { "Pacific/Port_Moresby" , 0x03BF66 },
- { "Pacific/Rarotonga" , 0x03BFAA },
- { "Pacific/Saipan" , 0x03C086 },
- { "Pacific/Samoa" , 0x03C0E9 },
- { "Pacific/Tahiti" , 0x03C160 },
- { "Pacific/Tarawa" , 0x03C1C5 },
- { "Pacific/Tongatapu" , 0x03C219 },
- { "Pacific/Truk" , 0x03C2A5 },
- { "Pacific/Wake" , 0x03C2EA },
- { "Pacific/Wallis" , 0x03C33A },
- { "Pacific/Yap" , 0x03C37E },
- { "Poland" , 0x03C3C3 },
- { "Portugal" , 0x03C7A4 },
- { "PRC" , 0x03CCA0 },
- { "PST8PDT" , 0x03CD40 },
- { "ROC" , 0x03D091 },
- { "ROK" , 0x03D1C2 },
- { "Singapore" , 0x03D289 },
- { "Turkey" , 0x03D340 },
- { "UCT" , 0x03D72D },
- { "Universal" , 0x03D771 },
- { "US/Alaska" , 0x03D7B5 },
- { "US/Aleutian" , 0x03DB1E },
- { "US/Arizona" , 0x03DE84 },
- { "US/Central" , 0x03DF12 },
- { "US/East-Indiana" , 0x03E91C },
- { "US/Eastern" , 0x03E41D },
- { "US/Hawaii" , 0x03EB86 },
- { "US/Indiana-Starke" , 0x03EBF7 },
- { "US/Michigan" , 0x03EF68 },
- { "US/Mountain" , 0x03F29F },
- { "US/Pacific" , 0x03F618 },
- { "US/Pacific-New" , 0x03FA1D },
- { "US/Samoa" , 0x03FE22 },
- { "UTC" , 0x03FE99 },
- { "W-SU" , 0x040190 },
- { "WET" , 0x03FEDD },
- { "Zulu" , 0x0403D3 },
+ { "Asia/Hong_Kong" , 0x01B912 },
+ { "Asia/Hovd" , 0x01BAD4 },
+ { "Asia/Irkutsk" , 0x01BC4C },
+ { "Asia/Istanbul" , 0x01BE37 },
+ { "Asia/Jakarta" , 0x01C224 },
+ { "Asia/Jayapura" , 0x01C2CE },
+ { "Asia/Jerusalem" , 0x01C36B },
+ { "Asia/Kabul" , 0x01C69A },
+ { "Asia/Kamchatka" , 0x01C6EB },
+ { "Asia/Karachi" , 0x01C8E4 },
+ { "Asia/Kashgar" , 0x01C999 },
+ { "Asia/Kathmandu" , 0x01C9EE },
+ { "Asia/Katmandu" , 0x01CA54 },
+ { "Asia/Khandyga" , 0x01CABA },
+ { "Asia/Kolkata" , 0x01CCE4 },
+ { "Asia/Krasnoyarsk" , 0x01CD5D },
+ { "Asia/Kuala_Lumpur" , 0x01CF4A },
+ { "Asia/Kuching" , 0x01D007 },
+ { "Asia/Kuwait" , 0x01D0F5 },
+ { "Asia/Macao" , 0x01D14A },
+ { "Asia/Macau" , 0x01D285 },
+ { "Asia/Magadan" , 0x01D3C0 },
+ { "Asia/Makassar" , 0x01D5C4 },
+ { "Asia/Manila" , 0x01D689 },
+ { "Asia/Muscat" , 0x01D70E },
+ { "Asia/Nicosia" , 0x01D763 },
+ { "Asia/Novokuznetsk" , 0x01DA4B },
+ { "Asia/Novosibirsk" , 0x01DC6B },
+ { "Asia/Omsk" , 0x01DE5B },
+ { "Asia/Oral" , 0x01E047 },
+ { "Asia/Phnom_Penh" , 0x01E217 },
+ { "Asia/Pontianak" , 0x01E26C },
+ { "Asia/Pyongyang" , 0x01E32E },
+ { "Asia/Qatar" , 0x01E3BE },
+ { "Asia/Qyzylorda" , 0x01E424 },
+ { "Asia/Rangoon" , 0x01E5FA },
+ { "Asia/Riyadh" , 0x01E672 },
+ { "Asia/Saigon" , 0x01E6C7 },
+ { "Asia/Sakhalin" , 0x01E769 },
+ { "Asia/Samarkand" , 0x01E966 },
+ { "Asia/Seoul" , 0x01EA9C },
+ { "Asia/Shanghai" , 0x01EB63 },
+ { "Asia/Singapore" , 0x01EC0F },
+ { "Asia/Srednekolymsk" , 0x01ECC6 },
+ { "Asia/Taipei" , 0x01EEC6 },
+ { "Asia/Tashkent" , 0x01EFF7 },
+ { "Asia/Tbilisi" , 0x01F128 },
+ { "Asia/Tehran" , 0x01F2E2 },
+ { "Asia/Tel_Aviv" , 0x01F550 },
+ { "Asia/Thimbu" , 0x01F87F },
+ { "Asia/Thimphu" , 0x01F8E5 },
+ { "Asia/Tokyo" , 0x01F94B },
+ { "Asia/Ujung_Pandang" , 0x01F9D5 },
+ { "Asia/Ulaanbaatar" , 0x01FA52 },
+ { "Asia/Ulan_Bator" , 0x01FBAD },
+ { "Asia/Urumqi" , 0x01FCFA },
+ { "Asia/Ust-Nera" , 0x01FD5C },
+ { "Asia/Vientiane" , 0x01FF6E },
+ { "Asia/Vladivostok" , 0x01FFC3 },
+ { "Asia/Yakutsk" , 0x0201AD },
+ { "Asia/Yekaterinburg" , 0x020397 },
+ { "Asia/Yerevan" , 0x0205B8 },
+ { "Atlantic/Azores" , 0x0207B8 },
+ { "Atlantic/Bermuda" , 0x020CBB },
+ { "Atlantic/Canary" , 0x020F9C },
+ { "Atlantic/Cape_Verde" , 0x021272 },
+ { "Atlantic/Faeroe" , 0x0212EB },
+ { "Atlantic/Faroe" , 0x02158F },
+ { "Atlantic/Jan_Mayen" , 0x021833 },
+ { "Atlantic/Madeira" , 0x021B65 },
+ { "Atlantic/Reykjavik" , 0x02206E },
+ { "Atlantic/South_Georgia" , 0x022227 },
+ { "Atlantic/St_Helena" , 0x022439 },
+ { "Atlantic/Stanley" , 0x02226B },
+ { "Australia/ACT" , 0x02248E },
+ { "Australia/Adelaide" , 0x0227B1 },
+ { "Australia/Brisbane" , 0x022AE3 },
+ { "Australia/Broken_Hill" , 0x022BB0 },
+ { "Australia/Canberra" , 0x022EF4 },
+ { "Australia/Currie" , 0x023217 },
+ { "Australia/Darwin" , 0x023550 },
+ { "Australia/Eucla" , 0x0235DC },
+ { "Australia/Hobart" , 0x0236B8 },
+ { "Australia/LHI" , 0x023A1C },
+ { "Australia/Lindeman" , 0x023CBD },
+ { "Australia/Lord_Howe" , 0x023DA4 },
+ { "Australia/Melbourne" , 0x024055 },
+ { "Australia/North" , 0x024380 },
+ { "Australia/NSW" , 0x0243FA },
+ { "Australia/Perth" , 0x02471D },
+ { "Australia/Queensland" , 0x0247FB },
+ { "Australia/South" , 0x0248AD },
+ { "Australia/Sydney" , 0x024BD0 },
+ { "Australia/Tasmania" , 0x024F13 },
+ { "Australia/Victoria" , 0x02525E },
+ { "Australia/West" , 0x025581 },
+ { "Australia/Yancowinna" , 0x02563D },
+ { "Brazil/Acre" , 0x025965 },
+ { "Brazil/DeNoronha" , 0x025A69 },
+ { "Brazil/East" , 0x025B89 },
+ { "Brazil/West" , 0x025E66 },
+ { "Canada/Atlantic" , 0x025F5E },
+ { "Canada/Central" , 0x026446 },
+ { "Canada/East-Saskatchewan" , 0x026D50 },
+ { "Canada/Eastern" , 0x026860 },
+ { "Canada/Mountain" , 0x026ED9 },
+ { "Canada/Newfoundland" , 0x02724F },
+ { "Canada/Pacific" , 0x02777A },
+ { "Canada/Saskatchewan" , 0x027B93 },
+ { "Canada/Yukon" , 0x027D1C },
+ { "CET" , 0x02801F },
+ { "Chile/Continental" , 0x028328 },
+ { "Chile/EasterIsland" , 0x0286C3 },
+ { "CST6CDT" , 0x028A05 },
+ { "Cuba" , 0x028D56 },
+ { "EET" , 0x0290C9 },
+ { "Egypt" , 0x02937C },
+ { "Eire" , 0x029763 },
+ { "EST" , 0x029C74 },
+ { "EST5EDT" , 0x029CB8 },
+ { "Etc/GMT" , 0x02A009 },
+ { "Etc/GMT+0" , 0x02A0D5 },
+ { "Etc/GMT+1" , 0x02A15F },
+ { "Etc/GMT+10" , 0x02A1EC },
+ { "Etc/GMT+11" , 0x02A27A },
+ { "Etc/GMT+12" , 0x02A308 },
+ { "Etc/GMT+2" , 0x02A423 },
+ { "Etc/GMT+3" , 0x02A4AF },
+ { "Etc/GMT+4" , 0x02A53B },
+ { "Etc/GMT+5" , 0x02A5C7 },
+ { "Etc/GMT+6" , 0x02A653 },
+ { "Etc/GMT+7" , 0x02A6DF },
+ { "Etc/GMT+8" , 0x02A76B },
+ { "Etc/GMT+9" , 0x02A7F7 },
+ { "Etc/GMT-0" , 0x02A091 },
+ { "Etc/GMT-1" , 0x02A119 },
+ { "Etc/GMT-10" , 0x02A1A5 },
+ { "Etc/GMT-11" , 0x02A233 },
+ { "Etc/GMT-12" , 0x02A2C1 },
+ { "Etc/GMT-13" , 0x02A34F },
+ { "Etc/GMT-14" , 0x02A396 },
+ { "Etc/GMT-2" , 0x02A3DD },
+ { "Etc/GMT-3" , 0x02A469 },
+ { "Etc/GMT-4" , 0x02A4F5 },
+ { "Etc/GMT-5" , 0x02A581 },
+ { "Etc/GMT-6" , 0x02A60D },
+ { "Etc/GMT-7" , 0x02A699 },
+ { "Etc/GMT-8" , 0x02A725 },
+ { "Etc/GMT-9" , 0x02A7B1 },
+ { "Etc/GMT0" , 0x02A04D },
+ { "Etc/Greenwich" , 0x02A83D },
+ { "Etc/UCT" , 0x02A881 },
+ { "Etc/Universal" , 0x02A8C5 },
+ { "Etc/UTC" , 0x02A909 },
+ { "Etc/Zulu" , 0x02A94D },
+ { "Europe/Amsterdam" , 0x02A991 },
+ { "Europe/Andorra" , 0x02ADCF },
+ { "Europe/Athens" , 0x02B04B },
+ { "Europe/Belfast" , 0x02B38E },
+ { "Europe/Belgrade" , 0x02B8C5 },
+ { "Europe/Berlin" , 0x02BB8E },
+ { "Europe/Bratislava" , 0x02BEF2 },
+ { "Europe/Brussels" , 0x02C224 },
+ { "Europe/Bucharest" , 0x02C65B },
+ { "Europe/Budapest" , 0x02C985 },
+ { "Europe/Busingen" , 0x02CCEE },
+ { "Europe/Chisinau" , 0x02CFA5 },
+ { "Europe/Copenhagen" , 0x02D333 },
+ { "Europe/Dublin" , 0x02D63D },
+ { "Europe/Gibraltar" , 0x02DB4E },
+ { "Europe/Guernsey" , 0x02DFA5 },
+ { "Europe/Helsinki" , 0x02E4DC },
+ { "Europe/Isle_of_Man" , 0x02E792 },
+ { "Europe/Istanbul" , 0x02ECC9 },
+ { "Europe/Jersey" , 0x02F0B6 },
+ { "Europe/Kaliningrad" , 0x02F5ED },
+ { "Europe/Kiev" , 0x02F858 },
+ { "Europe/Lisbon" , 0x02FB74 },
+ { "Europe/Ljubljana" , 0x030078 },
+ { "Europe/London" , 0x030341 },
+ { "Europe/Luxembourg" , 0x030878 },
+ { "Europe/Madrid" , 0x030CCE },
+ { "Europe/Malta" , 0x031094 },
+ { "Europe/Mariehamn" , 0x03144D },
+ { "Europe/Minsk" , 0x031703 },
+ { "Europe/Monaco" , 0x031916 },
+ { "Europe/Moscow" , 0x031D51 },
+ { "Europe/Nicosia" , 0x031FAB },
+ { "Europe/Oslo" , 0x032293 },
+ { "Europe/Paris" , 0x0325C5 },
+ { "Europe/Podgorica" , 0x032A0B },
+ { "Europe/Prague" , 0x032CD4 },
+ { "Europe/Riga" , 0x033006 },
+ { "Europe/Rome" , 0x03334B },
+ { "Europe/Samara" , 0x03370E },
+ { "Europe/San_Marino" , 0x033977 },
+ { "Europe/Sarajevo" , 0x033D3A },
+ { "Europe/Simferopol" , 0x034003 },
+ { "Europe/Skopje" , 0x034254 },
+ { "Europe/Sofia" , 0x03451D },
+ { "Europe/Stockholm" , 0x034825 },
+ { "Europe/Tallinn" , 0x034AD4 },
+ { "Europe/Tirane" , 0x034E0E },
+ { "Europe/Tiraspol" , 0x035114 },
+ { "Europe/Uzhgorod" , 0x0354A2 },
+ { "Europe/Vaduz" , 0x0357B9 },
+ { "Europe/Vatican" , 0x035A68 },
+ { "Europe/Vienna" , 0x035E2B },
+ { "Europe/Vilnius" , 0x036158 },
+ { "Europe/Volgograd" , 0x036497 },
+ { "Europe/Warsaw" , 0x0366B8 },
+ { "Europe/Zagreb" , 0x036A99 },
+ { "Europe/Zaporozhye" , 0x036D62 },
+ { "Europe/Zurich" , 0x0370A3 },
+ { "Factory" , 0x037352 },
+ { "GB" , 0x0373C3 },
+ { "GB-Eire" , 0x0378FA },
+ { "GMT" , 0x037E31 },
+ { "GMT+0" , 0x037EFD },
+ { "GMT-0" , 0x037EB9 },
+ { "GMT0" , 0x037E75 },
+ { "Greenwich" , 0x037F41 },
+ { "Hongkong" , 0x037F85 },
+ { "HST" , 0x038147 },
+ { "Iceland" , 0x03818B },
+ { "Indian/Antananarivo" , 0x038344 },
+ { "Indian/Chagos" , 0x0383B8 },
+ { "Indian/Christmas" , 0x03841A },
+ { "Indian/Cocos" , 0x03845E },
+ { "Indian/Comoro" , 0x0384A2 },
+ { "Indian/Kerguelen" , 0x0384F7 },
+ { "Indian/Mahe" , 0x03854C },
+ { "Indian/Maldives" , 0x0385A1 },
+ { "Indian/Mauritius" , 0x0385F6 },
+ { "Indian/Mayotte" , 0x03866C },
+ { "Indian/Reunion" , 0x0386C1 },
+ { "Iran" , 0x038716 },
+ { "Israel" , 0x038984 },
+ { "Jamaica" , 0x038CB3 },
+ { "Japan" , 0x038D78 },
+ { "Kwajalein" , 0x038E02 },
+ { "Libya" , 0x038E65 },
+ { "MET" , 0x038F6E },
+ { "Mexico/BajaNorte" , 0x039277 },
+ { "Mexico/BajaSur" , 0x0395E0 },
+ { "Mexico/General" , 0x039825 },
+ { "MST" , 0x039A83 },
+ { "MST7MDT" , 0x039AC7 },
+ { "Navajo" , 0x039E18 },
+ { "NZ" , 0x03A191 },
+ { "NZ-CHAT" , 0x03A50F },
+ { "Pacific/Apia" , 0x03A7F3 },
+ { "Pacific/Auckland" , 0x03A98F },
+ { "Pacific/Bougainville" , 0x03AD1B },
+ { "Pacific/Chatham" , 0x03AD92 },
+ { "Pacific/Chuuk" , 0x03B085 },
+ { "Pacific/Easter" , 0x03B0DE },
+ { "Pacific/Efate" , 0x03B42D },
+ { "Pacific/Enderbury" , 0x03B4F3 },
+ { "Pacific/Fakaofo" , 0x03B561 },
+ { "Pacific/Fiji" , 0x03B5B2 },
+ { "Pacific/Funafuti" , 0x03B745 },
+ { "Pacific/Galapagos" , 0x03B789 },
+ { "Pacific/Gambier" , 0x03B801 },
+ { "Pacific/Guadalcanal" , 0x03B866 },
+ { "Pacific/Guam" , 0x03B8BB },
+ { "Pacific/Honolulu" , 0x03B911 },
+ { "Pacific/Johnston" , 0x03B988 },
+ { "Pacific/Kiritimati" , 0x03BA07 },
+ { "Pacific/Kosrae" , 0x03BA72 },
+ { "Pacific/Kwajalein" , 0x03BACF },
+ { "Pacific/Majuro" , 0x03BB3B },
+ { "Pacific/Marquesas" , 0x03BB9A },
+ { "Pacific/Midway" , 0x03BC01 },
+ { "Pacific/Nauru" , 0x03BC8B },
+ { "Pacific/Niue" , 0x03BD03 },
+ { "Pacific/Norfolk" , 0x03BD61 },
+ { "Pacific/Noumea" , 0x03BDB6 },
+ { "Pacific/Pago_Pago" , 0x03BE46 },
+ { "Pacific/Palau" , 0x03BEBD },
+ { "Pacific/Pitcairn" , 0x03BF01 },
+ { "Pacific/Pohnpei" , 0x03BF56 },
+ { "Pacific/Ponape" , 0x03BFAB },
+ { "Pacific/Port_Moresby" , 0x03BFF0 },
+ { "Pacific/Rarotonga" , 0x03C042 },
+ { "Pacific/Saipan" , 0x03C11E },
+ { "Pacific/Samoa" , 0x03C181 },
+ { "Pacific/Tahiti" , 0x03C1F8 },
+ { "Pacific/Tarawa" , 0x03C25D },
+ { "Pacific/Tongatapu" , 0x03C2B1 },
+ { "Pacific/Truk" , 0x03C33D },
+ { "Pacific/Wake" , 0x03C382 },
+ { "Pacific/Wallis" , 0x03C3D2 },
+ { "Pacific/Yap" , 0x03C416 },
+ { "Poland" , 0x03C45B },
+ { "Portugal" , 0x03C83C },
+ { "PRC" , 0x03CD38 },
+ { "PST8PDT" , 0x03CDD8 },
+ { "ROC" , 0x03D129 },
+ { "ROK" , 0x03D25A },
+ { "Singapore" , 0x03D321 },
+ { "Turkey" , 0x03D3D8 },
+ { "UCT" , 0x03D7C5 },
+ { "Universal" , 0x03D809 },
+ { "US/Alaska" , 0x03D84D },
+ { "US/Aleutian" , 0x03DBB6 },
+ { "US/Arizona" , 0x03DF1C },
+ { "US/Central" , 0x03DFAA },
+ { "US/East-Indiana" , 0x03E9B4 },
+ { "US/Eastern" , 0x03E4B5 },
+ { "US/Hawaii" , 0x03EC1E },
+ { "US/Indiana-Starke" , 0x03EC8F },
+ { "US/Michigan" , 0x03F000 },
+ { "US/Mountain" , 0x03F337 },
+ { "US/Pacific" , 0x03F6B0 },
+ { "US/Pacific-New" , 0x03FAB5 },
+ { "US/Samoa" , 0x03FEBA },
+ { "UTC" , 0x03FF31 },
+ { "W-SU" , 0x040228 },
+ { "WET" , 0x03FF75 },
+ { "Zulu" , 0x04046B },
};
/* This is a generated file, do not modify */
-const unsigned char timelib_timezone_db_data_builtin[263191] = {
+const unsigned char timelib_timezone_db_data_builtin[263343] = {
/* Africa/Abidjan */
@@ -8304,13 +8305,16 @@ const unsigned char timelib_timezone_db_data_builtin[263191] = {
/* Asia/Ho_Chi_Minh */
0x50, 0x48, 0x50, 0x31, 0x01, 0x56, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0C, 0x88, 0x6F, 0x42, 0x80,
-0x91, 0x5F, 0xEE, 0xD0, 0x93, 0x85, 0xB1, 0x90, 0xB7, 0x41, 0xBC, 0x00, 0x01, 0x02, 0x03, 0x02,
-0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0xEC, 0x00, 0x04, 0x00, 0x00, 0x62, 0x70,
-0x00, 0x08, 0x00, 0x00, 0x70, 0x80, 0x00, 0x08, 0x4C, 0x4D, 0x54, 0x00, 0x53, 0x4D, 0x54, 0x00,
-0x49, 0x43, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0xBB, 0x78,
-0x01, 0xB5, 0x6B, 0x2A, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x15, 0x88, 0x8C, 0x43, 0x80,
+0x91, 0xA3, 0x2B, 0x0A, 0xCD, 0x35, 0xE6, 0x80, 0xD1, 0x59, 0xCE, 0x70, 0xD2, 0x3B, 0x3E, 0xF0,
+0xD5, 0x32, 0xBB, 0x10, 0xE4, 0xB6, 0xE4, 0x80, 0xED, 0x2F, 0x98, 0x00, 0x0A, 0x3D, 0xC7, 0x00,
+0x01, 0x02, 0x03, 0x04, 0x02, 0x03, 0x02, 0x03, 0x02, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x63, 0xF6, 0x00, 0x04, 0x00, 0x00, 0x62, 0x70, 0x00, 0x09, 0x00, 0x00, 0x70, 0x80, 0x00,
+0x0D, 0x00, 0x00, 0x7E, 0x90, 0x00, 0x11, 0x4C, 0x4D, 0x54, 0x00, 0x50, 0x4C, 0x4D, 0x54, 0x00,
+0x49, 0x43, 0x54, 0x00, 0x49, 0x44, 0x54, 0x00, 0x4A, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0xBB, 0x78, 0x01, 0xB5, 0x6B, 0x2A, 0x00, 0x00,
+0x00, 0x00,
/* Asia/Hong_Kong */
0x50, 0x48, 0x50, 0x31, 0x01, 0x48, 0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -9046,13 +9050,11 @@ const unsigned char timelib_timezone_db_data_builtin[263191] = {
/* Asia/Phnom_Penh */
0x50, 0x48, 0x50, 0x31, 0x01, 0x4B, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0C, 0x88, 0x6F, 0x44, 0x24,
-0x91, 0x5F, 0xEE, 0xD0, 0x93, 0x85, 0xB1, 0x90, 0xB7, 0x41, 0xBC, 0x00, 0x01, 0x02, 0x03, 0x02,
-0x00, 0x00, 0x62, 0x5C, 0x00, 0x00, 0x00, 0x00, 0x63, 0xEC, 0x00, 0x04, 0x00, 0x00, 0x62, 0x70,
-0x00, 0x08, 0x00, 0x00, 0x70, 0x80, 0x00, 0x08, 0x4C, 0x4D, 0x54, 0x00, 0x53, 0x4D, 0x54, 0x00,
-0x49, 0x43, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9A, 0xF3, 0xF8,
-0x01, 0xB2, 0xBF, 0x92, 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, 0xA2, 0x6A, 0x67, 0xC4,
+0x01, 0x00, 0x00, 0x5E, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x62, 0x70, 0x00, 0x04, 0x42, 0x4D, 0x54,
+0x00, 0x49, 0x43, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9A, 0xF3, 0xF8, 0x01, 0xB2, 0xBF,
+0x92, 0x00, 0x00, 0x00, 0x00,
/* Asia/Pontianak */
0x50, 0x48, 0x50, 0x31, 0x01, 0x49, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -9142,13 +9144,16 @@ const unsigned char timelib_timezone_db_data_builtin[263191] = {
/* Asia/Saigon */
0x50, 0x48, 0x50, 0x31, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0C, 0x88, 0x6F, 0x42, 0x80,
-0x91, 0x5F, 0xEE, 0xD0, 0x93, 0x85, 0xB1, 0x90, 0xB7, 0x41, 0xBC, 0x00, 0x01, 0x02, 0x03, 0x02,
-0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0xEC, 0x00, 0x04, 0x00, 0x00, 0x62, 0x70,
-0x00, 0x08, 0x00, 0x00, 0x70, 0x80, 0x00, 0x08, 0x4C, 0x4D, 0x54, 0x00, 0x53, 0x4D, 0x54, 0x00,
-0x49, 0x43, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x54, 0x40,
-0x01, 0x12, 0xA8, 0x80, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x15, 0x88, 0x8C, 0x43, 0x80,
+0x91, 0xA3, 0x2B, 0x0A, 0xCD, 0x35, 0xE6, 0x80, 0xD1, 0x59, 0xCE, 0x70, 0xD2, 0x3B, 0x3E, 0xF0,
+0xD5, 0x32, 0xBB, 0x10, 0xE4, 0xB6, 0xE4, 0x80, 0xED, 0x2F, 0x98, 0x00, 0x0A, 0x3D, 0xC7, 0x00,
+0x01, 0x02, 0x03, 0x04, 0x02, 0x03, 0x02, 0x03, 0x02, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x63, 0xF6, 0x00, 0x04, 0x00, 0x00, 0x62, 0x70, 0x00, 0x09, 0x00, 0x00, 0x70, 0x80, 0x00,
+0x0D, 0x00, 0x00, 0x7E, 0x90, 0x00, 0x11, 0x4C, 0x4D, 0x54, 0x00, 0x50, 0x4C, 0x4D, 0x54, 0x00,
+0x49, 0x43, 0x54, 0x00, 0x49, 0x44, 0x54, 0x00, 0x4A, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, 0x00, 0x00,
+0x00, 0x00,
/* Asia/Sakhalin */
0x50, 0x48, 0x50, 0x31, 0x01, 0x52, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -9584,13 +9589,11 @@ const unsigned char timelib_timezone_db_data_builtin[263191] = {
/* Asia/Vientiane */
0x50, 0x48, 0x50, 0x31, 0x01, 0x4C, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0C, 0x88, 0x6F, 0x46, 0x50,
-0x91, 0x5F, 0xEE, 0xD0, 0x93, 0x85, 0xB1, 0x90, 0xB7, 0x41, 0xBC, 0x00, 0x01, 0x02, 0x03, 0x02,
-0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x63, 0xEC, 0x00, 0x04, 0x00, 0x00, 0x62, 0x70,
-0x00, 0x08, 0x00, 0x00, 0x70, 0x80, 0x00, 0x08, 0x4C, 0x4D, 0x54, 0x00, 0x53, 0x4D, 0x54, 0x00,
-0x49, 0x43, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA4, 0xBE, 0x7A,
-0x01, 0xAF, 0x36, 0xA0, 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, 0xA2, 0x6A, 0x67, 0xC4,
+0x01, 0x00, 0x00, 0x5E, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x62, 0x70, 0x00, 0x04, 0x42, 0x4D, 0x54,
+0x00, 0x49, 0x43, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA4, 0xBE, 0x7A, 0x01, 0xAF, 0x36,
+0xA0, 0x00, 0x00, 0x00, 0x00,
/* Asia/Vladivostok */
0x50, 0x48, 0x50, 0x31, 0x01, 0x52, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -14391,7 +14394,7 @@ const unsigned char timelib_timezone_db_data_builtin[263191] = {
/* Europe/Minsk */
0x50, 0x48, 0x50, 0x31, 0x01, 0x42, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x22, 0xAA, 0x19, 0xAA, 0x38,
+0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x22, 0xAA, 0x19, 0xAA, 0x38,
0xB5, 0xA4, 0x19, 0x60, 0xCA, 0x5E, 0x70, 0xD0, 0xCC, 0xE7, 0x4B, 0x10, 0xCD, 0xA9, 0x17, 0x90,
0xCE, 0xA2, 0x43, 0x10, 0xCF, 0x92, 0x34, 0x10, 0xD0, 0x0A, 0x02, 0x60, 0x15, 0x27, 0xA7, 0xD0,
0x16, 0x18, 0xDC, 0x40, 0x17, 0x08, 0xDB, 0x50, 0x17, 0xFA, 0x0F, 0xC0, 0x18, 0xEA, 0x0E, 0xD0,
@@ -14408,20 +14411,21 @@ const unsigned char timelib_timezone_db_data_builtin[263191] = {
0x40, 0x66, 0x15, 0x80, 0x41, 0x84, 0x2B, 0x00, 0x42, 0x45, 0xF7, 0x80, 0x43, 0x64, 0x0D, 0x00,
0x44, 0x25, 0xD9, 0x80, 0x45, 0x43, 0xEF, 0x00, 0x46, 0x05, 0xBB, 0x80, 0x47, 0x23, 0xD1, 0x00,
0x47, 0xEE, 0xD8, 0x00, 0x49, 0x03, 0xB3, 0x00, 0x49, 0xCE, 0xBA, 0x00, 0x4A, 0xE3, 0x95, 0x00,
-0x4B, 0xAE, 0x9C, 0x00, 0x4C, 0xCC, 0xB1, 0x80, 0x4D, 0x8E, 0x7E, 0x00, 0x01, 0x02, 0x05, 0x03,
-0x04, 0x03, 0x04, 0x02, 0x06, 0x02, 0x06, 0x02, 0x06, 0x02, 0x06, 0x07, 0x08, 0x07, 0x08, 0x07,
-0x08, 0x07, 0x08, 0x07, 0x08, 0x07, 0x02, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09,
+0x4B, 0xAE, 0x9C, 0x00, 0x4C, 0xCC, 0xB1, 0x80, 0x4D, 0x8E, 0x7E, 0x00, 0x54, 0x4C, 0x1D, 0x60,
+0x01, 0x02, 0x05, 0x03, 0x04, 0x03, 0x04, 0x02, 0x06, 0x02, 0x06, 0x02, 0x06, 0x02, 0x06, 0x07,
+0x08, 0x07, 0x08, 0x07, 0x08, 0x07, 0x08, 0x07, 0x08, 0x07, 0x02, 0x09, 0x0A, 0x09, 0x0A, 0x09,
+0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09,
0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09,
-0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x0B,
-0x00, 0x00, 0x19, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x00, 0x00, 0x2A, 0x30,
-0x00, 0x08, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x1C, 0x20, 0x01, 0x10, 0x00, 0x00,
-0x1C, 0x20, 0x01, 0x10, 0x00, 0x00, 0x38, 0x40, 0x01, 0x15, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x08,
-0x00, 0x00, 0x38, 0x40, 0x01, 0x15, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x19, 0x00, 0x00, 0x1C, 0x20,
-0x00, 0x04, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x1E, 0x4D, 0x4D, 0x54, 0x00, 0x45, 0x45, 0x54, 0x00,
-0x4D, 0x53, 0x4B, 0x00, 0x43, 0x45, 0x54, 0x00, 0x43, 0x45, 0x53, 0x54, 0x00, 0x4D, 0x53, 0x44,
-0x00, 0x45, 0x45, 0x53, 0x54, 0x00, 0x46, 0x45, 0x54, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00,
-0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0xDB, 0x92, 0xF0, 0x01, 0x3C, 0xB8, 0xBA, 0x00, 0x00, 0x00, 0x00,
+0x0A, 0x09, 0x0A, 0x0B, 0x07, 0x00, 0x00, 0x19, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x00,
+0x04, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x08, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x1C,
+0x20, 0x01, 0x10, 0x00, 0x00, 0x1C, 0x20, 0x01, 0x10, 0x00, 0x00, 0x38, 0x40, 0x01, 0x15, 0x00,
+0x00, 0x2A, 0x30, 0x00, 0x08, 0x00, 0x00, 0x38, 0x40, 0x01, 0x15, 0x00, 0x00, 0x2A, 0x30, 0x01,
+0x19, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x1E, 0x4D, 0x4D, 0x54,
+0x00, 0x45, 0x45, 0x54, 0x00, 0x4D, 0x53, 0x4B, 0x00, 0x43, 0x45, 0x54, 0x00, 0x43, 0x45, 0x53,
+0x54, 0x00, 0x4D, 0x53, 0x44, 0x00, 0x45, 0x45, 0x53, 0x54, 0x00, 0x46, 0x45, 0x54, 0x00, 0x00,
+0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDB, 0x92, 0xF0, 0x01, 0x3C, 0xB8, 0xBA, 0x00,
+0x00, 0x00, 0x00,
/* Europe/Monaco */
0x50, 0x48, 0x50, 0x31, 0x01, 0x4D, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -16966,6 +16970,16 @@ const unsigned char timelib_timezone_db_data_builtin[263191] = {
0x00, 0x00, 0x00, 0x51, 0x13, 0x35, 0x02, 0x1D, 0x54, 0xBA, 0x00, 0x00, 0x00, 0x0E, 0x6D, 0x6F,
0x73, 0x74, 0x20, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73,
+/* Pacific/Bougainville */
+0x50, 0x48, 0x50, 0x31, 0x01, 0x50, 0x47, 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, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0xCC, 0x43, 0x36, 0x60,
+0xD2, 0x2B, 0x6C, 0xF0, 0x54, 0x9E, 0xD7, 0x80, 0x01, 0x00, 0x02, 0x00, 0x00, 0x8C, 0xA0, 0x00,
+0x00, 0x00, 0x00, 0x7E, 0x90, 0x00, 0x04, 0x00, 0x00, 0x9A, 0xB0, 0x00, 0x08, 0x50, 0x47, 0x54,
+0x00, 0x4A, 0x53, 0x54, 0x00, 0x42, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x7F, 0xD7, 0xDD, 0x02, 0x00, 0x08, 0xBA, 0x00, 0x00, 0x00, 0x0C, 0x42, 0x6F, 0x75, 0x67, 0x61,
+0x69, 0x6E, 0x76, 0x69, 0x6C, 0x6C, 0x65,
+
/* Pacific/Chatham */
0x50, 0x48, 0x50, 0x31, 0x01, 0x4E, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
@@ -17118,19 +17132,19 @@ const unsigned char timelib_timezone_db_data_builtin[263191] = {
0x36, 0x3B, 0x17, 0xE0, 0x36, 0xD7, 0xFA, 0x60, 0x38, 0x24, 0x34, 0x60, 0x38, 0xB7, 0xDC, 0x60,
0x4B, 0x11, 0x2C, 0xE0, 0x4B, 0xAE, 0x0F, 0x60, 0x4C, 0xC2, 0xEA, 0x60, 0x4D, 0x72, 0x41, 0xE0,
0x4E, 0xA2, 0xCC, 0x60, 0x4F, 0x1A, 0xC4, 0xE0, 0x50, 0x82, 0xAE, 0x60, 0x50, 0xFA, 0xA6, 0xE0,
-0x52, 0x6B, 0xCA, 0xE0, 0x52, 0xDA, 0x7A, 0xD0, 0x54, 0x4B, 0xAC, 0xE0, 0x54, 0xBA, 0x5C, 0xD0,
-0x56, 0x2B, 0x8E, 0xE0, 0x56, 0xA3, 0x79, 0x50, 0x58, 0x0B, 0x70, 0xE0, 0x58, 0x83, 0x5B, 0x50,
-0x59, 0xEB, 0x52, 0xE0, 0x5A, 0x63, 0x3D, 0x50, 0x5B, 0xCB, 0x34, 0xE0, 0x5C, 0x43, 0x1F, 0x50,
-0x5D, 0xB4, 0x51, 0x60, 0x5E, 0x23, 0x01, 0x50, 0x5F, 0x94, 0x33, 0x60, 0x60, 0x0C, 0x1D, 0xD0,
-0x61, 0x74, 0x15, 0x60, 0x61, 0xEB, 0xFF, 0xD0, 0x63, 0x53, 0xF7, 0x60, 0x63, 0xCB, 0xE1, 0xD0,
-0x65, 0x33, 0xD9, 0x60, 0x65, 0xAB, 0xC3, 0xD0, 0x67, 0x1C, 0xF5, 0xE0, 0x67, 0x8B, 0xA5, 0xD0,
-0x68, 0xFC, 0xD7, 0xE0, 0x69, 0x6B, 0x87, 0xD0, 0x6A, 0xDC, 0xB9, 0xE0, 0x6B, 0x54, 0xA4, 0x50,
-0x6C, 0xBC, 0x9B, 0xE0, 0x6D, 0x34, 0x86, 0x50, 0x6E, 0x9C, 0x7D, 0xE0, 0x6F, 0x14, 0x68, 0x50,
-0x70, 0x7C, 0x5F, 0xE0, 0x70, 0xF4, 0x4A, 0x50, 0x72, 0x65, 0x7C, 0x60, 0x72, 0xD4, 0x2C, 0x50,
-0x74, 0x45, 0x5E, 0x60, 0x74, 0xB4, 0x0E, 0x50, 0x76, 0x25, 0x40, 0x60, 0x76, 0x9D, 0x2A, 0xD0,
-0x78, 0x05, 0x22, 0x60, 0x78, 0x7D, 0x0C, 0xD0, 0x79, 0xE5, 0x04, 0x60, 0x7A, 0x5C, 0xEE, 0xD0,
-0x7B, 0xC4, 0xE6, 0x60, 0x7C, 0x3C, 0xD0, 0xD0, 0x7D, 0xAE, 0x02, 0xE0, 0x7E, 0x1C, 0xB2, 0xD0,
-0x7F, 0x8D, 0xE4, 0xE0, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+0x52, 0x6B, 0xCA, 0xE0, 0x52, 0xDA, 0x7A, 0xD0, 0x54, 0x54, 0xE7, 0x60, 0x54, 0xBA, 0x6A, 0xE0,
+0x56, 0x34, 0xC9, 0x60, 0x56, 0xA3, 0x87, 0x60, 0x58, 0x1D, 0xE5, 0xE0, 0x58, 0x83, 0x69, 0x60,
+0x59, 0xFD, 0xC7, 0xE0, 0x5A, 0x63, 0x4B, 0x60, 0x5B, 0xDD, 0xA9, 0xE0, 0x5C, 0x43, 0x2D, 0x60,
+0x5D, 0xBD, 0x8B, 0xE0, 0x5E, 0x23, 0x0F, 0x60, 0x5F, 0x9D, 0x6D, 0xE0, 0x60, 0x0C, 0x2B, 0xE0,
+0x61, 0x86, 0x8A, 0x60, 0x61, 0xEC, 0x0D, 0xE0, 0x63, 0x66, 0x6C, 0x60, 0x63, 0xCB, 0xEF, 0xE0,
+0x65, 0x46, 0x4E, 0x60, 0x65, 0xAB, 0xD1, 0xE0, 0x67, 0x26, 0x30, 0x60, 0x67, 0x8B, 0xB3, 0xE0,
+0x69, 0x06, 0x12, 0x60, 0x69, 0x6B, 0x95, 0xE0, 0x6A, 0xE5, 0xF4, 0x60, 0x6B, 0x54, 0xB2, 0x60,
+0x6C, 0xCF, 0x10, 0xE0, 0x6D, 0x34, 0x94, 0x60, 0x6E, 0xAE, 0xF2, 0xE0, 0x6F, 0x14, 0x76, 0x60,
+0x70, 0x8E, 0xD4, 0xE0, 0x70, 0xF4, 0x58, 0x60, 0x72, 0x6E, 0xB6, 0xE0, 0x72, 0xD4, 0x3A, 0x60,
+0x74, 0x4E, 0x98, 0xE0, 0x74, 0xB4, 0x1C, 0x60, 0x76, 0x37, 0xB5, 0x60, 0x76, 0x9D, 0x38, 0xE0,
+0x78, 0x17, 0x97, 0x60, 0x78, 0x7D, 0x1A, 0xE0, 0x79, 0xF7, 0x79, 0x60, 0x7A, 0x5C, 0xFC, 0xE0,
+0x7B, 0xD7, 0x5B, 0x60, 0x7C, 0x3C, 0xDE, 0xE0, 0x7D, 0xB7, 0x3D, 0x60, 0x7E, 0x1C, 0xC0, 0xE0,
+0x7F, 0x97, 0x1F, 0x60, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
@@ -17338,7 +17352,8 @@ const unsigned char timelib_timezone_db_data_builtin[263191] = {
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, 0x8C, 0xA0,
0x00, 0x00, 0x50, 0x47, 0x54, 0x00, 0x00, 0x00, 0x00, 0x7A, 0xD5, 0x50, 0x01, 0xF3, 0x37, 0x7A,
-0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x0E, 0x6D, 0x6F, 0x73, 0x74, 0x20, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F,
+0x6E, 0x73,
/* Pacific/Rarotonga */
0x50, 0x48, 0x50, 0x31, 0x01, 0x43, 0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -18532,4 +18547,4 @@ const unsigned char timelib_timezone_db_data_builtin[263191] = {
0x00, 0x00, 0x55, 0x54, 0x43, 0x00, 0x00, 0x00, 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80,
0x00, 0x00, 0x00, 0x00, };
-const timelib_tzdb timezonedb_builtin = { "2014.8", 582, timezonedb_idx_builtin, timelib_timezone_db_data_builtin };
+const timelib_tzdb timezonedb_builtin = { "2014.9", 583, timezonedb_idx_builtin, timelib_timezone_db_data_builtin };
diff --git a/ext/fileinfo/libmagic.patch b/ext/fileinfo/libmagic.patch
index 8b0b9a8911..30f1e9b450 100644
--- a/ext/fileinfo/libmagic.patch
+++ b/ext/fileinfo/libmagic.patch
@@ -1,6 +1,6 @@
diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
--- libmagic.orig/apprentice.c Tue Nov 19 22:01:12 2013
-+++ libmagic/apprentice.c Mon Mar 31 17:15:53 2014
++++ libmagic/apprentice.c Sun Sep 21 18:30:39 2014
@@ -29,6 +29,8 @@
* apprentice - make one pass through /etc/magic, learning its secrets.
*/
@@ -357,8 +357,9 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
uint32_t i, j;
size_t files = 0, maxfiles = 0;
- char **filearr = NULL, *mfn;
+- struct stat st;
+ char **filearr = NULL;
- struct stat st;
++ zend_stat_t st;
struct magic_map *map;
struct magic_entry_set mset[MAGIC_SETS];
- DIR *dir;
@@ -406,8 +407,9 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
+ php_stream_closedir(dir);
goto out;
}
- if (stat(mfn, &st) == -1 || !S_ISREG(st.st_mode)) {
+- if (stat(mfn, &st) == -1 || !S_ISREG(st.st_mode)) {
- free(mfn);
++ if (zend_stat(mfn, &st) == -1 || !S_ISREG(st.st_mode)) {
continue;
}
if (files >= maxfiles) {
@@ -454,6 +456,15 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
return NULL;
}
return map;
+@@ -1248,7 +1272,7 @@
+ * the sign extension must have happened.
+ */
+ case FILE_BYTE:
+- v = (char) v;
++ v = (signed char) v;
+ break;
+ case FILE_SHORT:
+ case FILE_BESHORT:
@@ -1516,7 +1540,7 @@
if (me->cont_count == me->max_count) {
struct magic *nm;
@@ -536,12 +547,12 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
size_t i;
+ php_stream *stream = NULL;
+ php_stream_statbuf st;
-+
-+
-+ TSRMLS_FETCH();
- fd = -1;
- if ((map = CAST(struct magic_map *, calloc(1, sizeof(*map)))) == NULL) {
++
++ TSRMLS_FETCH();
++
+ if ((map = CAST(struct magic_map *, ecalloc(1, sizeof(*map)))) == NULL) {
file_oomem(ms, sizeof(*map));
+ efree(map);
@@ -649,7 +660,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
+ if (NULL != fn) {
+ nentries = (uint32_t)(st.sb.st_size / sizeof(struct magic));
+ entries = (uint32_t)(st.sb.st_size / sizeof(struct magic));
-+ if ((off_t)(entries * sizeof(struct magic)) != st.sb.st_size) {
++ if ((zend_off_t)(entries * sizeof(struct magic)) != st.sb.st_size) {
+ file_error(ms, 0, "Size of `%s' %llu is not a multiple of %zu",
+ dbname, (unsigned long long)st.sb.st_size,
+ sizeof(struct magic));
@@ -729,7 +740,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
assert(nm + sizeof(ar) < m);
- if (lseek(fd, (off_t)m, SEEK_SET) != (off_t)m) {
-+ if (php_stream_seek(stream,(off_t)sizeof(struct magic), SEEK_SET) != sizeof(struct magic)) {
++ if (php_stream_seek(stream,(zend_off_t)sizeof(struct magic), SEEK_SET) != sizeof(struct magic)) {
file_error(ms, errno, "error seeking `%s'", dbname);
goto out;
}
@@ -800,7 +811,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
}
diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
--- libmagic.orig/ascmagic.c Thu Feb 13 00:20:53 2014
-+++ libmagic/ascmagic.c Fri Feb 21 00:21:27 2014
++++ libmagic/ascmagic.c Wed Aug 27 12:35:45 2014
@@ -139,7 +139,7 @@
/* malloc size is a conservative overestimate; could be
improved, or at least realloced after conversion. */
@@ -822,7 +833,7 @@ diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
}
diff -u libmagic.orig/cdf.c libmagic/cdf.c
--- libmagic.orig/cdf.c Tue Feb 26 17:20:42 2013
-+++ libmagic/cdf.c Tue Jul 1 08:57:25 2014
++++ libmagic/cdf.c Wed Aug 27 12:35:45 2014
@@ -35,7 +35,7 @@
#include "file.h"
@@ -850,7 +861,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
#include <string.h>
#include <time.h>
#include <ctype.h>
-@@ -267,13 +277,15 @@
+@@ -267,23 +277,25 @@
{
const char *b = (const char *)sst->sst_tab;
const char *e = ((const char *)p) + tail;
@@ -868,18 +879,48 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
errno = EFTYPE;
return -1;
}
+
+ static ssize_t
+-cdf_read(const cdf_info_t *info, off_t off, void *buf, size_t len)
++cdf_read(const cdf_info_t *info, zend_off_t off, void *buf, size_t len)
+ {
+ size_t siz = (size_t)off + len;
+
+- if ((off_t)(off + len) != (off_t)siz) {
++ if ((zend_off_t)(off + len) != (zend_off_t)siz) {
+ errno = EINVAL;
+ return -1;
+ }
@@ -296,7 +308,10 @@
if (info->i_fd == -1)
return -1;
- if (pread(info->i_fd, buf, len, off) != (ssize_t)len)
-+ if (FINFO_LSEEK_FUNC(info->i_fd, off, SEEK_SET) == (off_t)-1)
++ if (FINFO_LSEEK_FUNC(info->i_fd, off, SEEK_SET) == (zend_off_t)-1)
+ return -1;
+
+ if (FINFO_READ_FUNC(info->i_fd, buf, len) != (ssize_t)len)
return -1;
return (ssize_t)len;
+@@ -308,7 +323,7 @@
+ char buf[512];
+
+ (void)memcpy(cdf_bo.s, "\01\02\03\04", 4);
+- if (cdf_read(info, (off_t)0, buf, sizeof(buf)) == -1)
++ if (cdf_read(info, (zend_off_t)0, buf, sizeof(buf)) == -1)
+ return -1;
+ cdf_unpack_header(h, buf);
+ cdf_swap_header(h);
+@@ -342,7 +357,7 @@
+ size_t ss = CDF_SEC_SIZE(h);
+ size_t pos = CDF_SEC_POS(h, id);
+ assert(ss == len);
+- return cdf_read(info, (off_t)pos, ((char *)buf) + offs, len);
++ return cdf_read(info, (zend_off_t)pos, ((char *)buf) + offs, len);
+ }
+
+ ssize_t
@@ -352,10 +367,10 @@
size_t ss = CDF_SHORT_SEC_SIZE(h);
size_t pos = CDF_SHORT_SEC_POS(h, id);
@@ -937,7 +978,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
/* If the it is not there, just fake it; some docs don't have it */
if (d->d_stream_first_sector < 0)
-@@ -796,7 +815,11 @@
+@@ -796,11 +815,15 @@
if (cdf_check_stream_offset(sst, h, e, 0, __LINE__) == -1)
goto out;
for (i = 0; i < sh.sh_properties; i++) {
@@ -950,6 +991,11 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
q = (const uint8_t *)(const void *)
((const char *)(const void *)p + ofs
- 2 * sizeof(uint32_t));
+- if (q > e) {
++ if (q < p || q > e) {
+ DPRINTF(("Ran of the end %p > %p\n", q, e));
+ goto out;
+ }
@@ -810,6 +833,10 @@
i, inp[i].pi_id, inp[i].pi_type, q - p, offs));
if (inp[i].pi_type & CDF_VECTOR) {
@@ -1038,7 +1084,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
} else {
diff -u libmagic.orig/cdf.h libmagic/cdf.h
--- libmagic.orig/cdf.h Thu Jun 21 00:19:55 2012
-+++ libmagic/cdf.h Thu Jun 5 18:05:33 2014
++++ libmagic/cdf.h Wed Aug 27 12:35:45 2014
@@ -35,10 +35,12 @@
#ifndef _H_CDF_
#define _H_CDF_
@@ -1091,7 +1137,7 @@ diff -u libmagic.orig/cdf.h libmagic/cdf.h
int cdf_read_summary_info(const cdf_info_t *, const cdf_header_t *,
diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
--- libmagic.orig/cdf_time.c Thu Jun 21 00:18:33 2012
-+++ libmagic/cdf_time.c Fri Feb 21 00:21:27 2014
++++ libmagic/cdf_time.c Wed Aug 27 12:35:45 2014
@@ -96,7 +96,7 @@
}
@@ -1151,7 +1197,7 @@ diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
static const char *ref = "Sat Apr 23 01:30:00 1977";
diff -u libmagic.orig/compress.c libmagic/compress.c
--- libmagic.orig/compress.c Sun Jan 5 16:55:21 2014
-+++ libmagic/compress.c Fri Feb 21 00:21:27 2014
++++ libmagic/compress.c Wed Aug 27 12:35:45 2014
@@ -32,6 +32,7 @@
* uncompress(method, old, n, newch) - uncompress old into new,
* using method, return sizeof new
@@ -1237,7 +1283,7 @@ diff -u libmagic.orig/compress.c libmagic/compress.c
}
(void)close(tfd);
- if (lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) {
-+ if (FINFO_LSEEK_FUNC(fd, (off_t)0, SEEK_SET) == (off_t)-1) {
++ if (FINFO_LSEEK_FUNC(fd, (zend_off_t)0, SEEK_SET) == (zend_off_t)-1) {
file_badseek(ms);
return -1;
}
@@ -1266,7 +1312,7 @@ diff -u libmagic.orig/compress.c libmagic/compress.c
- _exit(1);
- (void) lseek(0, (off_t)0, SEEK_SET);
+ (void) dup(fd);
-+ (void) FINFO_LSEEK_FUNC(0, (off_t)0, SEEK_SET);
++ (void) FINFO_LSEEK_FUNC(0, (zend_off_t)0, SEEK_SET);
} else {
- if (dup(fdin[0]) == -1)
- _exit(1);
@@ -1312,9 +1358,39 @@ diff -u libmagic.orig/compress.c libmagic/compress.c
}
-#endif
+#endif /* if PHP_FILEINFO_UNCOMPRESS */
+diff -u libmagic.orig/elfclass.h libmagic/elfclass.h
+--- libmagic.orig/elfclass.h Mon Feb 18 19:33:14 2013
++++ libmagic/elfclass.h Wed Aug 27 12:35:45 2014
+@@ -37,7 +37,7 @@
+ case ET_CORE:
+ flags |= FLAGS_IS_CORE;
+ if (dophn_core(ms, clazz, swap, fd,
+- (off_t)elf_getu(swap, elfhdr.e_phoff),
++ (zend_off_t)elf_getu(swap, elfhdr.e_phoff),
+ elf_getu16(swap, elfhdr.e_phnum),
+ (size_t)elf_getu16(swap, elfhdr.e_phentsize),
+ fsize, &flags) == -1)
+@@ -47,7 +47,7 @@
+ case ET_EXEC:
+ case ET_DYN:
+ if (dophn_exec(ms, clazz, swap, fd,
+- (off_t)elf_getu(swap, elfhdr.e_phoff),
++ (zend_off_t)elf_getu(swap, elfhdr.e_phoff),
+ elf_getu16(swap, elfhdr.e_phnum),
+ (size_t)elf_getu16(swap, elfhdr.e_phentsize),
+ fsize, &flags, elf_getu16(swap, elfhdr.e_shnum))
+@@ -56,7 +56,7 @@
+ /*FALLTHROUGH*/
+ case ET_REL:
+ if (doshn(ms, clazz, swap, fd,
+- (off_t)elf_getu(swap, elfhdr.e_shoff),
++ (zend_off_t)elf_getu(swap, elfhdr.e_shoff),
+ elf_getu16(swap, elfhdr.e_shnum),
+ (size_t)elf_getu16(swap, elfhdr.e_shentsize),
+ fsize, &flags, elf_getu16(swap, elfhdr.e_machine),
diff -u libmagic.orig/file.h libmagic/file.h
--- libmagic.orig/file.h Thu Feb 13 00:20:53 2014
-+++ libmagic/file.h Fri Feb 21 00:21:27 2014
++++ libmagic/file.h Wed Aug 27 12:35:45 2014
@@ -33,11 +33,9 @@
#ifndef __file_h__
#define __file_h__
@@ -1383,7 +1459,13 @@ diff -u libmagic.orig/file.h libmagic/file.h
((t) == FILE_STRING || \
(t) == FILE_PSTRING || \
(t) == FILE_BESTRING16 || \
-@@ -411,22 +413,18 @@
+@@ -405,28 +407,23 @@
+ /* Type for Unicode characters */
+ typedef unsigned long unichar;
+
+-struct stat;
+ #define FILE_T_LOCAL 1
+ #define FILE_T_WINDOWS 2
protected const char *file_fmttime(uint64_t, int, char *);
protected struct magic_set *file_ms_alloc(int);
protected void file_ms_free(struct magic_set *);
@@ -1391,7 +1473,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
+protected int file_buffer(struct magic_set *, php_stream *, const char *, const void *,
size_t);
-protected int file_fsmagic(struct magic_set *, const char *, struct stat *);
-+protected int file_fsmagic(struct magic_set *, const char *, struct stat *, php_stream *);
++protected int file_fsmagic(struct magic_set *, const char *, zend_stat_t *, php_stream *);
protected int file_pipe2file(struct magic_set *, int, const void *, size_t);
-protected int file_vprintf(struct magic_set *, const char *, va_list)
- __attribute__((__format__(__printf__, 2, 0)));
@@ -1410,7 +1492,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
protected int file_zmagic(struct magic_set *, int, const char *,
const unsigned char *, size_t);
#endif
-@@ -444,16 +442,13 @@
+@@ -444,16 +441,13 @@
protected int file_magicfind(struct magic_set *, const char *, struct mlist *);
protected uint64_t file_signextend(struct magic_set *, struct magic *,
uint64_t);
@@ -1431,7 +1513,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
protected void file_showstr(FILE *, const char *, size_t);
protected size_t file_mbswidth(const char *);
protected const char *file_getbuffer(struct magic_set *);
-@@ -463,16 +458,14 @@
+@@ -463,16 +457,14 @@
size_t *);
protected size_t file_pstring_length_size(const struct magic *);
protected size_t file_pstring_get_length(const struct magic *, const char *);
@@ -1449,7 +1531,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
#ifndef HAVE_STRERROR
extern int sys_nerr;
-@@ -485,20 +478,10 @@
+@@ -485,20 +477,10 @@
#define strtoul(a, b, c) strtol(a, b, c)
#endif
@@ -1472,7 +1554,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
size_t strlcat(char *, const char *, size_t);
#endif
#ifndef HAVE_STRCASESTR
-@@ -535,6 +518,14 @@
+@@ -535,6 +517,14 @@
#endif
#else
#define FILE_RCSID(id)
@@ -1489,7 +1571,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
#endif /* __file_h__ */
diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
--- libmagic.orig/fsmagic.c Sun Dec 1 20:22:13 2013
-+++ libmagic/fsmagic.c Fri Feb 21 00:21:27 2014
++++ libmagic/fsmagic.c Wed Aug 27 12:35:45 2014
@@ -59,27 +59,21 @@
# define minor(dev) ((dev) & 0xff)
#endif
@@ -1537,7 +1619,7 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
protected int
-file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
-+file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb, php_stream *stream)
++file_fsmagic(struct magic_set *ms, const char *fn, zend_stat_t *sb, php_stream *stream)
{
int ret, did = 0;
int mime = ms->flags & MAGIC_MIME;
@@ -1814,7 +1896,16 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
}
diff -u libmagic.orig/funcs.c libmagic/funcs.c
--- libmagic.orig/funcs.c Thu Feb 13 00:20:53 2014
-+++ libmagic/funcs.c Wed Mar 19 13:28:34 2014
++++ libmagic/funcs.c Sat Aug 30 10:39:10 2014
+@@ -27,7 +27,7 @@
+ #include "file.h"
+
+ #ifndef lint
+-FILE_RCSID("@(#)$File: funcs.c,v 1.67 2014/02/12 23:20:53 christos Exp $")
++FILE_RCSID("@(#)$File: funcs.c,v 1.68 2014/02/18 11:09:31 kim Exp $")
+ #endif /* lint */
+
+ #include "magic.h"
@@ -41,79 +41,79 @@
#if defined(HAVE_WCTYPE_H)
#include <wctype.h>
@@ -1865,7 +1956,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
- file_error(ms, errno, "vasprintf failed");
- return -1;
-}
-+extern public void convert_libmagic_pattern(zval *pattern, int options);
++extern public void convert_libmagic_pattern(zval *pattern, char *val, int len, int options);
protected int
file_printf(struct magic_set *ms, const char *fmt, ...)
@@ -1947,7 +2038,26 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
{
int m = 0, rv = 0, looks_text = 0;
int mime = ms->flags & MAGIC_MIME;
-@@ -203,10 +202,10 @@
+@@ -174,8 +173,7 @@
+ const char *code_mime = "binary";
+ const char *type = "application/octet-stream";
+ const char *def = "data";
+-
+-
++ const char *ftype = NULL;
+
+ if (nb == 0) {
+ def = "empty";
+@@ -188,7 +186,7 @@
+
+ if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) {
+ looks_text = file_encoding(ms, ubuf, nb, &u8buf, &ulen,
+- &code, &code_mime, &type);
++ &code, &code_mime, &ftype);
+ }
+
+ #ifdef __EMX__
+@@ -203,10 +201,10 @@
}
}
#endif
@@ -1961,7 +2071,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
if ((ms->flags & MAGIC_DEBUG) != 0)
(void)fprintf(stderr, "zmagic %d\n", m);
goto done_encoding;
-@@ -221,12 +220,17 @@
+@@ -221,12 +219,17 @@
}
/* Check if we have a CDF file */
@@ -1984,7 +2094,16 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
/* try soft magic tests */
if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0)
-@@ -300,7 +304,6 @@
+@@ -268,7 +271,7 @@
+ if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) {
+ if (looks_text == 0)
+ if ((m = file_ascmagic_with_encoding( ms, ubuf,
+- nb, u8buf, ulen, code, type, looks_text))
++ nb, u8buf, ulen, code, ftype, looks_text))
+ != 0) {
+ if ((ms->flags & MAGIC_DEBUG) != 0)
+ (void)fprintf(stderr,
+@@ -300,7 +303,6 @@
return m;
}
@@ -1992,7 +2111,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
protected int
file_reset(struct magic_set *ms)
-@@ -310,11 +313,11 @@
+@@ -310,11 +312,11 @@
return -1;
}
if (ms->o.buf) {
@@ -2006,7 +2125,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
ms->o.pbuf = NULL;
}
ms->event_flags &= ~EVENT_HAD_ERR;
-@@ -333,7 +336,7 @@
+@@ -333,7 +335,7 @@
protected const char *
file_getbuffer(struct magic_set *ms)
{
@@ -2015,7 +2134,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
size_t psize, len;
if (ms->event_flags & EVENT_HAD_ERR)
-@@ -348,15 +351,13 @@
+@@ -348,15 +350,13 @@
/* * 4 is for octal representation, + 1 is for NUL */
len = strlen(ms->o.buf);
if (len > (SIZE_MAX - 1) / 4) {
@@ -2032,7 +2151,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
#if defined(HAVE_WCHAR_H) && defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH)
{
-@@ -416,8 +417,8 @@
+@@ -416,8 +416,8 @@
if (level >= ms->c.len) {
len = (ms->c.len += 20) * sizeof(*ms->c.li);
ms->c.li = CAST(struct level_info *, (ms->c.li == NULL) ?
@@ -2043,7 +2162,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
if (ms->c.li == NULL) {
file_oomem(ms, len);
return -1;
-@@ -437,32 +438,50 @@
+@@ -437,32 +437,42 @@
return ms->o.buf == NULL ? 0 : strlen(ms->o.buf);
}
@@ -2052,12 +2171,12 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
{
- regex_t rx;
- int rc, rv = -1;
-+ zval *patt;
++ zval patt;
+ int opts = 0;
+ pcre_cache_entry *pce;
-+ char *res;
-+ zval *repl;
-+ int res_len, rep_cnt = 0;
++ zend_string *res;
++ zval repl;
++ int rep_cnt = 0;
+ TSRMLS_FETCH();
(void)setlocale(LC_CTYPE, "C");
@@ -2079,36 +2198,28 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
- regfree(&rx);
- rv = nm;
+
-+ MAKE_STD_ZVAL(patt);
-+ ZVAL_STRINGL(patt, pat, strlen(pat), 0);
+ opts |= PCRE_MULTILINE;
-+ convert_libmagic_pattern(patt, opts);
-+ if ((pce = pcre_get_compiled_regex_cache(Z_STRVAL_P(patt), Z_STRLEN_P(patt) TSRMLS_CC)) == NULL) {
-+ zval_dtor(patt);
-+ FREE_ZVAL(patt);
++ convert_libmagic_pattern(&patt, pat, strlen(pat), opts);
++ if ((pce = pcre_get_compiled_regex_cache(Z_STR(patt) TSRMLS_CC)) == NULL) {
++ zval_ptr_dtor(&patt);
+ rep_cnt = -1;
+ goto out;
}
++ zval_ptr_dtor(&patt);
+
-+ MAKE_STD_ZVAL(repl);
-+ ZVAL_STRINGL(repl, rep, strlen(rep), 0);
-+
-+ res = php_pcre_replace_impl(pce, ms->o.buf, strlen(ms->o.buf), repl,
-+ 0, &res_len, -1, &rep_cnt TSRMLS_CC);
-+
-+ FREE_ZVAL(repl);
-+ zval_dtor(patt);
-+ FREE_ZVAL(patt);
++ ZVAL_STRING(&repl, rep);
++ res = php_pcre_replace_impl(pce, ms->o.buf, strlen(ms->o.buf), &repl, 0, -1, &rep_cnt TSRMLS_CC);
+
++ zval_ptr_dtor(&repl);
+ if (NULL == res) {
+ rep_cnt = -1;
+ goto out;
+ }
+
-+ strncpy(ms->o.buf, res, res_len);
-+ ms->o.buf[res_len] = '\0';
++ strncpy(ms->o.buf, res->val, res->len);
++ ms->o.buf[res->len] = '\0';
+
-+ efree(res);
++ zend_string_release(res);
+
out:
(void)setlocale(LC_CTYPE, "");
@@ -2117,7 +2228,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
}
diff -u libmagic.orig/magic.c libmagic/magic.c
--- libmagic.orig/magic.c Sun Dec 1 20:22:13 2013
-+++ libmagic/magic.c Fri Feb 21 00:21:27 2014
++++ libmagic/magic.c Wed Aug 27 20:49:37 2014
@@ -25,11 +25,6 @@
* SUCH DAMAGE.
*/
@@ -2169,7 +2280,8 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
+#endif
+
private void close_and_restore(const struct magic_set *, const char *, int,
- const struct stat *);
+- const struct stat *);
++ const zend_stat_t *);
private int unreadable_info(struct magic_set *, mode_t, const char *);
+#if 0
private const char* get_default_magic(void);
@@ -2262,9 +2374,12 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
public int
magic_list(struct magic_set *ms, const char *magicfile)
-@@ -282,9 +288,6 @@
+@@ -280,11 +286,8 @@
+
+ private void
close_and_restore(const struct magic_set *ms, const char *name, int fd,
- const struct stat *sb)
+- const struct stat *sb)
++ const zend_stat_t *sb)
{
- if (fd == STDIN_FILENO || name == NULL)
- return;
@@ -2311,7 +2426,8 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
{
int rv = -1;
unsigned char *buf;
- struct stat sb;
+- struct stat sb;
++ zend_stat_t sb;
ssize_t nbytes = 0; /* number of bytes read from a datafile */
- int ispipe = 0;
- off_t pos = (off_t)-1;
@@ -2456,7 +2572,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
magic_error(struct magic_set *ms)
diff -u libmagic.orig/magic.h libmagic/magic.h
--- libmagic.orig/magic.h Wed Feb 19 10:53:11 2014
-+++ libmagic/magic.h Fri Feb 21 00:21:27 2014
++++ libmagic/magic.h Wed Aug 27 12:35:45 2014
@@ -88,6 +88,7 @@
const char *magic_getpath(const char *, int);
@@ -2475,7 +2591,7 @@ diff -u libmagic.orig/magic.h libmagic/magic.h
diff -u libmagic.orig/print.c libmagic/print.c
--- libmagic.orig/print.c Tue Feb 26 19:25:00 2013
-+++ libmagic/print.c Fri Feb 21 00:21:27 2014
++++ libmagic/print.c Wed Aug 27 12:35:45 2014
@@ -28,13 +28,17 @@
/*
* print.c - debugging printout routines
@@ -2706,7 +2822,7 @@ diff -u libmagic.orig/print.c libmagic/print.c
}
diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
--- libmagic.orig/readcdf.c Tue Jan 7 04:13:42 2014
-+++ libmagic/readcdf.c Thu Jun 5 18:05:33 2014
++++ libmagic/readcdf.c Wed Oct 22 17:56:13 2014
@@ -26,11 +26,15 @@
#include "file.h"
@@ -2724,7 +2840,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
#include <string.h>
#include <time.h>
#include <ctype.h>
-@@ -69,6 +73,44 @@
+@@ -69,6 +73,50 @@
{ NULL, NULL, },
};
@@ -2743,6 +2859,9 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
+ { 0x00000000000c1084LLU, 0x46000000000000c0LLU },
+#endif
+ "x-msi",
++ },
++ { { 0, 0 },
++ NULL,
+ }
+}, clsid2desc[] = {
+ {
@@ -2753,6 +2872,9 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
+#endif
+ "MSI Installer",
+ },
++ { { 0, 0 },
++ NULL,
++ }
+};
+
+private const char *
@@ -2769,7 +2891,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
private const char *
cdf_app_to_mime(const char *vbuf, const struct nv *nv)
{
-@@ -87,16 +129,21 @@
+@@ -87,16 +135,21 @@
private int
cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info,
@@ -2793,7 +2915,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
for (i = 0; i < count; i++) {
cdf_print_property_name(buf, sizeof(buf), info[i].pi_id);
switch (info[i].pi_type) {
-@@ -153,7 +200,7 @@
+@@ -153,7 +206,7 @@
buf, vbuf) == -1)
return -1;
}
@@ -2802,7 +2924,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
CDF_PROPERTY_NAME_OF_APPLICATION) {
str = cdf_app_to_mime(vbuf, app2mime);
}
-@@ -162,8 +209,12 @@
+@@ -162,8 +215,12 @@
case CDF_FILETIME:
tp = info[i].pi_tp;
if (tp != 0) {
@@ -2817,7 +2939,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
cdf_print_elapsed_time(tbuf,
sizeof(tbuf), tp);
if (NOTMIME(ms) && file_printf(ms,
-@@ -171,8 +222,11 @@
+@@ -171,8 +228,11 @@
return -1;
} else {
char *c, *ec;
@@ -2831,7 +2953,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
if (c != NULL &&
(ec = strchr(c, '\n')) != NULL)
*ec = '\0';
-@@ -200,7 +254,7 @@
+@@ -200,7 +260,7 @@
private int
cdf_file_summary_info(struct magic_set *ms, const cdf_header_t *h,
@@ -2840,7 +2962,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
{
cdf_summary_info_header_t si;
cdf_property_info_t *info;
-@@ -211,6 +265,8 @@
+@@ -211,6 +271,8 @@
return -1;
if (NOTMIME(ms)) {
@@ -2849,7 +2971,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
if (file_printf(ms, "Composite Document File V2 Document")
== -1)
return -1;
-@@ -238,9 +294,15 @@
+@@ -238,9 +300,15 @@
return -2;
break;
}
@@ -2867,7 +2989,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
free(info);
return m == -1 ? -2 : m;
-@@ -258,6 +320,7 @@
+@@ -258,6 +326,7 @@
int i;
const char *expn = "";
const char *corrupt = "corrupt: ";
@@ -2875,7 +2997,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
info.i_fd = fd;
info.i_buf = buf;
-@@ -291,7 +354,8 @@
+@@ -291,7 +360,8 @@
goto out2;
}
@@ -2885,7 +3007,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
expn = "Cannot read short stream";
goto out3;
}
-@@ -312,23 +376,21 @@
+@@ -312,23 +382,21 @@
#ifdef CDF_DEBUG
cdf_dump_summary_info(&h, &scn);
#endif
@@ -2918,14 +3040,23 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
if (str != NULL) {
diff -u libmagic.orig/readelf.c libmagic/readelf.c
--- libmagic.orig/readelf.c Tue Nov 5 16:44:01 2013
-+++ libmagic/readelf.c Fri Feb 21 00:21:27 2014
-@@ -48,8 +48,8 @@
++++ libmagic/readelf.c Sat Oct 25 11:42:59 2014
+@@ -42,14 +42,14 @@
+ #include "magic.h"
+
+ #ifdef ELFCORE
+-private int dophn_core(struct magic_set *, int, int, int, off_t, int, size_t,
+- off_t, int *);
++private int dophn_core(struct magic_set *, int, int, int, zend_off_t, int, size_t,
++ zend_off_t, int *);
+ #endif
private int dophn_exec(struct magic_set *, int, int, int, off_t, int, size_t,
- off_t, int *, int);
+- off_t, int *, int);
++ zend_off_t, int *, int);
private int doshn(struct magic_set *, int, int, int, off_t, int, size_t,
- off_t, int *, int, int);
-private size_t donote(struct magic_set *, void *, size_t, size_t, int,
-+ off_t, int *, int);
++ zend_off_t, int *, int);
+private size_t donote(struct magic_set *, unsigned char *, size_t, size_t, int,
int, size_t, int *);
@@ -2945,7 +3076,40 @@ diff -u libmagic.orig/readelf.c libmagic/readelf.c
#define xsh_addr (clazz == ELFCLASS32 \
? (void *)&sh32 \
-@@ -292,7 +298,7 @@
+@@ -138,7 +144,7 @@
+ #define xsh_size (size_t)(clazz == ELFCLASS32 \
+ ? elf_getu32(swap, sh32.sh_size) \
+ : elf_getu64(swap, sh64.sh_size))
+-#define xsh_offset (off_t)(clazz == ELFCLASS32 \
++#define xsh_offset (zend_off_t)(clazz == ELFCLASS32 \
+ ? elf_getu32(swap, sh32.sh_offset) \
+ : elf_getu64(swap, sh64.sh_offset))
+ #define xsh_type (clazz == ELFCLASS32 \
+@@ -156,13 +162,13 @@
+ #define xph_type (clazz == ELFCLASS32 \
+ ? elf_getu32(swap, ph32.p_type) \
+ : elf_getu32(swap, ph64.p_type))
+-#define xph_offset (off_t)(clazz == ELFCLASS32 \
++#define xph_offset (zend_off_t)(clazz == ELFCLASS32 \
+ ? elf_getu32(swap, ph32.p_offset) \
+ : elf_getu64(swap, ph64.p_offset))
+ #define xph_align (size_t)((clazz == ELFCLASS32 \
+- ? (off_t) (ph32.p_align ? \
++ ? (zend_off_t) (ph32.p_align ? \
+ elf_getu32(swap, ph32.p_align) : 4) \
+- : (off_t) (ph64.p_align ? \
++ : (zend_off_t) (ph64.p_align ? \
+ elf_getu64(swap, ph64.p_align) : 4)))
+ #define xph_filesz (size_t)((clazz == ELFCLASS32 \
+ ? elf_getu32(swap, ph32.p_filesz) \
+@@ -287,12 +293,12 @@
+ #define FLAGS_IS_CORE 0x10
+
+ private int
+-dophn_core(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
+- int num, size_t size, off_t fsize, int *flags)
++dophn_core(struct magic_set *ms, int clazz, int swap, int fd, zend_off_t off,
++ int num, size_t size, zend_off_t fsize, int *flags)
{
Elf32_Phdr ph32;
Elf64_Phdr ph64;
@@ -2959,7 +3123,7 @@ diff -u libmagic.orig/readelf.c libmagic/readelf.c
*/
for ( ; num; num--) {
- if (pread(fd, xph_addr, xph_sizeof, off) == -1) {
-+ if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (off_t)-1) {
++ if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (zend_off_t)-1) {
+ file_badseek(ms);
+ return -1;
+ }
@@ -2973,7 +3137,7 @@ diff -u libmagic.orig/readelf.c libmagic/readelf.c
*/
- len = xph_filesz < sizeof(nbuf) ? xph_filesz : sizeof(nbuf);
- if ((bufsize = pread(fd, nbuf, len, xph_offset)) == -1) {
-+ if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (off_t)-1) {
++ if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (zend_off_t)-1) {
+ file_badseek(ms);
+ return -1;
+ }
@@ -2983,7 +3147,30 @@ diff -u libmagic.orig/readelf.c libmagic/readelf.c
file_badread(ms);
return -1;
}
-@@ -913,24 +928,12 @@
+@@ -477,6 +492,13 @@
+ uint32_t namesz, descsz;
+ unsigned char *nbuf = CAST(unsigned char *, vbuf);
+
++ if (xnh_sizeof + offset > size) {
++ /*
++ * We're out of note headers.
++ */
++ return xnh_sizeof + offset;
++ }
++
+ (void)memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
+ offset += xnh_sizeof;
+
+@@ -902,7 +924,7 @@
+ Elf64_Shdr sh64;
+ int stripped = 1;
+ void *nbuf;
+- off_t noff, coff, name_off;
++ zend_off_t noff, coff, name_off;
+ uint64_t cap_hw1 = 0; /* SunOS 5.x hardware capabilites */
+ uint64_t cap_sf1 = 0; /* SunOS 5.x software capabilites */
+ char name[50];
+@@ -913,24 +935,12 @@
return 0;
}
@@ -2998,7 +3185,7 @@ diff -u libmagic.orig/readelf.c libmagic/readelf.c
- /* Read the name of this section. */
- if (pread(fd, name, sizeof(name), name_off + xsh_name) == -1) {
- file_badread(ms);
-+ if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (off_t)-1) {
++ if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (zend_off_t)-1) {
+ file_badseek(ms);
return -1;
}
@@ -3011,7 +3198,7 @@ diff -u libmagic.orig/readelf.c libmagic/readelf.c
file_badread(ms);
return -1;
}
-@@ -955,14 +958,17 @@
+@@ -955,41 +965,35 @@
/* Things we can determine when we seek */
switch (xsh_type) {
case SHT_NOTE:
@@ -3019,8 +3206,8 @@ diff -u libmagic.orig/readelf.c libmagic/readelf.c
- file_error(ms, errno, "Cannot allocate memory"
- " for note");
+ nbuf = emalloc((size_t)xsh_size);
-+ if ((noff = FINFO_LSEEK_FUNC(fd, (off_t)xsh_offset, SEEK_SET)) ==
-+ (off_t)-1) {
++ if ((noff = FINFO_LSEEK_FUNC(fd, (zend_off_t)xsh_offset, SEEK_SET)) ==
++ (zend_off_t)-1) {
+ file_badread(ms);
+ efree(nbuf);
return -1;
@@ -3034,8 +3221,10 @@ diff -u libmagic.orig/readelf.c libmagic/readelf.c
return -1;
}
-@@ -971,25 +977,16 @@
- if (noff >= (off_t)xsh_size)
+ noff = 0;
+ for (;;) {
+- if (noff >= (off_t)xsh_size)
++ if (noff >= (zend_off_t)xsh_size)
break;
noff = donote(ms, nbuf, (size_t)noff,
- xsh_size, clazz, swap, 4, flags);
@@ -3060,21 +3249,24 @@ diff -u libmagic.orig/readelf.c libmagic/readelf.c
- }
-
- if (lseek(fd, xsh_offset, SEEK_SET) == (off_t)-1) {
-+ if (FINFO_LSEEK_FUNC(fd, (off_t)xsh_offset, SEEK_SET) ==
-+ (off_t)-1) {
++ if (FINFO_LSEEK_FUNC(fd, (zend_off_t)xsh_offset, SEEK_SET) ==
++ (zend_off_t)-1) {
file_badseek(ms);
return -1;
}
-@@ -1001,7 +998,7 @@
+@@ -999,9 +1003,9 @@
+ Elf64_Cap cap64;
+ char cbuf[/*CONSTCOND*/
MAX(sizeof cap32, sizeof cap64)];
- if ((coff += xcap_sizeof) > (off_t)xsh_size)
+- if ((coff += xcap_sizeof) > (off_t)xsh_size)
++ if ((coff += xcap_sizeof) > (zend_off_t)xsh_size)
break;
- if (read(fd, cbuf, (size_t)xcap_sizeof) !=
+ if (FINFO_READ_FUNC(fd, cbuf, (size_t)xcap_sizeof) !=
(ssize_t)xcap_sizeof) {
file_badread(ms);
return -1;
-@@ -1027,13 +1024,12 @@
+@@ -1027,13 +1031,12 @@
break;
}
}
@@ -3090,7 +3282,18 @@ diff -u libmagic.orig/readelf.c libmagic/readelf.c
if (file_printf(ms, ", %sstripped", stripped ? "" : "not ") == -1)
return -1;
if (cap_hw1) {
-@@ -1112,7 +1108,7 @@
+@@ -1103,8 +1106,8 @@
+ * otherwise it's statically linked.
+ */
+ private int
+-dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
+- int num, size_t size, off_t fsize, int *flags, int sh_num)
++dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, zend_off_t off,
++ int num, size_t size, zend_off_t fsize, int *flags, int sh_num)
+ {
+ Elf32_Phdr ph32;
+ Elf64_Phdr ph64;
+@@ -1112,7 +1115,7 @@
const char *shared_libraries = "";
unsigned char nbuf[BUFSIZ];
ssize_t bufsize;
@@ -3099,13 +3302,13 @@ diff -u libmagic.orig/readelf.c libmagic/readelf.c
if (size != xph_sizeof) {
if (file_printf(ms, ", corrupted program header size") == -1)
-@@ -1121,8 +1117,13 @@
+@@ -1121,8 +1124,13 @@
}
for ( ; num; num--) {
- if (pread(fd, xph_addr, xph_sizeof, off) == -1) {
- file_badread(ms);
-+ if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (off_t)-1) {
++ if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (zend_off_t)-1) {
+ file_badseek(ms);
+ return -1;
+ }
@@ -3115,14 +3318,14 @@ diff -u libmagic.orig/readelf.c libmagic/readelf.c
return -1;
}
-@@ -1160,9 +1161,12 @@
+@@ -1160,9 +1168,12 @@
* This is a PT_NOTE section; loop through all the notes
* in the section.
*/
- len = xph_filesz < sizeof(nbuf) ? xph_filesz
- : sizeof(nbuf);
- bufsize = pread(fd, nbuf, len, xph_offset);
-+ if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (off_t)-1) {
++ if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (zend_off_t)-1) {
+ file_badseek(ms);
+ return -1;
+ }
@@ -3131,18 +3334,27 @@ diff -u libmagic.orig/readelf.c libmagic/readelf.c
if (bufsize == -1) {
file_badread(ms);
return -1;
-@@ -1223,7 +1227,7 @@
+@@ -1200,7 +1211,7 @@
+ int clazz;
+ int swap;
+ struct stat st;
+- off_t fsize;
++ zend_off_t fsize;
+ int flags = 0;
+ Elf32_Ehdr elf32hdr;
+ Elf64_Ehdr elf64hdr;
+@@ -1223,7 +1234,7 @@
/*
* If we cannot seek, it must be a pipe, socket or fifo.
*/
- if((lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) && (errno == ESPIPE))
-+ if((FINFO_LSEEK_FUNC(fd, (off_t)0, SEEK_SET) == (off_t)-1) && (errno == ESPIPE))
++ if((FINFO_LSEEK_FUNC(fd, (zend_off_t)0, SEEK_SET) == (zend_off_t)-1) && (errno == ESPIPE))
fd = file_pipe2file(ms, fd, buf, nbytes);
if (fstat(fd, &st) == -1) {
diff -u libmagic.orig/readelf.h libmagic/readelf.h
--- libmagic.orig/readelf.h Tue Nov 5 16:41:56 2013
-+++ libmagic/readelf.h Fri Feb 21 00:21:27 2014
++++ libmagic/readelf.h Wed Aug 27 12:35:45 2014
@@ -44,9 +44,17 @@
typedef uint32_t Elf32_Word;
typedef uint8_t Elf32_Char;
@@ -3163,7 +3375,7 @@ diff -u libmagic.orig/readelf.h libmagic/readelf.h
typedef uint8_t Elf64_Char;
diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
--- libmagic.orig/softmagic.c Thu Feb 13 00:20:53 2014
-+++ libmagic/softmagic.c Tue Jul 1 08:57:25 2014
++++ libmagic/softmagic.c Fri Sep 19 16:29:55 2014
@@ -50,6 +50,11 @@
#include <locale.h>
#endif
@@ -3176,6 +3388,15 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
private int match(struct magic_set *, struct magic *, uint32_t,
const unsigned char *, size_t, size_t, int, int, int, int, int *, int *,
+@@ -62,7 +67,7 @@
+ private int32_t moffset(struct magic_set *, struct magic *);
+ private void mdebug(uint32_t, const char *, size_t);
+ private int mcopy(struct magic_set *, union VALUETYPE *, int, int,
+- const unsigned char *, uint32_t, size_t, size_t);
++ const unsigned char *, uint32_t, size_t, struct magic *);
+ private int mconvert(struct magic_set *, struct magic *, int);
+ private int print_sep(struct magic_set *, int);
+ private int handle_annotation(struct magic_set *, struct magic *);
@@ -71,7 +76,8 @@
private void cvt_32(union VALUETYPE *, const struct magic *);
private void cvt_64(union VALUETYPE *, const struct magic *);
@@ -3206,7 +3427,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
m = &magic[magindex];
ms->line = m->lineno; /* for messages */
-@@ -350,46 +356,24 @@
+@@ -350,46 +356,27 @@
private int
check_fmt(struct magic_set *ms, struct magic *m)
{
@@ -3216,6 +3437,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
+ pcre *pce;
+ int re_options, rv = -1;
+ pcre_extra *re_extra;
++ zend_string *pattern;
+ TSRMLS_FETCH();
+
if (strchr(m->desc, '%') == NULL)
@@ -3227,7 +3449,8 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
- char errmsg[512];
- (void)regerror(rc, &rx, errmsg, sizeof(errmsg));
- file_magerror(ms, "regex error %d, (%s)", rc, errmsg);
-+ if ((pce = pcre_get_compiled_regex("~%[-0-9.]*s~", &re_extra, &re_options TSRMLS_CC)) == NULL) {
++ pattern = zend_string_init("~%[-0-9.]*s~", sizeof("~%[-0-9.]*s~") - 1, 0);
++ if ((pce = pcre_get_compiled_regex(pattern, &re_extra, &re_options TSRMLS_CC)) == NULL) {
+ rv = -1;
} else {
- rc = regexec(&rx, m->desc, 0, 0, 0);
@@ -3235,6 +3458,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
- rv = !rc;
+ rv = !pcre_exec(pce, re_extra, m->desc, strlen(m->desc), 0, re_options, NULL, 0);
}
++ zend_string_release(pattern);
(void)setlocale(LC_CTYPE, "");
return rv;
}
@@ -3261,7 +3485,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
private int32_t
mprint(struct magic_set *ms, struct magic *m)
{
-@@ -618,13 +602,13 @@
+@@ -618,13 +605,13 @@
char *cp;
int rval;
@@ -3277,7 +3501,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
if (rval == -1)
return -1;
-@@ -870,16 +854,16 @@
+@@ -870,16 +857,16 @@
if (m->num_mask) \
switch (m->mask_op & FILE_OPS_MASK) { \
case FILE_OPADD: \
@@ -3298,7 +3522,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
break; \
} \
-@@ -931,10 +915,18 @@
+@@ -931,10 +918,18 @@
return 1;
}
case FILE_PSTRING: {
@@ -3320,9 +3544,72 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
while (len--)
*ptr1++ = *ptr2++;
*ptr1 = '\0';
-@@ -1178,9 +1170,6 @@
- "nbytes=%zu, count=%u)\n", m->type, m->flag, offset, o,
- nbytes, count);
+@@ -1046,7 +1041,7 @@
+
+ private int
+ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
+- const unsigned char *s, uint32_t offset, size_t nbytes, size_t linecnt)
++ const unsigned char *s, uint32_t offset, size_t nbytes, struct magic *m)
+ {
+ /*
+ * Note: FILE_SEARCH and FILE_REGEX do not actually copy
+@@ -1066,15 +1061,24 @@
+ const char *last; /* end of search region */
+ const char *buf; /* start of search region */
+ const char *end;
+- size_t lines;
++ size_t lines, linecnt, bytecnt;
++
++ linecnt = m->str_range;
++ bytecnt = linecnt * 80;
+
++ if (bytecnt == 0) {
++ bytecnt = 8192;
++ }
++ if (bytecnt > nbytes) {
++ bytecnt = nbytes;
++ }
+ if (s == NULL) {
+ ms->search.s_len = 0;
+ ms->search.s = NULL;
+ return 0;
+ }
+ buf = RCAST(const char *, s) + offset;
+- end = last = RCAST(const char *, s) + nbytes;
++ end = last = RCAST(const char *, s) + bytecnt;
+ /* mget() guarantees buf <= last */
+ for (lines = linecnt, b = buf; lines && b < end &&
+ ((b = CAST(const char *,
+@@ -1087,7 +1091,7 @@
+ b++;
+ }
+ if (lines)
+- last = RCAST(const char *, s) + nbytes;
++ last = RCAST(const char *, s) + bytecnt;
+
+ ms->search.s = buf;
+ ms->search.s_len = last - buf;
+@@ -1158,7 +1162,6 @@
+ int *need_separator, int *returnval)
+ {
+ uint32_t soffset, offset = ms->offset;
+- uint32_t count = m->str_range;
+ int rv, oneed_separator, in_type;
+ char *sbuf, *rbuf;
+ union VALUETYPE *p = &ms->ms_value;
+@@ -1170,17 +1173,13 @@
+ }
+
+ if (mcopy(ms, p, m->type, m->flag & INDIR, s, (uint32_t)(offset + o),
+- (uint32_t)nbytes, count) == -1)
++ (uint32_t)nbytes, m) == -1)
+ return -1;
+
+ if ((ms->flags & MAGIC_DEBUG) != 0) {
+ fprintf(stderr, "mget(type=%d, flag=%x, offset=%u, o=%zu, "
+- "nbytes=%zu, count=%u)\n", m->type, m->flag, offset, o,
+- nbytes, count);
++ "nbytes=%zu)\n", m->type, m->flag, offset, o, nbytes);
mdebug(offset, (char *)(void *)p, sizeof(union VALUETYPE));
-#ifndef COMPILE_ONLY
- file_mdump(m);
@@ -3330,7 +3617,15 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
}
if (m->flag & INDIR) {
-@@ -1679,9 +1668,6 @@
+@@ -1672,16 +1671,13 @@
+ if ((ms->flags & MAGIC_DEBUG) != 0)
+ fprintf(stderr, "indirect +offs=%u\n", offset);
+ }
+- if (mcopy(ms, p, m->type, 0, s, offset, nbytes, count) == -1)
++ if (mcopy(ms, p, m->type, 0, s, offset, nbytes, m) == -1)
+ return -1;
+ ms->offset = offset;
+
if ((ms->flags & MAGIC_DEBUG) != 0) {
mdebug(offset, (char *)(void *)p,
sizeof(union VALUETYPE));
@@ -3340,7 +3635,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
}
}
-@@ -1755,11 +1741,21 @@
+@@ -1755,11 +1751,21 @@
ms->offset = soffset;
if (rv == 1) {
if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
@@ -3365,50 +3660,49 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
}
return rv;
-@@ -1875,6 +1871,42 @@
+@@ -1875,6 +1881,41 @@
return file_strncmp(a, b, len, flags);
}
+public void
-+convert_libmagic_pattern(zval *pattern, int options)
++convert_libmagic_pattern(zval *pattern, char *val, int len, int options)
+{
-+ int i, j=0;
-+ char *t;
++ int i, j=0;
++ zend_string *t;
+
-+ t = (char *) safe_emalloc(Z_STRLEN_P(pattern), 2, 5);
-+
-+ t[j++] = '~';
-+
-+ for (i=0; i<Z_STRLEN_P(pattern); i++, j++) {
-+ switch (Z_STRVAL_P(pattern)[i]) {
-+ case '~':
-+ t[j++] = '\\';
-+ t[j] = '~';
-+ break;
-+ default:
-+ t[j] = Z_STRVAL_P(pattern)[i];
-+ break;
-+ }
++ t = zend_string_alloc(len * 2 + 4, 0);
++
++ t->val[j++] = '~';
++
++ for (i = 0; i < len; i++, j++) {
++ switch (val[i]) {
++ case '~':
++ t->val[j++] = '\\';
++ t->val[j] = '~';
++ break;
++ default:
++ t->val[j] = val[i];
++ break;
+ }
-+ t[j++] = '~';
-+
-+ if (options & PCRE_CASELESS)
-+ t[j++] = 'i';
-+
-+ if (options & PCRE_MULTILINE)
-+ t[j++] = 'm';
++ }
++ t->val[j++] = '~';
+
-+ t[j]='\0';
-+
-+ Z_STRVAL_P(pattern) = t;
-+ Z_STRLEN_P(pattern) = j;
++ if (options & PCRE_CASELESS)
++ t->val[j++] = 'i';
++
++ if (options & PCRE_MULTILINE)
++ t->val[j++] = 'm';
+
++ t->val[j]='\0';
++ t->len = j;
++
++ ZVAL_NEW_STR(pattern, t);
+}
+
private int
magiccheck(struct magic_set *ms, struct magic *m)
{
-@@ -2035,63 +2067,151 @@
+@@ -2035,63 +2076,112 @@
break;
}
case FILE_REGEX: {
@@ -3418,141 +3712,61 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
-
- if (ms->search.s == NULL)
- return 0;
-+ zval *pattern;
++ zval pattern;
+ int options = 0;
+ pcre_cache_entry *pce;
+ TSRMLS_FETCH();
+
-+ MAKE_STD_ZVAL(pattern);
-+ ZVAL_STRINGL(pattern, (char *)m->value.s, m->vallen, 0);
-+
+ options |= PCRE_MULTILINE;
+
+ if (m->str_flags & STRING_IGNORE_CASE) {
+ options |= PCRE_CASELESS;
+ }
+
-+ convert_libmagic_pattern(pattern, options);
++ convert_libmagic_pattern(&pattern, (char *)m->value.s, m->vallen, options);
+
+ l = v = 0;
-+ if ((pce = pcre_get_compiled_regex_cache(Z_STRVAL_P(pattern), Z_STRLEN_P(pattern) TSRMLS_CC)) == NULL) {
-+ zval_dtor(pattern);
-+ FREE_ZVAL(pattern);
++ if ((pce = pcre_get_compiled_regex_cache(Z_STR(pattern) TSRMLS_CC)) == NULL) {
++ zval_ptr_dtor(&pattern);
+ return -1;
+ } else {
+ /* pce now contains the compiled regex */
-+ zval *retval;
-+ zval *subpats;
++ zval retval;
++ zval subpats;
+ char *haystack;
+
-+ MAKE_STD_ZVAL(retval);
-+ ALLOC_INIT_ZVAL(subpats);
-+
++ ZVAL_NULL(&retval);
++ ZVAL_NULL(&subpats);
++
+ /* Cut the search len from haystack, equals to REG_STARTEND */
+ haystack = estrndup(ms->search.s, ms->search.s_len);
+
+ /* match v = 0, no match v = 1 */
-+ php_pcre_match_impl(pce, haystack, ms->search.s_len, retval, subpats, 1, 1, PREG_OFFSET_CAPTURE, 0 TSRMLS_CC);
++ php_pcre_match_impl(pce, haystack, ms->search.s_len, &retval, &subpats, 1, 1, PREG_OFFSET_CAPTURE, 0 TSRMLS_CC);
+ /* Free haystack */
+ efree(haystack);
+
-+ if (Z_LVAL_P(retval) < 0) {
++ if (Z_LVAL(retval) < 0) {
+ zval_ptr_dtor(&subpats);
-+ FREE_ZVAL(retval);
-+ zval_dtor(pattern);
-+ FREE_ZVAL(pattern);
++ zval_ptr_dtor(&pattern);
+ return -1;
-+ } else if ((Z_LVAL_P(retval) > 0) && (Z_TYPE_P(subpats) == IS_ARRAY)) {
-+
++ } else if ((Z_LVAL(retval) > 0) && (Z_TYPE(subpats) == IS_ARRAY)) {
+ /* Need to fetch global match which equals pmatch[0] */
-+ HashTable *ht = Z_ARRVAL_P(subpats);
-+ HashPosition outer_pos;
++ zval *pzval;
++ HashTable *ht = Z_ARRVAL(subpats);
+ zval *pattern_match = NULL, *pattern_offset = NULL;
-+
-+ zend_hash_internal_pointer_reset_ex(ht, &outer_pos);
-+
-+ if (zend_hash_has_more_elements_ex(ht, &outer_pos) == SUCCESS &&
-+ zend_hash_move_forward_ex(ht, &outer_pos)) {
-+
-+ zval **ppzval;
-+
-+ /* The first element (should be) is the global match
-+ Need to move to the inner array to get the global match */
-+
-+ if (zend_hash_get_current_data_ex(ht, (void**)&ppzval, &outer_pos) != FAILURE) {
-+
-+ HashTable *inner_ht;
-+ HashPosition inner_pos;
-+ zval **match, **offset;
-+ zval tmpcopy = **ppzval, matchcopy, offsetcopy;
-+
-+ zval_copy_ctor(&tmpcopy);
-+ INIT_PZVAL(&tmpcopy);
-+
-+ inner_ht = Z_ARRVAL(tmpcopy);
-+
-+ /* If everything goes according to the master plan
-+ tmpcopy now contains two elements:
-+ 0 = the match
-+ 1 = starting position of the match */
-+ zend_hash_internal_pointer_reset_ex(inner_ht, &inner_pos);
-+
-+ if (zend_hash_has_more_elements_ex(inner_ht, &inner_pos) == SUCCESS &&
-+ zend_hash_move_forward_ex(inner_ht, &inner_pos)) {
-+
-+ if (zend_hash_get_current_data_ex(inner_ht, (void**)&match, &inner_pos) != FAILURE) {
-+
-+ matchcopy = **match;
-+ zval_copy_ctor(&matchcopy);
-+ INIT_PZVAL(&matchcopy);
-+ convert_to_string(&matchcopy);
-+
-+ MAKE_STD_ZVAL(pattern_match);
-+ Z_STRVAL_P(pattern_match) = (char *)Z_STRVAL(matchcopy);
-+ Z_STRLEN_P(pattern_match) = Z_STRLEN(matchcopy);
-+ Z_TYPE_P(pattern_match) = IS_STRING;
-+
-+ zval_dtor(&matchcopy);
-+ }
-+ }
-+
-+ if (zend_hash_has_more_elements_ex(inner_ht, &inner_pos) == SUCCESS &&
-+ zend_hash_move_forward_ex(inner_ht, &inner_pos)) {
-+
-+ if (zend_hash_get_current_data_ex(inner_ht, (void**)&offset, &inner_pos) != FAILURE) {
-+
-+ offsetcopy = **offset;
-+ zval_copy_ctor(&offsetcopy);
-+ INIT_PZVAL(&offsetcopy);
-+ convert_to_long(&offsetcopy);
-+
-+ MAKE_STD_ZVAL(pattern_offset);
-+ Z_LVAL_P(pattern_offset) = Z_LVAL(offsetcopy);
-+ Z_TYPE_P(pattern_offset) = IS_LONG;
-+
-+ zval_dtor(&offsetcopy);
-+ }
-+ }
-+ zval_dtor(&tmpcopy);
-+ }
-+
-+ if ((pattern_match != NULL) && (pattern_offset != NULL)) {
-+ ms->search.s += (int)Z_LVAL_P(pattern_offset); /* this is where the match starts */
-+ ms->search.offset += (size_t)Z_LVAL_P(pattern_offset); /* this is where the match starts as size_t */
-+ ms->search.rm_len = Z_STRLEN_P(pattern_match) /* This is the length of the matched pattern */;
-+ v = 0;
-+
-+ efree(pattern_match);
-+ efree(pattern_offset);
-+
-+ } else {
-+ zval_ptr_dtor(&subpats);
-+ FREE_ZVAL(retval);
-+ zval_dtor(pattern);
-+ FREE_ZVAL(pattern);
-+ return -1;
++ int first = 1, inner_first;
++
++ ZEND_HASH_FOREACH_VAL(ht, pzval) {
++ HashTable *inner_ht;
++ zval *match, *offset;
++ zval tmpcopy, matchcopy, offsetcopy;
++
++ if (first) {
++ first = 0;
++ continue;
+ }
-+ }
++ ZVAL_DUP(&tmpcopy, pzval);
- l = 0;
- rc = regcomp(&rx, m->value.s,
@@ -3588,8 +3802,51 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
- (size_t)(pmatch[0].rm_eo - pmatch[0].rm_so);
- v = 0;
- break;
++ inner_ht = Z_ARRVAL(tmpcopy);
- case REG_NOMATCH:
++ /* If everything goes according to the master plan
++ tmpcopy now contains two elements:
++ 0 = the match
++ 1 = starting position of the match */
++ inner_first = 1;
++ ZEND_HASH_FOREACH_VAL(inner_ht, match) {
++ if (inner_first) {
++ inner_first = 0;
++ continue;
++ }
++ ZVAL_DUP(&matchcopy, match);
++ convert_to_string(&matchcopy);
++ pattern_match = &matchcopy;
++ } ZEND_HASH_FOREACH_END();
++
++ inner_first = 1;
++ ZEND_HASH_FOREACH_VAL(inner_ht, offset) {
++ if (inner_first) {
++ inner_first = 0;
++ continue;
++ }
++ ZVAL_DUP(&offsetcopy, offset);
++ convert_to_long(&offsetcopy);
++ pattern_offset = &offsetcopy;
++ } ZEND_HASH_FOREACH_END();
++
++ zval_dtor(&tmpcopy);
++
++ if ((pattern_match != NULL) && (pattern_offset != NULL)) {
++ ms->search.s += Z_LVAL_P(pattern_offset); /* this is where the match starts */
++ ms->search.offset += Z_LVAL_P(pattern_offset); /* this is where the match starts as size_t */
++ ms->search.rm_len = Z_STRLEN_P(pattern_match) /* This is the length of the matched pattern */;
++ v = 0;
++
++ zval_ptr_dtor(pattern_match);
++ zval_ptr_dtor(pattern_offset);
++ } else {
++ zval_ptr_dtor(&subpats);
++ zval_ptr_dtor(&pattern);
++ return -1;
++ }
++ } ZEND_HASH_FOREACH_END();
+ } else {
v = 1;
- break;
@@ -3603,18 +3860,16 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
}
- regfree(&rx);
+ zval_ptr_dtor(&subpats);
-+ FREE_ZVAL(retval);
++ zval_ptr_dtor(&pattern);
}
- if (v == (uint64_t)-1)
- return -1;
-+ zval_dtor(pattern);
-+ FREE_ZVAL(pattern);
break;
}
case FILE_INDIRECT:
diff -u libmagic.orig/strcasestr.c libmagic/strcasestr.c
--- libmagic.orig/strcasestr.c Thu Dec 5 17:57:50 2013
-+++ libmagic/strcasestr.c Sun May 4 21:29:20 2014
++++ libmagic/strcasestr.c Wed Aug 27 12:35:45 2014
@@ -37,6 +37,8 @@
__RCSID("$NetBSD: strncasecmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $");
#endif /* LIBC_SCCS and not lint */
diff --git a/ext/fileinfo/libmagic/readcdf.c b/ext/fileinfo/libmagic/readcdf.c
index ec97ced44b..175719a2d7 100644
--- a/ext/fileinfo/libmagic/readcdf.c
+++ b/ext/fileinfo/libmagic/readcdf.c
@@ -88,6 +88,9 @@ static const struct cv {
{ 0x00000000000c1084LLU, 0x46000000000000c0LLU },
#endif
"x-msi",
+ },
+ { { 0, 0 },
+ NULL,
}
}, clsid2desc[] = {
{
@@ -98,6 +101,9 @@ static const struct cv {
#endif
"MSI Installer",
},
+ { { 0, 0 },
+ NULL,
+ }
};
private const char *
diff --git a/ext/fileinfo/libmagic/readelf.c b/ext/fileinfo/libmagic/readelf.c
index 3b0aae54c1..a849c1a098 100644
--- a/ext/fileinfo/libmagic/readelf.c
+++ b/ext/fileinfo/libmagic/readelf.c
@@ -492,6 +492,13 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
uint32_t namesz, descsz;
unsigned char *nbuf = CAST(unsigned char *, vbuf);
+ if (xnh_sizeof + offset > size) {
+ /*
+ * We're out of note headers.
+ */
+ return xnh_sizeof + offset;
+ }
+
(void)memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
offset += xnh_sizeof;
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
index de294049c4..b5e16845c2 100644
--- a/ext/gmp/gmp.c
+++ b/ext/gmp/gmp.c
@@ -1792,7 +1792,7 @@ ZEND_FUNCTION(gmp_random)
Gets a random number in the range 0 to (2 ** n) - 1 */
ZEND_FUNCTION(gmp_random_bits)
{
- long bits;
+ zend_long bits;
mpz_ptr gmpnum_result;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &bits) == FAILURE) {
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c
index f43802647b..5c6880beea 100644
--- a/ext/opcache/Optimizer/block_pass.c
+++ b/ext/opcache/Optimizer/block_pass.c
@@ -616,7 +616,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
VAR_SOURCE(opline->op1)->opcode == ZEND_QM_ASSIGN &&
ZEND_OP1_TYPE(VAR_SOURCE(opline->op1)) == IS_CONST &&
opline->opcode != ZEND_CASE && /* CASE _always_ expects variable */
- opline->opcode != ZEND_FETCH_LIST && /* in 5.1, FETCH_DIM_TMP_VAR expects T */
+ opline->opcode != ZEND_FETCH_LIST &&
opline->opcode != ZEND_FE_RESET &&
opline->opcode != ZEND_FREE
) {
diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c
index 091437e119..8fb5a9b0c9 100644
--- a/ext/opcache/Optimizer/compact_literals.c
+++ b/ext/opcache/Optimizer/compact_literals.c
@@ -227,10 +227,16 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
case ZEND_FETCH_CLASS:
case ZEND_ADD_INTERFACE:
case ZEND_ADD_TRAIT:
+ case ZEND_INSTANCEOF:
if (ZEND_OP2_TYPE(opline) == IS_CONST) {
LITERAL_INFO(opline->op2.constant, LITERAL_CLASS, 1, 1, 2);
}
break;
+ case ZEND_NEW:
+ if (ZEND_OP1_TYPE(opline) == IS_CONST) {
+ LITERAL_INFO(opline->op1.constant, LITERAL_CLASS, 1, 1, 2);
+ }
+ break;
case ZEND_ASSIGN_OBJ:
case ZEND_FETCH_OBJ_R:
case ZEND_FETCH_OBJ_W:
diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c
index 70e58f5695..1a6d0b675a 100644
--- a/ext/opcache/Optimizer/zend_optimizer.c
+++ b/ext/opcache/Optimizer/zend_optimizer.c
@@ -126,6 +126,7 @@ void zend_optimizer_update_op1_const(zend_op_array *op_array,
case ZEND_CATCH:
case ZEND_FETCH_CONSTANT:
case ZEND_DEFINED:
+ case ZEND_NEW:
opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
zend_string_hash_val(Z_STR(ZEND_OP1_LITERAL(opline)));
Z_CACHE_SLOT(op_array->literals[opline->op1.constant]) = op_array->last_cache_slot++;
@@ -173,6 +174,7 @@ void zend_optimizer_update_op2_const(zend_op_array *op_array,
case ZEND_ISSET_ISEMPTY_VAR:
case ZEND_ADD_INTERFACE:
case ZEND_ADD_TRAIT:
+ case ZEND_INSTANCEOF:
Z_CACHE_SLOT(op_array->literals[opline->op2.constant]) = op_array->last_cache_slot++;
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index d36827bde6..b5d446a54b 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -1127,10 +1127,6 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
return new_persistent_script;
}
- if (!compact_persistent_script(new_persistent_script)) {
- return new_persistent_script;
- }
-
/* exclusive lock */
zend_shared_alloc_lock(TSRMLS_C);
diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c
index ee7be50619..22683245f6 100644
--- a/ext/opcache/zend_accelerator_util_funcs.c
+++ b/ext/opcache/zend_accelerator_util_funcs.c
@@ -88,64 +88,6 @@ zend_persistent_script* create_persistent_script(void)
return persistent_script;
}
-static int compact_hash_table(HashTable *ht)
-{
- uint i = 3;
- uint j;
- uint nSize;
- Bucket *d;
- Bucket *p;
-
- if (!ht->nNumOfElements || (ht->u.flags & HASH_FLAG_PACKED)) {
- /* Empty tables don't allocate space for Buckets */
- return 1;
- }
-
- if (ht->nNumOfElements >= 0x80000000) {
- /* prevent overflow */
- nSize = 0x80000000;
- } else {
- while ((1U << i) < ht->nNumOfElements) {
- i++;
- }
- nSize = 1 << i;
- }
-
- if (nSize >= ht->nTableSize) {
- /* Keep the size */
- return 1;
- }
-
- d = (Bucket *)pemalloc(nSize * (sizeof(Bucket) + sizeof(uint32_t)), ht->u.flags & HASH_FLAG_PERSISTENT);
- if (!d) {
- return 0;
- }
-
- for (i = 0, j = 0; i < ht->nNumUsed; i++) {
- p = ht->arData + i;
- if (Z_TYPE(p->val) != IS_UNDEF) {
- d[j++] = *p;
- }
- }
- ht->nNumUsed = j;
-
- pefree(ht->arData, ht->u.flags & HASH_FLAG_PERSISTENT);
-
- ht->arData = d;
- ht->arHash = (uint32_t *)(d + nSize);
- ht->nTableSize = nSize;
- ht->nTableMask = ht->nTableSize - 1;
- zend_hash_rehash(ht);
-
- return 1;
-}
-
-int compact_persistent_script(zend_persistent_script *persistent_script)
-{
- return compact_hash_table(&persistent_script->function_table) &&
- compact_hash_table(&persistent_script->class_table);
-}
-
void free_persistent_script(zend_persistent_script *persistent_script, int destroy_elements)
{
if (destroy_elements) {
diff --git a/ext/opcache/zend_accelerator_util_funcs.h b/ext/opcache/zend_accelerator_util_funcs.h
index 2f515d85cc..cbcb2ffa8e 100644
--- a/ext/opcache/zend_accelerator_util_funcs.h
+++ b/ext/opcache/zend_accelerator_util_funcs.h
@@ -28,7 +28,6 @@
void zend_accel_copy_internal_functions(TSRMLS_D);
zend_persistent_script* create_persistent_script(void);
-int compact_persistent_script(zend_persistent_script *script);
void free_persistent_script(zend_persistent_script *persistent_script, int destroy_elements);
void zend_accel_free_user_functions(HashTable *ht TSRMLS_DC);
diff --git a/ext/pdo_dblib/README b/ext/pdo_dblib/README
index 888ffb676f..15f8d147a0 100644
--- a/ext/pdo_dblib/README
+++ b/ext/pdo_dblib/README
@@ -1,25 +1,12 @@
This is the unified Sybase-DB style driver for PDO.
-There are three implementations of this library that are known to me:
-
-- The Sybase DB lib itself
-- MSSQL DB lib
-- FreeTDS DB lib
-
-This extension will compile and register itself as 'mssql' when built against
-the mssql libraries (and be named php_pdo_mssql.dll), or 'sybase' otherwise
-(php_pdo_sybase.dll)
-
-If you want to try out the free "desktop" version of SQL Server, known as the MSDE, google to obtain the appropriate download link. Here are some short tips on getting it running:
-
-- Download it and run it to extract it
-- Open up a command prompt
-- cd \MSDERelA
-- setup.exe SQLSECURITY=1 SAPWD=yoursecretpassword
-- cd \Program Files\Microsoft SQL Server\80\Tools\Binn
-- SVRNETCN.exe
-- enable TCP (you MUST do this if you want to access it via FreeTDS/Sybase libs)
-- net start mssqlserver
-
-Consult the MS docs for more information about all this stuff.
+This extension register itself as:
+ - 'mssql' when built against the Microsoft DBLIB library
+ - 'sybase' when built against Sybase ct-lib
+ - 'dblib' when built against FreeTDS
+The following database products are free for testing:
+ - Microsoft SQL Server Express (Windows Only)
+ - Sybase Adaptive Server (Windows, Linux, *NIX)
+ - Microsoft SQL Server Azure (One Month Trial Cloud Service)
+
diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c
index 40d4114879..a433e8652c 100644
--- a/ext/pdo_dblib/dblib_driver.c
+++ b/ext/pdo_dblib/dblib_driver.c
@@ -61,7 +61,6 @@ static int dblib_fetch_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info TSRMLS
msg, einfo->dberr, einfo->severity, stmt ? stmt->active_query_string : "");
add_next_index_long(info, einfo->dberr);
- // TODO: avoid reallocation ???
add_next_index_string(info, message);
efree(message);
add_next_index_long(info, einfo->oserr);
@@ -145,28 +144,58 @@ static zend_long dblib_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sq
static int dblib_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type paramtype TSRMLS_DC)
{
- pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data;
- char *q;
- int l = 1;
-
- *quoted = q = safe_emalloc(2, unquotedlen, 3);
- *q++ = '\'';
-
- while (unquotedlen--) {
- if (*unquoted == '\'') {
- *q++ = '\'';
- *q++ = '\'';
- l += 2;
- } else {
- *q++ = *unquoted;
- ++l;
+
+ int useBinaryEncoding = 0;
+ const char * hex = "0123456789abcdef";
+ int i;
+ char * q;
+ *quotedlen = 0;
+
+ /*
+ * Detect quoted length and if we should use binary encoding
+ */
+ for(i=0;i<unquotedlen;i++) {
+ if( 32 > unquoted[i] || 127 < unquoted[i] ) {
+ useBinaryEncoding = 1;
+ break;
+ }
+ if(unquoted[i] == '\'') ++*quotedlen;
+ ++*quotedlen;
+ }
+
+ if(useBinaryEncoding) {
+ /*
+ * Binary safe quoting
+ * Will implicitly convert for all data types except Text, DateTime & SmallDateTime
+ *
+ */
+ *quotedlen = (unquotedlen * 2) + 2; /* 2 chars per byte +2 for "0x" prefix */
+ q = *quoted = emalloc(*quotedlen);
+
+ *q++ = '0';
+ *q++ = 'x';
+ for (i=0;i<unquotedlen;i++) {
+ *q++ = hex[ (*unquoted>>4)&0xF];
+ *q++ = hex[ (*unquoted++)&0xF];
+ }
+ } else {
+ /* Alpha/Numeric Quoting */
+ *quotedlen += 2; /* +2 for opening, closing quotes */
+ q = *quoted = emalloc(*quotedlen);
+ *q++ = '\'';
+
+ for (i=0;i<unquotedlen;i++) {
+ if (unquoted[i] == '\'') {
+ *q++ = '\'';
+ *q++ = '\'';
+ } else {
+ *q++ = unquoted[i];
+ }
}
- unquoted++;
+ *q++ = '\'';
}
- *q++ = '\'';
- *q++ = '\0';
- *quotedlen = l+1;
+ *q = 0;
return 1;
}
@@ -174,7 +203,6 @@ static int dblib_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquote
static int pdo_dblib_transaction_cmd(const char *cmd, pdo_dbh_t *dbh TSRMLS_DC)
{
pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data;
- RETCODE ret;
if (FAIL == dbcmd(H->link, cmd)) {
return 0;
@@ -240,12 +268,29 @@ char *dblib_handle_last_id(pdo_dbh_t *dbh, const char *name, unsigned int *len T
}
id = emalloc(32);
- *len = dbconvert(NULL, (dbcoltype(H->link, 1)) , (dbdata(H->link, 1)) , (dbdatlen(H->link, 1)), SQLCHAR, id, (DBINT)-1);
+ *len = dbconvert(NULL, (dbcoltype(H->link, 1)) , (dbdata(H->link, 1)) , (dbdatlen(H->link, 1)), SQLCHAR, (BYTE *)id, (DBINT)-1);
dbcancel(H->link);
return id;
}
+static int dblib_set_attr(pdo_dbh_t *dbh, zend_long attr, zval *val TSRMLS_DC)
+{
+ switch(attr) {
+ case PDO_ATTR_TIMEOUT:
+ return 0;
+ default:
+ return 1;
+ }
+
+}
+
+static int dblib_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *return_value TSRMLS_DC)
+{
+ /* dblib_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; */
+ return 0;
+}
+
static struct pdo_dbh_methods dblib_methods = {
dblib_handle_closer,
dblib_handle_preparer,
@@ -254,10 +299,10 @@ static struct pdo_dbh_methods dblib_methods = {
dblib_handle_begin, /* begin */
dblib_handle_commit, /* commit */
dblib_handle_rollback, /* rollback */
- NULL, /*set attr */
+ dblib_set_attr, /*set attr */
dblib_handle_last_id, /* last insert id */
dblib_fetch_error, /* fetch error */
- NULL, /* get attr */
+ dblib_get_attribute, /* get attr */
NULL, /* check liveness */
NULL, /* get driver methods */
NULL, /* request shutdown */
@@ -268,7 +313,6 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
{
pdo_dblib_db_handle *H;
int i, nvars, nvers, ret = 0;
- int *val;
const pdo_dblib_keyval tdsver[] = {
{"4.2",DBVERSION_42}
@@ -303,6 +347,12 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
php_pdo_parse_data_source(dbh->data_source, dbh->data_source_len, vars, nvars);
+ if (driver_options) {
+ int timeout = pdo_attr_lval(driver_options, PDO_ATTR_TIMEOUT, 30 TSRMLS_CC);
+ dbsetlogintime(timeout); /* Connection/Login Timeout */
+ dbsettime(timeout); /* Statement Timeout */
+ }
+
H = pecalloc(1, sizeof(*H), dbh->is_persistent);
H->login = dblogin();
H->err.sqlstate = dbh->error_code;
@@ -311,8 +361,8 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
goto cleanup;
}
- DBERRHANDLE(H->login, (EHANDLEFUNC) error_handler);
- DBMSGHANDLE(H->login, (MHANDLEFUNC) msg_handler);
+ DBERRHANDLE(H->login, (EHANDLEFUNC) pdo_dblib_error_handler);
+ DBMSGHANDLE(H->login, (MHANDLEFUNC) pdo_dblib_msg_handler);
if(vars[5].optval) {
for(i=0;i<nvers;i++) {
diff --git a/ext/pdo_dblib/dblib_stmt.c b/ext/pdo_dblib/dblib_stmt.c
index a29405b24e..bd79be3e9c 100644
--- a/ext/pdo_dblib/dblib_stmt.c
+++ b/ext/pdo_dblib/dblib_stmt.c
@@ -103,21 +103,15 @@ static int pdo_dblib_stmt_cursor_closer(pdo_stmt_t *stmt TSRMLS_DC)
/* Cancel any pending results */
dbcancel(H->link);
- efree(stmt->columns);
- stmt->columns = NULL;
-
return 1;
}
static int pdo_dblib_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC)
{
pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
-
- efree(stmt->columns);
- stmt->columns = NULL;
-
+
efree(S);
-
+
return 1;
}
@@ -128,16 +122,16 @@ static int pdo_dblib_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC)
RETCODE ret;
ret = dbresults(H->link);
-
+
if (FAIL == ret) {
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO_DBLIB: dbresults() returned FAIL" TSRMLS_CC);
return 0;
}
-
+
if(NO_MORE_RESULTS == ret) {
return 0;
}
-
+
stmt->row_count = DBCOUNT(H->link);
stmt->column_count = dbnumcols(H->link);
@@ -204,7 +198,7 @@ static int pdo_dblib_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC)
struct pdo_column_data *col = &stmt->columns[colno];
- col->name = (char*)dbcolname(H->link, colno+1);
+ col->name = estrdup(dbcolname(H->link, colno+1));
col->maxlen = dbcollen(H->link, colno+1);
col->namelen = strlen(col->name);
col->param_type = PDO_PARAM_STR;
@@ -255,12 +249,11 @@ static int pdo_dblib_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr,
break;
}
case SQLUNIQUE: {
- *len = 36+1;
+ *len = 37;
tmp_ptr = emalloc(*len + 1);
-
- /* uniqueidentifier is a 16-byte binary number, convert to 32 char hex string */
*len = dbconvert(NULL, SQLUNIQUE, *ptr, *len, SQLCHAR, tmp_ptr, *len);
php_strtoupper(tmp_ptr, *len);
+ tmp_ptr[36] = '\0';
*ptr = tmp_ptr;
break;
}
diff --git a/ext/pdo_dblib/pdo_dblib.c b/ext/pdo_dblib/pdo_dblib.c
index 3afd885df5..4cd0749cf8 100644
--- a/ext/pdo_dblib/pdo_dblib.c
+++ b/ext/pdo_dblib/pdo_dblib.c
@@ -86,7 +86,7 @@ ZEND_GET_MODULE(pdo_dblib)
#endif
#endif
-int error_handler(DBPROCESS *dbproc, int severity, int dberr,
+int pdo_dblib_error_handler(DBPROCESS *dbproc, int severity, int dberr,
int oserr, char *dberrstr, char *oserrstr)
{
pdo_dblib_err *einfo;
@@ -103,6 +103,7 @@ int error_handler(DBPROCESS *dbproc, int severity, int dberr,
einfo->severity = severity;
einfo->oserr = oserr;
einfo->dberr = dberr;
+
if (einfo->oserrstr) {
efree(einfo->oserrstr);
}
@@ -128,16 +129,10 @@ int error_handler(DBPROCESS *dbproc, int severity, int dberr,
}
strcpy(einfo->sqlstate, state);
-#if 0
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "dblib error: %d %s (severity %d)",
- dberr, dberrstr, severity);
-#endif
-
return INT_CANCEL;
}
-int msg_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate,
+int pdo_dblib_msg_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate,
int severity, char *msgtext, char *srvname, char *procname, DBUSMALLINT line)
{
pdo_dblib_err *einfo;
@@ -156,10 +151,6 @@ int msg_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate,
einfo->lastmsg = estrdup(msgtext);
}
-#if 0
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "dblib message: %s (severity %d)", msgtext, severity);
-#endif
-
return 0;
}
@@ -196,18 +187,9 @@ PHP_MINIT_FUNCTION(pdo_dblib)
return FAILURE;
}
- /* TODO:
-
- dbsetifile()
- dbsetmaxprocs()
- dbsetlogintime()
- dbsettime()
-
- */
-
#if !PHP_DBLIB_IS_MSSQL
- dberrhandle(error_handler);
- dbmsghandle(msg_handler);
+ dberrhandle((EHANDLEFUNC) pdo_dblib_error_handler);
+ dbmsghandle((MHANDLEFUNC) pdo_dblib_msg_handler);
#endif
return SUCCESS;
diff --git a/ext/pdo_dblib/php_pdo_dblib_int.h b/ext/pdo_dblib/php_pdo_dblib_int.h
index e247b5c19e..3b341478d7 100644
--- a/ext/pdo_dblib/php_pdo_dblib_int.h
+++ b/ext/pdo_dblib/php_pdo_dblib_int.h
@@ -37,7 +37,7 @@
# define DBSETOPT(a, b, c) dbsetopt(a, b, c)
# define SYBESMSG SQLESMSG
# define SYBESEOF SQLESEOF
-# define SYBEFCON SQLECONN // SQLEFCON does not exist in MS SQL Server.
+# define SYBEFCON SQLECONN /* SQLEFCON does not exist in MS SQL Server. */
# define SYBEMEM SQLEMEM
# define SYBEPWD SQLEPWD
@@ -89,10 +89,10 @@ typedef unsigned char *LPBYTE;
typedef float DBFLT4;
#endif
-int error_handler(DBPROCESS *dbproc, int severity, int dberr,
+int pdo_dblib_error_handler(DBPROCESS *dbproc, int severity, int dberr,
int oserr, char *dberrstr, char *oserrstr);
-int msg_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate,
+int pdo_dblib_msg_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate,
int severity, char *msgtext, char *srvname, char *procname, DBUSMALLINT line);
extern pdo_driver_t pdo_dblib_driver;
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index cdc61fee88..0903f6c952 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -3307,6 +3307,7 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type
zend_try {
failed = 0;
+ CG(zend_lineno) = 0;
res = phar_orig_compile_file(file_handle, type TSRMLS_CC);
} zend_catch {
failed = 1;
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index ba70ecca9d..361b0824eb 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -267,10 +267,8 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z
name = NULL;
} else {
if (Z_TYPE_P(member) != IS_STRING) {
- tmp_zv = *member;
- zval_copy_ctor(&tmp_zv);
+ ZVAL_STR(&tmp_zv, zval_get_string(member));
member = &tmp_zv;
- convert_to_string(member);
}
name = Z_STRVAL_P(member);
}
@@ -476,9 +474,7 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool
}
} else {
if (Z_TYPE_P(member) != IS_STRING) {
- trim_zv = *member;
- zval_copy_ctor(&trim_zv);
- convert_to_string(&trim_zv);
+ ZVAL_STR(&trim_zv, zval_get_string(member));
php_trim(Z_STRVAL(trim_zv), Z_STRLEN(trim_zv), NULL, 0, &tmp_zv, 3 TSRMLS_CC);
zval_dtor(&trim_zv);
member = &tmp_zv;
@@ -736,10 +732,8 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend
zval tmp_zv;
if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_LONG) {
- tmp_zv = *member;
- zval_copy_ctor(&tmp_zv);
+ ZVAL_STR(&tmp_zv, zval_get_string(member));
member = &tmp_zv;
- convert_to_string(member);
}
sxe = Z_SXEOBJ_P(object);
@@ -866,10 +860,8 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements,
int test = 0;
if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_LONG) {
- tmp_zv = *member;
- zval_copy_ctor(&tmp_zv);
+ ZVAL_STR(&tmp_zv, zval_get_string(member));
member = &tmp_zv;
- convert_to_string(member);
}
sxe = Z_SXEOBJ_P(object);
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index b12303ee0e..97191652d6 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -834,13 +834,10 @@ static xmlNodePtr to_xml_string(encodeTypePtr type, zval *data, int style, xmlNo
str = estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data));
new_len = Z_STRLEN_P(data);
} else {
- zval tmp = *data;
-
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- str = estrndup(Z_STRVAL(tmp), Z_STRLEN(tmp));
- new_len = Z_STRLEN(tmp);
- zval_dtor(&tmp);
+ zend_string *tmp = zval_get_string(data);
+ str = estrndup(tmp->val, tmp->len);
+ new_len = tmp->len;
+ zend_string_release(tmp);
}
if (SOAP_GLOBAL(encoding) != NULL) {
@@ -953,9 +950,7 @@ static xmlNodePtr to_xml_hexbin(encodeTypePtr type, zval *data, int style, xmlNo
FIND_ZVAL_NULL(data, ret, style);
if (Z_TYPE_P(data) != IS_STRING) {
- tmp = *data;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
+ ZVAL_STR(&tmp, zval_get_string(data));
data = &tmp;
}
str = (unsigned char *) safe_emalloc(Z_STRLEN_P(data) * 2, sizeof(char), 1);
@@ -1063,9 +1058,9 @@ static xmlNodePtr to_xml_long(encodeTypePtr type, zval *data, int style, xmlNode
snprintf(s, sizeof(s), "%0.0F",floor(Z_DVAL_P(data)));
xmlNodeSetContent(ret, BAD_CAST(s));
} else {
- zval tmp = *data;
+ zval tmp;
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, data);
if (Z_TYPE(tmp) != IS_LONG) {
convert_to_long(&tmp);
}
@@ -1090,11 +1085,7 @@ static xmlNodePtr to_xml_double(encodeTypePtr type, zval *data, int style, xmlNo
xmlAddChild(parent, ret);
FIND_ZVAL_NULL(data, ret, style);
- tmp = *data;
- if (Z_TYPE(tmp) != IS_DOUBLE) {
- zval_copy_ctor(&tmp);
- convert_to_double(&tmp);
- }
+ ZVAL_DOUBLE(&tmp, zval_get_double(data));
str = (char *) safe_emalloc(EG(precision), 1, MAX_LENGTH_OF_DOUBLE + 1);
php_gcvt(Z_DVAL(tmp), EG(precision), '.', 'E', str);
@@ -3032,13 +3023,12 @@ static xmlNodePtr to_xml_list(encodeTypePtr enc, zval *data, int style, xmlNodeP
xmlNodeSetContentLen(ret, BAD_CAST(list.s->val), list.s->len);
smart_str_free(&list);
} else {
- zval tmp = *data;
+ zval tmp;
char *str, *start, *next;
smart_str list = {0};
if (Z_TYPE_P(data) != IS_STRING) {
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
+ ZVAL_STR(&tmp, zval_get_string(data));
data = &tmp;
}
str = estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data));
@@ -3144,10 +3134,9 @@ static xmlNodePtr to_xml_any(encodeTypePtr type, zval *data, int style, xmlNodeP
if (Z_TYPE_P(data) == IS_STRING) {
ret = xmlNewTextLen(BAD_CAST(Z_STRVAL_P(data)), Z_STRLEN_P(data));
} else {
- zval tmp = *data;
+ zval tmp;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
+ ZVAL_STR(&tmp, zval_get_string(data));
ret = xmlNewTextLen(BAD_CAST(Z_STRVAL(tmp)), Z_STRLEN(tmp));
zval_dtor(&tmp);
}
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index 44078733d6..1de8e021dd 100644
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -351,7 +351,9 @@ PHP_FUNCTION(spl_autoload)
while (ex && (!ex->func || !ZEND_USER_CODE(ex->func->type))) {
ex = ex->prev_execute_data;
}
- if (ex && ex->opline->opcode != ZEND_FETCH_CLASS) {
+ if (ex &&
+ ex->opline->opcode != ZEND_FETCH_CLASS &&
+ ex->opline->opcode != ZEND_NEW) {
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Class %s could not be loaded", class_name->val);
} else {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s could not be loaded", class_name->val);
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 98a1c21b3e..57d0065b25 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -728,7 +728,7 @@ static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /*
zval_ptr_dtor(&args[0]);
zval_ptr_dtor(&args[1]);
- return result;
+ return result < 0 ? -1 : result > 0 ? 1 : 0;
}
/* }}} */
@@ -1301,9 +1301,10 @@ PHP_FUNCTION(array_search)
}
/* }}} */
-static int php_valid_var_name(char *var_name, int var_name_len) /* {{{ */
+static int php_valid_var_name(char *var_name, size_t var_name_len) /* {{{ */
{
- int i, ch;
+ size_t i;
+ int ch;
if (!var_name || !var_name_len) {
return 0;
@@ -1337,7 +1338,7 @@ static int php_valid_var_name(char *var_name, int var_name_len) /* {{{ */
}
/* }}} */
-PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, int var_name_len, zend_bool add_underscore TSRMLS_DC) /* {{{ */
+PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, size_t var_name_len, zend_bool add_underscore TSRMLS_DC) /* {{{ */
{
ZVAL_NEW_STR(result, zend_string_alloc(Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0));
memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRLEN_P(prefix));
@@ -1569,7 +1570,7 @@ PHP_FUNCTION(array_fill)
}
/* allocate an array for return */
- array_init_size(return_value, num);
+ array_init_size(return_value, (uint32_t)num);
if (num == 0) {
return;
@@ -1786,10 +1787,10 @@ err:
static void php_array_data_shuffle(zval *array TSRMLS_DC) /* {{{ */
{
- uint idx;
+ uint32_t idx, j, n_elems;
Bucket *p, temp;
HashTable *hash;
- int j, n_elems, rnd_idx, n_left;
+ zend_long rnd_idx, n_left;
n_elems = zend_hash_num_elements(Z_ARRVAL_P(array));
@@ -2222,7 +2223,7 @@ PHP_FUNCTION(array_splice)
/* Don't create the array of removed elements if it's not going
* to be used; e.g. only removing and/or replacing elements */
if (USED_RET()) {
- int size = length;
+ zend_long size = length;
/* Clamp the offset.. */
if (offset > num_in) {
@@ -2234,17 +2235,17 @@ PHP_FUNCTION(array_splice)
/* ..and the length */
if (length < 0) {
size = num_in - offset + length;
- } else if (((zend_ulong) offset + (zend_ulong) length) > (unsigned) num_in) {
+ } else if (((zend_ulong) offset + (zend_ulong) length) > (uint32_t) num_in) {
size = num_in - offset;
}
/* Initialize return value */
- array_init_size(return_value, size > 0 ? size : 0);
+ array_init_size(return_value, size > 0 ? (uint32_t)size : 0);
rem_hash = Z_ARRVAL_P(return_value);
}
/* Perform splice */
- new_hash = php_splice(Z_ARRVAL_P(array), offset, length, repl, repl_num, rem_hash);
+ new_hash = php_splice(Z_ARRVAL_P(array), (int)offset, (int)length, repl, (int)repl_num, rem_hash);
/* Replace input array's hashtable with the new one */
old_hash = *Z_ARRVAL_P(array);
@@ -2314,7 +2315,7 @@ PHP_FUNCTION(array_slice)
}
/* Initialize returned array */
- array_init_size(return_value, length > 0 ? length : 0);
+ array_init_size(return_value, length > 0 ? (uint32_t)length : 0);
if (length <= 0) {
return;
@@ -2897,9 +2898,9 @@ PHP_FUNCTION(array_pad)
/* Pad on the right or on the left */
if (pad_size > 0) {
- new_hash = php_splice(Z_ARRVAL_P(return_value), input_size, 0, pads, num_pads, NULL);
+ new_hash = php_splice(Z_ARRVAL_P(return_value), (int)input_size, 0, pads, (int)num_pads, NULL);
} else {
- new_hash = php_splice(Z_ARRVAL_P(return_value), 0, 0, pads, num_pads, NULL);
+ new_hash = php_splice(Z_ARRVAL_P(return_value), 0, 0, pads, (int)num_pads, NULL);
}
/* Copy the result hash into return value */
@@ -3971,22 +3972,23 @@ PHPAPI int php_multisort_compare(const void *a, const void *b TSRMLS_DC) /* {{{
Bucket *ab = *(Bucket **)a;
Bucket *bb = *(Bucket **)b;
int r;
- int result = 0;
+ zend_long result;
zval temp;
r = 0;
do {
+
php_set_compare_func(ARRAYG(multisort_flags)[MULTISORT_TYPE][r] TSRMLS_CC);
ARRAYG(compare_func)(&temp, &ab[r].val, &bb[r].val TSRMLS_CC);
result = ARRAYG(multisort_flags)[MULTISORT_ORDER][r] * Z_LVAL(temp);
if (result != 0) {
- return result;
+ return result > 0 ? 1 : -1;
}
r++;
} while (Z_TYPE(ab[r].val) != IS_UNDEF);
- return result;
+ return 0;
}
/* }}} */
@@ -4077,7 +4079,7 @@ PHP_FUNCTION(array_multisort)
/* flag allowed here */
if (parse_state[MULTISORT_TYPE] == 1) {
/* Save the flag and make sure then next arg is not the current flag. */
- sort_type = Z_LVAL(args[i]);
+ sort_type = (int)Z_LVAL(args[i]);
parse_state[MULTISORT_TYPE] = 0;
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1);
@@ -4205,7 +4207,7 @@ PHP_FUNCTION(array_rand)
/* Make the return value an array only if we need to pass back more than one result. */
if (num_req > 1) {
- array_init_size(return_value, num_req);
+ array_init_size(return_value, (uint32_t)num_req);
}
/* We can't use zend_hash_index_find() because the array may have string keys or gaps. */
@@ -4690,14 +4692,14 @@ PHP_FUNCTION(array_chunk)
size = num_in > 0 ? num_in : 1;
}
- array_init_size(return_value, ((num_in - 1) / size) + 1);
+ array_init_size(return_value, (uint32_t)(((num_in - 1) / size) + 1));
ZVAL_UNDEF(&chunk);
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(input), num_key, str_key, entry) {
/* If new chunk, create and initialize it. */
if (Z_TYPE(chunk) == IS_UNDEF) {
- array_init_size(&chunk, size);
+ array_init_size(&chunk, (uint32_t)size);
}
/* Add entry to the chunk, preserving keys if necessary. */
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
index 65472170e2..fa5ccfc12f 100644
--- a/ext/standard/assert.c
+++ b/ext/standard/assert.c
@@ -25,12 +25,12 @@
/* }}} */
ZEND_BEGIN_MODULE_GLOBALS(assert)
- zend_long active;
- zend_long bail;
- zend_long warning;
- zend_long quiet_eval;
zval callback;
char *cb;
+ zend_bool active;
+ zend_bool bail;
+ zend_bool warning;
+ zend_bool quiet_eval;
ZEND_END_MODULE_GLOBALS(assert)
ZEND_DECLARE_MODULE_GLOBALS(assert)
@@ -78,11 +78,11 @@ static PHP_INI_MH(OnChangeCallback) /* {{{ */
/* }}} */
PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("assert.active", "1", PHP_INI_ALL, OnUpdateLong, active, zend_assert_globals, assert_globals)
- STD_PHP_INI_ENTRY("assert.bail", "0", PHP_INI_ALL, OnUpdateLong, bail, zend_assert_globals, assert_globals)
- STD_PHP_INI_ENTRY("assert.warning", "1", PHP_INI_ALL, OnUpdateLong, warning, zend_assert_globals, assert_globals)
+ STD_PHP_INI_ENTRY("assert.active", "1", PHP_INI_ALL, OnUpdateBool, active, zend_assert_globals, assert_globals)
+ STD_PHP_INI_ENTRY("assert.bail", "0", PHP_INI_ALL, OnUpdateBool, bail, zend_assert_globals, assert_globals)
+ STD_PHP_INI_ENTRY("assert.warning", "1", PHP_INI_ALL, OnUpdateBool, warning, zend_assert_globals, assert_globals)
PHP_INI_ENTRY("assert.callback", NULL, PHP_INI_ALL, OnChangeCallback)
- STD_PHP_INI_ENTRY("assert.quiet_eval", "0", PHP_INI_ALL, OnUpdateLong, quiet_eval, zend_assert_globals, assert_globals)
+ STD_PHP_INI_ENTRY("assert.quiet_eval", "0", PHP_INI_ALL, OnUpdateBool, quiet_eval, zend_assert_globals, assert_globals)
PHP_INI_END()
static void php_assert_init_globals(zend_assert_globals *assert_globals_p TSRMLS_DC) /* {{{ */
@@ -258,7 +258,7 @@ PHP_FUNCTION(assert_options)
{
zval *value = NULL;
zend_long what;
- int oldint;
+ zend_bool oldint;
int ac = ZEND_NUM_ARGS();
zend_string *key;
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 5bcd3d3386..106bc54141 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -3952,7 +3952,7 @@ PHP_FUNCTION(long2ip)
/* "It's a long but it's not, PHP ints are signed */
char *ip;
size_t ip_len;
- zend_ulong n;
+ uint32_t n;
struct in_addr myaddr;
#ifdef HAVE_INET_PTON
char str[40];
@@ -4076,7 +4076,7 @@ PHP_FUNCTION(putenv)
#endif
}
- pe.key_len = strlen(pe.key);
+ pe.key_len = (int)strlen(pe.key);
#ifdef PHP_WIN32
if (equals) {
if (pe.key_len < setting_len - 1) {
@@ -4289,7 +4289,7 @@ PHP_FUNCTION(getopt)
opts->need_param = 0;
opts->opt_name = estrdup(arg_str->val);
- len = strlen(opts->opt_name);
+ len = (int)strlen(opts->opt_name);
if ((len > 0) && (opts->opt_name[len - 1] == ':')) {
opts->need_param++;
opts->opt_name[len - 1] = '\0';
@@ -4345,7 +4345,7 @@ PHP_FUNCTION(getopt)
}
/* Add this option / argument pair to the result hash. */
- optname_len = strlen(optname);
+ optname_len = (int)strlen(optname);
if (!(optname_len > 1 && optname[0] == '0') && is_numeric_string(optname, optname_len, NULL, NULL, 0) == IS_LONG) {
/* numeric string */
int optname_int = atoi(optname);
@@ -4400,9 +4400,9 @@ PHP_FUNCTION(sleep)
RETURN_FALSE;
}
#ifdef PHP_SLEEP_NON_VOID
- RETURN_LONG(php_sleep(num));
+ RETURN_LONG(php_sleep((unsigned int)num));
#else
- php_sleep(num);
+ php_sleep((unsigned int)num);
#endif
}
@@ -4422,7 +4422,7 @@ PHP_FUNCTION(usleep)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of microseconds must be greater than or equal to 0");
RETURN_FALSE;
}
- usleep(num);
+ usleep((unsigned int)num);
#endif
}
/* }}} */
@@ -4449,7 +4449,7 @@ PHP_FUNCTION(time_nanosleep)
}
php_req.tv_sec = (time_t) tv_sec;
- php_req.tv_nsec = tv_nsec;
+ php_req.tv_nsec = (long)tv_nsec;
if (!nanosleep(&php_req, &php_rem)) {
RETURN_TRUE;
} else if (errno == EINTR) {
@@ -4554,7 +4554,7 @@ PHP_FUNCTION(get_cfg_var)
return;
}
- retval = cfg_get_entry(varname, varname_len);
+ retval = cfg_get_entry(varname, (uint)varname_len);
if (retval) {
if (Z_TYPE_P(retval) == IS_ARRAY) {
@@ -4637,7 +4637,7 @@ PHP_FUNCTION(error_log)
}
if (argc > 1) {
- opt_err = erropt;
+ opt_err = (int)erropt;
}
if (_php_error_log_ex(opt_err, message, message_len, opt, headers TSRMLS_CC) == FAILURE) {
@@ -4655,7 +4655,7 @@ PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers T
}
/* }}} */
-PHPAPI int _php_error_log_ex(int opt_err, char *message, int message_len, char *opt, char *headers TSRMLS_DC) /* {{{ */
+PHPAPI int _php_error_log_ex(int opt_err, char *message, size_t message_len, char *opt, char *headers TSRMLS_DC) /* {{{ */
{
php_stream *stream = NULL;
@@ -5212,7 +5212,7 @@ PHP_FUNCTION(ini_get)
return;
}
- str = zend_ini_string(varname, varname_len, 0);
+ str = zend_ini_string(varname, (uint)varname_len, 0);
if (!str) {
RETURN_FALSE;
@@ -5322,7 +5322,7 @@ PHP_FUNCTION(ini_set)
return;
}
- old_value = zend_ini_string(varname->val, varname->len, 0);
+ old_value = zend_ini_string(varname->val, (int)varname->len, 0);
/* copy to return here, because alter might free it! */
if (old_value) {
@@ -5331,7 +5331,7 @@ PHP_FUNCTION(ini_set)
RETVAL_FALSE;
}
-#define _CHECK_PATH(var, var_len, ini) php_ini_check_path(var, var_len, ini, sizeof(ini))
+#define _CHECK_PATH(var, var_len, ini) php_ini_check_path(var, (int)var_len, ini, sizeof(ini))
/* open basedir check */
if (PG(open_basedir)) {
if (_CHECK_PATH(varname->val, varname->len, "error_log") ||
@@ -5592,7 +5592,7 @@ PHP_FUNCTION(getprotobynumber)
return;
}
- ent = getprotobynumber(proto);
+ ent = getprotobynumber((int)proto);
if (ent == NULL) {
RETURN_FALSE;
@@ -5790,7 +5790,7 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal
}
if (!(Z_STRLEN_P(arg1) > 1 && Z_STRVAL_P(arg1)[0] == '0') && is_numeric_string(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), NULL, NULL, 0) == IS_LONG) {
- zend_ulong key = (zend_ulong) zend_atol(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1));
+ zend_ulong key = (zend_ulong) zend_atol(Z_STRVAL_P(arg1), (int)Z_STRLEN_P(arg1));
if ((find_hash = zend_hash_index_find(Z_ARRVAL_P(arr), key)) == NULL) {
array_init(&hash);
find_hash = zend_hash_index_update(Z_ARRVAL_P(arr), key, &hash);
@@ -5878,7 +5878,7 @@ PHP_FUNCTION(parse_ini_file)
fh.type = ZEND_HANDLE_FILENAME;
array_init(return_value);
- if (zend_parse_ini_file(&fh, 0, scanner_mode, ini_parser_cb, return_value TSRMLS_CC) == FAILURE) {
+ if (zend_parse_ini_file(&fh, 0, (int)scanner_mode, ini_parser_cb, return_value TSRMLS_CC) == FAILURE) {
zval_dtor(return_value);
RETURN_FALSE;
}
@@ -5917,7 +5917,7 @@ PHP_FUNCTION(parse_ini_string)
memset(string + str_len, 0, ZEND_MMAP_AHEAD);
array_init(return_value);
- if (zend_parse_ini_string(string, 0, scanner_mode, ini_parser_cb, return_value TSRMLS_CC) == FAILURE) {
+ if (zend_parse_ini_string(string, 0, (int)scanner_mode, ini_parser_cb, return_value TSRMLS_CC) == FAILURE) {
zval_dtor(return_value);
RETVAL_FALSE;
}
diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h
index eaac7a1609..ba462c57b0 100644
--- a/ext/standard/basic_functions.h
+++ b/ext/standard/basic_functions.h
@@ -142,8 +142,8 @@ PHP_RSHUTDOWN_FUNCTION(browscap);
/* Left for BC (not binary safe!) */
PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers TSRMLS_DC);
-PHPAPI int _php_error_log_ex(int opt_err, char *message, int message_len, char *opt, char *headers TSRMLS_DC);
-PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, int var_name_len, zend_bool add_underscore TSRMLS_DC);
+PHPAPI int _php_error_log_ex(int opt_err, char *message, size_t message_len, char *opt, char *headers TSRMLS_DC);
+PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, size_t var_name_len, zend_bool add_underscore TSRMLS_DC);
#if SIZEOF_INT == 4
/* Most 32-bit and 64-bit systems have 32-bit ints */
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c
index 9599e2f056..7fae04fcbf 100644
--- a/ext/standard/crypt.c
+++ b/ext/standard/crypt.c
@@ -295,7 +295,7 @@ PHP_FUNCTION(crypt)
}
salt[salt_in_len] = '\0';
- if ((result = php_crypt(str, str_len, salt, salt_in_len)) == NULL) {
+ if ((result = php_crypt(str, (int)str_len, salt, (int)salt_in_len)) == NULL) {
if (salt[0] == '*' && salt[1] == '0') {
RETURN_STRING("*1");
} else {
diff --git a/ext/standard/crypt_sha256.c b/ext/standard/crypt_sha256.c
index 5f28bd7b9f..d79d14510a 100644
--- a/ext/standard/crypt_sha256.c
+++ b/ext/standard/crypt_sha256.c
@@ -120,7 +120,7 @@ static void sha256_process_block (const void *buffer, size_t len, struct sha256_
/* First increment the byte count. FIPS 180-2 specifies the possible
length of the file up to 2^64 bits. Here we only compute the
number of bytes. Do a double word increment. */
- ctx->total[0] += len;
+ ctx->total[0] += (uint32_t)len;
if (ctx->total[0] < len) {
++ctx->total[1];
}
@@ -261,7 +261,7 @@ static void sha256_process_bytes(const void *buffer, size_t len, struct sha256_c
size_t add = 128 - left_over > len ? len : 128 - left_over;
memcpy(&ctx->buffer[left_over], buffer, add);
- ctx->buflen += add;
+ ctx->buflen += (uint32_t)add;
if (ctx->buflen > 64) {
sha256_process_block(ctx->buffer, ctx->buflen & ~63, ctx);
@@ -306,7 +306,7 @@ compilers don't. */
left_over -= 64;
memcpy(ctx->buffer, &ctx->buffer[64], left_over);
}
- ctx->buflen = left_over;
+ ctx->buflen = (uint32_t)left_over;
}
}
@@ -529,7 +529,7 @@ char * php_sha256_crypt_r(const char *key, const char *salt, char *buffer, int b
}
cp = __php_stpncpy(cp, salt, MIN ((size_t) MAX (0, buflen), salt_len));
- buflen -= MIN((size_t) MAX (0, buflen), salt_len);
+ buflen -= MIN(MAX (0, buflen), (int)salt_len);
if (buflen > 0) {
*cp++ = '$';
@@ -600,7 +600,7 @@ char * php_sha256_crypt(const char *key, const char *salt)
static int buflen;
int needed = (sizeof(sha256_salt_prefix) - 1
+ sizeof(sha256_rounds_prefix) + 9 + 1
- + strlen(salt) + 1 + 43 + 1);
+ + (int)strlen(salt) + 1 + 43 + 1);
if (buflen < needed) {
char *new_buffer = (char *) realloc(buffer, needed);
diff --git a/ext/standard/dir.c b/ext/standard/dir.c
index 7b4ab1cd3e..a822ac4da0 100644
--- a/ext/standard/dir.c
+++ b/ext/standard/dir.c
@@ -87,7 +87,7 @@ static zend_class_entry *dir_class_entry_ptr;
} \
ZEND_FETCH_RESOURCE(dirp, php_stream *, tmp, -1, "Directory", php_file_le_stream()); \
} else { \
- ZEND_FETCH_RESOURCE(dirp, php_stream *, 0, DIRG(default_dir)->handle, "Directory", php_file_le_stream()); \
+ ZEND_FETCH_RESOURCE(dirp, php_stream *, 0, (int)DIRG(default_dir)->handle, "Directory", php_file_le_stream()); \
} \
} else { \
dirp = (php_stream *) zend_fetch_resource(id TSRMLS_CC, -1, "Directory", NULL, 1, php_file_le_stream()); \
@@ -463,7 +463,7 @@ PHP_FUNCTION(glob)
cwd[2] = '\0';
}
#endif
- cwd_skip = strlen(cwd)+1;
+ cwd_skip = (int)strlen(cwd)+1;
snprintf(work_pattern, MAXPATHLEN, "%s%c%s", cwd, DEFAULT_SLASH, pattern);
pattern = work_pattern;
diff --git a/ext/standard/dl.c b/ext/standard/dl.c
index 6ea69e5b81..a9ca94c0ad 100644
--- a/ext/standard/dl.c
+++ b/ext/standard/dl.c
@@ -129,7 +129,7 @@ PHPAPI int php_load_extension(char *filename, int type, int start_now TSRMLS_DC)
}
libpath = estrdup(filename);
} else if (extension_dir && extension_dir[0]) {
- int extension_dir_len = strlen(extension_dir);
+ int extension_dir_len = (int)strlen(extension_dir);
if (IS_SLASH(extension_dir[extension_dir_len-1])) {
spprintf(&libpath, 0, "%s%s", extension_dir, filename); /* SAFE */
diff --git a/ext/standard/dns_win32.c b/ext/standard/dns_win32.c
index 865ad30b3e..963d1f7a54 100644
--- a/ext/standard/dns_win32.c
+++ b/ext/standard/dns_win32.c
@@ -208,7 +208,7 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw,
DWORD count = data_txt->dwStringCount;
zend_string *txt;
char *txt_dst;
- long txt_len = 0;
+ size_t txt_len = 0;
zval entries;
add_assoc_string(subarray, "type", "TXT");
@@ -222,7 +222,7 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw,
txt = zend_string_safe_alloc(txt_len, 2, 0, 0);
txt_dst = txt->val;
for (i = 0; i < count; i++) {
- int len = strlen(data_txt->pStringArray[i]);
+ size_t len = strlen(data_txt->pStringArray[i]);
memcpy(txt_dst, data_txt->pStringArray[i], len);
add_next_index_stringl(&entries, data_txt->pStringArray[i], len);
txt_dst += len;
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index 28f01b338f..6106fe2c86 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@ -61,7 +61,8 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_
{
FILE *fp;
char *buf;
- int l = 0, pclose_return;
+ size_t l = 0;
+ int pclose_return;
char *b, *d=NULL;
php_stream *stream;
size_t buflen, bufl = 0;
@@ -115,8 +116,8 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_
} else if (type == 2) {
/* strip trailing whitespaces */
l = bufl;
- while (l-- && isspace(((unsigned char *)buf)[l]));
- if (l != (int)(bufl - 1)) {
+ while (l >= 1 && l-- && isspace(((unsigned char *)buf)[l]));
+ if (l != (bufl - 1)) {
bufl = l + 1;
buf[bufl] = '\0';
}
@@ -128,8 +129,8 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_
/* strip trailing whitespaces if we have not done so already */
if ((type == 2 && buf != b) || type != 2) {
l = bufl;
- while (l-- && isspace(((unsigned char *)buf)[l]));
- if (l != (int)(bufl - 1)) {
+ while (l >= 1 && l-- && isspace(((unsigned char *)buf)[l]));
+ if (l != (bufl - 1)) {
bufl = l + 1;
buf[bufl] = '\0';
}
@@ -240,7 +241,7 @@ PHP_FUNCTION(passthru)
*/
PHPAPI zend_string *php_escape_shell_cmd(char *str)
{
- register int x, y, l = strlen(str);
+ register int x, y, l = (int)strlen(str);
char *p = NULL;
size_t estimate = (2 * l) + 1;
zend_string *cmd;
@@ -333,7 +334,7 @@ PHPAPI zend_string *php_escape_shell_cmd(char *str)
*/
PHPAPI zend_string *php_escape_shell_arg(char *str)
{
- int x, y = 0, l = strlen(str);
+ int x, y = 0, l = (int)strlen(str);
zend_string *cmd;
size_t estimate = (4 * l) + 3;
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 446da20fb3..ff7c5433eb 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -1098,7 +1098,7 @@ PHPAPI PHP_FUNCTION(fgetss)
php_stream *stream;
zend_string *allowed = NULL;
char *allowed_tags=NULL;
- int allowed_tags_len=0;
+ size_t allowed_tags_len=0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|lS", &fd, &bytes, &allowed) == FAILURE) {
RETURN_FALSE;
@@ -1196,8 +1196,8 @@ PHPAPI PHP_FUNCTION(fwrite)
zval *arg1;
char *arg2;
size_t arg2len;
- int ret;
- int num_bytes;
+ size_t ret;
+ size_t num_bytes;
zend_long arg3 = 0;
char *buffer = NULL;
php_stream *stream;
@@ -1309,7 +1309,7 @@ PHPAPI PHP_FUNCTION(fseek)
PHP_STREAM_TO_ZVAL(stream, arg1);
- RETURN_LONG(php_stream_seek(stream, arg2, whence));
+ RETURN_LONG(php_stream_seek(stream, arg2, (int)whence));
}
/* }}} */
@@ -1355,7 +1355,7 @@ PHP_FUNCTION(mkdir)
context = php_stream_context_from_zval(zcontext, 0);
- RETURN_BOOL(php_stream_mkdir(dir, mode, (recursive ? PHP_STREAM_MKDIR_RECURSIVE : 0) | REPORT_ERRORS, context));
+ RETURN_BOOL(php_stream_mkdir(dir, (int)mode, (recursive ? PHP_STREAM_MKDIR_RECURSIVE : 0) | REPORT_ERRORS, context));
}
/* }}} */
@@ -1384,7 +1384,7 @@ PHP_FUNCTION(readfile)
{
char *filename;
size_t filename_len;
- int size = 0;
+ size_t size = 0;
zend_bool use_include_path = 0;
zval *zcontext = NULL;
php_stream *stream;
@@ -1427,7 +1427,7 @@ PHP_FUNCTION(umask)
if (ZEND_NUM_ARGS() == 0) {
umask(oldumask);
} else {
- umask(arg1);
+ umask((int)arg1);
}
RETURN_LONG(oldumask);
@@ -1439,7 +1439,7 @@ PHP_FUNCTION(umask)
PHPAPI PHP_FUNCTION(fpassthru)
{
zval *arg1;
- int size;
+ size_t size;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) {
@@ -1852,7 +1852,7 @@ PHP_FUNCTION(fputcsv)
char escape_char = '\\'; /* allow this to be set as parameter */
php_stream *stream;
zval *fp = NULL, *fields = NULL;
- int ret;
+ size_t ret;
char *delimiter_str = NULL, *enclosure_str = NULL, *escape_str = NULL;
size_t delimiter_str_len = 0, enclosure_str_len = 0, escape_str_len = 0;
@@ -1908,7 +1908,8 @@ PHP_FUNCTION(fputcsv)
/* {{{ PHPAPI size_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC) */
PHPAPI size_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC)
{
- int count, i = 0, ret;
+ int count, i = 0;
+ size_t ret;
zval *field_tmp;
smart_str csvline = {0};
@@ -2486,7 +2487,7 @@ PHP_FUNCTION(fnmatch)
RETURN_FALSE;
}
- RETURN_BOOL( ! fnmatch( pattern, filename, flags ));
+ RETURN_BOOL( ! fnmatch( pattern, filename, (int)flags ));
}
/* }}} */
#endif
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
index 6a06a55d94..53aede1469 100644
--- a/ext/standard/filestat.c
+++ b/ext/standard/filestat.c
@@ -835,7 +835,7 @@ PHP_FUNCTION(clearstatcache)
return;
}
- php_clear_stat_cache(clear_realpath_cache, filename, filename_len TSRMLS_CC);
+ php_clear_stat_cache(clear_realpath_cache, filename, (int)filename_len TSRMLS_CC);
}
/* }}} */
diff --git a/ext/standard/filters.c b/ext/standard/filters.c
index f0f49950bb..3fd27afa43 100644
--- a/ext/standard/filters.c
+++ b/ext/standard/filters.c
@@ -176,14 +176,14 @@ typedef struct _php_strip_tags_filter {
int persistent;
} php_strip_tags_filter;
-static int php_strip_tags_filter_ctor(php_strip_tags_filter *inst, const char *allowed_tags, int allowed_tags_len, int persistent)
+static int php_strip_tags_filter_ctor(php_strip_tags_filter *inst, const char *allowed_tags, size_t allowed_tags_len, int persistent)
{
if (allowed_tags != NULL) {
if (NULL == (inst->allowed_tags = pemalloc(allowed_tags_len, persistent))) {
return FAILURE;
}
memcpy((char *)inst->allowed_tags, allowed_tags, allowed_tags_len);
- inst->allowed_tags_len = allowed_tags_len;
+ inst->allowed_tags_len = (int)allowed_tags_len;
} else {
inst->allowed_tags = NULL;
}
@@ -861,7 +861,8 @@ static php_conv_err_t php_conv_qprint_encode_convert(php_conv_qprint_encode *ins
/* Check to see if this is EOL whitespace. */
if (inst->lbchars != NULL) {
unsigned char *ps2;
- unsigned int j, lb_cnt2;
+ unsigned int lb_cnt2;
+ size_t j;
lb_cnt2 = 0;
ps2 = ps;
@@ -1265,7 +1266,7 @@ static php_conv_err_t php_conv_get_ulong_prop_ex(const HashTable *ht, zend_ulong
zval tmp;
if (Z_TYPE_P(tmpval) != IS_LONG) {
- ZVAL_DUP(&tmp, tmpval);;
+ ZVAL_DUP(&tmp, tmpval);
convert_to_long(&tmp);
tmpval = &tmp;
}
@@ -1318,6 +1319,7 @@ static int php_conv_get_int_prop_ex(const HashTable *ht, int *pretval, char *fie
}
#endif
+/* XXX this might need an additional fix so it uses size_t, whereby unsigned is quite big so leaving as is for now */
static int php_conv_get_uint_prop_ex(const HashTable *ht, unsigned int *pretval, char *field_name, size_t field_name_len)
{
zend_ulong l;
@@ -1326,7 +1328,7 @@ static int php_conv_get_uint_prop_ex(const HashTable *ht, unsigned int *pretval,
*pretval = 0;
if ((err = php_conv_get_ulong_prop_ex(ht, &l, field_name, field_name_len)) == PHP_CONV_ERR_SUCCESS) {
- *pretval = l;
+ *pretval = (unsigned int)l;
}
return err;
}
@@ -1931,12 +1933,12 @@ typedef struct _php_chunked_filter_data {
int persistent;
} php_chunked_filter_data;
-static int php_dechunk(char *buf, int len, php_chunked_filter_data *data)
+static size_t php_dechunk(char *buf, size_t len, php_chunked_filter_data *data)
{
char *p = buf;
char *end = p + len;
char *out = buf;
- int out_len = 0;
+ size_t out_len = 0;
while (p < end) {
switch (data->state) {
diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c
index 8f211d0236..f84075440b 100644
--- a/ext/standard/formatted_print.c
+++ b/ext/standard/formatted_print.c
@@ -376,7 +376,7 @@ php_formatted_print(int param_count, int use_array, int format_offset TSRMLS_DC)
char *format, padding;
zend_string *result;
int always_sign;
- int format_len;
+ size_t format_len;
if (zend_parse_parameters(param_count TSRMLS_CC, "+", &args, &argc) == FAILURE) {
return NULL;
diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c
index 090d3f8f32..30a6fda5d6 100644
--- a/ext/standard/fsock.c
+++ b/ext/standard/fsock.c
@@ -35,14 +35,18 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
size_t host_len;
zend_long port = -1;
zval *zerrno = NULL, *zerrstr = NULL;
- double timeout = FG(default_socket_timeout);
- zend_ulong conv;
+ double timeout = (double)FG(default_socket_timeout);
+#ifndef PHP_WIN32
+ time_t conv;
+#else
+ long conv;
+#endif
struct timeval tv;
char *hashkey = NULL;
php_stream *stream = NULL;
int err;
char *hostname = NULL;
- zend_long hostname_len;
+ size_t hostname_len;
zend_string *errstr = NULL;
RETVAL_FALSE;
@@ -63,8 +67,13 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
}
/* prepare the timeout value for use */
- conv = (unsigned long) (timeout * 1000000.0);
+#ifndef PHP_WIN32
+ conv = (time_t) (timeout * 1000000.0);
tv.tv_sec = conv / 1000000;
+#else
+ conv = (long) (timeout * 1000000.0);
+ tv.tv_sec = conv / 1000000;
+#endif
tv.tv_usec = conv % 1000000;
if (zerrno) {
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
index 2bf4e02a41..ed93345bac 100644
--- a/ext/standard/ftp_fopen_wrapper.c
+++ b/ext/standard/ftp_fopen_wrapper.c
@@ -155,7 +155,7 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char
if (resource->port == 0)
resource->port = 21;
- transport_len = spprintf(&transport, 0, "tcp://%s:%d", resource->host, resource->port);
+ transport_len = (int)spprintf(&transport, 0, "tcp://%s:%d", resource->host, resource->port);
stream = php_stream_xport_create(transport, transport_len, REPORT_ERRORS, STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, NULL, NULL, context, NULL, NULL);
efree(transport);
if (stream == NULL) {
@@ -245,7 +245,7 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char
/* send the user name */
if (resource->user != NULL) {
- tmp_len = php_raw_url_decode(resource->user, strlen(resource->user));
+ tmp_len = (int)php_raw_url_decode(resource->user, (int)strlen(resource->user));
PHP_FTP_CNTRL_CHK(resource->user, tmp_len, "Invalid login %s")
@@ -262,7 +262,7 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char
php_stream_notify_info(context, PHP_STREAM_NOTIFY_AUTH_REQUIRED, tmp_line, 0);
if (resource->pass != NULL) {
- tmp_len = php_raw_url_decode(resource->pass, strlen(resource->pass));
+ tmp_len = (int)php_raw_url_decode(resource->pass, (int)strlen(resource->pass));
PHP_FTP_CNTRL_CHK(resource->pass, tmp_len, "Invalid password %s")
@@ -424,8 +424,8 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa
php_stream *reuseid=NULL;
size_t file_size = 0;
zval *tmpzval;
- int allow_overwrite = 0;
- int read_write = 0;
+ zend_bool allow_overwrite = 0;
+ int8_t read_write = 0;
char *transport;
int transport_len;
@@ -498,7 +498,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa
} else if (read_write == 2) {
/* when writing file (but not appending), it must NOT exist, unless a context option exists which allows it */
if (context && (tmpzval = php_stream_context_get_option(context, "ftp", "overwrite")) != NULL) {
- allow_overwrite = Z_LVAL_P(tmpzval);
+ allow_overwrite = Z_LVAL_P(tmpzval) ? 1 : 0;
}
if (result <= 299 && result >= 200) {
if (allow_overwrite) {
@@ -554,7 +554,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa
if (hoststart == NULL) {
hoststart = resource->host;
}
- transport_len = spprintf(&transport, 0, "tcp://%s:%d", hoststart, portno);
+ transport_len = (int)spprintf(&transport, 0, "tcp://%s:%d", hoststart, portno);
datastream = php_stream_xport_create(transport, transport_len, REPORT_ERRORS, STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, NULL, NULL, context, NULL, NULL);
efree(transport);
if (datastream == NULL) {
@@ -855,7 +855,7 @@ static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, const char *url,
gmt->tm_isdst = -1;
/* apply the GMT offset */
- tm.tm_sec += stamp - mktime(gmt);
+ tm.tm_sec += (long)(stamp - mktime(gmt));
tm.tm_isdst = gmt->tm_isdst;
ssb->sb.st_mtime = mktime(&tm);
diff --git a/ext/standard/head.c b/ext/standard/head.c
index 3dd18ee0fd..1417b52bc0 100644
--- a/ext/standard/head.c
+++ b/ext/standard/head.c
@@ -73,10 +73,10 @@ PHPAPI int php_header(TSRMLS_D)
}
-PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, time_t expires, char *path, int path_len, char *domain, int domain_len, int secure, int url_encode, int httponly TSRMLS_DC)
+PHPAPI int php_setcookie(char *name, size_t name_len, char *value, size_t value_len, time_t expires, char *path, size_t path_len, char *domain, size_t domain_len, int secure, int url_encode, int httponly TSRMLS_DC)
{
char *cookie;
- int len=sizeof("Set-Cookie: ");
+ size_t len=sizeof("Set-Cookie: ");
zend_string *dt;
sapi_header_line ctr = {0};
int result;
@@ -164,7 +164,7 @@ PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, t
}
ctr.line = cookie;
- ctr.line_len = strlen(cookie);
+ ctr.line_len = (uint)strlen(cookie);
result = sapi_header_op(SAPI_HEADER_ADD, &ctr TSRMLS_CC);
efree(cookie);
@@ -300,7 +300,7 @@ PHP_FUNCTION(http_response_code)
zend_long old_response_code;
old_response_code = SG(sapi_headers).http_response_code;
- SG(sapi_headers).http_response_code = response_code;
+ SG(sapi_headers).http_response_code = (int)response_code;
if (old_response_code) {
RETURN_LONG(old_response_code);
diff --git a/ext/standard/head.h b/ext/standard/head.h
index e32810a6f3..850a71dc74 100644
--- a/ext/standard/head.h
+++ b/ext/standard/head.h
@@ -38,6 +38,6 @@ PHP_FUNCTION(headers_list);
PHP_FUNCTION(http_response_code);
PHPAPI int php_header(TSRMLS_D);
-PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, time_t expires, char *path, int path_len, char *domain, int domain_len, int secure, int url_encode, int httponly TSRMLS_DC);
+PHPAPI int php_setcookie(char *name, size_t name_len, char *value, size_t value_len, time_t expires, char *path, size_t path_len, char *domain, size_t domain_len, int secure, int url_encode, int httponly TSRMLS_DC);
#endif
diff --git a/ext/standard/html.c b/ext/standard/html.c
index dfe30d9b3e..516bcc4ef7 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -377,7 +377,7 @@ static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC)
{
int i;
enum entity_charset charset = cs_utf_8;
- int len = 0;
+ size_t len = 0;
const zend_encoding *zenc;
/* Default is now UTF-8 */
@@ -1513,7 +1513,7 @@ PHP_FUNCTION(htmlspecialchars_decode)
return;
}
- replaced = php_unescape_html_entities((unsigned char*)str, str_len, 0 /*!all*/, quote_style, NULL TSRMLS_CC);
+ replaced = php_unescape_html_entities((unsigned char*)str, str_len, 0 /*!all*/, (int)quote_style, NULL TSRMLS_CC);
if (replaced) {
RETURN_STR(replaced);
}
@@ -1547,7 +1547,7 @@ PHP_FUNCTION(html_entity_decode)
if (!hint_charset) {
default_charset = get_default_charset(TSRMLS_C);
}
- replaced = php_unescape_html_entities((unsigned char*)str->val, str->len, 1 /*all*/, quote_style, (hint_charset ? hint_charset->val : default_charset) TSRMLS_CC);
+ replaced = php_unescape_html_entities((unsigned char*)str->val, str->len, 1 /*all*/, (int)quote_style, (hint_charset ? hint_charset->val : default_charset) TSRMLS_CC);
if (replaced) {
RETURN_STR(replaced);
@@ -1649,7 +1649,7 @@ PHP_FUNCTION(get_html_translation_table)
array_init(return_value);
- entity_table = determine_entity_table(all, doctype);
+ entity_table = determine_entity_table((int)all, doctype);
if (all && !CHARSET_UNICODE_COMPAT(charset)) {
to_uni_table = enc_to_uni_index[charset];
}
diff --git a/ext/standard/http.c b/ext/standard/http.c
index 9174163b7d..e5ba87d870 100644
--- a/ext/standard/http.c
+++ b/ext/standard/http.c
@@ -26,9 +26,9 @@
/* {{{ php_url_encode_hash */
PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
- const char *num_prefix, int num_prefix_len,
- const char *key_prefix, int key_prefix_len,
- const char *key_suffix, int key_suffix_len,
+ const char *num_prefix, size_t num_prefix_len,
+ const char *key_prefix, size_t key_prefix_len,
+ const char *key_suffix, size_t key_suffix_len,
zval *type, char *arg_sep, int enc_type TSRMLS_DC)
{
zend_string *key = NULL;
@@ -107,7 +107,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
*p = '\0';
} else {
char *ekey;
- int ekey_len;
+ size_t ekey_len;
/* Is an integer key */
ekey_len = spprintf(&ekey, 0, "%pd", idx);
newprefix_len = key_prefix_len + num_prefix_len + ekey_len + key_suffix_len + 3 /* %5B */;
@@ -194,7 +194,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
case IS_DOUBLE:
{
char *ekey;
- int ekey_len;
+ size_t ekey_len;
ekey_len = spprintf(&ekey, 0, "%.*G", (int) EG(precision), Z_DVAL_P(zdata));
smart_str_appendl(formstr, ekey, ekey_len);
efree(ekey);
@@ -242,7 +242,7 @@ PHP_FUNCTION(http_build_query)
RETURN_FALSE;
}
- if (php_url_encode_hash_ex(HASH_OF(formdata), &formstr, prefix, prefix_len, NULL, 0, NULL, 0, (Z_TYPE_P(formdata) == IS_OBJECT ? formdata : NULL), arg_sep, enc_type TSRMLS_CC) == FAILURE) {
+ if (php_url_encode_hash_ex(HASH_OF(formdata), &formstr, prefix, prefix_len, NULL, 0, NULL, 0, (Z_TYPE_P(formdata) == IS_OBJECT ? formdata : NULL), arg_sep, (int)enc_type TSRMLS_CC) == FAILURE) {
if (formstr.s) {
smart_str_free(&formstr);
}
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index 27c6cf6248..e1f8653c8d 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -121,7 +121,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
char *tmp = NULL;
char *ua_str = NULL;
zval *ua_zval = NULL, *tmpzval = NULL, ssl_proxy_peer_name;
- int scratch_len = 0;
+ size_t scratch_len = 0;
int body = 0;
char location[HTTP_HEADER_BLOCK_SIZE];
zval *response_header = NULL;
@@ -132,14 +132,16 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
int eol_detect = 0;
char *transport_string;
zend_string *errstr = NULL;
- int transport_len, have_header = 0, request_fulluri = 0, ignore_errors = 0;
+ size_t transport_len;
+ int have_header = 0;
+ zend_bool request_fulluri = 0, ignore_errors = 0;
char *protocol_version = NULL;
int protocol_version_len = 3; /* Default: "1.0" */
struct timeval timeout;
char *user_headers = NULL;
int header_init = ((flags & HTTP_WRAPPER_HEADER_INIT) != 0);
int redirected = ((flags & HTTP_WRAPPER_REDIRECTED) != 0);
- int follow_location = 1;
+ zend_bool follow_location = 1;
php_stream_filter *transfer_encoding = NULL;
int response_code;
zend_array *symbol_table;
@@ -201,10 +203,19 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
if (context && (tmpzval = php_stream_context_get_option(context, wrapper->wops->label, "timeout")) != NULL) {
double d = zval_get_double(tmpzval);
+#ifndef PHP_WIN32
timeout.tv_sec = (time_t) d;
timeout.tv_usec = (size_t) ((d - timeout.tv_sec) * 1000000);
+#else
+ timeout.tv_sec = (long) d;
+ timeout.tv_usec = (long) ((d - timeout.tv_sec) * 1000000);
+#endif
} else {
+#ifndef PHP_WIN32
timeout.tv_sec = FG(default_socket_timeout);
+#else
+ timeout.tv_sec = (long)FG(default_socket_timeout);
+#endif
timeout.tv_usec = 0;
}
@@ -346,7 +357,7 @@ finish:
php_stream_notify_info(context, PHP_STREAM_NOTIFY_CONNECT, NULL, 0);
if (header_init && context && (tmpzval = php_stream_context_get_option(context, "http", "max_redirects")) != NULL) {
- redirect_max = zval_get_long(tmpzval);
+ redirect_max = (int)zval_get_long(tmpzval);
}
if (context && (tmpzval = php_stream_context_get_option(context, "http", "method")) != NULL) {
@@ -366,7 +377,7 @@ finish:
}
if (context && (tmpzval = php_stream_context_get_option(context, "http", "protocol_version")) != NULL) {
- protocol_version_len = spprintf(&protocol_version, 0, "%.1F", zval_get_double(tmpzval));
+ protocol_version_len = (int)spprintf(&protocol_version, 0, "%.1F", zval_get_double(tmpzval));
}
if (!scratch) {
@@ -378,7 +389,7 @@ finish:
/* Should we send the entire path in the request line, default to no. */
if (!request_fulluri && context &&
(tmpzval = php_stream_context_get_option(context, "http", "request_fulluri")) != NULL) {
- request_fulluri = zend_is_true(tmpzval TSRMLS_CC) ? 1 : 0;
+ request_fulluri = zend_is_true(tmpzval TSRMLS_CC);
}
if (request_fulluri) {
@@ -731,7 +742,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_get_long(tmpzval);
+ follow_location = zval_is_true(tmpzval);
} 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)
@@ -843,7 +854,7 @@ finish:
#define CHECK_FOR_CNTRL_CHARS(val) { \
if (val) { \
unsigned char *s, *e; \
- int l; \
+ size_t l; \
l = php_url_decode(val, strlen(val)); \
s = (unsigned char*)val; e = s + l; \
while (s < e) { \
@@ -891,7 +902,7 @@ out:
/* Restore original chunk size now that we're done with headers */
if (options & STREAM_WILL_CAST)
- php_stream_set_chunk_size(stream, chunk_size);
+ php_stream_set_chunk_size(stream, (int)chunk_size);
/* restore the users auto-detect-line-endings setting */
stream->flags |= eol_detect;
diff --git a/ext/standard/info.c b/ext/standard/info.c
index bc0ddddcc0..7a118af7b4 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -61,9 +61,9 @@ PHPAPI extern char *php_ini_opened_path;
PHPAPI extern char *php_ini_scanned_path;
PHPAPI extern char *php_ini_scanned_files;
-static int php_info_print_html_esc(const char *str, int len) /* {{{ */
+static int php_info_print_html_esc(const char *str, size_t len) /* {{{ */
{
- int written;
+ size_t written;
zend_string *new_str;
TSRMLS_FETCH();
@@ -77,7 +77,7 @@ static int php_info_print_html_esc(const char *str, int len) /* {{{ */
static int php_info_printf(const char *fmt, ...) /* {{{ */
{
char *buf;
- int len, written;
+ size_t len, written;
va_list argv;
TSRMLS_FETCH();
@@ -1026,7 +1026,7 @@ PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header) /* {
if (!sapi_module.phpinfo_as_text) {
php_info_printf("<tr class=\"h\"><th colspan=\"%d\">%s</th></tr>\n", num_cols, header );
} else {
- spaces = (74 - strlen(header));
+ spaces = (int)(74 - strlen(header));
php_info_printf("%*s%s%*s\n", (int)(spaces/2), " ", header, (int)(spaces/2), " ");
}
}
@@ -1176,7 +1176,7 @@ PHP_FUNCTION(phpinfo)
/* Andale! Andale! Yee-Hah! */
php_output_start_default(TSRMLS_C);
- php_print_info(flag TSRMLS_CC);
+ php_print_info((int)flag TSRMLS_CC);
php_output_end(TSRMLS_C);
RETURN_TRUE;
@@ -1218,7 +1218,7 @@ PHP_FUNCTION(phpcredits)
return;
}
- php_print_credits(flag TSRMLS_CC);
+ php_print_credits((int)flag TSRMLS_CC);
RETURN_TRUE;
}
/* }}} */
diff --git a/ext/standard/levenshtein.c b/ext/standard/levenshtein.c
index df822f45d4..e776934e1f 100644
--- a/ext/standard/levenshtein.c
+++ b/ext/standard/levenshtein.c
@@ -27,10 +27,11 @@
/* {{{ reference_levdist
* reference implementation, only optimized for memory usage, not speed */
-static int reference_levdist(const char *s1, int l1, const char *s2, int l2, int cost_ins, int cost_rep, int cost_del )
+static zend_long reference_levdist(const char *s1, size_t l1, const char *s2, size_t l2, zend_long cost_ins, zend_long cost_rep, zend_long cost_del )
{
- int *p1, *p2, *tmp;
- int i1, i2, c0, c1, c2;
+ zend_long *p1, *p2, *tmp;
+ zend_long c0, c1, c2;
+ size_t i1, i2;
if (l1 == 0) {
return l2 * cost_ins;
@@ -42,8 +43,8 @@ static int reference_levdist(const char *s1, int l1, const char *s2, int l2, int
if ((l1 > LEVENSHTEIN_MAX_LENGTH) || (l2 > LEVENSHTEIN_MAX_LENGTH)) {
return -1;
}
- p1 = safe_emalloc((l2 + 1), sizeof(int), 0);
- p2 = safe_emalloc((l2 + 1), sizeof(int), 0);
+ p1 = safe_emalloc((l2 + 1), sizeof(zend_long), 0);
+ p2 = safe_emalloc((l2 + 1), sizeof(zend_long), 0);
for (i2 = 0; i2 <= l2; i2++) {
p1[i2] = i2 * cost_ins;
@@ -96,7 +97,7 @@ PHP_FUNCTION(levenshtein)
char *callback_name;
size_t str1_len, str2_len, callback_len;
zend_long cost_ins, cost_rep, cost_del;
- int distance = -1;
+ zend_long distance = -1;
switch (argc) {
case 2: /* just two strings: use maximum performance version */
diff --git a/ext/standard/mail.c b/ext/standard/mail.c
index 96363f4cb9..5d2b576c7e 100644
--- a/ext/standard/mail.c
+++ b/ext/standard/mail.c
@@ -251,7 +251,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char
if (mail_log && *mail_log) {
char *tmp;
time_t curtime;
- int l;
+ size_t l;
zend_string *date_str;
time(&curtime);
diff --git a/ext/standard/math.c b/ext/standard/math.c
index 7014e6c938..31eb259829 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -382,7 +382,7 @@ PHP_FUNCTION(round)
case IS_DOUBLE:
return_val = (Z_TYPE_P(value) == IS_LONG) ? (double)Z_LVAL_P(value) : Z_DVAL_P(value);
- return_val = _php_math_round(return_val, places, mode);
+ return_val = _php_math_round(return_val, (int)places, (int)mode);
RETURN_DOUBLE(return_val);
break;
@@ -946,7 +946,7 @@ PHP_FUNCTION(rad2deg)
PHPAPI zend_long _php_math_basetolong(zval *arg, int base)
{
zend_long num = 0, digit, onum;
- int i;
+ zend_long i;
char c, *s;
if (Z_TYPE_P(arg) != IS_STRING || base < 2 || base > 36) {
@@ -992,7 +992,7 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret)
{
zend_long num = 0;
double fnum = 0;
- int i;
+ zend_long i;
int mode = 0;
char c, *s;
zend_long cutoff;
@@ -1029,7 +1029,7 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret)
num = num * base + c;
break;
} else {
- fnum = num;
+ fnum = (double)num;
mode = 1;
}
/* fall-through */
@@ -1234,10 +1234,10 @@ PHP_FUNCTION(base_convert)
RETURN_FALSE;
}
- if(_php_math_basetozval(number, frombase, &temp) == FAILURE) {
+ if(_php_math_basetozval(number, (int)frombase, &temp) == FAILURE) {
RETURN_FALSE;
}
- result = _php_math_zvaltobase(&temp, tobase TSRMLS_CC);
+ result = _php_math_zvaltobase(&temp, (int)tobase TSRMLS_CC);
RETVAL_STR(result);
}
/* }}} */
@@ -1284,15 +1284,15 @@ PHPAPI zend_string *_php_math_number_format_ex(double d, int dec, char *dec_poin
/* calculate the length of the return buffer */
if (dp) {
- integral = dp - tmpbuf->val;
+ integral = (int)(dp - tmpbuf->val);
} else {
/* no decimal point was found */
- integral = tmpbuf->len;
+ integral = (int)tmpbuf->len;
}
/* allow for thousand separators */
if (thousand_sep) {
- integral += thousand_sep_len * ((integral-1) / 3);
+ integral += (int)(thousand_sep_len * ((integral-1) / 3));
}
reslen = integral;
@@ -1301,7 +1301,7 @@ PHPAPI zend_string *_php_math_number_format_ex(double d, int dec, char *dec_poin
reslen += dec;
if (dec_point) {
- reslen += dec_point_len;
+ reslen += (int)dec_point_len;
}
}
@@ -1319,7 +1319,7 @@ PHPAPI zend_string *_php_math_number_format_ex(double d, int dec, char *dec_poin
* Take care, as the sprintf implementation may return less places than
* we requested due to internal buffer limitations */
if (dec) {
- int declen = dp ? s - dp : 0;
+ int declen = (int)(dp ? s - dp : 0);
int topad = dec > declen ? dec - declen : 0;
/* pad with '0's */
@@ -1391,7 +1391,7 @@ PHP_FUNCTION(number_format)
RETURN_STR(_php_math_number_format(num, 0, dec_point_chr, thousand_sep_chr));
break;
case 2:
- RETURN_STR(_php_math_number_format(num, dec, dec_point_chr, thousand_sep_chr));
+ RETURN_STR(_php_math_number_format(num, (int)dec, dec_point_chr, thousand_sep_chr));
break;
case 4:
if (dec_point == NULL) {
@@ -1404,7 +1404,7 @@ PHP_FUNCTION(number_format)
thousand_sep_len = 1;
}
- RETVAL_STR(_php_math_number_format_ex(num, dec,
+ RETVAL_STR(_php_math_number_format_ex(num, (int)dec,
dec_point, dec_point_len, thousand_sep, thousand_sep_len));
break;
default:
diff --git a/ext/standard/pack.c b/ext/standard/pack.c
index 07206c8b7b..4af72c34b8 100644
--- a/ext/standard/pack.c
+++ b/ext/standard/pack.c
@@ -912,7 +912,7 @@ PHP_FUNCTION(unpack)
case 'P': {
int issigned = 0;
int *map = machine_endian_longlong_map;
- long v = 0;
+ zend_long v = 0;
if (type == 'q' || type == 'Q') {
issigned = input[inputpos + (machine_little_endian ? 7 : 0)] & 0x80;
@@ -927,9 +927,9 @@ PHP_FUNCTION(unpack)
v = php_unpack(&input[inputpos], 8, issigned, map);
if (type == 'q') {
- v = (signed long int) v;
+ v = (zend_long) v;
} else {
- v = (unsigned long int) v;
+ v = (zend_ulong) v;
}
add_assoc_long(return_value, n, v);
diff --git a/ext/standard/password.c b/ext/standard/password.c
index 0f75272d0e..c58c28ab3c 100644
--- a/ext/standard/password.c
+++ b/ext/standard/password.c
@@ -268,7 +268,7 @@ PHP_FUNCTION(password_verify)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &password, &password_len, &hash, &hash_len) == FAILURE) {
RETURN_FALSE;
}
- if ((ret = php_crypt(password, password_len, hash, hash_len)) == NULL) {
+ if ((ret = php_crypt(password, (int)password_len, hash, (int)hash_len)) == NULL) {
RETURN_FALSE;
}
@@ -298,7 +298,8 @@ PHP_FUNCTION(password_hash)
{
char *hash_format, *hash, *salt, *password;
zend_long algo = 0;
- size_t password_len = 0, hash_len;
+ size_t password_len = 0;
+ int hash_len;
size_t salt_len = 0, required_salt_len = 0, hash_format_len;
HashTable *options = 0;
zval *option_buffer;
@@ -344,7 +345,7 @@ PHP_FUNCTION(password_hash)
if (options && (option_buffer = zend_symtable_str_find(options, "salt", sizeof("salt")-1)) != NULL) {
char *buffer;
- int buffer_len_int = 0;
+ size_t buffer_len_int = 0;
size_t buffer_len;
switch (Z_TYPE_P(option_buffer)) {
case IS_STRING:
@@ -425,7 +426,7 @@ PHP_FUNCTION(password_hash)
/* This cast is safe, since both values are defined here in code and cannot overflow */
hash_len = (int) (hash_format_len + salt_len);
- if ((result = php_crypt(password, password_len, hash, hash_len)) == NULL) {
+ if ((result = php_crypt(password, (int)password_len, hash, hash_len)) == NULL) {
efree(hash);
RETURN_FALSE;
}
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index 575e8fff98..1989a2eabc 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.c
@@ -80,7 +80,7 @@ static size_t php_stream_input_read(php_stream *stream, char *buf, size_t count
php_stream_input_t *input = stream->abstract;
size_t read;
- if (!SG(post_read) && SG(read_post_bytes) < input->position + count) {
+ if (!SG(post_read) && SG(read_post_bytes) < (int64_t)(input->position + count)) {
/* read requested data from SAPI */
int read_bytes = sapi_read_post_block(buf, count TSRMLS_CC);
@@ -323,7 +323,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
return NULL;
}
- fd = dup(fildes_ori);
+ fd = dup((int)fildes_ori);
if (fd == -1) {
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC,
"Error duping file descriptor " ZEND_LONG_FMT "; possibly it doesn't exist: "
diff --git a/ext/standard/php_http.h b/ext/standard/php_http.h
index 0979348314..712e297fe3 100644
--- a/ext/standard/php_http.h
+++ b/ext/standard/php_http.h
@@ -25,9 +25,9 @@
#include "zend_smart_str.h"
PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
- const char *num_prefix, int num_prefix_len,
- const char *key_prefix, int key_prefix_len,
- const char *key_suffix, int key_suffix_len,
+ const char *num_prefix, size_t num_prefix_len,
+ const char *key_prefix, size_t key_prefix_len,
+ const char *key_suffix, size_t key_suffix_len,
zval *type, char *arg_sep, int enc_type TSRMLS_DC);
#define php_url_encode_hash(ht, formstr) php_url_encode_hash_ex((ht), (formstr), NULL, 0, NULL, 0, NULL, 0, NULL TSRMLS_CC)
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index 66c0c2e7e3..d6a6f2be50 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -82,7 +82,7 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent
char **ep;
#endif
char *p;
- uint cnt, l, sizeenv=0;
+ size_t cnt, l, sizeenv=0;
HashTable *target_hash;
memset(&env, 0, sizeof(env));
@@ -109,7 +109,7 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent
/* first, we have to get the size of all the elements in the hash */
ZEND_HASH_FOREACH_STR_KEY_VAL(target_hash, string_key, element) {
zend_string *str = zval_get_string(element);
- uint el_len = str->len;
+ size_t el_len = str->len;
zend_string_release(str);
if (el_len == 0) {
@@ -512,7 +512,7 @@ PHP_FUNCTION(proc_open)
goto exit_fail;
}
- descriptors[ndesc].index = nindex;
+ descriptors[ndesc].index = (int)nindex;
if (Z_TYPE_P(descitem) == IS_RESOURCE) {
/* should be a stream - try and dup the descriptor */
@@ -526,7 +526,7 @@ PHP_FUNCTION(proc_open)
}
#ifdef PHP_WIN32
- descriptors[ndesc].childend = dup_fd_as_handle(fd);
+ descriptors[ndesc].childend = dup_fd_as_handle((int)fd);
if (descriptors[ndesc].childend == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to dup File-Handle for descriptor %d", nindex);
goto exit_fail;
@@ -621,8 +621,8 @@ PHP_FUNCTION(proc_open)
}
#ifdef PHP_WIN32
- descriptors[ndesc].childend = dup_fd_as_handle(fd);
- _close(fd);
+ descriptors[ndesc].childend = dup_fd_as_handle((int)fd);
+ _close((int)fd);
/* simulate the append mode by fseeking to the end of the file
this introduces a potential race-condition, but it is the best we can do, though */
diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c
index c7eddc576b..441b65288c 100644
--- a/ext/standard/quot_print.c
+++ b/ext/standard/quot_print.c
@@ -53,7 +53,7 @@ static char php_hex2int(int c) /* {{{ */
PHPAPI zend_string *php_quot_print_decode(const unsigned char *str, size_t length, int replace_us_by_ws) /* {{{ */
{
- register unsigned int i;
+ register size_t i;
register unsigned const char *p1;
register unsigned char *p2;
register unsigned int h_nbl, l_nbl;
diff --git a/ext/standard/soundex.c b/ext/standard/soundex.c
index feb9a6780e..d882f5cab6 100644
--- a/ext/standard/soundex.c
+++ b/ext/standard/soundex.c
@@ -78,7 +78,7 @@ PHP_FUNCTION(soundex)
if (code >= 'A' && code <= 'Z') {
if (_small == 0) {
/* remember first valid char */
- soundex[_small++] = code;
+ soundex[_small++] = (char)code;
last = soundex_table[code - 'A'];
}
else {
@@ -88,7 +88,7 @@ PHP_FUNCTION(soundex)
code = soundex_table[code - 'A'];
if (code != last) {
if (code != 0) {
- soundex[_small++] = code;
+ soundex[_small++] = (char)code;
}
last = code;
}
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index f864994d28..51e3c14e7a 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -60,7 +60,7 @@ PHP_FUNCTION(stream_socket_pair)
RETURN_FALSE;
}
- if (0 != socketpair(domain, type, protocol, pair)) {
+ if (0 != socketpair((int)domain, (int)type, (int)protocol, pair)) {
char errbuf[256];
php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to create sockets: [%d]: %s",
php_socket_errno(), php_socket_strerror(php_socket_errno(), errbuf, sizeof(errbuf)));
@@ -90,7 +90,7 @@ PHP_FUNCTION(stream_socket_client)
char *host;
size_t host_len;
zval *zerrno = NULL, *zerrstr = NULL, *zcontext = NULL;
- double timeout = FG(default_socket_timeout);
+ double timeout = (double)FG(default_socket_timeout);
php_timeout_ull conv;
struct timeval tv;
char *hashkey = NULL;
@@ -206,7 +206,7 @@ PHP_FUNCTION(stream_socket_server)
}
stream = php_stream_xport_create(host, host_len, REPORT_ERRORS,
- STREAM_XPORT_SERVER | flags,
+ STREAM_XPORT_SERVER | (int)flags,
NULL, NULL, context, &errstr, &err);
if (stream == NULL) {
@@ -239,7 +239,7 @@ PHP_FUNCTION(stream_socket_server)
Accept a client connection from a server socket */
PHP_FUNCTION(stream_socket_accept)
{
- double timeout = FG(default_socket_timeout);
+ double timeout = (double)FG(default_socket_timeout);
zval *zpeername = NULL;
zend_string *peername = NULL;
php_timeout_ull conv;
@@ -340,7 +340,7 @@ PHP_FUNCTION(stream_socket_sendto)
}
}
- RETURN_LONG(php_stream_xport_sendto(stream, data, datalen, flags, target_addr ? &sa : NULL, sl TSRMLS_CC));
+ RETURN_LONG(php_stream_xport_sendto(stream, data, datalen, (int)flags, target_addr ? &sa : NULL, sl TSRMLS_CC));
}
/* }}} */
@@ -374,7 +374,7 @@ PHP_FUNCTION(stream_socket_recvfrom)
read_buf = zend_string_alloc(to_read, 0);
- recvd = php_stream_xport_recvfrom(stream, read_buf->val, to_read, flags, NULL, NULL,
+ recvd = php_stream_xport_recvfrom(stream, read_buf->val, to_read, (int)flags, NULL, NULL,
zremote ? &remote_addr : NULL
TSRMLS_CC);
@@ -410,7 +410,7 @@ PHP_FUNCTION(stream_get_contents)
if (desiredpos >= 0) {
int seek_res = 0;
- off_t position;
+ zend_off_t position;
position = php_stream_tell(stream);
if (position >= 0 && desiredpos > position) {
@@ -773,6 +773,10 @@ PHP_FUNCTION(stream_select)
RETURN_FALSE;
}
+#ifdef PHP_WIN32
+ tv.tv_sec = (long)(Z_LVAL_P(sec) + (usec / 1000000));
+ tv.tv_usec = (long)(usec % 1000000);
+#else
/* Solaris + BSD do not like microsecond values which are >= 1 sec */
if (usec > 999999) {
tv.tv_sec = Z_LVAL_P(sec) + (usec / 1000000);
@@ -781,7 +785,7 @@ PHP_FUNCTION(stream_select)
tv.tv_sec = Z_LVAL_P(sec);
tv.tv_usec = usec;
}
-
+#endif
tv_p = &tv;
}
@@ -1275,19 +1279,16 @@ PHP_FUNCTION(stream_get_line)
PHP_FUNCTION(stream_set_blocking)
{
zval *arg1;
- int block;
- zend_long arg2;
+ zend_long block;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &arg2) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &block) == FAILURE) {
return;
}
php_stream_from_zval(stream, arg1);
- block = arg2;
-
- if (php_stream_set_option(stream, PHP_STREAM_OPTION_BLOCKING, block == 0 ? 0 : 1, NULL) == -1) {
+ if (php_stream_set_option(stream, PHP_STREAM_OPTION_BLOCKING, block ? 1 : 0, NULL) == -1) {
RETURN_FALSE;
}
@@ -1313,6 +1314,16 @@ PHP_FUNCTION(stream_set_timeout)
php_stream_from_zval(stream, socket);
+#ifdef PHP_WIN32
+ t.tv_sec = (long)seconds;
+
+ if (argc == 3) {
+ t.tv_usec = (long)(microseconds % 1000000);
+ t.tv_sec +=(long)(microseconds / 1000000);
+ } else {
+ t.tv_usec = 0;
+ }
+#else
t.tv_sec = seconds;
if (argc == 3) {
@@ -1321,6 +1332,7 @@ PHP_FUNCTION(stream_set_timeout)
} else {
t.tv_usec = 0;
}
+#endif
if (PHP_STREAM_OPTION_RETURN_OK == php_stream_set_option(stream, PHP_STREAM_OPTION_READ_TIMEOUT, 0, &t)) {
RETURN_TRUE;
@@ -1485,7 +1497,7 @@ PHP_FUNCTION(stream_resolve_include_path)
return;
}
- resolved_path = zend_resolve_path(filename, filename_len TSRMLS_CC);
+ resolved_path = zend_resolve_path(filename, (int)filename_len TSRMLS_CC);
if (resolved_path) {
// TODO: avoid reallocation ???
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 706a3eb075..152ae6d66f 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -1663,12 +1663,10 @@ static int php_needle_char(zval *needle, char *target TSRMLS_DC)
return SUCCESS;
case IS_OBJECT:
{
- zval holder = *needle;
- zval_copy_ctor(&(holder));
- convert_to_long(&(holder));
- if(Z_TYPE(holder) != IS_LONG) {
- return FAILURE;
- }
+ zval holder;
+
+ ZVAL_LONG(&holder, zval_get_long(needle));
+
*target = (char)Z_LVAL(holder);
return SUCCESS;
}
@@ -2766,20 +2764,20 @@ PHP_FUNCTION(ucwords)
PHPAPI char *php_strtr(char *str, size_t len, char *str_from, char *str_to, size_t trlen)
{
size_t i;
- unsigned char xlat[256];
+ unsigned char xlat[256], j = 0;
if ((trlen < 1) || (len < 1)) {
return str;
}
- for (i = 0; i < 256; xlat[i] = i, i++);
+ do { xlat[j] = j; } while (++j != 0);
for (i = 0; i < trlen; i++) {
- xlat[(unsigned char) str_from[i]] = str_to[i];
+ xlat[(size_t)(unsigned char) str_from[i]] = str_to[i];
}
for (i = 0; i < len; i++) {
- str[i] = xlat[(unsigned char) str[i]];
+ str[i] = xlat[(size_t)(unsigned char) str[i]];
}
return str;
@@ -4185,7 +4183,7 @@ PHP_FUNCTION(setlocale)
#ifdef HAVE_SETLOCALE
if (Z_TYPE_P(pcategory) == IS_LONG) {
- cat = Z_LVAL_P(pcategory);
+ cat = (int)Z_LVAL_P(pcategory);
} else {
/* FIXME: The following behaviour should be removed. */
char *category;
@@ -4896,14 +4894,14 @@ PHP_FUNCTION(localeconv)
localeconv_r( &currlocdata );
/* Grab the grouping data out of the array */
- len = strlen(currlocdata.grouping);
+ len = (int)strlen(currlocdata.grouping);
for (i = 0; i < len; i++) {
add_index_long(&grouping, i, currlocdata.grouping[i]);
}
/* Grab the monetary grouping data out of the array */
- len = strlen(currlocdata.mon_grouping);
+ len = (int)strlen(currlocdata.mon_grouping);
for (i = 0; i < len; i++) {
add_index_long(&mon_grouping, i, currlocdata.mon_grouping[i]);
@@ -5346,7 +5344,7 @@ PHP_FUNCTION(str_split)
return;
}
- array_init_size(return_value, ((str->len - 1) / split_length) + 1);
+ array_init_size(return_value, (uint32_t)(((str->len - 1) / split_length) + 1));
n_reg_segments = str->len / split_length;
p = str->val;
diff --git a/ext/standard/tests/serialize/bug68044.phpt b/ext/standard/tests/serialize/bug68044.phpt
index 031e44e149..f8ef937b1e 100644
--- a/ext/standard/tests/serialize/bug68044.phpt
+++ b/ext/standard/tests/serialize/bug68044.phpt
@@ -6,7 +6,7 @@ Bug #68044 Integer overflow in unserialize() (32-bits only)
?>
===DONE==
--EXPECTF--
-Warning: Insufficient data for unserializing - %d required, 1 present in %s/bug68044.php on line 2
+Warning: Insufficient data for unserializing - %d required, 1 present in %s%ebug68044.php on line 2
-Notice: unserialize(): Error at offset 32 of 33 bytes in %s/bug68044.php on line 2
+Notice: unserialize(): Error at offset 32 of 33 bytes in %s%ebug68044.php on line 2
===DONE==
diff --git a/ext/standard/type.c b/ext/standard/type.c
index 67d5ed1e75..a773e6c53c 100644
--- a/ext/standard/type.c
+++ b/ext/standard/type.c
@@ -156,7 +156,7 @@ PHP_FUNCTION(intval)
#endif
RETVAL_ZVAL(num, 1, 0);
- convert_to_long_base(return_value, base);
+ convert_to_long_base(return_value, (int)base);
}
/* }}} */
diff --git a/ext/standard/url.c b/ext/standard/url.c
index 4fb2c73edb..7d408ef88a 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -61,7 +61,7 @@ PHPAPI void php_url_free(php_url *theurl)
/* {{{ php_replace_controlchars
*/
-PHPAPI char *php_replace_controlchars_ex(char *str, int len)
+PHPAPI char *php_replace_controlchars_ex(char *str, size_t len)
{
unsigned char *s = (unsigned char *)str;
unsigned char *e = (unsigned char *)str + len;
@@ -94,7 +94,7 @@ PHPAPI php_url *php_url_parse(char const *str)
/* {{{ php_url_parse
*/
-PHPAPI php_url *php_url_parse_ex(char const *str, int length)
+PHPAPI php_url *php_url_parse_ex(char const *str, size_t length)
{
char port_buf[6];
php_url *ret = ecalloc(1, sizeof(php_url));
@@ -481,7 +481,7 @@ static unsigned char hexchars[] = "0123456789ABCDEF";
/* {{{ php_url_encode
*/
-PHPAPI zend_string *php_url_encode(char const *s, int len)
+PHPAPI zend_string *php_url_encode(char const *s, size_t len)
{
register unsigned char c;
unsigned char *to;
@@ -572,7 +572,7 @@ PHP_FUNCTION(urldecode)
/* {{{ php_url_decode
*/
-PHPAPI int php_url_decode(char *str, int len)
+PHPAPI size_t php_url_decode(char *str, size_t len)
{
char *dest = str;
char *data = str;
@@ -603,7 +603,7 @@ PHPAPI int php_url_decode(char *str, int len)
/* {{{ php_raw_url_encode
*/
-PHPAPI zend_string *php_raw_url_encode(char const *s, int len)
+PHPAPI zend_string *php_raw_url_encode(char const *s, size_t len)
{
register int x, y;
zend_string *str;
@@ -679,7 +679,7 @@ PHP_FUNCTION(rawurldecode)
/* {{{ php_raw_url_decode
*/
-PHPAPI int php_raw_url_decode(char *str, int len)
+PHPAPI size_t php_raw_url_decode(char *str, size_t len)
{
char *dest = str;
char *data = str;
diff --git a/ext/standard/url.h b/ext/standard/url.h
index 4d7a1f5b56..ec2676eaee 100644
--- a/ext/standard/url.h
+++ b/ext/standard/url.h
@@ -33,11 +33,12 @@ typedef struct php_url {
PHPAPI void php_url_free(php_url *theurl);
PHPAPI php_url *php_url_parse(char const *str);
-PHPAPI php_url *php_url_parse_ex(char const *str, int length);
-PHPAPI int php_url_decode(char *str, int len); /* return value: length of decoded string */
-PHPAPI int php_raw_url_decode(char *str, int len); /* return value: length of decoded string */
-PHPAPI zend_string *php_url_encode(char const *s, int len);
-PHPAPI zend_string *php_raw_url_encode(char const *s, int len);
+PHPAPI php_url *php_url_parse_ex(char const *str, size_t length);
+PHPAPI size_t php_url_decode(char *str, size_t len); /* return value: length of decoded string */
+PHPAPI size_t php_raw_url_decode(char *str, size_t len); /* return value: length of decoded string */
+PHPAPI zend_string *php_url_encode(char const *s, size_t len);
+PHPAPI zend_string *php_raw_url_encode(char const *s, size_t len);
+PHPAPI char *php_replace_controlchars_ex(char *str, size_t len);
PHP_FUNCTION(parse_url);
PHP_FUNCTION(urlencode);
diff --git a/ext/standard/uuencode.c b/ext/standard/uuencode.c
index 6582e7de65..ea171a658a 100644
--- a/ext/standard/uuencode.c
+++ b/ext/standard/uuencode.c
@@ -83,7 +83,7 @@ PHPAPI zend_string *php_uuencode(char *src, size_t src_len) /* {{{ */
ee = e;
len = ee - s;
if (len % 3) {
- ee = s + (int) (floor(len / 3) * 3);
+ ee = s + (int) (floor((double)len / 3) * 3);
}
}
*p++ = PHP_UU_ENC(len);
@@ -173,7 +173,8 @@ PHPAPI zend_string *php_uudecode(char *src, size_t src_len) /* {{{ */
s++;
}
- if ((len = total_len > (p - dest->val))) {
+ assert(p >= dest->val);
+ if ((len = total_len > (size_t)(p - dest->val))) {
*p++ = PHP_UU_DEC(*s) << 2 | PHP_UU_DEC(*(s + 1)) >> 4;
if (len > 1) {
*p++ = PHP_UU_DEC(*(s + 1)) << 4 | PHP_UU_DEC(*(s + 2)) >> 2;
diff --git a/ext/standard/var.c b/ext/standard/var.c
index 6e5bd703d3..4f0bd24bdc 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -389,7 +389,7 @@ PHP_FUNCTION(debug_zval_dump)
#define buffer_append_spaces(buf, num_spaces) \
do { \
char *tmp_spaces; \
- int tmp_spaces_len; \
+ size_t tmp_spaces_len; \
tmp_spaces_len = spprintf(&tmp_spaces, 0,"%*c", num_spaces, ' '); \
smart_str_appendl(buf, tmp_spaces, tmp_spaces_len); \
efree(tmp_spaces); \
@@ -594,7 +594,7 @@ PHP_FUNCTION(var_export)
static void php_var_serialize_intern(smart_str *buf, zval *struc, php_serialize_data_t var_hash TSRMLS_DC);
-static inline uint32_t php_add_var_hash(php_serialize_data_t data, zval *var TSRMLS_DC) /* {{{ */
+static inline zend_long php_add_var_hash(php_serialize_data_t data, zval *var TSRMLS_DC) /* {{{ */
{
zval *zv;
zend_ulong key;
@@ -772,7 +772,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt
static void php_var_serialize_intern(smart_str *buf, zval *struc, php_serialize_data_t var_hash TSRMLS_DC) /* {{{ */
{
- uint32_t var_already;
+ zend_long var_already;
HashTable *myht;
if (EG(exception)) {
@@ -816,7 +816,7 @@ again:
smart_str_appendl(buf, "d:", 2);
s = (char *) safe_emalloc(PG(serialize_precision), 1, MAX_LENGTH_OF_DOUBLE + 1);
- php_gcvt(Z_DVAL_P(struc), PG(serialize_precision), '.', 'E', s);
+ php_gcvt(Z_DVAL_P(struc), (int)PG(serialize_precision), '.', 'E', s);
smart_str_appends(buf, s);
smart_str_appendc(buf, ';');
efree(s);
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c
index 63ccf52370..8ca27d7b9a 100644
--- a/ext/tidy/tidy.c
+++ b/ext/tidy/tidy.c
@@ -494,7 +494,9 @@ static void TIDY_CALL php_tidy_panic(ctmbstr msg)
static int _php_tidy_set_tidy_opt(TidyDoc doc, char *optname, zval *value TSRMLS_DC)
{
TidyOption opt = tidyGetOptionByName(doc, optname);
- zval conv = *value;
+ zval conv;
+
+ ZVAL_COPY_VALUE(&conv, value);
if (!opt) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown Tidy Configuration Option '%s'", optname);