mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-26 02:15:42 +00:00
Compare commits
259
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f155eae86 | ||
|
|
c11d5ae290 | ||
|
|
080d463a76 | ||
|
|
079548829f | ||
|
|
1ff28cd0ec | ||
|
|
9b88bc494e | ||
|
|
2dfb8fbdf4 | ||
|
|
b30304fb78 | ||
|
|
2b811a5aec | ||
|
|
156cc39e21 | ||
|
|
497b918e62 | ||
|
|
46566b78c9 | ||
|
|
66bf216c66 | ||
|
|
80fa2ff646 | ||
|
|
e1d8c0a051 | ||
|
|
87a87c6682 | ||
|
|
17f6391bf8 | ||
|
|
db6c33875c | ||
|
|
356c442558 | ||
|
|
737c187013 | ||
|
|
f7b9c12ed9 | ||
|
|
3f049bcff2 | ||
|
|
495d5335f9 | ||
|
|
862c006da1 | ||
|
|
f2d5b2b6c6 | ||
|
|
06bbb657ad | ||
|
|
68f318a422 | ||
|
|
119821a452 | ||
|
|
dada2f550f | ||
|
|
f8252aa537 | ||
|
|
cb5178a450 | ||
|
|
ddd7ed9b24 | ||
|
|
72050af855 | ||
|
|
1a624e27a6 | ||
|
|
3a8282ed0f | ||
|
|
4dc8610d34 | ||
|
|
73b3f58bcd | ||
|
|
8391277fb8 | ||
|
|
a92240e209 | ||
|
|
c17fd65165 | ||
|
|
b9d494a33b | ||
|
|
cf7e73cf26 | ||
|
|
d2e42d5372 | ||
|
|
28fa31d6e5 | ||
|
|
af41914e15 | ||
|
|
cedc718f73 | ||
|
|
3a76cb2d95 | ||
|
|
a930e04792 | ||
|
|
1fdca8208f | ||
|
|
8e3c2015dc | ||
|
|
0c74d5ef08 | ||
|
|
972935cd95 | ||
|
|
091b7f841b | ||
|
|
3c673fed34 | ||
|
|
ecf7570072 | ||
|
|
e2fc6b52f0 | ||
|
|
70dd3f1731 | ||
|
|
9acdf71194 | ||
|
|
cab1894b81 | ||
|
|
b31a9cd4da | ||
|
|
7d5c11c235 | ||
|
|
721b9a7c8d | ||
|
|
515c103a08 | ||
|
|
af09d8b96a | ||
|
|
b084157d3d | ||
|
|
e590aceb5a | ||
|
|
014b95a0a7 | ||
|
|
5d08cae346 | ||
|
|
c2a9f73c99 | ||
|
|
a33759fd27 | ||
|
|
bc0b6e02e4 | ||
|
|
731013ee8e | ||
|
|
c34f26a938 | ||
|
|
bbd0781b39 | ||
|
|
1533f98afd | ||
|
|
e73c05b75e | ||
|
|
3eb8102348 | ||
|
|
c9680697ec | ||
|
|
362b70a32c | ||
|
|
36c445970e | ||
|
|
2e459be237 | ||
|
|
d022c8565d | ||
|
|
eca13f7909 | ||
|
|
79b3c2a744 | ||
|
|
9443fb999d | ||
|
|
488e64dbe4 | ||
|
|
5fc7382a57 | ||
|
|
b1df743b7a | ||
|
|
c73b0543f1 | ||
|
|
561843c973 | ||
|
|
ccd4bf5147 | ||
|
|
cb0e6124d4 | ||
|
|
82e92c99a6 | ||
|
|
33d372a45f | ||
|
|
816a5d2072 | ||
|
|
9137acc7ec | ||
|
|
fd20278fa5 | ||
|
|
bd961f3e87 | ||
|
|
38797e598b | ||
|
|
d18089d621 | ||
|
|
e1b1ef0d79 | ||
|
|
4d9c556b5d | ||
|
|
eb6941e902 | ||
|
|
6e15afd1be | ||
|
|
a59ec5d1b0 | ||
|
|
ee7671afb5 | ||
|
|
593505f266 | ||
|
|
8cdefd3d10 | ||
|
|
bca0e5edd5 | ||
|
|
c6a4a7cad6 | ||
|
|
2198bbce86 | ||
|
|
3f258e6b46 | ||
|
|
756ee95605 | ||
|
|
851f362882 | ||
|
|
f06b3432c8 | ||
|
|
884bbcd537 | ||
|
|
e244e2245b | ||
|
|
ce1fd72776 | ||
|
|
6d4d4155d2 | ||
|
|
10eb007070 | ||
|
|
ca313caa4b | ||
|
|
afa03a470e | ||
|
|
143bb29c1a | ||
|
|
a7d3606650 | ||
|
|
633f898f15 | ||
|
|
8dd99dd2dc | ||
|
|
a289b37f48 | ||
|
|
1cc5d1009f | ||
|
|
ee4b3892f8 | ||
|
|
0afcbb0ba9 | ||
|
|
be354936b7 | ||
|
|
bd8cd98d6d | ||
|
|
a6ad3a558a | ||
|
|
bdd65b578c | ||
|
|
9f449df1e4 | ||
|
|
89f864c547 | ||
|
|
58b7f21c3f | ||
|
|
c612440e0f | ||
|
|
b79d2285df | ||
|
|
bd9aa181dc | ||
|
|
a80cec1190 | ||
|
|
66f76ec1f9 | ||
|
|
641a0c86d9 | ||
|
|
b04159eed4 | ||
|
|
baafdad150 | ||
|
|
786234d351 | ||
|
|
f7f524aada | ||
|
|
3fcdecf658 | ||
|
|
f275fdcf00 | ||
|
|
f9537c2a0b | ||
|
|
6f14b5ab41 | ||
|
|
8c9fd8fb53 | ||
|
|
9f251548ae | ||
|
|
a65a546640 | ||
|
|
9d84f6c06e | ||
|
|
fbb1827da8 | ||
|
|
7ce88b2d8a | ||
|
|
6e0b8b4288 | ||
|
|
832c21cabf | ||
|
|
cf0741fd5b | ||
|
|
5cc851e83e | ||
|
|
65adb74984 | ||
|
|
19524fc6fe | ||
|
|
f9829690d4 | ||
|
|
c09bd9def0 | ||
|
|
35101e9ef4 | ||
|
|
39e721cf50 | ||
|
|
6188674f1e | ||
|
|
e41059c633 | ||
|
|
1e0fdf0256 | ||
|
|
71ebc0a7f3 | ||
|
|
179e45920c | ||
|
|
d676396435 | ||
|
|
e196dce45a | ||
|
|
62404e767a | ||
|
|
2c34d81e7d | ||
|
|
8605702a7a | ||
|
|
6267c40ac5 | ||
|
|
b855367551 | ||
|
|
fd87b38c47 | ||
|
|
918f626d97 | ||
|
|
465d5db693 | ||
|
|
ab32d36ec6 | ||
|
|
23cb7bd506 | ||
|
|
e79b54c4b5 | ||
|
|
c24f11450f | ||
|
|
770aeeb40c | ||
|
|
b1c0614ecc | ||
|
|
f5e097d1ed | ||
|
|
da84f3af75 | ||
|
|
3182660c04 | ||
|
|
d941ac5b4f | ||
|
|
6b77c3aaa1 | ||
|
|
79cbcd9ded | ||
|
|
a87125c1e8 | ||
|
|
eafe070f86 | ||
|
|
d3faae03ec | ||
|
|
e8bf18bd9f | ||
|
|
e9b4bca5a0 | ||
|
|
de99fd7301 | ||
|
|
4dee63ca1c | ||
|
|
fed80ee605 | ||
|
|
d65ddb633d | ||
|
|
f496aac1f6 | ||
|
|
76c098395d | ||
|
|
60bcf84dda | ||
|
|
498d94d137 | ||
|
|
d5560faaa3 | ||
|
|
f49965b487 | ||
|
|
1dcaa109a1 | ||
|
|
35cb180d9e | ||
|
|
dfe6628440 | ||
|
|
cd0bf6fc3a | ||
|
|
3f19697c0c | ||
|
|
7399386a20 | ||
|
|
251b914afa | ||
|
|
22dba2f5f3 | ||
|
|
ce1e1bb5d8 | ||
|
|
4e308abf28 | ||
|
|
6fca805b3b | ||
|
|
0742de587a | ||
|
|
93ede745bc | ||
|
|
fb16bff2ba | ||
|
|
e6ab180394 | ||
|
|
0ed477b408 | ||
|
|
69af357182 | ||
|
|
4b48b29988 | ||
|
|
c0acb9d5f6 | ||
|
|
c4c10a222e | ||
|
|
c0fcd3d6b0 | ||
|
|
c0e3429904 | ||
|
|
706d67787a | ||
|
|
0436b85d9f | ||
|
|
0eff7176de | ||
|
|
6d1d8ec330 | ||
|
|
34792280bc | ||
|
|
e67ef24227 | ||
|
|
7bcf01f39a | ||
|
|
fa224b1c58 | ||
|
|
58f94345a7 | ||
|
|
383423a1ee | ||
|
|
a27e51fd4e | ||
|
|
eb6d1fcd3c | ||
|
|
093ff4b624 | ||
|
|
1bc16fbfcd | ||
|
|
512f9bfe8c | ||
|
|
ac6bd1e346 | ||
|
|
2de24f182c | ||
|
|
c6f2581c39 | ||
|
|
fb721cefe7 | ||
|
|
09eb3cf381 | ||
|
|
5c964fb332 | ||
|
|
2311ba7d3f | ||
|
|
69581cdbbb | ||
|
|
8aa93b7f2c | ||
|
|
e6bb90c66a | ||
|
|
fb3e21fbcc | ||
|
|
07b9db3def | ||
|
|
9b54901ffb |
No files matched your search
@@ -206,6 +206,8 @@ ext/pdo_sqlite/sqlite3.h
|
||||
ext/pdo_sqlite/tests/*.db
|
||||
ext/pdo_sqlite/tests/*.tmp
|
||||
ext/phar/phar.phar
|
||||
ext/phar/phar.1
|
||||
ext/phar/phar.phar.1
|
||||
ext/pspell/tests/*.tmp
|
||||
ext/reflection/xml
|
||||
ext/reflection/html
|
||||
@@ -237,12 +239,14 @@ sapi/apache/libphp5.module
|
||||
sapi/apache2handler/libphp5.module
|
||||
sapi/apache_hooks/libphp5.module
|
||||
sapi/cgi/php-cgi
|
||||
sapi/cgi/php-cgi.1
|
||||
sapi/cli/php.1
|
||||
sapi/fpm/php-fpm
|
||||
sapi/fpm/php-fpm.1
|
||||
sapi/fpm/init.d.php-fpm
|
||||
sapi/fpm/php-fpm.conf
|
||||
sapi/fpm/fpm/php-cgi
|
||||
sapi/phpdbg/phpdbg
|
||||
scripts/php-config
|
||||
scripts/phpize
|
||||
scripts/man1/*.1
|
||||
|
||||
+23
-3
@@ -82,7 +82,7 @@ Exceptions:
|
||||
library may need to control or free the memory, or when the memory in
|
||||
question needs to survive between multiple requests.
|
||||
|
||||
Naming Conventions
|
||||
User Functions/Methods Naming Conventions
|
||||
------------------
|
||||
|
||||
1. Function names for user-level functions should be enclosed with in
|
||||
@@ -163,6 +163,26 @@ Naming Conventions
|
||||
'foobar'
|
||||
'foo_bar'
|
||||
|
||||
Internal Function Naming Convensions
|
||||
----------------------
|
||||
|
||||
1. Functions that are part of the external API should be named
|
||||
'php_modulename_function()' to avoid symbol collision. They should be in
|
||||
lowercase, with words underscore delimited. Exposed API must be defined
|
||||
in 'php_modulename.h'.
|
||||
|
||||
PHPAPI char *php_session_create_id(PS_CREATE_SID_ARGS);
|
||||
|
||||
Unexposed module function should be static and should not be defined in
|
||||
'php_modulename.h'.
|
||||
|
||||
static int php_session_destroy(TSRMLS_D)
|
||||
|
||||
2. Main module source file must be named 'modulename.c'.
|
||||
|
||||
3. Header file that is used by other sources must be named 'php_modulename.h'.
|
||||
|
||||
|
||||
Syntax and indentation
|
||||
----------------------
|
||||
|
||||
@@ -181,9 +201,9 @@ Syntax and indentation
|
||||
of PHP or one of its standard modules, please maintain the K&R
|
||||
style. This applies to just about everything, starting with
|
||||
indentation and comment styles and up to function declaration
|
||||
syntax. Also see Indentstyle_.
|
||||
syntax. Also see Indentstyle.
|
||||
|
||||
.. _Indentstyle: http://www.catb.org/~esr/jargon/html/I/indent-style.html
|
||||
Indentstyle: http://www.catb.org/~esr/jargon/html/I/indent-style.html
|
||||
|
||||
3. Be generous with whitespace and braces. Keep one empty line between the
|
||||
variable declaration section and the statements in a block, as well as
|
||||
|
||||
@@ -1,6 +1,101 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2014, PHP 5.5.9
|
||||
03 Apr 2014, PHP 5.5.11
|
||||
|
||||
- Core:
|
||||
. Allow zero length comparison in substr_compare() (Tjerk)
|
||||
. Fixed bug #60602 (proc_open() changes environment array) (Tjerk)
|
||||
|
||||
- SPL:
|
||||
. Added feature #65545 (SplFileObject::fread()) (Tjerk)
|
||||
|
||||
- cURL:
|
||||
. Fixed bug #66109 (Can't reset CURLOPT_CUSTOMREQUEST to default behaviour) (Tjerk)
|
||||
. Fix compilation on libcurl versions between 7.10.5 and 7.12.2, inclusive.
|
||||
(Adam)
|
||||
|
||||
- FPM:
|
||||
. Added clear_env configuration directive to disable clearenv() call.
|
||||
(Github PR# 598, Paul Annesley)
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #66946 (fileinfo: extensive backtracking in awk rule regular
|
||||
expression). (CVE-2013-7345) (Remi)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #66714 (imageconvolution breakage). (Brad Daily)
|
||||
. Fixed bug #66869 (Invalid 2nd argument crashes imageaffinematrixget) (Pierre)
|
||||
. Fixed bug #66887 (imagescale - poor quality of scaled image). (Remi)
|
||||
. Fixed bug #66890 (imagescale segfault). (Remi)
|
||||
. Fixed bug #66893 (imagescale ignore method argument). (Remi)
|
||||
|
||||
- Hash:
|
||||
. hash_pbkdf2() now works correctly if the $length argument is not specified.
|
||||
(Nikita)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #66873 (A reproductible crash in UConverter when given invalid
|
||||
encoding) (Stas)
|
||||
|
||||
- Mail:
|
||||
. Fixed bug #66535 (Don't add newline after X-PHP-Originating-Script) (Tjerk)
|
||||
|
||||
- MySQLi:
|
||||
. Fixed bug #66762 (Segfault in mysqli_stmt::bind_result() when link closed)
|
||||
(Remi)
|
||||
|
||||
- OPCache
|
||||
. Added function opcache_is_script_cached(). (Danack)
|
||||
. Added information about interned strings usage. (Terry, Julien, Dmitry)
|
||||
|
||||
- Openssl:
|
||||
. Fixed bug #66833 (Default disgest algo is still MD5, switch to SHA1). (Remi)
|
||||
|
||||
- GMP
|
||||
. Fixed bug #66872 (invalid argument crashes gmp_testbit) (Pierre)
|
||||
|
||||
- SQLite:
|
||||
. Updated bundled libsqlite to 3.8.3.1 (Anatol)
|
||||
|
||||
06 Mar 2014, PHP 5.5.10
|
||||
|
||||
- Core:
|
||||
. Fixed Request #66574i (Allow multiple paths in php_ini_scanned_path). (Remi)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #45528 (Allow the DateTimeZone constructor to accept timezones
|
||||
per offset too). (Derick)
|
||||
|
||||
- Fileinfo:
|
||||
. Bug #66731 (file: infinite recursion) (CVE-2014-1943). (Remi)
|
||||
. Fixed bug #66820 (out-of-bounds memory access in fileinfo)
|
||||
(CVE-2014-2270). (Remi)
|
||||
|
||||
- GD
|
||||
. Fixed Bug #66815 (imagecrop(): insufficient fix for NULL defer
|
||||
CVE-2013-7327). (Tomas Hoger, Remi)
|
||||
|
||||
- JSON:
|
||||
. Fixed bug #65753 (JsonSerializeable couldn't implement on module extension)
|
||||
(chobieeee@php.net)
|
||||
|
||||
- LDAP:
|
||||
. Implemented ldap_modify_batch (https://wiki.php.net/rfc/ldap_modify_batch).
|
||||
(Ondřej Hošek)
|
||||
|
||||
- Openssl:
|
||||
. Fixed bug #66501 (Add EC key support to php_openssl_is_private_key).
|
||||
(Mark Zedwood)
|
||||
|
||||
- PCRE:
|
||||
. Upgraded to PCRE 8.34. (Anatol)
|
||||
|
||||
- Pgsql:
|
||||
. Added warning for dangerous client encoding and remove possible injections
|
||||
for pg_insert()/pg_update()/pg_delete()/pg_select(). (Yasuo)
|
||||
|
||||
|
||||
06 Feb 2014, PHP 5.5.9
|
||||
|
||||
- Core:
|
||||
. Fixed bug #66509 (copy() arginfo has changed starting from 5.4). (willfitch)
|
||||
@@ -56,7 +151,8 @@ spaces) (willfitch, iliaa)
|
||||
. Fixed bug #66218 (zend_register_functions breaks reflection). (Remi)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #66060 (Heap buffer over-read in DateInterval). (Remi)
|
||||
. Fixed bug #66060 (Heap buffer over-read in DateInterval) (CVE-2013-6712).
|
||||
(Remi)
|
||||
. Fixed bug #65768 (DateTimeImmutable::diff does not work). (Nikita Nefedov)
|
||||
|
||||
- DOM:
|
||||
@@ -609,6 +705,12 @@ spaces) (willfitch, iliaa)
|
||||
CURLOPT_RTSP_REQUEST, CURLOPT_RESOLVE, CURLOPT_ACCEPT_ENCODING,
|
||||
CURLOPT_TRANSFER_ENCODING, CURLOPT_DNS_SERVERS and CURLOPT_USE_SSL.
|
||||
(Pierrick)
|
||||
. Added new functions curl_escape, curl_multi_setopt, curl_multi_strerror
|
||||
curl_pause, curl_reset, curl_share_close, curl_share_init,
|
||||
curl_share_setopt curl_strerror and curl_unescape. (Pierrick)
|
||||
. Addes new curl options CURLOPT_TELNETOPTIONS, CURLOPT_GSSAPI_DELEGATION,
|
||||
CURLOPT_ACCEPTTIMEOUT_MS, CURLOPT_SSL_OPTIONS, CURLOPT_TCP_KEEPALIVE,
|
||||
CURLOPT_TCP_KEEPIDLE and CURLOPT_TCP_KEEPINTVL. (Pierrick)
|
||||
. Fixed bug #55635 (CURLOPT_BINARYTRANSFER no longer used. The constant
|
||||
still exists for backward compatibility but is doing nothing). (Pierrick)
|
||||
. Fixed bug #54995 (Missing CURLINFO_RESPONSE_CODE support). (Pierrick)
|
||||
@@ -616,12 +718,6 @@ spaces) (willfitch, iliaa)
|
||||
- DateTime
|
||||
. Added DateTimeImmutable - a variant of DateTime that only returns the
|
||||
modified state instead of changing itself. (Derick)
|
||||
. Added new functions curl_escape, curl_multi_setopt, curl_multi_strerror
|
||||
curl_pause, curl_reset, curl_share_close, curl_share_init,
|
||||
curl_share_setopt curl_strerror and curl_unescape. (Pierrick)
|
||||
. Addes new curl options CURLOPT_TELNETOPTIONS, CURLOPT_GSSAPI_DELEGATION,
|
||||
CURLOPT_ACCEPTTIMEOUT_MS, CURLOPT_SSL_OPTIONS, CURLOPT_TCP_KEEPALIVE,
|
||||
CURLOPT_TCP_KEEPIDLE and CURLOPT_TCP_KEEPINTVL. (Pierrick)
|
||||
. Fixed bug #64825 (Invalid free when unserializing DateTimeZone).
|
||||
(Anatol)
|
||||
. Fixed bug #64359 (strftime crash with VS2012). (Anatol)
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
This file describes extension module API details. Refer to
|
||||
README.EXT_SKEL to create extension skeleton files. Refer to
|
||||
Hacker's Guide for PHP internals.
|
||||
|
||||
http://www.php.net/manual/en/internals2.php
|
||||
|
||||
|
||||
|
||||
Between PHP 4.0.6 and 4.1.0, the Zend module struct changed in a way
|
||||
that broke both source and binary compatibility. If you are
|
||||
maintaining a third party extension, here's how to update it:
|
||||
|
||||
+24
-6
@@ -45,12 +45,29 @@ HOW TO USE IT
|
||||
|
||||
--proto=filename.
|
||||
|
||||
SOURCE AND HEADER FILE NAME
|
||||
|
||||
./ext_skel generates 'module_name.c' and 'php_module_name.h' as main source
|
||||
and header files. Keep these names.
|
||||
|
||||
Module functions (User functions) must be named
|
||||
|
||||
module_name_function()
|
||||
|
||||
When you need to expose module functions to other modules, expose functions
|
||||
strictly needed by others. Exposed internal function must be named
|
||||
|
||||
php_module_name_function()
|
||||
|
||||
See also CODING_STANDARDS.
|
||||
|
||||
|
||||
FORMAT OF FUNCTION DEFINITIONS FILE
|
||||
|
||||
All the definitions must be on one line. In it's simplest form, it's just
|
||||
the function name, e.g.
|
||||
|
||||
my_function
|
||||
module_name_function
|
||||
|
||||
but then you'll be left with an almost empty function body without any
|
||||
argument handling.
|
||||
@@ -72,8 +89,9 @@ FORMAT OF FUNCTION DEFINITIONS FILE
|
||||
|
||||
An example:
|
||||
|
||||
my_function(int arg1, int arg2 [, int arg3 [, int arg4]]) this is my 1st
|
||||
module_name_function(int arg1, int arg2 [, int arg3 [, int arg4]])
|
||||
|
||||
Arguments arg1 and arg2 are required.
|
||||
Arguments arg3 and arg4 are optional.
|
||||
|
||||
If possible, the function definition should also contain it's return type
|
||||
@@ -133,15 +151,15 @@ EXAMPLE
|
||||
|
||||
The following _one_ line
|
||||
|
||||
bool my_drawtext(resource image, string text, resource font, int x, int y [, int color])
|
||||
bool module_name_drawtext(resource image, string text, resource font, int x, int y [, int color])
|
||||
|
||||
will create this function definition for you (note that there are a few
|
||||
question marks to be replaced by you, and you must of course add your own
|
||||
value definitions too):
|
||||
|
||||
/* {{{ proto bool my_drawtext(resource image, string text, resource font, int x, int y [, int color])
|
||||
/* {{{ proto bool module_name_drawtext(resource image, string text, resource font, int x, int y [, int color])
|
||||
*/
|
||||
PHP_FUNCTION(my_drawtext)
|
||||
PHP_FUNCTION(module_name_drawtext)
|
||||
{
|
||||
char *text = NULL;
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
@@ -164,7 +182,7 @@ PHP_FUNCTION(my_drawtext)
|
||||
ZEND_FETCH_RESOURCE(???, ???, font, font_id, "???", ???_rsrc_id);
|
||||
}
|
||||
|
||||
php_error(E_WARNING, "my_drawtext: not yet implemented");
|
||||
php_error(E_WARNING, "module_name_drawtext: not yet implemented");
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -101,10 +101,10 @@ pointing out "the location of the release" and "the possible release date of
|
||||
either the next RC, or the final release".
|
||||
|
||||
2. Send an email (see example here http://news.php.net/php.pear.qa/5201) **To**
|
||||
``php-qa@lists.php.net`` and ``primary-qa-tests@lists.php.net``.
|
||||
``php-qa@lists.php.net`` and ``primary-qa-tester@lists.php.net``.
|
||||
This email is to notify the selected projects about a new release so that they
|
||||
can make sure their projects keep working. Make sure that you have been setup
|
||||
as a moderator for ``primary-qa-tests@lists.php.net`` by having someone (Wez,
|
||||
as a moderator for ``primary-qa-tester@lists.php.net`` by having someone (Hannes, Dan,
|
||||
Derick) run the following commands for you:
|
||||
|
||||
``ssh lists.php.net``
|
||||
@@ -139,7 +139,7 @@ Rolling a stable release
|
||||
1. Checkout your release branch, you should have created when releasing previous RC
|
||||
and bump the version numbers in ``main/php_version.h``, ``configure.in`` and possibly ``NEWS``.
|
||||
|
||||
2. If a CVE commit needs to be merged to the release, then have it commited to
|
||||
2. If a CVE commit needs to be merged to the release, then have it committed to
|
||||
the base branches and merged upwards as usual (f.e commit the CVE fix to 5.3,
|
||||
merge to 5.4, 5.5 etc...). Then you can cherry-pick it in your release branch.
|
||||
Don't forget to update NEWS manually in an extra commit then.
|
||||
|
||||
@@ -50,6 +50,17 @@ Please make the mail subject prefix "[PATCH]". If attaching a patch,
|
||||
ensure it has a file extension of ".txt". This is because only MIME
|
||||
attachments of type 'text/*' are accepted.
|
||||
|
||||
The preferred way to propose PHP patch is sending pull request from
|
||||
github.
|
||||
|
||||
https://github.com/php/php-src
|
||||
|
||||
Fork the official PHP repository and send a pull request. A
|
||||
notification will be sent to the pull request mailing list. Sending a
|
||||
note to PHP Internals list (internals@lists.php.net) may help getting
|
||||
more feedback and quicker turnaround. You can also add pull requests
|
||||
to bug reports at http://bugs.php.net/.
|
||||
|
||||
|
||||
PHP Documentation Patches
|
||||
-------------------------
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
------------------
|
||||
Failed tests usually indicate a problem with your local system setup
|
||||
and not within PHP itself (at least for official PHP release versions).
|
||||
You may decide to automaticaly submit a test summary to our QA workflow
|
||||
You may decide to automatically submit a test summary to our QA workflow
|
||||
at the end of a test run.
|
||||
Please do *not* submit a failed test as a bug or ask for help on why
|
||||
it failed on your system without providing substantial backup information
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define TSRM_CONFIG_COMMON_H
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
# if WINNT|WIN32
|
||||
# ifdef _WIN32
|
||||
# define TSRM_WIN32
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -299,6 +299,9 @@ PHP 5.5 UPGRADE NOTES
|
||||
- IntlDateFormatter::getTimeZone()
|
||||
- IntlDateFormatter::setTimeZone()
|
||||
|
||||
- LDAP:
|
||||
- ldap_modify_batch() (5.5.10)
|
||||
|
||||
- Sockets:
|
||||
- socket_sendmsg()
|
||||
- socket_recvmsg()
|
||||
|
||||
+58
-3
@@ -360,6 +360,11 @@ ZEND_METHOD(error_exception, getSeverity)
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#define TRACE_ARG_APPEND(vallen) \
|
||||
*str = (char*)erealloc(*str, *len + 1 + vallen); \
|
||||
memcpy((*str) + *len - l_added + 1 + vallen, (*str) + *len - l_added + 1, l_added);
|
||||
|
||||
/* }}} */
|
||||
|
||||
static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
|
||||
@@ -371,7 +376,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
|
||||
len = va_arg(args, int*);
|
||||
|
||||
/* the trivial way would be to do:
|
||||
* conver_to_string_ex(arg);
|
||||
* convert_to_string_ex(arg);
|
||||
* append it and kill the now tmp arg.
|
||||
* but that could cause some E_NOTICE and also damn long lines.
|
||||
*/
|
||||
@@ -394,8 +399,58 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
|
||||
l_added += 3 + 1;
|
||||
}
|
||||
while (--l_added) {
|
||||
if ((*str)[*len - l_added] < 32) {
|
||||
(*str)[*len - l_added] = '?';
|
||||
unsigned char chr = (*str)[*len - l_added];
|
||||
if (chr < 32 || chr == '\\' || chr > 126) {
|
||||
(*str)[*len - l_added] = '\\';
|
||||
|
||||
switch (chr) {
|
||||
case '\n':
|
||||
TRACE_ARG_APPEND(1);
|
||||
(*str)[++(*len) - l_added] = 'n';
|
||||
break;
|
||||
case '\r':
|
||||
TRACE_ARG_APPEND(1);
|
||||
(*str)[++(*len) - l_added] = 'r';
|
||||
break;
|
||||
case '\t':
|
||||
TRACE_ARG_APPEND(1);
|
||||
(*str)[++(*len) - l_added] = 't';
|
||||
break;
|
||||
case '\f':
|
||||
TRACE_ARG_APPEND(1);
|
||||
(*str)[++(*len) - l_added] = 'f';
|
||||
break;
|
||||
case '\v':
|
||||
TRACE_ARG_APPEND(1);
|
||||
(*str)[++(*len) - l_added] = 'v';
|
||||
break;
|
||||
#ifndef PHP_WIN32
|
||||
case '\e':
|
||||
#else
|
||||
case VK_ESCAPE:
|
||||
#endif
|
||||
TRACE_ARG_APPEND(1);
|
||||
(*str)[++(*len) - l_added] = 'e';
|
||||
break;
|
||||
case '\\':
|
||||
TRACE_ARG_APPEND(1);
|
||||
(*str)[++(*len) - l_added] = '\\';
|
||||
break;
|
||||
default:
|
||||
TRACE_ARG_APPEND(3);
|
||||
(*str)[*len - l_added + 1] = 'x';
|
||||
if ((chr >> 4) < 10) {
|
||||
(*str)[*len - l_added + 2] = (chr >> 4) + '0';
|
||||
} else {
|
||||
(*str)[*len - l_added + 2] = (chr >> 4) + 'A' - 10;
|
||||
}
|
||||
if (chr % 16 < 10) {
|
||||
(*str)[*len - l_added + 3] = chr % 16 + '0';
|
||||
} else {
|
||||
(*str)[*len - l_added + 3] = chr % 16 + 'A' - 10;
|
||||
}
|
||||
*len += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -57,7 +57,7 @@ ZEND_API void zend_html_putc(char c)
|
||||
ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC)
|
||||
{
|
||||
const unsigned char *ptr = (const unsigned char*)s, *end = ptr + len;
|
||||
unsigned char *filtered;
|
||||
unsigned char *filtered = NULL;
|
||||
size_t filtered_len;
|
||||
|
||||
if (LANG_SCNG(output_filter)) {
|
||||
|
||||
@@ -1237,7 +1237,7 @@ function gen_vm($def, $skel) {
|
||||
out($f, "# pragma warning(once : 6285)\n");
|
||||
// Suppress (<non-zero constant> || <expression>) warnings on windows
|
||||
out($f, "# pragma warning(once : 6286)\n");
|
||||
// Suppress constant with constant comparsion warnings on windows
|
||||
// Suppress constant with constant comparison warnings on windows
|
||||
out($f, "# pragma warning(once : 6326)\n");
|
||||
}
|
||||
out($f, "#endif\n");
|
||||
|
||||
+2
-2
@@ -33,14 +33,14 @@ ac_version=`$PHP_AUTOCONF --version 2>/dev/null|head -n 1|sed -e 's/^[^0-9]*//'
|
||||
if test -z "$ac_version"; then
|
||||
echo "buildconf: autoconf not found."
|
||||
echo " You need autoconf version 2.59 or newer installed"
|
||||
echo " to build PHP from SVN."
|
||||
echo " to build PHP from Git."
|
||||
exit 1
|
||||
fi
|
||||
IFS=.; set $ac_version; IFS=' '
|
||||
if test "$1" = "2" -a "$2" -lt "59" || test "$1" -lt "2"; then
|
||||
echo "buildconf: autoconf version $ac_version found."
|
||||
echo " You need autoconf version 2.59 or newer installed"
|
||||
echo " to build PHP from SVN."
|
||||
echo " to build PHP from Git."
|
||||
exit 1
|
||||
else
|
||||
echo "buildconf: autoconf version $ac_version (ok)"
|
||||
|
||||
+2
-2
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=5
|
||||
PHP_RELEASE_VERSION=9
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=11
|
||||
PHP_EXTRA_VERSION=""
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
|
||||
+83
-98
@@ -165,50 +165,62 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||
# define php_curl_ret(__ret) RETVAL_FALSE; return;
|
||||
#endif
|
||||
|
||||
static int php_curl_option_url(php_curl *ch, const char *url, const int len TSRMLS_DC) /* {{{ */
|
||||
static int php_curl_option_str(php_curl *ch, long option, const char *str, const int len, zend_bool make_copy TSRMLS_DC)
|
||||
{
|
||||
CURLcode error = CURLE_OK;
|
||||
#if LIBCURL_VERSION_NUM < 0x071100
|
||||
char *copystr = NULL;
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x071100
|
||||
if (make_copy) {
|
||||
#endif
|
||||
char *copystr;
|
||||
|
||||
/* Strings passed to libcurl as 'char *' arguments, are copied by the library since 7.17.0 */
|
||||
copystr = estrndup(str, len);
|
||||
error = curl_easy_setopt(ch->cp, option, copystr);
|
||||
zend_llist_add_element(&ch->to_free->str, ©str);
|
||||
#if LIBCURL_VERSION_NUM >= 0x071100
|
||||
} else {
|
||||
error = curl_easy_setopt(ch->cp, option, str);
|
||||
}
|
||||
#endif
|
||||
|
||||
SAVE_CURL_ERROR(ch, error)
|
||||
|
||||
return error == CURLE_OK ? SUCCESS : FAILURE;
|
||||
}
|
||||
|
||||
static int php_curl_option_url(php_curl *ch, const char *url, const int len TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
/* Disable file:// if open_basedir are used */
|
||||
if (PG(open_basedir) && *PG(open_basedir)) {
|
||||
#if LIBCURL_VERSION_NUM >= 0x071304
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_PROTOCOLS, CURLPROTO_ALL & ~CURLPROTO_FILE);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_PROTOCOLS, CURLPROTO_ALL & ~CURLPROTO_FILE);
|
||||
#else
|
||||
php_url *uri;
|
||||
|
||||
if (!(uri = php_url_parse_ex(url, len))) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid URL '%s'", url);
|
||||
return 0;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (uri->scheme && !strncasecmp("file", uri->scheme, sizeof("file"))) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Protocol 'file' disabled in cURL");
|
||||
php_url_free(uri);
|
||||
return 0;
|
||||
return FAILURE;
|
||||
}
|
||||
php_url_free(uri);
|
||||
#endif
|
||||
}
|
||||
/* Strings passed to libcurl as 'char *' arguments, are copied by the library... NOTE: before 7.17.0 strings were not copied. */
|
||||
#if LIBCURL_VERSION_NUM >= 0x071100
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_URL, url);
|
||||
#else
|
||||
copystr = estrndup(url, len);
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_URL, copystr);
|
||||
zend_llist_add_element(&ch->to_free->str, ©str);
|
||||
#endif
|
||||
|
||||
return (error == CURLE_OK ? 1 : 0);
|
||||
return php_curl_option_str(ch, CURLOPT_URL, url, len, 0 TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
int _php_curl_verify_handlers(php_curl *ch, int reporterror TSRMLS_DC) /* {{{ */
|
||||
void _php_curl_verify_handlers(php_curl *ch, int reporterror TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
php_stream *stream;
|
||||
if (!ch || !ch->handlers) {
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ch->handlers->std_err) {
|
||||
@@ -265,7 +277,7 @@ int _php_curl_verify_handlers(php_curl *ch, int reporterror TSRMLS_DC) /* {{{ */
|
||||
curl_easy_setopt(ch->cp, CURLOPT_FILE, (void *) ch);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
return ;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1941,7 +1953,7 @@ PHP_FUNCTION(curl_init)
|
||||
_php_curl_set_default_options(ch);
|
||||
|
||||
if (url) {
|
||||
if (!php_curl_option_url(ch, url, url_len TSRMLS_CC)) {
|
||||
if (php_curl_option_url(ch, url, url_len TSRMLS_CC) == FAILURE) {
|
||||
_php_curl_close_ex(ch TSRMLS_CC);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -2058,7 +2070,7 @@ PHP_FUNCTION(curl_copy_handle)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *return_value TSRMLS_DC) /* {{{ */
|
||||
static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
CURLcode error=CURLE_OK;
|
||||
|
||||
@@ -2225,7 +2237,6 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
|
||||
if ((option == CURLOPT_PROTOCOLS || option == CURLOPT_REDIR_PROTOCOLS) &&
|
||||
(PG(open_basedir) && *PG(open_basedir)) && (Z_LVAL_PP(zvalue) & CURLPROTO_FILE)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLPROTO_FILE cannot be activated when an open_basedir is set");
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
@@ -2240,14 +2251,10 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
|
||||
case CURLOPT_CAINFO:
|
||||
case CURLOPT_CAPATH:
|
||||
case CURLOPT_COOKIE:
|
||||
case CURLOPT_CUSTOMREQUEST:
|
||||
case CURLOPT_EGDSOCKET:
|
||||
case CURLOPT_FTPPORT:
|
||||
case CURLOPT_INTERFACE:
|
||||
case CURLOPT_PRIVATE:
|
||||
case CURLOPT_PROXY:
|
||||
case CURLOPT_PROXYUSERPWD:
|
||||
case CURLOPT_RANGE:
|
||||
case CURLOPT_REFERER:
|
||||
case CURLOPT_SSLCERTTYPE:
|
||||
case CURLOPT_SSLENGINE:
|
||||
@@ -2256,23 +2263,14 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
|
||||
case CURLOPT_SSLKEYPASSWD:
|
||||
case CURLOPT_SSLKEYTYPE:
|
||||
case CURLOPT_SSL_CIPHER_LIST:
|
||||
case CURLOPT_URL:
|
||||
case CURLOPT_USERAGENT:
|
||||
case CURLOPT_USERPWD:
|
||||
#if LIBCURL_VERSION_NUM >= 0x070d00 /* Available since 7.13.0 */
|
||||
case CURLOPT_FTP_ACCOUNT:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x070e01 /* Available since 7.14.1 */
|
||||
case CURLOPT_COOKIELIST:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x070f05 /* Available since 7.15.5 */
|
||||
case CURLOPT_FTP_ALTERNATIVE_TO_USER:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x071004 /* Available since 7.16.4 */
|
||||
case CURLOPT_KRBLEVEL:
|
||||
#else
|
||||
case CURLOPT_KRB4LEVEL:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x071101 /* Available since 7.17.1 */
|
||||
case CURLOPT_SSH_HOST_PUBLIC_KEY_MD5:
|
||||
#endif
|
||||
@@ -2287,7 +2285,6 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x071400 /* Available since 7.20.0 */
|
||||
case CURLOPT_MAIL_FROM:
|
||||
case CURLOPT_RTSP_SESSION_ID:
|
||||
case CURLOPT_RTSP_STREAM_URI:
|
||||
case CURLOPT_RTSP_TRANSPORT:
|
||||
#endif
|
||||
@@ -2309,32 +2306,44 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
|
||||
#endif
|
||||
{
|
||||
convert_to_string_ex(zvalue);
|
||||
if (option == CURLOPT_URL) {
|
||||
if (!php_curl_option_url(ch, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue) TSRMLS_CC)) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if (option == CURLOPT_PRIVATE) {
|
||||
char *copystr;
|
||||
#if LIBCURL_VERSION_NUM < 0x071100
|
||||
string_copy:
|
||||
return php_curl_option_str(ch, option, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue), 0 TSRMLS_CC);
|
||||
}
|
||||
|
||||
/* Curl nullable string options */
|
||||
case CURLOPT_CUSTOMREQUEST:
|
||||
case CURLOPT_FTPPORT:
|
||||
case CURLOPT_RANGE:
|
||||
#if LIBCURL_VERSION_NUM >= 0x070d00 /* Available since 7.13.0 */
|
||||
case CURLOPT_FTP_ACCOUNT:
|
||||
#endif
|
||||
copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
|
||||
error = curl_easy_setopt(ch->cp, option, copystr);
|
||||
zend_llist_add_element(&ch->to_free->str, ©str);
|
||||
} else {
|
||||
#if LIBCURL_VERSION_NUM >= 0x071100
|
||||
/* Strings passed to libcurl as ’char *’ arguments, are copied by the library... NOTE: before 7.17.0 strings were not copied. */
|
||||
error = curl_easy_setopt(ch->cp, option, Z_STRVAL_PP(zvalue));
|
||||
#if LIBCURL_VERSION_NUM >= 0x071400 /* Available since 7.20.0 */
|
||||
case CURLOPT_RTSP_SESSION_ID:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x071004 /* Available since 7.16.4 */
|
||||
case CURLOPT_KRBLEVEL:
|
||||
#else
|
||||
goto string_copy;
|
||||
case CURLOPT_KRB4LEVEL:
|
||||
#endif
|
||||
}
|
||||
{
|
||||
if (Z_TYPE_PP(zvalue) == IS_NULL) {
|
||||
error = curl_easy_setopt(ch->cp, option, NULL);
|
||||
} else {
|
||||
convert_to_string_ex(zvalue);
|
||||
return php_curl_option_str(ch, option, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue), 0 TSRMLS_CC);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* Curl private option */
|
||||
case CURLOPT_PRIVATE:
|
||||
convert_to_string_ex(zvalue);
|
||||
return php_curl_option_str(ch, option, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue), 1 TSRMLS_CC);
|
||||
|
||||
/* Curl url option */
|
||||
case CURLOPT_URL:
|
||||
convert_to_string_ex(zvalue);
|
||||
return php_curl_option_url(ch, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue) TSRMLS_CC);
|
||||
|
||||
/* Curl file handle options */
|
||||
case CURLOPT_FILE:
|
||||
case CURLOPT_INFILE:
|
||||
@@ -2346,18 +2355,15 @@ string_copy:
|
||||
|
||||
what = zend_fetch_resource(zvalue TSRMLS_CC, -1, "File-Handle", &type, 1, php_file_le_stream(), php_file_le_pstream());
|
||||
if (!what) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (FAILURE == php_stream_cast((php_stream *) what, PHP_STREAM_AS_STDIO, (void *) &fp, REPORT_ERRORS)) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (!fp) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
error = CURLE_OK;
|
||||
@@ -2373,8 +2379,7 @@ string_copy:
|
||||
ch->handlers->write->stream = *zvalue;
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "the provided file handle is not writable");
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
break;
|
||||
case CURLOPT_WRITEHEADER:
|
||||
@@ -2388,8 +2393,7 @@ string_copy:
|
||||
ch->handlers->write_header->stream = *zvalue;
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "the provided file handle is not writable");
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
break;
|
||||
case CURLOPT_INFILE:
|
||||
@@ -2410,8 +2414,7 @@ string_copy:
|
||||
ch->handlers->std_err = *zvalue;
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "the provided file handle is not writable");
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
/* break omitted intentionally */
|
||||
default:
|
||||
@@ -2473,8 +2476,7 @@ string_copy:
|
||||
#endif
|
||||
}
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must pass either an object or an array with the %s argument", name);
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
for (zend_hash_internal_pointer_reset(ph);
|
||||
@@ -2487,7 +2489,6 @@ string_copy:
|
||||
slist = curl_slist_append(slist, Z_STRVAL_PP(current));
|
||||
if (!slist) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not build curl_slist");
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -2507,8 +2508,7 @@ string_copy:
|
||||
if (PG(open_basedir) && *PG(open_basedir)) {
|
||||
if (Z_LVAL_PP(zvalue) != 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set");
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
error = curl_easy_setopt(ch->cp, option, Z_LVAL_PP(zvalue));
|
||||
@@ -2534,8 +2534,7 @@ string_copy:
|
||||
postfields = HASH_OF(*zvalue);
|
||||
if (!postfields) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't get HashTable in CURLOPT_POSTFIELDS");
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
for (zend_hash_internal_pointer_reset(postfields);
|
||||
@@ -2571,7 +2570,6 @@ string_copy:
|
||||
postval = Z_STRVAL_P(prop);
|
||||
|
||||
if (php_check_open_basedir(postval TSRMLS_CC)) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -2620,8 +2618,7 @@ string_copy:
|
||||
}
|
||||
/* open_basedir check */
|
||||
if (php_check_open_basedir(postval TSRMLS_CC)) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
error = curl_formadd(&first, &last,
|
||||
CURLFORM_COPYNAME, string_key,
|
||||
@@ -2652,8 +2649,7 @@ string_copy:
|
||||
|
||||
SAVE_CURL_ERROR(ch, error);
|
||||
if (error != CURLE_OK) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (Z_REFCOUNT_P(ch->clone) <= 1) {
|
||||
@@ -2675,7 +2671,7 @@ string_copy:
|
||||
post = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
|
||||
zend_llist_add_element(&ch->to_free->str, &post);
|
||||
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, post);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, post);
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRLEN_PP(zvalue));
|
||||
#endif
|
||||
}
|
||||
@@ -2773,26 +2769,13 @@ string_copy:
|
||||
case CURLOPT_SSH_KNOWNHOSTS:
|
||||
#endif
|
||||
{
|
||||
#if LIBCURL_VERSION_NUM < 0x071100
|
||||
char *copystr = NULL;
|
||||
#endif
|
||||
|
||||
convert_to_string_ex(zvalue);
|
||||
|
||||
if (Z_STRLEN_PP(zvalue) && php_check_open_basedir(Z_STRVAL_PP(zvalue) TSRMLS_CC)) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x071100
|
||||
error = curl_easy_setopt(ch->cp, option, Z_STRVAL_PP(zvalue));
|
||||
#else
|
||||
copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
|
||||
|
||||
error = curl_easy_setopt(ch->cp, option, copystr);
|
||||
zend_llist_add_element(&ch->to_free->str, ©str);
|
||||
#endif
|
||||
break;
|
||||
return php_curl_option_str(ch, option, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue), 0 TSRMLS_CC);
|
||||
}
|
||||
|
||||
case CURLINFO_HEADER_OUT:
|
||||
@@ -2837,9 +2820,9 @@ string_copy:
|
||||
|
||||
SAVE_CURL_ERROR(ch, error);
|
||||
if (error != CURLE_OK) {
|
||||
return 1;
|
||||
return FAILURE;
|
||||
} else {
|
||||
return 0;
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2863,7 +2846,7 @@ PHP_FUNCTION(curl_setopt)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (!_php_curl_setopt(ch, options, zvalue, return_value TSRMLS_CC)) {
|
||||
if (_php_curl_setopt(ch, options, zvalue TSRMLS_CC) == SUCCESS) {
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
@@ -2894,7 +2877,7 @@ PHP_FUNCTION(curl_setopt_array)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array keys must be CURLOPT constants or equivalent integer values");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (_php_curl_setopt(ch, (long) option, entry, return_value TSRMLS_CC)) {
|
||||
if (_php_curl_setopt(ch, (long) option, entry TSRMLS_CC) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
zend_hash_move_forward_ex(Z_ARRVAL_P(arr), &pos);
|
||||
@@ -3159,6 +3142,7 @@ PHP_FUNCTION(curl_getinfo)
|
||||
}
|
||||
break;
|
||||
}
|
||||
#if LIBCURL_VERSION_NUM >= 0x070c03 /* Available since 7.12.3 */
|
||||
case CURLINFO_SLIST:
|
||||
{
|
||||
struct curl_slist *slist;
|
||||
@@ -3174,6 +3158,7 @@ PHP_FUNCTION(curl_getinfo)
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
+1
-1
@@ -198,7 +198,7 @@ typedef struct {
|
||||
|
||||
void _php_curl_cleanup_handle(php_curl *);
|
||||
void _php_curl_multi_cleanup_list(void *data);
|
||||
int _php_curl_verify_handlers(php_curl *ch, int reporterror TSRMLS_DC);
|
||||
void _php_curl_verify_handlers(php_curl *ch, int reporterror TSRMLS_DC);
|
||||
|
||||
void curlfile_register_class(TSRMLS_D);
|
||||
PHP_CURL_API extern zend_class_entry *curl_CURLFile_class;
|
||||
|
||||
@@ -81,8 +81,7 @@ Ok for CURLOPT_WRITEHEADER
|
||||
Warning: curl_multi_exec(): CURLOPT_FILE resource has gone away, resetting to default in %sbug48203_multi.php on line 36
|
||||
|
||||
Warning: curl_multi_exec(): CURLOPT_FILE resource has gone away, resetting to default in %sbug48203_multi.php on line 36
|
||||
%A
|
||||
Ok for CURLOPT_FILE
|
||||
%AOk for CURLOPT_FILE
|
||||
|
||||
Warning: curl_multi_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %sbug48203_multi.php on line 36
|
||||
|
||||
|
||||
@@ -58,15 +58,14 @@ foreach($options_to_check as $option) {
|
||||
--EXPECTF--
|
||||
Warning: curl_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %sbug54798.php on line %d
|
||||
* About to connect() %a
|
||||
* Closing connection #%d
|
||||
* Closing connection %d
|
||||
Ok for CURLOPT_STDERR
|
||||
|
||||
Warning: curl_exec(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in %sbug54798.php on line 24
|
||||
Ok for CURLOPT_WRITEHEADER
|
||||
|
||||
Warning: curl_exec(): CURLOPT_FILE resource has gone away, resetting to default in %sbug54798.php on line 24
|
||||
%a
|
||||
Ok for CURLOPT_FILE
|
||||
%aOk for CURLOPT_FILE
|
||||
|
||||
Warning: curl_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %sbug54798.php on line %d
|
||||
Ok for CURLOPT_INFILE
|
||||
@@ -17,9 +17,7 @@ open_basedir="c:/tmp"
|
||||
?>
|
||||
--EXPECTF--
|
||||
%a
|
||||
|
||||
Warning: curl_setopt(): open_basedir restriction in effect. File(c:/tmp/foo) is not within the allowed path(s): (c:/tmp) in %sbug61948-win32.php on line %d
|
||||
bool(false)
|
||||
bool(true)
|
||||
|
||||
Warning: curl_setopt(): open_basedir restriction in effect. File(c:/xxx/bar) is not within the allowed path(s): (c:/tmp) in %sbug61948-win32.php on line %d
|
||||
bool(false)
|
||||
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Bug #66109 (Option CURLOPT_CUSTOMREQUEST can't be reset to default.)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
exit("skip curl extension not loaded");
|
||||
}
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, "{$host}/get.php?test=method");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
|
||||
var_dump(curl_exec($ch));
|
||||
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, NULL);
|
||||
var_dump(curl_exec($ch));
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(6) "DELETE"
|
||||
string(3) "GET"
|
||||
@@ -33,6 +33,5 @@ echo "Closed correctly\n";
|
||||
<?php
|
||||
unlink(dirname(__FILE__) . '/curl_file_deleted_before_curl_close.tmp');
|
||||
?>
|
||||
--EXPECTF--
|
||||
* Closing connection #%d
|
||||
--EXPECT--
|
||||
Closed correctly
|
||||
@@ -48,5 +48,4 @@ curl_close($ch);
|
||||
*** Testing curl_setopt with CURLOPT_STDERR
|
||||
string(%d) "%S"
|
||||
string(%d) "%S"
|
||||
* Closing connection #%d
|
||||
|
||||
@@ -31,6 +31,9 @@
|
||||
echo $_FILES['file']['name'] . '|' . $_FILES['file']['type'];
|
||||
}
|
||||
break;
|
||||
case 'method':
|
||||
echo $_SERVER['REQUEST_METHOD'];
|
||||
break;
|
||||
default:
|
||||
echo "Hello World!\n";
|
||||
echo "Hello World!";
|
||||
|
||||
+42
-40
@@ -1,40 +1,42 @@
|
||||
{ "sst", 0, -11, "Pacific/Apia" },
|
||||
{ "hst", 0, -10, "Pacific/Honolulu" },
|
||||
{ "akst", 0, -9, "America/Anchorage" },
|
||||
{ "akdt", 1, -8, "America/Anchorage" },
|
||||
{ "pst", 0, -8, "America/Los_Angeles" },
|
||||
{ "pdt", 1, -7, "America/Los_Angeles" },
|
||||
{ "mst", 0, -7, "America/Denver" },
|
||||
{ "mdt", 1, -6, "America/Denver" },
|
||||
{ "cst", 0, -6, "America/Chicago" },
|
||||
{ "cdt", 1, -5, "America/Chicago" },
|
||||
{ "est", 0, -5, "America/New_York" },
|
||||
{ "edt", 1, -4, "America/New_York" },
|
||||
{ "ast", 0, -4, "America/Halifax" },
|
||||
{ "adt", 1, -3, "America/Halifax" },
|
||||
{ "brt", 0, -3, "America/Sao_Paulo" },
|
||||
{ "brst", 1, -2, "America/Sao_Paulo" },
|
||||
{ "azost", 0, -1, "Atlantic/Azores" },
|
||||
{ "azodt", 1, 0, "Atlantic/Azores" },
|
||||
{ "gmt", 0, 0, "Europe/London" },
|
||||
{ "bst", 1, 1, "Europe/London" },
|
||||
{ "cet", 0, 1, "Europe/Paris" },
|
||||
{ "cest", 1, 2, "Europe/Paris" },
|
||||
{ "eet", 0, 2, "Europe/Helsinki" },
|
||||
{ "eest", 1, 3, "Europe/Helsinki" },
|
||||
{ "msk", 0, 3, "Europe/Moscow" },
|
||||
{ "msd", 1, 4, "Europe/Moscow" },
|
||||
{ "gst", 0, 4, "Asia/Dubai" },
|
||||
{ "pkt", 0, 5, "Asia/Karachi" },
|
||||
{ "ist", 0, 5.5, "Asia/Kolkata" },
|
||||
{ "npt", 0, 5.75, "Asia/Katmandu" },
|
||||
{ "yekt", 1, 6, "Asia/Yekaterinburg" },
|
||||
{ "novst", 1, 7, "Asia/Novosibirsk" },
|
||||
{ "krat", 0, 7, "Asia/Krasnoyarsk" },
|
||||
{ "krast", 1, 8, "Asia/Krasnoyarsk" },
|
||||
{ "jst", 0, 9, "Asia/Tokyo" },
|
||||
{ "est", 0, 10, "Australia/Melbourne" },
|
||||
{ "cst", 1, 10.5, "Australia/Adelaide" },
|
||||
{ "est", 1, 11, "Australia/Melbourne" },
|
||||
{ "nzst", 0, 12, "Pacific/Auckland" },
|
||||
{ "nzdt", 1, 13, "Pacific/Auckland" },
|
||||
{ "sst", 0, -660, "Pacific/Apia" },
|
||||
{ "hst", 0, -600, "Pacific/Honolulu" },
|
||||
{ "akst", 0, -540, "America/Anchorage" },
|
||||
{ "akdt", 1, -480, "America/Anchorage" },
|
||||
{ "pst", 0, -480, "America/Los_Angeles" },
|
||||
{ "pdt", 1, -420, "America/Los_Angeles" },
|
||||
{ "mst", 0, -420, "America/Denver" },
|
||||
{ "mdt", 1, -360, "America/Denver" },
|
||||
{ "cst", 0, -360, "America/Chicago" },
|
||||
{ "cdt", 1, -300, "America/Chicago" },
|
||||
{ "est", 0, -300, "America/New_York" },
|
||||
{ "vet", 0, -270, "America/Caracas" },
|
||||
{ "edt", 1, -240, "America/New_York" },
|
||||
{ "ast", 0, -240, "America/Halifax" },
|
||||
{ "adt", 1, -180, "America/Halifax" },
|
||||
{ "brt", 0, -180, "America/Sao_Paulo" },
|
||||
{ "brst", 1, -120, "America/Sao_Paulo" },
|
||||
{ "azost", 0, -60, "Atlantic/Azores" },
|
||||
{ "azodt", 1, 0, "Atlantic/Azores" },
|
||||
{ "gmt", 0, 0, "Europe/London" },
|
||||
{ "bst", 1, 60, "Europe/London" },
|
||||
{ "cet", 0, 60, "Europe/Paris" },
|
||||
{ "cest", 1, 120, "Europe/Paris" },
|
||||
{ "eet", 0, 120, "Europe/Helsinki" },
|
||||
{ "eest", 1, 180, "Europe/Helsinki" },
|
||||
{ "msk", 0, 180, "Europe/Moscow" },
|
||||
{ "msd", 1, 240, "Europe/Moscow" },
|
||||
{ "gst", 0, 240, "Asia/Dubai" },
|
||||
{ "pkt", 0, 300, "Asia/Karachi" },
|
||||
{ "ist", 0, 330, "Asia/Kolkata" },
|
||||
{ "npt", 0, 345, "Asia/Katmandu" },
|
||||
{ "yekt", 1, 360, "Asia/Yekaterinburg" },
|
||||
{ "novst", 1, 420, "Asia/Novosibirsk" },
|
||||
{ "krat", 0, 420, "Asia/Krasnoyarsk" },
|
||||
{ "cst", 0, 480, "Asia/Shanghai" },
|
||||
{ "krast", 1, 480, "Asia/Krasnoyarsk" },
|
||||
{ "jst", 0, 540, "Asia/Tokyo" },
|
||||
{ "est", 0, 600, "Australia/Melbourne" },
|
||||
{ "cst", 1, 630, "Australia/Adelaide" },
|
||||
{ "est", 1, 660, "Australia/Melbourne" },
|
||||
{ "nzst", 0, 720, "Pacific/Auckland" },
|
||||
{ "nzdt", 1, 780, "Pacific/Auckland" },
|
||||
+11
-11
@@ -1,10 +1,10 @@
|
||||
/* Generated by re2c 0.13.5 on Sun Aug 25 15:12:48 2013 */
|
||||
/* Generated by re2c 0.13.5 on Thu Feb 6 07:35:53 2014 */
|
||||
#line 1 "ext/date/lib/parse_date.re"
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2014 The PHP Group |
|
||||
| Copyright (c) 1997-2013 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -717,7 +717,7 @@ const static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffs
|
||||
/* Still didn't find anything, let's find the zone solely based on
|
||||
* offset/isdst then */
|
||||
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
|
||||
if ((fmp->gmtoffset * 3600) == gmtoffset && fmp->type == isdst) {
|
||||
if ((fmp->gmtoffset * 60) == gmtoffset && fmp->type == isdst) {
|
||||
return fmp;
|
||||
}
|
||||
}
|
||||
@@ -751,7 +751,7 @@ static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found
|
||||
return value;
|
||||
}
|
||||
|
||||
static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper)
|
||||
long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper)
|
||||
{
|
||||
timelib_tzinfo *res;
|
||||
long retval = 0;
|
||||
@@ -1006,7 +1006,7 @@ yy4:
|
||||
DEBUG_OUTPUT("tzcorrection | tz");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_TZ();
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
@@ -4468,7 +4468,7 @@ yy223:
|
||||
}
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
@@ -9798,7 +9798,7 @@ yy491:
|
||||
}
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
@@ -12073,7 +12073,7 @@ yy701:
|
||||
s->time->h = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->i = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
@@ -13464,7 +13464,7 @@ yy843:
|
||||
if (*ptr == '.') {
|
||||
s->time->f = timelib_get_frac_nr((char **) &ptr, 9);
|
||||
if (*ptr) { /* timezone is optional */
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
@@ -15813,7 +15813,7 @@ yy1076:
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
@@ -25047,7 +25047,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
||||
case 'O': /* timezone */
|
||||
{
|
||||
int tz_not_found;
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_pbf_error(s, "The timezone could not be found in the database", string, begin);
|
||||
}
|
||||
|
||||
+10
-10
@@ -715,7 +715,7 @@ const static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffs
|
||||
/* Still didn't find anything, let's find the zone solely based on
|
||||
* offset/isdst then */
|
||||
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
|
||||
if ((fmp->gmtoffset * 3600) == gmtoffset && fmp->type == isdst) {
|
||||
if ((fmp->gmtoffset * 60) == gmtoffset && fmp->type == isdst) {
|
||||
return fmp;
|
||||
}
|
||||
}
|
||||
@@ -749,7 +749,7 @@ static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found
|
||||
return value;
|
||||
}
|
||||
|
||||
static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper)
|
||||
long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper)
|
||||
{
|
||||
timelib_tzinfo *res;
|
||||
long retval = 0;
|
||||
@@ -1161,7 +1161,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
}
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
@@ -1202,7 +1202,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
s->time->h = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->i = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->s = 0;
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, s->tzdb, tz_get_wrapper);
|
||||
break;
|
||||
case 1:
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
@@ -1227,7 +1227,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
@@ -1429,7 +1429,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
if (*ptr == '.') {
|
||||
s->time->f = timelib_get_frac_nr((char **) &ptr, 9);
|
||||
if (*ptr) { /* timezone is optional */
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
@@ -1532,7 +1532,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
s->time->h = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->i = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
@@ -1645,7 +1645,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
DEBUG_OUTPUT("tzcorrection | tz");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_TZ();
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
@@ -1698,7 +1698,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
}
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
@@ -2054,7 +2054,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
||||
case 'O': /* timezone */
|
||||
{
|
||||
int tz_not_found;
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_pbf_error(s, "The timezone could not be found in the database", string, begin);
|
||||
}
|
||||
|
||||
@@ -92,6 +92,8 @@ int timelib_apply_localtime(timelib_time *t, unsigned int localtime);
|
||||
void timelib_unixtime2gmt(timelib_time* tm, timelib_sll ts);
|
||||
void timelib_unixtime2local(timelib_time *tm, timelib_sll ts);
|
||||
void timelib_update_from_sse(timelib_time *tm);
|
||||
void timelib_set_timezone_from_offset(timelib_time *t, timelib_sll utc_offset);
|
||||
void timelib_set_timezone_from_abbr(timelib_time *t, timelib_abbr_info abbr_info);
|
||||
void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz);
|
||||
|
||||
/* From parse_tz.c */
|
||||
@@ -103,6 +105,7 @@ timelib_sll timelib_get_current_offset(timelib_time *t);
|
||||
void timelib_dump_tzinfo(timelib_tzinfo *tz);
|
||||
const timelib_tzdb *timelib_builtin_db(void);
|
||||
const timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int *count);
|
||||
long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper);
|
||||
|
||||
/* From timelib.c */
|
||||
timelib_tzinfo* timelib_tzinfo_ctor(char *name);
|
||||
|
||||
@@ -172,6 +172,12 @@ typedef struct timelib_time {
|
||||
* 2 TimeZone abbreviation */
|
||||
} timelib_time;
|
||||
|
||||
typedef struct timelib_abbr_info {
|
||||
timelib_sll utc_offset;
|
||||
char *abbr;
|
||||
int dst;
|
||||
} timelib_abbr_info;
|
||||
|
||||
typedef struct timelib_error_message {
|
||||
int position;
|
||||
char character;
|
||||
|
||||
+207
-207
@@ -435,152 +435,152 @@ const timelib_tzdb_index_entry timezonedb_idx_builtin[579] = {
|
||||
{ "Europe/Jersey" , 0x02EA09 },
|
||||
{ "Europe/Kaliningrad" , 0x02EF40 },
|
||||
{ "Europe/Kiev" , 0x02F1A6 },
|
||||
{ "Europe/Lisbon" , 0x02F4BD },
|
||||
{ "Europe/Ljubljana" , 0x02F9C1 },
|
||||
{ "Europe/London" , 0x02FC8A },
|
||||
{ "Europe/Luxembourg" , 0x0301C1 },
|
||||
{ "Europe/Madrid" , 0x030617 },
|
||||
{ "Europe/Malta" , 0x0309DD },
|
||||
{ "Europe/Mariehamn" , 0x030D96 },
|
||||
{ "Europe/Minsk" , 0x03104C },
|
||||
{ "Europe/Monaco" , 0x03125A },
|
||||
{ "Europe/Moscow" , 0x031695 },
|
||||
{ "Europe/Nicosia" , 0x0318E6 },
|
||||
{ "Europe/Oslo" , 0x031BCE },
|
||||
{ "Europe/Paris" , 0x031F00 },
|
||||
{ "Europe/Podgorica" , 0x032346 },
|
||||
{ "Europe/Prague" , 0x03260F },
|
||||
{ "Europe/Riga" , 0x032941 },
|
||||
{ "Europe/Rome" , 0x032C86 },
|
||||
{ "Europe/Samara" , 0x033049 },
|
||||
{ "Europe/San_Marino" , 0x03327C },
|
||||
{ "Europe/Sarajevo" , 0x03363F },
|
||||
{ "Europe/Simferopol" , 0x033908 },
|
||||
{ "Europe/Skopje" , 0x033C33 },
|
||||
{ "Europe/Sofia" , 0x033EFC },
|
||||
{ "Europe/Stockholm" , 0x034204 },
|
||||
{ "Europe/Tallinn" , 0x0344B3 },
|
||||
{ "Europe/Tirane" , 0x0347ED },
|
||||
{ "Europe/Tiraspol" , 0x034AF3 },
|
||||
{ "Europe/Uzhgorod" , 0x034E81 },
|
||||
{ "Europe/Vaduz" , 0x035198 },
|
||||
{ "Europe/Vatican" , 0x035447 },
|
||||
{ "Europe/Vienna" , 0x03580A },
|
||||
{ "Europe/Vilnius" , 0x035B37 },
|
||||
{ "Europe/Volgograd" , 0x035E76 },
|
||||
{ "Europe/Warsaw" , 0x036076 },
|
||||
{ "Europe/Zagreb" , 0x036457 },
|
||||
{ "Europe/Zaporozhye" , 0x036720 },
|
||||
{ "Europe/Zurich" , 0x036A61 },
|
||||
{ "Factory" , 0x036D10 },
|
||||
{ "GB" , 0x036D81 },
|
||||
{ "GB-Eire" , 0x0372B8 },
|
||||
{ "GMT" , 0x0377EF },
|
||||
{ "GMT+0" , 0x0378BB },
|
||||
{ "GMT-0" , 0x037877 },
|
||||
{ "GMT0" , 0x037833 },
|
||||
{ "Greenwich" , 0x0378FF },
|
||||
{ "Hongkong" , 0x037943 },
|
||||
{ "HST" , 0x037B05 },
|
||||
{ "Iceland" , 0x037B49 },
|
||||
{ "Indian/Antananarivo" , 0x037D02 },
|
||||
{ "Indian/Chagos" , 0x037D76 },
|
||||
{ "Indian/Christmas" , 0x037DD8 },
|
||||
{ "Indian/Cocos" , 0x037E1C },
|
||||
{ "Indian/Comoro" , 0x037E60 },
|
||||
{ "Indian/Kerguelen" , 0x037EB5 },
|
||||
{ "Indian/Mahe" , 0x037F0A },
|
||||
{ "Indian/Maldives" , 0x037F5F },
|
||||
{ "Indian/Mauritius" , 0x037FB4 },
|
||||
{ "Indian/Mayotte" , 0x03802A },
|
||||
{ "Indian/Reunion" , 0x03807F },
|
||||
{ "Iran" , 0x0380D4 },
|
||||
{ "Israel" , 0x038342 },
|
||||
{ "Jamaica" , 0x038671 },
|
||||
{ "Japan" , 0x038736 },
|
||||
{ "Kwajalein" , 0x0387BF },
|
||||
{ "Libya" , 0x038822 },
|
||||
{ "MET" , 0x03892B },
|
||||
{ "Mexico/BajaNorte" , 0x038C34 },
|
||||
{ "Mexico/BajaSur" , 0x038F9D },
|
||||
{ "Mexico/General" , 0x0391E2 },
|
||||
{ "MST" , 0x039440 },
|
||||
{ "MST7MDT" , 0x039484 },
|
||||
{ "Navajo" , 0x0397D5 },
|
||||
{ "NZ" , 0x039B4E },
|
||||
{ "NZ-CHAT" , 0x039ECC },
|
||||
{ "Pacific/Apia" , 0x03A1B4 },
|
||||
{ "Pacific/Auckland" , 0x03A350 },
|
||||
{ "Pacific/Chatham" , 0x03A6DC },
|
||||
{ "Pacific/Chuuk" , 0x03A9D3 },
|
||||
{ "Pacific/Easter" , 0x03AA2C },
|
||||
{ "Pacific/Efate" , 0x03AD8A },
|
||||
{ "Pacific/Enderbury" , 0x03AE50 },
|
||||
{ "Pacific/Fakaofo" , 0x03AEBE },
|
||||
{ "Pacific/Fiji" , 0x03AF0F },
|
||||
{ "Pacific/Funafuti" , 0x03B0A2 },
|
||||
{ "Pacific/Galapagos" , 0x03B0E6 },
|
||||
{ "Pacific/Gambier" , 0x03B15E },
|
||||
{ "Pacific/Guadalcanal" , 0x03B1C3 },
|
||||
{ "Pacific/Guam" , 0x03B218 },
|
||||
{ "Pacific/Honolulu" , 0x03B26E },
|
||||
{ "Pacific/Johnston" , 0x03B2E5 },
|
||||
{ "Pacific/Kiritimati" , 0x03B364 },
|
||||
{ "Pacific/Kosrae" , 0x03B3CF },
|
||||
{ "Pacific/Kwajalein" , 0x03B42C },
|
||||
{ "Pacific/Majuro" , 0x03B498 },
|
||||
{ "Pacific/Marquesas" , 0x03B4F7 },
|
||||
{ "Pacific/Midway" , 0x03B55E },
|
||||
{ "Pacific/Nauru" , 0x03B5E8 },
|
||||
{ "Pacific/Niue" , 0x03B660 },
|
||||
{ "Pacific/Norfolk" , 0x03B6BE },
|
||||
{ "Pacific/Noumea" , 0x03B713 },
|
||||
{ "Pacific/Pago_Pago" , 0x03B7A3 },
|
||||
{ "Pacific/Palau" , 0x03B82C },
|
||||
{ "Pacific/Pitcairn" , 0x03B870 },
|
||||
{ "Pacific/Pohnpei" , 0x03B8C5 },
|
||||
{ "Pacific/Ponape" , 0x03B91A },
|
||||
{ "Pacific/Port_Moresby" , 0x03B95F },
|
||||
{ "Pacific/Rarotonga" , 0x03B9A3 },
|
||||
{ "Pacific/Saipan" , 0x03BA7F },
|
||||
{ "Pacific/Samoa" , 0x03BAE2 },
|
||||
{ "Pacific/Tahiti" , 0x03BB6B },
|
||||
{ "Pacific/Tarawa" , 0x03BBD0 },
|
||||
{ "Pacific/Tongatapu" , 0x03BC24 },
|
||||
{ "Pacific/Truk" , 0x03BCB0 },
|
||||
{ "Pacific/Wake" , 0x03BCF5 },
|
||||
{ "Pacific/Wallis" , 0x03BD45 },
|
||||
{ "Pacific/Yap" , 0x03BD89 },
|
||||
{ "Poland" , 0x03BDCE },
|
||||
{ "Portugal" , 0x03C1AF },
|
||||
{ "PRC" , 0x03C6AB },
|
||||
{ "PST8PDT" , 0x03C75C },
|
||||
{ "ROC" , 0x03CAAD },
|
||||
{ "ROK" , 0x03CBC5 },
|
||||
{ "Singapore" , 0x03CC69 },
|
||||
{ "Turkey" , 0x03CD20 },
|
||||
{ "UCT" , 0x03D10D },
|
||||
{ "Universal" , 0x03D151 },
|
||||
{ "US/Alaska" , 0x03D195 },
|
||||
{ "US/Aleutian" , 0x03D4FE },
|
||||
{ "US/Arizona" , 0x03D864 },
|
||||
{ "US/Central" , 0x03D8F2 },
|
||||
{ "US/East-Indiana" , 0x03E2FC },
|
||||
{ "US/Eastern" , 0x03DDFD },
|
||||
{ "US/Hawaii" , 0x03E566 },
|
||||
{ "US/Indiana-Starke" , 0x03E5D7 },
|
||||
{ "US/Michigan" , 0x03E948 },
|
||||
{ "US/Mountain" , 0x03EC7F },
|
||||
{ "US/Pacific" , 0x03EFF8 },
|
||||
{ "US/Pacific-New" , 0x03F3FD },
|
||||
{ "US/Samoa" , 0x03F802 },
|
||||
{ "UTC" , 0x03F88B },
|
||||
{ "W-SU" , 0x03FB82 },
|
||||
{ "WET" , 0x03F8CF },
|
||||
{ "Zulu" , 0x03FDBC },
|
||||
{ "Europe/Lisbon" , 0x02F4C2 },
|
||||
{ "Europe/Ljubljana" , 0x02F9C6 },
|
||||
{ "Europe/London" , 0x02FC8F },
|
||||
{ "Europe/Luxembourg" , 0x0301C6 },
|
||||
{ "Europe/Madrid" , 0x03061C },
|
||||
{ "Europe/Malta" , 0x0309E2 },
|
||||
{ "Europe/Mariehamn" , 0x030D9B },
|
||||
{ "Europe/Minsk" , 0x031051 },
|
||||
{ "Europe/Monaco" , 0x03125F },
|
||||
{ "Europe/Moscow" , 0x03169A },
|
||||
{ "Europe/Nicosia" , 0x0318EB },
|
||||
{ "Europe/Oslo" , 0x031BD3 },
|
||||
{ "Europe/Paris" , 0x031F05 },
|
||||
{ "Europe/Podgorica" , 0x03234B },
|
||||
{ "Europe/Prague" , 0x032614 },
|
||||
{ "Europe/Riga" , 0x032946 },
|
||||
{ "Europe/Rome" , 0x032C8B },
|
||||
{ "Europe/Samara" , 0x03304E },
|
||||
{ "Europe/San_Marino" , 0x033281 },
|
||||
{ "Europe/Sarajevo" , 0x033644 },
|
||||
{ "Europe/Simferopol" , 0x03390D },
|
||||
{ "Europe/Skopje" , 0x033C38 },
|
||||
{ "Europe/Sofia" , 0x033F01 },
|
||||
{ "Europe/Stockholm" , 0x034209 },
|
||||
{ "Europe/Tallinn" , 0x0344B8 },
|
||||
{ "Europe/Tirane" , 0x0347F2 },
|
||||
{ "Europe/Tiraspol" , 0x034AF8 },
|
||||
{ "Europe/Uzhgorod" , 0x034E86 },
|
||||
{ "Europe/Vaduz" , 0x03519D },
|
||||
{ "Europe/Vatican" , 0x03544C },
|
||||
{ "Europe/Vienna" , 0x03580F },
|
||||
{ "Europe/Vilnius" , 0x035B3C },
|
||||
{ "Europe/Volgograd" , 0x035E7B },
|
||||
{ "Europe/Warsaw" , 0x03607B },
|
||||
{ "Europe/Zagreb" , 0x03645C },
|
||||
{ "Europe/Zaporozhye" , 0x036725 },
|
||||
{ "Europe/Zurich" , 0x036A66 },
|
||||
{ "Factory" , 0x036D15 },
|
||||
{ "GB" , 0x036D86 },
|
||||
{ "GB-Eire" , 0x0372BD },
|
||||
{ "GMT" , 0x0377F4 },
|
||||
{ "GMT+0" , 0x0378C0 },
|
||||
{ "GMT-0" , 0x03787C },
|
||||
{ "GMT0" , 0x037838 },
|
||||
{ "Greenwich" , 0x037904 },
|
||||
{ "Hongkong" , 0x037948 },
|
||||
{ "HST" , 0x037B0A },
|
||||
{ "Iceland" , 0x037B4E },
|
||||
{ "Indian/Antananarivo" , 0x037D07 },
|
||||
{ "Indian/Chagos" , 0x037D7B },
|
||||
{ "Indian/Christmas" , 0x037DDD },
|
||||
{ "Indian/Cocos" , 0x037E21 },
|
||||
{ "Indian/Comoro" , 0x037E65 },
|
||||
{ "Indian/Kerguelen" , 0x037EBA },
|
||||
{ "Indian/Mahe" , 0x037F0F },
|
||||
{ "Indian/Maldives" , 0x037F64 },
|
||||
{ "Indian/Mauritius" , 0x037FB9 },
|
||||
{ "Indian/Mayotte" , 0x03802F },
|
||||
{ "Indian/Reunion" , 0x038084 },
|
||||
{ "Iran" , 0x0380D9 },
|
||||
{ "Israel" , 0x038347 },
|
||||
{ "Jamaica" , 0x038676 },
|
||||
{ "Japan" , 0x03873B },
|
||||
{ "Kwajalein" , 0x0387C4 },
|
||||
{ "Libya" , 0x038827 },
|
||||
{ "MET" , 0x038930 },
|
||||
{ "Mexico/BajaNorte" , 0x038C39 },
|
||||
{ "Mexico/BajaSur" , 0x038FA2 },
|
||||
{ "Mexico/General" , 0x0391E7 },
|
||||
{ "MST" , 0x039445 },
|
||||
{ "MST7MDT" , 0x039489 },
|
||||
{ "Navajo" , 0x0397DA },
|
||||
{ "NZ" , 0x039B53 },
|
||||
{ "NZ-CHAT" , 0x039ED1 },
|
||||
{ "Pacific/Apia" , 0x03A1B9 },
|
||||
{ "Pacific/Auckland" , 0x03A355 },
|
||||
{ "Pacific/Chatham" , 0x03A6E1 },
|
||||
{ "Pacific/Chuuk" , 0x03A9D8 },
|
||||
{ "Pacific/Easter" , 0x03AA31 },
|
||||
{ "Pacific/Efate" , 0x03AD8F },
|
||||
{ "Pacific/Enderbury" , 0x03AE55 },
|
||||
{ "Pacific/Fakaofo" , 0x03AEC3 },
|
||||
{ "Pacific/Fiji" , 0x03AF14 },
|
||||
{ "Pacific/Funafuti" , 0x03B0A7 },
|
||||
{ "Pacific/Galapagos" , 0x03B0EB },
|
||||
{ "Pacific/Gambier" , 0x03B163 },
|
||||
{ "Pacific/Guadalcanal" , 0x03B1C8 },
|
||||
{ "Pacific/Guam" , 0x03B21D },
|
||||
{ "Pacific/Honolulu" , 0x03B273 },
|
||||
{ "Pacific/Johnston" , 0x03B2EA },
|
||||
{ "Pacific/Kiritimati" , 0x03B369 },
|
||||
{ "Pacific/Kosrae" , 0x03B3D4 },
|
||||
{ "Pacific/Kwajalein" , 0x03B431 },
|
||||
{ "Pacific/Majuro" , 0x03B49D },
|
||||
{ "Pacific/Marquesas" , 0x03B4FC },
|
||||
{ "Pacific/Midway" , 0x03B563 },
|
||||
{ "Pacific/Nauru" , 0x03B5ED },
|
||||
{ "Pacific/Niue" , 0x03B665 },
|
||||
{ "Pacific/Norfolk" , 0x03B6C3 },
|
||||
{ "Pacific/Noumea" , 0x03B718 },
|
||||
{ "Pacific/Pago_Pago" , 0x03B7A8 },
|
||||
{ "Pacific/Palau" , 0x03B831 },
|
||||
{ "Pacific/Pitcairn" , 0x03B875 },
|
||||
{ "Pacific/Pohnpei" , 0x03B8CA },
|
||||
{ "Pacific/Ponape" , 0x03B91F },
|
||||
{ "Pacific/Port_Moresby" , 0x03B964 },
|
||||
{ "Pacific/Rarotonga" , 0x03B9A8 },
|
||||
{ "Pacific/Saipan" , 0x03BA84 },
|
||||
{ "Pacific/Samoa" , 0x03BAE7 },
|
||||
{ "Pacific/Tahiti" , 0x03BB70 },
|
||||
{ "Pacific/Tarawa" , 0x03BBD5 },
|
||||
{ "Pacific/Tongatapu" , 0x03BC29 },
|
||||
{ "Pacific/Truk" , 0x03BCB5 },
|
||||
{ "Pacific/Wake" , 0x03BCFA },
|
||||
{ "Pacific/Wallis" , 0x03BD4A },
|
||||
{ "Pacific/Yap" , 0x03BD8E },
|
||||
{ "Poland" , 0x03BDD3 },
|
||||
{ "Portugal" , 0x03C1B4 },
|
||||
{ "PRC" , 0x03C6B0 },
|
||||
{ "PST8PDT" , 0x03C761 },
|
||||
{ "ROC" , 0x03CAB2 },
|
||||
{ "ROK" , 0x03CBCA },
|
||||
{ "Singapore" , 0x03CC6E },
|
||||
{ "Turkey" , 0x03CD25 },
|
||||
{ "UCT" , 0x03D112 },
|
||||
{ "Universal" , 0x03D156 },
|
||||
{ "US/Alaska" , 0x03D19A },
|
||||
{ "US/Aleutian" , 0x03D503 },
|
||||
{ "US/Arizona" , 0x03D869 },
|
||||
{ "US/Central" , 0x03D8F7 },
|
||||
{ "US/East-Indiana" , 0x03E301 },
|
||||
{ "US/Eastern" , 0x03DE02 },
|
||||
{ "US/Hawaii" , 0x03E56B },
|
||||
{ "US/Indiana-Starke" , 0x03E5DC },
|
||||
{ "US/Michigan" , 0x03E94D },
|
||||
{ "US/Mountain" , 0x03EC84 },
|
||||
{ "US/Pacific" , 0x03EFFD },
|
||||
{ "US/Pacific-New" , 0x03F402 },
|
||||
{ "US/Samoa" , 0x03F807 },
|
||||
{ "UTC" , 0x03F890 },
|
||||
{ "W-SU" , 0x03FB87 },
|
||||
{ "WET" , 0x03F8D4 },
|
||||
{ "Zulu" , 0x03FDC1 },
|
||||
};
|
||||
/* This is a generated file, do not modify */
|
||||
const unsigned char timelib_timezone_db_data_builtin[261632] = {
|
||||
const unsigned char timelib_timezone_db_data_builtin[261637] = {
|
||||
|
||||
|
||||
/* Africa/Abidjan */
|
||||
@@ -8126,7 +8126,7 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = {
|
||||
0xF9, 0xE1, 0xCA, 0x00, 0xFA, 0xF9, 0x39, 0xF0, 0xFB, 0x27, 0x42, 0x50, 0x08, 0x7C, 0x8B, 0xE0,
|
||||
0x08, 0xFD, 0xB0, 0xD0, 0x09, 0xF6, 0xEA, 0x60, 0x0A, 0xA6, 0x33, 0xD0, 0x1C, 0xBE, 0xF8, 0xE0,
|
||||
0x1D, 0x89, 0xF1, 0xD0, 0x1E, 0xCC, 0xFF, 0x60, 0x1F, 0x60, 0x99, 0x50, 0x20, 0x82, 0xB1, 0x60,
|
||||
0x21, 0x49, 0xB5, 0xD0, 0x22, 0x5D, 0x4D, 0x60, 0x23, 0x1F, 0x0B, 0xD0, 0x24, 0x5A, 0x30, 0x60,
|
||||
0x21, 0x49, 0xB5, 0xD0, 0x22, 0x5E, 0x9E, 0xE0, 0x23, 0x20, 0x5D, 0x50, 0x24, 0x5A, 0x30, 0x60,
|
||||
0x25, 0x00, 0x3F, 0x50, 0x26, 0x0B, 0xED, 0xE0, 0x26, 0xD6, 0xE6, 0xD0, 0x27, 0xEB, 0xCF, 0xE0,
|
||||
0x28, 0xC0, 0x03, 0x50, 0x29, 0xD4, 0xEC, 0x60, 0x2A, 0xA9, 0x1F, 0xD0, 0x2B, 0xBB, 0x65, 0xE0,
|
||||
0x2C, 0x89, 0x01, 0xD0, 0x2D, 0x9B, 0x47, 0xE0, 0x2E, 0x5F, 0xA9, 0x50, 0x2F, 0x7B, 0x29, 0xE0,
|
||||
@@ -8199,7 +8199,7 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = {
|
||||
0xF9, 0xE1, 0xCA, 0x00, 0xFA, 0xF9, 0x39, 0xF0, 0xFB, 0x27, 0x42, 0x50, 0x08, 0x7C, 0x8B, 0xE0,
|
||||
0x08, 0xFD, 0xB0, 0xD0, 0x09, 0xF6, 0xEA, 0x60, 0x0A, 0xA6, 0x33, 0xD0, 0x1C, 0xBE, 0xF8, 0xE0,
|
||||
0x1D, 0x89, 0xF1, 0xD0, 0x1E, 0xCC, 0xFF, 0x60, 0x1F, 0x60, 0x99, 0x50, 0x20, 0x82, 0xB1, 0x60,
|
||||
0x21, 0x49, 0xB5, 0xD0, 0x22, 0x5D, 0x4D, 0x60, 0x23, 0x1F, 0x0B, 0xD0, 0x24, 0x5A, 0x30, 0x60,
|
||||
0x21, 0x49, 0xB5, 0xD0, 0x22, 0x5E, 0x9E, 0xE0, 0x23, 0x20, 0x5D, 0x50, 0x24, 0x5A, 0x30, 0x60,
|
||||
0x25, 0x00, 0x3F, 0x50, 0x26, 0x0B, 0xED, 0xE0, 0x26, 0xD6, 0xE6, 0xD0, 0x27, 0xEB, 0xCF, 0xE0,
|
||||
0x28, 0xC0, 0x03, 0x50, 0x29, 0xD4, 0xEC, 0x60, 0x2A, 0xA9, 0x1F, 0xD0, 0x2B, 0xBB, 0x65, 0xE0,
|
||||
0x2C, 0x89, 0x01, 0xD0, 0x2D, 0x9B, 0x47, 0xE0, 0x2E, 0x5F, 0xA9, 0x50, 0x2F, 0x7B, 0x29, 0xE0,
|
||||
@@ -8375,7 +8375,7 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = {
|
||||
0x46, 0x05, 0xC9, 0x90, 0x47, 0x23, 0xDF, 0x10, 0x47, 0xEE, 0xE6, 0x10, 0x49, 0x03, 0xC1, 0x10,
|
||||
0x49, 0xCE, 0xC8, 0x10, 0x4A, 0xE3, 0xA3, 0x10, 0x4B, 0xAE, 0xAA, 0x10, 0x4C, 0xCC, 0xBF, 0x90,
|
||||
0x4D, 0x8F, 0xDD, 0x90, 0x4E, 0xAC, 0xA1, 0x90, 0x4F, 0x6E, 0x6E, 0x10, 0x50, 0x8C, 0x83, 0x90,
|
||||
0x51, 0x57, 0x8A, 0x90, 0x52, 0x6C, 0x65, 0x90, 0x53, 0x37, 0x6C, 0x90, 0x54, 0x4C, 0x47, 0x90,
|
||||
0x51, 0x57, 0x8A, 0x90, 0x52, 0x6C, 0x65, 0x90, 0x53, 0x38, 0xBE, 0x10, 0x54, 0x4C, 0x47, 0x90,
|
||||
0x55, 0x17, 0x4E, 0x90, 0x56, 0x2C, 0x29, 0x90, 0x56, 0xF7, 0x30, 0x90, 0x58, 0x15, 0x46, 0x10,
|
||||
0x58, 0xD7, 0x12, 0x90, 0x59, 0xF5, 0x28, 0x10, 0x5A, 0xB6, 0xF4, 0x90, 0x5B, 0xD5, 0x0A, 0x10,
|
||||
0x5C, 0xA0, 0x11, 0x10, 0x5D, 0xB4, 0xEC, 0x10, 0x5E, 0x7F, 0xF3, 0x10, 0x5F, 0x94, 0xCE, 0x10,
|
||||
@@ -8445,7 +8445,7 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = {
|
||||
0xE7, 0x11, 0xD2, 0x80, 0xE8, 0x27, 0xFF, 0x00, 0xE8, 0xE8, 0x4F, 0xD0, 0x08, 0x7C, 0x8B, 0xE0,
|
||||
0x08, 0xFD, 0xB0, 0xD0, 0x09, 0xF6, 0xEA, 0x60, 0x0A, 0xA6, 0x33, 0xD0, 0x1C, 0xBE, 0xF8, 0xE0,
|
||||
0x1D, 0x89, 0xF1, 0xD0, 0x1E, 0xCC, 0xFF, 0x60, 0x1F, 0x60, 0x99, 0x50, 0x20, 0x82, 0xB1, 0x60,
|
||||
0x21, 0x49, 0xB5, 0xD0, 0x22, 0x5D, 0x4D, 0x60, 0x23, 0x1F, 0x0B, 0xD0, 0x24, 0x5A, 0x30, 0x60,
|
||||
0x21, 0x49, 0xB5, 0xD0, 0x22, 0x5E, 0x9E, 0xE0, 0x23, 0x20, 0x5D, 0x50, 0x24, 0x5A, 0x30, 0x60,
|
||||
0x25, 0x00, 0x3F, 0x50, 0x26, 0x0B, 0xED, 0xE0, 0x26, 0xD6, 0xE6, 0xD0, 0x27, 0xEB, 0xCF, 0xE0,
|
||||
0x28, 0xC0, 0x03, 0x50, 0x29, 0xD4, 0xEC, 0x60, 0x2A, 0xA9, 0x1F, 0xD0, 0x2B, 0xBB, 0x65, 0xE0,
|
||||
0x2C, 0x89, 0x01, 0xD0, 0x2D, 0x9B, 0x47, 0xE0, 0x2E, 0x5F, 0xA9, 0x50, 0x2F, 0x7B, 0x29, 0xE0,
|
||||
@@ -9314,7 +9314,7 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = {
|
||||
0xE7, 0x11, 0xD2, 0x80, 0xE8, 0x27, 0xFF, 0x00, 0xE8, 0xE8, 0x4F, 0xD0, 0x08, 0x7C, 0x8B, 0xE0,
|
||||
0x08, 0xFD, 0xB0, 0xD0, 0x09, 0xF6, 0xEA, 0x60, 0x0A, 0xA6, 0x33, 0xD0, 0x1C, 0xBE, 0xF8, 0xE0,
|
||||
0x1D, 0x89, 0xF1, 0xD0, 0x1E, 0xCC, 0xFF, 0x60, 0x1F, 0x60, 0x99, 0x50, 0x20, 0x82, 0xB1, 0x60,
|
||||
0x21, 0x49, 0xB5, 0xD0, 0x22, 0x5D, 0x4D, 0x60, 0x23, 0x1F, 0x0B, 0xD0, 0x24, 0x5A, 0x30, 0x60,
|
||||
0x21, 0x49, 0xB5, 0xD0, 0x22, 0x5E, 0x9E, 0xE0, 0x23, 0x20, 0x5D, 0x50, 0x24, 0x5A, 0x30, 0x60,
|
||||
0x25, 0x00, 0x3F, 0x50, 0x26, 0x0B, 0xED, 0xE0, 0x26, 0xD6, 0xE6, 0xD0, 0x27, 0xEB, 0xCF, 0xE0,
|
||||
0x28, 0xC0, 0x03, 0x50, 0x29, 0xD4, 0xEC, 0x60, 0x2A, 0xA9, 0x1F, 0xD0, 0x2B, 0xBB, 0x65, 0xE0,
|
||||
0x2C, 0x89, 0x01, 0xD0, 0x2D, 0x9B, 0x47, 0xE0, 0x2E, 0x5F, 0xA9, 0x50, 0x2F, 0x7B, 0x29, 0xE0,
|
||||
@@ -13595,7 +13595,7 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = {
|
||||
0x46, 0x05, 0xC9, 0x90, 0x47, 0x23, 0xDF, 0x10, 0x47, 0xEE, 0xE6, 0x10, 0x49, 0x03, 0xC1, 0x10,
|
||||
0x49, 0xCE, 0xC8, 0x10, 0x4A, 0xE3, 0xA3, 0x10, 0x4B, 0xAE, 0xAA, 0x10, 0x4C, 0xCC, 0xBF, 0x90,
|
||||
0x4D, 0x8F, 0xDD, 0x90, 0x4E, 0xAC, 0xA1, 0x90, 0x4F, 0x6E, 0x6E, 0x10, 0x50, 0x8C, 0x83, 0x90,
|
||||
0x51, 0x57, 0x8A, 0x90, 0x52, 0x6C, 0x65, 0x90, 0x53, 0x37, 0x6C, 0x90, 0x54, 0x4C, 0x47, 0x90,
|
||||
0x51, 0x57, 0x8A, 0x90, 0x52, 0x6C, 0x65, 0x90, 0x53, 0x38, 0xBE, 0x10, 0x54, 0x4C, 0x47, 0x90,
|
||||
0x55, 0x17, 0x4E, 0x90, 0x56, 0x2C, 0x29, 0x90, 0x56, 0xF7, 0x30, 0x90, 0x58, 0x15, 0x46, 0x10,
|
||||
0x58, 0xD7, 0x12, 0x90, 0x59, 0xF5, 0x28, 0x10, 0x5A, 0xB6, 0xF4, 0x90, 0x5B, 0xD5, 0x0A, 0x10,
|
||||
0x5C, 0xA0, 0x11, 0x10, 0x5D, 0xB4, 0xEC, 0x10, 0x5E, 0x7F, 0xF3, 0x10, 0x5F, 0x94, 0xCE, 0x10,
|
||||
@@ -13756,54 +13756,54 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = {
|
||||
/* Europe/Kiev */
|
||||
0x50, 0x48, 0x50, 0x31, 0x01, 0x55, 0x41, 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, 0x77, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x1E, 0xAA, 0x19, 0xA7, 0x64,
|
||||
0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x1E, 0xAA, 0x19, 0xA7, 0x64,
|
||||
0xB5, 0xA4, 0x19, 0x60, 0xCA, 0xCD, 0x2E, 0xD0, 0xCC, 0xE7, 0x4B, 0x10, 0xCD, 0xA9, 0x17, 0x90,
|
||||
0xCE, 0xA2, 0x43, 0x10, 0xCE, 0xCD, 0xA8, 0x70, 0x15, 0x27, 0xA7, 0xD0, 0x16, 0x18, 0xDC, 0x40,
|
||||
0x17, 0x08, 0xDB, 0x50, 0x17, 0xFA, 0x0F, 0xC0, 0x18, 0xEA, 0x0E, 0xD0, 0x19, 0xDB, 0x43, 0x40,
|
||||
0x1A, 0xCC, 0x93, 0xD0, 0x1B, 0xBC, 0xA0, 0xF0, 0x1C, 0xAC, 0x91, 0xF0, 0x1D, 0x9C, 0x82, 0xF0,
|
||||
0x1E, 0x8C, 0x73, 0xF0, 0x1F, 0x7C, 0x64, 0xF0, 0x20, 0x6C, 0x55, 0xF0, 0x21, 0x5C, 0x46, 0xF0,
|
||||
0x22, 0x4C, 0x37, 0xF0, 0x23, 0x3C, 0x28, 0xF0, 0x24, 0x2C, 0x19, 0xF0, 0x25, 0x1C, 0x0A, 0xF0,
|
||||
0x25, 0x9E, 0x73, 0x50, 0x26, 0x8D, 0x2E, 0xF0, 0x29, 0xD4, 0xEC, 0x60, 0x2A, 0xC4, 0xCF, 0x50,
|
||||
0x2B, 0xB4, 0xCE, 0x60, 0x2C, 0xA4, 0xB1, 0x50, 0x2D, 0x94, 0xB0, 0x60, 0x2E, 0x84, 0x93, 0x50,
|
||||
0x2F, 0x74, 0xBC, 0x90, 0x30, 0x64, 0xAD, 0x90, 0x31, 0x5D, 0xD9, 0x10, 0x32, 0x72, 0xB4, 0x10,
|
||||
0x33, 0x3D, 0xBB, 0x10, 0x34, 0x52, 0x96, 0x10, 0x35, 0x1D, 0x9D, 0x10, 0x36, 0x32, 0x78, 0x10,
|
||||
0x36, 0xFD, 0x7F, 0x10, 0x38, 0x1B, 0x94, 0x90, 0x38, 0xDD, 0x61, 0x10, 0x39, 0xFB, 0x76, 0x90,
|
||||
0x3A, 0xBD, 0x43, 0x10, 0x3B, 0xDB, 0x58, 0x90, 0x3C, 0xA6, 0x5F, 0x90, 0x3D, 0xBB, 0x3A, 0x90,
|
||||
0x3E, 0x86, 0x41, 0x90, 0x3F, 0x9B, 0x1C, 0x90, 0x40, 0x66, 0x23, 0x90, 0x41, 0x84, 0x39, 0x10,
|
||||
0x42, 0x46, 0x05, 0x90, 0x43, 0x64, 0x1B, 0x10, 0x44, 0x25, 0xE7, 0x90, 0x45, 0x43, 0xFD, 0x10,
|
||||
0x46, 0x05, 0xC9, 0x90, 0x47, 0x23, 0xDF, 0x10, 0x47, 0xEE, 0xE6, 0x10, 0x49, 0x03, 0xC1, 0x10,
|
||||
0x49, 0xCE, 0xC8, 0x10, 0x4A, 0xE3, 0xA3, 0x10, 0x4B, 0xAE, 0xAA, 0x10, 0x4C, 0xCC, 0xBF, 0x90,
|
||||
0x4D, 0x8E, 0x8C, 0x10, 0x4E, 0xAC, 0xA1, 0x90, 0x4F, 0x6E, 0x6E, 0x10, 0x50, 0x8C, 0x83, 0x90,
|
||||
0x51, 0x57, 0x8A, 0x90, 0x52, 0x6C, 0x65, 0x90, 0x53, 0x37, 0x6C, 0x90, 0x54, 0x4C, 0x47, 0x90,
|
||||
0x55, 0x17, 0x4E, 0x90, 0x56, 0x2C, 0x29, 0x90, 0x56, 0xF7, 0x30, 0x90, 0x58, 0x15, 0x46, 0x10,
|
||||
0x58, 0xD7, 0x12, 0x90, 0x59, 0xF5, 0x28, 0x10, 0x5A, 0xB6, 0xF4, 0x90, 0x5B, 0xD5, 0x0A, 0x10,
|
||||
0x5C, 0xA0, 0x11, 0x10, 0x5D, 0xB4, 0xEC, 0x10, 0x5E, 0x7F, 0xF3, 0x10, 0x5F, 0x94, 0xCE, 0x10,
|
||||
0x60, 0x5F, 0xD5, 0x10, 0x61, 0x7D, 0xEA, 0x90, 0x62, 0x3F, 0xB7, 0x10, 0x63, 0x5D, 0xCC, 0x90,
|
||||
0x64, 0x1F, 0x99, 0x10, 0x65, 0x3D, 0xAE, 0x90, 0x66, 0x08, 0xB5, 0x90, 0x67, 0x1D, 0x90, 0x90,
|
||||
0x67, 0xE8, 0x97, 0x90, 0x68, 0xFD, 0x72, 0x90, 0x69, 0xC8, 0x79, 0x90, 0x6A, 0xDD, 0x54, 0x90,
|
||||
0x6B, 0xA8, 0x5B, 0x90, 0x6C, 0xC6, 0x71, 0x10, 0x6D, 0x88, 0x3D, 0x90, 0x6E, 0xA6, 0x53, 0x10,
|
||||
0x6F, 0x68, 0x1F, 0x90, 0x70, 0x86, 0x35, 0x10, 0x71, 0x51, 0x3C, 0x10, 0x72, 0x66, 0x17, 0x10,
|
||||
0x73, 0x31, 0x1E, 0x10, 0x74, 0x45, 0xF9, 0x10, 0x75, 0x11, 0x00, 0x10, 0x76, 0x2F, 0x15, 0x90,
|
||||
0x76, 0xF0, 0xE2, 0x10, 0x78, 0x0E, 0xF7, 0x90, 0x78, 0xD0, 0xC4, 0x10, 0x79, 0xEE, 0xD9, 0x90,
|
||||
0x7A, 0xB0, 0xA6, 0x10, 0x7B, 0xCE, 0xBB, 0x90, 0x7C, 0x99, 0xC2, 0x90, 0x7D, 0xAE, 0x9D, 0x90,
|
||||
0x7E, 0x79, 0xA4, 0x90, 0x7F, 0x8E, 0x7F, 0x90, 0x01, 0x02, 0x05, 0x03, 0x04, 0x03, 0x02, 0x06,
|
||||
0x02, 0x06, 0x02, 0x06, 0x02, 0x06, 0x07, 0x08, 0x07, 0x08, 0x07, 0x08, 0x07, 0x08, 0x07, 0x08,
|
||||
0x07, 0x02, 0x01, 0x09, 0x01, 0x09, 0x01, 0x09, 0x01, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A,
|
||||
0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A,
|
||||
0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A,
|
||||
0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A,
|
||||
0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A,
|
||||
0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x00,
|
||||
0x00, 0x1C, 0x9C, 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, 0x2A, 0x30, 0x01,
|
||||
0x19, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x4B, 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, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0xD6, 0x48,
|
||||
0xC5, 0x01, 0x41, 0x39, 0x12, 0x00, 0x00, 0x00, 0x0E, 0x6D, 0x6F, 0x73, 0x74, 0x20, 0x6C, 0x6F,
|
||||
0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73,
|
||||
0x26, 0x0B, 0xFB, 0xF0, 0x26, 0x8D, 0x20, 0xE0, 0x28, 0xE5, 0x17, 0x80, 0x29, 0xD4, 0xEC, 0x60,
|
||||
0x2A, 0xC4, 0xCF, 0x50, 0x2B, 0xB4, 0xCE, 0x60, 0x2C, 0xA4, 0xB1, 0x50, 0x2D, 0x94, 0xB0, 0x60,
|
||||
0x2E, 0x84, 0x93, 0x50, 0x2F, 0x74, 0xBC, 0x90, 0x30, 0x64, 0xAD, 0x90, 0x31, 0x5D, 0xD9, 0x10,
|
||||
0x32, 0x72, 0xB4, 0x10, 0x33, 0x3D, 0xBB, 0x10, 0x34, 0x52, 0x96, 0x10, 0x35, 0x1D, 0x9D, 0x10,
|
||||
0x36, 0x32, 0x78, 0x10, 0x36, 0xFD, 0x7F, 0x10, 0x38, 0x1B, 0x94, 0x90, 0x38, 0xDD, 0x61, 0x10,
|
||||
0x39, 0xFB, 0x76, 0x90, 0x3A, 0xBD, 0x43, 0x10, 0x3B, 0xDB, 0x58, 0x90, 0x3C, 0xA6, 0x5F, 0x90,
|
||||
0x3D, 0xBB, 0x3A, 0x90, 0x3E, 0x86, 0x41, 0x90, 0x3F, 0x9B, 0x1C, 0x90, 0x40, 0x66, 0x23, 0x90,
|
||||
0x41, 0x84, 0x39, 0x10, 0x42, 0x46, 0x05, 0x90, 0x43, 0x64, 0x1B, 0x10, 0x44, 0x25, 0xE7, 0x90,
|
||||
0x45, 0x43, 0xFD, 0x10, 0x46, 0x05, 0xC9, 0x90, 0x47, 0x23, 0xDF, 0x10, 0x47, 0xEE, 0xE6, 0x10,
|
||||
0x49, 0x03, 0xC1, 0x10, 0x49, 0xCE, 0xC8, 0x10, 0x4A, 0xE3, 0xA3, 0x10, 0x4B, 0xAE, 0xAA, 0x10,
|
||||
0x4C, 0xCC, 0xBF, 0x90, 0x4D, 0x8E, 0x8C, 0x10, 0x4E, 0xAC, 0xA1, 0x90, 0x4F, 0x6E, 0x6E, 0x10,
|
||||
0x50, 0x8C, 0x83, 0x90, 0x51, 0x57, 0x8A, 0x90, 0x52, 0x6C, 0x65, 0x90, 0x53, 0x37, 0x6C, 0x90,
|
||||
0x54, 0x4C, 0x47, 0x90, 0x55, 0x17, 0x4E, 0x90, 0x56, 0x2C, 0x29, 0x90, 0x56, 0xF7, 0x30, 0x90,
|
||||
0x58, 0x15, 0x46, 0x10, 0x58, 0xD7, 0x12, 0x90, 0x59, 0xF5, 0x28, 0x10, 0x5A, 0xB6, 0xF4, 0x90,
|
||||
0x5B, 0xD5, 0x0A, 0x10, 0x5C, 0xA0, 0x11, 0x10, 0x5D, 0xB4, 0xEC, 0x10, 0x5E, 0x7F, 0xF3, 0x10,
|
||||
0x5F, 0x94, 0xCE, 0x10, 0x60, 0x5F, 0xD5, 0x10, 0x61, 0x7D, 0xEA, 0x90, 0x62, 0x3F, 0xB7, 0x10,
|
||||
0x63, 0x5D, 0xCC, 0x90, 0x64, 0x1F, 0x99, 0x10, 0x65, 0x3D, 0xAE, 0x90, 0x66, 0x08, 0xB5, 0x90,
|
||||
0x67, 0x1D, 0x90, 0x90, 0x67, 0xE8, 0x97, 0x90, 0x68, 0xFD, 0x72, 0x90, 0x69, 0xC8, 0x79, 0x90,
|
||||
0x6A, 0xDD, 0x54, 0x90, 0x6B, 0xA8, 0x5B, 0x90, 0x6C, 0xC6, 0x71, 0x10, 0x6D, 0x88, 0x3D, 0x90,
|
||||
0x6E, 0xA6, 0x53, 0x10, 0x6F, 0x68, 0x1F, 0x90, 0x70, 0x86, 0x35, 0x10, 0x71, 0x51, 0x3C, 0x10,
|
||||
0x72, 0x66, 0x17, 0x10, 0x73, 0x31, 0x1E, 0x10, 0x74, 0x45, 0xF9, 0x10, 0x75, 0x11, 0x00, 0x10,
|
||||
0x76, 0x2F, 0x15, 0x90, 0x76, 0xF0, 0xE2, 0x10, 0x78, 0x0E, 0xF7, 0x90, 0x78, 0xD0, 0xC4, 0x10,
|
||||
0x79, 0xEE, 0xD9, 0x90, 0x7A, 0xB0, 0xA6, 0x10, 0x7B, 0xCE, 0xBB, 0x90, 0x7C, 0x99, 0xC2, 0x90,
|
||||
0x7D, 0xAE, 0x9D, 0x90, 0x7E, 0x79, 0xA4, 0x90, 0x7F, 0x8E, 0x7F, 0x90, 0x01, 0x02, 0x05, 0x03,
|
||||
0x04, 0x03, 0x02, 0x06, 0x02, 0x06, 0x02, 0x06, 0x02, 0x06, 0x07, 0x08, 0x07, 0x08, 0x07, 0x08,
|
||||
0x07, 0x08, 0x07, 0x08, 0x07, 0x08, 0x09, 0x01, 0x09, 0x01, 0x09, 0x01, 0x09, 0x01, 0x0A, 0x0B,
|
||||
0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B,
|
||||
0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B,
|
||||
0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B,
|
||||
0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B,
|
||||
0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B,
|
||||
0x0A, 0x0B, 0x0A, 0x0B, 0x00, 0x00, 0x1C, 0x9C, 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, 0x2A, 0x30, 0x01, 0x19, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x4B, 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, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00,
|
||||
0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x01, 0x00, 0xD6, 0x48, 0xC5, 0x01, 0x41, 0x39, 0x12, 0x00, 0x00, 0x00, 0x0E, 0x6D, 0x6F,
|
||||
0x73, 0x74, 0x20, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73,
|
||||
|
||||
/* Europe/Lisbon */
|
||||
0x50, 0x48, 0x50, 0x31, 0x01, 0x50, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
@@ -16255,7 +16255,7 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = {
|
||||
0xE7, 0x11, 0xD2, 0x80, 0xE8, 0x27, 0xFF, 0x00, 0xE8, 0xE8, 0x4F, 0xD0, 0x08, 0x7C, 0x8B, 0xE0,
|
||||
0x08, 0xFD, 0xB0, 0xD0, 0x09, 0xF6, 0xEA, 0x60, 0x0A, 0xA6, 0x33, 0xD0, 0x1C, 0xBE, 0xF8, 0xE0,
|
||||
0x1D, 0x89, 0xF1, 0xD0, 0x1E, 0xCC, 0xFF, 0x60, 0x1F, 0x60, 0x99, 0x50, 0x20, 0x82, 0xB1, 0x60,
|
||||
0x21, 0x49, 0xB5, 0xD0, 0x22, 0x5D, 0x4D, 0x60, 0x23, 0x1F, 0x0B, 0xD0, 0x24, 0x5A, 0x30, 0x60,
|
||||
0x21, 0x49, 0xB5, 0xD0, 0x22, 0x5E, 0x9E, 0xE0, 0x23, 0x20, 0x5D, 0x50, 0x24, 0x5A, 0x30, 0x60,
|
||||
0x25, 0x00, 0x3F, 0x50, 0x26, 0x0B, 0xED, 0xE0, 0x26, 0xD6, 0xE6, 0xD0, 0x27, 0xEB, 0xCF, 0xE0,
|
||||
0x28, 0xC0, 0x03, 0x50, 0x29, 0xD4, 0xEC, 0x60, 0x2A, 0xA9, 0x1F, 0xD0, 0x2B, 0xBB, 0x65, 0xE0,
|
||||
0x2C, 0x89, 0x01, 0xD0, 0x2D, 0x9B, 0x47, 0xE0, 0x2E, 0x5F, 0xA9, 0x50, 0x2F, 0x7B, 0x29, 0xE0,
|
||||
@@ -17003,18 +17003,18 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = {
|
||||
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, 0x88, 0xE0, 0x54, 0x4B, 0xAC, 0xE0, 0x54, 0xBA, 0x6A, 0xE0,
|
||||
0x56, 0x2B, 0x8E, 0xE0, 0x56, 0xA3, 0x87, 0x60, 0x58, 0x0B, 0x70, 0xE0, 0x58, 0x83, 0x69, 0x60,
|
||||
0x59, 0xEB, 0x52, 0xE0, 0x5A, 0x63, 0x4B, 0x60, 0x5B, 0xCB, 0x34, 0xE0, 0x5C, 0x43, 0x2D, 0x60,
|
||||
0x5D, 0xB4, 0x51, 0x60, 0x5E, 0x23, 0x0F, 0x60, 0x5F, 0x94, 0x33, 0x60, 0x60, 0x0C, 0x2B, 0xE0,
|
||||
0x61, 0x74, 0x15, 0x60, 0x61, 0xEC, 0x0D, 0xE0, 0x63, 0x53, 0xF7, 0x60, 0x63, 0xCB, 0xEF, 0xE0,
|
||||
0x65, 0x33, 0xD9, 0x60, 0x65, 0xAB, 0xD1, 0xE0, 0x67, 0x1C, 0xF5, 0xE0, 0x67, 0x8B, 0xB3, 0xE0,
|
||||
0x68, 0xFC, 0xD7, 0xE0, 0x69, 0x6B, 0x95, 0xE0, 0x6A, 0xDC, 0xB9, 0xE0, 0x6B, 0x54, 0xB2, 0x60,
|
||||
0x6C, 0xBC, 0x9B, 0xE0, 0x6D, 0x34, 0x94, 0x60, 0x6E, 0x9C, 0x7D, 0xE0, 0x6F, 0x14, 0x76, 0x60,
|
||||
0x70, 0x7C, 0x5F, 0xE0, 0x70, 0xF4, 0x58, 0x60, 0x72, 0x65, 0x7C, 0x60, 0x72, 0xD4, 0x3A, 0x60,
|
||||
0x74, 0x45, 0x5E, 0x60, 0x74, 0xB4, 0x1C, 0x60, 0x76, 0x25, 0x40, 0x60, 0x76, 0x9D, 0x38, 0xE0,
|
||||
0x78, 0x05, 0x22, 0x60, 0x78, 0x7D, 0x1A, 0xE0, 0x79, 0xE5, 0x04, 0x60, 0x7A, 0x5C, 0xFC, 0xE0,
|
||||
0x7B, 0xC4, 0xE6, 0x60, 0x7C, 0x3C, 0xDE, 0xE0, 0x7D, 0xAE, 0x02, 0xE0, 0x7E, 0x1C, 0xC0, 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,
|
||||
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,
|
||||
@@ -17617,7 +17617,7 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = {
|
||||
0x46, 0x05, 0xC9, 0x90, 0x47, 0x23, 0xDF, 0x10, 0x47, 0xEE, 0xE6, 0x10, 0x49, 0x03, 0xC1, 0x10,
|
||||
0x49, 0xCE, 0xC8, 0x10, 0x4A, 0xE3, 0xA3, 0x10, 0x4B, 0xAE, 0xAA, 0x10, 0x4C, 0xCC, 0xBF, 0x90,
|
||||
0x4D, 0x8F, 0xDD, 0x90, 0x4E, 0xAC, 0xA1, 0x90, 0x4F, 0x6E, 0x6E, 0x10, 0x50, 0x8C, 0x83, 0x90,
|
||||
0x51, 0x57, 0x8A, 0x90, 0x52, 0x6C, 0x65, 0x90, 0x53, 0x37, 0x6C, 0x90, 0x54, 0x4C, 0x47, 0x90,
|
||||
0x51, 0x57, 0x8A, 0x90, 0x52, 0x6C, 0x65, 0x90, 0x53, 0x38, 0xBE, 0x10, 0x54, 0x4C, 0x47, 0x90,
|
||||
0x55, 0x17, 0x4E, 0x90, 0x56, 0x2C, 0x29, 0x90, 0x56, 0xF7, 0x30, 0x90, 0x58, 0x15, 0x46, 0x10,
|
||||
0x58, 0xD7, 0x12, 0x90, 0x59, 0xF5, 0x28, 0x10, 0x5A, 0xB6, 0xF4, 0x90, 0x5B, 0xD5, 0x0A, 0x10,
|
||||
0x5C, 0xA0, 0x11, 0x10, 0x5D, 0xB4, 0xEC, 0x10, 0x5E, 0x7F, 0xF3, 0x10, 0x5F, 0x94, 0xCE, 0x10,
|
||||
@@ -18416,4 +18416,4 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = {
|
||||
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 = { "2013.9", 579, timezonedb_idx_builtin, timelib_timezone_db_data_builtin };
|
||||
const timelib_tzdb timezonedb_builtin = { "2014.1", 579, timezonedb_idx_builtin, timelib_timezone_db_data_builtin };
|
||||
+11
-12
@@ -28,7 +28,7 @@ static int month_tab[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 24
|
||||
static int days_in_month_leap[13] = { 31, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
static int days_in_month[13] = { 31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
|
||||
static int do_range_limit(timelib_sll start, timelib_sll end, timelib_sll adj, timelib_sll *a, timelib_sll *b)
|
||||
static void do_range_limit(timelib_sll start, timelib_sll end, timelib_sll adj, timelib_sll *a, timelib_sll *b)
|
||||
{
|
||||
if (*a < start) {
|
||||
*b -= (start - *a - 1) / adj + 1;
|
||||
@@ -38,7 +38,6 @@ static int do_range_limit(timelib_sll start, timelib_sll end, timelib_sll adj, t
|
||||
*b += *a / adj;
|
||||
*a -= adj * (*a / adj);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void inc_month(timelib_sll *y, timelib_sll *m)
|
||||
@@ -170,24 +169,24 @@ static void do_adjust_for_weekday(timelib_time* time)
|
||||
|
||||
void timelib_do_rel_normalize(timelib_time *base, timelib_rel_time *rt)
|
||||
{
|
||||
do {} while (do_range_limit(0, 60, 60, &rt->s, &rt->i));
|
||||
do {} while (do_range_limit(0, 60, 60, &rt->i, &rt->h));
|
||||
do {} while (do_range_limit(0, 24, 24, &rt->h, &rt->d));
|
||||
do {} while (do_range_limit(0, 12, 12, &rt->m, &rt->y));
|
||||
do_range_limit(0, 60, 60, &rt->s, &rt->i);
|
||||
do_range_limit(0, 60, 60, &rt->i, &rt->h);
|
||||
do_range_limit(0, 24, 24, &rt->h, &rt->d);
|
||||
do_range_limit(0, 12, 12, &rt->m, &rt->y);
|
||||
|
||||
do_range_limit_days_relative(&base->y, &base->m, &rt->y, &rt->m, &rt->d, rt->invert);
|
||||
do {} while (do_range_limit(0, 12, 12, &rt->m, &rt->y));
|
||||
do_range_limit(0, 12, 12, &rt->m, &rt->y);
|
||||
}
|
||||
|
||||
void timelib_do_normalize(timelib_time* time)
|
||||
{
|
||||
if (time->s != TIMELIB_UNSET) do {} while (do_range_limit(0, 60, 60, &time->s, &time->i));
|
||||
if (time->s != TIMELIB_UNSET) do {} while (do_range_limit(0, 60, 60, &time->i, &time->h));
|
||||
if (time->s != TIMELIB_UNSET) do {} while (do_range_limit(0, 24, 24, &time->h, &time->d));
|
||||
do {} while (do_range_limit(1, 13, 12, &time->m, &time->y));
|
||||
if (time->s != TIMELIB_UNSET) do_range_limit(0, 60, 60, &time->s, &time->i);
|
||||
if (time->s != TIMELIB_UNSET) do_range_limit(0, 60, 60, &time->i, &time->h);
|
||||
if (time->s != TIMELIB_UNSET) do_range_limit(0, 24, 24, &time->h, &time->d);
|
||||
do_range_limit(1, 13, 12, &time->m, &time->y);
|
||||
|
||||
do {} while (do_range_limit_days(&time->y, &time->m, &time->d));
|
||||
do {} while (do_range_limit(1, 13, 12, &time->m, &time->y));
|
||||
do_range_limit(1, 13, 12, &time->m, &time->y);
|
||||
}
|
||||
|
||||
static void do_adjust_relative(timelib_time* time)
|
||||
|
||||
@@ -214,6 +214,34 @@ void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
|
||||
tm->have_zone = 1;
|
||||
}
|
||||
|
||||
void timelib_set_timezone_from_offset(timelib_time *t, timelib_sll utc_offset)
|
||||
{
|
||||
if (t->tz_abbr) {
|
||||
free(t->tz_abbr);
|
||||
}
|
||||
t->tz_abbr = NULL;
|
||||
|
||||
t->z = utc_offset;
|
||||
t->have_zone = 1;
|
||||
t->zone_type = TIMELIB_ZONETYPE_OFFSET;
|
||||
t->dst = 0;
|
||||
t->tz_info = NULL;
|
||||
}
|
||||
|
||||
void timelib_set_timezone_from_abbr(timelib_time *t, timelib_abbr_info abbr_info)
|
||||
{
|
||||
if (t->tz_abbr) {
|
||||
free(t->tz_abbr);
|
||||
}
|
||||
t->tz_abbr = strdup(abbr_info.abbr);
|
||||
|
||||
t->z = abbr_info.utc_offset;
|
||||
t->have_zone = 1;
|
||||
t->zone_type = TIMELIB_ZONETYPE_ABBR;
|
||||
t->dst = abbr_info.dst;
|
||||
t->tz_info = NULL;
|
||||
}
|
||||
|
||||
void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz)
|
||||
{
|
||||
timelib_time_offset *gmt_offset;
|
||||
|
||||
+52
-77
@@ -2297,7 +2297,7 @@ static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC)
|
||||
case TIMELIB_ZONETYPE_ABBR:
|
||||
new_obj->tzi.z.utc_offset = old_obj->tzi.z.utc_offset;
|
||||
new_obj->tzi.z.dst = old_obj->tzi.z.dst;
|
||||
new_obj->tzi.z.abbr = old_obj->tzi.z.abbr;
|
||||
new_obj->tzi.z.abbr = strdup(old_obj->tzi.z.abbr);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3238,6 +3238,26 @@ PHP_METHOD(DateTimeImmutable, sub)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void set_timezone_from_timelib_time(php_timezone_obj *tzobj, timelib_time *t)
|
||||
{
|
||||
tzobj->initialized = 1;
|
||||
tzobj->type = t->zone_type;
|
||||
switch (t->zone_type) {
|
||||
case TIMELIB_ZONETYPE_ID:
|
||||
tzobj->tzi.tz = t->tz_info;
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_OFFSET:
|
||||
tzobj->tzi.utc_offset = t->z;
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_ABBR:
|
||||
tzobj->tzi.z.utc_offset = t->z;
|
||||
tzobj->tzi.z.dst = t->dst;
|
||||
tzobj->tzi.z.abbr = strdup(t->tz_abbr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* {{{ proto DateTimeZone date_timezone_get(DateTimeInterface object)
|
||||
Return new DateTimeZone object relative to give DateTime
|
||||
*/
|
||||
@@ -3255,21 +3275,7 @@ PHP_FUNCTION(date_timezone_get)
|
||||
if (dateobj->time->is_localtime/* && dateobj->time->tz_info*/) {
|
||||
php_date_instantiate(date_ce_timezone, return_value TSRMLS_CC);
|
||||
tzobj = (php_timezone_obj *) zend_object_store_get_object(return_value TSRMLS_CC);
|
||||
tzobj->initialized = 1;
|
||||
tzobj->type = dateobj->time->zone_type;
|
||||
switch (dateobj->time->zone_type) {
|
||||
case TIMELIB_ZONETYPE_ID:
|
||||
tzobj->tzi.tz = dateobj->time->tz_info;
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_OFFSET:
|
||||
tzobj->tzi.utc_offset = dateobj->time->z;
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_ABBR:
|
||||
tzobj->tzi.z.utc_offset = dateobj->time->z;
|
||||
tzobj->tzi.z.dst = dateobj->time->dst;
|
||||
tzobj->tzi.z.abbr = strdup(dateobj->time->tz_abbr);
|
||||
break;
|
||||
}
|
||||
set_timezone_from_timelib_time(tzobj, dateobj->time);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3284,11 +3290,18 @@ static void php_date_timezone_set(zval *object, zval *timezone_object, zval *ret
|
||||
dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
|
||||
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
|
||||
tzobj = (php_timezone_obj *) zend_object_store_get_object(timezone_object TSRMLS_CC);
|
||||
if (tzobj->type != TIMELIB_ZONETYPE_ID) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only do this for zones with ID for now");
|
||||
return;
|
||||
|
||||
switch (tzobj->type) {
|
||||
case TIMELIB_ZONETYPE_OFFSET:
|
||||
timelib_set_timezone_from_offset(dateobj->time, tzobj->tzi.utc_offset);
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_ABBR:
|
||||
timelib_set_timezone_from_abbr(dateobj->time, tzobj->tzi.z);
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_ID:
|
||||
timelib_set_timezone(dateobj->time, tzobj->tzi.tz);
|
||||
break;
|
||||
}
|
||||
timelib_set_timezone(dateobj->time, tzobj->tzi.tz);
|
||||
timelib_unixtime2local(dateobj->time, dateobj->time->sse);
|
||||
}
|
||||
|
||||
@@ -3613,23 +3626,21 @@ PHP_FUNCTION(date_diff)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int timezone_initialize(timelib_tzinfo **tzi, /*const*/ char *tz TSRMLS_DC)
|
||||
static int timezone_initialize(php_timezone_obj *tzobj, /*const*/ char *tz TSRMLS_DC)
|
||||
{
|
||||
char *tzid;
|
||||
|
||||
*tzi = NULL;
|
||||
|
||||
if ((tzid = timelib_timezone_id_from_abbr(tz, -1, 0))) {
|
||||
*tzi = php_date_parse_tzfile(tzid, DATE_TIMEZONEDB TSRMLS_CC);
|
||||
} else {
|
||||
*tzi = php_date_parse_tzfile(tz, DATE_TIMEZONEDB TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (*tzi) {
|
||||
return SUCCESS;
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or bad timezone (%s)", tz);
|
||||
timelib_time *dummy_t = ecalloc(1, sizeof(timelib_time));
|
||||
int dst, not_found;
|
||||
char *orig_tz = tz;
|
||||
|
||||
dummy_t->z = timelib_parse_zone(&tz, &dst, dummy_t, ¬_found, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
|
||||
if (not_found) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or bad timezone (%s)", orig_tz);
|
||||
efree(dummy_t);
|
||||
return FAILURE;
|
||||
} else {
|
||||
set_timezone_from_timelib_time(tzobj, dummy_t);
|
||||
efree(dummy_t);
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3640,19 +3651,15 @@ PHP_FUNCTION(timezone_open)
|
||||
{
|
||||
char *tz;
|
||||
int tz_len;
|
||||
timelib_tzinfo *tzi = NULL;
|
||||
php_timezone_obj *tzobj;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (SUCCESS != timezone_initialize(&tzi, tz TSRMLS_CC)) {
|
||||
tzobj = zend_object_store_get_object(php_date_instantiate(date_ce_timezone, return_value TSRMLS_CC) TSRMLS_CC);
|
||||
if (SUCCESS != timezone_initialize(tzobj, tz TSRMLS_CC)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
tzobj = zend_object_store_get_object(php_date_instantiate(date_ce_timezone, return_value TSRMLS_CC) TSRMLS_CC);
|
||||
tzobj->type = TIMELIB_ZONETYPE_ID;
|
||||
tzobj->tzi.tz = tzi;
|
||||
tzobj->initialized = 1;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -3663,18 +3670,13 @@ PHP_METHOD(DateTimeZone, __construct)
|
||||
{
|
||||
char *tz;
|
||||
int tz_len;
|
||||
timelib_tzinfo *tzi = NULL;
|
||||
php_timezone_obj *tzobj;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
|
||||
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len)) {
|
||||
if (SUCCESS == timezone_initialize(&tzi, tz TSRMLS_CC)) {
|
||||
tzobj = zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
tzobj->type = TIMELIB_ZONETYPE_ID;
|
||||
tzobj->tzi.tz = tzi;
|
||||
tzobj->initialized = 1;
|
||||
} else {
|
||||
tzobj = zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
if (FAILURE == timezone_initialize(tzobj, tz TSRMLS_CC)) {
|
||||
ZVAL_NULL(getThis());
|
||||
}
|
||||
}
|
||||
@@ -3686,39 +3688,12 @@ static int php_date_timezone_initialize_from_hash(zval **return_value, php_timez
|
||||
{
|
||||
zval **z_timezone = NULL;
|
||||
zval **z_timezone_type = NULL;
|
||||
timelib_tzinfo *tzi;
|
||||
|
||||
if (zend_hash_find(myht, "timezone_type", 14, (void**) &z_timezone_type) == SUCCESS) {
|
||||
if (zend_hash_find(myht, "timezone", 9, (void**) &z_timezone) == SUCCESS) {
|
||||
convert_to_long(*z_timezone_type);
|
||||
switch (Z_LVAL_PP(z_timezone_type)) {
|
||||
case TIMELIB_ZONETYPE_OFFSET: {
|
||||
char *offset, *offset_start;
|
||||
|
||||
offset = emalloc(sizeof(char) * (Z_STRLEN_PP(z_timezone) + 1));
|
||||
memmove(offset, Z_STRVAL_PP(z_timezone), Z_STRLEN_PP(z_timezone)+1);
|
||||
offset_start = offset;
|
||||
|
||||
++offset;
|
||||
if(*offset_start == '+'){
|
||||
(*tzobj)->tzi.utc_offset = -1 * timelib_parse_tz_cor(&offset);
|
||||
} else {
|
||||
(*tzobj)->tzi.utc_offset = timelib_parse_tz_cor(&offset);
|
||||
}
|
||||
efree(offset_start);
|
||||
(*tzobj)->type = TIMELIB_ZONETYPE_OFFSET;
|
||||
(*tzobj)->initialized = 1;
|
||||
return SUCCESS;
|
||||
break;
|
||||
}
|
||||
case TIMELIB_ZONETYPE_ABBR:
|
||||
case TIMELIB_ZONETYPE_ID:
|
||||
if (SUCCESS == timezone_initialize(&tzi, Z_STRVAL_PP(z_timezone) TSRMLS_CC)) {
|
||||
(*tzobj)->type = TIMELIB_ZONETYPE_ID;
|
||||
(*tzobj)->tzi.tz = tzi;
|
||||
(*tzobj)->initialized = 1;
|
||||
return SUCCESS;
|
||||
}
|
||||
if (SUCCESS == timezone_initialize(*tzobj, Z_STRVAL_PP(z_timezone) TSRMLS_CC)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-8
@@ -137,14 +137,9 @@ struct _php_timezone_obj {
|
||||
int initialized;
|
||||
int type;
|
||||
union {
|
||||
timelib_tzinfo *tz; /* TIMELIB_ZONETYPE_ID; */
|
||||
timelib_sll utc_offset; /* TIMELIB_ZONETYPE_OFFSET */
|
||||
struct /* TIMELIB_ZONETYPE_ABBR */
|
||||
{
|
||||
timelib_sll utc_offset;
|
||||
char *abbr;
|
||||
int dst;
|
||||
} z;
|
||||
timelib_tzinfo *tz; /* TIMELIB_ZONETYPE_ID */
|
||||
timelib_sll utc_offset; /* TIMELIB_ZONETYPE_OFFSET */
|
||||
timelib_abbr_info z; /* TIMELIB_ZONETYPE_ABBR */
|
||||
} tzi;
|
||||
HashTable *props;
|
||||
};
|
||||
|
||||
@@ -31,15 +31,15 @@ if ($clone != $orig) {
|
||||
*** Testing clone on DateTime objects ***
|
||||
object(DateTimeZone)#%d (2) {
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
int(2)
|
||||
["timezone"]=>
|
||||
string(3) "UTC"
|
||||
string(3) "GMT"
|
||||
}
|
||||
object(DateTimeZone)#%d (2) {
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
int(2)
|
||||
["timezone"]=>
|
||||
string(3) "UTC"
|
||||
string(3) "GMT"
|
||||
}
|
||||
TEST PASSED : Objects equal but not indetical
|
||||
===DONE===
|
||||
|
||||
@@ -23,9 +23,9 @@ var_dump( new DateTimeZone("America/Los_Angeles") );
|
||||
*** Testing new DateTimeZone() : basic functionality ***
|
||||
object(DateTimeZone)#%d (2) {
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
int(2)
|
||||
["timezone"]=>
|
||||
string(3) "UTC"
|
||||
string(3) "GMT"
|
||||
}
|
||||
object(DateTimeZone)#%d (2) {
|
||||
["timezone_type"]=>
|
||||
|
||||
@@ -48,11 +48,9 @@ $inputs = array(
|
||||
'int 0' => 0,
|
||||
'int 1' => 1,
|
||||
'int 12345' => 12345,
|
||||
'int -12345' => -12345,
|
||||
|
||||
// float data
|
||||
'float 10.5' => 10.5,
|
||||
'float -10.5' => -10.5,
|
||||
'float .5' => .5,
|
||||
|
||||
// array data
|
||||
@@ -123,15 +121,9 @@ FAILED: DateTimeZone::__construct(): Unknown or bad timezone (1)
|
||||
-- int 12345 --
|
||||
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (12345)
|
||||
|
||||
-- int -12345 --
|
||||
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (-12345)
|
||||
|
||||
-- float 10.5 --
|
||||
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (10.5)
|
||||
|
||||
-- float -10.5 --
|
||||
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (-10.5)
|
||||
|
||||
-- float .5 --
|
||||
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (0.5)
|
||||
|
||||
|
||||
@@ -20,16 +20,16 @@ var_dump( $tz2->getName() );
|
||||
--EXPECTF--
|
||||
object(DateTimeZone)#%d (2) {
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
int(2)
|
||||
["timezone"]=>
|
||||
string(16) "America/New_York"
|
||||
string(3) "EST"
|
||||
}
|
||||
string(88) "O:12:"DateTimeZone":2:{s:13:"timezone_type";i:3;s:8:"timezone";s:16:"America/New_York";}"
|
||||
string(74) "O:12:"DateTimeZone":2:{s:13:"timezone_type";i:2;s:8:"timezone";s:3:"EST";}"
|
||||
object(DateTimeZone)#%d (2) {
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
int(2)
|
||||
["timezone"]=>
|
||||
string(16) "America/New_York"
|
||||
string(3) "EST"
|
||||
}
|
||||
string(16) "America/New_York"
|
||||
string(3) "EST"
|
||||
===DONE===
|
||||
@@ -18,14 +18,14 @@ var_dump( $tz2->getName() );
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
object(DateTimeZone)#%d (2) {
|
||||
object(DateTimeZone)#1 (2) {
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
["timezone"]=>
|
||||
string(16) "America/New_York"
|
||||
}
|
||||
string(88) "O:12:"DateTimeZone":2:{s:13:"timezone_type";i:3;s:8:"timezone";s:16:"America/New_York";}"
|
||||
object(DateTimeZone)#%d (2) {
|
||||
object(DateTimeZone)#2 (2) {
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
["timezone"]=>
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Bug #44780 (some time zone offsets not recognized by timezone_name_from_abbr)
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump( timezone_name_from_abbr("", 5.5*3600, false) );
|
||||
var_dump( timezone_name_from_abbr("", 28800, false) );
|
||||
?>
|
||||
--EXPECT--
|
||||
string(12) "Asia/Kolkata"
|
||||
string(13) "Asia/Shanghai"
|
||||
@@ -0,0 +1,34 @@
|
||||
--TEST--
|
||||
Test for bug #45543: DateTime::setTimezone can not set timezones without ID.
|
||||
--INI--
|
||||
date.timezone=UTC
|
||||
--FILE--
|
||||
<?php
|
||||
$test_dates = array(
|
||||
'2008-01-01 12:00:00 PDT',
|
||||
'2008-01-01 12:00:00 +02:00',
|
||||
);
|
||||
|
||||
foreach ($test_dates as $test_date)
|
||||
{
|
||||
$d1 = new DateTime($test_date);
|
||||
$d2 = new DateTime('2008-01-01 12:00:00 UTC');
|
||||
echo $d1->format(DATE_ISO8601), PHP_EOL;
|
||||
echo $d2->format(DATE_ISO8601), PHP_EOL;
|
||||
$tz = $d1->getTimeZone();
|
||||
$d2->setTimeZone($tz);
|
||||
echo $d1->format(DATE_ISO8601), PHP_EOL;
|
||||
echo $d2->format(DATE_ISO8601), PHP_EOL;
|
||||
echo PHP_EOL;
|
||||
}
|
||||
--EXPECT--
|
||||
2008-01-01T12:00:00-0700
|
||||
2008-01-01T12:00:00+0000
|
||||
2008-01-01T12:00:00-0700
|
||||
2008-01-01T05:00:00-0700
|
||||
|
||||
2008-01-01T12:00:00+0200
|
||||
2008-01-01T12:00:00+0000
|
||||
2008-01-01T12:00:00+0200
|
||||
2008-01-01T14:00:00+0200
|
||||
|
||||
@@ -20,9 +20,9 @@ var_dump( timezone_open("America/Los_Angeles") );
|
||||
*** Testing timezone_open() : basic functionality ***
|
||||
object(DateTimeZone)#%d (2) {
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
int(2)
|
||||
["timezone"]=>
|
||||
string(3) "UTC"
|
||||
string(3) "GMT"
|
||||
}
|
||||
object(DateTimeZone)#%d (2) {
|
||||
["timezone_type"]=>
|
||||
@@ -36,4 +36,4 @@ object(DateTimeZone)#%d (2) {
|
||||
["timezone"]=>
|
||||
string(19) "America/Los_Angeles"
|
||||
}
|
||||
===DONE===
|
||||
===DONE===
|
||||
@@ -48,11 +48,9 @@ $inputs = array(
|
||||
'int 0' => 0,
|
||||
'int 1' => 1,
|
||||
'int 12345' => 12345,
|
||||
'int -12345' => -12345,
|
||||
|
||||
// float data
|
||||
'float 10.5' => 10.5,
|
||||
'float -10.5' => -10.5,
|
||||
'float .5' => .5,
|
||||
|
||||
// array data
|
||||
@@ -124,21 +122,11 @@ bool(false)
|
||||
Warning: timezone_open(): Unknown or bad timezone (12345) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- int -12345 --
|
||||
|
||||
Warning: timezone_open(): Unknown or bad timezone (-12345) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- float 10.5 --
|
||||
|
||||
Warning: timezone_open(): Unknown or bad timezone (10.5) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- float -10.5 --
|
||||
|
||||
Warning: timezone_open(): Unknown or bad timezone (-10.5) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- float .5 --
|
||||
|
||||
Warning: timezone_open(): Unknown or bad timezone (0.5) in %s on line %d
|
||||
|
||||
+21281
-21281
File diff suppressed because it is too large.
Load diff
+258
-61
@@ -1,6 +1,6 @@
|
||||
diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
--- libmagic.orig/apprentice.c 2013-03-21 18:45:14.000000000 +0100
|
||||
+++ libmagic/apprentice.c 2013-04-27 13:53:32.175250261 +0200
|
||||
--- libmagic.orig/apprentice.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/apprentice.c Fri May 3 15:19:35 2013
|
||||
@@ -29,6 +29,8 @@
|
||||
* apprentice - make one pass through /etc/magic, learning its secrets.
|
||||
*/
|
||||
@@ -830,8 +830,8 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
m->str_flags = swap4(m->str_flags);
|
||||
}
|
||||
diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
|
||||
--- libmagic.orig/ascmagic.c 2012-10-31 18:03:01.000000000 +0100
|
||||
+++ libmagic/ascmagic.c 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/ascmagic.c Wed Oct 31 18:03:01 2012
|
||||
+++ libmagic/ascmagic.c Tue Feb 18 18:44:17 2014
|
||||
@@ -139,7 +139,7 @@
|
||||
/* malloc size is a conservative overestimate; could be
|
||||
improved, or at least realloced after conversion. */
|
||||
@@ -841,6 +841,15 @@ diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
|
||||
file_oomem(ms, mlen);
|
||||
goto done;
|
||||
}
|
||||
@@ -147,7 +147,7 @@
|
||||
== NULL)
|
||||
goto done;
|
||||
if ((rv = file_softmagic(ms, utf8_buf,
|
||||
- (size_t)(utf8_end - utf8_buf), TEXTTEST, text)) == 0)
|
||||
+ (size_t)(utf8_end - utf8_buf), 0, TEXTTEST, text)) == 0)
|
||||
rv = -1;
|
||||
}
|
||||
|
||||
@@ -211,6 +211,7 @@
|
||||
case 0:
|
||||
if (file_printf(ms, ", ") == -1)
|
||||
@@ -860,8 +869,8 @@ diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
|
||||
return rv;
|
||||
}
|
||||
diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
--- libmagic.orig/cdf.c 2013-03-21 18:45:14.000000000 +0100
|
||||
+++ libmagic/cdf.c 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/cdf.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/cdf.c Sun Apr 7 22:30:22 2013
|
||||
@@ -43,7 +43,17 @@
|
||||
#include <err.h>
|
||||
#endif
|
||||
@@ -923,8 +932,8 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
(void)fprintf(stderr, "timestamp %s\n", buf);
|
||||
} else {
|
||||
diff -u libmagic.orig/cdf.h libmagic/cdf.h
|
||||
--- libmagic.orig/cdf.h 2012-10-31 18:03:01.000000000 +0100
|
||||
+++ libmagic/cdf.h 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/cdf.h Wed Oct 31 18:03:01 2012
|
||||
+++ libmagic/cdf.h Sun Apr 7 22:30:22 2013
|
||||
@@ -35,10 +35,12 @@
|
||||
#ifndef _H_CDF_
|
||||
#define _H_CDF_
|
||||
@@ -966,8 +975,8 @@ diff -u libmagic.orig/cdf.h libmagic/cdf.h
|
||||
void cdf_swap_header(cdf_header_t *);
|
||||
void cdf_unpack_header(cdf_header_t *, char *);
|
||||
diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
|
||||
--- libmagic.orig/cdf_time.c 2012-10-31 18:03:01.000000000 +0100
|
||||
+++ libmagic/cdf_time.c 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/cdf_time.c Wed Oct 31 18:03:01 2012
|
||||
+++ libmagic/cdf_time.c Sun Apr 7 22:30:22 2013
|
||||
@@ -96,7 +96,7 @@
|
||||
}
|
||||
|
||||
@@ -1026,8 +1035,8 @@ diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
|
||||
static const cdf_timestamp_t tst = 0x01A5E403C2D59C00ULL;
|
||||
static const char *ref = "Sat Apr 23 01:30:00 1977";
|
||||
diff -u libmagic.orig/compress.c libmagic/compress.c
|
||||
--- libmagic.orig/compress.c 2013-01-06 21:35:43.000000000 +0100
|
||||
+++ libmagic/compress.c 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/compress.c Sun Jan 6 21:35:43 2013
|
||||
+++ libmagic/compress.c Sun Apr 7 22:30:22 2013
|
||||
@@ -32,6 +32,7 @@
|
||||
* uncompress(method, old, n, newch) - uncompress old into new,
|
||||
* using method, return sizeof new
|
||||
@@ -1189,8 +1198,8 @@ diff -u libmagic.orig/compress.c libmagic/compress.c
|
||||
-#endif
|
||||
+#endif /* if PHP_FILEINFO_UNCOMPRESS */
|
||||
diff -u libmagic.orig/file.h libmagic/file.h
|
||||
--- libmagic.orig/file.h 2013-02-18 16:40:59.000000000 +0100
|
||||
+++ libmagic/file.h 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/file.h Mon Feb 18 16:40:59 2013
|
||||
+++ libmagic/file.h Tue Feb 18 18:44:17 2014
|
||||
@@ -33,11 +33,9 @@
|
||||
#ifndef __file_h__
|
||||
#define __file_h__
|
||||
@@ -1303,7 +1312,13 @@ 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
|
||||
@@ -443,16 +442,13 @@
|
||||
@@ -438,21 +437,18 @@
|
||||
unichar **, size_t *, const char **, const char **, const char **);
|
||||
protected int file_is_tar(struct magic_set *, const unsigned char *, size_t);
|
||||
protected int file_softmagic(struct magic_set *, const unsigned char *, size_t,
|
||||
- int, int);
|
||||
+ size_t, int, int);
|
||||
protected int file_apprentice(struct magic_set *, const char *, int);
|
||||
protected int file_magicfind(struct magic_set *, const char *, struct mlist *);
|
||||
protected uint64_t file_signextend(struct magic_set *, struct magic *,
|
||||
uint64_t);
|
||||
@@ -1377,22 +1392,24 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
|
||||
#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H) && !defined(QUICK)
|
||||
#define QUICK
|
||||
@@ -533,4 +511,12 @@
|
||||
#define FILE_RCSID(id)
|
||||
@@ -531,6 +509,14 @@
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define FILE_RCSID(id)
|
||||
+#endif
|
||||
+
|
||||
+#ifdef PHP_WIN32
|
||||
+#define FINFO_LSEEK_FUNC _lseek
|
||||
+#define FINFO_READ_FUNC _read
|
||||
+#else
|
||||
+#define FINFO_LSEEK_FUNC lseek
|
||||
+#define FINFO_READ_FUNC read
|
||||
+#endif
|
||||
+
|
||||
#endif
|
||||
|
||||
#endif /* __file_h__ */
|
||||
diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
|
||||
--- libmagic.orig/fsmagic.c 2013-03-21 18:45:14.000000000 +0100
|
||||
+++ libmagic/fsmagic.c 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/fsmagic.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/fsmagic.c Sun Apr 7 22:30:22 2013
|
||||
@@ -59,27 +59,21 @@
|
||||
# define minor(dev) ((dev) & 0xff)
|
||||
#endif
|
||||
@@ -1758,8 +1775,8 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
|
||||
return ret;
|
||||
}
|
||||
diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
--- libmagic.orig/funcs.c 2012-10-31 18:03:01.000000000 +0100
|
||||
+++ libmagic/funcs.c 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/funcs.c Wed Oct 31 18:03:01 2012
|
||||
+++ libmagic/funcs.c Tue Feb 18 18:44:17 2014
|
||||
@@ -41,52 +41,42 @@
|
||||
#if defined(HAVE_WCTYPE_H)
|
||||
#include <wctype.h>
|
||||
@@ -1896,7 +1913,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;
|
||||
@@ -219,12 +221,17 @@
|
||||
@@ -219,16 +221,21 @@
|
||||
}
|
||||
|
||||
/* Check if we have a CDF file */
|
||||
@@ -1919,6 +1936,11 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
|
||||
/* try soft magic tests */
|
||||
if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0)
|
||||
- if ((m = file_softmagic(ms, ubuf, nb, BINTEST,
|
||||
+ if ((m = file_softmagic(ms, ubuf, nb, 0, BINTEST,
|
||||
looks_text)) != 0) {
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
(void)fprintf(stderr, "softmagic %d\n", m);
|
||||
@@ -296,7 +303,6 @@
|
||||
|
||||
return m;
|
||||
@@ -2047,8 +2069,8 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
}
|
||||
+
|
||||
diff -u libmagic.orig/magic.c libmagic/magic.c
|
||||
--- libmagic.orig/magic.c 2013-01-11 17:43:09.000000000 +0100
|
||||
+++ libmagic/magic.c 2013-04-27 13:53:32.175250261 +0200
|
||||
--- libmagic.orig/magic.c Fri Jan 11 17:43:09 2013
|
||||
+++ libmagic/magic.c Fri May 3 15:19:35 2013
|
||||
@@ -25,11 +25,6 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
@@ -2391,8 +2413,8 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
|
||||
public const char *
|
||||
magic_error(struct magic_set *ms)
|
||||
diff -u libmagic.orig/magic.h libmagic/magic.h
|
||||
--- libmagic.orig/magic.h 2013-03-21 18:52:42.000000000 +0100
|
||||
+++ libmagic/magic.h 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/magic.h Thu Mar 21 18:52:42 2013
|
||||
+++ libmagic/magic.h Sun Apr 7 22:30:22 2013
|
||||
@@ -87,6 +87,7 @@
|
||||
|
||||
const char *magic_getpath(const char *, int);
|
||||
@@ -2410,15 +2432,15 @@ diff -u libmagic.orig/magic.h libmagic/magic.h
|
||||
int magic_errno(magic_t);
|
||||
|
||||
diff -u libmagic.orig/print.c libmagic/print.c
|
||||
--- libmagic.orig/print.c 2013-03-21 18:45:14.000000000 +0100
|
||||
+++ libmagic/print.c 2013-04-27 13:53:32.175250261 +0200
|
||||
@@ -28,13 +28,17 @@
|
||||
/*
|
||||
--- libmagic.orig/print.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/print.c Mon Dec 16 23:09:24 2013
|
||||
@@ -29,12 +29,17 @@
|
||||
* print.c - debugging printout routines
|
||||
*/
|
||||
|
||||
+#define _GNU_SOURCE
|
||||
+#include "php.h"
|
||||
|
||||
+
|
||||
#include "file.h"
|
||||
+#include "cdf.h"
|
||||
|
||||
@@ -2430,7 +2452,7 @@ diff -u libmagic.orig/print.c libmagic/print.c
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
@@ -43,188 +47,28 @@
|
||||
@@ -43,188 +48,28 @@
|
||||
#endif
|
||||
#include <time.h>
|
||||
|
||||
@@ -2631,7 +2653,7 @@ diff -u libmagic.orig/print.c libmagic/print.c
|
||||
}
|
||||
|
||||
protected const char *
|
||||
@@ -235,7 +79,7 @@
|
||||
@@ -235,7 +80,7 @@
|
||||
struct tm *tm;
|
||||
|
||||
if (flags & FILE_T_WINDOWS) {
|
||||
@@ -2641,8 +2663,8 @@ diff -u libmagic.orig/print.c libmagic/print.c
|
||||
t = ts.tv_sec;
|
||||
}
|
||||
diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
--- libmagic.orig/readcdf.c 2012-10-31 18:03:01.000000000 +0100
|
||||
+++ libmagic/readcdf.c 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/readcdf.c Wed Oct 31 18:03:01 2012
|
||||
+++ libmagic/readcdf.c Sun Apr 7 22:30:22 2013
|
||||
@@ -30,7 +30,11 @@
|
||||
#endif
|
||||
|
||||
@@ -2704,8 +2726,8 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
if (file_printf(ms, "application/CDFV2-corrupt") == -1)
|
||||
return -1;
|
||||
diff -u libmagic.orig/readelf.c libmagic/readelf.c
|
||||
--- libmagic.orig/readelf.c 2013-03-21 18:45:14.000000000 +0100
|
||||
+++ libmagic/readelf.c 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/readelf.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/readelf.c Sun Apr 7 22:30:22 2013
|
||||
@@ -48,8 +48,8 @@
|
||||
private int dophn_exec(struct magic_set *, int, int, int, off_t, int, size_t,
|
||||
off_t, int *, int);
|
||||
@@ -2956,8 +2978,8 @@ diff -u libmagic.orig/readelf.c libmagic/readelf.c
|
||||
|
||||
if (fstat(fd, &st) == -1) {
|
||||
diff -u libmagic.orig/readelf.h libmagic/readelf.h
|
||||
--- libmagic.orig/readelf.h 2013-03-21 18:45:14.000000000 +0100
|
||||
+++ libmagic/readelf.h 2013-03-31 16:57:18.499744030 +0200
|
||||
--- libmagic.orig/readelf.h Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/readelf.h Wed Mar 28 15:35:26 2012
|
||||
@@ -44,9 +44,17 @@
|
||||
typedef uint32_t Elf32_Word;
|
||||
typedef uint8_t Elf32_Char;
|
||||
@@ -2977,8 +2999,8 @@ diff -u libmagic.orig/readelf.h libmagic/readelf.h
|
||||
typedef uint32_t Elf64_Word;
|
||||
typedef uint8_t Elf64_Char;
|
||||
diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
--- libmagic.orig/softmagic.c 2013-03-21 18:45:14.000000000 +0100
|
||||
+++ libmagic/softmagic.c 2013-05-14 11:00:07.044745939 +0200
|
||||
--- libmagic.orig/softmagic.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/softmagic.c Mon Mar 10 14:03:18 2014
|
||||
@@ -41,6 +41,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
@@ -2991,7 +3013,32 @@ 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 *,
|
||||
@@ -132,7 +137,7 @@
|
||||
@@ -62,6 +67,8 @@
|
||||
private void cvt_32(union VALUETYPE *, const struct magic *);
|
||||
private void cvt_64(union VALUETYPE *, const struct magic *);
|
||||
|
||||
+#define OFFSET_OOB(n, o, i) ((n) < (o) || (i) > ((n) - (o)))
|
||||
+
|
||||
/*
|
||||
* softmagic - lookup one file in parsed, in-memory copy of database
|
||||
* Passed the name and FILE * of one file to be typed.
|
||||
@@ -69,13 +76,13 @@
|
||||
/*ARGSUSED1*/ /* nbytes passed for regularity, maybe need later */
|
||||
protected int
|
||||
file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
|
||||
- int mode, int text)
|
||||
+ size_t level, int mode, int text)
|
||||
{
|
||||
struct mlist *ml;
|
||||
int rv, printed_something = 0, need_separator = 0;
|
||||
for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next)
|
||||
if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, 0, mode,
|
||||
- text, 0, 0, &printed_something, &need_separator,
|
||||
+ text, 0, level, &printed_something, &need_separator,
|
||||
NULL)) != 0)
|
||||
return rv;
|
||||
|
||||
@@ -132,7 +139,7 @@
|
||||
struct magic *m = &magic[magindex];
|
||||
|
||||
if (m->type != FILE_NAME)
|
||||
@@ -3000,7 +3047,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
#define FLT (STRING_BINTEST | STRING_TEXTTEST)
|
||||
((text && (m->str_flags & FLT) == STRING_BINTEST) ||
|
||||
(!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
|
||||
@@ -209,8 +214,8 @@
|
||||
@@ -209,8 +216,8 @@
|
||||
if (file_check_mem(ms, ++cont_level) == -1)
|
||||
return -1;
|
||||
|
||||
@@ -3011,7 +3058,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
m = &magic[magindex];
|
||||
ms->line = m->lineno; /* for messages */
|
||||
|
||||
@@ -335,44 +340,22 @@
|
||||
@@ -335,44 +342,22 @@
|
||||
private int
|
||||
check_fmt(struct magic_set *ms, struct magic *m)
|
||||
{
|
||||
@@ -3066,7 +3113,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
private int32_t
|
||||
mprint(struct magic_set *ms, struct magic *m)
|
||||
{
|
||||
@@ -583,13 +566,13 @@
|
||||
@@ -583,13 +568,13 @@
|
||||
char *cp;
|
||||
int rval;
|
||||
|
||||
@@ -3082,7 +3129,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
|
||||
if (rval == -1)
|
||||
return -1;
|
||||
@@ -835,16 +818,16 @@
|
||||
@@ -835,16 +820,16 @@
|
||||
if (m->num_mask) \
|
||||
switch (m->mask_op & FILE_OPS_MASK) { \
|
||||
case FILE_OPADD: \
|
||||
@@ -3103,7 +3150,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
break; \
|
||||
} \
|
||||
|
||||
@@ -1145,9 +1128,6 @@
|
||||
@@ -1145,9 +1130,6 @@
|
||||
"nbytes=%zu, count=%u)\n", m->type, m->flag, offset, o,
|
||||
nbytes, count);
|
||||
mdebug(offset, (char *)(void *)p, sizeof(union VALUETYPE));
|
||||
@@ -3113,7 +3160,79 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
}
|
||||
|
||||
if (m->flag & INDIR) {
|
||||
@@ -1644,9 +1624,6 @@
|
||||
@@ -1191,7 +1173,7 @@
|
||||
}
|
||||
switch (cvt_flip(m->in_type, flip)) {
|
||||
case FILE_BYTE:
|
||||
- if (nbytes < (offset + 1))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 1))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1226,7 +1208,7 @@
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_BESHORT:
|
||||
- if (nbytes < (offset + 2))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 2))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1278,7 +1260,7 @@
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_LESHORT:
|
||||
- if (nbytes < (offset + 2))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 2))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1330,7 +1312,7 @@
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_SHORT:
|
||||
- if (nbytes < (offset + 2))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 2))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1367,7 +1349,7 @@
|
||||
break;
|
||||
case FILE_BELONG:
|
||||
case FILE_BEID3:
|
||||
- if (nbytes < (offset + 4))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1438,7 +1420,7 @@
|
||||
break;
|
||||
case FILE_LELONG:
|
||||
case FILE_LEID3:
|
||||
- if (nbytes < (offset + 4))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1508,7 +1490,7 @@
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_MELONG:
|
||||
- if (nbytes < (offset + 4))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1578,7 +1560,7 @@
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_LONG:
|
||||
- if (nbytes < (offset + 4))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1644,23 +1626,20 @@
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0) {
|
||||
mdebug(offset, (char *)(void *)p,
|
||||
sizeof(union VALUETYPE));
|
||||
@@ -3123,23 +3242,101 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1717,12 +1694,12 @@
|
||||
ms->o.buf = sbuf;
|
||||
/* Verify we have enough data to match magic type */
|
||||
switch (m->type) {
|
||||
case FILE_BYTE:
|
||||
- if (nbytes < (offset + 1)) /* should alway be true */
|
||||
+ if (OFFSET_OOB(nbytes, offset, 1))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_SHORT:
|
||||
case FILE_BESHORT:
|
||||
case FILE_LESHORT:
|
||||
- if (nbytes < (offset + 2))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 2))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
@@ -1679,38 +1658,40 @@
|
||||
case FILE_FLOAT:
|
||||
case FILE_BEFLOAT:
|
||||
case FILE_LEFLOAT:
|
||||
- if (nbytes < (offset + 4))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_DOUBLE:
|
||||
case FILE_BEDOUBLE:
|
||||
case FILE_LEDOUBLE:
|
||||
- if (nbytes < (offset + 8))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 8))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_STRING:
|
||||
case FILE_PSTRING:
|
||||
case FILE_SEARCH:
|
||||
- if (nbytes < (offset + m->vallen))
|
||||
+ if (OFFSET_OOB(nbytes, offset, m->vallen))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_REGEX:
|
||||
- if (nbytes < offset)
|
||||
+ if (OFFSET_OOB(nbytes, offset, 0))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_INDIRECT:
|
||||
- if (nbytes < offset)
|
||||
+ if (offset == 0)
|
||||
+ return 0;
|
||||
+ if (OFFSET_OOB(nbytes, offset, 0))
|
||||
return 0;
|
||||
sbuf = ms->o.buf;
|
||||
soffset = ms->offset;
|
||||
ms->o.buf = NULL;
|
||||
ms->offset = 0;
|
||||
rv = file_softmagic(ms, s + offset, nbytes - offset,
|
||||
- BINTEST, text);
|
||||
+ recursion_level, BINTEST, text);
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
|
||||
rbuf = ms->o.buf;
|
||||
@@ -1718,16 +1699,26 @@
|
||||
ms->offset = soffset;
|
||||
if (rv == 1) {
|
||||
- if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
|
||||
+ if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
|
||||
file_printf(ms, m->desc, offset) == -1)
|
||||
- return -1;
|
||||
+ return -1;
|
||||
if (file_printf(ms, "%s", rbuf) == -1)
|
||||
if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
|
||||
- file_printf(ms, m->desc, offset) == -1)
|
||||
+ file_printf(ms, m->desc, offset) == -1) {
|
||||
+ if (rbuf) {
|
||||
+ efree(rbuf);
|
||||
+ }
|
||||
return -1;
|
||||
- if (file_printf(ms, "%s", rbuf) == -1)
|
||||
+ }
|
||||
+ if (file_printf(ms, "%s", rbuf) == -1) {
|
||||
+ if (rbuf) {
|
||||
+ efree(rbuf);
|
||||
+ }
|
||||
return -1;
|
||||
- free(rbuf);
|
||||
+ }
|
||||
+ }
|
||||
+ if (rbuf) {
|
||||
+ efree(rbuf);
|
||||
}
|
||||
return rv;
|
||||
|
||||
@@ -1837,6 +1814,42 @@
|
||||
case FILE_USE:
|
||||
- if (nbytes < offset)
|
||||
+ if (OFFSET_OOB(nbytes, offset, 0))
|
||||
return 0;
|
||||
sbuf = m->value.s;
|
||||
if (*sbuf == '^') {
|
||||
@@ -1837,6 +1828,42 @@
|
||||
return file_strncmp(a, b, len, flags);
|
||||
}
|
||||
|
||||
@@ -3182,7 +3379,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
private int
|
||||
magiccheck(struct magic_set *ms, struct magic *m)
|
||||
{
|
||||
@@ -1996,69 +2009,157 @@
|
||||
@@ -1996,69 +2023,157 @@
|
||||
break;
|
||||
}
|
||||
case FILE_REGEX: {
|
||||
|
||||
@@ -147,7 +147,7 @@ file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf,
|
||||
== NULL)
|
||||
goto done;
|
||||
if ((rv = file_softmagic(ms, utf8_buf,
|
||||
(size_t)(utf8_end - utf8_buf), TEXTTEST, text)) == 0)
|
||||
(size_t)(utf8_end - utf8_buf), 0, TEXTTEST, text)) == 0)
|
||||
rv = -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -437,7 +437,7 @@ protected int file_encoding(struct magic_set *, const unsigned char *, size_t,
|
||||
unichar **, size_t *, const char **, const char **, const char **);
|
||||
protected int file_is_tar(struct magic_set *, const unsigned char *, size_t);
|
||||
protected int file_softmagic(struct magic_set *, const unsigned char *, size_t,
|
||||
int, int);
|
||||
size_t, int, int);
|
||||
protected int file_apprentice(struct magic_set *, const char *, int);
|
||||
protected int file_magicfind(struct magic_set *, const char *, struct mlist *);
|
||||
protected uint64_t file_signextend(struct magic_set *, struct magic *,
|
||||
|
||||
@@ -235,7 +235,7 @@ file_buffer(struct magic_set *ms, php_stream *stream, const char *inname, const
|
||||
|
||||
/* try soft magic tests */
|
||||
if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0)
|
||||
if ((m = file_softmagic(ms, ubuf, nb, BINTEST,
|
||||
if ((m = file_softmagic(ms, ubuf, nb, 0, BINTEST,
|
||||
looks_text)) != 0) {
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
(void)fprintf(stderr, "softmagic %d\n", m);
|
||||
|
||||
@@ -67,6 +67,8 @@ private void cvt_16(union VALUETYPE *, const struct magic *);
|
||||
private void cvt_32(union VALUETYPE *, const struct magic *);
|
||||
private void cvt_64(union VALUETYPE *, const struct magic *);
|
||||
|
||||
#define OFFSET_OOB(n, o, i) ((n) < (o) || (i) > ((n) - (o)))
|
||||
|
||||
/*
|
||||
* softmagic - lookup one file in parsed, in-memory copy of database
|
||||
* Passed the name and FILE * of one file to be typed.
|
||||
@@ -74,13 +76,13 @@ private void cvt_64(union VALUETYPE *, const struct magic *);
|
||||
/*ARGSUSED1*/ /* nbytes passed for regularity, maybe need later */
|
||||
protected int
|
||||
file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
|
||||
int mode, int text)
|
||||
size_t level, int mode, int text)
|
||||
{
|
||||
struct mlist *ml;
|
||||
int rv, printed_something = 0, need_separator = 0;
|
||||
for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next)
|
||||
if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, 0, mode,
|
||||
text, 0, 0, &printed_something, &need_separator,
|
||||
text, 0, level, &printed_something, &need_separator,
|
||||
NULL)) != 0)
|
||||
return rv;
|
||||
|
||||
@@ -1171,7 +1173,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
}
|
||||
switch (cvt_flip(m->in_type, flip)) {
|
||||
case FILE_BYTE:
|
||||
if (nbytes < (offset + 1))
|
||||
if (OFFSET_OOB(nbytes, offset, 1))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1206,7 +1208,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_BESHORT:
|
||||
if (nbytes < (offset + 2))
|
||||
if (OFFSET_OOB(nbytes, offset, 2))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1258,7 +1260,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_LESHORT:
|
||||
if (nbytes < (offset + 2))
|
||||
if (OFFSET_OOB(nbytes, offset, 2))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1310,7 +1312,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_SHORT:
|
||||
if (nbytes < (offset + 2))
|
||||
if (OFFSET_OOB(nbytes, offset, 2))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1347,7 +1349,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
break;
|
||||
case FILE_BELONG:
|
||||
case FILE_BEID3:
|
||||
if (nbytes < (offset + 4))
|
||||
if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1418,7 +1420,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
break;
|
||||
case FILE_LELONG:
|
||||
case FILE_LEID3:
|
||||
if (nbytes < (offset + 4))
|
||||
if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1488,7 +1490,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_MELONG:
|
||||
if (nbytes < (offset + 4))
|
||||
if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1558,7 +1560,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_LONG:
|
||||
if (nbytes < (offset + 4))
|
||||
if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1630,14 +1632,14 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
/* Verify we have enough data to match magic type */
|
||||
switch (m->type) {
|
||||
case FILE_BYTE:
|
||||
if (nbytes < (offset + 1)) /* should always be true */
|
||||
if (OFFSET_OOB(nbytes, offset, 1))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_SHORT:
|
||||
case FILE_BESHORT:
|
||||
case FILE_LESHORT:
|
||||
if (nbytes < (offset + 2))
|
||||
if (OFFSET_OOB(nbytes, offset, 2))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
@@ -1656,55 +1658,67 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
case FILE_FLOAT:
|
||||
case FILE_BEFLOAT:
|
||||
case FILE_LEFLOAT:
|
||||
if (nbytes < (offset + 4))
|
||||
if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_DOUBLE:
|
||||
case FILE_BEDOUBLE:
|
||||
case FILE_LEDOUBLE:
|
||||
if (nbytes < (offset + 8))
|
||||
if (OFFSET_OOB(nbytes, offset, 8))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_STRING:
|
||||
case FILE_PSTRING:
|
||||
case FILE_SEARCH:
|
||||
if (nbytes < (offset + m->vallen))
|
||||
if (OFFSET_OOB(nbytes, offset, m->vallen))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_REGEX:
|
||||
if (nbytes < offset)
|
||||
if (OFFSET_OOB(nbytes, offset, 0))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_INDIRECT:
|
||||
if (nbytes < offset)
|
||||
if (offset == 0)
|
||||
return 0;
|
||||
if (OFFSET_OOB(nbytes, offset, 0))
|
||||
return 0;
|
||||
sbuf = ms->o.buf;
|
||||
soffset = ms->offset;
|
||||
ms->o.buf = NULL;
|
||||
ms->offset = 0;
|
||||
rv = file_softmagic(ms, s + offset, nbytes - offset,
|
||||
BINTEST, text);
|
||||
recursion_level, BINTEST, text);
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
|
||||
rbuf = ms->o.buf;
|
||||
ms->o.buf = sbuf;
|
||||
ms->offset = soffset;
|
||||
if (rv == 1) {
|
||||
if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
|
||||
file_printf(ms, m->desc, offset) == -1)
|
||||
return -1;
|
||||
if (file_printf(ms, "%s", rbuf) == -1)
|
||||
if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
|
||||
file_printf(ms, m->desc, offset) == -1) {
|
||||
if (rbuf) {
|
||||
efree(rbuf);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
if (file_printf(ms, "%s", rbuf) == -1) {
|
||||
if (rbuf) {
|
||||
efree(rbuf);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (rbuf) {
|
||||
efree(rbuf);
|
||||
}
|
||||
return rv;
|
||||
|
||||
case FILE_USE:
|
||||
if (nbytes < offset)
|
||||
if (OFFSET_OOB(nbytes, offset, 0))
|
||||
return 0;
|
||||
sbuf = m->value.s;
|
||||
if (*sbuf == '^') {
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
Patches applied to file sources tree before generating magic.mgc
|
||||
and before running create_data_file.php to create data_file.c.
|
||||
|
||||
|
||||
|
||||
From ef2329cf71acb59204dd981e2c6cce6c81fe467c Mon Sep 17 00:00:00 2001
|
||||
From: Christos Zoulas <christos@zoulas.com>
|
||||
Date: Mon, 25 Mar 2013 14:06:55 +0000
|
||||
Subject: [PATCH] limit to 100 repetitions to avoid excessive backtracking
|
||||
Carsten Wolff
|
||||
|
||||
---
|
||||
magic/Magdir/commands | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/magic/Magdir/commands b/magic/Magdir/commands
|
||||
index 67c3eee..4a7d8dd 100644
|
||||
--- a/magic/Magdir/commands
|
||||
+++ b/magic/Magdir/commands
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
-# $File: commands,v 1.44 2013/02/05 15:20:47 christos Exp $
|
||||
+# $File: commands,v 1.45 2013/02/06 14:18:52 christos Exp $
|
||||
# commands: file(1) magic for various shells and interpreters
|
||||
#
|
||||
#0 string/w : shell archive or script for antique kernel text
|
||||
@@ -49,7 +49,7 @@
|
||||
!:mime text/x-awk
|
||||
0 string/wt #!\ /usr/bin/awk awk script text executable
|
||||
!:mime text/x-awk
|
||||
-0 regex =^\\s*BEGIN\\s*[{] awk script text
|
||||
+0 regex =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text
|
||||
|
||||
# AT&T Bell Labs' Plan 9 shell
|
||||
0 string/wt #!\ /bin/rc Plan 9 rc shell script text executable
|
||||
--
|
||||
1.8.5.5
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
extern zend_module_entry fileinfo_module_entry;
|
||||
#define phpext_fileinfo_ptr &fileinfo_module_entry
|
||||
|
||||
#define PHP_FILEINFO_VERSION "1.0.5-dev"
|
||||
#define PHP_FILEINFO_VERSION "1.0.5"
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#define PHP_FILEINFO_API __declspec(dllexport)
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
--TEST--
|
||||
Bug #66731: file: infinite recursion
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!class_exists('finfo'))
|
||||
die('skip no fileinfo extension');
|
||||
--FILE--
|
||||
<?php
|
||||
$fd = __DIR__.'/cve-2014-1943.data';
|
||||
$fm = __DIR__.'/cve-2014-1943.magic';
|
||||
|
||||
$a = "\105\122\000\000\000\000\000";
|
||||
$b = str_repeat("\001", 250000);
|
||||
$m = "0 byte x\n".
|
||||
">(1.b) indirect x\n";
|
||||
|
||||
file_put_contents($fd, $a);
|
||||
$fi = finfo_open(FILEINFO_NONE);
|
||||
var_dump(finfo_file($fi, $fd));
|
||||
finfo_close($fi);
|
||||
|
||||
file_put_contents($fd, $b);
|
||||
file_put_contents($fm, $m);
|
||||
$fi = finfo_open(FILEINFO_NONE, $fm);
|
||||
var_dump(finfo_file($fi, $fd));
|
||||
finfo_close($fi);
|
||||
?>
|
||||
Done
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__.'/cve-2014-1943.data');
|
||||
@unlink(__DIR__.'/cve-2014-1943.magic');
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(%d) "%s"
|
||||
|
||||
Warning: finfo_file(): Failed identify data 0:(null) in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
@@ -4888,7 +4888,7 @@
|
||||
>>0 ubyte 0xF5 FoxPro with memo
|
||||
# http://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
|
||||
#>>0 ubyte 0xFA FoxPro 2.x, with memo
|
||||
# unkown version (should not happen)
|
||||
# unknown version (should not happen)
|
||||
>>0 default x xBase
|
||||
>>>0 ubyte x (0x%x)
|
||||
# flags in version byte
|
||||
@@ -6115,7 +6115,7 @@
|
||||
>>>>>379 string GRUB\ \0 \b, GRUB version 0.95 or 0.96
|
||||
>>>>391 string Geom\0Hard\ Disk\0Read\0\ Error\0
|
||||
>>>>>385 string GRUB\ \0 \b, GRUB version 0.97
|
||||
#unkown version
|
||||
#unknown version
|
||||
>>>343 string Geom\0Read\0\ Error\0
|
||||
>>>>321 string Loading\ stage1.5 \b, GRUB version x.y
|
||||
>>>380 string Geom\0Hard\ Disk\0Read\0\ Error\0
|
||||
|
||||
+13
-28
@@ -4879,7 +4879,7 @@ PHP_FUNCTION(imageconvolution)
|
||||
if (zend_hash_index_find(Z_ARRVAL_PP(var), (j), (void **) &var2) == SUCCESS) {
|
||||
if (Z_TYPE_PP(var2) != IS_DOUBLE) {
|
||||
zval dval;
|
||||
dval = **var;
|
||||
dval = **var2;
|
||||
zval_copy_ctor(&dval);
|
||||
convert_to_double(&dval);
|
||||
matrix[i][j] = (float)Z_DVAL(dval);
|
||||
@@ -5101,40 +5101,24 @@ PHP_FUNCTION(imagescale)
|
||||
{
|
||||
zval *IM;
|
||||
gdImagePtr im;
|
||||
gdImagePtr im_scaled;
|
||||
int new_width, new_height = -1;
|
||||
gdInterpolationMethod method = GD_BILINEAR_FIXED;
|
||||
gdImagePtr im_scaled = NULL;
|
||||
int new_width, new_height;
|
||||
long tmp_w, tmp_h=-1, tmp_m = GD_BILINEAR_FIXED;
|
||||
gdInterpolationMethod method;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|ll", &IM, &new_width, &new_height, &method) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|ll", &IM, &tmp_w, &tmp_h, &tmp_m) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
method = tmp_m;
|
||||
new_width = tmp_w;
|
||||
new_height = tmp_h;
|
||||
|
||||
ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd);
|
||||
im_scaled = gdImageScale(im, new_width, new_height);
|
||||
goto finish;
|
||||
switch (method) {
|
||||
case GD_NEAREST_NEIGHBOUR:
|
||||
im_scaled = gdImageScaleNearestNeighbour(im, new_width, new_height);
|
||||
break;
|
||||
|
||||
case GD_BILINEAR_FIXED:
|
||||
im_scaled = gdImageScaleBilinear(im, new_width, new_height);
|
||||
break;
|
||||
|
||||
case GD_BICUBIC:
|
||||
im_scaled = gdImageScaleBicubicFixed(im, new_width, new_height);
|
||||
break;
|
||||
|
||||
case GD_BICUBIC_FIXED:
|
||||
im_scaled = gdImageScaleBicubicFixed(im, new_width, new_height);
|
||||
break;
|
||||
|
||||
default:
|
||||
im_scaled = gdImageScaleTwoPass(im, im->sx, im->sy, new_width, new_height);
|
||||
break;
|
||||
|
||||
if (gdImageSetInterpolationMethod(im, method)) {
|
||||
im_scaled = gdImageScale(im, new_width, new_height);
|
||||
}
|
||||
finish:
|
||||
|
||||
if (im_scaled == NULL) {
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
@@ -5298,6 +5282,7 @@ PHP_FUNCTION(imageaffinematrixget)
|
||||
double x, y;
|
||||
if (Z_TYPE_P(options) != IS_ARRAY) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array expected as options");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (zend_hash_find(HASH_OF(options), "x", sizeof("x"), (void **)&tmp) != FAILURE) {
|
||||
if (Z_TYPE_PP(tmp) != IS_DOUBLE) {
|
||||
|
||||
@@ -45,22 +45,20 @@ gdImagePtr gdImageCrop(gdImagePtr src, const gdRectPtr crop)
|
||||
gdImagePtr dst;
|
||||
int y;
|
||||
|
||||
/* check size */
|
||||
if (crop->width<=0 || crop->height<=0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* allocate the requested size (could be only partially filled) */
|
||||
if (src->trueColor) {
|
||||
dst = gdImageCreateTrueColor(crop->width, crop->height);
|
||||
if (dst == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
gdImageSaveAlpha(dst, 1);
|
||||
} else {
|
||||
dst = gdImageCreate(crop->width, crop->height);
|
||||
if (dst == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
gdImagePaletteCopy(dst, src);
|
||||
}
|
||||
if (dst == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
dst->transparent = src->transparent;
|
||||
|
||||
/* check position in the src image */
|
||||
|
||||
@@ -1324,8 +1324,8 @@ static gdImagePtr gdImageScaleBilinearTC(gdImagePtr im, const unsigned int new_w
|
||||
gdFixed f_j = gd_itofx(j);
|
||||
gdFixed f_a = gd_mulfx(f_i, f_dy);
|
||||
gdFixed f_b = gd_mulfx(f_j, f_dx);
|
||||
const long m = gd_fxtoi(f_a);
|
||||
const long n = gd_fxtoi(f_b);
|
||||
const gdFixed m = gd_fxtoi(f_a);
|
||||
const gdFixed n = gd_fxtoi(f_b);
|
||||
gdFixed f_f = f_a - gd_itofx(m);
|
||||
gdFixed f_g = f_b - gd_itofx(n);
|
||||
|
||||
@@ -1365,10 +1365,10 @@ static gdImagePtr gdImageScaleBilinearTC(gdImagePtr im, const unsigned int new_w
|
||||
f_a3 = gd_itofx(gdTrueColorGetAlpha(pixel3));
|
||||
f_a4 = gd_itofx(gdTrueColorGetAlpha(pixel4));
|
||||
{
|
||||
const char red = (char) gd_fxtoi(gd_mulfx(f_w1, f_r1) + gd_mulfx(f_w2, f_r2) + gd_mulfx(f_w3, f_r3) + gd_mulfx(f_w4, f_r4));
|
||||
const char green = (char) gd_fxtoi(gd_mulfx(f_w1, f_g1) + gd_mulfx(f_w2, f_g2) + gd_mulfx(f_w3, f_g3) + gd_mulfx(f_w4, f_g4));
|
||||
const char blue = (char) gd_fxtoi(gd_mulfx(f_w1, f_b1) + gd_mulfx(f_w2, f_b2) + gd_mulfx(f_w3, f_b3) + gd_mulfx(f_w4, f_b4));
|
||||
const char alpha = (char) gd_fxtoi(gd_mulfx(f_w1, f_a1) + gd_mulfx(f_w2, f_a2) + gd_mulfx(f_w3, f_a3) + gd_mulfx(f_w4, f_a4));
|
||||
const unsigned char red = (unsigned char) gd_fxtoi(gd_mulfx(f_w1, f_r1) + gd_mulfx(f_w2, f_r2) + gd_mulfx(f_w3, f_r3) + gd_mulfx(f_w4, f_r4));
|
||||
const unsigned char green = (unsigned char) gd_fxtoi(gd_mulfx(f_w1, f_g1) + gd_mulfx(f_w2, f_g2) + gd_mulfx(f_w3, f_g3) + gd_mulfx(f_w4, f_g4));
|
||||
const unsigned char blue = (unsigned char) gd_fxtoi(gd_mulfx(f_w1, f_b1) + gd_mulfx(f_w2, f_b2) + gd_mulfx(f_w3, f_b3) + gd_mulfx(f_w4, f_b4));
|
||||
const unsigned char alpha = (unsigned char) gd_fxtoi(gd_mulfx(f_w1, f_a1) + gd_mulfx(f_w2, f_a2) + gd_mulfx(f_w3, f_a3) + gd_mulfx(f_w4, f_a4));
|
||||
|
||||
new_img->tpixels[dst_offset_v][dst_offset_h] = gdTrueColorAlpha(red, green, blue, alpha);
|
||||
}
|
||||
@@ -2472,10 +2472,7 @@ int gdImageSetInterpolationMethod(gdImagePtr im, gdInterpolationMethod id)
|
||||
|
||||
switch (id) {
|
||||
case GD_DEFAULT:
|
||||
im->interpolation_id = GD_BILINEAR_FIXED;
|
||||
im->interpolation = NULL;
|
||||
break;
|
||||
|
||||
id = GD_BILINEAR_FIXED;
|
||||
/* Optimized versions */
|
||||
case GD_BILINEAR_FIXED:
|
||||
case GD_BICUBIC_FIXED:
|
||||
|
||||
@@ -122,6 +122,10 @@ const char * gdJpegGetVersionString()
|
||||
return "8";
|
||||
break;
|
||||
|
||||
case 90:
|
||||
return "9 compatible";
|
||||
break;
|
||||
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ var_dump(imagecrop($img, array("x" => -20, "y" => -20, "width" => 10, "height" =
|
||||
// POC #4
|
||||
var_dump(imagecrop($img, array("x" => 0x7fffff00, "y" => 0, "width" => 10, "height" => 10)));
|
||||
|
||||
// bug 66815
|
||||
var_dump(imagecrop($img, array("x" => 0, "y" => 0, "width" => 65535, "height" => 65535)));
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(%d) of type (gd)
|
||||
@@ -35,6 +37,13 @@ Array
|
||||
[width] => 10
|
||||
[height] => 10
|
||||
)
|
||||
|
||||
Warning: imagecrop(): gd warning: one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully
|
||||
in %sbug66356.php on line %d
|
||||
bool(false)
|
||||
resource(%d) of type (gd)
|
||||
resource(%d) of type (gd)
|
||||
resource(%d) of type (gd)
|
||||
|
||||
Warning: imagecrop(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
|
||||
in %sbug66356.php on line %d
|
||||
bool(false)
|
||||
@@ -1529,6 +1529,7 @@ ZEND_FUNCTION(gmp_testbit)
|
||||
if (mpz_tstbit(*gmpnum_a, index)) {
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
||||
RETURN_FALSE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
+5
-6
@@ -609,16 +609,15 @@ Generate a PBKDF2 hash of the given password and salt
|
||||
Returns lowercase hexits by default */
|
||||
PHP_FUNCTION(hash_pbkdf2)
|
||||
{
|
||||
char *returnval, *algo, *salt, *pass = NULL;
|
||||
unsigned char *computed_salt, *digest, *temp, *result, *K1, *K2 = NULL;
|
||||
long loops, i, j, algo_len, pass_len, iterations, length, digest_length = 0;
|
||||
int argc, salt_len = 0;
|
||||
char *returnval, *algo, *salt, *pass;
|
||||
unsigned char *computed_salt, *digest, *temp, *result, *K1, *K2;
|
||||
long loops, i, j, iterations, length = 0, digest_length;
|
||||
int algo_len, pass_len, salt_len;
|
||||
zend_bool raw_output = 0;
|
||||
const php_hash_ops *ops;
|
||||
void *context;
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "sssl|lb", &algo, &algo_len, &pass, &pass_len, &salt, &salt_len, &iterations, &length, &raw_output) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssl|lb", &algo, &algo_len, &pass, &pass_len, &salt, &salt_len, &iterations, &length, &raw_output) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ Test hash_pbkdf2() function : basic functionality
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/* Prototype : string hash_hmac ( string $algo , string $data , string $key [, bool $raw_output ] )
|
||||
/* Prototype : string hash_hmac(string $algo, string $data, string $key [, int $length = 0 [, bool $raw_output = false]])
|
||||
* Description: Generate a keyed hash value using the HMAC method
|
||||
* Source code: ext/hash/hash.c
|
||||
* Alias to functions:
|
||||
@@ -14,10 +14,12 @@ Test hash_pbkdf2() function : basic functionality
|
||||
echo "*** Testing hash_pbkdf2() : basic functionality ***\n";
|
||||
|
||||
echo "sha1: " . hash_pbkdf2('sha1', 'password', 'salt', 1, 20)."\n";
|
||||
echo "sha1(no length): " . hash_pbkdf2('sha1', 'password', 'salt', 1)."\n";
|
||||
echo "sha1(raw): " . bin2hex(hash_pbkdf2('sha1', 'password', 'salt', 1, 20, TRUE))."\n";
|
||||
echo "sha1(rounds): " . hash_pbkdf2('sha1', 'passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 4096, 25)."\n";
|
||||
echo "sha1(rounds)(raw): " . bin2hex(hash_pbkdf2('sha1', 'passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 4096, 25, TRUE))."\n";
|
||||
echo "sha256: " . hash_pbkdf2('sha256', 'password', 'salt', 1, 20)."\n";
|
||||
echo "sha256(no length): " . hash_pbkdf2('sha256', 'password', 'salt', 1)."\n";
|
||||
echo "sha256(raw): " . bin2hex(hash_pbkdf2('sha256', 'password', 'salt', 1, 20, TRUE))."\n";
|
||||
echo "sha256(rounds): " . hash_pbkdf2('sha256', 'passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 4096, 40)."\n";
|
||||
echo "sha256(rounds)(raw): " . bin2hex(hash_pbkdf2('sha256', 'passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 4096, 40, TRUE))."\n";
|
||||
@@ -27,10 +29,12 @@ echo "sha256(rounds)(raw): " . bin2hex(hash_pbkdf2('sha256', 'passwordPASSWORDpa
|
||||
--EXPECT--
|
||||
*** Testing hash_pbkdf2() : basic functionality ***
|
||||
sha1: 0c60c80f961f0e71f3a9
|
||||
sha1(no length): 0c60c80f961f0e71f3a9b524af6012062fe037a6
|
||||
sha1(raw): 0c60c80f961f0e71f3a9b524af6012062fe037a6
|
||||
sha1(rounds): 3d2eec4fe41c849b80c8d8366
|
||||
sha1(rounds)(raw): 3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038
|
||||
sha256: 120fb6cffcf8b32c43e7
|
||||
sha256(no length): 120fb6cffcf8b32c43e7225256c4f837a86548c92ccc35480805987cb70be17b
|
||||
sha256(raw): 120fb6cffcf8b32c43e7225256c4f837a86548c9
|
||||
sha256(rounds): 348c89dbcbd32b2f32d814b8116e84cf2b17347e
|
||||
sha256(rounds)(raw): 348c89dbcbd32b2f32d814b8116e84cf2b17347ebc1800181c4e2a1fb8dd53e1c635518c7dac47e9
|
||||
|
||||
@@ -57,6 +57,8 @@ static inline void php_converter_throw_failure(php_converter_object *objval, UEr
|
||||
|
||||
/* {{{ php_converter_default_callback */
|
||||
static void php_converter_default_callback(zval *return_value, zval *zobj, long reason, zval *error TSRMLS_DC) {
|
||||
zval_dtor(error);
|
||||
ZVAL_LONG(error, U_ZERO_ERROR);
|
||||
/* Basic functionality so children can call parent::toUCallback() */
|
||||
switch (reason) {
|
||||
case UCNV_UNASSIGNED:
|
||||
@@ -66,7 +68,16 @@ static void php_converter_default_callback(zval *return_value, zval *zobj, long
|
||||
php_converter_object *objval = (php_converter_object*)CONV_GET(zobj);
|
||||
char chars[127];
|
||||
int8_t chars_len = sizeof(chars);
|
||||
UErrorCode error = U_ZERO_ERROR;
|
||||
UErrorCode uerror = U_ZERO_ERROR;
|
||||
if(!objval->src) {
|
||||
php_converter_throw_failure(objval, U_INVALID_STATE_ERROR TSRMLS_CC, "Source Converter has not been initialized yet");
|
||||
chars[0] = 0x1A;
|
||||
chars[1] = 0;
|
||||
chars_len = 1;
|
||||
ZVAL_LONG(error, U_INVALID_STATE_ERROR);
|
||||
RETVAL_STRINGL(chars, chars_len, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Yes, this is fairly wasteful at first glance,
|
||||
* but considering that the alternative is to store
|
||||
@@ -75,18 +86,17 @@ static void php_converter_default_callback(zval *return_value, zval *zobj, long
|
||||
* I'd rather take the CPU hit here, than waste time
|
||||
* storing a value I'm unlikely to use.
|
||||
*/
|
||||
ucnv_getSubstChars(objval->src, chars, &chars_len, &error);
|
||||
if (U_FAILURE(error)) {
|
||||
THROW_UFAILURE(objval, "ucnv_getSubstChars", error);
|
||||
ucnv_getSubstChars(objval->src, chars, &chars_len, &uerror);
|
||||
if (U_FAILURE(uerror)) {
|
||||
THROW_UFAILURE(objval, "ucnv_getSubstChars", uerror);
|
||||
chars[0] = 0x1A;
|
||||
chars[1] = 0;
|
||||
chars_len = 1;
|
||||
ZVAL_LONG(error, uerror);
|
||||
}
|
||||
RETVAL_STRINGL(chars, chars_len, 1);
|
||||
}
|
||||
}
|
||||
zval_dtor(error);
|
||||
ZVAL_LONG(error, U_ZERO_ERROR);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Bug #66873 - crash in UConverter with invalid encoding
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$o = new UConverter(1, 1);
|
||||
$o->toUCallback(1, 1, 1, $b);
|
||||
var_dump($o->getErrorCode());
|
||||
--EXPECT--
|
||||
int(27)
|
||||
+1
-1
@@ -39,7 +39,7 @@ static PHP_FUNCTION(json_last_error_msg);
|
||||
|
||||
static const char digits[] = "0123456789abcdef";
|
||||
|
||||
zend_class_entry *php_json_serializable_ce;
|
||||
PHP_JSON_API zend_class_entry *php_json_serializable_ce;
|
||||
|
||||
ZEND_DECLARE_MODULE_GLOBALS(json)
|
||||
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ ZEND_END_MODULE_GLOBALS(json)
|
||||
|
||||
PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_DC);
|
||||
PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len, int options, long depth TSRMLS_DC);
|
||||
extern zend_class_entry *php_json_serializable_ce;
|
||||
extern PHP_JSON_API zend_class_entry *php_json_serializable_ce;
|
||||
|
||||
|
||||
/* json_encode() options */
|
||||
|
||||
+365
@@ -152,6 +152,15 @@ PHP_MINIT_FUNCTION(ldap)
|
||||
REGISTER_LONG_CONSTANT("LDAP_DEREF_FINDING", LDAP_DEREF_FINDING, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_LONG_CONSTANT("LDAP_DEREF_ALWAYS", LDAP_DEREF_ALWAYS, CONST_PERSISTENT | CONST_CS);
|
||||
|
||||
/* Constants to be used with ldap_modify_batch() */
|
||||
REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_ADD", LDAP_MODIFY_BATCH_ADD, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_REMOVE", LDAP_MODIFY_BATCH_REMOVE, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_REMOVE_ALL", LDAP_MODIFY_BATCH_REMOVE_ALL, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_REPLACE", LDAP_MODIFY_BATCH_REPLACE, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_ATTRIB", LDAP_MODIFY_BATCH_ATTRIB, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_MODTYPE", LDAP_MODIFY_BATCH_MODTYPE, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_VALUES", LDAP_MODIFY_BATCH_VALUES, CONST_PERSISTENT | CONST_CS);
|
||||
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
|
||||
/* LDAP options */
|
||||
REGISTER_LONG_CONSTANT("LDAP_OPT_DEREF", LDAP_OPT_DEREF, CONST_PERSISTENT | CONST_CS);
|
||||
@@ -1432,6 +1441,355 @@ PHP_FUNCTION(ldap_delete)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ _ldap_str_equal_to_const
|
||||
*/
|
||||
static int _ldap_str_equal_to_const(const char *str, uint str_len, const char *cstr)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (strlen(cstr) != str_len)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < str_len; ++i) {
|
||||
if (str[i] != cstr[i]) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ _ldap_strlen_max
|
||||
*/
|
||||
static int _ldap_strlen_max(const char *str, uint max_len)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < max_len; ++i) {
|
||||
if (str[i] == '\0') {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return max_len;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ _ldap_hash_fetch
|
||||
*/
|
||||
static void _ldap_hash_fetch(zval *hashTbl, const char *key, zval **out)
|
||||
{
|
||||
zval **fetched;
|
||||
if (zend_hash_find(Z_ARRVAL_P(hashTbl), key, strlen(key)+1, (void **) &fetched) == SUCCESS) {
|
||||
*out = *fetched;
|
||||
}
|
||||
else {
|
||||
*out = NULL;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool ldap_modify_batch(resource link, string dn, array modifs)
|
||||
Perform multiple modifications as part of one operation */
|
||||
PHP_FUNCTION(ldap_modify_batch)
|
||||
{
|
||||
ldap_linkdata *ld;
|
||||
zval *link, *mods, *mod, *modinfo, *modval;
|
||||
zval *attrib, *modtype, *vals;
|
||||
zval **fetched;
|
||||
char *dn;
|
||||
int dn_len;
|
||||
int i, j, k;
|
||||
int num_mods, num_modprops, num_modvals;
|
||||
LDAPMod **ldap_mods;
|
||||
uint oper;
|
||||
|
||||
/*
|
||||
$mods = array(
|
||||
array(
|
||||
"attrib" => "unicodePwd",
|
||||
"modtype" => LDAP_MODIFY_BATCH_REMOVE,
|
||||
"values" => array($oldpw)
|
||||
),
|
||||
array(
|
||||
"attrib" => "unicodePwd",
|
||||
"modtype" => LDAP_MODIFY_BATCH_ADD,
|
||||
"values" => array($newpw)
|
||||
),
|
||||
array(
|
||||
"attrib" => "userPrincipalName",
|
||||
"modtype" => LDAP_MODIFY_BATCH_REPLACE,
|
||||
"values" => array("janitor@corp.contoso.com")
|
||||
),
|
||||
array(
|
||||
"attrib" => "userCert",
|
||||
"modtype" => LDAP_MODIFY_BATCH_REMOVE_ALL
|
||||
)
|
||||
);
|
||||
*/
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsa", &link, &dn, &dn_len, &mods) != SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
|
||||
|
||||
/* perform validation */
|
||||
{
|
||||
char *modkey;
|
||||
uint modkeylen;
|
||||
long modtype;
|
||||
|
||||
/* to store the wrongly-typed keys */
|
||||
ulong tmpUlong;
|
||||
|
||||
/* make sure the DN contains no NUL bytes */
|
||||
if (_ldap_strlen_max(dn, dn_len) != dn_len) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "DN must not contain NUL bytes");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* make sure the top level is a normal array */
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_P(mods));
|
||||
if (zend_hash_get_current_key_type(Z_ARRVAL_P(mods)) != HASH_KEY_IS_LONG) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Modifications array must not be string-indexed");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
num_mods = zend_hash_num_elements(Z_ARRVAL_P(mods));
|
||||
|
||||
for (i = 0; i < num_mods; i++) {
|
||||
/* is the numbering consecutive? */
|
||||
if (zend_hash_index_find(Z_ARRVAL_P(mods), i, (void **) &fetched) != SUCCESS) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Modifications array must have consecutive indices 0, 1, ...");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
mod = *fetched;
|
||||
|
||||
/* is it an array? */
|
||||
if (Z_TYPE_P(mod) != IS_ARRAY) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Each entry of modifications array must be an array itself");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* for the modification hashtable... */
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_P(mod));
|
||||
num_modprops = zend_hash_num_elements(Z_ARRVAL_P(mod));
|
||||
|
||||
for (j = 0; j < num_modprops; j++) {
|
||||
/* are the keys strings? */
|
||||
if (zend_hash_get_current_key_ex(Z_ARRVAL_P(mod), &modkey, &modkeylen, &tmpUlong, 0, NULL) != HASH_KEY_IS_STRING) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Each entry of modifications array must be string-indexed");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* modkeylen includes the terminating NUL byte; remove that */
|
||||
--modkeylen;
|
||||
|
||||
/* is this a valid entry? */
|
||||
if (
|
||||
!_ldap_str_equal_to_const(modkey, modkeylen, LDAP_MODIFY_BATCH_ATTRIB) &&
|
||||
!_ldap_str_equal_to_const(modkey, modkeylen, LDAP_MODIFY_BATCH_MODTYPE) &&
|
||||
!_ldap_str_equal_to_const(modkey, modkeylen, LDAP_MODIFY_BATCH_VALUES)
|
||||
) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The only allowed keys in entries of the modifications array are '" LDAP_MODIFY_BATCH_ATTRIB "', '" LDAP_MODIFY_BATCH_MODTYPE "' and '" LDAP_MODIFY_BATCH_VALUES "'");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
zend_hash_get_current_data(Z_ARRVAL_P(mod), (void **) &fetched);
|
||||
modinfo = *fetched;
|
||||
|
||||
/* does the value type match the key? */
|
||||
if (_ldap_str_equal_to_const(modkey, modkeylen, LDAP_MODIFY_BATCH_ATTRIB)) {
|
||||
if (Z_TYPE_P(modinfo) != IS_STRING) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_ATTRIB "' value must be a string");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (Z_STRLEN_P(modinfo) != _ldap_strlen_max(Z_STRVAL_P(modinfo), Z_STRLEN_P(modinfo))) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_ATTRIB "' value must not contain NUL bytes");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
else if (_ldap_str_equal_to_const(modkey, modkeylen, LDAP_MODIFY_BATCH_MODTYPE)) {
|
||||
if (Z_TYPE_P(modinfo) != IS_LONG) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_MODTYPE "' value must be a long");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* is the value in range? */
|
||||
modtype = Z_LVAL_P(modinfo);
|
||||
if (
|
||||
modtype != LDAP_MODIFY_BATCH_ADD &&
|
||||
modtype != LDAP_MODIFY_BATCH_REMOVE &&
|
||||
modtype != LDAP_MODIFY_BATCH_REPLACE &&
|
||||
modtype != LDAP_MODIFY_BATCH_REMOVE_ALL
|
||||
) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The '" LDAP_MODIFY_BATCH_MODTYPE "' value must match one of the LDAP_MODIFY_BATCH_* constants");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* if it's REMOVE_ALL, there must not be a values array; otherwise, there must */
|
||||
if (modtype == LDAP_MODIFY_BATCH_REMOVE_ALL) {
|
||||
if (zend_hash_exists(Z_ARRVAL_P(mod), LDAP_MODIFY_BATCH_VALUES, strlen(LDAP_MODIFY_BATCH_VALUES) + 1)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "If '" LDAP_MODIFY_BATCH_MODTYPE "' is LDAP_MODIFY_BATCH_REMOVE_ALL, a '" LDAP_MODIFY_BATCH_VALUES "' array must not be provided");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!zend_hash_exists(Z_ARRVAL_P(mod), LDAP_MODIFY_BATCH_VALUES, strlen(LDAP_MODIFY_BATCH_VALUES) + 1)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "If '" LDAP_MODIFY_BATCH_MODTYPE "' is not LDAP_MODIFY_BATCH_REMOVE_ALL, a '" LDAP_MODIFY_BATCH_VALUES "' array must be provided");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_ldap_str_equal_to_const(modkey, modkeylen, LDAP_MODIFY_BATCH_VALUES)) {
|
||||
if (Z_TYPE_P(modinfo) != IS_ARRAY) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_VALUES "' value must be an array");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* is the array not empty? */
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_P(modinfo));
|
||||
num_modvals = zend_hash_num_elements(Z_ARRVAL_P(modinfo));
|
||||
if (num_modvals == 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_VALUES "' array must have at least one element");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* are its keys integers? */
|
||||
if (zend_hash_get_current_key_type(Z_ARRVAL_P(modinfo)) != HASH_KEY_IS_LONG) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_VALUES "' array must not be string-indexed");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* are the keys consecutive? */
|
||||
for (k = 0; k < num_modvals; k++) {
|
||||
if (zend_hash_index_find(Z_ARRVAL_P(modinfo), k, (void **) &fetched) != SUCCESS) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_VALUES "' array must have consecutive indices 0, 1, ...");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
modval = *fetched;
|
||||
|
||||
/* is the data element a string? */
|
||||
if (Z_TYPE_P(modval) != IS_STRING) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Each element of a '" LDAP_MODIFY_BATCH_VALUES "' array must be a string");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
zend_hash_move_forward(Z_ARRVAL_P(mod));
|
||||
}
|
||||
}
|
||||
}
|
||||
/* validation was successful */
|
||||
|
||||
/* allocate array of modifications */
|
||||
ldap_mods = safe_emalloc((num_mods+1), sizeof(LDAPMod *), 0);
|
||||
|
||||
/* for each modification */
|
||||
for (i = 0; i < num_mods; i++) {
|
||||
/* allocate the modification struct */
|
||||
ldap_mods[i] = safe_emalloc(1, sizeof(LDAPMod), 0);
|
||||
|
||||
/* fetch the relevant data */
|
||||
zend_hash_index_find(Z_ARRVAL_P(mods), i, (void **) &fetched);
|
||||
mod = *fetched;
|
||||
|
||||
_ldap_hash_fetch(mod, LDAP_MODIFY_BATCH_ATTRIB, &attrib);
|
||||
_ldap_hash_fetch(mod, LDAP_MODIFY_BATCH_MODTYPE, &modtype);
|
||||
_ldap_hash_fetch(mod, LDAP_MODIFY_BATCH_VALUES, &vals);
|
||||
|
||||
/* map the modification type */
|
||||
switch (Z_LVAL_P(modtype)) {
|
||||
case LDAP_MODIFY_BATCH_ADD:
|
||||
oper = LDAP_MOD_ADD;
|
||||
break;
|
||||
case LDAP_MODIFY_BATCH_REMOVE:
|
||||
case LDAP_MODIFY_BATCH_REMOVE_ALL:
|
||||
oper = LDAP_MOD_DELETE;
|
||||
break;
|
||||
case LDAP_MODIFY_BATCH_REPLACE:
|
||||
oper = LDAP_MOD_REPLACE;
|
||||
break;
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unknown and uncaught modification type.");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* fill in the basic info */
|
||||
ldap_mods[i]->mod_op = oper | LDAP_MOD_BVALUES;
|
||||
ldap_mods[i]->mod_type = estrndup(Z_STRVAL_P(attrib), Z_STRLEN_P(attrib));
|
||||
|
||||
if (Z_LVAL_P(modtype) == LDAP_MODIFY_BATCH_REMOVE_ALL) {
|
||||
/* no values */
|
||||
ldap_mods[i]->mod_bvalues = NULL;
|
||||
}
|
||||
else {
|
||||
/* allocate space for the values as part of this modification */
|
||||
num_modvals = zend_hash_num_elements(Z_ARRVAL_P(vals));
|
||||
ldap_mods[i]->mod_bvalues = safe_emalloc((num_modvals+1), sizeof(struct berval *), 0);
|
||||
|
||||
/* for each value */
|
||||
for (j = 0; j < num_modvals; j++) {
|
||||
/* fetch it */
|
||||
zend_hash_index_find(Z_ARRVAL_P(vals), j, (void **) &fetched);
|
||||
modval = *fetched;
|
||||
|
||||
/* allocate the data struct */
|
||||
ldap_mods[i]->mod_bvalues[j] = safe_emalloc(1, sizeof(struct berval), 0);
|
||||
|
||||
/* fill it */
|
||||
ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRLEN_P(modval);
|
||||
ldap_mods[i]->mod_bvalues[j]->bv_val = estrndup(Z_STRVAL_P(modval), Z_STRLEN_P(modval));
|
||||
}
|
||||
|
||||
/* NULL-terminate values */
|
||||
ldap_mods[i]->mod_bvalues[num_modvals] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* NULL-terminate modifications */
|
||||
ldap_mods[num_mods] = NULL;
|
||||
|
||||
/* perform (finally) */
|
||||
if ((i = ldap_modify_ext_s(ld->link, dn, ldap_mods, NULL, NULL)) != LDAP_SUCCESS) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Batch Modify: %s", ldap_err2string(i));
|
||||
RETVAL_FALSE;
|
||||
} else RETVAL_TRUE;
|
||||
|
||||
/* clean up */
|
||||
{
|
||||
for (i = 0; i < num_mods; i++) {
|
||||
/* attribute */
|
||||
efree(ldap_mods[i]->mod_type);
|
||||
|
||||
if (ldap_mods[i]->mod_bvalues != NULL) {
|
||||
/* each BER value */
|
||||
for (j = 0; ldap_mods[i]->mod_bvalues[j] != NULL; j++) {
|
||||
/* free the data bytes */
|
||||
efree(ldap_mods[i]->mod_bvalues[j]->bv_val);
|
||||
|
||||
/* free the bvalue struct */
|
||||
efree(ldap_mods[i]->mod_bvalues[j]);
|
||||
}
|
||||
|
||||
/* the BER value array */
|
||||
efree(ldap_mods[i]->mod_bvalues);
|
||||
}
|
||||
|
||||
/* the modification */
|
||||
efree(ldap_mods[i]);
|
||||
}
|
||||
|
||||
/* the modifications array */
|
||||
efree(ldap_mods);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int ldap_errno(resource link)
|
||||
Get the current ldap error number */
|
||||
PHP_FUNCTION(ldap_errno)
|
||||
@@ -2516,6 +2874,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_modify, 0, 0, 3)
|
||||
ZEND_ARG_INFO(0, entry)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_modify_batch, 0, 0, 3)
|
||||
ZEND_ARG_INFO(0, link_identifier)
|
||||
ZEND_ARG_INFO(0, dn)
|
||||
ZEND_ARG_ARRAY_INFO(0, modifications_info, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_add, 0, 0, 3)
|
||||
ZEND_ARG_INFO(0, link_identifier)
|
||||
ZEND_ARG_INFO(0, dn)
|
||||
@@ -2669,6 +3033,7 @@ const zend_function_entry ldap_functions[] = {
|
||||
PHP_FE(ldap_dn2ufn, arginfo_ldap_dn2ufn)
|
||||
PHP_FE(ldap_add, arginfo_ldap_add)
|
||||
PHP_FE(ldap_delete, arginfo_ldap_delete)
|
||||
PHP_FE(ldap_modify_batch, arginfo_ldap_modify_batch)
|
||||
PHP_FALIAS(ldap_modify, ldap_mod_replace, arginfo_ldap_modify)
|
||||
|
||||
/* additional functions for attribute based modifications, Gerrit Thomson */
|
||||
|
||||
@@ -50,4 +50,14 @@ ZEND_END_MODULE_GLOBALS(ldap)
|
||||
|
||||
#define phpext_ldap_ptr ldap_module_ptr
|
||||
|
||||
/* Constants for ldap_modify_batch */
|
||||
#define LDAP_MODIFY_BATCH_ADD 0x01
|
||||
#define LDAP_MODIFY_BATCH_REMOVE 0x02
|
||||
#define LDAP_MODIFY_BATCH_REMOVE_ALL 0x12
|
||||
#define LDAP_MODIFY_BATCH_REPLACE 0x03
|
||||
|
||||
#define LDAP_MODIFY_BATCH_ATTRIB "attrib"
|
||||
#define LDAP_MODIFY_BATCH_MODTYPE "modtype"
|
||||
#define LDAP_MODIFY_BATCH_VALUES "values"
|
||||
|
||||
#endif /* PHP_LDAP_H */
|
||||
@@ -0,0 +1,109 @@
|
||||
--TEST--
|
||||
ldap_modify_batch() - Basic batch modify operation
|
||||
--CREDITS--
|
||||
Patrick Allaert <patrickallaert@php.net>
|
||||
Ondřej Hošek <ondra.hosek@gmail.com>
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
<?php require_once('skipifbindfailure.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
insert_dummy_data($link);
|
||||
|
||||
$mods = array(
|
||||
array(
|
||||
"attrib" => "telephoneNumber",
|
||||
"modtype" => LDAP_MODIFY_BATCH_ADD,
|
||||
"values" => array(
|
||||
"+1 555 5551717"
|
||||
)
|
||||
),
|
||||
array(
|
||||
"attrib" => "sn",
|
||||
"modtype" => LDAP_MODIFY_BATCH_REPLACE,
|
||||
"values" => array("Brown-Smith")
|
||||
),
|
||||
array(
|
||||
"attrib" => "description",
|
||||
"modtype" => LDAP_MODIFY_BATCH_REMOVE_ALL
|
||||
)
|
||||
);
|
||||
|
||||
var_dump(
|
||||
ldap_modify_batch($link, "cn=userA,dc=my-domain,dc=com", $mods),
|
||||
ldap_get_entries($link, ldap_search($link, "dc=my-domain,dc=com", "(sn=Brown-Smith)"))
|
||||
);
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
require "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
|
||||
remove_dummy_data($link);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
array(12) {
|
||||
["objectclass"]=>
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
string(6) "person"
|
||||
}
|
||||
[0]=>
|
||||
string(11) "objectclass"
|
||||
["cn"]=>
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
string(5) "userA"
|
||||
}
|
||||
[1]=>
|
||||
string(2) "cn"
|
||||
["userpassword"]=>
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
string(4) "oops"
|
||||
}
|
||||
[2]=>
|
||||
string(12) "userpassword"
|
||||
["telephonenumber"]=>
|
||||
array(3) {
|
||||
["count"]=>
|
||||
int(2)
|
||||
[0]=>
|
||||
string(14) "xx-xx-xx-xx-xx"
|
||||
[1]=>
|
||||
string(14) "+1 555 5551717"
|
||||
}
|
||||
[3]=>
|
||||
string(15) "telephonenumber"
|
||||
["sn"]=>
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
string(11) "Brown-Smith"
|
||||
}
|
||||
[4]=>
|
||||
string(2) "sn"
|
||||
["count"]=>
|
||||
int(5)
|
||||
["dn"]=>
|
||||
string(28) "cn=userA,dc=my-domain,dc=com"
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
@@ -0,0 +1,104 @@
|
||||
--TEST--
|
||||
ldap_modify_batch() - Batch modify operations that should fail
|
||||
--CREDITS--
|
||||
Patrick Allaert <patrickallaert@php.net>
|
||||
Ondřej Hošek <ondra.hosek@gmail.com>
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
<?php require_once('skipifbindfailure.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
|
||||
$addGivenName = array(
|
||||
array(
|
||||
"attrib" => "givenName",
|
||||
"modtype" => LDAP_MODIFY_BATCH_ADD,
|
||||
"values" => array("Jack")
|
||||
)
|
||||
);
|
||||
|
||||
// Too few parameters
|
||||
var_dump(ldap_modify_batch());
|
||||
var_dump(ldap_modify_batch($link));
|
||||
var_dump(ldap_modify_batch($link, "dc=my-domain,dc=com"));
|
||||
|
||||
// Too many parameters
|
||||
var_dump(ldap_modify_batch($link, "dc=my-domain,dc=com", $addGivenName, "Invalid additional parameter"));
|
||||
|
||||
// DN not found
|
||||
var_dump(ldap_modify_batch($link, "dc=my-domain,dc=com", $addGivenName));
|
||||
|
||||
// Invalid DN
|
||||
var_dump(ldap_modify_batch($link, "weirdAttribute=val", $addGivenName));
|
||||
|
||||
// prepare
|
||||
$entry = array(
|
||||
"objectClass" => array(
|
||||
"top",
|
||||
"dcObject",
|
||||
"organization"),
|
||||
"dc" => "my-domain",
|
||||
"o" => "my-domain",
|
||||
);
|
||||
|
||||
ldap_add($link, "dc=my-domain,dc=com", $entry);
|
||||
|
||||
// invalid domain
|
||||
$mods = array(
|
||||
array(
|
||||
"attrib" => "dc",
|
||||
"modtype" => LDAP_MODIFY_BATCH_REPLACE,
|
||||
"values" => array("Wrong Domain")
|
||||
)
|
||||
);
|
||||
|
||||
var_dump(ldap_modify_batch($link, "dc=my-domain,dc=com", $mods));
|
||||
|
||||
// invalid attribute
|
||||
$mods = array(
|
||||
array(
|
||||
"attrib" => "weirdAttribute",
|
||||
"modtype" => LDAP_MODIFY_BATCH_ADD,
|
||||
"values" => array("weirdVal", "anotherWeirdval")
|
||||
)
|
||||
);
|
||||
|
||||
var_dump(ldap_modify_batch($link, "dc=my-domain,dc=com", $mods));
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
require "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
|
||||
ldap_delete($link, "dc=my-domain,dc=com");
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: ldap_modify_batch() expects exactly 3 parameters, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: ldap_modify_batch() expects exactly 3 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: ldap_modify_batch() expects exactly 3 parameters, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: ldap_modify_batch() expects exactly 3 parameters, 4 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: ldap_modify_batch(): Batch Modify: No such object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: ldap_modify_batch(): Batch Modify: Invalid DN syntax in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: ldap_modify_batch(): Batch Modify: Naming violation in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: ldap_modify_batch(): Batch Modify: Undefined attribute type in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
||||
+2
-2
@@ -88,7 +88,7 @@ static PHP_MINIT_FUNCTION(libxml);
|
||||
static PHP_RINIT_FUNCTION(libxml);
|
||||
static PHP_MSHUTDOWN_FUNCTION(libxml);
|
||||
static PHP_MINFO_FUNCTION(libxml);
|
||||
static int php_libxml_post_deactivate();
|
||||
static int php_libxml_post_deactivate(void);
|
||||
|
||||
/* }}} */
|
||||
|
||||
@@ -875,7 +875,7 @@ static PHP_MSHUTDOWN_FUNCTION(libxml)
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static int php_libxml_post_deactivate()
|
||||
static int php_libxml_post_deactivate(void)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
/* reset libxml generic error handling */
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
--TEST--
|
||||
zend multibyte (2)
|
||||
--SKIPIF--
|
||||
--XFAIL--
|
||||
https://bugs.php.net/bug.php?id=66582
|
||||
--INI--
|
||||
zend.multibyte=On
|
||||
zend.script_encoding=UTF-8
|
||||
@@ -9,5 +10,5 @@ mbstring.internal_encoding=CP932
|
||||
<?php
|
||||
var_dump(bin2hex("テスト"));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(12) "836583588367"
|
||||
--EXPECTF--
|
||||
php: Zend/zend_language_scanner.l:%d: encoding_filter_script_to_internal: Assertion `internal_encoding && zend_multibyte_check_lexer_compatibility(internal_encoding)' failed.
|
||||
@@ -1,6 +1,7 @@
|
||||
--TEST--
|
||||
zend multibyte (6)
|
||||
--SKIPIF--
|
||||
--XFAIL--
|
||||
https://bugs.php.net/bug.php?id=66582
|
||||
--INI--
|
||||
zend.multibyte=On
|
||||
zend.script_encoding=EUC-JP
|
||||
@@ -10,5 +11,5 @@ mbstring.internal_encoding=CP932
|
||||
declare(encoding="UTF-8");
|
||||
var_dump(bin2hex("テスト"));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(12) "836583588367"
|
||||
--EXPECTF--
|
||||
php: Zend/zend_language_scanner.l:%d: encoding_filter_script_to_internal: Assertion `internal_encoding && zend_multibyte_check_lexer_compatibility(internal_encoding)' failed.
|
||||
@@ -1,6 +1,8 @@
|
||||
--TEST--
|
||||
zend multibyte (7)
|
||||
--SKIPIF--
|
||||
--XFAIL--
|
||||
https://bugs.php.net/bug.php?id=66582
|
||||
--INI--
|
||||
zend.multibyte=On
|
||||
zend.script_encoding=ISO-8859-1
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
--TEST--
|
||||
zend multibyte (9)
|
||||
--SKIPIF--
|
||||
--XFAIL--
|
||||
https://bugs.php.net/bug.php?id=66582
|
||||
--INI--
|
||||
zend.multibyte=On
|
||||
zend.script_encoding=cp1251
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
--TEST--
|
||||
zend multibyte (10)
|
||||
--SKIPIF--
|
||||
--INI--
|
||||
zend.multibyte=1
|
||||
--FILE--
|
||||
<?php
|
||||
declare(encoding="ISO-8859-15");
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
--TEST--
|
||||
zend multibyte (11)
|
||||
--SKIPIF--
|
||||
--INI--
|
||||
zend.multibyte=1
|
||||
--FILE--
|
||||
<?php
|
||||
declare(encoding="ISO-8859-15") {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
--TEST--
|
||||
zend multibyte (12)
|
||||
--SKIPIF--
|
||||
--INI--
|
||||
zend.multibyte=1
|
||||
--FILE--
|
||||
<?php
|
||||
declare(encoding="ISO-8859-15");
|
||||
|
||||
+8
-1
@@ -176,8 +176,11 @@ void php_clear_stmt_bind(MY_STMT *stmt TSRMLS_DC)
|
||||
php_free_stmt_bind_buffer(stmt->param, FETCH_SIMPLE);
|
||||
/* Clean output bind */
|
||||
php_free_stmt_bind_buffer(stmt->result, FETCH_RESULT);
|
||||
#endif
|
||||
|
||||
if (stmt->link_handle) {
|
||||
zend_objects_store_del_ref_by_handle(stmt->link_handle TSRMLS_CC);
|
||||
}
|
||||
#endif
|
||||
if (stmt->query) {
|
||||
efree(stmt->query);
|
||||
}
|
||||
@@ -1069,6 +1072,10 @@ PHP_FUNCTION(mysqli_stmt_construct)
|
||||
efree(stmt);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#ifndef MYSQLI_USE_MYSQLND
|
||||
stmt->link_handle = Z_OBJ_HANDLE(*mysql_link);
|
||||
zend_objects_store_add_ref_by_handle(stmt->link_handle TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
|
||||
mysqli_resource->ptr = (void *)stmt;
|
||||
|
||||
@@ -1869,6 +1869,10 @@ PHP_FUNCTION(mysqli_prepare)
|
||||
efree(stmt);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#ifndef MYSQLI_USE_MYSQLND
|
||||
stmt->link_handle = Z_OBJ_HANDLE(*mysql_link);
|
||||
zend_objects_store_add_ref_by_handle(stmt->link_handle TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
|
||||
mysqli_resource->ptr = (void *)stmt;
|
||||
@@ -2413,6 +2417,10 @@ PHP_FUNCTION(mysqli_stmt_init)
|
||||
efree(stmt);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#ifndef MYSQLI_USE_MYSQLND
|
||||
stmt->link_handle = Z_OBJ_HANDLE(*mysql_link);
|
||||
zend_objects_store_add_ref_by_handle(stmt->link_handle TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
|
||||
mysqli_resource->status = MYSQLI_STATUS_INITIALIZED;
|
||||
|
||||
@@ -116,6 +116,10 @@ typedef struct {
|
||||
BIND_BUFFER param;
|
||||
BIND_BUFFER result;
|
||||
char *query;
|
||||
#ifndef MYSQLI_USE_MYSQLND
|
||||
/* used to manage refcount with libmysql (already implement in mysqlnd) */
|
||||
zend_object_handle link_handle;
|
||||
#endif
|
||||
} MY_STMT;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #66762 mysqli@libmysql segfault in mysqli_stmt::bind_result() when link closed
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
|
||||
$mysqli = new mysqli($host, $user, $passwd, $db);
|
||||
|
||||
$read_stmt = $mysqli->prepare("SELECT 1");
|
||||
|
||||
var_dump($read_stmt->bind_result($data));
|
||||
|
||||
unset($mysqli);
|
||||
var_dump($read_stmt->bind_result($data));
|
||||
|
||||
?>
|
||||
done!
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
done!
|
||||
@@ -0,0 +1,140 @@
|
||||
--TEST--
|
||||
mysqli_begin_transaction()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifemb.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
|
||||
require_once('connect.inc');
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||
die(sprintf("Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
|
||||
|
||||
if (!have_innodb($link))
|
||||
die(sprintf("Needs InnoDB support, [%d] %s", $link->errno, $link->error));
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
/* {{{ proto bool mysqli_begin_transaction(object link, [int flags [, string name]]) */
|
||||
$tmp = NULL;
|
||||
$link = NULL;
|
||||
|
||||
if (!is_null($tmp = @mysqli_begin_transaction()))
|
||||
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (!is_null($tmp = @mysqli_begin_transaction($link)))
|
||||
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (!is_null($tmp = @mysqli_begin_transaction($link, $link)))
|
||||
printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||
printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $user, $db, $port, $socket);
|
||||
|
||||
if (!is_null($tmp = @mysqli_begin_transaction($link, $link)))
|
||||
printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (!is_null($tmp = @mysqli_begin_transaction($link, 0, $link)))
|
||||
printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (!is_null($tmp = @mysqli_begin_transaction($link, 0, "mytrx", $link)))
|
||||
printf("[007] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
|
||||
printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
|
||||
printf("[009] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
if (true !== ($tmp = mysqli_autocommit($link, true)))
|
||||
printf("[010] Cannot turn on autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
/* overrule autocommit */
|
||||
if (true !== ($tmp = mysqli_begin_transaction($link)))
|
||||
printf("[011] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
|
||||
printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
$tmp = mysqli_rollback($link);
|
||||
if ($tmp !== true)
|
||||
printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
/* empty */
|
||||
$res = mysqli_query($link, "SELECT * FROM test");
|
||||
var_dump($res->fetch_assoc());
|
||||
|
||||
/* valid flags */
|
||||
$flags = array(
|
||||
MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT,
|
||||
MYSQLI_TRANS_START_READ_WRITE,
|
||||
MYSQLI_TRANS_START_READ_ONLY,
|
||||
MYSQLI_TRANS_COR_AND_CHAIN,
|
||||
MYSQLI_TRANS_COR_AND_NO_CHAIN,
|
||||
MYSQLI_TRANS_COR_RELEASE,
|
||||
MYSQLI_TRANS_COR_NO_RELEASE);
|
||||
|
||||
/* just coverage */
|
||||
foreach ($flags as $flag) {
|
||||
if (!mysqli_begin_transaction($link, $flag, sprintf("flag %d", $flag))) {
|
||||
printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
}
|
||||
if (!mysqli_query($link, 'SELECT * FROM test') ||
|
||||
!mysqli_rollback($link)) {
|
||||
printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
}
|
||||
}
|
||||
|
||||
/* does it really set a flag? */
|
||||
if (mysqli_get_server_version($link) >= 50600) {
|
||||
if (!mysqli_begin_transaction($link, MYSQLI_TRANS_START_READ_ONLY, sprintf("flag %d", $flag))) {
|
||||
printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
}
|
||||
if (!mysqli_query($link, "INSERT INTO test(id) VALUES (2)") ||
|
||||
!mysqli_commit($link)) {
|
||||
printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
} else {
|
||||
$res = mysqli_query($link, "SELECT id FROM test WHERE id = 2");
|
||||
var_dump($res->fetch_assoc());
|
||||
}
|
||||
}
|
||||
|
||||
/* invalid flag */
|
||||
do {
|
||||
$invalid_flag = mt_rand(0, 10000);
|
||||
} while (isset(array_flip($flags)[$invalid_flag]));
|
||||
/* we may or may not hit an invalid combination provoking a SQL error */
|
||||
if (!mysqli_begin_transaction($link, $invalid_flag, sprintf("flag %d", $invalid_flag))) {
|
||||
printf("[018] invalid_flag = %d [%d] %s\n", $invalid_flag, mysqli_errno($link), mysqli_error($link));
|
||||
} else {
|
||||
printf("[018] invalid_flag = %d [%d] %s\n", $invalid_flag, mysqli_errno($link), mysqli_error($link));
|
||||
}
|
||||
if (!mysqli_begin_transaction($link, -1)) {
|
||||
printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
}
|
||||
|
||||
/* does it like stupid names? */
|
||||
if (!$link->begin_transaction(MYSQLI_TRANS_START_READ_WRITE, "*/trick me?\n\0"))
|
||||
printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
/* does it like stupid names? */
|
||||
if (!$link->begin_transaction(MYSQLI_TRANS_START_READ_WRITE, "az09"))
|
||||
printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
print "done!";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once("clean_table.inc");
|
||||
?>
|
||||
--EXPECTF--
|
||||
NULL
|
||||
[017] [1792] %s
|
||||
[018] invalid_flag = %d [%d]%A
|
||||
|
||||
Warning: mysqli_begin_transaction(): Invalid value for parameter flags (-1) in %s on line %d
|
||||
[019] [%d]%A
|
||||
[020] [%d]%A
|
||||
done!
|
||||
@@ -561,6 +561,10 @@ enum mysqlnd_packet_type
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
After adding new elements please update
|
||||
`mysqlnd_command_to_text` in mysqlnd_wireprotocol.c
|
||||
*/
|
||||
enum php_mysqlnd_server_command
|
||||
{
|
||||
COM_SLEEP = 0,
|
||||
@@ -593,6 +597,8 @@ enum php_mysqlnd_server_command
|
||||
COM_SET_OPTION = 27,
|
||||
COM_STMT_FETCH = 28,
|
||||
COM_DAEMON,
|
||||
COM_BINLOG_DUMP_GTID,
|
||||
COM_RESET_CONNECTION,
|
||||
COM_END
|
||||
};
|
||||
|
||||
|
||||
@@ -187,9 +187,11 @@ MYSQLND_METHOD(mysqlnd_res, free_buffered_data)(MYSQLND_RES * result TSRMLS_DC)
|
||||
if (set->data) {
|
||||
unsigned int copy_on_write_performed = 0;
|
||||
unsigned int copy_on_write_saved = 0;
|
||||
zval **data = set->data;
|
||||
set->data = NULL; /* prevent double free if following loop is interrupted */
|
||||
|
||||
for (row = set->row_count - 1; row >= 0; row--) {
|
||||
zval **current_row = set->data + row * field_count;
|
||||
zval **current_row = data + row * field_count;
|
||||
MYSQLND_MEMORY_POOL_CHUNK *current_buffer = set->row_buffers[row];
|
||||
int64_t col;
|
||||
|
||||
@@ -211,8 +213,7 @@ MYSQLND_METHOD(mysqlnd_res, free_buffered_data)(MYSQLND_RES * result TSRMLS_DC)
|
||||
|
||||
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_COPY_ON_WRITE_PERFORMED, copy_on_write_performed,
|
||||
STAT_COPY_ON_WRITE_SAVED, copy_on_write_saved);
|
||||
mnd_efree(set->data);
|
||||
set->data = NULL;
|
||||
mnd_efree(data);
|
||||
}
|
||||
|
||||
if (set->row_buffers) {
|
||||
|
||||
@@ -90,7 +90,8 @@ const char * const mysqlnd_command_to_text[COM_END] =
|
||||
"TIME", "DELAYED_INSERT", "CHANGE_USER", "BINLOG_DUMP",
|
||||
"TABLE_DUMP", "CONNECT_OUT", "REGISTER_SLAVE",
|
||||
"STMT_PREPARE", "STMT_EXECUTE", "STMT_SEND_LONG_DATA", "STMT_CLOSE",
|
||||
"STMT_RESET", "SET_OPTION", "STMT_FETCH", "DAEMON"
|
||||
"STMT_RESET", "SET_OPTION", "STMT_FETCH", "DAEMON", "BINLOG_DUMP_GTID",
|
||||
"RESET_CONNECTION"
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
@@ -1740,8 +1741,9 @@ php_mysqlnd_rowp_read_text_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, zval
|
||||
zval_dtor(*current_field);
|
||||
ZVAL_STRINGL(*current_field, (char *) start, bit_area - start - 1, 0);
|
||||
}
|
||||
} else
|
||||
ZVAL_STRINGL(*current_field, (char *)p, len, 0);
|
||||
} else {
|
||||
ZVAL_STRINGL(*current_field, (char *)p, len, 0);
|
||||
}
|
||||
p += len;
|
||||
last_field_was_string = TRUE;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,21 @@ DRCP: Test setting connection class inline
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
|
||||
require(dirname(__FILE__)."/details.inc");
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
if (!$test_drcp) die("skip testing DRCP connection class only works in DRCP mode");
|
||||
if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
|
||||
|
||||
preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches_sv);
|
||||
// This test in Oracle 12c needs a non-CDB or the root container
|
||||
if (isset($matches_sv[0]) && $matches_sv[1] >= 12) {
|
||||
$s = oci_parse($c, "select nvl(sys_context('userenv', 'con_name'), 'notacdb') as dbtype from dual");
|
||||
$r = @oci_execute($s);
|
||||
if (!$r)
|
||||
die('skip could not identify container type');
|
||||
$r = oci_fetch_array($s);
|
||||
if ($r['DBTYPE'] !== 'CDB$ROOT')
|
||||
die('skip cannot run test using a PDB');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -48,7 +48,7 @@ Warning: oci_bind_by_name() expects at least 3 parameters, 2 given in %s on line
|
||||
|
||||
Warning: oci_bind_by_name() expects at least 3 parameters, 1 given in %s on line %d
|
||||
|
||||
Warning: oci_execute(): ORA-00932: %s NUMBER %s BLOB in %s on line %d
|
||||
Warning: oci_execute(): ORA-00932: %s on line %d
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
|
||||
@@ -338,6 +338,7 @@ const char *accel_new_interned_string(const char *arKey, int nKeyLength, int fre
|
||||
if (ZCSG(interned_strings_top) + ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength) >=
|
||||
ZCSG(interned_strings_end)) {
|
||||
/* no memory, return the same non-interned string */
|
||||
zend_accel_error(ACCEL_LOG_WARNING, "Interned string buffer overflow");
|
||||
return arKey;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
#endif
|
||||
|
||||
#define ACCELERATOR_PRODUCT_NAME "Zend OPcache"
|
||||
#define ACCELERATOR_VERSION "7.0.3"
|
||||
#define PHP_ZENDOPCACHE_VERSION "7.0.4-dev"
|
||||
#define ACCELERATOR_VERSION PHP_ZENDOPCACHE_VERSION
|
||||
/* 2 - added Profiler support, on 20010712 */
|
||||
/* 3 - added support for Optimizer's encoded-only-files mode */
|
||||
/* 4 - works with the new Optimizer, that supports the file format with licenses */
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Test that script cached info is correct
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(opcache_is_script_cached(__FILE__));
|
||||
var_dump(opcache_is_script_cached("nonexistent.php"));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(false)
|
||||
@@ -1,5 +1,5 @@
|
||||
/path/to/bar
|
||||
; wildcard and relative entires
|
||||
; wildcard and relative entries
|
||||
blacklist.inc
|
||||
./current.php
|
||||
/tmp/path/?nocache.inc
|
||||
|
||||
@@ -57,9 +57,14 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_invalidate, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, force)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_is_script_cached, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, script)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
/* User functions */
|
||||
static ZEND_FUNCTION(opcache_reset);
|
||||
static ZEND_FUNCTION(opcache_invalidate);
|
||||
static ZEND_FUNCTION(opcache_is_script_cached);
|
||||
|
||||
/* Private functions */
|
||||
static ZEND_FUNCTION(opcache_get_status);
|
||||
@@ -71,6 +76,7 @@ static zend_function_entry accel_functions[] = {
|
||||
ZEND_FE(opcache_reset, arginfo_opcache_none)
|
||||
ZEND_FE(opcache_invalidate, arginfo_opcache_invalidate)
|
||||
ZEND_FE(opcache_compile_file, arginfo_opcache_compile_file)
|
||||
ZEND_FE(opcache_is_script_cached, arginfo_opcache_is_script_cached)
|
||||
/* Private functions */
|
||||
ZEND_FE(opcache_get_configuration, arginfo_opcache_none)
|
||||
ZEND_FE(opcache_get_status, arginfo_opcache_get_status)
|
||||
@@ -438,6 +444,14 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS)
|
||||
php_info_print_table_row(2, "Free memory", buf);
|
||||
snprintf(buf, sizeof(buf), "%ld", ZSMMG(wasted_shared_memory));
|
||||
php_info_print_table_row(2, "Wasted memory", buf);
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
|
||||
if (ZCSG(interned_strings_start) && ZCSG(interned_strings_end) && ZCSG(interned_strings_top)) {
|
||||
snprintf(buf, sizeof(buf), "%ld", ZCSG(interned_strings_top) - ZCSG(interned_strings_start));
|
||||
php_info_print_table_row(2, "Interned Strings Used memory", buf);
|
||||
snprintf(buf, sizeof(buf), "%ld", ZCSG(interned_strings_end) - ZCSG(interned_strings_top));
|
||||
php_info_print_table_row(2, "Interned Strings Free memory", buf);
|
||||
}
|
||||
#endif
|
||||
snprintf(buf, sizeof(buf), "%ld", ZCSG(hash).num_direct_entries);
|
||||
php_info_print_table_row(2, "Cached scripts", buf);
|
||||
snprintf(buf, sizeof(buf), "%ld", ZCSG(hash).num_entries);
|
||||
@@ -567,6 +581,20 @@ static ZEND_FUNCTION(opcache_get_status)
|
||||
add_assoc_double(memory_usage, "current_wasted_percentage", (((double) ZSMMG(wasted_shared_memory))/ZCG(accel_directives).memory_consumption)*100.0);
|
||||
add_assoc_zval(return_value, "memory_usage", memory_usage);
|
||||
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
|
||||
if (ZCSG(interned_strings_start) && ZCSG(interned_strings_end) && ZCSG(interned_strings_top)) {
|
||||
zval *interned_strings_usage;
|
||||
|
||||
MAKE_STD_ZVAL(interned_strings_usage);
|
||||
array_init(interned_strings_usage);
|
||||
add_assoc_long(interned_strings_usage, "buffer_size", ZCSG(interned_strings_end) - ZCSG(interned_strings_start));
|
||||
add_assoc_long(interned_strings_usage, "used_memory", ZCSG(interned_strings_top) - ZCSG(interned_strings_start));
|
||||
add_assoc_long(interned_strings_usage, "free_memory", ZCSG(interned_strings_end) - ZCSG(interned_strings_top));
|
||||
add_assoc_long(interned_strings_usage, "number_of_strings", ZCSG(interned_strings).nNumOfElements);
|
||||
add_assoc_zval(return_value, "interned_strings_usage", interned_strings_usage);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Accelerator statistics */
|
||||
MAKE_STD_ZVAL(statistics);
|
||||
array_init(statistics);
|
||||
@@ -759,3 +787,25 @@ static ZEND_FUNCTION(opcache_compile_file)
|
||||
}
|
||||
zend_destroy_file_handle(&handle TSRMLS_CC);
|
||||
}
|
||||
|
||||
/* {{{ proto bool opcache_is_script_cached(string $script)
|
||||
Return true if the script is cached in OPCache, false if it is not cached or if OPCache is not running. */
|
||||
static ZEND_FUNCTION(opcache_is_script_cached)
|
||||
{
|
||||
char *script_name;
|
||||
int script_name_len;
|
||||
|
||||
if (!validate_api_restriction(TSRMLS_C)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &script_name, &script_name_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
RETURN_BOOL(filename_is_in_cache(script_name, script_name_len TSRMLS_CC));
|
||||
}
|
||||
Regular → Executable
+18
-5
@@ -77,6 +77,10 @@
|
||||
#endif
|
||||
#define DEBUG_SMIME 0
|
||||
|
||||
#if !defined(OPENSSL_NO_EC) && defined(EVP_PKEY_EC)
|
||||
#define HAVE_EVP_PKEY_EC 1
|
||||
#endif
|
||||
|
||||
/* FIXME: Use the openssl constants instead of
|
||||
* enum. It is now impossible to match real values
|
||||
* against php constants. Also sorry to break the
|
||||
@@ -87,7 +91,7 @@ enum php_openssl_key_type {
|
||||
OPENSSL_KEYTYPE_DSA,
|
||||
OPENSSL_KEYTYPE_DH,
|
||||
OPENSSL_KEYTYPE_DEFAULT = OPENSSL_KEYTYPE_RSA,
|
||||
#ifdef EVP_PKEY_EC
|
||||
#ifdef HAVE_EVP_PKEY_EC
|
||||
OPENSSL_KEYTYPE_EC = OPENSSL_KEYTYPE_DH +1
|
||||
#endif
|
||||
};
|
||||
@@ -866,7 +870,7 @@ static int php_openssl_parse_config(struct php_x509_request * req, zval * option
|
||||
req->digest = req->md_alg = EVP_get_digestbyname(req->digest_name);
|
||||
}
|
||||
if (req->md_alg == NULL) {
|
||||
req->md_alg = req->digest = EVP_md5();
|
||||
req->md_alg = req->digest = EVP_sha1();
|
||||
}
|
||||
|
||||
PHP_SSL_CONFIG_SYNTAX_CHECK(extensions_section);
|
||||
@@ -1128,7 +1132,7 @@ PHP_MINIT_FUNCTION(openssl)
|
||||
REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_DSA", OPENSSL_KEYTYPE_DSA, CONST_CS|CONST_PERSISTENT);
|
||||
#endif
|
||||
REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_DH", OPENSSL_KEYTYPE_DH, CONST_CS|CONST_PERSISTENT);
|
||||
#ifdef EVP_PKEY_EC
|
||||
#ifdef HAVE_EVP_PKEY_EC
|
||||
REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_EC", OPENSSL_KEYTYPE_EC, CONST_CS|CONST_PERSISTENT);
|
||||
#endif
|
||||
|
||||
@@ -3025,6 +3029,15 @@ static int php_openssl_is_private_key(EVP_PKEY* pkey TSRMLS_DC)
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_EVP_PKEY_EC
|
||||
case EVP_PKEY_EC:
|
||||
assert(pkey->pkey.ec != NULL);
|
||||
|
||||
if ( NULL == EC_KEY_get0_private_key(pkey->pkey.ec)) {
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "key type not supported in this PHP build!");
|
||||
@@ -3426,7 +3439,7 @@ PHP_FUNCTION(openssl_pkey_get_details)
|
||||
}
|
||||
|
||||
break;
|
||||
#ifdef EVP_PKEY_EC
|
||||
#ifdef HAVE_EVP_PKEY_EC
|
||||
case EVP_PKEY_EC:
|
||||
ktype = OPENSSL_KEYTYPE_EC;
|
||||
break;
|
||||
@@ -5064,7 +5077,7 @@ PHP_FUNCTION(openssl_cipher_iv_length)
|
||||
|
||||
|
||||
/* {{{ proto string openssl_dh_compute_key(string pub_key, resource dh_key)
|
||||
Computes shared sicret for public value of remote DH key and local DH key */
|
||||
Computes shared secret for public value of remote DH key and local DH key */
|
||||
PHP_FUNCTION(openssl_dh_compute_key)
|
||||
{
|
||||
zval *key;
|
||||
|
||||
@@ -3,6 +3,7 @@ Bug #64802: openssl_x509_parse fails to parse subject properly in some cases
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
if (!defined(OPENSSL_KEYTYPE_EC)) die("skip no EC available);
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #66501: EC private key support in openssl_sign
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
if (!defined(OPENSSL_KEYTYPE_EC)) die("skip no EC available);
|
||||
--FILE--
|
||||
<?php
|
||||
$pkey = 'ASN1 OID: prime256v1
|
||||
-----BEGIN EC PARAMETERS-----
|
||||
BggqhkjOPQMBBw==
|
||||
-----END EC PARAMETERS-----
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEILPkqoeyM7XgwYkuSj3077lrsrfWJK5LqMolv+m2oOjZoAoGCCqGSM49
|
||||
AwEHoUQDQgAEPq4hbIWHvB51rdWr8ejrjWo4qVNWVugYFtPg/xLQw0mHkIPZ4DvK
|
||||
sqOTOnMoezkbSmVVMuwz9flvnqHGmQvmug==
|
||||
-----END EC PRIVATE KEY-----';
|
||||
$key = openssl_pkey_get_private($pkey);
|
||||
$res = openssl_sign($data ='alpha', $sign, $key, 'ecdsa-with-SHA1');
|
||||
var_dump($res);
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
@@ -8,7 +8,7 @@ Email domain: cam.ac.uk
|
||||
University of Cambridge Computing Service,
|
||||
Cambridge, England.
|
||||
|
||||
Copyright (c) 1997-2012 University of Cambridge
|
||||
Copyright (c) 1997-2013 University of Cambridge
|
||||
All rights reserved
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ Written by: Zoltan Herczeg
|
||||
Email local part: hzmester
|
||||
Emain domain: freemail.hu
|
||||
|
||||
Copyright(c) 2010-2012 Zoltan Herczeg
|
||||
Copyright(c) 2010-2013 Zoltan Herczeg
|
||||
All rights reserved.
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ Written by: Zoltan Herczeg
|
||||
Email local part: hzmester
|
||||
Emain domain: freemail.hu
|
||||
|
||||
Copyright(c) 2009-2012 Zoltan Herczeg
|
||||
Copyright(c) 2009-2013 Zoltan Herczeg
|
||||
All rights reserved.
|
||||
|
||||
|
||||
|
||||
+377
-1
@@ -1,6 +1,381 @@
|
||||
ChangeLog for PCRE
|
||||
------------------
|
||||
|
||||
Version 8.34 15-December-2013
|
||||
-----------------------------
|
||||
|
||||
1. Add pcre[16|32]_jit_free_unused_memory to forcibly free unused JIT
|
||||
executable memory. Patch inspired by Carsten Klein.
|
||||
|
||||
2. ./configure --enable-coverage defined SUPPORT_GCOV in config.h, although
|
||||
this macro is never tested and has no effect, because the work to support
|
||||
coverage involves only compiling and linking options and special targets in
|
||||
the Makefile. The comment in config.h implied that defining the macro would
|
||||
enable coverage support, which is totally false. There was also support for
|
||||
setting this macro in the CMake files (my fault, I just copied it from
|
||||
configure). SUPPORT_GCOV has now been removed.
|
||||
|
||||
3. Make a small performance improvement in strlen16() and strlen32() in
|
||||
pcretest.
|
||||
|
||||
4. Change 36 for 8.33 left some unreachable statements in pcre_exec.c,
|
||||
detected by the Solaris compiler (gcc doesn't seem to be able to diagnose
|
||||
these cases). There was also one in pcretest.c.
|
||||
|
||||
5. Cleaned up a "may be uninitialized" compiler warning in pcre_exec.c.
|
||||
|
||||
6. In UTF mode, the code for checking whether a group could match an empty
|
||||
string (which is used for indefinitely repeated groups to allow for
|
||||
breaking an infinite loop) was broken when the group contained a repeated
|
||||
negated single-character class with a character that occupied more than one
|
||||
data item and had a minimum repetition of zero (for example, [^\x{100}]* in
|
||||
UTF-8 mode). The effect was undefined: the group might or might not be
|
||||
deemed as matching an empty string, or the program might have crashed.
|
||||
|
||||
7. The code for checking whether a group could match an empty string was not
|
||||
recognizing that \h, \H, \v, \V, and \R must match a character.
|
||||
|
||||
8. Implemented PCRE_INFO_MATCH_EMPTY, which yields 1 if the pattern can match
|
||||
an empty string. If it can, pcretest shows this in its information output.
|
||||
|
||||
9. Fixed two related bugs that applied to Unicode extended grapheme clusters
|
||||
that were repeated with a maximizing qualifier (e.g. \X* or \X{2,5}) when
|
||||
matched by pcre_exec() without using JIT:
|
||||
|
||||
(a) If the rest of the pattern did not match after a maximal run of
|
||||
grapheme clusters, the code for backing up to try with fewer of them
|
||||
did not always back up over a full grapheme when characters that do not
|
||||
have the modifier quality were involved, e.g. Hangul syllables.
|
||||
|
||||
(b) If the match point in a subject started with modifier character, and
|
||||
there was no match, the code could incorrectly back up beyond the match
|
||||
point, and potentially beyond the first character in the subject,
|
||||
leading to a segfault or an incorrect match result.
|
||||
|
||||
10. A conditional group with an assertion condition could lead to PCRE
|
||||
recording an incorrect first data item for a match if no other first data
|
||||
item was recorded. For example, the pattern (?(?=ab)ab) recorded "a" as a
|
||||
first data item, and therefore matched "ca" after "c" instead of at the
|
||||
start.
|
||||
|
||||
11. Change 40 for 8.33 (allowing pcregrep to find empty strings) showed up a
|
||||
bug that caused the command "echo a | ./pcregrep -M '|a'" to loop.
|
||||
|
||||
12. The source of pcregrep now includes z/OS-specific code so that it can be
|
||||
compiled for z/OS as part of the special z/OS distribution.
|
||||
|
||||
13. Added the -T and -TM options to pcretest.
|
||||
|
||||
14. The code in pcre_compile.c for creating the table of named capturing groups
|
||||
has been refactored. Instead of creating the table dynamically during the
|
||||
actual compiling pass, the information is remembered during the pre-compile
|
||||
pass (on the stack unless there are more than 20 named groups, in which
|
||||
case malloc() is used) and the whole table is created before the actual
|
||||
compile happens. This has simplified the code (it is now nearly 150 lines
|
||||
shorter) and prepared the way for better handling of references to groups
|
||||
with duplicate names.
|
||||
|
||||
15. A back reference to a named subpattern when there is more than one of the
|
||||
same name now checks them in the order in which they appear in the pattern.
|
||||
The first one that is set is used for the reference. Previously only the
|
||||
first one was inspected. This change makes PCRE more compatible with Perl.
|
||||
|
||||
16. Unicode character properties were updated from Unicode 6.3.0.
|
||||
|
||||
17. The compile-time code for auto-possessification has been refactored, based
|
||||
on a patch by Zoltan Herczeg. It now happens after instead of during
|
||||
compilation. The code is cleaner, and more cases are handled. The option
|
||||
PCRE_NO_AUTO_POSSESS is added for testing purposes, and the -O and /O
|
||||
options in pcretest are provided to set it. It can also be set by
|
||||
(*NO_AUTO_POSSESS) at the start of a pattern.
|
||||
|
||||
18. The character VT has been added to the default ("C" locale) set of
|
||||
characters that match \s and are generally treated as white space,
|
||||
following this same change in Perl 5.18. There is now no difference between
|
||||
"Perl space" and "POSIX space". Whether VT is treated as white space in
|
||||
other locales depends on the locale.
|
||||
|
||||
19. The code for checking named groups as conditions, either for being set or
|
||||
for being recursed, has been refactored (this is related to 14 and 15
|
||||
above). Processing unduplicated named groups should now be as fast at
|
||||
numerical groups, and processing duplicated groups should be faster than
|
||||
before.
|
||||
|
||||
20. Two patches to the CMake build system, by Alexander Barkov:
|
||||
|
||||
(1) Replace the "source" command by "." in CMakeLists.txt because
|
||||
"source" is a bash-ism.
|
||||
|
||||
(2) Add missing HAVE_STDINT_H and HAVE_INTTYPES_H to config-cmake.h.in;
|
||||
without these the CMake build does not work on Solaris.
|
||||
|
||||
21. Perl has changed its handling of \8 and \9. If there is no previously
|
||||
encountered capturing group of those numbers, they are treated as the
|
||||
literal characters 8 and 9 instead of a binary zero followed by the
|
||||
literals. PCRE now does the same.
|
||||
|
||||
22. Following Perl, added \o{} to specify codepoints in octal, making it
|
||||
possible to specify values greater than 0777 and also making them
|
||||
unambiguous.
|
||||
|
||||
23. Perl now gives an error for missing closing braces after \x{... instead of
|
||||
treating the string as literal. PCRE now does the same.
|
||||
|
||||
24. RunTest used to grumble if an inappropriate test was selected explicitly,
|
||||
but just skip it when running all tests. This make it awkward to run ranges
|
||||
of tests when one of them was inappropriate. Now it just skips any
|
||||
inappropriate tests, as it always did when running all tests.
|
||||
|
||||
25. If PCRE_AUTO_CALLOUT and PCRE_UCP were set for a pattern that contained
|
||||
character types such as \d or \w, too many callouts were inserted, and the
|
||||
data that they returned was rubbish.
|
||||
|
||||
26. In UCP mode, \s was not matching two of the characters that Perl matches,
|
||||
namely NEL (U+0085) and MONGOLIAN VOWEL SEPARATOR (U+180E), though they
|
||||
were matched by \h. The code has now been refactored so that the lists of
|
||||
the horizontal and vertical whitespace characters used for \h and \v (which
|
||||
are defined only in one place) are now also used for \s.
|
||||
|
||||
27. Add JIT support for the 64 bit TileGX architecture.
|
||||
Patch by Jiong Wang (Tilera Corporation).
|
||||
|
||||
28. Possessive quantifiers for classes (both explicit and automatically
|
||||
generated) now use special opcodes instead of wrapping in ONCE brackets.
|
||||
|
||||
29. Whereas an item such as A{4}+ ignored the possessivenes of the quantifier
|
||||
(because it's meaningless), this was not happening when PCRE_CASELESS was
|
||||
set. Not wrong, but inefficient.
|
||||
|
||||
30. Updated perltest.pl to add /u (force Unicode mode) when /W (use Unicode
|
||||
properties for \w, \d, etc) is present in a test regex. Otherwise if the
|
||||
test contains no characters greater than 255, Perl doesn't realise it
|
||||
should be using Unicode semantics.
|
||||
|
||||
31. Upgraded the handling of the POSIX classes [:graph:], [:print:], and
|
||||
[:punct:] when PCRE_UCP is set so as to include the same characters as Perl
|
||||
does in Unicode mode.
|
||||
|
||||
32. Added the "forbid" facility to pcretest so that putting tests into the
|
||||
wrong test files can sometimes be quickly detected.
|
||||
|
||||
33. There is now a limit (default 250) on the depth of nesting of parentheses.
|
||||
This limit is imposed to control the amount of system stack used at compile
|
||||
time. It can be changed at build time by --with-parens-nest-limit=xxx or
|
||||
the equivalent in CMake.
|
||||
|
||||
34. Character classes such as [A-\d] or [a-[:digit:]] now cause compile-time
|
||||
errors. Perl warns for these when in warning mode, but PCRE has no facility
|
||||
for giving warnings.
|
||||
|
||||
35. Change 34 for 8.13 allowed quantifiers on assertions, because Perl does.
|
||||
However, this was not working for (?!) because it is optimized to (*FAIL),
|
||||
for which PCRE does not allow quantifiers. The optimization is now disabled
|
||||
when a quantifier follows (?!). I can't see any use for this, but it makes
|
||||
things uniform.
|
||||
|
||||
36. Perl no longer allows group names to start with digits, so I have made this
|
||||
change also in PCRE. It simplifies the code a bit.
|
||||
|
||||
37. In extended mode, Perl ignores spaces before a + that indicates a
|
||||
possessive quantifier. PCRE allowed a space before the quantifier, but not
|
||||
before the possessive +. It now does.
|
||||
|
||||
38. The use of \K (reset reported match start) within a repeated possessive
|
||||
group such as (a\Kb)*+ was not working.
|
||||
|
||||
40. Document that the same character tables must be used at compile time and
|
||||
run time, and that the facility to pass tables to pcre_exec() and
|
||||
pcre_dfa_exec() is for use only with saved/restored patterns.
|
||||
|
||||
41. Applied Jeff Trawick's patch CMakeLists.txt, which "provides two new
|
||||
features for Builds with MSVC:
|
||||
|
||||
1. Support pcre.rc and/or pcreposix.rc (as is already done for MinGW
|
||||
builds). The .rc files can be used to set FileDescription and many other
|
||||
attributes.
|
||||
|
||||
2. Add an option (-DINSTALL_MSVC_PDB) to enable installation of .pdb files.
|
||||
This allows higher-level build scripts which want .pdb files to avoid
|
||||
hard-coding the exact files needed."
|
||||
|
||||
42. Added support for [[:<:]] and [[:>:]] as used in the BSD POSIX library to
|
||||
mean "start of word" and "end of word", respectively, as a transition aid.
|
||||
|
||||
43. A minimizing repeat of a class containing codepoints greater than 255 in
|
||||
non-UTF 16-bit or 32-bit modes caused an internal error when PCRE was
|
||||
compiled to use the heap for recursion.
|
||||
|
||||
44. Got rid of some compiler warnings for unused variables when UTF but not UCP
|
||||
is configured.
|
||||
|
||||
|
||||
Version 8.33 28-May-2013
|
||||
------------------------
|
||||
|
||||
1. Added 'U' to some constants that are compared to unsigned integers, to
|
||||
avoid compiler signed/unsigned warnings. Added (int) casts to unsigned
|
||||
variables that are added to signed variables, to ensure the result is
|
||||
signed and can be negated.
|
||||
|
||||
2. Applied patch by Daniel Richard G for quashing MSVC warnings to the
|
||||
CMake config files.
|
||||
|
||||
3. Revise the creation of config.h.generic so that all boolean macros are
|
||||
#undefined, whereas non-boolean macros are #ifndef/#endif-ed. This makes
|
||||
overriding via -D on the command line possible.
|
||||
|
||||
4. Changing the definition of the variable "op" in pcre_exec.c from pcre_uchar
|
||||
to unsigned int is reported to make a quite noticeable speed difference in
|
||||
a specific Windows environment. Testing on Linux did also appear to show
|
||||
some benefit (and it is clearly not harmful). Also fixed the definition of
|
||||
Xop which should be unsigned.
|
||||
|
||||
5. Related to (4), changing the definition of the intermediate variable cc
|
||||
in repeated character loops from pcre_uchar to pcre_uint32 also gave speed
|
||||
improvements.
|
||||
|
||||
6. Fix forward search in JIT when link size is 3 or greater. Also removed some
|
||||
unnecessary spaces.
|
||||
|
||||
7. Adjust autogen.sh and configure.ac to lose warnings given by automake 1.12
|
||||
and later.
|
||||
|
||||
8. Fix two buffer over read issues in 16 and 32 bit modes. Affects JIT only.
|
||||
|
||||
9. Optimizing fast_forward_start_bits in JIT.
|
||||
|
||||
10. Adding support for callouts in JIT, and fixing some issues revealed
|
||||
during this work. Namely:
|
||||
|
||||
(a) Unoptimized capturing brackets incorrectly reset on backtrack.
|
||||
|
||||
(b) Minimum length was not checked before the matching is started.
|
||||
|
||||
11. The value of capture_last that is passed to callouts was incorrect in some
|
||||
cases when there was a capture on one path that was subsequently abandoned
|
||||
after a backtrack. Also, the capture_last value is now reset after a
|
||||
recursion, since all captures are also reset in this case.
|
||||
|
||||
12. The interpreter no longer returns the "too many substrings" error in the
|
||||
case when an overflowing capture is in a branch that is subsequently
|
||||
abandoned after a backtrack.
|
||||
|
||||
13. In the pathological case when an offset vector of size 2 is used, pcretest
|
||||
now prints out the matched string after a yield of 0 or 1.
|
||||
|
||||
14. Inlining subpatterns in recursions, when certain conditions are fulfilled.
|
||||
Only supported by the JIT compiler at the moment.
|
||||
|
||||
15. JIT compiler now supports 32 bit Macs thanks to Lawrence Velazquez.
|
||||
|
||||
16. Partial matches now set offsets[2] to the "bumpalong" value, that is, the
|
||||
offset of the starting point of the matching process, provided the offsets
|
||||
vector is large enough.
|
||||
|
||||
17. The \A escape now records a lookbehind value of 1, though its execution
|
||||
does not actually inspect the previous character. This is to ensure that,
|
||||
in partial multi-segment matching, at least one character from the old
|
||||
segment is retained when a new segment is processed. Otherwise, if there
|
||||
are no lookbehinds in the pattern, \A might match incorrectly at the start
|
||||
of a new segment.
|
||||
|
||||
18. Added some #ifdef __VMS code into pcretest.c to help VMS implementations.
|
||||
|
||||
19. Redefined some pcre_uchar variables in pcre_exec.c as pcre_uint32; this
|
||||
gives some modest performance improvement in 8-bit mode.
|
||||
|
||||
20. Added the PCRE-specific property \p{Xuc} for matching characters that can
|
||||
be expressed in certain programming languages using Universal Character
|
||||
Names.
|
||||
|
||||
21. Unicode validation has been updated in the light of Unicode Corrigendum #9,
|
||||
which points out that "non characters" are not "characters that may not
|
||||
appear in Unicode strings" but rather "characters that are reserved for
|
||||
internal use and have only local meaning".
|
||||
|
||||
22. When a pattern was compiled with automatic callouts (PCRE_AUTO_CALLOUT) and
|
||||
there was a conditional group that depended on an assertion, if the
|
||||
assertion was false, the callout that immediately followed the alternation
|
||||
in the condition was skipped when pcre_exec() was used for matching.
|
||||
|
||||
23. Allow an explicit callout to be inserted before an assertion that is the
|
||||
condition for a conditional group, for compatibility with automatic
|
||||
callouts, which always insert a callout at this point.
|
||||
|
||||
24. In 8.31, (*COMMIT) was confined to within a recursive subpattern. Perl also
|
||||
confines (*SKIP) and (*PRUNE) in the same way, and this has now been done.
|
||||
|
||||
25. (*PRUNE) is now supported by the JIT compiler.
|
||||
|
||||
26. Fix infinite loop when /(?<=(*SKIP)ac)a/ is matched against aa.
|
||||
|
||||
27. Fix the case where there are two or more SKIPs with arguments that may be
|
||||
ignored.
|
||||
|
||||
28. (*SKIP) is now supported by the JIT compiler.
|
||||
|
||||
29. (*THEN) is now supported by the JIT compiler.
|
||||
|
||||
30. Update RunTest with additional test selector options.
|
||||
|
||||
31. The way PCRE handles backtracking verbs has been changed in two ways.
|
||||
|
||||
(1) Previously, in something like (*COMMIT)(*SKIP), COMMIT would override
|
||||
SKIP. Now, PCRE acts on whichever backtracking verb is reached first by
|
||||
backtracking. In some cases this makes it more Perl-compatible, but Perl's
|
||||
rather obscure rules do not always do the same thing.
|
||||
|
||||
(2) Previously, backtracking verbs were confined within assertions. This is
|
||||
no longer the case for positive assertions, except for (*ACCEPT). Again,
|
||||
this sometimes improves Perl compatibility, and sometimes does not.
|
||||
|
||||
32. A number of tests that were in test 2 because Perl did things differently
|
||||
have been moved to test 1, because either Perl or PCRE has changed, and
|
||||
these tests are now compatible.
|
||||
|
||||
32. Backtracking control verbs are now handled in the same way in JIT and
|
||||
interpreter.
|
||||
|
||||
33. An opening parenthesis in a MARK/PRUNE/SKIP/THEN name in a pattern that
|
||||
contained a forward subroutine reference caused a compile error.
|
||||
|
||||
34. Auto-detect and optimize limited repetitions in JIT.
|
||||
|
||||
35. Implement PCRE_NEVER_UTF to lock out the use of UTF, in particular,
|
||||
blocking (*UTF) etc.
|
||||
|
||||
36. In the interpreter, maximizing pattern repetitions for characters and
|
||||
character types now use tail recursion, which reduces stack usage.
|
||||
|
||||
37. The value of the max lookbehind was not correctly preserved if a compiled
|
||||
and saved regex was reloaded on a host of different endianness.
|
||||
|
||||
38. Implemented (*LIMIT_MATCH) and (*LIMIT_RECURSION). As part of the extension
|
||||
of the compiled pattern block, expand the flags field from 16 to 32 bits
|
||||
because it was almost full.
|
||||
|
||||
39. Try madvise first before posix_madvise.
|
||||
|
||||
40. Change 7 for PCRE 7.9 made it impossible for pcregrep to find empty lines
|
||||
with a pattern such as ^$. It has taken 4 years for anybody to notice! The
|
||||
original change locked out all matches of empty strings. This has been
|
||||
changed so that one match of an empty string per line is recognized.
|
||||
Subsequent searches on the same line (for colouring or for --only-matching,
|
||||
for example) do not recognize empty strings.
|
||||
|
||||
41. Applied a user patch to fix a number of spelling mistakes in comments.
|
||||
|
||||
42. Data lines longer than 65536 caused pcretest to crash.
|
||||
|
||||
43. Clarified the data type for length and startoffset arguments for pcre_exec
|
||||
and pcre_dfa_exec in the function-specific man pages, where they were
|
||||
explicitly stated to be in bytes, never having been updated. I also added
|
||||
some clarification to the pcreapi man page.
|
||||
|
||||
44. A call to pcre_dfa_exec() with an output vector size less than 2 caused
|
||||
a segmentation fault.
|
||||
|
||||
|
||||
Version 8.32 30-November-2012
|
||||
-----------------------------
|
||||
|
||||
@@ -1508,7 +1883,8 @@ Version 7.9 11-Apr-09
|
||||
7. A pattern that could match an empty string could cause pcregrep to loop; it
|
||||
doesn't make sense to accept an empty string match in pcregrep, so I have
|
||||
locked it out (using PCRE's PCRE_NOTEMPTY option). By experiment, this
|
||||
seems to be how GNU grep behaves.
|
||||
seems to be how GNU grep behaves. [But see later change 40 for release
|
||||
8.33.]
|
||||
|
||||
8. The pattern (?(?=.*b)b|^) was incorrectly compiled as "match must be at
|
||||
start or after a newline", because the conditional assertion was not being
|
||||
|
||||
+162
-107
@@ -54,12 +54,12 @@ Support for 16-bit and 32-bit data strings
|
||||
|
||||
From release 8.30, PCRE supports 16-bit as well as 8-bit data strings; and from
|
||||
release 8.32, PCRE supports 32-bit data strings. The library can be compiled
|
||||
in any combination of 8-bit, 16-bit or 32-bit modes, creating different
|
||||
libraries. In the description that follows, the word "short" is
|
||||
used for a 16-bit data quantity, and the word "unit" is used for a quantity
|
||||
that is a byte in 8-bit mode, a short in 16-bit mode and a 32-bit unsigned
|
||||
integer in 32-bit mode. However, so as not to over-complicate the text, the
|
||||
names of PCRE functions are given in 8-bit form only.
|
||||
in any combination of 8-bit, 16-bit or 32-bit modes, creating up to three
|
||||
different libraries. In the description that follows, the word "short" is used
|
||||
for a 16-bit data quantity, and the word "unit" is used for a quantity that is
|
||||
a byte in 8-bit mode, a short in 16-bit mode and a 32-bit word in 32-bit mode.
|
||||
However, so as not to over-complicate the text, the names of PCRE functions are
|
||||
given in 8-bit form only.
|
||||
|
||||
|
||||
Computing the memory requirement: how it was
|
||||
@@ -94,6 +94,11 @@ runs more slowly than before (30% or more, depending on the pattern) because it
|
||||
is doing a full analysis of the pattern. My hope was that this would not be a
|
||||
big issue, and in the event, nobody has commented on it.
|
||||
|
||||
At release 8.34, a limit on the nesting depth of parentheses was re-introduced
|
||||
(default 250, settable at build time) so as to put a limit on the amount of
|
||||
system stack used by pcre_compile(). This is a safety feature for environments
|
||||
with small stacks where the patterns are provided by users.
|
||||
|
||||
|
||||
Traditional matching function
|
||||
-----------------------------
|
||||
@@ -120,29 +125,30 @@ facilities are available, and those that are do not always work in quite the
|
||||
same way. See the user documentation for details.
|
||||
|
||||
The algorithm that is used for pcre_dfa_exec() is not a traditional FSM,
|
||||
because it may have a number of states active at one time. More work would be
|
||||
needed at compile time to produce a traditional FSM where only one state is
|
||||
ever active at once. I believe some other regex matchers work this way.
|
||||
because it may have a number of states active at one time. More work would be
|
||||
needed at compile time to produce a traditional FSM where only one state is
|
||||
ever active at once. I believe some other regex matchers work this way. JIT
|
||||
support is not available for this kind of matching.
|
||||
|
||||
|
||||
Changeable options
|
||||
------------------
|
||||
|
||||
The /i, /m, or /s options (PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL) may
|
||||
change in the middle of patterns. From PCRE 8.13, their processing is handled
|
||||
entirely at compile time by generating different opcodes for the different
|
||||
settings. The runtime functions do not need to keep track of an options state
|
||||
any more.
|
||||
The /i, /m, or /s options (PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and some
|
||||
others) may change in the middle of patterns. From PCRE 8.13, their processing
|
||||
is handled entirely at compile time by generating different opcodes for the
|
||||
different settings. The runtime functions do not need to keep track of an
|
||||
options state any more.
|
||||
|
||||
|
||||
Format of compiled patterns
|
||||
---------------------------
|
||||
|
||||
The compiled form of a pattern is a vector of units (bytes in 8-bit mode, or
|
||||
shorts in 16-bit mode, 32-bit unsigned integers in 32-bit mode), containing
|
||||
items of variable length. The first unit in an item contains an opcode, and
|
||||
the length of the item is either implicit in the opcode or contained in the
|
||||
data that follows it.
|
||||
The compiled form of a pattern is a vector of unsigned units (bytes in 8-bit
|
||||
mode, shorts in 16-bit mode, 32-bit words in 32-bit mode), containing items of
|
||||
variable length. The first unit in an item contains an opcode, and the length
|
||||
of the item is either implicit in the opcode or contained in the data that
|
||||
follows it.
|
||||
|
||||
In many cases listed below, LINK_SIZE data values are specified for offsets
|
||||
within the compiled pattern. LINK_SIZE always specifies a number of bytes. The
|
||||
@@ -151,8 +157,10 @@ default value for LINK_SIZE is 2, but PCRE can be compiled to use 3-byte or
|
||||
LINK_SIZE values are available only in 8-bit mode.) Specifing a LINK_SIZE
|
||||
larger than 2 is necessary only when patterns whose compiled length is greater
|
||||
than 64K are going to be processed. In this description, we assume the "normal"
|
||||
compilation options. Data values that are counts (e.g. for quantifiers) are
|
||||
always just two bytes long (one short in 16-bit mode).
|
||||
compilation options. Data values that are counts (e.g. quantifiers) are two
|
||||
bytes long in 8-bit mode (most significant byte first), or one unit in 16-bit
|
||||
and 32-bit modes.
|
||||
|
||||
|
||||
Opcodes with no following data
|
||||
------------------------------
|
||||
@@ -162,7 +170,7 @@ These items are all just one unit long
|
||||
OP_END end of pattern
|
||||
OP_ANY match any one character other than newline
|
||||
OP_ALLANY match any one character, including newline
|
||||
OP_ANYBYTE match any single byte, even in UTF-8 mode
|
||||
OP_ANYBYTE match any single unit, even in UTF-8/16 mode
|
||||
OP_SOD match start of data: \A
|
||||
OP_SOM, start of match (subject + offset): \G
|
||||
OP_SET_SOM, set start of match (\K)
|
||||
@@ -180,28 +188,33 @@ These items are all just one unit long
|
||||
OP_VSPACE \v
|
||||
OP_NOT_WORDCHAR \W
|
||||
OP_WORDCHAR \w
|
||||
OP_EODN match end of data or \n at end: \Z
|
||||
OP_EODN match end of data or newline at end: \Z
|
||||
OP_EOD match end of data: \z
|
||||
OP_DOLL $ (end of data, or before final newline)
|
||||
OP_DOLLM $ multiline mode (end of data or before newline)
|
||||
OP_EXTUNI match an extended Unicode character
|
||||
OP_EXTUNI match an extended Unicode grapheme cluster
|
||||
OP_ANYNL match any Unicode newline sequence
|
||||
|
||||
OP_ASSERT_ACCEPT )
|
||||
OP_ACCEPT ) These are Perl 5.10's "backtracking control
|
||||
OP_COMMIT ) verbs". If OP_ACCEPT is inside capturing
|
||||
OP_FAIL ) parentheses, it may be preceded by one or more
|
||||
OP_PRUNE ) OP_CLOSE, followed by a 2-byte number,
|
||||
OP_SKIP ) indicating which parentheses must be closed.
|
||||
OP_PRUNE ) OP_CLOSE, each followed by a count that
|
||||
OP_SKIP ) indicates which parentheses must be closed.
|
||||
OP_THEN )
|
||||
|
||||
OP_ASSERT_ACCEPT is used when (*ACCEPT) is encountered within an assertion.
|
||||
This ends the assertion, not the entire pattern match.
|
||||
|
||||
|
||||
Backtracking control verbs with (optional) data
|
||||
-----------------------------------------------
|
||||
Backtracking control verbs with optional data
|
||||
---------------------------------------------
|
||||
|
||||
(*THEN) without an argument generates the opcode OP_THEN and no following data.
|
||||
OP_MARK is followed by the mark name, preceded by a one-unit length, and
|
||||
followed by a binary zero. For (*PRUNE), (*SKIP), and (*THEN) with arguments,
|
||||
the opcodes OP_PRUNE_ARG, OP_SKIP_ARG, and OP_THEN_ARG are used, with the name
|
||||
following in the same format.
|
||||
following in the same format as OP_MARK.
|
||||
|
||||
|
||||
Matching literal characters
|
||||
@@ -212,6 +225,10 @@ casefully. For caseless matching, OP_CHARI is used. In UTF-8 or UTF-16 modes,
|
||||
the character may be more than one unit long. In UTF-32 mode, characters
|
||||
are always exactly one unit long.
|
||||
|
||||
If there is only one character in a character class, OP_CHAR or OP_CHARI is
|
||||
used for a positive class, and OP_NOT or OP_NOTI for a negative one (that is,
|
||||
for something like [^a]).
|
||||
|
||||
|
||||
Repeating single characters
|
||||
---------------------------
|
||||
@@ -232,10 +249,9 @@ following opcodes, which come in caseful and caseless versions:
|
||||
|
||||
Each opcode is followed by the character that is to be repeated. In ASCII mode,
|
||||
these are two-unit items; in UTF-8 or UTF-16 modes, the length is variable; in
|
||||
UTF-32 mode these are one-unit items.
|
||||
Those with "MIN" in their names are the minimizing versions. Those with "POS"
|
||||
in their names are possessive versions. Other repeats make use of these
|
||||
opcodes:
|
||||
UTF-32 mode these are one-unit items. Those with "MIN" in their names are the
|
||||
minimizing versions. Those with "POS" in their names are possessive versions.
|
||||
Other repeats make use of these opcodes:
|
||||
|
||||
Caseful Caseless
|
||||
OP_UPTO OP_UPTOI
|
||||
@@ -243,10 +259,15 @@ opcodes:
|
||||
OP_POSUPTO OP_POSUPTOI
|
||||
OP_EXACT OP_EXACTI
|
||||
|
||||
Each of these is followed by a two-byte (one short) count (most significant
|
||||
byte first in 8-bit mode) and then the repeated character. OP_UPTO matches from
|
||||
0 to the given number. A repeat with a non-zero minimum and a fixed maximum is
|
||||
coded as an OP_EXACT followed by an OP_UPTO (or OP_MINUPTO or OPT_POSUPTO).
|
||||
Each of these is followed by a count and then the repeated character. OP_UPTO
|
||||
matches from 0 to the given number. A repeat with a non-zero minimum and a
|
||||
fixed maximum is coded as an OP_EXACT followed by an OP_UPTO (or OP_MINUPTO or
|
||||
OPT_POSUPTO).
|
||||
|
||||
Another set of matching repeating opcodes (called OP_NOTSTAR, OP_NOTSTARI,
|
||||
etc.) are used for repeated, negated, single-character classes such as [^a]*.
|
||||
The normal single-character opcodes (OP_STAR, etc.) are used for repeated
|
||||
positive single-character classes.
|
||||
|
||||
|
||||
Repeating character types
|
||||
@@ -277,7 +298,10 @@ Match by Unicode property
|
||||
OP_PROP and OP_NOTPROP are used for positive and negative matches of a
|
||||
character by testing its Unicode property (the \p and \P escape sequences).
|
||||
Each is followed by two units that encode the desired property as a type and a
|
||||
value.
|
||||
value. The types are a set of #defines of the form PT_xxx, and the values are
|
||||
enumerations of the form ucp_xx, defined in the ucp.h source file. The value is
|
||||
relevant only for PT_GC (General Category), PT_PC (Particular Category), and
|
||||
PT_SC (Script).
|
||||
|
||||
Repeats of these items use the OP_TYPESTAR etc. set of opcodes, followed by
|
||||
three units: OP_PROP or OP_NOTPROP, and then the desired property type and
|
||||
@@ -287,67 +311,88 @@ value.
|
||||
Character classes
|
||||
-----------------
|
||||
|
||||
If there is only one character in the class, OP_CHAR or OP_CHARI is used for a
|
||||
If there is only one character in a class, OP_CHAR or OP_CHARI is used for a
|
||||
positive class, and OP_NOT or OP_NOTI for a negative one (that is, for
|
||||
something like [^a]).
|
||||
|
||||
Another set of 13 repeating opcodes (called OP_NOTSTAR etc.) are used for
|
||||
repeated, negated, single-character classes. The normal single-character
|
||||
opcodes (OP_STAR, etc.) are used for repeated positive single-character
|
||||
classes.
|
||||
A set of repeating opcodes (called OP_NOTSTAR etc.) are used for repeated,
|
||||
negated, single-character classes. The normal single-character opcodes
|
||||
(OP_STAR, etc.) are used for repeated positive single-character classes.
|
||||
|
||||
When there is more than one character in a class and all the characters are
|
||||
When there is more than one character in a class, and all the code points are
|
||||
less than 256, OP_CLASS is used for a positive class, and OP_NCLASS for a
|
||||
negative one. In either case, the opcode is followed by a 32-byte (16-short)
|
||||
bit map containing a 1 bit for every character that is acceptable. The bits are
|
||||
counted from the least significant end of each unit. In caseless mode, bits for
|
||||
both cases are set.
|
||||
negative one. In either case, the opcode is followed by a 32-byte (16-short,
|
||||
8-word) bit map containing a 1 bit for every character that is acceptable. The
|
||||
bits are counted from the least significant end of each unit. In caseless mode,
|
||||
bits for both cases are set.
|
||||
|
||||
The reason for having both OP_CLASS and OP_NCLASS is so that, in UTF-8/16/32 mode,
|
||||
subject characters with values greater than 255 can be handled correctly. For
|
||||
OP_CLASS they do not match, whereas for OP_NCLASS they do.
|
||||
The reason for having both OP_CLASS and OP_NCLASS is so that, in UTF-8/16/32
|
||||
mode, subject characters with values greater than 255 can be handled correctly.
|
||||
For OP_CLASS they do not match, whereas for OP_NCLASS they do.
|
||||
|
||||
For classes containing characters with values greater than 255, OP_XCLASS is
|
||||
used. It optionally uses a bit map (if any characters lie within it), followed
|
||||
by a list of pairs (for a range) and single characters. In caseless mode, both
|
||||
cases are explicitly listed. There is a flag character than indicates whether
|
||||
it is a positive or a negative class.
|
||||
For classes containing characters with values greater than 255 or that contain
|
||||
\p or \P, OP_XCLASS is used. It optionally uses a bit map if any code points
|
||||
are less than 256, followed by a list of pairs (for a range) and single
|
||||
characters. In caseless mode, both cases are explicitly listed.
|
||||
|
||||
OP_XCLASS is followed by a unit containing flag bits: XCL_NOT indicates that
|
||||
this is a negative class, and XCL_MAP indicates that a bit map is present.
|
||||
There follows the bit map, if XCL_MAP is set, and then a sequence of items
|
||||
coded as follows:
|
||||
|
||||
XCL_END marks the end of the list
|
||||
XCL_SINGLE one character follows
|
||||
XCL_RANGE two characters follow
|
||||
XCL_PROP a Unicode property (type, value) follows
|
||||
XCL_NOTPROP a Unicode property (type, value) follows
|
||||
|
||||
If a range starts with a code point less than 256 and ends with one greater
|
||||
than 256, an XCL_RANGE item is used, without setting any bits in the bit map.
|
||||
This means that if no other items in the class set bits in the map, a map is
|
||||
not needed.
|
||||
|
||||
|
||||
Back references
|
||||
---------------
|
||||
|
||||
OP_REF (caseful) or OP_REFI (caseless) is followed by two bytes (one short)
|
||||
containing the reference number.
|
||||
OP_REF (caseful) or OP_REFI (caseless) is followed by a count containing the
|
||||
reference number if the reference is to a unique capturing group (either by
|
||||
number or by name). When named groups are used, there may be more than one
|
||||
group with the same name. In this case, a reference by name generates OP_DNREF
|
||||
or OP_DNREFI. These are followed by two counts: the index (not the byte offset)
|
||||
in the group name table of the first entry for the requred name, followed by
|
||||
the number of groups with the same name.
|
||||
|
||||
|
||||
Repeating character classes and back references
|
||||
-----------------------------------------------
|
||||
|
||||
Single-character classes are handled specially (see above). This section
|
||||
applies to OP_CLASS and OP_REF[I]. In both cases, the repeat information
|
||||
follows the base item. The matching code looks at the following opcode to see
|
||||
if it is one of
|
||||
applies to other classes and also to back references. In both cases, the repeat
|
||||
information follows the base item. The matching code looks at the following
|
||||
opcode to see if it is one of
|
||||
|
||||
OP_CRSTAR
|
||||
OP_CRMINSTAR
|
||||
OP_CRPOSSTAR
|
||||
OP_CRPLUS
|
||||
OP_CRMINPLUS
|
||||
OP_CRPOSPLUS
|
||||
OP_CRQUERY
|
||||
OP_CRMINQUERY
|
||||
OP_CRPOSQUERY
|
||||
OP_CRRANGE
|
||||
OP_CRMINRANGE
|
||||
OP_CRPOSRANGE
|
||||
|
||||
All but the last two are just single-unit items. The others are followed by
|
||||
four bytes (two shorts) of data, comprising the minimum and maximum repeat
|
||||
counts. There are no special possessive opcodes for these repeats; a possessive
|
||||
repeat is compiled into an atomic group.
|
||||
All but the last three are single-unit items, with no data. The others are
|
||||
followed by the minimum and maximum repeat counts.
|
||||
|
||||
|
||||
Brackets and alternation
|
||||
------------------------
|
||||
|
||||
A pair of non-capturing (round) brackets is wrapped round each expression at
|
||||
A pair of non-capturing round brackets is wrapped round each expression at
|
||||
compile time, so alternation always happens in the context of brackets.
|
||||
|
||||
[Note for North Americans: "bracket" to some English speakers, including
|
||||
@@ -364,20 +409,20 @@ A bracket opcode is followed by LINK_SIZE bytes which give the offset to the
|
||||
next alternative OP_ALT or, if there aren't any branches, to the matching
|
||||
OP_KET opcode. Each OP_ALT is followed by LINK_SIZE bytes giving the offset to
|
||||
the next one, or to the OP_KET opcode. For capturing brackets, the bracket
|
||||
number immediately follows the offset, always as a 2-byte (one short) item.
|
||||
number is a count that immediately follows the offset.
|
||||
|
||||
OP_KET is used for subpatterns that do not repeat indefinitely, and
|
||||
OP_KETRMIN and OP_KETRMAX are used for indefinite repetitions, minimally or
|
||||
maximally respectively (see below for possessive repetitions). All three are
|
||||
followed by LINK_SIZE bytes giving (as a positive number) the offset back to
|
||||
the matching bracket opcode.
|
||||
OP_KET is used for subpatterns that do not repeat indefinitely, and OP_KETRMIN
|
||||
and OP_KETRMAX are used for indefinite repetitions, minimally or maximally
|
||||
respectively (see below for possessive repetitions). All three are followed by
|
||||
LINK_SIZE bytes giving (as a positive number) the offset back to the matching
|
||||
bracket opcode.
|
||||
|
||||
If a subpattern is quantified such that it is permitted to match zero times, it
|
||||
is preceded by one of OP_BRAZERO, OP_BRAMINZERO, or OP_SKIPZERO. These are
|
||||
single-unit opcodes that tell the matcher that skipping the following
|
||||
subpattern entirely is a valid branch. In the case of the first two, not
|
||||
skipping the pattern is also valid (greedy and non-greedy). The third is used
|
||||
when a pattern has the quantifier {0,0}. It cannot be entirely discarded,
|
||||
when a pattern has the quantifier {0,0}. It cannot be entirely discarded,
|
||||
because it may be called as a subroutine from elsewhere in the regex.
|
||||
|
||||
A subpattern with an indefinite maximum repetition is replicated in the
|
||||
@@ -397,6 +442,7 @@ final replication is changed to OP_SBRA or OP_SCBRA. This tells the matcher
|
||||
that it needs to check for matching an empty string when it hits OP_KETRMIN or
|
||||
OP_KETRMAX, and if so, to break the loop.
|
||||
|
||||
|
||||
Possessive brackets
|
||||
-------------------
|
||||
|
||||
@@ -407,26 +453,34 @@ of OP_SCBRA. The end of such a group is marked by OP_KETRPOS. If the minimum
|
||||
repetition is zero, the group is preceded by OP_BRAPOSZERO.
|
||||
|
||||
|
||||
Once-only (atomic) groups
|
||||
-------------------------
|
||||
|
||||
These are just like other subpatterns, but they start with the opcode
|
||||
OP_ONCE or OP_ONCE_NC. The former is used when there are no capturing brackets
|
||||
within the atomic group; the latter when there are. The distinction is needed
|
||||
for when there is a backtrack to before the group - any captures within the
|
||||
group must be reset, so it is necessary to retain backtracking points inside
|
||||
the group even after it is complete in order to do this. When there are no
|
||||
captures in an atomic group, all the backtracking can be discarded when it is
|
||||
complete. This is more efficient, and also uses less stack.
|
||||
|
||||
The check for matching an empty string in an unbounded repeat is handled
|
||||
entirely at runtime, so there are just these two opcodes for atomic groups.
|
||||
|
||||
|
||||
Assertions
|
||||
----------
|
||||
|
||||
Forward assertions are just like other subpatterns, but starting with one of
|
||||
the opcodes OP_ASSERT or OP_ASSERT_NOT. Backward assertions use the opcodes
|
||||
Forward assertions are also just like other subpatterns, but starting with one
|
||||
of the opcodes OP_ASSERT or OP_ASSERT_NOT. Backward assertions use the opcodes
|
||||
OP_ASSERTBACK and OP_ASSERTBACK_NOT, and the first opcode inside the assertion
|
||||
is OP_REVERSE, followed by a two byte (one short) count of the number of
|
||||
characters to move back the pointer in the subject string. In ASCII mode, the
|
||||
count is a number of units, but in UTF-8/16 mode each character may occupy more
|
||||
than one unit; in UTF-32 mode each character occupies exactly one unit.
|
||||
A separate count is present in each alternative of a lookbehind
|
||||
assertion, allowing them to have different fixed lengths.
|
||||
|
||||
|
||||
Once-only (atomic) subpatterns
|
||||
------------------------------
|
||||
|
||||
These are also just like other subpatterns, but they start with the opcode
|
||||
OP_ONCE. The check for matching an empty string in an unbounded repeat is
|
||||
handled entirely at runtime, so there is just this one opcode.
|
||||
is OP_REVERSE, followed by a count of the number of characters to move back the
|
||||
pointer in the subject string. In ASCII mode, the count is a number of units,
|
||||
but in UTF-8/16 mode each character may occupy more than one unit; in UTF-32
|
||||
mode each character occupies exactly one unit. A separate count is present in
|
||||
each alternative of a lookbehind assertion, allowing them to have different
|
||||
fixed lengths.
|
||||
|
||||
|
||||
Conditional subpatterns
|
||||
@@ -435,28 +489,29 @@ Conditional subpatterns
|
||||
These are like other subpatterns, but they start with the opcode OP_COND, or
|
||||
OP_SCOND for one that might match an empty string in an unbounded repeat. If
|
||||
the condition is a back reference, this is stored at the start of the
|
||||
subpattern using the opcode OP_CREF followed by two bytes (one short)
|
||||
containing the reference number. OP_NCREF is used instead if the reference was
|
||||
generated by name (so that the runtime code knows to check for duplicate
|
||||
names).
|
||||
subpattern using the opcode OP_CREF followed by a count containing the
|
||||
reference number, provided that the reference is to a unique capturing group.
|
||||
If the reference was by name and there is more than one group with that name,
|
||||
OP_DNCREF is used instead. It is followed by two counts: the index in the group
|
||||
names table, and the number of groups with the same name.
|
||||
|
||||
If the condition is "in recursion" (coded as "(?(R)"), or "in recursion of
|
||||
group x" (coded as "(?(Rx)"), the group number is stored at the start of the
|
||||
subpattern using the opcode OP_RREF or OP_NRREF (cf OP_NCREF), and a value of
|
||||
zero for "the whole pattern". For a DEFINE condition, just the single unit
|
||||
OP_DEF is used (it has no associated data). Otherwise, a conditional subpattern
|
||||
always starts with one of the assertions.
|
||||
subpattern using the opcode OP_RREF (with a value of zero for "the whole
|
||||
pattern") or OP_DNRREF (with data as for OP_DNCREF). For a DEFINE condition,
|
||||
just the single unit OP_DEF is used (it has no associated data). Otherwise, a
|
||||
conditional subpattern always starts with one of the assertions.
|
||||
|
||||
|
||||
Recursion
|
||||
---------
|
||||
|
||||
Recursion either matches the current regex, or some subexpression. The opcode
|
||||
OP_RECURSE is followed by an value which is the offset to the starting bracket
|
||||
from the start of the whole pattern. From release 6.5, OP_RECURSE is
|
||||
automatically wrapped inside OP_ONCE brackets (because otherwise some patterns
|
||||
broke it). OP_RECURSE is also used for "subroutine" calls, even though they
|
||||
are not strictly a recursion.
|
||||
OP_RECURSE is followed by aLINK_SIZE value that is the offset to the starting
|
||||
bracket from the start of the whole pattern. From release 6.5, OP_RECURSE is
|
||||
automatically wrapped inside OP_ONCE brackets, because otherwise some patterns
|
||||
broke it. OP_RECURSE is also used for "subroutine" calls, even though they are
|
||||
not strictly a recursion.
|
||||
|
||||
|
||||
Callout
|
||||
@@ -464,10 +519,10 @@ Callout
|
||||
|
||||
OP_CALLOUT is followed by one unit of data that holds a callout number in the
|
||||
range 0 to 254 for manual callouts, or 255 for an automatic callout. In both
|
||||
cases there follows a two-byte (one short) value giving the offset in the
|
||||
pattern to the start of the following item, and another two-byte (one short)
|
||||
item giving the length of the next item.
|
||||
|
||||
cases there follows a count giving the offset in the pattern string to the
|
||||
start of the following item, and another count giving the length of this item.
|
||||
These values make is possible for pcretest to output useful tracing information
|
||||
using automatic callouts.
|
||||
|
||||
Philip Hazel
|
||||
February 2012
|
||||
November 2013
|
||||
@@ -24,7 +24,7 @@ Email domain: cam.ac.uk
|
||||
University of Cambridge Computing Service,
|
||||
Cambridge, England.
|
||||
|
||||
Copyright (c) 1997-2012 University of Cambridge
|
||||
Copyright (c) 1997-2013 University of Cambridge
|
||||
All rights reserved.
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ Written by: Zoltan Herczeg
|
||||
Email local part: hzmester
|
||||
Emain domain: freemail.hu
|
||||
|
||||
Copyright(c) 2010-2012 Zoltan Herczeg
|
||||
Copyright(c) 2010-2013 Zoltan Herczeg
|
||||
All rights reserved.
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ Written by: Zoltan Herczeg
|
||||
Email local part: hzmester
|
||||
Emain domain: freemail.hu
|
||||
|
||||
Copyright(c) 2009-2012 Zoltan Herczeg
|
||||
Copyright(c) 2009-2013 Zoltan Herczeg
|
||||
All rights reserved.
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,77 @@
|
||||
News about PCRE releases
|
||||
------------------------
|
||||
|
||||
Release 8.34 15-December-2013
|
||||
-----------------------------
|
||||
|
||||
As well as fixing the inevitable bugs, performance has been improved by
|
||||
refactoring and extending the amount of "auto-possessification" that PCRE does.
|
||||
Other notable changes:
|
||||
|
||||
. Implemented PCRE_INFO_MATCH_EMPTY, which yields 1 if the pattern can match
|
||||
an empty string. If it can, pcretest shows this in its information output.
|
||||
|
||||
. A back reference to a named subpattern when there is more than one of the
|
||||
same name now checks them in the order in which they appear in the pattern.
|
||||
The first one that is set is used for the reference. Previously only the
|
||||
first one was inspected. This change makes PCRE more compatible with Perl.
|
||||
|
||||
. Unicode character properties were updated from Unicode 6.3.0.
|
||||
|
||||
. The character VT has been added to the set of characters that match \s and
|
||||
are generally treated as white space, following this same change in Perl
|
||||
5.18. There is now no difference between "Perl space" and "POSIX space".
|
||||
|
||||
. Perl has changed its handling of \8 and \9. If there is no previously
|
||||
encountered capturing group of those numbers, they are treated as the
|
||||
literal characters 8 and 9 instead of a binary zero followed by the
|
||||
literals. PCRE now does the same.
|
||||
|
||||
. Following Perl, added \o{} to specify codepoints in octal, making it
|
||||
possible to specify values greater than 0777 and also making them
|
||||
unambiguous.
|
||||
|
||||
. In UCP mode, \s was not matching two of the characters that Perl matches,
|
||||
namely NEL (U+0085) and MONGOLIAN VOWEL SEPARATOR (U+180E), though they
|
||||
were matched by \h.
|
||||
|
||||
. Add JIT support for the 64 bit TileGX architecture.
|
||||
|
||||
. Upgraded the handling of the POSIX classes [:graph:], [:print:], and
|
||||
[:punct:] when PCRE_UCP is set so as to include the same characters as Perl
|
||||
does in Unicode mode.
|
||||
|
||||
. Perl no longer allows group names to start with digits, so I have made this
|
||||
change also in PCRE.
|
||||
|
||||
. Added support for [[:<:]] and [[:>:]] as used in the BSD POSIX library to
|
||||
mean "start of word" and "end of word", respectively, as a transition aid.
|
||||
|
||||
|
||||
Release 8.33 28-May-2013
|
||||
--------------------------
|
||||
|
||||
A number of bugs are fixed, and some performance improvements have been made.
|
||||
There are also some new features, of which these are the most important:
|
||||
|
||||
. The behaviour of the backtracking verbs has been rationalized and
|
||||
documented in more detail.
|
||||
|
||||
. JIT now supports callouts and all of the backtracking verbs.
|
||||
|
||||
. Unicode validation has been updated in the light of Unicode Corrigendum #9,
|
||||
which points out that "non characters" are not "characters that may not
|
||||
appear in Unicode strings" but rather "characters that are reserved for
|
||||
internal use and have only local meaning".
|
||||
|
||||
. (*LIMIT_MATCH=d) and (*LIMIT_RECURSION=d) have been added so that the
|
||||
creator of a pattern can specify lower (but not higher) limits for the
|
||||
matching process.
|
||||
|
||||
. The PCRE_NEVER_UTF option is available to prevent pattern-writers from using
|
||||
the (*UTF) feature, as this could be a security issue.
|
||||
|
||||
|
||||
Release 8.32 30-November-2012
|
||||
-----------------------------
|
||||
|
||||
|
||||
Loaded 100 of 250 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user