diff --git a/.travis.yml b/.travis.yml index 4d127fe020164..07653040dd9a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,15 @@ notifications: email: false env: - - REPORT_EXIT_STATUS=1 + global: + - MYSQL_TEST_HOST=127.0.0.1 + - MYSQL_TEST_USER=travis + - PDO_MYSQL_TEST_DSN="mysql:host=127.0.0.1;dbname=test" + - PDO_MYSQL_TEST_USER=travis + - PDO_MYSQL_TEST_PASS= + - PDO_MYSQL_TEST_HOST=127.0.0.1 + matrix: + - REPORT_EXIT_STATUS=1 before_script: # Compile PHP @@ -21,4 +29,4 @@ before_script: - . ./travis/ext/pdo_pgsql/setup.sh # Run PHPs run-tests.php -script: ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --show-diff +script: ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --show-diff --set-timeout 120 diff --git a/CODING_STANDARDS b/CODING_STANDARDS index 16ec36b681307..a05d761cf14bb 100644 --- a/CODING_STANDARDS +++ b/CODING_STANDARDS @@ -151,7 +151,7 @@ Naming Conventions 7. Classes should be given descriptive names. Avoid using abbreviations where possible. Each word in the class name should start with a capital letter, - without underscore delimiters (CampelCaps starting with a capital letter). + without underscore delimiters (CamelCaps starting with a capital letter). The class name should be prefixed with the name of the 'parent set' (e.g. the name of the extension):: diff --git a/NEWS b/NEWS index 0c94ea23e12c7..fdfaef53cb58f 100644 --- a/NEWS +++ b/NEWS @@ -1,20 +1,35 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -?? ??? 201?, PHP 5.6.0 +?? ??? 20??, PHP 5.6.0 - Core: . Improved IS_VAR operands fetching. (Laruence, Dmitry) . Implemented internal operator overloading (RFC: https://wiki.php.net/rfc/operator_overloading_gmp). (Nikita) + . Made calls from incompatible context issue an E_DEPRECATED warning instead + of E_STRICT (phase 1 of RFC: https://wiki.php.net/rfc/incompat_ctx). + (Gustavo) + . Uploads equal or greater than 2GB in size are now accepted. + (Ralf Lang, Mike) + . Reduced POST data memory usage by 200-300%. Removed INI setting + always_populate_raw_post_data and the $HTTP_RAW_POST_DATA global + variable. (Mike) + . Implemented dedicated syntax for variadic functions + (RFC: https://wiki.php.net/rfc/variadics). (Nikita) + . Fixed bug #50333 Improving multi-threaded scalability by using + emalloc/efree/estrdup (Anatol, Dmitry) -- Session: - . Fixed Bug #65315 (session.hash_function silently fallback to default md5) - (Yasuo) - . Implemented Request #54649 (Create session_serializer_name()). (Yasuo) - . Implemented Request #17860 (Session write short circuit). (Yasuo) - . Implemented Request #20421 (session_abort() and session_reset() function). - (Yasuo) - . Implemented Request #11100 (session_gc() function). (Yasuo) +- cURL: + . Implemented FR #65646 (re-enable CURLOPT_FOLLOWLOCATION with open_basedir + or safe_mode). (Adam) + +- GMP: + . Moved GMP to use object as the underlying structure and implemented various + improvements based on this. + (RFC: https://wiki.php.net/rfc/operator_overloading_gmp). (Nikita) + +- Hash: + . Added gost-crypto (CryptoPro S-box) GOST hash algo. (Manuel Mausz) - mysqlnd: . Disabled flag for SP OUT variables for 5.5+ servers as they are not natively @@ -27,14 +42,40 @@ PHP NEWS cache_slots) in op_array->literals table. (Laruence, Dmitry) . Added script level constant replacement optimization pass. (Dmitry) +- Openssl: + . Added crypto_method option for the ssl stream context. (Martin Jansen) + . Added certificate fingerprint support. (Tjerk Meesters) + . Added explicit TLSv1.1 and TLSv1.2 stream transports. (Daniel Lowrey) + . Fixed bug #65729 (CN_match gives false positive). (Tjerk Meesters) + - PDO_pgsql: . Fixed Bug #42614 (PDO_pgsql: add pg_get_notify support). (Matteo) . Fixed Bug #63657 (pgsqlCopyFromFile, pgsqlCopyToArray use Postgres < 7.3 syntax). (Matteo) -- GMP: - . Moved GMP to use object as the underlying structure and implemented various - improvements based on this. - (RFC: https://wiki.php.net/rfc/operator_overloading_gmp). (Nikita) +- Session: + . Fixed Bug #65315 (session.hash_function silently fallback to default md5) + (Yasuo) + . Implemented Request #54649 (Create session_serializer_name()). (Yasuo) + . Implemented Request #17860 (Session write short circuit). (Yasuo) + . Implemented Request #20421 (session_abort() and session_reset() function). + (Yasuo) + . Implemented Request #11100 (session_gc() function). (Yasuo) + +- Standard: + . Implemented FR #65634 (HTTP wrapper is very slow with protocol_version + 1.1). (Adam) + . Implemented Change crypt() behavior w/o salt RFC. (Yasuo) + https://wiki.php.net/rfc/crypt_function_salt + +- XMLReader: + . Fixed bug #55285 (XMLReader::getAttribute/No/Ns methods inconsistency). + (Mike) + +- Zip: + . update libzip to version 1.11.1. + PHP don't use any ilibzip private symbol anymore. (Pierre, Remi) + . new method ZipArchive::setPassword($password). (Pierre) + . add --with-libzip option to build with system libzip. (Remi) <<< NOTE: Insert NEWS from last stable release here prior to actual release! >>> diff --git a/README.EXT_SKEL b/README.EXT_SKEL index b0db843a42ba0..d44fcc5c6a92c 100644 --- a/README.EXT_SKEL +++ b/README.EXT_SKEL @@ -31,6 +31,11 @@ HOW TO USE IT ./buildconf; ./configure --enable-module_name; make + The definition of PHP_MODULE_NAME_VERSION will be present in the + php_module_name.h and injected into the zend_module_entry definition. This + is required by the PECL website for the version string conformity checks + against package.xml + But if you already have planned the overall scheme of your module, what functions it will contain, their return types and the arguments they take (a very good idea) and don't want to bother yourself with creating function diff --git a/README.SELF-CONTAINED-EXTENSIONS b/README.SELF-CONTAINED-EXTENSIONS index e6a375331b4a5..5287230e1aea0 100644 --- a/README.SELF-CONTAINED-EXTENSIONS +++ b/README.SELF-CONTAINED-EXTENSIONS @@ -153,3 +153,18 @@ ADDING SHARED MODULE SUPPORT TO A MODULE #ifdef COMPILE_DL_FOO ZEND_GET_MODULE(foo) #endif + +PECL SITE CONFORMITY + + If you plan to release an extension to the PECL website, there are several + points to be regarded. + + 1. Add LICENSE or COPYING to the package.xml + + 2. The following should be defined in one of the extension header files + + #define PHP_FOO_VERSION "1.2.3" + + This macros has to be used within your foo_module_entry to indicate the + extension version. + diff --git a/README.md b/README.md index 51973854db86f..09e70e6a39f99 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ See https://wiki.php.net/rfc and https://wiki.php.net/rfc/voting for more information on the process. Bug fixes **do not** require an RFC, but require a bugtracker ticket. Always -open a ticket at http://bugs.php.net and reference the bug id using #NNNNNN. +open a ticket at https://bugs.php.net and reference the bug id using #NNNNNN. Fix #55371: get_magic_quotes_gpc() throws deprecation warning @@ -28,3 +28,12 @@ open a ticket at http://bugs.php.net and reference the bug id using #NNNNNN. We do not merge pull requests directly on github. All PRs will be pulled and pushed through http://git.php.net. + + +Guidelines for contributors +=========================== +- [CODING_STANDARDS](/CODING_STANDARDS) +- [README.GIT-RULES](/README.GIT-RULES) +- [README.MAILINGLIST_RULES](/README.MAILINGLIST_RULES) +- [README.RELEASE_PROCESS](/README.RELEASE_PROCESS) + diff --git a/TSRM/Makefile.am b/TSRM/Makefile.am index 91e585b65c89a..e232381a019e1 100644 --- a/TSRM/Makefile.am +++ b/TSRM/Makefile.am @@ -1,6 +1,6 @@ ## process this file with automake to produce Makefile.am AUTOMAKE_OPTIONS=foreign noinst_LTLIBRARIES=libtsrm.la -libtsrm_la_SOURCES = TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c +libtsrm_la_SOURCES = TSRM.c tsrm_strtok_r.c depend: diff --git a/TSRM/TSRM.dsp b/TSRM/TSRM.dsp index 1a5693f5a23c4..6c3e8bfb8bede 100644 --- a/TSRM/TSRM.dsp +++ b/TSRM/TSRM.dsp @@ -143,10 +143,6 @@ SOURCE=.\tsrm_strtok_r.c # End Source File # Begin Source File -SOURCE=.\tsrm_virtual_cwd.c -# End Source File -# Begin Source File - SOURCE=.\tsrm_win32.c # End Source File # End Group diff --git a/TSRM/config.w32 b/TSRM/config.w32 index 5498f8e7bd3ec..91b4eead2a07d 100644 --- a/TSRM/config.w32 +++ b/TSRM/config.w32 @@ -1,5 +1,5 @@ // vim:ft=javascript // $Id$ -ADD_SOURCES("TSRM", "TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c tsrm_win32.c"); +ADD_SOURCES("TSRM", "TSRM.c tsrm_strtok_r.c tsrm_win32.c"); diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c index 2ec97be0116bc..7b9ebc3061b34 100644 --- a/TSRM/tsrm_win32.c +++ b/TSRM/tsrm_win32.c @@ -32,7 +32,7 @@ #ifdef TSRM_WIN32 #include #include "tsrm_win32.h" -#include "tsrm_virtual_cwd.h" +#include "zend_virtual_cwd.h" #ifdef ZTS static ts_rsrc_id win32_globals_id; diff --git a/UPGRADING b/UPGRADING index 431ad79e999b9..022918cb14594 100755 --- a/UPGRADING +++ b/UPGRADING @@ -20,11 +20,32 @@ PHP X.Y UPGRADE NOTES 1. Backward Incompatible Changes ======================================== +- Core: + Removed $HTTP_RAW_POST_DATA global variable. Restore backwards compatibility + by: + ======================================== 2. New Features ======================================== +- Added dedicated syntax for variadic functions. + (https://wiki.php.net/rfc/variadics) + +- The php://input stream is now re-usable and can be used concurrently with + enable_post_data_reading=0. + +- Added gost-crypto (CryptoPro S-box) hash algo. + +- Added openssl certificate fingerprint support (inclusive stream context + option). + +- Added openssl crypto method stream context option. ======================================== 2. Changes in SAPI modules @@ -35,6 +56,9 @@ PHP X.Y UPGRADE NOTES 3. Deprecated Functionality ======================================== +- Incompatible context calls: + Instance calls from an incompatible context are now deprecated and issue + E_DEPRECATED instead of E_STRICT. See https://wiki.php.net/rfc/incompat_ctx ======================================== 4. Changed Functions @@ -44,10 +68,26 @@ PHP X.Y UPGRADE NOTES CURLOPT_SAFE_UPLOAD is now turned on by default and uploads with @file do not work unless it is explicitly set to false. +- Crypt: + crypt() will now raise an E_NOTICE error if the salt parameter is omitted. + See: https://wiki.php.net/rfc/crypt_function_salt + +- XMLReader: + XMLReader::getAttributeNs and XMLReader::getAttributeNo now return NULL if + the attribute could not be found, just like XMLReader::getAttribute. + ======================================== 5. New Functions ======================================== +- Openssl: + Added string openssl_x509_fingerprint($x509, $type, $binary). + +- LDAP: + Added ldap_escape($value, $ignore = "", $flags = 0). + +- Zip: + Added ZipArchive::setPassword($password) ======================================== 6. New Classes and Interfaces @@ -83,11 +123,16 @@ PHP X.Y UPGRADE NOTES 9. New Global Constants ======================================== +- LDAP: + LDAP_ESCAPE_FILTER int(1) + LDAP_ESCAPE_DN int(2) ======================================== 10. Changes to INI File Handling ======================================== +- Core: + Removed always_populate_raw_post_data. ======================================== 11. Other Changes @@ -95,3 +140,10 @@ PHP X.Y UPGRADE NOTES - File upload: Uploads equal or greater than 2GB in size are now accepted. + +- HTTP stream wrapper: + HTTP 1.1 requests now include a Connection: close header unless explicitly + overridden by setting a Connection header via the header context option. + +- Zip: + New --with-libzip option allow to use system libzip. Version > 0.11 required. diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 566f310998738..d1aca29dc4533 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -4,6 +4,9 @@ UPGRADE NOTES - PHP X.Y 1. Internal API changes a. Addition of do_operation and compare object handlers + b. return_value_ptr now always available, RETVAL_ZVAL_FAST macros + c. POST data handling + d. Arginfo changes 2. Build system changes a. Unix build system changes @@ -43,6 +46,70 @@ UPGRADE NOTES - PHP X.Y Further docs in the RFC: https://wiki.php.net/rfc/operator_overloading_gmp + b. return_value_ptr now always available, RETVAL_ZVAL_FAST macros + + The return_value_ptr argument to internal functions is now always set. + Previously it was only available for functions returning by-reference. + return_value_ptr can now be used to return zvals without copying them. + For this purpose two new macros are provided: + + RETVAL_ZVAL_FAST(zv); /* analog to RETVAL_ZVAL(zv, 1, 0) */ + RETURN_ZVAL_FAST(zv); /* analog to RETURN_ZVAL(zv, 1, 0) */ + + The macros behave similarly to the non-FAST variants with copy=1 and + dtor=0, but will try to return the zval without making a copy by utilizing + return_value_ptr. + + c. POST data handling + + The sapi_request_info's members post_data, post_data_len and raw_post_data as + well as raw_post_data_len have been replaced with a temp PHP stream + request_body. + + The recommended way to access raw POST data is to open and use a php://input + stream wrapper. It is safe to be used concurrently and more than once. + + d. Arginfo changes + + The pass_rest_by_reference argument of the ZEND_BEGIN_ARG_INFO and + ZEND_BEGIN_ARG_INFO_EX() is no longer used. The value passed to it is ignored. + + Instead a variadic argument is created using ZEND_ARG_VARIADIC_INFO(): + + ZEND_ARG_VARIADIC_INFO(0, name) /* pass rest by value */ + ZEND_ARG_VARIADIC_INFO(1, name) /* pass rest by reference */ + ZEND_ARG_VARIADIC_INFO(ZEND_SEND_PREFER_REF, name) + /* pass rest by prefer-ref */ + + ZEND_ARG_VARIADIC_INFO() should only be used for the last argument. + + The following changes were applied to the zend_arg_info struct: + + typedef struct _zend_arg_info { + const char *class_name; + zend_uint class_name_len; + zend_uchar type_hint; + + zend_uchar pass_by_reference; + zend_bool allow_null; + - zend_bool pass_by_reference; + + zend_bool is_variadic; + } zend_arg_info; + + The following changes were applied to the zend_internal_function_info struct: + + typedef struct _zend_internal_function_info { + zend_uint required_num_args; + zend_uchar _type_hint; + zend_bool return_reference; + - zend_bool pass_rest_by_reference; + + zend_bool _allow_null; + + zend_bool _is_variadic; + } zend_internal_function_info; + + The CHECK_ARG_SEND_TYPE(), ARG_MUST_BE_SENT_BY_REF(), + ARG_SHOULD_BE_SENT_BY_REF() and ARG_MAY_BE_SENT_BY_REF() macros now assume + that the argument passed to them is a zend_function* and that it is non-NULL. + ======================== 2. Build system changes ======================== diff --git a/Zend/Makefile.am b/Zend/Makefile.am index 6417f3eb141ed..924a00daebb39 100644 --- a/Zend/Makefile.am +++ b/Zend/Makefile.am @@ -18,7 +18,7 @@ libZend_la_SOURCES=\ zend_default_classes.c \ zend_iterators.c zend_interfaces.c zend_exceptions.c \ zend_strtod.c zend_closures.c zend_float.c zend_string.c zend_signal.c \ - zend_generators.c + zend_generators.c zend_virtual_cwd.c libZend_la_LDFLAGS = libZend_la_LIBADD = @ZEND_EXTRA_LIBS@ diff --git a/Zend/RFCs/003.txt b/Zend/RFCs/003.txt index 30fb4cec4912f..ac042183d426c 100644 --- a/Zend/RFCs/003.txt +++ b/Zend/RFCs/003.txt @@ -9,11 +9,11 @@ Modified: 2001-09-17 1. Background/Need ================== -Many internal function of PHP will reject parameters because of their +Many internal functions of PHP will reject parameters because of their type (the array and variable function come to mind). For userland this is not an easy task as there is no uniform way to do it. An addition to the engine for requiring loose types would allow -delevopers to know that the data passed to their functions is of the +developers to know that the data passed to their functions are of the correct type and reduce the need for duplicating the same code in every function to check for the type of data. @@ -57,7 +57,7 @@ function foo (array $var){ =========== Mis-matches in type should be reported as fatal errors and should halt -the execution of a script as that function can not be run and code +the execution of a script as that function cannot be run and code following could not reliably run. diff --git a/Zend/Zend.dsp b/Zend/Zend.dsp index 23ebd4532b5e7..d1b3b8903004d 100644 --- a/Zend/Zend.dsp +++ b/Zend/Zend.dsp @@ -429,6 +429,10 @@ SOURCE=.\zend_ts_hash.h SOURCE=.\zend_variables.h # End Source File +# Begin Source File + +SOURCE=.\zend_virtual_cwd.c +# End Source File # End Group # Begin Group "Parsers" diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4 index fe3ab63beb4c6..7fa8c99940596 100644 --- a/Zend/acinclude.m4 +++ b/Zend/acinclude.m4 @@ -9,7 +9,7 @@ AC_DEFUN([LIBZEND_BISON_CHECK],[ # non-working versions, e.g. "3.0 3.2"; # remove "none" when introducing the first incompatible bison version an # separate any following additions by spaces - bison_version_exclude="none" + bison_version_exclude="3.0" # for standalone build of Zend Engine test -z "$SED" && SED=sed diff --git a/Zend/tests/bug60598.phpt b/Zend/tests/bug60598.phpt new file mode 100644 index 0000000000000..eeee75a19d9ce --- /dev/null +++ b/Zend/tests/bug60598.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #60598 (cli/apache sapi segfault on objects manipulation) +--FILE-- +guid = 1; + $containers[spl_object_hash($this)] = $this; + } + public function __destruct() { + global $containers; + $containers[spl_object_hash($this)] = NULL; + } +} + +for ($i = 0; $i < OBJECT_COUNT; ++$i) { + new Object(); +} + +// You probably won't see this because of the "zend_mm_heap corrupted" +?> +If you see this, try to increase OBJECT_COUNT to 100,000 +--EXPECT-- +If you see this, try to increase OBJECT_COUNT to 100,000 diff --git a/Zend/tests/bug64896.phpt b/Zend/tests/bug64896.phpt new file mode 100644 index 0000000000000..3e955bbece7de --- /dev/null +++ b/Zend/tests/bug64896.phpt @@ -0,0 +1,47 @@ +--TEST-- +Bug #64896 (Segfault with gc_collect_cycles using unserialize on certain objects) +--XFAIL-- +We can not fix this bug without a significant (performace slow down) change to gc +--FILE-- +_private[] = 'php'; + } + + public function __destruct() + { + global $bar; + $bar = $this; + } +} + +$foo = new stdclass; +$foo->foo = $foo; +$foo->bad = new bad; + +gc_disable(); + +unserialize(serialize($foo)); +gc_collect_cycles(); +var_dump($bar); +/* will output: +object(bad)#4 (1) { + ["_private":"bad":private]=> + &UNKNOWN:0 +} +*/ +?> +--EXPECTF-- +bject(bad)#%d (1) { + ["_private":"bad":private]=> + array(1) { + [0]=> + string(3) "php" + } +} diff --git a/Zend/tests/bug64979.phpt b/Zend/tests/bug64979.phpt index 09de555546420..5bc8e5a6ab2a4 100644 --- a/Zend/tests/bug64979.phpt +++ b/Zend/tests/bug64979.phpt @@ -1,15 +1,13 @@ --TEST-- -Bug #64578 (Closures with static variables can be generators) ---XFAIL-- -Bug #64979 not fixed yet. +Bug #64979 (Wrong behavior of static variables in closure generators) --FILE-- diff --git a/Zend/tests/bug65322.phpt b/Zend/tests/bug65322.phpt new file mode 100644 index 0000000000000..aab163d915e11 --- /dev/null +++ b/Zend/tests/bug65322.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #65322: compile time errors won't trigger auto loading +--FILE-- + +--EXPECTF-- +string(50) "Redefining already defined constructor for class A" +string(%d) "%s(%d) : eval()'d code" +string(1) "B" diff --git a/Zend/tests/bug65579.phpt b/Zend/tests/bug65579.phpt new file mode 100644 index 0000000000000..25d74ed4f5ee4 --- /dev/null +++ b/Zend/tests/bug65579.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #65579 (Using traits with get_class_methods causes segfault) +--FILE-- + +--EXPECT-- +array(2) { + [0]=> + string(10) "testMethod" + [1]=> + string(25) "testmethodfromparenttrait" +} diff --git a/Zend/tests/bug65911.phpt b/Zend/tests/bug65911.phpt new file mode 100644 index 0000000000000..b9f37b7bd6a45 --- /dev/null +++ b/Zend/tests/bug65911.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #65911 (scope resolution operator - strange behavior with $this) +--FILE-- +foo = 'bar'; + echo A::$this->foo; // should not output 'bar' + } +} + +$obj = new B(); +$obj->go(); +?> +--EXPECTF-- +Fatal error: Access to undeclared static property: A::$this in %s on line %d diff --git a/Zend/tests/errmsg_045.phpt b/Zend/tests/errmsg_045.phpt new file mode 100644 index 0000000000000..b27f67ade4caa --- /dev/null +++ b/Zend/tests/errmsg_045.phpt @@ -0,0 +1,18 @@ +--TEST-- +Error message in error handler during compilation +--FILE-- + +--EXPECTF-- +string(50) "Redefining already defined constructor for class A" +string(%d) "%s(%d) : eval()'d code" + +Notice: Undefined variable: undefined in %s on line %d diff --git a/Zend/tests/incompat_ctx_user.phpt b/Zend/tests/incompat_ctx_user.phpt new file mode 100644 index 0000000000000..2d9b59c1e8030 --- /dev/null +++ b/Zend/tests/incompat_ctx_user.phpt @@ -0,0 +1,20 @@ +--TEST-- +Incompatible context call (non-internal function) +--INI-- +error_reporting=E_ALL +--FILE-- +bar(); + +?> +--EXPECTF-- +Deprecated: Non-static method A::foo() should not be called statically, assuming $this from incompatible context in %s on line %d +string(1) "B" diff --git a/Zend/tests/variadic/adding_additional_optional_parameter.phpt b/Zend/tests/variadic/adding_additional_optional_parameter.phpt new file mode 100644 index 0000000000000..b4e797803dcf2 --- /dev/null +++ b/Zend/tests/variadic/adding_additional_optional_parameter.phpt @@ -0,0 +1,17 @@ +--TEST-- +It's possible to add additional optional arguments with matching signature +--FILE-- + +===DONE=== +--EXPECT-- +===DONE=== diff --git a/Zend/tests/variadic/adding_additional_optional_parameter_error.phpt b/Zend/tests/variadic/adding_additional_optional_parameter_error.phpt new file mode 100644 index 0000000000000..2f31d47dc6969 --- /dev/null +++ b/Zend/tests/variadic/adding_additional_optional_parameter_error.phpt @@ -0,0 +1,16 @@ +--TEST-- +Additional optional parameters must have a matching prototype +--FILE-- + +--EXPECTF-- +Fatal error: Declaration of MySQL::query() must be compatible with DB::query($query, string ...$params) in %s on line %d diff --git a/Zend/tests/variadic/basic.phpt b/Zend/tests/variadic/basic.phpt new file mode 100644 index 0000000000000..810d4756aa087 --- /dev/null +++ b/Zend/tests/variadic/basic.phpt @@ -0,0 +1,57 @@ +--TEST-- +Basic variadic function +--FILE-- + +--EXPECT-- +array(0) { +} +array(1) { + [0]=> + int(1) +} +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +int(1) +int(2) +array(0) { +} +int(1) +int(2) +array(1) { + [0]=> + int(3) +} +int(1) +int(2) +array(3) { + [0]=> + int(3) + [1]=> + int(4) + [2]=> + int(5) +} diff --git a/Zend/tests/variadic/by_ref.phpt b/Zend/tests/variadic/by_ref.phpt new file mode 100644 index 0000000000000..e1635f4ecf20a --- /dev/null +++ b/Zend/tests/variadic/by_ref.phpt @@ -0,0 +1,24 @@ +--TEST-- +Variadic arguments with by-reference passing +--FILE-- + +--EXPECT-- +int(0) +int(0) +int(1) +int(2) diff --git a/Zend/tests/variadic/by_ref_error.phpt b/Zend/tests/variadic/by_ref_error.phpt new file mode 100644 index 0000000000000..7f21014146406 --- /dev/null +++ b/Zend/tests/variadic/by_ref_error.phpt @@ -0,0 +1,12 @@ +--TEST-- +By-ref variadics enforce the reference +--FILE-- + +--EXPECTF-- +Fatal error: Only variables can be passed by reference in %s on line %d diff --git a/Zend/tests/variadic/no_default_error.phpt b/Zend/tests/variadic/no_default_error.phpt new file mode 100644 index 0000000000000..427ebed0289a9 --- /dev/null +++ b/Zend/tests/variadic/no_default_error.phpt @@ -0,0 +1,10 @@ +--TEST-- +Variadic argument cannot have a default value +--FILE-- + +--EXPECTF-- +Fatal error: Variadic parameter cannot have a default value in %s on line %d diff --git a/Zend/tests/variadic/non_variadic_implements_variadic_error.phpt b/Zend/tests/variadic/non_variadic_implements_variadic_error.phpt new file mode 100644 index 0000000000000..f447837ca4afb --- /dev/null +++ b/Zend/tests/variadic/non_variadic_implements_variadic_error.phpt @@ -0,0 +1,16 @@ +--TEST-- +It's not possible to turn a variadic function into a non-variadic one +--FILE-- + +--EXPECTF-- +Fatal error: Declaration of MySQL::query() must be compatible with DB::query($query, ...$params) in %s on line %d diff --git a/Zend/tests/variadic/only_last_error.phpt b/Zend/tests/variadic/only_last_error.phpt new file mode 100644 index 0000000000000..ee6ff3f777c46 --- /dev/null +++ b/Zend/tests/variadic/only_last_error.phpt @@ -0,0 +1,10 @@ +--TEST-- +Only the last argument can be variadic +--FILE-- + +--EXPECTF-- +Fatal error: Only the last parameter can be variadic in %s on line %d diff --git a/Zend/tests/variadic/optional_params.phpt b/Zend/tests/variadic/optional_params.phpt new file mode 100644 index 0000000000000..ba965e538c4f9 --- /dev/null +++ b/Zend/tests/variadic/optional_params.phpt @@ -0,0 +1,49 @@ +--TEST-- +Optional parameter before variadic parameter +--FILE-- + +--EXPECT-- +int(1) +NULL +array(0) { +} +int(1) +int(2) +array(0) { +} +int(1) +int(2) +array(1) { + [0]=> + int(3) +} +int(1) +int(2) +array(2) { + [0]=> + int(3) + [1]=> + int(4) +} +int(1) +int(2) +array(3) { + [0]=> + int(3) + [1]=> + int(4) + [2]=> + int(5) +} diff --git a/Zend/tests/variadic/removing_parameter_error.phpt b/Zend/tests/variadic/removing_parameter_error.phpt new file mode 100644 index 0000000000000..a189e5cf094b7 --- /dev/null +++ b/Zend/tests/variadic/removing_parameter_error.phpt @@ -0,0 +1,20 @@ +--TEST-- +It's not possible to remove required parameter before a variadic parameter +--FILE-- + +--EXPECTF-- +Fatal error: Declaration of MySQL::query() must be compatible with DB::query($query, ...$params) in %s on line %d diff --git a/Zend/tests/variadic/typehint_error.phpt b/Zend/tests/variadic/typehint_error.phpt new file mode 100644 index 0000000000000..3006b999576c6 --- /dev/null +++ b/Zend/tests/variadic/typehint_error.phpt @@ -0,0 +1,36 @@ +--TEST-- +Variadic arguments enforce typehints +--FILE-- + +--EXPECTF-- +array(0) { +} +array(3) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [0]=> + int(1) + } + [2]=> + array(1) { + [0]=> + int(2) + } +} + +Catchable fatal error: Argument 3 passed to test() must be of the type array, integer given, called in %s on line %d diff --git a/Zend/tests/variadic/typehint_suppressed_error.phpt b/Zend/tests/variadic/typehint_suppressed_error.phpt new file mode 100644 index 0000000000000..5048e1c1bb5ab --- /dev/null +++ b/Zend/tests/variadic/typehint_suppressed_error.phpt @@ -0,0 +1,33 @@ +--TEST-- +Error suppression for typehints on variadic arguments works +--FILE-- + +--EXPECTF-- +string(%d) "Argument 3 passed to test() must be of the type array, integer given, called in %s on line %d and defined" +array(3) { + [0]=> + array(1) { + [0]=> + int(0) + } + [1]=> + array(1) { + [0]=> + int(1) + } + [2]=> + int(2) +} diff --git a/Zend/tests/variadic/variadic_changed_byref_error.phpt b/Zend/tests/variadic/variadic_changed_byref_error.phpt new file mode 100644 index 0000000000000..14fb6ae5eb0d9 --- /dev/null +++ b/Zend/tests/variadic/variadic_changed_byref_error.phpt @@ -0,0 +1,16 @@ +--TEST-- +Variadic arguments must have compatible passing modes +--FILE-- + +--EXPECTF-- +Fatal error: Declaration of MySQL::query() must be compatible with DB::query($query, &...$params) in %s on line %d diff --git a/Zend/tests/variadic/variadic_changed_typehint_error.phpt b/Zend/tests/variadic/variadic_changed_typehint_error.phpt new file mode 100644 index 0000000000000..00df33a0424a4 --- /dev/null +++ b/Zend/tests/variadic/variadic_changed_typehint_error.phpt @@ -0,0 +1,16 @@ +--TEST-- +Typehints for variadic arguments have to be compatible +--FILE-- + +--EXPECTF-- +Fatal error: Declaration of MySQL::query() must be compatible with DB::query($query, string ...$params) in %s on line %d diff --git a/Zend/tests/variadic/variadic_implements_non_variadic.phpt b/Zend/tests/variadic/variadic_implements_non_variadic.phpt new file mode 100644 index 0000000000000..a66ec280b8626 --- /dev/null +++ b/Zend/tests/variadic/variadic_implements_non_variadic.phpt @@ -0,0 +1,17 @@ +--TEST-- +A non-variadic function can be turned into a variadic one +--FILE-- + +===DONE=== +--EXPECT-- +===DONE=== diff --git a/Zend/zend.c b/Zend/zend.c index f9069c8e1b515..a5ed953cd0de0 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -30,6 +30,7 @@ #include "zend_ini.h" #include "zend_vm.h" #include "zend_dtrace.h" +#include "zend_virtual_cwd.h" #ifdef ZTS # define GLOBAL_FUNCTION_TABLE global_function_table @@ -652,6 +653,8 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions TS start_memory_manager(TSRMLS_C); + virtual_cwd_startup(); /* Could use shutdown to free the main cwd but it would just slow it down for CGI */ + #if defined(__FreeBSD__) || defined(__DragonFly__) /* FreeBSD and DragonFly floating point precision fix */ fpsetmask(0); @@ -802,9 +805,14 @@ void zend_post_startup(TSRMLS_D) /* {{{ */ compiler_globals_ctor(compiler_globals, tsrm_ls); } free(EG(zend_constants)); + + virtual_cwd_deactivate(TSRMLS_C); + executor_globals_ctor(executor_globals, tsrm_ls); global_persistent_list = &EG(persistent_list); zend_copy_ini_directives(TSRMLS_C); +#else + virtual_cwd_deactivate(TSRMLS_C); #endif } /* }}} */ @@ -820,6 +828,9 @@ void zend_shutdown(TSRMLS_D) /* {{{ */ zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC); zend_destroy_modules(); + virtual_cwd_deactivate(TSRMLS_C); + virtual_cwd_shutdown(); + zend_hash_destroy(GLOBAL_FUNCTION_TABLE); zend_hash_destroy(GLOBAL_CLASS_TABLE); @@ -910,6 +921,9 @@ ZEND_API char *get_zend_version(void) /* {{{ */ void zend_activate(TSRMLS_D) /* {{{ */ { +#ifdef ZTS + virtual_cwd_activate(TSRMLS_C); +#endif gc_reset(TSRMLS_C); init_compiler(TSRMLS_C); init_executor(TSRMLS_C); @@ -1184,7 +1198,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */ * such scripts recursivly, but some CG() variables may be * inconsistent. */ - in_compilation = zend_is_compiling(TSRMLS_C); + in_compilation = CG(in_compilation); if (in_compilation) { saved_class_entry = CG(active_class_entry); CG(active_class_entry) = NULL; @@ -1196,6 +1210,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */ SAVE_STACK(declare_stack); SAVE_STACK(list_stack); SAVE_STACK(context_stack); + CG(in_compilation) = 0; } if (call_user_function_ex(CG(function_table), NULL, orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC) == SUCCESS) { @@ -1220,6 +1235,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */ RESTORE_STACK(declare_stack); RESTORE_STACK(list_stack); RESTORE_STACK(context_stack); + CG(in_compilation) = 1; } if (!EG(user_error_handler)) { diff --git a/Zend/zend.h b/Zend/zend.h index 1377fd566594b..5ac884455d4d0 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -193,7 +193,7 @@ char *alloca (); #endif #define restrict __restrict__ -#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(ZEND_WIN32)) && !(defined(ZTS) && defined(NETWARE)) && !(defined(ZTS) && defined(HPUX)) && !defined(DARWIN) +#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(NETWARE)) && !(defined(ZTS) && defined(HPUX)) && !defined(DARWIN) # define ZEND_ALLOCA_MAX_SIZE (32 * 1024) # define ALLOCA_FLAG(name) \ zend_bool name; @@ -670,8 +670,8 @@ END_EXTERN_C() /* FIXME: Check if we can save if (ptr) too */ -#define STR_FREE(ptr) if (ptr && !IS_INTERNED(ptr)) { efree(ptr); } -#define STR_FREE_REL(ptr) if (ptr && !IS_INTERNED(ptr)) { efree_rel(ptr); } +#define STR_FREE(ptr) if (ptr) { str_efree(ptr); } +#define STR_FREE_REL(ptr) if (ptr) { str_efree_rel(ptr); } #define STR_EMPTY_ALLOC() estrndup("", sizeof("")-1) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 23ad158b17d44..5fa7fb908e500 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2029,7 +2029,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio const zend_function_entry *ptr = functions; zend_function function, *reg_function; zend_internal_function *internal_function = (zend_internal_function *)&function; - int count=0, unload=0, result=0; + int count=0, unload=0; HashTable *target_function_table = function_table; int error_type; zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__unset = NULL, *__isset = NULL, *__call = NULL, *__callstatic = NULL, *__tostring = NULL; @@ -2037,6 +2037,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio int fname_len; const char *lc_class_name = NULL; int class_name_len = 0; + zend_ulong hash; if (type==MODULE_PERSISTENT) { error_type = E_CORE_WARNING; @@ -2089,16 +2090,12 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio } else { internal_function->required_num_args = info->required_num_args; } - if (info->pass_rest_by_reference) { - if (info->pass_rest_by_reference == ZEND_SEND_PREFER_REF) { - internal_function->fn_flags |= ZEND_ACC_PASS_REST_PREFER_REF; - } else { - internal_function->fn_flags |= ZEND_ACC_PASS_REST_BY_REFERENCE; - } - } if (info->return_reference) { internal_function->fn_flags |= ZEND_ACC_RETURN_REFERENCE; } + if (ptr->arg_info[ptr->num_args].is_variadic) { + internal_function->fn_flags |= ZEND_ACC_VARIADIC; + } } else { internal_function->arg_info = NULL; internal_function->num_args = 0; @@ -2135,12 +2132,8 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio } fname_len = strlen(ptr->fname); lowercase_name = zend_new_interned_string(zend_str_tolower_dup(ptr->fname, fname_len), fname_len + 1, 1 TSRMLS_CC); - if (IS_INTERNED(lowercase_name)) { - result = zend_hash_quick_add(target_function_table, lowercase_name, fname_len+1, INTERNED_HASH(lowercase_name), &function, sizeof(zend_function), (void**)®_function); - } else { - result = zend_hash_add(target_function_table, lowercase_name, fname_len+1, &function, sizeof(zend_function), (void**)®_function); - } - if (result == FAILURE) { + hash = str_hash(lowercase_name, fname_len); + if (zend_hash_quick_add(target_function_table, lowercase_name, fname_len+1, hash, &function, sizeof(zend_function), (void**)®_function) == FAILURE) { unload=1; str_efree(lowercase_name); break; @@ -2493,6 +2486,7 @@ static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class { zend_class_entry *class_entry = malloc(sizeof(zend_class_entry)); char *lowercase_name = emalloc(orig_class_entry->name_length + 1); + zend_ulong hash; *class_entry = *orig_class_entry; class_entry->type = ZEND_INTERNAL_CLASS; @@ -2506,11 +2500,8 @@ static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class zend_str_tolower_copy(lowercase_name, orig_class_entry->name, class_entry->name_length); lowercase_name = (char*)zend_new_interned_string(lowercase_name, class_entry->name_length + 1, 1 TSRMLS_CC); - if (IS_INTERNED(lowercase_name)) { - zend_hash_quick_update(CG(class_table), lowercase_name, class_entry->name_length+1, INTERNED_HASH(lowercase_name), &class_entry, sizeof(zend_class_entry *), NULL); - } else { - zend_hash_update(CG(class_table), lowercase_name, class_entry->name_length+1, &class_entry, sizeof(zend_class_entry *), NULL); - } + hash = str_hash(lowercase_name, class_entry->name_length); + zend_hash_quick_update(CG(class_table), lowercase_name, class_entry->name_length+1, hash, &class_entry, sizeof(zend_class_entry *), NULL); str_efree(lowercase_name); return class_entry; } @@ -2577,7 +2568,12 @@ ZEND_API int zend_register_class_alias_ex(const char *name, int name_len, zend_c char *lcname = zend_str_tolower_dup(name, name_len); int ret; - ret = zend_hash_add(CG(class_table), lcname, name_len+1, &ce, sizeof(zend_class_entry *), NULL); + if (lcname[0] == '\\') { + ret = zend_hash_add(CG(class_table), lcname+1, name_len, &ce, sizeof(zend_class_entry *), NULL); + } else { + ret = zend_hash_add(CG(class_table), lcname, name_len+1, &ce, sizeof(zend_class_entry *), NULL); + } + efree(lcname); if (ret == SUCCESS) { ce->refcount++; @@ -3980,15 +3976,16 @@ ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name { zend_trait_alias *alias, **alias_ptr; - alias_ptr = ce->trait_aliases; - alias = *alias_ptr; - while (alias) { - if (alias->alias_len == len && - !strncasecmp(name, alias->alias, alias->alias_len)) { - return alias->alias; - } - alias_ptr++; + if ((alias_ptr = ce->trait_aliases)) { alias = *alias_ptr; + while (alias) { + if (alias->alias_len == len && + !strncasecmp(name, alias->alias, alias->alias_len)) { + return alias->alias; + } + alias_ptr++; + alias = *alias_ptr; + } } return name; diff --git a/Zend/zend_API.h b/Zend/zend_API.h index ecc8d9acd9f43..007d9896092be 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -98,16 +98,18 @@ typedef struct _zend_fcall_info_cache { #define ZEND_FE_END { NULL, NULL, NULL, 0, 0 } -#define ZEND_ARG_INFO(pass_by_ref, name) { #name, sizeof(#name)-1, NULL, 0, 0, 0, pass_by_ref}, -#define ZEND_ARG_PASS_INFO(pass_by_ref) { NULL, 0, NULL, 0, 0, 0, pass_by_ref}, -#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) { #name, sizeof(#name)-1, #classname, sizeof(#classname)-1, IS_OBJECT, allow_null, pass_by_ref}, -#define ZEND_ARG_ARRAY_INFO(pass_by_ref, name, allow_null) { #name, sizeof(#name)-1, NULL, 0, IS_ARRAY, allow_null, pass_by_ref}, -#define ZEND_ARG_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) { #name, sizeof(#name)-1, NULL, 0, type_hint, allow_null, pass_by_ref}, -#define ZEND_BEGIN_ARG_INFO_EX(name, pass_rest_by_reference, return_reference, required_num_args) \ +#define ZEND_ARG_INFO(pass_by_ref, name) { #name, sizeof(#name)-1, NULL, 0, 0, pass_by_ref, 0, 0 }, +#define ZEND_ARG_PASS_INFO(pass_by_ref) { NULL, 0, NULL, 0, 0, pass_by_ref, 0, 0 }, +#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) { #name, sizeof(#name)-1, #classname, sizeof(#classname)-1, IS_OBJECT, pass_by_ref, allow_null, 0 }, +#define ZEND_ARG_ARRAY_INFO(pass_by_ref, name, allow_null) { #name, sizeof(#name)-1, NULL, 0, IS_ARRAY, pass_by_ref, allow_null, 0 }, +#define ZEND_ARG_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) { #name, sizeof(#name)-1, NULL, 0, type_hint, pass_by_ref, allow_null, 0 }, +#define ZEND_ARG_VARIADIC_INFO(pass_by_ref, name) { #name, sizeof(#name)-1, NULL, 0, 0, pass_by_ref, 0, 1 }, + +#define ZEND_BEGIN_ARG_INFO_EX(name, _unused, return_reference, required_num_args) \ static const zend_arg_info name[] = { \ - { NULL, 0, NULL, required_num_args, 0, return_reference, pass_rest_by_reference}, -#define ZEND_BEGIN_ARG_INFO(name, pass_rest_by_reference) \ - ZEND_BEGIN_ARG_INFO_EX(name, pass_rest_by_reference, ZEND_RETURN_VALUE, -1) + { NULL, 0, NULL, required_num_args, 0, return_reference, 0, 0 }, +#define ZEND_BEGIN_ARG_INFO(name, _unused) \ + ZEND_BEGIN_ARG_INFO_EX(name, 0, ZEND_RETURN_VALUE, -1) #define ZEND_END_ARG_INFO() }; /* Name macros */ @@ -594,22 +596,20 @@ END_EXTERN_C() Z_TYPE_P(__z) = IS_STRING; \ } while (0) -#define ZVAL_ZVAL(z, zv, copy, dtor) { \ - zend_uchar is_ref = Z_ISREF_P(z); \ - zend_uint refcount = Z_REFCOUNT_P(z); \ - ZVAL_COPY_VALUE(z, zv); \ +#define ZVAL_ZVAL(z, zv, copy, dtor) do { \ + zval *__z = (z); \ + zval *__zv = (zv); \ + ZVAL_COPY_VALUE(__z, __zv); \ if (copy) { \ - zval_copy_ctor(z); \ + zval_copy_ctor(__z); \ } \ if (dtor) { \ if (!copy) { \ - ZVAL_NULL(zv); \ + ZVAL_NULL(__zv); \ } \ - zval_ptr_dtor(&zv); \ + zval_ptr_dtor(&__zv); \ } \ - Z_SET_ISREF_TO_P(z, is_ref); \ - Z_SET_REFCOUNT_P(z, refcount); \ - } + } while (0) #define ZVAL_FALSE(z) ZVAL_BOOL(z, 0) #define ZVAL_TRUE(z) ZVAL_BOOL(z, 1) @@ -638,6 +638,18 @@ END_EXTERN_C() #define RETURN_FALSE { RETVAL_FALSE; return; } #define RETURN_TRUE { RETVAL_TRUE; return; } +#define RETVAL_ZVAL_FAST(z) do { \ + zval *_z = (z); \ + if (Z_ISREF_P(_z)) { \ + RETVAL_ZVAL(_z, 1, 0); \ + } else { \ + zval_ptr_dtor(&return_value); \ + Z_ADDREF_P(_z); \ + *return_value_ptr = _z; \ + } \ +} while (0) +#define RETURN_ZVAL_FAST(z) { RETVAL_ZVAL_FAST(z); return; } + #define SET_VAR_STRING(n, v) { \ { \ zval *var; \ diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 44a480f2a12f4..55e5f34e83aab 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -435,9 +435,7 @@ ZEND_FUNCTION(func_get_arg) } arg = *(p-(arg_count-requested_offset)); - *return_value = *arg; - zval_copy_ctor(return_value); - INIT_PZVAL(return_value); + RETURN_ZVAL_FAST(arg); } /* }}} */ @@ -461,12 +459,17 @@ ZEND_FUNCTION(func_get_args) array_init_size(return_value, arg_count); for (i=0; ivalue.ht, &element, sizeof(zval *), NULL); } } @@ -706,7 +709,7 @@ ZEND_FUNCTION(define) zval_ptr_dtor(&val_free); } c.flags = case_sensitive; /* non persistent */ - c.name = IS_INTERNED(name) ? name : zend_strndup(name, name_len); + c.name = str_strndup(name, name_len); if(c.name == NULL) { RETURN_FALSE; } @@ -1388,26 +1391,18 @@ ZEND_FUNCTION(function_exists) Creates an alias for user defined class */ ZEND_FUNCTION(class_alias) { - char *class_name, *lc_name, *alias_name; + char *class_name, *alias_name; zend_class_entry **ce; int class_name_len, alias_name_len; int found; zend_bool autoload = 1; - ALLOCA_FLAG(use_heap) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|b", &class_name, &class_name_len, &alias_name, &alias_name_len, &autoload) == FAILURE) { return; } - if (!autoload) { - lc_name = do_alloca(class_name_len + 1, use_heap); - zend_str_tolower_copy(lc_name, class_name, class_name_len); + found = zend_lookup_class_ex(class_name, class_name_len, NULL, autoload, &ce TSRMLS_CC); - found = zend_hash_find(EG(class_table), lc_name, class_name_len+1, (void **) &ce); - free_alloca(lc_name, use_heap); - } else { - found = zend_lookup_class(class_name, class_name_len, &ce TSRMLS_CC); - } if (found == SUCCESS) { if ((*ce)->type == ZEND_USER_CLASS) { if (zend_register_class_alias_ex(alias_name, alias_name_len, *ce TSRMLS_CC) == SUCCESS) { diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 5faefbd2241a4..fcad86f171058 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -59,14 +59,8 @@ ZEND_METHOD(Closure, __invoke) /* {{{ */ } else if (call_user_function_ex(CG(function_table), NULL, this_ptr, &closure_result_ptr, ZEND_NUM_ARGS(), arguments, 1, NULL TSRMLS_CC) == FAILURE) { RETVAL_FALSE; } else if (closure_result_ptr) { - if (Z_ISREF_P(closure_result_ptr) && return_value_ptr) { - if (return_value) { - zval_ptr_dtor(&return_value); - } - *return_value_ptr = closure_result_ptr; - } else { - RETVAL_ZVAL(closure_result_ptr, 1, 1); - } + zval_ptr_dtor(&return_value); + *return_value_ptr = closure_result_ptr; } efree(arguments); diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 14a28f392be99..44e95adf86cf2 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -26,7 +26,7 @@ #include "zend_llist.h" #include "zend_API.h" #include "zend_exceptions.h" -#include "tsrm_virtual_cwd.h" +#include "zend_virtual_cwd.h" #include "zend_multibyte.h" #include "zend_language_scanner.h" @@ -61,11 +61,8 @@ } while (0) #define CALCULATE_LITERAL_HASH(num) do { \ - if (IS_INTERNED(Z_STRVAL(CONSTANT(num)))) { \ - Z_HASH_P(&CONSTANT(num)) = INTERNED_HASH(Z_STRVAL(CONSTANT(num))); \ - } else { \ - Z_HASH_P(&CONSTANT(num)) = zend_hash_func(Z_STRVAL(CONSTANT(num)), Z_STRLEN(CONSTANT(num))+1); \ - } \ + zval *c = &CONSTANT(num); \ + Z_HASH_P(c) = str_hash(Z_STRVAL_P(c), Z_STRLEN_P(c)); \ } while (0) #define GET_CACHE_SLOT(literal) do { \ @@ -107,9 +104,7 @@ ZEND_API zend_executor_globals executor_globals; static void zend_duplicate_property_info(zend_property_info *property_info) /* {{{ */ { - if (!IS_INTERNED(property_info->name)) { - property_info->name = estrndup(property_info->name, property_info->name_length); - } + property_info->name = str_estrndup(property_info->name, property_info->name_length); if (property_info->doc_comment) { property_info->doc_comment = estrndup(property_info->doc_comment, property_info->doc_comment_len); } @@ -118,9 +113,7 @@ static void zend_duplicate_property_info(zend_property_info *property_info) /* { static void zend_duplicate_property_info_internal(zend_property_info *property_info) /* {{{ */ { - if (!IS_INTERNED(property_info->name)) { - property_info->name = zend_strndup(property_info->name, property_info->name_length); - } + property_info->name = str_strndup(property_info->name, property_info->name_length); } /* }}} */ @@ -153,12 +146,12 @@ static void build_runtime_defined_function_key(zval *result, const char *name, i } /* NULL, name length, filename length, last accepting char position length */ - result->value.str.len = 1+name_length+strlen(filename)+char_pos_len; + Z_STRLEN_P(result) = 1+name_length+strlen(filename)+char_pos_len; /* must be binary safe */ - result->value.str.val = (char *) safe_emalloc(result->value.str.len, 1, 1); - result->value.str.val[0] = '\0'; - sprintf(result->value.str.val+1, "%s%s%s", name, filename, char_pos_buf); + Z_STRVAL_P(result) = (char *) safe_emalloc(Z_STRLEN_P(result), 1, 1); + Z_STRVAL_P(result)[0] = '\0'; + sprintf(Z_STRVAL_P(result)+1, "%s%s%s", name, filename, char_pos_buf); result->type = IS_STRING; Z_SET_REFCOUNT_P(result, 1); @@ -665,21 +658,21 @@ void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar zend_llist *fetch_list_ptr; if (varname->op_type == IS_CONST) { - ulong hash = 0; + ulong hash; if (Z_TYPE(varname->u.constant) != IS_STRING) { convert_to_string(&varname->u.constant); - } else if (IS_INTERNED(Z_STRVAL(varname->u.constant))) { - hash = INTERNED_HASH(Z_STRVAL(varname->u.constant)); } - if (!zend_is_auto_global_quick(varname->u.constant.value.str.val, varname->u.constant.value.str.len, hash TSRMLS_CC) && - !(varname->u.constant.value.str.len == (sizeof("this")-1) && - !memcmp(varname->u.constant.value.str.val, "this", sizeof("this"))) && + + hash = str_hash(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant)); + if (!zend_is_auto_global_quick(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant), hash TSRMLS_CC) && + !(Z_STRLEN(varname->u.constant) == (sizeof("this")-1) && + !memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this"))) && (CG(active_op_array)->last == 0 || CG(active_op_array)->opcodes[CG(active_op_array)->last-1].opcode != ZEND_BEGIN_SILENCE)) { result->op_type = IS_CV; - result->u.op.var = lookup_cv(CG(active_op_array), varname->u.constant.value.str.val, varname->u.constant.value.str.len, hash TSRMLS_CC); - varname->u.constant.value.str.val = (char*)CG(active_op_array)->vars[result->u.op.var].name; + result->u.op.var = lookup_cv(CG(active_op_array), Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant), hash TSRMLS_CC); + Z_STRVAL(varname->u.constant) = (char*)CG(active_op_array)->vars[result->u.op.var].name; result->EA = 0; return; } @@ -702,7 +695,7 @@ void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar if (varname->op_type == IS_CONST) { CALCULATE_LITERAL_HASH(opline_ptr->op1.constant); - if (zend_is_auto_global_quick(varname->u.constant.value.str.val, varname->u.constant.value.str.len, Z_HASH_P(&CONSTANT(opline_ptr->op1.constant)) TSRMLS_CC)) { + if (zend_is_auto_global_quick(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant), Z_HASH_P(&CONSTANT(opline_ptr->op1.constant)) TSRMLS_CC)) { opline_ptr->extended_value = ZEND_FETCH_GLOBAL; } } @@ -731,7 +724,7 @@ void zend_do_fetch_static_member(znode *result, znode *class_name TSRMLS_DC) /* if (class_name->op_type == IS_CONST && ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) { - zend_resolve_class_name(class_name, ZEND_FETCH_CLASS_GLOBAL, 1 TSRMLS_CC); + zend_resolve_class_name(class_name TSRMLS_CC); class_node = *class_name; } else { zend_do_fetch_class(&class_node, class_name TSRMLS_CC); @@ -890,9 +883,9 @@ void zend_do_abstract_method(const znode *function_name, znode *modifiers, const method_type = "Abstract"; } - if (modifiers->u.constant.value.lval & ZEND_ACC_ABSTRACT) { - if(modifiers->u.constant.value.lval & ZEND_ACC_PRIVATE) { - zend_error(E_COMPILE_ERROR, "%s function %s::%s() cannot be declared private", method_type, CG(active_class_entry)->name, function_name->u.constant.value.str.val); + if (Z_LVAL(modifiers->u.constant) & ZEND_ACC_ABSTRACT) { + if(Z_LVAL(modifiers->u.constant) & ZEND_ACC_PRIVATE) { + zend_error_noreturn(E_COMPILE_ERROR, "%s function %s::%s() cannot be declared private", method_type, CG(active_class_entry)->name, Z_STRVAL(function_name->u.constant)); } if (Z_LVAL(body->u.constant) == ZEND_ACC_ABSTRACT) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -902,11 +895,11 @@ void zend_do_abstract_method(const znode *function_name, znode *modifiers, const SET_UNUSED(opline->op2); } else { /* we had code in the function body */ - zend_error(E_COMPILE_ERROR, "%s function %s::%s() cannot contain body", method_type, CG(active_class_entry)->name, function_name->u.constant.value.str.val); + zend_error_noreturn(E_COMPILE_ERROR, "%s function %s::%s() cannot contain body", method_type, CG(active_class_entry)->name, Z_STRVAL(function_name->u.constant)); } } else { - if (body->u.constant.value.lval == ZEND_ACC_ABSTRACT) { - zend_error(E_COMPILE_ERROR, "Non-abstract method %s::%s() must contain body", CG(active_class_entry)->name, function_name->u.constant.value.str.val); + if (Z_LVAL(body->u.constant) == ZEND_ACC_ABSTRACT) { + zend_error_noreturn(E_COMPILE_ERROR, "Non-abstract method %s::%s() must contain body", CG(active_class_entry)->name, Z_STRVAL(function_name->u.constant)); } } } @@ -916,6 +909,7 @@ static zend_bool opline_is_fetch_this(const zend_op *opline TSRMLS_DC) /* {{{ */ { if ((opline->opcode == ZEND_FETCH_W) && (opline->op1_type == IS_CONST) && (Z_TYPE(CONSTANT(opline->op1.constant)) == IS_STRING) + && ((opline->extended_value & ZEND_FETCH_STATIC_MEMBER) != ZEND_FETCH_STATIC_MEMBER) && (Z_HASH_P(&CONSTANT(opline->op1.constant)) == THIS_HASHVAL) && (Z_STRLEN(CONSTANT(opline->op1.constant)) == (sizeof("this")-1)) && !memcmp(Z_STRVAL(CONSTANT(opline->op1.constant)), "this", sizeof("this"))) { @@ -965,7 +959,7 @@ void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC) /* { if (variable->op_type == IS_CV) { if (variable->u.op.var == CG(active_op_array)->this_var) { - zend_error(E_COMPILE_ERROR, "Cannot re-assign $this"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this"); } } else if (variable->op_type == IS_VAR) { int n = 0; @@ -1011,7 +1005,7 @@ void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC) /* { GET_NODE(result, last_op->result); return; } else if (opline_is_fetch_this(last_op TSRMLS_CC)) { - zend_error(E_COMPILE_ERROR, "Cannot re-assign $this"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this"); } else { break; } @@ -1035,7 +1029,7 @@ void zend_do_assign_ref(znode *result, const znode *lvar, const znode *rvar TSRM if (lvar->op_type == IS_CV) { if (lvar->u.op.var == CG(active_op_array)->this_var) { - zend_error(E_COMPILE_ERROR, "Cannot re-assign $this"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this"); } } else if (lvar->op_type == IS_VAR) { int last_op_number = get_next_op_number(CG(active_op_array)); @@ -1043,7 +1037,7 @@ void zend_do_assign_ref(znode *result, const znode *lvar, const znode *rvar TSRM if (last_op_number > 0) { opline = &CG(active_op_array)->opcodes[last_op_number-1]; if (opline_is_fetch_this(opline TSRMLS_CC)) { - zend_error(E_COMPILE_ERROR, "Cannot re-assign $this"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this"); } } } @@ -1285,10 +1279,10 @@ void zend_check_writable_variable(const znode *variable) /* {{{ */ zend_uint type = variable->EA; if (type & ZEND_PARSED_METHOD_CALL) { - zend_error(E_COMPILE_ERROR, "Can't use method return value in write context"); + zend_error_noreturn(E_COMPILE_ERROR, "Can't use method return value in write context"); } if (type == ZEND_PARSED_FUNCTION_CALL) { - zend_error(E_COMPILE_ERROR, "Can't use function return value in write context"); + zend_error_noreturn(E_COMPILE_ERROR, "Can't use function return value in write context"); } } /* }}} */ @@ -1361,7 +1355,7 @@ void zend_do_end_variable_parse(znode *variable, int type, int arg_offset TSRMLS switch (type) { case BP_VAR_R: if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2_type == IS_UNUSED) { - zend_error(E_COMPILE_ERROR, "Cannot use [] for reading"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use [] for reading"); } opline->opcode -= 3; break; @@ -1372,7 +1366,7 @@ void zend_do_end_variable_parse(znode *variable, int type, int arg_offset TSRMLS break; case BP_VAR_IS: if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2_type == IS_UNUSED) { - zend_error(E_COMPILE_ERROR, "Cannot use [] for reading"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use [] for reading"); } opline->opcode += 6; /* 3+3 */ break; @@ -1382,7 +1376,7 @@ void zend_do_end_variable_parse(znode *variable, int type, int arg_offset TSRMLS break; case BP_VAR_UNSET: if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2_type == IS_UNUSED) { - zend_error(E_COMPILE_ERROR, "Cannot use [] for unsetting"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use [] for unsetting"); } opline->opcode += 12; /* 3+3+3+3 */ break; @@ -1510,22 +1504,22 @@ int zend_do_verify_access_types(const znode *current_access_type, const znode *n { if ((Z_LVAL(current_access_type->u.constant) & ZEND_ACC_PPP_MASK) && (Z_LVAL(new_modifier->u.constant) & ZEND_ACC_PPP_MASK)) { - zend_error(E_COMPILE_ERROR, "Multiple access type modifiers are not allowed"); + zend_error_noreturn(E_COMPILE_ERROR, "Multiple access type modifiers are not allowed"); } if ((Z_LVAL(current_access_type->u.constant) & ZEND_ACC_ABSTRACT) && (Z_LVAL(new_modifier->u.constant) & ZEND_ACC_ABSTRACT)) { - zend_error(E_COMPILE_ERROR, "Multiple abstract modifiers are not allowed"); + zend_error_noreturn(E_COMPILE_ERROR, "Multiple abstract modifiers are not allowed"); } if ((Z_LVAL(current_access_type->u.constant) & ZEND_ACC_STATIC) && (Z_LVAL(new_modifier->u.constant) & ZEND_ACC_STATIC)) { - zend_error(E_COMPILE_ERROR, "Multiple static modifiers are not allowed"); + zend_error_noreturn(E_COMPILE_ERROR, "Multiple static modifiers are not allowed"); } if ((Z_LVAL(current_access_type->u.constant) & ZEND_ACC_FINAL) && (Z_LVAL(new_modifier->u.constant) & ZEND_ACC_FINAL)) { - zend_error(E_COMPILE_ERROR, "Multiple final modifiers are not allowed"); + zend_error_noreturn(E_COMPILE_ERROR, "Multiple final modifiers are not allowed"); } if (((Z_LVAL(current_access_type->u.constant) | Z_LVAL(new_modifier->u.constant)) & (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) == (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) { - zend_error(E_COMPILE_ERROR, "Cannot use the final modifier on an abstract class member"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use the final modifier on an abstract class member"); } return (Z_LVAL(current_access_type->u.constant) | Z_LVAL(new_modifier->u.constant)); } @@ -1534,8 +1528,8 @@ int zend_do_verify_access_types(const znode *current_access_type, const znode *n void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference, znode *fn_flags_znode TSRMLS_DC) /* {{{ */ { zend_op_array op_array; - char *name = function_name->u.constant.value.str.val; - int name_len = function_name->u.constant.value.str.len; + char *name = Z_STRVAL(function_name->u.constant); + int name_len = Z_STRLEN(function_name->u.constant); int function_begin_line = function_token->u.op.opline_num; zend_uint fn_flags; const char *lcname; @@ -1545,7 +1539,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n if (is_method) { if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) { if ((Z_LVAL(fn_flags_znode->u.constant) & ~(ZEND_ACC_STATIC|ZEND_ACC_PUBLIC))) { - zend_error(E_COMPILE_ERROR, "Access type for interface method %s::%s() must be omitted", CG(active_class_entry)->name, function_name->u.constant.value.str.val); + zend_error_noreturn(E_COMPILE_ERROR, "Access type for interface method %s::%s() must be omitted", CG(active_class_entry)->name, Z_STRVAL(function_name->u.constant)); } Z_LVAL(fn_flags_znode->u.constant) |= ZEND_ACC_ABSTRACT; /* propagates to the rest of the parser */ } @@ -1576,17 +1570,12 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n op_array.line_start = zend_get_compiled_lineno(TSRMLS_C); if (is_method) { - int result; + zend_ulong hash; lcname = zend_new_interned_string(zend_str_tolower_dup(name, name_len), name_len + 1, 1 TSRMLS_CC); - - if (IS_INTERNED(lcname)) { - result = zend_hash_quick_add(&CG(active_class_entry)->function_table, lcname, name_len+1, INTERNED_HASH(lcname), &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)); - } else { - result = zend_hash_add(&CG(active_class_entry)->function_table, lcname, name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)); - } - if (result == FAILURE) { - zend_error(E_COMPILE_ERROR, "Cannot redeclare %s::%s()", CG(active_class_entry)->name, name); + hash = str_hash(lcname, name_len); + if (zend_hash_quick_add(&CG(active_class_entry)->function_table, lcname, name_len+1, hash, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)) == FAILURE) { + zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s::%s()", CG(active_class_entry)->name, name); } zend_stack_push(&CG(context_stack), (void *) &CG(context), sizeof(CG(context))); @@ -1772,7 +1761,6 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n zend_op dummy_opline; dummy_opline.result_type = IS_UNUSED; - dummy_opline.op1_type = IS_UNUSED; zend_stack_push(&CG(foreach_copy_stack), (void *) &dummy_opline, sizeof(zend_op)); } @@ -1843,7 +1831,7 @@ void zend_do_end_function_declaration(const znode *function_token TSRMLS_DC) /* zend_str_tolower_copy(lcname, CG(active_op_array)->function_name, MIN(name_len, sizeof(lcname)-1)); lcname[sizeof(lcname)-1] = '\0'; /* zend_str_tolower_copy won't necessarily set the zero byte */ if (name_len == sizeof(ZEND_AUTOLOAD_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)) && CG(active_op_array)->num_args != 1) { - zend_error(E_COMPILE_ERROR, "%s() must take exactly 1 argument", ZEND_AUTOLOAD_FUNC_NAME); + zend_error_noreturn(E_COMPILE_ERROR, "%s() must take exactly 1 argument", ZEND_AUTOLOAD_FUNC_NAME); } } @@ -1857,26 +1845,17 @@ void zend_do_end_function_declaration(const znode *function_token TSRMLS_DC) /* } /* }}} */ -void zend_do_receive_arg(zend_uchar op, znode *varname, const znode *offset, const znode *initialization, znode *class_type, zend_uchar pass_by_reference TSRMLS_DC) /* {{{ */ +void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initialization, znode *class_type, zend_uchar pass_by_reference, zend_bool is_variadic TSRMLS_DC) /* {{{ */ { zend_op *opline; zend_arg_info *cur_arg_info; znode var; - if (class_type->op_type == IS_CONST && - Z_TYPE(class_type->u.constant) == IS_STRING && - Z_STRLEN(class_type->u.constant) == 0) { - /* Usage of namespace as class name not in namespace */ - zval_dtor(&class_type->u.constant); - zend_error(E_COMPILE_ERROR, "Cannot use 'namespace' as a class name"); - return; - } - - if (zend_is_auto_global_quick(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant), 0 TSRMLS_CC)) { - zend_error(E_COMPILE_ERROR, "Cannot re-assign auto-global variable %s", Z_STRVAL(varname->u.constant)); + if (zend_is_auto_global(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant) TSRMLS_CC)) { + zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign auto-global variable %s", Z_STRVAL(varname->u.constant)); } else { var.op_type = IS_CV; - var.u.op.var = lookup_cv(CG(active_op_array), varname->u.constant.value.str.val, varname->u.constant.value.str.len, 0 TSRMLS_CC); + var.u.op.var = lookup_cv(CG(active_op_array), Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant), 0 TSRMLS_CC); Z_STRVAL(varname->u.constant) = (char*)CG(active_op_array)->vars[var.u.op.var].name; var.EA = 0; if (CG(active_op_array)->vars[var.u.op.var].hash_value == THIS_HASHVAL && @@ -1884,30 +1863,47 @@ void zend_do_receive_arg(zend_uchar op, znode *varname, const znode *offset, con !memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this")-1)) { if (CG(active_op_array)->scope && (CG(active_op_array)->fn_flags & ZEND_ACC_STATIC) == 0) { - zend_error(E_COMPILE_ERROR, "Cannot re-assign $this"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this"); } CG(active_op_array)->this_var = var.u.op.var; } } + if (CG(active_op_array)->fn_flags & ZEND_ACC_VARIADIC) { + zend_error_noreturn(E_COMPILE_ERROR, "Only the last parameter can be variadic"); + } + + if (is_variadic) { + if (op == ZEND_RECV_INIT) { + zend_error_noreturn(E_COMPILE_ERROR, "Variadic parameter cannot have a default value"); + } + + op = ZEND_RECV_VARIADIC; + CG(active_op_array)->fn_flags |= ZEND_ACC_VARIADIC; + } + opline = get_next_op(CG(active_op_array) TSRMLS_CC); CG(active_op_array)->num_args++; opline->opcode = op; SET_NODE(opline->result, &var); - SET_NODE(opline->op1, offset); + opline->op1_type = IS_UNUSED; + opline->op1.num = CG(active_op_array)->num_args; if (op == ZEND_RECV_INIT) { SET_NODE(opline->op2, initialization); } else { - CG(active_op_array)->required_num_args = CG(active_op_array)->num_args; SET_UNUSED(opline->op2); + if (!is_variadic) { + CG(active_op_array)->required_num_args = CG(active_op_array)->num_args; + } } CG(active_op_array)->arg_info = erealloc(CG(active_op_array)->arg_info, sizeof(zend_arg_info)*(CG(active_op_array)->num_args)); cur_arg_info = &CG(active_op_array)->arg_info[CG(active_op_array)->num_args-1]; - cur_arg_info->name = zend_new_interned_string(estrndup(varname->u.constant.value.str.val, varname->u.constant.value.str.len), varname->u.constant.value.str.len + 1, 1 TSRMLS_CC); - cur_arg_info->name_len = varname->u.constant.value.str.len; + cur_arg_info->name = zend_new_interned_string(estrndup(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant)), Z_STRLEN(varname->u.constant) + 1, 1 TSRMLS_CC); + cur_arg_info->name_len = Z_STRLEN(varname->u.constant); cur_arg_info->type_hint = 0; - cur_arg_info->allow_null = 1; cur_arg_info->pass_by_reference = pass_by_reference; + cur_arg_info->allow_null = 1; + cur_arg_info->is_variadic = is_variadic; cur_arg_info->class_name = NULL; cur_arg_info->class_name_len = 0; @@ -1921,7 +1917,7 @@ void zend_do_receive_arg(zend_uchar op, znode *varname, const znode *offset, con if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL"))) { cur_arg_info->allow_null = 1; } else if (Z_TYPE(initialization->u.constant) != IS_ARRAY && Z_TYPE(initialization->u.constant) != IS_CONSTANT_ARRAY) { - zend_error(E_COMPILE_ERROR, "Default value for parameters with array type hint can only be an array or NULL"); + zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with array type hint can only be an array or NULL"); } } } else if (class_type->u.constant.type == IS_CALLABLE) { @@ -1930,22 +1926,22 @@ void zend_do_receive_arg(zend_uchar op, znode *varname, const znode *offset, con if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL"))) { cur_arg_info->allow_null = 1; } else { - zend_error(E_COMPILE_ERROR, "Default value for parameters with callable type hint can only be NULL"); + zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with callable type hint can only be NULL"); } } } else { cur_arg_info->type_hint = IS_OBJECT; if (ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_type->u.constant), Z_STRLEN(class_type->u.constant))) { - zend_resolve_class_name(class_type, opline->extended_value, 1 TSRMLS_CC); + zend_resolve_class_name(class_type TSRMLS_CC); } - Z_STRVAL(class_type->u.constant) = (char*)zend_new_interned_string(class_type->u.constant.value.str.val, class_type->u.constant.value.str.len + 1, 1 TSRMLS_CC); - cur_arg_info->class_name = class_type->u.constant.value.str.val; - cur_arg_info->class_name_len = class_type->u.constant.value.str.len; + Z_STRVAL(class_type->u.constant) = (char*)zend_new_interned_string(Z_STRVAL(class_type->u.constant), Z_STRLEN(class_type->u.constant) + 1, 1 TSRMLS_CC); + cur_arg_info->class_name = Z_STRVAL(class_type->u.constant); + cur_arg_info->class_name_len = Z_STRLEN(class_type->u.constant); if (op == ZEND_RECV_INIT) { if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL"))) { cur_arg_info->allow_null = 1; } else { - zend_error(E_COMPILE_ERROR, "Default value for parameters with a class type hint can only be NULL"); + zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with a class type hint can only be NULL"); } } } @@ -1972,16 +1968,16 @@ int zend_do_begin_function_call(znode *function_name, zend_bool check_namespace return 1; } - lcname = zend_str_tolower_dup(function_name->u.constant.value.str.val, function_name->u.constant.value.str.len); - if ((zend_hash_find(CG(function_table), lcname, function_name->u.constant.value.str.len+1, (void **) &function)==FAILURE) || + lcname = zend_str_tolower_dup(Z_STRVAL(function_name->u.constant), Z_STRLEN(function_name->u.constant)); + if ((zend_hash_find(CG(function_table), lcname, Z_STRLEN(function_name->u.constant)+1, (void **) &function)==FAILURE) || ((CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS) && (function->type == ZEND_INTERNAL_FUNCTION))) { zend_do_begin_dynamic_function_call(function_name, 0 TSRMLS_CC); efree(lcname); return 1; /* Dynamic */ } - efree(function_name->u.constant.value.str.val); - function_name->u.constant.value.str.val = lcname; + efree(Z_STRVAL(function_name->u.constant)); + Z_STRVAL(function_name->u.constant) = lcname; zend_stack_push(&CG(function_call_stack), (void *) &function, sizeof(zend_function *)); if (CG(context).nested_calls + 1 > CG(active_op_array)->nested_calls) { @@ -2006,7 +2002,7 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) /* {{{ */ if ((last_op->op2_type == IS_CONST) && (Z_TYPE(CONSTANT(last_op->op2.constant)) == IS_STRING) && (Z_STRLEN(CONSTANT(last_op->op2.constant)) == sizeof(ZEND_CLONE_FUNC_NAME)-1) && !zend_binary_strcasecmp(Z_STRVAL(CONSTANT(last_op->op2.constant)), Z_STRLEN(CONSTANT(last_op->op2.constant)), ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)-1)) { - zend_error(E_COMPILE_ERROR, "Cannot call __clone() method on objects - use 'clone $obj' instead"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot call __clone() method on objects - use 'clone $obj' instead"); } if (last_op->opcode == ZEND_FETCH_OBJ_R) { @@ -2014,11 +2010,9 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) /* {{{ */ zval name; name = CONSTANT(last_op->op2.constant); if (Z_TYPE(name) != IS_STRING) { - zend_error(E_COMPILE_ERROR, "Method name must be a string"); - } - if (!IS_INTERNED(Z_STRVAL(name))) { - Z_STRVAL(name) = estrndup(Z_STRVAL(name), Z_STRLEN(name)); + zend_error_noreturn(E_COMPILE_ERROR, "Method name must be a string"); } + Z_STRVAL(name) = str_estrndup(Z_STRVAL(name), Z_STRLEN(name)); FREE_POLYMORPHIC_CACHE_SLOT(last_op->op2.constant); last_op->op2.constant = zend_add_func_name_literal(CG(active_op_array), &name TSRMLS_CC); @@ -2165,7 +2159,7 @@ void zend_resolve_non_class_name(znode *element_name, zend_bool *check_namespace memcpy(Z_STRVAL(tmp.u.constant), Z_STRVAL_P(CG(current_namespace)), Z_STRLEN_P(CG(current_namespace))); memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRLEN_P(CG(current_namespace))]), "\\", sizeof("\\")-1); memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRLEN_P(CG(current_namespace)) + sizeof("\\")-1]), Z_STRVAL(element_name->u.constant), Z_STRLEN(element_name->u.constant)+1); - STR_FREE(Z_STRVAL(element_name->u.constant)); + str_efree(Z_STRVAL(element_name->u.constant)); *element_name = tmp; } } @@ -2189,12 +2183,12 @@ void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static int lctype; znode constant_name; - lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), class_name->u.constant.value.str.len); + lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant)); lctype = zend_get_class_fetch_type(lcname, strlen(lcname)); switch (lctype) { case ZEND_FETCH_CLASS_SELF: if (!CG(active_class_entry)) { - zend_error(E_COMPILE_ERROR, "Cannot access self::class when no class scope is active"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot access self::class when no class scope is active"); } zval_dtor(&class_name->u.constant); class_name->op_type = IS_CONST; @@ -2204,13 +2198,13 @@ void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static case ZEND_FETCH_CLASS_STATIC: case ZEND_FETCH_CLASS_PARENT: if (is_static) { - zend_error(E_COMPILE_ERROR, + zend_error_noreturn(E_COMPILE_ERROR, "%s::class cannot be used for compile-time class name resolution", lctype == ZEND_FETCH_CLASS_STATIC ? "static" : "parent" ); } if (!CG(active_class_entry)) { - zend_error(E_COMPILE_ERROR, + zend_error_noreturn(E_COMPILE_ERROR, "Cannot access %s::class when no class scope is active", lctype == ZEND_FETCH_CLASS_STATIC ? "static" : "parent" ); @@ -2220,7 +2214,7 @@ void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static zend_do_fetch_constant(result, class_name, &constant_name, ZEND_RT, 1 TSRMLS_CC); break; case ZEND_FETCH_CLASS_DEFAULT: - zend_resolve_class_name(class_name, ZEND_FETCH_CLASS_GLOBAL, 1 TSRMLS_CC); + zend_resolve_class_name(class_name TSRMLS_CC); *result = *class_name; break; } @@ -2230,7 +2224,7 @@ void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static } /* }}} */ -void zend_resolve_class_name(znode *class_name, ulong fetch_type, int check_ns_name TSRMLS_DC) /* {{{ */ +void zend_resolve_class_name(znode *class_name TSRMLS_DC) /* {{{ */ { char *compound; char *lcname; @@ -2250,7 +2244,7 @@ void zend_resolve_class_name(znode *class_name, ulong fetch_type, int check_ns_n Z_STRLEN(class_name->u.constant) + 1); if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) { - zend_error(E_COMPILE_ERROR, "'\\%s' is an invalid class name", Z_STRVAL(class_name->u.constant)); + zend_error_noreturn(E_COMPILE_ERROR, "'\\%s' is an invalid class name", Z_STRVAL(class_name->u.constant)); } } else { if (CG(current_import)) { @@ -2309,26 +2303,17 @@ void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC) /* {{{ */ long fetch_class_op_number; zend_op *opline; - if (class_name->op_type == IS_CONST && - Z_TYPE(class_name->u.constant) == IS_STRING && - Z_STRLEN(class_name->u.constant) == 0) { - /* Usage of namespace as class name not in namespace */ - zval_dtor(&class_name->u.constant); - zend_error(E_COMPILE_ERROR, "Cannot use 'namespace' as a class name"); - return; - } - fetch_class_op_number = get_next_op_number(CG(active_op_array)); opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_FETCH_CLASS; SET_UNUSED(opline->op1); - opline->extended_value = ZEND_FETCH_CLASS_GLOBAL; + opline->extended_value = ZEND_FETCH_CLASS_DEFAULT; CG(catch_begin) = fetch_class_op_number; if (class_name->op_type == IS_CONST) { int fetch_type; - fetch_type = zend_get_class_fetch_type(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len); + fetch_type = zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant)); switch (fetch_type) { case ZEND_FETCH_CLASS_SELF: case ZEND_FETCH_CLASS_PARENT: @@ -2338,7 +2323,7 @@ void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC) /* {{{ */ zval_dtor(&class_name->u.constant); break; default: - zend_resolve_class_name(class_name, opline->extended_value, 0 TSRMLS_CC); + zend_resolve_class_name(class_name TSRMLS_CC); opline->op2_type = IS_CONST; opline->op2.constant = zend_add_class_name_literal(CG(active_op_array), &class_name->u.constant TSRMLS_CC); @@ -2367,7 +2352,7 @@ void zend_do_label(znode *label TSRMLS_DC) /* {{{ */ dest.opline_num = get_next_op_number(CG(active_op_array)); if (zend_hash_add(CG(context).labels, Z_STRVAL(label->u.constant), Z_STRLEN(label->u.constant) + 1, (void**)&dest, sizeof(zend_label), NULL) == FAILURE) { - zend_error(E_COMPILE_ERROR, "Label '%s' already defined", Z_STRVAL(label->u.constant)); + zend_error_noreturn(E_COMPILE_ERROR, "Label '%s' already defined", Z_STRVAL(label->u.constant)); } /* Done with label now */ @@ -2393,7 +2378,7 @@ void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2 CG(in_compilation) = 1; CG(active_op_array) = op_array; CG(zend_lineno) = opline->lineno; - zend_error(E_COMPILE_ERROR, "'goto' to undefined label '%s'", Z_STRVAL_P(label)); + zend_error_noreturn(E_COMPILE_ERROR, "'goto' to undefined label '%s'", Z_STRVAL_P(label)); } else { /* Label is not defined. Delay to pass 2. */ INC_BPC(op_array); @@ -2414,7 +2399,7 @@ void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2 CG(active_op_array) = op_array; CG(zend_lineno) = opline->lineno; } - zend_error(E_COMPILE_ERROR, "'goto' into loop or switch statement is disallowed"); + zend_error_noreturn(E_COMPILE_ERROR, "'goto' into loop or switch statement is disallowed"); } current = op_array->brk_cont_array[current].parent; } @@ -2475,19 +2460,19 @@ void zend_do_build_full_name(znode *result, znode *prefix, znode *name, int is_c } if (is_class_member) { - length = sizeof("::")-1 + result->u.constant.value.str.len + name->u.constant.value.str.len; - result->u.constant.value.str.val = erealloc(result->u.constant.value.str.val, length+1); - memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len], "::", sizeof("::")-1); - memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len + sizeof("::")-1], name->u.constant.value.str.val, name->u.constant.value.str.len+1); - STR_FREE(name->u.constant.value.str.val); - result->u.constant.value.str.len = length; + length = sizeof("::")-1 + Z_STRLEN(result->u.constant) + Z_STRLEN(name->u.constant); + Z_STRVAL(result->u.constant) = erealloc(Z_STRVAL(result->u.constant), length+1); + memcpy(&Z_STRVAL(result->u.constant)[Z_STRLEN(result->u.constant)], "::", sizeof("::")-1); + memcpy(&Z_STRVAL(result->u.constant)[Z_STRLEN(result->u.constant) + sizeof("::")-1], Z_STRVAL(name->u.constant), Z_STRLEN(name->u.constant)+1); + str_efree(Z_STRVAL(name->u.constant)); + Z_STRLEN(result->u.constant) = length; } else { - length = sizeof("\\")-1 + result->u.constant.value.str.len + name->u.constant.value.str.len; - result->u.constant.value.str.val = erealloc(result->u.constant.value.str.val, length+1); - memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len], "\\", sizeof("\\")-1); - memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len + sizeof("\\")-1], name->u.constant.value.str.val, name->u.constant.value.str.len+1); - STR_FREE(name->u.constant.value.str.val); - result->u.constant.value.str.len = length; + length = sizeof("\\")-1 + Z_STRLEN(result->u.constant) + Z_STRLEN(name->u.constant); + Z_STRVAL(result->u.constant) = erealloc(Z_STRVAL(result->u.constant), length+1); + memcpy(&Z_STRVAL(result->u.constant)[Z_STRLEN(result->u.constant)], "\\", sizeof("\\")-1); + memcpy(&Z_STRVAL(result->u.constant)[Z_STRLEN(result->u.constant) + sizeof("\\")-1], Z_STRVAL(name->u.constant), Z_STRLEN(name->u.constant)+1); + str_efree(Z_STRVAL(name->u.constant)); + Z_STRLEN(result->u.constant) = length; } } /* }}} */ @@ -2501,7 +2486,7 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na if (method_name->op_type == IS_CONST) { char *lcname; if (Z_TYPE(method_name->u.constant) != IS_STRING) { - zend_error(E_COMPILE_ERROR, "Method name must be a string"); + zend_error_noreturn(E_COMPILE_ERROR, "Method name must be a string"); } lcname = zend_str_tolower_dup(Z_STRVAL(method_name->u.constant), Z_STRLEN(method_name->u.constant)); if ((sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == Z_STRLEN(method_name->u.constant) && @@ -2514,7 +2499,7 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na if (class_name->op_type == IS_CONST && ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) { - zend_resolve_class_name(class_name, ZEND_FETCH_CLASS_GLOBAL, 1 TSRMLS_CC); + zend_resolve_class_name(class_name TSRMLS_CC); class_node = *class_name; opline = get_next_op(CG(active_op_array) TSRMLS_CC); } else { @@ -2610,12 +2595,12 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC) /* {{ function_ptr->common.function_name && function_ptr->common.type == ZEND_USER_FUNCTION && !ARG_SHOULD_BE_SENT_BY_REF(function_ptr, (zend_uint) offset)) { - zend_error(E_COMPILE_ERROR, + zend_error_noreturn(E_COMPILE_ERROR, "Call-time pass-by-reference has been removed; " "If you would like to pass argument by reference, modify the declaration of %s().", function_ptr->common.function_name); } else { - zend_error(E_COMPILE_ERROR, "Call-time pass-by-reference has been removed"); + zend_error_noreturn(E_COMPILE_ERROR, "Call-time pass-by-reference has been removed"); } return; } @@ -2656,7 +2641,7 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC) /* {{ op = ZEND_SEND_REF; break; default: - zend_error(E_COMPILE_ERROR, "Only variables can be passed by reference"); + zend_error_noreturn(E_COMPILE_ERROR, "Only variables can be passed by reference"); break; } } @@ -2718,7 +2703,7 @@ static int generate_free_switch_expr(const zend_switch_entry *switch_entry TSRML opline->opcode = (switch_entry->cond.op_type == IS_TMP_VAR) ? ZEND_FREE : ZEND_SWITCH_FREE; SET_NODE(opline->op1, &switch_entry->cond); SET_UNUSED(opline->op2); - opline->extended_value = 0; + return 0; } /* }}} */ @@ -2728,7 +2713,7 @@ static int generate_free_foreach_copy(const zend_op *foreach_copy TSRMLS_DC) /* zend_op *opline; /* If we reach the separator then stop applying the stack */ - if (foreach_copy->result_type == IS_UNUSED && foreach_copy->op1_type == IS_UNUSED) { + if (foreach_copy->result_type == IS_UNUSED) { return 1; } @@ -2737,16 +2722,6 @@ static int generate_free_foreach_copy(const zend_op *foreach_copy TSRMLS_DC) /* opline->opcode = (foreach_copy->result_type == IS_TMP_VAR) ? ZEND_FREE : ZEND_SWITCH_FREE; COPY_NODE(opline->op1, foreach_copy->result); SET_UNUSED(opline->op2); - opline->extended_value = 1; - - if (foreach_copy->op1_type != IS_UNUSED) { - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = (foreach_copy->op1_type == IS_TMP_VAR) ? ZEND_FREE : ZEND_SWITCH_FREE; - COPY_NODE(opline->op1, foreach_copy->op1); - SET_UNUSED(opline->op2); - opline->extended_value = 0; - } return 0; } @@ -2815,7 +2790,7 @@ void zend_do_yield(znode *result, znode *value, const znode *key, zend_bool is_v zend_op *opline; if (!CG(active_op_array)->function_name) { - zend_error(E_COMPILE_ERROR, "The \"yield\" expression can only be used inside a function"); + zend_error_noreturn(E_COMPILE_ERROR, "The \"yield\" expression can only be used inside a function"); } CG(active_op_array)->fn_flags |= ZEND_ACC_GENERATOR; @@ -2952,10 +2927,10 @@ void zend_do_begin_catch(znode *catch_token, znode *class_name, znode *catch_var if (class_name->op_type == IS_CONST && ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) { - zend_resolve_class_name(class_name, ZEND_FETCH_CLASS_GLOBAL, 1 TSRMLS_CC); + zend_resolve_class_name(class_name TSRMLS_CC); catch_class = *class_name; } else { - zend_error(E_COMPILE_ERROR, "Bad class name in the catch statement"); + zend_error_noreturn(E_COMPILE_ERROR, "Bad class name in the catch statement"); } catch_op_number = get_next_op_number(CG(active_op_array)); @@ -2968,7 +2943,7 @@ void zend_do_begin_catch(znode *catch_token, znode *class_name, znode *catch_var opline->op1_type = IS_CONST; opline->op1.constant = zend_add_class_name_literal(CG(active_op_array), &catch_class.u.constant TSRMLS_CC); opline->op2_type = IS_CV; - opline->op2.var = lookup_cv(CG(active_op_array), catch_var->u.constant.value.str.val, catch_var->u.constant.value.str.len, 0 TSRMLS_CC); + opline->op2.var = lookup_cv(CG(active_op_array), Z_STRVAL(catch_var->u.constant), Z_STRLEN(catch_var->u.constant), 0 TSRMLS_CC); Z_STRVAL(catch_var->u.constant) = (char*)CG(active_op_array)->vars[opline->op2.var].name; opline->result.num = 0; /* 1 means it's the last catch in the block */ @@ -3004,7 +2979,7 @@ void zend_do_bind_catch(znode *try_token, znode *catch_token TSRMLS_DC) /* {{{ * void zend_do_end_finally(znode *try_token, znode* catch_token, znode *finally_token TSRMLS_DC) /* {{{ */ { if (catch_token->op_type == IS_UNUSED && finally_token->op_type == IS_UNUSED) { - zend_error(E_COMPILE_ERROR, "Cannot use try without catch or finally"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use try without catch or finally"); } if (finally_token->op_type != IS_UNUSED) { zend_op *opline; @@ -3171,7 +3146,7 @@ static void do_inherit_method(zend_function *function) /* {{{ */ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, const zend_function *proto TSRMLS_DC) /* {{{ */ { - zend_uint i; + zend_uint i, num_args; /* If it's a user function then arg_info == NULL means we don't have any parameters but * we still need to do the arg number checks. We are only willing to ignore this for internal @@ -3201,48 +3176,66 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c return 0; } - if (fe->common.type != ZEND_USER_FUNCTION - && (proto->common.fn_flags & ZEND_ACC_PASS_REST_BY_REFERENCE) != 0 - && (fe->common.fn_flags & ZEND_ACC_PASS_REST_BY_REFERENCE) == 0) { - return 0; - } - /* by-ref constraints on return values are covariant */ if ((proto->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) && !(fe->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)) { return 0; } - for (i=0; i < proto->common.num_args; i++) { - if (ZEND_LOG_XOR(fe->common.arg_info[i].class_name, proto->common.arg_info[i].class_name)) { + if ((proto->common.fn_flags & ZEND_ACC_VARIADIC) + && !(fe->common.fn_flags & ZEND_ACC_VARIADIC)) { + return 0; + } + + /* For variadic functions any additional (optional) arguments that were added must be + * checked against the signature of the variadic argument, so in this case we have to + * go through all the parameters of the function and not just those present in the + * prototype. */ + num_args = proto->common.num_args; + if ((fe->common.fn_flags & ZEND_ACC_VARIADIC) + && fe->common.num_args > proto->common.num_args) { + num_args = fe->common.num_args; + } + + for (i = 0; i < num_args; i++) { + zend_arg_info *fe_arg_info = &fe->common.arg_info[i]; + + zend_arg_info *proto_arg_info; + if (i < proto->common.num_args) { + proto_arg_info = &proto->common.arg_info[i]; + } else { + proto_arg_info = &proto->common.arg_info[proto->common.num_args-1]; + } + + if (ZEND_LOG_XOR(fe_arg_info->class_name, proto_arg_info->class_name)) { /* Only one has a type hint and the other one doesn't */ return 0; } - if (fe->common.arg_info[i].class_name) { + if (fe_arg_info->class_name) { const char *fe_class_name, *proto_class_name; zend_uint fe_class_name_len, proto_class_name_len; - if (!strcasecmp(fe->common.arg_info[i].class_name, "parent") && proto->common.scope) { + if (!strcasecmp(fe_arg_info->class_name, "parent") && proto->common.scope) { fe_class_name = proto->common.scope->name; fe_class_name_len = proto->common.scope->name_length; - } else if (!strcasecmp(fe->common.arg_info[i].class_name, "self") && fe->common.scope) { + } else if (!strcasecmp(fe_arg_info->class_name, "self") && fe->common.scope) { fe_class_name = fe->common.scope->name; fe_class_name_len = fe->common.scope->name_length; } else { - fe_class_name = fe->common.arg_info[i].class_name; - fe_class_name_len = fe->common.arg_info[i].class_name_len; + fe_class_name = fe_arg_info->class_name; + fe_class_name_len = fe_arg_info->class_name_len; } - if (!strcasecmp(proto->common.arg_info[i].class_name, "parent") && proto->common.scope && proto->common.scope->parent) { + if (!strcasecmp(proto_arg_info->class_name, "parent") && proto->common.scope && proto->common.scope->parent) { proto_class_name = proto->common.scope->parent->name; proto_class_name_len = proto->common.scope->parent->name_length; - } else if (!strcasecmp(proto->common.arg_info[i].class_name, "self") && proto->common.scope) { + } else if (!strcasecmp(proto_arg_info->class_name, "self") && proto->common.scope) { proto_class_name = proto->common.scope->name; proto_class_name_len = proto->common.scope->name_length; } else { - proto_class_name = proto->common.arg_info[i].class_name; - proto_class_name_len = proto->common.arg_info[i].class_name_len; + proto_class_name = proto_arg_info->class_name; + proto_class_name_len = proto_arg_info->class_name_len; } if (strcasecmp(fe_class_name, proto_class_name)!=0) { @@ -3269,24 +3262,17 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c } } } - if (fe->common.arg_info[i].type_hint != proto->common.arg_info[i].type_hint) { + if (fe_arg_info->type_hint != proto_arg_info->type_hint) { /* Incompatible type hint */ return 0; } /* by-ref constraints on arguments are invariant */ - if (fe->common.arg_info[i].pass_by_reference != proto->common.arg_info[i].pass_by_reference) { + if (fe_arg_info->pass_by_reference != proto_arg_info->pass_by_reference) { return 0; } } - if (proto->common.fn_flags & ZEND_ACC_PASS_REST_BY_REFERENCE) { - for (i=proto->common.num_args; i < fe->common.num_args; i++) { - if (!fe->common.arg_info[i].pass_by_reference) { - return 0; - } - } - } return 1; } /* }}} */ @@ -3359,6 +3345,13 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{ if (arg_info->pass_by_reference) { *(offset++) = '&'; } + + if (arg_info->is_variadic) { + *(offset++) = '.'; + *(offset++) = '.'; + *(offset++) = '.'; + } + *(offset++) = '$'; if (arg_info->name) { @@ -3374,7 +3367,7 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{ idx /= 10; } while (idx > 0); } - if (i >= required) { + if (i >= required && !arg_info->is_variadic) { *(offset++) = ' '; *(offset++) = '='; *(offset++) = ' '; @@ -3469,14 +3462,14 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function * && parent->common.fn_flags & ZEND_ACC_ABSTRACT && parent->common.scope != (child->common.prototype ? child->common.prototype->common.scope : child->common.scope) && child->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_IMPLEMENTED_ABSTRACT)) { - zend_error(E_COMPILE_ERROR, "Can't inherit abstract function %s::%s() (previously declared abstract in %s)", + zend_error_noreturn(E_COMPILE_ERROR, "Can't inherit abstract function %s::%s() (previously declared abstract in %s)", parent->common.scope->name, child->common.function_name, child->common.prototype ? child->common.prototype->common.scope->name : child->common.scope->name); } if (parent_flags & ZEND_ACC_FINAL) { - zend_error(E_COMPILE_ERROR, "Cannot override final method %s::%s()", ZEND_FN_SCOPE_NAME(parent), child->common.function_name); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot override final method %s::%s()", ZEND_FN_SCOPE_NAME(parent), child->common.function_name); } child_flags = child->common.fn_flags; @@ -3484,15 +3477,15 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function * */ if ((child_flags & ZEND_ACC_STATIC) != (parent_flags & ZEND_ACC_STATIC)) { if (child->common.fn_flags & ZEND_ACC_STATIC) { - zend_error(E_COMPILE_ERROR, "Cannot make non static method %s::%s() static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot make non static method %s::%s() static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child)); } else { - zend_error(E_COMPILE_ERROR, "Cannot make static method %s::%s() non static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot make static method %s::%s() non static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child)); } } /* Disallow making an inherited method abstract. */ if ((child_flags & ZEND_ACC_ABSTRACT) && !(parent_flags & ZEND_ACC_ABSTRACT)) { - zend_error(E_COMPILE_ERROR, "Cannot make non abstract method %s::%s() abstract in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot make non abstract method %s::%s() abstract in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child)); } if (parent_flags & ZEND_ACC_CHANGED) { @@ -3501,7 +3494,7 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function * /* Prevent derived classes from restricting access that was available in parent classes */ if ((child_flags & ZEND_ACC_PPP_MASK) > (parent_flags & ZEND_ACC_PPP_MASK)) { - zend_error(E_COMPILE_ERROR, "Access level to %s::%s() must be %s (as in class %s)%s", ZEND_FN_SCOPE_NAME(child), child->common.function_name, zend_visibility_string(parent_flags), ZEND_FN_SCOPE_NAME(parent), (parent_flags&ZEND_ACC_PUBLIC) ? "" : " or weaker"); + zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::%s() must be %s (as in class %s)%s", ZEND_FN_SCOPE_NAME(child), child->common.function_name, zend_visibility_string(parent_flags), ZEND_FN_SCOPE_NAME(parent), (parent_flags&ZEND_ACC_PUBLIC) ? "" : " or weaker"); } else if (((child_flags & ZEND_ACC_PPP_MASK) < (parent_flags & ZEND_ACC_PPP_MASK)) && ((parent_flags & ZEND_ACC_PPP_MASK) & ZEND_ACC_PRIVATE)) { child->common.fn_flags |= ZEND_ACC_CHANGED; @@ -3520,7 +3513,7 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function * if (child->common.prototype && (child->common.prototype->common.fn_flags & ZEND_ACC_ABSTRACT)) { if (!zend_do_perform_implementation_check(child, child->common.prototype TSRMLS_CC)) { - zend_error(E_COMPILE_ERROR, "Declaration of %s::%s() must be compatible with %s", ZEND_FN_SCOPE_NAME(child), child->common.function_name, zend_get_function_declaration(child->common.prototype TSRMLS_CC)); + zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s::%s() must be compatible with %s", ZEND_FN_SCOPE_NAME(child), child->common.function_name, zend_get_function_declaration(child->common.prototype TSRMLS_CC)); } } else if (EG(error_reporting) & E_STRICT || EG(user_error_handler)) { /* Check E_STRICT (or custom error handler) before the check so that we save some time */ if (!zend_do_perform_implementation_check(child, parent TSRMLS_CC)) { @@ -3574,7 +3567,7 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro if (zend_hash_quick_find(&ce->properties_info, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **) &child_info)==SUCCESS) { if ((parent_info->flags & ZEND_ACC_STATIC) != (child_info->flags & ZEND_ACC_STATIC)) { - zend_error(E_COMPILE_ERROR, "Cannot redeclare %s%s::$%s as %s%s::$%s", + zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s%s::$%s as %s%s::$%s", (parent_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", parent_ce->name, hash_key->arKey, (child_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ce->name, hash_key->arKey); @@ -3585,7 +3578,7 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro } if ((child_info->flags & ZEND_ACC_PPP_MASK) > (parent_info->flags & ZEND_ACC_PPP_MASK)) { - zend_error(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s", ce->name, hash_key->arKey, zend_visibility_string(parent_info->flags), parent_ce->name, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker"); + zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s", ce->name, hash_key->arKey, zend_visibility_string(parent_info->flags), parent_ce->name, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker"); } else if ((child_info->flags & ZEND_ACC_STATIC) == 0) { zval_ptr_dtor(&(ce->default_properties_table[parent_info->offset])); ce->default_properties_table[parent_info->offset] = ce->default_properties_table[child_info->offset]; @@ -3670,10 +3663,10 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent if ((ce->ce_flags & ZEND_ACC_INTERFACE) && !(parent_ce->ce_flags & ZEND_ACC_INTERFACE)) { - zend_error(E_COMPILE_ERROR, "Interface %s may not inherit from class (%s)", ce->name, parent_ce->name); + zend_error_noreturn(E_COMPILE_ERROR, "Interface %s may not inherit from class (%s)", ce->name, parent_ce->name); } if (parent_ce->ce_flags & ZEND_ACC_FINAL_CLASS) { - zend_error(E_COMPILE_ERROR, "Class %s may not inherit from final class (%s)", ce->name, parent_ce->name); + zend_error_noreturn(E_COMPILE_ERROR, "Class %s may not inherit from final class (%s)", ce->name, parent_ce->name); } ce->parent = parent_ce; @@ -3795,7 +3788,7 @@ static zend_bool do_inherit_constant_check(HashTable *child_constants_table, con if (zend_hash_quick_find(child_constants_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void**)&old_constant) == SUCCESS) { if (*old_constant != *parent_constant) { - zend_error(E_COMPILE_ERROR, "Cannot inherit previously-inherited or override constant %s from interface %s", hash_key->arKey, iface->name); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot inherit previously-inherited or override constant %s from interface %s", hash_key->arKey, iface->name); } return 0; } @@ -3827,7 +3820,7 @@ ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry if (i < parent_iface_num) { ignore = 1; } else { - zend_error(E_COMPILE_ERROR, "Class %s cannot implement previously implemented interface %s", ce->name, iface->name); + zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot implement previously implemented interface %s", ce->name, iface->name); } } } @@ -3900,7 +3893,7 @@ static void zend_add_magic_methods(zend_class_entry* ce, const char* mname, uint ce->clone = fe; fe->common.fn_flags |= ZEND_ACC_CLONE; } else if (!strncmp(mname, ZEND_CONSTRUCTOR_FUNC_NAME, mname_len)) { if (ce->constructor) { - zend_error(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name); + zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name); } ce->constructor = fe; fe->common.fn_flags |= ZEND_ACC_CTOR; } else if (!strncmp(mname, ZEND_DESTRUCTOR_FUNC_NAME, mname_len)) { @@ -3925,7 +3918,7 @@ static void zend_add_magic_methods(zend_class_entry* ce, const char* mname, uint lowercase_name = (char*)zend_new_interned_string(lowercase_name, ce->name_length + 1, 1 TSRMLS_CC); if (!memcmp(mname, lowercase_name, mname_len)) { if (ce->constructor) { - zend_error(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name); + zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name); } ce->constructor = fe; fe->common.fn_flags |= ZEND_ACC_CTOR; @@ -3949,14 +3942,14 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, const if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) { /* Make sure the trait method is compatible with previosly declared abstract method */ if (!zend_traits_method_compatibility_check(fn, existing_fn TSRMLS_CC)) { - zend_error(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s", + zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s", zend_get_function_declaration(fn TSRMLS_CC), zend_get_function_declaration(existing_fn TSRMLS_CC)); } } else if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) { /* Make sure the abstract declaration is compatible with previous declaration */ if (!zend_traits_method_compatibility_check(existing_fn, fn TSRMLS_CC)) { - zend_error(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s", + zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s", zend_get_function_declaration(fn TSRMLS_CC), zend_get_function_declaration(existing_fn TSRMLS_CC)); } @@ -3972,25 +3965,25 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, const } else if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) { /* Make sure the trait method is compatible with previosly declared abstract method */ if (!zend_traits_method_compatibility_check(fn, existing_fn TSRMLS_CC)) { - zend_error(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s", + zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s", zend_get_function_declaration(fn TSRMLS_CC), zend_get_function_declaration(existing_fn TSRMLS_CC)); } } else if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) { /* Make sure the abstract declaration is compatible with previous declaration */ if (!zend_traits_method_compatibility_check(existing_fn, fn TSRMLS_CC)) { - zend_error(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s", + zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s", zend_get_function_declaration(fn TSRMLS_CC), zend_get_function_declaration(existing_fn TSRMLS_CC)); } return; } else if ((existing_fn->common.scope->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) { - /* two trais can't define the same non-abstract method */ + /* two traits can't define the same non-abstract method */ #if 1 - zend_error(E_COMPILE_ERROR, "Trait method %s has not been applied, because there are collisions with other trait methods on %s", + zend_error_noreturn(E_COMPILE_ERROR, "Trait method %s has not been applied, because there are collisions with other trait methods on %s", name, ce->name); -#else /* TODO: better errot message */ - zend_error(E_COMPILE_ERROR, "Trait method %s::%s has not been applied as %s::%s, because of collision with %s::%s", +#else /* TODO: better error message */ + zend_error_noreturn(E_COMPILE_ERROR, "Trait method %s::%s has not been applied as %s::%s, because of collision with %s::%s", fn->common.scope->name, fn->common.function_name, ce->name, name, existing_fn->common.scope->name, existing_fn->common.function_name); @@ -4073,7 +4066,7 @@ static int zend_traits_copy_functions(zend_function *fn TSRMLS_DC, int num_args, } } - lcname = hash_key->arKey; + lcname = (char *) hash_key->arKey; if (exclude_table == NULL || zend_hash_find(exclude_table, lcname, fnname_len, &dummy) == FAILURE) { /* is not in hashtable, thus, function is not to be excluded */ @@ -4114,7 +4107,7 @@ static void zend_check_trait_usage(zend_class_entry *ce, zend_class_entry *trait zend_uint i; if ((trait->ce_flags & ZEND_ACC_TRAIT) != ZEND_ACC_TRAIT) { - zend_error(E_COMPILE_ERROR, "Class %s is not a trait, Only traits may be used in 'as' and 'insteadof' statements", trait->name); + zend_error_noreturn(E_COMPILE_ERROR, "Class %s is not a trait, Only traits may be used in 'as' and 'insteadof' statements", trait->name); } for (i = 0; i < ce->num_traits; i++) { @@ -4122,7 +4115,7 @@ static void zend_check_trait_usage(zend_class_entry *ce, zend_class_entry *trait return; } } - zend_error(E_COMPILE_ERROR, "Required Trait %s wasn't added to %s", trait->name, ce->name); + zend_error_noreturn(E_COMPILE_ERROR, "Required Trait %s wasn't added to %s", trait->name, ce->name); } /* }}} */ @@ -4143,7 +4136,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /* cur_method_ref = cur_precedence->trait_method; if (!(cur_precedence->trait_method->ce = zend_fetch_class(cur_method_ref->class_name, cur_method_ref->cname_len, ZEND_FETCH_CLASS_TRAIT|ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) { - zend_error(E_COMPILE_ERROR, "Could not find trait %s", cur_method_ref->class_name); + zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", cur_method_ref->class_name); } zend_check_trait_usage(ce, cur_precedence->trait_method->ce TSRMLS_CC); @@ -4155,7 +4148,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /* cur_method_ref->mname_len + 1); efree(lcname); if (!method_exists) { - zend_error(E_COMPILE_ERROR, + zend_error_noreturn(E_COMPILE_ERROR, "A precedence rule was defined for %s::%s but this method does not exist", cur_method_ref->ce->name, cur_method_ref->method_name); @@ -4173,14 +4166,14 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /* zend_uint name_length = strlen(class_name); if (!(cur_precedence->exclude_from_classes[j] = zend_fetch_class(class_name, name_length, ZEND_FETCH_CLASS_TRAIT |ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) { - zend_error(E_COMPILE_ERROR, "Could not find trait %s", class_name); + zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", class_name); } zend_check_trait_usage(ce, cur_precedence->exclude_from_classes[j] TSRMLS_CC); /* make sure that the trait method is not from a class mentioned in exclude_from_classes, for consistency */ if (cur_precedence->trait_method->ce == cur_precedence->exclude_from_classes[i]) { - zend_error(E_COMPILE_ERROR, + zend_error_noreturn(E_COMPILE_ERROR, "Inconsistent insteadof definition. " "The method %s is to be used from %s, but %s is also on the exclude list", cur_method_ref->method_name, @@ -4203,7 +4196,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /* if (ce->trait_aliases[i]->trait_method->class_name) { cur_method_ref = ce->trait_aliases[i]->trait_method; if (!(cur_method_ref->ce = zend_fetch_class(cur_method_ref->class_name, cur_method_ref->cname_len, ZEND_FETCH_CLASS_TRAIT|ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) { - zend_error(E_COMPILE_ERROR, "Could not find trait %s", cur_method_ref->class_name); + zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", cur_method_ref->class_name); } zend_check_trait_usage(ce, cur_method_ref->ce TSRMLS_CC); @@ -4215,7 +4208,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /* efree(lcname); if (!method_exists) { - zend_error(E_COMPILE_ERROR, "An alias was defined for %s::%s but this method does not exist", cur_method_ref->ce->name, cur_method_ref->method_name); + zend_error_noreturn(E_COMPILE_ERROR, "An alias was defined for %s::%s but this method does not exist", cur_method_ref->ce->name, cur_method_ref->method_name); } } i++; @@ -4241,7 +4234,7 @@ static void zend_traits_compile_exclude_table(HashTable* exclude_table, zend_tra if (zend_hash_add(exclude_table, lcname, lcname_len, NULL, 0, NULL) == FAILURE) { efree(lcname); - zend_error(E_COMPILE_ERROR, "Failed to evaluate a trait precedence (%s). Method of trait %s was defined to be excluded multiple times", precedences[i]->trait_method->method_name, trait->name); + zend_error_noreturn(E_COMPILE_ERROR, "Failed to evaluate a trait precedence (%s). Method of trait %s was defined to be excluded multiple times", precedences[i]->trait_method->method_name, trait->name); } efree(lcname); } @@ -4366,7 +4359,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* { } if (not_compatible) { - zend_error(E_COMPILE_ERROR, + zend_error_noreturn(E_COMPILE_ERROR, "%s and %s define the same property ($%s) in the composition of %s. However, the definition differs and is considered incompatible. Class was composed", find_first_definition(ce, i, prop_name, prop_name_length, prop_hash, coliding_prop->ce)->name, property_info->ce->name, @@ -4415,7 +4408,7 @@ static void zend_do_check_for_inconsistent_traits_aliasing(zend_class_entry *ce if (!cur_alias->trait_method->ce) { if (cur_alias->alias) { /** Plain old inconsistency/typo/bug */ - zend_error(E_COMPILE_ERROR, + zend_error_noreturn(E_COMPILE_ERROR, "An alias (%s) was defined for method %s(), but this method does not exist", cur_alias->alias, cur_alias->trait_method->method_name); @@ -4434,12 +4427,12 @@ static void zend_do_check_for_inconsistent_traits_aliasing(zend_class_entry *ce lc_method_name, cur_alias->trait_method->mname_len+1)) { efree(lc_method_name); - zend_error(E_COMPILE_ERROR, + zend_error_noreturn(E_COMPILE_ERROR, "The modifiers for the trait alias %s() need to be changed in the same statment in which the alias is defined. Error", cur_alias->trait_method->method_name); } else { efree(lc_method_name); - zend_error(E_COMPILE_ERROR, + zend_error_noreturn(E_COMPILE_ERROR, "The modifiers of the trait method %s() are changed, but this method does not exist. Error", cur_alias->trait_method->method_name); @@ -4526,7 +4519,7 @@ void zend_prepare_reference(znode *result, znode *class_name, znode *method_name /* REM: There should not be a need for copying, zend_do_begin_class_declaration is also just using that string */ if (class_name) { - zend_resolve_class_name(class_name, ZEND_FETCH_CLASS_GLOBAL, 1 TSRMLS_CC); + zend_resolve_class_name(class_name TSRMLS_CC); method_ref->class_name = Z_STRVAL(class_name->u.constant); method_ref->cname_len = Z_STRLEN(class_name->u.constant); } else { @@ -4548,13 +4541,13 @@ void zend_add_trait_alias(znode *method_reference, znode *modifiers, znode *alia zend_trait_alias *trait_alias; if (Z_LVAL(modifiers->u.constant) == ZEND_ACC_STATIC) { - zend_error(E_COMPILE_ERROR, "Cannot use 'static' as method modifier"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'static' as method modifier"); return; } else if (Z_LVAL(modifiers->u.constant) == ZEND_ACC_ABSTRACT) { - zend_error(E_COMPILE_ERROR, "Cannot use 'abstract' as method modifier"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'abstract' as method modifier"); return; } else if (Z_LVAL(modifiers->u.constant) == ZEND_ACC_FINAL) { - zend_error(E_COMPILE_ERROR, "Cannot use 'final' as method modifier"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'final' as method modifier"); return; } @@ -4596,7 +4589,7 @@ ZEND_API zend_class_entry *do_bind_class(const zend_op_array* op_array, const ze op2 = opline->op2.zv; } if (zend_hash_quick_find(class_table, Z_STRVAL_P(op1), Z_STRLEN_P(op1), Z_HASH_P(op1), (void **) &pce)==FAILURE) { - zend_error(E_COMPILE_ERROR, "Internal Zend error - Missing class information for %s", Z_STRVAL_P(op1)); + zend_error_noreturn(E_COMPILE_ERROR, "Internal Zend error - Missing class information for %s", Z_STRVAL_P(op1)); return NULL; } else { ce = *pce; @@ -4610,7 +4603,7 @@ ZEND_API zend_class_entry *do_bind_class(const zend_op_array* op_array, const ze * so we shut up about it. This allows the if (!defined('FOO')) { return; } * approach to work. */ - zend_error(E_COMPILE_ERROR, "Cannot redeclare class %s", ce->name); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare class %s", ce->name); } return NULL; } else { @@ -4645,7 +4638,7 @@ ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op_array *op_array * so we shut up about it. This allows the if (!defined('FOO')) { return; } * approach to work. */ - zend_error(E_COMPILE_ERROR, "Cannot redeclare class %s", Z_STRVAL_P(op2)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare class %s", Z_STRVAL_P(op2)); } return NULL; } else { @@ -4653,9 +4646,9 @@ ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op_array *op_array } if (parent_ce->ce_flags & ZEND_ACC_INTERFACE) { - zend_error(E_COMPILE_ERROR, "Class %s cannot extend from interface %s", ce->name, parent_ce->name); + zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot extend from interface %s", ce->name, parent_ce->name); } else if ((parent_ce->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) { - zend_error(E_COMPILE_ERROR, "Class %s cannot extend from trait %s", ce->name, parent_ce->name); + zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot extend from trait %s", ce->name, parent_ce->name); } zend_do_inheritance(ce, parent_ce TSRMLS_CC); @@ -4664,7 +4657,7 @@ ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op_array *op_array /* Register the derived class */ if (zend_hash_quick_add(class_table, Z_STRVAL_P(op2), Z_STRLEN_P(op2)+1, Z_HASH_P(op2), pce, sizeof(zend_class_entry *), NULL)==FAILURE) { - zend_error(E_COMPILE_ERROR, "Cannot redeclare class %s", ce->name); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare class %s", ce->name); } return ce; } @@ -4733,7 +4726,7 @@ void zend_do_early_binding(TSRMLS_D) /* {{{ */ /* Classes with traits are handled exactly the same, no early-bind here */ return; default: - zend_error(E_COMPILE_ERROR, "Invalid binding type"); + zend_error_noreturn(E_COMPILE_ERROR, "Invalid binding type"); return; } @@ -4864,9 +4857,9 @@ void zend_do_brk_cont(zend_uchar op, const znode *expr TSRMLS_DC) /* {{{ */ SET_UNUSED(opline->op1); if (expr) { if (expr->op_type != IS_CONST) { - zend_error(E_COMPILE_ERROR, "'%s' operator with non-constant operand is no longer supported", op == ZEND_BRK ? "break" : "continue"); + zend_error_noreturn(E_COMPILE_ERROR, "'%s' operator with non-constant operand is no longer supported", op == ZEND_BRK ? "break" : "continue"); } else if (Z_TYPE(expr->u.constant) != IS_LONG || Z_LVAL(expr->u.constant) < 1) { - zend_error(E_COMPILE_ERROR, "'%s' operator accepts only positive numbers", op == ZEND_BRK ? "break" : "continue"); + zend_error_noreturn(E_COMPILE_ERROR, "'%s' operator accepts only positive numbers", op == ZEND_BRK ? "break" : "continue"); } SET_NODE(opline->op2, expr); } else { @@ -5025,15 +5018,15 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name zval **ns_name, key; if (CG(active_class_entry)) { - zend_error(E_COMPILE_ERROR, "Class declarations may not be nested"); + zend_error_noreturn(E_COMPILE_ERROR, "Class declarations may not be nested"); return; } - lcname = zend_str_tolower_dup(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len); + lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant)); if (!(strcmp(lcname, "self") && strcmp(lcname, "parent"))) { efree(lcname); - zend_error(E_COMPILE_ERROR, "Cannot use '%s' as class name as it is reserved", Z_STRVAL(class_name->u.constant)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as class name as it is reserved", Z_STRVAL(class_name->u.constant)); } /* Class name must not conflict with import names */ @@ -5060,7 +5053,7 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name if (Z_STRLEN_PP(ns_name) != Z_STRLEN(class_name->u.constant) || memcmp(tmp, lcname, Z_STRLEN(class_name->u.constant))) { - zend_error(E_COMPILE_ERROR, "Cannot declare class %s because the name is already in use", Z_STRVAL(class_name->u.constant)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare class %s because the name is already in use", Z_STRVAL(class_name->u.constant)); } efree(tmp); } @@ -5078,13 +5071,13 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name if (parent_class_name && parent_class_name->op_type != IS_UNUSED) { switch (parent_class_name->EA) { case ZEND_FETCH_CLASS_SELF: - zend_error(E_COMPILE_ERROR, "Cannot use 'self' as class name as it is reserved"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'self' as class name as it is reserved"); break; case ZEND_FETCH_CLASS_PARENT: - zend_error(E_COMPILE_ERROR, "Cannot use 'parent' as class name as it is reserved"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'parent' as class name as it is reserved"); break; case ZEND_FETCH_CLASS_STATIC: - zend_error(E_COMPILE_ERROR, "Cannot use 'static' as class name as it is reserved"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'static' as class name as it is reserved"); break; default: break; @@ -5103,7 +5096,7 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name if (doing_inheritance) { /* Make sure a trait does not try to extend a class */ if ((new_class_entry->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) { - zend_error(E_COMPILE_ERROR, "A trait (%s) cannot extend a class. Traits can only be composed from other traits with the 'use' keyword. Error", new_class_entry->name); + zend_error_noreturn(E_COMPILE_ERROR, "A trait (%s) cannot extend a class. Traits can only be composed from other traits with the 'use' keyword. Error", new_class_entry->name); } opline->extended_value = parent_class_name->u.op.var; @@ -5148,19 +5141,19 @@ void zend_do_end_class_declaration(const znode *class_token, const znode *parent if (ce->constructor) { ce->constructor->common.fn_flags |= ZEND_ACC_CTOR; if (ce->constructor->common.fn_flags & ZEND_ACC_STATIC) { - zend_error(E_COMPILE_ERROR, "Constructor %s::%s() cannot be static", ce->name, ce->constructor->common.function_name); + zend_error_noreturn(E_COMPILE_ERROR, "Constructor %s::%s() cannot be static", ce->name, ce->constructor->common.function_name); } } if (ce->destructor) { ce->destructor->common.fn_flags |= ZEND_ACC_DTOR; if (ce->destructor->common.fn_flags & ZEND_ACC_STATIC) { - zend_error(E_COMPILE_ERROR, "Destructor %s::%s() cannot be static", ce->name, ce->destructor->common.function_name); + zend_error_noreturn(E_COMPILE_ERROR, "Destructor %s::%s() cannot be static", ce->name, ce->destructor->common.function_name); } } if (ce->clone) { ce->clone->common.fn_flags |= ZEND_ACC_CLONE; if (ce->clone->common.fn_flags & ZEND_ACC_STATIC) { - zend_error(E_COMPILE_ERROR, "Clone method %s::%s() cannot be static", ce->name, ce->clone->common.function_name); + zend_error_noreturn(E_COMPILE_ERROR, "Clone method %s::%s() cannot be static", ce->name, ce->clone->common.function_name); } } @@ -5209,7 +5202,7 @@ void zend_do_implements_interface(znode *interface_name TSRMLS_DC) /* {{{ */ /* Traits can not implement interfaces */ if ((CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) { - zend_error(E_COMPILE_ERROR, "Cannot use '%s' as interface on '%s' since it is a Trait", + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as interface on '%s' since it is a Trait", Z_STRVAL(interface_name->u.constant), CG(active_class_entry)->name); } @@ -5218,7 +5211,7 @@ void zend_do_implements_interface(znode *interface_name TSRMLS_DC) /* {{{ */ case ZEND_FETCH_CLASS_SELF: case ZEND_FETCH_CLASS_PARENT: case ZEND_FETCH_CLASS_STATIC: - zend_error(E_COMPILE_ERROR, "Cannot use '%s' as interface name as it is reserved", Z_STRVAL(interface_name->u.constant)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as interface name as it is reserved", Z_STRVAL(interface_name->u.constant)); break; default: break; @@ -5227,7 +5220,7 @@ void zend_do_implements_interface(znode *interface_name TSRMLS_DC) /* {{{ */ opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_ADD_INTERFACE; SET_NODE(opline->op1, &CG(implementing_class)); - zend_resolve_class_name(interface_name, opline->extended_value, 0 TSRMLS_CC); + zend_resolve_class_name(interface_name TSRMLS_CC); opline->extended_value = (opline->extended_value & ~ZEND_FETCH_CLASS_MASK) | ZEND_FETCH_CLASS_INTERFACE; opline->op2_type = IS_CONST; opline->op2.constant = zend_add_class_name_literal(CG(active_op_array), &interface_name->u.constant TSRMLS_CC); @@ -5240,7 +5233,7 @@ void zend_do_use_trait(znode *trait_name TSRMLS_DC) /* {{{ */ zend_op *opline; if ((CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE)) { - zend_error(E_COMPILE_ERROR, + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use traits inside of interfaces. %s is used in %s", Z_STRVAL(trait_name->u.constant), CG(active_class_entry)->name); } @@ -5250,7 +5243,7 @@ void zend_do_use_trait(znode *trait_name TSRMLS_DC) /* {{{ */ case ZEND_FETCH_CLASS_SELF: case ZEND_FETCH_CLASS_PARENT: case ZEND_FETCH_CLASS_STATIC: - zend_error(E_COMPILE_ERROR, "Cannot use '%s' as trait name as it is reserved", Z_STRVAL(trait_name->u.constant)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as trait name as it is reserved", Z_STRVAL(trait_name->u.constant)); break; default: break; @@ -5259,7 +5252,7 @@ void zend_do_use_trait(znode *trait_name TSRMLS_DC) /* {{{ */ opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_ADD_TRAIT; SET_NODE(opline->op1, &CG(implementing_class)); - zend_resolve_class_name(trait_name, opline->extended_value, 0 TSRMLS_CC); + zend_resolve_class_name(trait_name TSRMLS_CC); opline->extended_value = ZEND_FETCH_CLASS_TRAIT; opline->op2_type = IS_CONST; opline->op2.constant = zend_add_class_name_literal(CG(active_op_array), &trait_name->u.constant TSRMLS_CC); @@ -5339,20 +5332,20 @@ void zend_do_declare_property(const znode *var_name, const znode *value, zend_ui int comment_len = 0; if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) { - zend_error(E_COMPILE_ERROR, "Interfaces may not include member variables"); + zend_error_noreturn(E_COMPILE_ERROR, "Interfaces may not include member variables"); } if (access_type & ZEND_ACC_ABSTRACT) { - zend_error(E_COMPILE_ERROR, "Properties cannot be declared abstract"); + zend_error_noreturn(E_COMPILE_ERROR, "Properties cannot be declared abstract"); } if (access_type & ZEND_ACC_FINAL) { - zend_error(E_COMPILE_ERROR, "Cannot declare property %s::$%s final, the final modifier is allowed only for methods and classes", - CG(active_class_entry)->name, var_name->u.constant.value.str.val); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare property %s::$%s final, the final modifier is allowed only for methods and classes", + CG(active_class_entry)->name, Z_STRVAL(var_name->u.constant)); } - if (zend_hash_find(&CG(active_class_entry)->properties_info, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, (void **) &existing_property_info)==SUCCESS) { - zend_error(E_COMPILE_ERROR, "Cannot redeclare %s::$%s", CG(active_class_entry)->name, var_name->u.constant.value.str.val); + if (zend_hash_find(&CG(active_class_entry)->properties_info, Z_STRVAL(var_name->u.constant), Z_STRLEN(var_name->u.constant)+1, (void **) &existing_property_info)==SUCCESS) { + zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s::$%s", CG(active_class_entry)->name, Z_STRVAL(var_name->u.constant)); } ALLOC_ZVAL(property); @@ -5370,8 +5363,8 @@ void zend_do_declare_property(const znode *var_name, const znode *value, zend_ui CG(doc_comment_len) = 0; } - zend_declare_property_ex(CG(active_class_entry), zend_new_interned_string(var_name->u.constant.value.str.val, var_name->u.constant.value.str.len + 1, 0 TSRMLS_CC), var_name->u.constant.value.str.len, property, access_type, comment, comment_len TSRMLS_CC); - efree(var_name->u.constant.value.str.val); + zend_declare_property_ex(CG(active_class_entry), zend_new_interned_string(Z_STRVAL(var_name->u.constant), Z_STRLEN(var_name->u.constant) + 1, 0 TSRMLS_CC), Z_STRLEN(var_name->u.constant), property, access_type, comment, comment_len TSRMLS_CC); + efree(Z_STRVAL(var_name->u.constant)); } /* }}} */ @@ -5379,30 +5372,25 @@ void zend_do_declare_class_constant(znode *var_name, const znode *value TSRMLS_D { zval *property; const char *cname = NULL; - int result; + zend_ulong hash; if(Z_TYPE(value->u.constant) == IS_CONSTANT_ARRAY) { - zend_error(E_COMPILE_ERROR, "Arrays are not allowed in class constants"); + zend_error_noreturn(E_COMPILE_ERROR, "Arrays are not allowed in class constants"); return; } if ((CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) { - zend_error(E_COMPILE_ERROR, "Traits cannot have constants"); + zend_error_noreturn(E_COMPILE_ERROR, "Traits cannot have constants"); return; } ALLOC_ZVAL(property); *property = value->u.constant; - cname = zend_new_interned_string(var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, 0 TSRMLS_CC); - - if (IS_INTERNED(cname)) { - result = zend_hash_quick_add(&CG(active_class_entry)->constants_table, cname, var_name->u.constant.value.str.len+1, INTERNED_HASH(cname), &property, sizeof(zval *), NULL); - } else { - result = zend_hash_add(&CG(active_class_entry)->constants_table, cname, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL); - } - if (result == FAILURE) { + cname = zend_new_interned_string(Z_STRVAL(var_name->u.constant), Z_STRLEN(var_name->u.constant)+1, 0 TSRMLS_CC); + hash = str_hash(cname, Z_STRLEN(var_name->u.constant)); + if (zend_hash_quick_add(&CG(active_class_entry)->constants_table, cname, Z_STRLEN(var_name->u.constant)+1, hash, &property, sizeof(zval *), NULL) == FAILURE) { FREE_ZVAL(property); - zend_error(E_COMPILE_ERROR, "Cannot redefine class constant %s::%s", CG(active_class_entry)->name, var_name->u.constant.value.str.val); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot redefine class constant %s::%s", CG(active_class_entry)->name, Z_STRVAL(var_name->u.constant)); } FREE_PNODE(var_name); @@ -5496,7 +5484,7 @@ void zend_do_halt_compiler_register(TSRMLS_D) /* {{{ */ int len, clen; if (CG(has_bracketed_namespaces) && CG(in_namespace)) { - zend_error(E_COMPILE_ERROR, "__HALT_COMPILER() can only be used from the outermost scope"); + zend_error_noreturn(E_COMPILE_ERROR, "__HALT_COMPILER() can only be used from the outermost scope"); } cfilename = zend_get_compiled_filename(TSRMLS_C); @@ -5638,7 +5626,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con if (ZEND_FETCH_CLASS_STATIC == type) { zend_error(E_ERROR, "\"static::\" is not allowed in compile-time constants"); } else if (ZEND_FETCH_CLASS_DEFAULT == type) { - zend_resolve_class_name(constant_container, fetch_type, 1 TSRMLS_CC); + zend_resolve_class_name(constant_container TSRMLS_CC); } zend_do_build_full_name(NULL, constant_container, constant_name, 1 TSRMLS_CC); *result = *constant_container; @@ -5647,7 +5635,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con case ZEND_RT: if (constant_container->op_type == IS_CONST && ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(constant_container->u.constant), Z_STRLEN(constant_container->u.constant))) { - zend_resolve_class_name(constant_container, fetch_type, 1 TSRMLS_CC); + zend_resolve_class_name(constant_container TSRMLS_CC); } else { zend_do_fetch_class(&tmp, constant_container TSRMLS_CC); constant_container = &tmp; @@ -5847,11 +5835,11 @@ void zend_do_add_static_array_element(znode *result, znode *offset, const znode Z_STRVAL(offset->u.constant) = erealloc(Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3); Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+1] = Z_TYPE(offset->u.constant); Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+2] = 0; - zend_symtable_update(result->u.constant.value.ht, Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3, &element, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL(result->u.constant), Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3, &element, sizeof(zval *), NULL); zval_dtor(&offset->u.constant); break; case IS_STRING: - zend_symtable_update(result->u.constant.value.ht, offset->u.constant.value.str.val, offset->u.constant.value.str.len+1, &element, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL(result->u.constant), Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+1, &element, sizeof(zval *), NULL); zval_dtor(&offset->u.constant); break; case IS_NULL: @@ -6028,7 +6016,7 @@ void zend_do_fetch_static_variable(znode *varname, const znode *static_assignmen ALLOC_HASHTABLE(CG(active_op_array)->static_variables); zend_hash_init(CG(active_op_array)->static_variables, 2, NULL, ZVAL_PTR_DTOR, 0); } - zend_hash_update(CG(active_op_array)->static_variables, varname->u.constant.value.str.val, varname->u.constant.value.str.len+1, &tmp, sizeof(zval *), NULL); + zend_hash_update(CG(active_op_array)->static_variables, Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant)+1, &tmp, sizeof(zval *), NULL); if (varname->op_type == IS_CONST) { if (Z_TYPE(varname->u.constant) != IS_STRING) { @@ -6072,7 +6060,7 @@ void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC) if (Z_STRLEN(varname->u.constant) == sizeof("this") - 1 && memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this") - 1) == 0) { - zend_error(E_COMPILE_ERROR, "Cannot use $this as lexical variable"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use $this as lexical variable"); return; } @@ -6157,7 +6145,7 @@ void zend_do_indirect_references(znode *result, const znode *num_references, zno int i; zend_do_end_variable_parse(variable, BP_VAR_R, 0 TSRMLS_CC); - for (i=1; iu.constant.value.lval; i++) { + for (i=1; iu.constant); i++) { fetch_simple_variable_ex(result, variable, 0, ZEND_FETCH_R TSRMLS_CC); *variable = *result; } @@ -6216,7 +6204,7 @@ void zend_do_isset_or_isempty(int type, znode *result, znode *variable TSRMLS_DC /* empty(func()) can be transformed to !func() */ zend_do_unary_op(ZEND_BOOL_NOT, result, variable TSRMLS_CC); } else { - zend_error(E_COMPILE_ERROR, "Cannot use isset() on the result of a function call (you can use \"null !== func()\" instead)"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use isset() on the result of a function call (you can use \"null !== func()\" instead)"); } return; @@ -6264,7 +6252,7 @@ void zend_do_instanceof(znode *result, const znode *expr, const znode *class_zno } if (expr->op_type == IS_CONST) { - zend_error(E_COMPILE_ERROR, "instanceof expects an object instance, constant given"); + zend_error_noreturn(E_COMPILE_ERROR, "instanceof expects an object instance, constant given"); } opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -6283,7 +6271,6 @@ void zend_do_foreach_begin(znode *foreach_token, znode *open_brackets_token, zno { zend_op *opline; zend_bool is_variable; - zend_bool push_container = 0; zend_op dummy_opline; if (variable) { @@ -6295,14 +6282,6 @@ void zend_do_foreach_begin(znode *foreach_token, znode *open_brackets_token, zno /* save the location of FETCH_W instruction(s) */ open_brackets_token->u.op.opline_num = get_next_op_number(CG(active_op_array)); zend_do_end_variable_parse(array, BP_VAR_W, 0 TSRMLS_CC); - if (CG(active_op_array)->last > 0 && - CG(active_op_array)->opcodes[CG(active_op_array)->last-1].opcode == ZEND_FETCH_OBJ_W) { - /* Only lock the container if we are fetching from a real container and not $this */ - if (CG(active_op_array)->opcodes[CG(active_op_array)->last-1].op1_type == IS_VAR) { - CG(active_op_array)->opcodes[CG(active_op_array)->last-1].extended_value |= ZEND_FETCH_ADD_LOCK; - push_container = 1; - } - } } else { is_variable = 0; open_brackets_token->u.op.opline_num = get_next_op_number(CG(active_op_array)); @@ -6322,11 +6301,6 @@ void zend_do_foreach_begin(znode *foreach_token, znode *open_brackets_token, zno opline->extended_value = is_variable ? ZEND_FE_RESET_VARIABLE : 0; COPY_NODE(dummy_opline.result, opline->result); - if (push_container) { - COPY_NODE(dummy_opline.op1, CG(active_op_array)->opcodes[CG(active_op_array)->last-2].op1); - } else { - dummy_opline.op1_type = IS_UNUSED; - } zend_stack_push(&CG(foreach_copy_stack), (void *) &dummy_opline, sizeof(zend_op)); /* save the location of FE_FETCH */ @@ -6369,10 +6343,10 @@ void zend_do_foreach_cont(znode *foreach_token, const znode *open_brackets_token if ((key->op_type != IS_UNUSED)) { if (key->EA & ZEND_PARSED_REFERENCE_VARIABLE) { - zend_error(E_COMPILE_ERROR, "Key element cannot be a reference"); + zend_error_noreturn(E_COMPILE_ERROR, "Key element cannot be a reference"); } if (key->EA & ZEND_PARSED_LIST_EXPR) { - zend_error(E_COMPILE_ERROR, "Cannot use list as key element"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use list as key element"); } } @@ -6383,7 +6357,6 @@ void zend_do_foreach_cont(znode *foreach_token, const znode *open_brackets_token opline->extended_value |= ZEND_FE_FETCH_BYREF; CG(active_op_array)->opcodes[foreach_token->u.op.opline_num].extended_value |= ZEND_FE_RESET_REFERENCE; } else { - zend_op *foreach_copy; zend_op *fetch = &CG(active_op_array)->opcodes[foreach_token->u.op.opline_num]; zend_op *end = &CG(active_op_array)->opcodes[open_brackets_token->u.op.opline_num]; @@ -6392,7 +6365,7 @@ void zend_do_foreach_cont(znode *foreach_token, const znode *open_brackets_token while (fetch != end) { --fetch; if (fetch->opcode == ZEND_FETCH_DIM_W && fetch->op2_type == IS_UNUSED) { - zend_error(E_COMPILE_ERROR, "Cannot use [] for reading"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use [] for reading"); } if (fetch->opcode == ZEND_SEPARATE) { MAKE_NOP(fetch); @@ -6400,16 +6373,13 @@ void zend_do_foreach_cont(znode *foreach_token, const znode *open_brackets_token fetch->opcode -= 3; /* FETCH_W -> FETCH_R */ } } - /* prevent double SWITCH_FREE */ - zend_stack_top(&CG(foreach_copy_stack), (void **) &foreach_copy); - foreach_copy->op1_type = IS_UNUSED; } GET_NODE(&value_node, opline->result); if (value->EA & ZEND_PARSED_LIST_EXPR) { if (!CG(list_llist).head) { - zend_error(E_COMPILE_ERROR, "Cannot use empty list"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use empty list"); } zend_do_list_end(&dummy, &value_node TSRMLS_CC); zend_do_free(&dummy TSRMLS_CC); @@ -6472,12 +6442,12 @@ void zend_do_declare_begin(TSRMLS_D) /* {{{ */ void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC) /* {{{ */ { - if (!zend_binary_strcasecmp(var->u.constant.value.str.val, var->u.constant.value.str.len, "ticks", sizeof("ticks")-1)) { + if (!zend_binary_strcasecmp(Z_STRVAL(var->u.constant), Z_STRLEN(var->u.constant), "ticks", sizeof("ticks")-1)) { convert_to_long(&val->u.constant); CG(declarables).ticks = val->u.constant; - } else if (!zend_binary_strcasecmp(var->u.constant.value.str.val, var->u.constant.value.str.len, "encoding", sizeof("encoding")-1)) { + } else if (!zend_binary_strcasecmp(Z_STRVAL(var->u.constant), Z_STRLEN(var->u.constant), "encoding", sizeof("encoding")-1)) { if ((Z_TYPE(val->u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { - zend_error(E_COMPILE_ERROR, "Cannot use constants as encoding"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use constants as encoding"); } /* @@ -6496,7 +6466,7 @@ void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC) /* {{{ */ } if (num > 0) { - zend_error(E_COMPILE_ERROR, "Encoding declaration pragma must be the very first statement in the script"); + zend_error_noreturn(E_COMPILE_ERROR, "Encoding declaration pragma must be the very first statement in the script"); } } @@ -6507,9 +6477,9 @@ void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC) /* {{{ */ CG(encoding_declared) = 1; convert_to_string(&val->u.constant); - new_encoding = zend_multibyte_fetch_encoding(val->u.constant.value.str.val TSRMLS_CC); + new_encoding = zend_multibyte_fetch_encoding(Z_STRVAL(val->u.constant) TSRMLS_CC); if (!new_encoding) { - zend_error(E_COMPILE_WARNING, "Unsupported encoding [%s]", val->u.constant.value.str.val); + zend_error(E_COMPILE_WARNING, "Unsupported encoding [%s]", Z_STRVAL(val->u.constant)); } else { old_input_filter = LANG_SCNG(input_filter); old_encoding = LANG_SCNG(script_encoding); @@ -6526,7 +6496,7 @@ void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC) /* {{{ */ } zval_dtor(&val->u.constant); } else { - zend_error(E_COMPILE_WARNING, "Unsupported declare '%s'", var->u.constant.value.str.val); + zend_error(E_COMPILE_WARNING, "Unsupported declare '%s'", Z_STRVAL(var->u.constant)); zval_dtor(&val->u.constant); } zval_dtor(&var->u.constant); @@ -6766,10 +6736,9 @@ void zend_do_ticks(TSRMLS_D) /* {{{ */ } /* }}} */ -zend_bool zend_is_auto_global_quick(const char *name, uint name_len, ulong hashval TSRMLS_DC) /* {{{ */ +zend_bool zend_is_auto_global_quick(const char *name, uint name_len, ulong hash TSRMLS_DC) /* {{{ */ { zend_auto_global *auto_global; - ulong hash = hashval ? hashval : zend_hash_func(name, name_len+1); if (zend_hash_quick_find(CG(auto_globals), name, name_len+1, hash, (void **) &auto_global)==SUCCESS) { if (auto_global->armed) { @@ -6783,7 +6752,7 @@ zend_bool zend_is_auto_global_quick(const char *name, uint name_len, ulong hashv zend_bool zend_is_auto_global(const char *name, uint name_len TSRMLS_DC) /* {{{ */ { - return zend_is_auto_global_quick(name, name_len, 0 TSRMLS_CC); + return zend_is_auto_global_quick(name, name_len, zend_hash_func(name, name_len+1) TSRMLS_CC); } /* }}} */ @@ -6993,15 +6962,15 @@ void zend_do_begin_namespace(const znode *name, zend_bool with_bracket TSRMLS_DC if (CG(current_namespace)) { /* previous namespace declarations were unbracketed */ if (with_bracket) { - zend_error(E_COMPILE_ERROR, "Cannot mix bracketed namespace declarations with unbracketed namespace declarations"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot mix bracketed namespace declarations with unbracketed namespace declarations"); } } } else { /* previous namespace declarations were bracketed */ if (!with_bracket) { - zend_error(E_COMPILE_ERROR, "Cannot mix bracketed namespace declarations with unbracketed namespace declarations"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot mix bracketed namespace declarations with unbracketed namespace declarations"); } else if (CG(current_namespace) || CG(in_namespace)) { - zend_error(E_COMPILE_ERROR, "Namespace declarations cannot be nested"); + zend_error_noreturn(E_COMPILE_ERROR, "Namespace declarations cannot be nested"); } } @@ -7014,7 +6983,7 @@ void zend_do_begin_namespace(const znode *name, zend_bool with_bracket TSRMLS_DC --num; } if (num > 0) { - zend_error(E_COMPILE_ERROR, "Namespace declaration statement has to be the very first statement in the script"); + zend_error_noreturn(E_COMPILE_ERROR, "Namespace declaration statement has to be the very first statement in the script"); } } @@ -7029,7 +6998,7 @@ void zend_do_begin_namespace(const znode *name, zend_bool with_bracket TSRMLS_DC !memcmp(lcname, "self", sizeof("self")-1)) || ((Z_STRLEN(name->u.constant) == sizeof("parent")-1) && !memcmp(lcname, "parent", sizeof("parent")-1))) { - zend_error(E_COMPILE_ERROR, "Cannot use '%s' as namespace name", Z_STRVAL(name->u.constant)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as namespace name", Z_STRVAL(name->u.constant)); } efree(lcname); @@ -7086,7 +7055,7 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{ } ALLOC_ZVAL(ns); - *ns = ns_name->u.constant; + ZVAL_ZVAL(ns, &ns_name->u.constant, 0, 0); if (new_name) { name = &new_name->u.constant; } else { @@ -7099,8 +7068,7 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{ if (p) { ZVAL_STRING(name, p+1, 1); } else { - *name = *ns; - zval_copy_ctor(name); + ZVAL_ZVAL(name, ns, 1, 0); warn = !is_global && !CG(current_namespace); } } @@ -7111,7 +7079,7 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{ !memcmp(lcname, "self", sizeof("self")-1)) || ((Z_STRLEN_P(name) == sizeof("parent")-1) && !memcmp(lcname, "parent", sizeof("parent")-1))) { - zend_error(E_COMPILE_ERROR, "Cannot use %s as %s because '%s' is a special class name", Z_STRVAL_P(ns), Z_STRVAL_P(name), Z_STRVAL_P(name)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because '%s' is a special class name", Z_STRVAL_P(ns), Z_STRVAL_P(name), Z_STRVAL_P(name)); } if (CG(current_namespace)) { @@ -7126,7 +7094,7 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{ if (Z_STRLEN_P(ns) != Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name) || memcmp(tmp2, c_ns_name, Z_STRLEN_P(ns))) { - zend_error(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name)); } efree(tmp2); } @@ -7138,17 +7106,17 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{ if (Z_STRLEN_P(ns) != Z_STRLEN_P(name) || memcmp(c_tmp, lcname, Z_STRLEN_P(ns))) { - zend_error(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name)); } efree(c_tmp); } if (zend_hash_add(CG(current_import), lcname, Z_STRLEN_P(name)+1, &ns, sizeof(zval*), NULL) != SUCCESS) { - zend_error(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name)); } if (warn) { if (!strcmp(Z_STRVAL_P(name), "strict")) { - zend_error(E_COMPILE_ERROR, "You seem to be trying to use a different language..."); + zend_error_noreturn(E_COMPILE_ERROR, "You seem to be trying to use a different language..."); } zend_error(E_WARNING, "The use statement with non-compound name '%s' has no effect", Z_STRVAL_P(name)); } @@ -7164,7 +7132,7 @@ void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int i zend_bool warn = 0; ALLOC_ZVAL(ns); - *ns = ns_name->u.constant; + ZVAL_ZVAL(ns, &ns_name->u.constant, 0, 0); if (new_name) { name = &new_name->u.constant; } else { @@ -7177,8 +7145,7 @@ void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int i if (p) { ZVAL_STRING(name, p+1, 1); } else { - *name = *ns; - zval_copy_ctor(name); + ZVAL_ZVAL(name, ns, 1, 0); warn = !is_global && !CG(current_namespace); } } @@ -7271,11 +7238,11 @@ void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC) /* {{{ */ zval **ns_name; if(Z_TYPE(value->u.constant) == IS_CONSTANT_ARRAY) { - zend_error(E_COMPILE_ERROR, "Arrays are not allowed as constants"); + zend_error_noreturn(E_COMPILE_ERROR, "Arrays are not allowed as constants"); } if (zend_get_ct_const(&name->u.constant, 0 TSRMLS_CC)) { - zend_error(E_COMPILE_ERROR, "Cannot redeclare constant '%s'", Z_STRVAL(name->u.constant)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare constant '%s'", Z_STRVAL(name->u.constant)); } if (CG(current_namespace)) { @@ -7315,7 +7282,7 @@ void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC) /* {{{ */ void zend_verify_namespace(TSRMLS_D) /* {{{ */ { if (CG(has_bracketed_namespaces) && !CG(in_namespace)) { - zend_error(E_COMPILE_ERROR, "No code may exist outside of namespace {}"); + zend_error_noreturn(E_COMPILE_ERROR, "No code may exist outside of namespace {}"); } } /* }}} */ diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 53bff384702dc..c1a8e6fcafe97 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -74,7 +74,7 @@ typedef struct _zend_literal { #define Z_HASH_P(zv) \ (((zend_literal*)(zv))->hash_value) -typedef union _znode_op { +typedef union _znode_op { zend_uint constant; zend_uint var; zend_uint num; @@ -86,7 +86,7 @@ typedef union _znode_op { void *ptr; /* Used for passing pointers from the compile to execution phase, currently used for traits */ } znode_op; -typedef struct _znode { /* used only during compilation */ +typedef struct _znode { /* used only during compilation */ int op_type; union { znode_op op; @@ -207,8 +207,7 @@ typedef struct _zend_try_catch_element { /* disable inline caching */ #define ZEND_ACC_NEVER_CACHE 0x400000 -#define ZEND_ACC_PASS_REST_BY_REFERENCE 0x1000000 -#define ZEND_ACC_PASS_REST_PREFER_REF 0x2000000 +#define ZEND_ACC_VARIADIC 0x1000000 #define ZEND_ACC_RETURN_REFERENCE 0x4000000 #define ZEND_ACC_DONE_PASS_TWO 0x8000000 @@ -234,12 +233,13 @@ typedef struct _zend_arg_info { const char *class_name; zend_uint class_name_len; zend_uchar type_hint; + zend_uchar pass_by_reference; zend_bool allow_null; - zend_bool pass_by_reference; + zend_bool is_variadic; } zend_arg_info; /* the following structure repeats the layout of zend_arg_info, - * but its fields have different meaning. It's used as the first element of + * but its fields have different meaning. It's used as the first element of * arg_info array to define properties of internal functions. */ typedef struct _zend_internal_function_info { @@ -249,7 +249,8 @@ typedef struct _zend_internal_function_info { zend_uint required_num_args; zend_uchar _type_hint; zend_bool return_reference; - zend_bool pass_rest_by_reference; + zend_bool _allow_null; + zend_bool _is_variadic; } zend_internal_function_info; typedef struct _zend_compiled_variable { @@ -261,7 +262,7 @@ typedef struct _zend_compiled_variable { struct _zend_op_array { /* Common elements */ zend_uchar type; - const char *function_name; + const char *function_name; zend_class_entry *scope; zend_uint fn_flags; union _zend_function *prototype; @@ -440,7 +441,7 @@ ZEND_API size_t zend_get_scanned_file_offset(TSRMLS_D); void zend_resolve_non_class_name(znode *element_name, zend_bool *check_namespace, zend_bool case_sensitive, HashTable *current_import_sub TSRMLS_DC); void zend_resolve_function_name(znode *element_name, zend_bool *check_namespace TSRMLS_DC); void zend_resolve_const_name(znode *element_name, zend_bool *check_namespace TSRMLS_DC); -void zend_resolve_class_name(znode *class_name, ulong fetch_type, int check_ns_name TSRMLS_DC); +void zend_resolve_class_name(znode *class_name TSRMLS_DC); ZEND_API const char* zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var, int* name_len); #ifdef ZTS @@ -502,7 +503,7 @@ void zend_do_add_variable(znode *result, const znode *op1, const znode *op2 TSRM int zend_do_verify_access_types(const znode *current_access_type, const znode *new_modifier); void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference, znode *fn_flags_znode TSRMLS_DC); void zend_do_end_function_declaration(const znode *function_token TSRMLS_DC); -void zend_do_receive_arg(zend_uchar op, znode *varname, const znode *offset, const znode *initialization, znode *class_type, zend_bool pass_by_reference TSRMLS_DC); +void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initialization, znode *class_type, zend_bool pass_by_reference, zend_bool is_variadic TSRMLS_DC); int zend_do_begin_function_call(znode *function_name, zend_bool check_namespace TSRMLS_DC); void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC); void zend_do_clone(znode *result, const znode *expr TSRMLS_DC); @@ -679,7 +680,7 @@ void zend_class_add_ref(zend_class_entry **ce); ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, const char *src1, int src1_length, const char *src2, int src2_length, int internal); #define zend_unmangle_property_name(mangled_property, mangled_property_len, class_name, prop_name) \ - zend_unmangle_property_name_ex(mangled_property, mangled_property_len, class_name, prop_name, NULL) + zend_unmangle_property_name_ex(mangled_property, mangled_property_len, class_name, prop_name, NULL) ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, int mangled_property_len, const char **class_name, const char **prop_name, int *prop_len); #define ZEND_FUNCTION_DTOR (void (*)(void *)) zend_function_dtor @@ -731,8 +732,8 @@ int zend_add_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC); #define ZEND_FETCH_CLASS_DEFAULT 0 #define ZEND_FETCH_CLASS_SELF 1 #define ZEND_FETCH_CLASS_PARENT 2 -#define ZEND_FETCH_CLASS_MAIN 3 -#define ZEND_FETCH_CLASS_GLOBAL 4 +#define ZEND_FETCH_CLASS_MAIN 3 /* unused */ +#define ZEND_FETCH_CLASS_GLOBAL 4 /* unused */ #define ZEND_FETCH_CLASS_AUTO 5 #define ZEND_FETCH_CLASS_INTERFACE 6 #define ZEND_FETCH_CLASS_STATIC 7 @@ -822,21 +823,21 @@ int zend_add_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC); #define ZEND_SEND_BY_REF 1 #define ZEND_SEND_PREFER_REF 2 -#define CHECK_ARG_SEND_TYPE(zf, arg_num, m1, m2) \ - ((zf) && \ - ((((zend_function*)(zf))->common.arg_info && \ - arg_num <= ((zend_function*)(zf))->common.num_args) ? \ - (((zend_function *)(zf))->common.arg_info[arg_num-1].pass_by_reference & (m1)) : \ - (((zend_function *)(zf))->common.fn_flags & (m2)))) +#define CHECK_ARG_SEND_TYPE(zf, arg_num, m) \ + ((zf)->common.arg_info && \ + (arg_num <= (zf)->common.num_args \ + ? ((zf)->common.arg_info[arg_num-1].pass_by_reference & (m)) \ + : ((zf)->common.fn_flags & ZEND_ACC_VARIADIC) \ + ? ((zf)->common.arg_info[(zf)->common.num_args-1].pass_by_reference & (m)) : 0)) #define ARG_MUST_BE_SENT_BY_REF(zf, arg_num) \ - CHECK_ARG_SEND_TYPE(zf, arg_num, ZEND_SEND_BY_REF, ZEND_ACC_PASS_REST_BY_REFERENCE) + CHECK_ARG_SEND_TYPE(zf, arg_num, ZEND_SEND_BY_REF) #define ARG_SHOULD_BE_SENT_BY_REF(zf, arg_num) \ - CHECK_ARG_SEND_TYPE(zf, arg_num, ZEND_SEND_BY_REF|ZEND_SEND_PREFER_REF, ZEND_ACC_PASS_REST_BY_REFERENCE|ZEND_ACC_PASS_REST_PREFER_REF) + CHECK_ARG_SEND_TYPE(zf, arg_num, ZEND_SEND_BY_REF|ZEND_SEND_PREFER_REF) #define ARG_MAY_BE_SENT_BY_REF(zf, arg_num) \ - CHECK_ARG_SEND_TYPE(zf, arg_num, ZEND_SEND_PREFER_REF, ZEND_ACC_PASS_REST_PREFER_REF) + CHECK_ARG_SEND_TYPE(zf, arg_num, ZEND_SEND_PREFER_REF) #define ZEND_RETURN_VAL 0 #define ZEND_RETURN_REF 1 diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index 594559d58bf06..a53af497cc8d4 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -38,9 +38,7 @@ void free_zend_constant(zend_constant *c) void copy_zend_constant(zend_constant *c) { - if (!IS_INTERNED(c->name)) { - c->name = zend_strndup(c->name, c->name_len - 1); - } + c->name = str_strndup(c->name, c->name_len - 1); if (!(c->flags & CONST_PERSISTENT)) { zval_copy_ctor(&c->value); } @@ -474,7 +472,7 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC) char *lowercase_name = NULL; char *name; int ret = SUCCESS; - ulong chash = 0; + ulong chash; #if 0 printf("Registering constant for module %d\n", c->module_number); @@ -486,23 +484,18 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC) zend_str_tolower(lowercase_name, c->name_len-1); lowercase_name = (char*)zend_new_interned_string(lowercase_name, c->name_len, 1 TSRMLS_CC); name = lowercase_name; - chash = IS_INTERNED(lowercase_name) ? INTERNED_HASH(lowercase_name) : 0; } else { char *slash = strrchr(c->name, '\\'); - if(slash) { + if (slash) { lowercase_name = estrndup(c->name, c->name_len-1); zend_str_tolower(lowercase_name, slash-c->name); lowercase_name = (char*)zend_new_interned_string(lowercase_name, c->name_len, 1 TSRMLS_CC); name = lowercase_name; - - chash = IS_INTERNED(lowercase_name) ? INTERNED_HASH(lowercase_name) : 0; } else { name = c->name; } } - if (chash == 0) { - chash = zend_hash_func(name, c->name_len); - } + chash = str_hash(name, c->name_len-1); /* Check if the user is trying to define the internal pseudo constant name __COMPILER_HALT_OFFSET__ */ if ((c->name_len == sizeof("__COMPILER_HALT_OFFSET__") @@ -521,8 +514,8 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC) } ret = FAILURE; } - if (lowercase_name && !IS_INTERNED(lowercase_name)) { - efree(lowercase_name); + if (lowercase_name) { + str_efree(lowercase_name); } return ret; } diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 14ae75e38d096..c7f157c4d5f2d 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -560,7 +560,7 @@ ZEND_METHOD(exception, getPrevious) RETURN_ZVAL(previous, 1, 0); } -int zend_spprintf(char **message, int max_len, char *format, ...) /* {{{ */ +int zend_spprintf(char **message, int max_len, const char *format, ...) /* {{{ */ { va_list arg; int len; @@ -732,7 +732,7 @@ ZEND_API zend_class_entry *zend_get_error_exception(TSRMLS_D) /* {{{ */ } /* }}} */ -ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC) /* {{{ */ +ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char *message, long code TSRMLS_DC) /* {{{ */ { zval *ex; @@ -760,7 +760,7 @@ ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, char *messa } /* }}} */ -ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, char *format, ...) /* {{{ */ +ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *format, ...) /* {{{ */ { va_list arg; char *message; @@ -775,7 +775,7 @@ ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long cod } /* }}} */ -ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, char *message, long code, int severity TSRMLS_DC) /* {{{ */ +ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, long code, int severity TSRMLS_DC) /* {{{ */ { zval *ex = zend_throw_exception(exception_ce, message, code TSRMLS_CC); zend_update_property_long(default_exception_ce, ex, "severity", sizeof("severity")-1, severity TSRMLS_CC); diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h index 82633530d61ad..81c8a1f21333e 100644 --- a/Zend/zend_exceptions.h +++ b/Zend/zend_exceptions.h @@ -40,12 +40,12 @@ ZEND_API void zend_register_default_classes(TSRMLS_D); /* exception_ce NULL or zend_exception_get_default() or a derived class * message NULL or the message of the exception */ -ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC); -ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, char *format, ...); +ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char *message, long code TSRMLS_DC); +ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *format, ...); ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC); ZEND_API void zend_clear_exception(TSRMLS_D); -ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, char *message, long code, int severity TSRMLS_DC); +ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, long code, int severity TSRMLS_DC); extern ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC); @@ -53,7 +53,7 @@ extern ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC); ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC); /* do not export, in php it's available thru spprintf directly */ -int zend_spprintf(char **message, int max_len, char *format, ...); +int zend_spprintf(char **message, int max_len, const char *format, ...); END_EXTERN_C() diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 3c3dd8e3b0b57..77e67e6cbbfc9 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -40,7 +40,7 @@ #include "zend_dtrace.h" /* Virtual current working directory support */ -#include "tsrm_virtual_cwd.h" +#include "zend_virtual_cwd.h" #define _CONST_CODE 0 #define _TMP_CODE 1 @@ -79,7 +79,6 @@ static zend_always_inline void zend_pzval_unlock_func(zval *z, zend_free_op *sho if (unref && Z_ISREF_P(z) && Z_REFCOUNT_P(z) == 1) { Z_UNSET_ISREF_P(z); } - GC_ZVAL_CHECK_POSSIBLE_ROOT(z); } } @@ -94,7 +93,8 @@ static zend_always_inline void zend_pzval_unlock_free_func(zval *z TSRMLS_DC) } #undef zval_ptr_dtor -#define zval_ptr_dtor(pzv) i_zval_ptr_dtor(*(pzv) ZEND_FILE_LINE_CC) +#define zval_ptr_dtor(pzv) i_zval_ptr_dtor(*(pzv) ZEND_FILE_LINE_CC TSRMLS_CC) +#define zval_ptr_dtor_nogc(pzv) i_zval_ptr_dtor_nogc(*(pzv) ZEND_FILE_LINE_CC TSRMLS_CC) #define PZVAL_UNLOCK(z, f) zend_pzval_unlock_func(z, f, 1 TSRMLS_CC) #define PZVAL_UNLOCK_EX(z, f, u) zend_pzval_unlock_func(z, f, u TSRMLS_CC) @@ -125,18 +125,18 @@ static zend_always_inline void zend_pzval_unlock_free_func(zval *z TSRMLS_DC) if ((zend_uintptr_t)should_free.var & 1L) { \ zval_dtor((zval*)((zend_uintptr_t)should_free.var & ~1L)); \ } else { \ - zval_ptr_dtor(&should_free.var); \ + zval_ptr_dtor_nogc(&should_free.var); \ } \ } #define FREE_OP_IF_VAR(should_free) \ if (should_free.var != NULL && (((zend_uintptr_t)should_free.var & 1L) == 0)) { \ - zval_ptr_dtor(&should_free.var); \ + zval_ptr_dtor_nogc(&should_free.var); \ } #define FREE_OP_VAR_PTR(should_free) \ if (should_free.var) { \ - zval_ptr_dtor(&should_free.var); \ + zval_ptr_dtor_nogc(&should_free.var); \ } #define TMP_FREE(z) (zval*)(((zend_uintptr_t)(z)) | 1L) @@ -616,12 +616,17 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva char *need_msg; zend_class_entry *ce; - if (!zf->common.arg_info - || arg_num>zf->common.num_args) { + if (!zf->common.arg_info) { return 1; } - cur_arg_info = &zf->common.arg_info[arg_num-1]; + if (arg_num <= zf->common.num_args) { + cur_arg_info = &zf->common.arg_info[arg_num-1]; + } else if (zf->common.fn_flags & ZEND_ACC_VARIADIC) { + cur_arg_info = &zf->common.arg_info[zf->common.num_args-1]; + } else { + return 1; + } if (cur_arg_info->class_name) { const char *class_name; @@ -767,32 +772,21 @@ static inline void zend_assign_to_object(zval **retval, zval **object_ptr, zval static inline int zend_assign_to_string_offset(const temp_variable *T, const zval *value, int value_type TSRMLS_DC) { - if (Z_TYPE_P(T->str_offset.str) == IS_STRING) { - - if (((int)T->str_offset.offset < 0)) { - zend_error(E_WARNING, "Illegal string offset: %d", T->str_offset.offset); + zval *str = T->str_offset.str; + zend_uint offset = T->str_offset.offset; + if (Z_TYPE_P(str) == IS_STRING) { + if ((int)offset < 0) { + zend_error(E_WARNING, "Illegal string offset: %d", offset); return 0; } - if (T->str_offset.offset >= Z_STRLEN_P(T->str_offset.str)) { - if (IS_INTERNED(Z_STRVAL_P(T->str_offset.str))) { - char *tmp = (char *) emalloc(T->str_offset.offset+1+1); - - memcpy(tmp, Z_STRVAL_P(T->str_offset.str), Z_STRLEN_P(T->str_offset.str)+1); - Z_STRVAL_P(T->str_offset.str) = tmp; - } else { - Z_STRVAL_P(T->str_offset.str) = (char *) erealloc(Z_STRVAL_P(T->str_offset.str), T->str_offset.offset+1+1); - } - memset(Z_STRVAL_P(T->str_offset.str) + Z_STRLEN_P(T->str_offset.str), - ' ', - T->str_offset.offset - Z_STRLEN_P(T->str_offset.str)); - Z_STRVAL_P(T->str_offset.str)[T->str_offset.offset+1] = 0; - Z_STRLEN_P(T->str_offset.str) = T->str_offset.offset+1; - } else if (IS_INTERNED(Z_STRVAL_P(T->str_offset.str))) { - char *tmp = (char *) emalloc(Z_STRLEN_P(T->str_offset.str) + 1); - - memcpy(tmp, Z_STRVAL_P(T->str_offset.str), Z_STRLEN_P(T->str_offset.str) + 1); - Z_STRVAL_P(T->str_offset.str) = tmp; + if (offset >= Z_STRLEN_P(str)) { + Z_STRVAL_P(str) = str_erealloc(Z_STRVAL_P(str), offset+1+1); + memset(Z_STRVAL_P(str) + Z_STRLEN_P(str), ' ', offset - Z_STRLEN_P(str)); + Z_STRVAL_P(str)[offset+1] = 0; + Z_STRLEN_P(str) = offset+1; + } else if (IS_INTERNED(Z_STRVAL_P(str))) { + Z_STRVAL_P(str) = estrndup(Z_STRVAL_P(str), Z_STRLEN_P(str)); } if (Z_TYPE_P(value) != IS_STRING) { @@ -803,15 +797,15 @@ static inline int zend_assign_to_string_offset(const temp_variable *T, const zva zval_copy_ctor(&tmp); } convert_to_string(&tmp); - Z_STRVAL_P(T->str_offset.str)[T->str_offset.offset] = Z_STRVAL(tmp)[0]; - STR_FREE(Z_STRVAL(tmp)); + Z_STRVAL_P(str)[offset] = Z_STRVAL(tmp)[0]; + str_efree(Z_STRVAL(tmp)); } else { - Z_STRVAL_P(T->str_offset.str)[T->str_offset.offset] = Z_STRVAL_P(value)[0]; + Z_STRVAL_P(str)[offset] = Z_STRVAL_P(value)[0]; if (value_type == IS_TMP_VAR) { /* we can safely free final_value here * because separation is done only * in case value_type == IS_VAR */ - STR_FREE(Z_STRVAL_P(value)); + str_efree(Z_STRVAL_P(value)); } } /* @@ -1024,11 +1018,7 @@ static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, const zva hval = Z_HASH_P(dim); } else { ZEND_HANDLE_NUMERIC_EX(offset_key, offset_key_length+1, hval, goto num_index); - if (IS_INTERNED(offset_key)) { - hval = INTERNED_HASH(offset_key); - } else { - hval = zend_hash_func(offset_key, offset_key_length+1); - } + hval = str_hash(offset_key, offset_key_length); } fetch_string_dim: if (zend_hash_quick_find(ht, offset_key, offset_key_length+1, hval, (void **) &retval) == FAILURE) { @@ -1487,15 +1477,17 @@ ZEND_API opcode_handler_t *zend_opcode_handlers; ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, zend_fcall_info *fci, int return_value_used TSRMLS_DC) { - if(fci != NULL) { - ((zend_internal_function *) execute_data_ptr->function_state.function)->handler(fci->param_count, - *fci->retval_ptr_ptr, fci->retval_ptr_ptr, fci->object_ptr, 1 TSRMLS_CC); - + if (fci != NULL) { + execute_data_ptr->function_state.function->internal_function.handler( + fci->param_count, *fci->retval_ptr_ptr, fci->retval_ptr_ptr, + fci->object_ptr, 1 TSRMLS_CC + ); } else { zval **return_value_ptr = &EX_TMP_VAR(execute_data_ptr, execute_data_ptr->opline->result.var)->var.ptr; - ((zend_internal_function *) execute_data_ptr->function_state.function)->handler(execute_data_ptr->opline->extended_value, *return_value_ptr, - (execute_data_ptr->function_state.function->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)?return_value_ptr:NULL, - execute_data_ptr->object, return_value_used TSRMLS_CC); + execute_data_ptr->function_state.function->internal_function.handler( + execute_data_ptr->opline->extended_value, *return_value_ptr, return_value_ptr, + execute_data_ptr->object, return_value_used TSRMLS_CC + ); } } @@ -1513,7 +1505,7 @@ void zend_clean_and_cache_symbol_table(HashTable *symbol_table TSRMLS_DC) /* {{{ } /* }}} */ -static zend_always_inline void i_free_compiled_variables(zend_execute_data *execute_data) /* {{{ */ +static zend_always_inline void i_free_compiled_variables(zend_execute_data *execute_data TSRMLS_DC) /* {{{ */ { zval ***cv = EX_CV_NUM(execute_data, 0); zval ***end = cv + EX(op_array)->last_var; @@ -1526,9 +1518,9 @@ static zend_always_inline void i_free_compiled_variables(zend_execute_data *exec } /* }}} */ -void zend_free_compiled_variables(zend_execute_data *execute_data) /* {{{ */ +void zend_free_compiled_variables(zend_execute_data *execute_data TSRMLS_DC) /* {{{ */ { - i_free_compiled_variables(execute_data); + i_free_compiled_variables(execute_data TSRMLS_CC); } /* }}} */ diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index ff0758772e48b..5c900e5ceced5 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -71,18 +71,14 @@ ZEND_API int zend_eval_stringl_ex(char *str, int str_len, zval *retval_ptr, char ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, ulong fetch_type, const char **class_name, zend_class_entry **pce TSRMLS_DC); ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend_uint arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind TSRMLS_DC); -static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC) +static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC TSRMLS_DC) { if (!Z_DELREF_P(zval_ptr)) { - TSRMLS_FETCH(); - ZEND_ASSERT(zval_ptr != &EG(uninitialized_zval)); GC_REMOVE_ZVAL_FROM_BUFFER(zval_ptr); zval_dtor(zval_ptr); efree_rel(zval_ptr); } else { - TSRMLS_FETCH(); - if (Z_REFCOUNT_P(zval_ptr) == 1) { Z_UNSET_ISREF_P(zval_ptr); } @@ -91,6 +87,20 @@ static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC) } } +static zend_always_inline void i_zval_ptr_dtor_nogc(zval *zval_ptr ZEND_FILE_LINE_DC TSRMLS_DC) +{ + if (!Z_DELREF_P(zval_ptr)) { + ZEND_ASSERT(zval_ptr != &EG(uninitialized_zval)); + GC_REMOVE_ZVAL_FROM_BUFFER(zval_ptr); + zval_dtor(zval_ptr); + efree_rel(zval_ptr); + } else { + if (Z_REFCOUNT_P(zval_ptr) == 1) { + Z_UNSET_ISREF_P(zval_ptr); + } + } +} + static zend_always_inline int i_zend_is_true(zval *op) { int result; @@ -295,7 +305,7 @@ static zend_always_inline void zend_vm_stack_clear_multiple(int nested TSRMLS_DC while (p != end) { zval *q = (zval *) *(--p); *p = NULL; - i_zval_ptr_dtor(q ZEND_FILE_LINE_CC); + i_zval_ptr_dtor(q ZEND_FILE_LINE_CC TSRMLS_CC); } if (nested) { EG(argument_stack)->top = p; @@ -394,7 +404,7 @@ ZEND_API zval **zend_get_zval_ptr_ptr(int op_type, const znode_op *node, const z ZEND_API int zend_do_fcall(ZEND_OPCODE_HANDLER_ARGS); void zend_clean_and_cache_symbol_table(HashTable *symbol_table TSRMLS_DC); -void zend_free_compiled_variables(zend_execute_data *execute_data); +void zend_free_compiled_variables(zend_execute_data *execute_data TSRMLS_DC); #define CACHED_PTR(num) \ EG(active_op_array)->run_time_cache[(num)] diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 83c221798416f..779e6d886fa4d 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -423,7 +423,8 @@ ZEND_API zend_bool zend_is_executing(TSRMLS_D) /* {{{ */ ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC) /* {{{ */ { - i_zval_ptr_dtor(*zval_ptr ZEND_FILE_LINE_RELAY_CC); + TSRMLS_FETCH(); + i_zval_ptr_dtor(*zval_ptr ZEND_FILE_LINE_RELAY_CC TSRMLS_CC); } /* }}} */ @@ -533,13 +534,13 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco if (fix_save) { save--; } - if (inline_change && !IS_INTERNED(save)) { - efree(save); + if (inline_change) { + str_efree(save); } save = NULL; } - if (inline_change && save && save != actual && !IS_INTERNED(save)) { - efree(save); + if (inline_change && save && save != actual) { + str_efree(save); } zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); p->type = IS_STRING; @@ -551,7 +552,7 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco } } else { if (inline_change) { - STR_FREE(Z_STRVAL_P(p)); + str_efree(Z_STRVAL_P(p)); } *p = const_value; } @@ -952,9 +953,9 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS if (EX(function_state).function->common.scope) { EG(scope) = EX(function_state).function->common.scope; } - if(EXPECTED(zend_execute_internal == NULL)) { + if (EXPECTED(zend_execute_internal == NULL)) { /* saves one function call if zend_execute_internal is not used */ - ((zend_internal_function *) EX(function_state).function)->handler(fci->param_count, *fci->retval_ptr_ptr, fci->retval_ptr_ptr, fci->object_ptr, 1 TSRMLS_CC); + EX(function_state).function->internal_function.handler(fci->param_count, *fci->retval_ptr_ptr, fci->retval_ptr_ptr, fci->object_ptr, 1 TSRMLS_CC); } else { zend_execute_internal(&execute_data, fci, 1 TSRMLS_CC); } diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h index 83cad7f38d648..e7f289a656097 100644 --- a/Zend/zend_extensions.h +++ b/Zend/zend_extensions.h @@ -28,7 +28,7 @@ /* The first number is the engine version and the rest is the date. * This way engine 2/3 API no. is always greater than engine 1 API no.. */ -#define ZEND_EXTENSION_API_NO 220121212 +#define ZEND_EXTENSION_API_NO 220131106 typedef struct _zend_extension_version_info { int zend_extension_api_no; diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 1a805bbd6d61c..e8b1be4445e2e 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -46,7 +46,7 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished zend_op_array *op_array = execute_data->op_array; if (!execute_data->symbol_table) { - zend_free_compiled_variables(execute_data); + zend_free_compiled_variables(execute_data TSRMLS_CC); } else { zend_clean_and_cache_symbol_table(execute_data->symbol_table TSRMLS_CC); } @@ -226,6 +226,16 @@ static zend_object_value zend_generator_create(zend_class_entry *class_type TSRM } /* }}} */ +static void copy_closure_static_var(zval **var TSRMLS_DC, int num_args, va_list args, zend_hash_key *key) /* {{{ */ +{ + HashTable *target = va_arg(args, HashTable *); + + SEPARATE_ZVAL_TO_MAKE_IS_REF(var); + Z_ADDREF_PP(var); + zend_hash_quick_update(target, key->arKey, key->nKeyLength, key->h, var, sizeof(zval *), NULL); +} +/* }}} */ + /* Requires globals EG(scope), EG(current_scope), EG(This), * EG(active_symbol_table) and EG(current_execute_data). */ ZEND_API zval *zend_generator_create_zval(zend_op_array *op_array TSRMLS_DC) /* {{{ */ @@ -242,7 +252,23 @@ ZEND_API zval *zend_generator_create_zval(zend_op_array *op_array TSRMLS_DC) /* if (op_array->fn_flags & ZEND_ACC_CLOSURE) { zend_op_array *op_array_copy = (zend_op_array*)emalloc(sizeof(zend_op_array)); *op_array_copy = *op_array; - function_add_ref((zend_function *) op_array_copy); + + (*op_array->refcount)++; + op_array->run_time_cache = NULL; + if (op_array->static_variables) { + ALLOC_HASHTABLE(op_array_copy->static_variables); + zend_hash_init( + op_array_copy->static_variables, + zend_hash_num_elements(op_array->static_variables), + NULL, ZVAL_PTR_DTOR, 0 + ); + zend_hash_apply_with_arguments( + op_array->static_variables TSRMLS_CC, + (apply_func_args_t) copy_closure_static_var, + 1, op_array_copy->static_variables + ); + } + op_array = op_array_copy; } @@ -430,7 +456,7 @@ ZEND_METHOD(Generator, current) zend_generator_ensure_initialized(generator TSRMLS_CC); if (generator->value) { - RETURN_ZVAL(generator->value, 1, 0); + RETURN_ZVAL_FAST(generator->value); } } /* }}} */ @@ -450,7 +476,7 @@ ZEND_METHOD(Generator, key) zend_generator_ensure_initialized(generator TSRMLS_CC); if (generator->key) { - RETURN_ZVAL(generator->key, 1, 0); + RETURN_ZVAL_FAST(generator->key); } } /* }}} */ @@ -499,7 +525,7 @@ ZEND_METHOD(Generator, send) zend_generator_resume(generator TSRMLS_CC); if (generator->value) { - RETURN_ZVAL(generator->value, 1, 0); + RETURN_ZVAL_FAST(generator->value); } } /* }}} */ @@ -532,7 +558,7 @@ ZEND_METHOD(Generator, throw) zend_generator_resume(generator TSRMLS_CC); if (generator->value) { - RETURN_ZVAL(generator->value, 1, 0); + RETURN_ZVAL_FAST(generator->value); } } else { /* If the generator is already closed throw the exception in the diff --git a/Zend/zend_ini_scanner.c b/Zend/zend_ini_scanner.c index 87ba664312712..a3ecdef4949ac 100644 --- a/Zend/zend_ini_scanner.c +++ b/Zend/zend_ini_scanner.c @@ -1,4663 +1,4663 @@ -/* Generated by re2c 0.13.5 */ -#line 1 "Zend/zend_ini_scanner.l" -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.00 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Zeev Suraski | - | Jani Taskinen | - | Marcus Boerger | - | Nuno Lopes | - | Scott MacVicar | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include -#include "zend.h" -#include "zend_globals.h" -#include -#include "zend_ini_scanner.h" - -#if 0 -# define YYDEBUG(s, c) printf("state: %d char: %c\n", s, c) -#else -# define YYDEBUG(s, c) -#endif - -#include "zend_ini_scanner_defs.h" - -#define YYCTYPE unsigned char -/* allow the scanner to read one null byte after the end of the string (from ZEND_MMAP_AHEAD) - * so that if will be able to terminate to match the current token (e.g. non-enclosed string) */ -#define YYFILL(n) { if (YYCURSOR > YYLIMIT) return 0; } -#define YYCURSOR SCNG(yy_cursor) -#define YYLIMIT SCNG(yy_limit) -#define YYMARKER SCNG(yy_marker) - -#define YYGETCONDITION() SCNG(yy_state) -#define YYSETCONDITION(s) SCNG(yy_state) = s - -#define STATE(name) yyc##name - -/* emulate flex constructs */ -#define BEGIN(state) YYSETCONDITION(STATE(state)) -#define YYSTATE YYGETCONDITION() -#define yytext ((char*)SCNG(yy_text)) -#define yyleng SCNG(yy_leng) -#define yyless(x) do { YYCURSOR = (unsigned char*)yytext + x; \ - yyleng = (unsigned int)x; } while(0) - -/* #define yymore() goto yymore_restart */ - -/* perform sanity check. If this message is triggered you should - increase the ZEND_MMAP_AHEAD value in the zend_streams.h file */ -#define YYMAXFILL 6 -#if ZEND_MMAP_AHEAD < (YYMAXFILL + 1) -# error ZEND_MMAP_AHEAD should be greater than YYMAXFILL -#endif - - -/* How it works (for the core ini directives): - * =========================================== - * - * 1. Scanner scans file for tokens and passes them to parser. - * 2. Parser parses the tokens and passes the name/value pairs to the callback - * function which stores them in the configuration hash table. - * 3. Later REGISTER_INI_ENTRIES() is called which triggers the actual - * registering of ini entries and uses zend_get_configuration_directive() - * to fetch the previously stored name/value pair from configuration hash table - * and registers the static ini entries which match the name to the value - * into EG(ini_directives) hash table. - * 4. PATH section entries are used per-request from down to top, each overriding - * previous if one exists. zend_alter_ini_entry() is called for each entry. - * Settings in PATH section are ZEND_INI_SYSTEM accessible and thus mimics the - * php_admin_* directives used within Apache httpd.conf when PHP is compiled as - * module for Apache. - * 5. User defined ini files (like .htaccess for apache) are parsed for each request and - * stored in separate hash defined by SAPI. - */ - -/* TODO: (ordered by importance :-) - * =============================================================================== - * - * - Separate constant lookup totally from plain strings (using CONSTANT pattern) - * - Add #if .. #else .. #endif and ==, !=, <, > , <=, >= operators - * - Add #include "some.ini" - * - Allow variables to refer to options also when using parse_ini_file() - * - */ - -/* Globals Macros */ -#define SCNG INI_SCNG -#ifdef ZTS -ZEND_API ts_rsrc_id ini_scanner_globals_id; -#else -ZEND_API zend_ini_scanner_globals ini_scanner_globals; -#endif - -/* Eat leading whitespace */ -#define EAT_LEADING_WHITESPACE() \ - while (yytext[0]) { \ - if (yytext[0] == ' ' || yytext[0] == '\t') { \ - SCNG(yy_text)++; \ - yyleng--; \ - } else { \ - break; \ - } \ - } - -/* Eat trailing whitespace + extra char */ -#define EAT_TRAILING_WHITESPACE_EX(ch) \ - while (yyleng > 0 && ( \ - (ch != 'X' && yytext[yyleng - 1] == ch) || \ - yytext[yyleng - 1] == '\n' || \ - yytext[yyleng - 1] == '\r' || \ - yytext[yyleng - 1] == '\t' || \ - yytext[yyleng - 1] == ' ') \ - ) { \ - yyleng--; \ - } - -/* Eat trailing whitespace */ -#define EAT_TRAILING_WHITESPACE() EAT_TRAILING_WHITESPACE_EX('X') - -#define zend_ini_copy_value(retval, str, len) { \ - Z_STRVAL_P(retval) = zend_strndup(str, len); \ - Z_STRLEN_P(retval) = len; \ - Z_TYPE_P(retval) = IS_STRING; \ -} - -#define RETURN_TOKEN(type, str, len) { \ - zend_ini_copy_value(ini_lval, str, len); \ - return type; \ -} - -static void _yy_push_state(int new_state TSRMLS_DC) -{ - zend_stack_push(&SCNG(state_stack), (void *) &YYGETCONDITION(), sizeof(int)); - YYSETCONDITION(new_state); -} - -#define yy_push_state(state_and_tsrm) _yy_push_state(yyc##state_and_tsrm) - -static void yy_pop_state(TSRMLS_D) -{ - int *stack_state; - zend_stack_top(&SCNG(state_stack), (void **) &stack_state); - YYSETCONDITION(*stack_state); - zend_stack_del_top(&SCNG(state_stack)); -} - -static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC) -{ - YYCURSOR = (YYCTYPE*)str; - SCNG(yy_start) = YYCURSOR; - YYLIMIT = YYCURSOR + len; -} - -#define ini_filename SCNG(filename) - -/* {{{ init_ini_scanner() -*/ -static int init_ini_scanner(int scanner_mode, zend_file_handle *fh TSRMLS_DC) -{ - /* Sanity check */ - if (scanner_mode != ZEND_INI_SCANNER_NORMAL && scanner_mode != ZEND_INI_SCANNER_RAW) { - zend_error(E_WARNING, "Invalid scanner mode"); - return FAILURE; - } - - SCNG(lineno) = 1; - SCNG(scanner_mode) = scanner_mode; - SCNG(yy_in) = fh; - - if (fh != NULL) { - ini_filename = zend_strndup(fh->filename, strlen(fh->filename)); - } else { - ini_filename = NULL; - } - - zend_stack_init(&SCNG(state_stack)); - BEGIN(INITIAL); - - return SUCCESS; -} -/* }}} */ - -/* {{{ shutdown_ini_scanner() -*/ -void shutdown_ini_scanner(TSRMLS_D) -{ - zend_stack_destroy(&SCNG(state_stack)); - if (ini_filename) { - free(ini_filename); - } -} -/* }}} */ - -/* {{{ zend_ini_scanner_get_lineno() -*/ -int zend_ini_scanner_get_lineno(TSRMLS_D) -{ - return SCNG(lineno); -} -/* }}} */ - -/* {{{ zend_ini_scanner_get_filename() -*/ -char *zend_ini_scanner_get_filename(TSRMLS_D) -{ - return ini_filename ? ini_filename : "Unknown"; -} -/* }}} */ - -/* {{{ zend_ini_open_file_for_scanning() -*/ -int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRMLS_DC) -{ - char *buf; - size_t size; - - if (zend_stream_fixup(fh, &buf, &size TSRMLS_CC) == FAILURE) { - return FAILURE; - } - - if (init_ini_scanner(scanner_mode, fh TSRMLS_CC) == FAILURE) { - zend_file_handle_dtor(fh TSRMLS_CC); - return FAILURE; - } - - yy_scan_buffer(buf, size TSRMLS_CC); - - return SUCCESS; -} -/* }}} */ - -/* {{{ zend_ini_prepare_string_for_scanning() -*/ -int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC) -{ - int len = strlen(str); - - if (init_ini_scanner(scanner_mode, NULL TSRMLS_CC) == FAILURE) { - return FAILURE; - } - - yy_scan_buffer(str, len TSRMLS_CC); - - return SUCCESS; -} -/* }}} */ - -/* {{{ zend_ini_escape_string() - */ -static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_type TSRMLS_DC) -{ - register char *s, *t; - char *end; - - zend_ini_copy_value(lval, str, len); - - /* convert escape sequences */ - s = t = Z_STRVAL_P(lval); - end = s + Z_STRLEN_P(lval); - - while (s < end) { - if (*s == '\\') { - s++; - if (s >= end) { - *t++ = '\\'; - continue; - } - switch (*s) { - case '"': - if (*s != quote_type) { - *t++ = '\\'; - *t++ = *s; - break; - } - case '\\': - case '$': - *t++ = *s; - Z_STRLEN_P(lval)--; - break; - default: - *t++ = '\\'; - *t++ = *s; - break; - } - } else { - *t++ = *s; - } - if (*s == '\n' || (*s == '\r' && (*(s+1) != '\n'))) { - SCNG(lineno)++; - } - s++; - } - *t = 0; -} -/* }}} */ - -int ini_lex(zval *ini_lval TSRMLS_DC) -{ -restart: - SCNG(yy_text) = YYCURSOR; - -/* yymore_restart: */ - /* detect EOF */ - if (YYCURSOR >= YYLIMIT) { - if (YYSTATE == STATE(ST_VALUE) || YYSTATE == STATE(ST_RAW)) { - BEGIN(INITIAL); - return END_OF_LINE; - } - return 0; - } - - /* Eat any UTF-8 BOM we find in the first 3 bytes */ - if (YYCURSOR == SCNG(yy_start) && YYCURSOR + 3 < YYLIMIT) { - if (memcmp(YYCURSOR, "\xef\xbb\xbf", 3) == 0) { - YYCURSOR += 3; - goto restart; - } - } - -#line 337 "Zend/zend_ini_scanner.c" -{ - YYCTYPE yych; - unsigned int yyaccept = 0; - if (YYGETCONDITION() < 4) { - if (YYGETCONDITION() < 2) { - if (YYGETCONDITION() < 1) { - goto yyc_INITIAL; - } else { - goto yyc_ST_OFFSET; - } - } else { - if (YYGETCONDITION() < 3) { - goto yyc_ST_SECTION_VALUE; - } else { - goto yyc_ST_VALUE; - } - } - } else { - if (YYGETCONDITION() < 6) { - if (YYGETCONDITION() < 5) { - goto yyc_ST_SECTION_RAW; - } else { - goto yyc_ST_DOUBLE_QUOTES; - } - } else { - if (YYGETCONDITION() < 7) { - goto yyc_ST_VARNAME; - } else { - goto yyc_ST_RAW; - } - } - } -/* *********************************** */ -yyc_INITIAL: - { - static const unsigned char yybm[] = { - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 160, 0, 144, 144, 0, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 240, 128, 128, 144, 128, 144, 128, 144, - 128, 128, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 128, 144, 128, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 128, 144, 144, 128, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 128, 128, 128, 128, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, - }; - - YYDEBUG(0, *YYCURSOR); - YYFILL(5); - yych = *YYCURSOR; - YYDEBUG(-1, yych); - switch (yych) { - case '\t': goto yy4; - case '\n': goto yy6; - case '\r': goto yy8; - case ' ': goto yy9; - case '!': - case '"': - case '$': - case '&': - case '(': - case ')': - case '^': - case '{': - case '|': - case '}': - case '~': goto yy10; - case '#': goto yy12; - case '%': - case '\'': - case '*': - case '+': - case ',': - case '-': - case '.': - case '/': - case ':': - case '<': - case '>': - case '?': - case '@': - case ']': goto yy13; - case ';': goto yy14; - case '=': goto yy16; - case 'F': - case 'f': goto yy18; - case 'N': - case 'n': goto yy19; - case 'O': - case 'o': goto yy20; - case 'T': - case 't': goto yy21; - case 'Y': - case 'y': goto yy22; - case '[': goto yy23; - default: goto yy2; - } -yy2: - YYDEBUG(2, *YYCURSOR); - ++YYCURSOR; - yych = *YYCURSOR; - goto yy26; -yy3: - YYDEBUG(3, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 429 "Zend/zend_ini_scanner.l" - { /* Get option name */ - /* Eat leading whitespace */ - EAT_LEADING_WHITESPACE(); - - /* Eat trailing whitespace */ - EAT_TRAILING_WHITESPACE(); - - RETURN_TOKEN(TC_LABEL, yytext, yyleng); -} -#line 476 "Zend/zend_ini_scanner.c" -yy4: - YYDEBUG(4, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - goto yy68; -yy5: - YYDEBUG(5, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" - { - /* eat whitespace */ - goto restart; -} -#line 490 "Zend/zend_ini_scanner.c" -yy6: - YYDEBUG(6, *YYCURSOR); - ++YYCURSOR; -yy7: - YYDEBUG(7, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 580 "Zend/zend_ini_scanner.l" - { - SCNG(lineno)++; - return END_OF_LINE; -} -#line 502 "Zend/zend_ini_scanner.c" -yy8: - YYDEBUG(8, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy71; - goto yy7; -yy9: - YYDEBUG(9, *YYCURSOR); - yyaccept = 1; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= ' ') { - if (yych <= '\n') { - if (yych <= 0x08) goto yy26; - if (yych <= '\t') goto yy67; - goto yy71; - } else { - if (yych == '\r') goto yy72; - if (yych <= 0x1F) goto yy26; - goto yy69; - } - } else { - if (yych <= ':') { - if (yych == '#') goto yy58; - goto yy26; - } else { - if (yych <= ';') goto yy53; - if (yych == '=') goto yy51; - goto yy26; - } - } -yy10: - YYDEBUG(10, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(11, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 503 "Zend/zend_ini_scanner.l" - { /* Disallow these chars outside option values */ - return yytext[0]; -} -#line 541 "Zend/zend_ini_scanner.c" -yy12: - YYDEBUG(12, *YYCURSOR); - yyaccept = 1; - yych = *(YYMARKER = ++YYCURSOR); - goto yy59; -yy13: - YYDEBUG(13, *YYCURSOR); - yych = *++YYCURSOR; - goto yy26; -yy14: - YYDEBUG(14, *YYCURSOR); - yyaccept = 2; - yych = *(YYMARKER = ++YYCURSOR); - goto yy54; - YYDEBUG(15, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 603 "Zend/zend_ini_scanner.l" - { - return 0; -} -#line 562 "Zend/zend_ini_scanner.c" -yy16: - YYDEBUG(16, *YYCURSOR); - ++YYCURSOR; - yych = *YYCURSOR; - goto yy52; -yy17: - YYDEBUG(17, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 439 "Zend/zend_ini_scanner.l" - { /* Start option value */ - if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) { - yy_push_state(ST_RAW TSRMLS_CC); - } else { - yy_push_state(ST_VALUE TSRMLS_CC); - } - return '='; -} -#line 580 "Zend/zend_ini_scanner.c" -yy18: - YYDEBUG(18, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy48; - if (yych == 'a') goto yy48; - goto yy26; -yy19: - YYDEBUG(19, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= 'U') { - if (yych == 'O') goto yy44; - if (yych <= 'T') goto yy26; - goto yy45; - } else { - if (yych <= 'o') { - if (yych <= 'n') goto yy26; - goto yy44; - } else { - if (yych == 'u') goto yy45; - goto yy26; - } - } -yy20: - YYDEBUG(20, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= 'N') { - if (yych == 'F') goto yy38; - if (yych <= 'M') goto yy26; - goto yy31; - } else { - if (yych <= 'f') { - if (yych <= 'e') goto yy26; - goto yy38; - } else { - if (yych == 'n') goto yy31; - goto yy26; - } - } -yy21: - YYDEBUG(21, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'R') goto yy36; - if (yych == 'r') goto yy36; - goto yy26; -yy22: - YYDEBUG(22, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy27; - if (yych == 'e') goto yy27; - goto yy26; -yy23: - YYDEBUG(23, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(24, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 358 "Zend/zend_ini_scanner.l" - { /* Section start */ - /* Enter section data lookup state */ - if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) { - yy_push_state(ST_SECTION_RAW TSRMLS_CC); - } else { - yy_push_state(ST_SECTION_VALUE TSRMLS_CC); - } - return TC_SECTION; -} -#line 646 "Zend/zend_ini_scanner.c" -yy25: - YYDEBUG(25, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; -yy26: - YYDEBUG(26, *YYCURSOR); - if (yybm[0+yych] & 16) { - goto yy25; - } - if (yych == '[') goto yy28; - goto yy3; -yy27: - YYDEBUG(27, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'S') goto yy31; - if (yych == 's') goto yy31; - goto yy26; -yy28: - YYDEBUG(28, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(29, *YYCURSOR); - if (yybm[0+yych] & 32) { - goto yy28; - } - YYDEBUG(30, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 383 "Zend/zend_ini_scanner.l" - { /* Start of option with offset */ - /* Eat leading whitespace */ - EAT_LEADING_WHITESPACE(); - - /* Eat trailing whitespace and [ */ - EAT_TRAILING_WHITESPACE_EX('['); - - /* Enter offset lookup state */ - yy_push_state(ST_OFFSET TSRMLS_CC); - - RETURN_TOKEN(TC_OFFSET, yytext, yyleng); -} -#line 689 "Zend/zend_ini_scanner.c" -yy31: - YYDEBUG(31, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(32, *YYCURSOR); - if (yybm[0+yych] & 64) { - goto yy31; - } - if (yych <= '\'') { - if (yych <= ' ') { - if (yych <= '\n') { - if (yych <= 0x08) goto yy25; - if (yych <= '\t') goto yy34; - } else { - if (yych != '\r') goto yy25; - } - } else { - if (yych <= '$') { - if (yych == '#') goto yy25; - } else { - if (yych != '&') goto yy25; - } - } - } else { - if (yych <= 'Z') { - if (yych <= ';') { - if (yych <= ')') goto yy33; - if (yych <= ':') goto yy25; - } else { - if (yych != '=') goto yy25; - } - } else { - if (yych <= '^') { - if (yych <= '[') goto yy28; - if (yych <= ']') goto yy25; - } else { - if (yych <= 'z') goto yy25; - if (yych >= 0x7F) goto yy25; - } - } - } -yy33: - YYDEBUG(33, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 421 "Zend/zend_ini_scanner.l" - { /* TRUE value (when used outside option value/offset this causes parse error!) */ - RETURN_TOKEN(BOOL_TRUE, "1", 1); -} -#line 739 "Zend/zend_ini_scanner.c" -yy34: - YYDEBUG(34, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(35, *YYCURSOR); - if (yych == '\t') goto yy34; - if (yych == ' ') goto yy34; - goto yy33; -yy36: - YYDEBUG(36, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'U') goto yy37; - if (yych != 'u') goto yy26; -yy37: - YYDEBUG(37, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy31; - if (yych == 'e') goto yy31; - goto yy26; -yy38: - YYDEBUG(38, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'F') goto yy39; - if (yych != 'f') goto yy26; -yy39: - YYDEBUG(39, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(40, *YYCURSOR); - if (yych <= '&') { - if (yych <= 0x1F) { - if (yych <= '\n') { - if (yych <= 0x08) goto yy25; - if (yych <= '\t') goto yy42; - } else { - if (yych != '\r') goto yy25; - } - } else { - if (yych <= '#') { - if (yych <= ' ') goto yy39; - if (yych >= '#') goto yy25; - } else { - if (yych == '%') goto yy25; - } - } - } else { - if (yych <= '=') { - if (yych <= ':') { - if (yych <= '\'') goto yy25; - if (yych >= '*') goto yy25; - } else { - if (yych == '<') goto yy25; - } - } else { - if (yych <= ']') { - if (yych == '[') goto yy28; - goto yy25; - } else { - if (yych <= '^') goto yy41; - if (yych <= 'z') goto yy25; - if (yych >= 0x7F) goto yy25; - } - } - } -yy41: - YYDEBUG(41, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 425 "Zend/zend_ini_scanner.l" - { /* FALSE value (when used outside option value/offset this causes parse error!)*/ - RETURN_TOKEN(BOOL_FALSE, "", 0); -} -#line 813 "Zend/zend_ini_scanner.c" -yy42: - YYDEBUG(42, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(43, *YYCURSOR); - if (yych == '\t') goto yy42; - if (yych == ' ') goto yy42; - goto yy41; -yy44: - YYDEBUG(44, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= '\'') { - if (yych <= 0x1F) { - if (yych <= '\n') { - if (yych <= 0x08) goto yy26; - if (yych <= '\t') goto yy42; - goto yy41; - } else { - if (yych == '\r') goto yy41; - goto yy26; - } - } else { - if (yych <= '#') { - if (yych <= ' ') goto yy39; - if (yych <= '"') goto yy41; - goto yy26; - } else { - if (yych == '%') goto yy26; - if (yych <= '&') goto yy41; - goto yy26; - } - } - } else { - if (yych <= 'N') { - if (yych <= ';') { - if (yych <= ')') goto yy41; - if (yych <= ':') goto yy26; - goto yy41; - } else { - if (yych == '=') goto yy41; - if (yych <= 'M') goto yy26; - goto yy47; - } - } else { - if (yych <= 'm') { - if (yych == '^') goto yy41; - goto yy26; - } else { - if (yych <= 'n') goto yy47; - if (yych <= 'z') goto yy26; - if (yych <= '~') goto yy41; - goto yy26; - } - } - } -yy45: - YYDEBUG(45, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'L') goto yy46; - if (yych != 'l') goto yy26; -yy46: - YYDEBUG(46, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'L') goto yy39; - if (yych == 'l') goto yy39; - goto yy26; -yy47: - YYDEBUG(47, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy39; - if (yych == 'e') goto yy39; - goto yy26; -yy48: - YYDEBUG(48, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'L') goto yy49; - if (yych != 'l') goto yy26; -yy49: - YYDEBUG(49, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'S') goto yy50; - if (yych != 's') goto yy26; -yy50: - YYDEBUG(50, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy39; - if (yych == 'e') goto yy39; - goto yy26; -yy51: - YYDEBUG(51, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; -yy52: - YYDEBUG(52, *YYCURSOR); - if (yych == '\t') goto yy51; - if (yych == ' ') goto yy51; - goto yy17; -yy53: - YYDEBUG(53, *YYCURSOR); - ++YYCURSOR; - YYFILL(2); - yych = *YYCURSOR; -yy54: - YYDEBUG(54, *YYCURSOR); - if (yybm[0+yych] & 128) { - goto yy53; - } - if (yych >= '\r') goto yy57; -yy55: - YYDEBUG(55, *YYCURSOR); - ++YYCURSOR; -yy56: - YYDEBUG(56, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 585 "Zend/zend_ini_scanner.l" - { /* Comment */ - BEGIN(INITIAL); - SCNG(lineno)++; - return END_OF_LINE; -} -#line 936 "Zend/zend_ini_scanner.c" -yy57: - YYDEBUG(57, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy55; - goto yy56; -yy58: - YYDEBUG(58, *YYCURSOR); - yyaccept = 1; - YYMARKER = ++YYCURSOR; - YYFILL(2); - yych = *YYCURSOR; -yy59: - YYDEBUG(59, *YYCURSOR); - if (yych <= '\'') { - if (yych <= ' ') { - if (yych <= '\n') { - if (yych <= 0x08) goto yy58; - if (yych >= '\n') goto yy64; - } else { - if (yych == '\r') goto yy66; - goto yy58; - } - } else { - if (yych <= '$') { - if (yych == '#') goto yy58; - } else { - if (yych != '&') goto yy58; - } - } - } else { - if (yych <= 'Z') { - if (yych <= ';') { - if (yych <= ')') goto yy60; - if (yych <= ':') goto yy58; - } else { - if (yych != '=') goto yy58; - } - } else { - if (yych <= '^') { - if (yych <= '[') goto yy62; - if (yych <= ']') goto yy58; - } else { - if (yych <= 'z') goto yy58; - if (yych >= 0x7F) goto yy58; - } - } - } -yy60: - YYDEBUG(60, *YYCURSOR); - ++YYCURSOR; - YYFILL(2); - yych = *YYCURSOR; - YYDEBUG(61, *YYCURSOR); - if (yych == '\n') goto yy64; - if (yych == '\r') goto yy66; - goto yy60; -yy62: - YYDEBUG(62, *YYCURSOR); - yyaccept = 3; - YYMARKER = ++YYCURSOR; - YYFILL(2); - yych = *YYCURSOR; - YYDEBUG(63, *YYCURSOR); - if (yych <= '\f') { - if (yych <= 0x08) goto yy60; - if (yych <= '\t') goto yy62; - if (yych >= '\v') goto yy60; - } else { - if (yych <= '\r') goto yy66; - if (yych == ' ') goto yy62; - goto yy60; - } -yy64: - YYDEBUG(64, *YYCURSOR); - ++YYCURSOR; -yy65: - YYDEBUG(65, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 591 "Zend/zend_ini_scanner.l" - { /* #Comment */ - zend_error(E_DEPRECATED, "Comments starting with '#' are deprecated in %s on line %d", zend_ini_scanner_get_filename(TSRMLS_C), SCNG(lineno)); - BEGIN(INITIAL); - SCNG(lineno)++; - return END_OF_LINE; -} -#line 1022 "Zend/zend_ini_scanner.c" -yy66: - YYDEBUG(66, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy64; - goto yy65; -yy67: - YYDEBUG(67, *YYCURSOR); - yyaccept = 0; - YYMARKER = ++YYCURSOR; - YYFILL(2); - yych = *YYCURSOR; -yy68: - YYDEBUG(68, *YYCURSOR); - if (yych <= ' ') { - if (yych <= '\n') { - if (yych <= 0x08) goto yy5; - if (yych <= '\t') goto yy67; - goto yy71; - } else { - if (yych == '\r') goto yy72; - if (yych <= 0x1F) goto yy5; - goto yy67; - } - } else { - if (yych <= ':') { - if (yych == '#') goto yy60; - goto yy5; - } else { - if (yych <= ';') goto yy53; - if (yych == '=') goto yy51; - goto yy5; - } - } -yy69: - YYDEBUG(69, *YYCURSOR); - yyaccept = 1; - YYMARKER = ++YYCURSOR; - YYFILL(2); - yych = *YYCURSOR; - YYDEBUG(70, *YYCURSOR); - if (yych <= '&') { - if (yych <= 0x1F) { - if (yych <= '\n') { - if (yych <= 0x08) goto yy25; - if (yych <= '\t') goto yy67; - } else { - if (yych == '\r') goto yy72; - goto yy25; - } - } else { - if (yych <= '#') { - if (yych <= ' ') goto yy69; - if (yych <= '"') goto yy3; - goto yy58; - } else { - if (yych == '%') goto yy25; - goto yy3; - } - } - } else { - if (yych <= '=') { - if (yych <= ':') { - if (yych <= '\'') goto yy25; - if (yych <= ')') goto yy3; - goto yy25; - } else { - if (yych <= ';') goto yy53; - if (yych <= '<') goto yy25; - goto yy51; - } - } else { - if (yych <= ']') { - if (yych == '[') goto yy28; - goto yy25; - } else { - if (yych <= '^') goto yy3; - if (yych <= 'z') goto yy25; - if (yych <= '~') goto yy3; - goto yy25; - } - } - } -yy71: - YYDEBUG(71, *YYCURSOR); - yych = *++YYCURSOR; - goto yy7; -yy72: - YYDEBUG(72, *YYCURSOR); - ++YYCURSOR; - if ((yych = *YYCURSOR) == '\n') goto yy71; - goto yy7; - } -/* *********************************** */ -yyc_ST_DOUBLE_QUOTES: - { - static const unsigned char yybm[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 128, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 128, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - }; - YYDEBUG(73, *YYCURSOR); - YYFILL(2); - yych = *YYCURSOR; - if (yych == '"') goto yy77; - if (yych == '$') goto yy79; - YYDEBUG(75, *YYCURSOR); - ++YYCURSOR; -yy76: - YYDEBUG(76, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 535 "Zend/zend_ini_scanner.l" - { /* Escape double quoted string contents */ - if (YYCURSOR > YYLIMIT) { - return 0; - } - - while (YYCURSOR < YYLIMIT) { - switch (*YYCURSOR++) { - case '"': - if (YYCURSOR < YYLIMIT && YYCURSOR[-2] == '\\' && *YYCURSOR != '\r' && *YYCURSOR != '\n') { - continue; - } - break; - case '$': - if (*YYCURSOR == '{') { - break; - } - continue; - case '\\': - if (YYCURSOR < YYLIMIT && *YYCURSOR != '"') { - YYCURSOR++; - } - /* fall through */ - default: - continue; - } - - YYCURSOR--; - break; - } - - yyleng = YYCURSOR - SCNG(yy_text); - - zend_ini_escape_string(ini_lval, yytext, yyleng, '"' TSRMLS_CC); - return TC_QUOTED_STRING; -} -#line 1198 "Zend/zend_ini_scanner.c" -yy77: - YYDEBUG(77, *YYCURSOR); - ++YYCURSOR; - yych = *YYCURSOR; - goto yy83; -yy78: - YYDEBUG(78, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 530 "Zend/zend_ini_scanner.l" - { /* Double quoted '"' string ends */ - yy_pop_state(TSRMLS_C); - return '"'; -} -#line 1212 "Zend/zend_ini_scanner.c" -yy79: - YYDEBUG(79, *YYCURSOR); - yych = *++YYCURSOR; - if (yych != '{') goto yy76; - YYDEBUG(80, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(81, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 401 "Zend/zend_ini_scanner.l" - { /* Variable start */ - yy_push_state(ST_VARNAME TSRMLS_CC); - return TC_DOLLAR_CURLY; -} -#line 1226 "Zend/zend_ini_scanner.c" -yy82: - YYDEBUG(82, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; -yy83: - YYDEBUG(83, *YYCURSOR); - if (yybm[0+yych] & 128) { - goto yy82; - } - goto yy78; - } -/* *********************************** */ -yyc_ST_OFFSET: - { - static const unsigned char yybm[] = { - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 194, 64, 66, 66, 64, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - 194, 66, 64, 66, 68, 66, 66, 0, - 66, 66, 66, 66, 66, 66, 66, 66, - 114, 114, 114, 114, 114, 114, 114, 114, - 114, 114, 66, 64, 66, 66, 66, 66, - 66, 82, 82, 82, 82, 82, 82, 82, - 82, 82, 82, 82, 82, 82, 82, 82, - 82, 82, 82, 82, 82, 82, 82, 82, - 82, 82, 82, 66, 72, 64, 66, 82, - 66, 82, 82, 82, 82, 82, 82, 82, - 82, 82, 82, 82, 82, 82, 82, 82, - 82, 82, 82, 82, 82, 82, 82, 82, - 82, 82, 82, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - }; - YYDEBUG(84, *YYCURSOR); - YYFILL(2); - yych = *YYCURSOR; - if (yych <= '-') { - if (yych <= ' ') { - if (yych <= '\n') { - if (yych <= 0x08) goto yy86; - if (yych <= '\t') goto yy88; - goto yy89; - } else { - if (yych == '\r') goto yy89; - if (yych >= ' ') goto yy88; - } - } else { - if (yych <= '$') { - if (yych == '"') goto yy91; - if (yych >= '$') goto yy93; - } else { - if (yych == '\'') goto yy94; - if (yych >= '-') goto yy95; - } - } - } else { - if (yych <= 'Z') { - if (yych <= '9') { - if (yych <= '.') goto yy96; - if (yych >= '0') goto yy97; - } else { - if (yych == ';') goto yy89; - if (yych >= 'A') goto yy99; - } - } else { - if (yych <= '^') { - if (yych <= '[') goto yy86; - if (yych <= '\\') goto yy101; - if (yych <= ']') goto yy102; - } else { - if (yych == '`') goto yy86; - if (yych <= 'z') goto yy99; - } - } - } -yy86: - YYDEBUG(86, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - goto yy105; -yy87: - YYDEBUG(87, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 521 "Zend/zend_ini_scanner.l" - { /* Get rest as section/offset value */ - RETURN_TOKEN(TC_STRING, yytext, yyleng); -} -#line 1330 "Zend/zend_ini_scanner.c" -yy88: - YYDEBUG(88, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yybm[0+yych] & 128) { - goto yy131; - } - if (yych == '"') goto yy133; - if (yych == ']') goto yy134; - goto yy105; -yy89: - YYDEBUG(89, *YYCURSOR); - ++YYCURSOR; -yy90: - YYDEBUG(90, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 603 "Zend/zend_ini_scanner.l" - { - return 0; -} -#line 1351 "Zend/zend_ini_scanner.c" -yy91: - YYDEBUG(91, *YYCURSOR); - ++YYCURSOR; -yy92: - YYDEBUG(92, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 525 "Zend/zend_ini_scanner.l" - { /* Double quoted '"' string start */ - yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); - return '"'; -} -#line 1363 "Zend/zend_ini_scanner.c" -yy93: - YYDEBUG(93, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= '\\') { - if (yych <= 0x00) goto yy90; - if (yych <= '[') goto yy104; - goto yy109; - } else { - if (yych == '{') goto yy129; - goto yy104; - } -yy94: - YYDEBUG(94, *YYCURSOR); - yyaccept = 1; - yych = *(YYMARKER = ++YYCURSOR); - if (yybm[0+yych] & 64) { - goto yy125; - } - goto yy90; -yy95: - YYDEBUG(95, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy105; - if (yych <= '9') goto yy123; - goto yy105; -yy96: - YYDEBUG(96, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy105; - if (yych <= '9') goto yy121; - goto yy105; -yy97: - YYDEBUG(97, *YYCURSOR); - yyaccept = 2; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '\'') { - if (yych <= '\r') { - if (yych == '\n') goto yy98; - if (yych <= '\f') goto yy105; - } else { - if (yych == '"') goto yy98; - if (yych <= '&') goto yy105; - } - } else { - if (yych <= '9') { - if (yych == '.') goto yy117; - if (yych <= '/') goto yy105; - goto yy119; - } else { - if (yych <= ';') { - if (yych <= ':') goto yy105; - } else { - if (yych != ']') goto yy105; - } - } - } -yy98: - YYDEBUG(98, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 499 "Zend/zend_ini_scanner.l" - { /* Get number option value as string */ - RETURN_TOKEN(TC_NUMBER, yytext, yyleng); -} -#line 1429 "Zend/zend_ini_scanner.c" -yy99: - YYDEBUG(99, *YYCURSOR); - yyaccept = 3; - yych = *(YYMARKER = ++YYCURSOR); - if (yybm[0+yych] & 16) { - goto yy115; - } - if (yych <= '"') { - if (yych <= '\f') { - if (yych != '\n') goto yy105; - } else { - if (yych <= '\r') goto yy100; - if (yych <= '!') goto yy105; - } - } else { - if (yych <= ':') { - if (yych != '\'') goto yy105; - } else { - if (yych <= ';') goto yy100; - if (yych != ']') goto yy105; - } - } -yy100: - YYDEBUG(100, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 495 "Zend/zend_ini_scanner.l" - { /* Get constant option value */ - RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); -} -#line 1459 "Zend/zend_ini_scanner.c" -yy101: - YYDEBUG(101, *YYCURSOR); - yych = *++YYCURSOR; - goto yy104; -yy102: - YYDEBUG(102, *YYCURSOR); - ++YYCURSOR; -yy103: - YYDEBUG(103, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 396 "Zend/zend_ini_scanner.l" - { /* End of section or an option offset */ - BEGIN(INITIAL); - return ']'; -} -#line 1475 "Zend/zend_ini_scanner.c" -yy104: - YYDEBUG(104, *YYCURSOR); - yyaccept = 0; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; -yy105: - YYDEBUG(105, *YYCURSOR); - if (yybm[0+yych] & 2) { - goto yy104; - } - if (yych == '$') goto yy107; - if (yych != '\\') goto yy87; -yy106: - YYDEBUG(106, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - goto yy104; -yy107: - YYDEBUG(107, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - if (yych <= '\\') { - if (yych <= 0x00) goto yy108; - if (yych <= '[') goto yy104; - goto yy109; - } else { - if (yych != '{') goto yy104; - } -yy108: - YYDEBUG(108, *YYCURSOR); - YYCURSOR = YYMARKER; - if (yyaccept <= 1) { - if (yyaccept <= 0) { - goto yy87; - } else { - goto yy90; - } - } else { - if (yyaccept <= 2) { - goto yy98; - } else { - goto yy100; - } - } -yy109: - YYDEBUG(109, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - if (yybm[0+yych] & 4) { - goto yy110; - } - if (yych == '\\') goto yy112; - goto yy104; -yy110: - YYDEBUG(110, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(111, *YYCURSOR); - if (yybm[0+yych] & 4) { - goto yy110; - } - if (yych == '\\') goto yy114; - goto yy104; -yy112: - YYDEBUG(112, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(113, *YYCURSOR); - if (yybm[0+yych] & 4) { - goto yy110; - } - if (yych == '\\') goto yy112; - goto yy104; -yy114: - YYDEBUG(114, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - if (yybm[0+yych] & 4) { - goto yy110; - } - if (yych == '\\') goto yy112; - goto yy104; -yy115: - YYDEBUG(115, *YYCURSOR); - yyaccept = 3; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(116, *YYCURSOR); - if (yybm[0+yych] & 16) { - goto yy115; - } - if (yych <= '$') { - if (yych <= '\r') { - if (yych == '\n') goto yy100; - if (yych <= '\f') goto yy104; - goto yy100; - } else { - if (yych == '"') goto yy100; - if (yych <= '#') goto yy104; - goto yy107; - } - } else { - if (yych <= ';') { - if (yych == '\'') goto yy100; - if (yych <= ':') goto yy104; - goto yy100; - } else { - if (yych <= '[') goto yy104; - if (yych <= '\\') goto yy106; - if (yych <= ']') goto yy100; - goto yy104; - } - } -yy117: - YYDEBUG(117, *YYCURSOR); - yyaccept = 2; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(118, *YYCURSOR); - if (yybm[0+yych] & 32) { - goto yy117; - } - if (yych <= '$') { - if (yych <= '\r') { - if (yych == '\n') goto yy98; - if (yych <= '\f') goto yy104; - goto yy98; - } else { - if (yych == '"') goto yy98; - if (yych <= '#') goto yy104; - goto yy107; - } - } else { - if (yych <= ';') { - if (yych == '\'') goto yy98; - if (yych <= ':') goto yy104; - goto yy98; - } else { - if (yych <= '[') goto yy104; - if (yych <= '\\') goto yy106; - if (yych <= ']') goto yy98; - goto yy104; - } - } -yy119: - YYDEBUG(119, *YYCURSOR); - yyaccept = 2; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(120, *YYCURSOR); - if (yych <= '\'') { - if (yych <= '!') { - if (yych <= '\n') { - if (yych <= '\t') goto yy104; - goto yy98; - } else { - if (yych == '\r') goto yy98; - goto yy104; - } - } else { - if (yych <= '#') { - if (yych <= '"') goto yy98; - goto yy104; - } else { - if (yych <= '$') goto yy107; - if (yych <= '&') goto yy104; - goto yy98; - } - } - } else { - if (yych <= ':') { - if (yych <= '.') { - if (yych <= '-') goto yy104; - goto yy117; - } else { - if (yych <= '/') goto yy104; - if (yych <= '9') goto yy119; - goto yy104; - } - } else { - if (yych <= '[') { - if (yych <= ';') goto yy98; - goto yy104; - } else { - if (yych <= '\\') goto yy106; - if (yych <= ']') goto yy98; - goto yy104; - } - } - } -yy121: - YYDEBUG(121, *YYCURSOR); - yyaccept = 2; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(122, *YYCURSOR); - if (yych <= '&') { - if (yych <= '\r') { - if (yych == '\n') goto yy98; - if (yych <= '\f') goto yy104; - goto yy98; - } else { - if (yych <= '"') { - if (yych <= '!') goto yy104; - goto yy98; - } else { - if (yych == '$') goto yy107; - goto yy104; - } - } - } else { - if (yych <= ':') { - if (yych <= '\'') goto yy98; - if (yych <= '/') goto yy104; - if (yych <= '9') goto yy121; - goto yy104; - } else { - if (yych <= '[') { - if (yych <= ';') goto yy98; - goto yy104; - } else { - if (yych <= '\\') goto yy106; - if (yych <= ']') goto yy98; - goto yy104; - } - } - } -yy123: - YYDEBUG(123, *YYCURSOR); - yyaccept = 2; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(124, *YYCURSOR); - if (yych <= '&') { - if (yych <= '\r') { - if (yych == '\n') goto yy98; - if (yych <= '\f') goto yy104; - goto yy98; - } else { - if (yych <= '"') { - if (yych <= '!') goto yy104; - goto yy98; - } else { - if (yych == '$') goto yy107; - goto yy104; - } - } - } else { - if (yych <= ':') { - if (yych <= '\'') goto yy98; - if (yych <= '/') goto yy104; - if (yych <= '9') goto yy123; - goto yy104; - } else { - if (yych <= '[') { - if (yych <= ';') goto yy98; - goto yy104; - } else { - if (yych <= '\\') goto yy106; - if (yych <= ']') goto yy98; - goto yy104; - } - } - } -yy125: - YYDEBUG(125, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(126, *YYCURSOR); - if (yybm[0+yych] & 64) { - goto yy125; - } - YYDEBUG(127, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(128, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 368 "Zend/zend_ini_scanner.l" - { /* Raw string */ - /* Eat leading and trailing single quotes */ - if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') { - SCNG(yy_text)++; - yyleng = yyleng - 2; - } - RETURN_TOKEN(TC_RAW, yytext, yyleng); -} -#line 1774 "Zend/zend_ini_scanner.c" -yy129: - YYDEBUG(129, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(130, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 401 "Zend/zend_ini_scanner.l" - { /* Variable start */ - yy_push_state(ST_VARNAME TSRMLS_CC); - return TC_DOLLAR_CURLY; -} -#line 1785 "Zend/zend_ini_scanner.c" -yy131: - YYDEBUG(131, *YYCURSOR); - yyaccept = 0; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(132, *YYCURSOR); - if (yybm[0+yych] & 128) { - goto yy131; - } - if (yych <= '$') { - if (yych <= '\r') { - if (yych == '\n') goto yy87; - if (yych <= '\f') goto yy104; - goto yy87; - } else { - if (yych == '"') goto yy133; - if (yych <= '#') goto yy104; - goto yy107; - } - } else { - if (yych <= ';') { - if (yych == '\'') goto yy87; - if (yych <= ':') goto yy104; - goto yy87; - } else { - if (yych <= '[') goto yy104; - if (yych <= '\\') goto yy106; - if (yych <= ']') goto yy134; - goto yy104; - } - } -yy133: - YYDEBUG(133, *YYCURSOR); - yych = *++YYCURSOR; - goto yy92; -yy134: - YYDEBUG(134, *YYCURSOR); - ++YYCURSOR; - yych = *YYCURSOR; - goto yy103; - } -/* *********************************** */ -yyc_ST_RAW: - { - static const unsigned char yybm[] = { - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 192, 0, 64, 64, 0, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 192, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, - }; - YYDEBUG(135, *YYCURSOR); - YYFILL(3); - yych = *YYCURSOR; - if (yych <= '\f') { - if (yych <= 0x08) { - if (yych >= 0x01) goto yy139; - } else { - if (yych <= '\t') goto yy141; - if (yych <= '\n') goto yy142; - goto yy139; - } - } else { - if (yych <= ' ') { - if (yych <= '\r') goto yy144; - if (yych <= 0x1F) goto yy139; - goto yy141; - } else { - if (yych == ';') goto yy145; - goto yy139; - } - } - YYDEBUG(137, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(138, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 598 "Zend/zend_ini_scanner.l" - { /* End of option value (if EOF is reached before EOL */ - BEGIN(INITIAL); - return END_OF_LINE; -} -#line 1895 "Zend/zend_ini_scanner.c" -yy139: - YYDEBUG(139, *YYCURSOR); - ++YYCURSOR; -yy140: - YYDEBUG(140, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 448 "Zend/zend_ini_scanner.l" - { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ - char *sc = NULL; - while (YYCURSOR < YYLIMIT) { - switch (*YYCURSOR) { - case '\n': - case '\r': - goto end_raw_value_chars; - break; - case ';': - if (sc == NULL) { - sc = YYCURSOR; - } - /* no break */ - default: - YYCURSOR++; - break; - } - } -end_raw_value_chars: - yyleng = YYCURSOR - SCNG(yy_text); - - /* Eat trailing semicolons */ - while (yytext[yyleng - 1] == ';') { - yyleng--; - } - - /* Eat leading and trailing double quotes */ - if (yytext[0] == '"' && yytext[yyleng - 1] == '"') { - SCNG(yy_text)++; - yyleng = yyleng - 2; - } else if (sc) { - YYCURSOR = sc; - yyleng = YYCURSOR - SCNG(yy_text); - } - RETURN_TOKEN(TC_RAW, yytext, yyleng); -} -#line 1939 "Zend/zend_ini_scanner.c" -yy141: - YYDEBUG(141, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '\r') { - if (yych <= 0x08) goto yy140; - if (yych <= '\n') goto yy153; - if (yych <= '\f') goto yy140; - goto yy153; - } else { - if (yych <= ' ') { - if (yych <= 0x1F) goto yy140; - goto yy153; - } else { - if (yych == ';') goto yy153; - goto yy140; - } - } -yy142: - YYDEBUG(142, *YYCURSOR); - ++YYCURSOR; -yy143: - YYDEBUG(143, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 489 "Zend/zend_ini_scanner.l" - { /* End of option value */ - BEGIN(INITIAL); - SCNG(lineno)++; - return END_OF_LINE; -} -#line 1970 "Zend/zend_ini_scanner.c" -yy144: - YYDEBUG(144, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy151; - goto yy143; -yy145: - YYDEBUG(145, *YYCURSOR); - yyaccept = 1; - yych = *(YYMARKER = ++YYCURSOR); - goto yy147; -yy146: - YYDEBUG(146, *YYCURSOR); - ++YYCURSOR; - YYFILL(2); - yych = *YYCURSOR; -yy147: - YYDEBUG(147, *YYCURSOR); - if (yybm[0+yych] & 64) { - goto yy146; - } - if (yych >= '\r') goto yy150; -yy148: - YYDEBUG(148, *YYCURSOR); - ++YYCURSOR; -yy149: - YYDEBUG(149, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 585 "Zend/zend_ini_scanner.l" - { /* Comment */ - BEGIN(INITIAL); - SCNG(lineno)++; - return END_OF_LINE; -} -#line 2004 "Zend/zend_ini_scanner.c" -yy150: - YYDEBUG(150, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy148; - goto yy149; -yy151: - YYDEBUG(151, *YYCURSOR); - yych = *++YYCURSOR; - goto yy143; -yy152: - YYDEBUG(152, *YYCURSOR); - yyaccept = 2; - YYMARKER = ++YYCURSOR; - YYFILL(2); - yych = *YYCURSOR; -yy153: - YYDEBUG(153, *YYCURSOR); - if (yybm[0+yych] & 128) { - goto yy152; - } - if (yych <= '\f') { - if (yych == '\n') goto yy151; - } else { - if (yych <= '\r') goto yy155; - if (yych == ';') goto yy146; - } - YYDEBUG(154, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" - { - /* eat whitespace */ - goto restart; -} -#line 2038 "Zend/zend_ini_scanner.c" -yy155: - YYDEBUG(155, *YYCURSOR); - ++YYCURSOR; - if ((yych = *YYCURSOR) == '\n') goto yy151; - goto yy143; - } -/* *********************************** */ -yyc_ST_SECTION_RAW: - { - static const unsigned char yybm[] = { - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 192, 0, 128, 128, 0, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 192, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 0, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - }; - YYDEBUG(156, *YYCURSOR); - YYFILL(3); - yych = *YYCURSOR; - if (yych <= '\f') { - if (yych == '\n') goto yy160; - } else { - if (yych <= '\r') goto yy160; - if (yych == ']') goto yy162; - } - YYDEBUG(158, *YYCURSOR); - ++YYCURSOR; - yych = *YYCURSOR; - goto yy169; -yy159: - YYDEBUG(159, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 485 "Zend/zend_ini_scanner.l" - { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ - RETURN_TOKEN(TC_RAW, yytext, yyleng); -} -#line 2102 "Zend/zend_ini_scanner.c" -yy160: - YYDEBUG(160, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(161, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 603 "Zend/zend_ini_scanner.l" - { - return 0; -} -#line 2112 "Zend/zend_ini_scanner.c" -yy162: - YYDEBUG(162, *YYCURSOR); - ++YYCURSOR; - yych = *YYCURSOR; - goto yy165; -yy163: - YYDEBUG(163, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 377 "Zend/zend_ini_scanner.l" - { /* End of section */ - BEGIN(INITIAL); - SCNG(lineno)++; - return ']'; -} -#line 2127 "Zend/zend_ini_scanner.c" -yy164: - YYDEBUG(164, *YYCURSOR); - ++YYCURSOR; - YYFILL(2); - yych = *YYCURSOR; -yy165: - YYDEBUG(165, *YYCURSOR); - if (yybm[0+yych] & 64) { - goto yy164; - } - if (yych == '\n') goto yy166; - if (yych == '\r') goto yy167; - goto yy163; -yy166: - YYDEBUG(166, *YYCURSOR); - yych = *++YYCURSOR; - goto yy163; -yy167: - YYDEBUG(167, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy166; - goto yy163; -yy168: - YYDEBUG(168, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; -yy169: - YYDEBUG(169, *YYCURSOR); - if (yybm[0+yych] & 128) { - goto yy168; - } - goto yy159; - } -/* *********************************** */ -yyc_ST_SECTION_VALUE: - { - static const unsigned char yybm[] = { - 132, 132, 132, 132, 132, 132, 132, 132, - 132, 134, 128, 132, 132, 128, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 132, - 134, 132, 128, 132, 136, 132, 132, 0, - 132, 132, 132, 132, 132, 132, 132, 132, - 228, 228, 228, 228, 228, 228, 228, 228, - 228, 228, 132, 128, 132, 132, 132, 132, - 132, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 132, 144, 128, 132, 164, - 132, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 132, 132, 132, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 132, - }; - YYDEBUG(170, *YYCURSOR); - YYFILL(3); - yych = *YYCURSOR; - if (yych <= '-') { - if (yych <= ' ') { - if (yych <= '\n') { - if (yych <= 0x08) goto yy172; - if (yych <= '\t') goto yy174; - goto yy175; - } else { - if (yych == '\r') goto yy175; - if (yych >= ' ') goto yy174; - } - } else { - if (yych <= '$') { - if (yych == '"') goto yy177; - if (yych >= '$') goto yy179; - } else { - if (yych == '\'') goto yy180; - if (yych >= '-') goto yy181; - } - } - } else { - if (yych <= 'Z') { - if (yych <= '9') { - if (yych <= '.') goto yy182; - if (yych >= '0') goto yy183; - } else { - if (yych == ';') goto yy175; - if (yych >= 'A') goto yy185; - } - } else { - if (yych <= '^') { - if (yych <= '[') goto yy172; - if (yych <= '\\') goto yy187; - if (yych <= ']') goto yy188; - } else { - if (yych == '`') goto yy172; - if (yych <= 'z') goto yy185; - } - } - } -yy172: - YYDEBUG(172, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - goto yy195; -yy173: - YYDEBUG(173, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 521 "Zend/zend_ini_scanner.l" - { /* Get rest as section/offset value */ - RETURN_TOKEN(TC_STRING, yytext, yyleng); -} -#line 2253 "Zend/zend_ini_scanner.c" -yy174: - YYDEBUG(174, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= 0x1F) { - if (yych == '\t') goto yy221; - goto yy195; - } else { - if (yych <= ' ') goto yy221; - if (yych == '"') goto yy223; - goto yy195; - } -yy175: - YYDEBUG(175, *YYCURSOR); - ++YYCURSOR; -yy176: - YYDEBUG(176, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 603 "Zend/zend_ini_scanner.l" - { - return 0; -} -#line 2276 "Zend/zend_ini_scanner.c" -yy177: - YYDEBUG(177, *YYCURSOR); - ++YYCURSOR; -yy178: - YYDEBUG(178, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 525 "Zend/zend_ini_scanner.l" - { /* Double quoted '"' string start */ - yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); - return '"'; -} -#line 2288 "Zend/zend_ini_scanner.c" -yy179: - YYDEBUG(179, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= '\\') { - if (yych <= 0x00) goto yy176; - if (yych <= '[') goto yy194; - goto yy199; - } else { - if (yych == '{') goto yy219; - goto yy194; - } -yy180: - YYDEBUG(180, *YYCURSOR); - yyaccept = 1; - yych = *(YYMARKER = ++YYCURSOR); - if (yybm[0+yych] & 128) { - goto yy215; - } - goto yy176; -yy181: - YYDEBUG(181, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy195; - if (yych <= '9') goto yy213; - goto yy195; -yy182: - YYDEBUG(182, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy195; - if (yych <= '9') goto yy211; - goto yy195; -yy183: - YYDEBUG(183, *YYCURSOR); - yyaccept = 2; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '\'') { - if (yych <= '\r') { - if (yych == '\n') goto yy184; - if (yych <= '\f') goto yy195; - } else { - if (yych == '"') goto yy184; - if (yych <= '&') goto yy195; - } - } else { - if (yych <= '9') { - if (yych == '.') goto yy207; - if (yych <= '/') goto yy195; - goto yy209; - } else { - if (yych <= ';') { - if (yych <= ':') goto yy195; - } else { - if (yych != ']') goto yy195; - } - } - } -yy184: - YYDEBUG(184, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 499 "Zend/zend_ini_scanner.l" - { /* Get number option value as string */ - RETURN_TOKEN(TC_NUMBER, yytext, yyleng); -} -#line 2354 "Zend/zend_ini_scanner.c" -yy185: - YYDEBUG(185, *YYCURSOR); - yyaccept = 3; - yych = *(YYMARKER = ++YYCURSOR); - if (yybm[0+yych] & 32) { - goto yy205; - } - if (yych <= '"') { - if (yych <= '\f') { - if (yych != '\n') goto yy195; - } else { - if (yych <= '\r') goto yy186; - if (yych <= '!') goto yy195; - } - } else { - if (yych <= ':') { - if (yych != '\'') goto yy195; - } else { - if (yych <= ';') goto yy186; - if (yych != ']') goto yy195; - } - } -yy186: - YYDEBUG(186, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 495 "Zend/zend_ini_scanner.l" - { /* Get constant option value */ - RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); -} -#line 2384 "Zend/zend_ini_scanner.c" -yy187: - YYDEBUG(187, *YYCURSOR); - yych = *++YYCURSOR; - goto yy194; -yy188: - YYDEBUG(188, *YYCURSOR); - ++YYCURSOR; - yych = *YYCURSOR; - goto yy191; -yy189: - YYDEBUG(189, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 377 "Zend/zend_ini_scanner.l" - { /* End of section */ - BEGIN(INITIAL); - SCNG(lineno)++; - return ']'; -} -#line 2403 "Zend/zend_ini_scanner.c" -yy190: - YYDEBUG(190, *YYCURSOR); - ++YYCURSOR; - YYFILL(2); - yych = *YYCURSOR; -yy191: - YYDEBUG(191, *YYCURSOR); - if (yybm[0+yych] & 2) { - goto yy190; - } - if (yych == '\n') goto yy192; - if (yych == '\r') goto yy193; - goto yy189; -yy192: - YYDEBUG(192, *YYCURSOR); - yych = *++YYCURSOR; - goto yy189; -yy193: - YYDEBUG(193, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy192; - goto yy189; -yy194: - YYDEBUG(194, *YYCURSOR); - yyaccept = 0; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; -yy195: - YYDEBUG(195, *YYCURSOR); - if (yybm[0+yych] & 4) { - goto yy194; - } - if (yych == '$') goto yy197; - if (yych != '\\') goto yy173; -yy196: - YYDEBUG(196, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - goto yy194; -yy197: - YYDEBUG(197, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - if (yych <= '\\') { - if (yych <= 0x00) goto yy198; - if (yych <= '[') goto yy194; - goto yy199; - } else { - if (yych != '{') goto yy194; - } -yy198: - YYDEBUG(198, *YYCURSOR); - YYCURSOR = YYMARKER; - if (yyaccept <= 1) { - if (yyaccept <= 0) { - goto yy173; - } else { - goto yy176; - } - } else { - if (yyaccept <= 2) { - goto yy184; - } else { - goto yy186; - } - } -yy199: - YYDEBUG(199, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - if (yybm[0+yych] & 8) { - goto yy200; - } - if (yych == '\\') goto yy202; - goto yy194; -yy200: - YYDEBUG(200, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(201, *YYCURSOR); - if (yybm[0+yych] & 8) { - goto yy200; - } - if (yych == '\\') goto yy204; - goto yy194; -yy202: - YYDEBUG(202, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(203, *YYCURSOR); - if (yybm[0+yych] & 8) { - goto yy200; - } - if (yych == '\\') goto yy202; - goto yy194; -yy204: - YYDEBUG(204, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - if (yybm[0+yych] & 8) { - goto yy200; - } - if (yych == '\\') goto yy202; - goto yy194; -yy205: - YYDEBUG(205, *YYCURSOR); - yyaccept = 3; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(206, *YYCURSOR); - if (yybm[0+yych] & 32) { - goto yy205; - } - if (yych <= '$') { - if (yych <= '\r') { - if (yych == '\n') goto yy186; - if (yych <= '\f') goto yy194; - goto yy186; - } else { - if (yych == '"') goto yy186; - if (yych <= '#') goto yy194; - goto yy197; - } - } else { - if (yych <= ';') { - if (yych == '\'') goto yy186; - if (yych <= ':') goto yy194; - goto yy186; - } else { - if (yych <= '[') goto yy194; - if (yych <= '\\') goto yy196; - if (yych <= ']') goto yy186; - goto yy194; - } - } -yy207: - YYDEBUG(207, *YYCURSOR); - yyaccept = 2; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(208, *YYCURSOR); - if (yybm[0+yych] & 64) { - goto yy207; - } - if (yych <= '$') { - if (yych <= '\r') { - if (yych == '\n') goto yy184; - if (yych <= '\f') goto yy194; - goto yy184; - } else { - if (yych == '"') goto yy184; - if (yych <= '#') goto yy194; - goto yy197; - } - } else { - if (yych <= ';') { - if (yych == '\'') goto yy184; - if (yych <= ':') goto yy194; - goto yy184; - } else { - if (yych <= '[') goto yy194; - if (yych <= '\\') goto yy196; - if (yych <= ']') goto yy184; - goto yy194; - } - } -yy209: - YYDEBUG(209, *YYCURSOR); - yyaccept = 2; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(210, *YYCURSOR); - if (yych <= '\'') { - if (yych <= '!') { - if (yych <= '\n') { - if (yych <= '\t') goto yy194; - goto yy184; - } else { - if (yych == '\r') goto yy184; - goto yy194; - } - } else { - if (yych <= '#') { - if (yych <= '"') goto yy184; - goto yy194; - } else { - if (yych <= '$') goto yy197; - if (yych <= '&') goto yy194; - goto yy184; - } - } - } else { - if (yych <= ':') { - if (yych <= '.') { - if (yych <= '-') goto yy194; - goto yy207; - } else { - if (yych <= '/') goto yy194; - if (yych <= '9') goto yy209; - goto yy194; - } - } else { - if (yych <= '[') { - if (yych <= ';') goto yy184; - goto yy194; - } else { - if (yych <= '\\') goto yy196; - if (yych <= ']') goto yy184; - goto yy194; - } - } - } -yy211: - YYDEBUG(211, *YYCURSOR); - yyaccept = 2; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(212, *YYCURSOR); - if (yych <= '&') { - if (yych <= '\r') { - if (yych == '\n') goto yy184; - if (yych <= '\f') goto yy194; - goto yy184; - } else { - if (yych <= '"') { - if (yych <= '!') goto yy194; - goto yy184; - } else { - if (yych == '$') goto yy197; - goto yy194; - } - } - } else { - if (yych <= ':') { - if (yych <= '\'') goto yy184; - if (yych <= '/') goto yy194; - if (yych <= '9') goto yy211; - goto yy194; - } else { - if (yych <= '[') { - if (yych <= ';') goto yy184; - goto yy194; - } else { - if (yych <= '\\') goto yy196; - if (yych <= ']') goto yy184; - goto yy194; - } - } - } -yy213: - YYDEBUG(213, *YYCURSOR); - yyaccept = 2; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(214, *YYCURSOR); - if (yych <= '&') { - if (yych <= '\r') { - if (yych == '\n') goto yy184; - if (yych <= '\f') goto yy194; - goto yy184; - } else { - if (yych <= '"') { - if (yych <= '!') goto yy194; - goto yy184; - } else { - if (yych == '$') goto yy197; - goto yy194; - } - } - } else { - if (yych <= ':') { - if (yych <= '\'') goto yy184; - if (yych <= '/') goto yy194; - if (yych <= '9') goto yy213; - goto yy194; - } else { - if (yych <= '[') { - if (yych <= ';') goto yy184; - goto yy194; - } else { - if (yych <= '\\') goto yy196; - if (yych <= ']') goto yy184; - goto yy194; - } - } - } -yy215: - YYDEBUG(215, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(216, *YYCURSOR); - if (yybm[0+yych] & 128) { - goto yy215; - } - YYDEBUG(217, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(218, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 368 "Zend/zend_ini_scanner.l" - { /* Raw string */ - /* Eat leading and trailing single quotes */ - if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') { - SCNG(yy_text)++; - yyleng = yyleng - 2; - } - RETURN_TOKEN(TC_RAW, yytext, yyleng); -} -#line 2724 "Zend/zend_ini_scanner.c" -yy219: - YYDEBUG(219, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(220, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 401 "Zend/zend_ini_scanner.l" - { /* Variable start */ - yy_push_state(ST_VARNAME TSRMLS_CC); - return TC_DOLLAR_CURLY; -} -#line 2735 "Zend/zend_ini_scanner.c" -yy221: - YYDEBUG(221, *YYCURSOR); - yyaccept = 0; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(222, *YYCURSOR); - if (yych <= '"') { - if (yych <= '\f') { - if (yych <= 0x08) goto yy194; - if (yych <= '\t') goto yy221; - if (yych <= '\n') goto yy173; - goto yy194; - } else { - if (yych <= 0x1F) { - if (yych <= '\r') goto yy173; - goto yy194; - } else { - if (yych <= ' ') goto yy221; - if (yych <= '!') goto yy194; - } - } - } else { - if (yych <= ':') { - if (yych <= '$') { - if (yych <= '#') goto yy194; - goto yy197; - } else { - if (yych == '\'') goto yy173; - goto yy194; - } - } else { - if (yych <= '[') { - if (yych <= ';') goto yy173; - goto yy194; - } else { - if (yych <= '\\') goto yy196; - if (yych <= ']') goto yy173; - goto yy194; - } - } - } -yy223: - YYDEBUG(223, *YYCURSOR); - ++YYCURSOR; - yych = *YYCURSOR; - goto yy178; - } -/* *********************************** */ -yyc_ST_VALUE: - { - static const unsigned char yybm[] = { - 160, 162, 162, 162, 162, 162, 162, 162, - 162, 176, 128, 162, 162, 128, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 176, 160, 160, 162, 168, 162, 160, 32, - 160, 160, 162, 162, 162, 162, 162, 162, - 230, 230, 230, 230, 230, 230, 230, 230, - 230, 230, 162, 160, 162, 160, 162, 162, - 162, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 162, 162, 162, 160, 166, - 162, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 162, 160, 162, 160, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - }; - YYDEBUG(224, *YYCURSOR); - YYFILL(6); - yych = *YYCURSOR; - YYDEBUG(-1, yych); - switch (yych) { - case 0x00: goto yy226; - case '\t': - case ' ': goto yy230; - case '\n': goto yy232; - case '\r': goto yy234; - case '!': - case '&': - case '(': - case ')': - case '^': - case '|': - case '~': goto yy235; - case '"': goto yy237; - case '$': goto yy239; - case '\'': goto yy240; - case '-': goto yy241; - case '.': goto yy242; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto yy243; - case ';': goto yy245; - case '=': goto yy246; - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'p': - case 'q': - case 'r': - case 's': - case 'u': - case 'v': - case 'w': - case 'x': - case 'z': goto yy248; - case 'F': - case 'f': goto yy250; - case 'N': - case 'n': goto yy251; - case 'O': - case 'o': goto yy252; - case 'T': - case 't': goto yy253; - case 'Y': - case 'y': goto yy254; - default: goto yy228; - } -yy226: - YYDEBUG(226, *YYCURSOR); - ++YYCURSOR; -yy227: - YYDEBUG(227, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 598 "Zend/zend_ini_scanner.l" - { /* End of option value (if EOF is reached before EOL */ - BEGIN(INITIAL); - return END_OF_LINE; -} -#line 2921 "Zend/zend_ini_scanner.c" -yy228: - YYDEBUG(228, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - goto yy256; -yy229: - YYDEBUG(229, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 517 "Zend/zend_ini_scanner.l" - { /* Get everything else as option/offset value */ - RETURN_TOKEN(TC_STRING, yytext, yyleng); -} -#line 2934 "Zend/zend_ini_scanner.c" -yy230: - YYDEBUG(230, *YYCURSOR); - yyaccept = 1; - yych = *(YYMARKER = ++YYCURSOR); - goto yy306; -yy231: - YYDEBUG(231, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 571 "Zend/zend_ini_scanner.l" - { - RETURN_TOKEN(TC_WHITESPACE, yytext, yyleng); -} -#line 2947 "Zend/zend_ini_scanner.c" -yy232: - YYDEBUG(232, *YYCURSOR); - ++YYCURSOR; -yy233: - YYDEBUG(233, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 489 "Zend/zend_ini_scanner.l" - { /* End of option value */ - BEGIN(INITIAL); - SCNG(lineno)++; - return END_OF_LINE; -} -#line 2960 "Zend/zend_ini_scanner.c" -yy234: - YYDEBUG(234, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy304; - goto yy233; -yy235: - YYDEBUG(235, *YYCURSOR); - ++YYCURSOR; - yych = *YYCURSOR; - goto yy303; -yy236: - YYDEBUG(236, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 507 "Zend/zend_ini_scanner.l" - { /* Boolean operators */ - return yytext[0]; -} -#line 2978 "Zend/zend_ini_scanner.c" -yy237: - YYDEBUG(237, *YYCURSOR); - ++YYCURSOR; -yy238: - YYDEBUG(238, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 525 "Zend/zend_ini_scanner.l" - { /* Double quoted '"' string start */ - yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); - return '"'; -} -#line 2990 "Zend/zend_ini_scanner.c" -yy239: - YYDEBUG(239, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= '\\') { - if (yych <= 0x00) goto yy227; - if (yych <= '[') goto yy255; - goto yy262; - } else { - if (yych == '{') goto yy300; - goto yy255; - } -yy240: - YYDEBUG(240, *YYCURSOR); - yyaccept = 2; - yych = *(YYMARKER = ++YYCURSOR); - if (yybm[0+yych] & 128) { - goto yy296; - } - goto yy227; -yy241: - YYDEBUG(241, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy256; - if (yych <= '9') goto yy294; - goto yy256; -yy242: - YYDEBUG(242, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy256; - if (yych <= '9') goto yy292; - goto yy256; -yy243: - YYDEBUG(243, *YYCURSOR); - yyaccept = 3; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') { - if (yych <= 0x1F) { - if (yych <= '\n') { - if (yych <= 0x00) goto yy244; - if (yych <= 0x08) goto yy256; - } else { - if (yych != '\r') goto yy256; - } - } else { - if (yych <= ')') { - if (yych <= '"') goto yy244; - if (yych <= '%') goto yy256; - } else { - if (yych == '.') goto yy288; - goto yy256; - } - } - } else { - if (yych <= ']') { - if (yych <= ';') { - if (yych <= '9') goto yy290; - if (yych <= ':') goto yy256; - } else { - if (yych != '=') goto yy256; - } - } else { - if (yych <= '|') { - if (yych <= '^') goto yy244; - if (yych <= '{') goto yy256; - } else { - if (yych != '~') goto yy256; - } - } - } -yy244: - YYDEBUG(244, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 499 "Zend/zend_ini_scanner.l" - { /* Get number option value as string */ - RETURN_TOKEN(TC_NUMBER, yytext, yyleng); -} -#line 3069 "Zend/zend_ini_scanner.c" -yy245: - YYDEBUG(245, *YYCURSOR); - yyaccept = 2; - yych = *(YYMARKER = ++YYCURSOR); - goto yy284; -yy246: - YYDEBUG(246, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(247, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 511 "Zend/zend_ini_scanner.l" - { /* Make = used in option value to trigger error */ - yyless(0); - BEGIN(INITIAL); - return END_OF_LINE; -} -#line 3086 "Zend/zend_ini_scanner.c" -yy248: - YYDEBUG(248, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yybm[0+yych] & 4) { - goto yy257; - } - if (yych <= ':') { - if (yych <= '\r') { - if (yych <= 0x08) { - if (yych >= 0x01) goto yy256; - } else { - if (yych <= '\n') goto yy249; - if (yych <= '\f') goto yy256; - } - } else { - if (yych <= '"') { - if (yych <= 0x1F) goto yy256; - } else { - if (yych <= '%') goto yy256; - if (yych >= '*') goto yy256; - } - } - } else { - if (yych <= '^') { - if (yych <= '<') { - if (yych >= '<') goto yy256; - } else { - if (yych <= '=') goto yy249; - if (yych <= ']') goto yy256; - } - } else { - if (yych <= '|') { - if (yych <= '{') goto yy256; - } else { - if (yych != '~') goto yy256; - } - } - } -yy249: - YYDEBUG(249, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 495 "Zend/zend_ini_scanner.l" - { /* Get constant option value */ - RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); -} -#line 3133 "Zend/zend_ini_scanner.c" -yy250: - YYDEBUG(250, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '<') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy249; - if (yych <= 0x08) goto yy256; - goto yy249; - } else { - if (yych == '\r') goto yy249; - if (yych <= 0x1F) goto yy256; - goto yy249; - } - } else { - if (yych <= '/') { - if (yych <= '%') goto yy256; - if (yych <= ')') goto yy249; - goto yy256; - } else { - if (yych <= '9') goto yy257; - if (yych == ';') goto yy249; - goto yy256; - } - } - } else { - if (yych <= '_') { - if (yych <= 'A') { - if (yych <= '=') goto yy249; - if (yych <= '@') goto yy256; - goto yy280; - } else { - if (yych <= 'Z') goto yy257; - if (yych <= ']') goto yy256; - if (yych <= '^') goto yy249; - goto yy257; - } - } else { - if (yych <= '{') { - if (yych <= '`') goto yy256; - if (yych <= 'a') goto yy280; - if (yych <= 'z') goto yy257; - goto yy256; - } else { - if (yych == '}') goto yy256; - if (yych <= '~') goto yy249; - goto yy256; - } - } - } -yy251: - YYDEBUG(251, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= 'N') { - if (yych <= '%') { - if (yych <= '\f') { - if (yych <= 0x00) goto yy249; - if (yych <= 0x08) goto yy256; - if (yych <= '\n') goto yy249; - goto yy256; - } else { - if (yych <= '\r') goto yy249; - if (yych <= 0x1F) goto yy256; - if (yych <= '"') goto yy249; - goto yy256; - } - } else { - if (yych <= ':') { - if (yych <= ')') goto yy249; - if (yych <= '/') goto yy256; - if (yych <= '9') goto yy257; - goto yy256; - } else { - if (yych <= '<') { - if (yych <= ';') goto yy249; - goto yy256; - } else { - if (yych <= '=') goto yy249; - if (yych <= '@') goto yy256; - goto yy257; - } - } - } - } else { - if (yych <= 'n') { - if (yych <= 'Z') { - if (yych <= 'O') goto yy276; - if (yych == 'U') goto yy277; - goto yy257; - } else { - if (yych <= '^') { - if (yych <= ']') goto yy256; - goto yy249; - } else { - if (yych == '`') goto yy256; - goto yy257; - } - } - } else { - if (yych <= 'z') { - if (yych <= 'o') goto yy276; - if (yych == 'u') goto yy277; - goto yy257; - } else { - if (yych <= '|') { - if (yych <= '{') goto yy256; - goto yy249; - } else { - if (yych == '~') goto yy249; - goto yy256; - } - } - } - } -yy252: - YYDEBUG(252, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= 'E') { - if (yych <= '%') { - if (yych <= '\f') { - if (yych <= 0x00) goto yy249; - if (yych <= 0x08) goto yy256; - if (yych <= '\n') goto yy249; - goto yy256; - } else { - if (yych <= '\r') goto yy249; - if (yych <= 0x1F) goto yy256; - if (yych <= '"') goto yy249; - goto yy256; - } - } else { - if (yych <= ':') { - if (yych <= ')') goto yy249; - if (yych <= '/') goto yy256; - if (yych <= '9') goto yy257; - goto yy256; - } else { - if (yych <= '<') { - if (yych <= ';') goto yy249; - goto yy256; - } else { - if (yych <= '=') goto yy249; - if (yych <= '@') goto yy256; - goto yy257; - } - } - } - } else { - if (yych <= 'e') { - if (yych <= 'Z') { - if (yych <= 'F') goto yy271; - if (yych == 'N') goto yy265; - goto yy257; - } else { - if (yych <= '^') { - if (yych <= ']') goto yy256; - goto yy249; - } else { - if (yych == '`') goto yy256; - goto yy257; - } - } - } else { - if (yych <= 'z') { - if (yych <= 'f') goto yy271; - if (yych == 'n') goto yy265; - goto yy257; - } else { - if (yych <= '|') { - if (yych <= '{') goto yy256; - goto yy249; - } else { - if (yych == '~') goto yy249; - goto yy256; - } - } - } - } -yy253: - YYDEBUG(253, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy249; - if (yych <= 0x08) goto yy256; - goto yy249; - } else { - if (yych == '\r') goto yy249; - if (yych <= 0x1F) goto yy256; - goto yy249; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy256; - if (yych <= ')') goto yy249; - if (yych <= '/') goto yy256; - goto yy257; - } else { - if (yych == ';') goto yy249; - if (yych <= '<') goto yy256; - goto yy249; - } - } - } else { - if (yych <= '`') { - if (yych <= 'Z') { - if (yych <= '@') goto yy256; - if (yych == 'R') goto yy269; - goto yy257; - } else { - if (yych <= ']') goto yy256; - if (yych <= '^') goto yy249; - if (yych <= '_') goto yy257; - goto yy256; - } - } else { - if (yych <= '{') { - if (yych == 'r') goto yy269; - if (yych <= 'z') goto yy257; - goto yy256; - } else { - if (yych == '}') goto yy256; - if (yych <= '~') goto yy249; - goto yy256; - } - } - } -yy254: - YYDEBUG(254, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy249; - if (yych <= 0x08) goto yy256; - goto yy249; - } else { - if (yych == '\r') goto yy249; - if (yych <= 0x1F) goto yy256; - goto yy249; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy256; - if (yych <= ')') goto yy249; - if (yych <= '/') goto yy256; - goto yy257; - } else { - if (yych == ';') goto yy249; - if (yych <= '<') goto yy256; - goto yy249; - } - } - } else { - if (yych <= '`') { - if (yych <= 'Z') { - if (yych <= '@') goto yy256; - if (yych == 'E') goto yy259; - goto yy257; - } else { - if (yych <= ']') goto yy256; - if (yych <= '^') goto yy249; - if (yych <= '_') goto yy257; - goto yy256; - } - } else { - if (yych <= '{') { - if (yych == 'e') goto yy259; - if (yych <= 'z') goto yy257; - goto yy256; - } else { - if (yych == '}') goto yy256; - if (yych <= '~') goto yy249; - goto yy256; - } - } - } -yy255: - YYDEBUG(255, *YYCURSOR); - yyaccept = 0; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; -yy256: - YYDEBUG(256, *YYCURSOR); - if (yybm[0+yych] & 2) { - goto yy255; - } - if (yych == '$') goto yy260; - goto yy229; -yy257: - YYDEBUG(257, *YYCURSOR); - yyaccept = 4; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(258, *YYCURSOR); - if (yybm[0+yych] & 4) { - goto yy257; - } - if (yych <= ')') { - if (yych <= '\r') { - if (yych <= 0x08) { - if (yych <= 0x00) goto yy249; - goto yy255; - } else { - if (yych <= '\n') goto yy249; - if (yych <= '\f') goto yy255; - goto yy249; - } - } else { - if (yych <= '#') { - if (yych <= 0x1F) goto yy255; - if (yych <= '"') goto yy249; - goto yy255; - } else { - if (yych <= '$') goto yy260; - if (yych <= '%') goto yy255; - goto yy249; - } - } - } else { - if (yych <= ']') { - if (yych <= ';') { - if (yych <= ':') goto yy255; - goto yy249; - } else { - if (yych == '=') goto yy249; - goto yy255; - } - } else { - if (yych <= '|') { - if (yych <= '^') goto yy249; - if (yych <= '{') goto yy255; - goto yy249; - } else { - if (yych == '~') goto yy249; - goto yy255; - } - } - } -yy259: - YYDEBUG(259, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy249; - if (yych <= 0x08) goto yy256; - goto yy249; - } else { - if (yych == '\r') goto yy249; - if (yych <= 0x1F) goto yy256; - goto yy249; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy256; - if (yych <= ')') goto yy249; - if (yych <= '/') goto yy256; - goto yy257; - } else { - if (yych == ';') goto yy249; - if (yych <= '<') goto yy256; - goto yy249; - } - } - } else { - if (yych <= '`') { - if (yych <= 'Z') { - if (yych <= '@') goto yy256; - if (yych == 'S') goto yy265; - goto yy257; - } else { - if (yych <= ']') goto yy256; - if (yych <= '^') goto yy249; - if (yych <= '_') goto yy257; - goto yy256; - } - } else { - if (yych <= '{') { - if (yych == 's') goto yy265; - if (yych <= 'z') goto yy257; - goto yy256; - } else { - if (yych == '}') goto yy256; - if (yych <= '~') goto yy249; - goto yy256; - } - } - } -yy260: - YYDEBUG(260, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - if (yych <= '\\') { - if (yych <= 0x00) goto yy261; - if (yych <= '[') goto yy255; - goto yy262; - } else { - if (yych != '{') goto yy255; - } -yy261: - YYDEBUG(261, *YYCURSOR); - YYCURSOR = YYMARKER; - if (yyaccept <= 3) { - if (yyaccept <= 1) { - if (yyaccept <= 0) { - goto yy229; - } else { - goto yy231; - } - } else { - if (yyaccept <= 2) { - goto yy227; - } else { - goto yy244; - } - } - } else { - if (yyaccept <= 5) { - if (yyaccept <= 4) { - goto yy249; - } else { - goto yy266; - } - } else { - goto yy273; - } - } -yy262: - YYDEBUG(262, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - if (yybm[0+yych] & 8) { - goto yy263; - } - goto yy255; -yy263: - YYDEBUG(263, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(264, *YYCURSOR); - if (yybm[0+yych] & 8) { - goto yy263; - } - if (yych <= 0x00) goto yy229; - if (yych == '\\') goto yy262; - goto yy255; -yy265: - YYDEBUG(265, *YYCURSOR); - yyaccept = 5; - yych = *(YYMARKER = ++YYCURSOR); - if (yybm[0+yych] & 16) { - goto yy267; - } - if (yych <= ';') { - if (yych <= ' ') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy266; - if (yych <= '\t') goto yy256; - } else { - if (yych != '\r') goto yy256; - } - } else { - if (yych <= ')') { - if (yych <= '"') goto yy266; - if (yych <= '%') goto yy256; - } else { - if (yych <= '/') goto yy256; - if (yych <= '9') goto yy257; - if (yych <= ':') goto yy256; - } - } - } else { - if (yych <= '_') { - if (yych <= '@') { - if (yych != '=') goto yy256; - } else { - if (yych <= 'Z') goto yy257; - if (yych <= ']') goto yy256; - if (yych >= '_') goto yy257; - } - } else { - if (yych <= '{') { - if (yych <= '`') goto yy256; - if (yych <= 'z') goto yy257; - goto yy256; - } else { - if (yych == '}') goto yy256; - if (yych >= 0x7F) goto yy256; - } - } - } -yy266: - YYDEBUG(266, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 421 "Zend/zend_ini_scanner.l" - { /* TRUE value (when used outside option value/offset this causes parse error!) */ - RETURN_TOKEN(BOOL_TRUE, "1", 1); -} -#line 3645 "Zend/zend_ini_scanner.c" -yy267: - YYDEBUG(267, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(268, *YYCURSOR); - if (yybm[0+yych] & 16) { - goto yy267; - } - goto yy266; -yy269: - YYDEBUG(269, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy249; - if (yych <= 0x08) goto yy256; - goto yy249; - } else { - if (yych == '\r') goto yy249; - if (yych <= 0x1F) goto yy256; - goto yy249; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy256; - if (yych <= ')') goto yy249; - if (yych <= '/') goto yy256; - goto yy257; - } else { - if (yych == ';') goto yy249; - if (yych <= '<') goto yy256; - goto yy249; - } - } - } else { - if (yych <= '`') { - if (yych <= 'Z') { - if (yych <= '@') goto yy256; - if (yych != 'U') goto yy257; - } else { - if (yych <= ']') goto yy256; - if (yych <= '^') goto yy249; - if (yych <= '_') goto yy257; - goto yy256; - } - } else { - if (yych <= '{') { - if (yych == 'u') goto yy270; - if (yych <= 'z') goto yy257; - goto yy256; - } else { - if (yych == '}') goto yy256; - if (yych <= '~') goto yy249; - goto yy256; - } - } - } -yy270: - YYDEBUG(270, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy249; - if (yych <= 0x08) goto yy256; - goto yy249; - } else { - if (yych == '\r') goto yy249; - if (yych <= 0x1F) goto yy256; - goto yy249; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy256; - if (yych <= ')') goto yy249; - if (yych <= '/') goto yy256; - goto yy257; - } else { - if (yych == ';') goto yy249; - if (yych <= '<') goto yy256; - goto yy249; - } - } - } else { - if (yych <= '`') { - if (yych <= 'Z') { - if (yych <= '@') goto yy256; - if (yych == 'E') goto yy265; - goto yy257; - } else { - if (yych <= ']') goto yy256; - if (yych <= '^') goto yy249; - if (yych <= '_') goto yy257; - goto yy256; - } - } else { - if (yych <= '{') { - if (yych == 'e') goto yy265; - if (yych <= 'z') goto yy257; - goto yy256; - } else { - if (yych == '}') goto yy256; - if (yych <= '~') goto yy249; - goto yy256; - } - } - } -yy271: - YYDEBUG(271, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy249; - if (yych <= 0x08) goto yy256; - goto yy249; - } else { - if (yych == '\r') goto yy249; - if (yych <= 0x1F) goto yy256; - goto yy249; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy256; - if (yych <= ')') goto yy249; - if (yych <= '/') goto yy256; - goto yy257; - } else { - if (yych == ';') goto yy249; - if (yych <= '<') goto yy256; - goto yy249; - } - } - } else { - if (yych <= '`') { - if (yych <= 'Z') { - if (yych <= '@') goto yy256; - if (yych != 'F') goto yy257; - } else { - if (yych <= ']') goto yy256; - if (yych <= '^') goto yy249; - if (yych <= '_') goto yy257; - goto yy256; - } - } else { - if (yych <= '{') { - if (yych == 'f') goto yy272; - if (yych <= 'z') goto yy257; - goto yy256; - } else { - if (yych == '}') goto yy256; - if (yych <= '~') goto yy249; - goto yy256; - } - } - } -yy272: - YYDEBUG(272, *YYCURSOR); - yyaccept = 6; - yych = *(YYMARKER = ++YYCURSOR); - if (yybm[0+yych] & 4) { - goto yy257; - } - if (yych <= ')') { - if (yych <= '\f') { - if (yych <= 0x08) { - if (yych >= 0x01) goto yy256; - } else { - if (yych <= '\t') goto yy274; - if (yych >= '\v') goto yy256; - } - } else { - if (yych <= ' ') { - if (yych <= '\r') goto yy273; - if (yych <= 0x1F) goto yy256; - goto yy274; - } else { - if (yych <= '"') goto yy273; - if (yych <= '%') goto yy256; - } - } - } else { - if (yych <= ']') { - if (yych <= ';') { - if (yych <= ':') goto yy256; - } else { - if (yych != '=') goto yy256; - } - } else { - if (yych <= '|') { - if (yych <= '^') goto yy273; - if (yych <= '{') goto yy256; - } else { - if (yych != '~') goto yy256; - } - } - } -yy273: - YYDEBUG(273, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 425 "Zend/zend_ini_scanner.l" - { /* FALSE value (when used outside option value/offset this causes parse error!)*/ - RETURN_TOKEN(BOOL_FALSE, "", 0); -} -#line 3855 "Zend/zend_ini_scanner.c" -yy274: - YYDEBUG(274, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(275, *YYCURSOR); - if (yych == '\t') goto yy274; - if (yych == ' ') goto yy274; - goto yy273; -yy276: - YYDEBUG(276, *YYCURSOR); - yyaccept = 6; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '<') { - if (yych <= ' ') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy273; - if (yych <= 0x08) goto yy256; - if (yych <= '\t') goto yy274; - goto yy273; - } else { - if (yych == '\r') goto yy273; - if (yych <= 0x1F) goto yy256; - goto yy274; - } - } else { - if (yych <= '/') { - if (yych <= '"') goto yy273; - if (yych <= '%') goto yy256; - if (yych <= ')') goto yy273; - goto yy256; - } else { - if (yych <= '9') goto yy257; - if (yych == ';') goto yy273; - goto yy256; - } - } - } else { - if (yych <= '_') { - if (yych <= 'N') { - if (yych <= '=') goto yy273; - if (yych <= '@') goto yy256; - if (yych <= 'M') goto yy257; - goto yy279; - } else { - if (yych <= 'Z') goto yy257; - if (yych <= ']') goto yy256; - if (yych <= '^') goto yy273; - goto yy257; - } - } else { - if (yych <= 'z') { - if (yych <= '`') goto yy256; - if (yych == 'n') goto yy279; - goto yy257; - } else { - if (yych <= '|') { - if (yych <= '{') goto yy256; - goto yy273; - } else { - if (yych == '~') goto yy273; - goto yy256; - } - } - } - } -yy277: - YYDEBUG(277, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy249; - if (yych <= 0x08) goto yy256; - goto yy249; - } else { - if (yych == '\r') goto yy249; - if (yych <= 0x1F) goto yy256; - goto yy249; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy256; - if (yych <= ')') goto yy249; - if (yych <= '/') goto yy256; - goto yy257; - } else { - if (yych == ';') goto yy249; - if (yych <= '<') goto yy256; - goto yy249; - } - } - } else { - if (yych <= '`') { - if (yych <= 'Z') { - if (yych <= '@') goto yy256; - if (yych != 'L') goto yy257; - } else { - if (yych <= ']') goto yy256; - if (yych <= '^') goto yy249; - if (yych <= '_') goto yy257; - goto yy256; - } - } else { - if (yych <= '{') { - if (yych == 'l') goto yy278; - if (yych <= 'z') goto yy257; - goto yy256; - } else { - if (yych == '}') goto yy256; - if (yych <= '~') goto yy249; - goto yy256; - } - } - } -yy278: - YYDEBUG(278, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy249; - if (yych <= 0x08) goto yy256; - goto yy249; - } else { - if (yych == '\r') goto yy249; - if (yych <= 0x1F) goto yy256; - goto yy249; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy256; - if (yych <= ')') goto yy249; - if (yych <= '/') goto yy256; - goto yy257; - } else { - if (yych == ';') goto yy249; - if (yych <= '<') goto yy256; - goto yy249; - } - } - } else { - if (yych <= '`') { - if (yych <= 'Z') { - if (yych <= '@') goto yy256; - if (yych == 'L') goto yy272; - goto yy257; - } else { - if (yych <= ']') goto yy256; - if (yych <= '^') goto yy249; - if (yych <= '_') goto yy257; - goto yy256; - } - } else { - if (yych <= '{') { - if (yych == 'l') goto yy272; - if (yych <= 'z') goto yy257; - goto yy256; - } else { - if (yych == '}') goto yy256; - if (yych <= '~') goto yy249; - goto yy256; - } - } - } -yy279: - YYDEBUG(279, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy249; - if (yych <= 0x08) goto yy256; - goto yy249; - } else { - if (yych == '\r') goto yy249; - if (yych <= 0x1F) goto yy256; - goto yy249; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy256; - if (yych <= ')') goto yy249; - if (yych <= '/') goto yy256; - goto yy257; - } else { - if (yych == ';') goto yy249; - if (yych <= '<') goto yy256; - goto yy249; - } - } - } else { - if (yych <= '`') { - if (yych <= 'Z') { - if (yych <= '@') goto yy256; - if (yych == 'E') goto yy272; - goto yy257; - } else { - if (yych <= ']') goto yy256; - if (yych <= '^') goto yy249; - if (yych <= '_') goto yy257; - goto yy256; - } - } else { - if (yych <= '{') { - if (yych == 'e') goto yy272; - if (yych <= 'z') goto yy257; - goto yy256; - } else { - if (yych == '}') goto yy256; - if (yych <= '~') goto yy249; - goto yy256; - } - } - } -yy280: - YYDEBUG(280, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy249; - if (yych <= 0x08) goto yy256; - goto yy249; - } else { - if (yych == '\r') goto yy249; - if (yych <= 0x1F) goto yy256; - goto yy249; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy256; - if (yych <= ')') goto yy249; - if (yych <= '/') goto yy256; - goto yy257; - } else { - if (yych == ';') goto yy249; - if (yych <= '<') goto yy256; - goto yy249; - } - } - } else { - if (yych <= '`') { - if (yych <= 'Z') { - if (yych <= '@') goto yy256; - if (yych != 'L') goto yy257; - } else { - if (yych <= ']') goto yy256; - if (yych <= '^') goto yy249; - if (yych <= '_') goto yy257; - goto yy256; - } - } else { - if (yych <= '{') { - if (yych == 'l') goto yy281; - if (yych <= 'z') goto yy257; - goto yy256; - } else { - if (yych == '}') goto yy256; - if (yych <= '~') goto yy249; - goto yy256; - } - } - } -yy281: - YYDEBUG(281, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy249; - if (yych <= 0x08) goto yy256; - goto yy249; - } else { - if (yych == '\r') goto yy249; - if (yych <= 0x1F) goto yy256; - goto yy249; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy256; - if (yych <= ')') goto yy249; - if (yych <= '/') goto yy256; - goto yy257; - } else { - if (yych == ';') goto yy249; - if (yych <= '<') goto yy256; - goto yy249; - } - } - } else { - if (yych <= '`') { - if (yych <= 'Z') { - if (yych <= '@') goto yy256; - if (yych != 'S') goto yy257; - } else { - if (yych <= ']') goto yy256; - if (yych <= '^') goto yy249; - if (yych <= '_') goto yy257; - goto yy256; - } - } else { - if (yych <= '{') { - if (yych == 's') goto yy282; - if (yych <= 'z') goto yy257; - goto yy256; - } else { - if (yych == '}') goto yy256; - if (yych <= '~') goto yy249; - goto yy256; - } - } - } -yy282: - YYDEBUG(282, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy249; - if (yych <= 0x08) goto yy256; - goto yy249; - } else { - if (yych == '\r') goto yy249; - if (yych <= 0x1F) goto yy256; - goto yy249; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy256; - if (yych <= ')') goto yy249; - if (yych <= '/') goto yy256; - goto yy257; - } else { - if (yych == ';') goto yy249; - if (yych <= '<') goto yy256; - goto yy249; - } - } - } else { - if (yych <= '`') { - if (yych <= 'Z') { - if (yych <= '@') goto yy256; - if (yych == 'E') goto yy272; - goto yy257; - } else { - if (yych <= ']') goto yy256; - if (yych <= '^') goto yy249; - if (yych <= '_') goto yy257; - goto yy256; - } - } else { - if (yych <= '{') { - if (yych == 'e') goto yy272; - if (yych <= 'z') goto yy257; - goto yy256; - } else { - if (yych == '}') goto yy256; - if (yych <= '~') goto yy249; - goto yy256; - } - } - } -yy283: - YYDEBUG(283, *YYCURSOR); - ++YYCURSOR; - YYFILL(2); - yych = *YYCURSOR; -yy284: - YYDEBUG(284, *YYCURSOR); - if (yybm[0+yych] & 32) { - goto yy283; - } - if (yych >= '\r') goto yy287; -yy285: - YYDEBUG(285, *YYCURSOR); - ++YYCURSOR; -yy286: - YYDEBUG(286, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 585 "Zend/zend_ini_scanner.l" - { /* Comment */ - BEGIN(INITIAL); - SCNG(lineno)++; - return END_OF_LINE; -} -#line 4248 "Zend/zend_ini_scanner.c" -yy287: - YYDEBUG(287, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy285; - goto yy286; -yy288: - YYDEBUG(288, *YYCURSOR); - yyaccept = 3; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(289, *YYCURSOR); - if (yybm[0+yych] & 64) { - goto yy288; - } - if (yych <= ')') { - if (yych <= '\r') { - if (yych <= 0x08) { - if (yych <= 0x00) goto yy244; - goto yy255; - } else { - if (yych <= '\n') goto yy244; - if (yych <= '\f') goto yy255; - goto yy244; - } - } else { - if (yych <= '#') { - if (yych <= 0x1F) goto yy255; - if (yych <= '"') goto yy244; - goto yy255; - } else { - if (yych <= '$') goto yy260; - if (yych <= '%') goto yy255; - goto yy244; - } - } - } else { - if (yych <= ']') { - if (yych <= ';') { - if (yych <= ':') goto yy255; - goto yy244; - } else { - if (yych == '=') goto yy244; - goto yy255; - } - } else { - if (yych <= '|') { - if (yych <= '^') goto yy244; - if (yych <= '{') goto yy255; - goto yy244; - } else { - if (yych == '~') goto yy244; - goto yy255; - } - } - } -yy290: - YYDEBUG(290, *YYCURSOR); - yyaccept = 3; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(291, *YYCURSOR); - if (yych <= '.') { - if (yych <= 0x1F) { - if (yych <= '\n') { - if (yych <= 0x00) goto yy244; - if (yych <= 0x08) goto yy255; - goto yy244; - } else { - if (yych == '\r') goto yy244; - goto yy255; - } - } else { - if (yych <= '$') { - if (yych <= '"') goto yy244; - if (yych <= '#') goto yy255; - goto yy260; - } else { - if (yych <= '%') goto yy255; - if (yych <= ')') goto yy244; - if (yych <= '-') goto yy255; - goto yy288; - } - } - } else { - if (yych <= '=') { - if (yych <= ':') { - if (yych <= '/') goto yy255; - if (yych <= '9') goto yy290; - goto yy255; - } else { - if (yych == '<') goto yy255; - goto yy244; - } - } else { - if (yych <= '{') { - if (yych == '^') goto yy244; - goto yy255; - } else { - if (yych == '}') goto yy255; - if (yych <= '~') goto yy244; - goto yy255; - } - } - } -yy292: - YYDEBUG(292, *YYCURSOR); - yyaccept = 3; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(293, *YYCURSOR); - if (yych <= '/') { - if (yych <= 0x1F) { - if (yych <= '\n') { - if (yych <= 0x00) goto yy244; - if (yych <= 0x08) goto yy255; - goto yy244; - } else { - if (yych == '\r') goto yy244; - goto yy255; - } - } else { - if (yych <= '$') { - if (yych <= '"') goto yy244; - if (yych <= '#') goto yy255; - goto yy260; - } else { - if (yych <= '%') goto yy255; - if (yych <= ')') goto yy244; - goto yy255; - } - } - } else { - if (yych <= ']') { - if (yych <= ';') { - if (yych <= '9') goto yy292; - if (yych <= ':') goto yy255; - goto yy244; - } else { - if (yych == '=') goto yy244; - goto yy255; - } - } else { - if (yych <= '|') { - if (yych <= '^') goto yy244; - if (yych <= '{') goto yy255; - goto yy244; - } else { - if (yych == '~') goto yy244; - goto yy255; - } - } - } -yy294: - YYDEBUG(294, *YYCURSOR); - yyaccept = 3; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(295, *YYCURSOR); - if (yych <= '/') { - if (yych <= 0x1F) { - if (yych <= '\n') { - if (yych <= 0x00) goto yy244; - if (yych <= 0x08) goto yy255; - goto yy244; - } else { - if (yych == '\r') goto yy244; - goto yy255; - } - } else { - if (yych <= '$') { - if (yych <= '"') goto yy244; - if (yych <= '#') goto yy255; - goto yy260; - } else { - if (yych <= '%') goto yy255; - if (yych <= ')') goto yy244; - goto yy255; - } - } - } else { - if (yych <= ']') { - if (yych <= ';') { - if (yych <= '9') goto yy294; - if (yych <= ':') goto yy255; - goto yy244; - } else { - if (yych == '=') goto yy244; - goto yy255; - } - } else { - if (yych <= '|') { - if (yych <= '^') goto yy244; - if (yych <= '{') goto yy255; - goto yy244; - } else { - if (yych == '~') goto yy244; - goto yy255; - } - } - } -yy296: - YYDEBUG(296, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(297, *YYCURSOR); - if (yybm[0+yych] & 128) { - goto yy296; - } - YYDEBUG(298, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(299, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 368 "Zend/zend_ini_scanner.l" - { /* Raw string */ - /* Eat leading and trailing single quotes */ - if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') { - SCNG(yy_text)++; - yyleng = yyleng - 2; - } - RETURN_TOKEN(TC_RAW, yytext, yyleng); -} -#line 4475 "Zend/zend_ini_scanner.c" -yy300: - YYDEBUG(300, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(301, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 401 "Zend/zend_ini_scanner.l" - { /* Variable start */ - yy_push_state(ST_VARNAME TSRMLS_CC); - return TC_DOLLAR_CURLY; -} -#line 4486 "Zend/zend_ini_scanner.c" -yy302: - YYDEBUG(302, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; -yy303: - YYDEBUG(303, *YYCURSOR); - if (yych == '\t') goto yy302; - if (yych == ' ') goto yy302; - goto yy236; -yy304: - YYDEBUG(304, *YYCURSOR); - yych = *++YYCURSOR; - goto yy233; -yy305: - YYDEBUG(305, *YYCURSOR); - yyaccept = 1; - YYMARKER = ++YYCURSOR; - YYFILL(2); - yych = *YYCURSOR; -yy306: - YYDEBUG(306, *YYCURSOR); - if (yych <= 0x1F) { - if (yych <= '\n') { - if (yych <= 0x08) goto yy231; - if (yych <= '\t') goto yy305; - goto yy304; - } else { - if (yych == '\r') goto yy308; - goto yy231; - } - } else { - if (yych <= '"') { - if (yych <= ' ') goto yy305; - if (yych <= '!') goto yy231; - } else { - if (yych == ';') goto yy283; - goto yy231; - } - } - YYDEBUG(307, *YYCURSOR); - yych = *++YYCURSOR; - goto yy238; -yy308: - YYDEBUG(308, *YYCURSOR); - ++YYCURSOR; - if ((yych = *YYCURSOR) == '\n') goto yy304; - goto yy233; - } -/* *********************************** */ -yyc_ST_VARNAME: - { - static const unsigned char yybm[] = { - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 0, 0, 128, 128, 0, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 0, 0, 128, 0, 128, 0, 128, - 0, 0, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 0, 128, 0, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 0, 128, 128, 0, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 0, 0, 0, 0, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - }; - YYDEBUG(309, *YYCURSOR); - YYFILL(2); - yych = *YYCURSOR; - if (yych <= ')') { - if (yych <= '"') { - if (yych <= '\f') { - if (yych <= 0x08) goto yy311; - if (yych <= '\n') goto yy313; - } else { - if (yych <= '\r') goto yy313; - if (yych >= '!') goto yy313; - } - } else { - if (yych <= '%') { - if (yych == '$') goto yy313; - } else { - if (yych != '\'') goto yy313; - } - } - } else { - if (yych <= '[') { - if (yych <= '<') { - if (yych == ';') goto yy313; - } else { - if (yych <= '=') goto yy313; - if (yych >= '[') goto yy313; - } - } else { - if (yych <= 'z') { - if (yych == '^') goto yy313; - } else { - if (yych == '}') goto yy315; - if (yych <= '~') goto yy313; - } - } - } -yy311: - YYDEBUG(311, *YYCURSOR); - ++YYCURSOR; - yych = *YYCURSOR; - goto yy318; -yy312: - YYDEBUG(312, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 406 "Zend/zend_ini_scanner.l" - { /* Variable name */ - /* Eat leading whitespace */ - EAT_LEADING_WHITESPACE(); - - /* Eat trailing whitespace */ - EAT_TRAILING_WHITESPACE(); - - RETURN_TOKEN(TC_VARNAME, yytext, yyleng); -} -#line 4627 "Zend/zend_ini_scanner.c" -yy313: - YYDEBUG(313, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(314, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 603 "Zend/zend_ini_scanner.l" - { - return 0; -} -#line 4637 "Zend/zend_ini_scanner.c" -yy315: - YYDEBUG(315, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(316, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 416 "Zend/zend_ini_scanner.l" - { /* Variable end */ - yy_pop_state(TSRMLS_C); - return '}'; -} -#line 4648 "Zend/zend_ini_scanner.c" -yy317: - YYDEBUG(317, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; -yy318: - YYDEBUG(318, *YYCURSOR); - if (yybm[0+yych] & 128) { - goto yy317; - } - goto yy312; - } -} -#line 607 "Zend/zend_ini_scanner.l" - -} +/* Generated by re2c 0.13.5 */ +#line 1 "Zend/zend_ini_scanner.l" +/* + +----------------------------------------------------------------------+ + | Zend Engine | + +----------------------------------------------------------------------+ + | Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) | + +----------------------------------------------------------------------+ + | This source file is subject to version 2.00 of the Zend license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.zend.com/license/2_00.txt. | + | If you did not receive a copy of the Zend license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@zend.com so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Zeev Suraski | + | Jani Taskinen | + | Marcus Boerger | + | Nuno Lopes | + | Scott MacVicar | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include +#include "zend.h" +#include "zend_globals.h" +#include +#include "zend_ini_scanner.h" + +#if 0 +# define YYDEBUG(s, c) printf("state: %d char: %c\n", s, c) +#else +# define YYDEBUG(s, c) +#endif + +#include "zend_ini_scanner_defs.h" + +#define YYCTYPE unsigned char +/* allow the scanner to read one null byte after the end of the string (from ZEND_MMAP_AHEAD) + * so that if will be able to terminate to match the current token (e.g. non-enclosed string) */ +#define YYFILL(n) { if (YYCURSOR > YYLIMIT) return 0; } +#define YYCURSOR SCNG(yy_cursor) +#define YYLIMIT SCNG(yy_limit) +#define YYMARKER SCNG(yy_marker) + +#define YYGETCONDITION() SCNG(yy_state) +#define YYSETCONDITION(s) SCNG(yy_state) = s + +#define STATE(name) yyc##name + +/* emulate flex constructs */ +#define BEGIN(state) YYSETCONDITION(STATE(state)) +#define YYSTATE YYGETCONDITION() +#define yytext ((char*)SCNG(yy_text)) +#define yyleng SCNG(yy_leng) +#define yyless(x) do { YYCURSOR = (unsigned char*)yytext + x; \ + yyleng = (unsigned int)x; } while(0) + +/* #define yymore() goto yymore_restart */ + +/* perform sanity check. If this message is triggered you should + increase the ZEND_MMAP_AHEAD value in the zend_streams.h file */ +#define YYMAXFILL 6 +#if ZEND_MMAP_AHEAD < (YYMAXFILL + 1) +# error ZEND_MMAP_AHEAD should be greater than YYMAXFILL +#endif + + +/* How it works (for the core ini directives): + * =========================================== + * + * 1. Scanner scans file for tokens and passes them to parser. + * 2. Parser parses the tokens and passes the name/value pairs to the callback + * function which stores them in the configuration hash table. + * 3. Later REGISTER_INI_ENTRIES() is called which triggers the actual + * registering of ini entries and uses zend_get_configuration_directive() + * to fetch the previously stored name/value pair from configuration hash table + * and registers the static ini entries which match the name to the value + * into EG(ini_directives) hash table. + * 4. PATH section entries are used per-request from down to top, each overriding + * previous if one exists. zend_alter_ini_entry() is called for each entry. + * Settings in PATH section are ZEND_INI_SYSTEM accessible and thus mimics the + * php_admin_* directives used within Apache httpd.conf when PHP is compiled as + * module for Apache. + * 5. User defined ini files (like .htaccess for apache) are parsed for each request and + * stored in separate hash defined by SAPI. + */ + +/* TODO: (ordered by importance :-) + * =============================================================================== + * + * - Separate constant lookup totally from plain strings (using CONSTANT pattern) + * - Add #if .. #else .. #endif and ==, !=, <, > , <=, >= operators + * - Add #include "some.ini" + * - Allow variables to refer to options also when using parse_ini_file() + * + */ + +/* Globals Macros */ +#define SCNG INI_SCNG +#ifdef ZTS +ZEND_API ts_rsrc_id ini_scanner_globals_id; +#else +ZEND_API zend_ini_scanner_globals ini_scanner_globals; +#endif + +/* Eat leading whitespace */ +#define EAT_LEADING_WHITESPACE() \ + while (yytext[0]) { \ + if (yytext[0] == ' ' || yytext[0] == '\t') { \ + SCNG(yy_text)++; \ + yyleng--; \ + } else { \ + break; \ + } \ + } + +/* Eat trailing whitespace + extra char */ +#define EAT_TRAILING_WHITESPACE_EX(ch) \ + while (yyleng > 0 && ( \ + (ch != 'X' && yytext[yyleng - 1] == ch) || \ + yytext[yyleng - 1] == '\n' || \ + yytext[yyleng - 1] == '\r' || \ + yytext[yyleng - 1] == '\t' || \ + yytext[yyleng - 1] == ' ') \ + ) { \ + yyleng--; \ + } + +/* Eat trailing whitespace */ +#define EAT_TRAILING_WHITESPACE() EAT_TRAILING_WHITESPACE_EX('X') + +#define zend_ini_copy_value(retval, str, len) { \ + Z_STRVAL_P(retval) = zend_strndup(str, len); \ + Z_STRLEN_P(retval) = len; \ + Z_TYPE_P(retval) = IS_STRING; \ +} + +#define RETURN_TOKEN(type, str, len) { \ + zend_ini_copy_value(ini_lval, str, len); \ + return type; \ +} + +static void _yy_push_state(int new_state TSRMLS_DC) +{ + zend_stack_push(&SCNG(state_stack), (void *) &YYGETCONDITION(), sizeof(int)); + YYSETCONDITION(new_state); +} + +#define yy_push_state(state_and_tsrm) _yy_push_state(yyc##state_and_tsrm) + +static void yy_pop_state(TSRMLS_D) +{ + int *stack_state; + zend_stack_top(&SCNG(state_stack), (void **) &stack_state); + YYSETCONDITION(*stack_state); + zend_stack_del_top(&SCNG(state_stack)); +} + +static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC) +{ + YYCURSOR = (YYCTYPE*)str; + SCNG(yy_start) = YYCURSOR; + YYLIMIT = YYCURSOR + len; +} + +#define ini_filename SCNG(filename) + +/* {{{ init_ini_scanner() +*/ +static int init_ini_scanner(int scanner_mode, zend_file_handle *fh TSRMLS_DC) +{ + /* Sanity check */ + if (scanner_mode != ZEND_INI_SCANNER_NORMAL && scanner_mode != ZEND_INI_SCANNER_RAW) { + zend_error(E_WARNING, "Invalid scanner mode"); + return FAILURE; + } + + SCNG(lineno) = 1; + SCNG(scanner_mode) = scanner_mode; + SCNG(yy_in) = fh; + + if (fh != NULL) { + ini_filename = zend_strndup(fh->filename, strlen(fh->filename)); + } else { + ini_filename = NULL; + } + + zend_stack_init(&SCNG(state_stack)); + BEGIN(INITIAL); + + return SUCCESS; +} +/* }}} */ + +/* {{{ shutdown_ini_scanner() +*/ +void shutdown_ini_scanner(TSRMLS_D) +{ + zend_stack_destroy(&SCNG(state_stack)); + if (ini_filename) { + free(ini_filename); + } +} +/* }}} */ + +/* {{{ zend_ini_scanner_get_lineno() +*/ +int zend_ini_scanner_get_lineno(TSRMLS_D) +{ + return SCNG(lineno); +} +/* }}} */ + +/* {{{ zend_ini_scanner_get_filename() +*/ +char *zend_ini_scanner_get_filename(TSRMLS_D) +{ + return ini_filename ? ini_filename : "Unknown"; +} +/* }}} */ + +/* {{{ zend_ini_open_file_for_scanning() +*/ +int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRMLS_DC) +{ + char *buf; + size_t size; + + if (zend_stream_fixup(fh, &buf, &size TSRMLS_CC) == FAILURE) { + return FAILURE; + } + + if (init_ini_scanner(scanner_mode, fh TSRMLS_CC) == FAILURE) { + zend_file_handle_dtor(fh TSRMLS_CC); + return FAILURE; + } + + yy_scan_buffer(buf, size TSRMLS_CC); + + return SUCCESS; +} +/* }}} */ + +/* {{{ zend_ini_prepare_string_for_scanning() +*/ +int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC) +{ + int len = strlen(str); + + if (init_ini_scanner(scanner_mode, NULL TSRMLS_CC) == FAILURE) { + return FAILURE; + } + + yy_scan_buffer(str, len TSRMLS_CC); + + return SUCCESS; +} +/* }}} */ + +/* {{{ zend_ini_escape_string() + */ +static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_type TSRMLS_DC) +{ + register char *s, *t; + char *end; + + zend_ini_copy_value(lval, str, len); + + /* convert escape sequences */ + s = t = Z_STRVAL_P(lval); + end = s + Z_STRLEN_P(lval); + + while (s < end) { + if (*s == '\\') { + s++; + if (s >= end) { + *t++ = '\\'; + continue; + } + switch (*s) { + case '"': + if (*s != quote_type) { + *t++ = '\\'; + *t++ = *s; + break; + } + case '\\': + case '$': + *t++ = *s; + Z_STRLEN_P(lval)--; + break; + default: + *t++ = '\\'; + *t++ = *s; + break; + } + } else { + *t++ = *s; + } + if (*s == '\n' || (*s == '\r' && (*(s+1) != '\n'))) { + SCNG(lineno)++; + } + s++; + } + *t = 0; +} +/* }}} */ + +int ini_lex(zval *ini_lval TSRMLS_DC) +{ +restart: + SCNG(yy_text) = YYCURSOR; + +/* yymore_restart: */ + /* detect EOF */ + if (YYCURSOR >= YYLIMIT) { + if (YYSTATE == STATE(ST_VALUE) || YYSTATE == STATE(ST_RAW)) { + BEGIN(INITIAL); + return END_OF_LINE; + } + return 0; + } + + /* Eat any UTF-8 BOM we find in the first 3 bytes */ + if (YYCURSOR == SCNG(yy_start) && YYCURSOR + 3 < YYLIMIT) { + if (memcmp(YYCURSOR, "\xef\xbb\xbf", 3) == 0) { + YYCURSOR += 3; + goto restart; + } + } + +#line 337 "Zend/zend_ini_scanner.c" +{ + YYCTYPE yych; + unsigned int yyaccept = 0; + if (YYGETCONDITION() < 4) { + if (YYGETCONDITION() < 2) { + if (YYGETCONDITION() < 1) { + goto yyc_INITIAL; + } else { + goto yyc_ST_OFFSET; + } + } else { + if (YYGETCONDITION() < 3) { + goto yyc_ST_SECTION_VALUE; + } else { + goto yyc_ST_VALUE; + } + } + } else { + if (YYGETCONDITION() < 6) { + if (YYGETCONDITION() < 5) { + goto yyc_ST_SECTION_RAW; + } else { + goto yyc_ST_DOUBLE_QUOTES; + } + } else { + if (YYGETCONDITION() < 7) { + goto yyc_ST_VARNAME; + } else { + goto yyc_ST_RAW; + } + } + } +/* *********************************** */ +yyc_INITIAL: + { + static const unsigned char yybm[] = { + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 160, 0, 144, 144, 0, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 240, 128, 128, 144, 128, 144, 128, 144, + 128, 128, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 128, 144, 128, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 128, 144, 144, 128, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 128, 128, 128, 128, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + }; + + YYDEBUG(0, *YYCURSOR); + YYFILL(5); + yych = *YYCURSOR; + YYDEBUG(-1, yych); + switch (yych) { + case '\t': goto yy4; + case '\n': goto yy6; + case '\r': goto yy8; + case ' ': goto yy9; + case '!': + case '"': + case '$': + case '&': + case '(': + case ')': + case '^': + case '{': + case '|': + case '}': + case '~': goto yy10; + case '#': goto yy12; + case '%': + case '\'': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case '<': + case '>': + case '?': + case '@': + case ']': goto yy13; + case ';': goto yy14; + case '=': goto yy16; + case 'F': + case 'f': goto yy18; + case 'N': + case 'n': goto yy19; + case 'O': + case 'o': goto yy20; + case 'T': + case 't': goto yy21; + case 'Y': + case 'y': goto yy22; + case '[': goto yy23; + default: goto yy2; + } +yy2: + YYDEBUG(2, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy26; +yy3: + YYDEBUG(3, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 429 "Zend/zend_ini_scanner.l" + { /* Get option name */ + /* Eat leading whitespace */ + EAT_LEADING_WHITESPACE(); + + /* Eat trailing whitespace */ + EAT_TRAILING_WHITESPACE(); + + RETURN_TOKEN(TC_LABEL, yytext, yyleng); +} +#line 476 "Zend/zend_ini_scanner.c" +yy4: + YYDEBUG(4, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + goto yy68; +yy5: + YYDEBUG(5, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 575 "Zend/zend_ini_scanner.l" + { + /* eat whitespace */ + goto restart; +} +#line 490 "Zend/zend_ini_scanner.c" +yy6: + YYDEBUG(6, *YYCURSOR); + ++YYCURSOR; +yy7: + YYDEBUG(7, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 580 "Zend/zend_ini_scanner.l" + { + SCNG(lineno)++; + return END_OF_LINE; +} +#line 502 "Zend/zend_ini_scanner.c" +yy8: + YYDEBUG(8, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy71; + goto yy7; +yy9: + YYDEBUG(9, *YYCURSOR); + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= ' ') { + if (yych <= '\n') { + if (yych <= 0x08) goto yy26; + if (yych <= '\t') goto yy67; + goto yy71; + } else { + if (yych == '\r') goto yy72; + if (yych <= 0x1F) goto yy26; + goto yy69; + } + } else { + if (yych <= ':') { + if (yych == '#') goto yy58; + goto yy26; + } else { + if (yych <= ';') goto yy53; + if (yych == '=') goto yy51; + goto yy26; + } + } +yy10: + YYDEBUG(10, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(11, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 503 "Zend/zend_ini_scanner.l" + { /* Disallow these chars outside option values */ + return yytext[0]; +} +#line 541 "Zend/zend_ini_scanner.c" +yy12: + YYDEBUG(12, *YYCURSOR); + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + goto yy59; +yy13: + YYDEBUG(13, *YYCURSOR); + yych = *++YYCURSOR; + goto yy26; +yy14: + YYDEBUG(14, *YYCURSOR); + yyaccept = 2; + yych = *(YYMARKER = ++YYCURSOR); + goto yy54; + YYDEBUG(15, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 603 "Zend/zend_ini_scanner.l" + { + return 0; +} +#line 562 "Zend/zend_ini_scanner.c" +yy16: + YYDEBUG(16, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy52; +yy17: + YYDEBUG(17, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 439 "Zend/zend_ini_scanner.l" + { /* Start option value */ + if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) { + yy_push_state(ST_RAW TSRMLS_CC); + } else { + yy_push_state(ST_VALUE TSRMLS_CC); + } + return '='; +} +#line 580 "Zend/zend_ini_scanner.c" +yy18: + YYDEBUG(18, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy48; + if (yych == 'a') goto yy48; + goto yy26; +yy19: + YYDEBUG(19, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'U') { + if (yych == 'O') goto yy44; + if (yych <= 'T') goto yy26; + goto yy45; + } else { + if (yych <= 'o') { + if (yych <= 'n') goto yy26; + goto yy44; + } else { + if (yych == 'u') goto yy45; + goto yy26; + } + } +yy20: + YYDEBUG(20, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'N') { + if (yych == 'F') goto yy38; + if (yych <= 'M') goto yy26; + goto yy31; + } else { + if (yych <= 'f') { + if (yych <= 'e') goto yy26; + goto yy38; + } else { + if (yych == 'n') goto yy31; + goto yy26; + } + } +yy21: + YYDEBUG(21, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy36; + if (yych == 'r') goto yy36; + goto yy26; +yy22: + YYDEBUG(22, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy27; + if (yych == 'e') goto yy27; + goto yy26; +yy23: + YYDEBUG(23, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(24, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 358 "Zend/zend_ini_scanner.l" + { /* Section start */ + /* Enter section data lookup state */ + if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) { + yy_push_state(ST_SECTION_RAW TSRMLS_CC); + } else { + yy_push_state(ST_SECTION_VALUE TSRMLS_CC); + } + return TC_SECTION; +} +#line 646 "Zend/zend_ini_scanner.c" +yy25: + YYDEBUG(25, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy26: + YYDEBUG(26, *YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy25; + } + if (yych == '[') goto yy28; + goto yy3; +yy27: + YYDEBUG(27, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy31; + if (yych == 's') goto yy31; + goto yy26; +yy28: + YYDEBUG(28, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(29, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy28; + } + YYDEBUG(30, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 383 "Zend/zend_ini_scanner.l" + { /* Start of option with offset */ + /* Eat leading whitespace */ + EAT_LEADING_WHITESPACE(); + + /* Eat trailing whitespace and [ */ + EAT_TRAILING_WHITESPACE_EX('['); + + /* Enter offset lookup state */ + yy_push_state(ST_OFFSET TSRMLS_CC); + + RETURN_TOKEN(TC_OFFSET, yytext, yyleng); +} +#line 689 "Zend/zend_ini_scanner.c" +yy31: + YYDEBUG(31, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(32, *YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy31; + } + if (yych <= '\'') { + if (yych <= ' ') { + if (yych <= '\n') { + if (yych <= 0x08) goto yy25; + if (yych <= '\t') goto yy34; + } else { + if (yych != '\r') goto yy25; + } + } else { + if (yych <= '$') { + if (yych == '#') goto yy25; + } else { + if (yych != '&') goto yy25; + } + } + } else { + if (yych <= 'Z') { + if (yych <= ';') { + if (yych <= ')') goto yy33; + if (yych <= ':') goto yy25; + } else { + if (yych != '=') goto yy25; + } + } else { + if (yych <= '^') { + if (yych <= '[') goto yy28; + if (yych <= ']') goto yy25; + } else { + if (yych <= 'z') goto yy25; + if (yych >= 0x7F) goto yy25; + } + } + } +yy33: + YYDEBUG(33, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 421 "Zend/zend_ini_scanner.l" + { /* TRUE value (when used outside option value/offset this causes parse error!) */ + RETURN_TOKEN(BOOL_TRUE, "1", 1); +} +#line 739 "Zend/zend_ini_scanner.c" +yy34: + YYDEBUG(34, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(35, *YYCURSOR); + if (yych == '\t') goto yy34; + if (yych == ' ') goto yy34; + goto yy33; +yy36: + YYDEBUG(36, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'U') goto yy37; + if (yych != 'u') goto yy26; +yy37: + YYDEBUG(37, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy31; + if (yych == 'e') goto yy31; + goto yy26; +yy38: + YYDEBUG(38, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'F') goto yy39; + if (yych != 'f') goto yy26; +yy39: + YYDEBUG(39, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(40, *YYCURSOR); + if (yych <= '&') { + if (yych <= 0x1F) { + if (yych <= '\n') { + if (yych <= 0x08) goto yy25; + if (yych <= '\t') goto yy42; + } else { + if (yych != '\r') goto yy25; + } + } else { + if (yych <= '#') { + if (yych <= ' ') goto yy39; + if (yych >= '#') goto yy25; + } else { + if (yych == '%') goto yy25; + } + } + } else { + if (yych <= '=') { + if (yych <= ':') { + if (yych <= '\'') goto yy25; + if (yych >= '*') goto yy25; + } else { + if (yych == '<') goto yy25; + } + } else { + if (yych <= ']') { + if (yych == '[') goto yy28; + goto yy25; + } else { + if (yych <= '^') goto yy41; + if (yych <= 'z') goto yy25; + if (yych >= 0x7F) goto yy25; + } + } + } +yy41: + YYDEBUG(41, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 425 "Zend/zend_ini_scanner.l" + { /* FALSE value (when used outside option value/offset this causes parse error!)*/ + RETURN_TOKEN(BOOL_FALSE, "", 0); +} +#line 813 "Zend/zend_ini_scanner.c" +yy42: + YYDEBUG(42, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(43, *YYCURSOR); + if (yych == '\t') goto yy42; + if (yych == ' ') goto yy42; + goto yy41; +yy44: + YYDEBUG(44, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= '\'') { + if (yych <= 0x1F) { + if (yych <= '\n') { + if (yych <= 0x08) goto yy26; + if (yych <= '\t') goto yy42; + goto yy41; + } else { + if (yych == '\r') goto yy41; + goto yy26; + } + } else { + if (yych <= '#') { + if (yych <= ' ') goto yy39; + if (yych <= '"') goto yy41; + goto yy26; + } else { + if (yych == '%') goto yy26; + if (yych <= '&') goto yy41; + goto yy26; + } + } + } else { + if (yych <= 'N') { + if (yych <= ';') { + if (yych <= ')') goto yy41; + if (yych <= ':') goto yy26; + goto yy41; + } else { + if (yych == '=') goto yy41; + if (yych <= 'M') goto yy26; + goto yy47; + } + } else { + if (yych <= 'm') { + if (yych == '^') goto yy41; + goto yy26; + } else { + if (yych <= 'n') goto yy47; + if (yych <= 'z') goto yy26; + if (yych <= '~') goto yy41; + goto yy26; + } + } + } +yy45: + YYDEBUG(45, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy46; + if (yych != 'l') goto yy26; +yy46: + YYDEBUG(46, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy39; + if (yych == 'l') goto yy39; + goto yy26; +yy47: + YYDEBUG(47, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy39; + if (yych == 'e') goto yy39; + goto yy26; +yy48: + YYDEBUG(48, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy49; + if (yych != 'l') goto yy26; +yy49: + YYDEBUG(49, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy50; + if (yych != 's') goto yy26; +yy50: + YYDEBUG(50, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy39; + if (yych == 'e') goto yy39; + goto yy26; +yy51: + YYDEBUG(51, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy52: + YYDEBUG(52, *YYCURSOR); + if (yych == '\t') goto yy51; + if (yych == ' ') goto yy51; + goto yy17; +yy53: + YYDEBUG(53, *YYCURSOR); + ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; +yy54: + YYDEBUG(54, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy53; + } + if (yych >= '\r') goto yy57; +yy55: + YYDEBUG(55, *YYCURSOR); + ++YYCURSOR; +yy56: + YYDEBUG(56, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 585 "Zend/zend_ini_scanner.l" + { /* Comment */ + BEGIN(INITIAL); + SCNG(lineno)++; + return END_OF_LINE; +} +#line 936 "Zend/zend_ini_scanner.c" +yy57: + YYDEBUG(57, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy55; + goto yy56; +yy58: + YYDEBUG(58, *YYCURSOR); + yyaccept = 1; + YYMARKER = ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; +yy59: + YYDEBUG(59, *YYCURSOR); + if (yych <= '\'') { + if (yych <= ' ') { + if (yych <= '\n') { + if (yych <= 0x08) goto yy58; + if (yych >= '\n') goto yy64; + } else { + if (yych == '\r') goto yy66; + goto yy58; + } + } else { + if (yych <= '$') { + if (yych == '#') goto yy58; + } else { + if (yych != '&') goto yy58; + } + } + } else { + if (yych <= 'Z') { + if (yych <= ';') { + if (yych <= ')') goto yy60; + if (yych <= ':') goto yy58; + } else { + if (yych != '=') goto yy58; + } + } else { + if (yych <= '^') { + if (yych <= '[') goto yy62; + if (yych <= ']') goto yy58; + } else { + if (yych <= 'z') goto yy58; + if (yych >= 0x7F) goto yy58; + } + } + } +yy60: + YYDEBUG(60, *YYCURSOR); + ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; + YYDEBUG(61, *YYCURSOR); + if (yych == '\n') goto yy64; + if (yych == '\r') goto yy66; + goto yy60; +yy62: + YYDEBUG(62, *YYCURSOR); + yyaccept = 3; + YYMARKER = ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; + YYDEBUG(63, *YYCURSOR); + if (yych <= '\f') { + if (yych <= 0x08) goto yy60; + if (yych <= '\t') goto yy62; + if (yych >= '\v') goto yy60; + } else { + if (yych <= '\r') goto yy66; + if (yych == ' ') goto yy62; + goto yy60; + } +yy64: + YYDEBUG(64, *YYCURSOR); + ++YYCURSOR; +yy65: + YYDEBUG(65, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 591 "Zend/zend_ini_scanner.l" + { /* #Comment */ + zend_error(E_DEPRECATED, "Comments starting with '#' are deprecated in %s on line %d", zend_ini_scanner_get_filename(TSRMLS_C), SCNG(lineno)); + BEGIN(INITIAL); + SCNG(lineno)++; + return END_OF_LINE; +} +#line 1022 "Zend/zend_ini_scanner.c" +yy66: + YYDEBUG(66, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy64; + goto yy65; +yy67: + YYDEBUG(67, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; +yy68: + YYDEBUG(68, *YYCURSOR); + if (yych <= ' ') { + if (yych <= '\n') { + if (yych <= 0x08) goto yy5; + if (yych <= '\t') goto yy67; + goto yy71; + } else { + if (yych == '\r') goto yy72; + if (yych <= 0x1F) goto yy5; + goto yy67; + } + } else { + if (yych <= ':') { + if (yych == '#') goto yy60; + goto yy5; + } else { + if (yych <= ';') goto yy53; + if (yych == '=') goto yy51; + goto yy5; + } + } +yy69: + YYDEBUG(69, *YYCURSOR); + yyaccept = 1; + YYMARKER = ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; + YYDEBUG(70, *YYCURSOR); + if (yych <= '&') { + if (yych <= 0x1F) { + if (yych <= '\n') { + if (yych <= 0x08) goto yy25; + if (yych <= '\t') goto yy67; + } else { + if (yych == '\r') goto yy72; + goto yy25; + } + } else { + if (yych <= '#') { + if (yych <= ' ') goto yy69; + if (yych <= '"') goto yy3; + goto yy58; + } else { + if (yych == '%') goto yy25; + goto yy3; + } + } + } else { + if (yych <= '=') { + if (yych <= ':') { + if (yych <= '\'') goto yy25; + if (yych <= ')') goto yy3; + goto yy25; + } else { + if (yych <= ';') goto yy53; + if (yych <= '<') goto yy25; + goto yy51; + } + } else { + if (yych <= ']') { + if (yych == '[') goto yy28; + goto yy25; + } else { + if (yych <= '^') goto yy3; + if (yych <= 'z') goto yy25; + if (yych <= '~') goto yy3; + goto yy25; + } + } + } +yy71: + YYDEBUG(71, *YYCURSOR); + yych = *++YYCURSOR; + goto yy7; +yy72: + YYDEBUG(72, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) == '\n') goto yy71; + goto yy7; + } +/* *********************************** */ +yyc_ST_DOUBLE_QUOTES: + { + static const unsigned char yybm[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 128, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 128, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + }; + YYDEBUG(73, *YYCURSOR); + YYFILL(2); + yych = *YYCURSOR; + if (yych == '"') goto yy77; + if (yych == '$') goto yy79; + YYDEBUG(75, *YYCURSOR); + ++YYCURSOR; +yy76: + YYDEBUG(76, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 535 "Zend/zend_ini_scanner.l" + { /* Escape double quoted string contents */ + if (YYCURSOR > YYLIMIT) { + return 0; + } + + while (YYCURSOR < YYLIMIT) { + switch (*YYCURSOR++) { + case '"': + if (YYCURSOR < YYLIMIT && YYCURSOR[-2] == '\\' && *YYCURSOR != '\r' && *YYCURSOR != '\n') { + continue; + } + break; + case '$': + if (*YYCURSOR == '{') { + break; + } + continue; + case '\\': + if (YYCURSOR < YYLIMIT && *YYCURSOR != '"') { + YYCURSOR++; + } + /* fall through */ + default: + continue; + } + + YYCURSOR--; + break; + } + + yyleng = YYCURSOR - SCNG(yy_text); + + zend_ini_escape_string(ini_lval, yytext, yyleng, '"' TSRMLS_CC); + return TC_QUOTED_STRING; +} +#line 1198 "Zend/zend_ini_scanner.c" +yy77: + YYDEBUG(77, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy83; +yy78: + YYDEBUG(78, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 530 "Zend/zend_ini_scanner.l" + { /* Double quoted '"' string ends */ + yy_pop_state(TSRMLS_C); + return '"'; +} +#line 1212 "Zend/zend_ini_scanner.c" +yy79: + YYDEBUG(79, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '{') goto yy76; + YYDEBUG(80, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(81, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 401 "Zend/zend_ini_scanner.l" + { /* Variable start */ + yy_push_state(ST_VARNAME TSRMLS_CC); + return TC_DOLLAR_CURLY; +} +#line 1226 "Zend/zend_ini_scanner.c" +yy82: + YYDEBUG(82, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy83: + YYDEBUG(83, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy82; + } + goto yy78; + } +/* *********************************** */ +yyc_ST_OFFSET: + { + static const unsigned char yybm[] = { + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 194, 64, 66, 66, 64, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 194, 66, 64, 66, 68, 66, 66, 0, + 66, 66, 66, 66, 66, 66, 66, 66, + 114, 114, 114, 114, 114, 114, 114, 114, + 114, 114, 66, 64, 66, 66, 66, 66, + 66, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 66, 72, 64, 66, 82, + 66, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, + }; + YYDEBUG(84, *YYCURSOR); + YYFILL(2); + yych = *YYCURSOR; + if (yych <= '-') { + if (yych <= ' ') { + if (yych <= '\n') { + if (yych <= 0x08) goto yy86; + if (yych <= '\t') goto yy88; + goto yy89; + } else { + if (yych == '\r') goto yy89; + if (yych >= ' ') goto yy88; + } + } else { + if (yych <= '$') { + if (yych == '"') goto yy91; + if (yych >= '$') goto yy93; + } else { + if (yych == '\'') goto yy94; + if (yych >= '-') goto yy95; + } + } + } else { + if (yych <= 'Z') { + if (yych <= '9') { + if (yych <= '.') goto yy96; + if (yych >= '0') goto yy97; + } else { + if (yych == ';') goto yy89; + if (yych >= 'A') goto yy99; + } + } else { + if (yych <= '^') { + if (yych <= '[') goto yy86; + if (yych <= '\\') goto yy101; + if (yych <= ']') goto yy102; + } else { + if (yych == '`') goto yy86; + if (yych <= 'z') goto yy99; + } + } + } +yy86: + YYDEBUG(86, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + goto yy105; +yy87: + YYDEBUG(87, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 521 "Zend/zend_ini_scanner.l" + { /* Get rest as section/offset value */ + RETURN_TOKEN(TC_STRING, yytext, yyleng); +} +#line 1330 "Zend/zend_ini_scanner.c" +yy88: + YYDEBUG(88, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy131; + } + if (yych == '"') goto yy133; + if (yych == ']') goto yy134; + goto yy105; +yy89: + YYDEBUG(89, *YYCURSOR); + ++YYCURSOR; +yy90: + YYDEBUG(90, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 603 "Zend/zend_ini_scanner.l" + { + return 0; +} +#line 1351 "Zend/zend_ini_scanner.c" +yy91: + YYDEBUG(91, *YYCURSOR); + ++YYCURSOR; +yy92: + YYDEBUG(92, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 525 "Zend/zend_ini_scanner.l" + { /* Double quoted '"' string start */ + yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); + return '"'; +} +#line 1363 "Zend/zend_ini_scanner.c" +yy93: + YYDEBUG(93, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= '\\') { + if (yych <= 0x00) goto yy90; + if (yych <= '[') goto yy104; + goto yy109; + } else { + if (yych == '{') goto yy129; + goto yy104; + } +yy94: + YYDEBUG(94, *YYCURSOR); + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy125; + } + goto yy90; +yy95: + YYDEBUG(95, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy105; + if (yych <= '9') goto yy123; + goto yy105; +yy96: + YYDEBUG(96, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy105; + if (yych <= '9') goto yy121; + goto yy105; +yy97: + YYDEBUG(97, *YYCURSOR); + yyaccept = 2; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '\'') { + if (yych <= '\r') { + if (yych == '\n') goto yy98; + if (yych <= '\f') goto yy105; + } else { + if (yych == '"') goto yy98; + if (yych <= '&') goto yy105; + } + } else { + if (yych <= '9') { + if (yych == '.') goto yy117; + if (yych <= '/') goto yy105; + goto yy119; + } else { + if (yych <= ';') { + if (yych <= ':') goto yy105; + } else { + if (yych != ']') goto yy105; + } + } + } +yy98: + YYDEBUG(98, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 499 "Zend/zend_ini_scanner.l" + { /* Get number option value as string */ + RETURN_TOKEN(TC_NUMBER, yytext, yyleng); +} +#line 1429 "Zend/zend_ini_scanner.c" +yy99: + YYDEBUG(99, *YYCURSOR); + yyaccept = 3; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy115; + } + if (yych <= '"') { + if (yych <= '\f') { + if (yych != '\n') goto yy105; + } else { + if (yych <= '\r') goto yy100; + if (yych <= '!') goto yy105; + } + } else { + if (yych <= ':') { + if (yych != '\'') goto yy105; + } else { + if (yych <= ';') goto yy100; + if (yych != ']') goto yy105; + } + } +yy100: + YYDEBUG(100, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 495 "Zend/zend_ini_scanner.l" + { /* Get constant option value */ + RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); +} +#line 1459 "Zend/zend_ini_scanner.c" +yy101: + YYDEBUG(101, *YYCURSOR); + yych = *++YYCURSOR; + goto yy104; +yy102: + YYDEBUG(102, *YYCURSOR); + ++YYCURSOR; +yy103: + YYDEBUG(103, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 396 "Zend/zend_ini_scanner.l" + { /* End of section or an option offset */ + BEGIN(INITIAL); + return ']'; +} +#line 1475 "Zend/zend_ini_scanner.c" +yy104: + YYDEBUG(104, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy105: + YYDEBUG(105, *YYCURSOR); + if (yybm[0+yych] & 2) { + goto yy104; + } + if (yych == '$') goto yy107; + if (yych != '\\') goto yy87; +yy106: + YYDEBUG(106, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + goto yy104; +yy107: + YYDEBUG(107, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yych <= '\\') { + if (yych <= 0x00) goto yy108; + if (yych <= '[') goto yy104; + goto yy109; + } else { + if (yych != '{') goto yy104; + } +yy108: + YYDEBUG(108, *YYCURSOR); + YYCURSOR = YYMARKER; + if (yyaccept <= 1) { + if (yyaccept <= 0) { + goto yy87; + } else { + goto yy90; + } + } else { + if (yyaccept <= 2) { + goto yy98; + } else { + goto yy100; + } + } +yy109: + YYDEBUG(109, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 4) { + goto yy110; + } + if (yych == '\\') goto yy112; + goto yy104; +yy110: + YYDEBUG(110, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(111, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy110; + } + if (yych == '\\') goto yy114; + goto yy104; +yy112: + YYDEBUG(112, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(113, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy110; + } + if (yych == '\\') goto yy112; + goto yy104; +yy114: + YYDEBUG(114, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 4) { + goto yy110; + } + if (yych == '\\') goto yy112; + goto yy104; +yy115: + YYDEBUG(115, *YYCURSOR); + yyaccept = 3; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(116, *YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy115; + } + if (yych <= '$') { + if (yych <= '\r') { + if (yych == '\n') goto yy100; + if (yych <= '\f') goto yy104; + goto yy100; + } else { + if (yych == '"') goto yy100; + if (yych <= '#') goto yy104; + goto yy107; + } + } else { + if (yych <= ';') { + if (yych == '\'') goto yy100; + if (yych <= ':') goto yy104; + goto yy100; + } else { + if (yych <= '[') goto yy104; + if (yych <= '\\') goto yy106; + if (yych <= ']') goto yy100; + goto yy104; + } + } +yy117: + YYDEBUG(117, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(118, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy117; + } + if (yych <= '$') { + if (yych <= '\r') { + if (yych == '\n') goto yy98; + if (yych <= '\f') goto yy104; + goto yy98; + } else { + if (yych == '"') goto yy98; + if (yych <= '#') goto yy104; + goto yy107; + } + } else { + if (yych <= ';') { + if (yych == '\'') goto yy98; + if (yych <= ':') goto yy104; + goto yy98; + } else { + if (yych <= '[') goto yy104; + if (yych <= '\\') goto yy106; + if (yych <= ']') goto yy98; + goto yy104; + } + } +yy119: + YYDEBUG(119, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(120, *YYCURSOR); + if (yych <= '\'') { + if (yych <= '!') { + if (yych <= '\n') { + if (yych <= '\t') goto yy104; + goto yy98; + } else { + if (yych == '\r') goto yy98; + goto yy104; + } + } else { + if (yych <= '#') { + if (yych <= '"') goto yy98; + goto yy104; + } else { + if (yych <= '$') goto yy107; + if (yych <= '&') goto yy104; + goto yy98; + } + } + } else { + if (yych <= ':') { + if (yych <= '.') { + if (yych <= '-') goto yy104; + goto yy117; + } else { + if (yych <= '/') goto yy104; + if (yych <= '9') goto yy119; + goto yy104; + } + } else { + if (yych <= '[') { + if (yych <= ';') goto yy98; + goto yy104; + } else { + if (yych <= '\\') goto yy106; + if (yych <= ']') goto yy98; + goto yy104; + } + } + } +yy121: + YYDEBUG(121, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(122, *YYCURSOR); + if (yych <= '&') { + if (yych <= '\r') { + if (yych == '\n') goto yy98; + if (yych <= '\f') goto yy104; + goto yy98; + } else { + if (yych <= '"') { + if (yych <= '!') goto yy104; + goto yy98; + } else { + if (yych == '$') goto yy107; + goto yy104; + } + } + } else { + if (yych <= ':') { + if (yych <= '\'') goto yy98; + if (yych <= '/') goto yy104; + if (yych <= '9') goto yy121; + goto yy104; + } else { + if (yych <= '[') { + if (yych <= ';') goto yy98; + goto yy104; + } else { + if (yych <= '\\') goto yy106; + if (yych <= ']') goto yy98; + goto yy104; + } + } + } +yy123: + YYDEBUG(123, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(124, *YYCURSOR); + if (yych <= '&') { + if (yych <= '\r') { + if (yych == '\n') goto yy98; + if (yych <= '\f') goto yy104; + goto yy98; + } else { + if (yych <= '"') { + if (yych <= '!') goto yy104; + goto yy98; + } else { + if (yych == '$') goto yy107; + goto yy104; + } + } + } else { + if (yych <= ':') { + if (yych <= '\'') goto yy98; + if (yych <= '/') goto yy104; + if (yych <= '9') goto yy123; + goto yy104; + } else { + if (yych <= '[') { + if (yych <= ';') goto yy98; + goto yy104; + } else { + if (yych <= '\\') goto yy106; + if (yych <= ']') goto yy98; + goto yy104; + } + } + } +yy125: + YYDEBUG(125, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(126, *YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy125; + } + YYDEBUG(127, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(128, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 368 "Zend/zend_ini_scanner.l" + { /* Raw string */ + /* Eat leading and trailing single quotes */ + if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') { + SCNG(yy_text)++; + yyleng = yyleng - 2; + } + RETURN_TOKEN(TC_RAW, yytext, yyleng); +} +#line 1774 "Zend/zend_ini_scanner.c" +yy129: + YYDEBUG(129, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(130, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 401 "Zend/zend_ini_scanner.l" + { /* Variable start */ + yy_push_state(ST_VARNAME TSRMLS_CC); + return TC_DOLLAR_CURLY; +} +#line 1785 "Zend/zend_ini_scanner.c" +yy131: + YYDEBUG(131, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(132, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy131; + } + if (yych <= '$') { + if (yych <= '\r') { + if (yych == '\n') goto yy87; + if (yych <= '\f') goto yy104; + goto yy87; + } else { + if (yych == '"') goto yy133; + if (yych <= '#') goto yy104; + goto yy107; + } + } else { + if (yych <= ';') { + if (yych == '\'') goto yy87; + if (yych <= ':') goto yy104; + goto yy87; + } else { + if (yych <= '[') goto yy104; + if (yych <= '\\') goto yy106; + if (yych <= ']') goto yy134; + goto yy104; + } + } +yy133: + YYDEBUG(133, *YYCURSOR); + yych = *++YYCURSOR; + goto yy92; +yy134: + YYDEBUG(134, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy103; + } +/* *********************************** */ +yyc_ST_RAW: + { + static const unsigned char yybm[] = { + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 192, 0, 64, 64, 0, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 192, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + }; + YYDEBUG(135, *YYCURSOR); + YYFILL(3); + yych = *YYCURSOR; + if (yych <= '\f') { + if (yych <= 0x08) { + if (yych >= 0x01) goto yy139; + } else { + if (yych <= '\t') goto yy141; + if (yych <= '\n') goto yy142; + goto yy139; + } + } else { + if (yych <= ' ') { + if (yych <= '\r') goto yy144; + if (yych <= 0x1F) goto yy139; + goto yy141; + } else { + if (yych == ';') goto yy145; + goto yy139; + } + } + YYDEBUG(137, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(138, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 598 "Zend/zend_ini_scanner.l" + { /* End of option value (if EOF is reached before EOL */ + BEGIN(INITIAL); + return END_OF_LINE; +} +#line 1895 "Zend/zend_ini_scanner.c" +yy139: + YYDEBUG(139, *YYCURSOR); + ++YYCURSOR; +yy140: + YYDEBUG(140, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 448 "Zend/zend_ini_scanner.l" + { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ + char *sc = NULL; + while (YYCURSOR < YYLIMIT) { + switch (*YYCURSOR) { + case '\n': + case '\r': + goto end_raw_value_chars; + break; + case ';': + if (sc == NULL) { + sc = YYCURSOR; + } + /* no break */ + default: + YYCURSOR++; + break; + } + } +end_raw_value_chars: + yyleng = YYCURSOR - SCNG(yy_text); + + /* Eat trailing semicolons */ + while (yytext[yyleng - 1] == ';') { + yyleng--; + } + + /* Eat leading and trailing double quotes */ + if (yytext[0] == '"' && yytext[yyleng - 1] == '"') { + SCNG(yy_text)++; + yyleng = yyleng - 2; + } else if (sc) { + YYCURSOR = sc; + yyleng = YYCURSOR - SCNG(yy_text); + } + RETURN_TOKEN(TC_RAW, yytext, yyleng); +} +#line 1939 "Zend/zend_ini_scanner.c" +yy141: + YYDEBUG(141, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '\r') { + if (yych <= 0x08) goto yy140; + if (yych <= '\n') goto yy153; + if (yych <= '\f') goto yy140; + goto yy153; + } else { + if (yych <= ' ') { + if (yych <= 0x1F) goto yy140; + goto yy153; + } else { + if (yych == ';') goto yy153; + goto yy140; + } + } +yy142: + YYDEBUG(142, *YYCURSOR); + ++YYCURSOR; +yy143: + YYDEBUG(143, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 489 "Zend/zend_ini_scanner.l" + { /* End of option value */ + BEGIN(INITIAL); + SCNG(lineno)++; + return END_OF_LINE; +} +#line 1970 "Zend/zend_ini_scanner.c" +yy144: + YYDEBUG(144, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy151; + goto yy143; +yy145: + YYDEBUG(145, *YYCURSOR); + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + goto yy147; +yy146: + YYDEBUG(146, *YYCURSOR); + ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; +yy147: + YYDEBUG(147, *YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy146; + } + if (yych >= '\r') goto yy150; +yy148: + YYDEBUG(148, *YYCURSOR); + ++YYCURSOR; +yy149: + YYDEBUG(149, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 585 "Zend/zend_ini_scanner.l" + { /* Comment */ + BEGIN(INITIAL); + SCNG(lineno)++; + return END_OF_LINE; +} +#line 2004 "Zend/zend_ini_scanner.c" +yy150: + YYDEBUG(150, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy148; + goto yy149; +yy151: + YYDEBUG(151, *YYCURSOR); + yych = *++YYCURSOR; + goto yy143; +yy152: + YYDEBUG(152, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; +yy153: + YYDEBUG(153, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy152; + } + if (yych <= '\f') { + if (yych == '\n') goto yy151; + } else { + if (yych <= '\r') goto yy155; + if (yych == ';') goto yy146; + } + YYDEBUG(154, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 575 "Zend/zend_ini_scanner.l" + { + /* eat whitespace */ + goto restart; +} +#line 2038 "Zend/zend_ini_scanner.c" +yy155: + YYDEBUG(155, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) == '\n') goto yy151; + goto yy143; + } +/* *********************************** */ +yyc_ST_SECTION_RAW: + { + static const unsigned char yybm[] = { + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 192, 0, 128, 128, 0, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 192, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 0, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + }; + YYDEBUG(156, *YYCURSOR); + YYFILL(3); + yych = *YYCURSOR; + if (yych <= '\f') { + if (yych == '\n') goto yy160; + } else { + if (yych <= '\r') goto yy160; + if (yych == ']') goto yy162; + } + YYDEBUG(158, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy169; +yy159: + YYDEBUG(159, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 485 "Zend/zend_ini_scanner.l" + { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ + RETURN_TOKEN(TC_RAW, yytext, yyleng); +} +#line 2102 "Zend/zend_ini_scanner.c" +yy160: + YYDEBUG(160, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(161, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 603 "Zend/zend_ini_scanner.l" + { + return 0; +} +#line 2112 "Zend/zend_ini_scanner.c" +yy162: + YYDEBUG(162, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy165; +yy163: + YYDEBUG(163, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 377 "Zend/zend_ini_scanner.l" + { /* End of section */ + BEGIN(INITIAL); + SCNG(lineno)++; + return ']'; +} +#line 2127 "Zend/zend_ini_scanner.c" +yy164: + YYDEBUG(164, *YYCURSOR); + ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; +yy165: + YYDEBUG(165, *YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy164; + } + if (yych == '\n') goto yy166; + if (yych == '\r') goto yy167; + goto yy163; +yy166: + YYDEBUG(166, *YYCURSOR); + yych = *++YYCURSOR; + goto yy163; +yy167: + YYDEBUG(167, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy166; + goto yy163; +yy168: + YYDEBUG(168, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy169: + YYDEBUG(169, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy168; + } + goto yy159; + } +/* *********************************** */ +yyc_ST_SECTION_VALUE: + { + static const unsigned char yybm[] = { + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 134, 128, 132, 132, 128, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 134, 132, 128, 132, 136, 132, 132, 0, + 132, 132, 132, 132, 132, 132, 132, 132, + 228, 228, 228, 228, 228, 228, 228, 228, + 228, 228, 132, 128, 132, 132, 132, 132, + 132, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 132, 144, 128, 132, 164, + 132, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + }; + YYDEBUG(170, *YYCURSOR); + YYFILL(3); + yych = *YYCURSOR; + if (yych <= '-') { + if (yych <= ' ') { + if (yych <= '\n') { + if (yych <= 0x08) goto yy172; + if (yych <= '\t') goto yy174; + goto yy175; + } else { + if (yych == '\r') goto yy175; + if (yych >= ' ') goto yy174; + } + } else { + if (yych <= '$') { + if (yych == '"') goto yy177; + if (yych >= '$') goto yy179; + } else { + if (yych == '\'') goto yy180; + if (yych >= '-') goto yy181; + } + } + } else { + if (yych <= 'Z') { + if (yych <= '9') { + if (yych <= '.') goto yy182; + if (yych >= '0') goto yy183; + } else { + if (yych == ';') goto yy175; + if (yych >= 'A') goto yy185; + } + } else { + if (yych <= '^') { + if (yych <= '[') goto yy172; + if (yych <= '\\') goto yy187; + if (yych <= ']') goto yy188; + } else { + if (yych == '`') goto yy172; + if (yych <= 'z') goto yy185; + } + } + } +yy172: + YYDEBUG(172, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + goto yy195; +yy173: + YYDEBUG(173, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 521 "Zend/zend_ini_scanner.l" + { /* Get rest as section/offset value */ + RETURN_TOKEN(TC_STRING, yytext, yyleng); +} +#line 2253 "Zend/zend_ini_scanner.c" +yy174: + YYDEBUG(174, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 0x1F) { + if (yych == '\t') goto yy221; + goto yy195; + } else { + if (yych <= ' ') goto yy221; + if (yych == '"') goto yy223; + goto yy195; + } +yy175: + YYDEBUG(175, *YYCURSOR); + ++YYCURSOR; +yy176: + YYDEBUG(176, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 603 "Zend/zend_ini_scanner.l" + { + return 0; +} +#line 2276 "Zend/zend_ini_scanner.c" +yy177: + YYDEBUG(177, *YYCURSOR); + ++YYCURSOR; +yy178: + YYDEBUG(178, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 525 "Zend/zend_ini_scanner.l" + { /* Double quoted '"' string start */ + yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); + return '"'; +} +#line 2288 "Zend/zend_ini_scanner.c" +yy179: + YYDEBUG(179, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= '\\') { + if (yych <= 0x00) goto yy176; + if (yych <= '[') goto yy194; + goto yy199; + } else { + if (yych == '{') goto yy219; + goto yy194; + } +yy180: + YYDEBUG(180, *YYCURSOR); + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy215; + } + goto yy176; +yy181: + YYDEBUG(181, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy195; + if (yych <= '9') goto yy213; + goto yy195; +yy182: + YYDEBUG(182, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy195; + if (yych <= '9') goto yy211; + goto yy195; +yy183: + YYDEBUG(183, *YYCURSOR); + yyaccept = 2; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '\'') { + if (yych <= '\r') { + if (yych == '\n') goto yy184; + if (yych <= '\f') goto yy195; + } else { + if (yych == '"') goto yy184; + if (yych <= '&') goto yy195; + } + } else { + if (yych <= '9') { + if (yych == '.') goto yy207; + if (yych <= '/') goto yy195; + goto yy209; + } else { + if (yych <= ';') { + if (yych <= ':') goto yy195; + } else { + if (yych != ']') goto yy195; + } + } + } +yy184: + YYDEBUG(184, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 499 "Zend/zend_ini_scanner.l" + { /* Get number option value as string */ + RETURN_TOKEN(TC_NUMBER, yytext, yyleng); +} +#line 2354 "Zend/zend_ini_scanner.c" +yy185: + YYDEBUG(185, *YYCURSOR); + yyaccept = 3; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy205; + } + if (yych <= '"') { + if (yych <= '\f') { + if (yych != '\n') goto yy195; + } else { + if (yych <= '\r') goto yy186; + if (yych <= '!') goto yy195; + } + } else { + if (yych <= ':') { + if (yych != '\'') goto yy195; + } else { + if (yych <= ';') goto yy186; + if (yych != ']') goto yy195; + } + } +yy186: + YYDEBUG(186, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 495 "Zend/zend_ini_scanner.l" + { /* Get constant option value */ + RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); +} +#line 2384 "Zend/zend_ini_scanner.c" +yy187: + YYDEBUG(187, *YYCURSOR); + yych = *++YYCURSOR; + goto yy194; +yy188: + YYDEBUG(188, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy191; +yy189: + YYDEBUG(189, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 377 "Zend/zend_ini_scanner.l" + { /* End of section */ + BEGIN(INITIAL); + SCNG(lineno)++; + return ']'; +} +#line 2403 "Zend/zend_ini_scanner.c" +yy190: + YYDEBUG(190, *YYCURSOR); + ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; +yy191: + YYDEBUG(191, *YYCURSOR); + if (yybm[0+yych] & 2) { + goto yy190; + } + if (yych == '\n') goto yy192; + if (yych == '\r') goto yy193; + goto yy189; +yy192: + YYDEBUG(192, *YYCURSOR); + yych = *++YYCURSOR; + goto yy189; +yy193: + YYDEBUG(193, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy192; + goto yy189; +yy194: + YYDEBUG(194, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy195: + YYDEBUG(195, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy194; + } + if (yych == '$') goto yy197; + if (yych != '\\') goto yy173; +yy196: + YYDEBUG(196, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + goto yy194; +yy197: + YYDEBUG(197, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yych <= '\\') { + if (yych <= 0x00) goto yy198; + if (yych <= '[') goto yy194; + goto yy199; + } else { + if (yych != '{') goto yy194; + } +yy198: + YYDEBUG(198, *YYCURSOR); + YYCURSOR = YYMARKER; + if (yyaccept <= 1) { + if (yyaccept <= 0) { + goto yy173; + } else { + goto yy176; + } + } else { + if (yyaccept <= 2) { + goto yy184; + } else { + goto yy186; + } + } +yy199: + YYDEBUG(199, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 8) { + goto yy200; + } + if (yych == '\\') goto yy202; + goto yy194; +yy200: + YYDEBUG(200, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(201, *YYCURSOR); + if (yybm[0+yych] & 8) { + goto yy200; + } + if (yych == '\\') goto yy204; + goto yy194; +yy202: + YYDEBUG(202, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(203, *YYCURSOR); + if (yybm[0+yych] & 8) { + goto yy200; + } + if (yych == '\\') goto yy202; + goto yy194; +yy204: + YYDEBUG(204, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 8) { + goto yy200; + } + if (yych == '\\') goto yy202; + goto yy194; +yy205: + YYDEBUG(205, *YYCURSOR); + yyaccept = 3; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(206, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy205; + } + if (yych <= '$') { + if (yych <= '\r') { + if (yych == '\n') goto yy186; + if (yych <= '\f') goto yy194; + goto yy186; + } else { + if (yych == '"') goto yy186; + if (yych <= '#') goto yy194; + goto yy197; + } + } else { + if (yych <= ';') { + if (yych == '\'') goto yy186; + if (yych <= ':') goto yy194; + goto yy186; + } else { + if (yych <= '[') goto yy194; + if (yych <= '\\') goto yy196; + if (yych <= ']') goto yy186; + goto yy194; + } + } +yy207: + YYDEBUG(207, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(208, *YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy207; + } + if (yych <= '$') { + if (yych <= '\r') { + if (yych == '\n') goto yy184; + if (yych <= '\f') goto yy194; + goto yy184; + } else { + if (yych == '"') goto yy184; + if (yych <= '#') goto yy194; + goto yy197; + } + } else { + if (yych <= ';') { + if (yych == '\'') goto yy184; + if (yych <= ':') goto yy194; + goto yy184; + } else { + if (yych <= '[') goto yy194; + if (yych <= '\\') goto yy196; + if (yych <= ']') goto yy184; + goto yy194; + } + } +yy209: + YYDEBUG(209, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(210, *YYCURSOR); + if (yych <= '\'') { + if (yych <= '!') { + if (yych <= '\n') { + if (yych <= '\t') goto yy194; + goto yy184; + } else { + if (yych == '\r') goto yy184; + goto yy194; + } + } else { + if (yych <= '#') { + if (yych <= '"') goto yy184; + goto yy194; + } else { + if (yych <= '$') goto yy197; + if (yych <= '&') goto yy194; + goto yy184; + } + } + } else { + if (yych <= ':') { + if (yych <= '.') { + if (yych <= '-') goto yy194; + goto yy207; + } else { + if (yych <= '/') goto yy194; + if (yych <= '9') goto yy209; + goto yy194; + } + } else { + if (yych <= '[') { + if (yych <= ';') goto yy184; + goto yy194; + } else { + if (yych <= '\\') goto yy196; + if (yych <= ']') goto yy184; + goto yy194; + } + } + } +yy211: + YYDEBUG(211, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(212, *YYCURSOR); + if (yych <= '&') { + if (yych <= '\r') { + if (yych == '\n') goto yy184; + if (yych <= '\f') goto yy194; + goto yy184; + } else { + if (yych <= '"') { + if (yych <= '!') goto yy194; + goto yy184; + } else { + if (yych == '$') goto yy197; + goto yy194; + } + } + } else { + if (yych <= ':') { + if (yych <= '\'') goto yy184; + if (yych <= '/') goto yy194; + if (yych <= '9') goto yy211; + goto yy194; + } else { + if (yych <= '[') { + if (yych <= ';') goto yy184; + goto yy194; + } else { + if (yych <= '\\') goto yy196; + if (yych <= ']') goto yy184; + goto yy194; + } + } + } +yy213: + YYDEBUG(213, *YYCURSOR); + yyaccept = 2; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(214, *YYCURSOR); + if (yych <= '&') { + if (yych <= '\r') { + if (yych == '\n') goto yy184; + if (yych <= '\f') goto yy194; + goto yy184; + } else { + if (yych <= '"') { + if (yych <= '!') goto yy194; + goto yy184; + } else { + if (yych == '$') goto yy197; + goto yy194; + } + } + } else { + if (yych <= ':') { + if (yych <= '\'') goto yy184; + if (yych <= '/') goto yy194; + if (yych <= '9') goto yy213; + goto yy194; + } else { + if (yych <= '[') { + if (yych <= ';') goto yy184; + goto yy194; + } else { + if (yych <= '\\') goto yy196; + if (yych <= ']') goto yy184; + goto yy194; + } + } + } +yy215: + YYDEBUG(215, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(216, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy215; + } + YYDEBUG(217, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(218, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 368 "Zend/zend_ini_scanner.l" + { /* Raw string */ + /* Eat leading and trailing single quotes */ + if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') { + SCNG(yy_text)++; + yyleng = yyleng - 2; + } + RETURN_TOKEN(TC_RAW, yytext, yyleng); +} +#line 2724 "Zend/zend_ini_scanner.c" +yy219: + YYDEBUG(219, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(220, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 401 "Zend/zend_ini_scanner.l" + { /* Variable start */ + yy_push_state(ST_VARNAME TSRMLS_CC); + return TC_DOLLAR_CURLY; +} +#line 2735 "Zend/zend_ini_scanner.c" +yy221: + YYDEBUG(221, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(222, *YYCURSOR); + if (yych <= '"') { + if (yych <= '\f') { + if (yych <= 0x08) goto yy194; + if (yych <= '\t') goto yy221; + if (yych <= '\n') goto yy173; + goto yy194; + } else { + if (yych <= 0x1F) { + if (yych <= '\r') goto yy173; + goto yy194; + } else { + if (yych <= ' ') goto yy221; + if (yych <= '!') goto yy194; + } + } + } else { + if (yych <= ':') { + if (yych <= '$') { + if (yych <= '#') goto yy194; + goto yy197; + } else { + if (yych == '\'') goto yy173; + goto yy194; + } + } else { + if (yych <= '[') { + if (yych <= ';') goto yy173; + goto yy194; + } else { + if (yych <= '\\') goto yy196; + if (yych <= ']') goto yy173; + goto yy194; + } + } + } +yy223: + YYDEBUG(223, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy178; + } +/* *********************************** */ +yyc_ST_VALUE: + { + static const unsigned char yybm[] = { + 160, 162, 162, 162, 162, 162, 162, 162, + 162, 176, 128, 162, 162, 128, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 176, 160, 160, 162, 168, 162, 160, 32, + 160, 160, 162, 162, 162, 162, 162, 162, + 230, 230, 230, 230, 230, 230, 230, 230, + 230, 230, 162, 160, 162, 160, 162, 162, + 162, 166, 166, 166, 166, 166, 166, 166, + 166, 166, 166, 166, 166, 166, 166, 166, + 166, 166, 166, 166, 166, 166, 166, 166, + 166, 166, 166, 162, 162, 162, 160, 166, + 162, 166, 166, 166, 166, 166, 166, 166, + 166, 166, 166, 166, 166, 166, 166, 166, + 166, 166, 166, 166, 166, 166, 166, 166, + 166, 166, 166, 162, 160, 162, 160, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + }; + YYDEBUG(224, *YYCURSOR); + YYFILL(6); + yych = *YYCURSOR; + YYDEBUG(-1, yych); + switch (yych) { + case 0x00: goto yy226; + case '\t': + case ' ': goto yy230; + case '\n': goto yy232; + case '\r': goto yy234; + case '!': + case '&': + case '(': + case ')': + case '^': + case '|': + case '~': goto yy235; + case '"': goto yy237; + case '$': goto yy239; + case '\'': goto yy240; + case '-': goto yy241; + case '.': goto yy242; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy243; + case ';': goto yy245; + case '=': goto yy246; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'p': + case 'q': + case 'r': + case 's': + case 'u': + case 'v': + case 'w': + case 'x': + case 'z': goto yy248; + case 'F': + case 'f': goto yy250; + case 'N': + case 'n': goto yy251; + case 'O': + case 'o': goto yy252; + case 'T': + case 't': goto yy253; + case 'Y': + case 'y': goto yy254; + default: goto yy228; + } +yy226: + YYDEBUG(226, *YYCURSOR); + ++YYCURSOR; +yy227: + YYDEBUG(227, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 598 "Zend/zend_ini_scanner.l" + { /* End of option value (if EOF is reached before EOL */ + BEGIN(INITIAL); + return END_OF_LINE; +} +#line 2921 "Zend/zend_ini_scanner.c" +yy228: + YYDEBUG(228, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + goto yy256; +yy229: + YYDEBUG(229, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 517 "Zend/zend_ini_scanner.l" + { /* Get everything else as option/offset value */ + RETURN_TOKEN(TC_STRING, yytext, yyleng); +} +#line 2934 "Zend/zend_ini_scanner.c" +yy230: + YYDEBUG(230, *YYCURSOR); + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + goto yy306; +yy231: + YYDEBUG(231, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 571 "Zend/zend_ini_scanner.l" + { + RETURN_TOKEN(TC_WHITESPACE, yytext, yyleng); +} +#line 2947 "Zend/zend_ini_scanner.c" +yy232: + YYDEBUG(232, *YYCURSOR); + ++YYCURSOR; +yy233: + YYDEBUG(233, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 489 "Zend/zend_ini_scanner.l" + { /* End of option value */ + BEGIN(INITIAL); + SCNG(lineno)++; + return END_OF_LINE; +} +#line 2960 "Zend/zend_ini_scanner.c" +yy234: + YYDEBUG(234, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy304; + goto yy233; +yy235: + YYDEBUG(235, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy303; +yy236: + YYDEBUG(236, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 507 "Zend/zend_ini_scanner.l" + { /* Boolean operators */ + return yytext[0]; +} +#line 2978 "Zend/zend_ini_scanner.c" +yy237: + YYDEBUG(237, *YYCURSOR); + ++YYCURSOR; +yy238: + YYDEBUG(238, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 525 "Zend/zend_ini_scanner.l" + { /* Double quoted '"' string start */ + yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); + return '"'; +} +#line 2990 "Zend/zend_ini_scanner.c" +yy239: + YYDEBUG(239, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= '\\') { + if (yych <= 0x00) goto yy227; + if (yych <= '[') goto yy255; + goto yy262; + } else { + if (yych == '{') goto yy300; + goto yy255; + } +yy240: + YYDEBUG(240, *YYCURSOR); + yyaccept = 2; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy296; + } + goto yy227; +yy241: + YYDEBUG(241, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy256; + if (yych <= '9') goto yy294; + goto yy256; +yy242: + YYDEBUG(242, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy256; + if (yych <= '9') goto yy292; + goto yy256; +yy243: + YYDEBUG(243, *YYCURSOR); + yyaccept = 3; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') { + if (yych <= 0x1F) { + if (yych <= '\n') { + if (yych <= 0x00) goto yy244; + if (yych <= 0x08) goto yy256; + } else { + if (yych != '\r') goto yy256; + } + } else { + if (yych <= ')') { + if (yych <= '"') goto yy244; + if (yych <= '%') goto yy256; + } else { + if (yych == '.') goto yy288; + goto yy256; + } + } + } else { + if (yych <= ']') { + if (yych <= ';') { + if (yych <= '9') goto yy290; + if (yych <= ':') goto yy256; + } else { + if (yych != '=') goto yy256; + } + } else { + if (yych <= '|') { + if (yych <= '^') goto yy244; + if (yych <= '{') goto yy256; + } else { + if (yych != '~') goto yy256; + } + } + } +yy244: + YYDEBUG(244, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 499 "Zend/zend_ini_scanner.l" + { /* Get number option value as string */ + RETURN_TOKEN(TC_NUMBER, yytext, yyleng); +} +#line 3069 "Zend/zend_ini_scanner.c" +yy245: + YYDEBUG(245, *YYCURSOR); + yyaccept = 2; + yych = *(YYMARKER = ++YYCURSOR); + goto yy284; +yy246: + YYDEBUG(246, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(247, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 511 "Zend/zend_ini_scanner.l" + { /* Make = used in option value to trigger error */ + yyless(0); + BEGIN(INITIAL); + return END_OF_LINE; +} +#line 3086 "Zend/zend_ini_scanner.c" +yy248: + YYDEBUG(248, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy257; + } + if (yych <= ':') { + if (yych <= '\r') { + if (yych <= 0x08) { + if (yych >= 0x01) goto yy256; + } else { + if (yych <= '\n') goto yy249; + if (yych <= '\f') goto yy256; + } + } else { + if (yych <= '"') { + if (yych <= 0x1F) goto yy256; + } else { + if (yych <= '%') goto yy256; + if (yych >= '*') goto yy256; + } + } + } else { + if (yych <= '^') { + if (yych <= '<') { + if (yych >= '<') goto yy256; + } else { + if (yych <= '=') goto yy249; + if (yych <= ']') goto yy256; + } + } else { + if (yych <= '|') { + if (yych <= '{') goto yy256; + } else { + if (yych != '~') goto yy256; + } + } + } +yy249: + YYDEBUG(249, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 495 "Zend/zend_ini_scanner.l" + { /* Get constant option value */ + RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); +} +#line 3133 "Zend/zend_ini_scanner.c" +yy250: + YYDEBUG(250, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '<') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy249; + if (yych <= 0x08) goto yy256; + goto yy249; + } else { + if (yych == '\r') goto yy249; + if (yych <= 0x1F) goto yy256; + goto yy249; + } + } else { + if (yych <= '/') { + if (yych <= '%') goto yy256; + if (yych <= ')') goto yy249; + goto yy256; + } else { + if (yych <= '9') goto yy257; + if (yych == ';') goto yy249; + goto yy256; + } + } + } else { + if (yych <= '_') { + if (yych <= 'A') { + if (yych <= '=') goto yy249; + if (yych <= '@') goto yy256; + goto yy280; + } else { + if (yych <= 'Z') goto yy257; + if (yych <= ']') goto yy256; + if (yych <= '^') goto yy249; + goto yy257; + } + } else { + if (yych <= '{') { + if (yych <= '`') goto yy256; + if (yych <= 'a') goto yy280; + if (yych <= 'z') goto yy257; + goto yy256; + } else { + if (yych == '}') goto yy256; + if (yych <= '~') goto yy249; + goto yy256; + } + } + } +yy251: + YYDEBUG(251, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'N') { + if (yych <= '%') { + if (yych <= '\f') { + if (yych <= 0x00) goto yy249; + if (yych <= 0x08) goto yy256; + if (yych <= '\n') goto yy249; + goto yy256; + } else { + if (yych <= '\r') goto yy249; + if (yych <= 0x1F) goto yy256; + if (yych <= '"') goto yy249; + goto yy256; + } + } else { + if (yych <= ':') { + if (yych <= ')') goto yy249; + if (yych <= '/') goto yy256; + if (yych <= '9') goto yy257; + goto yy256; + } else { + if (yych <= '<') { + if (yych <= ';') goto yy249; + goto yy256; + } else { + if (yych <= '=') goto yy249; + if (yych <= '@') goto yy256; + goto yy257; + } + } + } + } else { + if (yych <= 'n') { + if (yych <= 'Z') { + if (yych <= 'O') goto yy276; + if (yych == 'U') goto yy277; + goto yy257; + } else { + if (yych <= '^') { + if (yych <= ']') goto yy256; + goto yy249; + } else { + if (yych == '`') goto yy256; + goto yy257; + } + } + } else { + if (yych <= 'z') { + if (yych <= 'o') goto yy276; + if (yych == 'u') goto yy277; + goto yy257; + } else { + if (yych <= '|') { + if (yych <= '{') goto yy256; + goto yy249; + } else { + if (yych == '~') goto yy249; + goto yy256; + } + } + } + } +yy252: + YYDEBUG(252, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'E') { + if (yych <= '%') { + if (yych <= '\f') { + if (yych <= 0x00) goto yy249; + if (yych <= 0x08) goto yy256; + if (yych <= '\n') goto yy249; + goto yy256; + } else { + if (yych <= '\r') goto yy249; + if (yych <= 0x1F) goto yy256; + if (yych <= '"') goto yy249; + goto yy256; + } + } else { + if (yych <= ':') { + if (yych <= ')') goto yy249; + if (yych <= '/') goto yy256; + if (yych <= '9') goto yy257; + goto yy256; + } else { + if (yych <= '<') { + if (yych <= ';') goto yy249; + goto yy256; + } else { + if (yych <= '=') goto yy249; + if (yych <= '@') goto yy256; + goto yy257; + } + } + } + } else { + if (yych <= 'e') { + if (yych <= 'Z') { + if (yych <= 'F') goto yy271; + if (yych == 'N') goto yy265; + goto yy257; + } else { + if (yych <= '^') { + if (yych <= ']') goto yy256; + goto yy249; + } else { + if (yych == '`') goto yy256; + goto yy257; + } + } + } else { + if (yych <= 'z') { + if (yych <= 'f') goto yy271; + if (yych == 'n') goto yy265; + goto yy257; + } else { + if (yych <= '|') { + if (yych <= '{') goto yy256; + goto yy249; + } else { + if (yych == '~') goto yy249; + goto yy256; + } + } + } + } +yy253: + YYDEBUG(253, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy249; + if (yych <= 0x08) goto yy256; + goto yy249; + } else { + if (yych == '\r') goto yy249; + if (yych <= 0x1F) goto yy256; + goto yy249; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy256; + if (yych <= ')') goto yy249; + if (yych <= '/') goto yy256; + goto yy257; + } else { + if (yych == ';') goto yy249; + if (yych <= '<') goto yy256; + goto yy249; + } + } + } else { + if (yych <= '`') { + if (yych <= 'Z') { + if (yych <= '@') goto yy256; + if (yych == 'R') goto yy269; + goto yy257; + } else { + if (yych <= ']') goto yy256; + if (yych <= '^') goto yy249; + if (yych <= '_') goto yy257; + goto yy256; + } + } else { + if (yych <= '{') { + if (yych == 'r') goto yy269; + if (yych <= 'z') goto yy257; + goto yy256; + } else { + if (yych == '}') goto yy256; + if (yych <= '~') goto yy249; + goto yy256; + } + } + } +yy254: + YYDEBUG(254, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy249; + if (yych <= 0x08) goto yy256; + goto yy249; + } else { + if (yych == '\r') goto yy249; + if (yych <= 0x1F) goto yy256; + goto yy249; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy256; + if (yych <= ')') goto yy249; + if (yych <= '/') goto yy256; + goto yy257; + } else { + if (yych == ';') goto yy249; + if (yych <= '<') goto yy256; + goto yy249; + } + } + } else { + if (yych <= '`') { + if (yych <= 'Z') { + if (yych <= '@') goto yy256; + if (yych == 'E') goto yy259; + goto yy257; + } else { + if (yych <= ']') goto yy256; + if (yych <= '^') goto yy249; + if (yych <= '_') goto yy257; + goto yy256; + } + } else { + if (yych <= '{') { + if (yych == 'e') goto yy259; + if (yych <= 'z') goto yy257; + goto yy256; + } else { + if (yych == '}') goto yy256; + if (yych <= '~') goto yy249; + goto yy256; + } + } + } +yy255: + YYDEBUG(255, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy256: + YYDEBUG(256, *YYCURSOR); + if (yybm[0+yych] & 2) { + goto yy255; + } + if (yych == '$') goto yy260; + goto yy229; +yy257: + YYDEBUG(257, *YYCURSOR); + yyaccept = 4; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(258, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy257; + } + if (yych <= ')') { + if (yych <= '\r') { + if (yych <= 0x08) { + if (yych <= 0x00) goto yy249; + goto yy255; + } else { + if (yych <= '\n') goto yy249; + if (yych <= '\f') goto yy255; + goto yy249; + } + } else { + if (yych <= '#') { + if (yych <= 0x1F) goto yy255; + if (yych <= '"') goto yy249; + goto yy255; + } else { + if (yych <= '$') goto yy260; + if (yych <= '%') goto yy255; + goto yy249; + } + } + } else { + if (yych <= ']') { + if (yych <= ';') { + if (yych <= ':') goto yy255; + goto yy249; + } else { + if (yych == '=') goto yy249; + goto yy255; + } + } else { + if (yych <= '|') { + if (yych <= '^') goto yy249; + if (yych <= '{') goto yy255; + goto yy249; + } else { + if (yych == '~') goto yy249; + goto yy255; + } + } + } +yy259: + YYDEBUG(259, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy249; + if (yych <= 0x08) goto yy256; + goto yy249; + } else { + if (yych == '\r') goto yy249; + if (yych <= 0x1F) goto yy256; + goto yy249; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy256; + if (yych <= ')') goto yy249; + if (yych <= '/') goto yy256; + goto yy257; + } else { + if (yych == ';') goto yy249; + if (yych <= '<') goto yy256; + goto yy249; + } + } + } else { + if (yych <= '`') { + if (yych <= 'Z') { + if (yych <= '@') goto yy256; + if (yych == 'S') goto yy265; + goto yy257; + } else { + if (yych <= ']') goto yy256; + if (yych <= '^') goto yy249; + if (yych <= '_') goto yy257; + goto yy256; + } + } else { + if (yych <= '{') { + if (yych == 's') goto yy265; + if (yych <= 'z') goto yy257; + goto yy256; + } else { + if (yych == '}') goto yy256; + if (yych <= '~') goto yy249; + goto yy256; + } + } + } +yy260: + YYDEBUG(260, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yych <= '\\') { + if (yych <= 0x00) goto yy261; + if (yych <= '[') goto yy255; + goto yy262; + } else { + if (yych != '{') goto yy255; + } +yy261: + YYDEBUG(261, *YYCURSOR); + YYCURSOR = YYMARKER; + if (yyaccept <= 3) { + if (yyaccept <= 1) { + if (yyaccept <= 0) { + goto yy229; + } else { + goto yy231; + } + } else { + if (yyaccept <= 2) { + goto yy227; + } else { + goto yy244; + } + } + } else { + if (yyaccept <= 5) { + if (yyaccept <= 4) { + goto yy249; + } else { + goto yy266; + } + } else { + goto yy273; + } + } +yy262: + YYDEBUG(262, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 8) { + goto yy263; + } + goto yy255; +yy263: + YYDEBUG(263, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(264, *YYCURSOR); + if (yybm[0+yych] & 8) { + goto yy263; + } + if (yych <= 0x00) goto yy229; + if (yych == '\\') goto yy262; + goto yy255; +yy265: + YYDEBUG(265, *YYCURSOR); + yyaccept = 5; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy267; + } + if (yych <= ';') { + if (yych <= ' ') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy266; + if (yych <= '\t') goto yy256; + } else { + if (yych != '\r') goto yy256; + } + } else { + if (yych <= ')') { + if (yych <= '"') goto yy266; + if (yych <= '%') goto yy256; + } else { + if (yych <= '/') goto yy256; + if (yych <= '9') goto yy257; + if (yych <= ':') goto yy256; + } + } + } else { + if (yych <= '_') { + if (yych <= '@') { + if (yych != '=') goto yy256; + } else { + if (yych <= 'Z') goto yy257; + if (yych <= ']') goto yy256; + if (yych >= '_') goto yy257; + } + } else { + if (yych <= '{') { + if (yych <= '`') goto yy256; + if (yych <= 'z') goto yy257; + goto yy256; + } else { + if (yych == '}') goto yy256; + if (yych >= 0x7F) goto yy256; + } + } + } +yy266: + YYDEBUG(266, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 421 "Zend/zend_ini_scanner.l" + { /* TRUE value (when used outside option value/offset this causes parse error!) */ + RETURN_TOKEN(BOOL_TRUE, "1", 1); +} +#line 3645 "Zend/zend_ini_scanner.c" +yy267: + YYDEBUG(267, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(268, *YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy267; + } + goto yy266; +yy269: + YYDEBUG(269, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy249; + if (yych <= 0x08) goto yy256; + goto yy249; + } else { + if (yych == '\r') goto yy249; + if (yych <= 0x1F) goto yy256; + goto yy249; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy256; + if (yych <= ')') goto yy249; + if (yych <= '/') goto yy256; + goto yy257; + } else { + if (yych == ';') goto yy249; + if (yych <= '<') goto yy256; + goto yy249; + } + } + } else { + if (yych <= '`') { + if (yych <= 'Z') { + if (yych <= '@') goto yy256; + if (yych != 'U') goto yy257; + } else { + if (yych <= ']') goto yy256; + if (yych <= '^') goto yy249; + if (yych <= '_') goto yy257; + goto yy256; + } + } else { + if (yych <= '{') { + if (yych == 'u') goto yy270; + if (yych <= 'z') goto yy257; + goto yy256; + } else { + if (yych == '}') goto yy256; + if (yych <= '~') goto yy249; + goto yy256; + } + } + } +yy270: + YYDEBUG(270, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy249; + if (yych <= 0x08) goto yy256; + goto yy249; + } else { + if (yych == '\r') goto yy249; + if (yych <= 0x1F) goto yy256; + goto yy249; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy256; + if (yych <= ')') goto yy249; + if (yych <= '/') goto yy256; + goto yy257; + } else { + if (yych == ';') goto yy249; + if (yych <= '<') goto yy256; + goto yy249; + } + } + } else { + if (yych <= '`') { + if (yych <= 'Z') { + if (yych <= '@') goto yy256; + if (yych == 'E') goto yy265; + goto yy257; + } else { + if (yych <= ']') goto yy256; + if (yych <= '^') goto yy249; + if (yych <= '_') goto yy257; + goto yy256; + } + } else { + if (yych <= '{') { + if (yych == 'e') goto yy265; + if (yych <= 'z') goto yy257; + goto yy256; + } else { + if (yych == '}') goto yy256; + if (yych <= '~') goto yy249; + goto yy256; + } + } + } +yy271: + YYDEBUG(271, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy249; + if (yych <= 0x08) goto yy256; + goto yy249; + } else { + if (yych == '\r') goto yy249; + if (yych <= 0x1F) goto yy256; + goto yy249; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy256; + if (yych <= ')') goto yy249; + if (yych <= '/') goto yy256; + goto yy257; + } else { + if (yych == ';') goto yy249; + if (yych <= '<') goto yy256; + goto yy249; + } + } + } else { + if (yych <= '`') { + if (yych <= 'Z') { + if (yych <= '@') goto yy256; + if (yych != 'F') goto yy257; + } else { + if (yych <= ']') goto yy256; + if (yych <= '^') goto yy249; + if (yych <= '_') goto yy257; + goto yy256; + } + } else { + if (yych <= '{') { + if (yych == 'f') goto yy272; + if (yych <= 'z') goto yy257; + goto yy256; + } else { + if (yych == '}') goto yy256; + if (yych <= '~') goto yy249; + goto yy256; + } + } + } +yy272: + YYDEBUG(272, *YYCURSOR); + yyaccept = 6; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy257; + } + if (yych <= ')') { + if (yych <= '\f') { + if (yych <= 0x08) { + if (yych >= 0x01) goto yy256; + } else { + if (yych <= '\t') goto yy274; + if (yych >= '\v') goto yy256; + } + } else { + if (yych <= ' ') { + if (yych <= '\r') goto yy273; + if (yych <= 0x1F) goto yy256; + goto yy274; + } else { + if (yych <= '"') goto yy273; + if (yych <= '%') goto yy256; + } + } + } else { + if (yych <= ']') { + if (yych <= ';') { + if (yych <= ':') goto yy256; + } else { + if (yych != '=') goto yy256; + } + } else { + if (yych <= '|') { + if (yych <= '^') goto yy273; + if (yych <= '{') goto yy256; + } else { + if (yych != '~') goto yy256; + } + } + } +yy273: + YYDEBUG(273, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 425 "Zend/zend_ini_scanner.l" + { /* FALSE value (when used outside option value/offset this causes parse error!)*/ + RETURN_TOKEN(BOOL_FALSE, "", 0); +} +#line 3855 "Zend/zend_ini_scanner.c" +yy274: + YYDEBUG(274, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(275, *YYCURSOR); + if (yych == '\t') goto yy274; + if (yych == ' ') goto yy274; + goto yy273; +yy276: + YYDEBUG(276, *YYCURSOR); + yyaccept = 6; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '<') { + if (yych <= ' ') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy273; + if (yych <= 0x08) goto yy256; + if (yych <= '\t') goto yy274; + goto yy273; + } else { + if (yych == '\r') goto yy273; + if (yych <= 0x1F) goto yy256; + goto yy274; + } + } else { + if (yych <= '/') { + if (yych <= '"') goto yy273; + if (yych <= '%') goto yy256; + if (yych <= ')') goto yy273; + goto yy256; + } else { + if (yych <= '9') goto yy257; + if (yych == ';') goto yy273; + goto yy256; + } + } + } else { + if (yych <= '_') { + if (yych <= 'N') { + if (yych <= '=') goto yy273; + if (yych <= '@') goto yy256; + if (yych <= 'M') goto yy257; + goto yy279; + } else { + if (yych <= 'Z') goto yy257; + if (yych <= ']') goto yy256; + if (yych <= '^') goto yy273; + goto yy257; + } + } else { + if (yych <= 'z') { + if (yych <= '`') goto yy256; + if (yych == 'n') goto yy279; + goto yy257; + } else { + if (yych <= '|') { + if (yych <= '{') goto yy256; + goto yy273; + } else { + if (yych == '~') goto yy273; + goto yy256; + } + } + } + } +yy277: + YYDEBUG(277, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy249; + if (yych <= 0x08) goto yy256; + goto yy249; + } else { + if (yych == '\r') goto yy249; + if (yych <= 0x1F) goto yy256; + goto yy249; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy256; + if (yych <= ')') goto yy249; + if (yych <= '/') goto yy256; + goto yy257; + } else { + if (yych == ';') goto yy249; + if (yych <= '<') goto yy256; + goto yy249; + } + } + } else { + if (yych <= '`') { + if (yych <= 'Z') { + if (yych <= '@') goto yy256; + if (yych != 'L') goto yy257; + } else { + if (yych <= ']') goto yy256; + if (yych <= '^') goto yy249; + if (yych <= '_') goto yy257; + goto yy256; + } + } else { + if (yych <= '{') { + if (yych == 'l') goto yy278; + if (yych <= 'z') goto yy257; + goto yy256; + } else { + if (yych == '}') goto yy256; + if (yych <= '~') goto yy249; + goto yy256; + } + } + } +yy278: + YYDEBUG(278, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy249; + if (yych <= 0x08) goto yy256; + goto yy249; + } else { + if (yych == '\r') goto yy249; + if (yych <= 0x1F) goto yy256; + goto yy249; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy256; + if (yych <= ')') goto yy249; + if (yych <= '/') goto yy256; + goto yy257; + } else { + if (yych == ';') goto yy249; + if (yych <= '<') goto yy256; + goto yy249; + } + } + } else { + if (yych <= '`') { + if (yych <= 'Z') { + if (yych <= '@') goto yy256; + if (yych == 'L') goto yy272; + goto yy257; + } else { + if (yych <= ']') goto yy256; + if (yych <= '^') goto yy249; + if (yych <= '_') goto yy257; + goto yy256; + } + } else { + if (yych <= '{') { + if (yych == 'l') goto yy272; + if (yych <= 'z') goto yy257; + goto yy256; + } else { + if (yych == '}') goto yy256; + if (yych <= '~') goto yy249; + goto yy256; + } + } + } +yy279: + YYDEBUG(279, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy249; + if (yych <= 0x08) goto yy256; + goto yy249; + } else { + if (yych == '\r') goto yy249; + if (yych <= 0x1F) goto yy256; + goto yy249; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy256; + if (yych <= ')') goto yy249; + if (yych <= '/') goto yy256; + goto yy257; + } else { + if (yych == ';') goto yy249; + if (yych <= '<') goto yy256; + goto yy249; + } + } + } else { + if (yych <= '`') { + if (yych <= 'Z') { + if (yych <= '@') goto yy256; + if (yych == 'E') goto yy272; + goto yy257; + } else { + if (yych <= ']') goto yy256; + if (yych <= '^') goto yy249; + if (yych <= '_') goto yy257; + goto yy256; + } + } else { + if (yych <= '{') { + if (yych == 'e') goto yy272; + if (yych <= 'z') goto yy257; + goto yy256; + } else { + if (yych == '}') goto yy256; + if (yych <= '~') goto yy249; + goto yy256; + } + } + } +yy280: + YYDEBUG(280, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy249; + if (yych <= 0x08) goto yy256; + goto yy249; + } else { + if (yych == '\r') goto yy249; + if (yych <= 0x1F) goto yy256; + goto yy249; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy256; + if (yych <= ')') goto yy249; + if (yych <= '/') goto yy256; + goto yy257; + } else { + if (yych == ';') goto yy249; + if (yych <= '<') goto yy256; + goto yy249; + } + } + } else { + if (yych <= '`') { + if (yych <= 'Z') { + if (yych <= '@') goto yy256; + if (yych != 'L') goto yy257; + } else { + if (yych <= ']') goto yy256; + if (yych <= '^') goto yy249; + if (yych <= '_') goto yy257; + goto yy256; + } + } else { + if (yych <= '{') { + if (yych == 'l') goto yy281; + if (yych <= 'z') goto yy257; + goto yy256; + } else { + if (yych == '}') goto yy256; + if (yych <= '~') goto yy249; + goto yy256; + } + } + } +yy281: + YYDEBUG(281, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy249; + if (yych <= 0x08) goto yy256; + goto yy249; + } else { + if (yych == '\r') goto yy249; + if (yych <= 0x1F) goto yy256; + goto yy249; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy256; + if (yych <= ')') goto yy249; + if (yych <= '/') goto yy256; + goto yy257; + } else { + if (yych == ';') goto yy249; + if (yych <= '<') goto yy256; + goto yy249; + } + } + } else { + if (yych <= '`') { + if (yych <= 'Z') { + if (yych <= '@') goto yy256; + if (yych != 'S') goto yy257; + } else { + if (yych <= ']') goto yy256; + if (yych <= '^') goto yy249; + if (yych <= '_') goto yy257; + goto yy256; + } + } else { + if (yych <= '{') { + if (yych == 's') goto yy282; + if (yych <= 'z') goto yy257; + goto yy256; + } else { + if (yych == '}') goto yy256; + if (yych <= '~') goto yy249; + goto yy256; + } + } + } +yy282: + YYDEBUG(282, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy249; + if (yych <= 0x08) goto yy256; + goto yy249; + } else { + if (yych == '\r') goto yy249; + if (yych <= 0x1F) goto yy256; + goto yy249; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy256; + if (yych <= ')') goto yy249; + if (yych <= '/') goto yy256; + goto yy257; + } else { + if (yych == ';') goto yy249; + if (yych <= '<') goto yy256; + goto yy249; + } + } + } else { + if (yych <= '`') { + if (yych <= 'Z') { + if (yych <= '@') goto yy256; + if (yych == 'E') goto yy272; + goto yy257; + } else { + if (yych <= ']') goto yy256; + if (yych <= '^') goto yy249; + if (yych <= '_') goto yy257; + goto yy256; + } + } else { + if (yych <= '{') { + if (yych == 'e') goto yy272; + if (yych <= 'z') goto yy257; + goto yy256; + } else { + if (yych == '}') goto yy256; + if (yych <= '~') goto yy249; + goto yy256; + } + } + } +yy283: + YYDEBUG(283, *YYCURSOR); + ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; +yy284: + YYDEBUG(284, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy283; + } + if (yych >= '\r') goto yy287; +yy285: + YYDEBUG(285, *YYCURSOR); + ++YYCURSOR; +yy286: + YYDEBUG(286, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 585 "Zend/zend_ini_scanner.l" + { /* Comment */ + BEGIN(INITIAL); + SCNG(lineno)++; + return END_OF_LINE; +} +#line 4248 "Zend/zend_ini_scanner.c" +yy287: + YYDEBUG(287, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy285; + goto yy286; +yy288: + YYDEBUG(288, *YYCURSOR); + yyaccept = 3; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(289, *YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy288; + } + if (yych <= ')') { + if (yych <= '\r') { + if (yych <= 0x08) { + if (yych <= 0x00) goto yy244; + goto yy255; + } else { + if (yych <= '\n') goto yy244; + if (yych <= '\f') goto yy255; + goto yy244; + } + } else { + if (yych <= '#') { + if (yych <= 0x1F) goto yy255; + if (yych <= '"') goto yy244; + goto yy255; + } else { + if (yych <= '$') goto yy260; + if (yych <= '%') goto yy255; + goto yy244; + } + } + } else { + if (yych <= ']') { + if (yych <= ';') { + if (yych <= ':') goto yy255; + goto yy244; + } else { + if (yych == '=') goto yy244; + goto yy255; + } + } else { + if (yych <= '|') { + if (yych <= '^') goto yy244; + if (yych <= '{') goto yy255; + goto yy244; + } else { + if (yych == '~') goto yy244; + goto yy255; + } + } + } +yy290: + YYDEBUG(290, *YYCURSOR); + yyaccept = 3; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(291, *YYCURSOR); + if (yych <= '.') { + if (yych <= 0x1F) { + if (yych <= '\n') { + if (yych <= 0x00) goto yy244; + if (yych <= 0x08) goto yy255; + goto yy244; + } else { + if (yych == '\r') goto yy244; + goto yy255; + } + } else { + if (yych <= '$') { + if (yych <= '"') goto yy244; + if (yych <= '#') goto yy255; + goto yy260; + } else { + if (yych <= '%') goto yy255; + if (yych <= ')') goto yy244; + if (yych <= '-') goto yy255; + goto yy288; + } + } + } else { + if (yych <= '=') { + if (yych <= ':') { + if (yych <= '/') goto yy255; + if (yych <= '9') goto yy290; + goto yy255; + } else { + if (yych == '<') goto yy255; + goto yy244; + } + } else { + if (yych <= '{') { + if (yych == '^') goto yy244; + goto yy255; + } else { + if (yych == '}') goto yy255; + if (yych <= '~') goto yy244; + goto yy255; + } + } + } +yy292: + YYDEBUG(292, *YYCURSOR); + yyaccept = 3; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(293, *YYCURSOR); + if (yych <= '/') { + if (yych <= 0x1F) { + if (yych <= '\n') { + if (yych <= 0x00) goto yy244; + if (yych <= 0x08) goto yy255; + goto yy244; + } else { + if (yych == '\r') goto yy244; + goto yy255; + } + } else { + if (yych <= '$') { + if (yych <= '"') goto yy244; + if (yych <= '#') goto yy255; + goto yy260; + } else { + if (yych <= '%') goto yy255; + if (yych <= ')') goto yy244; + goto yy255; + } + } + } else { + if (yych <= ']') { + if (yych <= ';') { + if (yych <= '9') goto yy292; + if (yych <= ':') goto yy255; + goto yy244; + } else { + if (yych == '=') goto yy244; + goto yy255; + } + } else { + if (yych <= '|') { + if (yych <= '^') goto yy244; + if (yych <= '{') goto yy255; + goto yy244; + } else { + if (yych == '~') goto yy244; + goto yy255; + } + } + } +yy294: + YYDEBUG(294, *YYCURSOR); + yyaccept = 3; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(295, *YYCURSOR); + if (yych <= '/') { + if (yych <= 0x1F) { + if (yych <= '\n') { + if (yych <= 0x00) goto yy244; + if (yych <= 0x08) goto yy255; + goto yy244; + } else { + if (yych == '\r') goto yy244; + goto yy255; + } + } else { + if (yych <= '$') { + if (yych <= '"') goto yy244; + if (yych <= '#') goto yy255; + goto yy260; + } else { + if (yych <= '%') goto yy255; + if (yych <= ')') goto yy244; + goto yy255; + } + } + } else { + if (yych <= ']') { + if (yych <= ';') { + if (yych <= '9') goto yy294; + if (yych <= ':') goto yy255; + goto yy244; + } else { + if (yych == '=') goto yy244; + goto yy255; + } + } else { + if (yych <= '|') { + if (yych <= '^') goto yy244; + if (yych <= '{') goto yy255; + goto yy244; + } else { + if (yych == '~') goto yy244; + goto yy255; + } + } + } +yy296: + YYDEBUG(296, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(297, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy296; + } + YYDEBUG(298, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(299, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 368 "Zend/zend_ini_scanner.l" + { /* Raw string */ + /* Eat leading and trailing single quotes */ + if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') { + SCNG(yy_text)++; + yyleng = yyleng - 2; + } + RETURN_TOKEN(TC_RAW, yytext, yyleng); +} +#line 4475 "Zend/zend_ini_scanner.c" +yy300: + YYDEBUG(300, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(301, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 401 "Zend/zend_ini_scanner.l" + { /* Variable start */ + yy_push_state(ST_VARNAME TSRMLS_CC); + return TC_DOLLAR_CURLY; +} +#line 4486 "Zend/zend_ini_scanner.c" +yy302: + YYDEBUG(302, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy303: + YYDEBUG(303, *YYCURSOR); + if (yych == '\t') goto yy302; + if (yych == ' ') goto yy302; + goto yy236; +yy304: + YYDEBUG(304, *YYCURSOR); + yych = *++YYCURSOR; + goto yy233; +yy305: + YYDEBUG(305, *YYCURSOR); + yyaccept = 1; + YYMARKER = ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; +yy306: + YYDEBUG(306, *YYCURSOR); + if (yych <= 0x1F) { + if (yych <= '\n') { + if (yych <= 0x08) goto yy231; + if (yych <= '\t') goto yy305; + goto yy304; + } else { + if (yych == '\r') goto yy308; + goto yy231; + } + } else { + if (yych <= '"') { + if (yych <= ' ') goto yy305; + if (yych <= '!') goto yy231; + } else { + if (yych == ';') goto yy283; + goto yy231; + } + } + YYDEBUG(307, *YYCURSOR); + yych = *++YYCURSOR; + goto yy238; +yy308: + YYDEBUG(308, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) == '\n') goto yy304; + goto yy233; + } +/* *********************************** */ +yyc_ST_VARNAME: + { + static const unsigned char yybm[] = { + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 0, 0, 128, 128, 0, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 0, 0, 128, 0, 128, 0, 128, + 0, 0, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 0, 128, 0, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 0, 128, 128, 0, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 0, 0, 0, 0, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + }; + YYDEBUG(309, *YYCURSOR); + YYFILL(2); + yych = *YYCURSOR; + if (yych <= ')') { + if (yych <= '"') { + if (yych <= '\f') { + if (yych <= 0x08) goto yy311; + if (yych <= '\n') goto yy313; + } else { + if (yych <= '\r') goto yy313; + if (yych >= '!') goto yy313; + } + } else { + if (yych <= '%') { + if (yych == '$') goto yy313; + } else { + if (yych != '\'') goto yy313; + } + } + } else { + if (yych <= '[') { + if (yych <= '<') { + if (yych == ';') goto yy313; + } else { + if (yych <= '=') goto yy313; + if (yych >= '[') goto yy313; + } + } else { + if (yych <= 'z') { + if (yych == '^') goto yy313; + } else { + if (yych == '}') goto yy315; + if (yych <= '~') goto yy313; + } + } + } +yy311: + YYDEBUG(311, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy318; +yy312: + YYDEBUG(312, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 406 "Zend/zend_ini_scanner.l" + { /* Variable name */ + /* Eat leading whitespace */ + EAT_LEADING_WHITESPACE(); + + /* Eat trailing whitespace */ + EAT_TRAILING_WHITESPACE(); + + RETURN_TOKEN(TC_VARNAME, yytext, yyleng); +} +#line 4627 "Zend/zend_ini_scanner.c" +yy313: + YYDEBUG(313, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(314, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 603 "Zend/zend_ini_scanner.l" + { + return 0; +} +#line 4637 "Zend/zend_ini_scanner.c" +yy315: + YYDEBUG(315, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(316, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 416 "Zend/zend_ini_scanner.l" + { /* Variable end */ + yy_pop_state(TSRMLS_C); + return '}'; +} +#line 4648 "Zend/zend_ini_scanner.c" +yy317: + YYDEBUG(317, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy318: + YYDEBUG(318, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy317; + } + goto yy312; + } +} +#line 607 "Zend/zend_ini_scanner.l" + +} diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 7cfab914debb4..7f46663c39c1a 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -212,6 +212,7 @@ static YYSIZE_T zend_yytnamerr(char*, const char*); %token T_NS_C "__NAMESPACE__ (T_NS_C)" %token T_DIR "__DIR__ (T_DIR)" %token T_NS_SEPARATOR "\\ (T_NS_SEPARATOR)" +%token T_ELLIPSIS "... (T_ELLIPSIS)" %% /* Rules */ @@ -296,7 +297,7 @@ inner_statement: statement | function_declaration_statement | class_declaration_statement - | T_HALT_COMPILER '(' ')' ';' { zend_error(E_COMPILE_ERROR, "__HALT_COMPILER() can only be used from the outermost scope"); } + | T_HALT_COMPILER '(' ')' ';' { zend_error_noreturn(E_COMPILE_ERROR, "__HALT_COMPILER() can only be used from the outermost scope"); } ; @@ -397,10 +398,14 @@ class_declaration_statement: ; is_reference: - /* empty */ { $$.op_type = ZEND_RETURN_VAL; } - | '&' { $$.op_type = ZEND_RETURN_REF; } + /* empty */ { $$.op_type = 0; } + | '&' { $$.op_type = 1; } ; +is_variadic: + /* empty */ { $$.op_type = 0; } + | T_ELLIPSIS { $$.op_type = 1; } +; unticked_function_declaration_statement: function is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$3, 0, $2.op_type, NULL TSRMLS_CC); } @@ -549,14 +554,15 @@ parameter_list: non_empty_parameter_list: - optional_class_type T_VARIABLE { $$.op_type = IS_UNUSED; $$.u.op.num=1; zend_do_receive_arg(ZEND_RECV, &$2, &$$, NULL, &$1, 0 TSRMLS_CC); } - | optional_class_type '&' T_VARIABLE { $$.op_type = IS_UNUSED; $$.u.op.num=1; zend_do_receive_arg(ZEND_RECV, &$3, &$$, NULL, &$1, 1 TSRMLS_CC); } - | optional_class_type '&' T_VARIABLE '=' static_scalar { $$.op_type = IS_UNUSED; $$.u.op.num=1; zend_do_receive_arg(ZEND_RECV_INIT, &$3, &$$, &$5, &$1, 1 TSRMLS_CC); } - | optional_class_type T_VARIABLE '=' static_scalar { $$.op_type = IS_UNUSED; $$.u.op.num=1; zend_do_receive_arg(ZEND_RECV_INIT, &$2, &$$, &$4, &$1, 0 TSRMLS_CC); } - | non_empty_parameter_list ',' optional_class_type T_VARIABLE { $$=$1; $$.u.op.num++; zend_do_receive_arg(ZEND_RECV, &$4, &$$, NULL, &$3, 0 TSRMLS_CC); } - | non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE { $$=$1; $$.u.op.num++; zend_do_receive_arg(ZEND_RECV, &$5, &$$, NULL, &$3, 1 TSRMLS_CC); } - | non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE '=' static_scalar { $$=$1; $$.u.op.num++; zend_do_receive_arg(ZEND_RECV_INIT, &$5, &$$, &$7, &$3, 1 TSRMLS_CC); } - | non_empty_parameter_list ',' optional_class_type T_VARIABLE '=' static_scalar { $$=$1; $$.u.op.num++; zend_do_receive_arg(ZEND_RECV_INIT, &$4, &$$, &$6, &$3, 0 TSRMLS_CC); } + parameter + | non_empty_parameter_list ',' parameter +; + +parameter: + optional_class_type is_reference is_variadic T_VARIABLE + { zend_do_receive_param(ZEND_RECV, &$4, NULL, &$1, $2.op_type, $3.op_type TSRMLS_CC); } + | optional_class_type is_reference is_variadic T_VARIABLE '=' static_scalar + { zend_do_receive_param(ZEND_RECV_INIT, &$4, &$6, &$1, $2.op_type, $3.op_type TSRMLS_CC); } ; @@ -655,8 +661,8 @@ trait_precedence: ; trait_reference_list: - fully_qualified_class_name { zend_resolve_class_name(&$1, ZEND_FETCH_CLASS_GLOBAL, 1 TSRMLS_CC); zend_init_list(&$$.u.op.ptr, Z_STRVAL($1.u.constant) TSRMLS_CC); } - | trait_reference_list ',' fully_qualified_class_name { zend_resolve_class_name(&$3, ZEND_FETCH_CLASS_GLOBAL, 1 TSRMLS_CC); zend_add_to_list(&$1.u.op.ptr, Z_STRVAL($3.u.constant) TSRMLS_CC); $$ = $1; } + fully_qualified_class_name { zend_resolve_class_name(&$1 TSRMLS_CC); zend_init_list(&$$.u.op.ptr, Z_STRVAL($1.u.constant) TSRMLS_CC); } + | trait_reference_list ',' fully_qualified_class_name { zend_resolve_class_name(&$3 TSRMLS_CC); zend_add_to_list(&$1.u.op.ptr, Z_STRVAL($3.u.constant) TSRMLS_CC); $$ = $1; } ; trait_method_reference: @@ -1222,7 +1228,7 @@ isset_variables: isset_variable: variable { zend_do_isset_or_isempty(ZEND_ISSET, &$$, &$1 TSRMLS_CC); } - | expr_without_variable { zend_error(E_COMPILE_ERROR, "Cannot use isset() on the result of an expression (you can use \"null !== expression\" instead)"); } + | expr_without_variable { zend_error_noreturn(E_COMPILE_ERROR, "Cannot use isset() on the result of an expression (you can use \"null !== expression\" instead)"); } ; class_constant: diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c index deb799ab763b2..76e3e5645129a 100644 --- a/Zend/zend_language_scanner.c +++ b/Zend/zend_language_scanner.c @@ -49,7 +49,7 @@ #include "zend_API.h" #include "zend_strtod.h" #include "zend_exceptions.h" -#include "tsrm_virtual_cwd.h" +#include "zend_virtual_cwd.h" #include "tsrm_config_common.h" #define YYCTYPE unsigned char @@ -564,10 +564,8 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR zend_bool original_in_compilation = CG(in_compilation); retval_znode.op_type = IS_CONST; - retval_znode.u.constant.type = IS_LONG; - retval_znode.u.constant.value.lval = 1; - Z_UNSET_ISREF(retval_znode.u.constant); - Z_SET_REFCOUNT(retval_znode.u.constant, 1); + INIT_PZVAL(&retval_znode.u.constant); + ZVAL_LONG(&retval_znode.u.constant, 1); zend_save_lexical_state(&original_lex_state TSRMLS_CC); @@ -624,7 +622,7 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC) convert_to_string(&tmp); filename = &tmp; } - file_handle.filename = filename->value.str.val; + file_handle.filename = Z_STRVAL_P(filename); file_handle.free_filename = 0; file_handle.type = ZEND_HANDLE_FILENAME; file_handle.opened_path = NULL; @@ -635,7 +633,7 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC) int dummy = 1; if (!file_handle.opened_path) { - file_handle.opened_path = opened_path = estrndup(filename->value.str.val, filename->value.str.len); + file_handle.opened_path = opened_path = estrndup(Z_STRVAL_P(filename), Z_STRLEN_P(filename)); } zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL); @@ -657,22 +655,15 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D char *buf; size_t size; - /* enforce two trailing NULLs for flex... */ - if (IS_INTERNED(str->value.str.val)) { - char *tmp = safe_emalloc(1, str->value.str.len, ZEND_MMAP_AHEAD); - memcpy(tmp, str->value.str.val, str->value.str.len + ZEND_MMAP_AHEAD); - str->value.str.val = tmp; - } else { - str->value.str.val = safe_erealloc(str->value.str.val, 1, str->value.str.len, ZEND_MMAP_AHEAD); - } - - memset(str->value.str.val + str->value.str.len, 0, ZEND_MMAP_AHEAD); + /* enforce ZEND_MMAP_AHEAD trailing NULLs for flex... */ + Z_STRVAL_P(str) = str_erealloc(Z_STRVAL_P(str), Z_STRLEN_P(str) + ZEND_MMAP_AHEAD); + memset(Z_STRVAL_P(str) + Z_STRLEN_P(str), 0, ZEND_MMAP_AHEAD); SCNG(yy_in) = NULL; SCNG(yy_start) = NULL; - buf = str->value.str.val; - size = str->value.str.len; + buf = Z_STRVAL_P(str); + size = Z_STRLEN_P(str); if (CG(multibyte)) { SCNG(script_org) = (unsigned char*)buf; @@ -733,7 +724,7 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC) int compiler_result; zend_bool original_in_compilation = CG(in_compilation); - if (source_string->value.str.len==0) { + if (Z_STRLEN_P(source_string)==0) { efree(op_array); return NULL; } @@ -871,11 +862,11 @@ ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter # define zend_copy_value(zendlval, yytext, yyleng) \ if (SCNG(output_filter)) { \ size_t sz = 0; \ - SCNG(output_filter)((unsigned char **)&(zendlval->value.str.val), &sz, (unsigned char *)yytext, (size_t)yyleng TSRMLS_CC); \ - zendlval->value.str.len = sz; \ + SCNG(output_filter)((unsigned char **)&Z_STRVAL_P(zendlval), &sz, (unsigned char *)yytext, (size_t)yyleng TSRMLS_CC); \ + Z_STRLEN_P(zendlval) = sz; \ } else { \ - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); \ - zendlval->value.str.len = yyleng; \ + Z_STRVAL_P(zendlval) = (char *) estrndup(yytext, yyleng); \ + Z_STRLEN_P(zendlval) = yyleng; \ } static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quote_type TSRMLS_DC) @@ -886,8 +877,8 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo ZVAL_STRINGL(zendlval, str, len, 1); /* convert escape sequences */ - s = t = zendlval->value.str.val; - end = s+zendlval->value.str.len; + s = t = Z_STRVAL_P(zendlval); + end = s+Z_STRLEN_P(zendlval); while (svalue.str.len--; + Z_STRLEN_P(zendlval)--; break; case 'r': *t++ = '\r'; - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; break; case 't': *t++ = '\t'; - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; break; case 'f': *t++ = '\f'; - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; break; case 'v': *t++ = '\v'; - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; break; case 'e': #ifdef PHP_WIN32 @@ -923,7 +914,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo #else *t++ = '\e'; #endif - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; break; case '"': case '`': @@ -935,20 +926,20 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo case '\\': case '$': *t++ = *s; - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; break; case 'x': case 'X': if (ZEND_IS_HEX(*(s+1))) { char hex_buf[3] = { 0, 0, 0 }; - zendlval->value.str.len--; /* for the 'x' */ + Z_STRLEN_P(zendlval)--; /* for the 'x' */ hex_buf[0] = *(++s); - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; if (ZEND_IS_HEX(*(s+1))) { hex_buf[1] = *(++s); - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; } *t++ = (char) strtol(hex_buf, NULL, 16); } else { @@ -962,13 +953,13 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo char octal_buf[4] = { 0, 0, 0, 0 }; octal_buf[0] = *s; - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; if (ZEND_IS_OCT(*(s+1))) { octal_buf[1] = *(++s); - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; if (ZEND_IS_OCT(*(s+1))) { octal_buf[2] = *(++s); - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; } } *t++ = (char) strtol(octal_buf, NULL, 8); @@ -990,9 +981,9 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo *t = 0; if (SCNG(output_filter)) { size_t sz = 0; - s = zendlval->value.str.val; - SCNG(output_filter)((unsigned char **)&(zendlval->value.str.val), &sz, (unsigned char *)s, (size_t)zendlval->value.str.len TSRMLS_CC); - zendlval->value.str.len = sz; + s = Z_STRVAL_P(zendlval); + SCNG(output_filter)((unsigned char **)&Z_STRVAL_P(zendlval), &sz, (unsigned char *)s, (size_t)Z_STRLEN_P(zendlval) TSRMLS_CC); + Z_STRLEN_P(zendlval) = sz; efree(s); } } @@ -1006,7 +997,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yymore_restart: -#line 1010 "Zend/zend_language_scanner.c" +#line 1001 "Zend/zend_language_scanner.c" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -1105,7 +1096,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy3: YYDEBUG(3, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1807 "Zend/zend_language_scanner.l" +#line 1741 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -1152,20 +1143,20 @@ int lex_scan(zval *zendlval TSRMLS_DC) if (SCNG(output_filter)) { int readsize; size_t sz = 0; - readsize = SCNG(output_filter)((unsigned char **)&(zendlval->value.str.val), &sz, (unsigned char *)yytext, (size_t)yyleng TSRMLS_CC); - zendlval->value.str.len = sz; + readsize = SCNG(output_filter)((unsigned char **)&Z_STRVAL_P(zendlval), &sz, (unsigned char *)yytext, (size_t)yyleng TSRMLS_CC); + Z_STRLEN_P(zendlval) = sz; if (readsize < yyleng) { yyless(readsize); } } else { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; + Z_STRVAL_P(zendlval) = (char *) estrndup(yytext, yyleng); + Z_STRLEN_P(zendlval) = yyleng; } zendlval->type = IS_STRING; HANDLE_NEWLINES(yytext, yyleng); return T_INLINE_HTML; } -#line 1169 "Zend/zend_language_scanner.c" +#line 1160 "Zend/zend_language_scanner.c" yy4: YYDEBUG(4, *YYCURSOR); yych = *++YYCURSOR; @@ -1183,38 +1174,34 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy6: YYDEBUG(6, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1795 "Zend/zend_language_scanner.l" +#line 1731 "Zend/zend_language_scanner.l" { if (CG(short_tags)) { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } else { goto inline_char_handler; } } -#line 1199 "Zend/zend_language_scanner.c" +#line 1188 "Zend/zend_language_scanner.c" yy7: YYDEBUG(7, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) == '=') goto yy43; YYDEBUG(8, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1772 "Zend/zend_language_scanner.l" +#line 1712 "Zend/zend_language_scanner.l" { if (CG(asp_tags)) { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } else { goto inline_char_handler; } } -#line 1218 "Zend/zend_language_scanner.c" +#line 1205 "Zend/zend_language_scanner.c" yy9: YYDEBUG(9, *YYCURSOR); yych = *++YYCURSOR; @@ -1400,7 +1387,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(38, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1732 "Zend/zend_language_scanner.l" +#line 1678 "Zend/zend_language_scanner.l" { YYCTYPE *bracket = (YYCTYPE*)zend_memrchr(yytext, '<', yyleng - (sizeof("script language=php>") - 1)); @@ -1411,13 +1398,11 @@ int lex_scan(zval *zendlval TSRMLS_DC) } HANDLE_NEWLINES(yytext, yyleng); - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } -#line 1421 "Zend/zend_language_scanner.c" +#line 1406 "Zend/zend_language_scanner.c" yy39: YYDEBUG(39, *YYCURSOR); yych = *++YYCURSOR; @@ -1444,33 +1429,29 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(44, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1750 "Zend/zend_language_scanner.l" +#line 1694 "Zend/zend_language_scanner.l" { if (CG(asp_tags)) { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG_WITH_ECHO; } else { goto inline_char_handler; } } -#line 1460 "Zend/zend_language_scanner.c" +#line 1443 "Zend/zend_language_scanner.c" yy45: YYDEBUG(45, *YYCURSOR); ++YYCURSOR; YYDEBUG(46, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1763 "Zend/zend_language_scanner.l" +#line 1705 "Zend/zend_language_scanner.l" { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG_WITH_ECHO; } -#line 1474 "Zend/zend_language_scanner.c" +#line 1455 "Zend/zend_language_scanner.c" yy47: YYDEBUG(47, *YYCURSOR); yych = *++YYCURSOR; @@ -1497,16 +1478,14 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy51: YYDEBUG(51, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1785 "Zend/zend_language_scanner.l" +#line 1723 "Zend/zend_language_scanner.l" { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */ HANDLE_NEWLINE(yytext[yyleng-1]); BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } -#line 1510 "Zend/zend_language_scanner.c" +#line 1489 "Zend/zend_language_scanner.c" yy52: YYDEBUG(52, *YYCURSOR); ++YYCURSOR; @@ -1577,7 +1556,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy56: YYDEBUG(56, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2258 "Zend/zend_language_scanner.l" +#line 2186 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -1618,7 +1597,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) zend_scan_escape_string(zendlval, yytext, yyleng, '`' TSRMLS_CC); return T_ENCAPSED_AND_WHITESPACE; } -#line 1622 "Zend/zend_language_scanner.c" +#line 1601 "Zend/zend_language_scanner.c" yy57: YYDEBUG(57, *YYCURSOR); yych = *++YYCURSOR; @@ -1629,12 +1608,12 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(59, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2202 "Zend/zend_language_scanner.l" +#line 2130 "Zend/zend_language_scanner.l" { BEGIN(ST_IN_SCRIPTING); return '`'; } -#line 1638 "Zend/zend_language_scanner.c" +#line 1617 "Zend/zend_language_scanner.c" yy60: YYDEBUG(60, *YYCURSOR); yych = *++YYCURSOR; @@ -1644,14 +1623,14 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(62, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2189 "Zend/zend_language_scanner.l" +#line 2117 "Zend/zend_language_scanner.l" { - zendlval->value.lval = (long) '{'; + Z_LVAL_P(zendlval) = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); yyless(1); return T_CURLY_OPEN; } -#line 1655 "Zend/zend_language_scanner.c" +#line 1634 "Zend/zend_language_scanner.c" yy63: YYDEBUG(63, *YYCURSOR); yyaccept = 0; @@ -1667,24 +1646,24 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy65: YYDEBUG(65, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1889 "Zend/zend_language_scanner.l" +#line 1823 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; return T_VARIABLE; } -#line 1677 "Zend/zend_language_scanner.c" +#line 1656 "Zend/zend_language_scanner.c" yy66: YYDEBUG(66, *YYCURSOR); ++YYCURSOR; YYDEBUG(67, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1465 "Zend/zend_language_scanner.l" +#line 1457 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); return T_DOLLAR_OPEN_CURLY_BRACES; } -#line 1688 "Zend/zend_language_scanner.c" +#line 1667 "Zend/zend_language_scanner.c" yy68: YYDEBUG(68, *YYCURSOR); yych = *++YYCURSOR; @@ -1698,7 +1677,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(71, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1881 "Zend/zend_language_scanner.l" +#line 1815 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); @@ -1706,7 +1685,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) zendlval->type = IS_STRING; return T_VARIABLE; } -#line 1710 "Zend/zend_language_scanner.c" +#line 1689 "Zend/zend_language_scanner.c" yy72: YYDEBUG(72, *YYCURSOR); yych = *++YYCURSOR; @@ -1724,7 +1703,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(74, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1871 "Zend/zend_language_scanner.l" +#line 1805 "Zend/zend_language_scanner.l" { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); @@ -1732,7 +1711,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) zendlval->type = IS_STRING; return T_VARIABLE; } -#line 1736 "Zend/zend_language_scanner.c" +#line 1715 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_DOUBLE_QUOTES: @@ -1800,7 +1779,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy78: YYDEBUG(78, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2208 "Zend/zend_language_scanner.l" +#line 2136 "Zend/zend_language_scanner.l" { if (GET_DOUBLE_QUOTES_SCANNED_LENGTH()) { YYCURSOR += GET_DOUBLE_QUOTES_SCANNED_LENGTH() - 1; @@ -1849,7 +1828,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) zend_scan_escape_string(zendlval, yytext, yyleng, '"' TSRMLS_CC); return T_ENCAPSED_AND_WHITESPACE; } -#line 1853 "Zend/zend_language_scanner.c" +#line 1832 "Zend/zend_language_scanner.c" yy79: YYDEBUG(79, *YYCURSOR); yych = *++YYCURSOR; @@ -1860,12 +1839,12 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(81, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2197 "Zend/zend_language_scanner.l" +#line 2125 "Zend/zend_language_scanner.l" { BEGIN(ST_IN_SCRIPTING); return '"'; } -#line 1869 "Zend/zend_language_scanner.c" +#line 1848 "Zend/zend_language_scanner.c" yy82: YYDEBUG(82, *YYCURSOR); yych = *++YYCURSOR; @@ -1875,14 +1854,14 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(84, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2189 "Zend/zend_language_scanner.l" +#line 2117 "Zend/zend_language_scanner.l" { - zendlval->value.lval = (long) '{'; + Z_LVAL_P(zendlval) = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); yyless(1); return T_CURLY_OPEN; } -#line 1886 "Zend/zend_language_scanner.c" +#line 1865 "Zend/zend_language_scanner.c" yy85: YYDEBUG(85, *YYCURSOR); yyaccept = 0; @@ -1898,24 +1877,24 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy87: YYDEBUG(87, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1889 "Zend/zend_language_scanner.l" +#line 1823 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; return T_VARIABLE; } -#line 1908 "Zend/zend_language_scanner.c" +#line 1887 "Zend/zend_language_scanner.c" yy88: YYDEBUG(88, *YYCURSOR); ++YYCURSOR; YYDEBUG(89, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1465 "Zend/zend_language_scanner.l" +#line 1457 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); return T_DOLLAR_OPEN_CURLY_BRACES; } -#line 1919 "Zend/zend_language_scanner.c" +#line 1898 "Zend/zend_language_scanner.c" yy90: YYDEBUG(90, *YYCURSOR); yych = *++YYCURSOR; @@ -1929,7 +1908,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(93, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1881 "Zend/zend_language_scanner.l" +#line 1815 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); @@ -1937,7 +1916,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) zendlval->type = IS_STRING; return T_VARIABLE; } -#line 1941 "Zend/zend_language_scanner.c" +#line 1920 "Zend/zend_language_scanner.c" yy94: YYDEBUG(94, *YYCURSOR); yych = *++YYCURSOR; @@ -1955,7 +1934,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(96, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1871 "Zend/zend_language_scanner.l" +#line 1805 "Zend/zend_language_scanner.l" { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); @@ -1963,7 +1942,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) zendlval->type = IS_STRING; return T_VARIABLE; } -#line 1967 "Zend/zend_language_scanner.c" +#line 1946 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_END_HEREDOC: @@ -1974,7 +1953,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(100, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2175 "Zend/zend_language_scanner.l" +#line 2103 "Zend/zend_language_scanner.l" { zend_heredoc_label *heredoc_label = zend_ptr_stack_pop(&SCNG(heredoc_label_stack)); @@ -1987,7 +1966,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) BEGIN(ST_IN_SCRIPTING); return T_END_HEREDOC; } -#line 1991 "Zend/zend_language_scanner.c" +#line 1970 "Zend/zend_language_scanner.c" /* *********************************** */ yyc_ST_HEREDOC: { @@ -2049,7 +2028,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy104: YYDEBUG(104, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2300 "Zend/zend_language_scanner.l" +#line 2228 "Zend/zend_language_scanner.l" { int newline = 0; @@ -2122,7 +2101,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) zend_scan_escape_string(zendlval, yytext, yyleng - newline, 0 TSRMLS_CC); return T_ENCAPSED_AND_WHITESPACE; } -#line 2126 "Zend/zend_language_scanner.c" +#line 2105 "Zend/zend_language_scanner.c" yy105: YYDEBUG(105, *YYCURSOR); yych = *++YYCURSOR; @@ -2137,14 +2116,14 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(108, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2189 "Zend/zend_language_scanner.l" +#line 2117 "Zend/zend_language_scanner.l" { - zendlval->value.lval = (long) '{'; + Z_LVAL_P(zendlval) = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); yyless(1); return T_CURLY_OPEN; } -#line 2148 "Zend/zend_language_scanner.c" +#line 2127 "Zend/zend_language_scanner.c" yy109: YYDEBUG(109, *YYCURSOR); yyaccept = 0; @@ -2160,24 +2139,24 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy111: YYDEBUG(111, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1889 "Zend/zend_language_scanner.l" +#line 1823 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; return T_VARIABLE; } -#line 2170 "Zend/zend_language_scanner.c" +#line 2149 "Zend/zend_language_scanner.c" yy112: YYDEBUG(112, *YYCURSOR); ++YYCURSOR; YYDEBUG(113, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1465 "Zend/zend_language_scanner.l" +#line 1457 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); return T_DOLLAR_OPEN_CURLY_BRACES; } -#line 2181 "Zend/zend_language_scanner.c" +#line 2160 "Zend/zend_language_scanner.c" yy114: YYDEBUG(114, *YYCURSOR); yych = *++YYCURSOR; @@ -2191,7 +2170,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(117, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1881 "Zend/zend_language_scanner.l" +#line 1815 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); @@ -2199,7 +2178,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) zendlval->type = IS_STRING; return T_VARIABLE; } -#line 2203 "Zend/zend_language_scanner.c" +#line 2182 "Zend/zend_language_scanner.c" yy118: YYDEBUG(118, *YYCURSOR); yych = *++YYCURSOR; @@ -2217,7 +2196,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(120, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1871 "Zend/zend_language_scanner.l" +#line 1805 "Zend/zend_language_scanner.l" { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); @@ -2225,7 +2204,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) zendlval->type = IS_STRING; return T_VARIABLE; } -#line 2229 "Zend/zend_language_scanner.c" +#line 2208 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_IN_SCRIPTING: @@ -2302,14 +2281,14 @@ int lex_scan(zval *zendlval TSRMLS_DC) case '\n': case '\r': case ' ': goto yy140; - case '!': goto yy153; + case '!': goto yy154; case '"': goto yy180; case '#': goto yy176; case '$': goto yy165; case '%': goto yy159; case '&': goto yy160; case '\'': goto yy178; - case '(': goto yy147; + case '(': goto yy148; case ')': case ',': case ';': @@ -2317,11 +2296,11 @@ int lex_scan(zval *zendlval TSRMLS_DC) case '[': case ']': case '~': goto yy166; - case '*': goto yy156; - case '+': goto yy152; + case '*': goto yy157; + case '+': goto yy153; case '-': goto yy138; - case '.': goto yy158; - case '/': goto yy157; + case '.': goto yy145; + case '/': goto yy158; case '0': goto yy172; case '1': case '2': @@ -2333,9 +2312,9 @@ int lex_scan(zval *zendlval TSRMLS_DC) case '8': case '9': goto yy174; case ':': goto yy142; - case '<': goto yy154; - case '=': goto yy150; - case '>': goto yy155; + case '<': goto yy155; + case '=': goto yy151; + case '>': goto yy156; case '?': goto yy167; case 'A': case 'a': goto yy133; @@ -2354,9 +2333,9 @@ int lex_scan(zval *zendlval TSRMLS_DC) case 'I': case 'i': goto yy131; case 'L': - case 'l': goto yy151; + case 'l': goto yy152; case 'N': - case 'n': goto yy145; + case 'n': goto yy146; case 'O': case 'o': goto yy163; case 'P': @@ -2368,9 +2347,9 @@ int lex_scan(zval *zendlval TSRMLS_DC) case 'T': case 't': goto yy130; case 'U': - case 'u': goto yy148; + case 'u': goto yy149; case 'V': - case 'v': goto yy146; + case 'v': goto yy147; case 'W': case 'w': goto yy132; case 'X': @@ -2379,7 +2358,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) case 'y': goto yy129; case '\\': goto yy143; case '^': goto yy162; - case '_': goto yy149; + case '_': goto yy150; case '`': goto yy182; case '{': goto yy168; case '|': goto yy161; @@ -2392,48 +2371,48 @@ int lex_scan(zval *zendlval TSRMLS_DC) YYDEBUG(-1, yych); switch ((yych = *YYCURSOR)) { case 'C': - case 'c': goto yy735; + case 'c': goto yy738; case 'L': - case 'l': goto yy736; + case 'l': goto yy739; case 'M': - case 'm': goto yy737; + case 'm': goto yy740; case 'N': - case 'n': goto yy738; + case 'n': goto yy741; case 'V': - case 'v': goto yy739; + case 'v': goto yy742; case 'X': - case 'x': goto yy740; + case 'x': goto yy743; default: goto yy187; } yy124: YYDEBUG(124, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1912 "Zend/zend_language_scanner.l" +#line 1846 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, yytext, yyleng); zendlval->type = IS_STRING; return T_STRING; } -#line 2418 "Zend/zend_language_scanner.c" +#line 2397 "Zend/zend_language_scanner.c" yy125: YYDEBUG(125, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'O') { if (yych <= 'H') { - if (yych == 'E') goto yy717; + if (yych == 'E') goto yy720; goto yy187; } else { - if (yych <= 'I') goto yy718; + if (yych <= 'I') goto yy721; if (yych <= 'N') goto yy187; - goto yy719; + goto yy722; } } else { if (yych <= 'h') { - if (yych == 'e') goto yy717; + if (yych == 'e') goto yy720; goto yy187; } else { - if (yych <= 'i') goto yy718; - if (yych == 'o') goto yy719; + if (yych <= 'i') goto yy721; + if (yych == 'o') goto yy722; goto yy187; } } @@ -2442,20 +2421,20 @@ int lex_scan(zval *zendlval TSRMLS_DC) yych = *++YYCURSOR; if (yych <= 'U') { if (yych <= 'N') { - if (yych == 'I') goto yy693; + if (yych == 'I') goto yy696; goto yy187; } else { - if (yych <= 'O') goto yy694; + if (yych <= 'O') goto yy697; if (yych <= 'T') goto yy187; - goto yy695; + goto yy698; } } else { if (yych <= 'n') { - if (yych == 'i') goto yy693; + if (yych == 'i') goto yy696; goto yy187; } else { - if (yych <= 'o') goto yy694; - if (yych == 'u') goto yy695; + if (yych <= 'o') goto yy697; + if (yych == 'u') goto yy698; goto yy187; } } @@ -2464,48 +2443,48 @@ int lex_scan(zval *zendlval TSRMLS_DC) yych = *++YYCURSOR; if (yych <= 'O') { if (yych <= 'K') { - if (yych == 'A') goto yy658; + if (yych == 'A') goto yy661; goto yy187; } else { - if (yych <= 'L') goto yy659; + if (yych <= 'L') goto yy662; if (yych <= 'N') goto yy187; - goto yy660; + goto yy663; } } else { if (yych <= 'k') { - if (yych == 'a') goto yy658; + if (yych == 'a') goto yy661; goto yy187; } else { - if (yych <= 'l') goto yy659; - if (yych == 'o') goto yy660; + if (yych <= 'l') goto yy662; + if (yych == 'o') goto yy663; goto yy187; } } yy128: YYDEBUG(128, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy640; - if (yych == 'e') goto yy640; + if (yych == 'E') goto yy643; + if (yych == 'e') goto yy643; goto yy187; yy129: YYDEBUG(129, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy635; - if (yych == 'i') goto yy635; + if (yych == 'I') goto yy638; + if (yych == 'i') goto yy638; goto yy187; yy130: YYDEBUG(130, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'R') { - if (yych == 'H') goto yy623; + if (yych == 'H') goto yy626; if (yych <= 'Q') goto yy187; - goto yy624; + goto yy627; } else { if (yych <= 'h') { if (yych <= 'g') goto yy187; - goto yy623; + goto yy626; } else { - if (yych == 'r') goto yy624; + if (yych == 'r') goto yy627; goto yy187; } } @@ -2514,53 +2493,53 @@ int lex_scan(zval *zendlval TSRMLS_DC) yych = *++YYCURSOR; if (yych <= 'S') { if (yych <= 'L') { - if (yych == 'F') goto yy570; + if (yych == 'F') goto yy573; goto yy187; } else { - if (yych <= 'M') goto yy572; - if (yych <= 'N') goto yy573; + if (yych <= 'M') goto yy575; + if (yych <= 'N') goto yy576; if (yych <= 'R') goto yy187; - goto yy574; + goto yy577; } } else { if (yych <= 'm') { - if (yych == 'f') goto yy570; + if (yych == 'f') goto yy573; if (yych <= 'l') goto yy187; - goto yy572; + goto yy575; } else { - if (yych <= 'n') goto yy573; - if (yych == 's') goto yy574; + if (yych <= 'n') goto yy576; + if (yych == 's') goto yy577; goto yy187; } } yy132: YYDEBUG(132, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'H') goto yy565; - if (yych == 'h') goto yy565; + if (yych == 'H') goto yy568; + if (yych == 'h') goto yy568; goto yy187; yy133: YYDEBUG(133, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'S') { if (yych <= 'M') { - if (yych == 'B') goto yy547; + if (yych == 'B') goto yy550; goto yy187; } else { - if (yych <= 'N') goto yy548; + if (yych <= 'N') goto yy551; if (yych <= 'Q') goto yy187; - if (yych <= 'R') goto yy549; - goto yy550; + if (yych <= 'R') goto yy552; + goto yy553; } } else { if (yych <= 'n') { - if (yych == 'b') goto yy547; + if (yych == 'b') goto yy550; if (yych <= 'm') goto yy187; - goto yy548; + goto yy551; } else { if (yych <= 'q') goto yy187; - if (yych <= 'r') goto yy549; - if (yych <= 's') goto yy550; + if (yych <= 'r') goto yy552; + if (yych <= 's') goto yy553; goto yy187; } } @@ -2568,15 +2547,15 @@ int lex_scan(zval *zendlval TSRMLS_DC) YYDEBUG(134, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'W') { - if (yych == 'T') goto yy535; + if (yych == 'T') goto yy538; if (yych <= 'V') goto yy187; - goto yy536; + goto yy539; } else { if (yych <= 't') { if (yych <= 's') goto yy187; - goto yy535; + goto yy538; } else { - if (yych == 'w') goto yy536; + if (yych == 'w') goto yy539; goto yy187; } } @@ -2587,18 +2566,18 @@ int lex_scan(zval *zendlval TSRMLS_DC) if (yych <= ';') { if (yych <= '"') { if (yych <= '!') goto yy187; - goto yy527; + goto yy530; } else { - if (yych == '\'') goto yy528; + if (yych == '\'') goto yy531; goto yy187; } } else { if (yych <= 'R') { - if (yych <= '<') goto yy526; + if (yych <= '<') goto yy529; if (yych <= 'Q') goto yy187; - goto yy529; + goto yy532; } else { - if (yych == 'r') goto yy529; + if (yych == 'r') goto yy532; goto yy187; } } @@ -2606,15 +2585,15 @@ int lex_scan(zval *zendlval TSRMLS_DC) YYDEBUG(136, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'O') { - if (yych == 'L') goto yy516; + if (yych == 'L') goto yy519; if (yych <= 'N') goto yy187; - goto yy517; + goto yy520; } else { if (yych <= 'l') { if (yych <= 'k') goto yy187; - goto yy516; + goto yy519; } else { - if (yych == 'o') goto yy517; + if (yych == 'o') goto yy520; goto yy187; } } @@ -2622,15 +2601,15 @@ int lex_scan(zval *zendlval TSRMLS_DC) YYDEBUG(137, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'U') { - if (yych == 'R') goto yy492; + if (yych == 'R') goto yy495; if (yych <= 'T') goto yy187; - goto yy493; + goto yy496; } else { if (yych <= 'r') { if (yych <= 'q') goto yy187; - goto yy492; + goto yy495; } else { - if (yych == 'u') goto yy493; + if (yych == 'u') goto yy496; goto yy187; } } @@ -2638,214 +2617,217 @@ int lex_scan(zval *zendlval TSRMLS_DC) YYDEBUG(138, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) <= '<') { - if (yych == '-') goto yy488; + if (yych == '-') goto yy491; } else { - if (yych <= '=') goto yy486; - if (yych <= '>') goto yy490; + if (yych <= '=') goto yy489; + if (yych <= '>') goto yy493; } yy139: YYDEBUG(139, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1454 "Zend/zend_language_scanner.l" +#line 1446 "Zend/zend_language_scanner.l" { return yytext[0]; } -#line 2654 "Zend/zend_language_scanner.c" +#line 2633 "Zend/zend_language_scanner.c" yy140: YYDEBUG(140, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy485; + goto yy488; yy141: YYDEBUG(141, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1185 "Zend/zend_language_scanner.l" +#line 1175 "Zend/zend_language_scanner.l" { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */ HANDLE_NEWLINES(yytext, yyleng); return T_WHITESPACE; } -#line 2671 "Zend/zend_language_scanner.c" +#line 2648 "Zend/zend_language_scanner.c" yy142: YYDEBUG(142, *YYCURSOR); yych = *++YYCURSOR; - if (yych == ':') goto yy482; + if (yych == ':') goto yy485; goto yy139; yy143: YYDEBUG(143, *YYCURSOR); ++YYCURSOR; YYDEBUG(144, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1214 "Zend/zend_language_scanner.l" +#line 1202 "Zend/zend_language_scanner.l" { return T_NS_SEPARATOR; } -#line 2686 "Zend/zend_language_scanner.c" +#line 2663 "Zend/zend_language_scanner.c" yy145: YYDEBUG(145, *YYCURSOR); + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') { + if (yych == '.') goto yy482; + goto yy139; + } else { + if (yych <= '9') goto yy478; + if (yych == '=') goto yy480; + goto yy139; + } +yy146: + YYDEBUG(146, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'E') { - if (yych == 'A') goto yy470; + if (yych == 'A') goto yy466; if (yych <= 'D') goto yy187; - goto yy471; + goto yy467; } else { if (yych <= 'a') { if (yych <= '`') goto yy187; - goto yy470; + goto yy466; } else { - if (yych == 'e') goto yy471; + if (yych == 'e') goto yy467; goto yy187; } } -yy146: - YYDEBUG(146, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy467; - if (yych == 'a') goto yy467; - goto yy187; yy147: YYDEBUG(147, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy463; + if (yych == 'a') goto yy463; + goto yy187; +yy148: + YYDEBUG(148, *YYCURSOR); yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); if (yych <= 'S') { if (yych <= 'D') { if (yych <= ' ') { - if (yych == '\t') goto yy392; + if (yych == '\t') goto yy388; if (yych <= 0x1F) goto yy139; - goto yy392; + goto yy388; } else { if (yych <= '@') goto yy139; if (yych == 'C') goto yy139; - goto yy392; + goto yy388; } } else { if (yych <= 'I') { - if (yych == 'F') goto yy392; + if (yych == 'F') goto yy388; if (yych <= 'H') goto yy139; - goto yy392; + goto yy388; } else { - if (yych == 'O') goto yy392; + if (yych == 'O') goto yy388; if (yych <= 'Q') goto yy139; - goto yy392; + goto yy388; } } } else { if (yych <= 'f') { if (yych <= 'b') { - if (yych == 'U') goto yy392; + if (yych == 'U') goto yy388; if (yych <= '`') goto yy139; - goto yy392; + goto yy388; } else { - if (yych == 'd') goto yy392; + if (yych == 'd') goto yy388; if (yych <= 'e') goto yy139; - goto yy392; + goto yy388; } } else { if (yych <= 'o') { - if (yych == 'i') goto yy392; + if (yych == 'i') goto yy388; if (yych <= 'n') goto yy139; - goto yy392; + goto yy388; } else { if (yych <= 's') { if (yych <= 'q') goto yy139; - goto yy392; + goto yy388; } else { - if (yych == 'u') goto yy392; + if (yych == 'u') goto yy388; goto yy139; } } } } -yy148: - YYDEBUG(148, *YYCURSOR); +yy149: + YYDEBUG(149, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'S') { - if (yych == 'N') goto yy383; + if (yych == 'N') goto yy379; if (yych <= 'R') goto yy187; - goto yy384; + goto yy380; } else { if (yych <= 'n') { if (yych <= 'm') goto yy187; - goto yy383; + goto yy379; } else { - if (yych == 's') goto yy384; + if (yych == 's') goto yy380; goto yy187; } } -yy149: - YYDEBUG(149, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '_') goto yy301; - goto yy187; yy150: YYDEBUG(150, *YYCURSOR); yych = *++YYCURSOR; - if (yych <= '<') goto yy139; - if (yych <= '=') goto yy295; - if (yych <= '>') goto yy297; - goto yy139; + if (yych == '_') goto yy297; + goto yy187; yy151: YYDEBUG(151, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy291; - if (yych == 'i') goto yy291; - goto yy187; + if (yych <= '<') goto yy139; + if (yych <= '=') goto yy291; + if (yych <= '>') goto yy293; + goto yy139; yy152: YYDEBUG(152, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '+') goto yy289; - if (yych == '=') goto yy287; - goto yy139; + if (yych == 'I') goto yy287; + if (yych == 'i') goto yy287; + goto yy187; yy153: YYDEBUG(153, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '=') goto yy284; + if (yych == '+') goto yy285; + if (yych == '=') goto yy283; goto yy139; yy154: YYDEBUG(154, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '=') goto yy280; + goto yy139; +yy155: + YYDEBUG(155, *YYCURSOR); yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); if (yych <= ';') { - if (yych == '/') goto yy256; + if (yych == '/') goto yy252; goto yy139; } else { - if (yych <= '<') goto yy254; - if (yych <= '=') goto yy257; - if (yych <= '>') goto yy259; + if (yych <= '<') goto yy250; + if (yych <= '=') goto yy253; + if (yych <= '>') goto yy255; goto yy139; } -yy155: - YYDEBUG(155, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= '<') goto yy139; - if (yych <= '=') goto yy250; - if (yych <= '>') goto yy248; - goto yy139; yy156: YYDEBUG(156, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '=') goto yy246; + if (yych <= '<') goto yy139; + if (yych <= '=') goto yy246; + if (yych <= '>') goto yy244; goto yy139; yy157: YYDEBUG(157, *YYCURSOR); yych = *++YYCURSOR; + if (yych == '=') goto yy242; + goto yy139; +yy158: + YYDEBUG(158, *YYCURSOR); + yych = *++YYCURSOR; if (yych <= '.') { - if (yych == '*') goto yy238; + if (yych == '*') goto yy234; goto yy139; } else { - if (yych <= '/') goto yy240; - if (yych == '=') goto yy241; + if (yych <= '/') goto yy236; + if (yych == '=') goto yy237; goto yy139; } -yy158: - YYDEBUG(158, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= '/') goto yy139; - if (yych <= '9') goto yy234; - if (yych == '=') goto yy236; - goto yy139; yy159: YYDEBUG(159, *YYCURSOR); yych = *++YYCURSOR; @@ -2910,18 +2892,18 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(169, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1459 "Zend/zend_language_scanner.l" +#line 1451 "Zend/zend_language_scanner.l" { yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); return '{'; } -#line 2919 "Zend/zend_language_scanner.c" +#line 2901 "Zend/zend_language_scanner.c" yy170: YYDEBUG(170, *YYCURSOR); ++YYCURSOR; YYDEBUG(171, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1471 "Zend/zend_language_scanner.l" +#line 1463 "Zend/zend_language_scanner.l" { RESET_DOC_COMMENT(); if (!zend_stack_is_empty(&SCNG(state_stack))) { @@ -2929,7 +2911,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } return '}'; } -#line 2933 "Zend/zend_language_scanner.c" +#line 2915 "Zend/zend_language_scanner.c" yy172: YYDEBUG(172, *YYCURSOR); yyaccept = 2; @@ -2957,18 +2939,18 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy173: YYDEBUG(173, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1522 "Zend/zend_language_scanner.l" +#line 1513 "Zend/zend_language_scanner.l" { if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */ - zendlval->value.lval = strtol(yytext, NULL, 0); + Z_LVAL_P(zendlval) = strtol(yytext, NULL, 0); } else { errno = 0; - zendlval->value.lval = strtol(yytext, NULL, 0); + Z_LVAL_P(zendlval) = strtol(yytext, NULL, 0); if (errno == ERANGE) { /* Overflow */ if (yytext[0] == '0') { /* octal overflow */ - zendlval->value.dval = zend_oct_strtod(yytext, NULL); + Z_DVAL_P(zendlval) = zend_oct_strtod(yytext, NULL); } else { - zendlval->value.dval = zend_strtod(yytext, NULL); + Z_DVAL_P(zendlval) = zend_strtod(yytext, NULL); } zendlval->type = IS_DOUBLE; return T_DNUMBER; @@ -2978,7 +2960,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) zendlval->type = IS_LONG; return T_LNUMBER; } -#line 2982 "Zend/zend_language_scanner.c" +#line 2964 "Zend/zend_language_scanner.c" yy174: YYDEBUG(174, *YYCURSOR); yyaccept = 2; @@ -3006,7 +2988,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy177: YYDEBUG(177, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1919 "Zend/zend_language_scanner.l" +#line 1853 "Zend/zend_language_scanner.l" { while (YYCURSOR < YYLIMIT) { switch (*YYCURSOR++) { @@ -3040,14 +3022,14 @@ int lex_scan(zval *zendlval TSRMLS_DC) return T_COMMENT; } -#line 3044 "Zend/zend_language_scanner.c" +#line 3026 "Zend/zend_language_scanner.c" yy178: YYDEBUG(178, *YYCURSOR); ++YYCURSOR; yy179: YYDEBUG(179, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2010 "Zend/zend_language_scanner.l" +#line 1940 "Zend/zend_language_scanner.l" { register char *s, *t; char *end; @@ -3073,13 +3055,11 @@ int lex_scan(zval *zendlval TSRMLS_DC) } } - zendlval->value.str.val = estrndup(yytext+bprefix+1, yyleng-bprefix-2); - zendlval->value.str.len = yyleng-bprefix-2; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext+bprefix+1, yyleng-bprefix-2, 1); /* convert escape sequences */ - s = t = zendlval->value.str.val; - end = s+zendlval->value.str.len; + s = t = Z_STRVAL_P(zendlval); + end = s+Z_STRLEN_P(zendlval); while (svalue.str.len--; + Z_STRLEN_P(zendlval)--; break; default: *t++ = '\\'; @@ -3108,21 +3088,21 @@ int lex_scan(zval *zendlval TSRMLS_DC) if (SCNG(output_filter)) { size_t sz = 0; - s = zendlval->value.str.val; - SCNG(output_filter)((unsigned char **)&(zendlval->value.str.val), &sz, (unsigned char *)s, (size_t)zendlval->value.str.len TSRMLS_CC); - zendlval->value.str.len = sz; + s = Z_STRVAL_P(zendlval); + SCNG(output_filter)((unsigned char **)&Z_STRVAL_P(zendlval), &sz, (unsigned char *)s, (size_t)Z_STRLEN_P(zendlval) TSRMLS_CC); + Z_STRLEN_P(zendlval) = sz; efree(s); } return T_CONSTANT_ENCAPSED_STRING; } -#line 3119 "Zend/zend_language_scanner.c" +#line 3099 "Zend/zend_language_scanner.c" yy180: YYDEBUG(180, *YYCURSOR); ++YYCURSOR; yy181: YYDEBUG(181, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2079 "Zend/zend_language_scanner.l" +#line 2007 "Zend/zend_language_scanner.l" { int bprefix = (yytext[0] != '"') ? 1 : 0; @@ -3163,24 +3143,24 @@ int lex_scan(zval *zendlval TSRMLS_DC) BEGIN(ST_DOUBLE_QUOTES); return '"'; } -#line 3167 "Zend/zend_language_scanner.c" +#line 3147 "Zend/zend_language_scanner.c" yy182: YYDEBUG(182, *YYCURSOR); ++YYCURSOR; YYDEBUG(183, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2169 "Zend/zend_language_scanner.l" +#line 2097 "Zend/zend_language_scanner.l" { BEGIN(ST_BACKQUOTE); return '`'; } -#line 3178 "Zend/zend_language_scanner.c" +#line 3158 "Zend/zend_language_scanner.c" yy184: YYDEBUG(184, *YYCURSOR); ++YYCURSOR; YYDEBUG(185, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2432 "Zend/zend_language_scanner.l" +#line 2360 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -3189,7 +3169,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE); goto restart; } -#line 3193 "Zend/zend_language_scanner.c" +#line 3173 "Zend/zend_language_scanner.c" yy186: YYDEBUG(186, *YYCURSOR); ++YYCURSOR; @@ -3216,13 +3196,12 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy190: YYDEBUG(190, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1587 "Zend/zend_language_scanner.l" +#line 1572 "Zend/zend_language_scanner.l" { - zendlval->value.dval = zend_strtod(yytext, NULL); - zendlval->type = IS_DOUBLE; + ZVAL_DOUBLE(zendlval, zend_strtod(yytext, NULL)); return T_DNUMBER; } -#line 3226 "Zend/zend_language_scanner.c" +#line 3205 "Zend/zend_language_scanner.c" yy191: YYDEBUG(191, *YYCURSOR); yyaccept = 2; @@ -3269,10 +3248,10 @@ int lex_scan(zval *zendlval TSRMLS_DC) if (yyaccept <= 3) { goto yy190; } else { - goto yy239; + goto yy235; } } else { - goto yy255; + goto yy251; } } yy195: @@ -3314,7 +3293,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(202, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1497 "Zend/zend_language_scanner.l" +#line 1489 "Zend/zend_language_scanner.l" { char *bin = yytext + 2; /* Skip "0b" */ int len = yyleng - 2; @@ -3327,19 +3306,18 @@ int lex_scan(zval *zendlval TSRMLS_DC) if (len < SIZEOF_LONG * 8) { if (len == 0) { - zendlval->value.lval = 0; + Z_LVAL_P(zendlval) = 0; } else { - zendlval->value.lval = strtol(bin, NULL, 2); + Z_LVAL_P(zendlval) = strtol(bin, NULL, 2); } zendlval->type = IS_LONG; return T_LNUMBER; } else { - zendlval->value.dval = zend_bin_strtod(bin, NULL); - zendlval->type = IS_DOUBLE; + ZVAL_DOUBLE(zendlval, zend_bin_strtod(bin, NULL)); return T_DNUMBER; } } -#line 3343 "Zend/zend_language_scanner.c" +#line 3321 "Zend/zend_language_scanner.c" yy203: YYDEBUG(203, *YYCURSOR); ++YYCURSOR; @@ -3351,7 +3329,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(205, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1543 "Zend/zend_language_scanner.l" +#line 1534 "Zend/zend_language_scanner.l" { char *hex = yytext + 2; /* Skip "0x" */ int len = yyleng - 2; @@ -3364,19 +3342,18 @@ int lex_scan(zval *zendlval TSRMLS_DC) if (len < SIZEOF_LONG * 2 || (len == SIZEOF_LONG * 2 && *hex <= '7')) { if (len == 0) { - zendlval->value.lval = 0; + Z_LVAL_P(zendlval) = 0; } else { - zendlval->value.lval = strtol(hex, NULL, 16); + Z_LVAL_P(zendlval) = strtol(hex, NULL, 16); } zendlval->type = IS_LONG; return T_LNUMBER; } else { - zendlval->value.dval = zend_hex_strtod(hex, NULL); - zendlval->type = IS_DOUBLE; + ZVAL_DOUBLE(zendlval, zend_hex_strtod(hex, NULL)); return T_DNUMBER; } } -#line 3380 "Zend/zend_language_scanner.c" +#line 3357 "Zend/zend_language_scanner.c" yy206: YYDEBUG(206, *YYCURSOR); ++YYCURSOR; @@ -3385,15 +3362,13 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy207: YYDEBUG(207, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1987 "Zend/zend_language_scanner.l" +#line 1921 "Zend/zend_language_scanner.l" { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */ BEGIN(INITIAL); return T_CLOSE_TAG; /* implicit ';' at php-end tag */ } -#line 3397 "Zend/zend_language_scanner.c" +#line 3372 "Zend/zend_language_scanner.c" yy208: YYDEBUG(208, *YYCURSOR); yych = *++YYCURSOR; @@ -3427,13 +3402,13 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy212: YYDEBUG(212, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1889 "Zend/zend_language_scanner.l" +#line 1823 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; return T_VARIABLE; } -#line 3437 "Zend/zend_language_scanner.c" +#line 3412 "Zend/zend_language_scanner.c" yy213: YYDEBUG(213, *YYCURSOR); yych = *++YYCURSOR; @@ -3447,11 +3422,11 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(215, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1442 "Zend/zend_language_scanner.l" +#line 1434 "Zend/zend_language_scanner.l" { return T_LOGICAL_XOR; } -#line 3455 "Zend/zend_language_scanner.c" +#line 3430 "Zend/zend_language_scanner.c" yy216: YYDEBUG(216, *YYCURSOR); ++YYCURSOR; @@ -3460,61 +3435,61 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(217, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1434 "Zend/zend_language_scanner.l" +#line 1426 "Zend/zend_language_scanner.l" { return T_LOGICAL_OR; } -#line 3468 "Zend/zend_language_scanner.c" +#line 3443 "Zend/zend_language_scanner.c" yy218: YYDEBUG(218, *YYCURSOR); ++YYCURSOR; YYDEBUG(219, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1422 "Zend/zend_language_scanner.l" +#line 1414 "Zend/zend_language_scanner.l" { return T_XOR_EQUAL; } -#line 3478 "Zend/zend_language_scanner.c" +#line 3453 "Zend/zend_language_scanner.c" yy220: YYDEBUG(220, *YYCURSOR); ++YYCURSOR; YYDEBUG(221, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1426 "Zend/zend_language_scanner.l" +#line 1418 "Zend/zend_language_scanner.l" { return T_BOOLEAN_OR; } -#line 3488 "Zend/zend_language_scanner.c" +#line 3463 "Zend/zend_language_scanner.c" yy222: YYDEBUG(222, *YYCURSOR); ++YYCURSOR; YYDEBUG(223, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1418 "Zend/zend_language_scanner.l" +#line 1410 "Zend/zend_language_scanner.l" { return T_OR_EQUAL; } -#line 3498 "Zend/zend_language_scanner.c" +#line 3473 "Zend/zend_language_scanner.c" yy224: YYDEBUG(224, *YYCURSOR); ++YYCURSOR; YYDEBUG(225, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1430 "Zend/zend_language_scanner.l" +#line 1422 "Zend/zend_language_scanner.l" { return T_BOOLEAN_AND; } -#line 3508 "Zend/zend_language_scanner.c" +#line 3483 "Zend/zend_language_scanner.c" yy226: YYDEBUG(226, *YYCURSOR); ++YYCURSOR; YYDEBUG(227, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1414 "Zend/zend_language_scanner.l" +#line 1406 "Zend/zend_language_scanner.l" { return T_AND_EQUAL; } -#line 3518 "Zend/zend_language_scanner.c" +#line 3493 "Zend/zend_language_scanner.c" yy228: YYDEBUG(228, *YYCURSOR); ++YYCURSOR; @@ -3523,30 +3498,28 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy229: YYDEBUG(229, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1996 "Zend/zend_language_scanner.l" +#line 1928 "Zend/zend_language_scanner.l" { if (CG(asp_tags)) { BEGIN(INITIAL); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - zendlval->value.str.val = yytext; /* no copying - intentional */ + ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */ return T_CLOSE_TAG; /* implicit ';' at php-end tag */ } else { yyless(1); return yytext[0]; } } -#line 3540 "Zend/zend_language_scanner.c" +#line 3513 "Zend/zend_language_scanner.c" yy230: YYDEBUG(230, *YYCURSOR); ++YYCURSOR; YYDEBUG(231, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1402 "Zend/zend_language_scanner.l" +#line 1394 "Zend/zend_language_scanner.l" { return T_MOD_EQUAL; } -#line 3550 "Zend/zend_language_scanner.c" +#line 3523 "Zend/zend_language_scanner.c" yy232: YYDEBUG(232, *YYCURSOR); yych = *++YYCURSOR; @@ -3558,39 +3531,13 @@ int lex_scan(zval *zendlval TSRMLS_DC) goto yy229; yy234: YYDEBUG(234, *YYCURSOR); - yyaccept = 3; - YYMARKER = ++YYCURSOR; - YYFILL(3); - yych = *YYCURSOR; - YYDEBUG(235, *YYCURSOR); - if (yych <= 'D') { - if (yych <= '/') goto yy190; - if (yych <= '9') goto yy234; - goto yy190; - } else { - if (yych <= 'E') goto yy193; - if (yych == 'e') goto yy193; - goto yy190; - } -yy236: - YYDEBUG(236, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(237, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1398 "Zend/zend_language_scanner.l" - { - return T_CONCAT_EQUAL; -} -#line 3585 "Zend/zend_language_scanner.c" -yy238: - YYDEBUG(238, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); - if (yych == '*') goto yy243; -yy239: - YYDEBUG(239, *YYCURSOR); + if (yych == '*') goto yy239; +yy235: + YYDEBUG(235, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1953 "Zend/zend_language_scanner.l" +#line 1887 "Zend/zend_language_scanner.l" { int doc_com; @@ -3624,281 +3571,281 @@ int lex_scan(zval *zendlval TSRMLS_DC) return T_COMMENT; } -#line 3628 "Zend/zend_language_scanner.c" -yy240: - YYDEBUG(240, *YYCURSOR); +#line 3575 "Zend/zend_language_scanner.c" +yy236: + YYDEBUG(236, *YYCURSOR); yych = *++YYCURSOR; goto yy177; -yy241: - YYDEBUG(241, *YYCURSOR); +yy237: + YYDEBUG(237, *YYCURSOR); ++YYCURSOR; - YYDEBUG(242, *YYCURSOR); + YYDEBUG(238, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1394 "Zend/zend_language_scanner.l" +#line 1386 "Zend/zend_language_scanner.l" { return T_DIV_EQUAL; } -#line 3642 "Zend/zend_language_scanner.c" -yy243: - YYDEBUG(243, *YYCURSOR); +#line 3589 "Zend/zend_language_scanner.c" +yy239: + YYDEBUG(239, *YYCURSOR); yych = *++YYCURSOR; if (yybm[0+yych] & 64) { - goto yy244; + goto yy240; } goto yy194; -yy244: - YYDEBUG(244, *YYCURSOR); +yy240: + YYDEBUG(240, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(245, *YYCURSOR); + YYDEBUG(241, *YYCURSOR); if (yybm[0+yych] & 64) { - goto yy244; + goto yy240; } - goto yy239; -yy246: - YYDEBUG(246, *YYCURSOR); + goto yy235; +yy242: + YYDEBUG(242, *YYCURSOR); ++YYCURSOR; - YYDEBUG(247, *YYCURSOR); + YYDEBUG(243, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1390 "Zend/zend_language_scanner.l" +#line 1382 "Zend/zend_language_scanner.l" { return T_MUL_EQUAL; } -#line 3669 "Zend/zend_language_scanner.c" -yy248: - YYDEBUG(248, *YYCURSOR); +#line 3616 "Zend/zend_language_scanner.c" +yy244: + YYDEBUG(244, *YYCURSOR); ++YYCURSOR; - if ((yych = *YYCURSOR) == '=') goto yy252; - YYDEBUG(249, *YYCURSOR); + if ((yych = *YYCURSOR) == '=') goto yy248; + YYDEBUG(245, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1450 "Zend/zend_language_scanner.l" +#line 1442 "Zend/zend_language_scanner.l" { return T_SR; } -#line 3680 "Zend/zend_language_scanner.c" -yy250: - YYDEBUG(250, *YYCURSOR); +#line 3627 "Zend/zend_language_scanner.c" +yy246: + YYDEBUG(246, *YYCURSOR); ++YYCURSOR; - YYDEBUG(251, *YYCURSOR); + YYDEBUG(247, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1378 "Zend/zend_language_scanner.l" +#line 1370 "Zend/zend_language_scanner.l" { return T_IS_GREATER_OR_EQUAL; } -#line 3690 "Zend/zend_language_scanner.c" -yy252: - YYDEBUG(252, *YYCURSOR); +#line 3637 "Zend/zend_language_scanner.c" +yy248: + YYDEBUG(248, *YYCURSOR); ++YYCURSOR; - YYDEBUG(253, *YYCURSOR); + YYDEBUG(249, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1410 "Zend/zend_language_scanner.l" +#line 1402 "Zend/zend_language_scanner.l" { return T_SR_EQUAL; } -#line 3700 "Zend/zend_language_scanner.c" -yy254: - YYDEBUG(254, *YYCURSOR); +#line 3647 "Zend/zend_language_scanner.c" +yy250: + YYDEBUG(250, *YYCURSOR); yyaccept = 5; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= ';') goto yy255; - if (yych <= '<') goto yy270; - if (yych <= '=') goto yy268; -yy255: - YYDEBUG(255, *YYCURSOR); + if (yych <= ';') goto yy251; + if (yych <= '<') goto yy266; + if (yych <= '=') goto yy264; +yy251: + YYDEBUG(251, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1446 "Zend/zend_language_scanner.l" +#line 1438 "Zend/zend_language_scanner.l" { return T_SL; } -#line 3715 "Zend/zend_language_scanner.c" -yy256: - YYDEBUG(256, *YYCURSOR); +#line 3662 "Zend/zend_language_scanner.c" +yy252: + YYDEBUG(252, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'S') goto yy261; - if (yych == 's') goto yy261; + if (yych == 'S') goto yy257; + if (yych == 's') goto yy257; goto yy194; -yy257: - YYDEBUG(257, *YYCURSOR); +yy253: + YYDEBUG(253, *YYCURSOR); ++YYCURSOR; - YYDEBUG(258, *YYCURSOR); + YYDEBUG(254, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1374 "Zend/zend_language_scanner.l" +#line 1366 "Zend/zend_language_scanner.l" { return T_IS_SMALLER_OR_EQUAL; } -#line 3731 "Zend/zend_language_scanner.c" -yy259: - YYDEBUG(259, *YYCURSOR); +#line 3678 "Zend/zend_language_scanner.c" +yy255: + YYDEBUG(255, *YYCURSOR); ++YYCURSOR; -yy260: - YYDEBUG(260, *YYCURSOR); +yy256: + YYDEBUG(256, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1370 "Zend/zend_language_scanner.l" +#line 1362 "Zend/zend_language_scanner.l" { return T_IS_NOT_EQUAL; } -#line 3742 "Zend/zend_language_scanner.c" -yy261: - YYDEBUG(261, *YYCURSOR); +#line 3689 "Zend/zend_language_scanner.c" +yy257: + YYDEBUG(257, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy262; + if (yych == 'C') goto yy258; if (yych != 'c') goto yy194; -yy262: - YYDEBUG(262, *YYCURSOR); +yy258: + YYDEBUG(258, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy263; + if (yych == 'R') goto yy259; if (yych != 'r') goto yy194; -yy263: - YYDEBUG(263, *YYCURSOR); +yy259: + YYDEBUG(259, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy264; + if (yych == 'I') goto yy260; if (yych != 'i') goto yy194; -yy264: - YYDEBUG(264, *YYCURSOR); +yy260: + YYDEBUG(260, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'P') goto yy265; + if (yych == 'P') goto yy261; if (yych != 'p') goto yy194; -yy265: - YYDEBUG(265, *YYCURSOR); +yy261: + YYDEBUG(261, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy266; + if (yych == 'T') goto yy262; if (yych != 't') goto yy194; -yy266: - YYDEBUG(266, *YYCURSOR); +yy262: + YYDEBUG(262, *YYCURSOR); ++YYCURSOR; YYFILL(3); yych = *YYCURSOR; - YYDEBUG(267, *YYCURSOR); + YYDEBUG(263, *YYCURSOR); if (yych <= '\r') { if (yych <= 0x08) goto yy194; - if (yych <= '\n') goto yy266; + if (yych <= '\n') goto yy262; if (yych <= '\f') goto yy194; - goto yy266; + goto yy262; } else { if (yych <= ' ') { if (yych <= 0x1F) goto yy194; - goto yy266; + goto yy262; } else { if (yych == '>') goto yy206; goto yy194; } } -yy268: - YYDEBUG(268, *YYCURSOR); +yy264: + YYDEBUG(264, *YYCURSOR); ++YYCURSOR; - YYDEBUG(269, *YYCURSOR); + YYDEBUG(265, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1406 "Zend/zend_language_scanner.l" +#line 1398 "Zend/zend_language_scanner.l" { return T_SL_EQUAL; } -#line 3797 "Zend/zend_language_scanner.c" -yy270: - YYDEBUG(270, *YYCURSOR); +#line 3744 "Zend/zend_language_scanner.c" +yy266: + YYDEBUG(266, *YYCURSOR); ++YYCURSOR; YYFILL(2); yych = *YYCURSOR; - YYDEBUG(271, *YYCURSOR); + YYDEBUG(267, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy270; + goto yy266; } if (yych <= 'Z') { if (yych <= '&') { - if (yych == '"') goto yy275; + if (yych == '"') goto yy271; goto yy194; } else { - if (yych <= '\'') goto yy274; + if (yych <= '\'') goto yy270; if (yych <= '@') goto yy194; } } else { if (yych <= '`') { if (yych != '_') goto yy194; } else { - if (yych <= 'z') goto yy272; + if (yych <= 'z') goto yy268; if (yych <= '~') goto yy194; } } -yy272: - YYDEBUG(272, *YYCURSOR); +yy268: + YYDEBUG(268, *YYCURSOR); ++YYCURSOR; YYFILL(2); yych = *YYCURSOR; - YYDEBUG(273, *YYCURSOR); + YYDEBUG(269, *YYCURSOR); if (yych <= '@') { if (yych <= '\f') { - if (yych == '\n') goto yy279; + if (yych == '\n') goto yy275; goto yy194; } else { - if (yych <= '\r') goto yy281; + if (yych <= '\r') goto yy277; if (yych <= '/') goto yy194; - if (yych <= '9') goto yy272; + if (yych <= '9') goto yy268; goto yy194; } } else { if (yych <= '_') { - if (yych <= 'Z') goto yy272; + if (yych <= 'Z') goto yy268; if (yych <= '^') goto yy194; - goto yy272; + goto yy268; } else { if (yych <= '`') goto yy194; - if (yych <= 'z') goto yy272; + if (yych <= 'z') goto yy268; if (yych <= '~') goto yy194; - goto yy272; + goto yy268; } } -yy274: - YYDEBUG(274, *YYCURSOR); +yy270: + YYDEBUG(270, *YYCURSOR); yych = *++YYCURSOR; if (yych == '\'') goto yy194; - if (yych <= '/') goto yy283; + if (yych <= '/') goto yy279; if (yych <= '9') goto yy194; - goto yy283; -yy275: - YYDEBUG(275, *YYCURSOR); + goto yy279; +yy271: + YYDEBUG(271, *YYCURSOR); yych = *++YYCURSOR; if (yych == '"') goto yy194; - if (yych <= '/') goto yy277; + if (yych <= '/') goto yy273; if (yych <= '9') goto yy194; - goto yy277; -yy276: - YYDEBUG(276, *YYCURSOR); + goto yy273; +yy272: + YYDEBUG(272, *YYCURSOR); ++YYCURSOR; YYFILL(3); yych = *YYCURSOR; -yy277: - YYDEBUG(277, *YYCURSOR); +yy273: + YYDEBUG(273, *YYCURSOR); if (yych <= 'Z') { if (yych <= '/') { if (yych != '"') goto yy194; } else { - if (yych <= '9') goto yy276; + if (yych <= '9') goto yy272; if (yych <= '@') goto yy194; - goto yy276; + goto yy272; } } else { if (yych <= '`') { - if (yych == '_') goto yy276; + if (yych == '_') goto yy272; goto yy194; } else { - if (yych <= 'z') goto yy276; + if (yych <= 'z') goto yy272; if (yych <= '~') goto yy194; - goto yy276; + goto yy272; } } -yy278: - YYDEBUG(278, *YYCURSOR); +yy274: + YYDEBUG(274, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '\n') goto yy279; - if (yych == '\r') goto yy281; + if (yych == '\n') goto yy275; + if (yych == '\r') goto yy277; goto yy194; -yy279: - YYDEBUG(279, *YYCURSOR); +yy275: + YYDEBUG(275, *YYCURSOR); ++YYCURSOR; -yy280: - YYDEBUG(280, *YYCURSOR); +yy276: + YYDEBUG(276, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2121 "Zend/zend_language_scanner.l" +#line 2049 "Zend/zend_language_scanner.l" { char *s; int bprefix = (yytext[0] != '<') ? 1 : 0; @@ -3945,255 +3892,255 @@ int lex_scan(zval *zendlval TSRMLS_DC) return T_START_HEREDOC; } -#line 3949 "Zend/zend_language_scanner.c" -yy281: - YYDEBUG(281, *YYCURSOR); +#line 3896 "Zend/zend_language_scanner.c" +yy277: + YYDEBUG(277, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '\n') goto yy279; - goto yy280; -yy282: - YYDEBUG(282, *YYCURSOR); + if (yych == '\n') goto yy275; + goto yy276; +yy278: + YYDEBUG(278, *YYCURSOR); ++YYCURSOR; YYFILL(3); yych = *YYCURSOR; -yy283: - YYDEBUG(283, *YYCURSOR); +yy279: + YYDEBUG(279, *YYCURSOR); if (yych <= 'Z') { if (yych <= '/') { - if (yych == '\'') goto yy278; + if (yych == '\'') goto yy274; goto yy194; } else { - if (yych <= '9') goto yy282; + if (yych <= '9') goto yy278; if (yych <= '@') goto yy194; - goto yy282; + goto yy278; } } else { if (yych <= '`') { - if (yych == '_') goto yy282; + if (yych == '_') goto yy278; goto yy194; } else { - if (yych <= 'z') goto yy282; + if (yych <= 'z') goto yy278; if (yych <= '~') goto yy194; - goto yy282; + goto yy278; } } -yy284: - YYDEBUG(284, *YYCURSOR); +yy280: + YYDEBUG(280, *YYCURSOR); yych = *++YYCURSOR; - if (yych != '=') goto yy260; - YYDEBUG(285, *YYCURSOR); + if (yych != '=') goto yy256; + YYDEBUG(281, *YYCURSOR); ++YYCURSOR; - YYDEBUG(286, *YYCURSOR); + YYDEBUG(282, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1362 "Zend/zend_language_scanner.l" +#line 1354 "Zend/zend_language_scanner.l" { return T_IS_NOT_IDENTICAL; } -#line 3993 "Zend/zend_language_scanner.c" -yy287: - YYDEBUG(287, *YYCURSOR); +#line 3940 "Zend/zend_language_scanner.c" +yy283: + YYDEBUG(283, *YYCURSOR); ++YYCURSOR; - YYDEBUG(288, *YYCURSOR); + YYDEBUG(284, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1382 "Zend/zend_language_scanner.l" +#line 1374 "Zend/zend_language_scanner.l" { return T_PLUS_EQUAL; } -#line 4003 "Zend/zend_language_scanner.c" -yy289: - YYDEBUG(289, *YYCURSOR); +#line 3950 "Zend/zend_language_scanner.c" +yy285: + YYDEBUG(285, *YYCURSOR); ++YYCURSOR; - YYDEBUG(290, *YYCURSOR); + YYDEBUG(286, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1350 "Zend/zend_language_scanner.l" +#line 1342 "Zend/zend_language_scanner.l" { return T_INC; } -#line 4013 "Zend/zend_language_scanner.c" -yy291: - YYDEBUG(291, *YYCURSOR); +#line 3960 "Zend/zend_language_scanner.c" +yy287: + YYDEBUG(287, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'S') goto yy292; + if (yych == 'S') goto yy288; if (yych != 's') goto yy187; -yy292: - YYDEBUG(292, *YYCURSOR); +yy288: + YYDEBUG(288, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy293; + if (yych == 'T') goto yy289; if (yych != 't') goto yy187; -yy293: - YYDEBUG(293, *YYCURSOR); +yy289: + YYDEBUG(289, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(294, *YYCURSOR); + YYDEBUG(290, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1338 "Zend/zend_language_scanner.l" +#line 1330 "Zend/zend_language_scanner.l" { return T_LIST; } -#line 4036 "Zend/zend_language_scanner.c" -yy295: - YYDEBUG(295, *YYCURSOR); +#line 3983 "Zend/zend_language_scanner.c" +yy291: + YYDEBUG(291, *YYCURSOR); ++YYCURSOR; - if ((yych = *YYCURSOR) == '=') goto yy299; - YYDEBUG(296, *YYCURSOR); + if ((yych = *YYCURSOR) == '=') goto yy295; + YYDEBUG(292, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1366 "Zend/zend_language_scanner.l" +#line 1358 "Zend/zend_language_scanner.l" { return T_IS_EQUAL; } -#line 4047 "Zend/zend_language_scanner.c" -yy297: - YYDEBUG(297, *YYCURSOR); +#line 3994 "Zend/zend_language_scanner.c" +yy293: + YYDEBUG(293, *YYCURSOR); ++YYCURSOR; - YYDEBUG(298, *YYCURSOR); + YYDEBUG(294, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1334 "Zend/zend_language_scanner.l" +#line 1326 "Zend/zend_language_scanner.l" { return T_DOUBLE_ARROW; } -#line 4057 "Zend/zend_language_scanner.c" -yy299: - YYDEBUG(299, *YYCURSOR); +#line 4004 "Zend/zend_language_scanner.c" +yy295: + YYDEBUG(295, *YYCURSOR); ++YYCURSOR; - YYDEBUG(300, *YYCURSOR); + YYDEBUG(296, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1358 "Zend/zend_language_scanner.l" +#line 1350 "Zend/zend_language_scanner.l" { return T_IS_IDENTICAL; } -#line 4067 "Zend/zend_language_scanner.c" -yy301: - YYDEBUG(301, *YYCURSOR); +#line 4014 "Zend/zend_language_scanner.c" +yy297: + YYDEBUG(297, *YYCURSOR); yych = *++YYCURSOR; YYDEBUG(-1, yych); switch (yych) { case 'C': - case 'c': goto yy303; + case 'c': goto yy299; case 'D': - case 'd': goto yy308; + case 'd': goto yy304; case 'F': - case 'f': goto yy305; + case 'f': goto yy301; case 'H': - case 'h': goto yy302; + case 'h': goto yy298; case 'L': - case 'l': goto yy307; + case 'l': goto yy303; case 'M': - case 'm': goto yy306; + case 'm': goto yy302; case 'N': - case 'n': goto yy309; + case 'n': goto yy305; case 'T': - case 't': goto yy304; + case 't': goto yy300; default: goto yy187; } -yy302: - YYDEBUG(302, *YYCURSOR); +yy298: + YYDEBUG(298, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy370; - if (yych == 'a') goto yy370; + if (yych == 'A') goto yy366; + if (yych == 'a') goto yy366; goto yy187; -yy303: - YYDEBUG(303, *YYCURSOR); +yy299: + YYDEBUG(299, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy363; - if (yych == 'l') goto yy363; + if (yych == 'L') goto yy359; + if (yych == 'l') goto yy359; goto yy187; -yy304: - YYDEBUG(304, *YYCURSOR); +yy300: + YYDEBUG(300, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy356; - if (yych == 'r') goto yy356; + if (yych == 'R') goto yy352; + if (yych == 'r') goto yy352; goto yy187; -yy305: - YYDEBUG(305, *YYCURSOR); +yy301: + YYDEBUG(301, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'U') { - if (yych == 'I') goto yy340; + if (yych == 'I') goto yy336; if (yych <= 'T') goto yy187; - goto yy341; + goto yy337; } else { if (yych <= 'i') { if (yych <= 'h') goto yy187; - goto yy340; + goto yy336; } else { - if (yych == 'u') goto yy341; + if (yych == 'u') goto yy337; goto yy187; } } +yy302: + YYDEBUG(302, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy328; + if (yych == 'e') goto yy328; + goto yy187; +yy303: + YYDEBUG(303, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy322; + if (yych == 'i') goto yy322; + goto yy187; +yy304: + YYDEBUG(304, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy317; + if (yych == 'i') goto yy317; + goto yy187; +yy305: + YYDEBUG(305, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy306; + if (yych != 'a') goto yy187; yy306: YYDEBUG(306, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy332; - if (yych == 'e') goto yy332; - goto yy187; + if (yych == 'M') goto yy307; + if (yych != 'm') goto yy187; yy307: YYDEBUG(307, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy326; - if (yych == 'i') goto yy326; - goto yy187; + if (yych == 'E') goto yy308; + if (yych != 'e') goto yy187; yy308: YYDEBUG(308, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy321; - if (yych == 'i') goto yy321; - goto yy187; + if (yych == 'S') goto yy309; + if (yych != 's') goto yy187; yy309: YYDEBUG(309, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy310; - if (yych != 'a') goto yy187; + if (yych == 'P') goto yy310; + if (yych != 'p') goto yy187; yy310: YYDEBUG(310, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'M') goto yy311; - if (yych != 'm') goto yy187; + if (yych == 'A') goto yy311; + if (yych != 'a') goto yy187; yy311: YYDEBUG(311, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy312; - if (yych != 'e') goto yy187; + if (yych == 'C') goto yy312; + if (yych != 'c') goto yy187; yy312: YYDEBUG(312, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'S') goto yy313; - if (yych != 's') goto yy187; + if (yych == 'E') goto yy313; + if (yych != 'e') goto yy187; yy313: YYDEBUG(313, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'P') goto yy314; - if (yych != 'p') goto yy187; -yy314: - YYDEBUG(314, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy315; - if (yych != 'a') goto yy187; -yy315: - YYDEBUG(315, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'C') goto yy316; - if (yych != 'c') goto yy187; -yy316: - YYDEBUG(316, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy317; - if (yych != 'e') goto yy187; -yy317: - YYDEBUG(317, *YYCURSOR); - yych = *++YYCURSOR; if (yych != '_') goto yy187; - YYDEBUG(318, *YYCURSOR); + YYDEBUG(314, *YYCURSOR); yych = *++YYCURSOR; if (yych != '_') goto yy187; - YYDEBUG(319, *YYCURSOR); + YYDEBUG(315, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(320, *YYCURSOR); + YYDEBUG(316, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1722 "Zend/zend_language_scanner.l" +#line 1668 "Zend/zend_language_scanner.l" { if (CG(current_namespace)) { *zendlval = *CG(current_namespace); @@ -4203,27 +4150,27 @@ int lex_scan(zval *zendlval TSRMLS_DC) } return T_NS_C; } -#line 4207 "Zend/zend_language_scanner.c" -yy321: - YYDEBUG(321, *YYCURSOR); +#line 4154 "Zend/zend_language_scanner.c" +yy317: + YYDEBUG(317, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy322; + if (yych == 'R') goto yy318; if (yych != 'r') goto yy187; -yy322: - YYDEBUG(322, *YYCURSOR); +yy318: + YYDEBUG(318, *YYCURSOR); yych = *++YYCURSOR; if (yych != '_') goto yy187; - YYDEBUG(323, *YYCURSOR); + YYDEBUG(319, *YYCURSOR); yych = *++YYCURSOR; if (yych != '_') goto yy187; - YYDEBUG(324, *YYCURSOR); + YYDEBUG(320, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(325, *YYCURSOR); + YYDEBUG(321, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1695 "Zend/zend_language_scanner.l" +#line 1643 "Zend/zend_language_scanner.l" { char *filename = zend_get_compiled_filename(TSRMLS_C); const size_t filename_len = strlen(filename); @@ -4245,91 +4192,80 @@ int lex_scan(zval *zendlval TSRMLS_DC) #endif } - zendlval->value.str.len = strlen(dirname); - zendlval->value.str.val = dirname; - zendlval->type = IS_STRING; + ZVAL_STRING(zendlval, dirname, 0); return T_DIR; } -#line 4254 "Zend/zend_language_scanner.c" -yy326: - YYDEBUG(326, *YYCURSOR); +#line 4199 "Zend/zend_language_scanner.c" +yy322: + YYDEBUG(322, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy327; + if (yych == 'N') goto yy323; if (yych != 'n') goto yy187; -yy327: - YYDEBUG(327, *YYCURSOR); +yy323: + YYDEBUG(323, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy328; + if (yych == 'E') goto yy324; if (yych != 'e') goto yy187; -yy328: - YYDEBUG(328, *YYCURSOR); +yy324: + YYDEBUG(324, *YYCURSOR); yych = *++YYCURSOR; if (yych != '_') goto yy187; - YYDEBUG(329, *YYCURSOR); + YYDEBUG(325, *YYCURSOR); yych = *++YYCURSOR; if (yych != '_') goto yy187; - YYDEBUG(330, *YYCURSOR); + YYDEBUG(326, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(331, *YYCURSOR); + YYDEBUG(327, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1677 "Zend/zend_language_scanner.l" +#line 1628 "Zend/zend_language_scanner.l" { - zendlval->value.lval = CG(zend_lineno); - zendlval->type = IS_LONG; + ZVAL_LONG(zendlval, CG(zend_lineno)); return T_LINE; } -#line 4285 "Zend/zend_language_scanner.c" -yy332: - YYDEBUG(332, *YYCURSOR); +#line 4229 "Zend/zend_language_scanner.c" +yy328: + YYDEBUG(328, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy333; + if (yych == 'T') goto yy329; if (yych != 't') goto yy187; -yy333: - YYDEBUG(333, *YYCURSOR); +yy329: + YYDEBUG(329, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'H') goto yy334; + if (yych == 'H') goto yy330; if (yych != 'h') goto yy187; -yy334: - YYDEBUG(334, *YYCURSOR); +yy330: + YYDEBUG(330, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy335; + if (yych == 'O') goto yy331; if (yych != 'o') goto yy187; -yy335: - YYDEBUG(335, *YYCURSOR); +yy331: + YYDEBUG(331, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'D') goto yy336; + if (yych == 'D') goto yy332; if (yych != 'd') goto yy187; -yy336: - YYDEBUG(336, *YYCURSOR); +yy332: + YYDEBUG(332, *YYCURSOR); yych = *++YYCURSOR; if (yych != '_') goto yy187; - YYDEBUG(337, *YYCURSOR); + YYDEBUG(333, *YYCURSOR); yych = *++YYCURSOR; if (yych != '_') goto yy187; - YYDEBUG(338, *YYCURSOR); + YYDEBUG(334, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(339, *YYCURSOR); + YYDEBUG(335, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1656 "Zend/zend_language_scanner.l" +#line 1615 "Zend/zend_language_scanner.l" { const char *class_name = CG(active_class_entry) ? CG(active_class_entry)->name : NULL; const char *func_name = CG(active_op_array)? CG(active_op_array)->function_name : NULL; - size_t len = 0; - if (class_name) { - len += strlen(class_name) + 2; - } - if (func_name) { - len += strlen(func_name); - } - - zendlval->value.str.len = zend_spprintf(&zendlval->value.str.val, 0, "%s%s%s", + Z_STRLEN_P(zendlval) = zend_spprintf(&Z_STRVAL_P(zendlval), 0, "%s%s%s", class_name ? class_name : "", class_name && func_name ? "::" : "", func_name ? func_name : "" @@ -4337,266 +4273,263 @@ int lex_scan(zval *zendlval TSRMLS_DC) zendlval->type = IS_STRING; return T_METHOD_C; } -#line 4341 "Zend/zend_language_scanner.c" -yy340: - YYDEBUG(340, *YYCURSOR); +#line 4277 "Zend/zend_language_scanner.c" +yy336: + YYDEBUG(336, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy351; - if (yych == 'l') goto yy351; + if (yych == 'L') goto yy347; + if (yych == 'l') goto yy347; goto yy187; -yy341: - YYDEBUG(341, *YYCURSOR); +yy337: + YYDEBUG(337, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy342; + if (yych == 'N') goto yy338; if (yych != 'n') goto yy187; -yy342: - YYDEBUG(342, *YYCURSOR); +yy338: + YYDEBUG(338, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy343; + if (yych == 'C') goto yy339; if (yych != 'c') goto yy187; -yy343: - YYDEBUG(343, *YYCURSOR); +yy339: + YYDEBUG(339, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy344; + if (yych == 'T') goto yy340; if (yych != 't') goto yy187; -yy344: - YYDEBUG(344, *YYCURSOR); +yy340: + YYDEBUG(340, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy345; + if (yych == 'I') goto yy341; if (yych != 'i') goto yy187; -yy345: - YYDEBUG(345, *YYCURSOR); +yy341: + YYDEBUG(341, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy346; + if (yych == 'O') goto yy342; if (yych != 'o') goto yy187; -yy346: - YYDEBUG(346, *YYCURSOR); +yy342: + YYDEBUG(342, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy347; + if (yych == 'N') goto yy343; if (yych != 'n') goto yy187; -yy347: - YYDEBUG(347, *YYCURSOR); +yy343: + YYDEBUG(343, *YYCURSOR); yych = *++YYCURSOR; if (yych != '_') goto yy187; - YYDEBUG(348, *YYCURSOR); + YYDEBUG(344, *YYCURSOR); yych = *++YYCURSOR; if (yych != '_') goto yy187; - YYDEBUG(349, *YYCURSOR); + YYDEBUG(345, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(350, *YYCURSOR); + YYDEBUG(346, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1640 "Zend/zend_language_scanner.l" +#line 1605 "Zend/zend_language_scanner.l" { - const char *func_name = NULL; - - if (CG(active_op_array)) { - func_name = CG(active_op_array)->function_name; - } - - if (!func_name) { - func_name = ""; + zend_op_array *op_array = CG(active_op_array); + if (op_array && op_array->function_name) { + ZVAL_STRING(zendlval, op_array->function_name, 1); + } else { + ZVAL_EMPTY_STRING(zendlval); } - zendlval->value.str.len = strlen(func_name); - zendlval->value.str.val = estrndup(func_name, zendlval->value.str.len); - zendlval->type = IS_STRING; return T_FUNC_C; } -#line 4408 "Zend/zend_language_scanner.c" -yy351: - YYDEBUG(351, *YYCURSOR); +#line 4338 "Zend/zend_language_scanner.c" +yy347: + YYDEBUG(347, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy352; + if (yych == 'E') goto yy348; if (yych != 'e') goto yy187; -yy352: - YYDEBUG(352, *YYCURSOR); +yy348: + YYDEBUG(348, *YYCURSOR); yych = *++YYCURSOR; if (yych != '_') goto yy187; - YYDEBUG(353, *YYCURSOR); + YYDEBUG(349, *YYCURSOR); yych = *++YYCURSOR; if (yych != '_') goto yy187; - YYDEBUG(354, *YYCURSOR); + YYDEBUG(350, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(355, *YYCURSOR); + YYDEBUG(351, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1683 "Zend/zend_language_scanner.l" +#line 1633 "Zend/zend_language_scanner.l" { char *filename = zend_get_compiled_filename(TSRMLS_C); if (!filename) { filename = ""; } - zendlval->value.str.len = strlen(filename); - zendlval->value.str.val = estrndup(filename, zendlval->value.str.len); - zendlval->type = IS_STRING; + ZVAL_STRING(zendlval, filename, 1); return T_FILE; } -#line 4440 "Zend/zend_language_scanner.c" -yy356: - YYDEBUG(356, *YYCURSOR); +#line 4368 "Zend/zend_language_scanner.c" +yy352: + YYDEBUG(352, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy357; + if (yych == 'A') goto yy353; if (yych != 'a') goto yy187; -yy357: - YYDEBUG(357, *YYCURSOR); +yy353: + YYDEBUG(353, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy358; + if (yych == 'I') goto yy354; if (yych != 'i') goto yy187; -yy358: - YYDEBUG(358, *YYCURSOR); +yy354: + YYDEBUG(354, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy359; + if (yych == 'T') goto yy355; if (yych != 't') goto yy187; -yy359: - YYDEBUG(359, *YYCURSOR); +yy355: + YYDEBUG(355, *YYCURSOR); yych = *++YYCURSOR; if (yych != '_') goto yy187; - YYDEBUG(360, *YYCURSOR); + YYDEBUG(356, *YYCURSOR); yych = *++YYCURSOR; if (yych != '_') goto yy187; - YYDEBUG(361, *YYCURSOR); + YYDEBUG(357, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(362, *YYCURSOR); + YYDEBUG(358, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1620 "Zend/zend_language_scanner.l" +#line 1595 "Zend/zend_language_scanner.l" { - const char *trait_name = NULL; - - if (CG(active_class_entry) - && (ZEND_ACC_TRAIT == - (CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT))) { - trait_name = CG(active_class_entry)->name; - } - - if (!trait_name) { - trait_name = ""; + zend_class_entry *ce = CG(active_class_entry); + if (ce && ce->name && ZEND_ACC_TRAIT == (ce->ce_flags & ZEND_ACC_TRAIT)) { + ZVAL_STRINGL(zendlval, ce->name, ce->name_length, 1); + } else { + ZVAL_EMPTY_STRING(zendlval); } - - zendlval->value.str.len = strlen(trait_name); - zendlval->value.str.val = estrndup(trait_name, zendlval->value.str.len); - zendlval->type = IS_STRING; - return T_TRAIT_C; } -#line 4490 "Zend/zend_language_scanner.c" -yy363: - YYDEBUG(363, *YYCURSOR); +#line 4408 "Zend/zend_language_scanner.c" +yy359: + YYDEBUG(359, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy364; + if (yych == 'A') goto yy360; if (yych != 'a') goto yy187; -yy364: - YYDEBUG(364, *YYCURSOR); +yy360: + YYDEBUG(360, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'S') goto yy365; + if (yych == 'S') goto yy361; if (yych != 's') goto yy187; -yy365: - YYDEBUG(365, *YYCURSOR); +yy361: + YYDEBUG(361, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'S') goto yy366; + if (yych == 'S') goto yy362; if (yych != 's') goto yy187; -yy366: - YYDEBUG(366, *YYCURSOR); +yy362: + YYDEBUG(362, *YYCURSOR); yych = *++YYCURSOR; if (yych != '_') goto yy187; - YYDEBUG(367, *YYCURSOR); + YYDEBUG(363, *YYCURSOR); yych = *++YYCURSOR; if (yych != '_') goto yy187; - YYDEBUG(368, *YYCURSOR); + YYDEBUG(364, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(369, *YYCURSOR); + YYDEBUG(365, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1593 "Zend/zend_language_scanner.l" +#line 1577 "Zend/zend_language_scanner.l" { - const char *class_name = NULL; - - if (CG(active_class_entry) - && (ZEND_ACC_TRAIT == - (CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT))) { + zend_class_entry *ce = CG(active_class_entry); + if (ce && ZEND_ACC_TRAIT == (ce->ce_flags & ZEND_ACC_TRAIT)) { /* We create a special __CLASS__ constant that is going to be resolved at run-time */ - zendlval->value.str.len = sizeof("__CLASS__")-1; - zendlval->value.str.val = estrndup("__CLASS__", zendlval->value.str.len); + Z_STRLEN_P(zendlval) = sizeof("__CLASS__")-1; + Z_STRVAL_P(zendlval) = estrndup("__CLASS__", Z_STRLEN_P(zendlval)); zendlval->type = IS_CONSTANT; } else { - if (CG(active_class_entry)) { - class_name = CG(active_class_entry)->name; - } - - if (!class_name) { - class_name = ""; + if (ce && ce->name) { + ZVAL_STRINGL(zendlval, ce->name, ce->name_length, 1); + } else { + ZVAL_EMPTY_STRING(zendlval); } - - zendlval->value.str.len = strlen(class_name); - zendlval->value.str.val = estrndup(class_name, zendlval->value.str.len); - zendlval->type = IS_STRING; } return T_CLASS_C; } -#line 4547 "Zend/zend_language_scanner.c" +#line 4456 "Zend/zend_language_scanner.c" +yy366: + YYDEBUG(366, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy367; + if (yych != 'l') goto yy187; +yy367: + YYDEBUG(367, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy368; + if (yych != 't') goto yy187; +yy368: + YYDEBUG(368, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy187; + YYDEBUG(369, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy370; + if (yych != 'c') goto yy187; yy370: YYDEBUG(370, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy371; - if (yych != 'l') goto yy187; + if (yych == 'O') goto yy371; + if (yych != 'o') goto yy187; yy371: YYDEBUG(371, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy372; - if (yych != 't') goto yy187; + if (yych == 'M') goto yy372; + if (yych != 'm') goto yy187; yy372: YYDEBUG(372, *YYCURSOR); yych = *++YYCURSOR; - if (yych != '_') goto yy187; + if (yych == 'P') goto yy373; + if (yych != 'p') goto yy187; +yy373: YYDEBUG(373, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy374; - if (yych != 'c') goto yy187; + if (yych == 'I') goto yy374; + if (yych != 'i') goto yy187; yy374: YYDEBUG(374, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy375; - if (yych != 'o') goto yy187; + if (yych == 'L') goto yy375; + if (yych != 'l') goto yy187; yy375: YYDEBUG(375, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'M') goto yy376; - if (yych != 'm') goto yy187; + if (yych == 'E') goto yy376; + if (yych != 'e') goto yy187; yy376: YYDEBUG(376, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'P') goto yy377; - if (yych != 'p') goto yy187; + if (yych == 'R') goto yy377; + if (yych != 'r') goto yy187; yy377: YYDEBUG(377, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'I') goto yy378; - if (yych != 'i') goto yy187; -yy378: + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } YYDEBUG(378, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'L') goto yy379; - if (yych != 'l') goto yy187; + yyleng = YYCURSOR - SCNG(yy_text); +#line 1294 "Zend/zend_language_scanner.l" + { + return T_HALT_COMPILER; +} +#line 4522 "Zend/zend_language_scanner.c" yy379: YYDEBUG(379, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy380; - if (yych != 'e') goto yy187; + if (yych == 'S') goto yy383; + if (yych == 's') goto yy383; + goto yy187; yy380: YYDEBUG(380, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy381; - if (yych != 'r') goto yy187; + if (yych == 'E') goto yy381; + if (yych != 'e') goto yy187; yy381: YYDEBUG(381, *YYCURSOR); ++YYCURSOR; @@ -4605,22 +4538,21 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(382, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1302 "Zend/zend_language_scanner.l" +#line 1274 "Zend/zend_language_scanner.l" { - return T_HALT_COMPILER; + return T_USE; } -#line 4613 "Zend/zend_language_scanner.c" +#line 4546 "Zend/zend_language_scanner.c" yy383: YYDEBUG(383, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'S') goto yy387; - if (yych == 's') goto yy387; - goto yy187; + if (yych == 'E') goto yy384; + if (yych != 'e') goto yy187; yy384: YYDEBUG(384, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy385; - if (yych != 'e') goto yy187; + if (yych == 'T') goto yy385; + if (yych != 't') goto yy187; yy385: YYDEBUG(385, *YYCURSOR); ++YYCURSOR; @@ -4629,742 +4561,743 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(386, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1282 "Zend/zend_language_scanner.l" +#line 1322 "Zend/zend_language_scanner.l" { - return T_USE; + return T_UNSET; } -#line 4637 "Zend/zend_language_scanner.c" +#line 4569 "Zend/zend_language_scanner.c" yy387: YYDEBUG(387, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy388; - if (yych != 'e') goto yy187; -yy388: - YYDEBUG(388, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy389; - if (yych != 't') goto yy187; -yy389: - YYDEBUG(389, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy186; - } - YYDEBUG(390, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1330 "Zend/zend_language_scanner.l" - { - return T_UNSET; -} -#line 4660 "Zend/zend_language_scanner.c" -yy391: - YYDEBUG(391, *YYCURSOR); ++YYCURSOR; YYFILL(7); yych = *YYCURSOR; -yy392: - YYDEBUG(392, *YYCURSOR); +yy388: + YYDEBUG(388, *YYCURSOR); if (yych <= 'S') { if (yych <= 'D') { if (yych <= ' ') { - if (yych == '\t') goto yy391; + if (yych == '\t') goto yy387; if (yych <= 0x1F) goto yy194; - goto yy391; + goto yy387; } else { if (yych <= 'A') { if (yych <= '@') goto yy194; - goto yy396; + goto yy392; } else { - if (yych <= 'B') goto yy394; + if (yych <= 'B') goto yy390; if (yych <= 'C') goto yy194; - goto yy399; + goto yy395; } } } else { if (yych <= 'I') { - if (yych == 'F') goto yy400; + if (yych == 'F') goto yy396; if (yych <= 'H') goto yy194; - goto yy401; + goto yy397; } else { if (yych <= 'O') { if (yych <= 'N') goto yy194; - goto yy395; + goto yy391; } else { if (yych <= 'Q') goto yy194; - if (yych <= 'R') goto yy398; - goto yy397; + if (yych <= 'R') goto yy394; + goto yy393; } } } } else { if (yych <= 'f') { if (yych <= 'a') { - if (yych == 'U') goto yy393; + if (yych == 'U') goto yy389; if (yych <= '`') goto yy194; - goto yy396; + goto yy392; } else { if (yych <= 'c') { - if (yych <= 'b') goto yy394; + if (yych <= 'b') goto yy390; goto yy194; } else { - if (yych <= 'd') goto yy399; + if (yych <= 'd') goto yy395; if (yych <= 'e') goto yy194; - goto yy400; + goto yy396; } } } else { if (yych <= 'q') { if (yych <= 'i') { if (yych <= 'h') goto yy194; - goto yy401; + goto yy397; } else { - if (yych == 'o') goto yy395; + if (yych == 'o') goto yy391; goto yy194; } } else { if (yych <= 's') { - if (yych <= 'r') goto yy398; - goto yy397; + if (yych <= 'r') goto yy394; + goto yy393; } else { if (yych != 'u') goto yy194; } } } } -yy393: - YYDEBUG(393, *YYCURSOR); +yy389: + YYDEBUG(389, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy460; - if (yych == 'n') goto yy460; + if (yych == 'N') goto yy456; + if (yych == 'n') goto yy456; goto yy194; -yy394: - YYDEBUG(394, *YYCURSOR); +yy390: + YYDEBUG(390, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'O') { - if (yych == 'I') goto yy447; + if (yych == 'I') goto yy443; if (yych <= 'N') goto yy194; - goto yy448; + goto yy444; } else { if (yych <= 'i') { if (yych <= 'h') goto yy194; - goto yy447; + goto yy443; } else { - if (yych == 'o') goto yy448; + if (yych == 'o') goto yy444; goto yy194; } } +yy391: + YYDEBUG(391, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'B') goto yy435; + if (yych == 'b') goto yy435; + goto yy194; +yy392: + YYDEBUG(392, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy428; + if (yych == 'r') goto yy428; + goto yy194; +yy393: + YYDEBUG(393, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy420; + if (yych == 't') goto yy420; + goto yy194; +yy394: + YYDEBUG(394, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy418; + if (yych == 'e') goto yy418; + goto yy194; yy395: YYDEBUG(395, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'B') goto yy439; - if (yych == 'b') goto yy439; + if (yych == 'O') goto yy414; + if (yych == 'o') goto yy414; goto yy194; yy396: YYDEBUG(396, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy432; - if (yych == 'r') goto yy432; + if (yych == 'L') goto yy407; + if (yych == 'l') goto yy407; goto yy194; yy397: YYDEBUG(397, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy424; - if (yych == 't') goto yy424; - goto yy194; + if (yych == 'N') goto yy398; + if (yych != 'n') goto yy194; yy398: YYDEBUG(398, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy422; - if (yych == 'e') goto yy422; - goto yy194; + if (yych == 'T') goto yy399; + if (yych != 't') goto yy194; yy399: YYDEBUG(399, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy418; - if (yych == 'o') goto yy418; - goto yy194; + if (yych == 'E') goto yy400; + if (yych != 'e') goto yy402; yy400: YYDEBUG(400, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy411; - if (yych == 'l') goto yy411; + if (yych == 'G') goto yy405; + if (yych == 'g') goto yy405; goto yy194; yy401: YYDEBUG(401, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'N') goto yy402; - if (yych != 'n') goto yy194; -yy402: - YYDEBUG(402, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy403; - if (yych != 't') goto yy194; -yy403: - YYDEBUG(403, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy404; - if (yych != 'e') goto yy406; -yy404: - YYDEBUG(404, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'G') goto yy409; - if (yych == 'g') goto yy409; - goto yy194; -yy405: - YYDEBUG(405, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy406: - YYDEBUG(406, *YYCURSOR); +yy402: + YYDEBUG(402, *YYCURSOR); if (yych <= 0x1F) { - if (yych == '\t') goto yy405; + if (yych == '\t') goto yy401; goto yy194; } else { - if (yych <= ' ') goto yy405; + if (yych <= ' ') goto yy401; if (yych != ')') goto yy194; } - YYDEBUG(407, *YYCURSOR); + YYDEBUG(403, *YYCURSOR); ++YYCURSOR; - YYDEBUG(408, *YYCURSOR); + YYDEBUG(404, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1230 "Zend/zend_language_scanner.l" +#line 1222 "Zend/zend_language_scanner.l" { return T_INT_CAST; } -#line 4836 "Zend/zend_language_scanner.c" -yy409: - YYDEBUG(409, *YYCURSOR); +#line 4745 "Zend/zend_language_scanner.c" +yy405: + YYDEBUG(405, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy410; + if (yych == 'E') goto yy406; if (yych != 'e') goto yy194; -yy410: - YYDEBUG(410, *YYCURSOR); +yy406: + YYDEBUG(406, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy405; - if (yych == 'r') goto yy405; + if (yych == 'R') goto yy401; + if (yych == 'r') goto yy401; goto yy194; -yy411: - YYDEBUG(411, *YYCURSOR); +yy407: + YYDEBUG(407, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy412; + if (yych == 'O') goto yy408; if (yych != 'o') goto yy194; -yy412: - YYDEBUG(412, *YYCURSOR); +yy408: + YYDEBUG(408, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy413; + if (yych == 'A') goto yy409; if (yych != 'a') goto yy194; -yy413: - YYDEBUG(413, *YYCURSOR); +yy409: + YYDEBUG(409, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy414; + if (yych == 'T') goto yy410; if (yych != 't') goto yy194; -yy414: - YYDEBUG(414, *YYCURSOR); +yy410: + YYDEBUG(410, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(415, *YYCURSOR); + YYDEBUG(411, *YYCURSOR); if (yych <= 0x1F) { - if (yych == '\t') goto yy414; + if (yych == '\t') goto yy410; goto yy194; } else { - if (yych <= ' ') goto yy414; + if (yych <= ' ') goto yy410; if (yych != ')') goto yy194; } - YYDEBUG(416, *YYCURSOR); + YYDEBUG(412, *YYCURSOR); ++YYCURSOR; - YYDEBUG(417, *YYCURSOR); + YYDEBUG(413, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1234 "Zend/zend_language_scanner.l" +#line 1226 "Zend/zend_language_scanner.l" { return T_DOUBLE_CAST; } -#line 4884 "Zend/zend_language_scanner.c" -yy418: - YYDEBUG(418, *YYCURSOR); +#line 4793 "Zend/zend_language_scanner.c" +yy414: + YYDEBUG(414, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'U') goto yy419; + if (yych == 'U') goto yy415; if (yych != 'u') goto yy194; -yy419: - YYDEBUG(419, *YYCURSOR); +yy415: + YYDEBUG(415, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'B') goto yy420; + if (yych == 'B') goto yy416; if (yych != 'b') goto yy194; -yy420: - YYDEBUG(420, *YYCURSOR); +yy416: + YYDEBUG(416, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy421; + if (yych == 'L') goto yy417; if (yych != 'l') goto yy194; -yy421: - YYDEBUG(421, *YYCURSOR); +yy417: + YYDEBUG(417, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy414; - if (yych == 'e') goto yy414; + if (yych == 'E') goto yy410; + if (yych == 'e') goto yy410; goto yy194; -yy422: - YYDEBUG(422, *YYCURSOR); +yy418: + YYDEBUG(418, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy423; + if (yych == 'A') goto yy419; if (yych != 'a') goto yy194; -yy423: - YYDEBUG(423, *YYCURSOR); +yy419: + YYDEBUG(419, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy414; - if (yych == 'l') goto yy414; + if (yych == 'L') goto yy410; + if (yych == 'l') goto yy410; goto yy194; -yy424: - YYDEBUG(424, *YYCURSOR); +yy420: + YYDEBUG(420, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy425; + if (yych == 'R') goto yy421; if (yych != 'r') goto yy194; -yy425: - YYDEBUG(425, *YYCURSOR); +yy421: + YYDEBUG(421, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy426; + if (yych == 'I') goto yy422; if (yych != 'i') goto yy194; -yy426: - YYDEBUG(426, *YYCURSOR); +yy422: + YYDEBUG(422, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy427; + if (yych == 'N') goto yy423; if (yych != 'n') goto yy194; -yy427: - YYDEBUG(427, *YYCURSOR); +yy423: + YYDEBUG(423, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'G') goto yy428; + if (yych == 'G') goto yy424; if (yych != 'g') goto yy194; -yy428: - YYDEBUG(428, *YYCURSOR); +yy424: + YYDEBUG(424, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(429, *YYCURSOR); + YYDEBUG(425, *YYCURSOR); if (yych <= 0x1F) { - if (yych == '\t') goto yy428; + if (yych == '\t') goto yy424; goto yy194; } else { - if (yych <= ' ') goto yy428; + if (yych <= ' ') goto yy424; if (yych != ')') goto yy194; } - YYDEBUG(430, *YYCURSOR); + YYDEBUG(426, *YYCURSOR); ++YYCURSOR; - YYDEBUG(431, *YYCURSOR); + YYDEBUG(427, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1238 "Zend/zend_language_scanner.l" +#line 1230 "Zend/zend_language_scanner.l" { return T_STRING_CAST; } -#line 4958 "Zend/zend_language_scanner.c" -yy432: - YYDEBUG(432, *YYCURSOR); +#line 4867 "Zend/zend_language_scanner.c" +yy428: + YYDEBUG(428, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy433; + if (yych == 'R') goto yy429; if (yych != 'r') goto yy194; -yy433: - YYDEBUG(433, *YYCURSOR); +yy429: + YYDEBUG(429, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy434; + if (yych == 'A') goto yy430; if (yych != 'a') goto yy194; -yy434: - YYDEBUG(434, *YYCURSOR); +yy430: + YYDEBUG(430, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'Y') goto yy435; + if (yych == 'Y') goto yy431; if (yych != 'y') goto yy194; -yy435: - YYDEBUG(435, *YYCURSOR); +yy431: + YYDEBUG(431, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(436, *YYCURSOR); + YYDEBUG(432, *YYCURSOR); if (yych <= 0x1F) { - if (yych == '\t') goto yy435; + if (yych == '\t') goto yy431; goto yy194; } else { - if (yych <= ' ') goto yy435; + if (yych <= ' ') goto yy431; if (yych != ')') goto yy194; } - YYDEBUG(437, *YYCURSOR); + YYDEBUG(433, *YYCURSOR); ++YYCURSOR; - YYDEBUG(438, *YYCURSOR); + YYDEBUG(434, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1242 "Zend/zend_language_scanner.l" +#line 1234 "Zend/zend_language_scanner.l" { return T_ARRAY_CAST; } -#line 4995 "Zend/zend_language_scanner.c" -yy439: - YYDEBUG(439, *YYCURSOR); +#line 4904 "Zend/zend_language_scanner.c" +yy435: + YYDEBUG(435, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'J') goto yy440; + if (yych == 'J') goto yy436; if (yych != 'j') goto yy194; -yy440: - YYDEBUG(440, *YYCURSOR); +yy436: + YYDEBUG(436, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy441; + if (yych == 'E') goto yy437; if (yych != 'e') goto yy194; -yy441: - YYDEBUG(441, *YYCURSOR); +yy437: + YYDEBUG(437, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy442; + if (yych == 'C') goto yy438; if (yych != 'c') goto yy194; -yy442: - YYDEBUG(442, *YYCURSOR); +yy438: + YYDEBUG(438, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy443; + if (yych == 'T') goto yy439; if (yych != 't') goto yy194; -yy443: - YYDEBUG(443, *YYCURSOR); +yy439: + YYDEBUG(439, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(444, *YYCURSOR); + YYDEBUG(440, *YYCURSOR); if (yych <= 0x1F) { - if (yych == '\t') goto yy443; + if (yych == '\t') goto yy439; goto yy194; } else { - if (yych <= ' ') goto yy443; + if (yych <= ' ') goto yy439; if (yych != ')') goto yy194; } - YYDEBUG(445, *YYCURSOR); + YYDEBUG(441, *YYCURSOR); ++YYCURSOR; - YYDEBUG(446, *YYCURSOR); + YYDEBUG(442, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1246 "Zend/zend_language_scanner.l" +#line 1238 "Zend/zend_language_scanner.l" { return T_OBJECT_CAST; } -#line 5037 "Zend/zend_language_scanner.c" -yy447: - YYDEBUG(447, *YYCURSOR); +#line 4946 "Zend/zend_language_scanner.c" +yy443: + YYDEBUG(443, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy457; - if (yych == 'n') goto yy457; + if (yych == 'N') goto yy453; + if (yych == 'n') goto yy453; goto yy194; -yy448: - YYDEBUG(448, *YYCURSOR); +yy444: + YYDEBUG(444, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy449; + if (yych == 'O') goto yy445; if (yych != 'o') goto yy194; -yy449: - YYDEBUG(449, *YYCURSOR); +yy445: + YYDEBUG(445, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy450; + if (yych == 'L') goto yy446; if (yych != 'l') goto yy194; -yy450: - YYDEBUG(450, *YYCURSOR); +yy446: + YYDEBUG(446, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy455; - if (yych == 'e') goto yy455; - goto yy452; -yy451: - YYDEBUG(451, *YYCURSOR); + if (yych == 'E') goto yy451; + if (yych == 'e') goto yy451; + goto yy448; +yy447: + YYDEBUG(447, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy452: - YYDEBUG(452, *YYCURSOR); +yy448: + YYDEBUG(448, *YYCURSOR); if (yych <= 0x1F) { - if (yych == '\t') goto yy451; + if (yych == '\t') goto yy447; goto yy194; } else { - if (yych <= ' ') goto yy451; + if (yych <= ' ') goto yy447; if (yych != ')') goto yy194; } - YYDEBUG(453, *YYCURSOR); + YYDEBUG(449, *YYCURSOR); ++YYCURSOR; - YYDEBUG(454, *YYCURSOR); + YYDEBUG(450, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1250 "Zend/zend_language_scanner.l" +#line 1242 "Zend/zend_language_scanner.l" { return T_BOOL_CAST; } -#line 5082 "Zend/zend_language_scanner.c" -yy455: - YYDEBUG(455, *YYCURSOR); +#line 4991 "Zend/zend_language_scanner.c" +yy451: + YYDEBUG(451, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy456; + if (yych == 'A') goto yy452; if (yych != 'a') goto yy194; -yy456: - YYDEBUG(456, *YYCURSOR); +yy452: + YYDEBUG(452, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy451; - if (yych == 'n') goto yy451; + if (yych == 'N') goto yy447; + if (yych == 'n') goto yy447; goto yy194; -yy457: - YYDEBUG(457, *YYCURSOR); +yy453: + YYDEBUG(453, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy458; + if (yych == 'A') goto yy454; if (yych != 'a') goto yy194; -yy458: - YYDEBUG(458, *YYCURSOR); +yy454: + YYDEBUG(454, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy459; + if (yych == 'R') goto yy455; if (yych != 'r') goto yy194; -yy459: - YYDEBUG(459, *YYCURSOR); +yy455: + YYDEBUG(455, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'Y') goto yy428; - if (yych == 'y') goto yy428; + if (yych == 'Y') goto yy424; + if (yych == 'y') goto yy424; goto yy194; -yy460: - YYDEBUG(460, *YYCURSOR); +yy456: + YYDEBUG(456, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'S') goto yy461; + if (yych == 'S') goto yy457; if (yych != 's') goto yy194; -yy461: - YYDEBUG(461, *YYCURSOR); +yy457: + YYDEBUG(457, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy462; + if (yych == 'E') goto yy458; if (yych != 'e') goto yy194; -yy462: - YYDEBUG(462, *YYCURSOR); +yy458: + YYDEBUG(458, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy463; + if (yych == 'T') goto yy459; if (yych != 't') goto yy194; -yy463: - YYDEBUG(463, *YYCURSOR); +yy459: + YYDEBUG(459, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(464, *YYCURSOR); + YYDEBUG(460, *YYCURSOR); if (yych <= 0x1F) { - if (yych == '\t') goto yy463; + if (yych == '\t') goto yy459; goto yy194; } else { - if (yych <= ' ') goto yy463; + if (yych <= ' ') goto yy459; if (yych != ')') goto yy194; } - YYDEBUG(465, *YYCURSOR); + YYDEBUG(461, *YYCURSOR); ++YYCURSOR; - YYDEBUG(466, *YYCURSOR); + YYDEBUG(462, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1254 "Zend/zend_language_scanner.l" +#line 1246 "Zend/zend_language_scanner.l" { return T_UNSET_CAST; } -#line 5146 "Zend/zend_language_scanner.c" -yy467: - YYDEBUG(467, *YYCURSOR); +#line 5055 "Zend/zend_language_scanner.c" +yy463: + YYDEBUG(463, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy468; + if (yych == 'R') goto yy464; if (yych != 'r') goto yy187; -yy468: - YYDEBUG(468, *YYCURSOR); +yy464: + YYDEBUG(464, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(469, *YYCURSOR); + YYDEBUG(465, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1226 "Zend/zend_language_scanner.l" +#line 1218 "Zend/zend_language_scanner.l" { return T_VAR; } -#line 5164 "Zend/zend_language_scanner.c" -yy470: - YYDEBUG(470, *YYCURSOR); +#line 5073 "Zend/zend_language_scanner.c" +yy466: + YYDEBUG(466, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'M') goto yy474; - if (yych == 'm') goto yy474; + if (yych == 'M') goto yy470; + if (yych == 'm') goto yy470; goto yy187; -yy471: - YYDEBUG(471, *YYCURSOR); +yy467: + YYDEBUG(467, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'W') goto yy472; + if (yych == 'W') goto yy468; if (yych != 'w') goto yy187; -yy472: - YYDEBUG(472, *YYCURSOR); +yy468: + YYDEBUG(468, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(473, *YYCURSOR); + YYDEBUG(469, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1218 "Zend/zend_language_scanner.l" +#line 1210 "Zend/zend_language_scanner.l" { return T_NEW; } -#line 5188 "Zend/zend_language_scanner.c" -yy474: - YYDEBUG(474, *YYCURSOR); +#line 5097 "Zend/zend_language_scanner.c" +yy470: + YYDEBUG(470, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy475; + if (yych == 'E') goto yy471; if (yych != 'e') goto yy187; -yy475: - YYDEBUG(475, *YYCURSOR); +yy471: + YYDEBUG(471, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'S') goto yy476; + if (yych == 'S') goto yy472; if (yych != 's') goto yy187; -yy476: - YYDEBUG(476, *YYCURSOR); +yy472: + YYDEBUG(472, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'P') goto yy477; + if (yych == 'P') goto yy473; if (yych != 'p') goto yy187; -yy477: - YYDEBUG(477, *YYCURSOR); +yy473: + YYDEBUG(473, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy478; + if (yych == 'A') goto yy474; if (yych != 'a') goto yy187; -yy478: - YYDEBUG(478, *YYCURSOR); +yy474: + YYDEBUG(474, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy479; + if (yych == 'C') goto yy475; if (yych != 'c') goto yy187; -yy479: - YYDEBUG(479, *YYCURSOR); +yy475: + YYDEBUG(475, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy480; + if (yych == 'E') goto yy476; if (yych != 'e') goto yy187; -yy480: - YYDEBUG(480, *YYCURSOR); +yy476: + YYDEBUG(476, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(481, *YYCURSOR); + YYDEBUG(477, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1278 "Zend/zend_language_scanner.l" +#line 1270 "Zend/zend_language_scanner.l" { return T_NAMESPACE; } -#line 5231 "Zend/zend_language_scanner.c" +#line 5140 "Zend/zend_language_scanner.c" +yy478: + YYDEBUG(478, *YYCURSOR); + yyaccept = 3; + YYMARKER = ++YYCURSOR; + YYFILL(3); + yych = *YYCURSOR; + YYDEBUG(479, *YYCURSOR); + if (yych <= 'D') { + if (yych <= '/') goto yy190; + if (yych <= '9') goto yy478; + goto yy190; + } else { + if (yych <= 'E') goto yy193; + if (yych == 'e') goto yy193; + goto yy190; + } +yy480: + YYDEBUG(480, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(481, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1390 "Zend/zend_language_scanner.l" + { + return T_CONCAT_EQUAL; +} +#line 5166 "Zend/zend_language_scanner.c" yy482: YYDEBUG(482, *YYCURSOR); - ++YYCURSOR; + yych = *++YYCURSOR; + if (yych != '.') goto yy194; YYDEBUG(483, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(484, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1210 "Zend/zend_language_scanner.l" +#line 1206 "Zend/zend_language_scanner.l" + { + return T_ELLIPSIS; +} +#line 5179 "Zend/zend_language_scanner.c" +yy485: + YYDEBUG(485, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(486, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1198 "Zend/zend_language_scanner.l" { return T_PAAMAYIM_NEKUDOTAYIM; } -#line 5241 "Zend/zend_language_scanner.c" -yy484: - YYDEBUG(484, *YYCURSOR); +#line 5189 "Zend/zend_language_scanner.c" +yy487: + YYDEBUG(487, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy485: - YYDEBUG(485, *YYCURSOR); +yy488: + YYDEBUG(488, *YYCURSOR); if (yych <= '\f') { if (yych <= 0x08) goto yy141; - if (yych <= '\n') goto yy484; + if (yych <= '\n') goto yy487; goto yy141; } else { - if (yych <= '\r') goto yy484; - if (yych == ' ') goto yy484; + if (yych <= '\r') goto yy487; + if (yych == ' ') goto yy487; goto yy141; } -yy486: - YYDEBUG(486, *YYCURSOR); +yy489: + YYDEBUG(489, *YYCURSOR); ++YYCURSOR; - YYDEBUG(487, *YYCURSOR); + YYDEBUG(490, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1386 "Zend/zend_language_scanner.l" +#line 1378 "Zend/zend_language_scanner.l" { return T_MINUS_EQUAL; } -#line 5267 "Zend/zend_language_scanner.c" -yy488: - YYDEBUG(488, *YYCURSOR); +#line 5215 "Zend/zend_language_scanner.c" +yy491: + YYDEBUG(491, *YYCURSOR); ++YYCURSOR; - YYDEBUG(489, *YYCURSOR); + YYDEBUG(492, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1354 "Zend/zend_language_scanner.l" +#line 1346 "Zend/zend_language_scanner.l" { return T_DEC; } -#line 5277 "Zend/zend_language_scanner.c" -yy490: - YYDEBUG(490, *YYCURSOR); +#line 5225 "Zend/zend_language_scanner.c" +yy493: + YYDEBUG(493, *YYCURSOR); ++YYCURSOR; - YYDEBUG(491, *YYCURSOR); + YYDEBUG(494, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1180 "Zend/zend_language_scanner.l" +#line 1170 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); return T_OBJECT_OPERATOR; } -#line 5288 "Zend/zend_language_scanner.c" -yy492: - YYDEBUG(492, *YYCURSOR); +#line 5236 "Zend/zend_language_scanner.c" +yy495: + YYDEBUG(495, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'O') { - if (yych == 'I') goto yy499; + if (yych == 'I') goto yy502; if (yych <= 'N') goto yy187; - goto yy500; + goto yy503; } else { if (yych <= 'i') { if (yych <= 'h') goto yy187; - goto yy499; + goto yy502; } else { - if (yych == 'o') goto yy500; + if (yych == 'o') goto yy503; goto yy187; } } -yy493: - YYDEBUG(493, *YYCURSOR); +yy496: + YYDEBUG(496, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'B') goto yy494; + if (yych == 'B') goto yy497; if (yych != 'b') goto yy187; -yy494: - YYDEBUG(494, *YYCURSOR); +yy497: + YYDEBUG(497, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy495; + if (yych == 'L') goto yy498; if (yych != 'l') goto yy187; -yy495: - YYDEBUG(495, *YYCURSOR); +yy498: + YYDEBUG(498, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy496; + if (yych == 'I') goto yy499; if (yych != 'i') goto yy187; -yy496: - YYDEBUG(496, *YYCURSOR); +yy499: + YYDEBUG(499, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy497; + if (yych == 'C') goto yy500; if (yych != 'c') goto yy187; -yy497: - YYDEBUG(497, *YYCURSOR); +yy500: + YYDEBUG(500, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(498, *YYCURSOR); + YYDEBUG(501, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1326 "Zend/zend_language_scanner.l" +#line 1318 "Zend/zend_language_scanner.l" { return T_PUBLIC; } -#line 5337 "Zend/zend_language_scanner.c" -yy499: - YYDEBUG(499, *YYCURSOR); +#line 5285 "Zend/zend_language_scanner.c" +yy502: + YYDEBUG(502, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'V') { - if (yych == 'N') goto yy508; + if (yych == 'N') goto yy511; if (yych <= 'U') goto yy187; - goto yy509; + goto yy512; } else { if (yych <= 'n') { if (yych <= 'm') goto yy187; - goto yy508; + goto yy511; } else { - if (yych == 'v') goto yy509; + if (yych == 'v') goto yy512; goto yy187; } } -yy500: - YYDEBUG(500, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy501; - if (yych != 't') goto yy187; -yy501: - YYDEBUG(501, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy502; - if (yych != 'e') goto yy187; -yy502: - YYDEBUG(502, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'C') goto yy503; - if (yych != 'c') goto yy187; yy503: YYDEBUG(503, *YYCURSOR); yych = *++YYCURSOR; @@ -5378,1112 +5311,1112 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy505: YYDEBUG(505, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'D') goto yy506; - if (yych != 'd') goto yy187; + if (yych == 'C') goto yy506; + if (yych != 'c') goto yy187; yy506: YYDEBUG(506, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy507; + if (yych != 't') goto yy187; +yy507: + YYDEBUG(507, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy508; + if (yych != 'e') goto yy187; +yy508: + YYDEBUG(508, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'D') goto yy509; + if (yych != 'd') goto yy187; +yy509: + YYDEBUG(509, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(507, *YYCURSOR); + YYDEBUG(510, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1322 "Zend/zend_language_scanner.l" +#line 1314 "Zend/zend_language_scanner.l" { return T_PROTECTED; } -#line 5396 "Zend/zend_language_scanner.c" -yy508: - YYDEBUG(508, *YYCURSOR); +#line 5344 "Zend/zend_language_scanner.c" +yy511: + YYDEBUG(511, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy514; - if (yych == 't') goto yy514; + if (yych == 'T') goto yy517; + if (yych == 't') goto yy517; goto yy187; -yy509: - YYDEBUG(509, *YYCURSOR); +yy512: + YYDEBUG(512, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy510; + if (yych == 'A') goto yy513; if (yych != 'a') goto yy187; -yy510: - YYDEBUG(510, *YYCURSOR); +yy513: + YYDEBUG(513, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy511; + if (yych == 'T') goto yy514; if (yych != 't') goto yy187; -yy511: - YYDEBUG(511, *YYCURSOR); +yy514: + YYDEBUG(514, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy512; + if (yych == 'E') goto yy515; if (yych != 'e') goto yy187; -yy512: - YYDEBUG(512, *YYCURSOR); +yy515: + YYDEBUG(515, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(513, *YYCURSOR); + YYDEBUG(516, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1318 "Zend/zend_language_scanner.l" +#line 1310 "Zend/zend_language_scanner.l" { return T_PRIVATE; } -#line 5430 "Zend/zend_language_scanner.c" -yy514: - YYDEBUG(514, *YYCURSOR); +#line 5378 "Zend/zend_language_scanner.c" +yy517: + YYDEBUG(517, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(515, *YYCURSOR); + YYDEBUG(518, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1156 "Zend/zend_language_scanner.l" +#line 1146 "Zend/zend_language_scanner.l" { return T_PRINT; } -#line 5443 "Zend/zend_language_scanner.c" -yy516: - YYDEBUG(516, *YYCURSOR); +#line 5391 "Zend/zend_language_scanner.c" +yy519: + YYDEBUG(519, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy521; - if (yych == 'o') goto yy521; + if (yych == 'O') goto yy524; + if (yych == 'o') goto yy524; goto yy187; -yy517: - YYDEBUG(517, *YYCURSOR); +yy520: + YYDEBUG(520, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy518; + if (yych == 'T') goto yy521; if (yych != 't') goto yy187; -yy518: - YYDEBUG(518, *YYCURSOR); +yy521: + YYDEBUG(521, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy519; + if (yych == 'O') goto yy522; if (yych != 'o') goto yy187; -yy519: - YYDEBUG(519, *YYCURSOR); +yy522: + YYDEBUG(522, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(520, *YYCURSOR); + YYDEBUG(523, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1148 "Zend/zend_language_scanner.l" +#line 1138 "Zend/zend_language_scanner.l" { return T_GOTO; } -#line 5472 "Zend/zend_language_scanner.c" -yy521: - YYDEBUG(521, *YYCURSOR); +#line 5420 "Zend/zend_language_scanner.c" +yy524: + YYDEBUG(524, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'B') goto yy522; + if (yych == 'B') goto yy525; if (yych != 'b') goto yy187; -yy522: - YYDEBUG(522, *YYCURSOR); +yy525: + YYDEBUG(525, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy523; + if (yych == 'A') goto yy526; if (yych != 'a') goto yy187; -yy523: - YYDEBUG(523, *YYCURSOR); +yy526: + YYDEBUG(526, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy524; + if (yych == 'L') goto yy527; if (yych != 'l') goto yy187; -yy524: - YYDEBUG(524, *YYCURSOR); +yy527: + YYDEBUG(527, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(525, *YYCURSOR); + YYDEBUG(528, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1290 "Zend/zend_language_scanner.l" +#line 1282 "Zend/zend_language_scanner.l" { return T_GLOBAL; } -#line 5500 "Zend/zend_language_scanner.c" -yy526: - YYDEBUG(526, *YYCURSOR); +#line 5448 "Zend/zend_language_scanner.c" +yy529: + YYDEBUG(529, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '<') goto yy534; + if (yych == '<') goto yy537; goto yy194; -yy527: - YYDEBUG(527, *YYCURSOR); +yy530: + YYDEBUG(530, *YYCURSOR); yych = *++YYCURSOR; goto yy181; -yy528: - YYDEBUG(528, *YYCURSOR); +yy531: + YYDEBUG(531, *YYCURSOR); yych = *++YYCURSOR; goto yy179; -yy529: - YYDEBUG(529, *YYCURSOR); +yy532: + YYDEBUG(532, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy530; + if (yych == 'E') goto yy533; if (yych != 'e') goto yy187; -yy530: - YYDEBUG(530, *YYCURSOR); +yy533: + YYDEBUG(533, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy531; + if (yych == 'A') goto yy534; if (yych != 'a') goto yy187; -yy531: - YYDEBUG(531, *YYCURSOR); +yy534: + YYDEBUG(534, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'K') goto yy532; + if (yych == 'K') goto yy535; if (yych != 'k') goto yy187; -yy532: - YYDEBUG(532, *YYCURSOR); +yy535: + YYDEBUG(535, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(533, *YYCURSOR); + YYDEBUG(536, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1140 "Zend/zend_language_scanner.l" +#line 1130 "Zend/zend_language_scanner.l" { return T_BREAK; } -#line 5541 "Zend/zend_language_scanner.c" -yy534: - YYDEBUG(534, *YYCURSOR); +#line 5489 "Zend/zend_language_scanner.c" +yy537: + YYDEBUG(537, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '<') goto yy270; + if (yych == '<') goto yy266; goto yy194; -yy535: - YYDEBUG(535, *YYCURSOR); +yy538: + YYDEBUG(538, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy542; - if (yych == 'a') goto yy542; + if (yych == 'A') goto yy545; + if (yych == 'a') goto yy545; goto yy187; -yy536: - YYDEBUG(536, *YYCURSOR); +yy539: + YYDEBUG(539, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy537; + if (yych == 'I') goto yy540; if (yych != 'i') goto yy187; -yy537: - YYDEBUG(537, *YYCURSOR); +yy540: + YYDEBUG(540, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy538; + if (yych == 'T') goto yy541; if (yych != 't') goto yy187; -yy538: - YYDEBUG(538, *YYCURSOR); +yy541: + YYDEBUG(541, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy539; + if (yych == 'C') goto yy542; if (yych != 'c') goto yy187; -yy539: - YYDEBUG(539, *YYCURSOR); +yy542: + YYDEBUG(542, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'H') goto yy540; + if (yych == 'H') goto yy543; if (yych != 'h') goto yy187; -yy540: - YYDEBUG(540, *YYCURSOR); +yy543: + YYDEBUG(543, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(541, *YYCURSOR); + YYDEBUG(544, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1124 "Zend/zend_language_scanner.l" +#line 1114 "Zend/zend_language_scanner.l" { return T_SWITCH; } -#line 5585 "Zend/zend_language_scanner.c" -yy542: - YYDEBUG(542, *YYCURSOR); +#line 5533 "Zend/zend_language_scanner.c" +yy545: + YYDEBUG(545, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy543; + if (yych == 'T') goto yy546; if (yych != 't') goto yy187; -yy543: - YYDEBUG(543, *YYCURSOR); +yy546: + YYDEBUG(546, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy544; + if (yych == 'I') goto yy547; if (yych != 'i') goto yy187; -yy544: - YYDEBUG(544, *YYCURSOR); +yy547: + YYDEBUG(547, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy545; + if (yych == 'C') goto yy548; if (yych != 'c') goto yy187; -yy545: - YYDEBUG(545, *YYCURSOR); +yy548: + YYDEBUG(548, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(546, *YYCURSOR); + YYDEBUG(549, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1306 "Zend/zend_language_scanner.l" +#line 1298 "Zend/zend_language_scanner.l" { return T_STATIC; } -#line 5613 "Zend/zend_language_scanner.c" -yy547: - YYDEBUG(547, *YYCURSOR); +#line 5561 "Zend/zend_language_scanner.c" +yy550: + YYDEBUG(550, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'S') goto yy558; - if (yych == 's') goto yy558; + if (yych == 'S') goto yy561; + if (yych == 's') goto yy561; goto yy187; -yy548: - YYDEBUG(548, *YYCURSOR); +yy551: + YYDEBUG(551, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'D') goto yy556; - if (yych == 'd') goto yy556; + if (yych == 'D') goto yy559; + if (yych == 'd') goto yy559; goto yy187; -yy549: - YYDEBUG(549, *YYCURSOR); +yy552: + YYDEBUG(552, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy552; - if (yych == 'r') goto yy552; + if (yych == 'R') goto yy555; + if (yych == 'r') goto yy555; goto yy187; -yy550: - YYDEBUG(550, *YYCURSOR); +yy553: + YYDEBUG(553, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(551, *YYCURSOR); + YYDEBUG(554, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1120 "Zend/zend_language_scanner.l" +#line 1110 "Zend/zend_language_scanner.l" { return T_AS; } -#line 5644 "Zend/zend_language_scanner.c" -yy552: - YYDEBUG(552, *YYCURSOR); +#line 5592 "Zend/zend_language_scanner.c" +yy555: + YYDEBUG(555, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy553; + if (yych == 'A') goto yy556; if (yych != 'a') goto yy187; -yy553: - YYDEBUG(553, *YYCURSOR); +yy556: + YYDEBUG(556, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'Y') goto yy554; + if (yych == 'Y') goto yy557; if (yych != 'y') goto yy187; -yy554: - YYDEBUG(554, *YYCURSOR); +yy557: + YYDEBUG(557, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(555, *YYCURSOR); + YYDEBUG(558, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1342 "Zend/zend_language_scanner.l" +#line 1334 "Zend/zend_language_scanner.l" { return T_ARRAY; } -#line 5667 "Zend/zend_language_scanner.c" -yy556: - YYDEBUG(556, *YYCURSOR); +#line 5615 "Zend/zend_language_scanner.c" +yy559: + YYDEBUG(559, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(557, *YYCURSOR); + YYDEBUG(560, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1438 "Zend/zend_language_scanner.l" +#line 1430 "Zend/zend_language_scanner.l" { return T_LOGICAL_AND; } -#line 5680 "Zend/zend_language_scanner.c" -yy558: - YYDEBUG(558, *YYCURSOR); +#line 5628 "Zend/zend_language_scanner.c" +yy561: + YYDEBUG(561, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy559; + if (yych == 'T') goto yy562; if (yych != 't') goto yy187; -yy559: - YYDEBUG(559, *YYCURSOR); +yy562: + YYDEBUG(562, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy560; + if (yych == 'R') goto yy563; if (yych != 'r') goto yy187; -yy560: - YYDEBUG(560, *YYCURSOR); +yy563: + YYDEBUG(563, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy561; + if (yych == 'A') goto yy564; if (yych != 'a') goto yy187; -yy561: - YYDEBUG(561, *YYCURSOR); +yy564: + YYDEBUG(564, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy562; + if (yych == 'C') goto yy565; if (yych != 'c') goto yy187; -yy562: - YYDEBUG(562, *YYCURSOR); +yy565: + YYDEBUG(565, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy563; + if (yych == 'T') goto yy566; if (yych != 't') goto yy187; -yy563: - YYDEBUG(563, *YYCURSOR); +yy566: + YYDEBUG(566, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(564, *YYCURSOR); + YYDEBUG(567, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1310 "Zend/zend_language_scanner.l" +#line 1302 "Zend/zend_language_scanner.l" { return T_ABSTRACT; } -#line 5718 "Zend/zend_language_scanner.c" -yy565: - YYDEBUG(565, *YYCURSOR); +#line 5666 "Zend/zend_language_scanner.c" +yy568: + YYDEBUG(568, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy566; + if (yych == 'I') goto yy569; if (yych != 'i') goto yy187; -yy566: - YYDEBUG(566, *YYCURSOR); +yy569: + YYDEBUG(569, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy567; + if (yych == 'L') goto yy570; if (yych != 'l') goto yy187; -yy567: - YYDEBUG(567, *YYCURSOR); +yy570: + YYDEBUG(570, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy568; + if (yych == 'E') goto yy571; if (yych != 'e') goto yy187; -yy568: - YYDEBUG(568, *YYCURSOR); +yy571: + YYDEBUG(571, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(569, *YYCURSOR); + YYDEBUG(572, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1080 "Zend/zend_language_scanner.l" +#line 1070 "Zend/zend_language_scanner.l" { return T_WHILE; } -#line 5746 "Zend/zend_language_scanner.c" -yy570: - YYDEBUG(570, *YYCURSOR); +#line 5694 "Zend/zend_language_scanner.c" +yy573: + YYDEBUG(573, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(571, *YYCURSOR); + YYDEBUG(574, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1064 "Zend/zend_language_scanner.l" +#line 1054 "Zend/zend_language_scanner.l" { return T_IF; } -#line 5759 "Zend/zend_language_scanner.c" -yy572: - YYDEBUG(572, *YYCURSOR); +#line 5707 "Zend/zend_language_scanner.c" +yy575: + YYDEBUG(575, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'P') goto yy614; - if (yych == 'p') goto yy614; + if (yych == 'P') goto yy617; + if (yych == 'p') goto yy617; goto yy187; -yy573: - YYDEBUG(573, *YYCURSOR); +yy576: + YYDEBUG(576, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'T') { if (yych <= 'C') { if (yych <= 'B') goto yy187; - goto yy581; + goto yy584; } else { if (yych <= 'R') goto yy187; - if (yych <= 'S') goto yy579; - goto yy580; + if (yych <= 'S') goto yy582; + goto yy583; } } else { if (yych <= 'r') { - if (yych == 'c') goto yy581; + if (yych == 'c') goto yy584; goto yy187; } else { - if (yych <= 's') goto yy579; - if (yych <= 't') goto yy580; + if (yych <= 's') goto yy582; + if (yych <= 't') goto yy583; goto yy187; } } -yy574: - YYDEBUG(574, *YYCURSOR); +yy577: + YYDEBUG(577, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'S') goto yy575; + if (yych == 'S') goto yy578; if (yych != 's') goto yy187; -yy575: - YYDEBUG(575, *YYCURSOR); +yy578: + YYDEBUG(578, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy576; + if (yych == 'E') goto yy579; if (yych != 'e') goto yy187; -yy576: - YYDEBUG(576, *YYCURSOR); +yy579: + YYDEBUG(579, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy577; + if (yych == 'T') goto yy580; if (yych != 't') goto yy187; -yy577: - YYDEBUG(577, *YYCURSOR); +yy580: + YYDEBUG(580, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(578, *YYCURSOR); + YYDEBUG(581, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1294 "Zend/zend_language_scanner.l" +#line 1286 "Zend/zend_language_scanner.l" { return T_ISSET; } -#line 5815 "Zend/zend_language_scanner.c" -yy579: - YYDEBUG(579, *YYCURSOR); +#line 5763 "Zend/zend_language_scanner.c" +yy582: + YYDEBUG(582, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy600; - if (yych == 't') goto yy600; + if (yych == 'T') goto yy603; + if (yych == 't') goto yy603; goto yy187; -yy580: - YYDEBUG(580, *YYCURSOR); +yy583: + YYDEBUG(583, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy593; - if (yych == 'e') goto yy593; + if (yych == 'E') goto yy596; + if (yych == 'e') goto yy596; goto yy187; -yy581: - YYDEBUG(581, *YYCURSOR); +yy584: + YYDEBUG(584, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy582; + if (yych == 'L') goto yy585; if (yych != 'l') goto yy187; -yy582: - YYDEBUG(582, *YYCURSOR); +yy585: + YYDEBUG(585, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'U') goto yy583; + if (yych == 'U') goto yy586; if (yych != 'u') goto yy187; -yy583: - YYDEBUG(583, *YYCURSOR); +yy586: + YYDEBUG(586, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'D') goto yy584; + if (yych == 'D') goto yy587; if (yych != 'd') goto yy187; -yy584: - YYDEBUG(584, *YYCURSOR); +yy587: + YYDEBUG(587, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy585; + if (yych == 'E') goto yy588; if (yych != 'e') goto yy187; -yy585: - YYDEBUG(585, *YYCURSOR); +yy588: + YYDEBUG(588, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) <= '^') { if (yych <= '9') { if (yych >= '0') goto yy186; } else { - if (yych <= '@') goto yy586; + if (yych <= '@') goto yy589; if (yych <= 'Z') goto yy186; } } else { if (yych <= '`') { - if (yych <= '_') goto yy587; + if (yych <= '_') goto yy590; } else { if (yych <= 'z') goto yy186; if (yych >= 0x7F) goto yy186; } } -yy586: - YYDEBUG(586, *YYCURSOR); +yy589: + YYDEBUG(589, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1262 "Zend/zend_language_scanner.l" +#line 1254 "Zend/zend_language_scanner.l" { return T_INCLUDE; } -#line 5873 "Zend/zend_language_scanner.c" -yy587: - YYDEBUG(587, *YYCURSOR); +#line 5821 "Zend/zend_language_scanner.c" +yy590: + YYDEBUG(590, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy588; + if (yych == 'O') goto yy591; if (yych != 'o') goto yy187; -yy588: - YYDEBUG(588, *YYCURSOR); +yy591: + YYDEBUG(591, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy589; + if (yych == 'N') goto yy592; if (yych != 'n') goto yy187; -yy589: - YYDEBUG(589, *YYCURSOR); +yy592: + YYDEBUG(592, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy590; + if (yych == 'C') goto yy593; if (yych != 'c') goto yy187; -yy590: - YYDEBUG(590, *YYCURSOR); +yy593: + YYDEBUG(593, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy591; + if (yych == 'E') goto yy594; if (yych != 'e') goto yy187; -yy591: - YYDEBUG(591, *YYCURSOR); +yy594: + YYDEBUG(594, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(592, *YYCURSOR); + YYDEBUG(595, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1266 "Zend/zend_language_scanner.l" +#line 1258 "Zend/zend_language_scanner.l" { return T_INCLUDE_ONCE; } -#line 5906 "Zend/zend_language_scanner.c" -yy593: - YYDEBUG(593, *YYCURSOR); +#line 5854 "Zend/zend_language_scanner.c" +yy596: + YYDEBUG(596, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy594; + if (yych == 'R') goto yy597; if (yych != 'r') goto yy187; -yy594: - YYDEBUG(594, *YYCURSOR); +yy597: + YYDEBUG(597, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'F') goto yy595; + if (yych == 'F') goto yy598; if (yych != 'f') goto yy187; -yy595: - YYDEBUG(595, *YYCURSOR); +yy598: + YYDEBUG(598, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy596; + if (yych == 'A') goto yy599; if (yych != 'a') goto yy187; -yy596: - YYDEBUG(596, *YYCURSOR); +yy599: + YYDEBUG(599, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy597; + if (yych == 'C') goto yy600; if (yych != 'c') goto yy187; -yy597: - YYDEBUG(597, *YYCURSOR); +yy600: + YYDEBUG(600, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy598; + if (yych == 'E') goto yy601; if (yych != 'e') goto yy187; -yy598: - YYDEBUG(598, *YYCURSOR); +yy601: + YYDEBUG(601, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(599, *YYCURSOR); + YYDEBUG(602, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1164 "Zend/zend_language_scanner.l" +#line 1154 "Zend/zend_language_scanner.l" { return T_INTERFACE; } -#line 5944 "Zend/zend_language_scanner.c" -yy600: - YYDEBUG(600, *YYCURSOR); +#line 5892 "Zend/zend_language_scanner.c" +yy603: + YYDEBUG(603, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'E') { - if (yych == 'A') goto yy601; + if (yych == 'A') goto yy604; if (yych <= 'D') goto yy187; - goto yy602; + goto yy605; } else { if (yych <= 'a') { if (yych <= '`') goto yy187; } else { - if (yych == 'e') goto yy602; + if (yych == 'e') goto yy605; goto yy187; } } -yy601: - YYDEBUG(601, *YYCURSOR); +yy604: + YYDEBUG(604, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy608; - if (yych == 'n') goto yy608; + if (yych == 'N') goto yy611; + if (yych == 'n') goto yy611; goto yy187; -yy602: - YYDEBUG(602, *YYCURSOR); +yy605: + YYDEBUG(605, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy603; + if (yych == 'A') goto yy606; if (yych != 'a') goto yy187; -yy603: - YYDEBUG(603, *YYCURSOR); +yy606: + YYDEBUG(606, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'D') goto yy604; + if (yych == 'D') goto yy607; if (yych != 'd') goto yy187; -yy604: - YYDEBUG(604, *YYCURSOR); +yy607: + YYDEBUG(607, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy605; + if (yych == 'O') goto yy608; if (yych != 'o') goto yy187; -yy605: - YYDEBUG(605, *YYCURSOR); +yy608: + YYDEBUG(608, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'F') goto yy606; + if (yych == 'F') goto yy609; if (yych != 'f') goto yy187; -yy606: - YYDEBUG(606, *YYCURSOR); +yy609: + YYDEBUG(609, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(607, *YYCURSOR); + YYDEBUG(610, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1286 "Zend/zend_language_scanner.l" +#line 1278 "Zend/zend_language_scanner.l" { return T_INSTEADOF; } -#line 5998 "Zend/zend_language_scanner.c" -yy608: - YYDEBUG(608, *YYCURSOR); +#line 5946 "Zend/zend_language_scanner.c" +yy611: + YYDEBUG(611, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy609; + if (yych == 'C') goto yy612; if (yych != 'c') goto yy187; -yy609: - YYDEBUG(609, *YYCURSOR); +yy612: + YYDEBUG(612, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy610; + if (yych == 'E') goto yy613; if (yych != 'e') goto yy187; -yy610: - YYDEBUG(610, *YYCURSOR); +yy613: + YYDEBUG(613, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy611; + if (yych == 'O') goto yy614; if (yych != 'o') goto yy187; -yy611: - YYDEBUG(611, *YYCURSOR); +yy614: + YYDEBUG(614, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'F') goto yy612; + if (yych == 'F') goto yy615; if (yych != 'f') goto yy187; -yy612: - YYDEBUG(612, *YYCURSOR); +yy615: + YYDEBUG(615, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(613, *YYCURSOR); + YYDEBUG(616, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1116 "Zend/zend_language_scanner.l" +#line 1106 "Zend/zend_language_scanner.l" { return T_INSTANCEOF; } -#line 6031 "Zend/zend_language_scanner.c" -yy614: - YYDEBUG(614, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'L') goto yy615; - if (yych != 'l') goto yy187; -yy615: - YYDEBUG(615, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy616; - if (yych != 'e') goto yy187; -yy616: - YYDEBUG(616, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'M') goto yy617; - if (yych != 'm') goto yy187; +#line 5979 "Zend/zend_language_scanner.c" yy617: YYDEBUG(617, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy618; - if (yych != 'e') goto yy187; + if (yych == 'L') goto yy618; + if (yych != 'l') goto yy187; yy618: YYDEBUG(618, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy619; - if (yych != 'n') goto yy187; + if (yych == 'E') goto yy619; + if (yych != 'e') goto yy187; yy619: YYDEBUG(619, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy620; - if (yych != 't') goto yy187; + if (yych == 'M') goto yy620; + if (yych != 'm') goto yy187; yy620: YYDEBUG(620, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'S') goto yy621; - if (yych != 's') goto yy187; + if (yych == 'E') goto yy621; + if (yych != 'e') goto yy187; yy621: YYDEBUG(621, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy622; + if (yych != 'n') goto yy187; +yy622: + YYDEBUG(622, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy623; + if (yych != 't') goto yy187; +yy623: + YYDEBUG(623, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy624; + if (yych != 's') goto yy187; +yy624: + YYDEBUG(624, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(622, *YYCURSOR); + YYDEBUG(625, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1176 "Zend/zend_language_scanner.l" +#line 1166 "Zend/zend_language_scanner.l" { return T_IMPLEMENTS; } -#line 6079 "Zend/zend_language_scanner.c" -yy623: - YYDEBUG(623, *YYCURSOR); +#line 6027 "Zend/zend_language_scanner.c" +yy626: + YYDEBUG(626, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy631; - if (yych == 'r') goto yy631; + if (yych == 'R') goto yy634; + if (yych == 'r') goto yy634; goto yy187; -yy624: - YYDEBUG(624, *YYCURSOR); +yy627: + YYDEBUG(627, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'Y') { - if (yych == 'A') goto yy627; + if (yych == 'A') goto yy630; if (yych <= 'X') goto yy187; } else { if (yych <= 'a') { if (yych <= '`') goto yy187; - goto yy627; + goto yy630; } else { if (yych != 'y') goto yy187; } } - YYDEBUG(625, *YYCURSOR); + YYDEBUG(628, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(626, *YYCURSOR); + YYDEBUG(629, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1048 "Zend/zend_language_scanner.l" +#line 1038 "Zend/zend_language_scanner.l" { return T_TRY; } -#line 6111 "Zend/zend_language_scanner.c" -yy627: - YYDEBUG(627, *YYCURSOR); +#line 6059 "Zend/zend_language_scanner.c" +yy630: + YYDEBUG(630, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy628; + if (yych == 'I') goto yy631; if (yych != 'i') goto yy187; -yy628: - YYDEBUG(628, *YYCURSOR); +yy631: + YYDEBUG(631, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy629; + if (yych == 'T') goto yy632; if (yych != 't') goto yy187; -yy629: - YYDEBUG(629, *YYCURSOR); +yy632: + YYDEBUG(632, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(630, *YYCURSOR); + YYDEBUG(633, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1168 "Zend/zend_language_scanner.l" +#line 1158 "Zend/zend_language_scanner.l" { return T_TRAIT; } -#line 6134 "Zend/zend_language_scanner.c" -yy631: - YYDEBUG(631, *YYCURSOR); +#line 6082 "Zend/zend_language_scanner.c" +yy634: + YYDEBUG(634, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy632; + if (yych == 'O') goto yy635; if (yych != 'o') goto yy187; -yy632: - YYDEBUG(632, *YYCURSOR); +yy635: + YYDEBUG(635, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'W') goto yy633; + if (yych == 'W') goto yy636; if (yych != 'w') goto yy187; -yy633: - YYDEBUG(633, *YYCURSOR); +yy636: + YYDEBUG(636, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(634, *YYCURSOR); + YYDEBUG(637, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1060 "Zend/zend_language_scanner.l" +#line 1050 "Zend/zend_language_scanner.l" { return T_THROW; } -#line 6157 "Zend/zend_language_scanner.c" -yy635: - YYDEBUG(635, *YYCURSOR); +#line 6105 "Zend/zend_language_scanner.c" +yy638: + YYDEBUG(638, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy636; + if (yych == 'E') goto yy639; if (yych != 'e') goto yy187; -yy636: - YYDEBUG(636, *YYCURSOR); +yy639: + YYDEBUG(639, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy637; + if (yych == 'L') goto yy640; if (yych != 'l') goto yy187; -yy637: - YYDEBUG(637, *YYCURSOR); +yy640: + YYDEBUG(640, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'D') goto yy638; + if (yych == 'D') goto yy641; if (yych != 'd') goto yy187; -yy638: - YYDEBUG(638, *YYCURSOR); +yy641: + YYDEBUG(641, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(639, *YYCURSOR); + YYDEBUG(642, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1044 "Zend/zend_language_scanner.l" +#line 1034 "Zend/zend_language_scanner.l" { return T_YIELD; } -#line 6185 "Zend/zend_language_scanner.c" -yy640: - YYDEBUG(640, *YYCURSOR); +#line 6133 "Zend/zend_language_scanner.c" +yy643: + YYDEBUG(643, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'T') { - if (yych == 'Q') goto yy642; + if (yych == 'Q') goto yy645; if (yych <= 'S') goto yy187; } else { if (yych <= 'q') { if (yych <= 'p') goto yy187; - goto yy642; + goto yy645; } else { if (yych != 't') goto yy187; } } - YYDEBUG(641, *YYCURSOR); + YYDEBUG(644, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'U') goto yy654; - if (yych == 'u') goto yy654; + if (yych == 'U') goto yy657; + if (yych == 'u') goto yy657; goto yy187; -yy642: - YYDEBUG(642, *YYCURSOR); +yy645: + YYDEBUG(645, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'U') goto yy643; + if (yych == 'U') goto yy646; if (yych != 'u') goto yy187; -yy643: - YYDEBUG(643, *YYCURSOR); +yy646: + YYDEBUG(646, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy644; + if (yych == 'I') goto yy647; if (yych != 'i') goto yy187; -yy644: - YYDEBUG(644, *YYCURSOR); +yy647: + YYDEBUG(647, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy645; + if (yych == 'R') goto yy648; if (yych != 'r') goto yy187; -yy645: - YYDEBUG(645, *YYCURSOR); +yy648: + YYDEBUG(648, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy646; + if (yych == 'E') goto yy649; if (yych != 'e') goto yy187; -yy646: - YYDEBUG(646, *YYCURSOR); +yy649: + YYDEBUG(649, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) <= '^') { if (yych <= '9') { if (yych >= '0') goto yy186; } else { - if (yych <= '@') goto yy647; + if (yych <= '@') goto yy650; if (yych <= 'Z') goto yy186; } } else { if (yych <= '`') { - if (yych <= '_') goto yy648; + if (yych <= '_') goto yy651; } else { if (yych <= 'z') goto yy186; if (yych >= 0x7F) goto yy186; } } -yy647: - YYDEBUG(647, *YYCURSOR); +yy650: + YYDEBUG(650, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1270 "Zend/zend_language_scanner.l" +#line 1262 "Zend/zend_language_scanner.l" { return T_REQUIRE; } -#line 6250 "Zend/zend_language_scanner.c" -yy648: - YYDEBUG(648, *YYCURSOR); +#line 6198 "Zend/zend_language_scanner.c" +yy651: + YYDEBUG(651, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy649; + if (yych == 'O') goto yy652; if (yych != 'o') goto yy187; -yy649: - YYDEBUG(649, *YYCURSOR); +yy652: + YYDEBUG(652, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy650; + if (yych == 'N') goto yy653; if (yych != 'n') goto yy187; -yy650: - YYDEBUG(650, *YYCURSOR); +yy653: + YYDEBUG(653, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy651; + if (yych == 'C') goto yy654; if (yych != 'c') goto yy187; -yy651: - YYDEBUG(651, *YYCURSOR); +yy654: + YYDEBUG(654, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy652; + if (yych == 'E') goto yy655; if (yych != 'e') goto yy187; -yy652: - YYDEBUG(652, *YYCURSOR); +yy655: + YYDEBUG(655, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(653, *YYCURSOR); + YYDEBUG(656, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1274 "Zend/zend_language_scanner.l" +#line 1266 "Zend/zend_language_scanner.l" { return T_REQUIRE_ONCE; } -#line 6283 "Zend/zend_language_scanner.c" -yy654: - YYDEBUG(654, *YYCURSOR); +#line 6231 "Zend/zend_language_scanner.c" +yy657: + YYDEBUG(657, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy655; + if (yych == 'R') goto yy658; if (yych != 'r') goto yy187; -yy655: - YYDEBUG(655, *YYCURSOR); +yy658: + YYDEBUG(658, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy656; + if (yych == 'N') goto yy659; if (yych != 'n') goto yy187; -yy656: - YYDEBUG(656, *YYCURSOR); +yy659: + YYDEBUG(659, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(657, *YYCURSOR); + YYDEBUG(660, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1040 "Zend/zend_language_scanner.l" +#line 1030 "Zend/zend_language_scanner.l" { return T_RETURN; } -#line 6306 "Zend/zend_language_scanner.c" -yy658: - YYDEBUG(658, *YYCURSOR); +#line 6254 "Zend/zend_language_scanner.c" +yy661: + YYDEBUG(661, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'T') { if (yych <= 'L') { if (yych <= 'K') goto yy187; - goto yy681; + goto yy684; } else { if (yych <= 'R') goto yy187; - if (yych <= 'S') goto yy680; - goto yy679; + if (yych <= 'S') goto yy683; + goto yy682; } } else { if (yych <= 'r') { - if (yych == 'l') goto yy681; + if (yych == 'l') goto yy684; goto yy187; } else { - if (yych <= 's') goto yy680; - if (yych <= 't') goto yy679; + if (yych <= 's') goto yy683; + if (yych <= 't') goto yy682; goto yy187; } } -yy659: - YYDEBUG(659, *YYCURSOR); +yy662: + YYDEBUG(662, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'O') { - if (yych == 'A') goto yy671; + if (yych == 'A') goto yy674; if (yych <= 'N') goto yy187; - goto yy672; + goto yy675; } else { if (yych <= 'a') { if (yych <= '`') goto yy187; - goto yy671; + goto yy674; } else { - if (yych == 'o') goto yy672; + if (yych == 'o') goto yy675; goto yy187; } } -yy660: - YYDEBUG(660, *YYCURSOR); +yy663: + YYDEBUG(663, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy661; + if (yych == 'N') goto yy664; if (yych != 'n') goto yy187; -yy661: - YYDEBUG(661, *YYCURSOR); +yy664: + YYDEBUG(664, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'T') { if (yych <= 'R') goto yy187; - if (yych >= 'T') goto yy663; + if (yych >= 'T') goto yy666; } else { if (yych <= 'r') goto yy187; - if (yych <= 's') goto yy662; - if (yych <= 't') goto yy663; + if (yych <= 's') goto yy665; + if (yych <= 't') goto yy666; goto yy187; } -yy662: - YYDEBUG(662, *YYCURSOR); +yy665: + YYDEBUG(665, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy669; - if (yych == 't') goto yy669; + if (yych == 'T') goto yy672; + if (yych == 't') goto yy672; goto yy187; -yy663: - YYDEBUG(663, *YYCURSOR); +yy666: + YYDEBUG(666, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy664; + if (yych == 'I') goto yy667; if (yych != 'i') goto yy187; -yy664: - YYDEBUG(664, *YYCURSOR); +yy667: + YYDEBUG(667, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy665; + if (yych == 'N') goto yy668; if (yych != 'n') goto yy187; -yy665: - YYDEBUG(665, *YYCURSOR); +yy668: + YYDEBUG(668, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'U') goto yy666; + if (yych == 'U') goto yy669; if (yych != 'u') goto yy187; -yy666: - YYDEBUG(666, *YYCURSOR); +yy669: + YYDEBUG(669, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy667; + if (yych == 'E') goto yy670; if (yych != 'e') goto yy187; -yy667: - YYDEBUG(667, *YYCURSOR); +yy670: + YYDEBUG(670, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(668, *YYCURSOR); + YYDEBUG(671, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1144 "Zend/zend_language_scanner.l" +#line 1134 "Zend/zend_language_scanner.l" { return T_CONTINUE; } -#line 6400 "Zend/zend_language_scanner.c" -yy669: - YYDEBUG(669, *YYCURSOR); +#line 6348 "Zend/zend_language_scanner.c" +yy672: + YYDEBUG(672, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(670, *YYCURSOR); + YYDEBUG(673, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1036 "Zend/zend_language_scanner.l" +#line 1026 "Zend/zend_language_scanner.l" { return T_CONST; } -#line 6413 "Zend/zend_language_scanner.c" -yy671: - YYDEBUG(671, *YYCURSOR); +#line 6361 "Zend/zend_language_scanner.c" +yy674: + YYDEBUG(674, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'S') goto yy676; - if (yych == 's') goto yy676; + if (yych == 'S') goto yy679; + if (yych == 's') goto yy679; goto yy187; -yy672: - YYDEBUG(672, *YYCURSOR); +yy675: + YYDEBUG(675, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy673; + if (yych == 'N') goto yy676; if (yych != 'n') goto yy187; -yy673: - YYDEBUG(673, *YYCURSOR); +yy676: + YYDEBUG(676, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy674; + if (yych == 'E') goto yy677; if (yych != 'e') goto yy187; -yy674: - YYDEBUG(674, *YYCURSOR); +yy677: + YYDEBUG(677, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(675, *YYCURSOR); + YYDEBUG(678, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1222 "Zend/zend_language_scanner.l" +#line 1214 "Zend/zend_language_scanner.l" { return T_CLONE; } -#line 6442 "Zend/zend_language_scanner.c" -yy676: - YYDEBUG(676, *YYCURSOR); +#line 6390 "Zend/zend_language_scanner.c" +yy679: + YYDEBUG(679, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'S') goto yy677; + if (yych == 'S') goto yy680; if (yych != 's') goto yy187; -yy677: - YYDEBUG(677, *YYCURSOR); +yy680: + YYDEBUG(680, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(678, *YYCURSOR); + YYDEBUG(681, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1160 "Zend/zend_language_scanner.l" +#line 1150 "Zend/zend_language_scanner.l" { return T_CLASS; } -#line 6460 "Zend/zend_language_scanner.c" -yy679: - YYDEBUG(679, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'C') goto yy690; - if (yych == 'c') goto yy690; - goto yy187; -yy680: - YYDEBUG(680, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy688; - if (yych == 'e') goto yy688; - goto yy187; -yy681: - YYDEBUG(681, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'L') goto yy682; - if (yych != 'l') goto yy187; +#line 6408 "Zend/zend_language_scanner.c" yy682: YYDEBUG(682, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy683; - if (yych != 'a') goto yy187; + if (yych == 'C') goto yy693; + if (yych == 'c') goto yy693; + goto yy187; yy683: YYDEBUG(683, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'B') goto yy684; - if (yych != 'b') goto yy187; + if (yych == 'E') goto yy691; + if (yych == 'e') goto yy691; + goto yy187; yy684: YYDEBUG(684, *YYCURSOR); yych = *++YYCURSOR; @@ -6492,39 +6425,36 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy685: YYDEBUG(685, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy686; - if (yych != 'e') goto yy187; + if (yych == 'A') goto yy686; + if (yych != 'a') goto yy187; yy686: YYDEBUG(686, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy186; - } + yych = *++YYCURSOR; + if (yych == 'B') goto yy687; + if (yych != 'b') goto yy187; +yy687: YYDEBUG(687, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1346 "Zend/zend_language_scanner.l" - { - return T_CALLABLE; -} -#line 6510 "Zend/zend_language_scanner.c" + yych = *++YYCURSOR; + if (yych == 'L') goto yy688; + if (yych != 'l') goto yy187; yy688: YYDEBUG(688, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy689; + if (yych != 'e') goto yy187; +yy689: + YYDEBUG(689, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(689, *YYCURSOR); + YYDEBUG(690, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1132 "Zend/zend_language_scanner.l" +#line 1338 "Zend/zend_language_scanner.l" { - return T_CASE; + return T_CALLABLE; } -#line 6523 "Zend/zend_language_scanner.c" -yy690: - YYDEBUG(690, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'H') goto yy691; - if (yych != 'h') goto yy187; +#line 6458 "Zend/zend_language_scanner.c" yy691: YYDEBUG(691, *YYCURSOR); ++YYCURSOR; @@ -6533,719 +6463,737 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(692, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1052 "Zend/zend_language_scanner.l" +#line 1122 "Zend/zend_language_scanner.l" { - return T_CATCH; + return T_CASE; } -#line 6541 "Zend/zend_language_scanner.c" +#line 6471 "Zend/zend_language_scanner.c" yy693: YYDEBUG(693, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy710; - if (yych == 'n') goto yy710; - goto yy187; + if (yych == 'H') goto yy694; + if (yych != 'h') goto yy187; yy694: YYDEBUG(694, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'R') goto yy703; - if (yych == 'r') goto yy703; - goto yy187; -yy695: + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } YYDEBUG(695, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'N') goto yy696; - if (yych != 'n') goto yy187; + yyleng = YYCURSOR - SCNG(yy_text); +#line 1042 "Zend/zend_language_scanner.l" + { + return T_CATCH; +} +#line 6489 "Zend/zend_language_scanner.c" yy696: YYDEBUG(696, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy697; - if (yych != 'c') goto yy187; + if (yych == 'N') goto yy713; + if (yych == 'n') goto yy713; + goto yy187; yy697: YYDEBUG(697, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy698; - if (yych != 't') goto yy187; + if (yych == 'R') goto yy706; + if (yych == 'r') goto yy706; + goto yy187; yy698: YYDEBUG(698, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy699; - if (yych != 'i') goto yy187; + if (yych == 'N') goto yy699; + if (yych != 'n') goto yy187; yy699: YYDEBUG(699, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy700; - if (yych != 'o') goto yy187; + if (yych == 'C') goto yy700; + if (yych != 'c') goto yy187; yy700: YYDEBUG(700, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy701; + if (yych == 'T') goto yy701; + if (yych != 't') goto yy187; +yy701: + YYDEBUG(701, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy702; + if (yych != 'i') goto yy187; +yy702: + YYDEBUG(702, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy703; + if (yych != 'o') goto yy187; +yy703: + YYDEBUG(703, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy704; if (yych != 'n') goto yy187; -yy701: - YYDEBUG(701, *YYCURSOR); +yy704: + YYDEBUG(704, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(702, *YYCURSOR); + YYDEBUG(705, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1032 "Zend/zend_language_scanner.l" +#line 1022 "Zend/zend_language_scanner.l" { return T_FUNCTION; } -#line 6596 "Zend/zend_language_scanner.c" -yy703: - YYDEBUG(703, *YYCURSOR); +#line 6544 "Zend/zend_language_scanner.c" +yy706: + YYDEBUG(706, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) <= '^') { if (yych <= '@') { - if (yych <= '/') goto yy704; + if (yych <= '/') goto yy707; if (yych <= '9') goto yy186; } else { - if (yych == 'E') goto yy705; + if (yych == 'E') goto yy708; if (yych <= 'Z') goto yy186; } } else { if (yych <= 'd') { if (yych != '`') goto yy186; } else { - if (yych <= 'e') goto yy705; + if (yych <= 'e') goto yy708; if (yych <= 'z') goto yy186; if (yych >= 0x7F) goto yy186; } } -yy704: - YYDEBUG(704, *YYCURSOR); +yy707: + YYDEBUG(707, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1092 "Zend/zend_language_scanner.l" +#line 1082 "Zend/zend_language_scanner.l" { return T_FOR; } -#line 6624 "Zend/zend_language_scanner.c" -yy705: - YYDEBUG(705, *YYCURSOR); +#line 6572 "Zend/zend_language_scanner.c" +yy708: + YYDEBUG(708, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy706; + if (yych == 'A') goto yy709; if (yych != 'a') goto yy187; -yy706: - YYDEBUG(706, *YYCURSOR); +yy709: + YYDEBUG(709, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy707; + if (yych == 'C') goto yy710; if (yych != 'c') goto yy187; -yy707: - YYDEBUG(707, *YYCURSOR); +yy710: + YYDEBUG(710, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'H') goto yy708; + if (yych == 'H') goto yy711; if (yych != 'h') goto yy187; -yy708: - YYDEBUG(708, *YYCURSOR); +yy711: + YYDEBUG(711, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(709, *YYCURSOR); + YYDEBUG(712, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1100 "Zend/zend_language_scanner.l" +#line 1090 "Zend/zend_language_scanner.l" { return T_FOREACH; } -#line 6652 "Zend/zend_language_scanner.c" -yy710: - YYDEBUG(710, *YYCURSOR); +#line 6600 "Zend/zend_language_scanner.c" +yy713: + YYDEBUG(713, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy711; + if (yych == 'A') goto yy714; if (yych != 'a') goto yy187; -yy711: - YYDEBUG(711, *YYCURSOR); +yy714: + YYDEBUG(714, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy712; + if (yych == 'L') goto yy715; if (yych != 'l') goto yy187; -yy712: - YYDEBUG(712, *YYCURSOR); +yy715: + YYDEBUG(715, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) <= '^') { if (yych <= '@') { - if (yych <= '/') goto yy713; + if (yych <= '/') goto yy716; if (yych <= '9') goto yy186; } else { - if (yych == 'L') goto yy714; + if (yych == 'L') goto yy717; if (yych <= 'Z') goto yy186; } } else { if (yych <= 'k') { if (yych != '`') goto yy186; } else { - if (yych <= 'l') goto yy714; + if (yych <= 'l') goto yy717; if (yych <= 'z') goto yy186; if (yych >= 0x7F) goto yy186; } } -yy713: - YYDEBUG(713, *YYCURSOR); +yy716: + YYDEBUG(716, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1314 "Zend/zend_language_scanner.l" +#line 1306 "Zend/zend_language_scanner.l" { return T_FINAL; } -#line 6690 "Zend/zend_language_scanner.c" -yy714: - YYDEBUG(714, *YYCURSOR); +#line 6638 "Zend/zend_language_scanner.c" +yy717: + YYDEBUG(717, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'Y') goto yy715; + if (yych == 'Y') goto yy718; if (yych != 'y') goto yy187; -yy715: - YYDEBUG(715, *YYCURSOR); +yy718: + YYDEBUG(718, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(716, *YYCURSOR); + YYDEBUG(719, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1056 "Zend/zend_language_scanner.l" +#line 1046 "Zend/zend_language_scanner.l" { return T_FINALLY; } -#line 6708 "Zend/zend_language_scanner.c" -yy717: - YYDEBUG(717, *YYCURSOR); +#line 6656 "Zend/zend_language_scanner.c" +yy720: + YYDEBUG(720, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'F') { - if (yych == 'C') goto yy723; + if (yych == 'C') goto yy726; if (yych <= 'E') goto yy187; - goto yy724; + goto yy727; } else { if (yych <= 'c') { if (yych <= 'b') goto yy187; - goto yy723; + goto yy726; } else { - if (yych == 'f') goto yy724; + if (yych == 'f') goto yy727; goto yy187; } } -yy718: - YYDEBUG(718, *YYCURSOR); +yy721: + YYDEBUG(721, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy721; - if (yych == 'e') goto yy721; + if (yych == 'E') goto yy724; + if (yych == 'e') goto yy724; goto yy187; -yy719: - YYDEBUG(719, *YYCURSOR); +yy722: + YYDEBUG(722, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(720, *YYCURSOR); + YYDEBUG(723, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1088 "Zend/zend_language_scanner.l" +#line 1078 "Zend/zend_language_scanner.l" { return T_DO; } -#line 6743 "Zend/zend_language_scanner.c" -yy721: - YYDEBUG(721, *YYCURSOR); +#line 6691 "Zend/zend_language_scanner.c" +yy724: + YYDEBUG(724, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(722, *YYCURSOR); + YYDEBUG(725, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1028 "Zend/zend_language_scanner.l" +#line 1018 "Zend/zend_language_scanner.l" { return T_EXIT; } -#line 6756 "Zend/zend_language_scanner.c" -yy723: - YYDEBUG(723, *YYCURSOR); +#line 6704 "Zend/zend_language_scanner.c" +yy726: + YYDEBUG(726, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy730; - if (yych == 'l') goto yy730; + if (yych == 'L') goto yy733; + if (yych == 'l') goto yy733; goto yy187; -yy724: - YYDEBUG(724, *YYCURSOR); +yy727: + YYDEBUG(727, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy725; + if (yych == 'A') goto yy728; if (yych != 'a') goto yy187; -yy725: - YYDEBUG(725, *YYCURSOR); +yy728: + YYDEBUG(728, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'U') goto yy726; + if (yych == 'U') goto yy729; if (yych != 'u') goto yy187; -yy726: - YYDEBUG(726, *YYCURSOR); +yy729: + YYDEBUG(729, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy727; + if (yych == 'L') goto yy730; if (yych != 'l') goto yy187; -yy727: - YYDEBUG(727, *YYCURSOR); +yy730: + YYDEBUG(730, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy728; + if (yych == 'T') goto yy731; if (yych != 't') goto yy187; -yy728: - YYDEBUG(728, *YYCURSOR); +yy731: + YYDEBUG(731, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(729, *YYCURSOR); + YYDEBUG(732, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1136 "Zend/zend_language_scanner.l" +#line 1126 "Zend/zend_language_scanner.l" { return T_DEFAULT; } -#line 6795 "Zend/zend_language_scanner.c" -yy730: - YYDEBUG(730, *YYCURSOR); +#line 6743 "Zend/zend_language_scanner.c" +yy733: + YYDEBUG(733, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy731; + if (yych == 'A') goto yy734; if (yych != 'a') goto yy187; -yy731: - YYDEBUG(731, *YYCURSOR); +yy734: + YYDEBUG(734, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy732; + if (yych == 'R') goto yy735; if (yych != 'r') goto yy187; -yy732: - YYDEBUG(732, *YYCURSOR); +yy735: + YYDEBUG(735, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy733; + if (yych == 'E') goto yy736; if (yych != 'e') goto yy187; -yy733: - YYDEBUG(733, *YYCURSOR); +yy736: + YYDEBUG(736, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(734, *YYCURSOR); + YYDEBUG(737, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1108 "Zend/zend_language_scanner.l" +#line 1098 "Zend/zend_language_scanner.l" { return T_DECLARE; } -#line 6823 "Zend/zend_language_scanner.c" -yy735: - YYDEBUG(735, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'H') goto yy797; - if (yych == 'h') goto yy797; - goto yy187; -yy736: - YYDEBUG(736, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'S') goto yy791; - if (yych == 's') goto yy791; - goto yy187; -yy737: - YYDEBUG(737, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'P') goto yy787; - if (yych == 'p') goto yy787; - goto yy187; +#line 6771 "Zend/zend_language_scanner.c" yy738: YYDEBUG(738, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'D') goto yy753; - if (yych == 'd') goto yy753; + if (yych == 'H') goto yy800; + if (yych == 'h') goto yy800; goto yy187; yy739: YYDEBUG(739, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy750; - if (yych == 'a') goto yy750; + if (yych == 'S') goto yy794; + if (yych == 's') goto yy794; goto yy187; yy740: YYDEBUG(740, *YYCURSOR); yych = *++YYCURSOR; + if (yych == 'P') goto yy790; + if (yych == 'p') goto yy790; + goto yy187; +yy741: + YYDEBUG(741, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'D') goto yy756; + if (yych == 'd') goto yy756; + goto yy187; +yy742: + YYDEBUG(742, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy753; + if (yych == 'a') goto yy753; + goto yy187; +yy743: + YYDEBUG(743, *YYCURSOR); + yych = *++YYCURSOR; if (yych <= 'T') { - if (yych == 'I') goto yy741; + if (yych == 'I') goto yy744; if (yych <= 'S') goto yy187; - goto yy742; + goto yy745; } else { if (yych <= 'i') { if (yych <= 'h') goto yy187; } else { - if (yych == 't') goto yy742; + if (yych == 't') goto yy745; goto yy187; } } -yy741: - YYDEBUG(741, *YYCURSOR); +yy744: + YYDEBUG(744, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy748; - if (yych == 't') goto yy748; + if (yych == 'T') goto yy751; + if (yych == 't') goto yy751; goto yy187; -yy742: - YYDEBUG(742, *YYCURSOR); +yy745: + YYDEBUG(745, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy743; + if (yych == 'E') goto yy746; if (yych != 'e') goto yy187; -yy743: - YYDEBUG(743, *YYCURSOR); +yy746: + YYDEBUG(746, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy744; + if (yych == 'N') goto yy747; if (yych != 'n') goto yy187; -yy744: - YYDEBUG(744, *YYCURSOR); +yy747: + YYDEBUG(747, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'D') goto yy745; + if (yych == 'D') goto yy748; if (yych != 'd') goto yy187; -yy745: - YYDEBUG(745, *YYCURSOR); +yy748: + YYDEBUG(748, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'S') goto yy746; + if (yych == 'S') goto yy749; if (yych != 's') goto yy187; -yy746: - YYDEBUG(746, *YYCURSOR); +yy749: + YYDEBUG(749, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(747, *YYCURSOR); + YYDEBUG(750, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1172 "Zend/zend_language_scanner.l" +#line 1162 "Zend/zend_language_scanner.l" { return T_EXTENDS; } -#line 6907 "Zend/zend_language_scanner.c" -yy748: - YYDEBUG(748, *YYCURSOR); +#line 6855 "Zend/zend_language_scanner.c" +yy751: + YYDEBUG(751, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(749, *YYCURSOR); + YYDEBUG(752, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1024 "Zend/zend_language_scanner.l" +#line 1014 "Zend/zend_language_scanner.l" { return T_EXIT; } -#line 6920 "Zend/zend_language_scanner.c" -yy750: - YYDEBUG(750, *YYCURSOR); +#line 6868 "Zend/zend_language_scanner.c" +yy753: + YYDEBUG(753, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy751; + if (yych == 'L') goto yy754; if (yych != 'l') goto yy187; -yy751: - YYDEBUG(751, *YYCURSOR); +yy754: + YYDEBUG(754, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(752, *YYCURSOR); + YYDEBUG(755, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1258 "Zend/zend_language_scanner.l" +#line 1250 "Zend/zend_language_scanner.l" { return T_EVAL; } -#line 6938 "Zend/zend_language_scanner.c" -yy753: - YYDEBUG(753, *YYCURSOR); +#line 6886 "Zend/zend_language_scanner.c" +yy756: + YYDEBUG(756, *YYCURSOR); yych = *++YYCURSOR; YYDEBUG(-1, yych); switch (yych) { case 'D': - case 'd': goto yy754; + case 'd': goto yy757; case 'F': - case 'f': goto yy755; + case 'f': goto yy758; case 'I': - case 'i': goto yy756; + case 'i': goto yy759; case 'S': - case 's': goto yy757; + case 's': goto yy760; case 'W': - case 'w': goto yy758; + case 'w': goto yy761; default: goto yy187; } -yy754: - YYDEBUG(754, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy780; - if (yych == 'e') goto yy780; - goto yy187; -yy755: - YYDEBUG(755, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'O') goto yy772; - if (yych == 'o') goto yy772; - goto yy187; -yy756: - YYDEBUG(756, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'F') goto yy770; - if (yych == 'f') goto yy770; - goto yy187; yy757: YYDEBUG(757, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'W') goto yy764; - if (yych == 'w') goto yy764; + if (yych == 'E') goto yy783; + if (yych == 'e') goto yy783; goto yy187; yy758: YYDEBUG(758, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'H') goto yy759; - if (yych != 'h') goto yy187; + if (yych == 'O') goto yy775; + if (yych == 'o') goto yy775; + goto yy187; yy759: YYDEBUG(759, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy760; - if (yych != 'i') goto yy187; + if (yych == 'F') goto yy773; + if (yych == 'f') goto yy773; + goto yy187; yy760: YYDEBUG(760, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy761; - if (yych != 'l') goto yy187; + if (yych == 'W') goto yy767; + if (yych == 'w') goto yy767; + goto yy187; yy761: YYDEBUG(761, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy762; - if (yych != 'e') goto yy187; + if (yych == 'H') goto yy762; + if (yych != 'h') goto yy187; yy762: YYDEBUG(762, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy763; + if (yych != 'i') goto yy187; +yy763: + YYDEBUG(763, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy764; + if (yych != 'l') goto yy187; +yy764: + YYDEBUG(764, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy765; + if (yych != 'e') goto yy187; +yy765: + YYDEBUG(765, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(763, *YYCURSOR); + YYDEBUG(766, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1084 "Zend/zend_language_scanner.l" +#line 1074 "Zend/zend_language_scanner.l" { return T_ENDWHILE; } -#line 7012 "Zend/zend_language_scanner.c" -yy764: - YYDEBUG(764, *YYCURSOR); +#line 6960 "Zend/zend_language_scanner.c" +yy767: + YYDEBUG(767, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy765; + if (yych == 'I') goto yy768; if (yych != 'i') goto yy187; -yy765: - YYDEBUG(765, *YYCURSOR); +yy768: + YYDEBUG(768, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy766; + if (yych == 'T') goto yy769; if (yych != 't') goto yy187; -yy766: - YYDEBUG(766, *YYCURSOR); +yy769: + YYDEBUG(769, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy767; + if (yych == 'C') goto yy770; if (yych != 'c') goto yy187; -yy767: - YYDEBUG(767, *YYCURSOR); +yy770: + YYDEBUG(770, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'H') goto yy768; + if (yych == 'H') goto yy771; if (yych != 'h') goto yy187; -yy768: - YYDEBUG(768, *YYCURSOR); +yy771: + YYDEBUG(771, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(769, *YYCURSOR); + YYDEBUG(772, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1128 "Zend/zend_language_scanner.l" +#line 1118 "Zend/zend_language_scanner.l" { return T_ENDSWITCH; } -#line 7045 "Zend/zend_language_scanner.c" -yy770: - YYDEBUG(770, *YYCURSOR); +#line 6993 "Zend/zend_language_scanner.c" +yy773: + YYDEBUG(773, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(771, *YYCURSOR); + YYDEBUG(774, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1072 "Zend/zend_language_scanner.l" +#line 1062 "Zend/zend_language_scanner.l" { return T_ENDIF; } -#line 7058 "Zend/zend_language_scanner.c" -yy772: - YYDEBUG(772, *YYCURSOR); +#line 7006 "Zend/zend_language_scanner.c" +yy775: + YYDEBUG(775, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy773; + if (yych == 'R') goto yy776; if (yych != 'r') goto yy187; -yy773: - YYDEBUG(773, *YYCURSOR); +yy776: + YYDEBUG(776, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) <= '^') { if (yych <= '@') { - if (yych <= '/') goto yy774; + if (yych <= '/') goto yy777; if (yych <= '9') goto yy186; } else { - if (yych == 'E') goto yy775; + if (yych == 'E') goto yy778; if (yych <= 'Z') goto yy186; } } else { if (yych <= 'd') { if (yych != '`') goto yy186; } else { - if (yych <= 'e') goto yy775; + if (yych <= 'e') goto yy778; if (yych <= 'z') goto yy186; if (yych >= 0x7F) goto yy186; } } -yy774: - YYDEBUG(774, *YYCURSOR); +yy777: + YYDEBUG(777, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1096 "Zend/zend_language_scanner.l" +#line 1086 "Zend/zend_language_scanner.l" { return T_ENDFOR; } -#line 7091 "Zend/zend_language_scanner.c" -yy775: - YYDEBUG(775, *YYCURSOR); +#line 7039 "Zend/zend_language_scanner.c" +yy778: + YYDEBUG(778, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy776; + if (yych == 'A') goto yy779; if (yych != 'a') goto yy187; -yy776: - YYDEBUG(776, *YYCURSOR); +yy779: + YYDEBUG(779, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy777; + if (yych == 'C') goto yy780; if (yych != 'c') goto yy187; -yy777: - YYDEBUG(777, *YYCURSOR); +yy780: + YYDEBUG(780, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'H') goto yy778; + if (yych == 'H') goto yy781; if (yych != 'h') goto yy187; -yy778: - YYDEBUG(778, *YYCURSOR); +yy781: + YYDEBUG(781, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(779, *YYCURSOR); + YYDEBUG(782, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1104 "Zend/zend_language_scanner.l" +#line 1094 "Zend/zend_language_scanner.l" { return T_ENDFOREACH; } -#line 7119 "Zend/zend_language_scanner.c" -yy780: - YYDEBUG(780, *YYCURSOR); +#line 7067 "Zend/zend_language_scanner.c" +yy783: + YYDEBUG(783, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy781; + if (yych == 'C') goto yy784; if (yych != 'c') goto yy187; -yy781: - YYDEBUG(781, *YYCURSOR); +yy784: + YYDEBUG(784, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy782; + if (yych == 'L') goto yy785; if (yych != 'l') goto yy187; -yy782: - YYDEBUG(782, *YYCURSOR); +yy785: + YYDEBUG(785, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy783; + if (yych == 'A') goto yy786; if (yych != 'a') goto yy187; -yy783: - YYDEBUG(783, *YYCURSOR); +yy786: + YYDEBUG(786, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy784; + if (yych == 'R') goto yy787; if (yych != 'r') goto yy187; -yy784: - YYDEBUG(784, *YYCURSOR); +yy787: + YYDEBUG(787, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy785; + if (yych == 'E') goto yy788; if (yych != 'e') goto yy187; -yy785: - YYDEBUG(785, *YYCURSOR); +yy788: + YYDEBUG(788, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(786, *YYCURSOR); + YYDEBUG(789, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1112 "Zend/zend_language_scanner.l" +#line 1102 "Zend/zend_language_scanner.l" { return T_ENDDECLARE; } -#line 7157 "Zend/zend_language_scanner.c" -yy787: - YYDEBUG(787, *YYCURSOR); +#line 7105 "Zend/zend_language_scanner.c" +yy790: + YYDEBUG(790, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy788; + if (yych == 'T') goto yy791; if (yych != 't') goto yy187; -yy788: - YYDEBUG(788, *YYCURSOR); +yy791: + YYDEBUG(791, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'Y') goto yy789; + if (yych == 'Y') goto yy792; if (yych != 'y') goto yy187; -yy789: - YYDEBUG(789, *YYCURSOR); +yy792: + YYDEBUG(792, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(790, *YYCURSOR); + YYDEBUG(793, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1298 "Zend/zend_language_scanner.l" +#line 1290 "Zend/zend_language_scanner.l" { return T_EMPTY; } -#line 7180 "Zend/zend_language_scanner.c" -yy791: - YYDEBUG(791, *YYCURSOR); +#line 7128 "Zend/zend_language_scanner.c" +yy794: + YYDEBUG(794, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy792; + if (yych == 'E') goto yy795; if (yych != 'e') goto yy187; -yy792: - YYDEBUG(792, *YYCURSOR); +yy795: + YYDEBUG(795, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) <= '^') { if (yych <= '@') { - if (yych <= '/') goto yy793; + if (yych <= '/') goto yy796; if (yych <= '9') goto yy186; } else { - if (yych == 'I') goto yy794; + if (yych == 'I') goto yy797; if (yych <= 'Z') goto yy186; } } else { if (yych <= 'h') { if (yych != '`') goto yy186; } else { - if (yych <= 'i') goto yy794; + if (yych <= 'i') goto yy797; if (yych <= 'z') goto yy186; if (yych >= 0x7F) goto yy186; } } -yy793: - YYDEBUG(793, *YYCURSOR); +yy796: + YYDEBUG(796, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1076 "Zend/zend_language_scanner.l" +#line 1066 "Zend/zend_language_scanner.l" { return T_ELSE; } -#line 7213 "Zend/zend_language_scanner.c" -yy794: - YYDEBUG(794, *YYCURSOR); +#line 7161 "Zend/zend_language_scanner.c" +yy797: + YYDEBUG(797, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'F') goto yy795; + if (yych == 'F') goto yy798; if (yych != 'f') goto yy187; -yy795: - YYDEBUG(795, *YYCURSOR); +yy798: + YYDEBUG(798, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(796, *YYCURSOR); + YYDEBUG(799, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1068 "Zend/zend_language_scanner.l" +#line 1058 "Zend/zend_language_scanner.l" { return T_ELSEIF; } -#line 7231 "Zend/zend_language_scanner.c" -yy797: - YYDEBUG(797, *YYCURSOR); +#line 7179 "Zend/zend_language_scanner.c" +yy800: + YYDEBUG(800, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy798; + if (yych == 'O') goto yy801; if (yych != 'o') goto yy187; -yy798: - YYDEBUG(798, *YYCURSOR); +yy801: + YYDEBUG(801, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(799, *YYCURSOR); + YYDEBUG(802, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1152 "Zend/zend_language_scanner.l" +#line 1142 "Zend/zend_language_scanner.l" { return T_ECHO; } -#line 7249 "Zend/zend_language_scanner.c" +#line 7197 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_LOOKING_FOR_PROPERTY: @@ -7284,115 +7232,113 @@ int lex_scan(zval *zendlval TSRMLS_DC) 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, }; - YYDEBUG(800, *YYCURSOR); + YYDEBUG(803, *YYCURSOR); YYFILL(2); yych = *YYCURSOR; if (yych <= '-') { if (yych <= '\r') { - if (yych <= 0x08) goto yy808; - if (yych <= '\n') goto yy802; - if (yych <= '\f') goto yy808; + if (yych <= 0x08) goto yy811; + if (yych <= '\n') goto yy805; + if (yych <= '\f') goto yy811; } else { - if (yych == ' ') goto yy802; - if (yych <= ',') goto yy808; - goto yy804; + if (yych == ' ') goto yy805; + if (yych <= ',') goto yy811; + goto yy807; } } else { if (yych <= '_') { - if (yych <= '@') goto yy808; - if (yych <= 'Z') goto yy806; - if (yych <= '^') goto yy808; - goto yy806; + if (yych <= '@') goto yy811; + if (yych <= 'Z') goto yy809; + if (yych <= '^') goto yy811; + goto yy809; } else { - if (yych <= '`') goto yy808; - if (yych <= 'z') goto yy806; - if (yych <= '~') goto yy808; - goto yy806; + if (yych <= '`') goto yy811; + if (yych <= 'z') goto yy809; + if (yych <= '~') goto yy811; + goto yy809; } } -yy802: - YYDEBUG(802, *YYCURSOR); +yy805: + YYDEBUG(805, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy814; -yy803: - YYDEBUG(803, *YYCURSOR); + goto yy817; +yy806: + YYDEBUG(806, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1185 "Zend/zend_language_scanner.l" +#line 1175 "Zend/zend_language_scanner.l" { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */ HANDLE_NEWLINES(yytext, yyleng); return T_WHITESPACE; } -#line 7330 "Zend/zend_language_scanner.c" -yy804: - YYDEBUG(804, *YYCURSOR); +#line 7276 "Zend/zend_language_scanner.c" +yy807: + YYDEBUG(807, *YYCURSOR); ++YYCURSOR; - if ((yych = *YYCURSOR) == '>') goto yy811; -yy805: - YYDEBUG(805, *YYCURSOR); + if ((yych = *YYCURSOR) == '>') goto yy814; +yy808: + YYDEBUG(808, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1204 "Zend/zend_language_scanner.l" +#line 1192 "Zend/zend_language_scanner.l" { yyless(0); yy_pop_state(TSRMLS_C); goto restart; } -#line 7344 "Zend/zend_language_scanner.c" -yy806: - YYDEBUG(806, *YYCURSOR); +#line 7290 "Zend/zend_language_scanner.c" +yy809: + YYDEBUG(809, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy810; -yy807: - YYDEBUG(807, *YYCURSOR); + goto yy813; +yy810: + YYDEBUG(810, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1197 "Zend/zend_language_scanner.l" +#line 1185 "Zend/zend_language_scanner.l" { yy_pop_state(TSRMLS_C); zend_copy_value(zendlval, yytext, yyleng); zendlval->type = IS_STRING; return T_STRING; } -#line 7360 "Zend/zend_language_scanner.c" -yy808: - YYDEBUG(808, *YYCURSOR); +#line 7306 "Zend/zend_language_scanner.c" +yy811: + YYDEBUG(811, *YYCURSOR); yych = *++YYCURSOR; - goto yy805; -yy809: - YYDEBUG(809, *YYCURSOR); + goto yy808; +yy812: + YYDEBUG(812, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy810: - YYDEBUG(810, *YYCURSOR); +yy813: + YYDEBUG(813, *YYCURSOR); if (yybm[0+yych] & 64) { - goto yy809; + goto yy812; } - goto yy807; -yy811: - YYDEBUG(811, *YYCURSOR); + goto yy810; +yy814: + YYDEBUG(814, *YYCURSOR); ++YYCURSOR; - YYDEBUG(812, *YYCURSOR); + YYDEBUG(815, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1193 "Zend/zend_language_scanner.l" +#line 1181 "Zend/zend_language_scanner.l" { return T_OBJECT_OPERATOR; } -#line 7385 "Zend/zend_language_scanner.c" -yy813: - YYDEBUG(813, *YYCURSOR); +#line 7331 "Zend/zend_language_scanner.c" +yy816: + YYDEBUG(816, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy814: - YYDEBUG(814, *YYCURSOR); +yy817: + YYDEBUG(817, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy813; + goto yy816; } - goto yy803; + goto yy806; } /* *********************************** */ yyc_ST_LOOKING_FOR_VARNAME: @@ -7431,74 +7377,74 @@ int lex_scan(zval *zendlval TSRMLS_DC) 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, }; - YYDEBUG(815, *YYCURSOR); + YYDEBUG(818, *YYCURSOR); YYFILL(2); yych = *YYCURSOR; if (yych <= '_') { - if (yych <= '@') goto yy819; - if (yych <= 'Z') goto yy817; - if (yych <= '^') goto yy819; + if (yych <= '@') goto yy822; + if (yych <= 'Z') goto yy820; + if (yych <= '^') goto yy822; } else { - if (yych <= '`') goto yy819; - if (yych <= 'z') goto yy817; - if (yych <= '~') goto yy819; + if (yych <= '`') goto yy822; + if (yych <= 'z') goto yy820; + if (yych <= '~') goto yy822; } -yy817: - YYDEBUG(817, *YYCURSOR); +yy820: + YYDEBUG(820, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '_') { if (yych <= '@') { - if (yych <= '/') goto yy818; - if (yych <= '9') goto yy821; + if (yych <= '/') goto yy821; + if (yych <= '9') goto yy824; } else { - if (yych <= '[') goto yy821; - if (yych >= '_') goto yy821; + if (yych <= '[') goto yy824; + if (yych >= '_') goto yy824; } } else { if (yych <= '|') { - if (yych <= '`') goto yy818; - if (yych <= 'z') goto yy821; + if (yych <= '`') goto yy821; + if (yych <= 'z') goto yy824; } else { - if (yych != '~') goto yy821; + if (yych != '~') goto yy824; } } -yy818: - YYDEBUG(818, *YYCURSOR); +yy821: + YYDEBUG(821, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1490 "Zend/zend_language_scanner.l" +#line 1482 "Zend/zend_language_scanner.l" { yyless(0); yy_pop_state(TSRMLS_C); yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); goto restart; } -#line 7477 "Zend/zend_language_scanner.c" -yy819: - YYDEBUG(819, *YYCURSOR); +#line 7423 "Zend/zend_language_scanner.c" +yy822: + YYDEBUG(822, *YYCURSOR); yych = *++YYCURSOR; - goto yy818; -yy820: - YYDEBUG(820, *YYCURSOR); + goto yy821; +yy823: + YYDEBUG(823, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy821: - YYDEBUG(821, *YYCURSOR); +yy824: + YYDEBUG(824, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy820; + goto yy823; } - if (yych == '[') goto yy823; - if (yych == '}') goto yy823; - YYDEBUG(822, *YYCURSOR); + if (yych == '[') goto yy826; + if (yych == '}') goto yy826; + YYDEBUG(825, *YYCURSOR); YYCURSOR = YYMARKER; - goto yy818; -yy823: - YYDEBUG(823, *YYCURSOR); + goto yy821; +yy826: + YYDEBUG(826, *YYCURSOR); ++YYCURSOR; - YYDEBUG(824, *YYCURSOR); + YYDEBUG(827, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1480 "Zend/zend_language_scanner.l" +#line 1472 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); zend_copy_value(zendlval, yytext, yyleng); @@ -7507,18 +7453,18 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); return T_STRING_VARNAME; } -#line 7511 "Zend/zend_language_scanner.c" +#line 7457 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_NOWDOC: - YYDEBUG(825, *YYCURSOR); + YYDEBUG(828, *YYCURSOR); YYFILL(1); yych = *YYCURSOR; - YYDEBUG(827, *YYCURSOR); + YYDEBUG(830, *YYCURSOR); ++YYCURSOR; - YYDEBUG(828, *YYCURSOR); + YYDEBUG(831, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2374 "Zend/zend_language_scanner.l" +#line 2302 "Zend/zend_language_scanner.l" { int newline = 0; @@ -7575,7 +7521,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) HANDLE_NEWLINES(yytext, yyleng - newline); return T_ENCAPSED_AND_WHITESPACE; } -#line 7579 "Zend/zend_language_scanner.c" +#line 7525 "Zend/zend_language_scanner.c" /* *********************************** */ yyc_ST_VAR_OFFSET: { @@ -7613,162 +7559,159 @@ int lex_scan(zval *zendlval TSRMLS_DC) 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, }; - YYDEBUG(829, *YYCURSOR); + YYDEBUG(832, *YYCURSOR); YYFILL(3); yych = *YYCURSOR; if (yych <= '/') { if (yych <= ' ') { if (yych <= '\f') { - if (yych <= 0x08) goto yy843; - if (yych <= '\n') goto yy839; - goto yy843; + if (yych <= 0x08) goto yy846; + if (yych <= '\n') goto yy842; + goto yy846; } else { - if (yych <= '\r') goto yy839; - if (yych <= 0x1F) goto yy843; - goto yy839; + if (yych <= '\r') goto yy842; + if (yych <= 0x1F) goto yy846; + goto yy842; } } else { if (yych <= '$') { - if (yych <= '"') goto yy838; - if (yych <= '#') goto yy839; - goto yy834; + if (yych <= '"') goto yy841; + if (yych <= '#') goto yy842; + goto yy837; } else { - if (yych == '\'') goto yy839; - goto yy838; + if (yych == '\'') goto yy842; + goto yy841; } } } else { if (yych <= '\\') { if (yych <= '@') { - if (yych <= '0') goto yy831; - if (yych <= '9') goto yy833; - goto yy838; + if (yych <= '0') goto yy834; + if (yych <= '9') goto yy836; + goto yy841; } else { - if (yych <= 'Z') goto yy841; - if (yych <= '[') goto yy838; - goto yy839; + if (yych <= 'Z') goto yy844; + if (yych <= '[') goto yy841; + goto yy842; } } else { if (yych <= '_') { - if (yych <= ']') goto yy836; - if (yych <= '^') goto yy838; - goto yy841; + if (yych <= ']') goto yy839; + if (yych <= '^') goto yy841; + goto yy844; } else { - if (yych <= '`') goto yy838; - if (yych <= 'z') goto yy841; - if (yych <= '~') goto yy838; - goto yy841; + if (yych <= '`') goto yy841; + if (yych <= 'z') goto yy844; + if (yych <= '~') goto yy841; + goto yy844; } } } -yy831: - YYDEBUG(831, *YYCURSOR); +yy834: + YYDEBUG(834, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); if (yych <= 'W') { if (yych <= '9') { - if (yych >= '0') goto yy855; + if (yych >= '0') goto yy858; } else { - if (yych == 'B') goto yy852; + if (yych == 'B') goto yy855; } } else { if (yych <= 'b') { - if (yych <= 'X') goto yy854; - if (yych >= 'b') goto yy852; + if (yych <= 'X') goto yy857; + if (yych >= 'b') goto yy855; } else { - if (yych == 'x') goto yy854; + if (yych == 'x') goto yy857; } } -yy832: - YYDEBUG(832, *YYCURSOR); +yy835: + YYDEBUG(835, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1568 "Zend/zend_language_scanner.l" +#line 1558 "Zend/zend_language_scanner.l" { /* Offset could be treated as a long */ if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) { - zendlval->value.lval = strtol(yytext, NULL, 10); - zendlval->type = IS_LONG; + ZVAL_LONG(zendlval, strtol(yytext, NULL, 10)); } else { - zendlval->value.str.val = (char *)estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext, yyleng, 1); } return T_NUM_STRING; } -#line 7698 "Zend/zend_language_scanner.c" -yy833: - YYDEBUG(833, *YYCURSOR); +#line 7641 "Zend/zend_language_scanner.c" +yy836: + YYDEBUG(836, *YYCURSOR); yych = *++YYCURSOR; - goto yy851; -yy834: - YYDEBUG(834, *YYCURSOR); + goto yy854; +yy837: + YYDEBUG(837, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) <= '_') { - if (yych <= '@') goto yy835; - if (yych <= 'Z') goto yy847; - if (yych >= '_') goto yy847; + if (yych <= '@') goto yy838; + if (yych <= 'Z') goto yy850; + if (yych >= '_') goto yy850; } else { - if (yych <= '`') goto yy835; - if (yych <= 'z') goto yy847; - if (yych >= 0x7F) goto yy847; + if (yych <= '`') goto yy838; + if (yych <= 'z') goto yy850; + if (yych >= 0x7F) goto yy850; } -yy835: - YYDEBUG(835, *YYCURSOR); +yy838: + YYDEBUG(838, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1900 "Zend/zend_language_scanner.l" +#line 1834 "Zend/zend_language_scanner.l" { /* Only '[' can be valid, but returning other tokens will allow a more explicit parse error */ return yytext[0]; } -#line 7723 "Zend/zend_language_scanner.c" -yy836: - YYDEBUG(836, *YYCURSOR); +#line 7666 "Zend/zend_language_scanner.c" +yy839: + YYDEBUG(839, *YYCURSOR); ++YYCURSOR; - YYDEBUG(837, *YYCURSOR); + YYDEBUG(840, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1895 "Zend/zend_language_scanner.l" +#line 1829 "Zend/zend_language_scanner.l" { yy_pop_state(TSRMLS_C); return ']'; } -#line 7734 "Zend/zend_language_scanner.c" -yy838: - YYDEBUG(838, *YYCURSOR); +#line 7677 "Zend/zend_language_scanner.c" +yy841: + YYDEBUG(841, *YYCURSOR); yych = *++YYCURSOR; - goto yy835; -yy839: - YYDEBUG(839, *YYCURSOR); + goto yy838; +yy842: + YYDEBUG(842, *YYCURSOR); ++YYCURSOR; - YYDEBUG(840, *YYCURSOR); + YYDEBUG(843, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1905 "Zend/zend_language_scanner.l" +#line 1839 "Zend/zend_language_scanner.l" { /* Invalid rule to return a more explicit parse error with proper line number */ yyless(0); yy_pop_state(TSRMLS_C); return T_ENCAPSED_AND_WHITESPACE; } -#line 7751 "Zend/zend_language_scanner.c" -yy841: - YYDEBUG(841, *YYCURSOR); +#line 7694 "Zend/zend_language_scanner.c" +yy844: + YYDEBUG(844, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy846; -yy842: - YYDEBUG(842, *YYCURSOR); + goto yy849; +yy845: + YYDEBUG(845, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1912 "Zend/zend_language_scanner.l" +#line 1846 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, yytext, yyleng); zendlval->type = IS_STRING; return T_STRING; } -#line 7766 "Zend/zend_language_scanner.c" -yy843: - YYDEBUG(843, *YYCURSOR); +#line 7709 "Zend/zend_language_scanner.c" +yy846: + YYDEBUG(846, *YYCURSOR); ++YYCURSOR; - YYDEBUG(844, *YYCURSOR); + YYDEBUG(847, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2432 "Zend/zend_language_scanner.l" +#line 2360 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -7777,118 +7720,116 @@ int lex_scan(zval *zendlval TSRMLS_DC) zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE); goto restart; } -#line 7781 "Zend/zend_language_scanner.c" -yy845: - YYDEBUG(845, *YYCURSOR); +#line 7724 "Zend/zend_language_scanner.c" +yy848: + YYDEBUG(848, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy846: - YYDEBUG(846, *YYCURSOR); +yy849: + YYDEBUG(849, *YYCURSOR); if (yybm[0+yych] & 16) { - goto yy845; + goto yy848; } - goto yy842; -yy847: - YYDEBUG(847, *YYCURSOR); + goto yy845; +yy850: + YYDEBUG(850, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(848, *YYCURSOR); + YYDEBUG(851, *YYCURSOR); if (yych <= '^') { if (yych <= '9') { - if (yych >= '0') goto yy847; + if (yych >= '0') goto yy850; } else { - if (yych <= '@') goto yy849; - if (yych <= 'Z') goto yy847; + if (yych <= '@') goto yy852; + if (yych <= 'Z') goto yy850; } } else { if (yych <= '`') { - if (yych <= '_') goto yy847; + if (yych <= '_') goto yy850; } else { - if (yych <= 'z') goto yy847; - if (yych >= 0x7F) goto yy847; + if (yych <= 'z') goto yy850; + if (yych >= 0x7F) goto yy850; } } -yy849: - YYDEBUG(849, *YYCURSOR); +yy852: + YYDEBUG(852, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1889 "Zend/zend_language_scanner.l" +#line 1823 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; return T_VARIABLE; } -#line 7823 "Zend/zend_language_scanner.c" -yy850: - YYDEBUG(850, *YYCURSOR); +#line 7766 "Zend/zend_language_scanner.c" +yy853: + YYDEBUG(853, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy851: - YYDEBUG(851, *YYCURSOR); +yy854: + YYDEBUG(854, *YYCURSOR); if (yybm[0+yych] & 32) { - goto yy850; + goto yy853; } - goto yy832; -yy852: - YYDEBUG(852, *YYCURSOR); + goto yy835; +yy855: + YYDEBUG(855, *YYCURSOR); yych = *++YYCURSOR; if (yybm[0+yych] & 128) { - goto yy860; + goto yy863; } -yy853: - YYDEBUG(853, *YYCURSOR); +yy856: + YYDEBUG(856, *YYCURSOR); YYCURSOR = YYMARKER; - goto yy832; -yy854: - YYDEBUG(854, *YYCURSOR); + goto yy835; +yy857: + YYDEBUG(857, *YYCURSOR); yych = *++YYCURSOR; if (yybm[0+yych] & 64) { - goto yy858; + goto yy861; } - goto yy853; -yy855: - YYDEBUG(855, *YYCURSOR); + goto yy856; +yy858: + YYDEBUG(858, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(856, *YYCURSOR); - if (yych <= '/') goto yy857; - if (yych <= '9') goto yy855; -yy857: - YYDEBUG(857, *YYCURSOR); + YYDEBUG(859, *YYCURSOR); + if (yych <= '/') goto yy860; + if (yych <= '9') goto yy858; +yy860: + YYDEBUG(860, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1580 "Zend/zend_language_scanner.l" +#line 1567 "Zend/zend_language_scanner.l" { /* Offset must be treated as a string */ - zendlval->value.str.val = (char *)estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext, yyleng, 1); return T_NUM_STRING; } -#line 7870 "Zend/zend_language_scanner.c" -yy858: - YYDEBUG(858, *YYCURSOR); +#line 7811 "Zend/zend_language_scanner.c" +yy861: + YYDEBUG(861, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(859, *YYCURSOR); + YYDEBUG(862, *YYCURSOR); if (yybm[0+yych] & 64) { - goto yy858; + goto yy861; } - goto yy857; -yy860: - YYDEBUG(860, *YYCURSOR); + goto yy860; +yy863: + YYDEBUG(863, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(861, *YYCURSOR); + YYDEBUG(864, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy860; + goto yy863; } - goto yy857; + goto yy860; } } -#line 2441 "Zend/zend_language_scanner.l" +#line 2369 "Zend/zend_language_scanner.l" } diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index d2e7243bb2da1..736d7712d5ab8 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -47,7 +47,7 @@ #include "zend_API.h" #include "zend_strtod.h" #include "zend_exceptions.h" -#include "tsrm_virtual_cwd.h" +#include "zend_virtual_cwd.h" #include "tsrm_config_common.h" #define YYCTYPE unsigned char @@ -562,10 +562,8 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR zend_bool original_in_compilation = CG(in_compilation); retval_znode.op_type = IS_CONST; - retval_znode.u.constant.type = IS_LONG; - retval_znode.u.constant.value.lval = 1; - Z_UNSET_ISREF(retval_znode.u.constant); - Z_SET_REFCOUNT(retval_znode.u.constant, 1); + INIT_PZVAL(&retval_znode.u.constant); + ZVAL_LONG(&retval_znode.u.constant, 1); zend_save_lexical_state(&original_lex_state TSRMLS_CC); @@ -622,7 +620,7 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC) convert_to_string(&tmp); filename = &tmp; } - file_handle.filename = filename->value.str.val; + file_handle.filename = Z_STRVAL_P(filename); file_handle.free_filename = 0; file_handle.type = ZEND_HANDLE_FILENAME; file_handle.opened_path = NULL; @@ -633,7 +631,7 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC) int dummy = 1; if (!file_handle.opened_path) { - file_handle.opened_path = opened_path = estrndup(filename->value.str.val, filename->value.str.len); + file_handle.opened_path = opened_path = estrndup(Z_STRVAL_P(filename), Z_STRLEN_P(filename)); } zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL); @@ -655,22 +653,15 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D char *buf; size_t size; - /* enforce two trailing NULLs for flex... */ - if (IS_INTERNED(str->value.str.val)) { - char *tmp = safe_emalloc(1, str->value.str.len, ZEND_MMAP_AHEAD); - memcpy(tmp, str->value.str.val, str->value.str.len + ZEND_MMAP_AHEAD); - str->value.str.val = tmp; - } else { - str->value.str.val = safe_erealloc(str->value.str.val, 1, str->value.str.len, ZEND_MMAP_AHEAD); - } - - memset(str->value.str.val + str->value.str.len, 0, ZEND_MMAP_AHEAD); + /* enforce ZEND_MMAP_AHEAD trailing NULLs for flex... */ + Z_STRVAL_P(str) = str_erealloc(Z_STRVAL_P(str), Z_STRLEN_P(str) + ZEND_MMAP_AHEAD); + memset(Z_STRVAL_P(str) + Z_STRLEN_P(str), 0, ZEND_MMAP_AHEAD); SCNG(yy_in) = NULL; SCNG(yy_start) = NULL; - buf = str->value.str.val; - size = str->value.str.len; + buf = Z_STRVAL_P(str); + size = Z_STRLEN_P(str); if (CG(multibyte)) { SCNG(script_org) = (unsigned char*)buf; @@ -731,7 +722,7 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC) int compiler_result; zend_bool original_in_compilation = CG(in_compilation); - if (source_string->value.str.len==0) { + if (Z_STRLEN_P(source_string)==0) { efree(op_array); return NULL; } @@ -869,11 +860,11 @@ ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter # define zend_copy_value(zendlval, yytext, yyleng) \ if (SCNG(output_filter)) { \ size_t sz = 0; \ - SCNG(output_filter)((unsigned char **)&(zendlval->value.str.val), &sz, (unsigned char *)yytext, (size_t)yyleng TSRMLS_CC); \ - zendlval->value.str.len = sz; \ + SCNG(output_filter)((unsigned char **)&Z_STRVAL_P(zendlval), &sz, (unsigned char *)yytext, (size_t)yyleng TSRMLS_CC); \ + Z_STRLEN_P(zendlval) = sz; \ } else { \ - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); \ - zendlval->value.str.len = yyleng; \ + Z_STRVAL_P(zendlval) = (char *) estrndup(yytext, yyleng); \ + Z_STRLEN_P(zendlval) = yyleng; \ } static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quote_type TSRMLS_DC) @@ -884,8 +875,8 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo ZVAL_STRINGL(zendlval, str, len, 1); /* convert escape sequences */ - s = t = zendlval->value.str.val; - end = s+zendlval->value.str.len; + s = t = Z_STRVAL_P(zendlval); + end = s+Z_STRLEN_P(zendlval); while (svalue.str.len--; + Z_STRLEN_P(zendlval)--; break; case 'r': *t++ = '\r'; - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; break; case 't': *t++ = '\t'; - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; break; case 'f': *t++ = '\f'; - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; break; case 'v': *t++ = '\v'; - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; break; case 'e': #ifdef PHP_WIN32 @@ -921,7 +912,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo #else *t++ = '\e'; #endif - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; break; case '"': case '`': @@ -933,20 +924,20 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo case '\\': case '$': *t++ = *s; - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; break; case 'x': case 'X': if (ZEND_IS_HEX(*(s+1))) { char hex_buf[3] = { 0, 0, 0 }; - zendlval->value.str.len--; /* for the 'x' */ + Z_STRLEN_P(zendlval)--; /* for the 'x' */ hex_buf[0] = *(++s); - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; if (ZEND_IS_HEX(*(s+1))) { hex_buf[1] = *(++s); - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; } *t++ = (char) strtol(hex_buf, NULL, 16); } else { @@ -960,13 +951,13 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo char octal_buf[4] = { 0, 0, 0, 0 }; octal_buf[0] = *s; - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; if (ZEND_IS_OCT(*(s+1))) { octal_buf[1] = *(++s); - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; if (ZEND_IS_OCT(*(s+1))) { octal_buf[2] = *(++s); - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; } } *t++ = (char) strtol(octal_buf, NULL, 8); @@ -988,9 +979,9 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo *t = 0; if (SCNG(output_filter)) { size_t sz = 0; - s = zendlval->value.str.val; - SCNG(output_filter)((unsigned char **)&(zendlval->value.str.val), &sz, (unsigned char *)s, (size_t)zendlval->value.str.len TSRMLS_CC); - zendlval->value.str.len = sz; + s = Z_STRVAL_P(zendlval); + SCNG(output_filter)((unsigned char **)&Z_STRVAL_P(zendlval), &sz, (unsigned char *)s, (size_t)Z_STRLEN_P(zendlval) TSRMLS_CC); + Z_STRLEN_P(zendlval) = sz; efree(s); } } @@ -1020,7 +1011,6 @@ NEWLINE ("\r"|"\n"|"\r\n") /* compute yyleng before each rule */ := yyleng = YYCURSOR - SCNG(yy_text); - "exit" { return T_EXIT; } @@ -1183,9 +1173,7 @@ NEWLINE ("\r"|"\n"|"\r\n") } {WHITESPACE}+ { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */ HANDLE_NEWLINES(yytext, yyleng); return T_WHITESPACE; } @@ -1215,6 +1203,10 @@ NEWLINE ("\r"|"\n"|"\r\n") return T_NS_SEPARATOR; } +"..." { + return T_ELLIPSIS; +} + "new" { return T_NEW; } @@ -1506,30 +1498,29 @@ NEWLINE ("\r"|"\n"|"\r\n") if (len < SIZEOF_LONG * 8) { if (len == 0) { - zendlval->value.lval = 0; + Z_LVAL_P(zendlval) = 0; } else { - zendlval->value.lval = strtol(bin, NULL, 2); + Z_LVAL_P(zendlval) = strtol(bin, NULL, 2); } zendlval->type = IS_LONG; return T_LNUMBER; } else { - zendlval->value.dval = zend_bin_strtod(bin, NULL); - zendlval->type = IS_DOUBLE; + ZVAL_DOUBLE(zendlval, zend_bin_strtod(bin, NULL)); return T_DNUMBER; } } {LNUM} { if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */ - zendlval->value.lval = strtol(yytext, NULL, 0); + Z_LVAL_P(zendlval) = strtol(yytext, NULL, 0); } else { errno = 0; - zendlval->value.lval = strtol(yytext, NULL, 0); + Z_LVAL_P(zendlval) = strtol(yytext, NULL, 0); if (errno == ERANGE) { /* Overflow */ if (yytext[0] == '0') { /* octal overflow */ - zendlval->value.dval = zend_oct_strtod(yytext, NULL); + Z_DVAL_P(zendlval) = zend_oct_strtod(yytext, NULL); } else { - zendlval->value.dval = zend_strtod(yytext, NULL); + Z_DVAL_P(zendlval) = zend_strtod(yytext, NULL); } zendlval->type = IS_DOUBLE; return T_DNUMBER; @@ -1552,120 +1543,80 @@ NEWLINE ("\r"|"\n"|"\r\n") if (len < SIZEOF_LONG * 2 || (len == SIZEOF_LONG * 2 && *hex <= '7')) { if (len == 0) { - zendlval->value.lval = 0; + Z_LVAL_P(zendlval) = 0; } else { - zendlval->value.lval = strtol(hex, NULL, 16); + Z_LVAL_P(zendlval) = strtol(hex, NULL, 16); } zendlval->type = IS_LONG; return T_LNUMBER; } else { - zendlval->value.dval = zend_hex_strtod(hex, NULL); - zendlval->type = IS_DOUBLE; + ZVAL_DOUBLE(zendlval, zend_hex_strtod(hex, NULL)); return T_DNUMBER; } } [0]|([1-9][0-9]*) { /* Offset could be treated as a long */ if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) { - zendlval->value.lval = strtol(yytext, NULL, 10); - zendlval->type = IS_LONG; + ZVAL_LONG(zendlval, strtol(yytext, NULL, 10)); } else { - zendlval->value.str.val = (char *)estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext, yyleng, 1); } return T_NUM_STRING; } {LNUM}|{HNUM}|{BNUM} { /* Offset must be treated as a string */ - zendlval->value.str.val = (char *)estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext, yyleng, 1); return T_NUM_STRING; } {DNUM}|{EXPONENT_DNUM} { - zendlval->value.dval = zend_strtod(yytext, NULL); - zendlval->type = IS_DOUBLE; + ZVAL_DOUBLE(zendlval, zend_strtod(yytext, NULL)); return T_DNUMBER; } "__CLASS__" { - const char *class_name = NULL; - - if (CG(active_class_entry) - && (ZEND_ACC_TRAIT == - (CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT))) { + zend_class_entry *ce = CG(active_class_entry); + if (ce && ZEND_ACC_TRAIT == (ce->ce_flags & ZEND_ACC_TRAIT)) { /* We create a special __CLASS__ constant that is going to be resolved at run-time */ - zendlval->value.str.len = sizeof("__CLASS__")-1; - zendlval->value.str.val = estrndup("__CLASS__", zendlval->value.str.len); + Z_STRLEN_P(zendlval) = sizeof("__CLASS__")-1; + Z_STRVAL_P(zendlval) = estrndup("__CLASS__", Z_STRLEN_P(zendlval)); zendlval->type = IS_CONSTANT; } else { - if (CG(active_class_entry)) { - class_name = CG(active_class_entry)->name; - } - - if (!class_name) { - class_name = ""; + if (ce && ce->name) { + ZVAL_STRINGL(zendlval, ce->name, ce->name_length, 1); + } else { + ZVAL_EMPTY_STRING(zendlval); } - - zendlval->value.str.len = strlen(class_name); - zendlval->value.str.val = estrndup(class_name, zendlval->value.str.len); - zendlval->type = IS_STRING; } return T_CLASS_C; } "__TRAIT__" { - const char *trait_name = NULL; - - if (CG(active_class_entry) - && (ZEND_ACC_TRAIT == - (CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT))) { - trait_name = CG(active_class_entry)->name; - } - - if (!trait_name) { - trait_name = ""; - } - - zendlval->value.str.len = strlen(trait_name); - zendlval->value.str.val = estrndup(trait_name, zendlval->value.str.len); - zendlval->type = IS_STRING; - + zend_class_entry *ce = CG(active_class_entry); + if (ce && ce->name && ZEND_ACC_TRAIT == (ce->ce_flags & ZEND_ACC_TRAIT)) { + ZVAL_STRINGL(zendlval, ce->name, ce->name_length, 1); + } else { + ZVAL_EMPTY_STRING(zendlval); + } return T_TRAIT_C; } "__FUNCTION__" { - const char *func_name = NULL; - - if (CG(active_op_array)) { - func_name = CG(active_op_array)->function_name; - } - - if (!func_name) { - func_name = ""; + zend_op_array *op_array = CG(active_op_array); + if (op_array && op_array->function_name) { + ZVAL_STRING(zendlval, op_array->function_name, 1); + } else { + ZVAL_EMPTY_STRING(zendlval); } - zendlval->value.str.len = strlen(func_name); - zendlval->value.str.val = estrndup(func_name, zendlval->value.str.len); - zendlval->type = IS_STRING; return T_FUNC_C; } "__METHOD__" { const char *class_name = CG(active_class_entry) ? CG(active_class_entry)->name : NULL; const char *func_name = CG(active_op_array)? CG(active_op_array)->function_name : NULL; - size_t len = 0; - - if (class_name) { - len += strlen(class_name) + 2; - } - if (func_name) { - len += strlen(func_name); - } - zendlval->value.str.len = zend_spprintf(&zendlval->value.str.val, 0, "%s%s%s", + Z_STRLEN_P(zendlval) = zend_spprintf(&Z_STRVAL_P(zendlval), 0, "%s%s%s", class_name ? class_name : "", class_name && func_name ? "::" : "", func_name ? func_name : "" @@ -1675,8 +1626,7 @@ NEWLINE ("\r"|"\n"|"\r\n") } "__LINE__" { - zendlval->value.lval = CG(zend_lineno); - zendlval->type = IS_LONG; + ZVAL_LONG(zendlval, CG(zend_lineno)); return T_LINE; } @@ -1686,9 +1636,7 @@ NEWLINE ("\r"|"\n"|"\r\n") if (!filename) { filename = ""; } - zendlval->value.str.len = strlen(filename); - zendlval->value.str.val = estrndup(filename, zendlval->value.str.len); - zendlval->type = IS_STRING; + ZVAL_STRING(zendlval, filename, 1); return T_FILE; } @@ -1713,9 +1661,7 @@ NEWLINE ("\r"|"\n"|"\r\n") #endif } - zendlval->value.str.len = strlen(dirname); - zendlval->value.str.val = dirname; - zendlval->type = IS_STRING; + ZVAL_STRING(zendlval, dirname, 0); return T_DIR; } @@ -1739,9 +1685,7 @@ NEWLINE ("\r"|"\n"|"\r\n") } HANDLE_NEWLINES(yytext, yyleng); - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } @@ -1749,9 +1693,7 @@ NEWLINE ("\r"|"\n"|"\r\n") "<%=" { if (CG(asp_tags)) { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG_WITH_ECHO; } else { @@ -1761,9 +1703,7 @@ NEWLINE ("\r"|"\n"|"\r\n") "value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG_WITH_ECHO; } @@ -1771,9 +1711,7 @@ NEWLINE ("\r"|"\n"|"\r\n") "<%" { if (CG(asp_tags)) { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } else { @@ -1783,9 +1721,7 @@ NEWLINE ("\r"|"\n"|"\r\n") "value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */ HANDLE_NEWLINE(yytext[yyleng-1]); BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; @@ -1794,9 +1730,7 @@ NEWLINE ("\r"|"\n"|"\r\n") "value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } else { @@ -1850,14 +1784,14 @@ inline_html: if (SCNG(output_filter)) { int readsize; size_t sz = 0; - readsize = SCNG(output_filter)((unsigned char **)&(zendlval->value.str.val), &sz, (unsigned char *)yytext, (size_t)yyleng TSRMLS_CC); - zendlval->value.str.len = sz; + readsize = SCNG(output_filter)((unsigned char **)&Z_STRVAL_P(zendlval), &sz, (unsigned char *)yytext, (size_t)yyleng TSRMLS_CC); + Z_STRLEN_P(zendlval) = sz; if (readsize < yyleng) { yyless(readsize); } } else { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; + Z_STRVAL_P(zendlval) = (char *) estrndup(yytext, yyleng); + Z_STRLEN_P(zendlval) = yyleng; } zendlval->type = IS_STRING; HANDLE_NEWLINES(yytext, yyleng); @@ -1985,9 +1919,7 @@ inline_html: } ("?>"|""){NEWLINE}? { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */ BEGIN(INITIAL); return T_CLOSE_TAG; /* implicit ';' at php-end tag */ } @@ -1996,9 +1928,7 @@ inline_html: "%>"{NEWLINE}? { if (CG(asp_tags)) { BEGIN(INITIAL); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - zendlval->value.str.val = yytext; /* no copying - intentional */ + ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */ return T_CLOSE_TAG; /* implicit ';' at php-end tag */ } else { yyless(1); @@ -2032,13 +1962,11 @@ inline_html: } } - zendlval->value.str.val = estrndup(yytext+bprefix+1, yyleng-bprefix-2); - zendlval->value.str.len = yyleng-bprefix-2; - zendlval->type = IS_STRING; + ZVAL_STRINGL(zendlval, yytext+bprefix+1, yyleng-bprefix-2, 1); /* convert escape sequences */ - s = t = zendlval->value.str.val; - end = s+zendlval->value.str.len; + s = t = Z_STRVAL_P(zendlval); + end = s+Z_STRLEN_P(zendlval); while (svalue.str.len--; + Z_STRLEN_P(zendlval)--; break; default: *t++ = '\\'; @@ -2067,9 +1995,9 @@ inline_html: if (SCNG(output_filter)) { size_t sz = 0; - s = zendlval->value.str.val; - SCNG(output_filter)((unsigned char **)&(zendlval->value.str.val), &sz, (unsigned char *)s, (size_t)zendlval->value.str.len TSRMLS_CC); - zendlval->value.str.len = sz; + s = Z_STRVAL_P(zendlval); + SCNG(output_filter)((unsigned char **)&Z_STRVAL_P(zendlval), &sz, (unsigned char *)s, (size_t)Z_STRLEN_P(zendlval) TSRMLS_CC); + Z_STRLEN_P(zendlval) = sz; efree(s); } return T_CONSTANT_ENCAPSED_STRING; @@ -2187,7 +2115,7 @@ inline_html: "{$" { - zendlval->value.lval = (long) '{'; + Z_LVAL_P(zendlval) = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); yyless(1); return T_CURLY_OPEN; diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h index d4adcf5aac982..00209a0ddc81d 100644 --- a/Zend/zend_modules.h +++ b/Zend/zend_modules.h @@ -33,7 +33,7 @@ #define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module TSRMLS_DC #define ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU zend_module TSRMLS_CC -#define ZEND_MODULE_API_NO 20121212 +#define ZEND_MODULE_API_NO 20131106 #ifdef ZTS #define USING_ZTS 1 #else diff --git a/Zend/zend_multibyte.c b/Zend/zend_multibyte.c index dafcf18393578..a75d074936ec8 100644 --- a/Zend/zend_multibyte.c +++ b/Zend/zend_multibyte.c @@ -53,7 +53,7 @@ static size_t dummy_encoding_converter(unsigned char **to, size_t *to_length, co static int dummy_encoding_list_parser(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent TSRMLS_DC) { *return_list = pemalloc(0, persistent); - return_size = 0; + *return_size = 0; return SUCCESS; } diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 921e0d798a069..8beacdfd352b4 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -896,11 +896,8 @@ ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */ zend_call_method_with_2_params(&this_ptr, ce, &ce->__call, ZEND_CALL_FUNC_NAME, &method_result_ptr, method_name_ptr, method_args_ptr); if (method_result_ptr) { - if (Z_ISREF_P(method_result_ptr) || Z_REFCOUNT_P(method_result_ptr) > 1) { - RETVAL_ZVAL(method_result_ptr, 1, 1); - } else { - RETVAL_ZVAL(method_result_ptr, 0, 1); - } + RETVAL_ZVAL_FAST(method_result_ptr); + zval_ptr_dtor(&method_result_ptr); } /* now destruct all auxiliaries */ @@ -1113,11 +1110,8 @@ ZEND_API void zend_std_callstatic_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ zend_call_method_with_2_params(NULL, ce, &ce->__callstatic, ZEND_CALLSTATIC_FUNC_NAME, &method_result_ptr, method_name_ptr, method_args_ptr); if (method_result_ptr) { - if (Z_ISREF_P(method_result_ptr) || Z_REFCOUNT_P(method_result_ptr) > 1) { - RETVAL_ZVAL(method_result_ptr, 1, 1); - } else { - RETVAL_ZVAL(method_result_ptr, 0, 1); - } + RETVAL_ZVAL_FAST(method_result_ptr); + zval_ptr_dtor(&method_result_ptr); } /* now destruct all auxiliaries */ diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c index 1fe5d0c1994cd..b5dd48f798455 100644 --- a/Zend/zend_objects_API.c +++ b/Zend/zend_objects_API.c @@ -57,6 +57,11 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TS obj->dtor(obj->object, i TSRMLS_CC); obj = &objects->object_buckets[i].bucket.obj; obj->refcount--; + + if (obj->refcount == 0) { + /* in case gc_collect_cycle is triggered before free_storage */ + GC_REMOVE_ZOBJ_FROM_BUFFER(obj); + } } } } diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 41b4bd25710fd..ad0879888426c 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -499,7 +499,7 @@ static void zend_check_finally_breakout(zend_op_array *op_array, zend_uint op_nu CG(in_compilation) = 1; CG(active_op_array) = op_array; CG(zend_lineno) = op_array->opcodes[op_num].lineno; - zend_error(E_COMPILE_ERROR, "jump out of a finally block is disallowed"); + zend_error_noreturn(E_COMPILE_ERROR, "jump out of a finally block is disallowed"); } } } @@ -710,7 +710,7 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC) if (op_array->fn_flags & ZEND_ACC_GENERATOR) { if (opline->op1_type != IS_CONST || Z_TYPE_P(opline->op1.zv) != IS_NULL) { CG(zend_lineno) = opline->lineno; - zend_error(E_COMPILE_ERROR, "Generators cannot return values using \"return\""); + zend_error_noreturn(E_COMPILE_ERROR, "Generators cannot return values using \"return\""); } opline->opcode = ZEND_GENERATOR_RETURN; diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 60730121882c5..e8629291e545a 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -192,7 +192,7 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) /* {{{ */ if ((Z_TYPE_P(op)=is_numeric_string(strval, Z_STRLEN_P(op), &Z_LVAL_P(op), &Z_DVAL_P(op), 1)) == 0) { ZVAL_LONG(op, 0); } - STR_FREE(strval); + str_efree(strval); break; } case IS_BOOL: @@ -391,7 +391,7 @@ ZEND_API void convert_to_long_base(zval *op, int base) /* {{{ */ char *strval = Z_STRVAL_P(op); Z_LVAL_P(op) = strtol(strval, NULL, base); - STR_FREE(strval); + str_efree(strval); } break; case IS_ARRAY: @@ -451,7 +451,7 @@ ZEND_API void convert_to_double(zval *op) /* {{{ */ char *strval = Z_STRVAL_P(op); Z_DVAL_P(op) = zend_strtod(strval, NULL); - STR_FREE(strval); + str_efree(strval); } break; case IS_ARRAY: @@ -540,7 +540,7 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */ } else { Z_LVAL_P(op) = 1; } - STR_FREE(strval); + str_efree(strval); } break; case IS_ARRAY: @@ -1153,7 +1153,7 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) / result_str[i] |= Z_STRVAL_P(shorter)[i]; } if (result==op1) { - STR_FREE(Z_STRVAL_P(result)); + str_efree(Z_STRVAL_P(result)); } Z_STRVAL_P(result) = result_str; Z_STRLEN_P(result) = result_len; @@ -1200,7 +1200,7 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) result_str[i] &= Z_STRVAL_P(longer)[i]; } if (result==op1) { - STR_FREE(Z_STRVAL_P(result)); + str_efree(Z_STRVAL_P(result)); } Z_STRVAL_P(result) = result_str; Z_STRLEN_P(result) = result_len; @@ -1247,7 +1247,7 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) result_str[i] ^= Z_STRVAL_P(longer)[i]; } if (result==op1) { - STR_FREE(Z_STRVAL_P(result)); + str_efree(Z_STRVAL_P(result)); } Z_STRVAL_P(result) = result_str; Z_STRLEN_P(result) = result_len; @@ -1313,14 +1313,8 @@ ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */ { int length = Z_STRLEN_P(op1) + 1; - char *buf; + char *buf = str_erealloc(Z_STRVAL_P(op1), length + 1); - if (IS_INTERNED(Z_STRVAL_P(op1))) { - buf = (char *) emalloc(length + 1); - memcpy(buf, Z_STRVAL_P(op1), Z_STRLEN_P(op1)); - } else { - buf = (char *) erealloc(Z_STRVAL_P(op1), length + 1); - } buf[length - 1] = (char) Z_LVAL_P(op2); buf[length] = 0; ZVAL_STRINGL(result, buf, length, 0); @@ -1332,14 +1326,8 @@ ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2) ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */ { int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); - char *buf; + char *buf = str_erealloc(Z_STRVAL_P(op1), length + 1); - if (IS_INTERNED(Z_STRVAL_P(op1))) { - buf = (char *) emalloc(length+1); - memcpy(buf, Z_STRVAL_P(op1), Z_STRLEN_P(op1)); - } else { - buf = (char *) erealloc(Z_STRVAL_P(op1), length+1); - } memcpy(buf + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); buf[length] = 0; ZVAL_STRINGL(result, buf, length, 0); @@ -1842,16 +1830,14 @@ static void increment_string(zval *str) /* {{{ */ int ch; if (Z_STRLEN_P(str) == 0) { - STR_FREE(Z_STRVAL_P(str)); + str_efree(Z_STRVAL_P(str)); Z_STRVAL_P(str) = estrndup("1", sizeof("1")-1); Z_STRLEN_P(str) = 1; return; } if (IS_INTERNED(s)) { - s = (char*) emalloc(Z_STRLEN_P(str) + 1); - memcpy(s, Z_STRVAL_P(str), Z_STRLEN_P(str) + 1); - Z_STRVAL_P(str) = s; + Z_STRVAL_P(str) = s = estrndup(s, Z_STRLEN_P(str)); } while (pos >= 0) { @@ -1909,7 +1895,7 @@ static void increment_string(zval *str) /* {{{ */ t[0] = 'a'; break; } - STR_FREE(Z_STRVAL_P(str)); + str_efree(Z_STRVAL_P(str)); Z_STRVAL_P(str) = t; } } @@ -1999,13 +1985,13 @@ ZEND_API int decrement_function(zval *op1) /* {{{ */ break; case IS_STRING: /* Like perl we only support string increment */ if (Z_STRLEN_P(op1) == 0) { /* consider as 0 */ - STR_FREE(Z_STRVAL_P(op1)); + str_efree(Z_STRVAL_P(op1)); ZVAL_LONG(op1, -1); break; } switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) { case IS_LONG: - STR_FREE(Z_STRVAL_P(op1)); + str_efree(Z_STRVAL_P(op1)); if (lval == LONG_MIN) { double d = (double)lval; ZVAL_DOUBLE(op1, d-1); @@ -2014,7 +2000,7 @@ ZEND_API int decrement_function(zval *op1) /* {{{ */ } break; case IS_DOUBLE: - STR_FREE(Z_STRVAL_P(op1)); + str_efree(Z_STRVAL_P(op1)); ZVAL_DOUBLE(op1, dval - 1); break; } @@ -2235,8 +2221,8 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) /* {{{ */ { int ret1, ret2; int oflow1, oflow2; - long lval1, lval2; - double dval1, dval2; + long lval1 = 0, lval2 = 0; + double dval1 = 0.0, dval2 = 0.0; if ((ret1=is_numeric_string_ex(Z_STRVAL_P(s1), Z_STRLEN_P(s1), &lval1, &dval1, 0, &oflow1)) && (ret2=is_numeric_string_ex(Z_STRVAL_P(s2), Z_STRLEN_P(s2), &lval2, &dval2, 0, &oflow2))) { diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 38d96f1e9b8f0..15ad79e4dbfc5 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -132,7 +132,7 @@ static inline zend_uchar is_numeric_string_ex(const char *str, int length, long { const char *ptr; int base = 10, digits = 0, dp_or_e = 0; - double local_dval; + double local_dval = 0.0; zend_uchar type; if (!length) { diff --git a/Zend/zend_string.h b/Zend/zend_string.h index ebf8c816c11ff..27ba50be3d642 100644 --- a/Zend/zend_string.h +++ b/Zend/zend_string.h @@ -56,12 +56,39 @@ END_EXTERN_C() } \ } while (0) +#define str_efree_rel(s) do { \ + if (!IS_INTERNED(s)) { \ + efree_rel((char *)s); \ + } \ + } while (0) + #define str_free(s) do { \ if (!IS_INTERNED(s)) { \ free((char*)s); \ } \ } while (0) +#define str_erealloc(str, new_len) \ + (IS_INTERNED(str) \ + ? _str_erealloc(str, new_len, INTERNED_LEN(str)) \ + : erealloc(str, new_len)) + +static inline char *_str_erealloc(char *str, size_t new_len, size_t old_len) { + char *buf = (char *) emalloc(new_len); + memcpy(buf, str, old_len); + return buf; +} + +#define str_estrndup(str, len) \ + (IS_INTERNED(str) ? (str) : estrndup((str), (len))) + +#define str_strndup(str, len) \ + (IS_INTERNED(str) ? (str) : zend_strndup((str), (len))); + +#define str_hash(str, len) \ + (IS_INTERNED(str) ? INTERNED_HASH(str) : zend_hash_func((str), (len)+1)) + + #endif /* ZEND_STRING_H */ /* diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c index c0e1849eefa13..d82e1642e78b0 100644 --- a/Zend/zend_variables.c +++ b/Zend/zend_variables.c @@ -33,7 +33,7 @@ ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC) case IS_STRING: case IS_CONSTANT: CHECK_ZVAL_STRING_REL(zvalue); - STR_FREE_REL(zvalue->value.str.val); + str_efree_rel(zvalue->value.str.val); break; case IS_ARRAY: case IS_CONSTANT_ARRAY: { diff --git a/TSRM/tsrm_virtual_cwd.c b/Zend/zend_virtual_cwd.c similarity index 92% rename from TSRM/tsrm_virtual_cwd.c rename to Zend/zend_virtual_cwd.c index a7d09630a26c7..d9da5cf4c0c8e 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/Zend/zend_virtual_cwd.c @@ -30,7 +30,8 @@ #include #include -#include "tsrm_virtual_cwd.h" +#include "zend.h" +#include "zend_virtual_cwd.h" #include "tsrm_strtok_r.h" #ifdef TSRM_WIN32 @@ -126,7 +127,6 @@ static int php_check_dots(const char *element, int n) #define TOKENIZER_STRING "/" #endif - /* default macros */ #ifndef IS_DIRECTORY_UP @@ -149,11 +149,21 @@ static int php_check_dots(const char *element, int n) #define CWD_STATE_COPY(d, s) \ (d)->cwd_length = (s)->cwd_length; \ - (d)->cwd = (char *) malloc((s)->cwd_length+1); \ + (d)->cwd = (char *) emalloc((s)->cwd_length+1); \ memcpy((d)->cwd, (s)->cwd, (s)->cwd_length+1); #define CWD_STATE_FREE(s) \ - free((s)->cwd); + efree((s)->cwd); + +#ifdef TSRM_WIN32 +# define CWD_STATE_FREE_ERR(state) do { \ + DWORD last_error = GetLastError(); \ + CWD_STATE_FREE(state); \ + SetLastError(last_error); \ + } while (0) +#else +# define CWD_STATE_FREE_ERR(state) CWD_STATE_FREE(state) +#endif #ifdef TSRM_WIN32 @@ -286,6 +296,7 @@ CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat) /* {{ WIN32_FILE_ATTRIBUTE_DATA data; __int64 t; const size_t path_len = strlen(path); + ALLOCA_FLAG(use_heap_large); if (!GetFileAttributesEx(path, GetFileExInfoStandard, &data)) { return stat(path, buf); @@ -337,16 +348,15 @@ CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat) /* {{ HANDLE hLink = NULL; REPARSE_DATA_BUFFER * pbuffer; unsigned int retlength = 0; - TSRM_ALLOCA_FLAG(use_heap_large); hLink = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, NULL); if(hLink == INVALID_HANDLE_VALUE) { return -1; } - pbuffer = (REPARSE_DATA_BUFFER *)tsrm_do_alloca(MAXIMUM_REPARSE_DATA_BUFFER_SIZE, use_heap_large); + pbuffer = (REPARSE_DATA_BUFFER *)do_alloca(MAXIMUM_REPARSE_DATA_BUFFER_SIZE, use_heap_large); if(!DeviceIoControl(hLink, FSCTL_GET_REPARSE_POINT, NULL, 0, pbuffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &retlength, NULL)) { - tsrm_free_alloca(pbuffer, use_heap_large); + free_alloca(pbuffer, use_heap_large); CloseHandle(hLink); return -1; } @@ -363,7 +373,7 @@ CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat) /* {{ buf->st_mode |=; } #endif - tsrm_free_alloca(pbuffer, use_heap_large); + free_alloca(pbuffer, use_heap_large); } else { buf->st_mode = (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? (S_IFDIR|S_IEXEC|(S_IEXEC>>3)|(S_IEXEC>>6)) : S_IFREG; buf->st_mode |= (data.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)) : (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)|S_IWRITE|(S_IWRITE>>3)|(S_IWRITE>>6)); @@ -429,7 +439,6 @@ static void cwd_globals_ctor(virtual_cwd_globals *cwd_g TSRMLS_DC) /* {{{ */ static void cwd_globals_dtor(virtual_cwd_globals *cwd_g TSRMLS_DC) /* {{{ */ { - CWD_STATE_FREE(&cwd_g->cwd); realpath_cache_clean(TSRMLS_C); } /* }}} */ @@ -490,6 +499,25 @@ CWD_API void virtual_cwd_shutdown(void) /* {{{ */ } /* }}} */ +CWD_API int virtual_cwd_activate(TSRMLS_D) /* {{{ */ +{ + if (CWDG(cwd).cwd == NULL) { + CWD_STATE_COPY(&CWDG(cwd), &main_cwd_state); + } + return 0; +} +/* }}} */ + +CWD_API int virtual_cwd_deactivate(TSRMLS_D) /* {{{ */ +{ + if (CWDG(cwd).cwd != NULL) { + CWD_STATE_FREE(&CWDG(cwd)); + CWDG(cwd).cwd = NULL; + } + return 0; +} +/* }}} */ + CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC) /* {{{ */ { cwd_state *state; @@ -500,7 +528,7 @@ CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC) /* {{{ */ char *retval; *length = 1; - retval = (char *) malloc(2); + retval = (char *) emalloc(2); if (retval == NULL) { return NULL; } @@ -515,7 +543,7 @@ CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC) /* {{{ */ char *retval; *length = state->cwd_length+1; - retval = (char *) malloc(*length+1); + retval = (char *) emalloc(*length+1); if (retval == NULL) { return NULL; } @@ -527,7 +555,7 @@ CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC) /* {{{ */ } #endif *length = state->cwd_length; - return strdup(state->cwd); + return estrdup(state->cwd); } /* }}} */ @@ -543,12 +571,12 @@ CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC) /* {{{ */ return cwd; } if (length > size-1) { - free(cwd); + efree(cwd); errno = ERANGE; /* Is this OK? */ return NULL; } memcpy(buf, cwd, length+1); - free(cwd); + efree(cwd); return buf; } /* }}} */ @@ -754,13 +782,13 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i #ifdef TSRM_WIN32 WIN32_FIND_DATA data; HANDLE hFind; - TSRM_ALLOCA_FLAG(use_heap_large) + ALLOCA_FLAG(use_heap_large) #else struct stat st; #endif realpath_cache_bucket *bucket; char *tmp; - TSRM_ALLOCA_FLAG(use_heap) + ALLOCA_FLAG(use_heap) while (1) { if (len <= start) { @@ -860,7 +888,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i FindClose(hFind); } - tmp = tsrm_do_alloca(len+1, use_heap); + tmp = do_alloca(len+1, use_heap); memcpy(tmp, path, len+1); if(save && @@ -887,12 +915,12 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i return -1; } - pbuffer = (REPARSE_DATA_BUFFER *)tsrm_do_alloca(MAXIMUM_REPARSE_DATA_BUFFER_SIZE, use_heap_large); + pbuffer = (REPARSE_DATA_BUFFER *)do_alloca(MAXIMUM_REPARSE_DATA_BUFFER_SIZE, use_heap_large); if (pbuffer == NULL) { return -1; } if(!DeviceIoControl(hLink, FSCTL_GET_REPARSE_POINT, NULL, 0, pbuffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &retlength, NULL)) { - tsrm_free_alloca(pbuffer, use_heap_large); + free_alloca(pbuffer, use_heap_large); CloseHandle(hLink); return -1; } @@ -908,7 +936,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i printname_len + 1, printname, MAX_PATH, NULL, NULL )) { - tsrm_free_alloca(pbuffer, use_heap_large); + free_alloca(pbuffer, use_heap_large); return -1; }; printname_len = pbuffer->MountPointReparseBuffer.PrintNameLength / sizeof(WCHAR); @@ -920,7 +948,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i substitutename_len + 1, substitutename, MAX_PATH, NULL, NULL )) { - tsrm_free_alloca(pbuffer, use_heap_large); + free_alloca(pbuffer, use_heap_large); return -1; }; substitutename[substitutename_len] = 0; @@ -934,7 +962,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i printname_len + 1, printname, MAX_PATH, NULL, NULL )) { - tsrm_free_alloca(pbuffer, use_heap_large); + free_alloca(pbuffer, use_heap_large); return -1; }; printname[pbuffer->MountPointReparseBuffer.PrintNameLength / sizeof(WCHAR)] = 0; @@ -945,7 +973,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i substitutename_len + 1, substitutename, MAX_PATH, NULL, NULL )) { - tsrm_free_alloca(pbuffer, use_heap_large); + free_alloca(pbuffer, use_heap_large); return -1; }; substitutename[substitutename_len] = 0; @@ -955,7 +983,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i memcpy(substitutename, path, len + 1); substitutename_len = len; } else { - tsrm_free_alloca(pbuffer, use_heap_large); + free_alloca(pbuffer, use_heap_large); return -1; } @@ -999,21 +1027,21 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i fprintf(stderr, "sub: %s ", substitutename); fprintf(stderr, "resolved: %s ", path); #endif - tsrm_free_alloca(pbuffer, use_heap_large); + free_alloca(pbuffer, use_heap_large); if(isabsolute == 1) { if (!((j == 3) && (path[1] == ':') && (path[2] == '\\'))) { /* use_realpath is 0 in the call below coz path is absolute*/ j = tsrm_realpath_r(path, 0, j, ll, t, 0, is_dir, &directory TSRMLS_CC); if(j < 0) { - tsrm_free_alloca(tmp, use_heap); + free_alloca(tmp, use_heap); return -1; } } } else { if(i + j >= MAXPATHLEN - 1) { - tsrm_free_alloca(tmp, use_heap); + free_alloca(tmp, use_heap); return -1; } @@ -1022,7 +1050,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i path[i-1] = DEFAULT_SLASH; j = tsrm_realpath_r(path, start, i + j, ll, t, use_realpath, is_dir, &directory TSRMLS_CC); if(j < 0) { - tsrm_free_alloca(tmp, use_heap); + free_alloca(tmp, use_heap); return -1; } } @@ -1043,7 +1071,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i #elif defined(NETWARE) save = 0; - tmp = tsrm_do_alloca(len+1, use_heap); + tmp = do_alloca(len+1, use_heap); memcpy(tmp, path, len+1); #else if (save && php_sys_lstat(path, &st) < 0) { @@ -1055,25 +1083,25 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i save = 0; } - tmp = tsrm_do_alloca(len+1, use_heap); + tmp = do_alloca(len+1, use_heap); memcpy(tmp, path, len+1); if (save && S_ISLNK(st.st_mode)) { if (++(*ll) > LINK_MAX || (j = php_sys_readlink(tmp, path, MAXPATHLEN)) < 0) { /* too many links or broken symlinks */ - tsrm_free_alloca(tmp, use_heap); + free_alloca(tmp, use_heap); return -1; } path[j] = 0; if (IS_ABSOLUTE_PATH(path, j)) { j = tsrm_realpath_r(path, 1, j, ll, t, use_realpath, is_dir, &directory TSRMLS_CC); if (j < 0) { - tsrm_free_alloca(tmp, use_heap); + free_alloca(tmp, use_heap); return -1; } } else { if (i + j >= MAXPATHLEN-1) { - tsrm_free_alloca(tmp, use_heap); + free_alloca(tmp, use_heap); return -1; /* buffer overflow */ } memmove(path+i, path, j+1); @@ -1081,7 +1109,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i path[i-1] = DEFAULT_SLASH; j = tsrm_realpath_r(path, start, i + j, ll, t, use_realpath, is_dir, &directory TSRMLS_CC); if (j < 0) { - tsrm_free_alloca(tmp, use_heap); + free_alloca(tmp, use_heap); return -1; } } @@ -1096,7 +1124,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i } if (is_dir && !directory) { /* not a directory */ - tsrm_free_alloca(tmp, use_heap); + free_alloca(tmp, use_heap); return -1; } } @@ -1112,7 +1140,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i } #ifdef TSRM_WIN32 if (j < 0 || j + len - i >= MAXPATHLEN-1) { - tsrm_free_alloca(tmp, use_heap); + free_alloca(tmp, use_heap); return -1; } if (save) { @@ -1127,7 +1155,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i } #else if (j < 0 || j + len - i >= MAXPATHLEN-1) { - tsrm_free_alloca(tmp, use_heap); + free_alloca(tmp, use_heap); return -1; } memcpy(path+j, tmp+i, len-i+1); @@ -1140,7 +1168,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i realpath_cache_add(tmp, len, path, j, directory, *t TSRMLS_CC); } - tsrm_free_alloca(tmp, use_heap); + free_alloca(tmp, use_heap); return j; } } @@ -1316,7 +1344,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func CWD_STATE_COPY(&old_state, state); state->cwd_length = path_length; - tmp = realloc(state->cwd, state->cwd_length+1); + tmp = erealloc(state->cwd, state->cwd_length+1); if (tmp == NULL) { #if VIRTUAL_CWD_DEBUG fprintf (stderr, "Out of memory\n"); @@ -1336,7 +1364,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func } } else { state->cwd_length = path_length; - tmp = realloc(state->cwd, state->cwd_length+1); + tmp = erealloc(state->cwd, state->cwd_length+1); if (tmp == NULL) { #if VIRTUAL_CWD_DEBUG fprintf (stderr, "Out of memory\n"); @@ -1367,7 +1395,7 @@ CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path int length = strlen(path); char *temp; int retval; - TSRM_ALLOCA_FLAG(use_heap) + ALLOCA_FLAG(use_heap) if (length == 0) { return 1; /* Can't cd to empty string */ @@ -1384,14 +1412,14 @@ CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path if (length == COPY_WHEN_ABSOLUTE(path) && IS_ABSOLUTE_PATH(path, length+1)) { /* Also use trailing slash if this is absolute */ length++; } - temp = (char *) tsrm_do_alloca(length+1, use_heap); + temp = (char *) do_alloca(length+1, use_heap); memcpy(temp, path, length); temp[length] = 0; #if VIRTUAL_CWD_DEBUG fprintf (stderr, "Changing directory to %s\n", temp); #endif retval = p_chdir(temp TSRMLS_CC); - tsrm_free_alloca(temp, use_heap); + free_alloca(temp, use_heap); return retval; } /* }}} */ @@ -1404,7 +1432,7 @@ CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC) /* { /* realpath("") returns CWD */ if (!*path) { - new_state.cwd = (char*)malloc(1); + new_state.cwd = (char*)emalloc(1); if (new_state.cwd == NULL) { retval = NULL; goto end; @@ -1417,7 +1445,7 @@ CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC) /* { } else if (!IS_ABSOLUTE_PATH(path, strlen(path))) { CWD_STATE_COPY(&new_state, &CWDG(cwd)); } else { - new_state.cwd = (char*)malloc(1); + new_state.cwd = (char*)emalloc(1); if (new_state.cwd == NULL) { retval = NULL; goto end; @@ -1474,13 +1502,14 @@ CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC) /* {{{ CWD_STATE_COPY(&new_state, &CWDG(cwd)); if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND TSRMLS_CC)) { - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return NULL; } f = fopen(new_state.cwd, mode); - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); + return f; } /* }}} */ @@ -1492,7 +1521,7 @@ CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC) /* {{{ */ CWD_STATE_COPY(&new_state, &CWDG(cwd)); if (virtual_file_ex(&new_state, pathname, NULL, CWD_REALPATH TSRMLS_CC)) { - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return -1; } @@ -1502,7 +1531,7 @@ CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC) /* {{{ */ ret = access(new_state.cwd, mode); #endif - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return ret; } @@ -1565,7 +1594,7 @@ CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC) / CWD_STATE_COPY(&new_state, &CWDG(cwd)); if (virtual_file_ex(&new_state, filename, NULL, CWD_REALPATH TSRMLS_CC)) { - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return -1; } @@ -1575,7 +1604,7 @@ CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC) / ret = utime(new_state.cwd, buf); #endif - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return ret; } /* }}} */ @@ -1588,13 +1617,13 @@ CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC) /* {{{ */ CWD_STATE_COPY(&new_state, &CWDG(cwd)); if (virtual_file_ex(&new_state, filename, NULL, CWD_REALPATH TSRMLS_CC)) { - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return -1; } ret = chmod(new_state.cwd, mode); - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return ret; } /* }}} */ @@ -1607,7 +1636,7 @@ CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int li CWD_STATE_COPY(&new_state, &CWDG(cwd)); if (virtual_file_ex(&new_state, filename, NULL, CWD_REALPATH TSRMLS_CC)) { - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return -1; } @@ -1621,7 +1650,7 @@ CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int li ret = chown(new_state.cwd, owner, group); } - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return ret; } /* }}} */ @@ -1634,7 +1663,7 @@ CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...) /* {{{ */ CWD_STATE_COPY(&new_state, &CWDG(cwd)); if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH TSRMLS_CC)) { - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return -1; } @@ -1650,7 +1679,7 @@ CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...) /* {{{ */ } else { f = open(new_state.cwd, flags); } - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return f; } /* }}} */ @@ -1662,13 +1691,13 @@ CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC) /* {{{ */ CWD_STATE_COPY(&new_state, &CWDG(cwd)); if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH TSRMLS_CC)) { - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return -1; } f = creat(new_state.cwd, mode); - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return f; } /* }}} */ @@ -1681,15 +1710,15 @@ CWD_API int virtual_rename(const char *oldname, const char *newname TSRMLS_DC) / CWD_STATE_COPY(&old_state, &CWDG(cwd)); if (virtual_file_ex(&old_state, oldname, NULL, CWD_EXPAND TSRMLS_CC)) { - CWD_STATE_FREE(&old_state); + CWD_STATE_FREE_ERR(&old_state); return -1; } oldname = old_state.cwd; CWD_STATE_COPY(&new_state, &CWDG(cwd)); if (virtual_file_ex(&new_state, newname, NULL, CWD_EXPAND TSRMLS_CC)) { - CWD_STATE_FREE(&old_state); - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&old_state); + CWD_STATE_FREE_ERR(&new_state); return -1; } newname = new_state.cwd; @@ -1703,8 +1732,8 @@ CWD_API int virtual_rename(const char *oldname, const char *newname TSRMLS_DC) / retval = rename(oldname, newname); #endif - CWD_STATE_FREE(&old_state); - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&old_state); + CWD_STATE_FREE_ERR(&new_state); return retval; } @@ -1717,13 +1746,13 @@ CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC) /* {{{ */ CWD_STATE_COPY(&new_state, &CWDG(cwd)); if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC)) { - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return -1; } retval = php_sys_stat(new_state.cwd, buf); - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return retval; } /* }}} */ @@ -1735,13 +1764,13 @@ CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC) /* {{{ * CWD_STATE_COPY(&new_state, &CWDG(cwd)); if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND TSRMLS_CC)) { - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return -1; } retval = php_sys_lstat(new_state.cwd, buf); - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return retval; } /* }}} */ @@ -1753,13 +1782,13 @@ CWD_API int virtual_unlink(const char *path TSRMLS_DC) /* {{{ */ CWD_STATE_COPY(&new_state, &CWDG(cwd)); if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND TSRMLS_CC)) { - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return -1; } retval = unlink(new_state.cwd); - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return retval; } /* }}} */ @@ -1771,7 +1800,7 @@ CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC) /* {{{ */ CWD_STATE_COPY(&new_state, &CWDG(cwd)); if (virtual_file_ex(&new_state, pathname, NULL, CWD_FILEPATH TSRMLS_CC)) { - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return -1; } @@ -1780,7 +1809,7 @@ CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC) /* {{{ */ #else retval = mkdir(new_state.cwd, mode); #endif - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return retval; } /* }}} */ @@ -1792,13 +1821,13 @@ CWD_API int virtual_rmdir(const char *pathname TSRMLS_DC) /* {{{ */ CWD_STATE_COPY(&new_state, &CWDG(cwd)); if (virtual_file_ex(&new_state, pathname, NULL, CWD_EXPAND TSRMLS_CC)) { - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return -1; } retval = rmdir(new_state.cwd); - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return retval; } /* }}} */ @@ -1814,13 +1843,13 @@ CWD_API DIR *virtual_opendir(const char *pathname TSRMLS_DC) /* {{{ */ CWD_STATE_COPY(&new_state, &CWDG(cwd)); if (virtual_file_ex(&new_state, pathname, NULL, CWD_REALPATH TSRMLS_CC)) { - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return NULL; } retval = opendir(new_state.cwd); - CWD_STATE_FREE(&new_state); + CWD_STATE_FREE_ERR(&new_state); return retval; } /* }}} */ @@ -1882,7 +1911,7 @@ CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC) /* dir_length = CWDG(cwd).cwd_length; dir = CWDG(cwd).cwd; - ptr = command_line = (char *) malloc(command_length + sizeof("cd '' ; ") + dir_length + extra+1+1); + ptr = command_line = (char *) emalloc(command_length + sizeof("cd '' ; ") + dir_length + extra+1+1); if (!command_line) { return NULL; } @@ -1916,7 +1945,7 @@ CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC) /* memcpy(ptr, command, command_length+1); retval = popen(command_line, type); - free(command_line); + efree(command_line); return retval; } /* }}} */ @@ -1929,7 +1958,7 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{ /* realpath("") returns CWD */ if (!*path) { - new_state.cwd = (char*)malloc(1); + new_state.cwd = (char*)emalloc(1); if (new_state.cwd == NULL) { return NULL; } @@ -1940,10 +1969,10 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{ } } else if (!IS_ABSOLUTE_PATH(path, strlen(path)) && VCWD_GETCWD(cwd, MAXPATHLEN)) { - new_state.cwd = strdup(cwd); + new_state.cwd = estrdup(cwd); new_state.cwd_length = strlen(cwd); } else { - new_state.cwd = (char*)malloc(1); + new_state.cwd = (char*)emalloc(1); if (new_state.cwd == NULL) { return NULL; } @@ -1952,7 +1981,7 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{ } if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC)) { - free(new_state.cwd); + efree(new_state.cwd); return NULL; } @@ -1960,7 +1989,7 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{ int copy_len = new_state.cwd_length>MAXPATHLEN-1 ? MAXPATHLEN-1 : new_state.cwd_length; memcpy(real_path, new_state.cwd, copy_len); real_path[copy_len] = '\0'; - free(new_state.cwd); + efree(new_state.cwd); return real_path; } else { return new_state.cwd; diff --git a/TSRM/tsrm_virtual_cwd.h b/Zend/zend_virtual_cwd.h similarity index 99% rename from TSRM/tsrm_virtual_cwd.h rename to Zend/zend_virtual_cwd.h index 72c4424670566..a6ac0aeef7162 100644 --- a/TSRM/tsrm_virtual_cwd.h +++ b/Zend/zend_virtual_cwd.h @@ -151,6 +151,8 @@ typedef int (*verify_path_func)(const cwd_state *); CWD_API void virtual_cwd_startup(void); CWD_API void virtual_cwd_shutdown(void); +CWD_API int virtual_cwd_activate(TSRMLS_D); +CWD_API int virtual_cwd_deactivate(TSRMLS_D); CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC); CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC); CWD_API int virtual_chdir(const char *path TSRMLS_DC); diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 7e4f7a897d2db..572aac5a20706 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1052,10 +1052,8 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST| */ if (OP1_TYPE == IS_CONST) { hash_value = Z_HASH_P(varname); - } else if (IS_INTERNED(Z_STRVAL_P(varname))) { - hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname)); } if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { @@ -1390,11 +1388,6 @@ ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|CV, CONST|TMP|VAR|CV) SAVE_OPLINE(); property = GET_OP2_ZVAL_PTR(BP_VAR_R); - if (OP1_TYPE == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); - EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr; - } - if (IS_OP2_TMP_FREE()) { MAKE_REAL_ZVAL_PTR(property); } @@ -1835,7 +1828,7 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY) EG(current_execute_data) = EX(prev_execute_data); EG(opline_ptr) = NULL; if (!EG(active_symbol_table)) { - i_free_compiled_variables(execute_data); + i_free_compiled_variables(execute_data TSRMLS_CC); } zend_vm_stack_free((char*)execute_data - (ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T) TSRMLS_CC); @@ -1990,7 +1983,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) if (!zend_execute_internal) { /* saves one function call if zend_execute_internal is not used */ - fbc->internal_function.handler(opline->extended_value, ret->var.ptr, (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) ? &ret->var.ptr : NULL, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC); + fbc->internal_function.handler(opline->extended_value, ret->var.ptr, &ret->var.ptr, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC); } else { zend_execute_internal(execute_data, NULL, RETURN_VALUE_USED(opline) TSRMLS_CC); } @@ -2609,7 +2602,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } else { /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); @@ -3281,6 +3274,37 @@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST) ZEND_VM_NEXT_OPCODE(); } +ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, ANY, ANY) +{ + USE_OPLINE + zend_uint arg_num = opline->op1.num; + zend_uint arg_count = zend_vm_stack_get_args_count(TSRMLS_C); + zval **var_ptr, *params; + + SAVE_OPLINE(); + + var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC); + Z_DELREF_PP(var_ptr); + MAKE_STD_ZVAL(params); + *var_ptr = params; + + if (arg_num <= arg_count) { + array_init_size(params, arg_count - arg_num + 1); + } else { + array_init(params); + } + + for (; arg_num <= arg_count; ++arg_num) { + zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC); + zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC); + zend_hash_next_index_insert(Z_ARRVAL_P(params), param, sizeof(zval *), NULL); + Z_ADDREF_PP(param); + } + + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); +} + ZEND_VM_HANDLER(52, ZEND_BOOL, CONST|TMP|VAR|CV, ANY) { USE_OPLINE @@ -3640,11 +3664,7 @@ ZEND_VM_C_LABEL(num_index): hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index)); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; @@ -3992,11 +4012,7 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV) hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_dim)); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); @@ -4476,22 +4492,21 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST| { USE_OPLINE zend_free_op free_op1, free_op2; - zval **container; + zval *container; zval **value = NULL; int result = 0; ulong hval; zval *offset; SAVE_OPLINE(); - container = GET_OP1_OBJ_ZVAL_PTR_PTR_FAST(BP_VAR_IS); - + container = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_IS); offset = GET_OP2_ZVAL_PTR(BP_VAR_R); - if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) { + if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) { HashTable *ht; int isset = 0; - ht = Z_ARRVAL_PP(container); + ht = Z_ARRVAL_P(container); switch (Z_TYPE_P(offset)) { case IS_DOUBLE: @@ -4510,14 +4525,8 @@ ZEND_VM_C_LABEL(num_index_prop): if (OP2_TYPE == IS_CONST) { hval = Z_HASH_P(offset); } else { - if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_prop)); - } - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_prop)); + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; @@ -4547,20 +4556,20 @@ ZEND_VM_C_LABEL(num_index_prop): } } FREE_OP2(); - } else if (Z_TYPE_PP(container) == IS_OBJECT) { + } else if (Z_TYPE_P(container) == IS_OBJECT) { if (IS_OP2_TMP_FREE()) { MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - if (Z_OBJ_HT_P(*container)->has_property) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_property) { + result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check property of non-object"); result = 0; } } else { - if (Z_OBJ_HT_P(*container)->has_dimension) { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_dimension) { + result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check element of non-array"); result = 0; @@ -4571,7 +4580,7 @@ ZEND_VM_C_LABEL(num_index_prop): } else { FREE_OP2(); } - } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + } else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { @@ -4589,11 +4598,11 @@ ZEND_VM_C_LABEL(num_index_prop): } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; } } @@ -4610,7 +4619,7 @@ ZEND_VM_C_LABEL(num_index_prop): Z_LVAL(EX_T(opline->result.var).tmp_var) = !result; } - FREE_OP1_VAR_PTR_FAST(); + FREE_OP1_IF_VAR(); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -5194,7 +5203,7 @@ ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST) zval_copy_ctor(&c.value); } c.flags = CONST_CS; /* non persistent, case sensetive */ - c.name = IS_INTERNED(Z_STRVAL_P(name)) ? Z_STRVAL_P(name) : zend_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name)); + c.name = str_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name)); c.name_len = Z_STRLEN_P(name)+1; c.module_number = PHP_USER_CONSTANT; diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 9622fee5e4efa..7ad7dcf463f51 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -20,6 +20,13 @@ #ifdef ZEND_WIN32 # pragma warning(once : 4101) +# pragma warning(once : 6235) +# pragma warning(once : 6237) +# pragma warning(once : 6239) +# pragma warning(once : 6240) +# pragma warning(once : 6285) +# pragma warning(once : 6286) +# pragma warning(once : 6326) #endif static user_opcode_handler_t zend_user_opcode_handlers[256] = { (user_opcode_handler_t)NULL, @@ -389,7 +396,7 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS) EG(current_execute_data) = EX(prev_execute_data); EG(opline_ptr) = NULL; if (!EG(active_symbol_table)) { - i_free_compiled_variables(execute_data); + i_free_compiled_variables(execute_data TSRMLS_CC); } zend_vm_stack_free((char*)execute_data - (ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T) TSRMLS_CC); @@ -544,7 +551,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR if (!zend_execute_internal) { /* saves one function call if zend_execute_internal is not used */ - fbc->internal_function.handler(opline->extended_value, ret->var.ptr, (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) ? &ret->var.ptr : NULL, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC); + fbc->internal_function.handler(opline->extended_value, ret->var.ptr, &ret->var.ptr, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC); } else { zend_execute_internal(execute_data, NULL, RETURN_VALUE_USED(opline) TSRMLS_CC); } @@ -735,6 +742,37 @@ static int ZEND_FASTCALL ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL ZEND_RECV_VARIADIC_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + zend_uint arg_num = opline->op1.num; + zend_uint arg_count = zend_vm_stack_get_args_count(TSRMLS_C); + zval **var_ptr, *params; + + SAVE_OPLINE(); + + var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC); + Z_DELREF_PP(var_ptr); + MAKE_STD_ZVAL(params); + *var_ptr = params; + + if (arg_num <= arg_count) { + array_init_size(params, arg_count - arg_num + 1); + } else { + array_init(params); + } + + for (; arg_num <= arg_count; ++arg_num) { + zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC); + zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC); + zend_hash_next_index_insert(Z_ARRVAL_P(params), param, sizeof(zval *), NULL); + Z_ADDREF_PP(param); + } + + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); +} + static int ZEND_FASTCALL ZEND_NEW_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -1716,7 +1754,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ zend_error_noreturn(E_ERROR, "Class name must be a valid object or a string"); } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -1765,7 +1803,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval); } efree(lcname); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); call->object = NULL; call->called_scope = NULL; call->is_ctor_call = 0; @@ -1784,7 +1822,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H /* Delay closure destruction until its invocation */ call->fbc->common.prototype = (zend_function*)function_name; } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } call->is_ctor_call = 0; EX(call) = call; @@ -1855,7 +1893,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H } call->is_ctor_call = 0; EX(call) = call; - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } else { @@ -3390,10 +3428,8 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type */ if (IS_CONST == IS_CONST) { hash_value = Z_HASH_P(varname); - } else if (IS_INTERNED(Z_STRVAL_P(varname))) { - hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname)); } if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { @@ -3654,7 +3690,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER( /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } else { /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); @@ -3840,11 +3876,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_O hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; @@ -4073,7 +4105,7 @@ static int ZEND_FASTCALL ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER(ZEND_OPCOD zval_copy_ctor(&c.value); } c.flags = CONST_CS; /* non persistent, case sensetive */ - c.name = IS_INTERNED(Z_STRVAL_P(name)) ? Z_STRVAL_P(name) : zend_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name)); + c.name = str_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name)); c.name_len = Z_STRLEN_P(name)+1; c.module_number = PHP_USER_CONSTANT; @@ -4647,7 +4679,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } else { /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); @@ -4737,11 +4769,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPC hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; @@ -4944,7 +4972,7 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR opline->op1.zv, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -4959,7 +4987,7 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR opline->op1.zv, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -4974,7 +5002,7 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR opline->op1.zv, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -4989,7 +5017,7 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR opline->op1.zv, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -5004,7 +5032,7 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR opline->op1.zv, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -5019,7 +5047,7 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG opline->op1.zv, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -5034,7 +5062,7 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG opline->op1.zv, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -5049,7 +5077,7 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER opline->op1.zv, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -5064,7 +5092,7 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_H opline->op1.zv, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -5081,7 +5109,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCO _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); Z_LVAL_P(result) = !Z_LVAL_P(result); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -5097,7 +5125,7 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDL opline->op1.zv, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC)); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -5113,7 +5141,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_H opline->op1.zv, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC)); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -5129,7 +5157,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAN opline->op1.zv, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC)); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -5145,7 +5173,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_VAR_HANDLER(ZEND_O opline->op1.zv, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC)); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -5160,7 +5188,7 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ opline->op1.zv, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -5175,7 +5203,7 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER opline->op1.zv, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -5190,7 +5218,7 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER opline->op1.zv, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -5205,7 +5233,7 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDL opline->op1.zv, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -5265,10 +5293,8 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type, */ if (IS_CONST == IS_CONST) { hash_value = Z_HASH_P(varname); - } else if (IS_INTERNED(Z_STRVAL_P(varname))) { - hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname)); } if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { @@ -5385,12 +5411,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HA if (IS_CONST == IS_TMP_VAR || IS_CONST == IS_CONST) { zval *container = opline->op1.zv; zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } else { container = NULL; zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); if (IS_CONST == IS_VAR && !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { } @@ -5484,7 +5510,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE } } if (IS_VAR != IS_CONST) { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } } else { if (UNEXPECTED(ce->constructor == NULL)) { @@ -5505,7 +5531,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } else { /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); @@ -5533,7 +5559,7 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_A opline->op1.zv, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -5595,11 +5621,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPC hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; @@ -5612,7 +5634,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPC /* do nothing */ break; } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } else { zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL); } @@ -5930,7 +5952,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ generator->largest_used_integer_key = Z_LVAL_P(generator->key); } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; @@ -6011,10 +6033,8 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ */ if (IS_CONST == IS_CONST) { hash_value = Z_HASH_P(varname); - } else if (IS_INTERNED(Z_STRVAL_P(varname))) { - hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname)); } if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { @@ -6225,7 +6245,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } else { /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); @@ -6300,11 +6320,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_ hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; @@ -7085,7 +7101,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } else { /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); @@ -7234,11 +7250,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCO hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; @@ -8771,10 +8783,8 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type, */ if (IS_TMP_VAR == IS_CONST) { hash_value = Z_HASH_P(varname); - } else if (IS_INTERNED(Z_STRVAL_P(varname))) { - hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname)); } if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { @@ -9126,11 +9136,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPC hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; @@ -9985,11 +9991,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCOD hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; @@ -10192,7 +10194,7 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); zval_dtor(free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -10207,7 +10209,7 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); zval_dtor(free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -10222,7 +10224,7 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); zval_dtor(free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -10237,7 +10239,7 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); zval_dtor(free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -10252,7 +10254,7 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); zval_dtor(free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -10267,7 +10269,7 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); zval_dtor(free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -10282,7 +10284,7 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); zval_dtor(free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -10297,7 +10299,7 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_A _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); zval_dtor(free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -10312,7 +10314,7 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HAN _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); zval_dtor(free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -10329,7 +10331,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); Z_LVAL_P(result) = !Z_LVAL_P(result); zval_dtor(free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -10345,7 +10347,7 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC)); zval_dtor(free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -10361,7 +10363,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HAN _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC)); zval_dtor(free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -10377,7 +10379,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDL _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC)); zval_dtor(free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -10393,7 +10395,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMP_VAR_HANDLER(ZEND_OPC _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC)); zval_dtor(free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -10408,7 +10410,7 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); zval_dtor(free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -10423,7 +10425,7 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_A _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); zval_dtor(free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -10438,7 +10440,7 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_A _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); zval_dtor(free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -10453,7 +10455,7 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); zval_dtor(free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -10513,10 +10515,8 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE */ if (IS_TMP_VAR == IS_CONST) { hash_value = Z_HASH_P(varname); - } else if (IS_INTERNED(Z_STRVAL_P(varname))) { - hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname)); } if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { @@ -10633,12 +10633,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HAND if (IS_TMP_VAR == IS_TMP_VAR || IS_TMP_VAR == IS_CONST) { zval *container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); zval_dtor(free_op1.var); } else { container = NULL; zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); if (IS_TMP_VAR == IS_VAR && !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { } @@ -10687,7 +10687,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ * which aren't affected by FREE_OP(Ts, )'s anyway, unless they're * string offsets or overloaded objects */ - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -10745,7 +10745,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE } } else { if (UNEXPECTED(EG(exception) != NULL)) { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); HANDLE_EXCEPTION(); } zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); @@ -10767,7 +10767,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE call->is_ctor_call = 0; EX(call) = call; - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -10783,7 +10783,7 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -10845,11 +10845,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; @@ -10862,7 +10858,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD /* do nothing */ break; } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } else { zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL); } @@ -11180,7 +11176,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR generator->largest_used_integer_key = Z_LVAL_P(generator->key); } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; @@ -11261,10 +11257,8 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type, */ if (IS_TMP_VAR == IS_CONST) { hash_value = Z_HASH_P(varname); - } else if (IS_INTERNED(Z_STRVAL_P(varname))) { - hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname)); } if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { @@ -11427,11 +11421,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OP hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; @@ -12283,11 +12273,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; @@ -12488,7 +12474,7 @@ static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) SAVE_OPLINE(); bitwise_not_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -12501,7 +12487,7 @@ static int ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG SAVE_OPLINE(); boolean_not_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -12523,7 +12509,7 @@ static int ZEND_FASTCALL ZEND_PRE_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS PZVAL_LOCK(&EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -12548,7 +12534,7 @@ static int ZEND_FASTCALL ZEND_PRE_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS AI_SET_PTR(&EX_T(opline->result.var), *var_ptr); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -12570,7 +12556,7 @@ static int ZEND_FASTCALL ZEND_PRE_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS PZVAL_LOCK(&EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -12595,7 +12581,7 @@ static int ZEND_FASTCALL ZEND_PRE_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS AI_SET_PTR(&EX_T(opline->result.var), *var_ptr); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -12614,7 +12600,7 @@ static int ZEND_FASTCALL ZEND_POST_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG } if (IS_VAR == IS_VAR && UNEXPECTED(*var_ptr == &EG(error_zval))) { ZVAL_NULL(&EX_T(opline->result.var).tmp_var); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -12638,7 +12624,7 @@ static int ZEND_FASTCALL ZEND_POST_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG fast_increment_function(*var_ptr); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -12657,7 +12643,7 @@ static int ZEND_FASTCALL ZEND_POST_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG } if (IS_VAR == IS_VAR && UNEXPECTED(*var_ptr == &EG(error_zval))) { ZVAL_NULL(&EX_T(opline->result.var).tmp_var); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -12681,7 +12667,7 @@ static int ZEND_FASTCALL ZEND_POST_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG fast_decrement_function(*var_ptr); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -12700,7 +12686,7 @@ static int ZEND_FASTCALL ZEND_ECHO_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } zend_print_variable(z); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -12727,7 +12713,7 @@ static int ZEND_FASTCALL ZEND_JMPZ_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ret = Z_LVAL_P(val); } else { ret = i_zend_is_true(val); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -12757,7 +12743,7 @@ static int ZEND_FASTCALL ZEND_JMPNZ_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ret = Z_LVAL_P(val); } else { ret = i_zend_is_true(val); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -12787,7 +12773,7 @@ static int ZEND_FASTCALL ZEND_JMPZNZ_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) retval = Z_LVAL_P(val); } else { retval = i_zend_is_true(val); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -12821,7 +12807,7 @@ static int ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS retval = Z_LVAL_P(val); } else { retval = i_zend_is_true(val); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -12852,7 +12838,7 @@ static int ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG retval = Z_LVAL_P(val); } else { retval = i_zend_is_true(val); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -12893,7 +12879,7 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) retval_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); if (!EG(return_value_ptr_ptr)) { - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } else { if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR || @@ -12906,7 +12892,7 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_copy_ctor(ret); } *EG(return_value_ptr_ptr) = ret; - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } else if ((IS_VAR == IS_CV || IS_VAR == IS_VAR) && retval_ptr == &EG(uninitialized_zval)) { zval *ret; @@ -12943,7 +12929,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE retval_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); if (!EG(return_value_ptr_ptr)) { if (IS_VAR == IS_TMP_VAR) { - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } } else if (!0) { /* Not a temp var */ zval *ret; @@ -12993,7 +12979,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE } } while (0); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } @@ -13024,7 +13010,7 @@ static int ZEND_FASTCALL ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_throw_exception_object(exception TSRMLS_CC); zend_exception_restore(TSRMLS_C); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); HANDLE_EXCEPTION(); } @@ -13048,7 +13034,7 @@ static int ZEND_FASTCALL zend_send_by_var_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_AR ALLOC_ZVAL(varptr); INIT_PZVAL_COPY(varptr, original_var); zval_copy_ctor(varptr); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } else { Z_UNSET_ISREF_P(varptr); } @@ -13099,7 +13085,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND if (!0) { zval_copy_ctor(valptr); } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); zend_vm_stack_push(valptr TSRMLS_CC); } CHECK_EXCEPTION(); @@ -13138,7 +13124,7 @@ static int ZEND_FASTCALL ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG Z_ADDREF_P(varptr); zend_vm_stack_push(varptr TSRMLS_CC); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -13164,7 +13150,7 @@ static int ZEND_FASTCALL ZEND_BOOL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) SAVE_OPLINE(); /* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */ ZVAL_BOOL(retval, i_zend_is_true(_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC))); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -13241,7 +13227,7 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) AI_SET_PTR(&EX_T(opline->result.var), retval); } } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -13283,7 +13269,7 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (use_copy) { ZVAL_COPY_VALUE(result, &var_copy); if (0) { - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } } else { ZVAL_COPY_VALUE(result, expr); @@ -13300,7 +13286,7 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) convert_to_object(result); break; } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -13389,7 +13375,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND if (tmp_inc_filename) { zval_ptr_dtor(&tmp_inc_filename); } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } else if (EXPECTED(new_op_array != NULL)) { @@ -13525,13 +13511,13 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_RESET_REFERENCE TSRMLS_CC); if (IS_VAR == IS_VAR && !(opline->extended_value & ZEND_FE_RESET_VARIABLE)) { - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } if (iter && EXPECTED(EG(exception) == NULL)) { array_ptr = zend_iterator_wrap(iter TSRMLS_CC); } else { if (IS_VAR == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) { - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; } if (!EG(exception)) { zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Object of type %s did not create an Iterator", ce->name); @@ -13550,7 +13536,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG if (UNEXPECTED(EG(exception) != NULL)) { zval_ptr_dtor(&array_ptr); if (IS_VAR == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) { - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; } HANDLE_EXCEPTION(); } @@ -13559,7 +13545,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG if (UNEXPECTED(EG(exception) != NULL)) { zval_ptr_dtor(&array_ptr); if (IS_VAR == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) { - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; } HANDLE_EXCEPTION(); } @@ -13591,7 +13577,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG } if (IS_VAR == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) { - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; } if (is_empty) { ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num); @@ -13747,7 +13733,7 @@ static int ZEND_FASTCALL ZEND_EXIT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { zend_print_variable(ptr); } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } #endif zend_bailout(); @@ -13768,14 +13754,14 @@ static int ZEND_FASTCALL ZEND_JMP_SET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS if (!0) { zendi_zval_copy_ctor(EX_T(opline->result.var).tmp_var); } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.opline_num); #endif ZEND_VM_JMP(opline->op2.jmp_addr); } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -13803,14 +13789,14 @@ static int ZEND_FASTCALL ZEND_JMP_SET_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ zval_copy_ctor(EX_T(opline->result.var).var.ptr); } } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.opline_num); #endif ZEND_VM_JMP(opline->op2.jmp_addr); } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -13828,7 +13814,7 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR if (!0) { zval_copy_ctor(&EX_T(opline->result.var).tmp_var); } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -13856,7 +13842,7 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE } } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -13877,7 +13863,7 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_A result = 0; } ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, result); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -13891,7 +13877,7 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR fast_add_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), opline->op2.zv TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -13906,7 +13892,7 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR fast_sub_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), opline->op2.zv TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -13921,7 +13907,7 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR fast_mul_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), opline->op2.zv TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -13936,7 +13922,7 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR fast_div_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), opline->op2.zv TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -13951,7 +13937,7 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR fast_mod_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), opline->op2.zv TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -13966,7 +13952,7 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG shift_left_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), opline->op2.zv TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -13981,7 +13967,7 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG shift_right_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), opline->op2.zv TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -13996,7 +13982,7 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER concat_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), opline->op2.zv TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -14011,7 +13997,7 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H is_identical_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), opline->op2.zv TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -14028,7 +14014,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), opline->op2.zv TSRMLS_CC); Z_LVAL_P(result) = !Z_LVAL_P(result); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -14044,7 +14030,7 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDL ZVAL_BOOL(result, fast_equal_function(result, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), opline->op2.zv TSRMLS_CC)); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -14060,7 +14046,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H ZVAL_BOOL(result, fast_not_equal_function(result, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), opline->op2.zv TSRMLS_CC)); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -14076,7 +14062,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAN ZVAL_BOOL(result, fast_is_smaller_function(result, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), opline->op2.zv TSRMLS_CC)); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -14092,7 +14078,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_VAR_CONST_HANDLER(ZEND_O ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), opline->op2.zv TSRMLS_CC)); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -14107,7 +14093,7 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ bitwise_or_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), opline->op2.zv TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -14122,7 +14108,7 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER bitwise_and_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), opline->op2.zv TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -14137,7 +14123,7 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER bitwise_xor_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), opline->op2.zv TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -14152,7 +14138,7 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDL boolean_xor_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), opline->op2.zv TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -14263,7 +14249,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*b FREE_OP(free_op_data1); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* assign_obj has two opcodes! */ CHECK_EXCEPTION(); ZEND_VM_INC_OPCODE(); @@ -14318,7 +14304,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_CONST(int (*binar AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); if (opline->extended_value == ZEND_ASSIGN_DIM) { ZEND_VM_INC_OPCODE(); @@ -14349,11 +14335,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_CONST(int (*binar if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); FREE_OP_VAR_PTR(free_op_data2); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_INC_OPCODE(); } else { - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); } ZEND_VM_NEXT_OPCODE(); @@ -14443,7 +14429,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t PZVAL_LOCK(&EG(uninitialized_zval)); *retval = &EG(uninitialized_zval); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -14503,7 +14489,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t } else { } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -14544,7 +14530,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_ zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); ZVAL_NULL(retval); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -14605,7 +14591,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_ } else { } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -14654,7 +14640,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type, if (IS_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -14664,7 +14650,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type, ce = EX_T(opline->op2.var).class_entry; } retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); /* @@ -14675,10 +14661,8 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type, */ if (IS_VAR == IS_CONST) { hash_value = Z_HASH_P(varname); - } else if (IS_INTERNED(Z_STRVAL_P(varname))) { - hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname)); } if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { @@ -14703,11 +14687,11 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type, switch (opline->extended_value & ZEND_FETCH_TYPE_MASK) { case ZEND_FETCH_GLOBAL: if (IS_VAR != IS_TMP_VAR) { - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } break; case ZEND_FETCH_LOCAL: - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); break; case ZEND_FETCH_STATIC: zval_update_constant(retval, (void*) 1 TSRMLS_CC); @@ -14796,13 +14780,13 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HA zval *container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } else { container = _get_zval_ptr_ptr_var_fast(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); if (IS_VAR == IS_VAR && !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } } @@ -14827,7 +14811,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HA if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* We are going to assign the result by reference */ if (UNEXPECTED(opline->extended_value != 0)) { @@ -14861,7 +14845,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -14876,7 +14860,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H container = _get_zval_ptr_ptr_var_fast(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_IS TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -14899,7 +14883,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CONST_HANDLER(ZEND_OP EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; } else { if (IS_CONST == IS_UNUSED) { zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); @@ -14907,7 +14891,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CONST_HANDLER(ZEND_OP container = _get_zval_ptr_ptr_var_fast(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -14935,7 +14919,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCOD if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; if (UNEXPECTED(EX_T(opline->result.var).var.ptr_ptr == NULL)) { zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); ZEND_VM_NEXT_OPCODE(); @@ -14992,7 +14976,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_CONST( } } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -15012,11 +14996,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HA SAVE_OPLINE(); property = opline->op2.zv; - if (IS_VAR == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); - EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr; - } - if (0) { MAKE_REAL_ZVAL_PTR(property); } @@ -15034,7 +15013,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HA if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* We are going to assign the result by reference */ if (opline->extended_value & ZEND_FETCH_MAKE_REF) { @@ -15077,7 +15056,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -15119,7 +15098,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H } } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -15153,7 +15132,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CONST_HANDLER(ZEND_OP if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } else { @@ -15192,7 +15171,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCOD if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; PZVAL_UNLOCK(*EX_T(opline->result.var).var.ptr_ptr, &free_res); if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) { @@ -15227,7 +15206,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAN } else { } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* assign_obj has two opcodes! */ CHECK_EXCEPTION(); ZEND_VM_INC_OPCODE(); @@ -15307,7 +15286,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAN FREE_OP_VAR_PTR(free_op_data2); FREE_OP_IF_VAR(free_op_data1); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* assign_dim has two opcodes! */ CHECK_EXCEPTION(); ZEND_VM_INC_OPCODE(); @@ -15361,7 +15340,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER } } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* zend_assign_to_variable() always takes care of op2, never free it! */ @@ -15443,7 +15422,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO call->is_ctor_call = 0; EX(call) = call; - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -15554,7 +15533,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } else { /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); @@ -15714,7 +15693,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPC INIT_PZVAL_COPY(new_expr, expr_ptr); expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } else if (IS_VAR == IS_CV) { Z_ADDREF_P(expr_ptr); } @@ -15740,11 +15719,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPC hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; @@ -15762,7 +15737,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPC zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL); } if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) { - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -15831,7 +15806,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND } else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) { zval_ptr_dtor(&varname); } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); HANDLE_EXCEPTION(); } if (UNEXPECTED(ce == NULL)) { @@ -15855,7 +15830,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND } else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) { zval_ptr_dtor(&varname); } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -15899,11 +15874,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); @@ -15954,7 +15925,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND } else { } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -15995,7 +15966,7 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND } else { } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16065,7 +16036,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPC if (IS_VAR != IS_CONST && varname == &tmp) { zval_dtor(&tmp); } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } if (opline->extended_value & ZEND_ISSET) { @@ -16090,22 +16061,21 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST( { USE_OPLINE zend_free_op free_op1; - zval **container; + zval *container; zval **value = NULL; int result = 0; ulong hval; zval *offset; SAVE_OPLINE(); - container = _get_zval_ptr_ptr_var_fast(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); - + container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); offset = opline->op2.zv; - if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) { + if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) { HashTable *ht; int isset = 0; - ht = Z_ARRVAL_PP(container); + ht = Z_ARRVAL_P(container); switch (Z_TYPE_P(offset)) { case IS_DOUBLE: @@ -16124,14 +16094,8 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST( if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); - } - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; @@ -16161,20 +16125,20 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST( } } - } else if (Z_TYPE_PP(container) == IS_OBJECT) { + } else if (Z_TYPE_P(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - if (Z_OBJ_HT_P(*container)->has_property) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_property) { + result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check property of non-object"); result = 0; } } else { - if (Z_OBJ_HT_P(*container)->has_dimension) { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_dimension) { + result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check element of non-array"); result = 0; @@ -16185,7 +16149,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST( } else { } - } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + } else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { @@ -16203,11 +16167,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST( } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; } } @@ -16224,7 +16188,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST( Z_LVAL(EX_T(opline->result.var).tmp_var) = !result; } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16306,7 +16270,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ generator->value = *value_ptr; } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; } } else { zval *value = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -16326,7 +16290,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ } generator->value = copy; - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } else { if (IS_VAR == IS_CV) { Z_ADDREF_P(value); @@ -16405,7 +16369,7 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS fast_add_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); zval_dtor(free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16420,7 +16384,7 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS fast_sub_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); zval_dtor(free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16435,7 +16399,7 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS fast_mul_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); zval_dtor(free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16450,7 +16414,7 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS fast_div_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); zval_dtor(free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16465,7 +16429,7 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS fast_mod_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); zval_dtor(free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16480,7 +16444,7 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) shift_left_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); zval_dtor(free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16495,7 +16459,7 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) shift_right_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); zval_dtor(free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16510,7 +16474,7 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_A concat_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); zval_dtor(free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16525,7 +16489,7 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN is_identical_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); zval_dtor(free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16542,7 +16506,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); Z_LVAL_P(result) = !Z_LVAL_P(result); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); zval_dtor(free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16558,7 +16522,7 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER ZVAL_BOOL(result, fast_equal_function(result, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC)); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); zval_dtor(free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16574,7 +16538,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN ZVAL_BOOL(result, fast_not_equal_function(result, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC)); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); zval_dtor(free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16590,7 +16554,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDL ZVAL_BOOL(result, fast_is_smaller_function(result, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC)); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); zval_dtor(free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16606,7 +16570,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_VAR_TMP_HANDLER(ZEND_OPC ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC)); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); zval_dtor(free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16621,7 +16585,7 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR bitwise_or_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); zval_dtor(free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16636,7 +16600,7 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_A bitwise_and_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); zval_dtor(free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16651,7 +16615,7 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_A bitwise_xor_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); zval_dtor(free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16666,7 +16630,7 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER boolean_xor_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); zval_dtor(free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16777,7 +16741,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*bin FREE_OP(free_op_data1); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* assign_obj has two opcodes! */ CHECK_EXCEPTION(); ZEND_VM_INC_OPCODE(); @@ -16832,7 +16796,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_TMP(int (*binary_ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); } zval_dtor(free_op2.var); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); if (opline->extended_value == ZEND_ASSIGN_DIM) { ZEND_VM_INC_OPCODE(); @@ -16864,11 +16828,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_TMP(int (*binary_ if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); FREE_OP_VAR_PTR(free_op_data2); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_INC_OPCODE(); } else { - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); } ZEND_VM_NEXT_OPCODE(); @@ -16958,7 +16922,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t i PZVAL_LOCK(&EG(uninitialized_zval)); *retval = &EG(uninitialized_zval); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -17018,7 +16982,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t i } else { zval_dtor(free_op2.var); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -17059,7 +17023,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); zval_dtor(free_op2.var); ZVAL_NULL(retval); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -17120,7 +17084,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t } else { zval_dtor(free_op2.var); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -17147,13 +17111,13 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAND zval *container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC); zval_dtor(free_op2.var); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } else { container = _get_zval_ptr_ptr_var_fast(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC); zval_dtor(free_op2.var); if (IS_VAR == IS_VAR && !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } } @@ -17178,7 +17142,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAND if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* We are going to assign the result by reference */ if (UNEXPECTED(opline->extended_value != 0)) { @@ -17212,7 +17176,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -17227,7 +17191,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN container = _get_zval_ptr_ptr_var_fast(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_IS TSRMLS_CC); zval_dtor(free_op2.var); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -17250,7 +17214,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_TMP_HANDLER(ZEND_OPCO EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } zval_dtor(free_op2.var); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; } else { if (IS_TMP_VAR == IS_UNUSED) { zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); @@ -17258,7 +17222,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_TMP_HANDLER(ZEND_OPCO container = _get_zval_ptr_ptr_var_fast(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC); zval_dtor(free_op2.var); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -17286,7 +17250,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_ if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; if (UNEXPECTED(EX_T(opline->result.var).var.ptr_ptr == NULL)) { zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); ZEND_VM_NEXT_OPCODE(); @@ -17343,7 +17307,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_TMP(ZE } } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -17363,11 +17327,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAND SAVE_OPLINE(); property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); - if (IS_VAR == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); - EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr; - } - if (1) { MAKE_REAL_ZVAL_PTR(property); } @@ -17385,7 +17344,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAND if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* We are going to assign the result by reference */ if (opline->extended_value & ZEND_FETCH_MAKE_REF) { @@ -17428,7 +17387,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -17470,7 +17429,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN } } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -17504,7 +17463,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_TMP_HANDLER(ZEND_OPCO if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } else { @@ -17543,7 +17502,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_ if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; PZVAL_UNLOCK(*EX_T(opline->result.var).var.ptr_ptr, &free_res); if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) { @@ -17578,7 +17537,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDL } else { zval_dtor(free_op2.var); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* assign_obj has two opcodes! */ CHECK_EXCEPTION(); ZEND_VM_INC_OPCODE(); @@ -17659,7 +17618,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDL FREE_OP_VAR_PTR(free_op_data2); FREE_OP_IF_VAR(free_op_data1); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* assign_dim has two opcodes! */ CHECK_EXCEPTION(); ZEND_VM_INC_OPCODE(); @@ -17713,7 +17672,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_A } } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* zend_assign_to_variable() always takes care of op2, never free it! */ @@ -17796,7 +17755,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE EX(call) = call; zval_dtor(free_op2.var); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -17907,7 +17866,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } else { /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); @@ -17971,7 +17930,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCOD INIT_PZVAL_COPY(new_expr, expr_ptr); expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } else if (IS_VAR == IS_CV) { Z_ADDREF_P(expr_ptr); } @@ -17997,11 +17956,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCOD hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; @@ -18019,7 +17974,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCOD zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL); } if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) { - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -18078,11 +18033,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLE hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); @@ -18133,7 +18084,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLE } else { zval_dtor(free_op2.var); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -18174,7 +18125,7 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLE } else { zval_dtor(free_op2.var); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -18184,22 +18135,21 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in { USE_OPLINE zend_free_op free_op1, free_op2; - zval **container; + zval *container; zval **value = NULL; int result = 0; ulong hval; zval *offset; SAVE_OPLINE(); - container = _get_zval_ptr_ptr_var_fast(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); - + container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); - if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) { + if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) { HashTable *ht; int isset = 0; - ht = Z_ARRVAL_PP(container); + ht = Z_ARRVAL_P(container); switch (Z_TYPE_P(offset)) { case IS_DOUBLE: @@ -18218,14 +18168,8 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); - } - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; @@ -18255,20 +18199,20 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in } } zval_dtor(free_op2.var); - } else if (Z_TYPE_PP(container) == IS_OBJECT) { + } else if (Z_TYPE_P(container) == IS_OBJECT) { if (1) { MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - if (Z_OBJ_HT_P(*container)->has_property) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_property) { + result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check property of non-object"); result = 0; } } else { - if (Z_OBJ_HT_P(*container)->has_dimension) { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_dimension) { + result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check element of non-array"); result = 0; @@ -18279,7 +18223,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in } else { zval_dtor(free_op2.var); } - } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + } else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { @@ -18297,11 +18241,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; } } @@ -18318,7 +18262,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in Z_LVAL(EX_T(opline->result.var).tmp_var) = !result; } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -18400,7 +18344,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR generator->value = *value_ptr; } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; } } else { zval *value = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -18420,7 +18364,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR } generator->value = copy; - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } else { if (IS_VAR == IS_CV) { Z_ADDREF_P(value); @@ -18499,8 +18443,8 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS fast_add_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -18514,8 +18458,8 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS fast_sub_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -18529,8 +18473,8 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS fast_mul_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -18544,8 +18488,8 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS fast_div_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -18559,8 +18503,8 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS fast_mod_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -18574,8 +18518,8 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) shift_left_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -18589,8 +18533,8 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) shift_right_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -18604,8 +18548,8 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_A concat_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -18619,8 +18563,8 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN is_identical_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -18636,8 +18580,8 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); Z_LVAL_P(result) = !Z_LVAL_P(result); - zval_ptr_dtor(&free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -18652,8 +18596,8 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER ZVAL_BOOL(result, fast_equal_function(result, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC)); - zval_ptr_dtor(&free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -18668,8 +18612,8 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN ZVAL_BOOL(result, fast_not_equal_function(result, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC)); - zval_ptr_dtor(&free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -18684,8 +18628,8 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL ZVAL_BOOL(result, fast_is_smaller_function(result, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC)); - zval_ptr_dtor(&free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -18700,8 +18644,8 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_VAR_VAR_HANDLER(ZEND_OPC ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC)); - zval_ptr_dtor(&free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -18715,8 +18659,8 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR bitwise_or_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -18730,8 +18674,8 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_A bitwise_and_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -18745,8 +18689,8 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_A bitwise_xor_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -18760,8 +18704,8 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER boolean_xor_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -18785,7 +18729,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*bin if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) { zend_error(E_WARNING, "Attempt to assign property of non-object"); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); FREE_OP(free_op_data1); if (RETURN_VALUE_USED(opline)) { @@ -18866,12 +18810,12 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*bin if (0) { zval_ptr_dtor(&property); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } FREE_OP(free_op_data1); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* assign_obj has two opcodes! */ CHECK_EXCEPTION(); ZEND_VM_INC_OPCODE(); @@ -18925,8 +18869,8 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_VAR(int (*binary_ PZVAL_LOCK(&EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); } - zval_ptr_dtor(&free_op2.var); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + zval_ptr_dtor_nogc(&free_op2.var); + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); if (opline->extended_value == ZEND_ASSIGN_DIM) { ZEND_VM_INC_OPCODE(); @@ -18953,16 +18897,16 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_VAR(int (*binary_ PZVAL_LOCK(*var_ptr); AI_SET_PTR(&EX_T(opline->result.var), *var_ptr); } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); FREE_OP_VAR_PTR(free_op_data2); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_INC_OPCODE(); } else { - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); } ZEND_VM_NEXT_OPCODE(); @@ -19047,12 +18991,12 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t i if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); if (RETURN_VALUE_USED(opline)) { PZVAL_LOCK(&EG(uninitialized_zval)); *retval = &EG(uninitialized_zval); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -19110,9 +19054,9 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t i if (0) { zval_ptr_dtor(&property); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -19151,9 +19095,9 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); ZVAL_NULL(retval); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -19212,9 +19156,9 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t if (0) { zval_ptr_dtor(&property); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -19263,7 +19207,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE if (IS_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -19273,7 +19217,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE ce = EX_T(opline->op2.var).class_entry; } retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); /* @@ -19284,10 +19228,8 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE */ if (IS_VAR == IS_CONST) { hash_value = Z_HASH_P(varname); - } else if (IS_INTERNED(Z_STRVAL_P(varname))) { - hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname)); } if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { @@ -19312,11 +19254,11 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE switch (opline->extended_value & ZEND_FETCH_TYPE_MASK) { case ZEND_FETCH_GLOBAL: if (IS_VAR != IS_TMP_VAR) { - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } break; case ZEND_FETCH_LOCAL: - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); break; case ZEND_FETCH_STATIC: zval_update_constant(retval, (void*) 1 TSRMLS_CC); @@ -19404,14 +19346,14 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAND if (IS_VAR == IS_TMP_VAR || IS_VAR == IS_CONST) { zval *container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); } else { container = _get_zval_ptr_ptr_var_fast(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); if (IS_VAR == IS_VAR && !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } } @@ -19432,11 +19374,11 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAND zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_W TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* We are going to assign the result by reference */ if (UNEXPECTED(opline->extended_value != 0)) { @@ -19466,11 +19408,11 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_RW TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -19484,8 +19426,8 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN SAVE_OPLINE(); container = _get_zval_ptr_ptr_var_fast(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_IS TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -19507,16 +19449,16 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_VAR_HANDLER(ZEND_OPCO if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - zval_ptr_dtor(&free_op2.var); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + zval_ptr_dtor_nogc(&free_op2.var); + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; } else { if (IS_VAR == IS_UNUSED) { zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); } container = _get_zval_ptr_ptr_var_fast(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -19540,11 +19482,11 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_ zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_UNSET TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; if (UNEXPECTED(EX_T(opline->result.var).var.ptr_ptr == NULL)) { zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); ZEND_VM_NEXT_OPCODE(); @@ -19580,7 +19522,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_VAR(ZE zend_error(E_NOTICE, "Trying to get property of non-object"); PZVAL_LOCK(&EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } else { zval *retval; @@ -19597,11 +19539,11 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_VAR(ZE if (0) { zval_ptr_dtor(&offset); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -19621,11 +19563,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAND SAVE_OPLINE(); property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); - if (IS_VAR == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); - EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr; - } - if (0) { MAKE_REAL_ZVAL_PTR(property); } @@ -19638,12 +19575,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAND if (0) { zval_ptr_dtor(&property); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* We are going to assign the result by reference */ if (opline->extended_value & ZEND_FETCH_MAKE_REF) { @@ -19681,12 +19618,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN if (0) { zval_ptr_dtor(&property); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -19707,7 +19644,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) { PZVAL_LOCK(&EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } else { zval *retval; @@ -19724,11 +19661,11 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN if (0) { zval_ptr_dtor(&offset); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -19757,12 +19694,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_VAR_HANDLER(ZEND_OPCO if (0) { zval_ptr_dtor(&property); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } else { @@ -19796,12 +19733,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_ if (0) { zval_ptr_dtor(&property); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; PZVAL_UNLOCK(*EX_T(opline->result.var).var.ptr_ptr, &free_res); if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) { @@ -19834,9 +19771,9 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL if (0) { zval_ptr_dtor(&property_name); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* assign_obj has two opcodes! */ CHECK_EXCEPTION(); ZEND_VM_INC_OPCODE(); @@ -19866,7 +19803,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL if (0) { zval_ptr_dtor(&property_name); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } } else { zend_free_op free_op2, free_op_data1, free_op_data2; @@ -19875,7 +19812,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL zval **variable_ptr_ptr; zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), object_ptr, dim, IS_VAR, BP_VAR_W TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R); variable_ptr_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC); @@ -19917,7 +19854,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL FREE_OP_VAR_PTR(free_op_data2); FREE_OP_IF_VAR(free_op_data1); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* assign_dim has two opcodes! */ CHECK_EXCEPTION(); ZEND_VM_INC_OPCODE(); @@ -19971,10 +19908,10 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_A } } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* zend_assign_to_variable() always takes care of op2, never free it! */ - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -20000,7 +19937,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL } zend_error(E_STRICT, "Only variables should be assigned by reference"); if (UNEXPECTED(EG(exception) != NULL)) { - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + if (free_op2.var) {zval_ptr_dtor_nogc(&free_op2.var);}; HANDLE_EXCEPTION(); } return ZEND_ASSIGN_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); @@ -20027,8 +19964,8 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL AI_SET_PTR(&EX_T(opline->result.var), *variable_ptr_ptr); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; + if (free_op2.var) {zval_ptr_dtor_nogc(&free_op2.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -20086,7 +20023,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE } } else { if (UNEXPECTED(EG(exception) != NULL)) { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); HANDLE_EXCEPTION(); } zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); @@ -20108,8 +20045,8 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE call->is_ctor_call = 0; EX(call) = call; - zval_ptr_dtor(&free_op2.var); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op2.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -20199,7 +20136,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND } } if (IS_VAR != IS_CONST) { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } } else { if (UNEXPECTED(ce->constructor == NULL)) { @@ -20220,7 +20157,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } else { /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); @@ -20248,7 +20185,7 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -20284,7 +20221,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD INIT_PZVAL_COPY(new_expr, expr_ptr); expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } else if (IS_VAR == IS_CV) { Z_ADDREF_P(expr_ptr); } @@ -20310,11 +20247,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; @@ -20327,12 +20260,12 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD /* do nothing */ break; } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } else { zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL); } if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) { - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -20401,7 +20334,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE } else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) { zval_ptr_dtor(&varname); } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); HANDLE_EXCEPTION(); } if (UNEXPECTED(ce == NULL)) { @@ -20425,7 +20358,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE } else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) { zval_ptr_dtor(&varname); } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -20469,11 +20402,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); @@ -20497,7 +20426,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE zend_error(E_WARNING, "Illegal offset type in unset"); break; } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); break; } case IS_OBJECT: @@ -20511,20 +20440,20 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE if (0) { zval_ptr_dtor(&offset); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } break; case IS_STRING: zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); ZEND_VM_CONTINUE(); /* bailed out before */ default: - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); break; } } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -20557,15 +20486,15 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE if (0) { zval_ptr_dtor(&offset); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -20635,7 +20564,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD if (IS_VAR != IS_CONST && varname == &tmp) { zval_dtor(&tmp); } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } if (opline->extended_value & ZEND_ISSET) { @@ -20660,22 +20589,21 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in { USE_OPLINE zend_free_op free_op1, free_op2; - zval **container; + zval *container; zval **value = NULL; int result = 0; ulong hval; zval *offset; SAVE_OPLINE(); - container = _get_zval_ptr_ptr_var_fast(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); - + container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); - if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) { + if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) { HashTable *ht; int isset = 0; - ht = Z_ARRVAL_PP(container); + ht = Z_ARRVAL_P(container); switch (Z_TYPE_P(offset)) { case IS_DOUBLE: @@ -20694,14 +20622,8 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); - } - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; @@ -20730,21 +20652,21 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in result = 1; } } - zval_ptr_dtor(&free_op2.var); - } else if (Z_TYPE_PP(container) == IS_OBJECT) { + zval_ptr_dtor_nogc(&free_op2.var); + } else if (Z_TYPE_P(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - if (Z_OBJ_HT_P(*container)->has_property) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_property) { + result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check property of non-object"); result = 0; } } else { - if (Z_OBJ_HT_P(*container)->has_dimension) { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_dimension) { + result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check element of non-array"); result = 0; @@ -20753,9 +20675,9 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in if (0) { zval_ptr_dtor(&offset); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } - } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + } else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { @@ -20773,18 +20695,18 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; } } } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL; @@ -20794,7 +20716,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in Z_LVAL(EX_T(opline->result.var).tmp_var) = !result; } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -20876,7 +20798,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR generator->value = *value_ptr; } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; } } else { zval *value = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -20896,7 +20818,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR } generator->value = copy; - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } else { if (IS_VAR == IS_CV) { Z_ADDREF_P(value); @@ -20941,7 +20863,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR generator->largest_used_integer_key = Z_LVAL_P(generator->key); } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; @@ -21072,7 +20994,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (* FREE_OP(free_op_data1); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* assign_obj has two opcodes! */ CHECK_EXCEPTION(); ZEND_VM_INC_OPCODE(); @@ -21127,7 +21049,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_UNUSED(int (*bina AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); if (opline->extended_value == ZEND_ASSIGN_DIM) { ZEND_VM_INC_OPCODE(); @@ -21158,11 +21080,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_UNUSED(int (*bina if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); FREE_OP_VAR_PTR(free_op_data2); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_INC_OPCODE(); } else { - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); } ZEND_VM_NEXT_OPCODE(); @@ -21257,7 +21179,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type, if (IS_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -21267,7 +21189,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type, ce = EX_T(opline->op2.var).class_entry; } retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); /* @@ -21278,10 +21200,8 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type, */ if (IS_VAR == IS_CONST) { hash_value = Z_HASH_P(varname); - } else if (IS_INTERNED(Z_STRVAL_P(varname))) { - hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname)); } if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { @@ -21306,11 +21226,11 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type, switch (opline->extended_value & ZEND_FETCH_TYPE_MASK) { case ZEND_FETCH_GLOBAL: if (IS_VAR != IS_TMP_VAR) { - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } break; case ZEND_FETCH_LOCAL: - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); break; case ZEND_FETCH_STATIC: zval_update_constant(retval, (void*) 1 TSRMLS_CC); @@ -21404,7 +21324,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_H if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* We are going to assign the result by reference */ if (UNEXPECTED(opline->extended_value != 0)) { @@ -21438,7 +21358,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_ if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -21461,7 +21381,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_UNUSED_HANDLER(ZEND_O EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; } else { if (IS_UNUSED == IS_UNUSED) { zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); @@ -21469,7 +21389,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_UNUSED_HANDLER(ZEND_O container = _get_zval_ptr_ptr_var_fast(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, NULL, IS_UNUSED, BP_VAR_R TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -21548,7 +21468,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HA FREE_OP_VAR_PTR(free_op_data2); FREE_OP_IF_VAR(free_op_data1); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* assign_dim has two opcodes! */ CHECK_EXCEPTION(); ZEND_VM_INC_OPCODE(); @@ -21660,7 +21580,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } else { /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); @@ -21709,7 +21629,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OP INIT_PZVAL_COPY(new_expr, expr_ptr); expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } else if (IS_VAR == IS_CV) { Z_ADDREF_P(expr_ptr); } @@ -21735,11 +21655,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OP hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; @@ -21757,7 +21673,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OP zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL); } if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) { - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -21826,7 +21742,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAN } else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) { zval_ptr_dtor(&varname); } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); HANDLE_EXCEPTION(); } if (UNEXPECTED(ce == NULL)) { @@ -21850,7 +21766,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAN } else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) { zval_ptr_dtor(&varname); } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -21919,7 +21835,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OP if (IS_VAR != IS_CONST && varname == &tmp) { zval_dtor(&tmp); } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } if (opline->extended_value & ZEND_ISSET) { @@ -22027,7 +21943,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER generator->value = *value_ptr; } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; } } else { zval *value = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -22047,7 +21963,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER } generator->value = copy; - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } else { if (IS_VAR == IS_CV) { Z_ADDREF_P(value); @@ -22126,7 +22042,7 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) fast_add_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -22141,7 +22057,7 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) fast_sub_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -22156,7 +22072,7 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) fast_mul_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -22171,7 +22087,7 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) fast_div_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -22186,7 +22102,7 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) fast_mod_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -22201,7 +22117,7 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) shift_left_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -22216,7 +22132,7 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) shift_right_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -22231,7 +22147,7 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_AR concat_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -22246,7 +22162,7 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND is_identical_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -22263,7 +22179,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_ _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC); Z_LVAL_P(result) = !Z_LVAL_P(result); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -22279,7 +22195,7 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ ZVAL_BOOL(result, fast_equal_function(result, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC)); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -22295,7 +22211,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND ZVAL_BOOL(result, fast_not_equal_function(result, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC)); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -22311,7 +22227,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE ZVAL_BOOL(result, fast_is_smaller_function(result, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC)); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -22327,7 +22243,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_VAR_CV_HANDLER(ZEND_OPCO ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC)); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -22342,7 +22258,7 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG bitwise_or_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -22357,7 +22273,7 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_AR bitwise_and_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -22372,7 +22288,7 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_AR bitwise_xor_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -22387,7 +22303,7 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ boolean_xor_function(&EX_T(opline->result.var).tmp_var, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC), _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -22498,7 +22414,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*bina FREE_OP(free_op_data1); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* assign_obj has two opcodes! */ CHECK_EXCEPTION(); ZEND_VM_INC_OPCODE(); @@ -22553,7 +22469,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_CV(int (*binary_o AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); if (opline->extended_value == ZEND_ASSIGN_DIM) { ZEND_VM_INC_OPCODE(); @@ -22584,11 +22500,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_CV(int (*binary_o if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); FREE_OP_VAR_PTR(free_op_data2); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_INC_OPCODE(); } else { - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); } ZEND_VM_NEXT_OPCODE(); @@ -22678,7 +22594,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t in PZVAL_LOCK(&EG(uninitialized_zval)); *retval = &EG(uninitialized_zval); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -22738,7 +22654,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t in } else { } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -22779,7 +22695,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t i zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); ZVAL_NULL(retval); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -22840,7 +22756,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t i } else { } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -22867,13 +22783,13 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDL zval *container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } else { container = _get_zval_ptr_ptr_var_fast(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC); if (IS_VAR == IS_VAR && !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } } @@ -22898,7 +22814,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDL if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* We are going to assign the result by reference */ if (UNEXPECTED(opline->extended_value != 0)) { @@ -22932,7 +22848,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -22947,7 +22863,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND container = _get_zval_ptr_ptr_var_fast(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_IS TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -22970,7 +22886,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CV_HANDLER(ZEND_OPCOD EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; } else { if (IS_CV == IS_UNUSED) { zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); @@ -22978,7 +22894,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CV_HANDLER(ZEND_OPCOD container = _get_zval_ptr_ptr_var_fast(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -23006,7 +22922,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_H if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; if (UNEXPECTED(EX_T(opline->result.var).var.ptr_ptr == NULL)) { zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); ZEND_VM_NEXT_OPCODE(); @@ -23063,7 +22979,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_CV(ZEN } } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -23083,11 +22999,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDL SAVE_OPLINE(); property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC); - if (IS_VAR == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); - EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr; - } - if (0) { MAKE_REAL_ZVAL_PTR(property); } @@ -23105,7 +23016,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDL if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* We are going to assign the result by reference */ if (opline->extended_value & ZEND_FETCH_MAKE_REF) { @@ -23148,7 +23059,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -23190,7 +23101,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND } } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -23224,7 +23135,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CV_HANDLER(ZEND_OPCOD if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } else { @@ -23263,7 +23174,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_H if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; PZVAL_UNLOCK(*EX_T(opline->result.var).var.ptr_ptr, &free_res); if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) { @@ -23298,7 +23209,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE } else { } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* assign_obj has two opcodes! */ CHECK_EXCEPTION(); ZEND_VM_INC_OPCODE(); @@ -23378,7 +23289,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE FREE_OP_VAR_PTR(free_op_data2); FREE_OP_IF_VAR(free_op_data1); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* assign_dim has two opcodes! */ CHECK_EXCEPTION(); ZEND_VM_INC_OPCODE(); @@ -23432,7 +23343,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_AR } } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; /* zend_assign_to_variable() always takes care of op2, never free it! */ @@ -23487,7 +23398,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE AI_SET_PTR(&EX_T(opline->result.var), *variable_ptr_ptr); } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -23567,7 +23478,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_ call->is_ctor_call = 0; EX(call) = call; - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -23678,7 +23589,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_ /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } else { /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); @@ -23741,7 +23652,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE INIT_PZVAL_COPY(new_expr, expr_ptr); expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } else if (IS_VAR == IS_CV) { Z_ADDREF_P(expr_ptr); } @@ -23767,11 +23678,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; @@ -23789,7 +23696,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL); } if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) { - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -23848,11 +23755,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); @@ -23903,7 +23806,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER } else { } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -23944,7 +23847,7 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER } else { } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -23954,22 +23857,21 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int { USE_OPLINE zend_free_op free_op1; - zval **container; + zval *container; zval **value = NULL; int result = 0; ulong hval; zval *offset; SAVE_OPLINE(); - container = _get_zval_ptr_ptr_var_fast(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); - + container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC); - if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) { + if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) { HashTable *ht; int isset = 0; - ht = Z_ARRVAL_PP(container); + ht = Z_ARRVAL_P(container); switch (Z_TYPE_P(offset)) { case IS_DOUBLE: @@ -23988,14 +23890,8 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); - } - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; @@ -24025,20 +23921,20 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int } } - } else if (Z_TYPE_PP(container) == IS_OBJECT) { + } else if (Z_TYPE_P(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - if (Z_OBJ_HT_P(*container)->has_property) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_property) { + result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check property of non-object"); result = 0; } } else { - if (Z_OBJ_HT_P(*container)->has_dimension) { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_dimension) { + result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check element of non-array"); result = 0; @@ -24049,7 +23945,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int } else { } - } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + } else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { @@ -24067,11 +23963,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; } } @@ -24088,7 +23984,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int Z_LVAL(EX_T(opline->result.var).tmp_var) = !result; } - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -24170,7 +24066,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG generator->value = *value_ptr; } - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}; } } else { zval *value = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -24190,7 +24086,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG } generator->value = copy; - zval_ptr_dtor(&free_op1.var); + zval_ptr_dtor_nogc(&free_op1.var); } else { if (IS_VAR == IS_CV) { Z_ADDREF_P(value); @@ -24866,11 +24762,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE SAVE_OPLINE(); property = opline->op2.zv; - if (IS_UNUSED == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); - EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr; - } - if (0) { MAKE_REAL_ZVAL_PTR(property); } @@ -25360,11 +25251,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_H hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); @@ -25464,22 +25351,21 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON { USE_OPLINE - zval **container; + zval *container; zval **value = NULL; int result = 0; ulong hval; zval *offset; SAVE_OPLINE(); - container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); - + container = _get_obj_zval_ptr_unused(TSRMLS_C); offset = opline->op2.zv; - if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) { + if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) { HashTable *ht; int isset = 0; - ht = Z_ARRVAL_PP(container); + ht = Z_ARRVAL_P(container); switch (Z_TYPE_P(offset)) { case IS_DOUBLE: @@ -25498,14 +25384,8 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); - } - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; @@ -25535,20 +25415,20 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON } } - } else if (Z_TYPE_PP(container) == IS_OBJECT) { + } else if (Z_TYPE_P(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - if (Z_OBJ_HT_P(*container)->has_property) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_property) { + result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check property of non-object"); result = 0; } } else { - if (Z_OBJ_HT_P(*container)->has_dimension) { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_dimension) { + result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check element of non-array"); result = 0; @@ -25559,7 +25439,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON } else { } - } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + } else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { @@ -25577,11 +25457,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; } } @@ -26286,11 +26166,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_H SAVE_OPLINE(); property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); - if (IS_UNUSED == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); - EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr; - } - if (1) { MAKE_REAL_ZVAL_PTR(property); } @@ -26683,11 +26558,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HAN hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); @@ -26787,22 +26658,21 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP { USE_OPLINE zend_free_op free_op2; - zval **container; + zval *container; zval **value = NULL; int result = 0; ulong hval; zval *offset; SAVE_OPLINE(); - container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); - + container = _get_obj_zval_ptr_unused(TSRMLS_C); offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); - if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) { + if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) { HashTable *ht; int isset = 0; - ht = Z_ARRVAL_PP(container); + ht = Z_ARRVAL_P(container); switch (Z_TYPE_P(offset)) { case IS_DOUBLE: @@ -26821,14 +26691,8 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); - } - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; @@ -26858,20 +26722,20 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP } } zval_dtor(free_op2.var); - } else if (Z_TYPE_PP(container) == IS_OBJECT) { + } else if (Z_TYPE_P(container) == IS_OBJECT) { if (1) { MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - if (Z_OBJ_HT_P(*container)->has_property) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_property) { + result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check property of non-object"); result = 0; } } else { - if (Z_OBJ_HT_P(*container)->has_dimension) { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_dimension) { + result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check element of non-array"); result = 0; @@ -26882,7 +26746,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP } else { zval_dtor(free_op2.var); } - } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + } else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { @@ -26900,11 +26764,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; } } @@ -27109,7 +26973,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (* if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) { zend_error(E_WARNING, "Attempt to assign property of non-object"); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); FREE_OP(free_op_data1); if (RETURN_VALUE_USED(opline)) { @@ -27190,7 +27054,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (* if (0) { zval_ptr_dtor(&property); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } FREE_OP(free_op_data1); } @@ -27248,7 +27112,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_VAR(int (*bina PZVAL_LOCK(&EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); if (opline->extended_value == ZEND_ASSIGN_DIM) { @@ -27276,7 +27140,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_VAR(int (*bina PZVAL_LOCK(*var_ptr); AI_SET_PTR(&EX_T(opline->result.var), *var_ptr); } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); @@ -27370,7 +27234,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_ if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); if (RETURN_VALUE_USED(opline)) { PZVAL_LOCK(&EG(uninitialized_zval)); *retval = &EG(uninitialized_zval); @@ -27433,7 +27297,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_ if (0) { zval_ptr_dtor(&property); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } CHECK_EXCEPTION(); @@ -27474,7 +27338,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); ZVAL_NULL(retval); CHECK_EXCEPTION(); @@ -27535,7 +27399,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec if (0) { zval_ptr_dtor(&property); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } CHECK_EXCEPTION(); @@ -27569,7 +27433,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR zend_error(E_NOTICE, "Trying to get property of non-object"); PZVAL_LOCK(&EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } else { zval *retval; @@ -27586,7 +27450,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR if (0) { zval_ptr_dtor(&offset); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } } @@ -27609,11 +27473,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_H SAVE_OPLINE(); property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); - if (IS_UNUSED == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); - EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr; - } - if (0) { MAKE_REAL_ZVAL_PTR(property); } @@ -27626,7 +27485,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_H if (0) { zval_ptr_dtor(&property); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); @@ -27668,7 +27527,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_ if (0) { zval_ptr_dtor(&property); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); @@ -27694,7 +27553,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_ UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) { PZVAL_LOCK(&EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } else { zval *retval; @@ -27711,7 +27570,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_ if (0) { zval_ptr_dtor(&offset); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } } @@ -27743,7 +27602,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_VAR_HANDLER(ZEND_O if (0) { zval_ptr_dtor(&property); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); @@ -27782,7 +27641,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCO if (0) { zval_ptr_dtor(&property); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); @@ -27819,7 +27678,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HA if (0) { zval_ptr_dtor(&property_name); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } /* assign_obj has two opcodes! */ @@ -27867,7 +27726,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDL * which aren't affected by FREE_OP(Ts, )'s anyway, unless they're * string offsets or overloaded objects */ - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -27925,7 +27784,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC } } else { if (UNEXPECTED(EG(exception) != NULL)) { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); HANDLE_EXCEPTION(); } zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); @@ -27947,7 +27806,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC call->is_ctor_call = 0; EX(call) = call; - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -28006,11 +27865,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HAN hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); @@ -28034,7 +27889,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HAN zend_error(E_WARNING, "Illegal offset type in unset"); break; } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); break; } case IS_OBJECT: @@ -28048,18 +27903,18 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HAN if (0) { zval_ptr_dtor(&offset); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } break; case IS_STRING: zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); ZEND_VM_CONTINUE(); /* bailed out before */ default: - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); break; } } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } CHECK_EXCEPTION(); @@ -28093,13 +27948,13 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HAN if (0) { zval_ptr_dtor(&offset); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } CHECK_EXCEPTION(); @@ -28110,22 +27965,21 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR { USE_OPLINE zend_free_op free_op2; - zval **container; + zval *container; zval **value = NULL; int result = 0; ulong hval; zval *offset; SAVE_OPLINE(); - container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); - + container = _get_obj_zval_ptr_unused(TSRMLS_C); offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); - if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) { + if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) { HashTable *ht; int isset = 0; - ht = Z_ARRVAL_PP(container); + ht = Z_ARRVAL_P(container); switch (Z_TYPE_P(offset)) { case IS_DOUBLE: @@ -28144,14 +27998,8 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); - } - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; @@ -28180,21 +28028,21 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR result = 1; } } - zval_ptr_dtor(&free_op2.var); - } else if (Z_TYPE_PP(container) == IS_OBJECT) { + zval_ptr_dtor_nogc(&free_op2.var); + } else if (Z_TYPE_P(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - if (Z_OBJ_HT_P(*container)->has_property) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_property) { + result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check property of non-object"); result = 0; } } else { - if (Z_OBJ_HT_P(*container)->has_dimension) { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_dimension) { + result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check element of non-array"); result = 0; @@ -28203,9 +28051,9 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR if (0) { zval_ptr_dtor(&offset); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } - } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + } else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { @@ -28223,18 +28071,18 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; } } } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL; @@ -28388,7 +28236,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER generator->largest_used_integer_key = Z_LVAL_P(generator->key); } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; @@ -29356,11 +29204,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HA SAVE_OPLINE(); property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC); - if (IS_UNUSED == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); - EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr; - } - if (0) { MAKE_REAL_ZVAL_PTR(property); } @@ -29751,11 +29594,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAND hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); @@ -29855,22 +29694,21 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV( { USE_OPLINE - zval **container; + zval *container; zval **value = NULL; int result = 0; ulong hval; zval *offset; SAVE_OPLINE(); - container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); - + container = _get_obj_zval_ptr_unused(TSRMLS_C); offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC); - if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) { + if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) { HashTable *ht; int isset = 0; - ht = Z_ARRVAL_PP(container); + ht = Z_ARRVAL_P(container); switch (Z_TYPE_P(offset)) { case IS_DOUBLE: @@ -29889,14 +29727,8 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV( if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); - } - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; @@ -29926,20 +29758,20 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV( } } - } else if (Z_TYPE_PP(container) == IS_OBJECT) { + } else if (Z_TYPE_P(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - if (Z_OBJ_HT_P(*container)->has_property) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_property) { + result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check property of non-object"); result = 0; } } else { - if (Z_OBJ_HT_P(*container)->has_dimension) { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_dimension) { + result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check element of non-array"); result = 0; @@ -29950,7 +29782,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV( } else { } - } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + } else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { @@ -29968,11 +29800,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV( } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; } } @@ -32186,10 +32018,8 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z */ if (IS_CV == IS_CONST) { hash_value = Z_HASH_P(varname); - } else if (IS_INTERNED(Z_STRVAL_P(varname))) { - hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname)); } if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { @@ -32521,11 +32351,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAN SAVE_OPLINE(); property = opline->op2.zv; - if (IS_CV == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); - EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr; - } - if (0) { MAKE_REAL_ZVAL_PTR(property); } @@ -33023,11 +32848,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCO hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; @@ -33182,11 +33003,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); @@ -33371,22 +33188,21 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i { USE_OPLINE - zval **container; + zval *container; zval **value = NULL; int result = 0; ulong hval; zval *offset; SAVE_OPLINE(); - container = _get_zval_ptr_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC); - + container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC); offset = opline->op2.zv; - if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) { + if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) { HashTable *ht; int isset = 0; - ht = Z_ARRVAL_PP(container); + ht = Z_ARRVAL_P(container); switch (Z_TYPE_P(offset)) { case IS_DOUBLE: @@ -33405,14 +33221,8 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); - } - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; @@ -33442,20 +33252,20 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i } } - } else if (Z_TYPE_PP(container) == IS_OBJECT) { + } else if (Z_TYPE_P(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - if (Z_OBJ_HT_P(*container)->has_property) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_property) { + result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check property of non-object"); result = 0; } } else { - if (Z_OBJ_HT_P(*container)->has_dimension) { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_dimension) { + result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check element of non-array"); result = 0; @@ -33466,7 +33276,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i } else { } - } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + } else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { @@ -33484,11 +33294,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; } } @@ -34638,11 +34448,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDL SAVE_OPLINE(); property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); - if (IS_CV == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); - EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr; - } - if (1) { MAKE_REAL_ZVAL_PTR(property); } @@ -35143,11 +34948,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; @@ -35224,11 +35025,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); @@ -35328,22 +35125,21 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int { USE_OPLINE zend_free_op free_op2; - zval **container; + zval *container; zval **value = NULL; int result = 0; ulong hval; zval *offset; SAVE_OPLINE(); - container = _get_zval_ptr_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC); - + container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC); offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); - if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) { + if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) { HashTable *ht; int isset = 0; - ht = Z_ARRVAL_PP(container); + ht = Z_ARRVAL_P(container); switch (Z_TYPE_P(offset)) { case IS_DOUBLE: @@ -35362,14 +35158,8 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); - } - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; @@ -35399,20 +35189,20 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int } } zval_dtor(free_op2.var); - } else if (Z_TYPE_PP(container) == IS_OBJECT) { + } else if (Z_TYPE_P(container) == IS_OBJECT) { if (1) { MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - if (Z_OBJ_HT_P(*container)->has_property) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_property) { + result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check property of non-object"); result = 0; } } else { - if (Z_OBJ_HT_P(*container)->has_dimension) { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_dimension) { + result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check element of non-array"); result = 0; @@ -35423,7 +35213,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int } else { zval_dtor(free_op2.var); } - } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + } else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { @@ -35441,11 +35231,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; } } @@ -35641,7 +35431,7 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -35656,7 +35446,7 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -35671,7 +35461,7 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -35686,7 +35476,7 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -35701,7 +35491,7 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -35716,7 +35506,7 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -35731,7 +35521,7 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -35746,7 +35536,7 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -35761,7 +35551,7 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -35778,7 +35568,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_ _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); Z_LVAL_P(result) = !Z_LVAL_P(result); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -35794,7 +35584,7 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC)); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -35810,7 +35600,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC)); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -35826,7 +35616,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC)); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -35842,7 +35632,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CV_VAR_HANDLER(ZEND_OPCO _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC)); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -35857,7 +35647,7 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -35872,7 +35662,7 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -35887,7 +35677,7 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -35902,7 +35692,7 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -35926,7 +35716,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*bina if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) { zend_error(E_WARNING, "Attempt to assign property of non-object"); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); FREE_OP(free_op_data1); if (RETURN_VALUE_USED(opline)) { @@ -36007,7 +35797,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*bina if (0) { zval_ptr_dtor(&property); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } FREE_OP(free_op_data1); } @@ -36065,7 +35855,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_VAR(int (*binary_o PZVAL_LOCK(&EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); if (opline->extended_value == ZEND_ASSIGN_DIM) { @@ -36093,7 +35883,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_VAR(int (*binary_o PZVAL_LOCK(*var_ptr); AI_SET_PTR(&EX_T(opline->result.var), *var_ptr); } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); if (opline->extended_value == ZEND_ASSIGN_DIM) { FREE_OP(free_op_data1); @@ -36187,7 +35977,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t in if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); if (RETURN_VALUE_USED(opline)) { PZVAL_LOCK(&EG(uninitialized_zval)); *retval = &EG(uninitialized_zval); @@ -36250,7 +36040,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t in if (0) { zval_ptr_dtor(&property); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } CHECK_EXCEPTION(); @@ -36291,7 +36081,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t i if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); ZVAL_NULL(retval); CHECK_EXCEPTION(); @@ -36352,7 +36142,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t i if (0) { zval_ptr_dtor(&property); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } CHECK_EXCEPTION(); @@ -36424,10 +36214,8 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN */ if (IS_CV == IS_CONST) { hash_value = Z_HASH_P(varname); - } else if (IS_INTERNED(Z_STRVAL_P(varname))) { - hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname)); } if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { @@ -36544,12 +36332,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDL if (IS_CV == IS_TMP_VAR || IS_CV == IS_CONST) { zval *container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } else { container = _get_zval_ptr_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); if (IS_CV == IS_VAR && !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { } @@ -36572,7 +36360,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDL zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_W TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } @@ -36605,7 +36393,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_RW TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } @@ -36623,7 +36411,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND SAVE_OPLINE(); container = _get_zval_ptr_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_IS TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -36646,7 +36434,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_VAR_HANDLER(ZEND_OPCOD if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } else { if (IS_VAR == IS_UNUSED) { @@ -36654,7 +36442,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_VAR_HANDLER(ZEND_OPCOD } container = _get_zval_ptr_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } CHECK_EXCEPTION(); @@ -36679,7 +36467,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_H zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_UNSET TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); } @@ -36719,7 +36507,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_VAR(ZEN zend_error(E_NOTICE, "Trying to get property of non-object"); PZVAL_LOCK(&EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } else { zval *retval; @@ -36736,7 +36524,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_VAR(ZEN if (0) { zval_ptr_dtor(&offset); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } } @@ -36759,11 +36547,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDL SAVE_OPLINE(); property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); - if (IS_CV == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); - EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr; - } - if (0) { MAKE_REAL_ZVAL_PTR(property); } @@ -36776,7 +36559,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDL if (0) { zval_ptr_dtor(&property); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); @@ -36818,7 +36601,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND if (0) { zval_ptr_dtor(&property); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); @@ -36844,7 +36627,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) { PZVAL_LOCK(&EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } else { zval *retval; @@ -36861,7 +36644,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND if (0) { zval_ptr_dtor(&offset); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } } @@ -36893,7 +36676,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_VAR_HANDLER(ZEND_OPCOD if (0) { zval_ptr_dtor(&property); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); @@ -36932,7 +36715,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_H if (0) { zval_ptr_dtor(&property); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) { EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); @@ -36969,7 +36752,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE if (0) { zval_ptr_dtor(&property_name); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } /* assign_obj has two opcodes! */ @@ -37001,7 +36784,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE if (0) { zval_ptr_dtor(&property_name); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } } else { zend_free_op free_op2, free_op_data1, free_op_data2; @@ -37010,7 +36793,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE zval **variable_ptr_ptr; zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), object_ptr, dim, IS_VAR, BP_VAR_W TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R); variable_ptr_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC); @@ -37107,7 +36890,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR } /* zend_assign_to_variable() always takes care of op2, never free it! */ - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -37133,7 +36916,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE } zend_error(E_STRICT, "Only variables should be assigned by reference"); if (UNEXPECTED(EG(exception) != NULL)) { - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + if (free_op2.var) {zval_ptr_dtor_nogc(&free_op2.var);}; HANDLE_EXCEPTION(); } return ZEND_ASSIGN_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); @@ -37160,7 +36943,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE AI_SET_PTR(&EX_T(opline->result.var), *variable_ptr_ptr); } - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + if (free_op2.var) {zval_ptr_dtor_nogc(&free_op2.var);}; CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -37218,7 +37001,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_ } } else { if (UNEXPECTED(EG(exception) != NULL)) { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); HANDLE_EXCEPTION(); } zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); @@ -37240,7 +37023,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_ call->is_ctor_call = 0; EX(call) = call; - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -37256,7 +37039,7 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC), _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC); - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -37318,11 +37101,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; @@ -37335,7 +37114,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE /* do nothing */ break; } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } else { zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL); } @@ -37477,11 +37256,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); @@ -37505,7 +37280,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER zend_error(E_WARNING, "Illegal offset type in unset"); break; } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); break; } case IS_OBJECT: @@ -37519,18 +37294,18 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER if (0) { zval_ptr_dtor(&offset); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } break; case IS_STRING: zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); ZEND_VM_CONTINUE(); /* bailed out before */ default: - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); break; } } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } CHECK_EXCEPTION(); @@ -37564,13 +37339,13 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER if (0) { zval_ptr_dtor(&offset); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } CHECK_EXCEPTION(); @@ -37666,22 +37441,21 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int { USE_OPLINE zend_free_op free_op2; - zval **container; + zval *container; zval **value = NULL; int result = 0; ulong hval; zval *offset; SAVE_OPLINE(); - container = _get_zval_ptr_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC); - + container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC); offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); - if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) { + if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) { HashTable *ht; int isset = 0; - ht = Z_ARRVAL_PP(container); + ht = Z_ARRVAL_P(container); switch (Z_TYPE_P(offset)) { case IS_DOUBLE: @@ -37700,14 +37474,8 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); - } - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; @@ -37736,21 +37504,21 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int result = 1; } } - zval_ptr_dtor(&free_op2.var); - } else if (Z_TYPE_PP(container) == IS_OBJECT) { + zval_ptr_dtor_nogc(&free_op2.var); + } else if (Z_TYPE_P(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - if (Z_OBJ_HT_P(*container)->has_property) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_property) { + result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check property of non-object"); result = 0; } } else { - if (Z_OBJ_HT_P(*container)->has_dimension) { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_dimension) { + result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check element of non-array"); result = 0; @@ -37759,9 +37527,9 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int if (0) { zval_ptr_dtor(&offset); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } - } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + } else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { @@ -37779,18 +37547,18 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; } } } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } else { - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL; @@ -37944,7 +37712,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG generator->largest_used_integer_key = Z_LVAL_P(generator->key); } - zval_ptr_dtor(&free_op2.var); + zval_ptr_dtor_nogc(&free_op2.var); } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; @@ -38280,10 +38048,8 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type, */ if (IS_CV == IS_CONST) { hash_value = Z_HASH_P(varname); - } else if (IS_INTERNED(Z_STRVAL_P(varname))) { - hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname)); } if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { @@ -38613,11 +38379,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPC hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; @@ -39936,11 +39698,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLE SAVE_OPLINE(); property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC); - if (IS_CV == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); - EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr; - } - if (0) { MAKE_REAL_ZVAL_PTR(property); } @@ -40490,11 +40247,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_ hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; @@ -40571,11 +40324,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ hval = Z_HASH_P(offset); } else { ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); @@ -40675,22 +40424,21 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int { USE_OPLINE - zval **container; + zval *container; zval **value = NULL; int result = 0; ulong hval; zval *offset; SAVE_OPLINE(); - container = _get_zval_ptr_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC); - + container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC); offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC); - if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) { + if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) { HashTable *ht; int isset = 0; - ht = Z_ARRVAL_PP(container); + ht = Z_ARRVAL_P(container); switch (Z_TYPE_P(offset)) { case IS_DOUBLE: @@ -40709,14 +40457,8 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); - } - if (IS_INTERNED(Z_STRVAL_P(offset))) { - hval = INTERNED_HASH(Z_STRVAL_P(offset)); - } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - } + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset)); } if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; @@ -40746,20 +40488,20 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int } } - } else if (Z_TYPE_PP(container) == IS_OBJECT) { + } else if (Z_TYPE_P(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - if (Z_OBJ_HT_P(*container)->has_property) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_property) { + result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check property of non-object"); result = 0; } } else { - if (Z_OBJ_HT_P(*container)->has_dimension) { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); + if (Z_OBJ_HT_P(container)->has_dimension) { + result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); } else { zend_error(E_NOTICE, "Trying to check element of non-array"); result = 0; @@ -40770,7 +40512,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int } else { } - } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + } else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { @@ -40788,11 +40530,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; } } @@ -45088,6 +44830,31 @@ void zend_init_opcodes_handlers(void) ZEND_FAST_RET_SPEC_HANDLER, ZEND_FAST_RET_SPEC_HANDLER, ZEND_FAST_RET_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, + ZEND_RECV_VARIADIC_SPEC_HANDLER, ZEND_NULL_HANDLER }; zend_opcode_handlers = (opcode_handler_t*)labels; diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php index 60ac30e17f988..a0546460d0e44 100644 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -218,7 +218,7 @@ $op1_free_op = array( "ANY" => "FREE_OP(free_op1)", "TMP" => "zval_dtor(free_op1.var)", - "VAR" => "zval_ptr_dtor(&free_op1.var)", + "VAR" => "zval_ptr_dtor_nogc(&free_op1.var)", "CONST" => "", "UNUSED" => "", "CV" => "", @@ -227,7 +227,7 @@ $op2_free_op = array( "ANY" => "FREE_OP(free_op2)", "TMP" => "zval_dtor(free_op2.var)", - "VAR" => "zval_ptr_dtor(&free_op2.var)", + "VAR" => "zval_ptr_dtor_nogc(&free_op2.var)", "CONST" => "", "UNUSED" => "", "CV" => "", @@ -236,7 +236,7 @@ $op1_free_op_if_var = array( "ANY" => "FREE_OP_IF_VAR(free_op1)", "TMP" => "", - "VAR" => "zval_ptr_dtor(&free_op1.var)", + "VAR" => "zval_ptr_dtor_nogc(&free_op1.var)", "CONST" => "", "UNUSED" => "", "CV" => "", @@ -245,33 +245,33 @@ $op2_free_op_if_var = array( "ANY" => "FREE_OP_IF_VAR(free_op2)", "TMP" => "", - "VAR" => "zval_ptr_dtor(&free_op2.var)", + "VAR" => "zval_ptr_dtor_nogc(&free_op2.var)", "CONST" => "", "UNUSED" => "", "CV" => "", ); $op1_free_op_var_ptr = array( - "ANY" => "if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}", + "ANY" => "if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}", "TMP" => "", - "VAR" => "if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}", + "VAR" => "if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}", "CONST" => "", "UNUSED" => "", "CV" => "", ); $op1_free_op_var_ptr_fast = $op1_free_op_var_ptr; -$op1_free_op_var_ptr_fast["VAR"] = "zval_ptr_dtor(&free_op1.var)"; +$op1_free_op_var_ptr_fast["VAR"] = "zval_ptr_dtor_nogc(&free_op1.var)"; $op2_free_op_var_ptr = array( - "ANY" => "if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}", + "ANY" => "if (free_op2.var) {zval_ptr_dtor_nogc(&free_op2.var);}", "TMP" => "", - "VAR" => "if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}", + "VAR" => "if (free_op2.var) {zval_ptr_dtor_nogc(&free_op2.var);}", "CONST" => "", "UNUSED" => "", "CV" => "", ); $op2_free_op_var_ptr_fast = $op2_free_op_var_ptr; -$op2_free_op_var_ptr_fast["VAR"] = "zval_ptr_dtor(&free_op2.var)"; +$op2_free_op_var_ptr_fast["VAR"] = "zval_ptr_dtor_nogc(&free_op2.var)"; $list = array(); // list of opcode handlers and helpers in original order $opcodes = array(); // opcode handlers by code @@ -1216,8 +1216,26 @@ function gen_vm($def, $skel) { // Insert header out($f, $GLOBALS['header_text']); + out($f, "#ifdef ZEND_WIN32\n"); // Suppress free_op1 warnings on Windows - out($f, "#ifdef ZEND_WIN32\n# pragma warning(once : 4101)\n#endif\n"); + out($f, "# pragma warning(once : 4101)\n"); + if (ZEND_VM_SPEC) { + // Suppress ( || ) warnings on windows + out($f, "# pragma warning(once : 6235)\n"); + // Suppress ( && ) warnings on windows + out($f, "# pragma warning(once : 6237)\n"); + // Suppress ( && ) warnings on windows + out($f, "# pragma warning(once : 6239)\n"); + // Suppress ( && ) warnings on windows + out($f, "# pragma warning(once : 6240)\n"); + // Suppress ( || ) warnings on windows + out($f, "# pragma warning(once : 6285)\n"); + // Suppress ( || ) warnings on windows + out($f, "# pragma warning(once : 6286)\n"); + // Suppress constant with constant comparsion warnings on windows + out($f, "# pragma warning(once : 6326)\n"); + } + out($f, "#endif\n"); // Support for ZEND_USER_OPCODE out($f, "static user_opcode_handler_t zend_user_opcode_handlers[256] = {\n"); diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h index 859258a440bef..7624ec192d7e6 100644 --- a/Zend/zend_vm_opcodes.h +++ b/Zend/zend_vm_opcodes.h @@ -164,3 +164,4 @@ #define ZEND_GENERATOR_RETURN 161 #define ZEND_FAST_CALL 162 #define ZEND_FAST_RET 163 +#define ZEND_RECV_VARIADIC 164 diff --git a/build/shtool b/build/shtool index 684a01f5df968..fc6ae1e6efbbb 100755 --- a/build/shtool +++ b/build/shtool @@ -1003,7 +1003,14 @@ mkdir ) if [ ".$opt_t" = .yes ]; then echo "mkdir $pathcomp" 1>&2 fi - mkdir $pathcomp || errstatus=$? + # See https://bugs.php.net/51076 + # The fix is from Debian who have sent it + # upstream, too; but upstream seems dead. + mkdir $pathcomp || { + _errstatus=$? + [ -d "$pathcomp" ] || errstatus=${_errstatus} + unset _errstatus + } if [ ".$opt_o" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chown $opt_o $pathcomp" 1>&2 diff --git a/configure.in b/configure.in index 16738fe30ab67..805aa48f5940f 100644 --- a/configure.in +++ b/configure.in @@ -1440,7 +1440,7 @@ PHP_SUBST(install_binary_targets) PHP_INSTALL_HEADERS([Zend/ TSRM/ include/ main/ main/streams/]) -PHP_ADD_SOURCES(TSRM, TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c) +PHP_ADD_SOURCES(TSRM, TSRM.c tsrm_strtok_r.c) PHP_ADD_SOURCES(main, main.c snprintf.c spprintf.c php_sprintf.c \ fopen_wrappers.c alloca.c php_scandir.c \ @@ -1475,7 +1475,8 @@ PHP_ADD_SOURCES(Zend, \ zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \ zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c zend_stream.c \ zend_iterators.c zend_interfaces.c zend_exceptions.c zend_strtod.c zend_gc.c \ - zend_closures.c zend_float.c zend_string.c zend_signal.c zend_generators.c) + zend_closures.c zend_float.c zend_string.c zend_signal.c zend_generators.c \ + zend_virtual_cwd.c) if test -r "$abs_srcdir/Zend/zend_objects.c"; then PHP_ADD_SOURCES(Zend, zend_objects.c zend_object_handlers.c zend_objects_API.c zend_default_classes.c) diff --git a/ext/bcmath/libbcmath/src/recmul.c b/ext/bcmath/libbcmath/src/recmul.c index c31d09dc72db5..64014f3a6e8a0 100644 --- a/ext/bcmath/libbcmath/src/recmul.c +++ b/ext/bcmath/libbcmath/src/recmul.c @@ -183,7 +183,6 @@ _bc_rec_mul (bc_num u, int ulen, bc_num v, int vlen, bc_num *prod, int full_scale TSRMLS_DC) { bc_num u0, u1, v0, v1; - int u0len, v0len; bc_num m1, m2, m3, d1, d2; int n, prodlen, m1zero; int d1len, d2len; @@ -216,10 +215,8 @@ _bc_rec_mul (bc_num u, int ulen, bc_num v, int vlen, bc_num *prod, } _bc_rm_leading_zeros (u1); _bc_rm_leading_zeros (u0); - u0len = u0->n_len; _bc_rm_leading_zeros (v1); _bc_rm_leading_zeros (v0); - v0len = v0->n_len; m1zero = bc_is_zero(u1 TSRMLS_CC) || bc_is_zero(v1 TSRMLS_CC); diff --git a/ext/bz2/bz2_filter.c b/ext/bz2/bz2_filter.c index 335600232b301..1e7837b098dae 100644 --- a/ext/bz2/bz2_filter.c +++ b/ext/bz2/bz2_filter.c @@ -97,6 +97,7 @@ static php_stream_filter_status_t php_bz2_decompress_filter( status = BZ2_bzDecompressInit(streamp, 0, data->small_footprint); if (BZ_OK != status) { + php_stream_bucket_delref(bucket TSRMLS_CC); return PSFS_ERR_FATAL; } diff --git a/ext/curl/interface.c b/ext/curl/interface.c index ac872dfbc2ca9..591315973ce20 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -2504,6 +2504,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu case CURLOPT_FOLLOWLOCATION: convert_to_long_ex(zvalue); +#if LIBCURL_VERSION_NUM < 0x071304 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"); @@ -2511,6 +2512,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu return 1; } } +#endif error = curl_easy_setopt(ch->cp, option, Z_LVAL_PP(zvalue)); break; diff --git a/ext/curl/tests/bug65646.phpt b/ext/curl/tests/bug65646.phpt new file mode 100644 index 0000000000000..f244f7238fc7d --- /dev/null +++ b/ext/curl/tests/bug65646.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #65646 (re-enable CURLOPT_FOLLOWLOCATION with open_basedir or safe_mode): open_basedir disabled +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(true) diff --git a/ext/curl/tests/bug65646_open_basedir_new.phpt b/ext/curl/tests/bug65646_open_basedir_new.phpt new file mode 100644 index 0000000000000..991c4a2b8a562 --- /dev/null +++ b/ext/curl/tests/bug65646_open_basedir_new.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #65646 (re-enable CURLOPT_FOLLOWLOCATION with open_basedir or safe_mode): open_basedir enabled; curl >= 7.19.4 +--INI-- +open_basedir=. +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +bool(true) + +Warning: curl_setopt(): CURLPROTO_FILE cannot be activated when an open_basedir is set in %s on line %d +bool(false) + +Warning: curl_setopt(): CURLPROTO_FILE cannot be activated when an open_basedir is set in %s on line %d +bool(false) diff --git a/ext/curl/tests/bug65646_open_basedir_old.phpt b/ext/curl/tests/bug65646_open_basedir_old.phpt new file mode 100644 index 0000000000000..cf11d21a200a2 --- /dev/null +++ b/ext/curl/tests/bug65646_open_basedir_old.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #65646 (re-enable CURLOPT_FOLLOWLOCATION with open_basedir or safe_mode): open_basedir enabled; curl < 7.19.4 +--INI-- +open_basedir=. +--SKIPIF-- +=')) exit("skip curl version is too new"); +?> +--FILE-- + +--EXPECTF-- +Warning: curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set in %s on line %d +bool(false) diff --git a/ext/curl/tests/curl_setopt_CURLOPT_FOLLOWLOCATION_open_basedir.phpt b/ext/curl/tests/curl_setopt_CURLOPT_FOLLOWLOCATION_open_basedir.phpt deleted file mode 100644 index 7a778f36924db..0000000000000 --- a/ext/curl/tests/curl_setopt_CURLOPT_FOLLOWLOCATION_open_basedir.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -CURLOPT_FOLLOWLOCATION case check open_basedir ---CREDITS-- -WHITE new media architects - Dennis ---INI-- -open_basedir = DIRECTORY_SEPARATOR."tmp"; ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Warning: curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set in %s.php on line %d -bool(false) - diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c index 8f707482678a8..0e99e231d6210 100644 --- a/ext/date/lib/parse_date.c +++ b/ext/date/lib/parse_date.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Fri Apr 26 11:10:28 2013 */ +/* Generated by re2c 0.13.5 on Sun Aug 25 15:12:48 2013 */ #line 1 "ext/date/lib/parse_date.re" /* +----------------------------------------------------------------------+ @@ -616,7 +616,8 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr) char *begin = *ptr, *end; const timelib_relunit *tp, *value = NULL; - while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t') { + while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t' && **ptr != ';' && **ptr != ':' && + **ptr != '/' && **ptr != '.' && **ptr != '-' && **ptr != '(' && **ptr != ')' ) { ++*ptr; } end = *ptr; @@ -836,11 +837,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) std: s->tok = cursor; s->len = 0; -#line 962 "ext/date/lib/parse_date.re" +#line 963 "ext/date/lib/parse_date.re" -#line 844 "ext/date/lib/parse_date.c" +#line 845 "ext/date/lib/parse_date.c" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -960,7 +961,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy2: YYDEBUG(2, *YYCURSOR); -#line 1048 "ext/date/lib/parse_date.re" +#line 1049 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("firstdayof | lastdayof"); TIMELIB_INIT; @@ -976,7 +977,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_LF_DAY_OF_MONTH; } -#line 980 "ext/date/lib/parse_date.c" +#line 981 "ext/date/lib/parse_date.c" yy3: YYDEBUG(3, *YYCURSOR); ++YYCURSOR; @@ -999,7 +1000,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy4: YYDEBUG(4, *YYCURSOR); -#line 1642 "ext/date/lib/parse_date.re" +#line 1643 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("tzcorrection | tz"); @@ -1012,7 +1013,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_TIMEZONE; } -#line 1016 "ext/date/lib/parse_date.c" +#line 1017 "ext/date/lib/parse_date.c" yy5: YYDEBUG(5, *YYCURSOR); yych = *++YYCURSOR; @@ -1323,12 +1324,12 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) if (yych <= '9') goto yy1385; yy13: YYDEBUG(13, *YYCURSOR); -#line 1737 "ext/date/lib/parse_date.re" +#line 1738 "ext/date/lib/parse_date.re" { add_error(s, "Unexpected character"); goto std; } -#line 1332 "ext/date/lib/parse_date.c" +#line 1333 "ext/date/lib/parse_date.c" yy14: YYDEBUG(14, *YYCURSOR); yych = *++YYCURSOR; @@ -2385,11 +2386,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) if (yych <= '9') goto yy55; yy50: YYDEBUG(50, *YYCURSOR); -#line 1726 "ext/date/lib/parse_date.re" +#line 1727 "ext/date/lib/parse_date.re" { goto std; } -#line 2393 "ext/date/lib/parse_date.c" +#line 2394 "ext/date/lib/parse_date.c" yy51: YYDEBUG(51, *YYCURSOR); yych = *++YYCURSOR; @@ -2398,12 +2399,12 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) YYDEBUG(52, *YYCURSOR); ++YYCURSOR; YYDEBUG(53, *YYCURSOR); -#line 1731 "ext/date/lib/parse_date.re" +#line 1732 "ext/date/lib/parse_date.re" { s->pos = cursor; s->line++; goto std; } -#line 2407 "ext/date/lib/parse_date.c" +#line 2408 "ext/date/lib/parse_date.c" yy54: YYDEBUG(54, *YYCURSOR); yych = *++YYCURSOR; @@ -2790,7 +2791,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) if (yych == 's') goto yy74; yy73: YYDEBUG(73, *YYCURSOR); -#line 1710 "ext/date/lib/parse_date.re" +#line 1711 "ext/date/lib/parse_date.re" { timelib_ull i; DEBUG_OUTPUT("relative"); @@ -2805,7 +2806,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 2809 "ext/date/lib/parse_date.c" +#line 2810 "ext/date/lib/parse_date.c" yy74: YYDEBUG(74, *YYCURSOR); yych = *++YYCURSOR; @@ -3567,7 +3568,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy167: YYDEBUG(167, *YYCURSOR); -#line 1573 "ext/date/lib/parse_date.re" +#line 1574 "ext/date/lib/parse_date.re" { const timelib_relunit* relunit; DEBUG_OUTPUT("daytext"); @@ -3584,7 +3585,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_WEEKDAY; } -#line 3588 "ext/date/lib/parse_date.c" +#line 3589 "ext/date/lib/parse_date.c" yy168: YYDEBUG(168, *YYCURSOR); yych = *++YYCURSOR; @@ -4104,7 +4105,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy194: YYDEBUG(194, *YYCURSOR); -#line 1632 "ext/date/lib/parse_date.re" +#line 1633 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("monthtext"); TIMELIB_INIT; @@ -4113,7 +4114,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 4117 "ext/date/lib/parse_date.c" +#line 4118 "ext/date/lib/parse_date.c" yy195: YYDEBUG(195, *YYCURSOR); ++YYCURSOR; @@ -4164,7 +4165,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy199: YYDEBUG(199, *YYCURSOR); -#line 1378 "ext/date/lib/parse_date.re" +#line 1379 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("datetextual | datenoyear"); @@ -4177,7 +4178,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 4181 "ext/date/lib/parse_date.c" +#line 4182 "ext/date/lib/parse_date.c" yy200: YYDEBUG(200, *YYCURSOR); yyaccept = 6; @@ -4446,7 +4447,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy223: YYDEBUG(223, *YYCURSOR); -#line 1680 "ext/date/lib/parse_date.re" +#line 1681 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz"); @@ -4475,7 +4476,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_SHORTDATE_WITH_TIME; } -#line 4479 "ext/date/lib/parse_date.c" +#line 4480 "ext/date/lib/parse_date.c" yy224: YYDEBUG(224, *YYCURSOR); yyaccept = 7; @@ -5173,7 +5174,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) YYDEBUG(278, *YYCURSOR); ++YYCURSOR; YYDEBUG(279, *YYCURSOR); -#line 1656 "ext/date/lib/parse_date.re" +#line 1657 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12"); TIMELIB_INIT; @@ -5196,7 +5197,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_SHORTDATE_WITH_TIME; } -#line 5200 "ext/date/lib/parse_date.c" +#line 5201 "ext/date/lib/parse_date.c" yy280: YYDEBUG(280, *YYCURSOR); yych = *++YYCURSOR; @@ -5374,7 +5375,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) ++YYCURSOR; yy295: YYDEBUG(295, *YYCURSOR); -#line 1350 "ext/date/lib/parse_date.re" +#line 1351 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("datenoday"); @@ -5387,7 +5388,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_DATE_NO_DAY; } -#line 5391 "ext/date/lib/parse_date.c" +#line 5392 "ext/date/lib/parse_date.c" yy296: YYDEBUG(296, *YYCURSOR); yych = *++YYCURSOR; @@ -6607,7 +6608,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) if (yych <= '9') goto yy365; yy364: YYDEBUG(364, *YYCURSOR); -#line 1494 "ext/date/lib/parse_date.re" +#line 1495 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("pgtextshort"); @@ -6620,7 +6621,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_PG_TEXT; } -#line 6624 "ext/date/lib/parse_date.c" +#line 6625 "ext/date/lib/parse_date.c" yy365: YYDEBUG(365, *YYCURSOR); yych = *++YYCURSOR; @@ -7258,7 +7259,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy393: YYDEBUG(393, *YYCURSOR); -#line 1552 "ext/date/lib/parse_date.re" +#line 1553 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("ago"); TIMELIB_INIT; @@ -7278,7 +7279,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_AGO; } -#line 7282 "ext/date/lib/parse_date.c" +#line 7283 "ext/date/lib/parse_date.c" yy394: YYDEBUG(394, *YYCURSOR); yyaccept = 5; @@ -9028,7 +9029,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) ++YYCURSOR; yy455: YYDEBUG(455, *YYCURSOR); -#line 1255 "ext/date/lib/parse_date.re" +#line 1256 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash"); TIMELIB_INIT; @@ -9039,7 +9040,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 9043 "ext/date/lib/parse_date.c" +#line 9044 "ext/date/lib/parse_date.c" yy456: YYDEBUG(456, *YYCURSOR); yyaccept = 0; @@ -9599,7 +9600,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy476: YYDEBUG(476, *YYCURSOR); -#line 1392 "ext/date/lib/parse_date.re" +#line 1393 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("datenoyearrev"); TIMELIB_INIT; @@ -9610,7 +9611,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 9614 "ext/date/lib/parse_date.c" +#line 9615 "ext/date/lib/parse_date.c" yy477: YYDEBUG(477, *YYCURSOR); yyaccept = 10; @@ -9751,7 +9752,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) YYDEBUG(488, *YYCURSOR); ++YYCURSOR; YYDEBUG(489, *YYCURSOR); -#line 1110 "ext/date/lib/parse_date.re" +#line 1111 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12"); TIMELIB_INIT; @@ -9767,7 +9768,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_TIME12; } -#line 9771 "ext/date/lib/parse_date.c" +#line 9772 "ext/date/lib/parse_date.c" yy490: YYDEBUG(490, *YYCURSOR); yyaccept = 11; @@ -9780,7 +9781,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy491: YYDEBUG(491, *YYCURSOR); -#line 1147 "ext/date/lib/parse_date.re" +#line 1148 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long"); @@ -9805,7 +9806,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_TIME24_WITH_ZONE; } -#line 9809 "ext/date/lib/parse_date.c" +#line 9810 "ext/date/lib/parse_date.c" yy492: YYDEBUG(492, *YYCURSOR); yyaccept = 11; @@ -10115,7 +10116,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) YYDEBUG(523, *YYCURSOR); ++YYCURSOR; YYDEBUG(524, *YYCURSOR); -#line 1127 "ext/date/lib/parse_date.re" +#line 1128 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("mssqltime"); TIMELIB_INIT; @@ -10134,7 +10135,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_TIME24_WITH_ZONE; } -#line 10138 "ext/date/lib/parse_date.c" +#line 10139 "ext/date/lib/parse_date.c" yy525: YYDEBUG(525, *YYCURSOR); yyaccept = 11; @@ -10240,7 +10241,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) if (yych <= '9') goto yy541; yy535: YYDEBUG(535, *YYCURSOR); -#line 1309 "ext/date/lib/parse_date.re" +#line 1310 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("datefull"); @@ -10254,7 +10255,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_DATE_FULL; } -#line 10258 "ext/date/lib/parse_date.c" +#line 10259 "ext/date/lib/parse_date.c" yy536: YYDEBUG(536, *YYCURSOR); yych = *++YYCURSOR; @@ -10991,7 +10992,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) YYDEBUG(606, *YYCURSOR); ++YYCURSOR; YYDEBUG(607, *YYCURSOR); -#line 1324 "ext/date/lib/parse_date.re" +#line 1325 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("pointed date YYYY"); TIMELIB_INIT; @@ -11002,7 +11003,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_DATE_FULL_POINTED; } -#line 11006 "ext/date/lib/parse_date.c" +#line 11007 "ext/date/lib/parse_date.c" yy608: YYDEBUG(608, *YYCURSOR); yyaccept = 11; @@ -11038,7 +11039,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) if (yych <= '9') goto yy605; yy612: YYDEBUG(612, *YYCURSOR); -#line 1336 "ext/date/lib/parse_date.re" +#line 1337 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("pointed date YY"); @@ -11051,7 +11052,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_DATE_FULL_POINTED; } -#line 11055 "ext/date/lib/parse_date.c" +#line 11056 "ext/date/lib/parse_date.c" yy613: YYDEBUG(613, *YYCURSOR); yyaccept = 11; @@ -11692,7 +11693,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy657: YYDEBUG(657, *YYCURSOR); -#line 1295 "ext/date/lib/parse_date.re" +#line 1296 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("gnudateshort"); @@ -11705,7 +11706,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 11709 "ext/date/lib/parse_date.c" +#line 11710 "ext/date/lib/parse_date.c" yy658: YYDEBUG(658, *YYCURSOR); yyaccept = 13; @@ -11811,7 +11812,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy667: YYDEBUG(667, *YYCURSOR); -#line 1239 "ext/date/lib/parse_date.re" +#line 1240 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("americanshort | american"); @@ -11826,7 +11827,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_AMERICAN; } -#line 11830 "ext/date/lib/parse_date.c" +#line 11831 "ext/date/lib/parse_date.c" yy668: YYDEBUG(668, *YYCURSOR); yyaccept = 14; @@ -12059,7 +12060,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) if (yych <= ':') goto yy704; yy701: YYDEBUG(701, *YYCURSOR); -#line 1522 "ext/date/lib/parse_date.re" +#line 1523 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("clf"); @@ -12079,7 +12080,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_CLF; } -#line 12083 "ext/date/lib/parse_date.c" +#line 12084 "ext/date/lib/parse_date.c" yy702: YYDEBUG(702, *YYCURSOR); yych = *++YYCURSOR; @@ -12631,7 +12632,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy764: YYDEBUG(764, *YYCURSOR); -#line 1267 "ext/date/lib/parse_date.re" +#line 1268 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("iso8601date2"); @@ -12644,7 +12645,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 12648 "ext/date/lib/parse_date.c" +#line 12649 "ext/date/lib/parse_date.c" yy765: YYDEBUG(765, *YYCURSOR); yych = *++YYCURSOR; @@ -12683,7 +12684,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) YYDEBUG(771, *YYCURSOR); ++YYCURSOR; YYDEBUG(772, *YYCURSOR); -#line 1508 "ext/date/lib/parse_date.re" +#line 1509 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("pgtextreverse"); @@ -12696,7 +12697,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_PG_TEXT; } -#line 12700 "ext/date/lib/parse_date.c" +#line 12701 "ext/date/lib/parse_date.c" yy773: YYDEBUG(773, *YYCURSOR); yych = *++YYCURSOR; @@ -12834,7 +12835,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy784: YYDEBUG(784, *YYCURSOR); -#line 1543 "ext/date/lib/parse_date.re" +#line 1544 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("year4"); TIMELIB_INIT; @@ -12842,7 +12843,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_CLF; } -#line 12846 "ext/date/lib/parse_date.c" +#line 12847 "ext/date/lib/parse_date.c" yy785: YYDEBUG(785, *YYCURSOR); yych = *++YYCURSOR; @@ -12993,7 +12994,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy794: YYDEBUG(794, *YYCURSOR); -#line 1364 "ext/date/lib/parse_date.re" +#line 1365 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("datenodayrev"); @@ -13006,7 +13007,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_DATE_NO_DAY; } -#line 13010 "ext/date/lib/parse_date.c" +#line 13011 "ext/date/lib/parse_date.c" yy795: YYDEBUG(795, *YYCURSOR); yych = *++YYCURSOR; @@ -13221,7 +13222,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) if (yych <= '7') goto yy817; yy815: YYDEBUG(815, *YYCURSOR); -#line 1475 "ext/date/lib/parse_date.re" +#line 1476 "ext/date/lib/parse_date.re" { timelib_sll w, d; DEBUG_OUTPUT("isoweek"); @@ -13239,7 +13240,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_ISO_WEEK; } -#line 13243 "ext/date/lib/parse_date.c" +#line 13244 "ext/date/lib/parse_date.c" yy816: YYDEBUG(816, *YYCURSOR); yych = *++YYCURSOR; @@ -13249,7 +13250,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) YYDEBUG(817, *YYCURSOR); ++YYCURSOR; YYDEBUG(818, *YYCURSOR); -#line 1456 "ext/date/lib/parse_date.re" +#line 1457 "ext/date/lib/parse_date.re" { timelib_sll w, d; DEBUG_OUTPUT("isoweekday"); @@ -13267,7 +13268,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_ISO_WEEK; } -#line 13271 "ext/date/lib/parse_date.c" +#line 13272 "ext/date/lib/parse_date.c" yy819: YYDEBUG(819, *YYCURSOR); yych = *++YYCURSOR; @@ -13331,7 +13332,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy822: YYDEBUG(822, *YYCURSOR); -#line 1442 "ext/date/lib/parse_date.re" +#line 1443 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("pgydotd"); @@ -13344,7 +13345,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_PG_YEARDAY; } -#line 13348 "ext/date/lib/parse_date.c" +#line 13349 "ext/date/lib/parse_date.c" yy823: YYDEBUG(823, *YYCURSOR); yych = *++YYCURSOR; @@ -13447,7 +13448,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) ++YYCURSOR; yy843: YYDEBUG(843, *YYCURSOR); -#line 1416 "ext/date/lib/parse_date.re" +#line 1417 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif"); @@ -13472,7 +13473,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_XMLRPC_SOAP; } -#line 13476 "ext/date/lib/parse_date.c" +#line 13477 "ext/date/lib/parse_date.c" yy844: YYDEBUG(844, *YYCURSOR); yych = *++YYCURSOR; @@ -13734,7 +13735,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy849: YYDEBUG(849, *YYCURSOR); -#line 1404 "ext/date/lib/parse_date.re" +#line 1405 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("datenocolon"); TIMELIB_INIT; @@ -13745,7 +13746,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_DATE_NOCOLON; } -#line 13749 "ext/date/lib/parse_date.c" +#line 13750 "ext/date/lib/parse_date.c" yy850: YYDEBUG(850, *YYCURSOR); yych = *++YYCURSOR; @@ -14665,7 +14666,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) if (yych <= '9') goto yy996; yy974: YYDEBUG(974, *YYCURSOR); -#line 1281 "ext/date/lib/parse_date.re" +#line 1282 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("gnudateshorter"); @@ -14678,7 +14679,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 14682 "ext/date/lib/parse_date.c" +#line 14683 "ext/date/lib/parse_date.c" yy975: YYDEBUG(975, *YYCURSOR); yyaccept = 22; @@ -15687,7 +15688,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy1068: YYDEBUG(1068, *YYCURSOR); -#line 1173 "ext/date/lib/parse_date.re" +#line 1174 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("gnunocolon"); TIMELIB_INIT; @@ -15709,7 +15710,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_GNU_NOCOLON; } -#line 15713 "ext/date/lib/parse_date.c" +#line 15714 "ext/date/lib/parse_date.c" yy1069: YYDEBUG(1069, *YYCURSOR); yych = *++YYCURSOR; @@ -15801,7 +15802,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy1076: YYDEBUG(1076, *YYCURSOR); -#line 1219 "ext/date/lib/parse_date.re" +#line 1220 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("iso8601nocolon"); @@ -15820,7 +15821,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_ISO_NOCOLON; } -#line 15824 "ext/date/lib/parse_date.c" +#line 15825 "ext/date/lib/parse_date.c" yy1077: YYDEBUG(1077, *YYCURSOR); yyaccept = 25; @@ -16718,7 +16719,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy1118: YYDEBUG(1118, *YYCURSOR); -#line 1615 "ext/date/lib/parse_date.re" +#line 1616 "ext/date/lib/parse_date.re" { timelib_sll i; int behavior = 0; @@ -16734,7 +16735,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 16738 "ext/date/lib/parse_date.c" +#line 16739 "ext/date/lib/parse_date.c" yy1119: YYDEBUG(1119, *YYCURSOR); ++YYCURSOR; @@ -16785,7 +16786,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) YYDEBUG(1126, *YYCURSOR); ++YYCURSOR; YYDEBUG(1127, *YYCURSOR); -#line 1088 "ext/date/lib/parse_date.re" +#line 1089 "ext/date/lib/parse_date.re" { timelib_sll i; int behavior = 0; @@ -16806,7 +16807,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_WEEK_DAY_OF_MONTH; } -#line 16810 "ext/date/lib/parse_date.c" +#line 16811 "ext/date/lib/parse_date.c" yy1128: YYDEBUG(1128, *YYCURSOR); yyaccept = 26; @@ -16914,7 +16915,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy1142: YYDEBUG(1142, *YYCURSOR); -#line 1591 "ext/date/lib/parse_date.re" +#line 1592 "ext/date/lib/parse_date.re" { timelib_sll i; int behavior = 0; @@ -16937,7 +16938,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 16941 "ext/date/lib/parse_date.c" +#line 16942 "ext/date/lib/parse_date.c" yy1143: YYDEBUG(1143, *YYCURSOR); yych = *++YYCURSOR; @@ -19614,7 +19615,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) goto yy1298; yy1295: YYDEBUG(1295, *YYCURSOR); -#line 1065 "ext/date/lib/parse_date.re" +#line 1066 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("backof | frontof"); TIMELIB_INIT; @@ -19636,7 +19637,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_LF_DAY_OF_MONTH; } -#line 19640 "ext/date/lib/parse_date.c" +#line 19641 "ext/date/lib/parse_date.c" yy1296: YYDEBUG(1296, *YYCURSOR); yyaccept = 28; @@ -21327,7 +21328,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) if (yych <= '9') goto yy1385; yy1387: YYDEBUG(1387, *YYCURSOR); -#line 1022 "ext/date/lib/parse_date.re" +#line 1023 "ext/date/lib/parse_date.re" { timelib_ull i; @@ -21352,7 +21353,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 21356 "ext/date/lib/parse_date.c" +#line 21357 "ext/date/lib/parse_date.c" yy1388: YYDEBUG(1388, *YYCURSOR); yych = *++YYCURSOR; @@ -21788,7 +21789,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) ++YYCURSOR; yy1417: YYDEBUG(1417, *YYCURSOR); -#line 1010 "ext/date/lib/parse_date.re" +#line 1011 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("tomorrow"); TIMELIB_INIT; @@ -21799,7 +21800,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 21803 "ext/date/lib/parse_date.c" +#line 21804 "ext/date/lib/parse_date.c" yy1418: YYDEBUG(1418, *YYCURSOR); yych = *++YYCURSOR; @@ -21834,7 +21835,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy1420: YYDEBUG(1420, *YYCURSOR); -#line 1000 "ext/date/lib/parse_date.re" +#line 1001 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("midnight | today"); TIMELIB_INIT; @@ -21843,7 +21844,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 21847 "ext/date/lib/parse_date.c" +#line 21848 "ext/date/lib/parse_date.c" yy1421: YYDEBUG(1421, *YYCURSOR); yych = *++YYCURSOR; @@ -23855,7 +23856,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy1500: YYDEBUG(1500, *YYCURSOR); -#line 979 "ext/date/lib/parse_date.re" +#line 980 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("now"); TIMELIB_INIT; @@ -23863,7 +23864,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 23867 "ext/date/lib/parse_date.c" +#line 23868 "ext/date/lib/parse_date.c" yy1501: YYDEBUG(1501, *YYCURSOR); yych = *++YYCURSOR; @@ -24002,7 +24003,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) } yy1508: YYDEBUG(1508, *YYCURSOR); -#line 988 "ext/date/lib/parse_date.re" +#line 989 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("noon"); TIMELIB_INIT; @@ -24013,7 +24014,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 24017 "ext/date/lib/parse_date.c" +#line 24018 "ext/date/lib/parse_date.c" yy1509: YYDEBUG(1509, *YYCURSOR); yyaccept = 0; @@ -24546,7 +24547,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) ++YYCURSOR; yy1531: YYDEBUG(1531, *YYCURSOR); -#line 967 "ext/date/lib/parse_date.re" +#line 968 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("yesterday"); TIMELIB_INIT; @@ -24557,7 +24558,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 24561 "ext/date/lib/parse_date.c" +#line 24562 "ext/date/lib/parse_date.c" yy1532: YYDEBUG(1532, *YYCURSOR); yyaccept = 0; @@ -24730,7 +24731,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) goto yy1531; } } -#line 1741 "ext/date/lib/parse_date.re" +#line 1742 "ext/date/lib/parse_date.re" } @@ -25001,7 +25002,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim TIMELIB_CHECK_NUMBER; sec = timelib_get_nr_ex((char **) &ptr, 2, &length); if (sec == TIMELIB_UNSET || length != 2) { - add_pbf_error(s, "A two second minute could not be found", string, begin); + add_pbf_error(s, "A two digit second could not be found", string, begin); } else { s->time->s = sec; } diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re index 014f6a09e2f37..6d91d9ada9e41 100644 --- a/ext/date/lib/parse_date.re +++ b/ext/date/lib/parse_date.re @@ -614,7 +614,8 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr) char *begin = *ptr, *end; const timelib_relunit *tp, *value = NULL; - while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t') { + while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t' && **ptr != ';' && **ptr != ':' && + **ptr != '/' && **ptr != '.' && **ptr != '-' && **ptr != '(' && **ptr != ')' ) { ++*ptr; } end = *ptr; @@ -2008,7 +2009,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim TIMELIB_CHECK_NUMBER; sec = timelib_get_nr_ex((char **) &ptr, 2, &length); if (sec == TIMELIB_UNSET || length != 2) { - add_pbf_error(s, "A two second minute could not be found", string, begin); + add_pbf_error(s, "A two digit second could not be found", string, begin); } else { s->time->s = sec; } diff --git a/ext/date/lib/timezonedb.h b/ext/date/lib/timezonedb.h index 1e5706cdccd3c..91884a935f567 100644 --- a/ext/date/lib/timezonedb.h +++ b/ext/date/lib/timezonedb.h @@ -14,573 +14,573 @@ const timelib_tzdb_index_entry timezonedb_idx_builtin[579] = { { "Africa/Bujumbura" , 0x000571 }, { "Africa/Cairo" , 0x0005B5 }, { "Africa/Casablanca" , 0x000878 }, - { "Africa/Ceuta" , 0x000ABC }, - { "Africa/Conakry" , 0x000DC3 }, - { "Africa/Dakar" , 0x000E2E }, - { "Africa/Dar_es_Salaam" , 0x000E94 }, - { "Africa/Djibouti" , 0x000F01 }, - { "Africa/Douala" , 0x000F56 }, - { "Africa/El_Aaiun" , 0x000FAB }, - { "Africa/Freetown" , 0x001011 }, - { "Africa/Gaborone" , 0x001120 }, - { "Africa/Harare" , 0x00118D }, - { "Africa/Johannesburg" , 0x0011E2 }, - { "Africa/Juba" , 0x001250 }, - { "Africa/Kampala" , 0x001363 }, - { "Africa/Khartoum" , 0x0013E2 }, - { "Africa/Kigali" , 0x0014F5 }, - { "Africa/Kinshasa" , 0x00154A }, - { "Africa/Lagos" , 0x0015A5 }, - { "Africa/Libreville" , 0x0015FA }, - { "Africa/Lome" , 0x00164F }, - { "Africa/Luanda" , 0x001693 }, - { "Africa/Lubumbashi" , 0x0016E8 }, - { "Africa/Lusaka" , 0x001743 }, - { "Africa/Malabo" , 0x001798 }, - { "Africa/Maputo" , 0x0017FE }, - { "Africa/Maseru" , 0x001853 }, - { "Africa/Mbabane" , 0x0018BB }, - { "Africa/Mogadishu" , 0x001911 }, - { "Africa/Monrovia" , 0x00196C }, - { "Africa/Nairobi" , 0x0019D2 }, - { "Africa/Ndjamena" , 0x001A51 }, - { "Africa/Niamey" , 0x001ABD }, - { "Africa/Nouakchott" , 0x001B30 }, - { "Africa/Ouagadougou" , 0x001B9B }, - { "Africa/Porto-Novo" , 0x001BF0 }, - { "Africa/Sao_Tome" , 0x001C56 }, - { "Africa/Timbuktu" , 0x001CAB }, - { "Africa/Tripoli" , 0x001D16 }, - { "Africa/Tunis" , 0x001F0F }, - { "Africa/Windhoek" , 0x002021 }, - { "America/Adak" , 0x002268 }, - { "America/Anchorage" , 0x0025DE }, - { "America/Anguilla" , 0x002952 }, - { "America/Antigua" , 0x0029A7 }, - { "America/Araguaina" , 0x002A0D }, - { "America/Argentina/Buenos_Aires" , 0x002C67 }, - { "America/Argentina/Catamarca" , 0x002E15 }, - { "America/Argentina/ComodRivadavia" , 0x002FD6 }, - { "America/Argentina/Cordoba" , 0x00317C }, - { "America/Argentina/Jujuy" , 0x003351 }, - { "America/Argentina/La_Rioja" , 0x003505 }, - { "America/Argentina/Mendoza" , 0x0036BD }, - { "America/Argentina/Rio_Gallegos" , 0x00387D }, - { "America/Argentina/Salta" , 0x003A32 }, - { "America/Argentina/San_Juan" , 0x003BDE }, - { "America/Argentina/San_Luis" , 0x003D96 }, - { "America/Argentina/Tucuman" , 0x003F5C }, - { "America/Argentina/Ushuaia" , 0x004118 }, - { "America/Aruba" , 0x0042D3 }, - { "America/Asuncion" , 0x004339 }, - { "America/Atikokan" , 0x00461E }, - { "America/Atka" , 0x0046F4 }, - { "America/Bahia" , 0x004A5A }, - { "America/Bahia_Banderas" , 0x004BED }, - { "America/Barbados" , 0x004E66 }, - { "America/Belem" , 0x004F00 }, - { "America/Belize" , 0x004FFB }, - { "America/Blanc-Sablon" , 0x005177 }, - { "America/Boa_Vista" , 0x00522B }, - { "America/Bogota" , 0x005334 }, - { "America/Boise" , 0x0053A0 }, - { "America/Buenos_Aires" , 0x005737 }, - { "America/Cambridge_Bay" , 0x0058D0 }, - { "America/Campo_Grande" , 0x005BF8 }, - { "America/Cancun" , 0x005EE7 }, - { "America/Caracas" , 0x006129 }, - { "America/Catamarca" , 0x006190 }, - { "America/Cayenne" , 0x006336 }, - { "America/Cayman" , 0x006398 }, - { "America/Chicago" , 0x0063ED }, - { "America/Chihuahua" , 0x006904 }, - { "America/Coral_Harbour" , 0x006B6F }, - { "America/Cordoba" , 0x006C01 }, - { "America/Costa_Rica" , 0x006DA7 }, - { "America/Creston" , 0x006E31 }, - { "America/Cuiaba" , 0x006EBD }, - { "America/Curacao" , 0x00719B }, - { "America/Danmarkshavn" , 0x007201 }, - { "America/Dawson" , 0x007345 }, - { "America/Dawson_Creek" , 0x007662 }, - { "America/Denver" , 0x00783C }, - { "America/Detroit" , 0x007BC2 }, - { "America/Dominica" , 0x007F21 }, - { "America/Edmonton" , 0x007F76 }, - { "America/Eirunepe" , 0x00832E }, - { "America/El_Salvador" , 0x008441 }, - { "America/Ensenada" , 0x0084B6 }, - { "America/Fort_Wayne" , 0x00895D }, - { "America/Fortaleza" , 0x00881F }, - { "America/Glace_Bay" , 0x008BC7 }, - { "America/Godthab" , 0x008F3E }, - { "America/Goose_Bay" , 0x009202 }, - { "America/Grand_Turk" , 0x0096BF }, - { "America/Grenada" , 0x00996E }, - { "America/Guadeloupe" , 0x0099C3 }, - { "America/Guatemala" , 0x009A18 }, - { "America/Guayaquil" , 0x009AA1 }, - { "America/Guyana" , 0x009AFE }, - { "America/Halifax" , 0x009B7F }, - { "America/Havana" , 0x00A095 }, - { "America/Hermosillo" , 0x00A408 }, - { "America/Indiana/Indianapolis" , 0x00A4E6 }, - { "America/Indiana/Knox" , 0x00A777 }, - { "America/Indiana/Marengo" , 0x00AB0E }, - { "America/Indiana/Petersburg" , 0x00ADB4 }, - { "America/Indiana/Tell_City" , 0x00B301 }, - { "America/Indiana/Vevay" , 0x00B59A }, - { "America/Indiana/Vincennes" , 0x00B7D5 }, - { "America/Indiana/Winamac" , 0x00BA89 }, - { "America/Indianapolis" , 0x00B097 }, - { "America/Inuvik" , 0x00BD42 }, - { "America/Iqaluit" , 0x00C039 }, - { "America/Jamaica" , 0x00C35B }, - { "America/Jujuy" , 0x00C420 }, - { "America/Juneau" , 0x00C5CA }, - { "America/Kentucky/Louisville" , 0x00C948 }, - { "America/Kentucky/Monticello" , 0x00CD66 }, - { "America/Knox_IN" , 0x00D0EB }, - { "America/Kralendijk" , 0x00D45C }, - { "America/La_Paz" , 0x00D4C2 }, - { "America/Lima" , 0x00D529 }, - { "America/Los_Angeles" , 0x00D5D1 }, - { "America/Louisville" , 0x00D9E2 }, - { "America/Lower_Princes" , 0x00DDD7 }, - { "America/Maceio" , 0x00DE3D }, - { "America/Managua" , 0x00DF77 }, - { "America/Manaus" , 0x00E02A }, - { "America/Marigot" , 0x00E12C }, - { "America/Martinique" , 0x00E181 }, - { "America/Matamoros" , 0x00E1ED }, - { "America/Mazatlan" , 0x00E446 }, - { "America/Mendoza" , 0x00E6B3 }, - { "America/Menominee" , 0x00E867 }, - { "America/Merida" , 0x00EBE8 }, - { "America/Metlakatla" , 0x00EE23 }, - { "America/Mexico_City" , 0x00EF5D }, - { "America/Miquelon" , 0x00F1D8 }, - { "America/Moncton" , 0x00F44A }, - { "America/Monterrey" , 0x00F8E1 }, - { "America/Montevideo" , 0x00FB44 }, - { "America/Montreal" , 0x00FE56 }, - { "America/Montserrat" , 0x01036C }, - { "America/Nassau" , 0x0103C1 }, - { "America/New_York" , 0x010706 }, - { "America/Nipigon" , 0x010C11 }, - { "America/Nome" , 0x010F62 }, - { "America/Noronha" , 0x0112E0 }, - { "America/North_Dakota/Beulah" , 0x011410 }, - { "America/North_Dakota/Center" , 0x0117A4 }, - { "America/North_Dakota/New_Salem" , 0x011B38 }, - { "America/Ojinaga" , 0x011EE1 }, - { "America/Panama" , 0x012142 }, - { "America/Pangnirtung" , 0x012197 }, - { "America/Paramaribo" , 0x0124CD }, - { "America/Phoenix" , 0x01255F }, - { "America/Port-au-Prince" , 0x01260D }, - { "America/Port_of_Spain" , 0x01292C }, - { "America/Porto_Acre" , 0x01282D }, - { "America/Porto_Velho" , 0x012981 }, - { "America/Puerto_Rico" , 0x012A77 }, - { "America/Rainy_River" , 0x012AE2 }, - { "America/Rankin_Inlet" , 0x012E1A }, - { "America/Recife" , 0x013100 }, - { "America/Regina" , 0x01322A }, - { "America/Resolute" , 0x0133E8 }, - { "America/Rio_Branco" , 0x0136D9 }, - { "America/Rosario" , 0x0137DC }, - { "America/Santa_Isabel" , 0x013982 }, - { "America/Santarem" , 0x013D25 }, - { "America/Santiago" , 0x013E2A }, - { "America/Santo_Domingo" , 0x0141D3 }, - { "America/Sao_Paulo" , 0x014299 }, - { "America/Scoresbysund" , 0x0145A8 }, - { "America/Shiprock" , 0x014896 }, - { "America/Sitka" , 0x014C25 }, - { "America/St_Barthelemy" , 0x014FAD }, - { "America/St_Johns" , 0x015002 }, - { "America/St_Kitts" , 0x015555 }, - { "America/St_Lucia" , 0x0155AA }, - { "America/St_Thomas" , 0x0155FF }, - { "America/St_Vincent" , 0x015654 }, - { "America/Swift_Current" , 0x0156A9 }, - { "America/Tegucigalpa" , 0x0157CA }, - { "America/Thule" , 0x015849 }, - { "America/Thunder_Bay" , 0x015A90 }, - { "America/Tijuana" , 0x015DD9 }, - { "America/Toronto" , 0x016172 }, - { "America/Tortola" , 0x016689 }, - { "America/Vancouver" , 0x0166DE }, - { "America/Virgin" , 0x016B1B }, - { "America/Whitehorse" , 0x016B70 }, - { "America/Winnipeg" , 0x016E8D }, - { "America/Yakutat" , 0x0172CD }, - { "America/Yellowknife" , 0x017638 }, - { "Antarctica/Casey" , 0x017948 }, - { "Antarctica/Davis" , 0x0179E5 }, - { "Antarctica/DumontDUrville" , 0x017A86 }, - { "Antarctica/Macquarie" , 0x017B18 }, - { "Antarctica/Mawson" , 0x017D5F }, - { "Antarctica/McMurdo" , 0x017DDB }, - { "Antarctica/Palmer" , 0x0180DD }, - { "Antarctica/Rothera" , 0x0183F9 }, - { "Antarctica/South_Pole" , 0x01846F }, - { "Antarctica/Syowa" , 0x018777 }, - { "Antarctica/Vostok" , 0x0187E5 }, - { "Arctic/Longyearbyen" , 0x018856 }, - { "Asia/Aden" , 0x018B88 }, - { "Asia/Almaty" , 0x018BDD }, - { "Asia/Amman" , 0x018D5C }, - { "Asia/Anadyr" , 0x019012 }, - { "Asia/Aqtau" , 0x0191F7 }, - { "Asia/Aqtobe" , 0x0193F6 }, - { "Asia/Ashgabat" , 0x0195AE }, - { "Asia/Ashkhabad" , 0x0196CB }, - { "Asia/Baghdad" , 0x0197E8 }, - { "Asia/Bahrain" , 0x01995D }, - { "Asia/Baku" , 0x0199C3 }, - { "Asia/Bangkok" , 0x019CAB }, - { "Asia/Beirut" , 0x019D00 }, - { "Asia/Bishkek" , 0x01A00D }, - { "Asia/Brunei" , 0x01A1B9 }, - { "Asia/Calcutta" , 0x01A21B }, - { "Asia/Choibalsan" , 0x01A294 }, - { "Asia/Chongqing" , 0x01A40D }, - { "Asia/Chungking" , 0x01A4FC }, - { "Asia/Colombo" , 0x01A5AB }, - { "Asia/Dacca" , 0x01A647 }, - { "Asia/Damascus" , 0x01A6ED }, - { "Asia/Dhaka" , 0x01AA3D }, - { "Asia/Dili" , 0x01AAE3 }, - { "Asia/Dubai" , 0x01AB6C }, - { "Asia/Dushanbe" , 0x01ABC1 }, - { "Asia/Gaza" , 0x01ACC4 }, - { "Asia/Harbin" , 0x01B017 }, - { "Asia/Hebron" , 0x01B0FE }, - { "Asia/Ho_Chi_Minh" , 0x01B45A }, - { "Asia/Hong_Kong" , 0x01B4D2 }, - { "Asia/Hovd" , 0x01B694 }, - { "Asia/Irkutsk" , 0x01B80C }, - { "Asia/Istanbul" , 0x01B9F2 }, - { "Asia/Jakarta" , 0x01BDDF }, - { "Asia/Jayapura" , 0x01BE89 }, - { "Asia/Jerusalem" , 0x01BF25 }, - { "Asia/Kabul" , 0x01C254 }, - { "Asia/Kamchatka" , 0x01C2A5 }, - { "Asia/Karachi" , 0x01C481 }, - { "Asia/Kashgar" , 0x01C536 }, - { "Asia/Kathmandu" , 0x01C607 }, - { "Asia/Katmandu" , 0x01C66D }, - { "Asia/Khandyga" , 0x01C6D3 }, - { "Asia/Kolkata" , 0x01C8F8 }, - { "Asia/Krasnoyarsk" , 0x01C971 }, - { "Asia/Kuala_Lumpur" , 0x01CB59 }, - { "Asia/Kuching" , 0x01CC16 }, - { "Asia/Kuwait" , 0x01CD04 }, - { "Asia/Macao" , 0x01CD59 }, - { "Asia/Macau" , 0x01CE94 }, - { "Asia/Magadan" , 0x01CFCF }, - { "Asia/Makassar" , 0x01D1B1 }, - { "Asia/Manila" , 0x01D275 }, - { "Asia/Muscat" , 0x01D2FA }, - { "Asia/Nicosia" , 0x01D34F }, - { "Asia/Novokuznetsk" , 0x01D637 }, - { "Asia/Novosibirsk" , 0x01D839 }, - { "Asia/Omsk" , 0x01DA24 }, - { "Asia/Oral" , 0x01DC0B }, - { "Asia/Phnom_Penh" , 0x01DDDB }, - { "Asia/Pontianak" , 0x01DE53 }, - { "Asia/Pyongyang" , 0x01DF14 }, - { "Asia/Qatar" , 0x01DF81 }, - { "Asia/Qyzylorda" , 0x01DFE7 }, - { "Asia/Rangoon" , 0x01E1BD }, - { "Asia/Riyadh" , 0x01E235 }, - { "Asia/Saigon" , 0x01E28A }, - { "Asia/Sakhalin" , 0x01E302 }, - { "Asia/Samarkand" , 0x01E4F9 }, - { "Asia/Seoul" , 0x01E62F }, - { "Asia/Shanghai" , 0x01E6D3 }, - { "Asia/Singapore" , 0x01E7B3 }, - { "Asia/Taipei" , 0x01E86A }, - { "Asia/Tashkent" , 0x01E982 }, - { "Asia/Tbilisi" , 0x01EAB3 }, - { "Asia/Tehran" , 0x01EC6D }, - { "Asia/Tel_Aviv" , 0x01EEDB }, - { "Asia/Thimbu" , 0x01F20A }, - { "Asia/Thimphu" , 0x01F270 }, - { "Asia/Tokyo" , 0x01F2D6 }, - { "Asia/Ujung_Pandang" , 0x01F35F }, - { "Asia/Ulaanbaatar" , 0x01F3DB }, - { "Asia/Ulan_Bator" , 0x01F536 }, - { "Asia/Urumqi" , 0x01F683 }, - { "Asia/Ust-Nera" , 0x01F74A }, - { "Asia/Vientiane" , 0x01F94F }, - { "Asia/Vladivostok" , 0x01F9C7 }, - { "Asia/Yakutsk" , 0x01FBB3 }, - { "Asia/Yekaterinburg" , 0x01FD98 }, - { "Asia/Yerevan" , 0x01FFA3 }, - { "Atlantic/Azores" , 0x0201A3 }, - { "Atlantic/Bermuda" , 0x0206A6 }, - { "Atlantic/Canary" , 0x020987 }, - { "Atlantic/Cape_Verde" , 0x020C5D }, - { "Atlantic/Faeroe" , 0x020CD6 }, - { "Atlantic/Faroe" , 0x020F7A }, - { "Atlantic/Jan_Mayen" , 0x02121E }, - { "Atlantic/Madeira" , 0x021550 }, - { "Atlantic/Reykjavik" , 0x021A59 }, - { "Atlantic/South_Georgia" , 0x021C12 }, - { "Atlantic/St_Helena" , 0x021E24 }, - { "Atlantic/Stanley" , 0x021C56 }, - { "Australia/ACT" , 0x021E79 }, - { "Australia/Adelaide" , 0x022196 }, - { "Australia/Brisbane" , 0x0224C2 }, - { "Australia/Broken_Hill" , 0x022589 }, - { "Australia/Canberra" , 0x0228C7 }, - { "Australia/Currie" , 0x022BE4 }, - { "Australia/Darwin" , 0x022F17 }, - { "Australia/Eucla" , 0x022F9D }, - { "Australia/Hobart" , 0x023072 }, - { "Australia/LHI" , 0x0233D0 }, - { "Australia/Lindeman" , 0x02366B }, - { "Australia/Lord_Howe" , 0x02374C }, - { "Australia/Melbourne" , 0x0239F7 }, - { "Australia/North" , 0x023D1C }, - { "Australia/NSW" , 0x023D90 }, - { "Australia/Perth" , 0x0240AD }, - { "Australia/Queensland" , 0x024185 }, - { "Australia/South" , 0x024231 }, - { "Australia/Sydney" , 0x02454E }, - { "Australia/Tasmania" , 0x02488B }, - { "Australia/Victoria" , 0x024BD0 }, - { "Australia/West" , 0x024EED }, - { "Australia/Yancowinna" , 0x024FA3 }, - { "Brazil/Acre" , 0x0252C5 }, - { "Brazil/DeNoronha" , 0x0253C4 }, - { "Brazil/East" , 0x0254E4 }, - { "Brazil/West" , 0x0257C1 }, - { "Canada/Atlantic" , 0x0258B9 }, - { "Canada/Central" , 0x025DA1 }, - { "Canada/East-Saskatchewan" , 0x0266AB }, - { "Canada/Eastern" , 0x0261BB }, - { "Canada/Mountain" , 0x026834 }, - { "Canada/Newfoundland" , 0x026BAA }, - { "Canada/Pacific" , 0x0270D5 }, - { "Canada/Saskatchewan" , 0x0274EE }, - { "Canada/Yukon" , 0x027677 }, - { "CET" , 0x02797A }, - { "Chile/Continental" , 0x027C83 }, - { "Chile/EasterIsland" , 0x02801E }, - { "CST6CDT" , 0x028360 }, - { "Cuba" , 0x0286B1 }, - { "EET" , 0x028A24 }, - { "Egypt" , 0x028CD7 }, - { "Eire" , 0x028F9A }, - { "EST" , 0x0294AB }, - { "EST5EDT" , 0x0294EF }, - { "Etc/GMT" , 0x029840 }, - { "Etc/GMT+0" , 0x02990C }, - { "Etc/GMT+1" , 0x029996 }, - { "Etc/GMT+10" , 0x029A23 }, - { "Etc/GMT+11" , 0x029AB1 }, - { "Etc/GMT+12" , 0x029B3F }, - { "Etc/GMT+2" , 0x029C5A }, - { "Etc/GMT+3" , 0x029CE6 }, - { "Etc/GMT+4" , 0x029D72 }, - { "Etc/GMT+5" , 0x029DFE }, - { "Etc/GMT+6" , 0x029E8A }, - { "Etc/GMT+7" , 0x029F16 }, - { "Etc/GMT+8" , 0x029FA2 }, - { "Etc/GMT+9" , 0x02A02E }, - { "Etc/GMT-0" , 0x0298C8 }, - { "Etc/GMT-1" , 0x029950 }, - { "Etc/GMT-10" , 0x0299DC }, - { "Etc/GMT-11" , 0x029A6A }, - { "Etc/GMT-12" , 0x029AF8 }, - { "Etc/GMT-13" , 0x029B86 }, - { "Etc/GMT-14" , 0x029BCD }, - { "Etc/GMT-2" , 0x029C14 }, - { "Etc/GMT-3" , 0x029CA0 }, - { "Etc/GMT-4" , 0x029D2C }, - { "Etc/GMT-5" , 0x029DB8 }, - { "Etc/GMT-6" , 0x029E44 }, - { "Etc/GMT-7" , 0x029ED0 }, - { "Etc/GMT-8" , 0x029F5C }, - { "Etc/GMT-9" , 0x029FE8 }, - { "Etc/GMT0" , 0x029884 }, - { "Etc/Greenwich" , 0x02A074 }, - { "Etc/UCT" , 0x02A0B8 }, - { "Etc/Universal" , 0x02A0FC }, - { "Etc/UTC" , 0x02A140 }, - { "Etc/Zulu" , 0x02A184 }, - { "Europe/Amsterdam" , 0x02A1C8 }, - { "Europe/Andorra" , 0x02A606 }, - { "Europe/Athens" , 0x02A882 }, - { "Europe/Belfast" , 0x02ABC5 }, - { "Europe/Belgrade" , 0x02B0FC }, - { "Europe/Berlin" , 0x02B3C5 }, - { "Europe/Bratislava" , 0x02B729 }, - { "Europe/Brussels" , 0x02BA5B }, - { "Europe/Bucharest" , 0x02BE92 }, - { "Europe/Budapest" , 0x02C1BC }, - { "Europe/Busingen" , 0x02C52F }, - { "Europe/Chisinau" , 0x02C7E6 }, - { "Europe/Copenhagen" , 0x02CB74 }, - { "Europe/Dublin" , 0x02CE7E }, - { "Europe/Gibraltar" , 0x02D38F }, - { "Europe/Guernsey" , 0x02D7E6 }, - { "Europe/Helsinki" , 0x02DD1D }, - { "Europe/Isle_of_Man" , 0x02DFD3 }, - { "Europe/Istanbul" , 0x02E50A }, - { "Europe/Jersey" , 0x02E8F7 }, - { "Europe/Kaliningrad" , 0x02EE2E }, - { "Europe/Kiev" , 0x02F094 }, - { "Europe/Lisbon" , 0x02F3AB }, - { "Europe/Ljubljana" , 0x02F8AF }, - { "Europe/London" , 0x02FB78 }, - { "Europe/Luxembourg" , 0x0300AF }, - { "Europe/Madrid" , 0x030505 }, - { "Europe/Malta" , 0x0308CB }, - { "Europe/Mariehamn" , 0x030C84 }, - { "Europe/Minsk" , 0x030F3A }, - { "Europe/Monaco" , 0x031148 }, - { "Europe/Moscow" , 0x031583 }, - { "Europe/Nicosia" , 0x0317D4 }, - { "Europe/Oslo" , 0x031ABC }, - { "Europe/Paris" , 0x031DEE }, - { "Europe/Podgorica" , 0x032234 }, - { "Europe/Prague" , 0x0324FD }, - { "Europe/Riga" , 0x03282F }, - { "Europe/Rome" , 0x032B74 }, - { "Europe/Samara" , 0x032F37 }, - { "Europe/San_Marino" , 0x03316A }, - { "Europe/Sarajevo" , 0x03352D }, - { "Europe/Simferopol" , 0x0337F6 }, - { "Europe/Skopje" , 0x033B21 }, - { "Europe/Sofia" , 0x033DEA }, - { "Europe/Stockholm" , 0x0340F2 }, - { "Europe/Tallinn" , 0x0343A1 }, - { "Europe/Tirane" , 0x0346DB }, - { "Europe/Tiraspol" , 0x0349E1 }, - { "Europe/Uzhgorod" , 0x034D6F }, - { "Europe/Vaduz" , 0x035086 }, - { "Europe/Vatican" , 0x035319 }, - { "Europe/Vienna" , 0x0356DC }, - { "Europe/Vilnius" , 0x035A09 }, - { "Europe/Volgograd" , 0x035D48 }, - { "Europe/Warsaw" , 0x035F48 }, - { "Europe/Zagreb" , 0x036329 }, - { "Europe/Zaporozhye" , 0x0365F2 }, - { "Europe/Zurich" , 0x036933 }, - { "Factory" , 0x036BE2 }, - { "GB" , 0x036C53 }, - { "GB-Eire" , 0x03718A }, - { "GMT" , 0x0376C1 }, - { "GMT+0" , 0x03778D }, - { "GMT-0" , 0x037749 }, - { "GMT0" , 0x037705 }, - { "Greenwich" , 0x0377D1 }, - { "Hongkong" , 0x037815 }, - { "HST" , 0x0379D7 }, - { "Iceland" , 0x037A1B }, - { "Indian/Antananarivo" , 0x037BD4 }, - { "Indian/Chagos" , 0x037C48 }, - { "Indian/Christmas" , 0x037CAA }, - { "Indian/Cocos" , 0x037CEE }, - { "Indian/Comoro" , 0x037D32 }, - { "Indian/Kerguelen" , 0x037D87 }, - { "Indian/Mahe" , 0x037DDC }, - { "Indian/Maldives" , 0x037E31 }, - { "Indian/Mauritius" , 0x037E86 }, - { "Indian/Mayotte" , 0x037EFC }, - { "Indian/Reunion" , 0x037F51 }, - { "Iran" , 0x037FA6 }, - { "Israel" , 0x038214 }, - { "Jamaica" , 0x038543 }, - { "Japan" , 0x038608 }, - { "Kwajalein" , 0x038691 }, - { "Libya" , 0x0386F4 }, - { "MET" , 0x0388ED }, - { "Mexico/BajaNorte" , 0x038BF6 }, - { "Mexico/BajaSur" , 0x038F5F }, - { "Mexico/General" , 0x0391A4 }, - { "MST" , 0x039402 }, - { "MST7MDT" , 0x039446 }, - { "Navajo" , 0x039797 }, - { "NZ" , 0x039B10 }, - { "NZ-CHAT" , 0x039E8E }, - { "Pacific/Apia" , 0x03A176 }, - { "Pacific/Auckland" , 0x03A312 }, - { "Pacific/Chatham" , 0x03A69E }, - { "Pacific/Chuuk" , 0x03A995 }, - { "Pacific/Easter" , 0x03A9EE }, - { "Pacific/Efate" , 0x03AD4C }, - { "Pacific/Enderbury" , 0x03AE12 }, - { "Pacific/Fakaofo" , 0x03AE80 }, - { "Pacific/Fiji" , 0x03AED1 }, - { "Pacific/Funafuti" , 0x03B064 }, - { "Pacific/Galapagos" , 0x03B0A8 }, - { "Pacific/Gambier" , 0x03B120 }, - { "Pacific/Guadalcanal" , 0x03B185 }, - { "Pacific/Guam" , 0x03B1DA }, - { "Pacific/Honolulu" , 0x03B230 }, - { "Pacific/Johnston" , 0x03B2A7 }, - { "Pacific/Kiritimati" , 0x03B2F9 }, - { "Pacific/Kosrae" , 0x03B364 }, - { "Pacific/Kwajalein" , 0x03B3C1 }, - { "Pacific/Majuro" , 0x03B42D }, - { "Pacific/Marquesas" , 0x03B48C }, - { "Pacific/Midway" , 0x03B4F3 }, - { "Pacific/Nauru" , 0x03B57D }, - { "Pacific/Niue" , 0x03B5F5 }, - { "Pacific/Norfolk" , 0x03B653 }, - { "Pacific/Noumea" , 0x03B6A8 }, - { "Pacific/Pago_Pago" , 0x03B738 }, - { "Pacific/Palau" , 0x03B7C1 }, - { "Pacific/Pitcairn" , 0x03B805 }, - { "Pacific/Pohnpei" , 0x03B85A }, - { "Pacific/Ponape" , 0x03B8AF }, - { "Pacific/Port_Moresby" , 0x03B8F4 }, - { "Pacific/Rarotonga" , 0x03B938 }, - { "Pacific/Saipan" , 0x03BA14 }, - { "Pacific/Samoa" , 0x03BA77 }, - { "Pacific/Tahiti" , 0x03BB00 }, - { "Pacific/Tarawa" , 0x03BB65 }, - { "Pacific/Tongatapu" , 0x03BBB9 }, - { "Pacific/Truk" , 0x03BC45 }, - { "Pacific/Wake" , 0x03BC8A }, - { "Pacific/Wallis" , 0x03BCDA }, - { "Pacific/Yap" , 0x03BD1E }, - { "Poland" , 0x03BD63 }, - { "Portugal" , 0x03C144 }, - { "PRC" , 0x03C640 }, - { "PST8PDT" , 0x03C6F1 }, - { "ROC" , 0x03CA42 }, - { "ROK" , 0x03CB5A }, - { "Singapore" , 0x03CBFE }, - { "Turkey" , 0x03CCB5 }, - { "UCT" , 0x03D0A2 }, - { "Universal" , 0x03D0E6 }, - { "US/Alaska" , 0x03D12A }, - { "US/Aleutian" , 0x03D493 }, - { "US/Arizona" , 0x03D7F9 }, - { "US/Central" , 0x03D887 }, - { "US/East-Indiana" , 0x03E291 }, - { "US/Eastern" , 0x03DD92 }, - { "US/Hawaii" , 0x03E4FB }, - { "US/Indiana-Starke" , 0x03E56C }, - { "US/Michigan" , 0x03E8DD }, - { "US/Mountain" , 0x03EC14 }, - { "US/Pacific" , 0x03EF8D }, - { "US/Pacific-New" , 0x03F392 }, - { "US/Samoa" , 0x03F797 }, - { "UTC" , 0x03F820 }, - { "W-SU" , 0x03FB17 }, - { "WET" , 0x03F864 }, - { "Zulu" , 0x03FD51 }, + { "Africa/Ceuta" , 0x000ADA }, + { "Africa/Conakry" , 0x000DE1 }, + { "Africa/Dakar" , 0x000E4C }, + { "Africa/Dar_es_Salaam" , 0x000EB2 }, + { "Africa/Djibouti" , 0x000F1F }, + { "Africa/Douala" , 0x000F74 }, + { "Africa/El_Aaiun" , 0x000FC9 }, + { "Africa/Freetown" , 0x0011F4 }, + { "Africa/Gaborone" , 0x001303 }, + { "Africa/Harare" , 0x001370 }, + { "Africa/Johannesburg" , 0x0013C5 }, + { "Africa/Juba" , 0x001433 }, + { "Africa/Kampala" , 0x001546 }, + { "Africa/Khartoum" , 0x0015C5 }, + { "Africa/Kigali" , 0x0016D8 }, + { "Africa/Kinshasa" , 0x00172D }, + { "Africa/Lagos" , 0x001788 }, + { "Africa/Libreville" , 0x0017DD }, + { "Africa/Lome" , 0x001832 }, + { "Africa/Luanda" , 0x001876 }, + { "Africa/Lubumbashi" , 0x0018CB }, + { "Africa/Lusaka" , 0x001926 }, + { "Africa/Malabo" , 0x00197B }, + { "Africa/Maputo" , 0x0019E1 }, + { "Africa/Maseru" , 0x001A36 }, + { "Africa/Mbabane" , 0x001A9E }, + { "Africa/Mogadishu" , 0x001AF4 }, + { "Africa/Monrovia" , 0x001B4F }, + { "Africa/Nairobi" , 0x001BB5 }, + { "Africa/Ndjamena" , 0x001C34 }, + { "Africa/Niamey" , 0x001CA0 }, + { "Africa/Nouakchott" , 0x001D13 }, + { "Africa/Ouagadougou" , 0x001D7E }, + { "Africa/Porto-Novo" , 0x001DD3 }, + { "Africa/Sao_Tome" , 0x001E39 }, + { "Africa/Timbuktu" , 0x001E8E }, + { "Africa/Tripoli" , 0x001EF9 }, + { "Africa/Tunis" , 0x002002 }, + { "Africa/Windhoek" , 0x002114 }, + { "America/Adak" , 0x00235B }, + { "America/Anchorage" , 0x0026D1 }, + { "America/Anguilla" , 0x002A45 }, + { "America/Antigua" , 0x002A9A }, + { "America/Araguaina" , 0x002B00 }, + { "America/Argentina/Buenos_Aires" , 0x002C65 }, + { "America/Argentina/Catamarca" , 0x002E13 }, + { "America/Argentina/ComodRivadavia" , 0x002FD4 }, + { "America/Argentina/Cordoba" , 0x00317A }, + { "America/Argentina/Jujuy" , 0x00334F }, + { "America/Argentina/La_Rioja" , 0x003503 }, + { "America/Argentina/Mendoza" , 0x0036BB }, + { "America/Argentina/Rio_Gallegos" , 0x00387B }, + { "America/Argentina/Salta" , 0x003A30 }, + { "America/Argentina/San_Juan" , 0x003BDC }, + { "America/Argentina/San_Luis" , 0x003D94 }, + { "America/Argentina/Tucuman" , 0x003F5A }, + { "America/Argentina/Ushuaia" , 0x004116 }, + { "America/Aruba" , 0x0042D1 }, + { "America/Asuncion" , 0x004337 }, + { "America/Atikokan" , 0x00461C }, + { "America/Atka" , 0x0046F2 }, + { "America/Bahia" , 0x004A58 }, + { "America/Bahia_Banderas" , 0x004BEB }, + { "America/Barbados" , 0x004E64 }, + { "America/Belem" , 0x004EFE }, + { "America/Belize" , 0x004FF9 }, + { "America/Blanc-Sablon" , 0x005175 }, + { "America/Boa_Vista" , 0x005229 }, + { "America/Bogota" , 0x005332 }, + { "America/Boise" , 0x00539E }, + { "America/Buenos_Aires" , 0x005735 }, + { "America/Cambridge_Bay" , 0x0058CE }, + { "America/Campo_Grande" , 0x005BF6 }, + { "America/Cancun" , 0x005EE5 }, + { "America/Caracas" , 0x006127 }, + { "America/Catamarca" , 0x00618E }, + { "America/Cayenne" , 0x006334 }, + { "America/Cayman" , 0x006396 }, + { "America/Chicago" , 0x0063EB }, + { "America/Chihuahua" , 0x006902 }, + { "America/Coral_Harbour" , 0x006B6D }, + { "America/Cordoba" , 0x006BFF }, + { "America/Costa_Rica" , 0x006DA5 }, + { "America/Creston" , 0x006E2F }, + { "America/Cuiaba" , 0x006EBB }, + { "America/Curacao" , 0x007199 }, + { "America/Danmarkshavn" , 0x0071FF }, + { "America/Dawson" , 0x007343 }, + { "America/Dawson_Creek" , 0x007660 }, + { "America/Denver" , 0x00783A }, + { "America/Detroit" , 0x007BC0 }, + { "America/Dominica" , 0x007F1F }, + { "America/Edmonton" , 0x007F74 }, + { "America/Eirunepe" , 0x00832C }, + { "America/El_Salvador" , 0x008444 }, + { "America/Ensenada" , 0x0084B9 }, + { "America/Fort_Wayne" , 0x008960 }, + { "America/Fortaleza" , 0x008822 }, + { "America/Glace_Bay" , 0x008BCA }, + { "America/Godthab" , 0x008F41 }, + { "America/Goose_Bay" , 0x009205 }, + { "America/Grand_Turk" , 0x0096C2 }, + { "America/Grenada" , 0x009971 }, + { "America/Guadeloupe" , 0x0099C6 }, + { "America/Guatemala" , 0x009A1B }, + { "America/Guayaquil" , 0x009AA4 }, + { "America/Guyana" , 0x009B01 }, + { "America/Halifax" , 0x009B82 }, + { "America/Havana" , 0x00A098 }, + { "America/Hermosillo" , 0x00A40B }, + { "America/Indiana/Indianapolis" , 0x00A4E9 }, + { "America/Indiana/Knox" , 0x00A77A }, + { "America/Indiana/Marengo" , 0x00AB11 }, + { "America/Indiana/Petersburg" , 0x00ADB7 }, + { "America/Indiana/Tell_City" , 0x00B304 }, + { "America/Indiana/Vevay" , 0x00B59D }, + { "America/Indiana/Vincennes" , 0x00B7D8 }, + { "America/Indiana/Winamac" , 0x00BA8C }, + { "America/Indianapolis" , 0x00B09A }, + { "America/Inuvik" , 0x00BD45 }, + { "America/Iqaluit" , 0x00C03C }, + { "America/Jamaica" , 0x00C35E }, + { "America/Jujuy" , 0x00C423 }, + { "America/Juneau" , 0x00C5CD }, + { "America/Kentucky/Louisville" , 0x00C94B }, + { "America/Kentucky/Monticello" , 0x00CD69 }, + { "America/Knox_IN" , 0x00D0EE }, + { "America/Kralendijk" , 0x00D45F }, + { "America/La_Paz" , 0x00D4C5 }, + { "America/Lima" , 0x00D52C }, + { "America/Los_Angeles" , 0x00D5D4 }, + { "America/Louisville" , 0x00D9E5 }, + { "America/Lower_Princes" , 0x00DDDA }, + { "America/Maceio" , 0x00DE40 }, + { "America/Managua" , 0x00DF7A }, + { "America/Manaus" , 0x00E02D }, + { "America/Marigot" , 0x00E12F }, + { "America/Martinique" , 0x00E184 }, + { "America/Matamoros" , 0x00E1F0 }, + { "America/Mazatlan" , 0x00E449 }, + { "America/Mendoza" , 0x00E6B6 }, + { "America/Menominee" , 0x00E86A }, + { "America/Merida" , 0x00EBEB }, + { "America/Metlakatla" , 0x00EE26 }, + { "America/Mexico_City" , 0x00EF60 }, + { "America/Miquelon" , 0x00F1DB }, + { "America/Moncton" , 0x00F44D }, + { "America/Monterrey" , 0x00F8E4 }, + { "America/Montevideo" , 0x00FB47 }, + { "America/Montreal" , 0x00FE59 }, + { "America/Montserrat" , 0x010349 }, + { "America/Nassau" , 0x01039E }, + { "America/New_York" , 0x0106E3 }, + { "America/Nipigon" , 0x010BEE }, + { "America/Nome" , 0x010F3F }, + { "America/Noronha" , 0x0112BD }, + { "America/North_Dakota/Beulah" , 0x0113ED }, + { "America/North_Dakota/Center" , 0x011781 }, + { "America/North_Dakota/New_Salem" , 0x011B15 }, + { "America/Ojinaga" , 0x011EBE }, + { "America/Panama" , 0x01211F }, + { "America/Pangnirtung" , 0x012174 }, + { "America/Paramaribo" , 0x0124AA }, + { "America/Phoenix" , 0x01253C }, + { "America/Port-au-Prince" , 0x0125FA }, + { "America/Port_of_Spain" , 0x01291E }, + { "America/Porto_Acre" , 0x01281A }, + { "America/Porto_Velho" , 0x012973 }, + { "America/Puerto_Rico" , 0x012A69 }, + { "America/Rainy_River" , 0x012AD4 }, + { "America/Rankin_Inlet" , 0x012E0C }, + { "America/Recife" , 0x0130F2 }, + { "America/Regina" , 0x01321C }, + { "America/Resolute" , 0x0133DA }, + { "America/Rio_Branco" , 0x0136CB }, + { "America/Rosario" , 0x0137D3 }, + { "America/Santa_Isabel" , 0x013979 }, + { "America/Santarem" , 0x013D1C }, + { "America/Santiago" , 0x013E21 }, + { "America/Santo_Domingo" , 0x0141CA }, + { "America/Sao_Paulo" , 0x014290 }, + { "America/Scoresbysund" , 0x01459F }, + { "America/Shiprock" , 0x01488D }, + { "America/Sitka" , 0x014C06 }, + { "America/St_Barthelemy" , 0x014F8E }, + { "America/St_Johns" , 0x014FE3 }, + { "America/St_Kitts" , 0x015536 }, + { "America/St_Lucia" , 0x01558B }, + { "America/St_Thomas" , 0x0155E0 }, + { "America/St_Vincent" , 0x015635 }, + { "America/Swift_Current" , 0x01568A }, + { "America/Tegucigalpa" , 0x0157AB }, + { "America/Thule" , 0x01582A }, + { "America/Thunder_Bay" , 0x015A71 }, + { "America/Tijuana" , 0x015DBA }, + { "America/Toronto" , 0x016153 }, + { "America/Tortola" , 0x016673 }, + { "America/Vancouver" , 0x0166C8 }, + { "America/Virgin" , 0x016B05 }, + { "America/Whitehorse" , 0x016B5A }, + { "America/Winnipeg" , 0x016E77 }, + { "America/Yakutat" , 0x0172B7 }, + { "America/Yellowknife" , 0x017622 }, + { "Antarctica/Casey" , 0x017932 }, + { "Antarctica/Davis" , 0x0179CF }, + { "Antarctica/DumontDUrville" , 0x017A70 }, + { "Antarctica/Macquarie" , 0x017B02 }, + { "Antarctica/Mawson" , 0x017D49 }, + { "Antarctica/McMurdo" , 0x017DC5 }, + { "Antarctica/Palmer" , 0x018170 }, + { "Antarctica/Rothera" , 0x01848C }, + { "Antarctica/South_Pole" , 0x018502 }, + { "Antarctica/Syowa" , 0x018880 }, + { "Antarctica/Vostok" , 0x0188EE }, + { "Arctic/Longyearbyen" , 0x01895F }, + { "Asia/Aden" , 0x018C91 }, + { "Asia/Almaty" , 0x018CE6 }, + { "Asia/Amman" , 0x018E65 }, + { "Asia/Anadyr" , 0x019037 }, + { "Asia/Aqtau" , 0x01921C }, + { "Asia/Aqtobe" , 0x01941B }, + { "Asia/Ashgabat" , 0x0195D3 }, + { "Asia/Ashkhabad" , 0x0196F0 }, + { "Asia/Baghdad" , 0x01980D }, + { "Asia/Bahrain" , 0x019982 }, + { "Asia/Baku" , 0x0199E8 }, + { "Asia/Bangkok" , 0x019CD0 }, + { "Asia/Beirut" , 0x019D25 }, + { "Asia/Bishkek" , 0x01A032 }, + { "Asia/Brunei" , 0x01A1DE }, + { "Asia/Calcutta" , 0x01A240 }, + { "Asia/Choibalsan" , 0x01A2B9 }, + { "Asia/Chongqing" , 0x01A432 }, + { "Asia/Chungking" , 0x01A521 }, + { "Asia/Colombo" , 0x01A5D0 }, + { "Asia/Dacca" , 0x01A66C }, + { "Asia/Damascus" , 0x01A712 }, + { "Asia/Dhaka" , 0x01AA62 }, + { "Asia/Dili" , 0x01AB08 }, + { "Asia/Dubai" , 0x01AB92 }, + { "Asia/Dushanbe" , 0x01ABE7 }, + { "Asia/Gaza" , 0x01ACEA }, + { "Asia/Harbin" , 0x01B03D }, + { "Asia/Hebron" , 0x01B124 }, + { "Asia/Ho_Chi_Minh" , 0x01B480 }, + { "Asia/Hong_Kong" , 0x01B4F8 }, + { "Asia/Hovd" , 0x01B6BA }, + { "Asia/Irkutsk" , 0x01B832 }, + { "Asia/Istanbul" , 0x01BA18 }, + { "Asia/Jakarta" , 0x01BE05 }, + { "Asia/Jayapura" , 0x01BEAF }, + { "Asia/Jerusalem" , 0x01BF4B }, + { "Asia/Kabul" , 0x01C27A }, + { "Asia/Kamchatka" , 0x01C2CB }, + { "Asia/Karachi" , 0x01C4A7 }, + { "Asia/Kashgar" , 0x01C55C }, + { "Asia/Kathmandu" , 0x01C62D }, + { "Asia/Katmandu" , 0x01C693 }, + { "Asia/Khandyga" , 0x01C6F9 }, + { "Asia/Kolkata" , 0x01C91E }, + { "Asia/Krasnoyarsk" , 0x01C997 }, + { "Asia/Kuala_Lumpur" , 0x01CB7F }, + { "Asia/Kuching" , 0x01CC3C }, + { "Asia/Kuwait" , 0x01CD2A }, + { "Asia/Macao" , 0x01CD7F }, + { "Asia/Macau" , 0x01CEBA }, + { "Asia/Magadan" , 0x01CFF5 }, + { "Asia/Makassar" , 0x01D1D7 }, + { "Asia/Manila" , 0x01D29C }, + { "Asia/Muscat" , 0x01D321 }, + { "Asia/Nicosia" , 0x01D376 }, + { "Asia/Novokuznetsk" , 0x01D65E }, + { "Asia/Novosibirsk" , 0x01D860 }, + { "Asia/Omsk" , 0x01DA4B }, + { "Asia/Oral" , 0x01DC32 }, + { "Asia/Phnom_Penh" , 0x01DE02 }, + { "Asia/Pontianak" , 0x01DE7A }, + { "Asia/Pyongyang" , 0x01DF3C }, + { "Asia/Qatar" , 0x01DFA9 }, + { "Asia/Qyzylorda" , 0x01E00F }, + { "Asia/Rangoon" , 0x01E1E5 }, + { "Asia/Riyadh" , 0x01E25D }, + { "Asia/Saigon" , 0x01E2B2 }, + { "Asia/Sakhalin" , 0x01E32A }, + { "Asia/Samarkand" , 0x01E521 }, + { "Asia/Seoul" , 0x01E657 }, + { "Asia/Shanghai" , 0x01E6FB }, + { "Asia/Singapore" , 0x01E7DB }, + { "Asia/Taipei" , 0x01E892 }, + { "Asia/Tashkent" , 0x01E9AA }, + { "Asia/Tbilisi" , 0x01EADB }, + { "Asia/Tehran" , 0x01EC95 }, + { "Asia/Tel_Aviv" , 0x01EF03 }, + { "Asia/Thimbu" , 0x01F232 }, + { "Asia/Thimphu" , 0x01F298 }, + { "Asia/Tokyo" , 0x01F2FE }, + { "Asia/Ujung_Pandang" , 0x01F387 }, + { "Asia/Ulaanbaatar" , 0x01F404 }, + { "Asia/Ulan_Bator" , 0x01F55F }, + { "Asia/Urumqi" , 0x01F6AC }, + { "Asia/Ust-Nera" , 0x01F773 }, + { "Asia/Vientiane" , 0x01F978 }, + { "Asia/Vladivostok" , 0x01F9F0 }, + { "Asia/Yakutsk" , 0x01FBDC }, + { "Asia/Yekaterinburg" , 0x01FDC1 }, + { "Asia/Yerevan" , 0x01FFCC }, + { "Atlantic/Azores" , 0x0201CC }, + { "Atlantic/Bermuda" , 0x0206CF }, + { "Atlantic/Canary" , 0x0209B0 }, + { "Atlantic/Cape_Verde" , 0x020C86 }, + { "Atlantic/Faeroe" , 0x020CFF }, + { "Atlantic/Faroe" , 0x020FA3 }, + { "Atlantic/Jan_Mayen" , 0x021247 }, + { "Atlantic/Madeira" , 0x021579 }, + { "Atlantic/Reykjavik" , 0x021A82 }, + { "Atlantic/South_Georgia" , 0x021C3B }, + { "Atlantic/St_Helena" , 0x021E4D }, + { "Atlantic/Stanley" , 0x021C7F }, + { "Australia/ACT" , 0x021EA2 }, + { "Australia/Adelaide" , 0x0221BF }, + { "Australia/Brisbane" , 0x0224EB }, + { "Australia/Broken_Hill" , 0x0225B2 }, + { "Australia/Canberra" , 0x0228F0 }, + { "Australia/Currie" , 0x022C0D }, + { "Australia/Darwin" , 0x022F40 }, + { "Australia/Eucla" , 0x022FC6 }, + { "Australia/Hobart" , 0x02309B }, + { "Australia/LHI" , 0x0233F9 }, + { "Australia/Lindeman" , 0x023694 }, + { "Australia/Lord_Howe" , 0x023775 }, + { "Australia/Melbourne" , 0x023A20 }, + { "Australia/North" , 0x023D45 }, + { "Australia/NSW" , 0x023DB9 }, + { "Australia/Perth" , 0x0240D6 }, + { "Australia/Queensland" , 0x0241AE }, + { "Australia/South" , 0x02425A }, + { "Australia/Sydney" , 0x024577 }, + { "Australia/Tasmania" , 0x0248B4 }, + { "Australia/Victoria" , 0x024BF9 }, + { "Australia/West" , 0x024F16 }, + { "Australia/Yancowinna" , 0x024FCC }, + { "Brazil/Acre" , 0x0252EE }, + { "Brazil/DeNoronha" , 0x0253F2 }, + { "Brazil/East" , 0x025512 }, + { "Brazil/West" , 0x0257EF }, + { "Canada/Atlantic" , 0x0258E7 }, + { "Canada/Central" , 0x025DCF }, + { "Canada/East-Saskatchewan" , 0x0266D9 }, + { "Canada/Eastern" , 0x0261E9 }, + { "Canada/Mountain" , 0x026862 }, + { "Canada/Newfoundland" , 0x026BD8 }, + { "Canada/Pacific" , 0x027103 }, + { "Canada/Saskatchewan" , 0x02751C }, + { "Canada/Yukon" , 0x0276A5 }, + { "CET" , 0x0279A8 }, + { "Chile/Continental" , 0x027CB1 }, + { "Chile/EasterIsland" , 0x02804C }, + { "CST6CDT" , 0x02838E }, + { "Cuba" , 0x0286DF }, + { "EET" , 0x028A52 }, + { "Egypt" , 0x028D05 }, + { "Eire" , 0x028FC8 }, + { "EST" , 0x0294D9 }, + { "EST5EDT" , 0x02951D }, + { "Etc/GMT" , 0x02986E }, + { "Etc/GMT+0" , 0x02993A }, + { "Etc/GMT+1" , 0x0299C4 }, + { "Etc/GMT+10" , 0x029A51 }, + { "Etc/GMT+11" , 0x029ADF }, + { "Etc/GMT+12" , 0x029B6D }, + { "Etc/GMT+2" , 0x029C88 }, + { "Etc/GMT+3" , 0x029D14 }, + { "Etc/GMT+4" , 0x029DA0 }, + { "Etc/GMT+5" , 0x029E2C }, + { "Etc/GMT+6" , 0x029EB8 }, + { "Etc/GMT+7" , 0x029F44 }, + { "Etc/GMT+8" , 0x029FD0 }, + { "Etc/GMT+9" , 0x02A05C }, + { "Etc/GMT-0" , 0x0298F6 }, + { "Etc/GMT-1" , 0x02997E }, + { "Etc/GMT-10" , 0x029A0A }, + { "Etc/GMT-11" , 0x029A98 }, + { "Etc/GMT-12" , 0x029B26 }, + { "Etc/GMT-13" , 0x029BB4 }, + { "Etc/GMT-14" , 0x029BFB }, + { "Etc/GMT-2" , 0x029C42 }, + { "Etc/GMT-3" , 0x029CCE }, + { "Etc/GMT-4" , 0x029D5A }, + { "Etc/GMT-5" , 0x029DE6 }, + { "Etc/GMT-6" , 0x029E72 }, + { "Etc/GMT-7" , 0x029EFE }, + { "Etc/GMT-8" , 0x029F8A }, + { "Etc/GMT-9" , 0x02A016 }, + { "Etc/GMT0" , 0x0298B2 }, + { "Etc/Greenwich" , 0x02A0A2 }, + { "Etc/UCT" , 0x02A0E6 }, + { "Etc/Universal" , 0x02A12A }, + { "Etc/UTC" , 0x02A16E }, + { "Etc/Zulu" , 0x02A1B2 }, + { "Europe/Amsterdam" , 0x02A1F6 }, + { "Europe/Andorra" , 0x02A634 }, + { "Europe/Athens" , 0x02A8B0 }, + { "Europe/Belfast" , 0x02ABF3 }, + { "Europe/Belgrade" , 0x02B12A }, + { "Europe/Berlin" , 0x02B3F3 }, + { "Europe/Bratislava" , 0x02B757 }, + { "Europe/Brussels" , 0x02BA89 }, + { "Europe/Bucharest" , 0x02BEC0 }, + { "Europe/Budapest" , 0x02C1EA }, + { "Europe/Busingen" , 0x02C55D }, + { "Europe/Chisinau" , 0x02C814 }, + { "Europe/Copenhagen" , 0x02CBA2 }, + { "Europe/Dublin" , 0x02CEAC }, + { "Europe/Gibraltar" , 0x02D3BD }, + { "Europe/Guernsey" , 0x02D814 }, + { "Europe/Helsinki" , 0x02DD4B }, + { "Europe/Isle_of_Man" , 0x02E001 }, + { "Europe/Istanbul" , 0x02E538 }, + { "Europe/Jersey" , 0x02E925 }, + { "Europe/Kaliningrad" , 0x02EE5C }, + { "Europe/Kiev" , 0x02F0C2 }, + { "Europe/Lisbon" , 0x02F3D9 }, + { "Europe/Ljubljana" , 0x02F8DD }, + { "Europe/London" , 0x02FBA6 }, + { "Europe/Luxembourg" , 0x0300DD }, + { "Europe/Madrid" , 0x030533 }, + { "Europe/Malta" , 0x0308F9 }, + { "Europe/Mariehamn" , 0x030CB2 }, + { "Europe/Minsk" , 0x030F68 }, + { "Europe/Monaco" , 0x031176 }, + { "Europe/Moscow" , 0x0315B1 }, + { "Europe/Nicosia" , 0x031802 }, + { "Europe/Oslo" , 0x031AEA }, + { "Europe/Paris" , 0x031E1C }, + { "Europe/Podgorica" , 0x032262 }, + { "Europe/Prague" , 0x03252B }, + { "Europe/Riga" , 0x03285D }, + { "Europe/Rome" , 0x032BA2 }, + { "Europe/Samara" , 0x032F65 }, + { "Europe/San_Marino" , 0x033198 }, + { "Europe/Sarajevo" , 0x03355B }, + { "Europe/Simferopol" , 0x033824 }, + { "Europe/Skopje" , 0x033B4F }, + { "Europe/Sofia" , 0x033E18 }, + { "Europe/Stockholm" , 0x034120 }, + { "Europe/Tallinn" , 0x0343CF }, + { "Europe/Tirane" , 0x034709 }, + { "Europe/Tiraspol" , 0x034A0F }, + { "Europe/Uzhgorod" , 0x034D9D }, + { "Europe/Vaduz" , 0x0350B4 }, + { "Europe/Vatican" , 0x035363 }, + { "Europe/Vienna" , 0x035726 }, + { "Europe/Vilnius" , 0x035A53 }, + { "Europe/Volgograd" , 0x035D92 }, + { "Europe/Warsaw" , 0x035F92 }, + { "Europe/Zagreb" , 0x036373 }, + { "Europe/Zaporozhye" , 0x03663C }, + { "Europe/Zurich" , 0x03697D }, + { "Factory" , 0x036C2C }, + { "GB" , 0x036C9D }, + { "GB-Eire" , 0x0371D4 }, + { "GMT" , 0x03770B }, + { "GMT+0" , 0x0377D7 }, + { "GMT-0" , 0x037793 }, + { "GMT0" , 0x03774F }, + { "Greenwich" , 0x03781B }, + { "Hongkong" , 0x03785F }, + { "HST" , 0x037A21 }, + { "Iceland" , 0x037A65 }, + { "Indian/Antananarivo" , 0x037C1E }, + { "Indian/Chagos" , 0x037C92 }, + { "Indian/Christmas" , 0x037CF4 }, + { "Indian/Cocos" , 0x037D38 }, + { "Indian/Comoro" , 0x037D7C }, + { "Indian/Kerguelen" , 0x037DD1 }, + { "Indian/Mahe" , 0x037E26 }, + { "Indian/Maldives" , 0x037E7B }, + { "Indian/Mauritius" , 0x037ED0 }, + { "Indian/Mayotte" , 0x037F46 }, + { "Indian/Reunion" , 0x037F9B }, + { "Iran" , 0x037FF0 }, + { "Israel" , 0x03825E }, + { "Jamaica" , 0x03858D }, + { "Japan" , 0x038652 }, + { "Kwajalein" , 0x0386DB }, + { "Libya" , 0x03873E }, + { "MET" , 0x038847 }, + { "Mexico/BajaNorte" , 0x038B50 }, + { "Mexico/BajaSur" , 0x038EB9 }, + { "Mexico/General" , 0x0390FE }, + { "MST" , 0x03935C }, + { "MST7MDT" , 0x0393A0 }, + { "Navajo" , 0x0396F1 }, + { "NZ" , 0x039A6A }, + { "NZ-CHAT" , 0x039DE8 }, + { "Pacific/Apia" , 0x03A0D0 }, + { "Pacific/Auckland" , 0x03A26C }, + { "Pacific/Chatham" , 0x03A5F8 }, + { "Pacific/Chuuk" , 0x03A8EF }, + { "Pacific/Easter" , 0x03A948 }, + { "Pacific/Efate" , 0x03ACA6 }, + { "Pacific/Enderbury" , 0x03AD6C }, + { "Pacific/Fakaofo" , 0x03ADDA }, + { "Pacific/Fiji" , 0x03AE2B }, + { "Pacific/Funafuti" , 0x03AFBE }, + { "Pacific/Galapagos" , 0x03B002 }, + { "Pacific/Gambier" , 0x03B07A }, + { "Pacific/Guadalcanal" , 0x03B0DF }, + { "Pacific/Guam" , 0x03B134 }, + { "Pacific/Honolulu" , 0x03B18A }, + { "Pacific/Johnston" , 0x03B201 }, + { "Pacific/Kiritimati" , 0x03B280 }, + { "Pacific/Kosrae" , 0x03B2EB }, + { "Pacific/Kwajalein" , 0x03B348 }, + { "Pacific/Majuro" , 0x03B3B4 }, + { "Pacific/Marquesas" , 0x03B413 }, + { "Pacific/Midway" , 0x03B47A }, + { "Pacific/Nauru" , 0x03B504 }, + { "Pacific/Niue" , 0x03B57C }, + { "Pacific/Norfolk" , 0x03B5DA }, + { "Pacific/Noumea" , 0x03B62F }, + { "Pacific/Pago_Pago" , 0x03B6BF }, + { "Pacific/Palau" , 0x03B748 }, + { "Pacific/Pitcairn" , 0x03B78C }, + { "Pacific/Pohnpei" , 0x03B7E1 }, + { "Pacific/Ponape" , 0x03B836 }, + { "Pacific/Port_Moresby" , 0x03B87B }, + { "Pacific/Rarotonga" , 0x03B8BF }, + { "Pacific/Saipan" , 0x03B99B }, + { "Pacific/Samoa" , 0x03B9FE }, + { "Pacific/Tahiti" , 0x03BA87 }, + { "Pacific/Tarawa" , 0x03BAEC }, + { "Pacific/Tongatapu" , 0x03BB40 }, + { "Pacific/Truk" , 0x03BBCC }, + { "Pacific/Wake" , 0x03BC11 }, + { "Pacific/Wallis" , 0x03BC61 }, + { "Pacific/Yap" , 0x03BCA5 }, + { "Poland" , 0x03BCEA }, + { "Portugal" , 0x03C0CB }, + { "PRC" , 0x03C5C7 }, + { "PST8PDT" , 0x03C678 }, + { "ROC" , 0x03C9C9 }, + { "ROK" , 0x03CAE1 }, + { "Singapore" , 0x03CB85 }, + { "Turkey" , 0x03CC3C }, + { "UCT" , 0x03D029 }, + { "Universal" , 0x03D06D }, + { "US/Alaska" , 0x03D0B1 }, + { "US/Aleutian" , 0x03D41A }, + { "US/Arizona" , 0x03D780 }, + { "US/Central" , 0x03D80E }, + { "US/East-Indiana" , 0x03E218 }, + { "US/Eastern" , 0x03DD19 }, + { "US/Hawaii" , 0x03E482 }, + { "US/Indiana-Starke" , 0x03E4F3 }, + { "US/Michigan" , 0x03E864 }, + { "US/Mountain" , 0x03EB9B }, + { "US/Pacific" , 0x03EF14 }, + { "US/Pacific-New" , 0x03F319 }, + { "US/Samoa" , 0x03F71E }, + { "UTC" , 0x03F7A7 }, + { "W-SU" , 0x03FA9E }, + { "WET" , 0x03F7EB }, + { "Zulu" , 0x03FCD8 }, }; /* This is a generated file, do not modify */ -const unsigned char timelib_timezone_db_data_builtin[261525] = { +const unsigned char timelib_timezone_db_data_builtin[261404] = { /* Africa/Abidjan */ @@ -758,7 +758,7 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* Africa/Casablanca */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x4D, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x11, 0x96, 0x51, 0xF9, 0x9C, +0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x11, 0x96, 0x51, 0xF9, 0x9C, 0xC6, 0xFF, 0x14, 0x80, 0xC7, 0x58, 0xAC, 0x70, 0xC7, 0xD9, 0xED, 0x80, 0xD2, 0xA1, 0x32, 0xF0, 0xDB, 0x35, 0xA4, 0x00, 0xDB, 0xEE, 0x27, 0xF0, 0xFB, 0x25, 0x72, 0x40, 0xFB, 0xC2, 0xEF, 0x70, 0x08, 0x6B, 0x84, 0x80, 0x08, 0xC6, 0x6D, 0xF0, 0x0B, 0xE8, 0x0C, 0x00, 0x0C, 0x61, 0x47, 0xF0, @@ -767,32 +767,34 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x4A, 0x23, 0x1A, 0x00, 0x4A, 0x8D, 0xD5, 0x70, 0x4B, 0xDC, 0xC0, 0x80, 0x4C, 0x5D, 0xE5, 0x70, 0x4D, 0x97, 0xB8, 0x80, 0x4E, 0x34, 0x8C, 0xF0, 0x4F, 0x9C, 0xA0, 0xA0, 0x50, 0x08, 0xBB, 0xA0, 0x50, 0x31, 0x9A, 0x20, 0x50, 0x67, 0xA7, 0xA0, 0x51, 0x7C, 0x82, 0xA0, 0x51, 0xD8, 0xCB, 0xA0, -0x52, 0x05, 0x9E, 0xA0, 0x52, 0x47, 0x89, 0xA0, 0x53, 0x5C, 0x64, 0xA0, 0x53, 0xAF, 0x73, 0x20, -0x53, 0xD7, 0x00, 0x20, 0x54, 0x27, 0x6B, 0xA0, 0x55, 0x3C, 0x46, 0xA0, 0x55, 0x82, 0x26, 0x20, -0x55, 0xA9, 0xB3, 0x20, 0x56, 0x07, 0x4D, 0xA0, 0x57, 0x1C, 0x28, 0xA0, 0x57, 0x56, 0x2A, 0xA0, -0x57, 0x7D, 0xB7, 0xA0, 0x57, 0xE7, 0x2F, 0xA0, 0x59, 0x05, 0x45, 0x20, 0x59, 0x28, 0xDD, 0xA0, -0x59, 0x50, 0x6A, 0xA0, 0x59, 0xC7, 0x11, 0xA0, 0x5A, 0xE5, 0x27, 0x20, 0x5A, 0xFB, 0x90, 0xA0, -0x5B, 0x23, 0x1D, 0xA0, 0x5B, 0xB0, 0x2E, 0x20, 0x5C, 0xC5, 0x09, 0x20, 0x5C, 0xCF, 0x95, 0x20, -0x5C, 0xF7, 0x22, 0x20, 0x5D, 0x90, 0x10, 0x20, 0x5E, 0xC9, 0xD5, 0x20, 0x5F, 0x6F, 0xF2, 0x20, -0x60, 0x9C, 0x88, 0x20, 0x61, 0x4F, 0xD4, 0x20, 0x62, 0x70, 0x8C, 0xA0, 0x63, 0x2F, 0xB6, 0x20, -0x64, 0x4D, 0xCB, 0xA0, 0x65, 0x0F, 0x98, 0x20, 0x66, 0x2D, 0xAD, 0xA0, 0x66, 0xF8, 0xB4, 0xA0, -0x68, 0x0D, 0x8F, 0xA0, 0x68, 0xD8, 0x96, 0xA0, 0x69, 0xED, 0x71, 0xA0, 0x6A, 0xB8, 0x78, 0xA0, -0x6B, 0xCD, 0x53, 0xA0, 0x6C, 0x98, 0x5A, 0xA0, 0x6D, 0xB6, 0x70, 0x20, 0x6E, 0x78, 0x3C, 0xA0, -0x6F, 0x96, 0x52, 0x20, 0x70, 0x61, 0x59, 0x20, 0x71, 0x76, 0x34, 0x20, 0x72, 0x41, 0x3B, 0x20, -0x73, 0x56, 0x16, 0x20, 0x74, 0x21, 0x1D, 0x20, 0x75, 0x35, 0xF8, 0x20, 0x76, 0x00, 0xFF, 0x20, -0x77, 0x15, 0xDA, 0x20, 0x77, 0xE0, 0xE1, 0x20, 0x78, 0xFE, 0xF6, 0xA0, 0x79, 0xC0, 0xC3, 0x20, -0x7A, 0xDE, 0xD8, 0xA0, 0x7B, 0xA9, 0xDF, 0xA0, 0x7C, 0xBE, 0xBA, 0xA0, 0x7D, 0x89, 0xC1, 0xA0, -0x7E, 0x9E, 0x9C, 0xA0, 0x7F, 0x69, 0xA3, 0xA0, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x52, 0x05, 0x9E, 0xA0, 0x52, 0x6C, 0x73, 0xA0, 0x53, 0x37, 0x7A, 0xA0, 0x53, 0xAF, 0x73, 0x20, +0x53, 0xD7, 0x00, 0x20, 0x54, 0x4C, 0x55, 0xA0, 0x55, 0x17, 0x5C, 0xA0, 0x55, 0x82, 0x26, 0x20, +0x55, 0xA9, 0xB3, 0x20, 0x56, 0x2C, 0x37, 0xA0, 0x56, 0xF7, 0x3E, 0xA0, 0x57, 0x56, 0x2A, 0xA0, +0x57, 0x7D, 0xB7, 0xA0, 0x58, 0x15, 0x54, 0x20, 0x58, 0xD7, 0x20, 0xA0, 0x59, 0x28, 0xDD, 0xA0, +0x59, 0x50, 0x6A, 0xA0, 0x59, 0xF5, 0x36, 0x20, 0x5A, 0xB7, 0x02, 0xA0, 0x5A, 0xFB, 0x90, 0xA0, +0x5B, 0x23, 0x1D, 0xA0, 0x5B, 0xD5, 0x18, 0x20, 0x5C, 0xA0, 0x1F, 0x20, 0x5C, 0xCF, 0x95, 0x20, +0x5C, 0xF7, 0x22, 0x20, 0x5D, 0xB4, 0xFA, 0x20, 0x5E, 0x80, 0x01, 0x20, 0x5E, 0xA2, 0x48, 0x20, +0x5E, 0xC9, 0xD5, 0x20, 0x5F, 0x94, 0xDC, 0x20, 0x60, 0x5F, 0xE3, 0x20, 0x60, 0x74, 0xFB, 0x20, +0x60, 0x9C, 0x88, 0x20, 0x61, 0x7D, 0xF8, 0xA0, 0x62, 0x3F, 0xC5, 0x20, 0x62, 0x48, 0xFF, 0xA0, +0x62, 0x70, 0x8C, 0xA0, 0x63, 0x5D, 0xDA, 0xA0, 0x64, 0x43, 0x3F, 0xA0, 0x65, 0x3D, 0xBC, 0xA0, +0x66, 0x15, 0xF2, 0xA0, 0x67, 0x1D, 0x9E, 0xA0, 0x67, 0xE9, 0xF7, 0x20, 0x68, 0xFD, 0x80, 0xA0, +0x69, 0xC8, 0x87, 0xA0, 0x6A, 0xDD, 0x62, 0xA0, 0x6B, 0xA8, 0x69, 0xA0, 0x6C, 0xC6, 0x7F, 0x20, +0x6D, 0x88, 0x4B, 0xA0, 0x6E, 0xA6, 0x61, 0x20, 0x6F, 0x68, 0x2D, 0xA0, 0x70, 0x86, 0x43, 0x20, +0x71, 0x51, 0x4A, 0x20, 0x72, 0x66, 0x25, 0x20, 0x73, 0x31, 0x2C, 0x20, 0x74, 0x46, 0x07, 0x20, +0x75, 0x11, 0x0E, 0x20, 0x76, 0x2F, 0x23, 0xA0, 0x76, 0xF0, 0xF0, 0x20, 0x78, 0x0F, 0x05, 0xA0, +0x78, 0xD0, 0xD2, 0x20, 0x79, 0xEE, 0xE7, 0xA0, 0x7A, 0xB0, 0xB4, 0x20, 0x7B, 0xCE, 0xC9, 0xA0, +0x7C, 0x99, 0xD0, 0xA0, 0x7D, 0xA8, 0x14, 0x20, 0x7E, 0x79, 0xB2, 0xA0, 0x7F, 0x7C, 0x18, 0xA0, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x02, 0x03, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 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, 0xFF, 0xFF, 0xF8, 0xE4, 0x00, 0x00, 0x00, 0x00, 0x0E, -0x10, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x0D, 0x4C, -0x4D, 0x54, 0x00, 0x57, 0x45, 0x53, 0x54, 0x00, 0x57, 0x45, 0x54, 0x00, 0x43, 0x45, 0x54, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBC, 0xAC, 0xC8, 0x01, 0x07, 0x16, 0x42, -0x00, 0x00, 0x00, 0x00, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x02, 0x01, 0x02, 0x01, 0x02, 0xFF, 0xFF, 0xF8, 0xE4, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x10, 0x01, +0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x0D, 0x4C, 0x4D, 0x54, +0x00, 0x57, 0x45, 0x53, 0x54, 0x00, 0x57, 0x45, 0x54, 0x00, 0x43, 0x45, 0x54, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBC, 0xAC, 0xC8, 0x01, 0x07, 0x16, 0x42, 0x00, 0x00, +0x00, 0x00, /* Africa/Ceuta */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x45, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -890,12 +892,40 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* Africa/El_Aaiun */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x45, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0xBC, 0x48, 0xF0, 0xE0, -0x0B, 0xD1, 0xB0, 0x90, 0x01, 0x02, 0xFF, 0xFF, 0xF3, 0xA0, 0x00, 0x00, 0xFF, 0xFF, 0xF1, 0xF0, -0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x4C, 0x4D, 0x54, 0x00, 0x57, 0x41, 0x54, 0x00, -0x57, 0x45, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB2, 0xC1, 0xB8, 0x00, 0xFE, -0x84, 0x40, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x5A, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x11, 0xBC, 0x48, 0xF0, 0xE0, +0x0B, 0xD1, 0xB0, 0x90, 0x0B, 0xE8, 0x0C, 0x00, 0x0C, 0x61, 0x47, 0xF0, 0x0D, 0xC9, 0x3F, 0x80, +0x0E, 0x8E, 0xF2, 0x70, 0x0F, 0xD3, 0x51, 0x80, 0x10, 0x27, 0xA3, 0x70, 0x48, 0x41, 0xE6, 0x80, +0x48, 0xBB, 0x22, 0x70, 0x4A, 0x23, 0x1A, 0x00, 0x4A, 0x8D, 0xD5, 0x70, 0x4B, 0xDC, 0xC0, 0x80, +0x4C, 0x5D, 0xE5, 0x70, 0x4D, 0x97, 0xB8, 0x80, 0x4E, 0x34, 0x8C, 0xF0, 0x4F, 0x9C, 0xA0, 0xA0, +0x50, 0x08, 0xBB, 0xA0, 0x50, 0x31, 0x9A, 0x20, 0x50, 0x67, 0xA7, 0xA0, 0x51, 0x7C, 0x82, 0xA0, +0x51, 0xD8, 0xCB, 0xA0, 0x52, 0x05, 0x9E, 0xA0, 0x52, 0x6C, 0x73, 0xA0, 0x53, 0x37, 0x7A, 0xA0, +0x53, 0xAF, 0x73, 0x20, 0x53, 0xD7, 0x00, 0x20, 0x54, 0x4C, 0x55, 0xA0, 0x55, 0x17, 0x5C, 0xA0, +0x55, 0x82, 0x26, 0x20, 0x55, 0xA9, 0xB3, 0x20, 0x56, 0x2C, 0x37, 0xA0, 0x56, 0xF7, 0x3E, 0xA0, +0x57, 0x56, 0x2A, 0xA0, 0x57, 0x7D, 0xB7, 0xA0, 0x58, 0x15, 0x54, 0x20, 0x58, 0xD7, 0x20, 0xA0, +0x59, 0x28, 0xDD, 0xA0, 0x59, 0x50, 0x6A, 0xA0, 0x59, 0xF5, 0x36, 0x20, 0x5A, 0xB7, 0x02, 0xA0, +0x5A, 0xFB, 0x90, 0xA0, 0x5B, 0x23, 0x1D, 0xA0, 0x5B, 0xD5, 0x18, 0x20, 0x5C, 0xA0, 0x1F, 0x20, +0x5C, 0xCF, 0x95, 0x20, 0x5C, 0xF7, 0x22, 0x20, 0x5D, 0xB4, 0xFA, 0x20, 0x5E, 0x80, 0x01, 0x20, +0x5E, 0xA2, 0x48, 0x20, 0x5E, 0xC9, 0xD5, 0x20, 0x5F, 0x94, 0xDC, 0x20, 0x60, 0x5F, 0xE3, 0x20, +0x60, 0x74, 0xFB, 0x20, 0x60, 0x9C, 0x88, 0x20, 0x61, 0x7D, 0xF8, 0xA0, 0x62, 0x3F, 0xC5, 0x20, +0x62, 0x48, 0xFF, 0xA0, 0x62, 0x70, 0x8C, 0xA0, 0x63, 0x5D, 0xDA, 0xA0, 0x64, 0x43, 0x3F, 0xA0, +0x65, 0x3D, 0xBC, 0xA0, 0x66, 0x15, 0xF2, 0xA0, 0x67, 0x1D, 0x9E, 0xA0, 0x67, 0xE9, 0xF7, 0x20, +0x68, 0xFD, 0x80, 0xA0, 0x69, 0xC8, 0x87, 0xA0, 0x6A, 0xDD, 0x62, 0xA0, 0x6B, 0xA8, 0x69, 0xA0, +0x6C, 0xC6, 0x7F, 0x20, 0x6D, 0x88, 0x4B, 0xA0, 0x6E, 0xA6, 0x61, 0x20, 0x6F, 0x68, 0x2D, 0xA0, +0x70, 0x86, 0x43, 0x20, 0x71, 0x51, 0x4A, 0x20, 0x72, 0x66, 0x25, 0x20, 0x73, 0x31, 0x2C, 0x20, +0x74, 0x46, 0x07, 0x20, 0x75, 0x11, 0x0E, 0x20, 0x76, 0x2F, 0x23, 0xA0, 0x76, 0xF0, 0xF0, 0x20, +0x78, 0x0F, 0x05, 0xA0, 0x78, 0xD0, 0xD2, 0x20, 0x79, 0xEE, 0xE7, 0xA0, 0x7A, 0xB0, 0xB4, 0x20, +0x7B, 0xCE, 0xC9, 0xA0, 0x7C, 0x99, 0xD0, 0xA0, 0x7D, 0xA8, 0x14, 0x20, 0x7E, 0x79, 0xB2, 0xA0, +0x7F, 0x7C, 0x18, 0xA0, 0x01, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, +0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, +0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, +0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, +0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, +0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0xFF, 0xFF, +0xF3, 0xA0, 0x00, 0x00, 0xFF, 0xFF, 0xF1, 0xF0, 0x00, 0x04, 0x00, 0x00, 0x0E, 0x10, 0x01, 0x08, +0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x4C, 0x4D, 0x54, 0x00, 0x57, 0x41, 0x54, 0x00, 0x57, 0x45, +0x53, 0x54, 0x00, 0x57, 0x45, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xB2, 0xC1, 0xB8, 0x00, 0xFE, 0x84, 0x40, 0x00, 0x00, 0x00, 0x00, /* Africa/Freetown */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x53, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -945,7 +975,7 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* Africa/Juba */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x53, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x11, 0xB6, 0xA3, 0xDA, 0xE0, +0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x11, 0xB6, 0xA3, 0xDA, 0x00, 0x00, 0x9E, 0x17, 0xE0, 0x01, 0x7A, 0x34, 0x50, 0x02, 0x7D, 0xF9, 0xE0, 0x03, 0x5B, 0x67, 0xD0, 0x04, 0x60, 0x7E, 0xE0, 0x05, 0x3D, 0xEC, 0xD0, 0x06, 0x40, 0x60, 0xE0, 0x07, 0x1F, 0x20, 0x50, 0x08, 0x20, 0x42, 0xE0, 0x09, 0x00, 0x53, 0xD0, 0x0A, 0x00, 0x24, 0xE0, 0x0A, 0xE1, 0x87, 0x50, @@ -956,7 +986,7 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x1A, 0xF1, 0x8B, 0xE0, 0x1B, 0xD0, 0x4B, 0x50, 0x1C, 0xD1, 0x6D, 0xE0, 0x1D, 0xB1, 0x7E, 0xD0, 0x38, 0x80, 0x45, 0x20, 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, 0x03, 0x00, 0x00, 0x1D, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, +0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x00, 0x00, 0x1E, 0x80, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x04, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x09, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x0D, 0x4C, 0x4D, 0x54, 0x00, 0x43, 0x41, 0x53, 0x54, 0x00, 0x43, 0x41, 0x54, 0x00, 0x45, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0xBA, 0xC8, 0x01, 0x42, 0xE0, 0x40, 0x00, @@ -1181,7 +1211,7 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* Africa/Tripoli */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x4C, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x11, 0xA1, 0xF2, 0xC1, 0x24, +0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x11, 0xA1, 0xF2, 0xC1, 0x24, 0xDD, 0xBB, 0xB1, 0x10, 0xDE, 0x23, 0xAD, 0x60, 0xE1, 0x78, 0xD2, 0x10, 0xE1, 0xE7, 0x65, 0xE0, 0xE5, 0x2F, 0x3F, 0x70, 0xE5, 0xA9, 0xCC, 0xE0, 0xEB, 0x4E, 0xC6, 0xF0, 0x16, 0x92, 0x42, 0x60, 0x17, 0x08, 0xF7, 0x70, 0x17, 0xFA, 0x2B, 0xE0, 0x18, 0xEA, 0x2A, 0xF0, 0x19, 0xDB, 0x5F, 0x60, @@ -1189,24 +1219,9 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x1E, 0x93, 0x0B, 0x70, 0x1F, 0x82, 0xEE, 0x60, 0x20, 0x70, 0x4A, 0x70, 0x21, 0x61, 0x7E, 0xE0, 0x22, 0x52, 0xCF, 0x70, 0x23, 0x44, 0x03, 0xE0, 0x24, 0x34, 0x02, 0xF0, 0x25, 0x25, 0x37, 0x60, 0x26, 0x40, 0xB7, 0xF0, 0x32, 0x4E, 0xF1, 0x60, 0x33, 0x44, 0x36, 0x70, 0x34, 0x35, 0x6A, 0xE0, -0x50, 0x9D, 0x99, 0x00, 0x51, 0x54, 0xD9, 0x80, 0x52, 0x69, 0xB4, 0x80, 0x53, 0x34, 0xBB, 0x80, -0x54, 0x52, 0xD1, 0x00, 0x55, 0x14, 0x9D, 0x80, 0x56, 0x32, 0xB3, 0x00, 0x56, 0xF4, 0x7F, 0x80, -0x58, 0x12, 0x95, 0x00, 0x58, 0xDD, 0x9C, 0x00, 0x59, 0xF2, 0x77, 0x00, 0x5A, 0xBD, 0x7E, 0x00, -0x5B, 0xD2, 0x59, 0x00, 0x5C, 0x9D, 0x60, 0x00, 0x5D, 0xB2, 0x3B, 0x00, 0x5E, 0x7D, 0x42, 0x00, -0x5F, 0x9B, 0x57, 0x80, 0x60, 0x5D, 0x24, 0x00, 0x61, 0x7B, 0x39, 0x80, 0x62, 0x3D, 0x06, 0x00, -0x63, 0x5B, 0x1B, 0x80, 0x64, 0x26, 0x22, 0x80, 0x65, 0x3A, 0xFD, 0x80, 0x66, 0x06, 0x04, 0x80, -0x67, 0x1A, 0xDF, 0x80, 0x67, 0xE5, 0xE6, 0x80, 0x69, 0x03, 0xFC, 0x00, 0x69, 0xC5, 0xC8, 0x80, -0x6A, 0xE3, 0xDE, 0x00, 0x6B, 0xA5, 0xAA, 0x80, 0x6C, 0xC3, 0xC0, 0x00, 0x6D, 0x8E, 0xC7, 0x00, -0x6E, 0xA3, 0xA2, 0x00, 0x6F, 0x6E, 0xA9, 0x00, 0x70, 0x83, 0x84, 0x00, 0x71, 0x4E, 0x8B, 0x00, -0x72, 0x63, 0x66, 0x00, 0x73, 0x2E, 0x6D, 0x00, 0x74, 0x4C, 0x82, 0x80, 0x75, 0x0E, 0x4F, 0x00, -0x76, 0x2C, 0x64, 0x80, 0x76, 0xEE, 0x31, 0x00, 0x78, 0x0C, 0x46, 0x80, 0x78, 0xD7, 0x4D, 0x80, -0x79, 0xEC, 0x28, 0x80, 0x7A, 0xB7, 0x2F, 0x80, 0x7B, 0xCC, 0x0A, 0x80, 0x7C, 0x97, 0x11, 0x80, -0x7D, 0xB5, 0x27, 0x00, 0x7E, 0x76, 0xF3, 0x80, 0x7F, 0x95, 0x09, 0x00, 0x02, 0x01, 0x02, 0x01, +0x50, 0x9D, 0x99, 0x00, 0x51, 0x54, 0xD9, 0x80, 0x52, 0x69, 0xB4, 0x80, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x02, 0x01, 0x03, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, -0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, -0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, -0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x00, 0x00, 0x0C, 0x5C, +0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x02, 0x01, 0x03, 0x02, 0x01, 0x03, 0x00, 0x00, 0x0C, 0x5C, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x01, 0x04, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x09, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x0D, 0x4C, 0x4D, 0x54, 0x00, 0x43, 0x45, 0x53, 0x54, 0x00, 0x43, 0x45, 0x54, 0x00, 0x45, 0x45, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBB, 0x87, @@ -1390,8 +1405,8 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* America/Anguilla */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x41, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x93, 0x37, 0x35, 0x20, -0x01, 0xFF, 0xFF, 0xC4, 0xE0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, +0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x93, 0x37, 0x33, 0xAC, +0x01, 0xFF, 0xFF, 0xC6, 0x54, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA5, 0x19, 0xA0, 0x00, 0xB2, 0x6D, 0x15, 0x00, 0x00, 0x00, 0x00, @@ -1407,7 +1422,7 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* America/Araguaina */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x42, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0D, 0x96, 0xAA, 0x74, 0x30, +0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0D, 0x96, 0xAA, 0x74, 0x30, 0xB8, 0x0F, 0x49, 0xE0, 0xB8, 0xFD, 0x40, 0xA0, 0xB9, 0xF1, 0x34, 0x30, 0xBA, 0xDE, 0x74, 0x20, 0xDA, 0x38, 0xAE, 0x30, 0xDA, 0xEB, 0xFA, 0x30, 0xDC, 0x19, 0xE1, 0xB0, 0xDC, 0xB9, 0x59, 0x20, 0xDD, 0xFB, 0x15, 0x30, 0xDE, 0x9B, 0xDE, 0x20, 0xDF, 0xDD, 0x9A, 0x30, 0xE0, 0x54, 0x33, 0x20, @@ -1420,29 +1435,14 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x34, 0x38, 0x54, 0x30, 0x34, 0xF8, 0xC1, 0x20, 0x36, 0x20, 0x1F, 0x30, 0x36, 0xCF, 0x68, 0xA0, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xB8, 0x85, 0x20, 0x39, 0xDF, 0xE3, 0x30, 0x3A, 0x8F, 0x2C, 0xA0, 0x3B, 0xC8, 0xFF, 0xB0, 0x3C, 0x6F, 0x0E, 0xA0, 0x3D, 0xC4, 0x91, 0x30, 0x3E, 0x4E, 0xF0, 0xA0, -0x50, 0x83, 0x65, 0x30, 0x51, 0x20, 0x39, 0xA0, 0x52, 0x63, 0x47, 0x30, 0x53, 0x00, 0x1B, 0xA0, -0x54, 0x43, 0x29, 0x30, 0x54, 0xE9, 0x38, 0x20, 0x56, 0x23, 0x0B, 0x30, 0x56, 0xC9, 0x1A, 0x20, -0x58, 0x02, 0xED, 0x30, 0x58, 0xA8, 0xFC, 0x20, 0x59, 0xE2, 0xCF, 0x30, 0x5A, 0x88, 0xDE, 0x20, -0x5B, 0xCB, 0xEB, 0xB0, 0x5C, 0x68, 0xC0, 0x20, 0x5D, 0xAB, 0xCD, 0xB0, 0x5E, 0x48, 0xA2, 0x20, -0x5F, 0x8B, 0xAF, 0xB0, 0x60, 0x31, 0xBE, 0xA0, 0x61, 0x6B, 0x91, 0xB0, 0x62, 0x11, 0xA0, 0xA0, -0x63, 0x4B, 0x73, 0xB0, 0x63, 0xFA, 0xBD, 0x20, 0x65, 0x2B, 0x55, 0xB0, 0x65, 0xD1, 0x64, 0xA0, -0x67, 0x14, 0x72, 0x30, 0x67, 0xB1, 0x46, 0xA0, 0x68, 0xF4, 0x54, 0x30, 0x69, 0x9A, 0x63, 0x20, -0x6A, 0xD4, 0x36, 0x30, 0x6B, 0x7A, 0x45, 0x20, 0x6C, 0xB4, 0x18, 0x30, 0x6D, 0x5A, 0x27, 0x20, -0x6E, 0x93, 0xFA, 0x30, 0x6F, 0x3A, 0x09, 0x20, 0x70, 0x7D, 0x16, 0xB0, 0x71, 0x19, 0xEB, 0x20, -0x72, 0x5C, 0xF8, 0xB0, 0x72, 0xF9, 0xCD, 0x20, 0x74, 0x3C, 0xDA, 0xB0, 0x74, 0xD9, 0xAF, 0x20, -0x76, 0x1C, 0xBC, 0xB0, 0x76, 0xC2, 0xCB, 0xA0, 0x77, 0xFC, 0x9E, 0xB0, 0x78, 0xAB, 0xE8, 0x20, -0x79, 0xDC, 0x80, 0xB0, 0x7A, 0x82, 0x8F, 0xA0, 0x7B, 0xC5, 0x9D, 0x30, 0x7C, 0x62, 0x71, 0xA0, -0x7D, 0xA5, 0x7F, 0x30, 0x7E, 0x4B, 0x8E, 0x20, 0x7F, 0x85, 0x61, 0x30, 0x02, 0x01, 0x02, 0x01, +0x50, 0x83, 0x65, 0x30, 0x51, 0x20, 0x39, 0xA0, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, -0xFF, 0xFF, 0xD2, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, -0x00, 0x09, 0x4C, 0x4D, 0x54, 0x00, 0x42, 0x52, 0x53, 0x54, 0x00, 0x42, 0x52, 0x54, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x57, 0xC0, 0x00, 0xC9, 0x1C, 0x60, 0x00, 0x00, 0x00, -0x09, 0x54, 0x6F, 0x63, 0x61, 0x6E, 0x74, 0x69, 0x6E, 0x73, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0xFF, 0xFF, 0xD2, 0xD0, 0x00, +0x00, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x09, 0x4C, 0x4D, 0x54, +0x00, 0x42, 0x52, 0x53, 0x54, 0x00, 0x42, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x7E, 0x57, 0xC0, 0x00, 0xC9, 0x1C, 0x60, 0x00, 0x00, 0x00, 0x09, 0x54, 0x6F, 0x63, 0x61, +0x6E, 0x74, 0x69, 0x6E, 0x73, /* America/Argentina/Buenos_Aires */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x41, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -1767,7 +1767,7 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 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, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x05, -0x06, 0x05, 0x04, 0x06, 0x04, 0x05, 0x04, 0x03, 0x06, 0x05, 0x06, 0x05, 0x06, 0xFF, 0xFF, 0xC3, +0x06, 0x05, 0x04, 0x06, 0x04, 0x05, 0x04, 0x03, 0x06, 0x05, 0x06, 0x05, 0x04, 0xFF, 0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x12, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, @@ -1839,8 +1839,8 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* America/Aruba */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x41, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x93, 0x1E, 0x2F, 0x38, -0xF6, 0x98, 0xEC, 0x48, 0x01, 0x02, 0xFF, 0xFF, 0xBE, 0x48, 0x00, 0x00, 0xFF, 0xFF, 0xC0, 0xB8, +0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x93, 0x1E, 0x2E, 0x23, +0xF6, 0x98, 0xEC, 0x48, 0x01, 0x02, 0xFF, 0xFF, 0xBF, 0x5D, 0x00, 0x00, 0xFF, 0xFF, 0xC0, 0xB8, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x08, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x4E, 0x54, 0x00, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9C, 0x67, 0x10, 0x00, 0xA7, 0xE5, 0xC5, 0x00, 0x00, 0x00, 0x00, @@ -2414,8 +2414,8 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* America/Cayman */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x4B, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x93, 0x0F, 0xB5, 0x00, -0x01, 0xFF, 0xFF, 0xB8, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x04, 0x4B, 0x4D, 0x54, +0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x93, 0x0F, 0xB4, 0xFF, +0x01, 0xFF, 0xFF, 0xB8, 0x01, 0x00, 0x00, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x04, 0x4B, 0x4D, 0x54, 0x00, 0x45, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA6, 0xC7, 0x50, 0x00, 0x96, 0x7A, 0x22, 0x00, 0x00, 0x00, 0x00, @@ -2889,8 +2889,8 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* America/Dominica */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x44, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x91, 0xF4, 0x34, 0x4C, -0x01, 0xFF, 0xFF, 0xC6, 0x70, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, +0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x93, 0x37, 0x33, 0xAC, +0x01, 0xFF, 0xFF, 0xC6, 0x54, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0xAC, 0xD0, 0x00, 0xB4, 0xF8, 0x20, 0x00, 0x00, 0x00, 0x00, @@ -2959,7 +2959,7 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* America/Eirunepe */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x42, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x11, 0x96, 0xAA, 0x88, 0x80, +0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x11, 0x96, 0xAA, 0x88, 0x80, 0xB8, 0x0F, 0x66, 0x00, 0xB8, 0xFD, 0x5C, 0xC0, 0xB9, 0xF1, 0x50, 0x50, 0xBA, 0xDE, 0x90, 0x40, 0xDA, 0x38, 0xCA, 0x50, 0xDA, 0xEC, 0x16, 0x50, 0xDC, 0x19, 0xFD, 0xD0, 0xDC, 0xB9, 0x75, 0x40, 0xDD, 0xFB, 0x31, 0x50, 0xDE, 0x9B, 0xFA, 0x40, 0xDF, 0xDD, 0xB6, 0x50, 0xE0, 0x54, 0x4F, 0x40, @@ -2967,14 +2967,14 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0xF8, 0x51, 0x48, 0x50, 0xF8, 0xC7, 0xE1, 0x40, 0xFA, 0x0A, 0xEE, 0xD0, 0xFA, 0xA9, 0x14, 0xC0, 0xFB, 0xEC, 0x22, 0x50, 0xFC, 0x8B, 0x99, 0xC0, 0x1D, 0xC9, 0xAA, 0x50, 0x1E, 0x78, 0xF3, 0xC0, 0x1F, 0xA0, 0x51, 0xD0, 0x20, 0x33, 0xEB, 0xC0, 0x21, 0x81, 0x85, 0x50, 0x22, 0x0B, 0xE4, 0xC0, -0x2C, 0xC0, 0xD1, 0x50, 0x2D, 0x66, 0xE0, 0x40, 0x48, 0x60, 0x7F, 0x50, 0x02, 0x01, 0x02, 0x01, +0x2C, 0xC0, 0xD1, 0x50, 0x2D, 0x66, 0xE0, 0x40, 0x48, 0x60, 0x7F, 0x50, 0x52, 0x7F, 0x04, 0xC0, 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, 0x03, 0xFF, 0xFF, 0xBE, 0x80, -0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x04, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x09, 0xFF, 0xFF, -0xC7, 0xC0, 0x00, 0x0D, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x43, 0x53, 0x54, 0x00, 0x41, 0x43, 0x54, -0x00, 0x41, 0x4D, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x28, -0x15, 0x00, 0xA8, 0x0C, 0xD5, 0x00, 0x00, 0x00, 0x0A, 0x57, 0x20, 0x41, 0x6D, 0x61, 0x7A, 0x6F, -0x6E, 0x61, 0x73, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, +0x02, 0xFF, 0xFF, 0xBE, 0x80, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x04, 0xFF, 0xFF, 0xB9, +0xB0, 0x00, 0x09, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x43, 0x53, +0x54, 0x00, 0x41, 0x43, 0x54, 0x00, 0x41, 0x4D, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x7F, 0x28, 0x15, 0x00, 0xA8, 0x0C, 0xD5, 0x00, 0x00, 0x00, 0x0A, 0x57, 0x20, +0x41, 0x6D, 0x61, 0x7A, 0x6F, 0x6E, 0x61, 0x73, /* America/El_Salvador */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x53, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -3292,7 +3292,7 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* America/Grand_Turk */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x54, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x93, 0x0F, 0xB5, 0x00, +0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x93, 0x0F, 0xB4, 0xFF, 0x11, 0x89, 0x65, 0xF0, 0x12, 0x79, 0x48, 0xE0, 0x13, 0x69, 0x47, 0xF0, 0x14, 0x59, 0x2A, 0xE0, 0x15, 0x49, 0x29, 0xF0, 0x16, 0x39, 0x0C, 0xE0, 0x17, 0x29, 0x0B, 0xF0, 0x18, 0x22, 0x29, 0x60, 0x19, 0x08, 0xED, 0xF0, 0x1A, 0x02, 0x0B, 0x60, 0x1A, 0xF2, 0x0A, 0x70, 0x1B, 0xE1, 0xED, 0x60, @@ -3330,23 +3330,23 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0xFF, -0xFF, 0xB8, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x04, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, +0xFF, 0xB8, 0x01, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x04, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x08, 0x4B, 0x4D, 0x54, 0x00, 0x45, 0x44, 0x54, 0x00, 0x45, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAA, 0x15, 0xAA, 0x00, 0xA6, 0x1E, 0x0A, 0x00, 0x00, 0x00, 0x00, /* America/Grenada */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x47, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x91, 0xF4, 0x34, 0x64, -0x01, 0xFF, 0xFF, 0xC6, 0x1C, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, +0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x93, 0x37, 0x33, 0xAC, +0x01, 0xFF, 0xFF, 0xC6, 0x54, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9B, 0xB7, 0x48, 0x00, 0xB4, 0x6F, 0x68, 0x00, 0x00, 0x00, 0x00, /* America/Guadeloupe */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x47, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x91, 0xD5, 0xE1, 0xB0, -0x01, 0xFF, 0xFF, 0xC6, 0x50, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, +0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x93, 0x37, 0x33, 0xAC, +0x01, 0xFF, 0xFF, 0xC6, 0x54, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA2, 0x19, 0x65, 0x00, 0xB4, 0xC4, 0x0A, 0x00, 0x00, 0x00, 0x00, @@ -4057,17 +4057,17 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* America/Jamaica */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x4A, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x93, 0x0F, 0xB5, 0x00, +0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x93, 0x0F, 0xB4, 0xFF, 0x08, 0x20, 0xC1, 0x70, 0x09, 0x10, 0xA4, 0x60, 0x09, 0xAD, 0x94, 0xF0, 0x0A, 0xF0, 0x86, 0x60, 0x0B, 0xE0, 0x85, 0x70, 0x0C, 0xD9, 0xA2, 0xE0, 0x0D, 0xC0, 0x67, 0x70, 0x0E, 0xB9, 0x84, 0xE0, 0x0F, 0xA9, 0x83, 0xF0, 0x10, 0x99, 0x66, 0xE0, 0x11, 0x89, 0x65, 0xF0, 0x12, 0x79, 0x48, 0xE0, 0x13, 0x69, 0x47, 0xF0, 0x14, 0x59, 0x2A, 0xE0, 0x15, 0x49, 0x29, 0xF0, 0x16, 0x39, 0x0C, 0xE0, 0x17, 0x29, 0x0B, 0xF0, 0x18, 0x22, 0x29, 0x60, 0x19, 0x08, 0xED, 0xF0, 0x1A, 0x02, 0x0B, 0x60, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, -0x01, 0x02, 0x01, 0x02, 0x01, 0xFF, 0xFF, 0xB8, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, +0x01, 0x02, 0x01, 0x02, 0x01, 0xFF, 0xFF, 0xB8, 0x01, 0x00, 0x00, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x08, 0x4B, 0x4D, 0x54, 0x00, 0x45, 0x53, 0x54, 0x00, 0x45, -0x44, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA4, 0xCB, 0x80, 0x00, 0x9D, 0x78, -0x80, 0x00, 0x00, 0x00, 0x00, +0x44, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA4, 0xBF, 0x05, 0x00, 0x9D, 0x7B, +0x1A, 0x00, 0x00, 0x00, 0x00, /* America/Jujuy */ 0x50, 0x48, 0x50, 0x31, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -4573,8 +4573,8 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* America/Marigot */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x4D, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x91, 0xD5, 0xE1, 0xB0, -0x01, 0xFF, 0xFF, 0xC6, 0x50, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, +0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x93, 0x37, 0x33, 0xAC, +0x01, 0xFF, 0xFF, 0xC6, 0x54, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA4, 0xE5, 0x8A, 0x00, 0xB2, 0x66, 0x92, 0x00, 0x00, 0x00, 0x00, @@ -5071,7 +5071,7 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x00, 0x00, /* America/Montreal */ -0x50, 0x48, 0x50, 0x31, 0x01, 0x43, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x50, 0x48, 0x50, 0x31, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE8, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x9C, 0xBD, 0x01, 0xF0, 0x9C, 0xE4, 0x64, 0xC0, 0x9E, 0xB8, 0x93, 0x70, 0x9F, 0xBA, 0xEB, 0x60, 0xA0, 0x87, 0x58, 0xF8, @@ -5149,16 +5149,14 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x00, 0x01, 0x00, 0x01, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x00, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x08, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x0C, 0x45, 0x44, 0x54, 0x00, 0x45, 0x53, 0x54, 0x00, 0x45, 0x57, 0x54, 0x00, 0x45, 0x50, 0x54, 0x00, 0x00, 0x00, 0x00, 0x01, -0x00, 0x00, 0x00, 0x01, 0x00, 0xCE, 0xC8, 0x32, 0x00, 0xA2, 0x67, 0x85, 0x00, 0x00, 0x00, 0x26, -0x45, 0x61, 0x73, 0x74, 0x65, 0x72, 0x6E, 0x20, 0x54, 0x69, 0x6D, 0x65, 0x20, 0x2D, 0x20, 0x51, -0x75, 0x65, 0x62, 0x65, 0x63, 0x20, 0x2D, 0x20, 0x6D, 0x6F, 0x73, 0x74, 0x20, 0x6C, 0x6F, 0x63, -0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73, +0x00, 0x00, 0x00, 0x01, 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, 0x00, 0x00, 0x00, 0x00, + /* America/Montserrat */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x4D, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x91, 0xF4, 0x35, 0x10, -0x01, 0xFF, 0xFF, 0xC5, 0xAC, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, +0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x93, 0x37, 0x33, 0xAC, +0x01, 0xFF, 0xFF, 0xC6, 0x54, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA2, 0xD6, 0x32, 0x00, 0xB3, 0xB9, 0x1D, 0x00, 0x00, 0x00, 0x00, @@ -5741,9 +5739,10 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0xFB, 0xE8, 0x58, 0x00, 0x00, 0x01, 0x00, 0x01, 0x02, 0x01, 0x02, 0x01, 0x00, 0x01, 0xFF, 0xFF, 0xAB, 0xA0, 0x01, 0x00, 0xFF, 0xFF, 0x9D, 0x90, 0x00, 0x04, 0xFF, 0xFF, 0xAB, 0xA0, 0x01, 0x08, 0x4D, 0x44, 0x54, 0x00, 0x4D, 0x53, 0x54, 0x00, 0x4D, 0x57, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0xBC, 0x5E, 0x01, 0x00, 0x67, 0xA5, 0xDA, 0x00, 0x00, 0x00, 0x20, 0x4D, 0x6F, +0x00, 0x00, 0x00, 0xBC, 0x5E, 0x01, 0x00, 0x67, 0xA5, 0xDA, 0x00, 0x00, 0x00, 0x30, 0x4D, 0x6F, 0x75, 0x6E, 0x74, 0x61, 0x69, 0x6E, 0x20, 0x53, 0x74, 0x61, 0x6E, 0x64, 0x61, 0x72, 0x64, 0x20, -0x54, 0x69, 0x6D, 0x65, 0x20, 0x2D, 0x20, 0x41, 0x72, 0x69, 0x7A, 0x6F, 0x6E, 0x61, +0x54, 0x69, 0x6D, 0x65, 0x20, 0x2D, 0x20, 0x41, 0x72, 0x69, 0x7A, 0x6F, 0x6E, 0x61, 0x20, 0x28, +0x65, 0x78, 0x63, 0x65, 0x70, 0x74, 0x20, 0x4E, 0x61, 0x76, 0x61, 0x6A, 0x6F, 0x29, /* America/Port-au-Prince */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x48, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -5785,7 +5784,7 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* America/Porto_Acre */ 0x50, 0x48, 0x50, 0x31, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x11, 0x96, 0xAA, 0x86, 0x90, +0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x11, 0x96, 0xAA, 0x86, 0x90, 0xB8, 0x0F, 0x66, 0x00, 0xB8, 0xFD, 0x5C, 0xC0, 0xB9, 0xF1, 0x50, 0x50, 0xBA, 0xDE, 0x90, 0x40, 0xDA, 0x38, 0xCA, 0x50, 0xDA, 0xEC, 0x16, 0x50, 0xDC, 0x19, 0xFD, 0xD0, 0xDC, 0xB9, 0x75, 0x40, 0xDD, 0xFB, 0x31, 0x50, 0xDE, 0x9B, 0xFA, 0x40, 0xDF, 0xDD, 0xB6, 0x50, 0xE0, 0x54, 0x4F, 0x40, @@ -5793,12 +5792,13 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0xF8, 0x51, 0x48, 0x50, 0xF8, 0xC7, 0xE1, 0x40, 0xFA, 0x0A, 0xEE, 0xD0, 0xFA, 0xA9, 0x14, 0xC0, 0xFB, 0xEC, 0x22, 0x50, 0xFC, 0x8B, 0x99, 0xC0, 0x1D, 0xC9, 0xAA, 0x50, 0x1E, 0x78, 0xF3, 0xC0, 0x1F, 0xA0, 0x51, 0xD0, 0x20, 0x33, 0xEB, 0xC0, 0x21, 0x81, 0x85, 0x50, 0x22, 0x0B, 0xE4, 0xC0, -0x48, 0x60, 0x7F, 0x50, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x48, 0x60, 0x7F, 0x50, 0x52, 0x7F, 0x04, 0xC0, 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, 0x03, 0xFF, 0xFF, 0xC0, 0x70, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x04, 0xFF, 0xFF, -0xB9, 0xB0, 0x00, 0x09, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x43, -0x53, 0x54, 0x00, 0x41, 0x43, 0x54, 0x00, 0x41, 0x4D, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, 0x00, 0x00, 0x00, 0x00, +0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x02, 0xFF, 0xFF, 0xC0, 0x70, 0x00, 0x00, 0xFF, 0xFF, 0xC7, +0xC0, 0x01, 0x04, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x09, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0x4C, +0x4D, 0x54, 0x00, 0x41, 0x43, 0x53, 0x54, 0x00, 0x41, 0x43, 0x54, 0x00, 0x41, 0x4D, 0x54, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, +0x00, 0x00, 0x00, 0x00, /* America/Port_of_Spain */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x54, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -6042,7 +6042,7 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* America/Rio_Branco */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x42, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x11, 0x96, 0xAA, 0x86, 0x90, +0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x11, 0x96, 0xAA, 0x86, 0x90, 0xB8, 0x0F, 0x66, 0x00, 0xB8, 0xFD, 0x5C, 0xC0, 0xB9, 0xF1, 0x50, 0x50, 0xBA, 0xDE, 0x90, 0x40, 0xDA, 0x38, 0xCA, 0x50, 0xDA, 0xEC, 0x16, 0x50, 0xDC, 0x19, 0xFD, 0xD0, 0xDC, 0xB9, 0x75, 0x40, 0xDD, 0xFB, 0x31, 0x50, 0xDE, 0x9B, 0xFA, 0x40, 0xDF, 0xDD, 0xB6, 0x50, 0xE0, 0x54, 0x4F, 0x40, @@ -6050,13 +6050,13 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0xF8, 0x51, 0x48, 0x50, 0xF8, 0xC7, 0xE1, 0x40, 0xFA, 0x0A, 0xEE, 0xD0, 0xFA, 0xA9, 0x14, 0xC0, 0xFB, 0xEC, 0x22, 0x50, 0xFC, 0x8B, 0x99, 0xC0, 0x1D, 0xC9, 0xAA, 0x50, 0x1E, 0x78, 0xF3, 0xC0, 0x1F, 0xA0, 0x51, 0xD0, 0x20, 0x33, 0xEB, 0xC0, 0x21, 0x81, 0x85, 0x50, 0x22, 0x0B, 0xE4, 0xC0, -0x48, 0x60, 0x7F, 0x50, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x48, 0x60, 0x7F, 0x50, 0x52, 0x7F, 0x04, 0xC0, 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, 0x03, 0xFF, 0xFF, 0xC0, 0x70, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x04, 0xFF, 0xFF, -0xB9, 0xB0, 0x00, 0x09, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x43, -0x53, 0x54, 0x00, 0x41, 0x43, 0x54, 0x00, 0x41, 0x4D, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x7A, 0x1F, 0x05, 0x00, 0xAB, 0x34, 0x20, 0x00, 0x00, 0x00, 0x04, 0x41, -0x63, 0x72, 0x65, +0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x02, 0xFF, 0xFF, 0xC0, 0x70, 0x00, 0x00, 0xFF, 0xFF, 0xC7, +0xC0, 0x01, 0x04, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x09, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0x4C, +0x4D, 0x54, 0x00, 0x41, 0x43, 0x53, 0x54, 0x00, 0x41, 0x43, 0x54, 0x00, 0x41, 0x4D, 0x54, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7A, 0x1F, 0x05, 0x00, 0xAB, 0x34, 0x20, +0x00, 0x00, 0x00, 0x04, 0x41, 0x63, 0x72, 0x65, /* America/Rosario */ 0x50, 0x48, 0x50, 0x31, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -6344,7 +6344,7 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x74, 0x6F, 0x71, 0x71, 0x6F, 0x72, 0x74, 0x6F, 0x6F, 0x72, 0x6D, 0x69, 0x69, 0x74, /* America/Shiprock */ -0x50, 0x48, 0x50, 0x31, 0x01, 0x55, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x50, 0x48, 0x50, 0x31, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9D, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x9E, 0xA6, 0x3A, 0x90, 0x9F, 0xBB, 0x07, 0x80, 0xA0, 0x86, 0x1C, 0x90, 0xA1, 0x9A, 0xE9, 0x80, 0xA2, 0x65, 0xFE, 0x90, @@ -6398,9 +6398,8 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0xFF, 0xFF, 0xAB, 0xA0, 0x01, 0x00, 0xFF, 0xFF, 0x9D, 0x90, 0x00, 0x04, 0xFF, 0xFF, 0xAB, 0xA0, 0x01, 0x08, 0xFF, 0xFF, 0xAB, 0xA0, 0x01, 0x0C, 0x4D, 0x44, 0x54, 0x00, 0x4D, 0x53, 0x54, 0x00, 0x4D, 0x57, 0x54, -0x00, 0x4D, 0x50, 0x54, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xC1, 0x75, -0x9B, 0x00, 0x6C, 0xD0, 0xE1, 0x00, 0x00, 0x00, 0x16, 0x4D, 0x6F, 0x75, 0x6E, 0x74, 0x61, 0x69, -0x6E, 0x20, 0x54, 0x69, 0x6D, 0x65, 0x20, 0x2D, 0x20, 0x4E, 0x61, 0x76, 0x61, 0x6A, 0x6F, +0x00, 0x4D, 0x50, 0x54, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x89, 0x54, +0x40, 0x01, 0x12, 0xA8, 0x80, 0x00, 0x00, 0x00, 0x00, /* America/Sitka */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x55, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -6464,8 +6463,8 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* America/St_Barthelemy */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x42, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x91, 0xD5, 0xE1, 0xB0, -0x01, 0xFF, 0xFF, 0xC6, 0x50, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, +0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x93, 0x37, 0x33, 0xAC, +0x01, 0xFF, 0xFF, 0xC6, 0x54, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA4, 0x9D, 0xED, 0x00, 0xB2, 0xC1, 0xB8, 0x00, 0x00, 0x00, 0x00, @@ -6560,32 +6559,32 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* America/St_Kitts */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x4B, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x93, 0x37, 0x34, 0xCC, -0x01, 0xFF, 0xFF, 0xC5, 0x34, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, +0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x93, 0x37, 0x33, 0xAC, +0x01, 0xFF, 0xFF, 0xC6, 0x54, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA3, 0xBA, 0x10, 0x00, 0xB2, 0xF5, 0xCD, 0x00, 0x00, 0x00, 0x00, /* America/St_Lucia */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x4C, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x92, 0xE6, 0xC7, 0xB0, -0x01, 0xFF, 0xFF, 0xC6, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x43, 0x4D, 0x54, +0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x93, 0x37, 0x33, 0xAC, +0x01, 0xFF, 0xFF, 0xC6, 0x54, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9E, 0xB7, 0x82, 0x00, 0xB5, 0x94, 0x60, 0x00, 0x00, 0x00, 0x00, /* America/St_Thomas */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x56, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x91, 0xF4, 0x37, 0x60, -0x01, 0xFF, 0xFF, 0xC3, 0x20, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, +0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x93, 0x37, 0x33, 0xAC, +0x01, 0xFF, 0xFF, 0xC6, 0x54, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA5, 0x54, 0x38, 0x00, 0xAF, 0x93, 0xEA, 0x00, 0x00, 0x00, 0x00, /* America/St_Vincent */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x56, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x92, 0xE6, 0xC7, 0xE8, -0x01, 0xFF, 0xFF, 0xC6, 0x98, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4B, 0x4D, 0x54, +0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x93, 0x37, 0x33, 0xAC, +0x01, 0xFF, 0xFF, 0xC6, 0x54, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9D, 0x64, 0xF8, 0x00, 0xB5, 0x39, 0x3A, 0x00, 0x00, 0x00, 0x00, @@ -6853,16 +6852,17 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x00, 0x01, 0x00, 0x01, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x00, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x08, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x0C, 0x45, 0x44, 0x54, 0x00, 0x45, 0x53, 0x54, 0x00, 0x45, 0x57, 0x54, 0x00, 0x45, 0x50, 0x54, 0x00, 0x00, 0x00, 0x00, 0x01, -0x00, 0x00, 0x00, 0x01, 0x00, 0xCB, 0xEF, 0x08, 0x00, 0x99, 0x87, 0x62, 0x00, 0x00, 0x00, 0x27, +0x00, 0x00, 0x00, 0x01, 0x00, 0xCB, 0xEF, 0x08, 0x00, 0x99, 0x87, 0x62, 0x00, 0x00, 0x00, 0x30, 0x45, 0x61, 0x73, 0x74, 0x65, 0x72, 0x6E, 0x20, 0x54, 0x69, 0x6D, 0x65, 0x20, 0x2D, 0x20, 0x4F, -0x6E, 0x74, 0x61, 0x72, 0x69, 0x6F, 0x20, 0x2D, 0x20, 0x6D, 0x6F, 0x73, 0x74, 0x20, 0x6C, 0x6F, -0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73, +0x6E, 0x74, 0x61, 0x72, 0x69, 0x6F, 0x20, 0x26, 0x20, 0x51, 0x75, 0x65, 0x62, 0x65, 0x63, 0x20, +0x2D, 0x20, 0x6D, 0x6F, 0x73, 0x74, 0x20, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73, + /* America/Tortola */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x56, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x91, 0xF4, 0x37, 0x14, -0x01, 0xFF, 0xFF, 0xC3, 0x6C, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, +0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x93, 0x37, 0x33, 0xAC, +0x01, 0xFF, 0xFF, 0xC6, 0x54, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA5, 0x7B, 0x48, 0x00, 0xB0, 0x0F, 0x9D, 0x00, 0x00, 0x00, 0x00, @@ -6939,8 +6939,8 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* America/Virgin */ 0x50, 0x48, 0x50, 0x31, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x91, 0xF4, 0x37, 0x60, -0x01, 0xFF, 0xFF, 0xC3, 0x20, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, +0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x93, 0x37, 0x33, 0xAC, +0x01, 0xFF, 0xFF, 0xC6, 0x54, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, 0x00, 0x00, 0x00, 0x00, @@ -7264,54 +7264,64 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* Antarctica/McMurdo */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x41, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0E, 0xE5, 0xA9, 0xE9, 0x00, -0x09, 0x18, 0xFD, 0xE0, 0x09, 0xAC, 0xA5, 0xE0, 0x0A, 0xEF, 0xA5, 0x60, 0x0B, 0x9E, 0xFC, 0xE0, -0x0C, 0xD8, 0xC1, 0xE0, 0x0D, 0x7E, 0xDE, 0xE0, 0x0E, 0xB8, 0xA3, 0xE0, 0x0F, 0x5E, 0xC0, 0xE0, -0x10, 0x98, 0x85, 0xE0, 0x11, 0x3E, 0xA2, 0xE0, 0x12, 0x78, 0x67, 0xE0, 0x13, 0x1E, 0x84, 0xE0, -0x14, 0x58, 0x49, 0xE0, 0x14, 0xFE, 0x66, 0xE0, 0x16, 0x38, 0x2B, 0xE0, 0x16, 0xE7, 0x83, 0x60, -0x18, 0x21, 0x48, 0x60, 0x18, 0xC7, 0x65, 0x60, 0x1A, 0x01, 0x2A, 0x60, 0x1A, 0xA7, 0x47, 0x60, -0x1B, 0xE1, 0x0C, 0x60, 0x1C, 0x87, 0x29, 0x60, 0x1D, 0xC0, 0xEE, 0x60, 0x1E, 0x67, 0x0B, 0x60, -0x1F, 0xA0, 0xD0, 0x60, 0x20, 0x46, 0xED, 0x60, 0x21, 0x80, 0xB2, 0x60, 0x22, 0x30, 0x09, 0xE0, -0x23, 0x69, 0xCE, 0xE0, 0x24, 0x0F, 0xEB, 0xE0, 0x25, 0x2E, 0x01, 0x60, 0x26, 0x02, 0x42, 0xE0, -0x27, 0x0D, 0xE3, 0x60, 0x27, 0xE2, 0x24, 0xE0, 0x28, 0xED, 0xC5, 0x60, 0x29, 0xC2, 0x06, 0xE0, -0x2A, 0xCD, 0xA7, 0x60, 0x2B, 0xAB, 0x23, 0x60, 0x2C, 0xAD, 0x89, 0x60, 0x2D, 0x8B, 0x05, 0x60, -0x2E, 0x8D, 0x6B, 0x60, 0x2F, 0x6A, 0xE7, 0x60, 0x30, 0x6D, 0x4D, 0x60, 0x31, 0x4A, 0xC9, 0x60, -0x32, 0x56, 0x69, 0xE0, 0x33, 0x2A, 0xAB, 0x60, 0x34, 0x36, 0x4B, 0xE0, 0x35, 0x0A, 0x8D, 0x60, -0x36, 0x16, 0x2D, 0xE0, 0x36, 0xF3, 0xA9, 0xE0, 0x37, 0xF6, 0x0F, 0xE0, 0x38, 0xD3, 0x8B, 0xE0, -0x39, 0xD5, 0xF1, 0xE0, 0x3A, 0xB3, 0x6D, 0xE0, 0x3B, 0xBF, 0x0E, 0x60, 0x3C, 0x93, 0x4F, 0xE0, -0x3D, 0x9E, 0xF0, 0x60, 0x3E, 0x73, 0x31, 0xE0, 0x3F, 0x7E, 0xD2, 0x60, 0x40, 0x5C, 0x4E, 0x60, -0x41, 0x5E, 0xB4, 0x60, 0x42, 0x3C, 0x30, 0x60, 0x43, 0x3E, 0x96, 0x60, 0x44, 0x1C, 0x12, 0x60, -0x45, 0x1E, 0x78, 0x60, 0x45, 0xFB, 0xF4, 0x60, 0x46, 0xFE, 0x5A, 0x60, 0x47, 0xF7, 0x85, 0xE0, -0x48, 0xDE, 0x3C, 0x60, 0x49, 0xD7, 0x67, 0xE0, 0x4A, 0xBE, 0x1E, 0x60, 0x4B, 0xB7, 0x49, 0xE0, -0x4C, 0x9E, 0x00, 0x60, 0x4D, 0x97, 0x2B, 0xE0, 0x4E, 0x7D, 0xE2, 0x60, 0x4F, 0x77, 0x0D, 0xE0, -0x50, 0x66, 0xFE, 0xE0, 0x51, 0x60, 0x2A, 0x60, 0x52, 0x46, 0xE0, 0xE0, 0x53, 0x40, 0x0C, 0x60, -0x54, 0x26, 0xC2, 0xE0, 0x55, 0x1F, 0xEE, 0x60, 0x56, 0x06, 0xA4, 0xE0, 0x56, 0xFF, 0xD0, 0x60, -0x57, 0xE6, 0x86, 0xE0, 0x58, 0xDF, 0xB2, 0x60, 0x59, 0xC6, 0x68, 0xE0, 0x5A, 0xBF, 0x94, 0x60, -0x5B, 0xAF, 0x85, 0x60, 0x5C, 0xA8, 0xB0, 0xE0, 0x5D, 0x8F, 0x67, 0x60, 0x5E, 0x88, 0x92, 0xE0, -0x5F, 0x6F, 0x49, 0x60, 0x60, 0x68, 0x74, 0xE0, 0x61, 0x4F, 0x2B, 0x60, 0x62, 0x48, 0x56, 0xE0, -0x63, 0x2F, 0x0D, 0x60, 0x64, 0x28, 0x38, 0xE0, 0x65, 0x0E, 0xEF, 0x60, 0x66, 0x11, 0x55, 0x60, -0x66, 0xF8, 0x0B, 0xE0, 0x67, 0xF1, 0x37, 0x60, 0x68, 0xD7, 0xED, 0xE0, 0x69, 0xD1, 0x19, 0x60, -0x6A, 0xB7, 0xCF, 0xE0, 0x6B, 0xB0, 0xFB, 0x60, 0x6C, 0x97, 0xB1, 0xE0, 0x6D, 0x90, 0xDD, 0x60, -0x6E, 0x77, 0x93, 0xE0, 0x6F, 0x70, 0xBF, 0x60, 0x70, 0x60, 0xB0, 0x60, 0x71, 0x59, 0xDB, 0xE0, -0x72, 0x40, 0x92, 0x60, 0x73, 0x39, 0xBD, 0xE0, 0x74, 0x20, 0x74, 0x60, 0x75, 0x19, 0x9F, 0xE0, -0x76, 0x00, 0x56, 0x60, 0x76, 0xF9, 0x81, 0xE0, 0x77, 0xE0, 0x38, 0x60, 0x78, 0xD9, 0x63, 0xE0, -0x79, 0xC0, 0x1A, 0x60, 0x7A, 0xB9, 0x45, 0xE0, 0x7B, 0xA9, 0x36, 0xE0, 0x7C, 0xA2, 0x62, 0x60, -0x7D, 0x89, 0x18, 0xE0, 0x7E, 0x82, 0x44, 0x60, 0x7F, 0x68, 0xFA, 0xE0, 0x03, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x9B, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0F, 0xB0, 0xB4, 0xB2, 0xE8, +0xB1, 0x51, 0x87, 0x58, 0xB2, 0x78, 0xE5, 0x68, 0xB3, 0x43, 0xE5, 0x60, 0xB4, 0x58, 0xC7, 0x68, +0xB5, 0x23, 0xC7, 0x60, 0xB6, 0x38, 0xA9, 0x68, 0xB7, 0x03, 0xA9, 0x60, 0xB8, 0x18, 0x8B, 0x68, +0xB8, 0xEC, 0xC5, 0xE0, 0xB9, 0xF8, 0x6D, 0x68, 0xBA, 0xCC, 0xA7, 0xE0, 0xBB, 0xD8, 0x4F, 0x68, +0xBC, 0xE3, 0xE8, 0xE0, 0xBD, 0xAE, 0xF6, 0xE8, 0xBE, 0xC3, 0xCA, 0xE0, 0xBF, 0x8E, 0xD8, 0xE8, +0xC0, 0xA3, 0xAC, 0xE0, 0xC1, 0x6E, 0xBA, 0xE8, 0xC2, 0x83, 0x8E, 0xE0, 0xC3, 0x4E, 0x9C, 0xE8, +0xC4, 0x63, 0x70, 0xE0, 0xC5, 0x2E, 0x7E, 0xE8, 0xC6, 0x4C, 0x8D, 0x60, 0xC7, 0x0E, 0x60, 0xE8, +0xC8, 0x2C, 0x6F, 0x60, 0xC8, 0xF7, 0x7D, 0x68, 0xD2, 0xDA, 0x9A, 0x40, 0x09, 0x18, 0xFD, 0xE0, +0x09, 0xAC, 0xA5, 0xE0, 0x0A, 0xEF, 0xA5, 0x60, 0x0B, 0x9E, 0xFC, 0xE0, 0x0C, 0xD8, 0xC1, 0xE0, +0x0D, 0x7E, 0xDE, 0xE0, 0x0E, 0xB8, 0xA3, 0xE0, 0x0F, 0x5E, 0xC0, 0xE0, 0x10, 0x98, 0x85, 0xE0, +0x11, 0x3E, 0xA2, 0xE0, 0x12, 0x78, 0x67, 0xE0, 0x13, 0x1E, 0x84, 0xE0, 0x14, 0x58, 0x49, 0xE0, +0x14, 0xFE, 0x66, 0xE0, 0x16, 0x38, 0x2B, 0xE0, 0x16, 0xE7, 0x83, 0x60, 0x18, 0x21, 0x48, 0x60, +0x18, 0xC7, 0x65, 0x60, 0x1A, 0x01, 0x2A, 0x60, 0x1A, 0xA7, 0x47, 0x60, 0x1B, 0xE1, 0x0C, 0x60, +0x1C, 0x87, 0x29, 0x60, 0x1D, 0xC0, 0xEE, 0x60, 0x1E, 0x67, 0x0B, 0x60, 0x1F, 0xA0, 0xD0, 0x60, +0x20, 0x46, 0xED, 0x60, 0x21, 0x80, 0xB2, 0x60, 0x22, 0x30, 0x09, 0xE0, 0x23, 0x69, 0xCE, 0xE0, +0x24, 0x0F, 0xEB, 0xE0, 0x25, 0x2E, 0x01, 0x60, 0x26, 0x02, 0x42, 0xE0, 0x27, 0x0D, 0xE3, 0x60, +0x27, 0xE2, 0x24, 0xE0, 0x28, 0xED, 0xC5, 0x60, 0x29, 0xC2, 0x06, 0xE0, 0x2A, 0xCD, 0xA7, 0x60, +0x2B, 0xAB, 0x23, 0x60, 0x2C, 0xAD, 0x89, 0x60, 0x2D, 0x8B, 0x05, 0x60, 0x2E, 0x8D, 0x6B, 0x60, +0x2F, 0x6A, 0xE7, 0x60, 0x30, 0x6D, 0x4D, 0x60, 0x31, 0x4A, 0xC9, 0x60, 0x32, 0x56, 0x69, 0xE0, +0x33, 0x2A, 0xAB, 0x60, 0x34, 0x36, 0x4B, 0xE0, 0x35, 0x0A, 0x8D, 0x60, 0x36, 0x16, 0x2D, 0xE0, +0x36, 0xF3, 0xA9, 0xE0, 0x37, 0xF6, 0x0F, 0xE0, 0x38, 0xD3, 0x8B, 0xE0, 0x39, 0xD5, 0xF1, 0xE0, +0x3A, 0xB3, 0x6D, 0xE0, 0x3B, 0xBF, 0x0E, 0x60, 0x3C, 0x93, 0x4F, 0xE0, 0x3D, 0x9E, 0xF0, 0x60, +0x3E, 0x73, 0x31, 0xE0, 0x3F, 0x7E, 0xD2, 0x60, 0x40, 0x5C, 0x4E, 0x60, 0x41, 0x5E, 0xB4, 0x60, +0x42, 0x3C, 0x30, 0x60, 0x43, 0x3E, 0x96, 0x60, 0x44, 0x1C, 0x12, 0x60, 0x45, 0x1E, 0x78, 0x60, +0x45, 0xFB, 0xF4, 0x60, 0x46, 0xFE, 0x5A, 0x60, 0x47, 0xF7, 0x85, 0xE0, 0x48, 0xDE, 0x3C, 0x60, +0x49, 0xD7, 0x67, 0xE0, 0x4A, 0xBE, 0x1E, 0x60, 0x4B, 0xB7, 0x49, 0xE0, 0x4C, 0x9E, 0x00, 0x60, +0x4D, 0x97, 0x2B, 0xE0, 0x4E, 0x7D, 0xE2, 0x60, 0x4F, 0x77, 0x0D, 0xE0, 0x50, 0x66, 0xFE, 0xE0, +0x51, 0x60, 0x2A, 0x60, 0x52, 0x46, 0xE0, 0xE0, 0x53, 0x40, 0x0C, 0x60, 0x54, 0x26, 0xC2, 0xE0, +0x55, 0x1F, 0xEE, 0x60, 0x56, 0x06, 0xA4, 0xE0, 0x56, 0xFF, 0xD0, 0x60, 0x57, 0xE6, 0x86, 0xE0, +0x58, 0xDF, 0xB2, 0x60, 0x59, 0xC6, 0x68, 0xE0, 0x5A, 0xBF, 0x94, 0x60, 0x5B, 0xAF, 0x85, 0x60, +0x5C, 0xA8, 0xB0, 0xE0, 0x5D, 0x8F, 0x67, 0x60, 0x5E, 0x88, 0x92, 0xE0, 0x5F, 0x6F, 0x49, 0x60, +0x60, 0x68, 0x74, 0xE0, 0x61, 0x4F, 0x2B, 0x60, 0x62, 0x48, 0x56, 0xE0, 0x63, 0x2F, 0x0D, 0x60, +0x64, 0x28, 0x38, 0xE0, 0x65, 0x0E, 0xEF, 0x60, 0x66, 0x11, 0x55, 0x60, 0x66, 0xF8, 0x0B, 0xE0, +0x67, 0xF1, 0x37, 0x60, 0x68, 0xD7, 0xED, 0xE0, 0x69, 0xD1, 0x19, 0x60, 0x6A, 0xB7, 0xCF, 0xE0, +0x6B, 0xB0, 0xFB, 0x60, 0x6C, 0x97, 0xB1, 0xE0, 0x6D, 0x90, 0xDD, 0x60, 0x6E, 0x77, 0x93, 0xE0, +0x6F, 0x70, 0xBF, 0x60, 0x70, 0x60, 0xB0, 0x60, 0x71, 0x59, 0xDB, 0xE0, 0x72, 0x40, 0x92, 0x60, +0x73, 0x39, 0xBD, 0xE0, 0x74, 0x20, 0x74, 0x60, 0x75, 0x19, 0x9F, 0xE0, 0x76, 0x00, 0x56, 0x60, +0x76, 0xF9, 0x81, 0xE0, 0x77, 0xE0, 0x38, 0x60, 0x78, 0xD9, 0x63, 0xE0, 0x79, 0xC0, 0x1A, 0x60, +0x7A, 0xB9, 0x45, 0xE0, 0x7B, 0xA9, 0x36, 0xE0, 0x7C, 0xA2, 0x62, 0x60, 0x7D, 0x89, 0x18, 0xE0, +0x7E, 0x82, 0x44, 0x60, 0x7F, 0x68, 0xFA, 0xE0, 0x00, 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, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0xB6, 0xD0, 0x01, 0x04, 0x00, 0x00, 0xA8, 0xC0, 0x00, 0x09, 0x00, 0x00, -0xA8, 0xC0, 0x00, 0x09, 0x7A, 0x7A, 0x7A, 0x00, 0x4E, 0x5A, 0x44, 0x54, 0x00, 0x4E, 0x5A, 0x53, -0x54, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x90, 0x9A, 0x02, 0x10, -0xDE, 0xA0, 0x00, 0x00, 0x00, 0x1C, 0x4D, 0x63, 0x4D, 0x75, 0x72, 0x64, 0x6F, 0x20, 0x53, 0x74, -0x61, 0x74, 0x69, 0x6F, 0x6E, 0x2C, 0x20, 0x52, 0x6F, 0x73, 0x73, 0x20, 0x49, 0x73, 0x6C, 0x61, -0x6E, 0x64, +0x02, 0x01, 0x02, 0x05, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, +0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, +0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, +0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, +0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, +0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, +0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, +0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, +0x03, 0x04, 0x03, 0x00, 0x00, 0xAF, 0xC8, 0x01, 0x00, 0x00, 0x00, 0xA1, 0xB8, 0x00, 0x05, 0x00, +0x00, 0xA8, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xB6, 0xD0, 0x01, 0x0A, 0x00, 0x00, 0xA8, 0xC0, 0x00, +0x00, 0x00, 0x00, 0xA8, 0xC0, 0x00, 0x00, 0x4E, 0x5A, 0x53, 0x54, 0x00, 0x4E, 0x5A, 0x4D, 0x54, +0x00, 0x4E, 0x5A, 0x44, 0x54, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x12, 0x90, 0x9A, 0x02, 0x10, 0xDE, 0xA0, 0x00, 0x00, 0x00, 0x2D, 0x4D, 0x63, +0x4D, 0x75, 0x72, 0x64, 0x6F, 0x2C, 0x20, 0x53, 0x6F, 0x75, 0x74, 0x68, 0x20, 0x50, 0x6F, 0x6C, +0x65, 0x2C, 0x20, 0x53, 0x63, 0x6F, 0x74, 0x74, 0x20, 0x28, 0x4E, 0x65, 0x77, 0x20, 0x5A, 0x65, +0x61, 0x6C, 0x61, 0x6E, 0x64, 0x20, 0x74, 0x69, 0x6D, 0x65, 0x29, /* Antarctica/Palmer */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x41, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -7376,55 +7386,62 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x49, 0x73, 0x6C, 0x61, 0x6E, 0x64, /* Antarctica/South_Pole */ -0x50, 0x48, 0x50, 0x31, 0x01, 0x41, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0E, 0xE5, 0xA9, 0xE9, 0x00, -0x09, 0x18, 0xFD, 0xE0, 0x09, 0xAC, 0xA5, 0xE0, 0x0A, 0xEF, 0xA5, 0x60, 0x0B, 0x9E, 0xFC, 0xE0, -0x0C, 0xD8, 0xC1, 0xE0, 0x0D, 0x7E, 0xDE, 0xE0, 0x0E, 0xB8, 0xA3, 0xE0, 0x0F, 0x5E, 0xC0, 0xE0, -0x10, 0x98, 0x85, 0xE0, 0x11, 0x3E, 0xA2, 0xE0, 0x12, 0x78, 0x67, 0xE0, 0x13, 0x1E, 0x84, 0xE0, -0x14, 0x58, 0x49, 0xE0, 0x14, 0xFE, 0x66, 0xE0, 0x16, 0x38, 0x2B, 0xE0, 0x16, 0xE7, 0x83, 0x60, -0x18, 0x21, 0x48, 0x60, 0x18, 0xC7, 0x65, 0x60, 0x1A, 0x01, 0x2A, 0x60, 0x1A, 0xA7, 0x47, 0x60, -0x1B, 0xE1, 0x0C, 0x60, 0x1C, 0x87, 0x29, 0x60, 0x1D, 0xC0, 0xEE, 0x60, 0x1E, 0x67, 0x0B, 0x60, -0x1F, 0xA0, 0xD0, 0x60, 0x20, 0x46, 0xED, 0x60, 0x21, 0x80, 0xB2, 0x60, 0x22, 0x30, 0x09, 0xE0, -0x23, 0x69, 0xCE, 0xE0, 0x24, 0x0F, 0xEB, 0xE0, 0x25, 0x2E, 0x01, 0x60, 0x26, 0x02, 0x42, 0xE0, -0x27, 0x0D, 0xE3, 0x60, 0x27, 0xE2, 0x24, 0xE0, 0x28, 0xED, 0xC5, 0x60, 0x29, 0xC2, 0x06, 0xE0, -0x2A, 0xCD, 0xA7, 0x60, 0x2B, 0xAB, 0x23, 0x60, 0x2C, 0xAD, 0x89, 0x60, 0x2D, 0x8B, 0x05, 0x60, -0x2E, 0x8D, 0x6B, 0x60, 0x2F, 0x6A, 0xE7, 0x60, 0x30, 0x6D, 0x4D, 0x60, 0x31, 0x4A, 0xC9, 0x60, -0x32, 0x56, 0x69, 0xE0, 0x33, 0x2A, 0xAB, 0x60, 0x34, 0x36, 0x4B, 0xE0, 0x35, 0x0A, 0x8D, 0x60, -0x36, 0x16, 0x2D, 0xE0, 0x36, 0xF3, 0xA9, 0xE0, 0x37, 0xF6, 0x0F, 0xE0, 0x38, 0xD3, 0x8B, 0xE0, -0x39, 0xD5, 0xF1, 0xE0, 0x3A, 0xB3, 0x6D, 0xE0, 0x3B, 0xBF, 0x0E, 0x60, 0x3C, 0x93, 0x4F, 0xE0, -0x3D, 0x9E, 0xF0, 0x60, 0x3E, 0x73, 0x31, 0xE0, 0x3F, 0x7E, 0xD2, 0x60, 0x40, 0x5C, 0x4E, 0x60, -0x41, 0x5E, 0xB4, 0x60, 0x42, 0x3C, 0x30, 0x60, 0x43, 0x3E, 0x96, 0x60, 0x44, 0x1C, 0x12, 0x60, -0x45, 0x1E, 0x78, 0x60, 0x45, 0xFB, 0xF4, 0x60, 0x46, 0xFE, 0x5A, 0x60, 0x47, 0xF7, 0x85, 0xE0, -0x48, 0xDE, 0x3C, 0x60, 0x49, 0xD7, 0x67, 0xE0, 0x4A, 0xBE, 0x1E, 0x60, 0x4B, 0xB7, 0x49, 0xE0, -0x4C, 0x9E, 0x00, 0x60, 0x4D, 0x97, 0x2B, 0xE0, 0x4E, 0x7D, 0xE2, 0x60, 0x4F, 0x77, 0x0D, 0xE0, -0x50, 0x66, 0xFE, 0xE0, 0x51, 0x60, 0x2A, 0x60, 0x52, 0x46, 0xE0, 0xE0, 0x53, 0x40, 0x0C, 0x60, -0x54, 0x26, 0xC2, 0xE0, 0x55, 0x1F, 0xEE, 0x60, 0x56, 0x06, 0xA4, 0xE0, 0x56, 0xFF, 0xD0, 0x60, -0x57, 0xE6, 0x86, 0xE0, 0x58, 0xDF, 0xB2, 0x60, 0x59, 0xC6, 0x68, 0xE0, 0x5A, 0xBF, 0x94, 0x60, -0x5B, 0xAF, 0x85, 0x60, 0x5C, 0xA8, 0xB0, 0xE0, 0x5D, 0x8F, 0x67, 0x60, 0x5E, 0x88, 0x92, 0xE0, -0x5F, 0x6F, 0x49, 0x60, 0x60, 0x68, 0x74, 0xE0, 0x61, 0x4F, 0x2B, 0x60, 0x62, 0x48, 0x56, 0xE0, -0x63, 0x2F, 0x0D, 0x60, 0x64, 0x28, 0x38, 0xE0, 0x65, 0x0E, 0xEF, 0x60, 0x66, 0x11, 0x55, 0x60, -0x66, 0xF8, 0x0B, 0xE0, 0x67, 0xF1, 0x37, 0x60, 0x68, 0xD7, 0xED, 0xE0, 0x69, 0xD1, 0x19, 0x60, -0x6A, 0xB7, 0xCF, 0xE0, 0x6B, 0xB0, 0xFB, 0x60, 0x6C, 0x97, 0xB1, 0xE0, 0x6D, 0x90, 0xDD, 0x60, -0x6E, 0x77, 0x93, 0xE0, 0x6F, 0x70, 0xBF, 0x60, 0x70, 0x60, 0xB0, 0x60, 0x71, 0x59, 0xDB, 0xE0, -0x72, 0x40, 0x92, 0x60, 0x73, 0x39, 0xBD, 0xE0, 0x74, 0x20, 0x74, 0x60, 0x75, 0x19, 0x9F, 0xE0, -0x76, 0x00, 0x56, 0x60, 0x76, 0xF9, 0x81, 0xE0, 0x77, 0xE0, 0x38, 0x60, 0x78, 0xD9, 0x63, 0xE0, -0x79, 0xC0, 0x1A, 0x60, 0x7A, 0xB9, 0x45, 0xE0, 0x7B, 0xA9, 0x36, 0xE0, 0x7C, 0xA2, 0x62, 0x60, -0x7D, 0x89, 0x18, 0xE0, 0x7E, 0x82, 0x44, 0x60, 0x7F, 0x68, 0xFA, 0xE0, 0x03, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x50, 0x48, 0x50, 0x31, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x9B, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0F, 0xB0, 0xB4, 0xB2, 0xE8, +0xB1, 0x51, 0x87, 0x58, 0xB2, 0x78, 0xE5, 0x68, 0xB3, 0x43, 0xE5, 0x60, 0xB4, 0x58, 0xC7, 0x68, +0xB5, 0x23, 0xC7, 0x60, 0xB6, 0x38, 0xA9, 0x68, 0xB7, 0x03, 0xA9, 0x60, 0xB8, 0x18, 0x8B, 0x68, +0xB8, 0xEC, 0xC5, 0xE0, 0xB9, 0xF8, 0x6D, 0x68, 0xBA, 0xCC, 0xA7, 0xE0, 0xBB, 0xD8, 0x4F, 0x68, +0xBC, 0xE3, 0xE8, 0xE0, 0xBD, 0xAE, 0xF6, 0xE8, 0xBE, 0xC3, 0xCA, 0xE0, 0xBF, 0x8E, 0xD8, 0xE8, +0xC0, 0xA3, 0xAC, 0xE0, 0xC1, 0x6E, 0xBA, 0xE8, 0xC2, 0x83, 0x8E, 0xE0, 0xC3, 0x4E, 0x9C, 0xE8, +0xC4, 0x63, 0x70, 0xE0, 0xC5, 0x2E, 0x7E, 0xE8, 0xC6, 0x4C, 0x8D, 0x60, 0xC7, 0x0E, 0x60, 0xE8, +0xC8, 0x2C, 0x6F, 0x60, 0xC8, 0xF7, 0x7D, 0x68, 0xD2, 0xDA, 0x9A, 0x40, 0x09, 0x18, 0xFD, 0xE0, +0x09, 0xAC, 0xA5, 0xE0, 0x0A, 0xEF, 0xA5, 0x60, 0x0B, 0x9E, 0xFC, 0xE0, 0x0C, 0xD8, 0xC1, 0xE0, +0x0D, 0x7E, 0xDE, 0xE0, 0x0E, 0xB8, 0xA3, 0xE0, 0x0F, 0x5E, 0xC0, 0xE0, 0x10, 0x98, 0x85, 0xE0, +0x11, 0x3E, 0xA2, 0xE0, 0x12, 0x78, 0x67, 0xE0, 0x13, 0x1E, 0x84, 0xE0, 0x14, 0x58, 0x49, 0xE0, +0x14, 0xFE, 0x66, 0xE0, 0x16, 0x38, 0x2B, 0xE0, 0x16, 0xE7, 0x83, 0x60, 0x18, 0x21, 0x48, 0x60, +0x18, 0xC7, 0x65, 0x60, 0x1A, 0x01, 0x2A, 0x60, 0x1A, 0xA7, 0x47, 0x60, 0x1B, 0xE1, 0x0C, 0x60, +0x1C, 0x87, 0x29, 0x60, 0x1D, 0xC0, 0xEE, 0x60, 0x1E, 0x67, 0x0B, 0x60, 0x1F, 0xA0, 0xD0, 0x60, +0x20, 0x46, 0xED, 0x60, 0x21, 0x80, 0xB2, 0x60, 0x22, 0x30, 0x09, 0xE0, 0x23, 0x69, 0xCE, 0xE0, +0x24, 0x0F, 0xEB, 0xE0, 0x25, 0x2E, 0x01, 0x60, 0x26, 0x02, 0x42, 0xE0, 0x27, 0x0D, 0xE3, 0x60, +0x27, 0xE2, 0x24, 0xE0, 0x28, 0xED, 0xC5, 0x60, 0x29, 0xC2, 0x06, 0xE0, 0x2A, 0xCD, 0xA7, 0x60, +0x2B, 0xAB, 0x23, 0x60, 0x2C, 0xAD, 0x89, 0x60, 0x2D, 0x8B, 0x05, 0x60, 0x2E, 0x8D, 0x6B, 0x60, +0x2F, 0x6A, 0xE7, 0x60, 0x30, 0x6D, 0x4D, 0x60, 0x31, 0x4A, 0xC9, 0x60, 0x32, 0x56, 0x69, 0xE0, +0x33, 0x2A, 0xAB, 0x60, 0x34, 0x36, 0x4B, 0xE0, 0x35, 0x0A, 0x8D, 0x60, 0x36, 0x16, 0x2D, 0xE0, +0x36, 0xF3, 0xA9, 0xE0, 0x37, 0xF6, 0x0F, 0xE0, 0x38, 0xD3, 0x8B, 0xE0, 0x39, 0xD5, 0xF1, 0xE0, +0x3A, 0xB3, 0x6D, 0xE0, 0x3B, 0xBF, 0x0E, 0x60, 0x3C, 0x93, 0x4F, 0xE0, 0x3D, 0x9E, 0xF0, 0x60, +0x3E, 0x73, 0x31, 0xE0, 0x3F, 0x7E, 0xD2, 0x60, 0x40, 0x5C, 0x4E, 0x60, 0x41, 0x5E, 0xB4, 0x60, +0x42, 0x3C, 0x30, 0x60, 0x43, 0x3E, 0x96, 0x60, 0x44, 0x1C, 0x12, 0x60, 0x45, 0x1E, 0x78, 0x60, +0x45, 0xFB, 0xF4, 0x60, 0x46, 0xFE, 0x5A, 0x60, 0x47, 0xF7, 0x85, 0xE0, 0x48, 0xDE, 0x3C, 0x60, +0x49, 0xD7, 0x67, 0xE0, 0x4A, 0xBE, 0x1E, 0x60, 0x4B, 0xB7, 0x49, 0xE0, 0x4C, 0x9E, 0x00, 0x60, +0x4D, 0x97, 0x2B, 0xE0, 0x4E, 0x7D, 0xE2, 0x60, 0x4F, 0x77, 0x0D, 0xE0, 0x50, 0x66, 0xFE, 0xE0, +0x51, 0x60, 0x2A, 0x60, 0x52, 0x46, 0xE0, 0xE0, 0x53, 0x40, 0x0C, 0x60, 0x54, 0x26, 0xC2, 0xE0, +0x55, 0x1F, 0xEE, 0x60, 0x56, 0x06, 0xA4, 0xE0, 0x56, 0xFF, 0xD0, 0x60, 0x57, 0xE6, 0x86, 0xE0, +0x58, 0xDF, 0xB2, 0x60, 0x59, 0xC6, 0x68, 0xE0, 0x5A, 0xBF, 0x94, 0x60, 0x5B, 0xAF, 0x85, 0x60, +0x5C, 0xA8, 0xB0, 0xE0, 0x5D, 0x8F, 0x67, 0x60, 0x5E, 0x88, 0x92, 0xE0, 0x5F, 0x6F, 0x49, 0x60, +0x60, 0x68, 0x74, 0xE0, 0x61, 0x4F, 0x2B, 0x60, 0x62, 0x48, 0x56, 0xE0, 0x63, 0x2F, 0x0D, 0x60, +0x64, 0x28, 0x38, 0xE0, 0x65, 0x0E, 0xEF, 0x60, 0x66, 0x11, 0x55, 0x60, 0x66, 0xF8, 0x0B, 0xE0, +0x67, 0xF1, 0x37, 0x60, 0x68, 0xD7, 0xED, 0xE0, 0x69, 0xD1, 0x19, 0x60, 0x6A, 0xB7, 0xCF, 0xE0, +0x6B, 0xB0, 0xFB, 0x60, 0x6C, 0x97, 0xB1, 0xE0, 0x6D, 0x90, 0xDD, 0x60, 0x6E, 0x77, 0x93, 0xE0, +0x6F, 0x70, 0xBF, 0x60, 0x70, 0x60, 0xB0, 0x60, 0x71, 0x59, 0xDB, 0xE0, 0x72, 0x40, 0x92, 0x60, +0x73, 0x39, 0xBD, 0xE0, 0x74, 0x20, 0x74, 0x60, 0x75, 0x19, 0x9F, 0xE0, 0x76, 0x00, 0x56, 0x60, +0x76, 0xF9, 0x81, 0xE0, 0x77, 0xE0, 0x38, 0x60, 0x78, 0xD9, 0x63, 0xE0, 0x79, 0xC0, 0x1A, 0x60, +0x7A, 0xB9, 0x45, 0xE0, 0x7B, 0xA9, 0x36, 0xE0, 0x7C, 0xA2, 0x62, 0x60, 0x7D, 0x89, 0x18, 0xE0, +0x7E, 0x82, 0x44, 0x60, 0x7F, 0x68, 0xFA, 0xE0, 0x00, 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, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0xB6, 0xD0, 0x01, 0x04, 0x00, 0x00, 0xA8, 0xC0, 0x00, 0x09, 0x00, 0x00, -0xA8, 0xC0, 0x00, 0x09, 0x7A, 0x7A, 0x7A, 0x00, 0x4E, 0x5A, 0x44, 0x54, 0x00, 0x4E, 0x5A, 0x53, -0x54, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x12, -0xA8, 0x80, 0x00, 0x00, 0x00, 0x22, 0x41, 0x6D, 0x75, 0x6E, 0x64, 0x73, 0x65, 0x6E, 0x2D, 0x53, -0x63, 0x6F, 0x74, 0x74, 0x20, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x2C, 0x20, 0x53, 0x6F, -0x75, 0x74, 0x68, 0x20, 0x50, 0x6F, 0x6C, 0x65, +0x02, 0x01, 0x02, 0x05, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, +0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, +0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, +0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, +0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, +0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, +0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, +0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, +0x03, 0x04, 0x03, 0x00, 0x00, 0xAF, 0xC8, 0x01, 0x00, 0x00, 0x00, 0xA1, 0xB8, 0x00, 0x05, 0x00, +0x00, 0xA8, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xB6, 0xD0, 0x01, 0x0A, 0x00, 0x00, 0xA8, 0xC0, 0x00, +0x00, 0x00, 0x00, 0xA8, 0xC0, 0x00, 0x00, 0x4E, 0x5A, 0x53, 0x54, 0x00, 0x4E, 0x5A, 0x4D, 0x54, +0x00, 0x4E, 0x5A, 0x44, 0x54, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, 0x00, 0x00, 0x00, 0x00, /* Antarctica/Syowa */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x41, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -7535,8 +7552,8 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* Asia/Amman */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x4A, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0D, 0xB6, 0xA3, 0xD6, 0xD0, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x11, 0xB6, 0xA3, 0xD6, 0xD0, 0x06, 0x72, 0x79, 0xE0, 0x07, 0x0C, 0xAB, 0x50, 0x08, 0x24, 0x37, 0x60, 0x08, 0xED, 0xDE, 0xD0, 0x0A, 0x05, 0x6A, 0xE0, 0x0A, 0xCF, 0x12, 0x50, 0x0B, 0xE7, 0xEF, 0xE0, 0x0C, 0xDA, 0x75, 0xD0, 0x0D, 0xC9, 0x23, 0x60, 0x0E, 0x92, 0xCA, 0xD0, 0x0F, 0xA9, 0x05, 0x60, 0x10, 0x72, 0xAC, 0xD0, @@ -7553,31 +7570,17 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x42, 0x4C, 0x72, 0xE0, 0x43, 0x3C, 0x63, 0xE0, 0x44, 0x2C, 0x54, 0xE0, 0x45, 0x41, 0x2F, 0xE0, 0x46, 0x0C, 0x36, 0xE0, 0x47, 0x21, 0x11, 0xE0, 0x47, 0xEC, 0x18, 0xE0, 0x49, 0x0A, 0x2E, 0x60, 0x49, 0xCB, 0xFA, 0xE0, 0x4A, 0xEA, 0x10, 0x60, 0x4B, 0xAB, 0xDC, 0xE0, 0x4C, 0xC9, 0xF2, 0x60, -0x4D, 0x94, 0xF9, 0x60, 0x4E, 0xA9, 0xD4, 0x60, 0x4F, 0x74, 0xDB, 0x60, 0x52, 0x69, 0x98, 0x60, -0x53, 0x34, 0x9F, 0x60, 0x54, 0x52, 0xB4, 0xE0, 0x55, 0x14, 0x81, 0x60, 0x56, 0x32, 0x96, 0xE0, -0x56, 0xFD, 0x9D, 0xE0, 0x58, 0x12, 0x78, 0xE0, 0x58, 0xDD, 0x7F, 0xE0, 0x59, 0xF2, 0x5A, 0xE0, -0x5A, 0xBD, 0x61, 0xE0, 0x5B, 0xD2, 0x3C, 0xE0, 0x5C, 0x9D, 0x43, 0xE0, 0x5D, 0xB2, 0x1E, 0xE0, -0x5E, 0x7D, 0x25, 0xE0, 0x5F, 0x9B, 0x3B, 0x60, 0x60, 0x5D, 0x07, 0xE0, 0x61, 0x7B, 0x1D, 0x60, -0x62, 0x46, 0x24, 0x60, 0x63, 0x5A, 0xFF, 0x60, 0x64, 0x26, 0x06, 0x60, 0x65, 0x3A, 0xE1, 0x60, -0x66, 0x05, 0xE8, 0x60, 0x67, 0x1A, 0xC3, 0x60, 0x67, 0xE5, 0xCA, 0x60, 0x69, 0x03, 0xDF, 0xE0, -0x69, 0xC5, 0xAC, 0x60, 0x6A, 0xE3, 0xC1, 0xE0, 0x6B, 0xA5, 0x8E, 0x60, 0x6C, 0xC3, 0xA3, 0xE0, -0x6D, 0x8E, 0xAA, 0xE0, 0x6E, 0xA3, 0x85, 0xE0, 0x6F, 0x6E, 0x8C, 0xE0, 0x70, 0x83, 0x67, 0xE0, -0x71, 0x4E, 0x6E, 0xE0, 0x72, 0x63, 0x49, 0xE0, 0x73, 0x2E, 0x50, 0xE0, 0x74, 0x4C, 0x66, 0x60, -0x75, 0x0E, 0x32, 0xE0, 0x76, 0x2C, 0x48, 0x60, 0x76, 0xF7, 0x4F, 0x60, 0x78, 0x0C, 0x2A, 0x60, -0x78, 0xD7, 0x31, 0x60, 0x79, 0xEC, 0x0C, 0x60, 0x7A, 0xB7, 0x13, 0x60, 0x7B, 0xCB, 0xEE, 0x60, -0x7C, 0x96, 0xF5, 0x60, 0x7D, 0xB5, 0x0A, 0xE0, 0x7E, 0x76, 0xD7, 0x60, 0x7F, 0x94, 0xEC, 0xE0, +0x4D, 0x94, 0xF9, 0x60, 0x4E, 0xA9, 0xD4, 0x60, 0x4F, 0x74, 0xDB, 0x60, 0x50, 0x89, 0xB6, 0x60, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, -0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, -0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, -0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, -0x03, 0x01, 0x03, 0x01, 0x03, 0x00, 0x00, 0x21, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x01, +0x03, 0x01, 0x03, 0x01, 0x05, 0x00, 0x00, 0x21, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x04, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x09, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x09, 0x00, 0x00, 0x2A, -0x30, 0x01, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x45, 0x45, 0x53, 0x54, 0x00, 0x45, 0x45, 0x54, 0x00, -0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBA, 0x14, 0xB8, 0x01, 0x49, -0x7C, 0xF5, 0x00, 0x00, 0x00, 0x00, +0x30, 0x01, 0x04, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x0D, 0x4C, 0x4D, 0x54, 0x00, 0x45, 0x45, 0x53, +0x54, 0x00, 0x45, 0x45, 0x54, 0x00, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBA, 0x14, 0xB8, 0x01, 0x49, 0x7C, 0xF5, 0x00, 0x00, +0x00, 0x00, /* Asia/Anadyr */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x52, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -8060,13 +8063,13 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* Asia/Dili */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x54, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x10, 0x92, 0xE6, 0x18, 0xC4, +0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x11, 0x92, 0xE6, 0x18, 0xC4, 0xCB, 0x99, 0x32, 0xF0, 0xD2, 0x56, 0xEE, 0x70, 0x0B, 0xEA, 0x30, 0x70, 0x39, 0xC3, 0x99, 0x00, 0x01, 0x02, 0x03, 0x04, 0x03, 0x00, 0x00, 0x75, 0xBC, 0x00, 0x00, 0x00, 0x00, 0x70, 0x80, 0x00, 0x04, 0x00, 0x00, 0x7E, 0x90, 0x00, 0x08, 0x00, 0x00, 0x7E, 0x90, 0x00, 0x04, 0x00, 0x00, 0x70, -0x80, 0x00, 0x0C, 0x4C, 0x4D, 0x54, 0x00, 0x54, 0x4C, 0x54, 0x00, 0x4A, 0x53, 0x54, 0x00, 0x43, -0x49, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x48, -0x68, 0x01, 0xD2, 0x48, 0x7D, 0x00, 0x00, 0x00, 0x00, +0x80, 0x00, 0x0C, 0x4C, 0x4D, 0x54, 0x00, 0x54, 0x4C, 0x54, 0x00, 0x4A, 0x53, 0x54, 0x00, 0x57, +0x49, 0x54, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, +0x48, 0x68, 0x01, 0xD2, 0x48, 0x7D, 0x00, 0x00, 0x00, 0x00, /* Asia/Dubai */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x41, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -8122,19 +8125,19 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x45, 0x12, 0xFD, 0x50, 0x46, 0x0E, 0xD9, 0xE0, 0x46, 0xE8, 0x6F, 0x70, 0x47, 0xEC, 0x18, 0xE0, 0x48, 0xB7, 0x11, 0xD0, 0x49, 0xCB, 0xFA, 0xE0, 0x4A, 0xA0, 0x3C, 0x60, 0x4B, 0xAD, 0x2E, 0x9C, 0x4C, 0x61, 0xBD, 0xD0, 0x4D, 0x94, 0xF9, 0x9C, 0x4E, 0x35, 0xC2, 0x50, 0x4F, 0x74, 0xDB, 0x60, -0x50, 0x5B, 0x91, 0xE0, 0x51, 0x54, 0xBD, 0x60, 0x52, 0x44, 0xAE, 0x60, 0x53, 0x34, 0x9F, 0x60, -0x54, 0x24, 0x90, 0x60, 0x55, 0x14, 0x81, 0x60, 0x56, 0x04, 0x72, 0x60, 0x56, 0xFD, 0x9D, 0xE0, -0x57, 0xE4, 0x54, 0x60, 0x58, 0xDD, 0x7F, 0xE0, 0x59, 0xC4, 0x36, 0x60, 0x5A, 0xBD, 0x61, 0xE0, -0x5B, 0xA4, 0x18, 0x60, 0x5C, 0x9D, 0x43, 0xE0, 0x5D, 0x8D, 0x34, 0xE0, 0x5E, 0x7D, 0x25, 0xE0, -0x5F, 0x6D, 0x16, 0xE0, 0x60, 0x5D, 0x07, 0xE0, 0x61, 0x4C, 0xF8, 0xE0, 0x62, 0x46, 0x24, 0x60, -0x63, 0x2C, 0xDA, 0xE0, 0x64, 0x26, 0x06, 0x60, 0x65, 0x0C, 0xBC, 0xE0, 0x66, 0x05, 0xE8, 0x60, -0x66, 0xF5, 0xD9, 0x60, 0x67, 0xE5, 0xCA, 0x60, 0x68, 0xD5, 0xBB, 0x60, 0x69, 0xC5, 0xAC, 0x60, -0x6A, 0xB5, 0x9D, 0x60, 0x6B, 0xA5, 0x8E, 0x60, 0x6C, 0x95, 0x7F, 0x60, 0x6D, 0x8E, 0xAA, 0xE0, -0x6E, 0x75, 0x61, 0x60, 0x6F, 0x6E, 0x8C, 0xE0, 0x70, 0x55, 0x43, 0x60, 0x71, 0x4E, 0x6E, 0xE0, -0x72, 0x3E, 0x5F, 0xE0, 0x73, 0x2E, 0x50, 0xE0, 0x74, 0x1E, 0x41, 0xE0, 0x75, 0x0E, 0x32, 0xE0, -0x75, 0xFE, 0x23, 0xE0, 0x76, 0xF7, 0x4F, 0x60, 0x77, 0xDE, 0x05, 0xE0, 0x78, 0xD7, 0x31, 0x60, -0x79, 0xBD, 0xE7, 0xE0, 0x7A, 0xB7, 0x13, 0x60, 0x7B, 0x9D, 0xC9, 0xE0, 0x7C, 0x96, 0xF5, 0x60, -0x7D, 0x86, 0xE6, 0x60, 0x7E, 0x76, 0xD7, 0x60, 0x7F, 0x66, 0xC8, 0x60, 0x00, 0x01, 0x00, 0x01, +0x50, 0x5B, 0x91, 0xE0, 0x51, 0x54, 0xBD, 0x60, 0x52, 0x44, 0xA0, 0x50, 0x53, 0x34, 0x9F, 0x60, +0x54, 0x24, 0x82, 0x50, 0x55, 0x14, 0x81, 0x60, 0x56, 0x04, 0x64, 0x50, 0x56, 0xFD, 0x9D, 0xE0, +0x57, 0xE4, 0x46, 0x50, 0x58, 0xDD, 0x7F, 0xE0, 0x59, 0xC4, 0x28, 0x50, 0x5A, 0xBD, 0x61, 0xE0, +0x5B, 0xA4, 0x0A, 0x50, 0x5C, 0x9D, 0x43, 0xE0, 0x5D, 0x8D, 0x26, 0xD0, 0x5E, 0x7D, 0x25, 0xE0, +0x5F, 0x6D, 0x08, 0xD0, 0x60, 0x5D, 0x07, 0xE0, 0x61, 0x4C, 0xEA, 0xD0, 0x62, 0x46, 0x24, 0x60, +0x63, 0x2C, 0xCC, 0xD0, 0x64, 0x26, 0x06, 0x60, 0x65, 0x0C, 0xAE, 0xD0, 0x66, 0x05, 0xE8, 0x60, +0x66, 0xF5, 0xCB, 0x50, 0x67, 0xE5, 0xCA, 0x60, 0x68, 0xD5, 0xAD, 0x50, 0x69, 0xC5, 0xAC, 0x60, +0x6A, 0xB5, 0x8F, 0x50, 0x6B, 0xA5, 0x8E, 0x60, 0x6C, 0x95, 0x71, 0x50, 0x6D, 0x8E, 0xAA, 0xE0, +0x6E, 0x75, 0x53, 0x50, 0x6F, 0x6E, 0x8C, 0xE0, 0x70, 0x55, 0x35, 0x50, 0x71, 0x4E, 0x6E, 0xE0, +0x72, 0x3E, 0x51, 0xD0, 0x73, 0x2E, 0x50, 0xE0, 0x74, 0x1E, 0x33, 0xD0, 0x75, 0x0E, 0x32, 0xE0, +0x75, 0xFE, 0x15, 0xD0, 0x76, 0xF7, 0x4F, 0x60, 0x77, 0xDD, 0xF7, 0xD0, 0x78, 0xD7, 0x31, 0x60, +0x79, 0xBD, 0xD9, 0xD0, 0x7A, 0xB7, 0x13, 0x60, 0x7B, 0x9D, 0xBB, 0xD0, 0x7C, 0x96, 0xF5, 0x60, +0x7D, 0x86, 0xD8, 0x50, 0x7E, 0x76, 0xD7, 0x60, 0x7F, 0x66, 0xBA, 0x50, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, @@ -8196,19 +8199,19 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x48, 0xBB, 0x06, 0x50, 0x49, 0xCB, 0xFA, 0xE0, 0x4A, 0xA0, 0x3C, 0x60, 0x4B, 0xAB, 0xDC, 0xE0, 0x4C, 0x61, 0xBD, 0xD0, 0x4D, 0x94, 0xF9, 0x9C, 0x4E, 0x35, 0xC2, 0x50, 0x4E, 0x5C, 0x0B, 0xE0, 0x4E, 0x84, 0xDC, 0x50, 0x4F, 0x74, 0xDB, 0x60, 0x50, 0x5B, 0x91, 0xE0, 0x51, 0x54, 0xBD, 0x60, -0x52, 0x44, 0xAE, 0x60, 0x53, 0x34, 0x9F, 0x60, 0x54, 0x24, 0x90, 0x60, 0x55, 0x14, 0x81, 0x60, -0x56, 0x04, 0x72, 0x60, 0x56, 0xFD, 0x9D, 0xE0, 0x57, 0xE4, 0x54, 0x60, 0x58, 0xDD, 0x7F, 0xE0, -0x59, 0xC4, 0x36, 0x60, 0x5A, 0xBD, 0x61, 0xE0, 0x5B, 0xA4, 0x18, 0x60, 0x5C, 0x9D, 0x43, 0xE0, -0x5D, 0x8D, 0x34, 0xE0, 0x5E, 0x7D, 0x25, 0xE0, 0x5F, 0x6D, 0x16, 0xE0, 0x60, 0x5D, 0x07, 0xE0, -0x61, 0x4C, 0xF8, 0xE0, 0x62, 0x46, 0x24, 0x60, 0x63, 0x2C, 0xDA, 0xE0, 0x64, 0x26, 0x06, 0x60, -0x65, 0x0C, 0xBC, 0xE0, 0x66, 0x05, 0xE8, 0x60, 0x66, 0xF5, 0xD9, 0x60, 0x67, 0xE5, 0xCA, 0x60, -0x68, 0xD5, 0xBB, 0x60, 0x69, 0xC5, 0xAC, 0x60, 0x6A, 0xB5, 0x9D, 0x60, 0x6B, 0xA5, 0x8E, 0x60, -0x6C, 0x95, 0x7F, 0x60, 0x6D, 0x8E, 0xAA, 0xE0, 0x6E, 0x75, 0x61, 0x60, 0x6F, 0x6E, 0x8C, 0xE0, -0x70, 0x55, 0x43, 0x60, 0x71, 0x4E, 0x6E, 0xE0, 0x72, 0x3E, 0x5F, 0xE0, 0x73, 0x2E, 0x50, 0xE0, -0x74, 0x1E, 0x41, 0xE0, 0x75, 0x0E, 0x32, 0xE0, 0x75, 0xFE, 0x23, 0xE0, 0x76, 0xF7, 0x4F, 0x60, -0x77, 0xDE, 0x05, 0xE0, 0x78, 0xD7, 0x31, 0x60, 0x79, 0xBD, 0xE7, 0xE0, 0x7A, 0xB7, 0x13, 0x60, -0x7B, 0x9D, 0xC9, 0xE0, 0x7C, 0x96, 0xF5, 0x60, 0x7D, 0x86, 0xE6, 0x60, 0x7E, 0x76, 0xD7, 0x60, -0x7F, 0x66, 0xC8, 0x60, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x02, 0x01, +0x52, 0x44, 0xA0, 0x50, 0x53, 0x34, 0x9F, 0x60, 0x54, 0x24, 0x82, 0x50, 0x55, 0x14, 0x81, 0x60, +0x56, 0x04, 0x64, 0x50, 0x56, 0xFD, 0x9D, 0xE0, 0x57, 0xE4, 0x46, 0x50, 0x58, 0xDD, 0x7F, 0xE0, +0x59, 0xC4, 0x28, 0x50, 0x5A, 0xBD, 0x61, 0xE0, 0x5B, 0xA4, 0x0A, 0x50, 0x5C, 0x9D, 0x43, 0xE0, +0x5D, 0x8D, 0x26, 0xD0, 0x5E, 0x7D, 0x25, 0xE0, 0x5F, 0x6D, 0x08, 0xD0, 0x60, 0x5D, 0x07, 0xE0, +0x61, 0x4C, 0xEA, 0xD0, 0x62, 0x46, 0x24, 0x60, 0x63, 0x2C, 0xCC, 0xD0, 0x64, 0x26, 0x06, 0x60, +0x65, 0x0C, 0xAE, 0xD0, 0x66, 0x05, 0xE8, 0x60, 0x66, 0xF5, 0xCB, 0x50, 0x67, 0xE5, 0xCA, 0x60, +0x68, 0xD5, 0xAD, 0x50, 0x69, 0xC5, 0xAC, 0x60, 0x6A, 0xB5, 0x8F, 0x50, 0x6B, 0xA5, 0x8E, 0x60, +0x6C, 0x95, 0x71, 0x50, 0x6D, 0x8E, 0xAA, 0xE0, 0x6E, 0x75, 0x53, 0x50, 0x6F, 0x6E, 0x8C, 0xE0, +0x70, 0x55, 0x35, 0x50, 0x71, 0x4E, 0x6E, 0xE0, 0x72, 0x3E, 0x51, 0xD0, 0x73, 0x2E, 0x50, 0xE0, +0x74, 0x1E, 0x33, 0xD0, 0x75, 0x0E, 0x32, 0xE0, 0x75, 0xFE, 0x15, 0xD0, 0x76, 0xF7, 0x4F, 0x60, +0x77, 0xDD, 0xF7, 0xD0, 0x78, 0xD7, 0x31, 0x60, 0x79, 0xBD, 0xD9, 0xD0, 0x7A, 0xB7, 0x13, 0x60, +0x7B, 0x9D, 0xBB, 0xD0, 0x7C, 0x96, 0xF5, 0x60, 0x7D, 0x86, 0xD8, 0x50, 0x7E, 0x76, 0xD7, 0x60, +0x7F, 0x66, 0xBA, 0x50, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x01, 0x02, @@ -8397,7 +8400,7 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0xDA, 0xFF, 0x26, 0x00, 0xF4, 0xB5, 0xBE, 0x88, 0x01, 0x02, 0x03, 0x02, 0x04, 0x02, 0x05, 0x00, 0x00, 0x64, 0x20, 0x00, 0x00, 0x00, 0x00, 0x67, 0x20, 0x00, 0x04, 0x00, 0x00, 0x69, 0x78, 0x00, 0x09, 0x00, 0x00, 0x7E, 0x90, 0x00, 0x0D, 0x00, 0x00, 0x70, 0x80, 0x00, 0x09, 0x00, 0x00, 0x62, -0x70, 0x00, 0x09, 0x4A, 0x4D, 0x54, 0x00, 0x4A, 0x41, 0x56, 0x54, 0x00, 0x57, 0x49, 0x54, 0x00, +0x70, 0x00, 0x09, 0x42, 0x4D, 0x54, 0x00, 0x4A, 0x41, 0x56, 0x54, 0x00, 0x57, 0x49, 0x42, 0x00, 0x4A, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xEB, 0x65, 0x01, 0xB5, 0x9F, 0x40, 0x00, 0x00, 0x00, 0x0E, 0x4A, 0x61, 0x76, 0x61, 0x20, 0x26, 0x20, 0x53, 0x75, 0x6D, 0x61, 0x74, 0x72, 0x61, @@ -8408,7 +8411,7 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0xBA, 0x16, 0xC1, 0x98, 0xD0, 0x58, 0xB9, 0xF0, 0xF4, 0xB5, 0xA2, 0x68, 0x01, 0x02, 0x01, 0x00, 0x00, 0x83, 0xE8, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x90, 0x00, 0x04, 0x00, 0x00, 0x85, 0x98, 0x00, 0x08, 0x4C, 0x4D, 0x54, -0x00, 0x45, 0x49, 0x54, 0x00, 0x43, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x57, 0x49, 0x54, 0x00, 0x43, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x76, 0xAA, 0x01, 0xE9, 0x59, 0x70, 0x00, 0x00, 0x00, 0x31, 0x77, 0x65, 0x73, 0x74, 0x20, 0x4E, 0x65, 0x77, 0x20, 0x47, 0x75, 0x69, 0x6E, 0x65, 0x61, 0x20, 0x28, 0x49, 0x72, 0x69, 0x61, 0x6E, 0x20, 0x4A, 0x61, 0x79, 0x61, 0x29, 0x20, 0x26, 0x20, 0x4D, 0x61, 0x6C, 0x75, 0x6B, 0x75, @@ -8754,17 +8757,17 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* Asia/Makassar */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x49, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0xA1, 0xF2, 0x5D, 0x90, +0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x11, 0xA1, 0xF2, 0x5D, 0x90, 0xBA, 0x16, 0xD5, 0x90, 0xCB, 0x88, 0x1D, 0x80, 0xD2, 0x56, 0xEE, 0x70, 0x01, 0x02, 0x03, 0x02, 0x00, 0x00, 0x6F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x6F, 0xF0, 0x00, 0x04, 0x00, 0x00, 0x70, 0x80, -0x00, 0x08, 0x00, 0x00, 0x7E, 0x90, 0x00, 0x0C, 0x4C, 0x4D, 0x54, 0x00, 0x4D, 0x4D, 0x54, 0x00, -0x43, 0x49, 0x54, 0x00, 0x4A, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x81, 0x85, 0x8D, 0x01, 0xC8, 0xD9, 0x1F, 0x00, 0x00, 0x00, 0x48, 0x65, 0x61, 0x73, 0x74, -0x20, 0x26, 0x20, 0x73, 0x6F, 0x75, 0x74, 0x68, 0x20, 0x42, 0x6F, 0x72, 0x6E, 0x65, 0x6F, 0x2C, -0x20, 0x53, 0x75, 0x6C, 0x61, 0x77, 0x65, 0x73, 0x69, 0x20, 0x28, 0x43, 0x65, 0x6C, 0x65, 0x62, -0x65, 0x73, 0x29, 0x2C, 0x20, 0x42, 0x61, 0x6C, 0x69, 0x2C, 0x20, 0x4E, 0x75, 0x73, 0x61, 0x20, -0x54, 0x65, 0x6E, 0x67, 0x61, 0x72, 0x72, 0x61, 0x2C, 0x20, 0x77, 0x65, 0x73, 0x74, 0x20, 0x54, -0x69, 0x6D, 0x6F, 0x72, +0x00, 0x08, 0x00, 0x00, 0x7E, 0x90, 0x00, 0x0D, 0x4C, 0x4D, 0x54, 0x00, 0x4D, 0x4D, 0x54, 0x00, +0x57, 0x49, 0x54, 0x41, 0x00, 0x4A, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x81, 0x85, 0x8D, 0x01, 0xC8, 0xD9, 0x1F, 0x00, 0x00, 0x00, 0x48, 0x65, 0x61, 0x73, +0x74, 0x20, 0x26, 0x20, 0x73, 0x6F, 0x75, 0x74, 0x68, 0x20, 0x42, 0x6F, 0x72, 0x6E, 0x65, 0x6F, +0x2C, 0x20, 0x53, 0x75, 0x6C, 0x61, 0x77, 0x65, 0x73, 0x69, 0x20, 0x28, 0x43, 0x65, 0x6C, 0x65, +0x62, 0x65, 0x73, 0x29, 0x2C, 0x20, 0x42, 0x61, 0x6C, 0x69, 0x2C, 0x20, 0x4E, 0x75, 0x73, 0x61, +0x20, 0x54, 0x65, 0x6E, 0x67, 0x61, 0x72, 0x72, 0x61, 0x2C, 0x20, 0x77, 0x65, 0x73, 0x74, 0x20, +0x54, 0x69, 0x6D, 0x6F, 0x72, /* Asia/Manila */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x50, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -8980,17 +8983,17 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* Asia/Pontianak */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x49, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x14, 0x8B, 0xFF, 0x8E, 0x00, +0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x15, 0x8B, 0xFF, 0x8E, 0x00, 0xBA, 0x16, 0xDF, 0x00, 0xCB, 0x79, 0xA4, 0x08, 0xD2, 0x56, 0xEE, 0x70, 0xD7, 0x3C, 0xC6, 0x08, 0xDA, 0xFF, 0x26, 0x00, 0xF4, 0xB5, 0xBE, 0x88, 0x21, 0xDA, 0x74, 0x80, 0x01, 0x02, 0x03, 0x02, 0x04, 0x02, 0x05, 0x06, 0x00, 0x00, 0x66, 0x80, 0x00, 0x00, 0x00, 0x00, 0x66, 0x80, 0x00, 0x04, 0x00, 0x00, 0x69, 0x78, 0x00, 0x08, 0x00, 0x00, 0x7E, 0x90, 0x00, 0x0C, 0x00, 0x00, 0x70, 0x80, 0x00, 0x08, 0x00, 0x00, 0x70, 0x80, 0x00, 0x10, 0x00, 0x00, 0x62, 0x70, 0x00, 0x08, 0x4C, 0x4D, -0x54, 0x00, 0x50, 0x4D, 0x54, 0x00, 0x57, 0x49, 0x54, 0x00, 0x4A, 0x53, 0x54, 0x00, 0x43, 0x49, -0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x89, 0x47, 0x3A, 0x01, 0xB9, 0x7C, 0xD5, 0x00, 0x00, 0x00, 0x15, 0x77, 0x65, 0x73, 0x74, -0x20, 0x26, 0x20, 0x63, 0x65, 0x6E, 0x74, 0x72, 0x61, 0x6C, 0x20, 0x42, 0x6F, 0x72, 0x6E, 0x65, -0x6F, +0x54, 0x00, 0x50, 0x4D, 0x54, 0x00, 0x57, 0x49, 0x42, 0x00, 0x4A, 0x53, 0x54, 0x00, 0x57, 0x49, +0x54, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x89, 0x47, 0x3A, 0x01, 0xB9, 0x7C, 0xD5, 0x00, 0x00, 0x00, 0x15, 0x77, 0x65, 0x73, +0x74, 0x20, 0x26, 0x20, 0x63, 0x65, 0x6E, 0x74, 0x72, 0x61, 0x6C, 0x20, 0x42, 0x6F, 0x72, 0x6E, +0x65, 0x6F, /* Asia/Pyongyang */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x4B, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -9368,12 +9371,12 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* Asia/Ujung_Pandang */ 0x50, 0x48, 0x50, 0x31, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0xA1, 0xF2, 0x5D, 0x90, +0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x11, 0xA1, 0xF2, 0x5D, 0x90, 0xBA, 0x16, 0xD5, 0x90, 0xCB, 0x88, 0x1D, 0x80, 0xD2, 0x56, 0xEE, 0x70, 0x01, 0x02, 0x03, 0x02, 0x00, 0x00, 0x6F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x6F, 0xF0, 0x00, 0x04, 0x00, 0x00, 0x70, 0x80, -0x00, 0x08, 0x00, 0x00, 0x7E, 0x90, 0x00, 0x0C, 0x4C, 0x4D, 0x54, 0x00, 0x4D, 0x4D, 0x54, 0x00, -0x43, 0x49, 0x54, 0x00, 0x4A, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, 0x00, 0x00, 0x00, 0x00, +0x00, 0x08, 0x00, 0x00, 0x7E, 0x90, 0x00, 0x0D, 0x4C, 0x4D, 0x54, 0x00, 0x4D, 0x4D, 0x54, 0x00, +0x57, 0x49, 0x54, 0x41, 0x00, 0x4A, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, 0x00, 0x00, 0x00, 0x00, /* Asia/Ulaanbaatar */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x4D, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -11007,7 +11010,7 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* Brazil/Acre */ 0x50, 0x48, 0x50, 0x31, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x11, 0x96, 0xAA, 0x86, 0x90, +0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x11, 0x96, 0xAA, 0x86, 0x90, 0xB8, 0x0F, 0x66, 0x00, 0xB8, 0xFD, 0x5C, 0xC0, 0xB9, 0xF1, 0x50, 0x50, 0xBA, 0xDE, 0x90, 0x40, 0xDA, 0x38, 0xCA, 0x50, 0xDA, 0xEC, 0x16, 0x50, 0xDC, 0x19, 0xFD, 0xD0, 0xDC, 0xB9, 0x75, 0x40, 0xDD, 0xFB, 0x31, 0x50, 0xDE, 0x9B, 0xFA, 0x40, 0xDF, 0xDD, 0xB6, 0x50, 0xE0, 0x54, 0x4F, 0x40, @@ -11015,12 +11018,13 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0xF8, 0x51, 0x48, 0x50, 0xF8, 0xC7, 0xE1, 0x40, 0xFA, 0x0A, 0xEE, 0xD0, 0xFA, 0xA9, 0x14, 0xC0, 0xFB, 0xEC, 0x22, 0x50, 0xFC, 0x8B, 0x99, 0xC0, 0x1D, 0xC9, 0xAA, 0x50, 0x1E, 0x78, 0xF3, 0xC0, 0x1F, 0xA0, 0x51, 0xD0, 0x20, 0x33, 0xEB, 0xC0, 0x21, 0x81, 0x85, 0x50, 0x22, 0x0B, 0xE4, 0xC0, -0x48, 0x60, 0x7F, 0x50, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x48, 0x60, 0x7F, 0x50, 0x52, 0x7F, 0x04, 0xC0, 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, 0x03, 0xFF, 0xFF, 0xC0, 0x70, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x04, 0xFF, 0xFF, -0xB9, 0xB0, 0x00, 0x09, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x43, -0x53, 0x54, 0x00, 0x41, 0x43, 0x54, 0x00, 0x41, 0x4D, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, 0x00, 0x00, 0x00, 0x00, +0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x02, 0xFF, 0xFF, 0xC0, 0x70, 0x00, 0x00, 0xFF, 0xFF, 0xC7, +0xC0, 0x01, 0x04, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x09, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0x4C, +0x4D, 0x54, 0x00, 0x41, 0x43, 0x53, 0x54, 0x00, 0x41, 0x43, 0x54, 0x00, 0x41, 0x4D, 0x54, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, +0x00, 0x00, 0x00, 0x00, /* Brazil/DeNoronha */ 0x50, 0x48, 0x50, 0x31, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -15346,8 +15350,9 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* Europe/Vaduz */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x4C, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x09, 0x15, 0x23, 0xEB, 0x90, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x09, 0xCA, 0x17, 0x6A, 0x00, +0xCA, 0xE2, 0x71, 0x00, 0xCB, 0xF7, 0x4C, 0x00, 0xCC, 0xC2, 0x53, 0x00, 0x15, 0x23, 0xEB, 0x90, 0x16, 0x13, 0xDC, 0x90, 0x17, 0x03, 0xCD, 0x90, 0x17, 0xF3, 0xBE, 0x90, 0x18, 0xE3, 0xAF, 0x90, 0x19, 0xD3, 0xA0, 0x90, 0x1A, 0xC3, 0x91, 0x90, 0x1B, 0xBC, 0xBD, 0x10, 0x1C, 0xAC, 0xAE, 0x10, 0x1D, 0x9C, 0x9F, 0x10, 0x1E, 0x8C, 0x90, 0x10, 0x1F, 0x7C, 0x81, 0x10, 0x20, 0x6C, 0x72, 0x10, @@ -15376,17 +15381,17 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 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, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, -0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, -0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, -0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, -0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, -0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, -0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, -0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, -0x01, 0x04, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x00, 0x43, 0x45, 0x54, 0x00, 0x43, 0x45, 0x53, 0x54, -0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0xD1, 0x46, 0x38, 0x01, 0x21, 0x2D, 0xF2, 0x00, -0x00, 0x00, 0x00, +0x7F, 0x8E, 0x7F, 0x90, 0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, +0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, +0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, +0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, +0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, +0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, +0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, +0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x00, 0x00, 0x1C, 0x20, 0x01, 0x00, +0x00, 0x00, 0x0E, 0x10, 0x00, 0x05, 0x00, 0x00, 0x1C, 0x20, 0x01, 0x00, 0x00, 0x00, 0x0E, 0x10, +0x00, 0x05, 0x43, 0x45, 0x53, 0x54, 0x00, 0x43, 0x45, 0x54, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, +0x00, 0x01, 0x01, 0x00, 0xD1, 0x46, 0x38, 0x01, 0x21, 0x2D, 0xF2, 0x00, 0x00, 0x00, 0x00, /* Europe/Vatican */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x56, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -16278,14 +16283,14 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* Jamaica */ 0x50, 0x48, 0x50, 0x31, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x93, 0x0F, 0xB5, 0x00, +0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x93, 0x0F, 0xB4, 0xFF, 0x08, 0x20, 0xC1, 0x70, 0x09, 0x10, 0xA4, 0x60, 0x09, 0xAD, 0x94, 0xF0, 0x0A, 0xF0, 0x86, 0x60, 0x0B, 0xE0, 0x85, 0x70, 0x0C, 0xD9, 0xA2, 0xE0, 0x0D, 0xC0, 0x67, 0x70, 0x0E, 0xB9, 0x84, 0xE0, 0x0F, 0xA9, 0x83, 0xF0, 0x10, 0x99, 0x66, 0xE0, 0x11, 0x89, 0x65, 0xF0, 0x12, 0x79, 0x48, 0xE0, 0x13, 0x69, 0x47, 0xF0, 0x14, 0x59, 0x2A, 0xE0, 0x15, 0x49, 0x29, 0xF0, 0x16, 0x39, 0x0C, 0xE0, 0x17, 0x29, 0x0B, 0xF0, 0x18, 0x22, 0x29, 0x60, 0x19, 0x08, 0xED, 0xF0, 0x1A, 0x02, 0x0B, 0x60, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, -0x01, 0x02, 0x01, 0x02, 0x01, 0xFF, 0xFF, 0xB8, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, +0x01, 0x02, 0x01, 0x02, 0x01, 0xFF, 0xFF, 0xB8, 0x01, 0x00, 0x00, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x08, 0x4B, 0x4D, 0x54, 0x00, 0x45, 0x53, 0x54, 0x00, 0x45, 0x44, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, 0x00, 0x00, 0x00, 0x00, @@ -16313,7 +16318,7 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* Libya */ 0x50, 0x48, 0x50, 0x31, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x11, 0xA1, 0xF2, 0xC1, 0x24, +0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x11, 0xA1, 0xF2, 0xC1, 0x24, 0xDD, 0xBB, 0xB1, 0x10, 0xDE, 0x23, 0xAD, 0x60, 0xE1, 0x78, 0xD2, 0x10, 0xE1, 0xE7, 0x65, 0xE0, 0xE5, 0x2F, 0x3F, 0x70, 0xE5, 0xA9, 0xCC, 0xE0, 0xEB, 0x4E, 0xC6, 0xF0, 0x16, 0x92, 0x42, 0x60, 0x17, 0x08, 0xF7, 0x70, 0x17, 0xFA, 0x2B, 0xE0, 0x18, 0xEA, 0x2A, 0xF0, 0x19, 0xDB, 0x5F, 0x60, @@ -16321,24 +16326,9 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x1E, 0x93, 0x0B, 0x70, 0x1F, 0x82, 0xEE, 0x60, 0x20, 0x70, 0x4A, 0x70, 0x21, 0x61, 0x7E, 0xE0, 0x22, 0x52, 0xCF, 0x70, 0x23, 0x44, 0x03, 0xE0, 0x24, 0x34, 0x02, 0xF0, 0x25, 0x25, 0x37, 0x60, 0x26, 0x40, 0xB7, 0xF0, 0x32, 0x4E, 0xF1, 0x60, 0x33, 0x44, 0x36, 0x70, 0x34, 0x35, 0x6A, 0xE0, -0x50, 0x9D, 0x99, 0x00, 0x51, 0x54, 0xD9, 0x80, 0x52, 0x69, 0xB4, 0x80, 0x53, 0x34, 0xBB, 0x80, -0x54, 0x52, 0xD1, 0x00, 0x55, 0x14, 0x9D, 0x80, 0x56, 0x32, 0xB3, 0x00, 0x56, 0xF4, 0x7F, 0x80, -0x58, 0x12, 0x95, 0x00, 0x58, 0xDD, 0x9C, 0x00, 0x59, 0xF2, 0x77, 0x00, 0x5A, 0xBD, 0x7E, 0x00, -0x5B, 0xD2, 0x59, 0x00, 0x5C, 0x9D, 0x60, 0x00, 0x5D, 0xB2, 0x3B, 0x00, 0x5E, 0x7D, 0x42, 0x00, -0x5F, 0x9B, 0x57, 0x80, 0x60, 0x5D, 0x24, 0x00, 0x61, 0x7B, 0x39, 0x80, 0x62, 0x3D, 0x06, 0x00, -0x63, 0x5B, 0x1B, 0x80, 0x64, 0x26, 0x22, 0x80, 0x65, 0x3A, 0xFD, 0x80, 0x66, 0x06, 0x04, 0x80, -0x67, 0x1A, 0xDF, 0x80, 0x67, 0xE5, 0xE6, 0x80, 0x69, 0x03, 0xFC, 0x00, 0x69, 0xC5, 0xC8, 0x80, -0x6A, 0xE3, 0xDE, 0x00, 0x6B, 0xA5, 0xAA, 0x80, 0x6C, 0xC3, 0xC0, 0x00, 0x6D, 0x8E, 0xC7, 0x00, -0x6E, 0xA3, 0xA2, 0x00, 0x6F, 0x6E, 0xA9, 0x00, 0x70, 0x83, 0x84, 0x00, 0x71, 0x4E, 0x8B, 0x00, -0x72, 0x63, 0x66, 0x00, 0x73, 0x2E, 0x6D, 0x00, 0x74, 0x4C, 0x82, 0x80, 0x75, 0x0E, 0x4F, 0x00, -0x76, 0x2C, 0x64, 0x80, 0x76, 0xEE, 0x31, 0x00, 0x78, 0x0C, 0x46, 0x80, 0x78, 0xD7, 0x4D, 0x80, -0x79, 0xEC, 0x28, 0x80, 0x7A, 0xB7, 0x2F, 0x80, 0x7B, 0xCC, 0x0A, 0x80, 0x7C, 0x97, 0x11, 0x80, -0x7D, 0xB5, 0x27, 0x00, 0x7E, 0x76, 0xF3, 0x80, 0x7F, 0x95, 0x09, 0x00, 0x02, 0x01, 0x02, 0x01, +0x50, 0x9D, 0x99, 0x00, 0x51, 0x54, 0xD9, 0x80, 0x52, 0x69, 0xB4, 0x80, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, -0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x02, 0x01, 0x03, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, -0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, -0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, -0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x00, 0x00, 0x0C, 0x5C, +0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x02, 0x01, 0x03, 0x02, 0x01, 0x03, 0x00, 0x00, 0x0C, 0x5C, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x01, 0x04, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x09, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x0D, 0x4C, 0x4D, 0x54, 0x00, 0x43, 0x45, 0x53, 0x54, 0x00, 0x43, 0x45, 0x54, 0x00, 0x45, 0x45, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x54, @@ -16999,19 +16989,19 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 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, 0x62, 0x90, 0x60, 0x52, 0xDA, 0x88, 0xE0, 0x54, 0x42, 0x72, 0x60, 0x54, 0xBA, 0x6A, 0xE0, -0x56, 0x22, 0x54, 0x60, 0x56, 0xA3, 0x87, 0x60, 0x58, 0x0B, 0x70, 0xE0, 0x58, 0x83, 0x69, 0x60, +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, 0xAB, 0x16, 0xE0, 0x5E, 0x23, 0x0F, 0x60, 0x5F, 0x8A, 0xF8, 0xE0, 0x60, 0x0C, 0x2B, 0xE0, +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, 0x13, 0xBB, 0x60, 0x67, 0x8B, 0xB3, 0xE0, -0x68, 0xF3, 0x9D, 0x60, 0x69, 0x6B, 0x95, 0xE0, 0x6A, 0xD3, 0x7F, 0x60, 0x6B, 0x54, 0xB2, 0x60, +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, 0x5C, 0x41, 0xE0, 0x72, 0xD4, 0x3A, 0x60, -0x74, 0x3C, 0x23, 0xE0, 0x74, 0xB4, 0x1C, 0x60, 0x76, 0x25, 0x40, 0x60, 0x76, 0x9D, 0x38, 0xE0, +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, 0xA4, 0xC8, 0x60, 0x7E, 0x1C, 0xC0, 0xE0, -0x7F, 0x84, 0xAA, 0x60, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x7B, 0xC4, 0xE6, 0x60, 0x7C, 0x3C, 0xDE, 0xE0, 0x7D, 0xAE, 0x02, 0xE0, 0x7E, 0x1C, 0xC0, 0xE0, +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, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, @@ -17074,11 +17064,13 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { /* Pacific/Johnston */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x55, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0xFF, 0xFF, 0x73, 0x60, -0x00, 0x00, 0x48, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0xA2, 0xE3, 0x38, 0x00, 0x0F, 0xFF, 0x0D, -0x00, 0x00, 0x00, 0x0E, 0x4A, 0x6F, 0x68, 0x6E, 0x73, 0x74, 0x6F, 0x6E, 0x20, 0x41, 0x74, 0x6F, -0x6C, 0x6C, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0xBB, 0x05, 0x43, 0x48, +0xBB, 0x21, 0x71, 0x58, 0xCB, 0x89, 0x3D, 0xC8, 0xD2, 0x61, 0x49, 0x38, 0xD5, 0x8D, 0x73, 0x48, +0x01, 0x00, 0x01, 0x00, 0x02, 0xFF, 0xFF, 0x6C, 0x58, 0x00, 0x00, 0xFF, 0xFF, 0x7A, 0x68, 0x01, +0x04, 0xFF, 0xFF, 0x73, 0x60, 0x00, 0x00, 0x48, 0x53, 0x54, 0x00, 0x48, 0x44, 0x54, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA2, 0xE3, 0x38, 0x00, 0x0F, 0xFF, 0x0D, 0x00, 0x00, 0x00, +0x0E, 0x4A, 0x6F, 0x68, 0x6E, 0x73, 0x74, 0x6F, 0x6E, 0x20, 0x41, 0x74, 0x6F, 0x6C, 0x6C, /* Pacific/Kiritimati */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x4B, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -18410,4 +18402,4 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 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.4", 579, timezonedb_idx_builtin, timelib_timezone_db_data_builtin }; +const timelib_tzdb timezonedb_builtin = { "2013.8", 579, timezonedb_idx_builtin, timelib_timezone_db_data_builtin }; diff --git a/ext/date/php_date.c b/ext/date/php_date.c index f0c9525e567da..13a645117c959 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -480,7 +480,7 @@ const zend_function_entry date_funcs_immutable[] = { PHP_ME(DateTimeImmutable, __construct, arginfo_date_create, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) PHP_ME(DateTime, __wakeup, NULL, ZEND_ACC_PUBLIC) PHP_ME(DateTimeImmutable, __set_state, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME_MAPPING(createFromFormat, date_create_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME_MAPPING(createFromFormat, date_create_immutable_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME_MAPPING(getLastErrors, date_get_last_errors, arginfo_date_get_last_errors, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME_MAPPING(format, date_format, arginfo_date_method_format, 0) PHP_ME_MAPPING(getTimezone, date_timezone_get, arginfo_date_method_timezone_get, 0) @@ -1406,6 +1406,7 @@ PHPAPI signed long php_parse_date(char *string, signed long *now) parsed_time = timelib_strtotime(string, strlen(string), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper); if (error->error_count) { + timelib_time_dtor(parsed_time); timelib_error_container_dtor(error); return -1; } @@ -2142,27 +2143,21 @@ static zval* date_clone_immutable(zval *object TSRMLS_DC) static int date_object_compare_date(zval *d1, zval *d2 TSRMLS_DC) { - if (Z_TYPE_P(d1) == IS_OBJECT && Z_TYPE_P(d2) == IS_OBJECT && - instanceof_function(Z_OBJCE_P(d1), date_ce_date TSRMLS_CC) && - instanceof_function(Z_OBJCE_P(d2), date_ce_date TSRMLS_CC)) { - php_date_obj *o1 = zend_object_store_get_object(d1 TSRMLS_CC); - php_date_obj *o2 = zend_object_store_get_object(d2 TSRMLS_CC); + php_date_obj *o1 = zend_object_store_get_object(d1 TSRMLS_CC); + php_date_obj *o2 = zend_object_store_get_object(d2 TSRMLS_CC); - if (!o1->time || !o2->time) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to compare an incomplete DateTime object"); - return 1; - } - if (!o1->time->sse_uptodate) { - timelib_update_ts(o1->time, o1->time->tz_info); - } - if (!o2->time->sse_uptodate) { - timelib_update_ts(o2->time, o2->time->tz_info); - } - - return (o1->time->sse == o2->time->sse) ? 0 : ((o1->time->sse < o2->time->sse) ? -1 : 1); + if (!o1->time || !o2->time) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to compare an incomplete DateTime or DateTimeImmutable object"); + return 1; + } + if (!o1->time->sse_uptodate) { + timelib_update_ts(o1->time, o1->time->tz_info); + } + if (!o2->time->sse_uptodate) { + timelib_update_ts(o2->time, o2->time->tz_info); } - return 1; + return (o1->time->sse == o2->time->sse) ? 0 : ((o1->time->sse < o2->time->sse) ? -1 : 1); } static HashTable *date_object_get_gc(zval *object, zval ***table, int *n TSRMLS_DC) @@ -2198,13 +2193,13 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC) /* first we add the date and time in ISO format */ MAKE_STD_ZVAL(zv); ZVAL_STRING(zv, date_format("Y-m-d H:i:s", 12, dateobj->time, 1), 0); - zend_hash_update(props, "date", 5, &zv, sizeof(zval), NULL); + zend_hash_update(props, "date", 5, &zv, sizeof(zv), NULL); /* then we add the timezone name (or similar) */ if (dateobj->time->is_localtime) { MAKE_STD_ZVAL(zv); ZVAL_LONG(zv, dateobj->time->zone_type); - zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zval), NULL); + zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zv), NULL); MAKE_STD_ZVAL(zv); switch (dateobj->time->zone_type) { @@ -2227,7 +2222,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC) ZVAL_STRING(zv, dateobj->time->tz_abbr, 1); break; } - zend_hash_update(props, "timezone", 9, &zv, sizeof(zval), NULL); + zend_hash_update(props, "timezone", 9, &zv, sizeof(zv), NULL); } return props; @@ -2305,7 +2300,7 @@ static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC) MAKE_STD_ZVAL(zv); ZVAL_LONG(zv, tzobj->type); - zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zval), NULL); + zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zv), NULL); MAKE_STD_ZVAL(zv); switch (tzobj->type) { @@ -2327,7 +2322,7 @@ static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC) ZVAL_STRING(zv, tzobj->tzi.z.abbr, 1); break; } - zend_hash_update(props, "timezone", 9, &zv, sizeof(zval), NULL); + zend_hash_update(props, "timezone", 9, &zv, sizeof(zv), NULL); return props; } @@ -2394,7 +2389,7 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC) #define PHP_DATE_INTERVAL_ADD_PROPERTY(n,f) \ MAKE_STD_ZVAL(zv); \ ZVAL_LONG(zv, (long)intervalobj->diff->f); \ - zend_hash_update(props, n, strlen(n) + 1, &zv, sizeof(zval), NULL); + zend_hash_update(props, n, strlen(n) + 1, &zv, sizeof(zv), NULL); PHP_DATE_INTERVAL_ADD_PROPERTY("y", y); PHP_DATE_INTERVAL_ADD_PROPERTY("m", m); @@ -2411,7 +2406,7 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC) } else { MAKE_STD_ZVAL(zv); ZVAL_FALSE(zv); - zend_hash_update(props, "days", 5, &zv, sizeof(zval), NULL); + zend_hash_update(props, "days", 5, &zv, sizeof(zv), NULL); } PHP_DATE_INTERVAL_ADD_PROPERTY("special_type", special.type); PHP_DATE_INTERVAL_ADD_PROPERTY("special_amount", special.amount); @@ -4064,7 +4059,11 @@ zval *date_interval_read_property(zval *object, zval *member, int type, const ze ALLOC_INIT_ZVAL(retval); Z_SET_REFCOUNT_P(retval, 0); - ZVAL_LONG(retval, value); + if (value != -99999) { + ZVAL_LONG(retval, value); + } else { + ZVAL_FALSE(retval); + } if (member == &tmp_member) { zval_dtor(member); diff --git a/ext/date/tests/DateInterval_days_prop1.phpt b/ext/date/tests/DateInterval_days_prop1.phpt new file mode 100644 index 0000000000000..627b8f0b27f32 --- /dev/null +++ b/ext/date/tests/DateInterval_days_prop1.phpt @@ -0,0 +1,10 @@ +--TEST-- +Wrong var_dump(DateInterval->days) value +--FILE-- +days); +--EXPECT-- +bool(false) diff --git a/ext/date/tests/DateTime_fix_createFromFormat.phpt b/ext/date/tests/DateTime_fix_createFromFormat.phpt new file mode 100644 index 0000000000000..abde292775de4 --- /dev/null +++ b/ext/date/tests/DateTime_fix_createFromFormat.phpt @@ -0,0 +1,29 @@ +--TEST-- +Test fix for DateTime when date have textual day with dot or other special char at end +--FILE-- +format("D., M. j, Y g:iA") . "\n"; +echo "createFromFormat method: " . $fromFormat->format("D., M. j, Y g:iA") . "\n"; + +?> +===DONE=== +--EXPECTF-- +*** Testing clone on DateTime objects *** +Format method: Thu., Nov. 29, 2012 5:00PM +createFromFormat method: Thu., Nov. 29, 2012 5:00PM +===DONE=== diff --git a/ext/date/tests/bug64157.phpt b/ext/date/tests/bug64157.phpt new file mode 100644 index 0000000000000..fb71495430c72 --- /dev/null +++ b/ext/date/tests/bug64157.phpt @@ -0,0 +1,14 @@ +--TEST-- +Test for bug #64157: DateTime::createFromFormat() reports confusing error message +--CREDITS-- +Boro Sitnikovski +--INI-- +date.timezone = UTC +--FILE-- + +--EXPECT-- +A two digit second could not be found diff --git a/ext/date/tests/bug65184.phpt b/ext/date/tests/bug65184.phpt index adfd8d8124609..9bb68558aae83 100644 --- a/ext/date/tests/bug65184.phpt +++ b/ext/date/tests/bug65184.phpt @@ -6,6 +6,8 @@ if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { die("skip Test is valid for Windows"); } ?> +--INI-- +date.timezone = UTC --FILE-- +--INI-- +date.timezone = UTC +--FILE-- + +--EXPECT-- +DateTimeImmutable diff --git a/ext/date/tests/bug65548.phpt b/ext/date/tests/bug65548.phpt new file mode 100644 index 0000000000000..53f2519f6d371 --- /dev/null +++ b/ext/date/tests/bug65548.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test for bug #65548: Comparison for DateTimeImmutable doesn't work +--CREDITS-- +Boro Sitnikovski +--INI-- +date.timezone = UTC +--FILE-- + $iTomorrow); + +var_dump($iToday == $mToday); +var_dump($iToday === $mToday); + +var_dump($iToday < $mTomorrow); +var_dump($iToday == $mTomorrow); +var_dump($iToday > $mTomorrow); +?> +--EXPECT-- +bool(true) +bool(false) +bool(false) +bool(true) +bool(false) +bool(true) +bool(false) +bool(false) diff --git a/ext/dba/dba.c b/ext/dba/dba.c index 8005101de34b1..ced90f0c62299 100644 --- a/ext/dba/dba.c +++ b/ext/dba/dba.c @@ -226,12 +226,17 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS *key_free = *key_str; return len; } else { - *key_free = NULL; + zval tmp = *key; + int len; - convert_to_string(key); - *key_str = Z_STRVAL_P(key); + zval_copy_ctor(&tmp); + convert_to_string(&tmp); - return Z_STRLEN_P(key); + *key_free = *key_str = estrndup(Z_STRVAL(tmp), Z_STRLEN(tmp)); + len = Z_STRLEN(tmp); + + zval_dtor(&tmp); + return len; } } /* }}} */ @@ -297,6 +302,14 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS RETURN_FALSE; \ } +/* the same check, but with a call to DBA_ID_DONE before returning */ +#define DBA_WRITE_CHECK_WITH_ID \ + if(info->mode != DBA_WRITER && info->mode != DBA_TRUNC && info->mode != DBA_CREAT) { \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "You cannot perform a modification to a database without proper access"); \ + DBA_ID_DONE; \ + RETURN_FALSE; \ + } + /* }}} */ /* {{{ globals */ @@ -557,7 +570,7 @@ static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode) DBA_FETCH_RESOURCE(info, &id); - DBA_WRITE_CHECK; + DBA_WRITE_CHECK_WITH_ID; if (info->hnd->update(info, key_str, key_len, val, val_len, mode TSRMLS_CC) == SUCCESS) { DBA_ID_DONE; @@ -612,7 +625,8 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) char *file_mode; char mode[4], *pmode, *lock_file_mode = NULL; int persistent_flag = persistent ? STREAM_OPEN_PERSISTENT : 0; - char *opened_path, *lock_name; + char *opened_path = NULL; + char *lock_name; if(ac < 2) { WRONG_PARAM_COUNT; @@ -835,8 +849,10 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (!persistent) { info->lock.name = opened_path; } else { - info->lock.name = pestrdup(opened_path, persistent); - efree(opened_path); + if (opened_path) { + info->lock.name = pestrdup(opened_path, persistent); + efree(opened_path); + } } } } @@ -1110,7 +1126,7 @@ PHP_FUNCTION(dba_delete) { DBA_ID_GET2; - DBA_WRITE_CHECK; + DBA_WRITE_CHECK_WITH_ID; if(info->hnd->delete(info, key_str, key_len TSRMLS_CC) == SUCCESS) { diff --git a/ext/dba/tests/bug65708.phpt b/ext/dba/tests/bug65708.phpt new file mode 100644 index 0000000000000..b77138f6ed438 --- /dev/null +++ b/ext/dba/tests/bug65708.phpt @@ -0,0 +1,38 @@ +--TEST-- +Bug #65708 (dba functions cast $key param to string in-place, bypassing copy on write) +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +integer +integer +integer +integer diff --git a/ext/exif/exif.c b/ext/exif/exif.c index ec121a6c326bc..f886bb4fea783 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -2633,6 +2633,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP } else { decode = ImageInfo->decode_unicode_le; } + /* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */ if (zend_multibyte_encoding_converter( (unsigned char**)pszInfoPtr, &len, @@ -2640,7 +2641,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP ByteCount, zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC), zend_multibyte_fetch_encoding(decode TSRMLS_CC) - TSRMLS_CC) < 0) { + TSRMLS_CC) == (size_t)-1) { len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount); } return len; @@ -2653,6 +2654,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP *pszEncoding = estrdup((const char*)szValuePtr); szValuePtr = szValuePtr+8; ByteCount -= 8; + /* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */ if (zend_multibyte_encoding_converter( (unsigned char**)pszInfoPtr, &len, @@ -2660,7 +2662,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP ByteCount, zend_multibyte_fetch_encoding(ImageInfo->encode_jis TSRMLS_CC), zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_jis_be : ImageInfo->decode_jis_le TSRMLS_CC) - TSRMLS_CC) < 0) { + TSRMLS_CC) == (size_t)-1) { len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount); } return len; @@ -2690,8 +2692,8 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP static int exif_process_unicode(image_info_type *ImageInfo, xp_field_type *xp_field, int tag, char *szValuePtr, int ByteCount TSRMLS_DC) { xp_field->tag = tag; - - /* Copy the comment */ + + /* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */ if (zend_multibyte_encoding_converter( (unsigned char**)&xp_field->value, &xp_field->size, @@ -2699,7 +2701,7 @@ static int exif_process_unicode(image_info_type *ImageInfo, xp_field_type *xp_fi ByteCount, zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC), zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_unicode_be : ImageInfo->decode_unicode_le TSRMLS_CC) - TSRMLS_CC) < 0) { + TSRMLS_CC) == (size_t)-1) { xp_field->size = exif_process_string_raw(&xp_field->value, szValuePtr, ByteCount); } return xp_field->size; diff --git a/ext/exif/tests/bug62523_1.jpg b/ext/exif/tests/bug62523_1.jpg new file mode 100644 index 0000000000000..9a63d1e84d90b --- /dev/null +++ b/ext/exif/tests/bug62523_1.jpg @@ -0,0 +1,9 @@ + + +301 Moved Permanently + +

Moved Permanently

+

The document has moved here.

+
+
Apache Server at getid3.org Port 80
+ diff --git a/ext/exif/tests/bug62523_1.phpt b/ext/exif/tests/bug62523_1.phpt new file mode 100644 index 0000000000000..28d42f021d073 --- /dev/null +++ b/ext/exif/tests/bug62523_1.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug 62523 (php crashes with segfault when exif_read_data called) +--SKIPIF-- + +--FILE-- + +Done +--EXPECTF-- +Test + +Warning: exif_read_data(bug62523_1.jpg): File not supported in %sbug62523_1.php on line %d +int(1) +Done diff --git a/ext/exif/tests/bug62523_2.jpg b/ext/exif/tests/bug62523_2.jpg new file mode 100644 index 0000000000000..8d7fc6c5f41ba Binary files /dev/null and b/ext/exif/tests/bug62523_2.jpg differ diff --git a/ext/exif/tests/bug62523_2.phpt b/ext/exif/tests/bug62523_2.phpt new file mode 100644 index 0000000000000..ddc8ae824e82e --- /dev/null +++ b/ext/exif/tests/bug62523_2.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug 62523 (php crashes with segfault when exif_read_data called) +--SKIPIF-- + +--FILE-- + +Done +--EXPECT-- +Test +int(76) +Done diff --git a/ext/exif/tests/bug62523_3.jpg b/ext/exif/tests/bug62523_3.jpg new file mode 100644 index 0000000000000..3ee91368ceb86 --- /dev/null +++ b/ext/exif/tests/bug62523_3.jpg @@ -0,0 +1,12 @@ + + Found + +

Found

+

The resource was found at http://dl.dropboxusercontent.com/u/7562584/Bugs/Php/bad_exif.jpeg; +you should be redirected automatically. + +

+
+
WSGI Server
+ + diff --git a/ext/exif/tests/bug62523_3.phpt b/ext/exif/tests/bug62523_3.phpt new file mode 100644 index 0000000000000..6e11354c5a725 --- /dev/null +++ b/ext/exif/tests/bug62523_3.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug 62523 (php crashes with segfault when exif_read_data called) +--SKIPIF-- + +--FILE-- + +Done +--EXPECTF-- +Test + +Warning: exif_read_data(bug62523_3.jpg): File not supported in %sbug62523_3.php on line %d +int(1) +Done diff --git a/ext/exif/tests/exif_encoding_crash.jpg b/ext/exif/tests/exif_encoding_crash.jpg new file mode 100644 index 0000000000000..55138abe55210 Binary files /dev/null and b/ext/exif/tests/exif_encoding_crash.jpg differ diff --git a/ext/exif/tests/exif_encoding_crash.phpt b/ext/exif/tests/exif_encoding_crash.phpt new file mode 100644 index 0000000000000..1c4ad63860346 --- /dev/null +++ b/ext/exif/tests/exif_encoding_crash.phpt @@ -0,0 +1,14 @@ +--TEST-- +PHP crash when zend_multibyte_encoding_converter returns (size_t)-1) +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** no core dump *** +===DONE=== diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c index b8df2183b9d86..39433d6ece8b4 100644 --- a/ext/filter/logical_filters.c +++ b/ext/filter/logical_filters.c @@ -484,10 +484,6 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ } s++; } - - if (*(e - 1) == '.') { - goto bad_url; - } } if ( @@ -718,6 +714,7 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ if (flags & FILTER_FLAG_NO_RES_RANGE) { if ( (ip[0] == 0) || + (ip[0] == 100 && (ip[1] >= 64 && ip[1] <= 127)) || (ip[0] == 128 && ip[1] == 0) || (ip[0] == 191 && ip[1] == 255) || (ip[0] == 169 && ip[1] == 254) || diff --git a/ext/filter/tests/018.phpt b/ext/filter/tests/018.phpt index af52b2e60d67e..75bbd13427994 100644 --- a/ext/filter/tests/018.phpt +++ b/ext/filter/tests/018.phpt @@ -15,6 +15,8 @@ var_dump(filter_var("192.168.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)); var_dump(filter_var("127.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE)); var_dump(filter_var("192.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE)); +var_dump(filter_var("100.64.0.0", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE)); +var_dump(filter_var("100.127.255.255", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE)); var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP)); var_dump(filter_var("256.1237.123.1", FILTER_VALIDATE_IP)); var_dump(filter_var("255.255.255.255", FILTER_VALIDATE_IP)); @@ -40,6 +42,8 @@ bool(false) string(12) "192.0.34.166" bool(false) string(9) "192.0.0.1" +bool(false) +bool(false) string(12) "192.0.34.166" bool(false) string(15) "255.255.255.255" diff --git a/ext/filter/tests/bug64441.phpt b/ext/filter/tests/bug64441.phpt new file mode 100644 index 0000000000000..149079ec05323 --- /dev/null +++ b/ext/filter/tests/bug64441.phpt @@ -0,0 +1,11 @@ +--TEST-- +bug 64441, FILTER_VALIDATE_URL will invalidate a hostname that ended by dot +--SKIPIF-- + +--FILE-- +inbuf) { + if (response) { *response = estrdup(ftp->inbuf); } @@ -1638,7 +1638,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC) if (ftp->resp == 226) { ftp->data = data_close(ftp, data); php_stream_close(tmpstream); - return ecalloc(1, sizeof(char**)); + return ecalloc(1, sizeof(char*)); } /* pull data buffer into tmpfile */ @@ -1666,11 +1666,11 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC) } } - ftp->data = data = data_close(ftp, data); + ftp->data = data_close(ftp, data); php_stream_rewind(tmpstream); - ret = safe_emalloc((lines + 1), sizeof(char**), size * sizeof(char*)); + ret = safe_emalloc((lines + 1), sizeof(char*), size); entry = ret; text = (char*) (ret + lines + 1); diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c index da22e0b63eb3a..21e13ea460563 100644 --- a/ext/ftp/php_ftp.c +++ b/ext/ftp/php_ftp.c @@ -968,7 +968,9 @@ PHP_FUNCTION(ftp_nb_get) RETURN_LONG(PHP_FTP_FAILED); } - php_stream_close(outstream); + if (ret == PHP_FTP_FINISHED){ + php_stream_close(outstream); + } RETURN_LONG(ret); } diff --git a/ext/ftp/tests/ftp_fget_basic1.phpt b/ext/ftp/tests/ftp_fget_basic1.phpt index 475f7183d2532..5909d35cef608 100644 --- a/ext/ftp/tests/ftp_fget_basic1.phpt +++ b/ext/ftp/tests/ftp_fget_basic1.phpt @@ -16,7 +16,7 @@ ftp_login($ftp, 'user', 'pass'); if (!$ftp) die("Couldn't connect to the server"); ftp_set_option($ftp, FTP_AUTOSEEK, false); -$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"; +$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic1.txt"; $handle = fopen($local_file, 'w'); var_dump(ftp_fget($ftp, $handle, 'fget.txt', FTP_ASCII, FTP_AUTORESUME)); @@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file)); ?> --CLEAN-- --EXPECT-- bool(true) diff --git a/ext/ftp/tests/ftp_fget_basic2.phpt b/ext/ftp/tests/ftp_fget_basic2.phpt index 00a26752d9150..622cea3683b0d 100644 --- a/ext/ftp/tests/ftp_fget_basic2.phpt +++ b/ext/ftp/tests/ftp_fget_basic2.phpt @@ -15,7 +15,7 @@ $ftp = ftp_connect('127.0.0.1', $port); ftp_login($ftp, 'user', 'pass'); if (!$ftp) die("Couldn't connect to the server"); -$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"; +$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic2.txt"; file_put_contents($local_file, 'ASCIIFoo'); $handle = fopen($local_file, 'a'); @@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file)); ?> --CLEAN-- --EXPECT-- bool(true) diff --git a/ext/ftp/tests/ftp_fget_basic3.phpt b/ext/ftp/tests/ftp_fget_basic3.phpt index b7098701ab12e..9485473b1c6a3 100644 --- a/ext/ftp/tests/ftp_fget_basic3.phpt +++ b/ext/ftp/tests/ftp_fget_basic3.phpt @@ -15,7 +15,7 @@ $ftp = ftp_connect('127.0.0.1', $port); ftp_login($ftp, 'user', 'pass'); if (!$ftp) die("Couldn't connect to the server"); -$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"; +$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic3.txt"; file_put_contents($local_file, 'ASCIIFoo'); $handle = fopen($local_file, 'a'); @@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file)); ?> --CLEAN-- --EXPECT-- bool(true) diff --git a/ext/ftp/tests/ftp_nb_continue.phpt b/ext/ftp/tests/ftp_nb_continue.phpt new file mode 100644 index 0000000000000..1f703399139bf --- /dev/null +++ b/ext/ftp/tests/ftp_nb_continue.phpt @@ -0,0 +1,182 @@ +--TEST-- +Testing whether ftp_nb_continue() fetches more data +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +This is line 0 of the test data. +This is line 1 of the test data. +This is line 2 of the test data. +This is line 3 of the test data. +This is line 4 of the test data. +This is line 5 of the test data. +This is line 6 of the test data. +This is line 7 of the test data. +This is line 8 of the test data. +This is line 9 of the test data. +This is line 10 of the test data. +This is line 11 of the test data. +This is line 12 of the test data. +This is line 13 of the test data. +This is line 14 of the test data. +This is line 15 of the test data. +This is line 16 of the test data. +This is line 17 of the test data. +This is line 18 of the test data. +This is line 19 of the test data. +This is line 20 of the test data. +This is line 21 of the test data. +This is line 22 of the test data. +This is line 23 of the test data. +This is line 24 of the test data. +This is line 25 of the test data. +This is line 26 of the test data. +This is line 27 of the test data. +This is line 28 of the test data. +This is line 29 of the test data. +This is line 30 of the test data. +This is line 31 of the test data. +This is line 32 of the test data. +This is line 33 of the test data. +This is line 34 of the test data. +This is line 35 of the test data. +This is line 36 of the test data. +This is line 37 of the test data. +This is line 38 of the test data. +This is line 39 of the test data. +This is line 40 of the test data. +This is line 41 of the test data. +This is line 42 of the test data. +This is line 43 of the test data. +This is line 44 of the test data. +This is line 45 of the test data. +This is line 46 of the test data. +This is line 47 of the test data. +This is line 48 of the test data. +This is line 49 of the test data. +This is line 50 of the test data. +This is line 51 of the test data. +This is line 52 of the test data. +This is line 53 of the test data. +This is line 54 of the test data. +This is line 55 of the test data. +This is line 56 of the test data. +This is line 57 of the test data. +This is line 58 of the test data. +This is line 59 of the test data. +This is line 60 of the test data. +This is line 61 of the test data. +This is line 62 of the test data. +This is line 63 of the test data. +This is line 64 of the test data. +This is line 65 of the test data. +This is line 66 of the test data. +This is line 67 of the test data. +This is line 68 of the test data. +This is line 69 of the test data. +This is line 70 of the test data. +This is line 71 of the test data. +This is line 72 of the test data. +This is line 73 of the test data. +This is line 74 of the test data. +This is line 75 of the test data. +This is line 76 of the test data. +This is line 77 of the test data. +This is line 78 of the test data. +This is line 79 of the test data. +This is line 80 of the test data. +This is line 81 of the test data. +This is line 82 of the test data. +This is line 83 of the test data. +This is line 84 of the test data. +This is line 85 of the test data. +This is line 86 of the test data. +This is line 87 of the test data. +This is line 88 of the test data. +This is line 89 of the test data. +This is line 90 of the test data. +This is line 91 of the test data. +This is line 92 of the test data. +This is line 93 of the test data. +This is line 94 of the test data. +This is line 95 of the test data. +This is line 96 of the test data. +This is line 97 of the test data. +This is line 98 of the test data. +This is line 99 of the test data. +This is line 100 of the test data. +This is line 101 of the test data. +This is line 102 of the test data. +This is line 103 of the test data. +This is line 104 of the test data. +This is line 105 of the test data. +This is line 106 of the test data. +This is line 107 of the test data. +This is line 108 of the test data. +This is line 109 of the test data. +This is line 110 of the test data. +This is line 111 of the test data. +This is line 112 of the test data. +This is line 113 of the test data. +This is line 114 of the test data. +This is line 115 of the test data. +This is line 116 of the test data. +This is line 117 of the test data. +This is line 118 of the test data. +This is line 119 of the test data. +This is line 120 of the test data. +This is line 121 of the test data. +This is line 122 of the test data. +This is line 123 of the test data. +This is line 124 of the test data. +This is line 125 of the test data. +This is line 126 of the test data. +This is line 127 of the test data. +This is line 128 of the test data. +This is line 129 of the test data. +This is line 130 of the test data. +This is line 131 of the test data. +This is line 132 of the test data. +This is line 133 of the test data. +This is line 134 of the test data. +This is line 135 of the test data. +This is line 136 of the test data. +This is line 137 of the test data. +This is line 138 of the test data. +This is line 139 of the test data. +This is line 140 of the test data. +This is line 141 of the test data. +This is line 142 of the test data. +This is line 143 of the test data. +This is line 144 of the test data. +This is line 145 of the test data. +This is line 146 of the test data. +This is line 147 of the test data. +This is line 148 of the test data. +This is line 149 of the test data. diff --git a/ext/ftp/tests/ftp_nb_fget_basic1.phpt b/ext/ftp/tests/ftp_nb_fget_basic1.phpt index cac4eec56bc99..5e6389ff1336a 100644 --- a/ext/ftp/tests/ftp_nb_fget_basic1.phpt +++ b/ext/ftp/tests/ftp_nb_fget_basic1.phpt @@ -16,7 +16,7 @@ ftp_login($ftp, 'user', 'pass'); if (!$ftp) die("Couldn't connect to the server"); ftp_set_option($ftp, FTP_AUTOSEEK, false); -$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"; +$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic1.txt"; $handle = fopen($local_file, 'w'); var_dump(ftp_nb_fget($ftp, $handle, 'fget.txt', FTP_ASCII, FTP_AUTORESUME)); @@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file)); ?> --CLEAN-- --EXPECT-- int(2) diff --git a/ext/ftp/tests/ftp_nb_fget_basic2.phpt b/ext/ftp/tests/ftp_nb_fget_basic2.phpt index dc92f4e23bc99..215b79ac4a986 100644 --- a/ext/ftp/tests/ftp_nb_fget_basic2.phpt +++ b/ext/ftp/tests/ftp_nb_fget_basic2.phpt @@ -15,7 +15,7 @@ $ftp = ftp_connect('127.0.0.1', $port); ftp_login($ftp, 'user', 'pass'); if (!$ftp) die("Couldn't connect to the server"); -$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"; +$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic2.txt"; file_put_contents($local_file, 'ASCIIFoo'); $handle = fopen($local_file, 'a'); @@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file)); ?> --CLEAN-- --EXPECT-- int(2) diff --git a/ext/ftp/tests/ftp_nb_fget_basic3.phpt b/ext/ftp/tests/ftp_nb_fget_basic3.phpt index d1a87c4f3dfe3..66daf2ba0a030 100644 --- a/ext/ftp/tests/ftp_nb_fget_basic3.phpt +++ b/ext/ftp/tests/ftp_nb_fget_basic3.phpt @@ -15,7 +15,7 @@ $ftp = ftp_connect('127.0.0.1', $port); ftp_login($ftp, 'user', 'pass'); if (!$ftp) die("Couldn't connect to the server"); -$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"; +$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic3.txt"; file_put_contents($local_file, 'ASCIIFoo'); $handle = fopen($local_file, 'a'); @@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file)); ?> --CLEAN-- --EXPECT-- int(2) diff --git a/ext/ftp/tests/ftp_nb_get_large.phpt b/ext/ftp/tests/ftp_nb_get_large.phpt index 3fbf2a4831d14..0c354d7c1978f 100644 --- a/ext/ftp/tests/ftp_nb_get_large.phpt +++ b/ext/ftp/tests/ftp_nb_get_large.phpt @@ -18,7 +18,7 @@ $ftp = ftp_connect('127.0.0.1', $port); ftp_login($ftp, 'user', 'pass'); if (!$ftp) die("Couldn't connect to the server"); -$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"; +$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_get_large.txt"; touch($local_file); ftp_nb_get($ftp, $local_file, 'fget_large.txt', FTP_BINARY, 5368709119); $fp = fopen($local_file, 'r'); @@ -29,7 +29,7 @@ fclose($fp); ?> --CLEAN-- --EXPECT-- string(1) "X" diff --git a/ext/ftp/tests/server.inc b/ext/ftp/tests/server.inc index 7dc8fa08d99ff..bb0c1ff10bec9 100644 --- a/ext/ftp/tests/server.inc +++ b/ext/ftp/tests/server.inc @@ -368,6 +368,13 @@ if ($pid) { } fputs($s, "226 Closing data Connection.\r\n"); break; + case "mediumfile": + fputs($s, "150 File status okay; about to open data connection.\r\n"); + for($i = 0; $i < 150; $i++){ + fputs($fs, "This is line $i of the test data.\n"); + } + fputs($s, "226 Closing data Connection.\r\n"); + default: fputs($s, "550 {$matches[1]}: No such file or directory \r\n"); break; diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c index b6e7c69201f9b..e34242bb73646 100644 --- a/ext/gd/libgd/gd_interpolation.c +++ b/ext/gd/libgd/gd_interpolation.c @@ -1063,6 +1063,7 @@ gdImagePtr gdImageScaleTwoPass(const gdImagePtr src, const unsigned int src_widt if (tmp_im == NULL) { return NULL; } + gdImageSetInterpolationMethod(tmp_im, src->interpolation_id); _gdScaleHoriz(src, src_width, src_height, tmp_im, new_width, src_height); dst = gdImageCreateTrueColor(new_width, new_height); @@ -1070,6 +1071,7 @@ gdImagePtr gdImageScaleTwoPass(const gdImagePtr src, const unsigned int src_widt gdFree(tmp_im); return NULL; } + gdImageSetInterpolationMethod(dst, src->interpolation_id); _gdScaleVert(tmp_im, new_width, src_height, dst, new_width, new_height); gdFree(tmp_im); @@ -1084,8 +1086,9 @@ gdImagePtr Scale(const gdImagePtr src, const unsigned int src_width, const unsig if (tmp_im == NULL) { return NULL; } - _gdScaleHoriz(src, src_width, src_height, tmp_im, new_width, src_height); + gdImageSetInterpolationMethod(tmp_im, src->interpolation_id); + _gdScaleHoriz(src, src_width, src_height, tmp_im, new_width, src_height); _gdScaleVert(tmp_im, new_width, src_height, dst, new_width, new_height); gdFree(tmp_im); diff --git a/ext/gd/php_gd.h b/ext/gd/php_gd.h index 269c315e88be5..22fac40dd0ea3 100644 --- a/ext/gd/php_gd.h +++ b/ext/gd/php_gd.h @@ -59,7 +59,7 @@ PHPAPI extern const char php_sig_gif[3]; PHPAPI extern const char php_sig_jpg[3]; -PHPAPI extern const char php_sig_png[3]; +PHPAPI extern const char php_sig_png[8]; extern zend_module_entry gd_module_entry; #define phpext_gd_ptr &gd_module_entry diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index 8b5c131e76060..af9c73afa2b0a 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -24,7 +24,10 @@ #include "php_ini.h" #include "php_gmp.h" #include "ext/standard/info.h" +#include "ext/standard/php_var.h" +#include "ext/standard/php_smart_str_public.h" #include "zend_exceptions.h" +#include "zend_interfaces.h" #if HAVE_GMP @@ -564,12 +567,17 @@ static int gmp_cast_object(zval *readobj, zval *writeobj, int type TSRMLS_DC) /* } /* }}} */ -static HashTable *gmp_get_properties(zval *obj TSRMLS_DC) /* {{{ */ +static HashTable *gmp_get_debug_info(zval *obj, int *is_temp TSRMLS_DC) /* {{{ */ { - HashTable *ht = zend_std_get_properties(obj TSRMLS_CC); + HashTable *ht, *props = zend_std_get_properties(obj TSRMLS_CC); mpz_ptr gmpnum = GET_GMP_FROM_ZVAL(obj); zval *zv; + *is_temp = 1; + ALLOC_HASHTABLE(ht); + ZEND_INIT_SYMTABLE_EX(ht, zend_hash_num_elements(props) + 1, 0); + zend_hash_copy(ht, props, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *)); + MAKE_STD_ZVAL(zv); gmp_strval(zv, gmpnum, 10); zend_hash_update(ht, "num", sizeof("num"), &zv, sizeof(zval *), NULL); @@ -678,36 +686,96 @@ static int gmp_compare(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ } /* }}} */ -PHP_METHOD(GMP, __wakeup) /* {{{ */ +PHP_METHOD(GMP, serialize) /* {{{ */ { - HashTable *props; - zval **num_zv; + mpz_ptr gmpnum = GET_GMP_FROM_ZVAL(getThis()); + smart_str buf = {0}; + php_serialize_data_t var_hash; + zval zv, *zv_ptr = &zv; if (zend_parse_parameters_none() == FAILURE) { return; } - props = zend_std_get_properties(getThis() TSRMLS_CC); - if (zend_hash_find(props, "num", sizeof("num"), (void **) &num_zv) == SUCCESS - && Z_TYPE_PP(num_zv) == IS_STRING && Z_STRLEN_PP(num_zv) > 0 + PHP_VAR_SERIALIZE_INIT(var_hash); + + INIT_PZVAL(zv_ptr); + + gmp_strval(zv_ptr, gmpnum, 10); + php_var_serialize(&buf, &zv_ptr, &var_hash TSRMLS_CC); + zval_dtor(zv_ptr); + + Z_ARRVAL_P(zv_ptr) = zend_std_get_properties(getThis() TSRMLS_CC); + Z_TYPE_P(zv_ptr) = IS_ARRAY; + php_var_serialize(&buf, &zv_ptr, &var_hash TSRMLS_CC); + + PHP_VAR_SERIALIZE_DESTROY(var_hash); + + if (buf.c) { + RETURN_STRINGL(buf.c, buf.len, 0); + } +} +/* }}} */ + +PHP_METHOD(GMP, unserialize) /* {{{ */ +{ + mpz_ptr gmpnum = GET_GMP_FROM_ZVAL(getThis()); + char *str; + int str_len; + php_unserialize_data_t var_hash; + const unsigned char *p, *max; + zval zv, *zv_ptr = &zv; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + return; + } + + PHP_VAR_UNSERIALIZE_INIT(var_hash); + + p = (unsigned char *) str; + max = (unsigned char *) str + str_len; + + INIT_ZVAL(zv); + if (!php_var_unserialize(&zv_ptr, &p, max, &var_hash TSRMLS_CC) + || Z_TYPE_P(zv_ptr) != IS_STRING + || convert_to_gmp(gmpnum, zv_ptr, 10 TSRMLS_CC) == FAILURE ) { - mpz_ptr gmpnumber = GET_GMP_FROM_ZVAL(getThis()); - if (convert_to_gmp(gmpnumber, *num_zv, 10 TSRMLS_CC) == SUCCESS) { - return; - } + zend_throw_exception(NULL, "Could not unserialize number", 0 TSRMLS_CC); + goto exit; } + zval_dtor(&zv); - zend_throw_exception( - NULL, "Invalid serialization data", 0 TSRMLS_CC - ); + INIT_ZVAL(zv); + if (!php_var_unserialize(&zv_ptr, &p, max, &var_hash TSRMLS_CC) + || Z_TYPE_P(zv_ptr) != IS_ARRAY + ) { + zend_throw_exception(NULL, "Could not unserialize properties", 0 TSRMLS_CC); + goto exit; + } + + if (zend_hash_num_elements(Z_ARRVAL_P(zv_ptr)) != 0) { + zend_hash_copy( + zend_std_get_properties(getThis() TSRMLS_CC), Z_ARRVAL_P(zv_ptr), + (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *) + ); + } + +exit: + zval_dtor(&zv); + PHP_VAR_UNSERIALIZE_DESTROY(var_hash); } /* }}} */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_wakeup, 0, 0, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_serialize, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_unserialize, 0, 0, 1) +ZEND_ARG_INFO(0, serialized) ZEND_END_ARG_INFO() const zend_function_entry gmp_methods[] = { - PHP_ME(GMP, __wakeup, arginfo_wakeup, ZEND_ACC_PUBLIC) + PHP_ME(GMP, serialize, arginfo_serialize, ZEND_ACC_PUBLIC) + PHP_ME(GMP, unserialize, arginfo_unserialize, ZEND_ACC_PUBLIC) PHP_FE_END }; @@ -724,13 +792,14 @@ static ZEND_GINIT_FUNCTION(gmp) ZEND_MINIT_FUNCTION(gmp) { zend_class_entry tmp_ce; - INIT_CLASS_ENTRY(tmp_ce, "GMP", gmp_methods); /* No methods on the class for now */ + INIT_CLASS_ENTRY(tmp_ce, "GMP", gmp_methods); gmp_ce = zend_register_internal_class(&tmp_ce TSRMLS_CC); + zend_class_implements(gmp_ce TSRMLS_CC, 1, zend_ce_serializable); gmp_ce->create_object = gmp_create_object; memcpy(&gmp_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); gmp_object_handlers.cast_object = gmp_cast_object; - gmp_object_handlers.get_properties = gmp_get_properties; + gmp_object_handlers.get_debug_info = gmp_get_debug_info; gmp_object_handlers.clone_obj = gmp_clone_obj; gmp_object_handlers.do_operation = gmp_do_operation; gmp_object_handlers.compare = gmp_compare; @@ -1363,7 +1432,7 @@ ZEND_FUNCTION(gmp_powm) zval *base_arg, *exp_arg, *mod_arg; mpz_ptr gmpnum_base, gmpnum_exp, gmpnum_mod, gmpnum_result; int use_ui = 0; - gmp_temp_t temp_base = {0}, temp_exp = {0}, temp_mod; + gmp_temp_t temp_base, temp_exp, temp_mod; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzz", &base_arg, &exp_arg, &mod_arg) == FAILURE){ return; diff --git a/ext/gmp/tests/bug659967.phpt b/ext/gmp/tests/bug659967.phpt new file mode 100644 index 0000000000000..6ba220274c4f7 --- /dev/null +++ b/ext/gmp/tests/bug659967.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #65997: Leak when using gc_collect_cycles with new GMP implementation +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +===DONE=== diff --git a/ext/gmp/tests/serialize.phpt b/ext/gmp/tests/serialize.phpt index 26716b659c368..208e0e98001e7 100644 --- a/ext/gmp/tests/serialize.phpt +++ b/ext/gmp/tests/serialize.phpt @@ -9,14 +9,34 @@ var_dump($n = gmp_init(42)); var_dump($s = serialize($n)); var_dump(unserialize($s)); +$n = gmp_init(13); +$n->foo = "bar"; +var_dump(unserialize(serialize($n))); + +try { + unserialize('C:3:"GMP":0:{}'); +} catch (Exception $e) { var_dump($e->getMessage()); } + +try { + unserialize('C:3:"GMP":8:{s:2:"42"}'); +} catch (Exception $e) { var_dump($e->getMessage()); } + ?> --EXPECTF-- object(GMP)#%d (1) { ["num"]=> string(2) "42" } -string(33) "O:3:"GMP":1:{s:3:"num";s:2:"42";}" +string(30) "C:3:"GMP":15:{s:2:"42";a:0:{}}" object(GMP)#%d (1) { ["num"]=> string(2) "42" } +object(GMP)#%d (2) { + ["foo"]=> + string(3) "bar" + ["num"]=> + string(2) "13" +} +string(28) "Could not unserialize number" +string(32) "Could not unserialize properties" diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 117221484e363..87f19c5cacb1e 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -986,6 +986,7 @@ PHP_MINIT_FUNCTION(hash) php_hash_register_algo("snefru", &php_hash_snefru_ops); php_hash_register_algo("snefru256", &php_hash_snefru_ops); php_hash_register_algo("gost", &php_hash_gost_ops); + php_hash_register_algo("gost-crypto", &php_hash_gost_crypto_ops); php_hash_register_algo("adler32", &php_hash_adler32_ops); php_hash_register_algo("crc32", &php_hash_crc32_ops); php_hash_register_algo("crc32b", &php_hash_crc32b_ops); diff --git a/ext/hash/hash_gost.c b/ext/hash/hash_gost.c index 3961c4f2d5c36..da65bb5903e62 100644 --- a/ext/hash/hash_gost.c +++ b/ext/hash/hash_gost.c @@ -27,7 +27,7 @@ * derived from gost_compress() by Markku-Juhani Saarinen */ -#define round(k1, k2) \ +#define round(tables, k1, k2) \ t = (k1) + r; \ l ^= tables[0][t & 0xff] ^ tables[1][(t >> 8) & 0xff] ^ \ tables[2][(t >> 16) & 0xff] ^ tables[3][t >> 24]; \ @@ -35,25 +35,25 @@ r ^= tables[0][t & 0xff] ^ tables[1][(t >> 8) & 0xff] ^ \ tables[2][(t >> 16) & 0xff] ^ tables[3][t >> 24]; -#define R(key, h, i, t, l, r) \ +#define R(tables, key, h, i, t, l, r) \ r = h[i]; \ l = h[i + 1]; \ - round(key[0], key[1]) \ - round(key[2], key[3]) \ - round(key[4], key[5]) \ - round(key[6], key[7]) \ - round(key[0], key[1]) \ - round(key[2], key[3]) \ - round(key[4], key[5]) \ - round(key[6], key[7]) \ - round(key[0], key[1]) \ - round(key[2], key[3]) \ - round(key[4], key[5]) \ - round(key[6], key[7]) \ - round(key[7], key[6]) \ - round(key[5], key[4]) \ - round(key[3], key[2]) \ - round(key[1], key[0]) \ + round(tables, key[0], key[1]) \ + round(tables, key[2], key[3]) \ + round(tables, key[4], key[5]) \ + round(tables, key[6], key[7]) \ + round(tables, key[0], key[1]) \ + round(tables, key[2], key[3]) \ + round(tables, key[4], key[5]) \ + round(tables, key[6], key[7]) \ + round(tables, key[0], key[1]) \ + round(tables, key[2], key[3]) \ + round(tables, key[4], key[5]) \ + round(tables, key[6], key[7]) \ + round(tables, key[7], key[6]) \ + round(tables, key[5], key[4]) \ + round(tables, key[3], key[2]) \ + round(tables, key[1], key[0]) \ t = r; \ r = l; \ l = t; \ @@ -194,10 +194,10 @@ (v[3] >> 16) ^ v[3] ^ (v[4] << 16) ^ v[4] ^ (v[5] >> 16) ^ v[5] ^ \ (v[6] << 16) ^ (v[6] >> 16) ^ (v[7] << 16) ^ v[7]; -#define PASS \ +#define PASS(tables) \ X(w, u, v); \ P(key, w); \ - R(key, h, i, t, l, r); \ + R((tables), key, h, i, t, l, r); \ S(s, l, r); \ if (i != 6) { \ A(u, l, r); \ @@ -207,16 +207,16 @@ AA(v, l, r); \ } -static inline void Gost(php_hash_uint32 state[8], php_hash_uint32 data[8]) +static inline void Gost(PHP_GOST_CTX *context, php_hash_uint32 data[8]) { int i; - php_hash_uint32 l, r, t, key[8], u[8], v[8], w[8], s[8], *h = state, *m = data; + php_hash_uint32 l, r, t, key[8], u[8], v[8], w[8], s[8], *h = context->state, *m = data; - memcpy(u, state, sizeof(u)); + memcpy(u, context->state, sizeof(u)); memcpy(v, data, sizeof(v)); for (i = 0; i < 8; i += 2) { - PASS; + PASS(*context->tables); } SHIFT12(u, m, s); SHIFT16(h, v, u); @@ -237,12 +237,19 @@ static inline void GostTransform(PHP_GOST_CTX *context, const unsigned char inpu temp = ((context->state[i + 8] < data[i]) || (context->state[i + 8] < save)) ? 1 : 0; } - Gost(context->state, data); + Gost(context, data); } PHP_HASH_API void PHP_GOSTInit(PHP_GOST_CTX *context) { memset(context, 0, sizeof(*context)); + context->tables = &tables_test; +} + +PHP_HASH_API void PHP_GOSTInitCrypto(PHP_GOST_CTX *context) +{ + PHP_GOSTInit(context); + context->tables = &tables_crypto; } static const php_hash_uint32 MAX32 = 0xffffffffLU; @@ -288,9 +295,9 @@ PHP_HASH_API void PHP_GOSTFinal(unsigned char digest[32], PHP_GOST_CTX *context) } memcpy(l, context->count, sizeof(context->count)); - Gost(context->state, l); + Gost(context, l); memcpy(l, &context->state[8], sizeof(l)); - Gost(context->state, l); + Gost(context, l); for (i = 0, j = 0; j < 32; i++, j += 4) { digest[j] = (unsigned char) (context->state[i] & 0xff); @@ -312,6 +319,16 @@ const php_hash_ops php_hash_gost_ops = { sizeof(PHP_GOST_CTX) }; +const php_hash_ops php_hash_gost_crypto_ops = { + (php_hash_init_func_t) PHP_GOSTInitCrypto, + (php_hash_update_func_t) PHP_GOSTUpdate, + (php_hash_final_func_t) PHP_GOSTFinal, + (php_hash_copy_func_t) php_hash_copy, + 32, + 32, + sizeof(PHP_GOST_CTX) +}; + /* * Local variables: * tab-width: 4 diff --git a/ext/hash/php_hash.h b/ext/hash/php_hash.h index 3f5e7ced3a19b..e92572216aea4 100644 --- a/ext/hash/php_hash.h +++ b/ext/hash/php_hash.h @@ -80,6 +80,7 @@ extern const php_hash_ops php_hash_4tiger160_ops; extern const php_hash_ops php_hash_4tiger192_ops; extern const php_hash_ops php_hash_snefru_ops; extern const php_hash_ops php_hash_gost_ops; +extern const php_hash_ops php_hash_gost_crypto_ops; extern const php_hash_ops php_hash_adler32_ops; extern const php_hash_ops php_hash_crc32_ops; extern const php_hash_ops php_hash_crc32b_ops; diff --git a/ext/hash/php_hash_gost.h b/ext/hash/php_hash_gost.h index 6a4af310dc64c..a9c137530c4ae 100644 --- a/ext/hash/php_hash_gost.h +++ b/ext/hash/php_hash_gost.h @@ -29,6 +29,7 @@ typedef struct { php_hash_uint32 count[2]; unsigned char length; unsigned char buffer[32]; + const php_hash_uint32 (*tables)[4][256]; } PHP_GOST_CTX; PHP_HASH_API void PHP_GOSTInit(PHP_GOST_CTX *); diff --git a/ext/hash/php_hash_gost_tables.h b/ext/hash/php_hash_gost_tables.h index 5d05e593cb13a..a00d8b74907d2 100644 --- a/ext/hash/php_hash_gost_tables.h +++ b/ext/hash/php_hash_gost_tables.h @@ -1,4 +1,4 @@ -static const php_hash_uint32 tables[4][256] = { +static const php_hash_uint32 tables_test[4][256] = { { /* table 1 */ 0x00072000LU, 0x00075000LU, 0x00074800LU, 0x00071000LU, 0x00076800LU, 0x00074000LU, 0x00070000LU, 0x00077000LU, 0x00073000LU, 0x00075800LU, 0x00070800LU, 0x00076000LU, 0x00073800LU, 0x00077800LU, 0x00072800LU, 0x00071800LU, @@ -136,3 +136,142 @@ static const php_hash_uint32 tables[4][256] = { 0x00000600LU, 0x00000650LU, 0x00000670LU, 0x00000638LU, 0x00000630LU, 0x00000640LU, 0x00000610LU, 0x00000660LU, }, }; + +static const php_hash_uint32 tables_crypto[4][256] = { + { /* table 1 */ + 0x0002d000LU, 0x0002a000LU, 0x0002a800LU, 0x0002b000LU, 0x0002c000LU, 0x00028800LU, 0x00029800LU, 0x0002b800LU, + 0x0002e800LU, 0x0002e000LU, 0x0002f000LU, 0x00028000LU, 0x0002c800LU, 0x00029000LU, 0x0002d800LU, 0x0002f800LU, + 0x0007d000LU, 0x0007a000LU, 0x0007a800LU, 0x0007b000LU, 0x0007c000LU, 0x00078800LU, 0x00079800LU, 0x0007b800LU, + 0x0007e800LU, 0x0007e000LU, 0x0007f000LU, 0x00078000LU, 0x0007c800LU, 0x00079000LU, 0x0007d800LU, 0x0007f800LU, + 0x00025000LU, 0x00022000LU, 0x00022800LU, 0x00023000LU, 0x00024000LU, 0x00020800LU, 0x00021800LU, 0x00023800LU, + 0x00026800LU, 0x00026000LU, 0x00027000LU, 0x00020000LU, 0x00024800LU, 0x00021000LU, 0x00025800LU, 0x00027800LU, + 0x00005000LU, 0x00002000LU, 0x00002800LU, 0x00003000LU, 0x00004000LU, 0x00000800LU, 0x00001800LU, 0x00003800LU, + 0x00006800LU, 0x00006000LU, 0x00007000LU, 0x00000000LU, 0x00004800LU, 0x00001000LU, 0x00005800LU, 0x00007800LU, + 0x00015000LU, 0x00012000LU, 0x00012800LU, 0x00013000LU, 0x00014000LU, 0x00010800LU, 0x00011800LU, 0x00013800LU, + 0x00016800LU, 0x00016000LU, 0x00017000LU, 0x00010000LU, 0x00014800LU, 0x00011000LU, 0x00015800LU, 0x00017800LU, + 0x0006d000LU, 0x0006a000LU, 0x0006a800LU, 0x0006b000LU, 0x0006c000LU, 0x00068800LU, 0x00069800LU, 0x0006b800LU, + 0x0006e800LU, 0x0006e000LU, 0x0006f000LU, 0x00068000LU, 0x0006c800LU, 0x00069000LU, 0x0006d800LU, 0x0006f800LU, + 0x0005d000LU, 0x0005a000LU, 0x0005a800LU, 0x0005b000LU, 0x0005c000LU, 0x00058800LU, 0x00059800LU, 0x0005b800LU, + 0x0005e800LU, 0x0005e000LU, 0x0005f000LU, 0x00058000LU, 0x0005c800LU, 0x00059000LU, 0x0005d800LU, 0x0005f800LU, + 0x0004d000LU, 0x0004a000LU, 0x0004a800LU, 0x0004b000LU, 0x0004c000LU, 0x00048800LU, 0x00049800LU, 0x0004b800LU, + 0x0004e800LU, 0x0004e000LU, 0x0004f000LU, 0x00048000LU, 0x0004c800LU, 0x00049000LU, 0x0004d800LU, 0x0004f800LU, + 0x0000d000LU, 0x0000a000LU, 0x0000a800LU, 0x0000b000LU, 0x0000c000LU, 0x00008800LU, 0x00009800LU, 0x0000b800LU, + 0x0000e800LU, 0x0000e000LU, 0x0000f000LU, 0x00008000LU, 0x0000c800LU, 0x00009000LU, 0x0000d800LU, 0x0000f800LU, + 0x0003d000LU, 0x0003a000LU, 0x0003a800LU, 0x0003b000LU, 0x0003c000LU, 0x00038800LU, 0x00039800LU, 0x0003b800LU, + 0x0003e800LU, 0x0003e000LU, 0x0003f000LU, 0x00038000LU, 0x0003c800LU, 0x00039000LU, 0x0003d800LU, 0x0003f800LU, + 0x00035000LU, 0x00032000LU, 0x00032800LU, 0x00033000LU, 0x00034000LU, 0x00030800LU, 0x00031800LU, 0x00033800LU, + 0x00036800LU, 0x00036000LU, 0x00037000LU, 0x00030000LU, 0x00034800LU, 0x00031000LU, 0x00035800LU, 0x00037800LU, + 0x0001d000LU, 0x0001a000LU, 0x0001a800LU, 0x0001b000LU, 0x0001c000LU, 0x00018800LU, 0x00019800LU, 0x0001b800LU, + 0x0001e800LU, 0x0001e000LU, 0x0001f000LU, 0x00018000LU, 0x0001c800LU, 0x00019000LU, 0x0001d800LU, 0x0001f800LU, + 0x00065000LU, 0x00062000LU, 0x00062800LU, 0x00063000LU, 0x00064000LU, 0x00060800LU, 0x00061800LU, 0x00063800LU, + 0x00066800LU, 0x00066000LU, 0x00067000LU, 0x00060000LU, 0x00064800LU, 0x00061000LU, 0x00065800LU, 0x00067800LU, + 0x00075000LU, 0x00072000LU, 0x00072800LU, 0x00073000LU, 0x00074000LU, 0x00070800LU, 0x00071800LU, 0x00073800LU, + 0x00076800LU, 0x00076000LU, 0x00077000LU, 0x00070000LU, 0x00074800LU, 0x00071000LU, 0x00075800LU, 0x00077800LU, + 0x00055000LU, 0x00052000LU, 0x00052800LU, 0x00053000LU, 0x00054000LU, 0x00050800LU, 0x00051800LU, 0x00053800LU, + 0x00056800LU, 0x00056000LU, 0x00057000LU, 0x00050000LU, 0x00054800LU, 0x00051000LU, 0x00055800LU, 0x00057800LU, + 0x00045000LU, 0x00042000LU, 0x00042800LU, 0x00043000LU, 0x00044000LU, 0x00040800LU, 0x00041800LU, 0x00043800LU, + 0x00046800LU, 0x00046000LU, 0x00047000LU, 0x00040000LU, 0x00044800LU, 0x00041000LU, 0x00045800LU, 0x00047800LU, + }, + { /* table 2 */ + 0x02380000LU, 0x02780000LU, 0x02600000LU, 0x02700000LU, 0x02480000LU, 0x02200000LU, 0x02080000LU, 0x02000000LU, + 0x02180000LU, 0x02580000LU, 0x02280000LU, 0x02100000LU, 0x02300000LU, 0x02500000LU, 0x02400000LU, 0x02680000LU, + 0x05380000LU, 0x05780000LU, 0x05600000LU, 0x05700000LU, 0x05480000LU, 0x05200000LU, 0x05080000LU, 0x05000000LU, + 0x05180000LU, 0x05580000LU, 0x05280000LU, 0x05100000LU, 0x05300000LU, 0x05500000LU, 0x05400000LU, 0x05680000LU, + 0x03b80000LU, 0x03f80000LU, 0x03e00000LU, 0x03f00000LU, 0x03c80000LU, 0x03a00000LU, 0x03880000LU, 0x03800000LU, + 0x03980000LU, 0x03d80000LU, 0x03a80000LU, 0x03900000LU, 0x03b00000LU, 0x03d00000LU, 0x03c00000LU, 0x03e80000LU, + 0x06380000LU, 0x06780000LU, 0x06600000LU, 0x06700000LU, 0x06480000LU, 0x06200000LU, 0x06080000LU, 0x06000000LU, + 0x06180000LU, 0x06580000LU, 0x06280000LU, 0x06100000LU, 0x06300000LU, 0x06500000LU, 0x06400000LU, 0x06680000LU, + 0x00380000LU, 0x00780000LU, 0x00600000LU, 0x00700000LU, 0x00480000LU, 0x00200000LU, 0x00080000LU, 0x00000000LU, + 0x00180000LU, 0x00580000LU, 0x00280000LU, 0x00100000LU, 0x00300000LU, 0x00500000LU, 0x00400000LU, 0x00680000LU, + 0x07b80000LU, 0x07f80000LU, 0x07e00000LU, 0x07f00000LU, 0x07c80000LU, 0x07a00000LU, 0x07880000LU, 0x07800000LU, + 0x07980000LU, 0x07d80000LU, 0x07a80000LU, 0x07900000LU, 0x07b00000LU, 0x07d00000LU, 0x07c00000LU, 0x07e80000LU, + 0x01380000LU, 0x01780000LU, 0x01600000LU, 0x01700000LU, 0x01480000LU, 0x01200000LU, 0x01080000LU, 0x01000000LU, + 0x01180000LU, 0x01580000LU, 0x01280000LU, 0x01100000LU, 0x01300000LU, 0x01500000LU, 0x01400000LU, 0x01680000LU, + 0x04380000LU, 0x04780000LU, 0x04600000LU, 0x04700000LU, 0x04480000LU, 0x04200000LU, 0x04080000LU, 0x04000000LU, + 0x04180000LU, 0x04580000LU, 0x04280000LU, 0x04100000LU, 0x04300000LU, 0x04500000LU, 0x04400000LU, 0x04680000LU, + 0x07380000LU, 0x07780000LU, 0x07600000LU, 0x07700000LU, 0x07480000LU, 0x07200000LU, 0x07080000LU, 0x07000000LU, + 0x07180000LU, 0x07580000LU, 0x07280000LU, 0x07100000LU, 0x07300000LU, 0x07500000LU, 0x07400000LU, 0x07680000LU, + 0x00b80000LU, 0x00f80000LU, 0x00e00000LU, 0x00f00000LU, 0x00c80000LU, 0x00a00000LU, 0x00880000LU, 0x00800000LU, + 0x00980000LU, 0x00d80000LU, 0x00a80000LU, 0x00900000LU, 0x00b00000LU, 0x00d00000LU, 0x00c00000LU, 0x00e80000LU, + 0x03380000LU, 0x03780000LU, 0x03600000LU, 0x03700000LU, 0x03480000LU, 0x03200000LU, 0x03080000LU, 0x03000000LU, + 0x03180000LU, 0x03580000LU, 0x03280000LU, 0x03100000LU, 0x03300000LU, 0x03500000LU, 0x03400000LU, 0x03680000LU, + 0x02b80000LU, 0x02f80000LU, 0x02e00000LU, 0x02f00000LU, 0x02c80000LU, 0x02a00000LU, 0x02880000LU, 0x02800000LU, + 0x02980000LU, 0x02d80000LU, 0x02a80000LU, 0x02900000LU, 0x02b00000LU, 0x02d00000LU, 0x02c00000LU, 0x02e80000LU, + 0x06b80000LU, 0x06f80000LU, 0x06e00000LU, 0x06f00000LU, 0x06c80000LU, 0x06a00000LU, 0x06880000LU, 0x06800000LU, + 0x06980000LU, 0x06d80000LU, 0x06a80000LU, 0x06900000LU, 0x06b00000LU, 0x06d00000LU, 0x06c00000LU, 0x06e80000LU, + 0x05b80000LU, 0x05f80000LU, 0x05e00000LU, 0x05f00000LU, 0x05c80000LU, 0x05a00000LU, 0x05880000LU, 0x05800000LU, + 0x05980000LU, 0x05d80000LU, 0x05a80000LU, 0x05900000LU, 0x05b00000LU, 0x05d00000LU, 0x05c00000LU, 0x05e80000LU, + 0x04b80000LU, 0x04f80000LU, 0x04e00000LU, 0x04f00000LU, 0x04c80000LU, 0x04a00000LU, 0x04880000LU, 0x04800000LU, + 0x04980000LU, 0x04d80000LU, 0x04a80000LU, 0x04900000LU, 0x04b00000LU, 0x04d00000LU, 0x04c00000LU, 0x04e80000LU, + 0x01b80000LU, 0x01f80000LU, 0x01e00000LU, 0x01f00000LU, 0x01c80000LU, 0x01a00000LU, 0x01880000LU, 0x01800000LU, + 0x01980000LU, 0x01d80000LU, 0x01a80000LU, 0x01900000LU, 0x01b00000LU, 0x01d00000LU, 0x01c00000LU, 0x01e80000LU, + }, + { /* table 3 */ + 0xb8000003LU, 0xb0000003LU, 0xa0000003LU, 0xd8000003LU, 0xc8000003LU, 0xe0000003LU, 0x90000003LU, 0xd0000003LU, + 0x88000003LU, 0xc0000003LU, 0x80000003LU, 0xf0000003LU, 0xf8000003LU, 0xe8000003LU, 0x98000003LU, 0xa8000003LU, + 0x38000003LU, 0x30000003LU, 0x20000003LU, 0x58000003LU, 0x48000003LU, 0x60000003LU, 0x10000003LU, 0x50000003LU, + 0x08000003LU, 0x40000003LU, 0x00000003LU, 0x70000003LU, 0x78000003LU, 0x68000003LU, 0x18000003LU, 0x28000003LU, + 0x38000001LU, 0x30000001LU, 0x20000001LU, 0x58000001LU, 0x48000001LU, 0x60000001LU, 0x10000001LU, 0x50000001LU, + 0x08000001LU, 0x40000001LU, 0x00000001LU, 0x70000001LU, 0x78000001LU, 0x68000001LU, 0x18000001LU, 0x28000001LU, + 0x38000002LU, 0x30000002LU, 0x20000002LU, 0x58000002LU, 0x48000002LU, 0x60000002LU, 0x10000002LU, 0x50000002LU, + 0x08000002LU, 0x40000002LU, 0x00000002LU, 0x70000002LU, 0x78000002LU, 0x68000002LU, 0x18000002LU, 0x28000002LU, + 0xb8000006LU, 0xb0000006LU, 0xa0000006LU, 0xd8000006LU, 0xc8000006LU, 0xe0000006LU, 0x90000006LU, 0xd0000006LU, + 0x88000006LU, 0xc0000006LU, 0x80000006LU, 0xf0000006LU, 0xf8000006LU, 0xe8000006LU, 0x98000006LU, 0xa8000006LU, + 0xb8000004LU, 0xb0000004LU, 0xa0000004LU, 0xd8000004LU, 0xc8000004LU, 0xe0000004LU, 0x90000004LU, 0xd0000004LU, + 0x88000004LU, 0xc0000004LU, 0x80000004LU, 0xf0000004LU, 0xf8000004LU, 0xe8000004LU, 0x98000004LU, 0xa8000004LU, + 0xb8000007LU, 0xb0000007LU, 0xa0000007LU, 0xd8000007LU, 0xc8000007LU, 0xe0000007LU, 0x90000007LU, 0xd0000007LU, + 0x88000007LU, 0xc0000007LU, 0x80000007LU, 0xf0000007LU, 0xf8000007LU, 0xe8000007LU, 0x98000007LU, 0xa8000007LU, + 0x38000000LU, 0x30000000LU, 0x20000000LU, 0x58000000LU, 0x48000000LU, 0x60000000LU, 0x10000000LU, 0x50000000LU, + 0x08000000LU, 0x40000000LU, 0x00000000LU, 0x70000000LU, 0x78000000LU, 0x68000000LU, 0x18000000LU, 0x28000000LU, + 0x38000005LU, 0x30000005LU, 0x20000005LU, 0x58000005LU, 0x48000005LU, 0x60000005LU, 0x10000005LU, 0x50000005LU, + 0x08000005LU, 0x40000005LU, 0x00000005LU, 0x70000005LU, 0x78000005LU, 0x68000005LU, 0x18000005LU, 0x28000005LU, + 0xb8000000LU, 0xb0000000LU, 0xa0000000LU, 0xd8000000LU, 0xc8000000LU, 0xe0000000LU, 0x90000000LU, 0xd0000000LU, + 0x88000000LU, 0xc0000000LU, 0x80000000LU, 0xf0000000LU, 0xf8000000LU, 0xe8000000LU, 0x98000000LU, 0xa8000000LU, + 0xb8000002LU, 0xb0000002LU, 0xa0000002LU, 0xd8000002LU, 0xc8000002LU, 0xe0000002LU, 0x90000002LU, 0xd0000002LU, + 0x88000002LU, 0xc0000002LU, 0x80000002LU, 0xf0000002LU, 0xf8000002LU, 0xe8000002LU, 0x98000002LU, 0xa8000002LU, + 0xb8000005LU, 0xb0000005LU, 0xa0000005LU, 0xd8000005LU, 0xc8000005LU, 0xe0000005LU, 0x90000005LU, 0xd0000005LU, + 0x88000005LU, 0xc0000005LU, 0x80000005LU, 0xf0000005LU, 0xf8000005LU, 0xe8000005LU, 0x98000005LU, 0xa8000005LU, + 0x38000004LU, 0x30000004LU, 0x20000004LU, 0x58000004LU, 0x48000004LU, 0x60000004LU, 0x10000004LU, 0x50000004LU, + 0x08000004LU, 0x40000004LU, 0x00000004LU, 0x70000004LU, 0x78000004LU, 0x68000004LU, 0x18000004LU, 0x28000004LU, + 0x38000007LU, 0x30000007LU, 0x20000007LU, 0x58000007LU, 0x48000007LU, 0x60000007LU, 0x10000007LU, 0x50000007LU, + 0x08000007LU, 0x40000007LU, 0x00000007LU, 0x70000007LU, 0x78000007LU, 0x68000007LU, 0x18000007LU, 0x28000007LU, + 0x38000006LU, 0x30000006LU, 0x20000006LU, 0x58000006LU, 0x48000006LU, 0x60000006LU, 0x10000006LU, 0x50000006LU, + 0x08000006LU, 0x40000006LU, 0x00000006LU, 0x70000006LU, 0x78000006LU, 0x68000006LU, 0x18000006LU, 0x28000006LU, + 0xb8000001LU, 0xb0000001LU, 0xa0000001LU, 0xd8000001LU, 0xc8000001LU, 0xe0000001LU, 0x90000001LU, 0xd0000001LU, + 0x88000001LU, 0xc0000001LU, 0x80000001LU, 0xf0000001LU, 0xf8000001LU, 0xe8000001LU, 0x98000001LU, 0xa8000001LU, + }, + { /* table 4 */ + 0x000000e8LU, 0x000000f0LU, 0x000000a0LU, 0x00000088LU, 0x000000b8LU, 0x00000080LU, 0x000000a8LU, 0x000000d0LU, + 0x00000098LU, 0x000000e0LU, 0x000000c0LU, 0x000000f8LU, 0x000000b0LU, 0x00000090LU, 0x000000c8LU, 0x000000d8LU, + 0x000001e8LU, 0x000001f0LU, 0x000001a0LU, 0x00000188LU, 0x000001b8LU, 0x00000180LU, 0x000001a8LU, 0x000001d0LU, + 0x00000198LU, 0x000001e0LU, 0x000001c0LU, 0x000001f8LU, 0x000001b0LU, 0x00000190LU, 0x000001c8LU, 0x000001d8LU, + 0x00000568LU, 0x00000570LU, 0x00000520LU, 0x00000508LU, 0x00000538LU, 0x00000500LU, 0x00000528LU, 0x00000550LU, + 0x00000518LU, 0x00000560LU, 0x00000540LU, 0x00000578LU, 0x00000530LU, 0x00000510LU, 0x00000548LU, 0x00000558LU, + 0x000004e8LU, 0x000004f0LU, 0x000004a0LU, 0x00000488LU, 0x000004b8LU, 0x00000480LU, 0x000004a8LU, 0x000004d0LU, + 0x00000498LU, 0x000004e0LU, 0x000004c0LU, 0x000004f8LU, 0x000004b0LU, 0x00000490LU, 0x000004c8LU, 0x000004d8LU, + 0x000002e8LU, 0x000002f0LU, 0x000002a0LU, 0x00000288LU, 0x000002b8LU, 0x00000280LU, 0x000002a8LU, 0x000002d0LU, + 0x00000298LU, 0x000002e0LU, 0x000002c0LU, 0x000002f8LU, 0x000002b0LU, 0x00000290LU, 0x000002c8LU, 0x000002d8LU, + 0x000005e8LU, 0x000005f0LU, 0x000005a0LU, 0x00000588LU, 0x000005b8LU, 0x00000580LU, 0x000005a8LU, 0x000005d0LU, + 0x00000598LU, 0x000005e0LU, 0x000005c0LU, 0x000005f8LU, 0x000005b0LU, 0x00000590LU, 0x000005c8LU, 0x000005d8LU, + 0x00000268LU, 0x00000270LU, 0x00000220LU, 0x00000208LU, 0x00000238LU, 0x00000200LU, 0x00000228LU, 0x00000250LU, + 0x00000218LU, 0x00000260LU, 0x00000240LU, 0x00000278LU, 0x00000230LU, 0x00000210LU, 0x00000248LU, 0x00000258LU, + 0x000007e8LU, 0x000007f0LU, 0x000007a0LU, 0x00000788LU, 0x000007b8LU, 0x00000780LU, 0x000007a8LU, 0x000007d0LU, + 0x00000798LU, 0x000007e0LU, 0x000007c0LU, 0x000007f8LU, 0x000007b0LU, 0x00000790LU, 0x000007c8LU, 0x000007d8LU, + 0x00000468LU, 0x00000470LU, 0x00000420LU, 0x00000408LU, 0x00000438LU, 0x00000400LU, 0x00000428LU, 0x00000450LU, + 0x00000418LU, 0x00000460LU, 0x00000440LU, 0x00000478LU, 0x00000430LU, 0x00000410LU, 0x00000448LU, 0x00000458LU, + 0x00000368LU, 0x00000370LU, 0x00000320LU, 0x00000308LU, 0x00000338LU, 0x00000300LU, 0x00000328LU, 0x00000350LU, + 0x00000318LU, 0x00000360LU, 0x00000340LU, 0x00000378LU, 0x00000330LU, 0x00000310LU, 0x00000348LU, 0x00000358LU, + 0x000003e8LU, 0x000003f0LU, 0x000003a0LU, 0x00000388LU, 0x000003b8LU, 0x00000380LU, 0x000003a8LU, 0x000003d0LU, + 0x00000398LU, 0x000003e0LU, 0x000003c0LU, 0x000003f8LU, 0x000003b0LU, 0x00000390LU, 0x000003c8LU, 0x000003d8LU, + 0x00000768LU, 0x00000770LU, 0x00000720LU, 0x00000708LU, 0x00000738LU, 0x00000700LU, 0x00000728LU, 0x00000750LU, + 0x00000718LU, 0x00000760LU, 0x00000740LU, 0x00000778LU, 0x00000730LU, 0x00000710LU, 0x00000748LU, 0x00000758LU, + 0x000006e8LU, 0x000006f0LU, 0x000006a0LU, 0x00000688LU, 0x000006b8LU, 0x00000680LU, 0x000006a8LU, 0x000006d0LU, + 0x00000698LU, 0x000006e0LU, 0x000006c0LU, 0x000006f8LU, 0x000006b0LU, 0x00000690LU, 0x000006c8LU, 0x000006d8LU, + 0x00000068LU, 0x00000070LU, 0x00000020LU, 0x00000008LU, 0x00000038LU, 0x00000000LU, 0x00000028LU, 0x00000050LU, + 0x00000018LU, 0x00000060LU, 0x00000040LU, 0x00000078LU, 0x00000030LU, 0x00000010LU, 0x00000048LU, 0x00000058LU, + 0x00000168LU, 0x00000170LU, 0x00000120LU, 0x00000108LU, 0x00000138LU, 0x00000100LU, 0x00000128LU, 0x00000150LU, + 0x00000118LU, 0x00000160LU, 0x00000140LU, 0x00000178LU, 0x00000130LU, 0x00000110LU, 0x00000148LU, 0x00000158LU, + 0x00000668LU, 0x00000670LU, 0x00000620LU, 0x00000608LU, 0x00000638LU, 0x00000600LU, 0x00000628LU, 0x00000650LU, + 0x00000618LU, 0x00000660LU, 0x00000640LU, 0x00000678LU, 0x00000630LU, 0x00000610LU, 0x00000648LU, 0x00000658LU, + }, +}; diff --git a/ext/hash/tests/gost.phpt b/ext/hash/tests/gost.phpt index b800e112e85c3..6ce00242b1a40 100644 --- a/ext/hash/tests/gost.phpt +++ b/ext/hash/tests/gost.phpt @@ -10,6 +10,13 @@ echo hash('gost', 'The quick brown fox jumps over the lazy cog'), "\n"; echo hash('gost', str_repeat('a', 31)), "\n"; echo hash('gost', str_repeat('a', 32)), "\n"; echo hash('gost', str_repeat('a', 33)), "\n"; + +echo hash('gost-crypto', ''), "\n"; +echo hash('gost-crypto', 'The quick brown fox jumps over the lazy dog'), "\n"; +echo hash('gost-crypto', 'The quick brown fox jumps over the lazy cog'), "\n"; +echo hash('gost-crypto', str_repeat('a', 31)), "\n"; +echo hash('gost-crypto', str_repeat('a', 32)), "\n"; +echo hash('gost-crypto', str_repeat('a', 33)), "\n"; ?> --EXPECT-- ce85b99cc46752fffee35cab9a7b0278abb4c2d2055cff685af4912c49490f8d @@ -18,3 +25,9 @@ a3ebc4daaab78b0be131dab5737a7f67e602670d543521319150d2e14eeec445 03840d6348763f11e28e7b1ecc4da0cdf7f898fa555b928ef684c6c5b8f46d9f fd1b746d9397e78edd311baef391450434271e02816caa37680d6d7381c79d4e 715e59cdc8ebde9fdf0fe2a2e811b3bf7f48209a01505e467d2cd2aa2bbb5ecf +981e5f3ca30c841487830f84fb433e13ac1101569b9c13584ac483234cd656c0 +9004294a361a508c586fe53d1f1b02746765e71b765472786e4770d565830a76 +a93124f5bf2c6d83c3bbf722bc55569310245ca5957541f4dbd7dfaf8137e6f2 +8978e06b0ecf54ea81ec51ca4e02bcb4eb390b3f04cb5f65ee8de195ffae591b +e121e3740ae94ca6d289e6d653ff31695783efff3dd960417a1098a0130fa720 +d3e8f22d9762a148ddfc84a6043d97a608604dae7c05baee72b55f559d03dd74 diff --git a/ext/hash/tests/hash_algos.phpt b/ext/hash/tests/hash_algos.phpt index 55796ecbce9aa..7773fe979a72d 100644 --- a/ext/hash/tests/hash_algos.phpt +++ b/ext/hash/tests/hash_algos.phpt @@ -18,7 +18,7 @@ var_dump(hash_algos()); ===Done=== --EXPECTF-- *** Testing hash_algos() : basic functionality *** -array(43) { +array(44) { [%d]=> string(3) "md2" [%d]=> @@ -64,6 +64,8 @@ array(43) { [%d]=> string(4) "gost" [%d]=> + string(11) "gost-crypto" + [%d]=> string(7) "adler32" [%d]=> string(5) "crc32" @@ -106,4 +108,4 @@ array(43) { [%d]=> string(10) "haval256,5" } -===Done=== \ No newline at end of file +===Done=== diff --git a/ext/hash/tests/hash_copy_001.phpt b/ext/hash/tests/hash_copy_001.phpt index 638b7f5fc109a..bb4a49da89712 100644 --- a/ext/hash/tests/hash_copy_001.phpt +++ b/ext/hash/tests/hash_copy_001.phpt @@ -97,6 +97,9 @@ string(64) "fbe88daa74c89b9e29468fa3cd3a657d31845e21bb58dd3f8d806f5179a85c26" string(4) "gost" string(64) "5820c7c4a0650587538b30ef4099f2b5993069758d5c847a552e6ef7360766a5" string(64) "5820c7c4a0650587538b30ef4099f2b5993069758d5c847a552e6ef7360766a5" +string(11) "gost-crypto" +string(64) "f7c4e35548d66aabe2b106f20515d289fde90969225d3d7b83f6dd12d694f043" +string(64) "f7c4e35548d66aabe2b106f20515d289fde90969225d3d7b83f6dd12d694f043" string(7) "adler32" string(8) "6f7c0928" string(8) "6f7c0928" @@ -226,6 +229,9 @@ string(64) "614ca924864fa0e8fa309aa0944e047d5edbfd4964a35858f4d8ec66a0fb88b0" string(4) "gost" string(64) "5820c7c4a0650587538b30ef4099f2b5993069758d5c847a552e6ef7360766a5" string(64) "a00961e371287c71c527a41c14564f13b6ed12ac7cd9d5f5dfb3542a25e28d3b" +string(11) "gost-crypto" +string(64) "f7c4e35548d66aabe2b106f20515d289fde90969225d3d7b83f6dd12d694f043" +string(64) "68ca9aea6729dc07d995fbe071a4b5c6490bb27fc4dc65ec0e96200d5e082996" string(7) "adler32" string(8) "6f7c0928" string(8) "d9141747" diff --git a/ext/imap/config.m4 b/ext/imap/config.m4 index 3efc245901695..d664215e6686e 100644 --- a/ext/imap/config.m4 +++ b/ext/imap/config.m4 @@ -198,9 +198,9 @@ if test "$PHP_IMAP" != "no"; then AC_MSG_ERROR(Cannot find rfc822.h. Please check your c-client installation.) fi - if test -r "$IMAP_DIR/c-client/c-client.a"; then + if test ! -r "$IMAP_DIR/c-client/libc-client.a" && test -r "$IMAP_DIR/c-client/c-client.a" ; then ln -s "$IMAP_DIR/c-client/c-client.a" "$IMAP_DIR/c-client/libc-client.a" >/dev/null 2>&1 - elif test -r "$IMAP_DIR/$PHP_LIBDIR/c-client.a"; then + elif test ! -r "$IMAP_DIR/$PHP_LIBDIR/libc-client.a" && test -r "$IMAP_DIR/$PHP_LIBDIR/c-client.a"; then ln -s "$IMAP_DIR/$PHP_LIBDIR/c-client.a" "$IMAP_DIR/$PHP_LIBDIR/libc-client.a" >/dev/null 2>&1 fi diff --git a/ext/intl/collator/collator_create.c b/ext/intl/collator/collator_create.c index b2a8c7f6bac07..7ed4c534394b4 100644 --- a/ext/intl/collator/collator_create.c +++ b/ext/intl/collator/collator_create.c @@ -27,7 +27,7 @@ /* {{{ */ static void collator_ctor(INTERNAL_FUNCTION_PARAMETERS) { - char* locale; + const char* locale; int locale_len = 0; zval* object; Collator_object* co; diff --git a/ext/intl/dateformat/dateformat_parse.c b/ext/intl/dateformat/dateformat_parse.c index 4193e890175b9..993077854646e 100644 --- a/ext/intl/dateformat/dateformat_parse.c +++ b/ext/intl/dateformat/dateformat_parse.c @@ -62,7 +62,7 @@ static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, char* tex } /* }}} */ -static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, UCalendar parsed_calendar, long calendar_field, char* key_name TSRMLS_DC) +static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, const UCalendar *parsed_calendar, long calendar_field, char* key_name TSRMLS_DC) { long calendar_field_val = ucal_get( parsed_calendar, calendar_field, &INTL_DATA_ERROR_CODE(dfo)); INTL_METHOD_CHECK_STATUS( dfo, "Date parsing - localtime failed : could not get a field from calendar" ); @@ -83,7 +83,7 @@ static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_va */ static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* text_to_parse, int32_t text_len, int32_t *parse_pos, zval *return_value TSRMLS_DC) { - UCalendar* parsed_calendar = NULL; + UCalendar *parsed_calendar = NULL; UChar* text_utf16 = NULL; int32_t text_utf16_len = 0; long isInDST = 0; @@ -92,7 +92,7 @@ static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* tex intl_convert_utf8_to_utf16(&text_utf16, &text_utf16_len, text_to_parse, text_len, &INTL_DATA_ERROR_CODE(dfo)); INTL_METHOD_CHECK_STATUS(dfo, "Error converting timezone to UTF-16" ); - parsed_calendar = udat_getCalendar(DATE_FORMAT_OBJECT(dfo)); + parsed_calendar = (UCalendar *)udat_getCalendar(DATE_FORMAT_OBJECT(dfo)); udat_parseCalendar( DATE_FORMAT_OBJECT(dfo), parsed_calendar, text_utf16, text_utf16_len, parse_pos, &INTL_DATA_ERROR_CODE(dfo)); if (text_utf16) { diff --git a/ext/intl/formatter/formatter_main.c b/ext/intl/formatter/formatter_main.c index d0671a88b5e47..0a568472c4835 100644 --- a/ext/intl/formatter/formatter_main.c +++ b/ext/intl/formatter/formatter_main.c @@ -27,7 +27,7 @@ /* {{{ */ static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) { - char* locale; + const char* locale; char* pattern = NULL; int locale_len = 0, pattern_len = 0; long style; diff --git a/ext/intl/intl_data.h b/ext/intl/intl_data.h index 6966dc289100b..66ca27ae79682 100644 --- a/ext/intl/intl_data.h +++ b/ext/intl/intl_data.h @@ -79,7 +79,7 @@ typedef struct _intl_data { int u8len; \ intl_convert_utf16_to_utf8(&u8value, &u8len, ustring, ulen, &INTL_DATA_ERROR_CODE((obj))); \ if((free_it)) { \ - efree((void *)ustring); \ + efree(ustring); \ } \ INTL_METHOD_CHECK_STATUS((obj), "Error converting value to UTF-8"); \ RETVAL_STRINGL(u8value, u8len, 0); \ diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index d1a86d8ee27f4..21b5847f2d339 100644 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -121,12 +121,15 @@ static int16_t findOffset(const char* const* list, const char* key) } /*}}}*/ -static char* getPreferredTag(char* gf_tag) +static char* getPreferredTag(const char* gf_tag) { char* result = NULL; int grOffset = 0; grOffset = findOffset( LOC_GRANDFATHERED ,gf_tag); + if(grOffset < 0) { + return NULL; + } if( grOffset < LOC_PREFERRED_GRANDFATHERED_LEN ){ /* return preferred tag */ result = estrdup( LOC_PREFERRED_GRANDFATHERED[grOffset] ); @@ -172,7 +175,7 @@ static int getStrrtokenPos(char* str, int savedPos) * returns -1 if no singleton * strtok equivalent search for singleton */ -static int getSingletonPos(char* str) +static int getSingletonPos(const char* str) { int result =-1; int i=0; @@ -248,7 +251,7 @@ PHP_NAMED_FUNCTION(zif_locale_set_default) * common code shared by get_primary_language,get_script or get_region or get_variant * result = 0 if error, 1 if successful , -1 if no value */ -static char* get_icu_value_internal( char* loc_name , char* tag_name, int* result , int fromParseLocale) +static char* get_icu_value_internal( const char* loc_name , char* tag_name, int* result , int fromParseLocale) { char* tag_value = NULL; int32_t tag_value_len = 512; @@ -278,7 +281,7 @@ static char* get_icu_value_internal( char* loc_name , char* tag_name, int* resul /* Handle singletons */ if( strcmp(tag_name , LOC_LANG_TAG)==0 ){ if( strlen(loc_name)>1 && (isIDPrefix(loc_name) ==1 ) ){ - return loc_name; + return (char *)loc_name; } } @@ -367,7 +370,7 @@ static char* get_icu_value_internal( char* loc_name , char* tag_name, int* resul static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS) { - char* loc_name = NULL; + const char* loc_name = NULL; int loc_name_len = 0; char* tag_value = NULL; @@ -462,10 +465,10 @@ PHP_FUNCTION(locale_get_primary_language ) }}} */ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS) { - char* loc_name = NULL; + const char* loc_name = NULL; int loc_name_len = 0; - char* disp_loc_name = NULL; + const char* disp_loc_name = NULL; int disp_loc_name_len = 0; int free_loc_name = 0; @@ -558,7 +561,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME efree( mod_loc_name ); } if (free_loc_name) { - efree(disp_loc_name); + efree((void *)disp_loc_name); disp_loc_name = NULL; } RETURN_FALSE; @@ -569,7 +572,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME efree( mod_loc_name ); } if (free_loc_name) { - efree(disp_loc_name); + efree((void *)disp_loc_name); disp_loc_name = NULL; } /* Convert display locale name from UTF-16 to UTF-8. */ @@ -663,10 +666,10 @@ PHP_FUNCTION( locale_get_keywords ) UEnumeration* e = NULL; UErrorCode status = U_ZERO_ERROR; - const char* kw_key = NULL; + const char* kw_key = NULL; int32_t kw_key_len = 0; - char* loc_name = NULL; + const char* loc_name = NULL; int loc_name_len = 0; /* @@ -713,7 +716,7 @@ PHP_FUNCTION( locale_get_keywords ) kw_value = erealloc( kw_value , kw_value_len+1); } if (U_FAILURE(status)) { - intl_error_set( NULL, FAILURE, "locale_get_keywords: Error encountered while getting the keyword value for the keyword", 0 TSRMLS_CC ); + intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "locale_get_keywords: Error encountered while getting the keyword value for the keyword", 0 TSRMLS_CC ); if( kw_value){ efree( kw_value ); } @@ -971,12 +974,12 @@ PHP_FUNCTION(locale_compose) * e.g. for locale='en_US-x-prv1-prv2-prv3' * returns a pointer to the string 'prv1-prv2-prv3' */ -static char* get_private_subtags(char* loc_name) +static char* get_private_subtags(const char* loc_name) { char* result =NULL; int singletonPos = 0; int len =0; - char* mod_loc_name =NULL; + const char* mod_loc_name =NULL; if( loc_name && (len = strlen(loc_name)>0 ) ){ mod_loc_name = loc_name ; @@ -1016,7 +1019,7 @@ static char* get_private_subtags(char* loc_name) /* {{{ code used by locale_parse */ -static int add_array_entry(char* loc_name, zval* hash_arr, char* key_name TSRMLS_DC) +static int add_array_entry(const char* loc_name, zval* hash_arr, char* key_name TSRMLS_DC) { char* key_value = NULL; char* cur_key_name = NULL; @@ -1081,7 +1084,7 @@ static int add_array_entry(char* loc_name, zval* hash_arr, char* key_name TSRMLS */ PHP_FUNCTION(locale_parse) { - char* loc_name = NULL; + const char* loc_name = NULL; int loc_name_len = 0; int grOffset = 0; @@ -1125,8 +1128,8 @@ PHP_FUNCTION(locale_parse) */ PHP_FUNCTION(locale_get_all_variants) { - char* loc_name = NULL; - int loc_name_len = 0; + const char* loc_name = NULL; + int loc_name_len = 0; int result = 0; char* token = NULL; @@ -1179,10 +1182,10 @@ PHP_FUNCTION(locale_get_all_variants) /*{{{ * Converts to lower case and also replaces all hyphens with the underscore */ -static int strToMatch(char* str ,char *retstr) +static int strToMatch(const char* str ,char *retstr) { char* anchor = NULL; - char* anchor1 = NULL; + const char* anchor1 = NULL; int result = 0; int len = 0; @@ -1222,7 +1225,7 @@ PHP_FUNCTION(locale_filter_matches) { char* lang_tag = NULL; int lang_tag_len = 0; - char* loc_range = NULL; + const char* loc_range = NULL; int loc_range_len = 0; int result = 0; @@ -1398,7 +1401,7 @@ static void array_cleanup( char* arr[] , int arr_size) * returns the lookup result to lookup_loc_range_src_php * internal function */ -static char* lookup_loc_range(char* loc_range, HashTable* hash_arr, int canonicalize TSRMLS_DC) +static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int canonicalize TSRMLS_DC) { int i = 0; int cur_arr_len = 0; @@ -1520,7 +1523,7 @@ PHP_FUNCTION(locale_lookup) { char* fallback_loc = NULL; int fallback_loc_len = 0; - char* loc_range = NULL; + const char* loc_range = NULL; int loc_range_len = 0; zval* arr = NULL; diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index 6a9f04f32b463..7d8cd958e3c08 100644 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -28,7 +28,7 @@ /* {{{ */ static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) { - char* locale; + const char* locale; char* pattern; int locale_len = 0, pattern_len = 0; UChar* spattern = NULL; diff --git a/ext/intl/msgformat/msgformat_format.c b/ext/intl/msgformat/msgformat_format.c index 4b81cfe2b454c..55ec9e84ba0e8 100644 --- a/ext/intl/msgformat/msgformat_format.c +++ b/ext/intl/msgformat/msgformat_format.c @@ -103,7 +103,7 @@ PHP_FUNCTION( msgfmt_format_message ) int spattern_len = 0; char *pattern = NULL; int pattern_len = 0; - char *slocale = NULL; + const char *slocale = NULL; int slocale_len = 0; MessageFormatter_object mf = {0}; MessageFormatter_object *mfo = &mf; diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp index c4456d54f3c84..f75fd91dce775 100644 --- a/ext/intl/msgformat/msgformat_helpers.cpp +++ b/ext/intl/msgformat/msgformat_helpers.cpp @@ -209,6 +209,9 @@ static HashTable *umsg_parse_format(MessageFormatter_object *mfo, continue; } } + } else { + intl_errors_set(&err, U_INVALID_FORMAT_ERROR, "Invalid part type encountered", 0 TSRMLS_CC); + continue; } UMessagePatternArgType argType = p.getArgType(); diff --git a/ext/intl/msgformat/msgformat_parse.c b/ext/intl/msgformat/msgformat_parse.c index 413d3b1f15d89..14a6363424bf0 100644 --- a/ext/intl/msgformat/msgformat_parse.c +++ b/ext/intl/msgformat/msgformat_parse.c @@ -93,7 +93,7 @@ PHP_FUNCTION( msgfmt_parse_message ) int spattern_len = 0; char *pattern = NULL; int pattern_len = 0; - char *slocale = NULL; + const char *slocale = NULL; int slocale_len = 0; char *source = NULL; int src_len = 0; diff --git a/ext/intl/resourcebundle/resourcebundle.c b/ext/intl/resourcebundle/resourcebundle.c index 6d39dfb7e082e..f5475faf1c5a3 100644 --- a/ext/intl/resourcebundle/resourcebundle.c +++ b/ext/intl/resourcebundle/resourcebundle.c @@ -41,7 +41,7 @@ void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *so case URES_STRING: ufield = ures_getString( source->child, &ilen, &INTL_DATA_ERROR_CODE(source) ); INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve string value"); - INTL_METHOD_RETVAL_UTF8(source, ufield, ilen, 0); + INTL_METHOD_RETVAL_UTF8(source, (UChar *)ufield, ilen, 0); break; case URES_BINARY: diff --git a/ext/intl/tests/bug58756_MessageFormatter.phpt b/ext/intl/tests/bug58756_MessageFormatter.phpt index bbe96b7045a10..18566b666c9c4 100644 --- a/ext/intl/tests/bug58756_MessageFormatter.phpt +++ b/ext/intl/tests/bug58756_MessageFormatter.phpt @@ -4,6 +4,9 @@ Bug #58756: w.r.t MessageFormatter = 0) + die('skip for ICU < 51.2'); +?> --FILE-- format(array($time, 'date')), " ", --EXPECT-- date: Tuesday, July 7, 2009 8:41:13 PM EDT msgf: Tuesday, July 7, 2009 8:41:13 PM EDT -==DONE== \ No newline at end of file +==DONE== diff --git a/ext/intl/tests/bug58756_MessageFormatter_variant2.phpt b/ext/intl/tests/bug58756_MessageFormatter_variant2.phpt new file mode 100644 index 0000000000000..4fcfdbc08c073 --- /dev/null +++ b/ext/intl/tests/bug58756_MessageFormatter_variant2.phpt @@ -0,0 +1,37 @@ +--TEST-- +Bug #58756: w.r.t MessageFormatter +--SKIPIF-- += 51.2'); +?> +--FILE-- +format(array($time)) . "\n"; + +//NOT FIXED: +/*$msgf = new MessageFormatter('en_US', +'{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}'); + +echo "msgf2: ", $msgf->format(array($time, 'date')), " ", + $msgf->format(array($time, 'time')), "\n"; +*/ + +?> +==DONE== +--EXPECT-- +date: Tuesday, July 7, 2009 8:41:13 PM EDT +msgf: Tuesday, July 7, 2009 8:41:13 PM usnyc +==DONE== diff --git a/ext/intl/tests/collator_asort.phpt b/ext/intl/tests/collator_asort.phpt index a614ddc3f88e2..308f3a3ca3742 100644 --- a/ext/intl/tests/collator_asort.phpt +++ b/ext/intl/tests/collator_asort.phpt @@ -2,6 +2,7 @@ asort() --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 51.2'); ?> +--FILE-- + 'y' , + 'c' => 'i' , + 'a' => 'k' ), + + array( 'a' => 'a' , + 'b' => 'aaa', + 'c' => 'aa' ), + + array( 'a' => 'a' , + 'aaa'=> 'a' , + 'aa' => 'a' ), + + array( '1' => 'abc', + '5' => '!' , + '2' => null , + '7' => '' ), + + array( '1' => '100', + '2' => '25' , + '3' => '36' ), + + array( '1' => 5 , + '2' => '30' , + '3' => 2 ) + ); + + $res_str .= sort_arrays( 'en_US', $test_params ); + + // Sort an array in SORT_STRING mode using en_US locale. + $test_params = array( + array( '1' => '100', + '2' => '25' , + '3' => '36' ), + + array( '1' => 5 , + '2' => '30' , + '3' => 2 ), + + array( '1' => 'd' , + '2' => '' , + '3' => ' a' ), + + array( '1' => 'y' , + '2' => 'k' , + '3' => 'i' ) + ); + + $res_str .= sort_arrays( 'en_US', $test_params, Collator::SORT_STRING ); + + // Sort a non-ASCII array using ru_RU locale. + $test_params = array( + array( 'п' => 'у', + 'б' => 'в', + 'е' => 'а' ), + + array( '1' => 'п', + '4' => '', + '7' => 'd', + '2' => 'пп' ) + ); + + $res_str .= sort_arrays( 'ru_RU', $test_params ); + + + // Sort an array using Lithuanian locale. + $test_params = array( + array( 'd' => 'y', + 'c' => 'i', + 'a' => 'k' ) + ); + + $res_str .= sort_arrays( 'lt_LT', $test_params ); + + return $res_str . "\n"; +} + +include_once( 'ut_common.inc' ); +ut_run(); +?> +--EXPECT-- +Test 1.162b81ac12878b817fc39063097e45b5: +array ( + 'c' => 'i', + 'a' => 'k', + 'd' => 'y', +) + Result: true + +Test 2.93d96e22f692d8a281b0a389f01f8d1e: +array ( + 'a' => 'a', + 'c' => 'aa', + 'b' => 'aaa', +) + Result: true + +Test 3.9f25de4482bc7b58de508e278113317c: +array ( + 'aa' => 'a', + 'aaa' => 'a', + 'a' => 'a', +) + Result: true + +Test 4.a85a41ea78e45b651080cfd98c0b431d: +array ( + 7 => '', + 2 => NULL, + 5 => '!', + 1 => 'abc', +) + Result: true + +Test 5.99dc71f405b286e03d489061b36e6900: +array ( + 2 => '25', + 3 => '36', + 1 => '100', +) + Result: true + +Test 6.bf5bba243307c9d12934e756ad4be190: +array ( + 3 => 2, + 1 => 5, + 2 => '30', +) + Result: true + +Test 7.e4ee7024c61476e9e7a6c28b5e47df6f: +array ( + 1 => '100', + 2 => '25', + 3 => '36', +) + Result: true + +Test 8.5fa7033dd43784be0db1474eb48b83c8: +array ( + 3 => 2, + 2 => '30', + 1 => 5, +) + Result: true + +Test 9.588cdf4692bc09aa92ffe7e48f9e4579: +array ( + 2 => '', + 3 => ' a', + 1 => 'd', +) + Result: true + +Test 10.be02641a47ebcccd23e4183ca3a415f7: +array ( + 3 => 'i', + 2 => 'k', + 1 => 'y', +) + Result: true + +Test 11.153d9b11d1e5936afc917a94a4e11f34: +array ( + 'е' => 'а', + 'б' => 'в', + 'п' => 'у', +) + Result: true + +Test 12.e1f5cb037b564dce39ffbd0a61562d59: +array ( + 4 => '', + 1 => 'п', + 2 => 'пп', + 7 => 'd', +) + Result: true + +Test 13.8800d48abb960a59002eef77f1d73ae0: +array ( + 'c' => 'i', + 'd' => 'y', + 'a' => 'k', +) + Result: true diff --git a/ext/intl/tests/collator_compare.phpt b/ext/intl/tests/collator_compare.phpt index f10b5708f405c..7c07204b70309 100644 --- a/ext/intl/tests/collator_compare.phpt +++ b/ext/intl/tests/collator_compare.phpt @@ -2,6 +2,7 @@ compare() --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 51.2'); ?> +--FILE-- +'; + case -1: // UCOL_LESS + return '<'; + default: + return '?'; + } +} + +/* + * Compare string pairs in the given array + * using specified locale. + */ +function compare_pairs( $locale, $test_array ) +{ + $res_str = ''; + + $coll = ut_coll_create( $locale ); + + foreach( $test_array as $test_strings ) + { + list( $str1, $str2 ) = $test_strings; + + // Compare strings. + $res_val = cmp_to_char( ut_coll_compare( $coll, $str1, $str2 ) ); + + // Concatenate result strings. + $res_str .= dump( $str1 ) . + ' ' . $res_val . ' ' . + dump( $str2 ) . "\n"; + } + + return $res_str; + +} + +function ut_main() +{ + $res_str = ''; + + // Compare strings using en_US locale. + $test_params = array( + array( 'abc', 'abc' ), + array( 'Abc', 'abc' ), + array( 'a' , 'abc' ), + array( 'a' , '' ), + array( '' , '' ), + array( 'a' , 'b' ), + array( 'ab' , 'b' ), + array( 'ab' , 'a' ), + array( 123 , 'abc' ), + array( 'ac' , null ), + array( '.' , '.' ), + // Try to compare long strings. + array( 'abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcde', + 'abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdea'), + array( null , null ) + ); + + $res_str .= compare_pairs( 'en_US', $test_params ); + + + // Compare strings using ru_RU locale. + $test_params = array( + array( 'а', 'б' ), + array( 'а', 'аа' ), + array( 'аб', 'ба' ), + array( 'а', ',' ), + array( 'а', 'b' ), + array( 'а', 'bb' ), + array( 'а', 'ab' ), + array( 'а', null ) + ); + + $res_str .= compare_pairs( 'ru_RU', $test_params ); + + + // Compare strings using lt_LT locale. + $test_params = array( + array( 'y', 'k' ) + ); + + $res_str .= compare_pairs( 'lt_LT', $test_params ); + + return $res_str; +} + +include_once( 'ut_common.inc' ); +ut_run(); +?> +--EXPECT-- +'abc' = 'abc' +'Abc' > 'abc' +'a' < 'abc' +'a' > '' +'' = '' +'a' < 'b' +'ab' < 'b' +'ab' > 'a' +123 < 'abc' +'ac' > NULL +'.' = '.' +'abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcde' < 'abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdea' +NULL = NULL +'а' < 'б' +'а' < 'аа' +'аб' < 'ба' +'а' > ',' +'а' < 'b' +'а' < 'bb' +'а' < 'ab' +'а' > NULL +'y' < 'k' diff --git a/ext/intl/tests/collator_get_sort_key.phpt b/ext/intl/tests/collator_get_sort_key.phpt index a9c4d71348129..58240d426c52c 100644 --- a/ext/intl/tests/collator_get_sort_key.phpt +++ b/ext/intl/tests/collator_get_sort_key.phpt @@ -3,6 +3,8 @@ collator_get_sort_key() --SKIPIF-- = 4.8 only'; ?> += 4.8 and < 51.2 */ +if (version_compare(INTL_ICU_VERSION, '51.2') >= 0) die('skip for ICU < 51.2'); ?> --FILE-- += 51.2'); ?> +--FILE-- + +--EXPECT-- +source: abc +key: 27292b01070107 +source: abd +key: 27292d01070107 +source: aaa +key: 27272701070107 +source: аа +key: 5c0a0a01060106 +source: а +key: 5c0a01050105 +source: z +key: 5901050105 +source: +key: 0101 +source: +key: 0101 +source: 3 +key: 1801050105 +source: y +key: 5701050105 +source: i +key: 3701050105 +source: k +key: 3b01050105 +source: абг +key: 260a161a01070107 +source: абв +key: 260a161801070107 +source: жжж +key: 263a3a3a01070107 +source: эюя +key: 273b3f4501070107 +source: абг +key: 5c0a161a01070107 +source: абв +key: 5c0a161801070107 +source: жжж +key: 5c3a3a3a01070107 +source: эюя +key: 5d3b3f4501070107 diff --git a/ext/intl/tests/collator_sort.phpt b/ext/intl/tests/collator_sort.phpt index 5cefe2fd7cefd..e16eeea1e8503 100644 --- a/ext/intl/tests/collator_sort.phpt +++ b/ext/intl/tests/collator_sort.phpt @@ -2,6 +2,7 @@ sort() --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 51.2'); ?> +--FILE-- + +--EXPECT-- +Test 1.e8f1cd28133d79ecd660002f1c660d0e: +array ( + 0 => 'aaa', + 1 => 'abc', + 2 => 'abd', +) + Result: true + +Test 2.c2ded12173dd2996927378cae37eb275: +array ( + 0 => '_', + 1 => '1', + 2 => 'm', +) + Result: true + +Test 3.54071c968d71cb98c5d379145f8d7d38: +array ( + 0 => 'a', + 1 => 'aa', + 2 => 'aaa', +) + Result: true + +Test 4.19abe63d6f6dfef65b0e3c9ab4826b07: +array ( + 0 => 'ab', + 1 => 'b', + 2 => 'ba', +) + Result: true + +Test 5.9a8dc0a9bc771368c2f1fc3d02754610: +array ( + 0 => 'a', + 1 => 'c', + 2 => 'e', +) + Result: true + +Test 6.ab530b060e5e54a65bfb8b9f8fc61870: +array ( + 0 => '25', + 1 => '36', + 2 => '100', +) + Result: true + +Test 7.0718dd838509017bded2ed307a6e785f: +array ( + 0 => 2, + 1 => 5, + 2 => '30', +) + Result: true + +Test 8.923d65739c5219c634616ffd100a50e4: +array ( + 0 => '', + 1 => ' a', + 2 => 'd', +) + Result: true + +Test 9.289bc2f28e87d3201ec9d7e8477ae1b0: +array ( + 0 => ' a', + 1 => 'd ', + 2 => 'f ', +) + Result: true + +Test 10.de0fd958484f2377a645835d7fbcf124: +array ( + 0 => NULL, + 1 => '3', + 2 => 'a', +) + Result: true + +Test 11.dd2b8f0adb37c45d528cad1a0cc0f361: +array ( + 0 => 'i', + 1 => 'k', + 2 => 'y', +) + Result: true + +Test 12.1e6b4d6f7df9d4580317634ea46d8208: +array ( + 0 => '100', + 1 => '25', + 2 => '36', +) + Result: true + +Test 13.cec115dc9850b98dfbdf102efa09e61b: +array ( + 0 => 2, + 1 => '30', + 2 => 5, +) + Result: true + +Test 14.923d65739c5219c634616ffd100a50e4: +array ( + 0 => '', + 1 => ' a', + 2 => 'd', +) + Result: true + +Test 15.dd2b8f0adb37c45d528cad1a0cc0f361: +array ( + 0 => 'i', + 1 => 'k', + 2 => 'y', +) + Result: true + +Test 16.49056308afb2b800363c5baa735ed247: +array ( + 0 => 'ааа', + 1 => 'абв', + 2 => 'абг', + 3 => 'abc', +) + Result: true + +Test 17.91480b10473a0c96a4cd6d88c23c577a: +array ( + 0 => 'а', + 1 => 'аа', + 2 => 'ааа', +) + Result: true + +Test 18.fdd3fe3981476039164aa000bf9177f2: +array ( + 0 => 'i', + 1 => 'y', + 2 => 'k', +) + Result: true diff --git a/ext/intl/tests/collator_sort_with_sort_keys.phpt b/ext/intl/tests/collator_sort_with_sort_keys.phpt index 2f489d745cb90..8be9c97789cc6 100644 --- a/ext/intl/tests/collator_sort_with_sort_keys.phpt +++ b/ext/intl/tests/collator_sort_with_sort_keys.phpt @@ -2,6 +2,7 @@ sort_with_sort_keys() --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 51.2'); ?> +--FILE-- + +--EXPECT-- +Test 1.e8f1cd28133d79ecd660002f1c660d0e: +array ( + 0 => 'aaa', + 1 => 'abc', + 2 => 'abd', +) + Result: true + +Test 2.c2ded12173dd2996927378cae37eb275: +array ( + 0 => '_', + 1 => '1', + 2 => 'm', +) + Result: true + +Test 3.54071c968d71cb98c5d379145f8d7d38: +array ( + 0 => 'a', + 1 => 'aa', + 2 => 'aaa', +) + Result: true + +Test 4.19abe63d6f6dfef65b0e3c9ab4826b07: +array ( + 0 => 'ab', + 1 => 'b', + 2 => 'ba', +) + Result: true + +Test 5.9a8dc0a9bc771368c2f1fc3d02754610: +array ( + 0 => 'a', + 1 => 'c', + 2 => 'e', +) + Result: true + +Test 6.923d65739c5219c634616ffd100a50e4: +array ( + 0 => '', + 1 => ' a', + 2 => 'd', +) + Result: true + +Test 7.289bc2f28e87d3201ec9d7e8477ae1b0: +array ( + 0 => ' a', + 1 => 'd ', + 2 => 'f ', +) + Result: true + +Test 8.de0fd958484f2377a645835d7fbcf124: +array ( + 0 => NULL, + 1 => '3', + 2 => 'a', +) + Result: true + +Test 9.dd2b8f0adb37c45d528cad1a0cc0f361: +array ( + 0 => 'i', + 1 => 'k', + 2 => 'y', +) + Result: true + +Test 10.49056308afb2b800363c5baa735ed247: +array ( + 0 => 'ааа', + 1 => 'абв', + 2 => 'абг', + 3 => 'abc', +) + Result: true + +Test 11.91480b10473a0c96a4cd6d88c23c577a: +array ( + 0 => 'а', + 1 => 'аа', + 2 => 'ааа', +) + Result: true + +Test 12.fdd3fe3981476039164aa000bf9177f2: +array ( + 0 => 'i', + 1 => 'y', + 2 => 'k', +) + Result: true diff --git a/ext/intl/tests/dateformat_calendars.phpt b/ext/intl/tests/dateformat_calendars.phpt index 6af02e51c14e6..2239af28dfc68 100644 --- a/ext/intl/tests/dateformat_calendars.phpt +++ b/ext/intl/tests/dateformat_calendars.phpt @@ -4,8 +4,8 @@ IntlDateFormatter, calendars and time zone date.timezone=Atlantic/Azores --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 51.2'); ?> +--FILE-- +format(strtotime('2012-01-01 00:00:00 +0000'))); +var_dump($fmt2->format(strtotime('2012-01-01 00:00:00 +0000'))); +var_dump($fmt3->format(strtotime('2012-01-01 00:00:00 +0000'))); + +new IntlDateFormatter('en_US@calendar=hebrew', + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + -1); +?> +==DONE== +--EXPECTF-- +string(47) "Sunday, January 1, 2012 at 5:12:00 AM GMT+05:12" +string(47) "Sunday, January 1, 2012 at 5:12:00 AM GMT+05:12" +string(48) "Sunday, Tevet 6, 5772 AM at 5:12:00 AM GMT+05:12" + +Warning: IntlDateFormatter::__construct(): datefmt_create: invalid value for calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's default calendar) or IntlDateFormatter::GREGORIAN. Alternatively, it can be an IntlCalendar object in %sdateformat_calendars_variant2.php on line %d +==DONE== diff --git a/ext/intl/tests/dateformat_create_cal_arg.phpt b/ext/intl/tests/dateformat_create_cal_arg.phpt index 53fb084af95e6..a8f351247bde4 100644 --- a/ext/intl/tests/dateformat_create_cal_arg.phpt +++ b/ext/intl/tests/dateformat_create_cal_arg.phpt @@ -2,8 +2,8 @@ IntlDateFormatter: several forms of the calendar arg --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 51.2'); ?> +--FILE-- +format($ts), "\n"; + +$cal = IntlCalendar::createInstance('UTC', 'en@calendar=islamic'); +$df = new IntlDateFormatter('es_ES', 0, 0, NULL, $cal); +echo $df->format($ts), "\n"; + +//override calendar's timezone +$cal = new IntlGregorianCalendar('UTC', NULL); +$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Madrid', $cal); +echo $df->format($ts), "\n"; + +//default calendar is gregorian +$df = new IntlDateFormatter('es_ES@calendar=islamic', 0, 0); +echo $df->format($ts), "\n"; + +//try now with traditional +$df = new IntlDateFormatter('es_ES@calendar=islamic', 0, 0, NULL, IntlDateFormatter::TRADITIONAL); +echo $df->format($ts), "\n"; + +//the timezone can be overridden when not specifying a calendar +$df = new IntlDateFormatter('es_ES@calendar=islamic', 0, 0, 'UTC', IntlDateFormatter::TRADITIONAL); +echo $df->format($ts), "\n"; + +$df = new IntlDateFormatter('es_ES', 0, 0, 'UTC', 0); +echo $df->format($ts), "\n"; + +?> +==DONE== +--EXPECTF-- +domingo%S 1 de enero de 2012 00:00:00 GMT +domingo%S 8 de Safar de 1433 00:00:00 GMT +domingo%S 1 de enero de 2012 01:00:00 Hora estándar de Europa central +sábado%S 31 de diciembre de 2011 d.C. 23:00:00 Hora %Sde las Azores +sábado%S 7 de Safar de 1433 AH 23:00:00 Hora %Sde las Azores +domingo%S 8 de Safar de 1433 AH 00:00:00 GMT +domingo%S 1 de enero de 2012 00:00:00 GMT +==DONE== diff --git a/ext/intl/tests/dateformat_format.phpt b/ext/intl/tests/dateformat_format.phpt index 8664eea319888..c3f6c297d96df 100644 --- a/ext/intl/tests/dateformat_format.phpt +++ b/ext/intl/tests/dateformat_format.phpt @@ -2,6 +2,7 @@ datefmt_format_code() --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 51.2'); ?> +--FILE-- +setTime(strtotime('2012-01-01 00:00:00')*1000.); +echo IntlDateFormatter::formatObject($cal), "\n"; +echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n"; + +?> +==DONE== + +--EXPECTF-- +01/01/2012, 00:00:00 +Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental +Jan 1, 2012, 12:00:00 AM +1/1/12, 12:00:00 AM Western European Standard %STime +Sun 2012-01-1 00,00,00.000 Portugal Time +Domingo, 1 de Janeiro de 2012 às 05:00:00 GMT+03:00 +06/02/1433, 00:00:00 +Sunday, Safar 6, 1433 at 12:00:00 AM Western European Standard Time +==DONE== diff --git a/ext/intl/tests/dateformat_formatObject_datetime.phpt b/ext/intl/tests/dateformat_formatObject_datetime.phpt index 6427ad5a988c6..d9ddb0e644324 100644 --- a/ext/intl/tests/dateformat_formatObject_datetime.phpt +++ b/ext/intl/tests/dateformat_formatObject_datetime.phpt @@ -2,8 +2,8 @@ IntlDateFormatter::formatObject(): DateTime tests --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 51.2'); ?> +--FILE-- + +==DONE== + +--EXPECTF-- +01/01/2012, 00:00:00 +Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental +Jan 1, 2012, 12:00:00 AM +1/1/12, 12:00:00 AM Western European Standard %STime +Sun 2012-01-1 00,00,00.000 Portugal Time +Domingo, 1 de Janeiro de 2012 às 05:00:00 GMT+03:00 +==DONE== diff --git a/ext/intl/tests/dateformat_format_parse.phpt b/ext/intl/tests/dateformat_format_parse.phpt index 6bd3d8a8ff9ef..dfb479e937b97 100644 --- a/ext/intl/tests/dateformat_format_parse.phpt +++ b/ext/intl/tests/dateformat_format_parse.phpt @@ -2,6 +2,7 @@ datefmt_format_code() and datefmt_parse_code() --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 51.2'); ?> +--FILE-- + 24 , + 'tm_min' => 3, + 'tm_hour' => 19, + 'tm_mday' => 3, + 'tm_mon' => 3, + 'tm_year' => 105, + ); + $localtime_arr2 = array ( + 'tm_sec' => 21, + 'tm_min' => 5, + 'tm_hour' => 7, + 'tm_mday' => 13, + 'tm_mon' => 7, + 'tm_year' => 205, + ); + $localtime_arr3 = array ( + 'tm_sec' => 11, + 'tm_min' => 13, + 'tm_hour' => 0, + 'tm_mday' => 17, + 'tm_mon' => 11, + 'tm_year' => -5 + ); + + $localtime_arr = array ( + $localtime_arr1, + $localtime_arr2, + $localtime_arr3 + ); + + //Test format and parse with a timestamp : long + foreach( $time_arr as $timestamp_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput timestamp is : $timestamp_entry"; + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone); + $formatted = ut_datefmt_format( $fmt , $timestamp_entry); + $res_str .= "\nFormatted timestamp is : $formatted"; + $parsed = ut_datefmt_parse( $fmt , $formatted); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nParsed timestamp is : $parsed"; + }else{ + $res_str .= "\nError while parsing as: '".intl_get_error_message()."'"; + } + } + } + } + + //Test format and parse with a localtime :array + foreach( $localtime_arr as $localtime_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput localtime is : "; + foreach( $localtime_entry as $key => $value){ + $res_str .= "$key : '$value' , "; + } + + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone); + $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted localtime_array is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + //Parsing + $parsed_arr = ut_datefmt_localtime( $fmt, $formatted1 ); + + if( $parsed_arr){ + $res_str .= "\nParsed array is: "; + foreach( $parsed_arr as $key => $value){ + $res_str .= "$key : '$value' , "; + } + } +/* + else{ + //$res_str .= "No values found from LocaleTime parsing."; + $res_str .= "\tError : '".intl_get_error_message()."'"; + } +*/ + } + } + } + + return $res_str; + +} + +include_once( 'ut_common.inc' ); + +// Run the test +ut_run(); +?> +--EXPECT-- +------------ + +Input timestamp is : 0 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Thursday, January 1, 1970 at 5:00:00 AM GMT+05:00 +Parsed timestamp is : 0 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : January 1, 1970 at 5:00:00 AM GMT+5 +Parsed timestamp is : 0 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Jan 1, 1970, 5:00:00 AM +Parsed timestamp is : 0 +------------ + +Input timestamp is : -1200000 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Thursday, December 18, 1969 at 7:40:00 AM GMT+05:00 +Parsed timestamp is : -1200000 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : December 18, 1969 at 7:40:00 AM GMT+5 +Parsed timestamp is : -1200000 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Dec 18, 1969, 7:40:00 AM +Parsed timestamp is : -1200000 +------------ + +Input timestamp is : 1200000 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Thursday, January 15, 1970 at 2:20:00 AM GMT+05:00 +Parsed timestamp is : 1200000 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : January 15, 1970 at 2:20:00 AM GMT+5 +Parsed timestamp is : 1200000 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Jan 15, 1970, 2:20:00 AM +Parsed timestamp is : 1200000 +------------ + +Input timestamp is : 2200000000 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Monday, September 19, 2039 at 4:06:40 AM GMT+05:00 +Parsed timestamp is : 2200000000 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : September 19, 2039 at 4:06:40 AM GMT+5 +Parsed timestamp is : 2200000000 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Sep 19, 2039, 4:06:40 AM +Parsed timestamp is : 2200000000 +------------ + +Input timestamp is : -2200000000 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Sunday, April 15, 1900 at 5:53:20 AM GMT+05:00 +Parsed timestamp is : -2200000000 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : April 15, 1900 at 5:53:20 AM GMT+5 +Parsed timestamp is : -2200000000 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Apr 15, 1900, 5:53:20 AM +Parsed timestamp is : -2200000000 +------------ + +Input timestamp is : 90099999 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Thursday, November 9, 1972 at 12:46:39 AM GMT+05:00 +Parsed timestamp is : 90099999 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : November 9, 1972 at 12:46:39 AM GMT+5 +Parsed timestamp is : 90099999 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Nov 9, 1972, 12:46:39 AM +Parsed timestamp is : 90099999 +------------ + +Input timestamp is : 3600 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Thursday, January 1, 1970 at 6:00:00 AM GMT+05:00 +Parsed timestamp is : 3600 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : January 1, 1970 at 6:00:00 AM GMT+5 +Parsed timestamp is : 3600 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Jan 1, 1970, 6:00:00 AM +Parsed timestamp is : 3600 +------------ + +Input timestamp is : -3600 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Thursday, January 1, 1970 at 4:00:00 AM GMT+05:00 +Parsed timestamp is : -3600 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : January 1, 1970 at 4:00:00 AM GMT+5 +Parsed timestamp is : -3600 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Jan 1, 1970, 4:00:00 AM +Parsed timestamp is : -3600 +------------ + +Input localtime is : tm_sec : '24' , tm_min : '3' , tm_hour : '19' , tm_mday : '3' , tm_mon : '3' , tm_year : '105' , +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted localtime_array is : Sunday, April 3, 2005 at 7:03:24 PM GMT+05:00 +Parsed array is: tm_sec : '24' , tm_min : '3' , tm_hour : '19' , tm_year : '105' , tm_mday : '3' , tm_wday : '0' , tm_yday : '93' , tm_mon : '3' , tm_isdst : '0' , +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted localtime_array is : April 3, 2005 at 7:03:24 PM GMT+5 +Parsed array is: tm_sec : '24' , tm_min : '3' , tm_hour : '19' , tm_year : '105' , tm_mday : '3' , tm_wday : '0' , tm_yday : '93' , tm_mon : '3' , tm_isdst : '0' , +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted localtime_array is : Apr 3, 2005, 7:03:24 PM +Parsed array is: tm_sec : '24' , tm_min : '3' , tm_hour : '19' , tm_year : '105' , tm_mday : '3' , tm_wday : '0' , tm_yday : '93' , tm_mon : '3' , tm_isdst : '0' , +------------ + +Input localtime is : tm_sec : '21' , tm_min : '5' , tm_hour : '7' , tm_mday : '13' , tm_mon : '7' , tm_year : '205' , +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted localtime_array is : Thursday, August 13, 2105 at 7:05:21 AM GMT+05:00 +Parsed array is: tm_sec : '21' , tm_min : '5' , tm_hour : '7' , tm_year : '205' , tm_mday : '13' , tm_wday : '4' , tm_yday : '225' , tm_mon : '7' , tm_isdst : '0' , +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted localtime_array is : August 13, 2105 at 7:05:21 AM GMT+5 +Parsed array is: tm_sec : '21' , tm_min : '5' , tm_hour : '7' , tm_year : '205' , tm_mday : '13' , tm_wday : '4' , tm_yday : '225' , tm_mon : '7' , tm_isdst : '0' , +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted localtime_array is : Aug 13, 2105, 7:05:21 AM +Parsed array is: tm_sec : '21' , tm_min : '5' , tm_hour : '7' , tm_year : '205' , tm_mday : '13' , tm_wday : '4' , tm_yday : '225' , tm_mon : '7' , tm_isdst : '0' , +------------ + +Input localtime is : tm_sec : '11' , tm_min : '13' , tm_hour : '0' , tm_mday : '17' , tm_mon : '11' , tm_year : '-5' , +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted localtime_array is : Tuesday, December 17, 1895 at 12:13:11 AM GMT+05:00 +Parsed array is: tm_sec : '11' , tm_min : '13' , tm_hour : '0' , tm_year : '-5' , tm_mday : '17' , tm_wday : '2' , tm_yday : '351' , tm_mon : '11' , tm_isdst : '0' , +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted localtime_array is : December 17, 1895 at 12:13:11 AM GMT+5 +Parsed array is: tm_sec : '11' , tm_min : '13' , tm_hour : '0' , tm_year : '-5' , tm_mday : '17' , tm_wday : '2' , tm_yday : '351' , tm_mon : '11' , tm_isdst : '0' , +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted localtime_array is : Dec 17, 1895, 12:13:11 AM +Parsed array is: tm_sec : '11' , tm_min : '13' , tm_hour : '0' , tm_year : '-5' , tm_mday : '17' , tm_wday : '2' , tm_yday : '351' , tm_mon : '11' , tm_isdst : '0' , diff --git a/ext/intl/tests/dateformat_format_variant2.phpt b/ext/intl/tests/dateformat_format_variant2.phpt new file mode 100644 index 0000000000000..7c5bcfcfd43f5 --- /dev/null +++ b/ext/intl/tests/dateformat_format_variant2.phpt @@ -0,0 +1,423 @@ +--TEST-- +datefmt_format_code() +--SKIPIF-- + += 51.2'); ?> +--FILE-- + 24 , + 'tm_min' => 3, + 'tm_hour' => 19, + 'tm_mday' => 3, + 'tm_mon' => 3, + 'tm_year' => 105, + ); + $localtime_arr2 = array ( + 'tm_sec' => 21, + 'tm_min' => 5, + 'tm_hour' => 7, + 'tm_mday' => 13, + 'tm_mon' => 4, + 'tm_year' => 205, + ); + $localtime_arr3 = array ( + 'tm_sec' => 11, + 'tm_min' => 13, + 'tm_hour' => 0, + 'tm_mday' => 17, + 'tm_mon' => 11, + 'tm_year' => -5 + ); + + $localtime_arr = array ( + $localtime_arr1, + $localtime_arr2, + $localtime_arr3 + ); + + $d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC")); + $d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC")); + $d2->setTimezone(new DateTimeZone("PDT")); + $dates = array( + $d1, + $d2, + new StdClass(), + ); + + //Test format with input as a timestamp : integer + foreach( $time_arr as $timestamp_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput timestamp is : $timestamp_entry"; + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) + { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN); + $formatted = ut_datefmt_format( $fmt , $timestamp_entry); + $res_str .= "\nFormatted timestamp is : $formatted"; + } + } + } + + //Test format with input as a localtime :array + foreach( $localtime_arr as $localtime_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput localtime is : "; + foreach( $localtime_entry as $key => $value){ + $res_str .= "$key : '$value' , "; + } + + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) + { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); + $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted localtime_array is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + } + } + } + + foreach($dates as $date_entry) { + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) { + $res_str .= "\n------------"; + $res_str .= "\nDate is: ".var_export($date_entry, true); + $res_str .= "\n------------"; + + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); + $formatted1 = ut_datefmt_format( $fmt , $date_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted DateTime is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + } + } + } + + return $res_str; + +} + +include_once( 'ut_common.inc' ); + +// Run the test +ut_run(); +?> +--EXPECT-- +------------ + +Input timestamp is : 0 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Wednesday, December 31, 1969 at 2:00:00 PM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : December 31, 1969 at 2:00:00 PM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Dec 31, 1969, 2:00:00 PM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted timestamp is : 12/31/69, 2:00 PM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted timestamp is : 19691231 02:00 PM +------------ + +Input timestamp is : -1200000 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Wednesday, December 17, 1969 at 4:40:00 PM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : December 17, 1969 at 4:40:00 PM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Dec 17, 1969, 4:40:00 PM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted timestamp is : 12/17/69, 4:40 PM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted timestamp is : 19691217 04:40 PM +------------ + +Input timestamp is : 1200000 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Wednesday, January 14, 1970 at 11:20:00 AM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : January 14, 1970 at 11:20:00 AM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Jan 14, 1970, 11:20:00 AM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted timestamp is : 1/14/70, 11:20 AM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted timestamp is : 19700114 11:20 AM +------------ + +Input timestamp is : 2200000000 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Sunday, September 18, 2039 at 1:06:40 PM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : September 18, 2039 at 1:06:40 PM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Sep 18, 2039, 1:06:40 PM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted timestamp is : 9/18/39, 1:06 PM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted timestamp is : 20390918 01:06 PM +------------ + +Input timestamp is : -2200000000 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Saturday, April 14, 1900 at 2:53:20 PM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : April 14, 1900 at 2:53:20 PM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Apr 14, 1900, 2:53:20 PM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted timestamp is : 4/14/00, 2:53 PM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted timestamp is : 19000414 02:53 PM +------------ + +Input timestamp is : 90099999 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Wednesday, November 8, 1972 at 9:46:39 AM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : November 8, 1972 at 9:46:39 AM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Nov 8, 1972, 9:46:39 AM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted timestamp is : 11/8/72, 9:46 AM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted timestamp is : 19721108 09:46 AM +------------ + +Input timestamp is : 3600 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Wednesday, December 31, 1969 at 3:00:00 PM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : December 31, 1969 at 3:00:00 PM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Dec 31, 1969, 3:00:00 PM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted timestamp is : 12/31/69, 3:00 PM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted timestamp is : 19691231 03:00 PM +------------ + +Input timestamp is : -3600 +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Wednesday, December 31, 1969 at 1:00:00 PM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : December 31, 1969 at 1:00:00 PM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Dec 31, 1969, 1:00:00 PM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted timestamp is : 12/31/69, 1:00 PM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted timestamp is : 19691231 01:00 PM +------------ + +Input localtime is : tm_sec : '24' , tm_min : '3' , tm_hour : '19' , tm_mday : '3' , tm_mon : '3' , tm_year : '105' , +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted localtime_array is : Sunday, April 3, 2005 at 7:03:24 PM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted localtime_array is : April 3, 2005 at 7:03:24 PM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted localtime_array is : Apr 3, 2005, 7:03:24 PM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted localtime_array is : 4/3/05, 7:03 PM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted localtime_array is : 20050403 07:03 PM +------------ + +Input localtime is : tm_sec : '21' , tm_min : '5' , tm_hour : '7' , tm_mday : '13' , tm_mon : '4' , tm_year : '205' , +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted localtime_array is : Wednesday, May 13, 2105 at 7:05:21 AM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted localtime_array is : May 13, 2105 at 7:05:21 AM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted localtime_array is : May 13, 2105, 7:05:21 AM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted localtime_array is : 5/13/05, 7:05 AM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted localtime_array is : 21050513 07:05 AM +------------ + +Input localtime is : tm_sec : '11' , tm_min : '13' , tm_hour : '0' , tm_mday : '17' , tm_mon : '11' , tm_year : '-5' , +------------ + +IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted localtime_array is : Tuesday, December 17, 1895 at 12:13:11 AM GMT-10:00 +IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted localtime_array is : December 17, 1895 at 12:13:11 AM GMT-10 +IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted localtime_array is : Dec 17, 1895, 12:13:11 AM +IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted localtime_array is : 12/17/95, 12:13 AM +IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted localtime_array is : 18951217 12:13 AM +------------ +Date is: DateTime::__set_state(array( + 'date' => '2010-01-01 01:02:03', + 'timezone_type' => 3, + 'timezone' => 'UTC', +)) +------------ +Formatted DateTime is : Thursday, December 31, 2009 at 3:02:03 PM GMT-10:00 +------------ +Date is: DateTime::__set_state(array( + 'date' => '2010-01-01 01:02:03', + 'timezone_type' => 3, + 'timezone' => 'UTC', +)) +------------ +Formatted DateTime is : December 31, 2009 at 3:02:03 PM GMT-10 +------------ +Date is: DateTime::__set_state(array( + 'date' => '2010-01-01 01:02:03', + 'timezone_type' => 3, + 'timezone' => 'UTC', +)) +------------ +Formatted DateTime is : Dec 31, 2009, 3:02:03 PM +------------ +Date is: DateTime::__set_state(array( + 'date' => '2010-01-01 01:02:03', + 'timezone_type' => 3, + 'timezone' => 'UTC', +)) +------------ +Formatted DateTime is : 12/31/09, 3:02 PM +------------ +Date is: DateTime::__set_state(array( + 'date' => '2010-01-01 01:02:03', + 'timezone_type' => 3, + 'timezone' => 'UTC', +)) +------------ +Formatted DateTime is : 20091231 03:02 PM +------------ +Date is: DateTime::__set_state(array( + 'date' => '2000-12-30 19:04:05', + 'timezone_type' => 3, + 'timezone' => 'America/Los_Angeles', +)) +------------ +Formatted DateTime is : Saturday, December 30, 2000 at 5:04:05 PM GMT-10:00 +------------ +Date is: DateTime::__set_state(array( + 'date' => '2000-12-30 19:04:05', + 'timezone_type' => 3, + 'timezone' => 'America/Los_Angeles', +)) +------------ +Formatted DateTime is : December 30, 2000 at 5:04:05 PM GMT-10 +------------ +Date is: DateTime::__set_state(array( + 'date' => '2000-12-30 19:04:05', + 'timezone_type' => 3, + 'timezone' => 'America/Los_Angeles', +)) +------------ +Formatted DateTime is : Dec 30, 2000, 5:04:05 PM +------------ +Date is: DateTime::__set_state(array( + 'date' => '2000-12-30 19:04:05', + 'timezone_type' => 3, + 'timezone' => 'America/Los_Angeles', +)) +------------ +Formatted DateTime is : 12/30/00, 5:04 PM +------------ +Date is: DateTime::__set_state(array( + 'date' => '2000-12-30 19:04:05', + 'timezone_type' => 3, + 'timezone' => 'America/Los_Angeles', +)) +------------ +Formatted DateTime is : 20001230 05:04 PM +------------ +Date is: stdClass::__set_state(array( +)) +------------ +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +------------ +Date is: stdClass::__set_state(array( +)) +------------ +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +------------ +Date is: stdClass::__set_state(array( +)) +------------ +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +------------ +Date is: stdClass::__set_state(array( +)) +------------ +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +------------ +Date is: stdClass::__set_state(array( +)) +------------ +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' diff --git a/ext/intl/tests/dateformat_get_set_calendar.phpt b/ext/intl/tests/dateformat_get_set_calendar.phpt index dbb3e6cd2391c..f91fe5c775a21 100644 --- a/ext/intl/tests/dateformat_get_set_calendar.phpt +++ b/ext/intl/tests/dateformat_get_set_calendar.phpt @@ -2,8 +2,8 @@ IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject() --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 51.2'); ?> +--FILE-- +format($ts), "\n"; +var_dump($df->getCalendar(), +$df->getCalendarObject()->getType(), +$df->getCalendarObject()->getTimeZone()->getId()); +echo "\n"; +} + +$df = new IntlDateFormatter('fr@calendar=islamic', 0, 0, 'Europe/Minsk'); +d($df); + + +//changing the calendar with a cal type should not change tz +$df->setCalendar(IntlDateFormatter::TRADITIONAL); +d($df); + +//but changing with an actual calendar should +$cal = IntlCalendar::createInstance("UTC"); +$df->setCalendar($cal); +d($df); + +?> +==DONE== +--EXPECT-- +dimanche 1 janvier 2012 ap. J.-C. 03:00:00 UTC+03:00 +int(1) +string(9) "gregorian" +string(12) "Europe/Minsk" + +dimanche 8 safar 1433 AH 03:00:00 UTC+03:00 +int(0) +string(7) "islamic" +string(12) "Europe/Minsk" + +dimanche 1 janvier 2012 ap. J.-C. 00:00:00 UTC +bool(false) +string(9) "gregorian" +string(3) "UTC" + +==DONE== diff --git a/ext/intl/tests/dateformat_get_set_timezone.phpt b/ext/intl/tests/dateformat_get_set_timezone.phpt index 41aa35b9cf3c6..2a7ffa6c7393c 100644 --- a/ext/intl/tests/dateformat_get_set_timezone.phpt +++ b/ext/intl/tests/dateformat_get_set_timezone.phpt @@ -2,8 +2,8 @@ IntlDateFormatter: get/setTimeZone() --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 51.2'); ?> +--FILE-- +format($ts), "\n"; +var_dump( +$df->getTimeZoneID(), +$df->getTimeZone()->getID()); +echo "\n"; +} + +$df = new IntlDateFormatter('pt_PT', 0, 0, 'Europe/Minsk'); +d($df); + +$df->setTimeZone(NULL); +d($df); + +$df->setTimeZone('Europe/Madrid'); +d($df); + +$df->setTimeZone(IntlTimeZone::createTimeZone('Europe/Paris')); +d($df); + +$df->setTimeZone(new DateTimeZone('Europe/Amsterdam')); +d($df); + +?> +==DONE== +--EXPECTF-- +Domingo, 1 de Janeiro de 2012 às 03:00:00 GMT+03:00 +string(12) "Europe/Minsk" +string(12) "Europe/Minsk" + +Sábado, 31 de Dezembro de 2011 às 23:00:00 Hor%s %Sdos Açores +string(15) "Atlantic/Azores" +string(15) "Atlantic/Azores" + +Domingo, 1 de Janeiro de 2012 às 01:00:00 Hor%s %Sda Europa Central +string(13) "Europe/Madrid" +string(13) "Europe/Madrid" + +Domingo, 1 de Janeiro de 2012 às 01:00:00 Hor%s %Sda Europa Central +string(12) "Europe/Paris" +string(12) "Europe/Paris" + +Domingo, 1 de Janeiro de 2012 às 01:00:00 Hor%s %Sda Europa Central +string(16) "Europe/Amsterdam" +string(16) "Europe/Amsterdam" + +==DONE== diff --git a/ext/intl/tests/dateformat_set_timezone_id2.phpt b/ext/intl/tests/dateformat_set_timezone_id2.phpt index ce9b89d1fdbbf..a1ee440e71d99 100644 --- a/ext/intl/tests/dateformat_set_timezone_id2.phpt +++ b/ext/intl/tests/dateformat_set_timezone_id2.phpt @@ -5,6 +5,7 @@ date.timezone=Atlantic/Azores --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- = 4.8 +--INI-- +date.timezone=Atlantic/Azores +--SKIPIF-- + += 51.2'); ?> +--FILE-- + +--EXPECTF-- +Warning: IntlDateFormatter::setTimeZoneId(): datefmt_set_timezone: no such time zone: 'CN' in %sut_common.inc on line %d + +Warning: datefmt_set_timezone_id(): datefmt_set_timezone: no such time zone: 'CN' in %sut_common.inc on line %d + +After creation of the dateformatter : timezone_id= US/Pacific +----------- +Trying to set timezone_id= America/New_York +After call to set_timezone_id : timezone_id= America/New_York +Formatting timestamp=0 resulted in Wednesday, December 31, 1969 at 7:00:00 PM Eastern Standard Time +Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 at 8:00:00 PM Eastern Standard Time +----------- +Trying to set timezone_id= America/Los_Angeles +After call to set_timezone_id : timezone_id= America/Los_Angeles +Formatting timestamp=0 resulted in Wednesday, December 31, 1969 at 4:00:00 PM Pacific Standard Time +Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 at 5:00:00 PM Pacific Standard Time +----------- +Trying to set timezone_id= America/Chicago +After call to set_timezone_id : timezone_id= America/Chicago +Formatting timestamp=0 resulted in Wednesday, December 31, 1969 at 6:00:00 PM Central Standard Time +Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 at 7:00:00 PM Central Standard Time +----------- +Trying to set timezone_id= CN +After call to set_timezone_id : timezone_id= America/Chicago +Formatting timestamp=0 resulted in Wednesday, December 31, 1969 at 6:00:00 PM Central Standard Time +Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 at 7:00:00 PM Central Standard Time diff --git a/ext/intl/tests/dateformat_timezone_arg_variations.phpt b/ext/intl/tests/dateformat_timezone_arg_variations.phpt index ccfb5e19646a6..9fbb145c72e0b 100644 --- a/ext/intl/tests/dateformat_timezone_arg_variations.phpt +++ b/ext/intl/tests/dateformat_timezone_arg_variations.phpt @@ -2,8 +2,8 @@ IntlDateFormatter: several forms of the timezone arg --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 51.2'); ?> +--FILE-- +format($ts), "\n"; + +$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Amsterdam'); +echo $df->format($ts), "\n"; + +$df = new IntlDateFormatter('es_ES', 0, 0, new DateTimeZone('Europe/Lisbon')); +echo $df->format($ts), "\n"; + +$df = new IntlDateFormatter('es_ES', 0, 0, IntlTimeZone::createTimeZone('America/New_York')); +echo $df->format($ts), "\n"; + +//time zone has priority +$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Amsterdam', new IntlGregorianCalendar('Europe/Lisbon')); +echo $df->format($ts), "\n"; + +//calendar has priority +$df = new IntlDateFormatter('es_ES', 0, 0, NULL, new IntlGregorianCalendar('Europe/Lisbon')); +echo $df->format($ts), "\n"; + +$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Amsterdam', 0); +echo $df->format($ts), "\n"; + +--EXPECTF-- +sábado%S, 31 de diciembre de 2011 23:00:00 Hora estándar de las Azores +domingo%S, 1 de enero de 2012 01:00:00 Hora estándar de Europa central +domingo%S, 1 de enero de 2012 00:00:00 Hora%S de Europa occidental +sábado%S, 31 de diciembre de 2011 19:00:00 Hora estándar oriental +domingo%S, 1 de enero de 2012 01:00:00 Hora estándar de Europa central +domingo%S, 1 de enero de 2012 00:00:00 Hora%S de Europa occidental +domingo%S, 1 de enero de 2012 01:00:00 Hora estándar de Europa central diff --git a/ext/intl/tests/formatter_get_locale.phpt b/ext/intl/tests/formatter_get_locale.phpt index 3d4fb2ae4e036..7474eabbbacdd 100644 --- a/ext/intl/tests/formatter_get_locale.phpt +++ b/ext/intl/tests/formatter_get_locale.phpt @@ -2,6 +2,7 @@ numfmt_get_locale() --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 51.2'); ?> +--FILE-- + 'actual', + Locale::VALID_LOCALE => 'valid', + ); + + $res_str = ''; + + foreach( $locales as $locale ) + { + $fmt = ut_nfmt_create( $locale, NumberFormatter::DECIMAL ); + $res_str .= "$locale: "; + foreach( $loc_types as $loc_type => $loc_type_name ) + $res_str .= sprintf( " %s=%s", + $loc_type_name, + dump( ut_nfmt_get_locale( $fmt, $loc_type ) ) ); + $res_str .= "\n"; + } + + return $res_str; +} + +include_once( 'ut_common.inc' ); + +// Run the test +ut_run(); +?> +--EXPECT-- +en_UK: actual='en' valid='en' +en_US@California: actual='en' valid='en' +fr_CA: actual='fr' valid='fr_CA' diff --git a/ext/intl/tests/locale_filter_matches2.phpt b/ext/intl/tests/locale_filter_matches2.phpt index 37f9e5a37737a..12d247dc6be7e 100644 --- a/ext/intl/tests/locale_filter_matches2.phpt +++ b/ext/intl/tests/locale_filter_matches2.phpt @@ -1,8 +1,9 @@ --TEST-- -locale_filter_matches.phpt() icu >= 4.8 +locale_filter_matches.phpt() icu >= 4.8 && icu < 51.2 --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- = 51.2 +--SKIPIF-- + += 51.2'); ?> +--FILE-- + +--EXPECT-- +-------------- +loc_range:de-de matches lang_tag de-DEVA ? NO +loc_range:de_DE canonically matches lang_tag de_Deva ? NO +-------------- +loc_range:de-de matches lang_tag de-DE-1996 ? YES +loc_range:de_DE canonically matches lang_tag de_DE_1996 ? YES +-------------- +loc_range:de-de matches lang_tag de-DE ? YES +loc_range:de_DE canonically matches lang_tag de_DE ? YES +-------------- +loc_range:de-de matches lang_tag zh_Hans ? NO +loc_range:de_DE canonically matches lang_tag zh_Hans ? NO +-------------- +loc_range:de-de matches lang_tag de-CH-1996 ? NO +loc_range:de_DE canonically matches lang_tag de_CH_1996 ? NO +-------------- +loc_range:de-de matches lang_tag sl_IT ? NO +loc_range:de_DE canonically matches lang_tag sl_IT ? NO +-------------- +loc_range:de-de matches lang_tag sl_IT_nedis-a-kirti-x-xyz ? NO +loc_range:de_DE canonically matches lang_tag sl_IT_NEDIS_A_KIRTI_X_XYZ ? NO +-------------- +loc_range:de-de matches lang_tag sl_IT_rozaj ? NO +loc_range:de_DE canonically matches lang_tag sl_IT_ROZAJ ? NO +-------------- +loc_range:de-de matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? NO +loc_range:de_DE canonically matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? NO +-------------- +loc_range:de-de matches lang_tag i-enochian ? NO +loc_range:de_DE canonically matches lang_tag @x=i-enochian ? NO +-------------- +loc_range:de-de matches lang_tag sgn-CH-de ? NO +loc_range:de_DE canonically matches lang_tag sgn_CH_DE ? NO +-------------- +loc_range:de-de matches lang_tag art-lojban ? NO +loc_range:de_DE canonically matches lang_tag art__LOJBAN ? NO +-------------- +loc_range:de-de matches lang_tag i-lux ? NO +loc_range:de_DE canonically matches lang_tag lb ? NO +-------------- +loc_range:de-de matches lang_tag art-lojban ? NO +loc_range:de_DE canonically matches lang_tag art__LOJBAN ? NO +-------------- +loc_range:de-de matches lang_tag jbo ? NO +loc_range:de_DE canonically matches lang_tag jbo ? NO +-------------- +loc_range:de-de matches lang_tag en_sl_IT ? NO +loc_range:de_DE canonically matches lang_tag en_SL_IT ? NO +-------------- +loc_range:sl_IT matches lang_tag de-DEVA ? NO +loc_range:sl_IT canonically matches lang_tag de_Deva ? NO +-------------- +loc_range:sl_IT matches lang_tag de-DE-1996 ? NO +loc_range:sl_IT canonically matches lang_tag de_DE_1996 ? NO +-------------- +loc_range:sl_IT matches lang_tag de-DE ? NO +loc_range:sl_IT canonically matches lang_tag de_DE ? NO +-------------- +loc_range:sl_IT matches lang_tag zh_Hans ? NO +loc_range:sl_IT canonically matches lang_tag zh_Hans ? NO +-------------- +loc_range:sl_IT matches lang_tag de-CH-1996 ? NO +loc_range:sl_IT canonically matches lang_tag de_CH_1996 ? NO +-------------- +loc_range:sl_IT matches lang_tag sl_IT ? YES +loc_range:sl_IT canonically matches lang_tag sl_IT ? YES +-------------- +loc_range:sl_IT matches lang_tag sl_IT_nedis-a-kirti-x-xyz ? YES +loc_range:sl_IT canonically matches lang_tag sl_IT_NEDIS_A_KIRTI_X_XYZ ? YES +-------------- +loc_range:sl_IT matches lang_tag sl_IT_rozaj ? YES +loc_range:sl_IT canonically matches lang_tag sl_IT_ROZAJ ? YES +-------------- +loc_range:sl_IT matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? YES +loc_range:sl_IT canonically matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? YES +-------------- +loc_range:sl_IT matches lang_tag i-enochian ? NO +loc_range:sl_IT canonically matches lang_tag @x=i-enochian ? NO +-------------- +loc_range:sl_IT matches lang_tag sgn-CH-de ? NO +loc_range:sl_IT canonically matches lang_tag sgn_CH_DE ? NO +-------------- +loc_range:sl_IT matches lang_tag art-lojban ? NO +loc_range:sl_IT canonically matches lang_tag art__LOJBAN ? NO +-------------- +loc_range:sl_IT matches lang_tag i-lux ? NO +loc_range:sl_IT canonically matches lang_tag lb ? NO +-------------- +loc_range:sl_IT matches lang_tag art-lojban ? NO +loc_range:sl_IT canonically matches lang_tag art__LOJBAN ? NO +-------------- +loc_range:sl_IT matches lang_tag jbo ? NO +loc_range:sl_IT canonically matches lang_tag jbo ? NO +-------------- +loc_range:sl_IT matches lang_tag en_sl_IT ? NO +loc_range:sl_IT canonically matches lang_tag en_SL_IT ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag de-DEVA ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag de_Deva ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag de-DE-1996 ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag de_DE_1996 ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag de-DE ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag de_DE ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag zh_Hans ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag zh_Hans ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag de-CH-1996 ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag de_CH_1996 ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag sl_IT ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag sl_IT ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag sl_IT_nedis-a-kirti-x-xyz ? YES +loc_range:sl_IT_NEDIS canonically matches lang_tag sl_IT_NEDIS_A_KIRTI_X_XYZ ? YES +-------------- +loc_range:sl_IT_Nedis matches lang_tag sl_IT_rozaj ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag sl_IT_ROZAJ ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? YES +loc_range:sl_IT_NEDIS canonically matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? YES +-------------- +loc_range:sl_IT_Nedis matches lang_tag i-enochian ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag @x=i-enochian ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag sgn-CH-de ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag sgn_CH_DE ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag art-lojban ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag art__LOJBAN ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag i-lux ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag lb ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag art-lojban ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag art__LOJBAN ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag jbo ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag jbo ? NO +-------------- +loc_range:sl_IT_Nedis matches lang_tag en_sl_IT ? NO +loc_range:sl_IT_NEDIS canonically matches lang_tag en_SL_IT ? NO +-------------- +loc_range:jbo matches lang_tag de-DEVA ? NO +loc_range:jbo canonically matches lang_tag de_Deva ? NO +-------------- +loc_range:jbo matches lang_tag de-DE-1996 ? NO +loc_range:jbo canonically matches lang_tag de_DE_1996 ? NO +-------------- +loc_range:jbo matches lang_tag de-DE ? NO +loc_range:jbo canonically matches lang_tag de_DE ? NO +-------------- +loc_range:jbo matches lang_tag zh_Hans ? NO +loc_range:jbo canonically matches lang_tag zh_Hans ? NO +-------------- +loc_range:jbo matches lang_tag de-CH-1996 ? NO +loc_range:jbo canonically matches lang_tag de_CH_1996 ? NO +-------------- +loc_range:jbo matches lang_tag sl_IT ? NO +loc_range:jbo canonically matches lang_tag sl_IT ? NO +-------------- +loc_range:jbo matches lang_tag sl_IT_nedis-a-kirti-x-xyz ? NO +loc_range:jbo canonically matches lang_tag sl_IT_NEDIS_A_KIRTI_X_XYZ ? NO +-------------- +loc_range:jbo matches lang_tag sl_IT_rozaj ? NO +loc_range:jbo canonically matches lang_tag sl_IT_ROZAJ ? NO +-------------- +loc_range:jbo matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? NO +loc_range:jbo canonically matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? NO +-------------- +loc_range:jbo matches lang_tag i-enochian ? NO +loc_range:jbo canonically matches lang_tag @x=i-enochian ? NO +-------------- +loc_range:jbo matches lang_tag sgn-CH-de ? NO +loc_range:jbo canonically matches lang_tag sgn_CH_DE ? NO +-------------- +loc_range:jbo matches lang_tag art-lojban ? NO +loc_range:jbo canonically matches lang_tag art__LOJBAN ? NO +-------------- +loc_range:jbo matches lang_tag i-lux ? NO +loc_range:jbo canonically matches lang_tag lb ? NO +-------------- +loc_range:jbo matches lang_tag art-lojban ? NO +loc_range:jbo canonically matches lang_tag art__LOJBAN ? NO +-------------- +loc_range:jbo matches lang_tag jbo ? YES +loc_range:jbo canonically matches lang_tag jbo ? YES +-------------- +loc_range:jbo matches lang_tag en_sl_IT ? NO +loc_range:jbo canonically matches lang_tag en_SL_IT ? NO +-------------- +loc_range:art-lojban matches lang_tag de-DEVA ? NO +loc_range:art__LOJBAN canonically matches lang_tag de_Deva ? NO +-------------- +loc_range:art-lojban matches lang_tag de-DE-1996 ? NO +loc_range:art__LOJBAN canonically matches lang_tag de_DE_1996 ? NO +-------------- +loc_range:art-lojban matches lang_tag de-DE ? NO +loc_range:art__LOJBAN canonically matches lang_tag de_DE ? NO +-------------- +loc_range:art-lojban matches lang_tag zh_Hans ? NO +loc_range:art__LOJBAN canonically matches lang_tag zh_Hans ? NO +-------------- +loc_range:art-lojban matches lang_tag de-CH-1996 ? NO +loc_range:art__LOJBAN canonically matches lang_tag de_CH_1996 ? NO +-------------- +loc_range:art-lojban matches lang_tag sl_IT ? NO +loc_range:art__LOJBAN canonically matches lang_tag sl_IT ? NO +-------------- +loc_range:art-lojban matches lang_tag sl_IT_nedis-a-kirti-x-xyz ? NO +loc_range:art__LOJBAN canonically matches lang_tag sl_IT_NEDIS_A_KIRTI_X_XYZ ? NO +-------------- +loc_range:art-lojban matches lang_tag sl_IT_rozaj ? NO +loc_range:art__LOJBAN canonically matches lang_tag sl_IT_ROZAJ ? NO +-------------- +loc_range:art-lojban matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? NO +loc_range:art__LOJBAN canonically matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? NO +-------------- +loc_range:art-lojban matches lang_tag i-enochian ? NO +loc_range:art__LOJBAN canonically matches lang_tag @x=i-enochian ? NO +-------------- +loc_range:art-lojban matches lang_tag sgn-CH-de ? NO +loc_range:art__LOJBAN canonically matches lang_tag sgn_CH_DE ? NO +-------------- +loc_range:art-lojban matches lang_tag art-lojban ? YES +loc_range:art__LOJBAN canonically matches lang_tag art__LOJBAN ? YES +-------------- +loc_range:art-lojban matches lang_tag i-lux ? NO +loc_range:art__LOJBAN canonically matches lang_tag lb ? NO +-------------- +loc_range:art-lojban matches lang_tag art-lojban ? YES +loc_range:art__LOJBAN canonically matches lang_tag art__LOJBAN ? YES +-------------- +loc_range:art-lojban matches lang_tag jbo ? NO +loc_range:art__LOJBAN canonically matches lang_tag jbo ? NO +-------------- +loc_range:art-lojban matches lang_tag en_sl_IT ? NO +loc_range:art__LOJBAN canonically matches lang_tag en_SL_IT ? NO +-------------- +loc_range:sl_IT matches lang_tag de-DEVA ? NO +loc_range:sl_IT canonically matches lang_tag de_Deva ? NO +-------------- +loc_range:sl_IT matches lang_tag de-DE-1996 ? NO +loc_range:sl_IT canonically matches lang_tag de_DE_1996 ? NO +-------------- +loc_range:sl_IT matches lang_tag de-DE ? NO +loc_range:sl_IT canonically matches lang_tag de_DE ? NO +-------------- +loc_range:sl_IT matches lang_tag zh_Hans ? NO +loc_range:sl_IT canonically matches lang_tag zh_Hans ? NO +-------------- +loc_range:sl_IT matches lang_tag de-CH-1996 ? NO +loc_range:sl_IT canonically matches lang_tag de_CH_1996 ? NO +-------------- +loc_range:sl_IT matches lang_tag sl_IT ? YES +loc_range:sl_IT canonically matches lang_tag sl_IT ? YES +-------------- +loc_range:sl_IT matches lang_tag sl_IT_nedis-a-kirti-x-xyz ? YES +loc_range:sl_IT canonically matches lang_tag sl_IT_NEDIS_A_KIRTI_X_XYZ ? YES +-------------- +loc_range:sl_IT matches lang_tag sl_IT_rozaj ? YES +loc_range:sl_IT canonically matches lang_tag sl_IT_ROZAJ ? YES +-------------- +loc_range:sl_IT matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? YES +loc_range:sl_IT canonically matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? YES +-------------- +loc_range:sl_IT matches lang_tag i-enochian ? NO +loc_range:sl_IT canonically matches lang_tag @x=i-enochian ? NO +-------------- +loc_range:sl_IT matches lang_tag sgn-CH-de ? NO +loc_range:sl_IT canonically matches lang_tag sgn_CH_DE ? NO +-------------- +loc_range:sl_IT matches lang_tag art-lojban ? NO +loc_range:sl_IT canonically matches lang_tag art__LOJBAN ? NO +-------------- +loc_range:sl_IT matches lang_tag i-lux ? NO +loc_range:sl_IT canonically matches lang_tag lb ? NO +-------------- +loc_range:sl_IT matches lang_tag art-lojban ? NO +loc_range:sl_IT canonically matches lang_tag art__LOJBAN ? NO +-------------- +loc_range:sl_IT matches lang_tag jbo ? NO +loc_range:sl_IT canonically matches lang_tag jbo ? NO +-------------- +loc_range:sl_IT matches lang_tag en_sl_IT ? NO +loc_range:sl_IT canonically matches lang_tag en_SL_IT ? NO diff --git a/ext/intl/tests/locale_get_display_name2.phpt b/ext/intl/tests/locale_get_display_name2.phpt index 40ccc0c2c50fb..bd8cb50cd53c8 100644 --- a/ext/intl/tests/locale_get_display_name2.phpt +++ b/ext/intl/tests/locale_get_display_name2.phpt @@ -1,8 +1,9 @@ --TEST-- -locale_get_display_name() icu >= 4.8 +locale_get_display_name() icu >= 4.8 && icu < 51.2 --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- = 51.2 +--SKIPIF-- + += 51.2'); ?> +--FILE-- + +--EXPECTREGEX-- +locale='sl_IT_nedis_KIRTI' +disp_locale=en : display_name=Slovenian #Italy, NEDIS_KIRTI# +disp_locale=fr : display_name=slovène #Italie, NEDIS_KIRTI# +disp_locale=de : display_name=Slowenisch #Italien, NEDIS_KIRTI# +----------------- +locale='sl_IT_nedis-a-kirti-x-xyz' +disp_locale=en : display_name=Slovenian #Italy, NEDIS_A_KIRTI_X_XYZ# +disp_locale=fr : display_name=slovène #Italie, NEDIS_A_KIRTI_X_XYZ# +disp_locale=de : display_name=Slowenisch #Italien, NEDIS_A_KIRTI_X_XYZ# +----------------- +locale='sl_IT_rozaj' +disp_locale=en : display_name=Slovenian #Italy, Resian# +disp_locale=fr : display_name=slovène #Italie, dialecte de Resia# +disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch)# +----------------- +locale='sl_IT_NEDIS_ROJAZ_1901' +disp_locale=en : display_name=Slovenian #Italy, NEDIS_ROJAZ_1901# +disp_locale=fr : display_name=slovène #Italie, NEDIS_ROJAZ_1901# +disp_locale=de : display_name=Slowenisch #Italien, NEDIS_ROJAZ_1901# +----------------- +locale='i-enochian' +disp_locale=en : display_name=i-enochian #Private-Use=i-enochian# +disp_locale=fr : display_name=i-enochian #Usage privé=i-enochian# +disp_locale=de : display_name=i-enochian #Privatnutzung=i-enochian# +----------------- +locale='zh-hakka' +disp_locale=en : display_name=Chinese( #HAKKA#)? +disp_locale=fr : display_name=chinois( #HAKKA#)? +disp_locale=de : display_name=Chinesisch( #HAKKA#)? +----------------- +locale='zh-wuu' +disp_locale=en : display_name=Chinese #WUU# +disp_locale=fr : display_name=chinois #WUU# +disp_locale=de : display_name=Chinesisch #WUU# +----------------- +locale='i-tay' +disp_locale=en : display_name=i-tay +disp_locale=fr : display_name=i-tay +disp_locale=de : display_name=i-tay +----------------- +locale='sgn-BE-nl' +disp_locale=en : display_name=Sign Languages? #Belgium, NL# +disp_locale=fr : display_name=langues? des signes #Belgique, NL# +disp_locale=de : display_name=Gebärdensprache #Belgien, NL# +----------------- +locale='sgn-CH-de' +disp_locale=en : display_name=Sign Languages? #Switzerland, DE# +disp_locale=fr : display_name=langues? des signes #Suisse, DE# +disp_locale=de : display_name=Gebärdensprache #Schweiz, DE# +----------------- +locale='sl_IT_rozaj@currency=EUR' +disp_locale=en : display_name=Slovenian #Italy, Resian, [Cc]urrency=Euro# +disp_locale=fr : display_name=slovène #Italie, dialecte de Resia, [Dd]evise=euro# +disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch), Währung=Euro# +----------------- +locale='uk-ua_CALIFORNIA@currency=;currency=GRN' +disp_locale=en : display_name=Ukrainian #Ukraine, CALIFORNIA, [Cc]urrency# +disp_locale=fr : display_name=ukrainien #Ukraine, CALIFORNIA, [Dd]evise# +disp_locale=de : display_name=Ukrainisch #Ukraine, CALIFORNIA, Währung# +----------------- +locale='root' +disp_locale=en : display_name=Root +disp_locale=fr : display_name=racine +disp_locale=de : display_name=[Rr]oot +----------------- +locale='uk@currency=EURO' +disp_locale=en : display_name=Ukrainian #[Cc]urrency=EURO# +disp_locale=fr : display_name=ukrainien #[Dd]evise=EURO# +disp_locale=de : display_name=Ukrainisch #Währung=EURO# +----------------- +locale='Hindi' +disp_locale=en : display_name=hindi +disp_locale=fr : display_name=hindi +disp_locale=de : display_name=hindi +----------------- +locale='de' +disp_locale=en : display_name=German +disp_locale=fr : display_name=allemand +disp_locale=de : display_name=Deutsch +----------------- +locale='fr' +disp_locale=en : display_name=French +disp_locale=fr : display_name=français +disp_locale=de : display_name=Französisch +----------------- +locale='ja' +disp_locale=en : display_name=Japanese +disp_locale=fr : display_name=japonais +disp_locale=de : display_name=Japanisch +----------------- +locale='i-enochian' +disp_locale=en : display_name=i-enochian #Private-Use=i-enochian# +disp_locale=fr : display_name=i-enochian #Usage privé=i-enochian# +disp_locale=de : display_name=i-enochian #Privatnutzung=i-enochian# +----------------- +locale='zh-Hant' +disp_locale=en : display_name=Chinese #Traditional# +disp_locale=fr : display_name=chinois #traditionnel# +disp_locale=de : display_name=Chinesisch #Traditionell# +----------------- +locale='zh-Hans' +disp_locale=en : display_name=Chinese #Simplified# +disp_locale=fr : display_name=chinois #simplifié# +disp_locale=de : display_name=Chinesisch #Vereinfacht# +----------------- +locale='sr-Cyrl' +disp_locale=en : display_name=Serbian #Cyrillic# +disp_locale=fr : display_name=serbe #cyrillique# +disp_locale=de : display_name=Serbisch #Kyrillisch# +----------------- +locale='sr-Latn' +disp_locale=en : display_name=Serbian #Latin# +disp_locale=fr : display_name=serbe #latin# +disp_locale=de : display_name=Serbisch #Lateinisch# +----------------- +locale='zh-Hans-CN' +disp_locale=en : display_name=Chinese #Simplified, China# +disp_locale=fr : display_name=chinois #simplifié, Chine# +disp_locale=de : display_name=Chinesisch #Vereinfacht, China# +----------------- +locale='sr-Latn-CS' +disp_locale=en : display_name=Serbian #Latin, Serbia# +disp_locale=fr : display_name=serbe #latin, Serbie# +disp_locale=de : display_name=Serbisch #Lateinisch, Serbien# +----------------- +locale='sl-rozaj' +disp_locale=en : display_name=Slovenian #Resian# +disp_locale=fr : display_name=slovène #dialecte de Resia# +disp_locale=de : display_name=Slowenisch( #(ROZAJ|Resianisch)#)? +----------------- +locale='sl-nedis' +disp_locale=en : display_name=Slovenian #Natisone dialect# +disp_locale=fr : display_name=slovène #dialecte de Natisone# +disp_locale=de : display_name=Slowenisch #Natisone-Dialekt# +----------------- +locale='de-CH-1901' +disp_locale=en : display_name=German #Switzerland, Traditional German orthography# +disp_locale=fr : display_name=allemand #Suisse, orthographe allemande traditionnelle# +disp_locale=de : display_name=Deutsch #Schweiz, (1901|[aA]lte deutsche Rechtschreibung)# +----------------- +locale='sl-IT-nedis' +disp_locale=en : display_name=Slovenian #Italy, Natisone dialect# +disp_locale=fr : display_name=slovène #Italie, dialecte de Natisone# +disp_locale=de : display_name=Slowenisch #Italien, (NEDIS|Natisone-Dialekt)# +----------------- +locale='sl-Latn-IT-nedis' +disp_locale=en : display_name=Slovenian #Latin, Italy, Natisone dialect# +disp_locale=fr : display_name=slovène #latin, Italie, dialecte de Natisone# +disp_locale=de : display_name=Slowenisch #Lateinisch, Italien, (NEDIS|Natisone-Dialekt)# +----------------- +locale='de-DE' +disp_locale=en : display_name=German #Germany# +disp_locale=fr : display_name=allemand #Allemagne# +disp_locale=de : display_name=Deutsch #Deutschland# +----------------- +locale='en-US' +disp_locale=en : display_name=English #United States# +disp_locale=fr : display_name=anglais #États-Unis# +disp_locale=de : display_name=Englisch #Vereinigte Staaten# +----------------- +locale='es-419' +disp_locale=en : display_name=Spanish #Latin America# +disp_locale=fr : display_name=espagnol #Amérique latine# +disp_locale=de : display_name=Spanisch #Lateinamerika# +----------------- +locale='de-CH-x-phonebk' +disp_locale=en : display_name=German #Switzerland, Private-Use=phonebk# +disp_locale=fr : display_name=allemand #Suisse, Usage privé=phonebk# +disp_locale=de : display_name=Deutsch #Schweiz, Privatnutzung=phonebk# +----------------- +locale='az-Arab-x-AZE-derbend' +disp_locale=en : display_name=Azerbaijani #Arabic, Private-Use=aze-derbend# +disp_locale=fr : display_name=azéri #arabe, Usage privé=aze-derbend# +disp_locale=de : display_name=Aserbaidschanisch #Arabisch, Privatnutzung=aze-derbend# +----------------- +locale='zh-min' +disp_locale=en : display_name=Chinese #MIN# +disp_locale=fr : display_name=chinois #MIN# +disp_locale=de : display_name=Chinesisch #MIN# +----------------- +locale='zh-min-nan-Hant-CN' +disp_locale=en : display_name=Chinese #MIN, NAN_HANT_CN# +disp_locale=fr : display_name=chinois #MIN, NAN_HANT_CN# +disp_locale=de : display_name=Chinesisch #MIN, NAN_HANT_CN# +----------------- +locale='x-whatever' +disp_locale=en : display_name=x-whatever #Private-Use=whatever# +disp_locale=fr : display_name=x-whatever #Usage privé=whatever# +disp_locale=de : display_name=x-whatever #Privatnutzung=whatever# +----------------- +locale='qaa-Qaaa-QM-x-southern' +disp_locale=en : display_name=qaa #Qaaa, QM, Private-Use=southern# +disp_locale=fr : display_name=qaa #Qaaa, QM, Usage privé=southern# +disp_locale=de : display_name=qaa #Qaaa, QM, Privatnutzung=southern# +----------------- +locale='sr-Latn-QM' +disp_locale=en : display_name=Serbian #Latin, QM# +disp_locale=fr : display_name=serbe #latin, QM# +disp_locale=de : display_name=Serbisch #Lateinisch, QM# +----------------- +locale='sr-Qaaa-CS' +disp_locale=en : display_name=Serbian #Qaaa, Serbia# +disp_locale=fr : display_name=serbe #Qaaa, Serbie# +disp_locale=de : display_name=Serbisch #Qaaa, Serbien# +----------------- +locale='en-US-u-islamCal' +disp_locale=en : display_name=English #United States, attribute=islamcal# +disp_locale=fr : display_name=anglais #États-Unis, attribute=islamcal# +disp_locale=de : display_name=Englisch #Vereinigte Staaten, attribute=islamcal# +----------------- +locale='zh-CN-a-myExt-x-private' +disp_locale=en : display_name=Chinese #China, a=myext, Private-Use=private# +disp_locale=fr : display_name=chinois #Chine, a=myext, Usage privé=private# +disp_locale=de : display_name=Chinesisch #China, a=myext, Privatnutzung=private# +----------------- +locale='en-a-myExt-b-another' +disp_locale=en : display_name=English #a=myext, b=another# +disp_locale=fr : display_name=anglais #a=myext, b=another# +disp_locale=de : display_name=Englisch #a=myext, b=another# +----------------- +locale='de-419-DE' +disp_locale=en : display_name=German #Latin America, DE# +disp_locale=fr : display_name=allemand #Amérique latine, DE# +disp_locale=de : display_name=Deutsch #Lateinamerika, DE# +----------------- +locale='a-DE' +disp_locale=en : display_name=a #Germany# +disp_locale=fr : display_name=a #Allemagne# +disp_locale=de : display_name=a #Deutschland# +----------------- +locale='ar-a-aaa-b-bbb-a-ccc' +disp_locale=en : display_name=Arabic #a=aaa, b=bbb# +disp_locale=fr : display_name=arabe #a=aaa, b=bbb# +disp_locale=de : display_name=Arabisch #a=aaa, b=bbb# +----------------- diff --git a/ext/intl/tests/locale_get_display_region2.phpt b/ext/intl/tests/locale_get_display_region2.phpt index f1b584188aa22..1d7354bd1bc87 100644 --- a/ext/intl/tests/locale_get_display_region2.phpt +++ b/ext/intl/tests/locale_get_display_region2.phpt @@ -1,8 +1,9 @@ --TEST-- -locale_get_display_region() icu >= 4.8 +locale_get_display_region() icu >= 4.8 && icu < 51.2 --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- = 51.2 +--SKIPIF-- + += 51.2'); ?> +--FILE-- + +--EXPECTREGEX-- +locale='uk-ua_CALIFORNIA@currency=;currency=GRN' +disp_locale=en : display_region=Ukraine +disp_locale=fr : display_region=Ukraine +disp_locale=de : display_region=Ukraine +----------------- +locale='root' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='uk@currency=EURO' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='Hindi' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='de' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='fr' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='ja' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='i-enochian' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='zh-Hant' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='zh-Hans' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='sr-Cyrl' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='sr-Latn' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='zh-Hans-CN' +disp_locale=en : display_region=China +disp_locale=fr : display_region=Chine +disp_locale=de : display_region=China +----------------- +locale='sr-Latn-CS' +disp_locale=en : display_region=Serbia +disp_locale=fr : display_region=Serbie +disp_locale=de : display_region=Serbien +----------------- +locale='sl-rozaj' +disp_locale=en : display_region=(ROZAJ)? +disp_locale=fr : display_region=(ROZAJ)? +disp_locale=de : display_region=(ROZAJ)? +----------------- +locale='sl-nedis' +disp_locale=en : display_region=(NEDIS)? +disp_locale=fr : display_region=(NEDIS)? +disp_locale=de : display_region=(NEDIS)? +----------------- +locale='de-CH-1901' +disp_locale=en : display_region=Switzerland +disp_locale=fr : display_region=Suisse +disp_locale=de : display_region=Schweiz +----------------- +locale='sl-IT-nedis' +disp_locale=en : display_region=Italy +disp_locale=fr : display_region=Italie +disp_locale=de : display_region=Italien +----------------- +locale='sl-Latn-IT-nedis' +disp_locale=en : display_region=Italy +disp_locale=fr : display_region=Italie +disp_locale=de : display_region=Italien +----------------- +locale='de-DE' +disp_locale=en : display_region=Germany +disp_locale=fr : display_region=Allemagne +disp_locale=de : display_region=Deutschland +----------------- +locale='en-US' +disp_locale=en : display_region=United States +disp_locale=fr : display_region=États-Unis +disp_locale=de : display_region=Vereinigte Staaten +----------------- +locale='es-419' +disp_locale=en : display_region=Latin America +disp_locale=fr : display_region=Amérique latine +disp_locale=de : display_region=Lateinamerika +----------------- +locale='de-CH-x-phonebk' +disp_locale=en : display_region=Switzerland +disp_locale=fr : display_region=Suisse +disp_locale=de : display_region=Schweiz +----------------- +locale='az-Arab-x-AZE-derbend' +disp_locale=en : display_region=X? +disp_locale=fr : display_region=X? +disp_locale=de : display_region=X? +----------------- +locale='zh-min' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='zh-min-nan-Hant-CN' +disp_locale=en : display_region=MIN +disp_locale=fr : display_region=MIN +disp_locale=de : display_region=MIN +----------------- +locale='x-whatever' +disp_locale=en : display_region= +disp_locale=fr : display_region= +disp_locale=de : display_region= +----------------- +locale='qaa-Qaaa-QM-x-southern' +disp_locale=en : display_region=QM +disp_locale=fr : display_region=QM +disp_locale=de : display_region=QM +----------------- +locale='sr-Latn-QM' +disp_locale=en : display_region=QM +disp_locale=fr : display_region=QM +disp_locale=de : display_region=QM +----------------- +locale='sr-Qaaa-CS' +disp_locale=en : display_region=Serbia +disp_locale=fr : display_region=Serbie +disp_locale=de : display_region=Serbien +----------------- +locale='en-US-u-islamCal' +disp_locale=en : display_region=United States +disp_locale=fr : display_region=États-Unis +disp_locale=de : display_region=Vereinigte Staaten +----------------- +locale='zh-CN-a-myExt-x-private' +disp_locale=en : display_region=China +disp_locale=fr : display_region=Chine +disp_locale=de : display_region=China +----------------- +locale='en-a-myExt-b-another' +disp_locale=en : display_region=A? +disp_locale=fr : display_region=A? +disp_locale=de : display_region=A? +----------------- +locale='de-419-DE' +disp_locale=en : display_region=Latin America +disp_locale=fr : display_region=Amérique latine +disp_locale=de : display_region=Lateinamerika +----------------- +locale='a-DE' +disp_locale=en : display_region=Germany +disp_locale=fr : display_region=Allemagne +disp_locale=de : display_region=Deutschland +----------------- +locale='ar-a-aaa-b-bbb-a-ccc' +disp_locale=en : display_region=A? +disp_locale=fr : display_region=A? +disp_locale=de : display_region=A? +----------------- diff --git a/ext/intl/tests/locale_lookup.phpt b/ext/intl/tests/locale_lookup.phpt index f0affafa6f2bb..df5204f07d84b 100644 --- a/ext/intl/tests/locale_lookup.phpt +++ b/ext/intl/tests/locale_lookup.phpt @@ -2,6 +2,7 @@ locale_lookup.phpt() --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 51.2'); ?> +--FILE-- + +--EXPECT-- +-------------- +loc_range:de-de +lang_tags: de-DEVA,de-DE-1996,de-DE,zh_Hans,de-CH-1996,sl_IT,sl_IT_nedis-a-kirti-x-xyz,sl_IT_rozaj,sl_IT_NEDIS_ROJAZ_1901,i-enochian,sgn-CH-de,art-lojban,i-lux,art-lojban,jbo,en_sl_IT,zh-Hant-CN-x-prv1-prv2 + +lookup result:de-DE +Canonical lookup result:de_de +-------------- +loc_range:sl_IT +lang_tags: de-DEVA,de-DE-1996,de-DE,zh_Hans,de-CH-1996,sl_IT,sl_IT_nedis-a-kirti-x-xyz,sl_IT_rozaj,sl_IT_NEDIS_ROJAZ_1901,i-enochian,sgn-CH-de,art-lojban,i-lux,art-lojban,jbo,en_sl_IT,zh-Hant-CN-x-prv1-prv2 + +lookup result:sl_IT +Canonical lookup result:sl_it +-------------- +loc_range:sl_IT_Nedis +lang_tags: de-DEVA,de-DE-1996,de-DE,zh_Hans,de-CH-1996,sl_IT,sl_IT_nedis-a-kirti-x-xyz,sl_IT_rozaj,sl_IT_NEDIS_ROJAZ_1901,i-enochian,sgn-CH-de,art-lojban,i-lux,art-lojban,jbo,en_sl_IT,zh-Hant-CN-x-prv1-prv2 + +lookup result:sl_IT +Canonical lookup result:sl_it +-------------- +loc_range:jbo +lang_tags: de-DEVA,de-DE-1996,de-DE,zh_Hans,de-CH-1996,sl_IT,sl_IT_nedis-a-kirti-x-xyz,sl_IT_rozaj,sl_IT_NEDIS_ROJAZ_1901,i-enochian,sgn-CH-de,art-lojban,i-lux,art-lojban,jbo,en_sl_IT,zh-Hant-CN-x-prv1-prv2 + +lookup result:jbo +Canonical lookup result:jbo +-------------- +loc_range:art-lojban +lang_tags: de-DEVA,de-DE-1996,de-DE,zh_Hans,de-CH-1996,sl_IT,sl_IT_nedis-a-kirti-x-xyz,sl_IT_rozaj,sl_IT_NEDIS_ROJAZ_1901,i-enochian,sgn-CH-de,art-lojban,i-lux,art-lojban,jbo,en_sl_IT,zh-Hant-CN-x-prv1-prv2 + +lookup result:art-lojban +Canonical lookup result:art__lojban diff --git a/ext/intl/tests/msgfmt_format_intlcalendar.phpt b/ext/intl/tests/msgfmt_format_intlcalendar.phpt index 6ae78a91400c0..a6bff2ecddfba 100644 --- a/ext/intl/tests/msgfmt_format_intlcalendar.phpt +++ b/ext/intl/tests/msgfmt_format_intlcalendar.phpt @@ -2,8 +2,8 @@ MessageFormat accepts IntlCalendar args --SKIPIF-- += 0) die('skip for ICU < 51.2'); ?> --FILE-- format(array($time, 'date')), " ", ==DONE== --EXPECT-- Quinta-feira, 17 de Maio de 2012 5:35:36 p.m. WEST -==DONE== \ No newline at end of file +==DONE== diff --git a/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt b/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt new file mode 100644 index 0000000000000..f2d16b899dcdf --- /dev/null +++ b/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt @@ -0,0 +1,30 @@ +--TEST-- +MessageFormat accepts IntlCalendar args +--SKIPIF-- + += 51.2'); ?> +--FILE-- +format(array($cal)), "\n"; + +//NOT FIXED: +/*$msgf = new MessageFormatter('en_US', +'{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}'); + +echo "msgf2: ", $msgf->format(array($time, 'date')), " ", + $msgf->format(array($time, 'time')), "\n"; +*/ + +?> +==DONE== +--EXPECT-- +Quinta-feira, 17 de Maio de 2012 5:35:36 PM ptlis +==DONE== diff --git a/ext/intl/tests/resourcebundle_null_mandatory_args.phpt b/ext/intl/tests/resourcebundle_null_mandatory_args.phpt index 17fab6d630a5e..bbbc1b1e91ce2 100644 --- a/ext/intl/tests/resourcebundle_null_mandatory_args.phpt +++ b/ext/intl/tests/resourcebundle_null_mandatory_args.phpt @@ -3,11 +3,9 @@ ResourceBundle constructor bundle accepts NULL for first two arguments --INI-- date.timezone=Atlantic/Azores --SKIPIF-- -= 4.8 only'); + += 4.8 only'); ?> += 0) die('skip for ICU < 51.2'); ?> --FILE-- += 51.2'); ?> +--FILE-- +get('calendar')->get('gregorian')->get('DateTimePatterns')->get(0); +var_dump($c); + +ini_set('intl.default_locale', 'pt_PT'); +$r = new ResourceBundle(NULL, NULL); +$c = $r->get('calendar')->get('gregorian')->get('DateTimePatterns')->get(0); +var_dump($c); +?> +==DONE== +--EXPECT-- +string(14) "h:mm:ss a zzzz" +string(13) "HH:mm:ss zzzz" +==DONE== diff --git a/ext/intl/tests/timezone_getDisplayName_variant2-49+.phpt b/ext/intl/tests/timezone_getDisplayName_variant2-49+.phpt index 4ee30aee12642..8f60f2904021f 100644 --- a/ext/intl/tests/timezone_getDisplayName_variant2-49+.phpt +++ b/ext/intl/tests/timezone_getDisplayName_variant2-49+.phpt @@ -1,11 +1,9 @@ --TEST-- -IntlTimeZone::getDisplayName(): type parameter (ICU >= 49) +IntlTimeZone::getDisplayName(): type parameter (ICU >= 49 && ICU < 51.2) --SKIPIF-- - + += 0) die('skip for ICU < 51.2'); ?> --FILE-- = 51.2) +--SKIPIF-- + += 51.2'); ?> +--FILE-- +getDisplayName(false, IntlTimeZone::DISPLAY_SHORT)); +var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_LONG)); +var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_SHORT_GENERIC)); +var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_LONG_GENERIC)); +var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_SHORT_GMT)); +var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_LONG_GMT)); +var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_SHORT_COMMONLY_USED)); +var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_GENERIC_LOCATION)); + +?> +==DONE== +--EXPECT-- +string(3) "GMT" +string(30) "Western European Standard Time" +string(13) "Portugal Time" +string(21) "Western European Time" +string(5) "+0000" +string(3) "GMT" +string(3) "GMT" +string(13) "Portugal Time" +==DONE== diff --git a/ext/ldap/config.m4 b/ext/ldap/config.m4 index 3c8e23ea8e852..2804cd5968ebf 100644 --- a/ext/ldap/config.m4 +++ b/ext/ldap/config.m4 @@ -15,6 +15,28 @@ AC_DEFUN([PHP_LDAP_CHECKS], [ LDAP_DIR=$1 LDAP_INCDIR=$1/ldap/public LDAP_LIBDIR=$1/$PHP_LIBDIR + else + + dnl Find Oracle Instant Client RPM header location corresponding to the given lib path e.g. for --with-ldap=/usr/lib/oracle/12.1/client64/lib + AC_CHECK_SIZEOF(long int, 4) + if test "$ac_cv_sizeof_long_int" = "4"; then + PHP_OCI8_IC_LIBDIR_SUFFIX="" + else + PHP_OCI8_IC_LIBDIR_SUFFIX=64 + fi + OCISDKRPMINC=`echo "$1" | $SED -e 's!^/usr/lib/oracle/\(.*\)/client\('${PHP_OCI8_IC_LIBDIR_SUFFIX}'\)*/lib[/]*$!/usr/include/oracle/\1/client\2!'` + + dnl Check for Oracle Instant Client RPM install + if test -f $OCISDKRPMINC/ldap.h; then + LDAP_DIR=$1 + LDAP_INCDIR=$OCISDKRPMINC + LDAP_LIBDIR=$1 + dnl Check for Oracle Instant Client ZIP install + elif test -f $1/sdk/include/ldap.h; then + LDAP_DIR=$1 + LDAP_INCDIR=$1/sdk/include + LDAP_LIBDIR=$1 + fi fi ]) @@ -143,12 +165,21 @@ if test "$PHP_LDAP" != "no"; then PHP_ADD_LIBRARY_WITH_PATH(umich_lber, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) PHP_ADD_LIBRARY_WITH_PATH(umich_ldap, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) - elif test -f $LDAP_LIBDIR/libclntsh.$SHLIB_SUFFIX_NAME; then + elif test -f $LDAP_LIBDIR/libclntsh.$SHLIB_SUFFIX_NAME.12.1; then PHP_ADD_LIBRARY_WITH_PATH(clntsh, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) AC_DEFINE(HAVE_ORALDAP,1,[ ]) - if test -f $LDAP_LIBDIR/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then - AC_DEFINE(HAVE_ORALDAP_10,1,[ ]) - fi + AC_DEFINE(HAVE_ORALDAP_12,1,[ ]) + + elif test -f $LDAP_LIBDIR/libclntsh.$SHLIB_SUFFIX_NAME.11.1; then + PHP_ADD_LIBRARY_WITH_PATH(clntsh, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) + AC_DEFINE(HAVE_ORALDAP,1,[ ]) + AC_DEFINE(HAVE_ORALDAP_11,1,[ ]) + + elif test -f $LDAP_LIBDIR/libclntsh.$SHLIB_SUFFIX_NAME; then + PHP_ADD_LIBRARY_WITH_PATH(clntsh, $LDAP_LIBDIR, LDAP_SHARED_LIBADD) + AC_DEFINE(HAVE_ORALDAP,1,[ ]) + AC_DEFINE(HAVE_ORALDAP_10,1,[ ]) + else AC_MSG_ERROR(Cannot find ldap libraries in $LDAP_LIBDIR.) fi diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 3cfa2092e776e..d50b78321fb89 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -67,6 +67,9 @@ #include #endif +#define PHP_LDAP_ESCAPE_FILTER 0x01 +#define PHP_LDAP_ESCAPE_DN 0x02 + typedef struct { LDAP *link; #if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC) @@ -152,7 +155,7 @@ 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); -#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 +#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP /* LDAP options */ REGISTER_LONG_CONSTANT("LDAP_OPT_DEREF", LDAP_OPT_DEREF, CONST_PERSISTENT | CONST_CS); REGISTER_LONG_CONSTANT("LDAP_OPT_SIZELIMIT", LDAP_OPT_SIZELIMIT, CONST_PERSISTENT | CONST_CS); @@ -195,6 +198,9 @@ PHP_MINIT_FUNCTION(ldap) REGISTER_LONG_CONSTANT("GSLC_SSL_TWOWAY_AUTH", GSLC_SSL_TWOWAY_AUTH, CONST_PERSISTENT | CONST_CS); #endif + REGISTER_LONG_CONSTANT("LDAP_ESCAPE_FILTER", PHP_LDAP_ESCAPE_FILTER, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_ESCAPE_DN", PHP_LDAP_ESCAPE_DN, CONST_PERSISTENT | CONST_CS); + le_link = zend_register_list_destructors_ex(_close_ldap_link, NULL, "ldap link", module_number); le_result = zend_register_list_destructors_ex(_free_ldap_result, NULL, "ldap result", module_number); le_result_entry = zend_register_list_destructors_ex(_free_ldap_result_entry, NULL, "ldap result entry", module_number); @@ -361,7 +367,7 @@ PHP_FUNCTION(ldap_connect) static int _get_lderrno(LDAP *ldap) { #if !HAVE_NSLDAP -#if LDAP_API_VERSION > 2000 || HAVE_ORALDAP_10 +#if LDAP_API_VERSION > 2000 || HAVE_ORALDAP int lderr; /* New versions of OpenLDAP do it this way */ @@ -550,7 +556,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in { /* sizelimit */ if (sizelimit > -1) { -#if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP_10 +#if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_sizelimit); ldap_set_option(ldap, LDAP_OPT_SIZELIMIT, &sizelimit); #else @@ -561,7 +567,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in /* timelimit */ if (timelimit > -1) { -#if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP_10 +#if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_timelimit); ldap_set_option(ldap, LDAP_OPT_TIMELIMIT, &timelimit); #else @@ -572,7 +578,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in /* deref */ if (deref > -1) { -#if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP_10 +#if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_deref); ldap_set_option(ldap, LDAP_OPT_DEREF, &deref); #else @@ -975,12 +981,12 @@ PHP_FUNCTION(ldap_get_entries) add_index_string(tmp1, num_attrib, attribute, 1); num_attrib++; -#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS +#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS ldap_memfree(attribute); #endif attribute = ldap_next_attribute(ldap, ldap_result_entry, ber); } -#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS +#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS if (ber != NULL) { ber_free(ber, 0); } @@ -989,7 +995,7 @@ PHP_FUNCTION(ldap_get_entries) add_assoc_long(tmp1, "count", num_attrib); dn = ldap_get_dn(ldap, ldap_result_entry); add_assoc_string(tmp1, "dn", dn, 1); -#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS +#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS ldap_memfree(dn); #else free(dn); @@ -1027,7 +1033,7 @@ PHP_FUNCTION(ldap_first_attribute) RETURN_FALSE; } else { RETVAL_STRING(attribute, 1); -#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS +#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS ldap_memfree(attribute); #endif } @@ -1057,7 +1063,7 @@ PHP_FUNCTION(ldap_next_attribute) } if ((attribute = ldap_next_attribute(ld->link, resultentry->data, resultentry->ber)) == NULL) { -#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS +#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS if (resultentry->ber != NULL) { ber_free(resultentry->ber, 0); resultentry->ber = NULL; @@ -1066,7 +1072,7 @@ PHP_FUNCTION(ldap_next_attribute) RETURN_FALSE; } else { RETVAL_STRING(attribute, 1); -#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS +#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS ldap_memfree(attribute); #endif } @@ -1113,12 +1119,12 @@ PHP_FUNCTION(ldap_get_attributes) add_index_string(return_value, num_attrib, attribute, 1); num_attrib++; -#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS +#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS ldap_memfree(attribute); #endif attribute = ldap_next_attribute(ld->link, resultentry->data, ber); } -#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS +#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS if (ber != NULL) { ber_free(ber, 0); } @@ -1183,7 +1189,7 @@ PHP_FUNCTION(ldap_get_dn) text = ldap_get_dn(ld->link, resultentry->data); if (text != NULL) { RETVAL_STRING(text, 1); -#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS +#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS ldap_memfree(text); #else free(text); @@ -1241,7 +1247,7 @@ PHP_FUNCTION(ldap_dn2ufn) if (ufn != NULL) { RETVAL_STRING(ufn, 1); -#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS +#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS ldap_memfree(ufn); #endif } else { @@ -1546,7 +1552,7 @@ PHP_FUNCTION(ldap_sort) } /* }}} */ -#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 +#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP /* {{{ proto bool ldap_get_option(resource link, int option, mixed retval) Get the current value of various session-wide parameters */ PHP_FUNCTION(ldap_get_option) @@ -2003,7 +2009,7 @@ PHP_FUNCTION(ldap_rename) newparent = NULL; } -#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 +#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP rc = ldap_rename_s(ld->link, dn, newrdn, newparent, deleteoldrdn, NULL, NULL); #else if (newparent_len != 0) { @@ -2047,7 +2053,7 @@ PHP_FUNCTION(ldap_start_tls) } /* }}} */ #endif -#endif /* (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 */ +#endif /* (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP */ #if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC) /* {{{ _ldap_rebind_proc() @@ -2107,6 +2113,7 @@ PHP_FUNCTION(ldap_set_rebind_proc) /* unregister rebind procedure */ if (ld->rebindproc != NULL) { zval_dtor(ld->rebindproc); + FREE_ZVAL(ld->rebindproc); ld->rebindproc = NULL; ldap_set_rebind_proc(ld->link, NULL, NULL); } @@ -2136,6 +2143,83 @@ PHP_FUNCTION(ldap_set_rebind_proc) /* }}} */ #endif +static void php_ldap_do_escape(const zend_bool *map, const char *value, size_t valuelen, char **result, size_t *resultlen) +{ + char hex[] = "0123456789abcdef"; + int i, p = 0; + size_t len = 0; + + for (i = 0; i < valuelen; i++) { + len += (map[(unsigned char) value[i]]) ? 3 : 1; + } + + (*result) = (char *) safe_emalloc(1, len, 1); + (*resultlen) = len; + + for (i = 0; i < valuelen; i++) { + unsigned char v = (unsigned char) value[i]; + + if (map[v]) { + (*result)[p++] = '\\'; + (*result)[p++] = hex[v >> 4]; + (*result)[p++] = hex[v & 0x0f]; + } else { + (*result)[p++] = v; + } + } + + (*result)[p++] = '\0'; +} + +static void php_ldap_escape_map_set_chars(zend_bool *map, const char *chars, const int charslen, char escape) +{ + int i = 0; + while (i < charslen) { + map[(unsigned char) chars[i++]] = escape; + } +} + +PHP_FUNCTION(ldap_escape) +{ + char *value, *ignores, *result; + int valuelen = 0, ignoreslen = 0, i; + size_t resultlen; + long flags = 0; + zend_bool map[256] = {0}, havecharlist = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sl", &value, &valuelen, &ignores, &ignoreslen, &flags) != SUCCESS) { + return; + } + + if (!valuelen) { + RETURN_EMPTY_STRING(); + } + + if (flags & PHP_LDAP_ESCAPE_FILTER) { + havecharlist = 1; + php_ldap_escape_map_set_chars(map, "\\*()\0", sizeof("\\*()\0") - 1, 1); + } + + if (flags & PHP_LDAP_ESCAPE_DN) { + havecharlist = 1; + php_ldap_escape_map_set_chars(map, "\\,=+<>;\"#", sizeof("\\,=+<>;\"#") - 1, 1); + } + + if (!havecharlist) { + for (i = 0; i < 256; i++) { + map[i] = 1; + } + } + + if (ignoreslen) { + php_ldap_escape_map_set_chars(map, ignores, ignoreslen, 0); + } + + php_ldap_do_escape(map, value, valuelen, &result, &resultlen); + + RETURN_STRINGL(result, resultlen, 0); +} + #ifdef STR_TRANSLATION /* {{{ php_ldap_do_translate */ @@ -2566,7 +2650,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_control_paged_result_response, 0, 0, 2) ZEND_END_ARG_INFO(); #endif -#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 +#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_rename, 0, 0, 5) ZEND_ARG_INFO(0, link_identifier) ZEND_ARG_INFO(0, dn) @@ -2625,6 +2709,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_set_rebind_proc, 0, 0, 2) ZEND_END_ARG_INFO() #endif +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_escape, 0, 0, 1) + ZEND_ARG_INFO(0, value) + ZEND_ARG_INFO(0, ignore) + ZEND_ARG_INFO(0, flags) +ZEND_END_ARG_INFO() + #ifdef STR_TRANSLATION ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_t61_to_8859, 0, 0, 1) ZEND_ARG_INFO(0, value) @@ -2682,7 +2772,7 @@ const zend_function_entry ldap_functions[] = { PHP_FE(ldap_compare, arginfo_ldap_compare) PHP_FE(ldap_sort, arginfo_ldap_sort) -#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 +#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP PHP_FE(ldap_rename, arginfo_ldap_rename) PHP_FE(ldap_get_option, arginfo_ldap_get_option) PHP_FE(ldap_set_option, arginfo_ldap_set_option) @@ -2703,6 +2793,8 @@ const zend_function_entry ldap_functions[] = { PHP_FE(ldap_set_rebind_proc, arginfo_ldap_set_rebind_proc) #endif + PHP_FE(ldap_escape, arginfo_ldap_escape) + #ifdef STR_TRANSLATION PHP_FE(ldap_t61_to_8859, arginfo_ldap_t61_to_8859) PHP_FE(ldap_8859_to_t61, arginfo_ldap_8859_to_t61) diff --git a/ext/ldap/tests/ldap_escape_all.phpt b/ext/ldap/tests/ldap_escape_all.phpt new file mode 100644 index 0000000000000..a79be004ffe56 --- /dev/null +++ b/ext/ldap/tests/ldap_escape_all.phpt @@ -0,0 +1,14 @@ +--TEST-- +ldap_escape() test all +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(39) "\66\6f\6f\3d\62\61\72\28\62\61\7a\29\2a" \ No newline at end of file diff --git a/ext/ldap/tests/ldap_escape_both.phpt b/ext/ldap/tests/ldap_escape_both.phpt new file mode 100644 index 0000000000000..2169c0ad2e75c --- /dev/null +++ b/ext/ldap/tests/ldap_escape_both.phpt @@ -0,0 +1,14 @@ +--TEST-- +ldap_escape() test filter and DN +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(21) "foo\3dbar\28baz\29\2a" \ No newline at end of file diff --git a/ext/ldap/tests/ldap_escape_dn.phpt b/ext/ldap/tests/ldap_escape_dn.phpt new file mode 100644 index 0000000000000..fbcb0545ae4e8 --- /dev/null +++ b/ext/ldap/tests/ldap_escape_dn.phpt @@ -0,0 +1,14 @@ +--TEST-- +ldap_escape() test DN +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(15) "foo\3dbar(baz)*" \ No newline at end of file diff --git a/ext/ldap/tests/ldap_escape_filter.phpt b/ext/ldap/tests/ldap_escape_filter.phpt new file mode 100644 index 0000000000000..e4540a452d3f6 --- /dev/null +++ b/ext/ldap/tests/ldap_escape_filter.phpt @@ -0,0 +1,14 @@ +--TEST-- +ldap_escape() test filter +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(19) "foo=bar\28baz\29\2a" \ No newline at end of file diff --git a/ext/ldap/tests/ldap_escape_ignore.phpt b/ext/ldap/tests/ldap_escape_ignore.phpt new file mode 100644 index 0000000000000..ab56aa2d0e91f --- /dev/null +++ b/ext/ldap/tests/ldap_escape_ignore.phpt @@ -0,0 +1,15 @@ +--TEST-- +ldap_escape() test ignore +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(31) "\66oo\3d\62a\72\28\62a\7a\29\2a" \ No newline at end of file diff --git a/ext/ldap/tests/ldap_search_variation6.phpt b/ext/ldap/tests/ldap_search_variation6.phpt index a29e4524df46b..5139ebb77dece 100644 --- a/ext/ldap/tests/ldap_search_variation6.phpt +++ b/ext/ldap/tests/ldap_search_variation6.phpt @@ -217,14 +217,26 @@ array(2) { [1]=> resource(%d) of type (ldap result) } -NULL -NULL +array(1) { + ["count"]=> + int(0) +} +array(1) { + ["count"]=> + int(0) +} array(2) { [0]=> resource(%d) of type (ldap result) [1]=> resource(%d) of type (ldap result) } -NULL -NULL +array(1) { + ["count"]=> + int(0) +} +array(1) { + ["count"]=> + int(0) +} ===DONE=== diff --git a/ext/libxml/tests/bug61367-read.phpt b/ext/libxml/tests/bug61367-read.phpt index 75d0006a3f35e..b4ecaa0324292 100644 --- a/ext/libxml/tests/bug61367-read.phpt +++ b/ext/libxml/tests/bug61367-read.phpt @@ -32,10 +32,10 @@ XML } } -var_dump(mkdir('test_bug_61367')); -var_dump(mkdir('test_bug_61367/base')); -var_dump(file_put_contents('test_bug_61367/bad', 'blah')); -var_dump(chdir('test_bug_61367/base')); +var_dump(mkdir('test_bug_61367-read')); +var_dump(mkdir('test_bug_61367-read/base')); +var_dump(file_put_contents('test_bug_61367-read/bad', 'blah')); +var_dump(chdir('test_bug_61367-read/base')); stream_wrapper_register( 'exploit', 'StreamExploiter' ); $s = fopen( 'exploit://', 'r' ); @@ -43,9 +43,9 @@ $s = fopen( 'exploit://', 'r' ); ?> --CLEAN-- --EXPECTF-- bool(true) @@ -53,7 +53,7 @@ bool(true) int(4) bool(true) -Warning: DOMDocument::loadXML(): I/O warning : failed to load external entity "file:///%s/test_bug_61367/bad" in %s on line %d +Warning: DOMDocument::loadXML(): I/O warning : failed to load external entity "file:///%s/test_bug_61367-read/bad" in %s on line %d Warning: DOMDocument::loadXML(): Failure to process entity file in Entity, line: 4 in %s on line %d diff --git a/ext/libxml/tests/bug61367-write.phpt b/ext/libxml/tests/bug61367-write.phpt index e18b07149a7cb..63e99a8e50a2f 100644 --- a/ext/libxml/tests/bug61367-write.phpt +++ b/ext/libxml/tests/bug61367-write.phpt @@ -19,10 +19,10 @@ class StreamExploiter { } } -var_dump(mkdir('test_bug_61367')); -var_dump(mkdir('test_bug_61367/base')); -var_dump(file_put_contents('test_bug_61367/bad', 'blah')); -var_dump(chdir('test_bug_61367/base')); +var_dump(mkdir('test_bug_61367-write')); +var_dump(mkdir('test_bug_61367-write/base')); +var_dump(file_put_contents('test_bug_61367-write/bad', 'blah')); +var_dump(chdir('test_bug_61367-write/base')); stream_wrapper_register( 'exploit', 'StreamExploiter' ); $s = fopen( 'exploit://', 'r' ); @@ -30,9 +30,9 @@ $s = fopen( 'exploit://', 'r' ); ?> --CLEAN-- --EXPECTF-- bool(true) diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_mobile.c b/ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_mobile.c index 4deb02960c3a3..03e9633cae756 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_mobile.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_mobile.c @@ -142,7 +142,7 @@ const struct mbfl_convert_vtbl vtbl_wchar_2022jp_kddi = { int mbfl_filt_conv_2022jp_mobile_wchar(int c, mbfl_convert_filter *filter) { - int c1, s, w, snd; + int c1, s, w, snd = 0; retry: switch (filter->status & 0xf) { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_sjis_2004.c b/ext/mbstring/libmbfl/filters/mbfilter_sjis_2004.c index 4e1838f0601c5..87bb2f21fd5f2 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_sjis_2004.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_sjis_2004.c @@ -134,7 +134,7 @@ int mbfl_filt_conv_jis2004_wchar(int c, mbfl_convert_filter *filter) { int k; - int c1, c2, s, s1, s2, w = 0, w1; + int c1, c2, s, s1 = 0, s2 = 0, w = 0, w1; retry: switch (filter->status & 0xf) { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_sjis_mobile.c b/ext/mbstring/libmbfl/filters/mbfilter_sjis_mobile.c index 7a549af666587..93ac34644a833 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_sjis_mobile.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_sjis_mobile.c @@ -605,7 +605,7 @@ mbfilter_unicode2sjis_emoji_sb(int c, int *s1, mbfl_convert_filter *filter) int mbfl_filt_conv_sjis_mobile_wchar(int c, mbfl_convert_filter *filter) { - int c1, s, s1, s2, w; + int c1, s, s1 = 0, s2 = 0, w; int snd = 0; retry: diff --git a/ext/mbstring/libmbfl/mbfl/mbfilter.c b/ext/mbstring/libmbfl/mbfl/mbfilter.c index b3759f940d549..3b14727d6b6c1 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfilter.c +++ b/ext/mbstring/libmbfl/mbfl/mbfilter.c @@ -985,7 +985,7 @@ mbfl_strpos( { int result; mbfl_string _haystack_u8, _needle_u8; - const mbfl_string *haystack_u8, *needle_u8; + const mbfl_string *haystack_u8, *needle_u8 = NULL; const unsigned char *u8_tbl; if (haystack == NULL || haystack->val == NULL || needle == NULL || needle->val == NULL) { diff --git a/ext/mbstring/mb_gpc.c b/ext/mbstring/mb_gpc.c index 5ecc8f365e8ae..30764dc8076d3 100644 --- a/ext/mbstring/mb_gpc.c +++ b/ext/mbstring/mb_gpc.c @@ -364,6 +364,7 @@ SAPI_POST_HANDLER_FUNC(php_mb_post_handler) { const mbfl_encoding *detected; php_mb_encoding_handler_info_t info; + char *post_data_str = NULL; MBSTRG(http_input_identify_post) = NULL; @@ -376,7 +377,10 @@ SAPI_POST_HANDLER_FUNC(php_mb_post_handler) info.num_from_encodings = MBSTRG(http_input_list_size); info.from_language = MBSTRG(language); - detected = _php_mb_encoding_handler_ex(&info, arg, SG(request_info).post_data TSRMLS_CC); + php_stream_rewind(SG(request_info).request_body); + php_stream_copy_to_mem(SG(request_info).request_body, &post_data_str, PHP_STREAM_COPY_ALL, 0); + detected = _php_mb_encoding_handler_ex(&info, arg, post_data_str TSRMLS_CC); + STR_FREE(post_data_str); MBSTRG(http_input_identify) = detected; if (detected) { diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 4e430b6ea2364..168b133c6429f 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -402,10 +402,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_convert_kana, 0, 0, 1) ZEND_ARG_INFO(0, encoding) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_convert_variables, 1, 0, 3) +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_convert_variables, 0, 0, 3) ZEND_ARG_INFO(0, to) ZEND_ARG_INFO(0, from) - ZEND_ARG_INFO(1, ...) + ZEND_ARG_VARIADIC_INFO(1, vars) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_encode_numericentity, 0, 0, 2) diff --git a/ext/mysql/tests/bug55473.phpt b/ext/mysql/tests/bug55473.phpt index 1cc2dc928251c..98fd0091dcd16 100644 --- a/ext/mysql/tests/bug55473.phpt +++ b/ext/mysql/tests/bug55473.phpt @@ -69,18 +69,26 @@ mysql.allow_persistent=1 ?> --EXPECTF-- Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d + +Warning: mysql_ping(): MySQL server has gone away in %s on line %d [003] reconnect 0 Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d [005] Setting openened files... + +Warning: mysql_ping(): MySQL server has gone away in %s on line %d [003] reconnect 1 Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d [007] Opened files as expected + +Warning: mysql_ping(): MySQL server has gone away in %s on line %d [003] reconnect 2 Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d [007] Opened files as expected + +Warning: mysql_ping(): MySQL server has gone away in %s on line %d [003] reconnect 3 Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 3ee5c803a5508..e67aba8da04fa 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -385,7 +385,7 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval ***args, unsigned int argc, /* Changed to my_bool in MySQL 5.1. See MySQL Bug #16144 */ my_bool tmp; #else - uint tmp = 0; + ulong tmp = 0; #endif stmt->result.buf[ofs].type = IS_STRING; /* diff --git a/ext/mysqli/mysqli_fe.c b/ext/mysqli/mysqli_fe.c index 6f2e404087843..eb94ff65bbebf 100644 --- a/ext/mysqli/mysqli_fe.c +++ b/ext/mysqli/mysqli_fe.c @@ -43,23 +43,28 @@ #define MYSQLI_ZEND_ARG_OBJ_INFO_STMT() ZEND_ARG_INFO(0, stmt) #endif -ZEND_BEGIN_ARG_INFO(arginfo_mysqli_stmt_bind_result, 1) +ZEND_BEGIN_ARG_INFO(arginfo_mysqli_stmt_bind_result, 0) MYSQLI_ZEND_ARG_OBJ_INFO_STMT() + ZEND_ARG_VARIADIC_INFO(1, vars) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_mysqli_stmt_bind_param, 1) +ZEND_BEGIN_ARG_INFO(arginfo_mysqli_stmt_bind_param, 0) MYSQLI_ZEND_ARG_OBJ_INFO_STMT() ZEND_ARG_INFO(0, types) + ZEND_ARG_VARIADIC_INFO(1, vars) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_class_mysqli_stmt_bind_result, 1) +ZEND_BEGIN_ARG_INFO(arginfo_class_mysqli_stmt_bind_result, 0) + ZEND_ARG_VARIADIC_INFO(1, vars) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_class_mysqli_stmt_bind_param, 1) +ZEND_BEGIN_ARG_INFO(arginfo_class_mysqli_stmt_bind_param, 0) ZEND_ARG_INFO(0, types) + ZEND_ARG_VARIADIC_INFO(1, vars) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(all_args_force_by_ref, 1) +ZEND_BEGIN_ARG_INFO(all_args_force_by_ref, 0) + ZEND_ARG_VARIADIC_INFO(1, vars) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_mysqli_poll, 0, 0, 4) diff --git a/ext/mysqli/tests/bug66043.phpt b/ext/mysqli/tests/bug66043.phpt new file mode 100644 index 0000000000000..d0e8b1c3d391f --- /dev/null +++ b/ext/mysqli/tests/bug66043.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #66043 (Segfault calling bind_param() on mysqli) +--SKIPIF-- + +--FILE-- +stmt_init(); +$stmt->prepare("SELECT User FROM user WHERE password=\"\""); +$stmt->execute(); +$stmt->bind_result($testArg); +echo "Okey"; +?> +--EXPECTF-- +Okey diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index b41e5424f590e..c9e134f7a3ee6 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -557,7 +557,7 @@ mysqlnd_run_authentication( if (!auth_plugin) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The server requested authentication method unknown to the client [%s]", requested_protocol); - SET_CLIENT_ERROR(*conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "The server requested authentication method umknown to the client"); + SET_CLIENT_ERROR(*conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "The server requested authentication method unknown to the client"); goto end; } DBG_INF("plugin found"); @@ -2247,7 +2247,6 @@ MYSQLND_METHOD(mysqlnd_conn_data, change_user)(MYSQLND_CONN_DATA * const conn, } if (!db) { db = ""; - } /* XXX: passwords that have \0 inside work during auth, but in this case won't work with change user */ diff --git a/ext/oci8/LICENSE b/ext/oci8/LICENSE new file mode 100644 index 0000000000000..42536af320686 --- /dev/null +++ b/ext/oci8/LICENSE @@ -0,0 +1,68 @@ +-------------------------------------------------------------------- + The PHP License, version 3.01 +Copyright (c) 1999 - 2012 The PHP Group. All rights reserved. +-------------------------------------------------------------------- + +Redistribution and use in source and binary forms, with or without +modification, is permitted provided that the following conditions +are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + 3. The name "PHP" must not be used to endorse or promote products + derived from this software without prior written permission. For + written permission, please contact group@php.net. + + 4. Products derived from this software may not be called "PHP", nor + may "PHP" appear in their name, without prior written permission + from group@php.net. You may indicate that your software works in + conjunction with PHP by saying "Foo for PHP" instead of calling + it "PHP Foo" or "phpfoo" + + 5. The PHP Group may publish revised and/or new versions of the + license from time to time. Each version will be given a + distinguishing version number. + Once covered code has been published under a particular version + of the license, you may always continue to use it under the terms + of that version. You may also choose to use such covered code + under the terms of any subsequent version of the license + published by the PHP Group. No one other than the PHP Group has + the right to modify the terms applicable to covered code created + under this License. + + 6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes PHP software, freely available from + ". + +THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND +ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP +DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. + +-------------------------------------------------------------------- + +This software consists of voluntary contributions made by many +individuals on behalf of the PHP Group. + +The PHP Group can be contacted via Email at group@php.net. + +For more information on the PHP Group and the PHP project, +please see . + +PHP includes the Zend Engine, freely available at +. diff --git a/ext/oci8/README b/ext/oci8/README index af5beeb5c0745..d662072743fd1 100644 --- a/ext/oci8/README +++ b/ext/oci8/README @@ -1,13 +1,20 @@ The OCI8 Extension ------------------ -Use the OCI8 extension to access Oracle Database. +Use the OCI8 extension to access Oracle Database. Documentation is at http://php.net/oci8 -The extension can be built with PHP versions 4.3.9 to 5.x using Oracle -Database 9.2, 10, 11 or 12 client libraries. Oracle's standard -cross-version connectivity applies. For example PHP linked with -Oracle 11.2 client libraries can connect to Oracle Database 9.2 -onwards. See Oracle's note "Oracle Client / Server Interoperability -Support" (ID 207303.1) for details. +The extension can be linked with Oracle client libraries from Oracle +Database 10.2, 11, or 12.1. These libraries are found in the database +installation, or in the free Oracle Instant Client available from +Oracle. + +Oracle's standard cross-version connectivity applies. For example, +PHP OCI8 linked with Instant Client 11.2 can connect to Oracle +Database 9.2 onward. See Oracle's note "Oracle Client / Server +Interoperability Support" (ID 207303.1) for details. + +PHP OCI8 2.0 can be built with PHP 5.2 onward. Use the older PHP OCI8 +1.4.10 when using PHP 4.3.9 through to PHP 5.1.x, or when only Oracle +Database 9.2 client libraries are available. diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4 index b76db64638544..0d08d21c29e61 100644 --- a/ext/oci8/config.m4 +++ b/ext/oci8/config.m4 @@ -15,22 +15,6 @@ else PHP_OCI8_TAIL1="tail -1" fi -AC_DEFUN([PHP_OCI_IF_DEFINED],[ - old_CPPFLAGS=$CPPFLAGS - CPPFLAGS=$3 - AC_EGREP_CPP(yes,[ -#include -#if defined($1) - yes -#endif - ],[ - CPPFLAGS=$old_CPPFLAGS - $2 - ],[ - CPPFLAGS=$old_CPPFLAGS - ]) -]) - AC_DEFUN([AC_OCI8_CHECK_LIB_DIR],[ AC_MSG_CHECKING([ORACLE_HOME library validity]) if test ! -d "$OCI8_DIR"; then @@ -98,13 +82,99 @@ AC_DEFUN([AC_OCI8_ORACLE_VERSION],[ AC_MSG_RESULT($OCI8_ORACLE_VERSION) ]) +dnl +dnl OCI8_INIT_DTRACE(providerdesc, header-file, sources) +dnl This mimics PHP_INIT_DTRACE from PHP 5.4's acinclude.m4. It is +dnl necessarily different from PHP_INIT_DTRACE which doesn't currently +dnl support DTrace for extensions. Creating OCI8_INIT_DTRACE +dnl independently instead of using a refactored PHP_INIT_DTRACE allows +dnl OCI8 to be DTraced on versions of PHP where core PHP DTrace support +dnl isn't available. +dnl +AC_DEFUN([OCI8_INIT_DTRACE],[ + ac_srcdir=[]PHP_EXT_SRCDIR([oci8])/ + ac_bdir=[]PHP_EXT_BUILDDIR([oci8])/ + +dnl providerdesc + ac_provsrc=$1 + +dnl header-file + ac_hdrobj=$2 + +dnl DTrace objects + old_IFS=[$]IFS + for ac_src in $3; do + IFS=. + set $ac_src + ac_obj=[$]1 + IFS=$old_IFS + + OCI8_DTRACE_OBJS="[$]OCI8_DTRACE_OBJS [$]ac_bdir[$]ac_obj.lo" + done; + + for ac_lo in $OCI8_DTRACE_OBJS; do + dtrace_oci8_objs="[$]dtrace_oci8_objs `echo $ac_lo | $SED -e 's,\.lo$,.o,' -e 's#\(.*\)\/#\1\/.libs\/#'`" + done; + +dnl Generate Makefile.objects entry +dnl The empty $ac_provsrc command stops an implicit circular dependency +dnl in GNU Make which causes the .d file to be overwritten (Bug 61268) + cat>>Makefile.objects< \$[]@ + +\$(OCI8_DTRACE_OBJS): $ac_bdir[$]ac_hdrobj + +EOF + + case $host_alias in + *solaris*|*linux*) + dtrace_prov_name="`echo $ac_provsrc | $SED -e 's#\(.*\)\/##'`.o" + dtrace_lib_dir="`echo $ac_bdir[$]ac_provsrc | $SED -e 's#\(.*\)/[^/]*#\1#'`/.libs" + dtrace_d_obj="`echo $ac_bdir[$]ac_provsrc | $SED -e 's#\(.*\)/\([^/]*\)#\1/.libs/\2#'`.o" + dtrace_nolib_objs='$(OCI8_DTRACE_OBJS:.lo=.o)' + for ac_lo in $OCI8_DTRACE_OBJS; do + dtrace_oci8_lib_objs="[$]dtrace_oci8_lib_objs `echo $ac_lo | $SED -e 's,\.lo$,.o,' -e 's#\(.*\)\/#\1\/.libs\/#'`" + done; +dnl Always attempt to create both PIC and non-PIC DTrace objects (Bug 63692) + cat>>Makefile.objects< \$[]@ + @test -d "$dtrace_lib_dir" || mkdir $dtrace_lib_dir + if CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $dtrace_d_obj -s $ac_srcdir[$]ac_provsrc $dtrace_oci8_lib_objs 2> /dev/null && test -f "$dtrace_d_obj"; then [\\] + echo "pic_object=['].libs/$dtrace_prov_name[']" >> \$[]@ [;\\] + else [\\] + echo "pic_object='none'" >> \$[]@ [;\\] + fi + if CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $ac_bdir[$]ac_provsrc.o -s $ac_srcdir[$]ac_provsrc $dtrace_nolib_objs 2> /dev/null && test -f "$ac_bdir[$]ac_provsrc.o"; then [\\] + echo "non_pic_object=[']$dtrace_prov_name[']" >> \$[]@ [;\\] + else [\\] + echo "non_pic_object='none'" >> \$[]@ [;\\] + fi + +EOF + ;; + *) + AC_MSG_WARN([OCI8 extension: OCI8 DTrace support is not confirmed on this platform]) +cat>>Makefile.objects< | + | Authors: Stig Sæther Bakken | | Thies C. Arntzen | | Maxim Maletsky | | | @@ -39,12 +39,9 @@ #if HAVE_OCI8 -#if PHP_MAJOR_VERSION > 5 -#error This version of the PHP OCI8 extension is not compatible with PHP 6 or later -#elif PHP_MAJOR_VERSION < 5 -#ifdef ZTS -#error The PHP OCI8 extension does not support ZTS mode in PHP 4 -#endif +/* PHP 5.2 is the minimum supported version for OCI8 2.0 */ +#if PHP_MAJOR_VERSION < 5 || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION <= 1) +#error Use PHP OCI8 1.4 for your version of PHP #endif #include "php_oci8.h" @@ -66,11 +63,8 @@ #endif ZEND_DECLARE_MODULE_GLOBALS(oci) -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5) -/* This "if" allows PECL builds from this file to be portable to older PHP releases */ static PHP_GINIT_FUNCTION(oci); static PHP_GSHUTDOWN_FUNCTION(oci); -#endif /* Allow PHP 5.3 branch to be used in PECL for 5.x compatible builds */ #ifndef Z_ADDREF_P @@ -151,7 +145,7 @@ static sword php_oci_ping_init(php_oci_connection *connection, OCIError *errh TS /* }}} */ /* {{{ dynamically loadable module stuff */ -#if defined(COMPILE_DL_OCI8) || defined(COMPILE_DL_OCI8_11G) +#if defined(COMPILE_DL_OCI8) || defined(COMPILE_DL_OCI8_11G) || defined(COMPILE_DL_OCI8_12C) ZEND_GET_MODULE(oci8) #endif /* COMPILE_DL */ /* }}} */ @@ -457,6 +451,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_set_client_info, 0, 0, 2) ZEND_ARG_INFO(0, client_information) ZEND_END_ARG_INFO() +#ifdef WAITIING_ORACLE_BUG_16695981_FIX +ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_set_db_operation, 0, 0, 2) +ZEND_ARG_INFO(0, connection_resource) +ZEND_ARG_INFO(0, action) +ZEND_END_ARG_INFO() +#endif + ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_password_change, 0, 0, 4) ZEND_ARG_INFO(0, connection_resource_or_connection_string) ZEND_ARG_INFO(0, username) @@ -708,6 +709,9 @@ static unsigned char arginfo_oci_bind_array_by_name[] = { 3, BYREF_NONE, BYREF_N #define arginfo_oci_set_module_name NULL #define arginfo_oci_set_action NULL #define arginfo_oci_set_client_info NULL +#ifdef WAITIING_ORACLE_BUG_16695981_FIX +#define arginfo_oci_set_db_operation NULL +#endif #define arginfo_oci_password_change NULL #define arginfo_oci_new_cursor NULL #define arginfo_oci_result NULL @@ -799,6 +803,9 @@ PHP_FUNCTION(oci_statement_type); PHP_FUNCTION(oci_num_rows); PHP_FUNCTION(oci_set_prefetch); PHP_FUNCTION(oci_set_client_identifier); +#ifdef WAITIING_ORACLE_BUG_16695981_FIX +PHP_FUNCTION(oci_set_db_operation); +#endif PHP_FUNCTION(oci_set_edition); PHP_FUNCTION(oci_set_module_name); PHP_FUNCTION(oci_set_action); @@ -904,6 +911,9 @@ zend_function_entry php_oci_functions[] = { PHP_FE(oci_new_descriptor, arginfo_oci_new_descriptor) PHP_FE(oci_set_prefetch, arginfo_oci_set_prefetch) PHP_FE(oci_set_client_identifier, arginfo_oci_set_client_identifier) +#ifdef WAITIING_ORACLE_BUG_16695981_FIX + PHP_FE(oci_set_db_operation, arginfo_oci_set_db_operation) +#endif PHP_FE(oci_set_edition, arginfo_oci_set_edition) PHP_FE(oci_set_module_name, arginfo_oci_set_module_name) PHP_FE(oci_set_action, arginfo_oci_set_action) @@ -1039,16 +1049,11 @@ zend_module_entry oci8_module_entry = { PHP_RSHUTDOWN(oci), /* per-request shutdown function */ PHP_MINFO(oci), /* information function */ PHP_OCI8_VERSION, -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5) - /* This check allows PECL builds from this file to be portable to older PHP releases */ PHP_MODULE_GLOBALS(oci), /* globals descriptor */ PHP_GINIT(oci), /* globals ctor */ PHP_GSHUTDOWN(oci), /* globals dtor */ NULL, /* post deactivate */ STANDARD_MODULE_PROPERTIES_EX -#else - STANDARD_MODULE_PROPERTIES -#endif }; /* }}} */ @@ -1115,10 +1120,10 @@ static void php_oci_init_global_handles(TSRMLS_D) */ OCICPool *cpoolh; ub4 cpoolmode = 0x80000000; /* Pass invalid mode to OCIConnectionPoolCreate */ - PHP_OCI_CALL(OCIHANDLEALLOC, OCIHandleAlloc, (OCI_G(env), (dvoid **) &cpoolh, OCI_HTYPE_CPOOL, (size_t) 0, (dvoid **) 0)); - PHP_OCI_CALL(OCICONNECTIONPOOLCREATE, OCIConnectionPoolCreate, (OCI_G(env), OCI_G(err), cpoolh, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, NULL, 0, cpoolmode)); - PHP_OCI_CALL(OCICONNECTIONPOOLDESTROY, OCIConnectionPoolDestroy, (cpoolh, OCI_G(err), OCI_DEFAULT)); - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, (cpoolh, OCI_HTYPE_CPOOL)); + PHP_OCI_CALL(OCIHandleAlloc, (OCI_G(env), (dvoid **) &cpoolh, OCI_HTYPE_CPOOL, (size_t) 0, (dvoid **) 0)); + PHP_OCI_CALL(OCIConnectionPoolCreate, (OCI_G(env), OCI_G(err), cpoolh, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, NULL, 0, cpoolmode)); + PHP_OCI_CALL(OCIConnectionPoolDestroy, (cpoolh, OCI_G(err), OCI_DEFAULT)); + PHP_OCI_CALL(OCIHandleFree, (cpoolh, OCI_HTYPE_CPOOL)); #endif } else { OCIErrorGet(OCI_G(env), (ub4)1, NULL, &ora_error_code, tmp_buf, (ub4)OCI_ERROR_MAXMSG_SIZE, (ub4)OCI_HTYPE_ERROR); @@ -1152,12 +1157,12 @@ static void php_oci_init_global_handles(TSRMLS_D) static void php_oci_cleanup_global_handles(TSRMLS_D) { if (OCI_G(err)) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) OCI_G(err), OCI_HTYPE_ERROR)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) OCI_G(err), OCI_HTYPE_ERROR)); OCI_G(err) = NULL; } if (OCI_G(env)) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) OCI_G(env), OCI_HTYPE_ENV)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) OCI_G(env), OCI_HTYPE_ENV)); OCI_G(env) = NULL; } } @@ -1167,12 +1172,7 @@ static void php_oci_cleanup_global_handles(TSRMLS_D) * * Zerofill globals during module init */ -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5) -/* This check allows PECL builds from this file to be portable to older PHP releases */ static PHP_GINIT_FUNCTION(oci) -#else -static void php_oci_init_globals(zend_oci_globals *oci_globals TSRMLS_DC) -#endif { memset(oci_globals, 0, sizeof(zend_oci_globals)); } @@ -1182,12 +1182,7 @@ static void php_oci_init_globals(zend_oci_globals *oci_globals TSRMLS_DC) * * Called for thread shutdown in ZTS, after module shutdown for non-ZTS */ -/* This check allows PECL builds from this file to be portable to older PHP releases */ -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5) static PHP_GSHUTDOWN_FUNCTION(oci) -#else -static void php_oci_shutdown_globals(zend_oci_globals *oci_globals TSRMLS_DC) -#endif { php_oci_cleanup_global_handles(TSRMLS_C); } @@ -1198,12 +1193,6 @@ PHP_MINIT_FUNCTION(oci) zend_class_entry oci_lob_class_entry; zend_class_entry oci_coll_class_entry; -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5) - /* This check allows PECL builds from this file to be portable to older PHP releases */ - /* this is handled by new globals management code */ -#else - ZEND_INIT_MODULE_GLOBALS(oci, php_oci_init_globals, php_oci_shutdown_globals); -#endif REGISTER_INI_ENTRIES(); le_statement = zend_register_list_destructors_ex(php_oci_statement_list_dtor, NULL, "oci8 statement", module_number); @@ -1306,7 +1295,6 @@ PHP_MINIT_FUNCTION(oci) PHP_RINIT_FUNCTION(oci) { - OCI_G(debug_mode) = 0; /* start "fresh" */ OCI_G(num_links) = OCI_G(num_persistent); OCI_G(errcode) = 0; OCI_G(edition) = NULL; @@ -1316,13 +1304,6 @@ PHP_RINIT_FUNCTION(oci) PHP_MSHUTDOWN_FUNCTION(oci) { -/* Work around PHP_GSHUTDOWN_FUNCTION not being called in older versions of PHP */ -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 2) || (PHP_MAJOR_VERSION < 5) -#ifndef ZTS - php_oci_cleanup_global_handles(TSRMLS_C); -#endif -#endif - OCI_G(shutdown) = 1; UNREGISTER_INI_ENTRIES(); @@ -1354,6 +1335,11 @@ PHP_MINFO_FUNCTION(oci) php_info_print_table_start(); php_info_print_table_row(2, "OCI8 Support", "enabled"); +#if defined(HAVE_OCI8_DTRACE) + php_info_print_table_row(2, "OCI8 DTrace Support", "enabled"); +#else + php_info_print_table_row(2, "OCI8 DTrace Support", "disabled"); +#endif php_info_print_table_row(2, "OCI8 Version", PHP_OCI8_VERSION); php_info_print_table_row(2, "Revision", "$Id$"); @@ -1361,6 +1347,8 @@ PHP_MINFO_FUNCTION(oci) php_oci_client_get_version(&ver TSRMLS_CC); php_info_print_table_row(2, "Oracle Run-time Client Library Version", ver); efree(ver); +#else + php_info_print_table_row(2, "Oracle Run-time Client Library Version", "Unknown"); #endif #if defined(OCI_MAJOR_VERSION) && defined(OCI_MINOR_VERSION) snprintf(buf, sizeof(buf), "%d.%d", OCI_MAJOR_VERSION, OCI_MINOR_VERSION); @@ -1384,6 +1372,7 @@ PHP_MINFO_FUNCTION(oci) #endif #endif + php_info_print_table_end(); DISPLAY_INI_ENTRIES(); @@ -1467,11 +1456,11 @@ static void php_oci_pconnection_list_np_dtor(zend_rsrc_list_entry *entry TSRMLS_ OCI_G(num_persistent)--; } -#ifdef HAVE_DTRACE +#ifdef HAVE_OCI8_DTRACE if (DTRACE_OCI8_CONNECT_P_DTOR_CLOSE_ENABLED()) { DTRACE_OCI8_CONNECT_P_DTOR_CLOSE(connection); } -#endif /* HAVE_DTRACE */ +#endif /* HAVE_OCI8_DTRACE */ } else { /* * Release the connection to underlying pool. We do this unconditionally so that @@ -1484,11 +1473,11 @@ static void php_oci_pconnection_list_np_dtor(zend_rsrc_list_entry *entry TSRMLS_ */ php_oci_connection_release(connection TSRMLS_CC); -#ifdef HAVE_DTRACE +#ifdef HAVE_OCI8_DTRACE if (DTRACE_OCI8_CONNECT_P_DTOR_RELEASE_ENABLED()) { DTRACE_OCI8_CONNECT_P_DTOR_RELEASE(connection); } -#endif /* HAVE_DTRACE */ +#endif /* HAVE_OCI8_DTRACE */ } } /* }}} */ @@ -1635,12 +1624,12 @@ void php_oci_connection_descriptors_free(php_oci_connection *connection TSRMLS_D * Fetch & print out error message if we get an error * Returns an Oracle error number */ -sb4 php_oci_error(OCIError *err_p, sword status TSRMLS_DC) +sb4 php_oci_error(OCIError *err_p, sword errstatus TSRMLS_DC) { text *errbuf = (text *)NULL; - sb4 errcode = 0; + sb4 errcode = 0; /* Oracle error number */ - switch (status) { + switch (errstatus) { case OCI_SUCCESS: break; case OCI_SUCCESS_WITH_INFO: @@ -1683,15 +1672,15 @@ sb4 php_oci_error(OCIError *err_p, sword status TSRMLS_DC) php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_CONTINUE"); break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown OCI error code: %d", status); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown OCI error code: %d", errstatus); break; } -#ifdef HAVE_DTRACE +#ifdef HAVE_OCI8_DTRACE if (DTRACE_OCI8_ERROR_ENABLED()) { - DTRACE_OCI8_ERROR(status, errcode); + DTRACE_OCI8_ERROR((int)errstatus, (long)errcode); } -#endif /* HAVE_DTRACE */ +#endif /* HAVE_OCI8_DTRACE */ return errcode; } @@ -1707,7 +1696,7 @@ sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC) text err_buf[PHP_OCI_ERRBUF_LEN]; memset(err_buf, 0, sizeof(err_buf)); - PHP_OCI_CALL(OCIERRORGET, OCIErrorGet, (error_handle, (ub4)1, NULL, &error_code, err_buf, (ub4)PHP_OCI_ERRBUF_LEN, (ub4)OCI_HTYPE_ERROR)); + PHP_OCI_CALL(OCIErrorGet, (error_handle, (ub4)1, NULL, &error_code, err_buf, (ub4)PHP_OCI_ERRBUF_LEN, (ub4)OCI_HTYPE_ERROR)); if (error_code) { int err_buf_len = strlen((char *)err_buf); @@ -1734,7 +1723,7 @@ int php_oci_fetch_sqltext_offset(php_oci_statement *statement, text **sqltext, u *sqltext = NULL; *error_offset = 0; - PHP_OCI_CALL_RETURN(OCIATTRGET, errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *) sqltext, (ub4 *)0, OCI_ATTR_STATEMENT, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *) sqltext, (ub4 *)0, OCI_ATTR_STATEMENT, statement->err)); if (errstatus != OCI_SUCCESS) { statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); @@ -1742,7 +1731,7 @@ int php_oci_fetch_sqltext_offset(php_oci_statement *statement, text **sqltext, u return 1; } - PHP_OCI_CALL_RETURN(OCIATTRGET, errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)error_offset, (ub4 *)0, OCI_ATTR_PARSE_ERROR_OFFSET, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)error_offset, (ub4 *)0, OCI_ATTR_PARSE_ERROR_OFFSET, statement->err)); if (errstatus != OCI_SUCCESS) { statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); @@ -1771,11 +1760,11 @@ void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclus return; } -#ifdef HAVE_DTRACE - if (DTRACE_OCI8_CONNECT_START_ENABLED()) { - DTRACE_OCI8_CONNECT_START(username, dbname, charset, session_mode, persistent, exclusive); +#ifdef HAVE_OCI8_DTRACE + if (DTRACE_OCI8_CONNECT_ENTRY_ENABLED()) { + DTRACE_OCI8_CONNECT_ENTRY(username, dbname, charset, session_mode, persistent, exclusive); } -#endif /* HAVE_DTRACE */ +#endif /* HAVE_OCI8_DTRACE */ if (!charset_len) { charset = NULL; @@ -1783,11 +1772,11 @@ void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclus connection = php_oci_do_connect_ex(username, username_len, password, password_len, NULL, 0, dbname, dbname_len, charset, session_mode, persistent, exclusive TSRMLS_CC); -#ifdef HAVE_DTRACE - if (DTRACE_OCI8_CONNECT_DONE_ENABLED()) { - DTRACE_OCI8_CONNECT_DONE(); +#ifdef HAVE_OCI8_DTRACE + if (DTRACE_OCI8_CONNECT_RETURN_ENABLED()) { + DTRACE_OCI8_CONNECT_RETURN(connection); } -#endif /* HAVE_DTRACE */ +#endif /* HAVE_OCI8_DTRACE */ if (!connection) { @@ -1904,7 +1893,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char smart_str_appendl_ex(&hashed_details, "**", sizeof("**") - 1, 0); if (charset && *charset) { - PHP_OCI_CALL_RETURN(OCINLSCHARSETNAMETOID, charsetid, OCINlsCharSetNameToId, (OCI_G(env), (CONST oratext *)charset)); + PHP_OCI_CALL_RETURN(charsetid, OCINlsCharSetNameToId, (OCI_G(env), (CONST oratext *)charset)); if (!charsetid) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid character set name: %s", charset); } else { @@ -1917,7 +1906,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char size_t rsize = 0; sword result; - PHP_OCI_CALL_RETURN(OCINLSENVIRONMENTVARIABLEGET, result, OCINlsEnvironmentVariableGet, (&charsetid_nls_lang, 0, OCI_NLS_CHARSET_ID, 0, &rsize)); + PHP_OCI_CALL_RETURN(result, OCINlsEnvironmentVariableGet, (&charsetid_nls_lang, 0, OCI_NLS_CHARSET_ID, 0, &rsize)); if (result != OCI_SUCCESS) { charsetid_nls_lang = 0; } @@ -1955,11 +1944,11 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char } } -#ifdef HAVE_DTRACE +#ifdef HAVE_OCI8_DTRACE if (DTRACE_OCI8_CONNECT_LOOKUP_ENABLED()) { DTRACE_OCI8_CONNECT_LOOKUP(connection, connection && connection->is_stub ? 1 : 0); } -#endif /* HAVE_DTRACE */ +#endif /* HAVE_OCI8_DTRACE */ /* If we got a pconnection stub, then 'load'(OCISessionGet) the real connection from its * private spool A connection is a stub if it is only a cached structure and the real @@ -2090,6 +2079,9 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char connection = (php_oci_connection *) ecalloc(1, sizeof(php_oci_connection)); connection->hash_key = estrndup(hashed_details.c, hashed_details.len); connection->is_persistent = 0; +#ifdef HAVE_OCI8_DTRACE + connection->client_id = NULL; +#endif } else { connection = (php_oci_connection *) calloc(1, sizeof(php_oci_connection)); if (connection == NULL) { @@ -2101,11 +2093,17 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char return NULL; } connection->is_persistent = 1; +#ifdef HAVE_OCI8_DTRACE + connection->client_id = NULL; +#endif } } else { connection = (php_oci_connection *) ecalloc(1, sizeof(php_oci_connection)); connection->hash_key = estrndup(hashed_details.c, hashed_details.len); connection->is_persistent = 0; +#ifdef HAVE_OCI8_DTRACE + connection->client_id = NULL; +#endif } /* {{{ Get the session pool that suits this connection request from the persistent list. This @@ -2186,11 +2184,11 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char OCI_G(num_links)++; } -#ifdef HAVE_DTRACE +#ifdef HAVE_OCI8_DTRACE if (DTRACE_OCI8_CONNECT_TYPE_ENABLED()) { DTRACE_OCI8_CONNECT_TYPE(connection->is_persistent ? 1 : 0, exclusive ? 1 : 0, connection, OCI_G(num_persistent), OCI_G(num_links)); } -#endif /* HAVE_DTRACE */ +#endif /* HAVE_OCI8_DTRACE */ return connection; } @@ -2202,20 +2200,24 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char */ static int php_oci_connection_ping(php_oci_connection *connection TSRMLS_DC) { + sword errstatus; + + OCI_G(errcode) = 0; /* assume ping is successful */ + /* Use OCIPing instead of OCIServerVersion. If OCIPing returns ORA-1010 (invalid OCI operation) * such as from Pre-10.1 servers, the error is still from the server and we would have * successfully performed a roundtrip and validated the connection. Use OCIServerVersion for * Pre-10.2 clients */ #if ((OCI_MAJOR_VERSION > 10) || ((OCI_MAJOR_VERSION == 10) && (OCI_MINOR_VERSION >= 2))) /* OCIPing available 10.2 onwards */ - PHP_OCI_CALL_RETURN(OCIPING, OCI_G(errcode), OCIPing, (connection->svc, OCI_G(err), OCI_DEFAULT)); + PHP_OCI_CALL_RETURN(errstatus, OCIPing, (connection->svc, OCI_G(err), OCI_DEFAULT)); #else char version[256]; /* use good old OCIServerVersion() */ - PHP_OCI_CALL_RETURN(OCISERVERVERSION, OCI_G(errcode), OCIServerVersion, (connection->svc, OCI_G(err), (text *)version, sizeof(version), OCI_HTYPE_SVCCTX)); + PHP_OCI_CALL_RETURN(errstatus, OCIServerVersion, (connection->svc, OCI_G(err), (text *)version, sizeof(version), OCI_HTYPE_SVCCTX)); #endif - if (OCI_G(errcode) == OCI_SUCCESS) { + if (errstatus == OCI_SUCCESS) { return 1; } else { sb4 error_code = 0; @@ -2226,10 +2228,9 @@ static int php_oci_connection_ping(php_oci_connection *connection TSRMLS_DC) if (error_code == 1010) { return 1; } + OCI_G(errcode) = error_code; } - /* ignore errors here, just return failure - * php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); */ return 0; } /* }}} */ @@ -2240,17 +2241,17 @@ static int php_oci_connection_ping(php_oci_connection *connection TSRMLS_DC) */ static int php_oci_connection_status(php_oci_connection *connection TSRMLS_DC) { - ub4 ss = 0; + ub4 ss = OCI_SERVER_NOT_CONNECTED; + sword errstatus; /* get OCI_ATTR_SERVER_STATUS */ - PHP_OCI_CALL_RETURN(OCIATTRGET, OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->server, OCI_HTYPE_SERVER, (dvoid *)&ss, (ub4 *)0, OCI_ATTR_SERVER_STATUS, OCI_G(err))); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)connection->server, OCI_HTYPE_SERVER, (dvoid *)&ss, (ub4 *)0, OCI_ATTR_SERVER_STATUS, OCI_G(err))); - if (OCI_G(errcode) == OCI_SUCCESS && ss == OCI_SERVER_NORMAL) { + if (errstatus == OCI_SUCCESS && ss == OCI_SERVER_NORMAL) { return 1; } - /* ignore errors here, just return failure - * php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); */ + /* ignore errors here, just return failure */ return 0; } /* }}} */ @@ -2261,14 +2262,17 @@ static int php_oci_connection_status(php_oci_connection *connection TSRMLS_DC) */ int php_oci_connection_rollback(php_oci_connection *connection TSRMLS_DC) { - PHP_OCI_CALL_RETURN(OCITRANSROLLBACK, connection->errcode, OCITransRollback, (connection->svc, connection->err, (ub4) 0)); + sword errstatus; + + PHP_OCI_CALL_RETURN(errstatus, OCITransRollback, (connection->svc, connection->err, (ub4) 0)); connection->rb_on_disconnect = 0; - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -2279,14 +2283,17 @@ int php_oci_connection_rollback(php_oci_connection *connection TSRMLS_DC) */ int php_oci_connection_commit(php_oci_connection *connection TSRMLS_DC) { - PHP_OCI_CALL_RETURN(OCITRANSCOMMIT, connection->errcode, OCITransCommit, (connection->svc, connection->err, (ub4) 0)); + sword errstatus; + + PHP_OCI_CALL_RETURN(errstatus, OCITransCommit, (connection->svc, connection->err, (ub4) 0)); connection->rb_on_disconnect = 0; - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -2300,42 +2307,48 @@ static int php_oci_connection_close(php_oci_connection *connection TSRMLS_DC) int result = 0; zend_bool in_call_save = OCI_G(in_call); +#ifdef HAVE_OCI8_DTRACE + if (DTRACE_OCI8_CONNECTION_CLOSE_ENABLED()) { + DTRACE_OCI8_CONNECTION_CLOSE(connection); + } +#endif /* HAVE_OCI8_DTRACE */ + if (!connection->is_stub) { /* Release resources associated with connection */ php_oci_connection_release(connection TSRMLS_CC); } if (!connection->using_spool && connection->svc) { - PHP_OCI_CALL(OCISESSIONEND, OCISessionEnd, (connection->svc, connection->err, connection->session, (ub4) 0)); + PHP_OCI_CALL(OCISessionEnd, (connection->svc, connection->err, connection->session, (ub4) 0)); } if (connection->err) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) connection->err, (ub4) OCI_HTYPE_ERROR)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->err, (ub4) OCI_HTYPE_ERROR)); } if (connection->authinfo) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) connection->authinfo, (ub4) OCI_HTYPE_AUTHINFO)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->authinfo, (ub4) OCI_HTYPE_AUTHINFO)); } /* No Handlefrees for session pool connections */ if (!connection->using_spool) { if (connection->session) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) connection->session, OCI_HTYPE_SESSION)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->session, OCI_HTYPE_SESSION)); } if (connection->is_attached) { - PHP_OCI_CALL(OCISERVERDETACH, OCIServerDetach, (connection->server, OCI_G(err), OCI_DEFAULT)); + PHP_OCI_CALL(OCIServerDetach, (connection->server, OCI_G(err), OCI_DEFAULT)); } if (connection->svc) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX)); } if (connection->server) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) connection->server, (ub4) OCI_HTYPE_SERVER)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->server, (ub4) OCI_HTYPE_SERVER)); } if (connection->env) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) connection->env, OCI_HTYPE_ENV)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->env, OCI_HTYPE_ENV)); } } else if (connection->private_spool) { /* Keep this as the last member to be freed, as there are dependencies @@ -2344,17 +2357,15 @@ static int php_oci_connection_close(php_oci_connection *connection TSRMLS_DC) php_oci_spool_close(connection->private_spool TSRMLS_CC); } - if (connection->is_persistent) { - if (connection->hash_key) { - free(connection->hash_key); - } - free(connection); - } else { - if (connection->hash_key) { - efree(connection->hash_key); - } - efree(connection); + if (connection->hash_key) { + pefree(connection->hash_key, connection->is_persistent); } +#ifdef HAVE_OCI8_DTRACE + if (connection->client_id) { + pefree(connection->client_id, connection->is_persistent); + } +#endif /* HAVE_OCI8_DTRACE */ + pefree(connection, connection->is_persistent); connection = NULL; OCI_G(in_call) = in_call_save; return result; @@ -2424,7 +2435,7 @@ int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC) #endif if (connection->svc) { - PHP_OCI_CALL(OCISESSIONRELEASE, OCISessionRelease, (connection->svc, connection->err, NULL, + PHP_OCI_CALL(OCISessionRelease, (connection->svc, connection->err, NULL, 0, rlsMode)); } /* It no longer has relation with the database session. However authinfo and env are @@ -2441,6 +2452,12 @@ int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC) * the OCI session */ connection->next_pingp = NULL; +#ifdef HAVE_OCI8_DTRACE + if (connection->client_id) { + pefree(connection->client_id, connection->is_persistent); + connection->client_id = NULL; + } +#endif /* HAVE_OCI8_DTRACE */ } OCI_G(in_call) = in_call_save; @@ -2454,13 +2471,16 @@ int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC) */ int php_oci_password_change(php_oci_connection *connection, char *user, int user_len, char *pass_old, int pass_old_len, char *pass_new, int pass_new_len TSRMLS_DC) { - PHP_OCI_CALL_RETURN(OCIPASSWORDCHANGE, connection->errcode, OCIPasswordChange, (connection->svc, connection->err, (text *)user, user_len, (text *)pass_old, pass_old_len, (text *)pass_new, pass_new_len, OCI_DEFAULT)); + sword errstatus; - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + PHP_OCI_CALL_RETURN(errstatus, OCIPasswordChange, (connection->svc, connection->err, (text *)user, user_len, (text *)pass_old, pass_old_len, (text *)pass_new, pass_new_len, OCI_DEFAULT)); + + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ connection->passwd_changed = 1; return 0; } @@ -2480,7 +2500,7 @@ void php_oci_client_get_version(char **version TSRMLS_DC) sword patch_num = 0; sword port_update_num = 0; - PHP_OCI_CALL(OCICLIENTVERSION, OCIClientVersion, (&major_version, &minor_version, &update_num, &patch_num, &port_update_num)); + PHP_OCI_CALL(OCIClientVersion, (&major_version, &minor_version, &update_num, &patch_num, &port_update_num)); snprintf(version_buff, sizeof(version_buff), "%d.%d.%d.%d.%d", major_version, minor_version, update_num, patch_num, port_update_num); #else memcpy(version_buff, "Unknown", sizeof("Unknown")); @@ -2495,12 +2515,13 @@ void php_oci_client_get_version(char **version TSRMLS_DC) */ int php_oci_server_get_version(php_oci_connection *connection, char **version TSRMLS_DC) { + sword errstatus; char version_buff[256]; - PHP_OCI_CALL_RETURN(OCISERVERVERSION, connection->errcode, OCIServerVersion, (connection->svc, connection->err, (text *)version_buff, sizeof(version_buff), OCI_HTYPE_SVCCTX)); + PHP_OCI_CALL_RETURN(errstatus, OCIServerVersion, (connection->svc, connection->err, (text *)version_buff, sizeof(version_buff), OCI_HTYPE_SVCCTX)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } @@ -2669,7 +2690,7 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg sword errstatus; /* Check for an Implicit Result Set on this statement handle */ - PHP_OCI_CALL_RETURN(OCIATTRGET, errstatus, OCIAttrGet, ((dvoid *)invokedstatement->stmt, OCI_HTYPE_STMT, + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)invokedstatement->stmt, OCI_HTYPE_STMT, (dvoid *) &invokedstatement->impres_count, (ub4 *)NULL, OCI_ATTR_IMPLICIT_RESULT_COUNT, invokedstatement->err)); if (errstatus) { @@ -2773,11 +2794,11 @@ static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC) connection = (php_oci_connection *)le->ptr; if (!connection->used_this_request && OCI_G(persistent_timeout) != -1) { -#ifdef HAVE_DTRACE +#ifdef HAVE_OCI8_DTRACE if (DTRACE_OCI8_CONNECT_EXPIRY_ENABLED()) { - DTRACE_OCI8_CONNECT_EXPIRY(connection, connection->is_stub ? 1 : 0, connection->idle_expiry, timestamp); + DTRACE_OCI8_CONNECT_EXPIRY(connection, connection->is_stub ? 1 : 0, (long)connection->idle_expiry, (long)timestamp); } -#endif /* HAVE_DTRACE */ +#endif /* HAVE_OCI8_DTRACE */ if (connection->idle_expiry < timestamp) { /* connection has timed out */ return ZEND_HASH_APPLY_REMOVE; @@ -2798,6 +2819,7 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha zend_bool iserror = 0; ub4 poolmode = OCI_DEFAULT; /* Mode to be passed to OCISessionPoolCreate */ OCIAuthInfo *spoolAuth = NULL; + sword errstatus; /* Allocate sessionpool out of persistent memory */ session_pool = (php_oci_spool *) calloc(1, sizeof(php_oci_spool)); @@ -2822,10 +2844,10 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha } /* Allocate the pool handle */ - PHP_OCI_CALL_RETURN(OCIHANDLEALLOC, OCI_G(errcode), OCIHandleAlloc, (session_pool->env, (dvoid **) &session_pool->poolh, OCI_HTYPE_SPOOL, (size_t) 0, (dvoid **) 0)); + PHP_OCI_CALL_RETURN(errstatus, OCIHandleAlloc, (session_pool->env, (dvoid **) &session_pool->poolh, OCI_HTYPE_SPOOL, (size_t) 0, (dvoid **) 0)); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC); iserror = 1; goto exit_create_spool; } @@ -2834,10 +2856,10 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha * generic bug which can free up the OCI_G(err) variable before destroying connections. We * cannot use this for other roundtrip calls as there is no way the user can access this error */ - PHP_OCI_CALL_RETURN(OCIHANDLEALLOC, OCI_G(errcode), OCIHandleAlloc, ((dvoid *) session_pool->env, (dvoid **)&(session_pool->err), (ub4) OCI_HTYPE_ERROR,(size_t) 0, (dvoid **) 0)); + PHP_OCI_CALL_RETURN(errstatus, OCIHandleAlloc, ((dvoid *) session_pool->env, (dvoid **)&(session_pool->err), (ub4) OCI_HTYPE_ERROR,(size_t) 0, (dvoid **) 0)); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC); iserror = 1; goto exit_create_spool; } @@ -2851,10 +2873,10 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha #if ((OCI_MAJOR_VERSION > 11) || ((OCI_MAJOR_VERSION == 11) && (OCI_MINOR_VERSION >= 2))) /* {{{ Allocate auth handle for session pool */ - PHP_OCI_CALL_RETURN(OCIHANDLEALLOC, OCI_G(errcode), OCIHandleAlloc, (session_pool->env, (dvoid **)&(spoolAuth), OCI_HTYPE_AUTHINFO, 0, NULL)); + PHP_OCI_CALL_RETURN(errstatus, OCIHandleAlloc, (session_pool->env, (dvoid **)&(spoolAuth), OCI_HTYPE_AUTHINFO, 0, NULL)); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC); iserror = 1; goto exit_create_spool; } @@ -2862,10 +2884,10 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha /* {{{ Set the edition attribute on the auth handle */ if (OCI_G(edition)) { - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode),OCIAttrSet, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO, (dvoid *) OCI_G(edition), (ub4)(strlen(OCI_G(edition))), (ub4)OCI_ATTR_EDITION, OCI_G(err))); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO, (dvoid *) OCI_G(edition), (ub4)(strlen(OCI_G(edition))), (ub4)OCI_ATTR_EDITION, OCI_G(err))); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC); iserror = 1; goto exit_create_spool; } @@ -2873,20 +2895,20 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha /* }}} */ /* {{{ Set the driver name attribute on the auth handle */ - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO, (dvoid *) PHP_OCI8_DRIVER_NAME, (ub4) sizeof(PHP_OCI8_DRIVER_NAME)-1, (ub4) OCI_ATTR_DRIVER_NAME, OCI_G(err))); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO, (dvoid *) PHP_OCI8_DRIVER_NAME, (ub4) sizeof(PHP_OCI8_DRIVER_NAME)-1, (ub4) OCI_ATTR_DRIVER_NAME, OCI_G(err))); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC); iserror = 1; goto exit_create_spool; } /* }}} */ /* {{{ Set the auth handle on the session pool */ - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode),OCIAttrSet, ((dvoid *) (session_pool->poolh),(ub4) OCI_HTYPE_SPOOL, (dvoid *) spoolAuth, (ub4)0, (ub4)OCI_ATTR_SPOOL_AUTH, OCI_G(err))); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, ((dvoid *) (session_pool->poolh),(ub4) OCI_HTYPE_SPOOL, (dvoid *) spoolAuth, (ub4)0, (ub4)OCI_ATTR_SPOOL_AUTH, OCI_G(err))); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC); iserror = 1; goto exit_create_spool; } @@ -2896,10 +2918,10 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha /* Create the homogeneous session pool - We have different session pools for every different * username, password, charset and dbname. */ - PHP_OCI_CALL_RETURN(OCISESSIONPOOLCREATE, OCI_G(errcode), OCISessionPoolCreate,(session_pool->env, OCI_G(err), session_pool->poolh, (OraText **)&session_pool->poolname, &session_pool->poolname_len, (OraText *)dbname, (ub4)dbname_len, 0, UB4MAXVAL, 1,(OraText *)username, (ub4)username_len, (OraText *)password,(ub4)password_len, poolmode)); + PHP_OCI_CALL_RETURN(errstatus, OCISessionPoolCreate,(session_pool->env, OCI_G(err), session_pool->poolh, (OraText **)&session_pool->poolname, &session_pool->poolname_len, (OraText *)dbname, (ub4)dbname_len, 0, UB4MAXVAL, 1,(OraText *)username, (ub4)username_len, (OraText *)password,(ub4)password_len, poolmode)); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC); iserror = 1; } @@ -2910,14 +2932,14 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha } if (spoolAuth) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO)); } -#ifdef HAVE_DTRACE +#ifdef HAVE_OCI8_DTRACE if (DTRACE_OCI8_SESSPOOL_CREATE_ENABLED()) { DTRACE_OCI8_SESSPOOL_CREATE(session_pool); } -#endif /* HAVE_DTRACE */ +#endif /* HAVE_OCI8_DTRACE */ return session_pool; } @@ -3005,7 +3027,7 @@ static OCIEnv *php_oci_create_env(ub2 charsetid TSRMLS_DC) OCIEnv *retenv = NULL; /* create an environment using the character set id */ - PHP_OCI_CALL_RETURN(OCIENVNLSCREATE, OCI_G(errcode), OCIEnvNlsCreate, (&retenv, OCI_G(events) ? PHP_OCI_INIT_MODE | OCI_EVENTS : PHP_OCI_INIT_MODE, 0, NULL, NULL, NULL, 0, NULL, charsetid, charsetid)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIEnvNlsCreate, (&retenv, OCI_G(events) ? PHP_OCI_INIT_MODE | OCI_EVENTS : PHP_OCI_INIT_MODE, 0, NULL, NULL, NULL, 0, NULL, charsetid, charsetid)); if (OCI_G(errcode) != OCI_SUCCESS) { sb4 ora_error_code = 0; @@ -3043,7 +3065,7 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna } /* {{{ Allocate our server handle */ - PHP_OCI_CALL_RETURN(OCIHANDLEALLOC, OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->server), OCI_HTYPE_SERVER, 0, NULL)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->server), OCI_HTYPE_SERVER, 0, NULL)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3052,7 +3074,7 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna /* }}} */ /* {{{ Attach to the server */ - PHP_OCI_CALL_RETURN(OCISERVERATTACH, OCI_G(errcode), OCIServerAttach, (connection->server, OCI_G(err), (text *)dbname, dbname_len, (ub4) OCI_DEFAULT)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIServerAttach, (connection->server, OCI_G(err), (text *)dbname, dbname_len, (ub4) OCI_DEFAULT)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3062,7 +3084,7 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna connection->is_attached = 1; /* {{{ Allocate our session handle */ - PHP_OCI_CALL_RETURN(OCIHANDLEALLOC, OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->session), OCI_HTYPE_SESSION, 0, NULL)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->session), OCI_HTYPE_SESSION, 0, NULL)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3071,7 +3093,7 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna /* }}} */ /* {{{ Allocate our private error-handle */ - PHP_OCI_CALL_RETURN(OCIHANDLEALLOC, OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->err), OCI_HTYPE_ERROR, 0, NULL)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->err), OCI_HTYPE_ERROR, 0, NULL)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3080,7 +3102,7 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna /* }}} */ /* {{{ Allocate our service-context */ - PHP_OCI_CALL_RETURN(OCIHANDLEALLOC, OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->svc), OCI_HTYPE_SVCCTX, 0, NULL)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->svc), OCI_HTYPE_SVCCTX, 0, NULL)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3090,7 +3112,7 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna /* {{{ Set the username */ if (username) { - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) username, (ub4) username_len, (ub4) OCI_ATTR_USERNAME, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) username, (ub4) username_len, (ub4) OCI_ATTR_USERNAME, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3101,7 +3123,7 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna /* {{{ Set the password */ if (password) { - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) password, (ub4) password_len, (ub4) OCI_ATTR_PASSWORD, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) password, (ub4) password_len, (ub4) OCI_ATTR_PASSWORD, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3113,7 +3135,7 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna /* {{{ Set the edition attribute on the session handle */ #if ((OCI_MAJOR_VERSION > 11) || ((OCI_MAJOR_VERSION == 11) && (OCI_MINOR_VERSION >= 2))) if (OCI_G(edition)) { - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) OCI_G(edition), (ub4) (strlen(OCI_G(edition))), (ub4) OCI_ATTR_EDITION, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) OCI_G(edition), (ub4) (strlen(OCI_G(edition))), (ub4) OCI_ATTR_EDITION, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3125,7 +3147,7 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna /* {{{ Set the driver name attribute on the session handle */ #if (OCI_MAJOR_VERSION >= 11) - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) PHP_OCI8_DRIVER_NAME, (ub4) sizeof(PHP_OCI8_DRIVER_NAME)-1, (ub4) OCI_ATTR_DRIVER_NAME, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) PHP_OCI8_DRIVER_NAME, (ub4) sizeof(PHP_OCI8_DRIVER_NAME)-1, (ub4) OCI_ATTR_DRIVER_NAME, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3135,7 +3157,7 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna /* }}} */ /* {{{ Set the server handle in the service handle */ - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, (connection->svc, OCI_HTYPE_SVCCTX, connection->server, 0, OCI_ATTR_SERVER, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, (connection->svc, OCI_HTYPE_SVCCTX, connection->server, 0, OCI_ATTR_SERVER, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3144,7 +3166,7 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna /* }}} */ /* {{{ Set the authentication handle in the service handle */ - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, (connection->svc, OCI_HTYPE_SVCCTX, connection->session, 0, OCI_ATTR_SESSION, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, (connection->svc, OCI_HTYPE_SVCCTX, connection->session, 0, OCI_ATTR_SESSION, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3154,14 +3176,14 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna if (new_password) { /* {{{ Try to change password if new one was provided */ - PHP_OCI_CALL_RETURN(OCIPASSWORDCHANGE, OCI_G(errcode), OCIPasswordChange, (connection->svc, OCI_G(err), (text *)username, username_len, (text *)password, password_len, (text *)new_password, new_password_len, OCI_AUTH)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIPasswordChange, (connection->svc, OCI_G(err), (text *)username, username_len, (text *)password, password_len, (text *)new_password, new_password_len, OCI_AUTH)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); return 1; } - PHP_OCI_CALL_RETURN(OCIATTRGET, OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->svc, OCI_HTYPE_SVCCTX, (dvoid *)&(connection->session), (ub4 *)0, OCI_ATTR_SESSION, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->svc, OCI_HTYPE_SVCCTX, (dvoid *)&(connection->session), (ub4 *)0, OCI_ATTR_SESSION, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3180,7 +3202,7 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna session_mode |= OCI_STMT_CACHE; - PHP_OCI_CALL_RETURN(OCISESSIONBEGIN, OCI_G(errcode), OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) cred_type, (ub4) session_mode)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) cred_type, (ub4) session_mode)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3200,7 +3222,7 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna return 1; } - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX, (ub4 *) &statement_cache_size, 0, (ub4) OCI_ATTR_STMTCACHESIZE, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX, (ub4 *) &statement_cache_size, 0, (ub4) OCI_ATTR_STMTCACHESIZE, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3241,18 +3263,18 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool connection->using_spool = 1; } -#ifdef HAVE_DTRACE +#ifdef HAVE_OCI8_DTRACE if (DTRACE_OCI8_SESSPOOL_TYPE_ENABLED()) { DTRACE_OCI8_SESSPOOL_TYPE(session_pool ? 1 : 0, session_pool ? session_pool : connection->private_spool); } -#endif /* HAVE_DTRACE */ +#endif /* HAVE_OCI8_DTRACE */ /* The passed in "connection" can be a cached stub from plist or freshly created. In the former * case, we do not have to allocate any handles */ if (!connection->err) { - PHP_OCI_CALL_RETURN(OCIHANDLEALLOC, OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->err), OCI_HTYPE_ERROR, 0, NULL)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->err), OCI_HTYPE_ERROR, 0, NULL)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3262,7 +3284,7 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool /* {{{ Allocate and initialize the connection-private authinfo handle if not allocated yet */ if (!connection->authinfo) { - PHP_OCI_CALL_RETURN(OCIHANDLEALLOC, OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->authinfo), OCI_HTYPE_AUTHINFO, 0, NULL)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->authinfo), OCI_HTYPE_AUTHINFO, 0, NULL)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3271,7 +3293,7 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool /* Set the Connection class and purity if OCI client version >= 11g */ #if (OCI_MAJOR_VERSION > 10) - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode),OCIAttrSet, ((dvoid *) connection->authinfo,(ub4) OCI_HTYPE_SESSION, (dvoid *) OCI_G(connection_class), (ub4)(strlen(OCI_G(connection_class))), (ub4)OCI_ATTR_CONNECTION_CLASS, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->authinfo,(ub4) OCI_HTYPE_SESSION, (dvoid *) OCI_G(connection_class), (ub4)(strlen(OCI_G(connection_class))), (ub4)OCI_ATTR_CONNECTION_CLASS, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3283,7 +3305,7 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool else purity = OCI_ATTR_PURITY_NEW; - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode),OCIAttrSet, ((dvoid *) connection->authinfo,(ub4) OCI_HTYPE_AUTHINFO, (dvoid *) &purity, (ub4)0, (ub4)OCI_ATTR_PURITY, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode),OCIAttrSet, ((dvoid *) connection->authinfo,(ub4) OCI_HTYPE_AUTHINFO, (dvoid *) &purity, (ub4)0, (ub4)OCI_ATTR_PURITY, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3294,15 +3316,15 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool /* }}} */ /* {{{ Debug statements */ -#ifdef HAVE_DTRACE +#ifdef HAVE_OCI8_DTRACE if (DTRACE_OCI8_SESSPOOL_STATS_ENABLED()) { ub4 numfree = 0, numbusy = 0, numopen = 0; - PHP_OCI_CALL_RETURN(OCIATTRGET, OCI_G(errcode), OCIAttrGet, ((dvoid *)actual_spool->poolh, OCI_HTYPE_SPOOL, (dvoid *)&numopen, (ub4 *)0, OCI_ATTR_SPOOL_OPEN_COUNT, OCI_G(err))); - PHP_OCI_CALL_RETURN(OCIATTRGET, OCI_G(errcode), OCIAttrGet, ((dvoid *)actual_spool->poolh, OCI_HTYPE_SPOOL, (dvoid *)&numbusy, (ub4 *)0, OCI_ATTR_SPOOL_BUSY_COUNT, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrGet, ((dvoid *)actual_spool->poolh, OCI_HTYPE_SPOOL, (dvoid *)&numopen, (ub4 *)0, OCI_ATTR_SPOOL_OPEN_COUNT, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrGet, ((dvoid *)actual_spool->poolh, OCI_HTYPE_SPOOL, (dvoid *)&numbusy, (ub4 *)0, OCI_ATTR_SPOOL_BUSY_COUNT, OCI_G(err))); numfree = numopen - numbusy; /* number of free connections in the pool */ DTRACE_OCI8_SESSPOOL_STATS(numfree, numbusy, numopen); } -#endif /* HAVE_DTRACE */ +#endif /* HAVE_OCI8_DTRACE */ /* }}} */ /* Ping loop: Ping and loop till we get a good connection. When a database instance goes @@ -3313,7 +3335,7 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool */ do { /* Continue to use the global error handle as the connection is closed when an error occurs */ - PHP_OCI_CALL_RETURN(OCISESSIONGET, OCI_G(errcode),OCISessionGet, (connection->env, OCI_G(err), &(connection->svc), (OCIAuthInfo *)connection->authinfo, (OraText *)actual_spool->poolname, (ub4)actual_spool->poolname_len, NULL, 0, NULL, NULL, NULL, OCI_SESSGET_SPOOL)); + PHP_OCI_CALL_RETURN(OCI_G(errcode),OCISessionGet, (connection->env, OCI_G(err), &(connection->svc), (OCIAuthInfo *)connection->authinfo, (OraText *)actual_spool->poolname, (ub4)actual_spool->poolname_len, NULL, 0, NULL, NULL, NULL, OCI_SESSGET_SPOOL)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3328,12 +3350,12 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool } /* {{{ Populate the session and server fields of the connection */ - PHP_OCI_CALL_RETURN(OCIATTRGET, OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->svc, OCI_HTYPE_SVCCTX, (dvoid *)&(connection->server), (ub4 *)0, OCI_ATTR_SERVER, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->svc, OCI_HTYPE_SVCCTX, (dvoid *)&(connection->server), (ub4 *)0, OCI_ATTR_SERVER, OCI_G(err))); - PHP_OCI_CALL_RETURN(OCIATTRGET, OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->svc, OCI_HTYPE_SVCCTX, (dvoid *)&(connection->session), (ub4 *)0, OCI_ATTR_SESSION, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->svc, OCI_HTYPE_SVCCTX, (dvoid *)&(connection->session), (ub4 *)0, OCI_ATTR_SESSION, OCI_G(err))); /* }}} */ - PHP_OCI_CALL_RETURN(OCICONTEXTGETVALUE, OCI_G(errcode), OCIContextGetValue, (connection->session, OCI_G(err), (ub1 *)"NEXT_PING", (ub1)sizeof("NEXT_PING"), (void **)&(connection->next_pingp))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIContextGetValue, (connection->session, OCI_G(err), (ub1 *)"NEXT_PING", (ub1)sizeof("NEXT_PING"), (void **)&(connection->next_pingp))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); return 1; @@ -3351,7 +3373,7 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool *(connection->next_pingp) = timestamp + OCI_G(ping_interval); } else { /* Bad connection - remove from pool */ - PHP_OCI_CALL(OCISESSIONRELEASE, OCISessionRelease, (connection->svc, connection->err, NULL,0, (ub4) OCI_SESSRLS_DROPSESS)); + PHP_OCI_CALL(OCISessionRelease, (connection->svc, connection->err, NULL,0, (ub4) OCI_SESSRLS_DROPSESS)); connection->svc = NULL; connection->server = NULL; connection->session = NULL; @@ -3359,7 +3381,7 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool } /* If ping applicable */ } while (!(connection->svc)); - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX, (ub4 *) &statement_cache_size, 0, (ub4) OCI_ATTR_STMTCACHESIZE, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX, (ub4 *) &statement_cache_size, 0, (ub4) OCI_ATTR_STMTCACHESIZE, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3397,20 +3419,20 @@ static void php_oci_spool_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC) static void php_oci_spool_close(php_oci_spool *session_pool TSRMLS_DC) { if (session_pool->poolname_len) { - PHP_OCI_CALL(OCISESSIONPOOLDESTROY, OCISessionPoolDestroy, ((dvoid *) session_pool->poolh, + PHP_OCI_CALL(OCISessionPoolDestroy, ((dvoid *) session_pool->poolh, (dvoid *) session_pool->err, OCI_SPD_FORCE)); } if (session_pool->poolh) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) session_pool->poolh, OCI_HTYPE_SPOOL)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) session_pool->poolh, OCI_HTYPE_SPOOL)); } if (session_pool->err) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) session_pool->err, OCI_HTYPE_ERROR)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) session_pool->err, OCI_HTYPE_ERROR)); } if (session_pool->env) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) session_pool->env, OCI_HTYPE_ENV)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) session_pool->env, OCI_HTYPE_ENV)); } if (session_pool->spool_hash_key) { @@ -3431,14 +3453,14 @@ static sword php_oci_ping_init(php_oci_connection *connection, OCIError *errh TS { time_t *next_pingp = NULL; - PHP_OCI_CALL_RETURN(OCICONTEXTGETVALUE, OCI_G(errcode), OCIContextGetValue, (connection->session, errh, (ub1 *)"NEXT_PING", (ub1)sizeof("NEXT_PING"), (void **)&next_pingp)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIContextGetValue, (connection->session, errh, (ub1 *)"NEXT_PING", (ub1)sizeof("NEXT_PING"), (void **)&next_pingp)); if (OCI_G(errcode) != OCI_SUCCESS) { return OCI_G(errcode); } /* This must be a brand-new connection. Allocate memory for the ping */ if (!next_pingp) { - PHP_OCI_CALL_RETURN(OCIMEMORYALLOC, OCI_G(errcode), OCIMemoryAlloc, (connection->session, errh, (void **)&next_pingp, OCI_DURATION_SESSION, sizeof(time_t), OCI_MEMORY_CLEARED)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIMemoryAlloc, (connection->session, errh, (void **)&next_pingp, OCI_DURATION_SESSION, sizeof(time_t), OCI_MEMORY_CLEARED)); if (OCI_G(errcode) != OCI_SUCCESS) { return OCI_G(errcode); } @@ -3452,7 +3474,7 @@ static sword php_oci_ping_init(php_oci_connection *connection, OCIError *errh TS } /* Set the new ping value into the connection */ - PHP_OCI_CALL_RETURN(OCICONTEXTSETVALUE, OCI_G(errcode), OCIContextSetValue, (connection->session, errh, OCI_DURATION_SESSION, (ub1 *)"NEXT_PING", (ub1)sizeof("NEXT_PING"), next_pingp)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIContextSetValue, (connection->session, errh, OCI_DURATION_SESSION, (ub1 *)"NEXT_PING", (ub1)sizeof("NEXT_PING"), next_pingp)); if (OCI_G(errcode) != OCI_SUCCESS) { OCIMemoryFree(connection->session, errh, next_pingp); return OCI_G(errcode); @@ -3465,6 +3487,20 @@ static sword php_oci_ping_init(php_oci_connection *connection, OCIError *errh TS } /* }}} */ +/* {{{ php_oci_dtrace_check_connection() + * + * DTrace output for connections that may have become invalid and marked for reopening + */ +void php_oci_dtrace_check_connection(php_oci_connection *connection, sb4 errcode, ub4 serverStatus) +{ +#ifdef HAVE_OCI8_DTRACE + if (DTRACE_OCI8_CHECK_CONNECTION_ENABLED()) { + DTRACE_OCI8_CHECK_CONNECTION(connection, connection->client_id, connection->is_open ? 1 : 0, (long)errcode, (unsigned long)serverStatus); + } +#endif /* HAVE_OCI8_DTRACE */ +} +/* }}} */ + #endif /* HAVE_OCI8 */ /* diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c index 27430e8823801..35b70fa7af73f 100644 --- a/ext/oci8/oci8_collection.c +++ b/ext/oci8/oci8_collection.c @@ -44,12 +44,13 @@ /* {{{ php_oci_collection_create() Create and return connection handle */ -php_oci_collection * php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC) +php_oci_collection *php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC) { dvoid *dschp1 = NULL; dvoid *parmp1; dvoid *parmp2; php_oci_collection *collection; + sword errstatus; collection = emalloc(sizeof(php_oci_collection)); @@ -58,7 +59,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c zend_list_addref(collection->connection->id); /* get type handle by name */ - PHP_OCI_CALL_RETURN(OCITYPEBYNAME, connection->errcode, OCITypeByName, + PHP_OCI_CALL_RETURN(errstatus, OCITypeByName, ( connection->env, connection->err, @@ -75,19 +76,19 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c ) ); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { goto CLEANUP; } /* allocate describe handle */ - PHP_OCI_CALL_RETURN(OCIHANDLEALLOC, connection->errcode, OCIHandleAlloc, (connection->env, (dvoid **) &dschp1, (ub4) OCI_HTYPE_DESCRIBE, (size_t) 0, (dvoid **) 0)); + PHP_OCI_CALL_RETURN(errstatus, OCIHandleAlloc, (connection->env, (dvoid **) &dschp1, (ub4) OCI_HTYPE_DESCRIBE, (size_t) 0, (dvoid **) 0)); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { goto CLEANUP; } /* describe TDO */ - PHP_OCI_CALL_RETURN(OCIDESCRIBEANY, connection->errcode, OCIDescribeAny, + PHP_OCI_CALL_RETURN(errstatus, OCIDescribeAny, ( connection->svc, connection->err, @@ -100,19 +101,19 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c ) ); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { goto CLEANUP; } /* get first parameter handle */ - PHP_OCI_CALL_RETURN(OCIATTRGET, connection->errcode, OCIAttrGet, ((dvoid *) dschp1, (ub4) OCI_HTYPE_DESCRIBE, (dvoid *)&parmp1, (ub4 *)0, (ub4)OCI_ATTR_PARAM, connection->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *) dschp1, (ub4) OCI_HTYPE_DESCRIBE, (dvoid *)&parmp1, (ub4 *)0, (ub4)OCI_ATTR_PARAM, connection->err)); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { goto CLEANUP; } /* get the collection type code of the attribute */ - PHP_OCI_CALL_RETURN(OCIATTRGET, connection->errcode, OCIAttrGet, + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ( (dvoid*) parmp1, (ub4) OCI_DTYPE_PARAM, @@ -123,7 +124,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c ) ); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { goto CLEANUP; } @@ -131,7 +132,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c case OCI_TYPECODE_TABLE: case OCI_TYPECODE_VARRAY: /* get collection element handle */ - PHP_OCI_CALL_RETURN(OCIATTRGET, connection->errcode, OCIAttrGet, + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ( (dvoid*) parmp1, (ub4) OCI_DTYPE_PARAM, @@ -142,12 +143,12 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c ) ); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { goto CLEANUP; } /* get REF of the TDO for the type */ - PHP_OCI_CALL_RETURN(OCIATTRGET, connection->errcode, OCIAttrGet, + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ( (dvoid*) parmp2, (ub4) OCI_DTYPE_PARAM, @@ -158,12 +159,12 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c ) ); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { goto CLEANUP; } /* get the TDO (only header) */ - PHP_OCI_CALL_RETURN(OCITYPEBYREF, connection->errcode, OCITypeByRef, + PHP_OCI_CALL_RETURN(errstatus, OCITypeByRef, ( connection->env, connection->err, @@ -174,12 +175,12 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c ) ); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { goto CLEANUP; } /* get typecode */ - PHP_OCI_CALL_RETURN(OCIATTRGET, connection->errcode, OCIAttrGet, + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ( (dvoid*) parmp2, (ub4) OCI_DTYPE_PARAM, @@ -190,7 +191,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c ) ); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { goto CLEANUP; } break; @@ -201,7 +202,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c } /* Create object to hold return table */ - PHP_OCI_CALL_RETURN(OCIOBJECTNEW, connection->errcode, OCIObjectNew, + PHP_OCI_CALL_RETURN(errstatus, OCIObjectNew, ( connection->env, connection->err, @@ -215,22 +216,23 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c ) ); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { goto CLEANUP; } /* free the describe handle (Bug #44113) */ - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE)); PHP_OCI_REGISTER_RESOURCE(collection, le_collection); + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return collection; CLEANUP: if (dschp1) { /* free the describe handle (Bug #44113) */ - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE)); } - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); php_oci_collection_close(collection TSRMLS_CC); return NULL; @@ -242,14 +244,16 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c int php_oci_collection_size(php_oci_collection *collection, sb4 *size TSRMLS_DC) { php_oci_connection *connection = collection->connection; + sword errstatus; - PHP_OCI_CALL_RETURN(OCICOLLSIZE, connection->errcode, OCICollSize, (connection->env, connection->err, collection->collection, (sb4 *)size)); + PHP_OCI_CALL_RETURN(errstatus, OCICollSize, (connection->env, connection->err, collection->collection, (sb4 *)size)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -260,7 +264,7 @@ int php_oci_collection_max(php_oci_collection *collection, long *max TSRMLS_DC) { php_oci_connection *connection = collection->connection; - PHP_OCI_CALL_RETURN(OCICOLLMAX, *max, OCICollMax, (connection->env, collection->collection)); + PHP_OCI_CALL_RETURN(*max, OCICollMax, (connection->env, collection->collection)); /* error handling is not necessary here? */ return 0; @@ -272,14 +276,16 @@ int php_oci_collection_max(php_oci_collection *collection, long *max TSRMLS_DC) int php_oci_collection_trim(php_oci_collection *collection, long trim_size TSRMLS_DC) { php_oci_connection *connection = collection->connection; - - PHP_OCI_CALL_RETURN(OCICOLLTRIM, connection->errcode, OCICollTrim, (connection->env, connection->err, trim_size, collection->collection)); + sword errstatus; + + PHP_OCI_CALL_RETURN(errstatus, OCICollTrim, (connection->env, connection->err, trim_size, collection->collection)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + errstatus = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -290,15 +296,17 @@ int php_oci_collection_append_null(php_oci_collection *collection TSRMLS_DC) { OCIInd null_index = OCI_IND_NULL; php_oci_connection *connection = collection->connection; + sword errstatus; /* append NULL element */ - PHP_OCI_CALL_RETURN(OCICOLLAPPEND, connection->errcode, OCICollAppend, (connection->env, connection->err, (dvoid *)0, &null_index, collection->collection)); + PHP_OCI_CALL_RETURN(errstatus, OCICollAppend, (connection->env, connection->err, (dvoid *)0, &null_index, collection->collection)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + errstatus = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -310,18 +318,19 @@ int php_oci_collection_append_date(php_oci_collection *collection, char *date, i OCIInd new_index = OCI_IND_NOTNULL; OCIDate oci_date; php_oci_connection *connection = collection->connection; + sword errstatus; /* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */ - PHP_OCI_CALL_RETURN(OCIDATEFROMTEXT, connection->errcode, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date)); + PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date)); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { /* failed to convert string to date */ - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - PHP_OCI_CALL_RETURN(OCICOLLAPPEND, connection->errcode, OCICollAppend, + PHP_OCI_CALL_RETURN(errstatus, OCICollAppend, ( connection->env, connection->err, @@ -331,12 +340,13 @@ int php_oci_collection_append_date(php_oci_collection *collection, char *date, i ) ); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -349,24 +359,19 @@ int php_oci_collection_append_number(php_oci_collection *collection, char *numbe double element_double; OCINumber oci_number; php_oci_connection *connection = collection->connection; + sword errstatus; -#if (PHP_MAJOR_VERSION == 4 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION < 10) - /* minimum PHP version ext/oci8/config.m4 accepts is 4.3.9 */ - element_double = strtod(number, NULL); -#else - /* zend_strtod was introduced in PHP 4.3.10 */ element_double = zend_strtod(number, NULL); -#endif - PHP_OCI_CALL_RETURN(OCINUMBERFROMREAL, connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number)); + PHP_OCI_CALL_RETURN(errstatus, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - PHP_OCI_CALL_RETURN(OCICOLLAPPEND, connection->errcode, OCICollAppend, + PHP_OCI_CALL_RETURN(errstatus, OCICollAppend, ( connection->env, connection->err, @@ -376,12 +381,13 @@ int php_oci_collection_append_number(php_oci_collection *collection, char *numbe ) ); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -393,16 +399,17 @@ int php_oci_collection_append_string(php_oci_collection *collection, char *eleme OCIInd new_index = OCI_IND_NOTNULL; OCIString *ocistr = (OCIString *)0; php_oci_connection *connection = collection->connection; + sword errstatus; - PHP_OCI_CALL_RETURN(OCISTRINGASSIGNTEXT, connection->errcode, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr)); + PHP_OCI_CALL_RETURN(errstatus, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - PHP_OCI_CALL_RETURN(OCICOLLAPPEND, connection->errcode, OCICollAppend, + PHP_OCI_CALL_RETURN(errstatus, OCICollAppend, ( connection->env, connection->err, @@ -412,12 +419,13 @@ int php_oci_collection_append_string(php_oci_collection *collection, char *eleme ) ); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -473,11 +481,14 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z boolean exists; oratext buff[1024]; ub4 buff_len = 1024; + sword errstatus; MAKE_STD_ZVAL(*result_element); ZVAL_NULL(*result_element); - PHP_OCI_CALL_RETURN(OCICOLLGETELEM, connection->errcode, OCICollGetElem, + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ + + PHP_OCI_CALL_RETURN(errstatus, OCICollGetElem, ( connection->env, connection->err, @@ -489,8 +500,8 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z ) ); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); FREE_ZVAL(*result_element); return 1; @@ -509,10 +520,10 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z switch (collection->element_typecode) { case OCI_TYPECODE_DATE: - PHP_OCI_CALL_RETURN(OCIDATETOTEXT, connection->errcode, OCIDateToText, (connection->err, element, 0, 0, 0, 0, &buff_len, buff)); + PHP_OCI_CALL_RETURN(errstatus, OCIDateToText, (connection->err, element, 0, 0, 0, 0, &buff_len, buff)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); FREE_ZVAL(*result_element); return 1; @@ -529,7 +540,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z OCIString *oci_string = *(OCIString **)element; text *str; - PHP_OCI_CALL_RETURN(OCISTRINGPTR, str, OCIStringPtr, (connection->env, oci_string)); + PHP_OCI_CALL_RETURN(str, OCIStringPtr, (connection->env, oci_string)); if (str) { ZVAL_STRING(*result_element, (char *)str, 1); @@ -552,10 +563,10 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z { double double_number; - PHP_OCI_CALL_RETURN(OCINUMBERTOREAL, connection->errcode, OCINumberToReal, (connection->err, (CONST OCINumber *) element, (uword) sizeof(double), (dvoid *) &double_number)); + PHP_OCI_CALL_RETURN(errstatus, OCINumberToReal, (connection->err, (CONST OCINumber *) element, (uword) sizeof(double), (dvoid *) &double_number)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); FREE_ZVAL(*result_element); return 1; @@ -583,15 +594,17 @@ int php_oci_collection_element_set_null(php_oci_collection *collection, long ind { OCIInd null_index = OCI_IND_NULL; php_oci_connection *connection = collection->connection; + sword errstatus; /* set NULL element */ - PHP_OCI_CALL_RETURN(OCICOLLASSIGNELEM, connection->errcode, OCICollAssignElem, (connection->env, connection->err, (ub4) index, (dvoid *)"", &null_index, collection->collection)); + PHP_OCI_CALL_RETURN(errstatus, OCICollAssignElem, (connection->env, connection->err, (ub4) index, (dvoid *)"", &null_index, collection->collection)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -603,18 +616,19 @@ int php_oci_collection_element_set_date(php_oci_collection *collection, long ind OCIInd new_index = OCI_IND_NOTNULL; OCIDate oci_date; php_oci_connection *connection = collection->connection; + sword errstatus; /* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */ - PHP_OCI_CALL_RETURN(OCIDATEFROMTEXT, connection->errcode, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date)); + PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date)); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { /* failed to convert string to date */ - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - PHP_OCI_CALL_RETURN(OCICOLLASSIGNELEM, connection->errcode, OCICollAssignElem, + PHP_OCI_CALL_RETURN(errstatus, OCICollAssignElem, ( connection->env, connection->err, @@ -625,12 +639,13 @@ int php_oci_collection_element_set_date(php_oci_collection *collection, long ind ) ); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -643,24 +658,19 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, long i double element_double; OCINumber oci_number; php_oci_connection *connection = collection->connection; + sword errstatus; -#if (PHP_MAJOR_VERSION == 4 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION < 10) - /* minimum PHP version ext/oci8/config.m4 accepts is 4.3.9 */ - element_double = strtod(number, NULL); -#else - /* zend_strtod was introduced in PHP 4.3.10 */ element_double = zend_strtod(number, NULL); -#endif - PHP_OCI_CALL_RETURN(OCINUMBERFROMREAL, connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number)); + PHP_OCI_CALL_RETURN(errstatus, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - PHP_OCI_CALL_RETURN(OCICOLLASSIGNELEM, connection->errcode, OCICollAssignElem, + PHP_OCI_CALL_RETURN(errstatus, OCICollAssignElem, ( connection->env, connection->err, @@ -671,12 +681,13 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, long i ) ); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -688,16 +699,17 @@ int php_oci_collection_element_set_string(php_oci_collection *collection, long i OCIInd new_index = OCI_IND_NOTNULL; OCIString *ocistr = (OCIString *)0; php_oci_connection *connection = collection->connection; + sword errstatus; - PHP_OCI_CALL_RETURN(OCISTRINGASSIGNTEXT, connection->errcode, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr)); + PHP_OCI_CALL_RETURN(errstatus, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - PHP_OCI_CALL_RETURN(OCICOLLASSIGNELEM, connection->errcode, OCICollAssignElem, + PHP_OCI_CALL_RETURN(errstatus, OCICollAssignElem, ( connection->env, connection->err, @@ -708,12 +720,13 @@ int php_oci_collection_element_set_string(php_oci_collection *collection, long i ) ); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -764,14 +777,16 @@ int php_oci_collection_element_set(php_oci_collection *collection, long index, c int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_collection *collection_from TSRMLS_DC) { php_oci_connection *connection = collection_dest->connection; + sword errstatus; - PHP_OCI_CALL_RETURN(OCICOLLASSIGN, connection->errcode, OCICollAssign, (connection->env, connection->err, collection_from->collection, collection_dest->collection)); + PHP_OCI_CALL_RETURN(errstatus, OCICollAssign, (connection->env, connection->err, collection_from->collection, collection_dest->collection)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -781,18 +796,20 @@ int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_colle void php_oci_collection_close(php_oci_collection *collection TSRMLS_DC) { php_oci_connection *connection = collection->connection; + sword errstatus; if (collection->collection) { - PHP_OCI_CALL_RETURN(OCIOBJECTFREE, connection->errcode, OCIObjectFree, (connection->env, connection->err, (dvoid *)collection->collection, (ub2)OCI_OBJECTFREE_FORCE)); + PHP_OCI_CALL_RETURN(errstatus, OCIObjectFree, (connection->env, connection->err, (dvoid *)collection->collection, (ub2)OCI_OBJECTFREE_FORCE)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); + } else { + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ } } zend_list_delete(collection->connection->id); - efree(collection); return; } diff --git a/ext/oci8/oci8_dtrace.d b/ext/oci8/oci8_dtrace.d index 61f42ae17c85e..30c98de912828 100644 --- a/ext/oci8/oci8_dtrace.d +++ b/ext/oci8/oci8_dtrace.d @@ -16,180 +16,21 @@ +----------------------------------------------------------------------+ */ -provider php { - probe oci8__connect_start(char *username, char *dbname, char *charset, long session_mode, int persistent, int exclusive); - probe oci8__connect_done(); - probe oci8__sqltext(char *sql); +provider phpoci { + probe oci8__check__connection(void *connection, char *client_id, int is_open, long errcode, unsigned long server_status); + probe oci8__connect__entry(char *username, char *dbname, char *charset, long session_mode, int persistent, int exclusive); + probe oci8__connect__return(void *connection); + probe oci8__connection__close(void *connection); probe oci8__error(int status, long errcode); - probe oci8__execute_mode(unsigned int mode); + probe oci8__execute__mode(void *connection, char *client_id, void *statement, unsigned int mode); + probe oci8__sqltext(void *connection, char *client_id, void *statement, char *sql); - probe oci8__connect_p_dtor_close(void *connection); - probe oci8__connect_p_dtor_release(void *connection); - probe oci8__connect_lookup(void *connection, int is_stub); - probe oci8__connect_expiry(void *connection, int is_stub, time_t idle_expiry, time_t timestamp); - probe oci8__connect_type(int is_persistent, int exclusive, void *connection, long num_persistent, long num_links); - probe oci8__sesspool_create(void *session_pool); - probe oci8__sesspool_stats(unsigned long free, unsigned long busy, unsigned long open); - probe oci8__sesspool_type(int type, void *session_pool); - - probe oci8__ociattrget_start(); - probe oci8__ociattrget_done(); - probe oci8__ociattrset_start(); - probe oci8__ociattrset_done(); - probe oci8__ocibindbyname_start(); - probe oci8__ocibindbyname_done(); - probe oci8__ocibinddynamic_start(); - probe oci8__ocibinddynamic_done(); - probe oci8__ocibindobject_start(); - probe oci8__ocibindobject_done(); - probe oci8__ociclientversion_start(); - probe oci8__ociclientversion_done(); - probe oci8__ocicollappend_start(); - probe oci8__ocicollappend_done(); - probe oci8__ocicollassign_start(); - probe oci8__ocicollassign_done(); - probe oci8__ocicollassignelem_start(); - probe oci8__ocicollassignelem_done(); - probe oci8__ocicollgetelem_start(); - probe oci8__ocicollgetelem_done(); - probe oci8__ocicollmax_start(); - probe oci8__ocicollmax_done(); - probe oci8__ocicollsize_start(); - probe oci8__ocicollsize_done(); - probe oci8__ocicolltrim_start(); - probe oci8__ocicolltrim_done(); - probe oci8__ocicontextgetvalue_start(); - probe oci8__ocicontextgetvalue_done(); - probe oci8__ocicontextsetvalue_start(); - probe oci8__ocicontextsetvalue_done(); - probe oci8__ocidatefromtext_start(); - probe oci8__ocidatefromtext_done(); - probe oci8__ocidatetotext_start(); - probe oci8__ocidatetotext_done(); - probe oci8__ocidefinebypos_start(); - probe oci8__ocidefinebypos_done(); - probe oci8__ocidefinedynamic_start(); - probe oci8__ocidefinedynamic_done(); - probe oci8__ocidescribeany_start(); - probe oci8__ocidescribeany_done(); - probe oci8__ocidescriptoralloc_start(); - probe oci8__ocidescriptoralloc_done(); - probe oci8__ocidescriptorfree_start(); - probe oci8__ocidescriptorfree_done(); - probe oci8__ocienvnlscreate_start(); - probe oci8__ocienvnlscreate_done(); - probe oci8__ocierrorget_start(); - probe oci8__ocierrorget_done(); - probe oci8__ocihandlealloc_start(); - probe oci8__ocihandlealloc_done(); - probe oci8__ocihandlefree_start(); - probe oci8__ocihandlefree_done(); - probe oci8__ocilobappend_start(); - probe oci8__ocilobappend_done(); - probe oci8__ocilobcharsetid_start(); - probe oci8__ocilobcharsetid_done(); - probe oci8__ocilobclose_start(); - probe oci8__ocilobclose_done(); - probe oci8__ocilobcopy_start(); - probe oci8__ocilobcopy_done(); - probe oci8__ocilobcreatetemporary_start(); - probe oci8__ocilobcreatetemporary_done(); - probe oci8__ocilobdisablebuffering_start(); - probe oci8__ocilobdisablebuffering_done(); - probe oci8__ocilobenablebuffering_start(); - probe oci8__ocilobenablebuffering_done(); - probe oci8__ociloberase_start(); - probe oci8__ociloberase_done(); - probe oci8__ocilobfileclose_start(); - probe oci8__ocilobfileclose_done(); - probe oci8__ocilobfileopen_start(); - probe oci8__ocilobfileopen_done(); - probe oci8__ocilobflushbuffer_start(); - probe oci8__ocilobflushbuffer_done(); - probe oci8__ocilobfreetemporary_start(); - probe oci8__ocilobfreetemporary_done(); - probe oci8__ocilobgetchunksize_start(); - probe oci8__ocilobgetchunksize_done(); - probe oci8__ocilobgetlength_start(); - probe oci8__ocilobgetlength_done(); - probe oci8__ocilobisequal_start(); - probe oci8__ocilobisequal_done(); - probe oci8__ocilobistemporary_start(); - probe oci8__ocilobistemporary_done(); - probe oci8__ocilobopen_start(); - probe oci8__ocilobopen_done(); - probe oci8__ocilobread2_start(); - probe oci8__ocilobread2_done(); - probe oci8__ocilobtrim_start(); - probe oci8__ocilobtrim_done(); - probe oci8__ocilobwrite_start(); - probe oci8__ocilobwrite_done(); - probe oci8__ocimemoryalloc_start(); - probe oci8__ocimemoryalloc_done(); - probe oci8__ocimemoryfree_start(); - probe oci8__ocimemoryfree_done(); - probe oci8__ocinlscharsetnametoid_start(); - probe oci8__ocinlscharsetnametoid_done(); - probe oci8__ocinlsenvironmentvariableget_start(); - probe oci8__ocinlsenvironmentvariableget_done(); - probe oci8__ocinlsnumericinfoget_start(); - probe oci8__ocinlsnumericinfoget_done(); - probe oci8__ocinumberfromreal_start(); - probe oci8__ocinumberfromreal_done(); - probe oci8__ocinumbertoreal_start(); - probe oci8__ocinumbertoreal_done(); - probe oci8__ociobjectfree_start(); - probe oci8__ociobjectfree_done(); - probe oci8__ociobjectnew_start(); - probe oci8__ociobjectnew_done(); - probe oci8__ociparamget_start(); - probe oci8__ociparamget_done(); - probe oci8__ocipasswordchange_start(); - probe oci8__ocipasswordchange_done(); - probe oci8__ociping_start(); - probe oci8__ociping_done(); - probe oci8__ociserverattach_start(); - probe oci8__ociserverattach_done(); - probe oci8__ociserverdetach_start(); - probe oci8__ociserverdetach_done(); - probe oci8__ociserverversion_start(); - probe oci8__ociserverversion_done(); - probe oci8__ocisessionbegin_start(); - probe oci8__ocisessionbegin_done(); - probe oci8__ocisessionend_start(); - probe oci8__ocisessionend_done(); - probe oci8__ocisessionget_start(); - probe oci8__ocisessionget_done(); - probe oci8__ocisessionpoolcreate_start(); - probe oci8__ocisessionpoolcreate_done(); - probe oci8__ocisessionpooldestroy_start(); - probe oci8__ocisessionpooldestroy_done(); - probe oci8__ocisessionrelease_start(); - probe oci8__ocisessionrelease_done(); - probe oci8__ocistmtexecute_start(); - probe oci8__ocistmtexecute_done(); - probe oci8__ocistmtfetch_start(); - probe oci8__ocistmtfetch_done(); - probe oci8__ocistmtgetnextresult_start(); - probe oci8__ocistmtgetnextresult_done(); - probe oci8__ocistmtgetpieceinfo_start(); - probe oci8__ocistmtgetpieceinfo_done(); - probe oci8__ocistmtprepare2_start(); - probe oci8__ocistmtprepare2_done(); - probe oci8__ocistmtrelease_start(); - probe oci8__ocistmtrelease_done(); - probe oci8__ocistmtsetpieceinfo_start(); - probe oci8__ocistmtsetpieceinfo_done(); - probe oci8__ocistringassigntext_start(); - probe oci8__ocistringassigntext_done(); - probe oci8__ocistringptr_start(); - probe oci8__ocistringptr_done(); - probe oci8__ocitranscommit_start(); - probe oci8__ocitranscommit_done(); - probe oci8__ocitransrollback_start(); - probe oci8__ocitransrollback_done(); - probe oci8__ocitypebyname_start(); - probe oci8__ocitypebyname_done(); - probe oci8__ocitypebyref_start(); - probe oci8__ocitypebyref_done(); + probe oci8__connect__p__dtor__close(void *connection); + probe oci8__connect__p__dtor__release(void *connection); + probe oci8__connect__lookup(void *connection, int is_stub); + probe oci8__connect__expiry(void *connection, int is_stub, long idle_expiry, long timestamp); + probe oci8__connect__type(int persistent, int exclusive, void *connection, long num_persistent, long num_connections); + probe oci8__sesspool__create(void *session_pool); + probe oci8__sesspool__stats(unsigned long free, unsigned long busy, unsigned long open); + probe oci8__sesspool__type(int type, void *session_pool); }; diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index 70ec4b5093cfd..ccaed797429f1 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -1308,12 +1308,7 @@ PHP_FUNCTION(oci_field_is_null) Toggle internal debugging output for the OCI extension */ PHP_FUNCTION(oci_internal_debug) { - zend_bool on_off; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &on_off) == FAILURE) { - return; - } - OCI_G(debug_mode) = on_off; + /* NOP in OCI8 2.0. Obsoleted by DTrace probes */ } /* }}} */ @@ -1434,13 +1429,7 @@ PHP_FUNCTION(oci_fetch_all) if (flags & PHP_OCI_NUM) { zend_hash_next_index_insert(Z_ARRVAL_P(row), &element, sizeof(zval*), NULL); } else { /* default to ASSOC */ -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5) - /* zend_symtable_update is only available in 5.2+ */ zend_symtable_update(Z_ARRVAL_P(row), columns[ i ]->name, columns[ i ]->name_len+1, &element, sizeof(zval*), NULL); -#else - /* This code path means Bug #45458 will remain broken when OCI8 is built with PHP 4 */ - zend_hash_update(Z_ARRVAL_P(row), columns[ i ]->name, columns[ i ]->name_len+1, &element, sizeof(zval*), NULL); -#endif } } @@ -1472,13 +1461,7 @@ PHP_FUNCTION(oci_fetch_all) MAKE_STD_ZVAL(tmp); array_init(tmp); -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5) - /* zend_symtable_update is only available in 5.2+ */ zend_symtable_update(Z_ARRVAL_P(array), columns[ i ]->name, columns[ i ]->name_len+1, (void *) &tmp, sizeof(zval*), (void **) &(outarrs[ i ])); -#else - /* This code path means Bug #45458 will remain broken when OCI8 is built with PHP 4 */ - zend_hash_update(Z_ARRVAL_P(array), columns[ i ]->name, columns[ i ]->name_len+1, (void *) &tmp, sizeof(zval*), (void **) &(outarrs[ i ])); -#endif } } @@ -1624,7 +1607,6 @@ PHP_FUNCTION(oci_error) php_oci_connection *connection; text *errbuf; sb4 errcode = 0; - sword error = OCI_SUCCESS; dvoid *errh = NULL; ub2 error_offset = 0; text *sqltext = NULL; @@ -1635,10 +1617,9 @@ PHP_FUNCTION(oci_error) if (ZEND_NUM_ARGS() > 0) { statement = (php_oci_statement *) zend_fetch_resource(&arg TSRMLS_CC, -1, NULL, NULL, 1, le_statement); - if (statement) { errh = statement->err; - error = statement->errcode; + errcode = statement->errcode; if (php_oci_fetch_sqltext_offset(statement, &sqltext, &error_offset TSRMLS_CC)) { RETURN_FALSE; @@ -1649,23 +1630,23 @@ PHP_FUNCTION(oci_error) connection = (php_oci_connection *) zend_fetch_resource(&arg TSRMLS_CC, -1, NULL, NULL, 1, le_connection); if (connection) { errh = connection->err; - error = connection->errcode; + errcode = connection->errcode; goto go_out; } connection = (php_oci_connection *) zend_fetch_resource(&arg TSRMLS_CC, -1, NULL, NULL, 1, le_pconnection); if (connection) { errh = connection->err; - error = connection->errcode; + errcode = connection->errcode; goto go_out; } } else { errh = OCI_G(err); - error = OCI_G(errcode); + errcode = OCI_G(errcode); } go_out: - if (error == OCI_SUCCESS) { /* no error set in the handle */ + if (errcode == 0) { /* no error set in the handle */ RETURN_FALSE; } @@ -1764,6 +1745,7 @@ PHP_FUNCTION(oci_set_client_identifier) php_oci_connection *connection; char *client_id; int client_id_len; + sword errstatus; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &client_id, &client_id_len) == FAILURE) { return; @@ -1771,13 +1753,37 @@ PHP_FUNCTION(oci_set_client_identifier) PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) client_id, (ub4) client_id_len, (ub4) OCI_ATTR_CLIENT_IDENTIFIER, OCI_G(err))); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) client_id, (ub4) client_id_len, (ub4) OCI_ATTR_CLIENT_IDENTIFIER, connection->err)); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); RETURN_FALSE; } +#ifdef HAVE_OCI8_DTRACE + /* The alternatives to storing client_id like done below are + i) display it in a probe here in oci_set_client_identifier and + let the user D script correlate the connection address probe + argument and the client_id. This would likely require user D + script variables, which would use kernel memory. + ii) call OCIAttrGet for each probe definition that uses + client_id. This would be slower than storing it. + */ + + if (connection->client_id) { + pefree(connection->client_id, connection->is_persistent); + } + + if (client_id) { + /* this long winded copy allows compatibility with older PHP versions */ + connection->client_id = (char *)pemalloc(client_id_len+1, connection->is_persistent); + memcpy(connection->client_id, client_id, client_id_len); + connection->client_id[client_id_len] = '\0'; + } else { + connection->client_id = NULL; + } +#endif /* HAVE_OCI8_DTRACE */ + RETURN_TRUE; } /* }}} */ @@ -1796,13 +1802,14 @@ PHP_FUNCTION(oci_set_edition) if (OCI_G(edition)) { efree(OCI_G(edition)); - OCI_G(edition) = NULL; } if (edition) { - OCI_G(edition) = (char *)safe_emalloc(edition_len+1, sizeof(text), 0); + OCI_G(edition) = (char *)safe_emalloc(edition_len+1, sizeof(char), 0); memcpy(OCI_G(edition), edition, edition_len); OCI_G(edition)[edition_len] = '\0'; + } else { + OCI_G(edition) = NULL; } RETURN_TRUE; @@ -1822,6 +1829,7 @@ PHP_FUNCTION(oci_set_module_name) php_oci_connection *connection; char *module; int module_len; + sword errstatus; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &module, &module_len) == FAILURE) { return; @@ -1829,10 +1837,10 @@ PHP_FUNCTION(oci_set_module_name) PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) module, (ub4) module_len, (ub4) OCI_ATTR_MODULE, OCI_G(err))); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) module, (ub4) module_len, (ub4) OCI_ATTR_MODULE, connection->err)); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); RETURN_FALSE; } @@ -1853,6 +1861,7 @@ PHP_FUNCTION(oci_set_action) php_oci_connection *connection; char *action; int action_len; + sword errstatus; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &action, &action_len) == FAILURE) { return; @@ -1860,10 +1869,10 @@ PHP_FUNCTION(oci_set_action) PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) action, (ub4) action_len, (ub4) OCI_ATTR_ACTION, OCI_G(err))); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) action, (ub4) action_len, (ub4) OCI_ATTR_ACTION, connection->err)); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); RETURN_FALSE; } @@ -1884,6 +1893,7 @@ PHP_FUNCTION(oci_set_client_info) php_oci_connection *connection; char *client_info; int client_info_len; + sword errstatus; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &client_info, &client_info_len) == FAILURE) { return; @@ -1891,13 +1901,44 @@ PHP_FUNCTION(oci_set_client_info) PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) client_info, (ub4) client_info_len, (ub4) OCI_ATTR_CLIENT_INFO, OCI_G(err))); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) client_info, (ub4) client_info_len, (ub4) OCI_ATTR_CLIENT_INFO, connection->err)); + + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); + RETURN_FALSE; + } + + RETURN_TRUE; +#else + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unsupported attribute type"); + RETURN_FALSE; +#endif +} +/* }}} */ + +#ifdef WAITIING_ORACLE_BUG_16695981_FIX +/* {{{ proto bool oci_set_db_operation(resource connection, string value) + Sets the "DB operation" on the connection for Oracle end-to-end tracing */ +PHP_FUNCTION(oci_set_db_operation) +{ +#if (OCI_MAJOR_VERSION > 11) + zval *z_connection; + php_oci_connection *connection; + char *dbop_name; + int dbop_name_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &dbop_name, &dbop_name_len) == FAILURE) { + return; + } + + PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); + + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) dbop_name, (ub4) dbop_name_len, (ub4) OCI_ATTR_DBOP, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); RETURN_FALSE; } - RETURN_TRUE; #else php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unsupported attribute type"); @@ -1905,6 +1946,7 @@ PHP_FUNCTION(oci_set_client_info) #endif } /* }}} */ +#endif /* WAITIING_ORACLE_BUG_16695981_FIX */ /* {{{ proto bool oci_password_change(resource connection, string username, string old_password, string new_password) Changes the password of an account */ diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c index bd5b7065f431e..4f58c65737f97 100644 --- a/ext/oci8/oci8_lob.c +++ b/ext/oci8/oci8_lob.c @@ -54,6 +54,7 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long type TSRMLS_DC) { php_oci_descriptor *descriptor; + sword errstatus; switch (type) { case OCI_DTYPE_FILE: @@ -72,13 +73,15 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long typ descriptor->connection = connection; zend_list_addref(descriptor->connection->id); - PHP_OCI_CALL_RETURN(OCIDESCRIPTORALLOC, OCI_G(errcode), OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->type, (size_t) 0, (dvoid **) 0)); + PHP_OCI_CALL_RETURN(errstatus, OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->type, (size_t) 0, (dvoid **) 0)); - if (OCI_G(errcode) != OCI_SUCCESS) { - OCI_G(errcode) = php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, OCI_G(errcode)); efree(descriptor); return NULL; + } else { + OCI_G(errcode) = 0; /* retain backwards compat with OCI8 1.4 */ } PHP_OCI_REGISTER_RESOURCE(descriptor, le_descriptor); @@ -117,6 +120,7 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long typ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; + sword errstatus; *length = 0; @@ -125,18 +129,18 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_D return 0; } else { if (descriptor->type == OCI_DTYPE_FILE) { - PHP_OCI_CALL_RETURN(OCILOBFILEOPEN, connection->errcode, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + PHP_OCI_CALL_RETURN(errstatus, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY)); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } } - PHP_OCI_CALL_RETURN(OCILOBGETLENGTH, connection->errcode, OCILobGetLength, (connection->svc, connection->err, descriptor->descriptor, (ub4 *)length)); + PHP_OCI_CALL_RETURN(errstatus, OCILobGetLength, (connection->svc, connection->err, descriptor->descriptor, (ub4 *)length)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } @@ -144,14 +148,16 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_D descriptor->lob_size = *length; if (descriptor->type == OCI_DTYPE_FILE) { - PHP_OCI_CALL_RETURN(OCILOBFILECLOSE, connection->errcode, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor)); + PHP_OCI_CALL_RETURN(errstatus, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } } + + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ } return 0; } @@ -159,11 +165,7 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_D /* {{{ php_oci_lob_callback() Append LOB portion to a memory buffer */ -#if defined(HAVE_OCI_LOB_READ2) sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, dvoid **changed_bufpp, oraub8 *changed_lenp) -#else -sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece) -#endif { ub4 lenp = (ub4) len; php_oci_lob_ctx *ctx = (php_oci_lob_ctx *)ctxp; @@ -211,20 +213,22 @@ static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, l { php_oci_connection *connection = descriptor->connection; ub4 chunk_size; + sword errstatus; if (descriptor->type == OCI_DTYPE_FILE) { return read_length; } if (!descriptor->chunk_size) { - PHP_OCI_CALL_RETURN(OCILOBGETCHUNKSIZE, connection->errcode, OCILobGetChunkSize, (connection->svc, connection->err, descriptor->descriptor, &chunk_size)); + PHP_OCI_CALL_RETURN(errstatus, OCILobGetChunkSize, (connection->svc, connection->err, descriptor->descriptor, &chunk_size)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return read_length; /* we have to return original length here */ } descriptor->chunk_size = chunk_size; + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ } if ((read_length % descriptor->chunk_size) != 0) { @@ -243,16 +247,12 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini int buffer_size = PHP_OCI_LOB_BUFFER_SIZE; php_oci_lob_ctx ctx; ub1 *bufp; -#if defined(HAVE_OCI_LOB_READ2) oraub8 bytes_read, offset = 0; oraub8 requested_len = read_length; /* this is by default */ oraub8 chars_read = 0; -#else - int bytes_read, offset = 0; - int requested_len = read_length; /* this is by default */ -#endif int is_clob = 0; sb4 bytes_per_char = 1; + sword errstatus; *data_len = 0; *data = NULL; @@ -289,20 +289,20 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini offset = initial_offset; if (descriptor->type == OCI_DTYPE_FILE) { - PHP_OCI_CALL_RETURN(OCILOBFILEOPEN, connection->errcode, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY)); + PHP_OCI_CALL_RETURN(errstatus, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } } else { ub2 charset_id = 0; - PHP_OCI_CALL_RETURN(OCILOBCHARSETID, connection->errcode, OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_id)); + PHP_OCI_CALL_RETURN(errstatus, OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_id)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } @@ -313,10 +313,10 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini } if (is_clob) { - PHP_OCI_CALL_RETURN(OCINLSNUMERICINFOGET, connection->errcode, OCINlsNumericInfoGet, (connection->env, connection->err, &bytes_per_char, OCI_NLS_CHARSET_MAXBYTESZ)); + PHP_OCI_CALL_RETURN(errstatus, OCINlsNumericInfoGet, (connection->env, connection->err, &bytes_per_char, OCI_NLS_CHARSET_MAXBYTESZ)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } @@ -327,7 +327,6 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini ctx.alloc_len = (requested_len + 1) * bytes_per_char; *data = ecalloc(bytes_per_char, requested_len + 1); -#ifdef HAVE_OCI_LOB_READ2 if (is_clob) { chars_read = requested_len; bytes_read = 0; @@ -340,7 +339,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini buffer_size = php_oci_lob_calculate_buffer(descriptor, buffer_size TSRMLS_CC); /* use chunk size */ bufp = (ub1 *) ecalloc(1, buffer_size); - PHP_OCI_CALL_RETURN(OCILOBREAD2, connection->errcode, OCILobRead2, + PHP_OCI_CALL_RETURN(errstatus, OCILobRead2, ( connection->svc, connection->err, @@ -365,37 +364,9 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini } else { offset = descriptor->lob_current_position + bytes_read; } - -#else - - bytes_read = requested_len; - buffer_size = (requested_len < buffer_size ) ? requested_len : buffer_size; /* optimize buffer size */ - buffer_size = php_oci_lob_calculate_buffer(descriptor, buffer_size TSRMLS_CC); /* use chunk size */ - - bufp = (ub1 *) ecalloc(1, buffer_size); - PHP_OCI_CALL_RETURN(OCILOBREAD, connection->errcode, OCILobRead, - ( - connection->svc, - connection->err, - descriptor->descriptor, - &bytes_read, /* IN/OUT bytes toread/read */ - offset + 1, /* offset (starts with 1) */ - (dvoid *) bufp, - (ub4) buffer_size, /* size of buffer */ - (dvoid *)&ctx, - (OCICallbackLobRead) php_oci_lob_callback, /* callback... */ - (ub2) descriptor->charset_id, /* The character set ID of the buffer data. */ - (ub1) descriptor->charset_form /* The character set form of the buffer data. */ - ) - ); - - efree(bufp); - offset = descriptor->lob_current_position + bytes_read; - -#endif - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); if (*data) { efree(*data); @@ -408,10 +379,10 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini descriptor->lob_current_position = (int)offset; if (descriptor->type == OCI_DTYPE_FILE) { - PHP_OCI_CALL_RETURN(OCILOBFILECLOSE, connection->errcode, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor)); + PHP_OCI_CALL_RETURN(errstatus, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); if (*data) { efree(*data); @@ -422,6 +393,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini } } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -433,6 +405,7 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i OCILobLocator *lob = (OCILobLocator *) descriptor->descriptor; php_oci_connection *connection = (php_oci_connection *) descriptor->connection; ub4 lob_length; + sword errstatus; *bytes_written = 0; if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) { @@ -451,7 +424,7 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i offset = descriptor->lob_current_position; } - PHP_OCI_CALL_RETURN(OCILOBWRITE, connection->errcode, OCILobWrite, + PHP_OCI_CALL_RETURN(errstatus, OCILobWrite, ( connection->svc, connection->err, @@ -468,8 +441,8 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i ) ); - if (connection->errcode) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); *bytes_written = 0; return 1; @@ -486,6 +459,7 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i descriptor->buffering = PHP_OCI_LOB_BUFFER_USED; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -495,6 +469,7 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i int php_oci_lob_set_buffering (php_oci_descriptor *descriptor, int on_off TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; + sword errstatus; if (!on_off && descriptor->buffering == PHP_OCI_LOB_BUFFER_DISABLED) { /* disabling when it's already off */ @@ -507,17 +482,18 @@ int php_oci_lob_set_buffering (php_oci_descriptor *descriptor, int on_off TSRMLS } if (on_off) { - PHP_OCI_CALL_RETURN(OCILOBENABLEBUFFERING, connection->errcode, OCILobEnableBuffering, (connection->svc, connection->err, descriptor->descriptor)); + PHP_OCI_CALL_RETURN(errstatus, OCILobEnableBuffering, (connection->svc, connection->err, descriptor->descriptor)); } else { - PHP_OCI_CALL_RETURN(OCILOBDISABLEBUFFERING, connection->errcode, OCILobDisableBuffering, (connection->svc, connection->err, descriptor->descriptor)); + PHP_OCI_CALL_RETURN(errstatus, OCILobDisableBuffering, (connection->svc, connection->err, descriptor->descriptor)); } - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } descriptor->buffering = on_off ? PHP_OCI_LOB_BUFFER_ENABLED : PHP_OCI_LOB_BUFFER_DISABLED; + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -540,6 +516,7 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d { php_oci_connection *connection = descriptor_dest->connection; ub4 length_dest, length_from, copy_len; + sword errstatus; if (php_oci_lob_get_length(descriptor_dest, &length_dest TSRMLS_CC)) { return 1; @@ -560,7 +537,7 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d return 1; } - PHP_OCI_CALL_RETURN(OCILOBCOPY, connection->errcode, OCILobCopy, + PHP_OCI_CALL_RETURN(errstatus, OCILobCopy, ( connection->svc, connection->err, @@ -572,12 +549,13 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d ) ); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -587,15 +565,17 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; - + sword errstatus; + if (descriptor->is_open) { - PHP_OCI_CALL_RETURN(OCILOBCLOSE, connection->errcode, OCILobClose, (connection->svc, connection->err, descriptor->descriptor)); - } + PHP_OCI_CALL_RETURN(errstatus, OCILobClose, (connection->svc, connection->err, descriptor->descriptor)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); + PHP_OCI_HANDLE_ERROR(connection, connection->errcode); + return 1; + } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ } if (php_oci_temp_lob_close(descriptor TSRMLS_CC)) { @@ -612,24 +592,26 @@ int php_oci_temp_lob_close (php_oci_descriptor *descriptor TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; int is_temporary; + sword errstatus; - PHP_OCI_CALL_RETURN(OCILOBISTEMPORARY, connection->errcode, OCILobIsTemporary, (connection->env,connection->err, descriptor->descriptor, &is_temporary)); + PHP_OCI_CALL_RETURN(errstatus, OCILobIsTemporary, (connection->env,connection->err, descriptor->descriptor, &is_temporary)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } if (is_temporary) { - PHP_OCI_CALL_RETURN(OCILOBFREETEMPORARY, connection->errcode, OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor)); + PHP_OCI_CALL_RETURN(errstatus, OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -640,7 +622,8 @@ int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC) { OCILobLocator *lob = descriptor->descriptor; php_oci_connection *connection = descriptor->connection; - + sword errstatus; + if (!lob) { return 1; } @@ -663,16 +646,17 @@ int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC) return 0; } - PHP_OCI_CALL_RETURN(OCILOBFLUSHBUFFER, connection->errcode, OCILobFlushBuffer, (connection->svc, connection->err, lob, flush_flag)); + PHP_OCI_CALL_RETURN(errstatus, OCILobFlushBuffer, (connection->svc, connection->err, lob, flush_flag)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } /* marking buffer as enabled and not used */ descriptor->buffering = PHP_OCI_LOB_BUFFER_ENABLED; + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -717,7 +701,7 @@ void php_oci_lob_free (php_oci_descriptor *descriptor TSRMLS_DC) php_oci_temp_lob_close(descriptor TSRMLS_CC); } - PHP_OCI_CALL(OCIDESCRIPTORFREE, OCIDescriptorFree, (descriptor->descriptor, descriptor->type)); + PHP_OCI_CALL(OCIDescriptorFree, (descriptor->descriptor, descriptor->type)); zend_list_delete(descriptor->connection->id); efree(descriptor); @@ -734,6 +718,7 @@ int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename TSRMLS_DC php_oci_connection *connection = descriptor->connection; char buf[8192]; ub4 offset = 1; + sword errstatus; #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) /* Safe mode has been removed in PHP 5.4 */ @@ -750,7 +735,7 @@ int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename TSRMLS_DC } while ((loblen = read(fp, &buf, sizeof(buf))) > 0) { - PHP_OCI_CALL_RETURN(OCILOBWRITE, connection->errcode, + PHP_OCI_CALL_RETURN(errstatus, OCILobWrite, ( connection->svc, @@ -768,11 +753,13 @@ int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename TSRMLS_DC ) ); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); close(fp); return 1; + } else { + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ } offset += loblen; } @@ -790,6 +777,7 @@ int php_oci_lob_append (php_oci_descriptor *descriptor_dest, php_oci_descriptor OCILobLocator *lob_dest = descriptor_dest->descriptor; OCILobLocator *lob_from = descriptor_from->descriptor; ub4 dest_len, from_len; + sword errstatus; if (php_oci_lob_get_length(descriptor_dest, &dest_len TSRMLS_CC)) { return 1; @@ -803,13 +791,14 @@ int php_oci_lob_append (php_oci_descriptor *descriptor_dest, php_oci_descriptor return 0; } - PHP_OCI_CALL_RETURN(OCILOBAPPEND, connection->errcode, OCILobAppend, (connection->svc, connection->err, lob_dest, lob_from)); + PHP_OCI_CALL_RETURN(errstatus, OCILobAppend, (connection->svc, connection->err, lob_dest, lob_from)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -821,6 +810,7 @@ int php_oci_lob_truncate (php_oci_descriptor *descriptor, long new_lob_length TS php_oci_connection *connection = descriptor->connection; OCILobLocator *lob = descriptor->descriptor; ub4 lob_length; + sword errstatus; if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) { return 1; @@ -840,15 +830,17 @@ int php_oci_lob_truncate (php_oci_descriptor *descriptor, long new_lob_length TS return 1; } - PHP_OCI_CALL_RETURN(OCILOBTRIM, connection->errcode, OCILobTrim, (connection->svc, connection->err, lob, new_lob_length)); + PHP_OCI_CALL_RETURN(errstatus, OCILobTrim, (connection->svc, connection->err, lob, new_lob_length)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } descriptor->lob_size = new_lob_length; + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ + return 0; } /* }}} */ @@ -860,6 +852,7 @@ int php_oci_lob_erase (php_oci_descriptor *descriptor, long offset, ub4 length, php_oci_connection *connection = descriptor->connection; OCILobLocator *lob = descriptor->descriptor; ub4 lob_length; + sword errstatus; *bytes_erased = 0; @@ -875,15 +868,16 @@ int php_oci_lob_erase (php_oci_descriptor *descriptor, long offset, ub4 length, length = lob_length; } - PHP_OCI_CALL_RETURN(OCILOBERASE, connection->errcode, OCILobErase, (connection->svc, connection->err, lob, (ub4 *)&length, offset+1)); + PHP_OCI_CALL_RETURN(errstatus, OCILobErase, (connection->svc, connection->err, lob, (ub4 *)&length, offset+1)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } *bytes_erased = length; + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -895,14 +889,16 @@ int php_oci_lob_is_equal (php_oci_descriptor *descriptor_first, php_oci_descript php_oci_connection *connection = descriptor_first->connection; OCILobLocator *first_lob = descriptor_first->descriptor; OCILobLocator *second_lob = descriptor_second->descriptor; + sword errstatus; - PHP_OCI_CALL_RETURN(OCILOBISEQUAL, connection->errcode, OCILobIsEqual, (connection->env, first_lob, second_lob, result)); + PHP_OCI_CALL_RETURN(errstatus, OCILobIsEqual, (connection->env, first_lob, second_lob, result)); - if (connection->errcode) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -914,6 +910,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, long type, char *data php_oci_connection *connection = descriptor->connection; OCILobLocator *lob = descriptor->descriptor; ub4 bytes_written = 0; + sword errstatus; switch (type) { case OCI_TEMP_BLOB: @@ -930,7 +927,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, long type, char *data return 1; } - PHP_OCI_CALL_RETURN(OCILOBCREATETEMPORARY, connection->errcode, OCILobCreateTemporary, + PHP_OCI_CALL_RETURN(errstatus, OCILobCreateTemporary, ( connection->svc, connection->err, @@ -943,21 +940,22 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, long type, char *data ) ); - if (connection->errcode) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - PHP_OCI_CALL_RETURN(OCILOBOPEN, connection->errcode, OCILobOpen, (connection->svc, connection->err, lob, OCI_LOB_READWRITE)); + PHP_OCI_CALL_RETURN(errstatus, OCILobOpen, (connection->svc, connection->err, lob, OCI_LOB_READWRITE)); - if (connection->errcode) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } descriptor->is_open = 1; + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return php_oci_lob_write(descriptor, 0, data, data_len, &bytes_written TSRMLS_CC); } diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c index feec0568540ea..1e66308e53ca4 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -46,24 +46,21 @@ php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char *query, int query_len TSRMLS_DC) { php_oci_statement *statement; - + sword errstatus; + + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ + statement = ecalloc(1,sizeof(php_oci_statement)); if (!query_len) { /* do not allocate stmt handle for refcursors, we'll get it from OCIStmtPrepare2() */ - PHP_OCI_CALL(OCIHANDLEALLOC, OCIHandleAlloc, (connection->env, (dvoid **)&(statement->stmt), OCI_HTYPE_STMT, 0, NULL)); - } else { -#ifdef HAVE_DTRACE - if (DTRACE_OCI8_SQLTEXT_ENABLED()) { - DTRACE_OCI8_SQLTEXT(query); - } -#endif /* HAVE_DTRACE */ + PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->stmt), OCI_HTYPE_STMT, 0, NULL)); } - - PHP_OCI_CALL(OCIHANDLEALLOC, OCIHandleAlloc, (connection->env, (dvoid **)&(statement->err), OCI_HTYPE_ERROR, 0, NULL)); + + PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->err), OCI_HTYPE_ERROR, 0, NULL)); if (query_len > 0) { - PHP_OCI_CALL_RETURN(OCISTMTPREPARE2, connection->errcode, OCIStmtPrepare2, + PHP_OCI_CALL_RETURN(errstatus, OCIStmtPrepare2, ( connection->svc, &(statement->stmt), @@ -76,14 +73,19 @@ php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char OCI_DEFAULT ) ); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); +#ifdef HAVE_OCI8_DTRACE + if (DTRACE_OCI8_SQLTEXT_ENABLED()) { + DTRACE_OCI8_SQLTEXT(connection, connection->client_id, statement, query); + } +#endif /* HAVE_OCI8_DTRACE */ - PHP_OCI_CALL(OCISTMTRELEASE, OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_STRLS_CACHE_DELETE : OCI_DEFAULT)); - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree,(statement->err, OCI_HTYPE_ERROR)); - - efree(statement); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); + + PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, OCI_STRLS_CACHE_DELETE)); + PHP_OCI_CALL(OCIHandleFree,(statement->err, OCI_HTYPE_ERROR)); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); + efree(statement); return NULL; } } @@ -131,9 +133,10 @@ php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement T void *result; ub4 rtype; php_oci_statement *statement2; /* implicit result set statement handle */ + sword errstatus; - PHP_OCI_CALL_RETURN(OCISTMTGETNEXTRESULT, statement->errcode, OCIStmtGetNextResult, (statement->stmt, statement->err, &result, &rtype, OCI_DEFAULT)); - if (statement->errcode == OCI_NO_DATA) { + PHP_OCI_CALL_RETURN(errstatus, OCIStmtGetNextResult, (statement->stmt, statement->err, &result, &rtype, OCI_DEFAULT)); + if (errstatus == OCI_NO_DATA) { return NULL; } @@ -144,7 +147,7 @@ php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement T } else { statement2 = ecalloc(1,sizeof(php_oci_statement)); - PHP_OCI_CALL(OCIHANDLEALLOC, OCIHandleAlloc, (statement->connection->env, (dvoid **)&(statement2->err), OCI_HTYPE_ERROR, 0, NULL)); + PHP_OCI_CALL(OCIHandleAlloc, (statement->connection->env, (dvoid **)&(statement2->err), OCI_HTYPE_ERROR, 0, NULL)); statement2->stmt = (OCIStmt *)result; statement2->parent_stmtid = statement->id; statement2->impres_child_stmt = NULL; @@ -182,19 +185,22 @@ php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement T Set prefetch buffer size for the statement */ int php_oci_statement_set_prefetch(php_oci_statement *statement, ub4 prefetch TSRMLS_DC) { + sword errstatus; + if (prefetch > 20000) { prefetch = 20000; /* keep it somewhat sane */ } - PHP_OCI_CALL_RETURN(OCIATTRSET, statement->errcode, OCIAttrSet, (statement->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_ROWS, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, (statement->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_ROWS, statement->err)); - if (statement->errcode != OCI_SUCCESS) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); statement->prefetch_count = 0; return 1; } statement->prefetch_count = prefetch; + statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -242,16 +248,18 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) ub4 typep, iterp, idxp; ub1 in_outp, piecep; zend_bool piecewisecols = 0; - php_oci_out_column *column; + sword errstatus; + + statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ if (statement->has_descr && statement->columns) { zend_hash_apply(statement->columns, (apply_func_t) php_oci_cleanup_pre_fetch TSRMLS_CC); } - PHP_OCI_CALL_RETURN(OCISTMTFETCH, statement->errcode, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT)); + PHP_OCI_CALL_RETURN(errstatus, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT)); - if ( statement->errcode == OCI_NO_DATA || nrows == 0 ) { + if (errstatus == OCI_NO_DATA || nrows == 0) { if (statement->last_query == NULL) { /* reset define-list for refcursors */ if (statement->columns) { @@ -263,7 +271,6 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) statement->executed = 0; } - statement->errcode = 0; /* OCI_NO_DATA is NO error for us!!! */ statement->has_data = 0; if (nrows == 0) { @@ -282,9 +289,9 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) } } - while (statement->errcode == OCI_NEED_DATA) { + while (errstatus == OCI_NEED_DATA) { if (piecewisecols) { - PHP_OCI_CALL_RETURN(OCISTMTGETPIECEINFO,statement->errcode, + PHP_OCI_CALL_RETURN(errstatus, OCIStmtGetPieceInfo, ( statement->stmt, @@ -310,7 +317,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) column->cb_retlen = PHP_OCI_PIECE_SIZE; /* and instruct fetch to fetch waiting piece into our buffer */ - PHP_OCI_CALL(OCISTMTSETPIECEINFO, OCIStmtSetPieceInfo, + PHP_OCI_CALL(OCIStmtSetPieceInfo, ( (void *) column->oci_define, OCI_HTYPE_DEFINE, @@ -326,7 +333,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) } } - PHP_OCI_CALL_RETURN(OCISTMTFETCH, statement->errcode, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT)); + PHP_OCI_CALL_RETURN(errstatus, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT)); if (piecewisecols) { for (i = 0; i < statement->ncolumns; i++) { @@ -338,7 +345,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) } } - if (statement->errcode == OCI_SUCCESS_WITH_INFO || statement->errcode == OCI_SUCCESS) { + if (errstatus == OCI_SUCCESS_WITH_INFO || errstatus == OCI_SUCCESS) { statement->has_data = 1; /* do the stuff needed for OCIDefineByName */ @@ -359,7 +366,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) return 0; } - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); statement->has_data = 0; @@ -482,17 +489,18 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) ub4 colcount; ub2 dynamic; dvoid *buf; + sword errstatus; switch (mode) { case OCI_COMMIT_ON_SUCCESS: case OCI_DESCRIBE_ONLY: case OCI_DEFAULT: /* only these are allowed */ -#ifdef HAVE_DTRACE +#ifdef HAVE_OCI8_DTRACE if (DTRACE_OCI8_EXECUTE_MODE_ENABLED()) { - DTRACE_OCI8_EXECUTE_MODE(mode); + DTRACE_OCI8_EXECUTE_MODE(statement->connection, statement->connection->client_id, statement, mode); } -#endif /* HAVE_DTRACE */ +#endif /* HAVE_OCI8_DTRACE */ break; default: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid execute mode given: %d", mode); @@ -502,12 +510,14 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) if (!statement->stmttype) { /* get statement type */ - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement->stmttype, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement->stmttype, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err)); - if (statement->errcode != OCI_SUCCESS) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; + } else { + statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ } } @@ -528,10 +538,10 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) } /* execute statement */ - PHP_OCI_CALL_RETURN(OCISTMTEXECUTE, statement->errcode, OCIStmtExecute, (statement->connection->svc, statement->stmt, statement->err, iters, 0, NULL, NULL, mode)); + PHP_OCI_CALL_RETURN(errstatus, OCIStmtExecute, (statement->connection->svc, statement->stmt, statement->err, iters, 0, NULL, NULL, mode)); - if (statement->errcode != OCI_SUCCESS) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } @@ -553,6 +563,8 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) * invoked PL/SQL must explicitly rollback/commit else the * SELECT fails). */ + + statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ } if (statement->stmttype == OCI_STMT_SELECT && statement->executed == 0) { @@ -565,10 +577,10 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) counter = 1; /* get number of columns */ - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *)&colcount, (ub4 *)0, OCI_ATTR_PARAM_COUNT, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *)&colcount, (ub4 *)0, OCI_ATTR_PARAM_COUNT, statement->err)); - if (statement->errcode != OCI_SUCCESS) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } @@ -585,50 +597,50 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) } /* get column */ - PHP_OCI_CALL_RETURN(OCIPARAMGET, statement->errcode, OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, statement->err, (dvoid**)¶m, counter)); + PHP_OCI_CALL_RETURN(errstatus, OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, statement->err, (dvoid**)¶m, counter)); - if (statement->errcode != OCI_SUCCESS) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } /* get column datatype */ - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_type, (ub4 *)0, OCI_ATTR_DATA_TYPE, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_type, (ub4 *)0, OCI_ATTR_DATA_TYPE, statement->err)); - if (statement->errcode != OCI_SUCCESS) { - PHP_OCI_CALL(OCIDESCRIPTORFREE, OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } /* get character set form */ - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_form, (ub4 *)0, OCI_ATTR_CHARSET_FORM, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_form, (ub4 *)0, OCI_ATTR_CHARSET_FORM, statement->err)); - if (statement->errcode != OCI_SUCCESS) { - PHP_OCI_CALL(OCIDESCRIPTORFREE, OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } /* get character set id */ - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_id, (ub4 *)0, OCI_ATTR_CHARSET_ID, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_id, (ub4 *)0, OCI_ATTR_CHARSET_ID, statement->err)); - if (statement->errcode != OCI_SUCCESS) { - PHP_OCI_CALL(OCIDESCRIPTORFREE, OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } /* get size of the column */ - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_size, (dvoid *)0, OCI_ATTR_DATA_SIZE, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_size, (dvoid *)0, OCI_ATTR_DATA_SIZE, statement->err)); - if (statement->errcode != OCI_SUCCESS) { - PHP_OCI_CALL(OCIDESCRIPTORFREE, OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } @@ -637,35 +649,35 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) outcol->retlen = outcol->data_size; /* get scale of the column */ - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->scale, (dvoid *)0, OCI_ATTR_SCALE, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->scale, (dvoid *)0, OCI_ATTR_SCALE, statement->err)); - if (statement->errcode != OCI_SUCCESS) { - PHP_OCI_CALL(OCIDESCRIPTORFREE, OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } /* get precision of the column */ - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->precision, (dvoid *)0, OCI_ATTR_PRECISION, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->precision, (dvoid *)0, OCI_ATTR_PRECISION, statement->err)); - if (statement->errcode != OCI_SUCCESS) { - PHP_OCI_CALL(OCIDESCRIPTORFREE, OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } /* get name of the column */ - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid **)&colname, (ub4 *)&outcol->name_len, (ub4)OCI_ATTR_NAME, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid **)&colname, (ub4 *)&outcol->name_len, (ub4)OCI_ATTR_NAME, statement->err)); - if (statement->errcode != OCI_SUCCESS) { - PHP_OCI_CALL(OCIDESCRIPTORFREE, OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } - PHP_OCI_CALL(OCIDESCRIPTORFREE, OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); + PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); outcol->name = estrndup((char*) colname, outcol->name_len); @@ -757,7 +769,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) } if (dynamic == OCI_DYNAMIC_FETCH) { - PHP_OCI_CALL_RETURN(OCIDEFINEBYPOS, statement->errcode, + PHP_OCI_CALL_RETURN(errstatus, OCIDefineByPos, ( statement->stmt, /* IN/OUT handle to the requested SQL query */ @@ -775,7 +787,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) ); } else { - PHP_OCI_CALL_RETURN(OCIDEFINEBYPOS, statement->errcode, + PHP_OCI_CALL_RETURN(errstatus, OCIDefineByPos, ( statement->stmt, /* IN/OUT handle to the requested SQL query */ @@ -794,10 +806,10 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) } - if (statement->errcode != OCI_SUCCESS) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 0; + return 1; } /* additional OCIDefineDynamic() call */ @@ -807,7 +819,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) case SQLT_BLOB: case SQLT_CLOB: case SQLT_BFILE: - PHP_OCI_CALL_RETURN(OCIDEFINEDYNAMIC, statement->errcode, + PHP_OCI_CALL_RETURN(errstatus, OCIDefineDynamic, ( outcol->oci_define, @@ -817,9 +829,15 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) ) ); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); + PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); + return 1; + } break; } } + statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ } return 0; @@ -840,15 +858,15 @@ void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC) { if (statement->stmt) { if (statement->last_query_len) { /* FIXME: magical */ - PHP_OCI_CALL(OCISTMTRELEASE, OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_STRLS_CACHE_DELETE : OCI_DEFAULT)); + PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_STRLS_CACHE_DELETE : OCI_DEFAULT)); } else if (statement->impres_flag != PHP_OCI_IMPRES_IS_CHILD) { /* Oracle doc says don't free Implicit Result Set handles */ - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, (statement->stmt, OCI_HTYPE_STMT)); + PHP_OCI_CALL(OCIHandleFree, (statement->stmt, OCI_HTYPE_STMT)); } statement->stmt = NULL; } if (statement->err) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, (statement->err, OCI_HTYPE_ERROR)); + PHP_OCI_CALL(OCIHandleFree, (statement->err, OCI_HTYPE_ERROR)); statement->err = NULL; } @@ -950,6 +968,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC) { php_oci_bind *bind = (php_oci_bind *) data; php_oci_connection *connection = bind->parent_statement->connection; + sword errstatus; if (bind->indicator == -1) { /* NULL */ zval *val = bind->zval; @@ -1009,24 +1028,26 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC) memset((void*)buff,0,sizeof(buff)); if ((i < bind->array.old_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { - PHP_OCI_CALL_RETURN(OCIDATETOTEXT, connection->errcode, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff)); + PHP_OCI_CALL_RETURN(errstatus, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff)); zval_dtor(*entry); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); ZVAL_NULL(*entry); } else { + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ ZVAL_STRINGL(*entry, (char *)buff, buff_len, 1); } zend_hash_move_forward(hash); } else { - PHP_OCI_CALL_RETURN(OCIDATETOTEXT, connection->errcode, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + PHP_OCI_CALL_RETURN(errstatus, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff)); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); add_next_index_null(bind->zval); } else { + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ add_next_index_stringl(bind->zval, (char *)buff, buff_len, 1); } } @@ -1072,6 +1093,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, php_oci_bind bind, *old_bind, *bindp; int mode = OCI_DATA_AT_EXEC; sb4 value_sz = -1; + sword errstatus; switch (type) { case SQLT_NTY: @@ -1195,7 +1217,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, bindp->type = type; zval_add_ref(&var); - PHP_OCI_CALL_RETURN(OCIBINDBYNAME, statement->errcode, + PHP_OCI_CALL_RETURN(errstatus, OCIBindByName, ( statement->stmt, /* statement handle */ @@ -1215,14 +1237,14 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, ) ); - if (statement->errcode != OCI_SUCCESS) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } if (mode == OCI_DATA_AT_EXEC) { - PHP_OCI_CALL_RETURN(OCIBINDDYNAMIC, statement->errcode, OCIBindDynamic, + PHP_OCI_CALL_RETURN(errstatus, OCIBindDynamic, ( bindp->bind, statement->err, @@ -1233,8 +1255,8 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, ) ); - if (statement->errcode != OCI_SUCCESS) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } @@ -1242,7 +1264,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, if (type == SQLT_NTY) { /* Bind object */ - PHP_OCI_CALL_RETURN(OCIBINDOBJECT, statement->errcode, OCIBindObject, + PHP_OCI_CALL_RETURN(errstatus, OCIBindObject, ( bindp->bind, statement->err, @@ -1254,13 +1276,14 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, ) ); - if (statement->errcode) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } } + statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -1446,17 +1469,18 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type TSRMLS_DC) { ub2 statement_type; + sword errstatus; *type = 0; - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement_type, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement_type, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err)); - if (statement->errcode != OCI_SUCCESS) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } - + statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ *type = statement_type; return 0; @@ -1468,17 +1492,18 @@ int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type TSRMLS_DC int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows TSRMLS_DC) { ub4 statement_numrows; + sword errstatus; *numrows = 0; - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub4 *)&statement_numrows, (ub4 *)0, OCI_ATTR_ROW_COUNT, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub4 *)&statement_numrows, (ub4 *)0, OCI_ATTR_ROW_COUNT, statement->err)); - if (statement->errcode != OCI_SUCCESS) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } - + statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ *numrows = statement_numrows; return 0; @@ -1490,6 +1515,7 @@ int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows TSR int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, long max_table_length, long maxlength, long type TSRMLS_DC) { php_oci_bind *bind, *bindp; + sword errstatus; convert_to_array(var); @@ -1553,7 +1579,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int nam zval_add_ref(&var); - PHP_OCI_CALL_RETURN(OCIBINDBYNAME, statement->errcode, + PHP_OCI_CALL_RETURN(errstatus, OCIBindByName, ( statement->stmt, @@ -1574,12 +1600,13 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int nam ); - if (statement->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { efree(bind); - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } + statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ efree(bind); return 0; } @@ -1741,6 +1768,7 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, p ub4 i; HashTable *hash; zval **entry; + sword errstatus; hash = HASH_OF(var); @@ -1762,14 +1790,14 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, p if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { convert_to_string_ex(entry); - PHP_OCI_CALL_RETURN(OCIDATEFROMTEXT, connection->errcode, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, 0, NULL, 0, &oci_date)); + PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, 0, NULL, 0, &oci_date)); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { /* failed to convert string to date */ efree(bind->array.element_lengths); efree(bind->array.elements); efree(bind); - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return NULL; } @@ -1777,20 +1805,21 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, p ((OCIDate *)bind->array.elements)[i] = oci_date; zend_hash_move_forward(hash); } else { - PHP_OCI_CALL_RETURN(OCIDATEFROMTEXT, connection->errcode, OCIDateFromText, (connection->err, (CONST text *)"01-JAN-00", sizeof("01-JAN-00")-1, NULL, 0, NULL, 0, &oci_date)); + PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)"01-JAN-00", sizeof("01-JAN-00")-1, NULL, 0, NULL, 0, &oci_date)); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { /* failed to convert string to date */ efree(bind->array.element_lengths); efree(bind->array.elements); efree(bind); - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return NULL; } ((OCIDate *)bind->array.elements)[i] = oci_date; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ } zend_hash_internal_pointer_reset(hash); diff --git a/ext/oci8/package.xml b/ext/oci8/package.xml index 4dc78d4983774..7be825b895b39 100644 --- a/ext/oci8/package.xml +++ b/ext/oci8/package.xml @@ -8,12 +8,17 @@ http://pear.php.net/dtd/package-2.0.xsd"> Extension for Oracle Database - This extension allows you to access Oracle Database. OCI8 2.0 can - be built with PHP 4.3.9 onwards. OCI8 can be linked with Oracle - Database 9.2, 10, 11, or 12.1 client libraries. Oracle's standard - cross-version connectivity applies. For example PHP linked with - Oracle Database 11.2 client libraries can connect to Oracle - Database 9.2 onwards. +Use the OCI8 extension to access Oracle Database. The extension can +be linked with Oracle client libraries from Oracle Database 10.2, 11, +or 12.1. These libraries are found in the database installation, or +in the free Oracle Instant Client available from Oracle. Oracle's +standard cross-version connectivity applies. For example, PHP OCI8 +linked with Instant Client 11.2 can connect to Oracle Database 9.2 +onward. See Oracle's note "Oracle Client / Server Interoperability +Support" (ID 207303.1) for details. PHP OCI8 2.0 can be built with +PHP 5.2 onward. Use the older PHP OCI8 1.4.10 when using PHP 4.3.9 +through to PHP 5.1.x, or when only Oracle Database 9.2 client +libraries are available. Christopher Jones @@ -40,21 +45,21 @@ http://pear.php.net/dtd/package-2.0.xsd"> no - 2013-07-24 + 2013-10-22 - 2.0.1 - 2.0.1 + 2.0.6 + 2.0.6 - devel - devel + stable + stable PHP - - Fixed --enable-maintainer-zts mode - Allow Implicit Result Set statement resources to inherit the parent's current prefetch count + +Added a LICENSE file to make it easier for PECL binary distributions +to conform with the license. @@ -140,7 +145,6 @@ http://pear.php.net/dtd/package-2.0.xsd"> - @@ -153,7 +157,6 @@ http://pear.php.net/dtd/package-2.0.xsd"> - @@ -222,6 +225,8 @@ http://pear.php.net/dtd/package-2.0.xsd"> + + @@ -267,6 +272,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> + @@ -439,8 +445,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> - 4.3.9 - 6.0.0 + 5.2.0 1.4.0b1 @@ -453,6 +458,94 @@ http://pear.php.net/dtd/package-2.0.xsd"> + + + 2.0.5 + 2.0.5 + + + stable + stable + + PHP + +Bump PHP OCI8 2.0 mininum requirements to PHP 5.2 and Oracle client +library 10.2. (Use OCI8 1.4 for older PHP version support or if only +Oracle 9.2 client libraries are available.) + +Re-enable php_oci8.dll and php_oci8_11g.dll for Windows builds so URL +links work in the new Windows PECL infrastructure. + + + + + + 2.0.4 + 2.0.4 + + + devel + devel + + PHP + +Fix persistent memory usage with --enable-dtrace +Export get_module() for Windows php_oci8_12c.dll + + + + + + 2.0.3 + 2.0.3 + + + devel + devel + + PHP + +Add the oci_set_client_identifier() value and statement structure pointer to several DTrace probes. +Use 'phpoci' as the DTrace provider name since uniqueness is required by the Linux fasttrap module. +Update Windows builds to create only php_oci8_12c.dll. + + + + + + 2.0.2 + 2.0.2 + + + devel + devel + + PHP + +Review and improve error handling code and data types. +Fix oci_set_*($connection, ...) error handling so oci_error($connection) works. +Add DTrace oci8-connection-close probe +Add the connection handle to several DTrace probes. + + + + + + 2.0.1 + 2.0.1 + + + devel + devel + + PHP + +Fixed --enable-maintainer-zts mode. +Allow Implicit Result Set statement resources to inherit the parent's current prefetch count. +Allow OCI8 to be DTrace-enabled independently from core PHP. +Require OCI8 to be configured 'shared' when enabling DTrace support. + + @@ -465,69 +558,69 @@ http://pear.php.net/dtd/package-2.0.xsd"> PHP - - NEW FUNCTIONALITY: - - - Added Implicit Result Set support for Oracle Database 12c. - Streaming of all IRS's returned from a PL/SQL block is available - via oci_fetch_array, oci_fetch_assoc, oci_fetch_object and - oci_fetch_row (but not oci_fetch or oci_fetch_all). - Alternatively individual IRS statement resources can be obtained - with the new function 'oci_get_implicit_resultset' and passed to - any oci_fetch_* function. - - - Added DTrace probes enabled with PHP's generic --enable-dtrace - - - IMPROVED FUNCTIONALITY: - - - Using 'oci_execute($s, OCI_NO_AUTO_COMMIT)' for a SELECT no - longer unnecessarily initiates an internal ROLLBACK during - connection close. This can improve overall scalability by - reducing "round trips" between PHP and the database. - - - CHANGED FUNCTIONALITY: - - - PHPINFO() CHANGES: - - - The oci8.event and oci8.connection_class values are now shown - only when the Oracle client libraries support the respective - functionality. - - - Connection statistics are now in a separate phpinfo() table. - - - Temporary LOB and Collection support status lines in - phpinfo() were removed. These features have always been - enabled since 2007. - - - OCI_INTERNAL_DEBUG() CHANGES: - - - The oci_internal_debug() function is now a no-op. Use PHP's - --enable-dtrace functionality with DTrace or SystemTap instead. - - - INTERNAL CHANGES: - - - Fixed a potential NULL pointer dereference flagged by Parfait - static code analysis. - - - Extended testing of existing OCI8 functionality. - - - Improved test output portability when using the PHP development - web server to run tests. - - - Removed no-longer necessary Unicode patterns from tests - (vestiges of PHP's previous PHP 6 project) - - - Improved build portability by removing compilation type cast - warnings with some compilers. - - - Fixed compilation warnings when building with Oracle 9.2 - client libraries. - - - Updated code to use internal macro PHP_OCI_REGISTER_RESOURCE. - - - Regularized code prototypes and fixed some in-line documentation - prototypes. - - - Fixed code folding. +- NEW FUNCTIONALITY: + + - Added Implicit Result Set support for Oracle Database 12c. + Streaming of all IRS's returned from a PL/SQL block is available + via oci_fetch_array, oci_fetch_assoc, oci_fetch_object and + oci_fetch_row (but not oci_fetch or oci_fetch_all). + Alternatively individual IRS statement resources can be obtained + with the new function 'oci_get_implicit_resultset' and passed to + any oci_fetch_* function. + + - Added DTrace probes enabled with PHP's generic --enable-dtrace + +- IMPROVED FUNCTIONALITY: + + - Using 'oci_execute($s, OCI_NO_AUTO_COMMIT)' for a SELECT no + longer unnecessarily initiates an internal ROLLBACK during + connection close. This can improve overall scalability by + reducing "round trips" between PHP and the database. + +- CHANGED FUNCTIONALITY: + + - PHPINFO() CHANGES: + + - The oci8.event and oci8.connection_class values are now shown + only when the Oracle client libraries support the respective + functionality. + + - Connection statistics are now in a separate phpinfo() table. + + - Temporary LOB and Collection support status lines in + phpinfo() were removed. These features have always been + enabled since 2007. + + - OCI_INTERNAL_DEBUG() CHANGES: + + - The oci_internal_debug() function is now a no-op. Use PHP's + --enable-dtrace functionality with DTrace or SystemTap instead. + +- INTERNAL CHANGES: + + - Fixed a potential NULL pointer dereference flagged by Parfait + static code analysis. + + - Extended testing of existing OCI8 functionality. + + - Improved test output portability when using the PHP development + web server to run tests. + + - Removed no-longer necessary Unicode patterns from tests + (vestiges of PHP's previous PHP 6 project) + + - Improved build portability by removing compilation type cast + warnings with some compilers. + + - Fixed compilation warnings when building with Oracle 9.2 + client libraries. + + - Updated code to use internal macro PHP_OCI_REGISTER_RESOURCE. + + - Regularized code prototypes and fixed some in-line documentation + prototypes. + + - Fixed code folding. diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h index f10f01db52d42..751041554982f 100644 --- a/ext/oci8/php_oci8.h +++ b/ext/oci8/php_oci8.h @@ -41,12 +41,11 @@ */ #ifdef PHP_OCI8_VERSION /* The definition of PHP_OCI8_VERSION changed in PHP 5.3 and building - * this code with PHP 5.2 and earlier (e.g. when using OCI8 from PECL) - * will conflict. + * this code with PHP 5.2 (e.g. when using OCI8 from PECL) will conflict. */ #undef PHP_OCI8_VERSION #endif -#define PHP_OCI8_VERSION "2.0.1-dev" +#define PHP_OCI8_VERSION "2.0.6" extern zend_module_entry oci8_module_entry; #define phpext_oci8_ptr &oci8_module_entry diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h index d1aa1ae70c6eb..e50983d75eb53 100644 --- a/ext/oci8/php_oci8_int.h +++ b/ext/oci8/php_oci8_int.h @@ -44,7 +44,7 @@ # endif # endif /* osf alpha */ -#ifdef HAVE_DTRACE +#ifdef HAVE_OCI8_DTRACE #include "oci8_dtrace_gen.h" #endif @@ -141,7 +141,7 @@ typedef struct { OCIAuthInfo *authinfo; /* Cached authinfo handle for OCISessionGet */ OCIError *err; /* private error handle */ php_oci_spool *private_spool; /* private session pool (for persistent) */ - sword errcode; /* last errcode */ + sb4 errcode; /* last ORA- error number */ HashTable *descriptors; /* descriptors hash, used to flush all the LOBs using this connection on commit */ ulong descriptor_count; /* used to index the descriptors hash table. Not an accurate count */ @@ -156,6 +156,9 @@ typedef struct { time_t idle_expiry; /* time when the connection will be considered as expired */ time_t *next_pingp; /* (pointer to) time of the next ping */ char *hash_key; /* hashed details of the connection */ +#ifdef HAVE_OCI8_DTRACE + char *client_id; /* The oci_set_client_identifier() value */ +#endif } php_oci_connection; /* }}} */ @@ -213,7 +216,7 @@ typedef struct { struct php_oci_statement *impres_child_stmt;/* child of current Implicit Result Set statement handle */ ub4 impres_count; /* count of remaining Implicit Result children on parent statement handle */ php_oci_connection *connection; /* parent connection handle */ - sword errcode; /* last errcode*/ + sb4 errcode; /* last ORA- error number */ OCIError *err; /* private error handle */ OCIStmt *stmt; /* statement handle */ char *last_query; /* last query issued. also used to determine if this is a statement or a refcursor recieved from Oracle */ @@ -285,49 +288,19 @@ typedef struct { /* {{{ macros */ -#ifdef HAVE_DTRACE -#define PHP_OCI_CALL(func_uc, func, params) \ +#define PHP_OCI_CALL(func, params) \ do { \ - if (DTRACE_OCI8_ ## func_uc ## _START_ENABLED()) { \ - DTRACE_OCI8_ ## func_uc ## _START(); \ - } \ OCI_G(in_call) = 1; \ func params; \ OCI_G(in_call) = 0; \ - if (DTRACE_OCI8_ ## func_uc ## _DONE_ENABLED()) { \ - DTRACE_OCI8_ ## func_uc ## _DONE(); \ - } \ } while (0) -#else /* HAVE_DTRACE */ -#define PHP_OCI_CALL(func_uc, func, params) \ - do { \ - OCI_G(in_call) = 1; \ - func params; \ - OCI_G(in_call) = 0; \ - } while (0) -#endif /* HAVE_DTRACE */ -#ifdef HAVE_DTRACE -#define PHP_OCI_CALL_RETURN(func_uc, __retval, func, params) \ - do { \ - if (DTRACE_OCI8_ ## func_uc ## _START_ENABLED()) { \ - DTRACE_OCI8_ ## func_uc ## _START(); \ - } \ - OCI_G(in_call) = 1; \ - __retval = func params; \ - OCI_G(in_call) = 0; \ - if (DTRACE_OCI8_ ## func_uc ## _DONE_ENABLED()) { \ - DTRACE_OCI8_ ## func_uc ## _DONE(); \ - } \ - } while (0) -#else /* HAVE_DTRACE */ -#define PHP_OCI_CALL_RETURN(func_uc, __retval, func, params) \ +#define PHP_OCI_CALL_RETURN(__retval, func, params) \ do { \ OCI_G(in_call) = 1; \ __retval = func params; \ OCI_G(in_call) = 0; \ } while (0) -#endif /* HAVE_DTRACE */ /* Check for errors that indicate the connection to the DB is no * longer valid. If it isn't, then the PHP connection is marked to be @@ -340,6 +313,7 @@ typedef struct { */ #define PHP_OCI_HANDLE_ERROR(connection, errcode) \ do { \ + ub4 serverStatus = OCI_SERVER_NORMAL; \ switch (errcode) { \ case 1013: \ zend_bailout(); \ @@ -369,8 +343,7 @@ typedef struct { break; \ default: \ { \ - ub4 serverStatus = OCI_SERVER_NORMAL; \ - PHP_OCI_CALL(OCIATTRGET, OCIAttrGet, ((dvoid *)(connection)->server, OCI_HTYPE_SERVER, (dvoid *)&serverStatus, \ + PHP_OCI_CALL(OCIAttrGet, ((dvoid *)(connection)->server, OCI_HTYPE_SERVER, (dvoid *)&serverStatus, \ (ub4 *)0, OCI_ATTR_SERVER_STATUS, (connection)->err)); \ if (serverStatus != OCI_SERVER_NORMAL) { \ (connection)->is_open = 0; \ @@ -378,6 +351,7 @@ typedef struct { } \ break; \ } \ + php_oci_dtrace_check_connection(connection, errcode, serverStatus); \ } while (0) #define PHP_OCI_REGISTER_RESOURCE(resource, le_resource) \ @@ -441,6 +415,7 @@ void php_oci_client_get_version(char **version TSRMLS_DC); int php_oci_server_get_version(php_oci_connection *connection, char **version TSRMLS_DC); void php_oci_fetch_row(INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_args); int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSRMLS_DC); +void php_oci_dtrace_check_connection(php_oci_connection *connection, sb4 errcode, ub4 serverStatus); /* }}} */ @@ -463,11 +438,7 @@ int php_oci_lob_append(php_oci_descriptor *descriptor_dest, php_oci_descriptor * int php_oci_lob_truncate(php_oci_descriptor *descriptor, long new_lob_length TSRMLS_DC); int php_oci_lob_erase(php_oci_descriptor *descriptor, long offset, ub4 length, ub4 *bytes_erased TSRMLS_DC); int php_oci_lob_is_equal(php_oci_descriptor *descriptor_first, php_oci_descriptor *descriptor_second, boolean *result TSRMLS_DC); -#if defined(HAVE_OCI_LOB_READ2) sb4 php_oci_lob_callback(dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, dvoid **changed_bufpp, oraub8 *changed_lenp); -#else -sb4 php_oci_lob_callback(dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece); -#endif /* }}} */ /* {{{ collection related prototypes */ @@ -521,11 +492,9 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, p /* }}} */ ZEND_BEGIN_MODULE_GLOBALS(oci) /* {{{ Module globals */ - sword errcode; /* global last error code (used when connect fails, for example) */ + sb4 errcode; /* global last ORA- error number. Used when connect fails, for example */ OCIError *err; /* global error handle */ - zend_bool debug_mode; /* debug mode flag */ - long max_persistent; /* maximum number of persistent connections per process */ long num_persistent; /* number of existing persistent connections */ long num_links; /* non-persistent + persistent connections */ diff --git a/ext/oci8/tests/bind_char_1.phpt b/ext/oci8/tests/bind_char_1.phpt index d68991a7f2baf..dc162ff943182 100644 --- a/ext/oci8/tests/bind_char_1.phpt +++ b/ext/oci8/tests/bind_char_1.phpt @@ -6,15 +6,8 @@ if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 10 && $matches[2] >= 2) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2) - ))) { - die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 11) { - die("skip test expected to work only with Oracle 11g or greater version of client"); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bind_char_1_11gR1.phpt b/ext/oci8/tests/bind_char_1_11gR1.phpt index 2a7c713aa7f15..bdc29f766dab3 100644 --- a/ext/oci8/tests/bind_char_1_11gR1.phpt +++ b/ext/oci8/tests/bind_char_1_11gR1.phpt @@ -6,11 +6,8 @@ if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 11 && $matches[2] == 1) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) - ))) { - die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); +if (!(isset($matches[0]) && $matches[1] < 12)) { + die("skip expected output only valid when using pre-Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bind_char_2.phpt b/ext/oci8/tests/bind_char_2.phpt index 3695c85854904..9c61a858c8e71 100644 --- a/ext/oci8/tests/bind_char_2.phpt +++ b/ext/oci8/tests/bind_char_2.phpt @@ -6,15 +6,8 @@ if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 10 && $matches[2] >= 2) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2) - ))) { - die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 11) { - die("skip test expected to work only with Oracle 11g or greater version of client"); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bind_char_2_11gR1.phpt b/ext/oci8/tests/bind_char_2_11gR1.phpt index b9afd6940bcca..06c37afc93e20 100644 --- a/ext/oci8/tests/bind_char_2_11gR1.phpt +++ b/ext/oci8/tests/bind_char_2_11gR1.phpt @@ -6,11 +6,8 @@ if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 11 && $matches[2] == 1) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) - ))) { - die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); +if (!(isset($matches[0]) && $matches[1] < 12)) { + die("skip expected output only valid when using pre-Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bind_char_3.phpt b/ext/oci8/tests/bind_char_3.phpt index 009e60a542b6a..177676e25ca3b 100644 --- a/ext/oci8/tests/bind_char_3.phpt +++ b/ext/oci8/tests/bind_char_3.phpt @@ -6,15 +6,8 @@ if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 10 && $matches[2] >= 2) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2) - ))) { - die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 11) { - die("skip test expected to work only with Oracle 11g or greater version of client"); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bind_char_3_11gR1.phpt b/ext/oci8/tests/bind_char_3_11gR1.phpt index a894de00c075f..c3ec999d0f10d 100644 --- a/ext/oci8/tests/bind_char_3_11gR1.phpt +++ b/ext/oci8/tests/bind_char_3_11gR1.phpt @@ -6,11 +6,8 @@ if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 11 && $matches[2] == 1) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) - ))) { - die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); +if (!(isset($matches[0]) && $matches[1] < 12)) { + die("skip expected output only valid when using pre-Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bind_char_4.phpt b/ext/oci8/tests/bind_char_4.phpt index 0ac60e503de87..b4d3e089b136f 100644 --- a/ext/oci8/tests/bind_char_4.phpt +++ b/ext/oci8/tests/bind_char_4.phpt @@ -6,15 +6,8 @@ if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 10 && $matches[2] >= 2) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2) - ))) { - die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 11) { - die("skip test expected to work only with Oracle 11g or greater version of client"); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bind_char_4_11gR1.phpt b/ext/oci8/tests/bind_char_4_11gR1.phpt index d5ce116afb65a..ccad2cb7894c1 100644 --- a/ext/oci8/tests/bind_char_4_11gR1.phpt +++ b/ext/oci8/tests/bind_char_4_11gR1.phpt @@ -6,11 +6,8 @@ if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 11 && $matches[2] == 1) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) - ))) { - die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); +if (!(isset($matches[0]) && $matches[1] < 12)) { + die("skip expected output only valid when using pre-Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bind_misccoltypes.phpt b/ext/oci8/tests/bind_misccoltypes.phpt index 0da8c8bf8803a..9e55b3b1ff74b 100644 --- a/ext/oci8/tests/bind_misccoltypes.phpt +++ b/ext/oci8/tests/bind_misccoltypes.phpt @@ -4,9 +4,6 @@ Bind miscellaneous column types using default types true, 'timesten' => false); // test runs on these DBs require(dirname(__FILE__).'/skipif.inc'); -if (preg_match('/^1[012]\./', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 10g or greater version of client"); -} ?> --FILE-- --INI-- precision = 14 diff --git a/ext/oci8/tests/bind_sqltnum.phpt b/ext/oci8/tests/bind_sqltnum.phpt index d3828b73eea95..93fc4809ec10d 100644 --- a/ext/oci8/tests/bind_sqltnum.phpt +++ b/ext/oci8/tests/bind_sqltnum.phpt @@ -3,9 +3,6 @@ Bind with SQLT_NUM --SKIPIF-- --FILE-- --FILE-- = 2) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2) - ))) { - die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 11) { - die("skip test expected to work only with Oracle 11g or greater version of client"); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bug27303_1_11gR1.phpt b/ext/oci8/tests/bug27303_1_11gR1.phpt index 7b4c158561959..d2018783bc925 100644 --- a/ext/oci8/tests/bug27303_1_11gR1.phpt +++ b/ext/oci8/tests/bug27303_1_11gR1.phpt @@ -6,12 +6,8 @@ if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 10 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) || - ($matches[1] == 11 && $matches[2] == 1 && $matches[3] == 0 && $matches[4] == 6) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) - ))) { - die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases"); +if (!(isset($matches[0]) && $matches[1] < 12)) { + die("skip expected output only valid when using pre-Oracle 12c database"); } ?> --FILE-- diff --git a/ext/oci8/tests/bug27303_2.phpt b/ext/oci8/tests/bug27303_2.phpt index 72d4e5a7ddbcf..ee2f7b52aa5e6 100644 --- a/ext/oci8/tests/bug27303_2.phpt +++ b/ext/oci8/tests/bug27303_2.phpt @@ -6,15 +6,8 @@ if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 10 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2) - ))) { - die("skip expected output only valid when using Oracle 10.2.0.2 or 11.2.0.2 databases"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 11) { - die("skip test expected to work only with Oracle 11g or greater version of client"); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bug27303_2_11gR1.phpt b/ext/oci8/tests/bug27303_2_11gR1.phpt index 27d8a585bd452..06133e0115723 100644 --- a/ext/oci8/tests/bug27303_2_11gR1.phpt +++ b/ext/oci8/tests/bug27303_2_11gR1.phpt @@ -6,12 +6,8 @@ if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 10 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) || - ($matches[1] == 11 && $matches[2] == 1 && $matches[3] == 0 && $matches[4] == 6) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) - ))) { - die("skip expected output only valid when using specific Oracle database versions"); +if (!(isset($matches[0]) && $matches[1] < 12)) { + die("skip expected output only valid when using pre-Oracle 12c database"); } ?> --FILE-- diff --git a/ext/oci8/tests/bug27303_4.phpt b/ext/oci8/tests/bug27303_4.phpt index a24ae705aba57..ed9d5a1fe6d43 100644 --- a/ext/oci8/tests/bug27303_4.phpt +++ b/ext/oci8/tests/bug27303_4.phpt @@ -6,16 +6,8 @@ if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 10 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2) - ))) { - die("skip expected output only valid when using Oracle 10.2.0.2 or 11.2.0.2 databases"); - // Other point releases may also work -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 11) { - die("skip test expected to work only with Oracle 11g or greater version of client"); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bug27303_4_11gR1.phpt b/ext/oci8/tests/bug27303_4_11gR1.phpt index 01db1dc5a0bef..550d89fdcc52f 100644 --- a/ext/oci8/tests/bug27303_4_11gR1.phpt +++ b/ext/oci8/tests/bug27303_4_11gR1.phpt @@ -6,12 +6,8 @@ if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 10 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) || - ($matches[1] == 11 && $matches[2] == 1 && $matches[3] == 0 && $matches[4] == 6) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) - ))) { - die("skip expected output only valid when using specific Oracle database versions"); +if (!(isset($matches[0]) && $matches[1] < 12)) { + die("skip expected output only valid when using pre-Oracle 12c database"); } ?> --FILE-- diff --git a/ext/oci8/tests/bug36403.phpt b/ext/oci8/tests/bug36403.phpt index 4ac32c4b069a5..122b06bbfa2b0 100644 --- a/ext/oci8/tests/bug36403.phpt +++ b/ext/oci8/tests/bug36403.phpt @@ -3,10 +3,6 @@ Bug #36403 (oci_execute no longer supports OCI_DESCRIBE_ONLY) --SKIPIF-- --FILE-- true, 'timesten' => false); // test runs on these DBs require(dirname(__FILE__).'/skipif.inc'); if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request'); -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 10) { - die("skip test expected to work only with Oracle 10g or greater version of client"); -} ?> --FILE-- true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request'); -ob_start(); -phpinfo(INFO_MODULES); -$phpinfo = ob_get_clean(); -$iv = preg_match('/Oracle .*Version => (9\.2)/', $phpinfo); -if ($iv != 1) { - die ("skip tests a feature that works only with Oracle 9iR2 client"); -} -?> ---FILE-- -free(); // cleanup properly - ++$cntchk; - } - } - echo "Loop count check = $cntchk\n"; -} - -// Read all XML data using explicit LOB locator but without freeing the temp lobs -function readxmltab_ex_nofree($c) -{ - $stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab"); - - $cntchk = 0; - if (oci_execute($stmt)) { - while ($result = oci_fetch_array($stmt, OCI_NUM)) { - ++$cntchk; - } - } - echo "Loop count check = $cntchk\n"; -} - -// Read all XML data using implicit LOB locator -function readxmltab_im($c) -{ - $stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab"); - - $cntchk = 0; - if (oci_execute($stmt)) { - while ($result = oci_fetch_array($stmt, OCI_NUM+OCI_RETURN_LOBS)) { - ++$cntchk; - } - } - echo "Loop count check = $cntchk\n"; -} - -function createxmltab($c) // create table w/ field of XML type -{ - @dropxmltab($c); - $stmt = oci_parse($c, "create table bug43497_tab (id number primary key, xml xmltype)"); - oci_execute($stmt); -} - -function dropxmltab($c) // delete table -{ - $stmt = oci_parse($c, "drop table bug43497_tab"); - oci_execute($stmt); -} - - -function fillxmltab($c) -{ - for ($id = 1; $id <= 100; $id++) { - - // create an XML element string with random data - $s = ""; - for ($j = 0; $j < 128; $j++) { - $s .= rand(); - } - $s .= "\n"; - for ($j = 0; $j < 4; $j++) { - $s .= $s; - } - $data = "" . $s . ""; - - // insert XML data into database - - $stmt = oci_parse($c, "insert into bug43497_tab(id, xml) values (:id, sys.xmltype.createxml(:xml))"); - oci_bind_by_name($stmt, ":id", $id); - $clob = oci_new_descriptor($c, OCI_D_LOB); - oci_bind_by_name($stmt, ":xml", $clob, -1, OCI_B_CLOB); - $clob->writetemporary($data); - oci_execute($stmt); - - $clob->close(); - $clob->free(); - } -} - - -// Initialize - -createxmltab($c); -fillxmltab($c); - -// Run Test - -$sid = sessionid($c); - -echo "Explicit LOB use\n"; -for ($i = 1; $i <= 10; $i++) { - echo "\nRun = " . $i . "\n"; - echo "Temporary LOBs = " . templobs($c, $sid) . "\n"; - readxmltab_ex($c); -} - -echo "\nImplicit LOB use\n"; -for ($i = 1; $i <= 10; $i++) { - echo "\nRun = " . $i . "\n"; - echo "Temporary LOBs = " . templobs($c, $sid) . "\n"; - readxmltab_im($c); -} - -echo "\nExplicit LOB with no free (i.e. a temp lob leak)\n"; -for ($i = 1; $i <= 10; $i++) { - echo "\nRun = " . $i . "\n"; - echo "Temporary LOBs = " . templobs($c, $sid) . "\n"; - readxmltab_ex_nofree($c); -} - - - -// Cleanup - -dropxmltab($c); - -oci_close($c); - -echo "Done\n"; -?> ---EXPECT-- -Explicit LOB use - -Run = 1 -Temporary LOBs = 0 -Loop count check = 100 - -Run = 2 -Temporary LOBs = 100 -Loop count check = 100 - -Run = 3 -Temporary LOBs = 200 -Loop count check = 100 - -Run = 4 -Temporary LOBs = 300 -Loop count check = 100 - -Run = 5 -Temporary LOBs = 400 -Loop count check = 100 - -Run = 6 -Temporary LOBs = 500 -Loop count check = 100 - -Run = 7 -Temporary LOBs = 600 -Loop count check = 100 - -Run = 8 -Temporary LOBs = 700 -Loop count check = 100 - -Run = 9 -Temporary LOBs = 800 -Loop count check = 100 - -Run = 10 -Temporary LOBs = 900 -Loop count check = 100 - -Implicit LOB use - -Run = 1 -Temporary LOBs = 1000 -Loop count check = 100 - -Run = 2 -Temporary LOBs = 1100 -Loop count check = 100 - -Run = 3 -Temporary LOBs = 1200 -Loop count check = 100 - -Run = 4 -Temporary LOBs = 1300 -Loop count check = 100 - -Run = 5 -Temporary LOBs = 1400 -Loop count check = 100 - -Run = 6 -Temporary LOBs = 1500 -Loop count check = 100 - -Run = 7 -Temporary LOBs = 1600 -Loop count check = 100 - -Run = 8 -Temporary LOBs = 1700 -Loop count check = 100 - -Run = 9 -Temporary LOBs = 1800 -Loop count check = 100 - -Run = 10 -Temporary LOBs = 1900 -Loop count check = 100 - -Explicit LOB with no free (i.e. a temp lob leak) - -Run = 1 -Temporary LOBs = 2000 -Loop count check = 100 - -Run = 2 -Temporary LOBs = 2100 -Loop count check = 100 - -Run = 3 -Temporary LOBs = 2200 -Loop count check = 100 - -Run = 4 -Temporary LOBs = 2300 -Loop count check = 100 - -Run = 5 -Temporary LOBs = 2400 -Loop count check = 100 - -Run = 6 -Temporary LOBs = 2500 -Loop count check = 100 - -Run = 7 -Temporary LOBs = 2600 -Loop count check = 100 - -Run = 8 -Temporary LOBs = 2700 -Loop count check = 100 - -Run = 9 -Temporary LOBs = 2800 -Loop count check = 100 - -Run = 10 -Temporary LOBs = 2900 -Loop count check = 100 -Done \ No newline at end of file diff --git a/ext/oci8/tests/bug47281.phpt b/ext/oci8/tests/bug47281.phpt index 0098ec5ebb772..00c43c22dac7c 100644 --- a/ext/oci8/tests/bug47281.phpt +++ b/ext/oci8/tests/bug47281.phpt @@ -6,9 +6,9 @@ $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on t require(dirname(__FILE__).'/skipif.inc'); // error3.phpt obsoletes this test for newer Oracle client versions // Assume runtime client version is >= compile time client version -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); if (!isset($matches[0]) || - ($matches[0] > 11 || ($matches[0] == 11 && $matches[1] > 2) || ($matches[0] == 11 && $matches[1] == 2 && $matches[3] >= 3) + ($matches[1] > 11 || ($matches[1] == 11 && $matches[2] > 2) || ($matches[1] == 11 && $matches[2] == 2 && $matches[4] >= 3) )) { die("skip test works only with Oracle 11.2.0.2 or earlier Oracle client libraries"); } diff --git a/ext/oci8/tests/clientversion.phpt b/ext/oci8/tests/clientversion.phpt index db70b5affcea4..262ded462f9d9 100644 --- a/ext/oci8/tests/clientversion.phpt +++ b/ext/oci8/tests/clientversion.phpt @@ -3,9 +3,6 @@ oci_client_version() --SKIPIF-- --FILE-- ---FILE-- - -===DONE=== - ---EXPECTF-- -Unknown -===DONE=== diff --git a/ext/oci8/tests/conn_attr_1.phpt b/ext/oci8/tests/conn_attr_1.phpt index 631bc19c1d416..745b1cd93f906 100644 --- a/ext/oci8/tests/conn_attr_1.phpt +++ b/ext/oci8/tests/conn_attr_1.phpt @@ -13,10 +13,6 @@ preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit if (!(isset($matches[0]) && $matches[1] >= 10)) { die("skip expected output only valid when using Oracle 10g or greater database server"); } -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 10) { - die("skip test expected to work only with Oracle 10g or greater version of client"); -} ?> --FILE-- = 10)) { die("skip expected output only valid when using Oracle 10g or greater database server"); } -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 10) { - die("skip test expected to work only with Oracle 10g or greater version of client"); -} ?> --INI-- oci8.privileged_connect = On diff --git a/ext/oci8/tests/conn_attr_3.phpt b/ext/oci8/tests/conn_attr_3.phpt index 921487c9a00e1..1b00ac5a4ff45 100644 --- a/ext/oci8/tests/conn_attr_3.phpt +++ b/ext/oci8/tests/conn_attr_3.phpt @@ -12,10 +12,6 @@ preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit if (!(isset($matches[0]) && $matches[1] >= 10)) { die("skip expected output only valid when using Oracle 10g or greater database server"); } -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 10) { - die("skip test expected to work only with Oracle 10g or greater version of client"); -} ?> --FILE-- --FILE-- = 10)) { die("skip expected output only valid when using Oracle 10g or greater database server"); } -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 10) { - die("skip test expected to work only with Oracle 10g or greater version of client"); -} ?> --FILE-- --ENV-- diff --git a/ext/oci8/tests/connect_without_oracle_home_11.phpt b/ext/oci8/tests/connect_without_oracle_home_11.phpt index 40dc5a98fc7e3..42c45644567c4 100644 --- a/ext/oci8/tests/connect_without_oracle_home_11.phpt +++ b/ext/oci8/tests/connect_without_oracle_home_11.phpt @@ -10,10 +10,10 @@ $ov = preg_match('/Compile-time ORACLE_HOME/', $phpinfo); if ($ov != 1) { die ("skip Test only valid when OCI8 is built with an ORACLE_HOME"); } -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); if (!(isset($matches[0]) && - (($matches[0] == 11 && $matches[1] >= 2) || - ($matches[0] >= 12) + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) ))) { die("skip test expected to work only with Oracle 11gR2 or greater version of client"); } diff --git a/ext/oci8/tests/connect_without_oracle_home_old.phpt b/ext/oci8/tests/connect_without_oracle_home_old.phpt index 5a731337af13c..d6d12b47ba338 100644 --- a/ext/oci8/tests/connect_without_oracle_home_old.phpt +++ b/ext/oci8/tests/connect_without_oracle_home_old.phpt @@ -10,9 +10,6 @@ $ov = preg_match('/Compile-time ORACLE_HOME/', $phpinfo); if ($ov !== 1) { die ("skip Test only valid when OCI8 is built with an ORACLE_HOME"); } -if (preg_match('/^10\.2\./', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 10gR2 client libraries"); -} ?> --ENV-- ORACLE_HOME="" @@ -33,5 +30,8 @@ else { --EXPECTF-- Warning: ocilogon(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and %s are set and point to the right directories in %s on line %d + +Warning: ocilogon(): %s ORA-01804 + in %s on line %d bool(false) ===DONE=== diff --git a/ext/oci8/tests/connect_without_oracle_home_old_11.phpt b/ext/oci8/tests/connect_without_oracle_home_old_11.phpt index e04016f41a766..eb5fb0cc4d333 100644 --- a/ext/oci8/tests/connect_without_oracle_home_old_11.phpt +++ b/ext/oci8/tests/connect_without_oracle_home_old_11.phpt @@ -10,10 +10,10 @@ $ov = preg_match('/Compile-time ORACLE_HOME/', $phpinfo); if ($ov !== 1) { die ("skip Test only valid when OCI8 is built with an ORACLE_HOME"); } -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); if (!(isset($matches[0]) && - (($matches[0] == 11 && $matches[1] >= 2) || - ($matches[0] >= 12) + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) ))) { die("skip test expected to work only with Oracle 11gR2 or greater version of client"); } diff --git a/ext/oci8/tests/db_op_1.phpt b/ext/oci8/tests/db_op_1.phpt new file mode 100644 index 0000000000000..f645cf80ff3b2 --- /dev/null +++ b/ext/oci8/tests/db_op_1.phpt @@ -0,0 +1,61 @@ +--TEST-- +oci_set_db_operation: basic test for end-to-end tracing +--SKIPIF-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +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); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +if (!function_exists('oci_set_db_operation')) +{ + die("skip function oci_set_db_operation() does not exist"); +} +?> +--FILE-- + +===DONE=== + +--EXPECTF-- +Test 1 +array(1) { + ["DUMMY"]=> + string(1) "X" +} +array(1) { + ["DBOP_NAME"]=> + string(7) "db_op_1" +} +===DONE=== + diff --git a/ext/oci8/tests/db_op_2.phpt b/ext/oci8/tests/db_op_2.phpt new file mode 100644 index 0000000000000..05c2269ae0bfd --- /dev/null +++ b/ext/oci8/tests/db_op_2.phpt @@ -0,0 +1,69 @@ +--TEST-- +oci_set_db_operation: basic test for end-to-end tracing +--SKIPIF-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +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); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +if (!function_exists('oci_set_db_operation')) +{ + die("skip function oci_set_db_operation() does not exist"); +} +?> +--FILE-- + +===DONE=== + +--XFAIL-- +Fails due to Oracle Bug 16695981 +--EXPECTF-- +Test 1 +array(1) { + ["DUMMY"]=> + string(1) "X" +} +Test 2 +array(1) { + ["DUMMY"]=> + string(1) "X" +} +Test 3 +array(2) { + ["DBOP_NAME"]=> + string(7) "db_op_2a" +} +===DONE=== + diff --git a/ext/oci8/tests/drcp_cclass1.phpt b/ext/oci8/tests/drcp_cclass1.phpt index 068331e5a95ae..5c78a2943e94e 100644 --- a/ext/oci8/tests/drcp_cclass1.phpt +++ b/ext/oci8/tests/drcp_cclass1.phpt @@ -3,9 +3,21 @@ DRCP: Test setting connection class inline --SKIPIF-- = 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-- += 11)) { + die("skip works only with Oracle 11g or greater version of Oracle client libraries"); +} +?> --INI-- oci8.connection_class=test --FILE-- diff --git a/ext/oci8/tests/drcp_privileged.phpt b/ext/oci8/tests/drcp_privileged.phpt index da8702e3c9204..3871341bc50cc 100644 --- a/ext/oci8/tests/drcp_privileged.phpt +++ b/ext/oci8/tests/drcp_privileged.phpt @@ -3,7 +3,8 @@ DRCP: privileged connect --SKIPIF-- = 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'); +} ?> --INI-- oci8.privileged_connect=1 diff --git a/ext/oci8/tests/driver_name.phpt b/ext/oci8/tests/driver_name.phpt index bf86e66e7b64f..f63979d6b54c0 100644 --- a/ext/oci8/tests/driver_name.phpt +++ b/ext/oci8/tests/driver_name.phpt @@ -7,10 +7,19 @@ require(dirname(__FILE__)."/connect.inc"); if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user"); if ($test_drcp) die("skip as Output might vary with DRCP"); -if (preg_match('/Release (11\.2|12)/', oci_server_version($c), $matches) !== 1) { - die("skip expected output only valid when using Oracle 11gR2 or greater databases"); -} else if (preg_match('/^(11\.2|12\.)/', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 11g or greater version of client"); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { + die("skip expected output only valid when using Oracle 11gR2 or greater database server"); +} +preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { + die("skip test expected to work only with Oracle 11gR2 or greater version of client"); } ?> diff --git a/ext/oci8/tests/edition_1.phpt b/ext/oci8/tests/edition_1.phpt index d8ca53cddf061..3e55ee902c970 100644 --- a/ext/oci8/tests/edition_1.phpt +++ b/ext/oci8/tests/edition_1.phpt @@ -10,9 +10,18 @@ if (strcasecmp($user, "system") && strcasecmp($user, "sys")) { if ($test_drcp) { die("skip as Output might vary with DRCP"); } -if (preg_match('/Release (1[1]\.2|12)\./', oci_server_version($c), $matches) !== 1) { - die("skip expected output only valid when using Oracle 11gR2 or greater databases"); -} else if (preg_match('/^(11\.2|12)\./', oci_client_version()) != 1) { +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { + die("skip expected output only valid when using Oracle 11gR2 or greater database server"); +} +preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { die("skip test expected to work only with Oracle 11gR2 or greater version of client"); } ?> diff --git a/ext/oci8/tests/edition_2.phpt b/ext/oci8/tests/edition_2.phpt index 0ffb62dc32633..12e902667e621 100644 --- a/ext/oci8/tests/edition_2.phpt +++ b/ext/oci8/tests/edition_2.phpt @@ -8,10 +8,18 @@ if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user"); if ($test_drcp) die("skip as Output might vary with DRCP"); - -if (preg_match('/Release (1[1]\.2|12)\./', oci_server_version($c), $matches) !== 1) { - die("skip expected output only valid when using Oracle 11gR2 or greater databases"); -} else if (preg_match('/^(11\.2|12)\./', oci_client_version()) != 1) { +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { + die("skip expected output only valid when using Oracle 11gR2 or greater database server"); +} +preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { die("skip test expected to work only with Oracle 11gR2 or greater version of client"); } diff --git a/ext/oci8/tests/error_set.phpt b/ext/oci8/tests/error_set.phpt new file mode 100644 index 0000000000000..ad56e8aefadb1 --- /dev/null +++ b/ext/oci8/tests/error_set.phpt @@ -0,0 +1,72 @@ +--TEST-- +Check oci_set_{action,client_identifier,module_name,client_info} error handling +--SKIPIF-- + +--FILE-- + +===DONE=== + +--EXPECTF-- +Test 1 +bool(false) +24960 +bool(false) +24960 +bool(false) +24960 +bool(false) +24960 + +Test 2 +bool(true) +bool(true) +bool(true) +bool(true) +===DONE=== diff --git a/ext/oci8/tests/function_aliases.phpt b/ext/oci8/tests/function_aliases.phpt index 4c6ce8375965c..2c890d6403ca2 100644 --- a/ext/oci8/tests/function_aliases.phpt +++ b/ext/oci8/tests/function_aliases.phpt @@ -104,8 +104,6 @@ NULL Warning: ocifreestatement() expects exactly 1 parameter, 0 given in %s on line %d NULL - -Warning: ociinternaldebug() expects exactly 1 parameter, 0 given in %s on line %d NULL Warning: ocinumcols() expects exactly 1 parameter, 0 given in %s on line %d diff --git a/ext/oci8/tests/ini_1.phpt b/ext/oci8/tests/ini_1.phpt index 4c23b72b41fdb..2fba79813e845 100644 --- a/ext/oci8/tests/ini_1.phpt +++ b/ext/oci8/tests/ini_1.phpt @@ -1,7 +1,13 @@ --TEST-- Test OCI8 php.ini settings --SKIPIF-- - += 11)) { + die("skip works only with Oracle 11g or greater version of Oracle client libraries"); +} +?> --INI-- oci8.privileged_connect = On oci8.max_persistent = 111 diff --git a/ext/oci8/tests/password_new.phpt b/ext/oci8/tests/password_new.phpt index 2c66dd94ab7dc..a29fb8f52ff2b 100644 --- a/ext/oci8/tests/password_new.phpt +++ b/ext/oci8/tests/password_new.phpt @@ -8,15 +8,18 @@ if (empty($dbase)) die ("skip requires database connection string be set"); if ($test_drcp) die("skip password change not supported in DRCP Mode"); preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches_sv); -if (isset($matches_sv[1]) && $matches_sv[1] >= 11) { - preg_match('/([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); - if (isset($matches[0]) && $matches[1] == 10 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] < 5) { - die ("skip test known to fail using Oracle 10.2.0.4 client libs connecting to Oracle 11 (6277160)"); - } +preg_match('/([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!(isset($matches_sv[0]) && isset($matches[0]) + && $matches_sv[1] == $matches[1] + && $matches_sv[2] == $matches[2] + && $matches_sv[3] == $matches[3] + && $matches_sv[4] == $matches[4])) { + // Avoid diffs due to cross version protocol changes (e.g. like 11.2.0.2-11.2.0.3) and bugs like Oracle bug: 6277160 + die ("skip test only runs when database client libraries and database server are the same version"); } // This test in Oracle 12c needs a non-CDB or the root container -if (isset($matches_sv[1]) && $matches_sv[1] >= 12) { +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) @@ -29,22 +32,11 @@ if (isset($matches_sv[1]) && $matches_sv[1] >= 12) { --FILE-- = 11) { - preg_match('/([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); - if (isset($matches[0]) && $matches[1] == 10 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] < 5) { - die ("skip test known to fail using Oracle 10.2.0.4 client libs connecting to Oracle 11 (6277160)"); - } +preg_match('/([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!(isset($matches_sv[0]) && isset($matches[0]) + && $matches_sv[1] == $matches[1] + && $matches_sv[2] == $matches[2] + && $matches_sv[3] == $matches[3] + && $matches_sv[4] == $matches[4])) { + // Avoid diffs due to cross version protocol changes (e.g. like 11.2.0.2-11.2.0.3) and bugs like Oracle bug: 6277160 + die ("skip test only runs when database client libraries and database server are the same version"); } // This test in Oracle 12c needs a non-CDB or the root container -if (isset($matches_sv[1]) && $matches_sv[1] >= 12) { +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) @@ -29,25 +32,13 @@ if (isset($matches_sv[1]) && $matches_sv[1] >= 12) { --FILE-- diff --git a/ext/oci8/tests/pecl_bug16035.phpt b/ext/oci8/tests/pecl_bug16035.phpt index ddd0038de1524..29ff6439d1c8a 100644 --- a/ext/oci8/tests/pecl_bug16035.phpt +++ b/ext/oci8/tests/pecl_bug16035.phpt @@ -10,9 +10,6 @@ $ov = preg_match('/Compile-time ORACLE_HOME/', $phpinfo); if ($ov !== 1) { die ("skip Test only valid when OCI8 is built with an ORACLE_HOME"); } -if (preg_match('/Unknown/', oci_client_version()) == 1) { - die("skip expected output only valid with Oracle clients > 9gR2"); -} ?> --ENV-- ORACLE_HOME="" diff --git a/ext/oci8/tests/refcur_prefetch_1.phpt b/ext/oci8/tests/refcur_prefetch_1.phpt index ea09fbcd979cf..c7e200932aece 100644 --- a/ext/oci8/tests/refcur_prefetch_1.phpt +++ b/ext/oci8/tests/refcur_prefetch_1.phpt @@ -4,9 +4,16 @@ Prefetch with REF cursor. Test different values for prefetch with oci_set_prefet = 10))) { + die("skip expected output only valid when using Oracle 10g or greater database server"); +} +preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { die("skip test expected to work only with Oracle 11gR2 or greater version of client"); } ?> diff --git a/ext/oci8/tests/refcur_prefetch_2.phpt b/ext/oci8/tests/refcur_prefetch_2.phpt index 8d65251077ea3..9b2472db5df44 100644 --- a/ext/oci8/tests/refcur_prefetch_2.phpt +++ b/ext/oci8/tests/refcur_prefetch_2.phpt @@ -4,9 +4,16 @@ Prefetch with REF cursor. Test No 2 = 10))) { + die("skip expected output only valid when using Oracle 10g or greater database server"); +} +preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { die("skip test expected to work only with Oracle 11gR2 or greater version of client"); } ?> diff --git a/ext/oci8/tests/refcur_prefetch_3.phpt b/ext/oci8/tests/refcur_prefetch_3.phpt index 974864cbd90e7..f29345e515d47 100644 --- a/ext/oci8/tests/refcur_prefetch_3.phpt +++ b/ext/oci8/tests/refcur_prefetch_3.phpt @@ -6,12 +6,20 @@ oci8.default_prefetch=5 = 2) || + ($matches[1] >= 12) + ))) { + die("skip expected output only valid when using Oracle 11gR2 or greater database server"); +} +preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { die("skip test expected to work only with Oracle 11gR2 or greater version of client"); } - ?> --FILE-- = 10))) { + die("skip expected output only valid when using Oracle 10g or greater database server"); +} +preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { die("skip test expected to work only with Oracle 11gR2 or greater version of client"); } ?> diff --git a/ext/odbc/php_odbc_includes.h b/ext/odbc/php_odbc_includes.h index ca237c0537bf7..c00583b16a215 100644 --- a/ext/odbc/php_odbc_includes.h +++ b/ext/odbc/php_odbc_includes.h @@ -232,7 +232,7 @@ typedef struct odbc_connection { } odbc_connection; typedef struct odbc_result_value { - char name[32]; + char name[256]; char *value; SQLLEN vallen; SQLLEN coltype; diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c index 7f874e7a4b89f..a4e661e3f897a 100644 --- a/ext/opcache/Optimizer/block_pass.c +++ b/ext/opcache/Optimizer/block_pass.c @@ -562,7 +562,6 @@ static void strip_nop(zend_code_block *block) { zend_op *opline = block->start_opline; zend_op *end, *new_end; - int new_len = 0; /* remove leading NOPs */ while (block->len > 0 && block->start_opline->opcode == ZEND_NOP) { @@ -1284,11 +1283,15 @@ static void assemble_code_blocks(zend_cfg *cfg, zend_op_array *op_array) /* adjust exception jump targets */ if (op_array->last_try_catch) { - int i; - for (i = 0; i< op_array->last_try_catch; i++) { - op_array->try_catch_array[i].try_op = cfg->try[i]->start_opline - new_opcodes; - op_array->try_catch_array[i].catch_op = cfg->catch[i]->start_opline - new_opcodes; + int i, j; + for (i = 0, j = 0; i< op_array->last_try_catch; i++) { + if (cfg->try[i]->access) { + op_array->try_catch_array[j].try_op = cfg->try[i]->start_opline - new_opcodes; + op_array->try_catch_array[j].catch_op = cfg->catch[i]->start_opline - new_opcodes; + j++; + } } + op_array->last_try_catch = j; efree(cfg->try); efree(cfg->catch); } @@ -1896,7 +1899,7 @@ static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_arra #endif /* Find a set of variables which are used outside of the block where they are - * defined. We won't apply some optimization patterns for sush variables. */ + * defined. We won't apply some optimization patterns for such variables. */ static void zend_t_usage(zend_code_block *block, zend_op_array *op_array, char *used_ext) { zend_code_block *next_block = block->next; @@ -1928,6 +1931,7 @@ static void zend_t_usage(zend_code_block *block, zend_op_array *op_array, char * if (RESULT_USED(opline)) { if (!defined_here[VAR_NUM(ZEND_RESULT(opline).var)] && !used_ext[VAR_NUM(ZEND_RESULT(opline).var)] && (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT || + opline->opcode == ZEND_RECV_VARIADIC || (opline->opcode == ZEND_OP_DATA && ZEND_RESULT_TYPE(opline) == IS_TMP_VAR) || opline->opcode == ZEND_ADD_ARRAY_ELEMENT)) { /* these opcodes use the result as argument */ @@ -2012,6 +2016,7 @@ static void zend_t_usage(zend_code_block *block, zend_op_array *op_array, char * if (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT || + opline->opcode == ZEND_RECV_VARIADIC || opline->opcode == ZEND_ADD_ARRAY_ELEMENT) { if (ZEND_OP1_TYPE(opline) == IS_VAR || ZEND_OP1_TYPE(opline) == IS_TMP_VAR) { usage[VAR_NUM(ZEND_RESULT(opline).var)] = 1; diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c index 8c8253757e06b..2960e583aa35c 100644 --- a/ext/opcache/Optimizer/pass1_5.c +++ b/ext/opcache/Optimizer/pass1_5.c @@ -37,7 +37,6 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC) = get_binary_op(opline->opcode); zend_uint tv = ZEND_RESULT(opline).var; /* temporary variable */ zval result; - zend_op *tmp_opline; int er; if (opline->opcode == ZEND_DIV && @@ -61,95 +60,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { literal_dtor(&ZEND_OP2_LITERAL(opline)); MAKE_NOP(opline); - /* substitute the following TMP_VAR usage with constant */ - for (tmp_opline = opline + 1; tmp_opline < end; tmp_opline++) { - if (ZEND_OP1_TYPE(tmp_opline) == IS_TMP_VAR && - ZEND_OP1(tmp_opline).var == tv) { - if (tmp_opline->opcode == ZEND_FREE) { - MAKE_NOP(tmp_opline); - zval_dtor(&result); - } else { - ZEND_OP1_TYPE(tmp_opline) = IS_CONST; -#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO - tmp_opline->op1.constant = zend_optimizer_add_literal(op_array, &result TSRMLS_CC); - if (Z_TYPE(result) == IS_STRING) { - Z_HASH_P(&ZEND_OP1_LITERAL(tmp_opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(tmp_opline)), Z_STRLEN(ZEND_OP1_LITERAL(tmp_opline)) + 1); - if (tmp_opline->opcode == ZEND_INIT_STATIC_METHOD_CALL || - tmp_opline->opcode == ZEND_DO_FCALL || - tmp_opline->opcode == ZEND_CATCH || - tmp_opline->opcode == ZEND_FETCH_CONSTANT) { - op_array->literals[tmp_opline->op1.constant].cache_slot = op_array->last_cache_slot++; - } - } -#else - ZEND_OP1_LITERAL(tmp_opline) = result; -#endif - } - /* TMP_VAR my be used only once */ - break; - } - if (ZEND_OP2_TYPE(tmp_opline) == IS_TMP_VAR && - ZEND_OP2(tmp_opline).var == tv) { - ZEND_OP2_TYPE(tmp_opline) = IS_CONST; -#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO - tmp_opline->op2.constant = zend_optimizer_add_literal(op_array, &result TSRMLS_CC); - if (Z_TYPE(result) == IS_STRING) { - Z_HASH_P(&ZEND_OP2_LITERAL(tmp_opline)) = zend_hash_func(Z_STRVAL(ZEND_OP2_LITERAL(tmp_opline)), Z_STRLEN(ZEND_OP2_LITERAL(tmp_opline)) + 1); - if (tmp_opline->opcode == ZEND_FETCH_R || - tmp_opline->opcode == ZEND_FETCH_W || - tmp_opline->opcode == ZEND_FETCH_RW || - tmp_opline->opcode == ZEND_FETCH_IS || - tmp_opline->opcode == ZEND_FETCH_UNSET || - tmp_opline->opcode == ZEND_FETCH_FUNC_ARG || - tmp_opline->opcode == ZEND_FETCH_CLASS || - tmp_opline->opcode == ZEND_INIT_FCALL_BY_NAME || - tmp_opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME || - tmp_opline->opcode == ZEND_UNSET_VAR || - tmp_opline->opcode == ZEND_ISSET_ISEMPTY_VAR || - tmp_opline->opcode == ZEND_ADD_INTERFACE || - tmp_opline->opcode == ZEND_ADD_TRAIT) { - op_array->literals[tmp_opline->op2.constant].cache_slot = op_array->last_cache_slot++; - } else if (tmp_opline->opcode == ZEND_INIT_METHOD_CALL || - tmp_opline->opcode == ZEND_INIT_STATIC_METHOD_CALL || - tmp_opline->opcode == ZEND_FETCH_CONSTANT || - tmp_opline->opcode == ZEND_ASSIGN_OBJ || - tmp_opline->opcode == ZEND_FETCH_OBJ_R || - tmp_opline->opcode == ZEND_FETCH_OBJ_W || - tmp_opline->opcode == ZEND_FETCH_OBJ_RW || - tmp_opline->opcode == ZEND_FETCH_OBJ_IS || - tmp_opline->opcode == ZEND_FETCH_OBJ_UNSET || - tmp_opline->opcode == ZEND_FETCH_OBJ_FUNC_ARG || - tmp_opline->opcode == ZEND_UNSET_OBJ || - tmp_opline->opcode == ZEND_PRE_INC_OBJ || - tmp_opline->opcode == ZEND_PRE_DEC_OBJ || - tmp_opline->opcode == ZEND_POST_INC_OBJ || - tmp_opline->opcode == ZEND_POST_DEC_OBJ || - tmp_opline->opcode == ZEND_ISSET_ISEMPTY_PROP_OBJ) { - op_array->literals[tmp_opline->op2.constant].cache_slot = op_array->last_cache_slot; - op_array->last_cache_slot += 2; - } else if (tmp_opline->opcode == ZEND_ASSIGN_ADD || - tmp_opline->opcode == ZEND_ASSIGN_SUB || - tmp_opline->opcode == ZEND_ASSIGN_MUL || - tmp_opline->opcode == ZEND_ASSIGN_DIV || - tmp_opline->opcode == ZEND_ASSIGN_MOD || - tmp_opline->opcode == ZEND_ASSIGN_SL || - tmp_opline->opcode == ZEND_ASSIGN_SR || - tmp_opline->opcode == ZEND_ASSIGN_CONCAT || - tmp_opline->opcode == ZEND_ASSIGN_BW_OR || - tmp_opline->opcode == ZEND_ASSIGN_BW_AND || - tmp_opline->opcode == ZEND_ASSIGN_BW_XOR) { - if (tmp_opline->extended_value == ZEND_ASSIGN_OBJ) { - op_array->literals[tmp_opline->op2.constant].cache_slot = op_array->last_cache_slot; - op_array->last_cache_slot += 2; - } - } - } -#else - ZEND_OP2_LITERAL(tmp_opline) = result; -#endif - break; - } - } + replace_tmp_by_const(op_array, opline + 1, tv, &result TSRMLS_CC); } break; @@ -159,6 +70,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { opline->extended_value != IS_OBJECT && opline->extended_value != IS_RESOURCE) { /* cast of constant operand */ + zend_uint tv = ZEND_RESULT(opline).var; /* temporary variable */ zval res; res = ZEND_OP1_LITERAL(opline); zval_copy_ctor(&res); @@ -179,11 +91,11 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { convert_to_string(&res); break; } + literal_dtor(&ZEND_OP1_LITERAL(opline)); - opline->opcode = ZEND_QM_ASSIGN; - opline->extended_value = 0; - ZEND_OP1_LITERAL(opline) = res; - SET_UNUSED(opline->op2); + MAKE_NOP(opline); + + replace_tmp_by_const(op_array, opline + 1, tv, &res TSRMLS_CC); } else if (opline->extended_value == IS_BOOL) { /* T = CAST(X, IS_BOOL) => T = BOOL(X) */ opline->opcode = ZEND_BOOL; @@ -197,7 +109,6 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { /* unary operation on constant operand */ unary_op_type unary_op = get_unary_op(opline->opcode); zval result; - zend_op *tmp_opline; zend_uint tv = ZEND_RESULT(opline).var; /* temporary variable */ int er; @@ -218,34 +129,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { literal_dtor(&ZEND_OP1_LITERAL(opline)); MAKE_NOP(opline); - /* substitute the following TMP_VAR usage with constant */ - for (tmp_opline = opline + 1; tmp_opline < end; tmp_opline++) { - if (ZEND_OP1_TYPE(tmp_opline) == IS_TMP_VAR && - ZEND_OP1(tmp_opline).var == tv) { - if (tmp_opline->opcode == ZEND_FREE) { - MAKE_NOP(tmp_opline); - zval_dtor(&result); - } else { - ZEND_OP1_TYPE(tmp_opline) = IS_CONST; -#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO - tmp_opline->op1.constant = zend_optimizer_add_literal(op_array, &result TSRMLS_CC); -#else - ZEND_OP1_LITERAL(tmp_opline) = result; -#endif - } - break; - } - if (ZEND_OP2_TYPE(tmp_opline) == IS_TMP_VAR && - ZEND_OP2(tmp_opline).var == tv) { - ZEND_OP2_TYPE(tmp_opline) = IS_CONST; -#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO - tmp_opline->op2.constant = zend_optimizer_add_literal(op_array, &result TSRMLS_CC); -#else - ZEND_OP2_LITERAL(tmp_opline) = result; -#endif - break; - } - } + replace_tmp_by_const(op_array, opline + 1, tv, &result TSRMLS_CC); } break; @@ -458,6 +342,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { int var = opline->result.var; int level = 0; zend_op *op = opline + 1; + zend_op *use = NULL; while (op < end) { if (op->opcode == ZEND_BEGIN_SILENCE) { @@ -470,21 +355,36 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { } } if (op->op1_type == IS_VAR && op->op1.var == var) { - op->op1_type = IS_CV; - op->op1.var = zend_optimizer_lookup_cv(op_array, + if (use) { + /* used more than once */ + use = NULL; + break; + } + use = op; + } else if (op->op2_type == IS_VAR && op->op2.var == var) { + if (use) { + /* used more than once */ + use = NULL; + break; + } + use = op; + } + op++; + } + if (use) { + if (use->op1_type == IS_VAR && use->op1.var == var) { + use->op1_type = IS_CV; + use->op1.var = zend_optimizer_lookup_cv(op_array, Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline))); MAKE_NOP(opline); - break; - } else if (op->op2_type == IS_VAR && op->op2.var == var) { - op->op2_type = IS_CV; - op->op2.var = zend_optimizer_lookup_cv(op_array, + } else if (use->op2_type == IS_VAR && use->op2.var == var) { + use->op2_type = IS_CV; + use->op2.var = zend_optimizer_lookup_cv(op_array, Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline))); MAKE_NOP(opline); - break; } - op++; } } break; diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c index a058bd73cbb14..ec36502f167b1 100644 --- a/ext/opcache/Optimizer/zend_optimizer.c +++ b/ext/opcache/Optimizer/zend_optimizer.c @@ -138,6 +138,137 @@ int zend_optimizer_add_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC #endif +static void replace_tmp_by_const(zend_op_array *op_array, + zend_op *opline, + zend_uint var, + zval *val + TSRMLS_DC) +{ + zend_op *end = op_array->opcodes + op_array->last; + + while (opline < end) { + if (ZEND_OP1_TYPE(opline) == IS_TMP_VAR && + ZEND_OP1(opline).var == var) { + + if (opline->opcode == ZEND_FREE) { + MAKE_NOP(opline); + zval_dtor(val); + } else { + ZEND_OP1_TYPE(opline) = IS_CONST; +#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO + if (Z_TYPE_P(val) == IS_STRING) { + switch (opline->opcode) { + case ZEND_INIT_STATIC_METHOD_CALL: + case ZEND_CATCH: + case ZEND_FETCH_CONSTANT: + opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); + Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1); + op_array->literals[opline->op1.constant].cache_slot = op_array->last_cache_slot++; + zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); + zend_optimizer_add_literal(op_array, val TSRMLS_CC); + op_array->literals[opline->op1.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op1.constant+1].constant), Z_STRLEN(op_array->literals[opline->op1.constant+1].constant) + 1); + break; + case ZEND_DO_FCALL: + zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); + opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); + Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1); + op_array->literals[opline->op1.constant].cache_slot = op_array->last_cache_slot++; + break; + default: + opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); + Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1); + break; + } + } else { + opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); + } +#else + ZEND_OP1_LITERAL(opline) = *val; +#endif + } + /* TMP_VAR my be used only once */ + break; + } + + if (ZEND_OP2_TYPE(opline) == IS_TMP_VAR && + ZEND_OP2(opline).var == var) { + + ZEND_OP2_TYPE(opline) = IS_CONST; +#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO + opline->op2.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); + if (Z_TYPE_P(val) == IS_STRING) { + Z_HASH_P(&ZEND_OP2_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)) + 1); + switch (opline->opcode) { + case ZEND_FETCH_R: + case ZEND_FETCH_W: + case ZEND_FETCH_RW: + case ZEND_FETCH_IS: + case ZEND_FETCH_UNSET: + case ZEND_FETCH_FUNC_ARG: + case ZEND_FETCH_CLASS: + case ZEND_INIT_FCALL_BY_NAME: + /*case ZEND_INIT_NS_FCALL_BY_NAME:*/ + case ZEND_UNSET_VAR: + case ZEND_ISSET_ISEMPTY_VAR: + case ZEND_ADD_INTERFACE: + case ZEND_ADD_TRAIT: + op_array->literals[opline->op2.constant].cache_slot = op_array->last_cache_slot++; + zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); + zend_optimizer_add_literal(op_array, val TSRMLS_CC); + op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op2.constant+1].constant), Z_STRLEN(op_array->literals[opline->op2.constant+1].constant) + 1); + break; + case ZEND_INIT_METHOD_CALL: + case ZEND_INIT_STATIC_METHOD_CALL: + zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); + zend_optimizer_add_literal(op_array, val TSRMLS_CC); + op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op2.constant+1].constant), Z_STRLEN(op_array->literals[opline->op2.constant+1].constant) + 1); + /* break missing intentionally */ + /*case ZEND_FETCH_CONSTANT:*/ + case ZEND_ASSIGN_OBJ: + case ZEND_FETCH_OBJ_R: + case ZEND_FETCH_OBJ_W: + case ZEND_FETCH_OBJ_RW: + case ZEND_FETCH_OBJ_IS: + case ZEND_FETCH_OBJ_UNSET: + case ZEND_FETCH_OBJ_FUNC_ARG: + case ZEND_UNSET_OBJ: + case ZEND_PRE_INC_OBJ: + case ZEND_PRE_DEC_OBJ: + case ZEND_POST_INC_OBJ: + case ZEND_POST_DEC_OBJ: + case ZEND_ISSET_ISEMPTY_PROP_OBJ: + op_array->literals[opline->op2.constant].cache_slot = op_array->last_cache_slot; + op_array->last_cache_slot += 2; + break; + case ZEND_ASSIGN_ADD: + case ZEND_ASSIGN_SUB: + case ZEND_ASSIGN_MUL: + case ZEND_ASSIGN_DIV: + case ZEND_ASSIGN_MOD: + case ZEND_ASSIGN_SL: + case ZEND_ASSIGN_SR: + case ZEND_ASSIGN_CONCAT: + case ZEND_ASSIGN_BW_OR: + case ZEND_ASSIGN_BW_AND: + case ZEND_ASSIGN_BW_XOR: + if (opline->extended_value == ZEND_ASSIGN_OBJ) { + op_array->literals[opline->op2.constant].cache_slot = op_array->last_cache_slot; + op_array->last_cache_slot += 2; + } + break; + default: + break; + } + } +#else + ZEND_OP2_LITERAL(opline) = *val; +#endif + break; + } + opline++; + } +} + #include "Optimizer/nop_removal.c" #include "Optimizer/block_pass.c" #include "Optimizer/optimize_temp_vars_5.c" diff --git a/ext/opcache/Optimizer/zend_optimizer_internal.h b/ext/opcache/Optimizer/zend_optimizer_internal.h index a9bad01be3bf6..616bdf74f6e6b 100644 --- a/ext/opcache/Optimizer/zend_optimizer_internal.h +++ b/ext/opcache/Optimizer/zend_optimizer_internal.h @@ -27,6 +27,9 @@ #if ZEND_EXTENSION_API_NO > PHP_5_4_X_API_NO # define VAR_NUM(v) ((zend_uint)(EX_TMP_VAR_NUM(0, 0) - EX_TMP_VAR(0, v))) # define NUM_VAR(v) ((zend_uint)(zend_uintptr_t)EX_TMP_VAR_NUM(0, v)) +#elif ZEND_EXTENSION_API_NO > PHP_5_2_X_API_NO +# define VAR_NUM(v) ((v)/ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable))) +# define NUM_VAR(v) ((v)*ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable))) #else # define VAR_NUM(v) ((v)/(sizeof(temp_variable))) # define NUM_VAR(v) ((v)*(sizeof(temp_variable))) diff --git a/ext/opcache/README b/ext/opcache/README index 6c3cc746e77c0..2e30d92c001e1 100644 --- a/ext/opcache/README +++ b/ext/opcache/README @@ -31,8 +31,8 @@ Quick Install zend_extension=/...full path.../opcache.so -NOTE: In case you are going to use Zend OPcache together with Xdebug, -be sure that Xdebug is loaded after OPcache. "php -v" must show Xdebug +NOTE: In case you are going to use Zend OPcache together with Xdebug or Zend Debugger, +be sure that the debugger is loaded after OPcache. "php -v" must show the debugger after OPcache. - Restart PHP @@ -80,8 +80,8 @@ opcache.max_accelerated_files (default "2000") The maximum number of keys (scripts) in the OPcache hash table. The number is actually the first one in the following set of prime numbers that is bigger than the one supplied: { 223, 463, 983, 1979, 3907, - 7963, 16229, 32531, 65407, 130987 }. Only numbers between 200 and 100000 - are allowed. + 7963, 16229, 32531, 65407, 130987, 262237, 524521, 1048793 }. Only numbers + between 200 and 1000000 are allowed. opcache.max_wasted_percentage (default "5") The maximum percentage of "wasted" memory until a restart is scheduled. diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 2c765f1be7267..0d7b94057b36c 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -36,7 +36,7 @@ #include "main/php_open_temporary_file.h" #include "zend_API.h" #include "zend_ini.h" -#include "TSRM/tsrm_virtual_cwd.h" +#include "zend_virtual_cwd.h" #include "zend_accelerator_util_funcs.h" #include "zend_accelerator_hash.h" @@ -1062,6 +1062,10 @@ int zend_accel_invalidate(const char *filename, int filename_len, zend_bool forc realpath = accelerator_orig_zend_resolve_path(filename, filename_len TSRMLS_CC); #endif + if (!realpath) { + return FAILURE; + } + persistent_script = zend_accel_hash_find(&ZCSG(hash), realpath, strlen(realpath) + 1); if (persistent_script && !persistent_script->corrupted) { zend_file_handle file_handle; @@ -1196,6 +1200,8 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr /* store script structure in the hash table */ bucket = zend_accel_hash_update(&ZCSG(hash), new_persistent_script->full_path, new_persistent_script->full_path_len + 1, 0, new_persistent_script); if (bucket && + /* key may contain non-persistent PHAR aliases (see issues #115 and #149) */ + memcmp(key, "phar://", sizeof("phar://") - 1) != 0 && (new_persistent_script->full_path_len != key_length || memcmp(new_persistent_script->full_path, key, key_length) != 0)) { /* link key to the same persistent script in hash table */ @@ -1446,7 +1452,7 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han } /* zend_compile() replacement */ -static zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC) +zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC) { zend_persistent_script *persistent_script = NULL; char *key = NULL; @@ -1651,7 +1657,18 @@ static zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int #endif void *dummy = (void *) 1; - zend_hash_quick_add(&EG(included_files), persistent_script->full_path, persistent_script->full_path_len + 1, persistent_script->hash_value, &dummy, sizeof(void *), NULL); + if (zend_hash_quick_add(&EG(included_files), persistent_script->full_path, persistent_script->full_path_len + 1, persistent_script->hash_value, &dummy, sizeof(void *), NULL) == SUCCESS) { + /* ext/phar has to load phar's metadata into memory */ + if (strstr(persistent_script->full_path, ".phar") && !strstr(persistent_script->full_path, "://")) { + php_stream_statbuf ssb; + char *fname = emalloc(sizeof("phar://") + persistent_script->full_path_len); + + memcpy(fname, "phar://", sizeof("phar://") - 1); + memcpy(fname + sizeof("phar://") - 1, persistent_script->full_path, persistent_script->full_path_len + 1); + php_stream_stat_path(fname, &ssb); + efree(fname); + } + } } } #if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO @@ -2407,14 +2424,14 @@ static inline int accel_find_sapi(TSRMLS_D) return FAILURE; } -static void zend_accel_init_shm(TSRMLS_D) +static int zend_accel_init_shm(TSRMLS_D) { zend_shared_alloc_lock(TSRMLS_C); accel_shared_globals = zend_shared_alloc(sizeof(zend_accel_shared_globals)); if (!accel_shared_globals) { zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!"); - return; + return FAILURE; } ZSMMG(app_shared_globals) = accel_shared_globals; @@ -2429,7 +2446,8 @@ static void zend_accel_init_shm(TSRMLS_D) ZCSG(interned_strings).arBuckets = zend_shared_alloc(ZCSG(interned_strings).nTableSize * sizeof(Bucket *)); ZCSG(interned_strings_start) = zend_shared_alloc((ZCG(accel_directives).interned_strings_buffer * 1024 * 1024)); if (!ZCSG(interned_strings).arBuckets || !ZCSG(interned_strings_start)) { - zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME " cannot allocate buffer for interned strings"); + zend_accel_error(ACCEL_LOG_FATAL, ACCELERATOR_PRODUCT_NAME " cannot allocate buffer for interned strings"); + return FAILURE; } ZCSG(interned_strings_end) = ZCSG(interned_strings_start) + (ZCG(accel_directives).interned_strings_buffer * 1024 * 1024); ZCSG(interned_strings_top) = ZCSG(interned_strings_start); @@ -2468,6 +2486,8 @@ static void zend_accel_init_shm(TSRMLS_D) ZCSG(restart_in_progress) = 0; zend_shared_alloc_unlock(TSRMLS_C); + + return SUCCESS; } static void accel_globals_ctor(zend_accel_globals *accel_globals TSRMLS_DC) @@ -2525,7 +2545,10 @@ static int accel_startup(zend_extension *extension) /********************************************/ switch (zend_shared_alloc_startup(ZCG(accel_directives).memory_consumption)) { case ALLOC_SUCCESS: - zend_accel_init_shm(TSRMLS_C); + if (zend_accel_init_shm(TSRMLS_C) == FAILURE) { + accel_startup_ok = 0; + return FAILURE; + } break; case ALLOC_FAILURE: accel_startup_ok = 0; diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index 38f2e060f6e2e..2f6ee068e8111 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -80,6 +80,9 @@ # endif # include #else +# ifndef MAXPATHLEN +# define MAXPATHLEN 4096 +# endif # include #endif @@ -100,7 +103,7 @@ extern int lock_file; # elif defined(__svr4__) # define FLOCK_STRUCTURE(name, type, whence, start, len) \ struct flock name = {type, whence, start, len} -# elif defined(__linux__) || defined(__hpux) +# elif defined(__linux__) || defined(__hpux) || defined(__GNU__) # define FLOCK_STRUCTURE(name, type, whence, start, len) \ struct flock name = {type, whence, start, len, 0} # elif defined(_AIX) @@ -111,6 +114,12 @@ extern int lock_file; # define FLOCK_STRUCTURE(name, type, whence, start, len) \ struct flock name = {type, whence, start, len} # endif +# elif defined(HAVE_FLOCK_BSD) +# define FLOCK_STRUCTURE(name, type, whence, start, len) \ + struct flock name = {start, len, -1, type, whence} +# elif defined(HAVE_FLOCK_LINUX) +# define FLOCK_STRUCTURE(name, type, whence, start, len) \ + struct flock name = {type, whence, start, len} # else # error "Don't know how to define struct flock" # endif @@ -326,6 +335,7 @@ int accelerator_shm_read_lock(TSRMLS_D); void accelerator_shm_read_unlock(TSRMLS_D); char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_length, int *key_len TSRMLS_DC); +zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC); #if !defined(ZEND_DECLARE_INHERITED_CLASS_DELAYED) # define ZEND_DECLARE_INHERITED_CLASS_DELAYED 145 diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4 index 1798fe13fa80d..60edeed966b36 100644 --- a/ext/opcache/config.m4 +++ b/ext/opcache/config.m4 @@ -326,40 +326,42 @@ int main() { msg=yes,msg=no,msg=no) AC_MSG_RESULT([$msg]) - AC_MSG_CHECKING(for known struct flock definition) - dnl Copied from ZendAccelerator.h - AC_TRY_RUN([ -#include -#include - -#ifndef ZEND_WIN32 -extern int lock_file; - -# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || (defined(__APPLE__) && defined(__MACH__)/* Darwin */) || defined(__OpenBSD__) || defined(__NetBSD__) -# define FLOCK_STRUCTURE(name, type, whence, start, len) \ - struct flock name = {start, len, -1, type, whence} -# elif defined(__svr4__) -# define FLOCK_STRUCTURE(name, type, whence, start, len) \ - struct flock name = {type, whence, start, len} -# elif defined(__linux__) || defined(__hpux) -# define FLOCK_STRUCTURE(name, type, whence, start, len) \ - struct flock name = {type, whence, start, len, 0} -# elif defined(_AIX) -# if defined(_LARGE_FILES) || defined(__64BIT__) -# define FLOCK_STRUCTURE(name, type, whence, start, len) \ - struct flock name = {type, whence, 0, 0, 0, start, len } -# else -# define FLOCK_STRUCTURE(name, type, whence, start, len) \ - struct flock name = {type, whence, start, len} -# endif -# else -# error "Don't know how to define struct flock" -# endif -#endif -int main() { return 0; } -], -[AC_MSG_RESULT([done])], -[AC_MSG_ERROR([Don't know how to define struct flock on this system[,] set --enable-opcache=no])], []) +flock_type=unknown +AC_MSG_CHECKING("whether flock struct is linux ordered") +AC_TRY_RUN([ + #include + struct flock lock = { 1, 2, 3, 4, 5 }; + int main() { + if(lock.l_type == 1 && lock.l_whence == 2 && lock.l_start == 3 && lock.l_len == 4) { + return 0; + } + return 1; + } +], [ + flock_type=linux + AC_DEFINE([HAVE_FLOCK_LINUX], [], [Struct flock is Linux-type]) + AC_MSG_RESULT("yes") +], AC_MSG_RESULT("no") ) + +AC_MSG_CHECKING("whether flock struct is BSD ordered") +AC_TRY_RUN([ + #include + struct flock lock = { 1, 2, 3, 4, 5 }; + int main() { + if(lock.l_start == 1 && lock.l_len == 2 && lock.l_type == 4 && lock.l_whence == 5) { + return 0; + } + return 1; + } +], [ + flock_type=bsd + AC_DEFINE([HAVE_FLOCK_BSD], [], [Struct flock is BSD-type]) + AC_MSG_RESULT("yes") +], AC_MSG_RESULT("no") ) + +if test "$flock_type" == "unknown"; then + AC_MSG_ERROR([Don't know how to define struct flock on this system[,] set --enable-opcache=no]) +fi PHP_NEW_EXTENSION(opcache, ZendAccelerator.c \ diff --git a/ext/opcache/tests/bug65510.phpt b/ext/opcache/tests/bug65510.phpt new file mode 100644 index 0000000000000..ba19d27d6ff2a --- /dev/null +++ b/ext/opcache/tests/bug65510.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #65510 (5.5.2 crashes in _get_zval_ptr_ptr_var) +--INI-- +allow_url_include=1 +opcache.enable=1 +opcache.enable_cli=1 +--SKIPIF-- + +--FILE-- + +--FILE-- + +--FILE-- + +--EXPECT-- +string(4) "tutu" diff --git a/ext/opcache/tests/issue0115.phpt b/ext/opcache/tests/issue0115.phpt new file mode 100644 index 0000000000000..a1e469ff2fec2 --- /dev/null +++ b/ext/opcache/tests/issue0115.phpt @@ -0,0 +1,48 @@ +--TEST-- +ISSUE #115 (path issue when using phar) +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +phar.readonly=0 +--SKIPIF-- + + + +--FILE-- +'; +$p = new Phar(__DIR__ . '/issue0115_1.phar.php', 0, 'this'); +$p['index.php'] = 'setStub($stub); +unset($p); +$p = new Phar(__DIR__ . '/issue0115_2.phar.php', 0, 'this'); +$p['index.php'] = 'setStub($stub); +unset($p); + +include "php_cli_server.inc"; +php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1'); +echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0115_1.phar.php'); +echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0115_2.phar.php'); +?> +--CLEAN-- + +--EXPECT-- +Hello from Index 1. +Hello World 1! +Hello from Index 2. +Hello World 2! diff --git a/ext/opcache/tests/issue0128.phpt b/ext/opcache/tests/issue0128.phpt new file mode 100644 index 0000000000000..637f675ac2500 --- /dev/null +++ b/ext/opcache/tests/issue0128.phpt @@ -0,0 +1,16 @@ +--TEST-- +ISSUE #128 (opcache_invalidate segmentation fault) +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(false) +string(4) "okey" diff --git a/ext/opcache/tests/issue0149.phpt b/ext/opcache/tests/issue0149.phpt new file mode 100644 index 0000000000000..7044d3938837a --- /dev/null +++ b/ext/opcache/tests/issue0149.phpt @@ -0,0 +1,35 @@ +--TEST-- +ISSUE #149 (Phar mount points not working this OPcache enabled) +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +phar.readonly=0 +--SKIPIF-- + + + +--FILE-- +"; +$p = new Phar(__DIR__ . '/issue0149.phar.php', 0, 'this'); +$p['index.php'] = ""; # A Phar must have at least one file, hence this dummy +$p->setStub($stub); +unset($p); + +include "php_cli_server.inc"; +php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1'); +echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0149.phar.php'); +echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0149.phar.php'); +echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0149.phar.php'); +?> +--CLEAN-- + +--EXPECT-- +OK +OK +OK diff --git a/ext/opcache/tests/php_cli_server.inc b/ext/opcache/tests/php_cli_server.inc new file mode 100644 index 0000000000000..0878bfafc0d27 --- /dev/null +++ b/ext/opcache/tests/php_cli_server.inc @@ -0,0 +1,47 @@ + STDIN, + 1 => STDOUT, + 2 => STDERR, + ); + + if (substr(PHP_OS, 0, 3) == 'WIN') { + $cmd = "{$php_executable} -t {$doc_root} $ini -S " . PHP_CLI_SERVER_ADDRESS; + $handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array("bypass_shell" => true, "suppress_errors" => true)); + } else { + $cmd = "exec {$php_executable} -t {$doc_root} $ini -S " . PHP_CLI_SERVER_ADDRESS . " 2>/dev/null"; + $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root); + } + + // note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.' + // it might not be listening yet...need to wait until fsockopen() call returns + $i = 0; + while (($i++ < 30) && !($fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT))) { + usleep(10000); + } + + if ($fp) { + fclose($fp); + } + + register_shutdown_function( + function($handle) { + proc_terminate($handle); + }, + $handle + ); + // don't bother sleeping, server is already up + // server can take a variable amount of time to be up, so just sleeping a guessed amount of time + // does not work. this is why tests sometimes pass and sometimes fail. to get a reliable pass + // sleeping doesn't work. +} +?> + diff --git a/ext/opcache/zend_accelerator_blacklist.c b/ext/opcache/zend_accelerator_blacklist.c index da83cfd3119e1..eb0bc2146cd55 100644 --- a/ext/opcache/zend_accelerator_blacklist.c +++ b/ext/opcache/zend_accelerator_blacklist.c @@ -314,6 +314,7 @@ void zend_accel_blacklist_load(zend_blacklist *blacklist, char *filename) blacklist->entries[blacklist->pos].path = (char *)malloc(path_length + 1); if (!blacklist->entries[blacklist->pos].path) { zend_accel_error(ACCEL_LOG_ERROR, "malloc() failed\n"); + fclose(fp); return; } blacklist->entries[blacklist->pos].id = blacklist->pos; diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index f9ddaa98b8ba0..2ee02a60ce846 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -28,13 +28,13 @@ #include "zend_accelerator_blacklist.h" #include "php_ini.h" #include "SAPI.h" -#include "TSRM/tsrm_virtual_cwd.h" +#include "zend_virtual_cwd.h" #include "ext/standard/info.h" #include "ext/standard/php_filestat.h" #define STRING_NOT_NULL(s) (NULL == (s)?"":s) #define MIN_ACCEL_FILES 200 -#define MAX_ACCEL_FILES 100000 +#define MAX_ACCEL_FILES 1000000 #define TOKENTOSTR(X) #X static void (*orig_file_exists)(INTERNAL_FUNCTION_PARAMETERS) = NULL; @@ -48,6 +48,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_get_status, 0, 0, 0) ZEND_ARG_INFO(0, fetch_scripts) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_compile_file, 0, 0, 1) + ZEND_ARG_INFO(0, file) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_invalidate, 0, 0, 1) ZEND_ARG_INFO(0, script) ZEND_ARG_INFO(0, force) @@ -59,12 +63,14 @@ static ZEND_FUNCTION(opcache_invalidate); /* Private functions */ static ZEND_FUNCTION(opcache_get_status); +static ZEND_FUNCTION(opcache_compile_file); static ZEND_FUNCTION(opcache_get_configuration); static zend_function_entry accel_functions[] = { /* User functions */ ZEND_FE(opcache_reset, arginfo_opcache_none) ZEND_FE(opcache_invalidate, arginfo_opcache_invalidate) + ZEND_FE(opcache_compile_file, arginfo_opcache_compile_file) /* Private functions */ ZEND_FE(opcache_get_configuration, arginfo_opcache_none) ZEND_FE(opcache_get_status, arginfo_opcache_get_status) @@ -709,3 +715,44 @@ static ZEND_FUNCTION(opcache_invalidate) RETURN_FALSE; } } + +static ZEND_FUNCTION(opcache_compile_file) +{ + char *script_name; + int script_name_len; + zend_file_handle handle; + zend_op_array *op_array = NULL; + zend_execute_data *orig_execute_data = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &script_name, &script_name_len) == FAILURE) { + return; + } + + if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled)) { + zend_error(E_NOTICE, ACCELERATOR_PRODUCT_NAME " seems to be disabled, can't compile file"); + RETURN_FALSE; + } + + handle.filename = script_name; + handle.free_filename = 0; + handle.opened_path = NULL; + handle.type = ZEND_HANDLE_FILENAME; + + orig_execute_data = EG(current_execute_data); + + zend_try { + op_array = persistent_compile_file(&handle, ZEND_INCLUDE TSRMLS_CC); + } zend_catch { + EG(current_execute_data) = orig_execute_data; + zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME " could not compile file %s" TSRMLS_CC, handle.filename); + } zend_end_try(); + + if(op_array != NULL) { + destroy_op_array(op_array TSRMLS_CC); + efree(op_array); + RETVAL_TRUE; + } else { + RETVAL_FALSE; + } + zend_destroy_file_handle(&handle TSRMLS_CC); +} diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index 39b4c1fc2558b..894da63aaa48e 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -478,7 +478,7 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class if (accel_xlat_get(new_entry->scope, new_ce) == SUCCESS) { new_entry->scope = *new_ce; } else { - zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME " class loading error, class %s, function %s. Please call Zend Support", ce->name, new_entry->function_name); + zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME " class loading error, class %s, function %s", ce->name, new_entry->function_name); } } @@ -487,7 +487,7 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class if (accel_xlat_get(new_entry->prototype, new_prototype) == SUCCESS) { new_entry->prototype = *new_prototype; } else { - zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME " class loading error, class %s, function %s. Please call Zend Support", ce->name, new_entry->function_name); + zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME " class loading error, class %s, function %s", ce->name, new_entry->function_name); } } @@ -589,7 +589,7 @@ static void zend_hash_clone_prop_info(HashTable *ht, HashTable *source, zend_cla } else if (accel_xlat_get(prop_info->ce, new_ce) == SUCCESS) { prop_info->ce = *new_ce; } else { - zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME" class loading error, class %s, property %s. Please call Zend Support", ce->name, prop_info->name); + zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME" class loading error, class %s, property %s", ce->name, prop_info->name); } p = p->pListNext; @@ -621,7 +621,7 @@ static int zend_prepare_function_for_execution(zend_op_array *op_array) if (accel_xlat_get(ce->handler, new_func) == SUCCESS) { \ ce->handler = *new_func; \ } else { \ - zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME " class loading error, class %s. Please call Zend Support", ce->name); \ + zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME " class loading error, class %s", ce->name); \ } \ } \ } @@ -710,7 +710,7 @@ static void zend_class_copy_ctor(zend_class_entry **pce) if (accel_xlat_get(ce->parent, new_ce) == SUCCESS) { ce->parent = *new_ce; } else { - zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME" class loading error, class %s. Please call Zend Support", ce->name); + zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME" class loading error, class %s", ce->name); } } diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 4aac4e3137cad..7cf637c7f6cbd 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -129,6 +129,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_export, 0, 0, 2) ZEND_ARG_INFO(0, notext) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_fingerprint, 0, 0, 1) + ZEND_ARG_INFO(0, x509) + ZEND_ARG_INFO(0, method) + ZEND_ARG_INFO(0, raw_output) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO(arginfo_openssl_x509_check_private_key, 0) ZEND_ARG_INFO(0, cert) ZEND_ARG_INFO(0, key) @@ -443,6 +449,7 @@ const zend_function_entry openssl_functions[] = { PHP_FE(openssl_x509_checkpurpose, arginfo_openssl_x509_checkpurpose) PHP_FE(openssl_x509_check_private_key, arginfo_openssl_x509_check_private_key) PHP_FE(openssl_x509_export, arginfo_openssl_x509_export) + PHP_FE(openssl_x509_fingerprint, arginfo_openssl_x509_fingerprint) PHP_FE(openssl_x509_export_to_file, arginfo_openssl_x509_export_to_file) /* PKCS12 funcs */ @@ -1176,6 +1183,10 @@ PHP_MINIT_FUNCTION(openssl) php_stream_xport_register("sslv2", php_openssl_ssl_socket_factory TSRMLS_CC); #endif php_stream_xport_register("tls", php_openssl_ssl_socket_factory TSRMLS_CC); +#if OPENSSL_VERSION_NUMBER >= 0x10001001L + php_stream_xport_register("tlsv1.1", php_openssl_ssl_socket_factory TSRMLS_CC); + php_stream_xport_register("tlsv1.2", php_openssl_ssl_socket_factory TSRMLS_CC); +#endif /* override the default tcp socket provider */ php_stream_xport_register("tcp", php_openssl_ssl_socket_factory TSRMLS_CC); @@ -1214,6 +1225,10 @@ PHP_MSHUTDOWN_FUNCTION(openssl) #endif php_stream_xport_unregister("sslv3" TSRMLS_CC); php_stream_xport_unregister("tls" TSRMLS_CC); +#if OPENSSL_VERSION_NUMBER >= 0x10001001L + php_stream_xport_unregister("tlsv1.1" TSRMLS_CC); + php_stream_xport_unregister("tlsv1.2" TSRMLS_CC); +#endif /* reinstate the default tcp handler */ php_stream_xport_register("tcp", php_stream_generic_socket_factory TSRMLS_CC); @@ -1595,7 +1610,7 @@ PHP_FUNCTION(openssl_spki_export_challenge) goto cleanup; } - RETVAL_STRING(ASN1_STRING_data(spki->spkac->challenge), 1); + RETVAL_STRING((char *) ASN1_STRING_data(spki->spkac->challenge), 1); goto cleanup; cleanup: @@ -1665,6 +1680,121 @@ PHP_FUNCTION(openssl_x509_export) } /* }}} */ +static int php_openssl_x509_fingerprint(X509 *peer, const char *method, zend_bool raw, char **out, int *out_len TSRMLS_DC) +{ + unsigned char md[EVP_MAX_MD_SIZE]; + const EVP_MD *mdtype; + unsigned int n; + + if (!(mdtype = EVP_get_digestbyname(method))) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown signature algorithm"); + return FAILURE; + } else if (!X509_digest(peer, mdtype, md, &n)) { + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not generate signature"); + return FAILURE; + } + + if (raw) { + *out_len = n; + *out = estrndup((char *) md, n); + } else { + *out_len = n * 2; + *out = emalloc(*out_len + 1); + + make_digest_ex(*out, md, n); + } + + return SUCCESS; +} + +static int php_x509_fingerprint_cmp(X509 *peer, const char *method, const char *expected TSRMLS_DC) +{ + char *fingerprint; + int fingerprint_len; + int result = -1; + + if (php_openssl_x509_fingerprint(peer, method, 0, &fingerprint, &fingerprint_len TSRMLS_CC) == SUCCESS) { + result = strcmp(expected, fingerprint); + efree(fingerprint); + } + + return result; +} + +static zend_bool php_x509_fingerprint_match(X509 *peer, zval *val TSRMLS_DC) +{ + if (Z_TYPE_P(val) == IS_STRING) { + const char *method = NULL; + + switch (Z_STRLEN_P(val)) { + case 32: + method = "md5"; + break; + + case 40: + method = "sha1"; + break; + } + + return method && php_x509_fingerprint_cmp(peer, method, Z_STRVAL_P(val) TSRMLS_CC) == 0; + } else if (Z_TYPE_P(val) == IS_ARRAY) { + HashPosition pos; + zval **current; + char *key; + uint key_len; + ulong key_index; + + for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(val), &pos); + zend_hash_get_current_data_ex(Z_ARRVAL_P(val), (void **)¤t, &pos) == SUCCESS; + zend_hash_move_forward_ex(Z_ARRVAL_P(val), &pos) + ) { + int key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(val), &key, &key_len, &key_index, 0, &pos); + + if (key_type == HASH_KEY_IS_STRING + && Z_TYPE_PP(current) == IS_STRING + && php_x509_fingerprint_cmp(peer, key, Z_STRVAL_PP(current) TSRMLS_CC) != 0 + ) { + return 0; + } + } + return 1; + } + return 0; +} + +PHP_FUNCTION(openssl_x509_fingerprint) +{ + X509 *cert; + zval **zcert; + long certresource; + zend_bool raw_output = 0; + char *method = "sha1"; + int method_len; + + char *fingerprint; + int fingerprint_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|sb", &zcert, &method, &method_len, &raw_output) == FAILURE) { + return; + } + + cert = php_openssl_x509_from_zval(zcert, 0, &certresource TSRMLS_CC); + if (cert == NULL) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot get cert from parameter 1"); + RETURN_FALSE; + } + + if (php_openssl_x509_fingerprint(cert, method, raw_output, &fingerprint, &fingerprint_len TSRMLS_CC) == SUCCESS) { + RETVAL_STRINGL(fingerprint, fingerprint_len, 0); + } else { + RETVAL_FALSE; + } + + if (certresource == -1 && cert) { + X509_free(cert); + } +} + /* {{{ proto bool openssl_x509_check_private_key(mixed cert, mixed key) Checks if a private key corresponds to a CERT */ PHP_FUNCTION(openssl_x509_check_private_key) @@ -4794,14 +4924,12 @@ static int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) /* {{{ */ { php_stream *stream; SSL *ssl; - X509 *err_cert; int err, depth, ret; zval **val; ret = preverify_ok; /* determine the status for the current cert */ - err_cert = X509_STORE_CTX_get_current_cert(ctx); err = X509_STORE_CTX_get_error(ctx); depth = X509_STORE_CTX_get_error_depth(ctx); @@ -4829,12 +4957,91 @@ static int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) /* {{{ */ } /* }}} */ +static zend_bool matches_wildcard_name(const char *subjectname, const char *certname) +{ + char *wildcard; + int prefix_len, suffix_len, subject_len; + + if (strcasecmp(subjectname, certname) == 0) { + return 1; + } + + if (!(wildcard = strchr(certname, '*'))) { + return 0; + } + + // 1) prefix, if not empty, must match subject + prefix_len = wildcard - certname; + if (prefix_len && strncasecmp(subjectname, certname, prefix_len) != 0) { + return 0; + } + + suffix_len = strlen(wildcard + 1); + subject_len = strlen(subjectname); + if (suffix_len <= subject_len) { + /* 2) suffix must match + * 3) no . between prefix and suffix + **/ + return strcasecmp(wildcard + 1, subjectname + subject_len - suffix_len) == 0 && + memchr(subjectname + prefix_len, '.', subject_len - suffix_len - prefix_len) == NULL; + } + + return 0; +} + +static zend_bool matches_san_list(X509 *peer, const char *subject_name) +{ + int i; + zend_bool is_match = 0; + unsigned char *cert_name; + + GENERAL_NAMES *alt_names = X509_get_ext_d2i(peer, NID_subject_alt_name, 0, 0); + int alt_name_count = sk_GENERAL_NAME_num(alt_names); + + for (i = 0; i < alt_name_count; i++) { + GENERAL_NAME *san = sk_GENERAL_NAME_value(alt_names, i); + + if (GEN_DNS == san->type) { + ASN1_STRING_to_UTF8(&cert_name, san->d.dNSName); + is_match = matches_wildcard_name(subject_name, (char *) cert_name); + OPENSSL_free(cert_name); + } + + if (is_match) { + break; + } + } + + return is_match; +} + +static zend_bool matches_common_name(X509 *peer, const char *subject_name TSRMLS_DC) +{ + char buf[1024]; + X509_NAME *cert_name; + zend_bool is_match = 0; + int cert_name_len; + + cert_name = X509_get_subject_name(peer); + cert_name_len = X509_NAME_get_text_by_NID(cert_name, NID_commonName, buf, sizeof(buf)); + + if (cert_name_len == -1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to locate peer certificate CN"); + } else if (cert_name_len != strlen(buf)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Peer certificate CN=`%.*s' is malformed", cert_name_len, buf); + } else if (matches_wildcard_name(subject_name, buf)) { + is_match = 1; + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Peer certificate CN=`%.*s' did not match expected CN=`%s'", cert_name_len, buf, subject_name); + } + + return is_match; +} + int php_openssl_apply_verification_policy(SSL *ssl, X509 *peer, php_stream *stream TSRMLS_DC) /* {{{ */ { zval **val = NULL; char *cnmatch = NULL; - X509_NAME *name; - char buf[1024]; int err; /* verification is turned off */ @@ -4865,36 +5072,25 @@ int php_openssl_apply_verification_policy(SSL *ssl, X509 *peer, php_stream *stre /* if the cert passed the usual checks, apply our own local policies now */ - name = X509_get_subject_name(peer); - - /* Does the common name match ? (used primarily for https://) */ - GET_VER_OPT_STRING("CN_match", cnmatch); - if (cnmatch) { - int match = 0; - int name_len = X509_NAME_get_text_by_NID(name, NID_commonName, buf, sizeof(buf)); - - if (name_len == -1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to locate peer certificate CN"); - return FAILURE; - } else if (name_len != strlen(buf)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Peer certificate CN=`%.*s' is malformed", name_len, buf); - return FAILURE; - } - - match = strcmp(cnmatch, buf) == 0; - if (!match && strlen(buf) > 3 && buf[0] == '*' && buf[1] == '.') { - /* Try wildcard */ - - if (strchr(buf+2, '.')) { - char *tmp = strstr(cnmatch, buf+1); - - match = tmp && strcmp(tmp, buf+2) && tmp == strchr(cnmatch, '.'); + if (GET_VER_OPT("peer_fingerprint")) { + if (Z_TYPE_PP(val) == IS_STRING || Z_TYPE_PP(val) == IS_ARRAY) { + if (!php_x509_fingerprint_match(peer, *val TSRMLS_CC)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Peer fingerprint doesn't match"); + return FAILURE; } + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected peer fingerprint must be a string or an array"); } + } + + GET_VER_OPT_STRING("CN_match", cnmatch); - if (!match) { - /* didn't match */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Peer certificate CN=`%.*s' did not match expected CN=`%s'", name_len, buf, cnmatch); + if (cnmatch) { + if (matches_san_list(peer, cnmatch)) { + return SUCCESS; + } else if (matches_common_name(peer, cnmatch TSRMLS_CC)) { + return SUCCESS; + } else { return FAILURE; } } @@ -4974,9 +5170,6 @@ SSL *php_SSL_new_from_context(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) /* {{{ GET_VER_OPT_STRING("local_cert", certfile); if (certfile) { - X509 *cert = NULL; - EVP_PKEY *key = NULL; - SSL *tmpssl; char resolved_path_buff[MAXPATHLEN]; const char * private_key = NULL; @@ -5003,16 +5196,22 @@ SSL *php_SSL_new_from_context(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) /* {{{ } } - tmpssl = SSL_new(ctx); - cert = SSL_get_certificate(tmpssl); - - if (cert) { - key = X509_get_pubkey(cert); - EVP_PKEY_copy_parameters(key, SSL_get_privatekey(tmpssl)); - EVP_PKEY_free(key); - } - SSL_free(tmpssl); - +#if OPENSSL_VERSION_NUMBER < 0x10001001L + do { + /* Unnecessary as of OpenSSLv1.0.1 (will segfault if used with >= 10001001 ) */ + X509 *cert = NULL; + EVP_PKEY *key = NULL; + SSL *tmpssl = SSL_new(ctx); + cert = SSL_get_certificate(tmpssl); + + if (cert) { + key = X509_get_pubkey(cert); + EVP_PKEY_copy_parameters(key, SSL_get_privatekey(tmpssl)); + EVP_PKEY_free(key); + } + SSL_free(tmpssl); + } while (0); +#endif if (!SSL_CTX_check_private_key(ctx)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Private key does not match certificate!"); } diff --git a/ext/openssl/php_openssl.h b/ext/openssl/php_openssl.h index 8483bbf7626dd..a06e43db1ce5e 100644 --- a/ext/openssl/php_openssl.h +++ b/ext/openssl/php_openssl.h @@ -66,6 +66,7 @@ PHP_FUNCTION(openssl_x509_free); PHP_FUNCTION(openssl_x509_parse); PHP_FUNCTION(openssl_x509_checkpurpose); PHP_FUNCTION(openssl_x509_export); +PHP_FUNCTION(openssl_x509_fingerprint); PHP_FUNCTION(openssl_x509_export_to_file); PHP_FUNCTION(openssl_x509_check_private_key); diff --git a/ext/openssl/tests/bug65729.pem b/ext/openssl/tests/bug65729.pem new file mode 100644 index 0000000000000..dbeed6efd3011 --- /dev/null +++ b/ext/openssl/tests/bug65729.pem @@ -0,0 +1,28 @@ +-----BEGIN CERTIFICATE----- +MIICCTCCAXICCQDNMI29sowT7TANBgkqhkiG9w0BAQUFADBJMQswCQYDVQQGEwJT +RzESMBAGA1UECBMJVGVzdHZpbGxlMREwDwYDVQQKEwhkYXRpYmJhdzETMBEGA1UE +AxQKKi50ZXN0LmNvbTAeFw0xMzA5MjEwNzUyMjRaFw0xNDA5MjEwNzUyMjRaMEkx +CzAJBgNVBAYTAlNHMRIwEAYDVQQIEwlUZXN0dmlsbGUxETAPBgNVBAoTCGRhdGli +YmF3MRMwEQYDVQQDFAoqLnRlc3QuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB +iQKBgQCdzVnic8K5W4SVbwVuqezcTjeqVLoQ91vVNZB0Jnsuz6q3DoK03oAd1jTe +Vd0k+MQDbXpHoc37lA4+8z/g5Bs0UXxNx+nkbFTE7Ba2/G24caI9/cOXZPG3UViD +rtqXKL6h5/umqRG9Dt5liF2MVP9XFAesVC7B8+Ca+PbPlQoYzwIDAQABMA0GCSqG +SIb3DQEBBQUAA4GBAAS07u/Ke+EhEHidz6CG3Qcr+zg483JKRgZFyGz+YUKyyKKy +fmLs7JieGJxYQjOmIpj/6X9Gnb2HjIPDnI6A+MV1emXDTnnmsgf2/lZGcthhpZn2 +rMbj9bI0iH6HwOVGtp4ZJA5fB7nj3J+gWNTCQzDDOxwX36d2LL9ua+UMnk/g +-----END CERTIFICATE----- +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQCdzVnic8K5W4SVbwVuqezcTjeqVLoQ91vVNZB0Jnsuz6q3DoK0 +3oAd1jTeVd0k+MQDbXpHoc37lA4+8z/g5Bs0UXxNx+nkbFTE7Ba2/G24caI9/cOX +ZPG3UViDrtqXKL6h5/umqRG9Dt5liF2MVP9XFAesVC7B8+Ca+PbPlQoYzwIDAQAB +AoGAeyzTwKPDl5QMRejHQL57GOwlH1vLcXrjv+VzwHZZKQ0IoKM++5fCQYf29KXp +XPahaluGW2u9sWa8R/7wGcd0Q4RtquGzsgT3+AQsIc5KfIamyOyDaRVM/ymX3fWg +gHIU7OOzB+ihOU8sHyRIwfbk01/kmrBXLRj8E31sy3i3PIECQQDQQYE+aN7Acrdt +yN5CaqvbkiCGjRvASlemiTzPosgOtndyp21w1gakJwKYhYDk1N6A6Qb8REMZqM/U +wFypldV/AkEAwfq6NFuhpGL6hDA7MvlyY1KiZ0cHetPUX+PgdNqy2DA+1Sv4i7gm +Wd/uA651K7aPXuUaf9dKtPCmZwI4M6SEsQJBALW89HTqP7niYoDEEnITdPaghxHk +gptERUln6lGo1L1CLus3gSI/JHyMLo+7scgAnEwTD62GRKhX0Ubwt+ymfTECQAY5 +fHYnppU20+EgBxZIqOIFCc8UmWnYmE0Ha/Fz/x8u1SVUBuK84wYpSGL32yyu7ATY +hzQo/W229zABAzqtAdECQQCUdB7IBFpPnsfv/EUBFX7X/7zAc9JpACmu9It5ju8C +KIsMuz/02D+TQoJNjdAngBM+4AJDIaGFgTMIfaDMh5L7 +-----END RSA PRIVATE KEY----- diff --git a/ext/openssl/tests/bug65729.phpt b/ext/openssl/tests/bug65729.phpt new file mode 100644 index 0000000000000..c0ee4443ebee5 --- /dev/null +++ b/ext/openssl/tests/bug65729.phpt @@ -0,0 +1,54 @@ +--TEST-- +Bug #65729: CN_match gives false positive when wildcard is used +--SKIPIF-- + array( + 'verify_peer' => true, + 'allow_self_signed' => true, + 'CN_match' => $expected_name, + ) + )); + var_dump(stream_socket_client("ssl://127.0.0.1:64321", $errno, $errstr, 1, + STREAM_CLIENT_CONNECT, $contextC)); + } +} else { + @pcntl_wait($status); + foreach ($expected_names as $name) { + @stream_socket_accept($server, 1); + } +} +--EXPECTF-- +Warning: stream_socket_client(): Peer certificate CN=`*.test.com' did not match expected CN=`foo.test.com.sg' in %s on line %d + +Warning: stream_socket_client(): Failed to enable crypto in %s on line %d + +Warning: stream_socket_client(): unable to connect to ssl://127.0.0.1:64321 (Unknown error) in %s on line %d +bool(false) +resource(%d) of type (stream) +resource(%d) of type (stream) + +Warning: stream_socket_client(): Peer certificate CN=`*.test.com' did not match expected CN=`foo.bar.test.com' in %s on line %d + +Warning: stream_socket_client(): Failed to enable crypto in %s on line %d + +Warning: stream_socket_client(): unable to connect to ssl://127.0.0.1:64321 (Unknown error) in %s on line %d +bool(false) diff --git a/ext/openssl/tests/openssl_peer_fingerprint.phpt b/ext/openssl/tests/openssl_peer_fingerprint.phpt new file mode 100644 index 0000000000000..2960dffae506e --- /dev/null +++ b/ext/openssl/tests/openssl_peer_fingerprint.phpt @@ -0,0 +1,62 @@ +--TEST-- +Testing peer fingerprint on connection +--SKIPIF-- + array( + 'verify_peer' => true, + 'cafile' => __DIR__ . '/bug54992-ca.pem', + 'capture_peer_cert' => true, + 'peer_fingerprint' => '81cafc260aa8d82956ebc6212a362ece', + ) + ) + ); + // should be: 81cafc260aa8d82956ebc6212a362ecc + var_dump(stream_socket_client("ssl://127.0.0.1:64321", $errno, $errstr, 1, + STREAM_CLIENT_CONNECT, $contextC)); + + $contextC = stream_context_create( + array( + 'ssl' => array( + 'verify_peer' => true, + 'cafile' => __DIR__ . '/bug54992-ca.pem', + 'capture_peer_cert' => true, + 'peer_fingerprint' => array( + 'sha256' => '78ea579f2c3b439359dec5dac9d445108772927427c4780037e87df3799a0aa0', + ), + ) + ) + ); + + var_dump(stream_socket_client("ssl://127.0.0.1:64321", $errno, $errstr, 1, + STREAM_CLIENT_CONNECT, $contextC)); +} else { + @pcntl_wait($status); + @stream_socket_accept($server, 1); + @stream_socket_accept($server, 1); +} +--EXPECTF-- +Warning: stream_socket_client(): Peer fingerprint doesn't match in %s on line %d + +Warning: stream_socket_client(): Failed to enable crypto in %s on line %d + +Warning: stream_socket_client(): unable to connect to ssl://127.0.0.1:64321 (Unknown error) in %s on line %d +bool(false) +resource(9) of type (stream) diff --git a/ext/openssl/tests/openssl_x509_fingerprint.phpt b/ext/openssl/tests/openssl_x509_fingerprint.phpt new file mode 100644 index 0000000000000..6cd464a894872 --- /dev/null +++ b/ext/openssl/tests/openssl_x509_fingerprint.phpt @@ -0,0 +1,47 @@ +--TEST-- +Testing openssl_x509_fingerprint() +--SKIPIF-- + +--FILE-- + array( + 'local_cert' => __DIR__ . '/san-cert.pem', + 'allow_self_signed' => true, + ), +)); + +$server = stream_socket_server('ssl://127.0.0.1:64321', $errno, $errstr, + STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context); + + +$pid = pcntl_fork(); +if ($pid == -1) { + die('could not fork'); +} else if ($pid) { + $contextC = stream_context_create( + array( + 'ssl' => array( + 'verify_peer' => true, + 'cafile' => __DIR__ . '/san-ca.pem', + 'CN_match' => 'example.org', + ) + ) + ); + var_dump(stream_socket_client("ssl://127.0.0.1:64321", $errno, $errstr, 1, + STREAM_CLIENT_CONNECT, $contextC)); + + $contextC = stream_context_create(array( + 'ssl' => array( + 'verify_peer' => true, + 'cafile' => __DIR__ . '/san-ca.pem', + 'CN_match' => 'moar.example.org', + ) + )); + + var_dump(stream_socket_client("ssl://127.0.0.1:64321", $errno, $errstr, 1, + STREAM_CLIENT_CONNECT, $contextC)); + +} else { + @pcntl_wait($status); + @stream_socket_accept($server, 1); + @stream_socket_accept($server, 1); +} +--EXPECTF-- +resource(%d) of type (stream) + +Warning: stream_socket_client(): Unable to locate peer certificate CN in %s on line %d + +Warning: stream_socket_client(): Failed to enable crypto in %s on line %d + +Warning: stream_socket_client(): unable to connect to ssl://127.0.0.1:64321 (Unknown error) in %s on line %d +bool(false) diff --git a/ext/openssl/tests/streams_crypto_method.pem b/ext/openssl/tests/streams_crypto_method.pem new file mode 100644 index 0000000000000..9d754d460d57c --- /dev/null +++ b/ext/openssl/tests/streams_crypto_method.pem @@ -0,0 +1,33 @@ +-----BEGIN CERTIFICATE----- +MIIC5jCCAk+gAwIBAgIBADANBgkqhkiG9w0BAQQFADBcMQswCQYDVQQGEwJBVTET +MBEGA1UECBMKUXVlZW5zbGFuZDEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQx +HDAaBgNVBAMTE1Rlc3QgUENBICgxMDI0IGJpdCkwHhcNOTkxMjAyMjEzNTQ4WhcN +MDUwNzExMjEzNTQ4WjBcMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFu +ZDEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxHDAaBgNVBAMTE1Rlc3QgUENB +ICgxMDI0IGJpdCkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJ2haT/f5Zwy +V+MiuSDjSR62adBoSiBB7Usty44lXqsp9RICw+DCCxpsn/CfxPEDXLLd4olsWXc6 +JRcxGynbYmnzk+Z6aIPPJQhK3CTvaqGnWKZsA1m+WaUIUqJCuNTK4N+7hMAGaf6S +S3e9HVgEQ4a34gXJ7VQFVIBNV1EnZRWHAgMBAAGjgbcwgbQwHQYDVR0OBBYEFE0R +aEcrj18q1dw+G6nJbsTWR213MIGEBgNVHSMEfTB7gBRNEWhHK49fKtXcPhupyW7E +1kdtd6FgpF4wXDELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxGjAY +BgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYDVQQDExNUZXN0IFBDQSAoMTAy +NCBiaXQpggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAUa8B3pho ++Mvxeq9HsEzJxHIFQla05S5J/e/V+DQTYoKiRFchKPrDAdrzYSEvP3h4QJEtsNqQ +JfOxg5M42uLFq7aPGWkF6ZZqZsYS+zA9IVT14g7gNA6Ne+5QtJqQtH9HA24st0T0 +Tga/lZ9M2ovImovaxSL/kRHbpCWcqWVxpOw= +-----END CERTIFICATE----- +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQCdoWk/3+WcMlfjIrkg40ketmnQaEogQe1LLcuOJV6rKfUSAsPg +wgsabJ/wn8TxA1yy3eKJbFl3OiUXMRsp22Jp85PmemiDzyUIStwk72qhp1imbANZ +vlmlCFKiQrjUyuDfu4TABmn+kkt3vR1YBEOGt+IFye1UBVSATVdRJ2UVhwIDAQAB +AoGAba4fTtuap5l7/8ZsbE7Z1O32KJY4ZcOZukLOLUUhXxXduT+FTgGWujc0/rgc +z9qYCLlNZHOouMYTgtSfYvuMuLZ11VIt0GYH+nRioLShE59Yy+zCRyC+gPigS1kz +xvo14AsOIPYV14Tk/SsHyq6E0eTk7VzaIE197giiINUERPECQQDSKmtPTh/lRKw7 +HSZSM0I1mFWn/1zqrAbontRQY5w98QWIOe5qmzYyFbPXYT3d9BzlsMyhgiRNoBbD +yvohSHXJAkEAwAHx6ezAZeWWzD5yXD36nyjpkVCw7Tk7TSmOceLJMWt1QcrCfqlS +xA5jjpQ6Z8suU5DdtWAryM2sAir1WisYzwJAd6Zcx56jvAQ3xcPXsE6scBTVFzrj +7FqZ6E+cclPzfLQ+QQsyOBE7bpI6e/FJppY26XGZXo3YGzV8IGXrt40oOQJALETG +h86EFXo3qGOFbmsDy4pdP5nBERCu8X1xUCSfintiD4c2DInxgS5oGclnJeMcjTvL +QjQoJCX3UJCi/OUO1QJBAKgcDHWjMvt+l1pjJBsSEZ0HX9AAIIVx0RQmbFGS+F2Q +hhu5l77WnnZOQ9vvhV5u7NPCUF9nhU3jh60qWWO8mkc= +-----END RSA PRIVATE KEY----- diff --git a/ext/openssl/tests/streams_crypto_method.phpt b/ext/openssl/tests/streams_crypto_method.phpt new file mode 100644 index 0000000000000..97a6e9ee8ba85 --- /dev/null +++ b/ext/openssl/tests/streams_crypto_method.phpt @@ -0,0 +1,77 @@ +--TEST-- +Specific crypto method for ssl:// transports. +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Hello World! diff --git a/ext/openssl/tests/tlsv1.1_wrapper_001.phpt b/ext/openssl/tests/tlsv1.1_wrapper_001.phpt new file mode 100644 index 0000000000000..56211f0b965e0 --- /dev/null +++ b/ext/openssl/tests/tlsv1.1_wrapper_001.phpt @@ -0,0 +1,46 @@ +--TEST-- +tlsv1.1 stream wrapper +--SKIPIF-- + array( + 'local_cert' => __DIR__ . '/streams_crypto_method.pem', +))); + +$server = stream_socket_server('tlsv1.1://127.0.0.1:64321', $errno, $errstr, $flags, $ctx); +var_dump($server); + +$pid = pcntl_fork(); +if ($pid == -1) { + die('could not fork'); +} elseif ($pid) { + $flags = STREAM_CLIENT_CONNECT; + $ctx = stream_context_create(array('ssl' => array( + 'verify_peer' => false + ))); + + $client = stream_socket_client("tlsv1.1://127.0.0.1:64321", $errno, $errstr, 1, $flags, $ctx); + var_dump($client); + + $client = @stream_socket_client("sslv3://127.0.0.1:64321", $errno, $errstr, 1, $flags, $ctx); + var_dump($client); + + $client = @stream_socket_client("tlsv1.2://127.0.0.1:64321", $errno, $errstr, 1, $flags, $ctx); + var_dump($client); + +} else { + @pcntl_wait($status); + for ($i=0; $i < 3; $i++) { + @stream_socket_accept($server, 1); + } +} +--EXPECTF-- +resource(%d) of type (stream) +resource(%d) of type (stream) +bool(false) +bool(false) diff --git a/ext/openssl/tests/tlsv1.2_wrapper_002.phpt b/ext/openssl/tests/tlsv1.2_wrapper_002.phpt new file mode 100644 index 0000000000000..cb3f4106c727e --- /dev/null +++ b/ext/openssl/tests/tlsv1.2_wrapper_002.phpt @@ -0,0 +1,46 @@ +--TEST-- +tlsv1.2 stream wrapper +--SKIPIF-- + array( + 'local_cert' => __DIR__ . '/streams_crypto_method.pem', +))); + +$server = stream_socket_server('tlsv1.2://127.0.0.1:64321', $errno, $errstr, $flags, $ctx); +var_dump($server); + +$pid = pcntl_fork(); +if ($pid == -1) { + die('could not fork'); +} elseif ($pid) { + $flags = STREAM_CLIENT_CONNECT; + $ctx = stream_context_create(array('ssl' => array( + 'verify_peer' => false + ))); + + $client = stream_socket_client("tlsv1.2://127.0.0.1:64321", $errno, $errstr, 1, $flags, $ctx); + var_dump($client); + + $client = @stream_socket_client("sslv3://127.0.0.1:64321", $errno, $errstr, 1, $flags, $ctx); + var_dump($client); + + $client = @stream_socket_client("tlsv1.1://127.0.0.1:64321", $errno, $errstr, 1, $flags, $ctx); + var_dump($client); + +} else { + @pcntl_wait($status); + for ($i=0; $i < 3; $i++) { + @stream_socket_accept($server, 1); + } +} +--EXPECTF-- +resource(%d) of type (stream) +resource(%d) of type (stream) +bool(false) +bool(false) diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index d7ef42e0b1ddd..2e7f0cdc3f676 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -346,6 +346,24 @@ static inline int php_openssl_setup_crypto(php_stream *stream, sslsock->is_client = 1; method = TLSv1_client_method(); break; + case STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT: +#if OPENSSL_VERSION_NUMBER >= 0x10001001L + sslsock->is_client = 1; + method = TLSv1_1_client_method(); + break; +#else + php_error_docref(NULL TSRMLS_CC, E_WARNING, "TLSv1.1 support is not compiled into the OpenSSL library PHP is linked against"); + return -1; +#endif + case STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT: +#if OPENSSL_VERSION_NUMBER >= 0x10001001L + sslsock->is_client = 1; + method = TLSv1_2_client_method(); + break; +#else + php_error_docref(NULL TSRMLS_CC, E_WARNING, "TLSv1.2 support is not compiled into the OpenSSL library PHP is linked against"); + return -1; +#endif case STREAM_CRYPTO_METHOD_SSLv23_SERVER: sslsock->is_client = 0; method = SSLv23_server_method(); @@ -367,6 +385,24 @@ static inline int php_openssl_setup_crypto(php_stream *stream, sslsock->is_client = 0; method = TLSv1_server_method(); break; + case STREAM_CRYPTO_METHOD_TLSv1_1_SERVER: +#if OPENSSL_VERSION_NUMBER >= 0x10001001L + sslsock->is_client = 0; + method = TLSv1_1_server_method(); + break; +#else + php_error_docref(NULL TSRMLS_CC, E_WARNING, "TLSv1.1 support is not compiled into the OpenSSL library PHP is linked against"); + return -1; +#endif + case STREAM_CRYPTO_METHOD_TLSv1_2_SERVER: +#if OPENSSL_VERSION_NUMBER >= 0x10001001L + sslsock->is_client = 0; + method = TLSv1_2_server_method(); + break; +#else + php_error_docref(NULL TSRMLS_CC, E_WARNING, "TLSv1.2 support is not compiled into the OpenSSL library PHP is linked against"); + return -1; +#endif default: return -1; @@ -667,6 +703,12 @@ static inline int php_openssl_tcp_sockop_accept(php_stream *stream, php_openssl_ case STREAM_CRYPTO_METHOD_TLS_CLIENT: sock->method = STREAM_CRYPTO_METHOD_TLS_SERVER; break; + case STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT: + sock->method = STREAM_CRYPTO_METHOD_TLSv1_1_SERVER; + break; + case STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT: + sock->method = STREAM_CRYPTO_METHOD_TLSv1_2_SERVER; + break; default: break; } @@ -853,8 +895,32 @@ php_stream_ops php_openssl_socket_ops = { php_openssl_sockop_set_option, }; -static char * get_sni(php_stream_context *ctx, const char *resourcename, size_t resourcenamelen, int is_persistent TSRMLS_DC) { +static int get_crypto_method(php_stream_context *ctx) { + if (ctx) { + zval **val = NULL; + long crypto_method; + + if (php_stream_context_get_option(ctx, "ssl", "crypto_method", &val) == SUCCESS) { + convert_to_long_ex(val); + crypto_method = (long)Z_LVAL_PP(val); + + switch (crypto_method) { + case STREAM_CRYPTO_METHOD_SSLv2_CLIENT: + case STREAM_CRYPTO_METHOD_SSLv3_CLIENT: + case STREAM_CRYPTO_METHOD_SSLv23_CLIENT: + case STREAM_CRYPTO_METHOD_TLS_CLIENT: + case STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT: + case STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT: + return crypto_method; + } + + } + } + + return STREAM_CRYPTO_METHOD_SSLv23_CLIENT; +} +static char * get_sni(php_stream_context *ctx, const char *resourcename, size_t resourcenamelen, int is_persistent TSRMLS_DC) { php_url *url; if (ctx) { @@ -939,7 +1005,12 @@ php_stream *php_openssl_ssl_socket_factory(const char *proto, size_t protolen, if (strncmp(proto, "ssl", protolen) == 0) { sslsock->enable_on_connect = 1; - sslsock->method = STREAM_CRYPTO_METHOD_SSLv23_CLIENT; + + /* General ssl:// transports can use a number + * of crypto methods. The actual methhod can be + * provided in the streams context options. + */ + sslsock->method = get_crypto_method(context); } else if (strncmp(proto, "sslv2", protolen) == 0) { #ifdef OPENSSL_NO_SSL2 php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSLv2 support is not compiled into the OpenSSL library PHP is linked against"); @@ -954,8 +1025,24 @@ php_stream *php_openssl_ssl_socket_factory(const char *proto, size_t protolen, } else if (strncmp(proto, "tls", protolen) == 0) { sslsock->enable_on_connect = 1; sslsock->method = STREAM_CRYPTO_METHOD_TLS_CLIENT; + } else if (strncmp(proto, "tlsv1.1", protolen) == 0) { +#if OPENSSL_VERSION_NUMBER >= 0x10001001L + sslsock->enable_on_connect = 1; + sslsock->method = STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT; +#else + php_error_docref(NULL TSRMLS_CC, E_WARNING, "TLSv1.1 support is not compiled into the OpenSSL library PHP is linked against"); + return NULL; +#endif + } else if (strncmp(proto, "tlsv1.2", protolen) == 0) { +#if OPENSSL_VERSION_NUMBER >= 0x10001001L + sslsock->enable_on_connect = 1; + sslsock->method = STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; +#else + php_error_docref(NULL TSRMLS_CC, E_WARNING, "TLSv1.2 support is not compiled into the OpenSSL library PHP is linked against"); + return NULL; +#endif } - + return stream; } diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 9ac913bea06c5..67c6c58ed96b9 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -460,7 +460,7 @@ static void pdo_stmt_construct(pdo_stmt_t *stmt, zval *object, zend_class_entry if (dbstmt_ce->constructor) { zend_fcall_info fci; zend_fcall_info_cache fcc; - zval *retval; + zval *retval = NULL; fci.size = sizeof(zend_fcall_info); fci.function_table = &dbstmt_ce->function_table; @@ -495,7 +495,7 @@ static void pdo_stmt_construct(pdo_stmt_t *stmt, zval *object, zend_class_entry zval_dtor(object); ZVAL_NULL(object); object = NULL; /* marks failure */ - } else { + } else if (retval) { zval_ptr_dtor(&retval); } @@ -997,7 +997,7 @@ static PHP_METHOD(PDO, lastInsertId) pdo_raise_impl_error(dbh, NULL, "IM001", "driver does not support lastInsertId()" TSRMLS_CC); RETURN_FALSE; } else { - Z_STRVAL_P(return_value) = dbh->methods->last_id(dbh, name, &Z_STRLEN_P(return_value) TSRMLS_CC); + Z_STRVAL_P(return_value) = dbh->methods->last_id(dbh, name, (unsigned int *)&Z_STRLEN_P(return_value) TSRMLS_CC); if (!Z_STRVAL_P(return_value)) { PDO_HANDLE_DBH_ERR(); RETURN_FALSE; @@ -1328,16 +1328,12 @@ int pdo_hash_methods(pdo_dbh_t *dbh, int kind TSRMLS_DC) } else { ifunc->required_num_args = info->required_num_args; } - if (info->pass_rest_by_reference) { - if (info->pass_rest_by_reference == ZEND_SEND_PREFER_REF) { - ifunc->fn_flags |= ZEND_ACC_PASS_REST_PREFER_REF; - } else { - ifunc->fn_flags |= ZEND_ACC_PASS_REST_BY_REFERENCE; - } - } if (info->return_reference) { ifunc->fn_flags |= ZEND_ACC_RETURN_REFERENCE; } + if (funcs->arg_info[funcs->num_args].is_variadic) { + ifunc->fn_flags |= ZEND_ACC_VARIADIC; + } } else { ifunc->arg_info = NULL; ifunc->num_args = 0; diff --git a/ext/pdo/pdo_sql_parser.c b/ext/pdo/pdo_sql_parser.c index aea362fdb26d3..37d8752d62151 100644 --- a/ext/pdo/pdo_sql_parser.c +++ b/ext/pdo/pdo_sql_parser.c @@ -586,7 +586,9 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, } plc->freeq = 1; } else { - switch (Z_TYPE_P(param->parameter)) { + zval tmp_param = *param->parameter; + zval_copy_ctor(&tmp_param); + switch (Z_TYPE(tmp_param)) { case IS_NULL: plc->quoted = "NULL"; plc->qlen = sizeof("NULL")-1; @@ -594,20 +596,20 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, break; case IS_BOOL: - convert_to_long(param->parameter); - + convert_to_long(&tmp_param); + /* fall through */ case IS_LONG: case IS_DOUBLE: - convert_to_string(param->parameter); - plc->qlen = Z_STRLEN_P(param->parameter); - plc->quoted = Z_STRVAL_P(param->parameter); - plc->freeq = 0; + convert_to_string(&tmp_param); + plc->qlen = Z_STRLEN(tmp_param); + plc->quoted = estrdup(Z_STRVAL(tmp_param)); + plc->freeq = 1; break; default: - convert_to_string(param->parameter); - if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter), - Z_STRLEN_P(param->parameter), &plc->quoted, &plc->qlen, + convert_to_string(&tmp_param); + if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL(tmp_param), + Z_STRLEN(tmp_param), &plc->quoted, &plc->qlen, param->param_type TSRMLS_CC)) { /* bork */ ret = -1; @@ -616,6 +618,7 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, } plc->freeq = 1; } + zval_dtor(&tmp_param); } } else { plc->quoted = Z_STRVAL_P(param->parameter); diff --git a/ext/pdo/pdo_sql_parser.re b/ext/pdo/pdo_sql_parser.re index 1936a37340bb1..fa8ef187fa9a1 100644 --- a/ext/pdo/pdo_sql_parser.re +++ b/ext/pdo/pdo_sql_parser.re @@ -228,7 +228,9 @@ safe: } plc->freeq = 1; } else { - switch (Z_TYPE_P(param->parameter)) { + zval tmp_param = *param->parameter; + zval_copy_ctor(&tmp_param); + switch (Z_TYPE(tmp_param)) { case IS_NULL: plc->quoted = "NULL"; plc->qlen = sizeof("NULL")-1; @@ -236,20 +238,20 @@ safe: break; case IS_BOOL: - convert_to_long(param->parameter); - + convert_to_long(&tmp_param); + /* fall through */ case IS_LONG: case IS_DOUBLE: - convert_to_string(param->parameter); - plc->qlen = Z_STRLEN_P(param->parameter); - plc->quoted = Z_STRVAL_P(param->parameter); - plc->freeq = 0; + convert_to_string(&tmp_param); + plc->qlen = Z_STRLEN(tmp_param); + plc->quoted = estrdup(Z_STRVAL(tmp_param)); + plc->freeq = 1; break; default: - convert_to_string(param->parameter); - if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter), - Z_STRLEN_P(param->parameter), &plc->quoted, &plc->qlen, + convert_to_string(&tmp_param); + if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL(tmp_param), + Z_STRLEN(tmp_param), &plc->quoted, &plc->qlen, param->param_type TSRMLS_CC)) { /* bork */ ret = -1; @@ -258,6 +260,7 @@ safe: } plc->freeq = 1; } + zval_dtor(&tmp_param); } } else { plc->quoted = Z_STRVAL_P(param->parameter); diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 62eb5e436ba64..04e71823b9ded 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -1146,7 +1146,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, zval_ptr_dtor(&val); pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize class" TSRMLS_CC); return 0; - } else if (ce->unserialize(&return_value, ce, Z_TYPE_P(val) == IS_STRING ? Z_STRVAL_P(val) : "", Z_TYPE_P(val) == IS_STRING ? Z_STRLEN_P(val) : 0, NULL TSRMLS_CC) == FAILURE) { + } else if (ce->unserialize(&return_value, ce, (unsigned char *)(Z_TYPE_P(val) == IS_STRING ? Z_STRVAL_P(val) : ""), Z_TYPE_P(val) == IS_STRING ? Z_STRLEN_P(val) : 0, NULL TSRMLS_CC) == FAILURE) { zval_ptr_dtor(&val); pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize class" TSRMLS_CC); zval_dtor(return_value); diff --git a/ext/pdo/tests/bug65946.phpt b/ext/pdo/tests/bug65946.phpt new file mode 100644 index 0000000000000..30261d638aa89 --- /dev/null +++ b/ext/pdo/tests/bug65946.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #65946 (pdo_sql_parser.c permanently converts values bound to strings) +--SKIPIF-- + +--FILE-- +setAttribute(PDO::ATTR_EMULATE_PREPARES, true); +$db->exec('CREATE TABLE test(id int)'); +$db->exec('INSERT INTO test VALUES(1)'); +$db->exec('INSERT INTO test VALUES(2)'); +$stmt = $db->prepare('SELECT * FROM testtable LIMIT :limit'); +$stmt->bindValue('limit', 1, PDO::PARAM_INT); +if(!($res = $stmt->execute())) var_dump($stmt->errorInfo()); +if(!($res = $stmt->execute())) var_dump($stmt->errorInfo()); +var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); +?> +--EXPECTF-- +array(1) { + [0]=> + array(1) { + ["id"]=> + string(1) "2" + } +} diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c index b49ad2691f645..daf5494d5839f 100644 --- a/ext/pdo_dblib/dblib_driver.c +++ b/ext/pdo_dblib/dblib_driver.c @@ -350,9 +350,10 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ DBSETLAPP(H->login, vars[1].optval); +/* DBSETLDBNAME is only available in FreeTDS 0.92 or above */ #ifdef DBSETLDBNAME if (vars[3].optval) { - DBSETLDBNAME(H->login, vars[3].optval); + if(FAIL == DBSETLDBNAME(H->login, vars[3].optval)) goto cleanup; } #endif @@ -362,36 +363,31 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ goto cleanup; } +/* + * FreeTDS < 0.92 does not support the DBSETLDBNAME option + * Send use database here after login (Will not work with SQL Azure) + */ +#ifndef DBSETLDBNAME + if (vars[3].optval) { + if(FAIL == dbuse(H->link, vars[3].optval)) goto cleanup; + } +#endif + +#if PHP_DBLIB_IS_MSSQL /* dblib do not return more than this length from text/image */ DBSETOPT(H->link, DBTEXTLIMIT, "2147483647"); +#endif /* limit text/image from network */ DBSETOPT(H->link, DBTEXTSIZE, "2147483647"); /* allow double quoted indentifiers */ - DBSETOPT(H->link, DBQUOTEDIDENT, NULL); + DBSETOPT(H->link, DBQUOTEDIDENT, "1"); ret = 1; dbh->max_escaped_char_length = 2; dbh->alloc_own_columns = 1; -#if 0 - /* Cache the supported data types from the servers systypes table */ - if(dbcmd(H->link, "select usertype, name from systypes order by usertype") != FAIL) { - if(dbsqlexec(H->link) != FAIL) { - dbresults(H->link); - while (dbnextrow(H->link) == SUCCESS) { - val = dbdata(H->link, 1); - add_index_string(pdo_dblib_datatypes, *val, dbdata(H->link, 2), 1); - } - } - /* Throw out any remaining resultsets */ - dbcancel(H-link); - } -#endif - - - cleanup: for (i = 0; i < nvars; i++) { if (vars[i].freeme) { diff --git a/ext/pdo_firebird/CREDITS b/ext/pdo_firebird/CREDITS index a33294b69c0e6..60b917415db69 100644 --- a/ext/pdo_firebird/CREDITS +++ b/ext/pdo_firebird/CREDITS @@ -1,2 +1,2 @@ -Firebird/InterBase driver for PDO +Firebird driver for PDO Ard Biesheuvel diff --git a/ext/pdo_firebird/package2.xml b/ext/pdo_firebird/package2.xml index 5b5984c80fa56..b744d388bc0d5 100644 --- a/ext/pdo_firebird/package2.xml +++ b/ext/pdo_firebird/package2.xml @@ -5,9 +5,9 @@ http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> PDO_FIREBIRD pecl.php.net - Firebird/InterBase 6 driver for PDO - This extension provides a Firebird/InterBase driver for PDO. It supports -all versions of Firebird and InterBase versions 6 and up. + Firebird driver for PDO + This extension provides a Firebird driver for PDO. It supports +all versions of Firebird 2.1 and up. Ard Biesheuvel @@ -15,18 +15,17 @@ all versions of Firebird and InterBase versions 6 and up. abies@php.net yes - 2006-05-01 + 2013-09-01 - 0.3 - 0.3 + 1.0 + 1.0 - beta - beta + stable + stable PHP - To compile and run this module, you will need to have the main PDO module and Firebird's -or InterBase's client library installed on your system. + To compile and run this module, you will need to have the main PDO module and Firebird's client library installed on your system. Hope it works! @@ -49,7 +48,7 @@ Hope it works! - 5.0.3 + 5.3.27 1.4.0 diff --git a/ext/pdo_mysql/tests/bug_39858.phpt b/ext/pdo_mysql/tests/bug_39858.phpt index 47457180a5b60..cb9cafd9f59b6 100644 --- a/ext/pdo_mysql/tests/bug_39858.phpt +++ b/ext/pdo_mysql/tests/bug_39858.phpt @@ -18,6 +18,8 @@ if ($version < 50000) die(sprintf("skip Need MySQL Server 5.0.0+, found %d.%02d.%02d (%d)\n", $matches[0], $matches[1], $matches[2], $version)); ?> +--XFAIL-- +nextRowset() problem with stored proc & emulation mode & mysqlnd --FILE-- fetch(PDO::FETCH_ASSOC); $con1 = $tmp['_con1']; - $db2 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true)); + @$db2 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true)); $stmt = $db2->query('SELECT CONNECTION_ID() as _con2'); $tmp = $stmt->fetch(PDO::FETCH_ASSOC); $con2 = $tmp['_con2']; @@ -94,4 +94,4 @@ MySQLPDOTest::skip(); print "done!"; ?> --EXPECTF-- -done! \ No newline at end of file +done! diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt index 799624543141d..9165e70551f3e 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt @@ -1,5 +1,7 @@ --TEST-- MySQL PDOStatement->nextRowSet() +--XFAIL-- +nextRowset() problem with stored proc & emulation mode & mysqlnd --SKIPIF-- --EXPECTF-- -done! \ No newline at end of file +done! diff --git a/ext/pdo_sqlite/tests/bug66033.phpt b/ext/pdo_sqlite/tests/bug66033.phpt new file mode 100644 index 0000000000000..28da3b54bfff1 --- /dev/null +++ b/ext/pdo_sqlite/tests/bug66033.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #66033 (Segmentation Fault when constructor of PDO statement throws an exception) +--SKIPIF-- + +--FILE-- +dbh = $dbh; + throw new Exception("Blah"); + } +} + +$pdo = new PDO('sqlite::memory:', null, null); +$pdo->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('DBStatement', + array($pdo))); +$pdo->exec("CREATE TABLE IF NOT EXISTS messages ( + id INTEGER PRIMARY KEY, + title TEXT, + message TEXT, + time INTEGER)"); + +try { + $pdoStatement = $pdo->query("select * from messages"); +} catch (Exception $e) { + var_dump($e->getMessage()); +} +?> +--EXPECTF-- +string(4) "Blah" diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 2670914b7891a..32d407af70ac3 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -63,6 +63,7 @@ #define PGSQL_MAX_LENGTH_OF_LONG 30 #define PGSQL_MAX_LENGTH_OF_DOUBLE 60 +#if LONG_MAX < UINT_MAX #define PGSQL_RETURN_OID(oid) do { \ if (oid > LONG_MAX) { \ smart_str s = {0}; \ @@ -72,7 +73,9 @@ } \ RETURN_LONG((long)oid); \ } while(0) - +#else +#define PGSQL_RETURN_OID(oid) (RETURN_LONG((long)oid)) +#endif #if HAVE_PQSETNONBLOCKING #define PQ_SETNONBLOCKING(pg_link, flag) PQsetnonblocking(pg_link, flag) @@ -2636,7 +2639,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type, Bucket *p; fci.param_count = 0; - fci.params = safe_emalloc(sizeof(zval*), ht->nNumOfElements, 0); + fci.params = safe_emalloc(sizeof(zval***), ht->nNumOfElements, 0); p = ht->pListHead; while (p != NULL) { fci.params[fci.param_count++] = (zval**)p->pData; diff --git a/ext/phar/config.m4 b/ext/phar/config.m4 index d424060f2a247..614d672eabd9d 100644 --- a/ext/phar/config.m4 +++ b/ext/phar/config.m4 @@ -28,5 +28,7 @@ if test "$PHP_PHAR" != "no"; then PHP_ADD_EXTENSION_DEP(phar, spl, true) PHP_ADD_MAKEFILE_FRAGMENT + PHP_INSTALL_HEADERS([ext/phar], [php_phar.h]) + PHP_OUTPUT(ext/phar/phar.1 ext/phar/phar.phar.1) fi diff --git a/ext/phar/dirstream.c b/ext/phar/dirstream.c index b090577306758..0f2580000ddd2 100644 --- a/ext/phar/dirstream.c +++ b/ext/phar/dirstream.c @@ -94,31 +94,23 @@ static size_t phar_dir_read(php_stream *stream, char *buf, size_t count TSRMLS_D { size_t to_read; HashTable *data = (HashTable *)stream->abstract; - phar_zstr key; char *str_key; uint keylen; ulong unused; - if (FAILURE == zend_hash_has_more_elements(data)) { + if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(data, &str_key, &keylen, &unused, 0, NULL)) { return 0; } - if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(data, &key, &keylen, &unused, 0, NULL)) { - return 0; - } - - PHAR_STR(key, str_key); zend_hash_move_forward(data); to_read = MIN(keylen, count); if (to_read == 0 || count < keylen) { - PHAR_STR_FREE(str_key); return 0; } memset(buf, 0, sizeof(php_stream_dirent)); memcpy(((php_stream_dirent *) buf)->d_name, str_key, to_read); - PHAR_STR_FREE(str_key); ((php_stream_dirent *) buf)->d_name[to_read + 1] = '\0'; return sizeof(php_stream_dirent); @@ -168,11 +160,7 @@ static int phar_compare_dir_name(const void *a, const void *b TSRMLS_DC) /* {{{ f = *((Bucket **) a); s = *((Bucket **) b); -#if (PHP_MAJOR_VERSION < 6) result = zend_binary_strcmp(f->arKey, f->nKeyLength, s->arKey, s->nKeyLength); -#else - result = zend_binary_strcmp(f->key.arKey.s, f->nKeyLength, s->key.arKey.s, s->nKeyLength); -#endif if (result < 0) { return -1; @@ -193,13 +181,12 @@ static php_stream *phar_make_dirstream(char *dir, HashTable *manifest TSRMLS_DC) { HashTable *data; int dirlen = strlen(dir); - phar_zstr key; char *entry, *found, *save, *str_key; uint keylen; ulong unused; ALLOC_HASHTABLE(data); - zend_hash_init(data, 64, zend_get_hash_value, NULL, 0); + zend_hash_init(data, 64, NULL, NULL, 0); if ((*dir == '/' && dirlen == 1 && (manifest->nNumOfElements == 0)) || (dirlen >= sizeof(".phar")-1 && !memcmp(dir, ".phar", sizeof(".phar")-1))) { /* make empty root directory for empty phar */ @@ -211,15 +198,12 @@ static php_stream *phar_make_dirstream(char *dir, HashTable *manifest TSRMLS_DC) zend_hash_internal_pointer_reset(manifest); while (FAILURE != zend_hash_has_more_elements(manifest)) { - if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(manifest, &key, &keylen, &unused, 0, NULL)) { + if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(manifest, &str_key, &keylen, &unused, 0, NULL)) { break; } - PHAR_STR(key, str_key); - if (keylen <= (uint)dirlen) { if (keylen < (uint)dirlen || !strncmp(str_key, dir, dirlen)) { - PHAR_STR_FREE(str_key); if (SUCCESS != zend_hash_move_forward(manifest)) { break; } @@ -230,7 +214,6 @@ static php_stream *phar_make_dirstream(char *dir, HashTable *manifest TSRMLS_DC) if (*dir == '/') { /* root directory */ if (keylen >= sizeof(".phar")-1 && !memcmp(str_key, ".phar", sizeof(".phar")-1)) { - PHAR_STR_FREE(str_key); /* do not add any magic entries to this directory */ if (SUCCESS != zend_hash_move_forward(manifest)) { break; @@ -250,19 +233,16 @@ static php_stream *phar_make_dirstream(char *dir, HashTable *manifest TSRMLS_DC) entry[keylen] = '\0'; } - PHAR_STR_FREE(str_key); goto PHAR_ADD_ENTRY; } else { if (0 != memcmp(str_key, dir, dirlen)) { /* entry in directory not found */ - PHAR_STR_FREE(str_key); if (SUCCESS != zend_hash_move_forward(manifest)) { break; } continue; } else { if (str_key[dirlen] != '/') { - PHAR_STR_FREE(str_key); if (SUCCESS != zend_hash_move_forward(manifest)) { break; } @@ -289,7 +269,6 @@ static php_stream *phar_make_dirstream(char *dir, HashTable *manifest TSRMLS_DC) entry[keylen - dirlen - 1] = '\0'; keylen = keylen - dirlen - 1; } - PHAR_STR_FREE(str_key); PHAR_ADD_ENTRY: if (keylen) { phar_add_empty(data, entry, keylen); @@ -324,7 +303,6 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, php_url *resource = NULL; php_stream *ret; char *internal_file, *error, *str_key; - phar_zstr key; uint keylen; ulong unused; phar_archive_data *phar; @@ -405,17 +383,14 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, while (FAILURE != zend_hash_has_more_elements(&phar->manifest)) { if (HASH_KEY_NON_EXISTENT != zend_hash_get_current_key_ex( - &phar->manifest, &key, &keylen, &unused, 0, NULL)) { - PHAR_STR(key, str_key); + &phar->manifest, &str_key, &keylen, &unused, 0, NULL)) { if (keylen > (uint)i_len && 0 == memcmp(str_key, internal_file, i_len)) { - PHAR_STR_FREE(str_key); /* directory found */ internal_file = estrndup(internal_file, i_len); php_url_free(resource); return phar_make_dirstream(internal_file, &phar->manifest TSRMLS_CC); } - PHAR_STR_FREE(str_key); } if (SUCCESS != zend_hash_move_forward(&phar->manifest)) { @@ -572,7 +547,6 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options int arch_len, entry_len; php_url *resource = NULL; uint host_len; - phar_zstr key; char *str_key; uint key_len; ulong unused; @@ -637,15 +611,12 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options if (!entry->is_deleted) { for (zend_hash_internal_pointer_reset(&phar->manifest); - HASH_KEY_NON_EXISTENT != zend_hash_get_current_key_ex(&phar->manifest, &key, &key_len, &unused, 0, NULL); - zend_hash_move_forward(&phar->manifest)) { - - PHAR_STR(key, str_key); - + HASH_KEY_NON_EXISTENT != zend_hash_get_current_key_ex(&phar->manifest, &str_key, &key_len, &unused, 0, NULL); + zend_hash_move_forward(&phar->manifest) + ) { if (key_len > path_len && memcmp(str_key, resource->path+1, path_len) == 0 && IS_SLASH(str_key[path_len])) { - PHAR_STR_FREE(str_key); php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: Directory not empty"); if (entry->is_temp_dir) { efree(entry->filename); @@ -654,19 +625,15 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options php_url_free(resource); return 0; } - PHAR_STR_FREE(str_key); } for (zend_hash_internal_pointer_reset(&phar->virtual_dirs); - HASH_KEY_NON_EXISTENT != zend_hash_get_current_key_ex(&phar->virtual_dirs, &key, &key_len, &unused, 0, NULL); + HASH_KEY_NON_EXISTENT != zend_hash_get_current_key_ex(&phar->virtual_dirs, &str_key, &key_len, &unused, 0, NULL); zend_hash_move_forward(&phar->virtual_dirs)) { - PHAR_STR(key, str_key); - if (key_len > path_len && memcmp(str_key, resource->path+1, path_len) == 0 && IS_SLASH(str_key[path_len])) { - PHAR_STR_FREE(str_key); php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: Directory not empty"); if (entry->is_temp_dir) { efree(entry->filename); @@ -675,7 +642,6 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options php_url_free(resource); return 0; } - PHAR_STR_FREE(str_key); } } diff --git a/ext/phar/phar.c b/ext/phar/phar.c index e8d1139cfa862..d4716bca914ea 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -27,9 +27,7 @@ static void destroy_phar_data(void *pDest); ZEND_DECLARE_MODULE_GLOBALS(phar) -#if PHP_VERSION_ID >= 50300 char *(*phar_save_resolve_path)(const char *filename, int filename_len TSRMLS_DC); -#endif /** * set's phar->is_writeable based on the current INI value @@ -1641,7 +1639,7 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a php_stream_filter_append(&temp->writefilters, filter); - if (SUCCESS != phar_stream_copy_to_stream(fp, temp, PHP_STREAM_COPY_ALL, NULL)) { + if (SUCCESS != php_stream_copy_to_stream_ex(fp, temp, PHP_STREAM_COPY_ALL, NULL)) { if (err) { php_stream_close(temp); MAPPHAR_ALLOC_FAIL("unable to decompress gzipped phar archive \"%s\", ext/zlib is buggy in PHP versions older than 5.2.6") @@ -1683,7 +1681,7 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a php_stream_filter_append(&temp->writefilters, filter); - if (SUCCESS != phar_stream_copy_to_stream(fp, temp, PHP_STREAM_COPY_ALL, NULL)) { + if (SUCCESS != php_stream_copy_to_stream_ex(fp, temp, PHP_STREAM_COPY_ALL, NULL)) { php_stream_close(temp); MAPPHAR_ALLOC_FAIL("unable to decompress bzipped phar archive \"%s\" to temporary file") } @@ -1956,67 +1954,45 @@ int phar_detect_phar_fname_ext(const char *filename, int filename_len, const cha goto woohoo; } } else { - phar_zstr key; char *str_key; uint keylen; ulong unused; - zend_hash_internal_pointer_reset(&(PHAR_GLOBALS->phar_fname_map)); - - while (FAILURE != zend_hash_has_more_elements(&(PHAR_GLOBALS->phar_fname_map))) { - if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(&(PHAR_GLOBALS->phar_fname_map), &key, &keylen, &unused, 0, NULL)) { - break; - } - - PHAR_STR(key, str_key); - + for (zend_hash_internal_pointer_reset(&(PHAR_GLOBALS->phar_fname_map)); + HASH_KEY_NON_EXISTENT != zend_hash_get_current_key_ex(&(PHAR_GLOBALS->phar_fname_map), &str_key, &keylen, &unused, 0, NULL); + zend_hash_move_forward(&(PHAR_GLOBALS->phar_fname_map)) + ) { if (keylen > (uint) filename_len) { - zend_hash_move_forward(&(PHAR_GLOBALS->phar_fname_map)); - PHAR_STR_FREE(str_key); continue; } if (!memcmp(filename, str_key, keylen) && ((uint)filename_len == keylen || filename[keylen] == '/' || filename[keylen] == '\0')) { - PHAR_STR_FREE(str_key); if (FAILURE == zend_hash_get_current_data(&(PHAR_GLOBALS->phar_fname_map), (void **) &pphar)) { break; } *ext_str = filename + (keylen - (*pphar)->ext_len); goto woohoo; } - - PHAR_STR_FREE(str_key); - zend_hash_move_forward(&(PHAR_GLOBALS->phar_fname_map)); } if (PHAR_G(manifest_cached)) { - zend_hash_internal_pointer_reset(&cached_phars); - - while (FAILURE != zend_hash_has_more_elements(&cached_phars)) { - if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(&cached_phars, &key, &keylen, &unused, 0, NULL)) { - break; - } - - PHAR_STR(key, str_key); - + for (zend_hash_internal_pointer_reset(&cached_phars); + HASH_KEY_NON_EXISTENT != zend_hash_get_current_key_ex(&cached_phars, &str_key, &keylen, &unused, 0, NULL); + zend_hash_move_forward(&cached_phars) + ) { if (keylen > (uint) filename_len) { - zend_hash_move_forward(&cached_phars); - PHAR_STR_FREE(str_key); continue; } if (!memcmp(filename, str_key, keylen) && ((uint)filename_len == keylen || filename[keylen] == '/' || filename[keylen] == '\0')) { - PHAR_STR_FREE(str_key); if (FAILURE == zend_hash_get_current_data(&cached_phars, (void **) &pphar)) { break; } *ext_str = filename + (keylen - (*pphar)->ext_len); goto woohoo; } - PHAR_STR_FREE(str_key); - zend_hash_move_forward(&cached_phars); } } } @@ -2701,7 +2677,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert, size_t written; if (!user_stub && phar->halt_offset && oldfile && !phar->is_brandnew) { - phar_stream_copy_to_stream(oldfile, newfile, phar->halt_offset, &written); + php_stream_copy_to_stream_ex(oldfile, newfile, phar->halt_offset, &written); newstub = NULL; } else { /* this is either a brand new phar or a default stub overwrite */ @@ -2889,7 +2865,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert, return EOF; } php_stream_filter_append((&entry->cfp->writefilters), filter); - if (SUCCESS != phar_stream_copy_to_stream(file, entry->cfp, entry->uncompressed_filesize, NULL)) { + if (SUCCESS != php_stream_copy_to_stream_ex(file, entry->cfp, entry->uncompressed_filesize, NULL)) { if (closeoldfile) { php_stream_close(oldfile); } @@ -3121,7 +3097,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert, /* this will have changed for all files that have either changed compression or been modified */ entry->offset = entry->offset_abs = offset; offset += entry->compressed_filesize; - if (phar_stream_copy_to_stream(file, newfile, entry->compressed_filesize, &wrote) == FAILURE) { + if (php_stream_copy_to_stream_ex(file, newfile, entry->compressed_filesize, &wrote) == FAILURE) { if (closeoldfile) { php_stream_close(oldfile); } @@ -3267,7 +3243,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert, } php_stream_filter_append(&phar->fp->writefilters, filter); - phar_stream_copy_to_stream(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); + php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); php_stream_filter_flush(filter, 1); php_stream_filter_remove(filter, 1 TSRMLS_CC); php_stream_close(phar->fp); @@ -3276,14 +3252,14 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert, } else if (phar->flags & PHAR_FILE_COMPRESSED_BZ2) { filter = php_stream_filter_create("bzip2.compress", NULL, php_stream_is_persistent(phar->fp) TSRMLS_CC); php_stream_filter_append(&phar->fp->writefilters, filter); - phar_stream_copy_to_stream(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); + php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); php_stream_filter_flush(filter, 1); php_stream_filter_remove(filter, 1 TSRMLS_CC); php_stream_close(phar->fp); /* use the temp stream as our base */ phar->fp = newfile; } else { - phar_stream_copy_to_stream(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); + php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); /* we could also reopen the file in "rb" mode but there is no need for that */ php_stream_close(newfile); } @@ -3319,31 +3295,18 @@ static size_t phar_zend_stream_reader(void *handle, char *buf, size_t len TSRMLS } /* }}} */ -#if PHP_VERSION_ID >= 50300 static size_t phar_zend_stream_fsizer(void *handle TSRMLS_DC) /* {{{ */ { return ((phar_archive_data*)handle)->halt_offset + 32; } /* }}} */ -#else /* PHP_VERSION_ID */ - -static long phar_stream_fteller_for_zend(void *handle TSRMLS_DC) /* {{{ */ -{ - return (long)php_stream_tell(phar_get_pharfp((phar_archive_data*)handle TSRMLS_CC)); -} -/* }}} */ -#endif - zend_op_array *(*phar_orig_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC); -#if PHP_VERSION_ID >= 50300 #define phar_orig_zend_open zend_stream_open_function + static char *phar_resolve_path(const char *filename, int filename_len TSRMLS_DC) { return phar_find_in_include_path((char *) filename, filename_len, NULL TSRMLS_CC); } -#else -int (*phar_orig_zend_open)(const char *filename, zend_file_handle *handle TSRMLS_DC); -#endif static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC) /* {{{ */ { @@ -3376,7 +3339,6 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type } } else if (phar->flags & PHAR_FILE_COMPRESSION_MASK) { /* compressed phar */ -#if PHP_VERSION_ID >= 50300 file_handle->type = ZEND_HANDLE_STREAM; /* we do our own reading directly from the phar, don't change the next line */ file_handle->handle.stream.handle = phar; @@ -3388,18 +3350,6 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type php_stream_rewind(PHAR_GLOBALS->cached_fp[phar->phar_pos].fp) : php_stream_rewind(phar->fp); memset(&file_handle->handle.stream.mmap, 0, sizeof(file_handle->handle.stream.mmap)); -#else /* PHP_VERSION_ID */ - file_handle->type = ZEND_HANDLE_STREAM; - /* we do our own reading directly from the phar, don't change the next line */ - file_handle->handle.stream.handle = phar; - file_handle->handle.stream.reader = phar_zend_stream_reader; - file_handle->handle.stream.closer = NULL; /* don't close - let phar handle this one */ - file_handle->handle.stream.fteller = phar_stream_fteller_for_zend; - file_handle->handle.stream.interactive = 0; - phar->is_persistent ? - php_stream_rewind(PHAR_GLOBALS->cached_fp[phar->phar_pos].fp) : - php_stream_rewind(phar->fp); -#endif } } } @@ -3424,60 +3374,6 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type } /* }}} */ -#if PHP_VERSION_ID < 50300 -int phar_zend_open(const char *filename, zend_file_handle *handle TSRMLS_DC) /* {{{ */ -{ - char *arch, *entry; - int arch_len, entry_len; - - /* this code is obsoleted in php 5.3 */ - entry = (char *) filename; - if (!IS_ABSOLUTE_PATH(entry, strlen(entry)) && !strstr(entry, "://")) { - phar_archive_data **pphar = NULL; - char *fname; - int fname_len; - - fname = (char*)zend_get_executed_filename(TSRMLS_C); - fname_len = strlen(fname); - - if (fname_len > 7 && !strncasecmp(fname, "phar://", 7)) { - if (SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 1, 0 TSRMLS_CC)) { - zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), arch, arch_len, (void **) &pphar); - if (!pphar && PHAR_G(manifest_cached)) { - zend_hash_find(&cached_phars, arch, arch_len, (void **) &pphar); - } - efree(arch); - efree(entry); - } - } - - /* retrieving an include within the current directory, so use this if possible */ - if (!(entry = phar_find_in_include_path((char *) filename, strlen(filename), NULL TSRMLS_CC))) { - /* this file is not in the phar, use the original path */ - goto skip_phar; - } - - if (SUCCESS == phar_orig_zend_open(entry, handle TSRMLS_CC)) { - if (!handle->opened_path) { - handle->opened_path = entry; - } - if (entry != filename) { - handle->free_filename = 1; - } - return SUCCESS; - } - - if (entry != filename) { - efree(entry); - } - - return FAILURE; - } -skip_phar: - return phar_orig_zend_open(filename, handle TSRMLS_CC); -} -/* }}} */ -#endif typedef zend_op_array* (zend_compile_t)(zend_file_handle*, int TSRMLS_DC); typedef zend_compile_t* (compile_hook)(zend_compile_t *ptr); @@ -3554,13 +3450,8 @@ PHP_MINIT_FUNCTION(phar) /* {{{ */ phar_orig_compile_file = zend_compile_file; zend_compile_file = phar_compile_file; -#if PHP_VERSION_ID >= 50300 phar_save_resolve_path = zend_resolve_path; zend_resolve_path = phar_resolve_path; -#else - phar_orig_zend_open = zend_stream_open_function; - zend_stream_open_function = phar_zend_open; -#endif phar_object_init(TSRMLS_C); @@ -3581,11 +3472,6 @@ PHP_MSHUTDOWN_FUNCTION(phar) /* {{{ */ zend_compile_file = phar_orig_compile_file; } -#if PHP_VERSION_ID < 50300 - if (zend_stream_open_function == phar_zend_open) { - zend_stream_open_function = phar_orig_zend_open; - } -#endif if (PHAR_G(manifest_cached)) { zend_hash_destroy(&(cached_phars)); zend_hash_destroy(&(cached_alias)); diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h index e0a9faf38fb2c..359f25b4c635b 100644 --- a/ext/phar/phar_internal.h +++ b/ext/phar/phar_internal.h @@ -54,7 +54,7 @@ #ifndef PHP_WIN32 #include "TSRM/tsrm_strtok_r.h" #endif -#include "TSRM/tsrm_virtual_cwd.h" +#include "Zend/zend_virtual_cwd.h" #if HAVE_SPL #include "ext/spl/spl_array.h" #include "ext/spl/spl_directory.h" @@ -68,19 +68,6 @@ #include "ext/hash/php_hash_sha.h" #endif -#ifndef E_RECOVERABLE_ERROR -# define E_RECOVERABLE_ERROR E_ERROR -#endif - -#ifndef pestrndup -# define pestrndup(s, length, persistent) ((persistent)?zend_strndup((s),(length)):estrndup((s),(length))) -#endif - -#ifndef ALLOC_PERMANENT_ZVAL -# define ALLOC_PERMANENT_ZVAL(z) \ - (z) = (zval*)malloc(sizeof(zval)) -#endif - /* PHP_ because this is public information via MINFO */ #define PHP_PHAR_API_VERSION "1.1.1" /* x.y.z maps to 0xyz0 */ @@ -513,75 +500,7 @@ union _phar_entry_object { #endif #ifndef PHAR_MAIN -# if PHP_VERSION_ID >= 50300 extern char *(*phar_save_resolve_path)(const char *filename, int filename_len TSRMLS_DC); -# endif -#endif - -#if PHP_VERSION_ID < 50209 -static inline size_t phar_stream_copy_to_stream(php_stream *src, php_stream *dest, size_t maxlen, size_t *len STREAMS_DC TSRMLS_DC) -{ - size_t ret = php_stream_copy_to_stream(src, dest, maxlen); - if (len) { - *len = ret; - } - if (ret) { - return SUCCESS; - } - return FAILURE; -} -#else -# define phar_stream_copy_to_stream(src, dest, maxlen, len) _php_stream_copy_to_stream_ex((src), (dest), (maxlen), (len) STREAMS_CC TSRMLS_CC) - -#endif - -#if PHP_VERSION_ID >= 60000 -typedef zstr phar_zstr; -#define PHAR_STR(a, b) \ - spprintf(&b, 0, "%s", a.s); -#define PHAR_ZSTR(a, b) \ - b = ZSTR(a); -#define PHAR_STR_FREE(a) \ - efree(a); -static inline int phar_make_unicode(zstr *c_var, char *arKey, uint nKeyLength TSRMLS_DC) -{ - int c_var_len; - UConverter *conv = ZEND_U_CONVERTER(UG(runtime_encoding_conv)); - - c_var->u = NULL; - if (zend_string_to_unicode(conv, &c_var->u, &c_var_len, arKey, nKeyLength TSRMLS_CC) == FAILURE) { - - if (c_var->u) { - efree(c_var->u); - } - return 0; - - } - return c_var_len; -} -static inline int phar_find_key(HashTable *_SERVER, char *key, int len, void **stuff TSRMLS_DC) -{ - if (SUCCESS == zend_hash_find(_SERVER, key, len, stuff)) { - return 1; - } else { - int s = len; - zstr var; - s = phar_make_unicode(&var, key, len TSRMLS_CC); - if (SUCCESS == zend_u_hash_find(_SERVER, IS_UNICODE, var, s, stuff)) { - efree(var.u); - return 1; - } - efree(var.u); - return 0; - } -} -#else -typedef char *phar_zstr; -#define PHAR_STR(a, b) \ - b = a; -#define PHAR_ZSTR(a, b) \ - b = a; -#define PHAR_STR_FREE(a) #endif BEGIN_EXTERN_C() diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index dcb67fe9fa6e4..7c11a48f9cc87 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -685,11 +685,7 @@ PHP_METHOD(Phar, webPhar) ZVAL_STRINGL(params, entry, entry_len, 1); zp[0] = ¶ms; -#if PHP_VERSION_ID < 50300 - if (FAILURE == zend_fcall_info_init(rewrite, &fci, &fcc TSRMLS_CC)) { -#else if (FAILURE == zend_fcall_info_init(rewrite, 0, &fci, &fcc, NULL, NULL TSRMLS_CC)) { -#endif zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar error: invalid rewrite callback"); if (free_pathinfo) { @@ -701,11 +697,7 @@ PHP_METHOD(Phar, webPhar) fci.param_count = 1; fci.params = zp; -#if PHP_VERSION_ID < 50300 - ++(params->refcount); -#else Z_ADDREF_P(params); -#endif fci.retval_ptr_ptr = &retval_ptr; if (FAILURE == zend_call_function(&fci, &fcc TSRMLS_CC)) { @@ -729,11 +721,6 @@ PHP_METHOD(Phar, webPhar) } switch (Z_TYPE_P(retval_ptr)) { -#if PHP_VERSION_ID >= 60000 - case IS_UNICODE: - zval_unicode_to_string(retval_ptr TSRMLS_CC); - /* break intentionally omitted */ -#endif case IS_STRING: efree(entry); @@ -1155,11 +1142,7 @@ PHP_METHOD(Phar, __construct) #else char *fname, *alias = NULL, *error, *arch = NULL, *entry = NULL, *save_fname; int fname_len, alias_len = 0, arch_len, entry_len, is_data; -#if PHP_VERSION_ID < 50300 - long flags = 0; -#else long flags = SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS; -#endif long format = 0; phar_archive_object *phar_obj; phar_archive_data *phar_data; @@ -1459,11 +1442,6 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{ } switch (Z_TYPE_PP(value)) { -#if PHP_VERSION_ID >= 60000 - case IS_UNICODE: - zval_unicode_to_string(*(value) TSRMLS_CC); - /* break intentionally omitted */ -#endif case IS_STRING: break; case IS_RESOURCE: @@ -1514,13 +1492,7 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{ switch (intern->type) { case SPL_FS_DIR: -#if PHP_VERSION_ID >= 60000 - test = spl_filesystem_object_get_path(intern, NULL, NULL TSRMLS_CC).s; -#elif PHP_VERSION_ID >= 50300 test = spl_filesystem_object_get_path(intern, NULL TSRMLS_CC); -#else - test = intern->path; -#endif fname_len = spprintf(&fname, 0, "%s%c%s", test, DEFAULT_SLASH, intern->u.dir.entry.d_name); php_stat(fname, fname_len, FS_IS_DIR, &dummy TSRMLS_CC); @@ -1545,25 +1517,7 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{ goto phar_spl_fileinfo; case SPL_FS_INFO: case SPL_FS_FILE: -#if PHP_VERSION_ID >= 60000 - if (intern->file_name_type == IS_UNICODE) { - zval zv; - - INIT_ZVAL(zv); - Z_UNIVAL(zv) = intern->file_name; - Z_UNILEN(zv) = intern->file_name_len; - Z_TYPE(zv) = IS_UNICODE; - - zval_copy_ctor(&zv); - zval_unicode_to_string(&zv TSRMLS_CC); - fname = expand_filepath(Z_STRVAL(zv), NULL TSRMLS_CC); - ezfree(Z_UNIVAL(zv)); - } else { - fname = expand_filepath(intern->file_name.s, NULL TSRMLS_CC); - } -#else fname = expand_filepath(intern->file_name, NULL TSRMLS_CC); -#endif if (!fname) { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Could not resolve file path"); return ZEND_HASH_APPLY_STOP; @@ -1753,7 +1707,7 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{ data->internal_file->fp_type = PHAR_UFP; data->internal_file->offset_abs = data->internal_file->offset = php_stream_tell(p_obj->fp); data->fp = NULL; - phar_stream_copy_to_stream(fp, p_obj->fp, PHP_STREAM_COPY_ALL, &contents_len); + php_stream_copy_to_stream_ex(fp, p_obj->fp, PHP_STREAM_COPY_ALL, &contents_len); data->internal_file->uncompressed_filesize = data->internal_file->compressed_filesize = php_stream_tell(p_obj->fp) - data->internal_file->offset; } @@ -1816,11 +1770,7 @@ PHP_METHOD(Phar, buildFromDirectory) INIT_PZVAL(&arg); ZVAL_STRINGL(&arg, dir, dir_len, 0); INIT_PZVAL(&arg2); -#if PHP_VERSION_ID < 50300 - ZVAL_LONG(&arg2, 0); -#else ZVAL_LONG(&arg2, SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS); -#endif zend_call_method_with_2_params(&iter, spl_ce_RecursiveDirectoryIterator, &spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg, &arg2); @@ -2047,7 +1997,7 @@ static int phar_copy_file_contents(phar_entry_info *entry, php_stream *fp TSRMLS link = entry; } - if (SUCCESS != phar_stream_copy_to_stream(phar_get_efp(link, 0 TSRMLS_CC), fp, link->uncompressed_filesize, NULL)) { + if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(link, 0 TSRMLS_CC), fp, link->uncompressed_filesize, NULL)) { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Cannot convert phar archive \"%s\", unable to copy entry \"%s\" contents", entry->phar->fname, entry->filename); return FAILURE; @@ -2313,11 +2263,7 @@ static zval *phar_convert_to_other(phar_archive_data *source, int convert, char ALLOC_ZVAL(phar->metadata); *phar->metadata = *t; zval_copy_ctor(phar->metadata); -#if PHP_VERSION_ID < 50300 - phar->metadata->refcount = 1; -#else Z_SET_REFCOUNT_P(phar->metadata, 1); -#endif phar->metadata_len = 0; } @@ -2365,11 +2311,7 @@ static zval *phar_convert_to_other(phar_archive_data *source, int convert, char ALLOC_ZVAL(newentry.metadata); *newentry.metadata = *t; zval_copy_ctor(newentry.metadata); -#if PHP_VERSION_ID < 50300 - newentry.metadata->refcount = 1; -#else Z_SET_REFCOUNT_P(newentry.metadata, 1); -#endif newentry.metadata_str.c = NULL; newentry.metadata_str.len = 0; @@ -3552,11 +3494,7 @@ PHP_METHOD(Phar, copy) ALLOC_ZVAL(newentry.metadata); *newentry.metadata = *t; zval_copy_ctor(newentry.metadata); -#if PHP_VERSION_ID < 50300 - newentry.metadata->refcount = 1; -#else Z_SET_REFCOUNT_P(newentry.metadata, 1); -#endif newentry.metadata_str.c = NULL; newentry.metadata_str.len = 0; @@ -3713,7 +3651,7 @@ static void phar_add_file(phar_archive_data **pphar, char *filename, int filenam zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Entry %s could not be written to", filename); return; } - phar_stream_copy_to_stream(contents_file, data->fp, PHP_STREAM_COPY_ALL, &contents_len); + php_stream_copy_to_stream_ex(contents_file, data->fp, PHP_STREAM_COPY_ALL, &contents_len); } data->internal_file->compressed_filesize = data->internal_file->uncompressed_filesize = contents_len; @@ -4286,7 +4224,7 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char * return FAILURE; } - if (SUCCESS != phar_stream_copy_to_stream(phar_get_efp(entry, 0 TSRMLS_CC), fp, entry->uncompressed_filesize, NULL)) { + if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(entry, 0 TSRMLS_CC), fp, entry->uncompressed_filesize, NULL)) { spprintf(error, 4096, "Cannot extract \"%s\" to \"%s\", copying contents failed", entry->filename, fullpath); efree(fullpath); php_stream_close(fp); @@ -4371,11 +4309,6 @@ PHP_METHOD(Phar, extractTo) switch (Z_TYPE_P(zval_files)) { case IS_NULL: goto all_files; -#if PHP_VERSION_ID >= 60000 - case IS_UNICODE: - zval_unicode_to_string(zval_files TSRMLS_CC); - /* break intentionally omitted */ -#endif case IS_STRING: filename = Z_STRVAL_P(zval_files); filename_len = Z_STRLEN_P(zval_files); @@ -4389,11 +4322,6 @@ PHP_METHOD(Phar, extractTo) zval **zval_file; if (zend_hash_index_find(Z_ARRVAL_P(zval_files), i, (void **) &zval_file) == SUCCESS) { switch (Z_TYPE_PP(zval_file)) { -#if PHP_VERSION_ID >= 60000 - case IS_UNICODE: - zval_unicode_to_string(*(zval_file) TSRMLS_CC); - /* break intentionally omitted */ -#endif case IS_STRING: break; default: @@ -5414,11 +5342,7 @@ zend_function_entry phar_exception_methods[] = { #define REGISTER_PHAR_CLASS_CONST_LONG(class_name, const_name, value) \ zend_declare_class_constant_long(class_name, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); -#if PHP_VERSION_ID < 50200 -# define phar_exception_get_default() zend_exception_get_default() -#else -# define phar_exception_get_default() zend_exception_get_default(TSRMLS_C) -#endif +#define phar_exception_get_default() zend_exception_get_default(TSRMLS_C) void phar_object_init(TSRMLS_D) /* {{{ */ { diff --git a/ext/phar/php_phar.h b/ext/phar/php_phar.h index a6d7bff414b8c..f8325d0c635e3 100644 --- a/ext/phar/php_phar.h +++ b/ext/phar/php_phar.h @@ -22,7 +22,7 @@ #ifndef PHP_PHAR_H #define PHP_PHAR_H -#define PHP_PHAR_VERSION "2.0.1" +#define PHP_PHAR_VERSION "2.0.2" #include "ext/standard/basic_functions.h" extern zend_module_entry phar_module_entry; @@ -31,9 +31,11 @@ extern zend_module_entry phar_module_entry; #ifdef PHP_WIN32 #define PHP_PHAR_API __declspec(dllexport) #else -#define PHP_PHAR_API +#define PHP_PHAR_API PHPAPI #endif +PHP_PHAR_API int phar_resolve_alias(char *alias, int alias_len, char **filename, int *filename_len TSRMLS_DC); + #endif /* PHP_PHAR_H */ diff --git a/ext/phar/stream.c b/ext/phar/stream.c index d3d4cd655b33c..1b353e0d18c33 100644 --- a/ext/phar/stream.c +++ b/ext/phar/stream.c @@ -627,21 +627,16 @@ static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int f } /* check for mounted directories */ if (phar->mounted_dirs.arBuckets && zend_hash_num_elements(&phar->mounted_dirs)) { - phar_zstr key; char *str_key; ulong unused; uint keylen; HashPosition pos; - zend_hash_internal_pointer_reset_ex(&phar->mounted_dirs, &pos); - while (FAILURE != zend_hash_has_more_elements_ex(&phar->mounted_dirs, &pos)) { - if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(&phar->mounted_dirs, &key, &keylen, &unused, 0, &pos)) { - break; - } - PHAR_STR(key, str_key); + for (zend_hash_internal_pointer_reset_ex(&phar->mounted_dirs, &pos); + HASH_KEY_NON_EXISTENT != zend_hash_get_current_key_ex(&phar->mounted_dirs, &str_key, &keylen, &unused, 0, &pos); + zend_hash_move_forward_ex(&phar->mounted_dirs, &pos) + ) { if ((int)keylen >= internal_file_len || strncmp(str_key, internal_file, keylen)) { - zend_hash_move_forward_ex(&phar->mounted_dirs, &pos); - PHAR_STR_FREE(str_key); continue; } else { char *test; @@ -649,17 +644,14 @@ static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int f php_stream_statbuf ssbi; if (SUCCESS != zend_hash_find(&phar->manifest, str_key, keylen, (void **) &entry)) { - PHAR_STR_FREE(str_key); goto free_resource; } - PHAR_STR_FREE(str_key); if (!entry->tmp || !entry->is_mounted) { goto free_resource; } test_len = spprintf(&test, MAXPATHLEN, "%s%s", entry->tmp, internal_file + keylen); if (SUCCESS != php_stream_stat_path(test, &ssbi)) { efree(test); - zend_hash_move_forward_ex(&phar->mounted_dirs, &pos); continue; } /* mount the file/directory just in time */ @@ -910,7 +902,6 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from /* Rename directory. Update all nested paths */ if (is_dir) { int key_type; - phar_zstr key, new_key; char *str_key, *new_str_key; uint key_len, new_key_len; ulong unused; @@ -918,12 +909,10 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from uint to_len = strlen(resource_to->path+1); for (zend_hash_internal_pointer_reset(&phar->manifest); - HASH_KEY_NON_EXISTENT != (key_type = zend_hash_get_current_key_ex(&phar->manifest, &key, &key_len, &unused, 0, NULL)) && + HASH_KEY_NON_EXISTENT != (key_type = zend_hash_get_current_key_ex(&phar->manifest, &str_key, &key_len, &unused, 0, NULL)) && SUCCESS == zend_hash_get_current_data(&phar->manifest, (void **) &entry); - zend_hash_move_forward(&phar->manifest)) { - - PHAR_STR(key, str_key); - + zend_hash_move_forward(&phar->manifest) + ) { if (!entry->is_deleted && key_len > from_len && memcmp(str_key, resource_from->path+1, from_len) == 0 && @@ -941,22 +930,14 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from entry->filename = new_str_key; entry->filename_len = new_key_len; - PHAR_ZSTR(new_str_key, new_key); -#if PHP_VERSION_ID < 50300 - zend_hash_update_current_key_ex(&phar->manifest, key_type, new_key, new_key_len, 0, NULL); -#else - zend_hash_update_current_key_ex(&phar->manifest, key_type, new_key, new_key_len, 0, HASH_UPDATE_KEY_ANYWAY, NULL); -#endif + zend_hash_update_current_key_ex(&phar->manifest, key_type, new_str_key, new_key_len, 0, HASH_UPDATE_KEY_ANYWAY, NULL); } - PHAR_STR_FREE(str_key); } for (zend_hash_internal_pointer_reset(&phar->virtual_dirs); - HASH_KEY_NON_EXISTENT != (key_type = zend_hash_get_current_key_ex(&phar->virtual_dirs, &key, &key_len, &unused, 0, NULL)); - zend_hash_move_forward(&phar->virtual_dirs)) { - - PHAR_STR(key, str_key); - + HASH_KEY_NON_EXISTENT != (key_type = zend_hash_get_current_key_ex(&phar->virtual_dirs, &str_key, &key_len, &unused, 0, NULL)); + zend_hash_move_forward(&phar->virtual_dirs) + ) { if (key_len >= from_len && memcmp(str_key, resource_from->path+1, from_len) == 0 && (key_len == from_len || IS_SLASH(str_key[from_len]))) { @@ -967,24 +948,16 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from memcpy(new_str_key + to_len, str_key + from_len, key_len - from_len); new_str_key[new_key_len] = 0; - PHAR_ZSTR(new_str_key, new_key); -#if PHP_VERSION_ID < 50300 - zend_hash_update_current_key_ex(&phar->virtual_dirs, key_type, new_key, new_key_len, 0, NULL); -#else - zend_hash_update_current_key_ex(&phar->virtual_dirs, key_type, new_key, new_key_len, 0, HASH_UPDATE_KEY_ANYWAY, NULL); -#endif + zend_hash_update_current_key_ex(&phar->virtual_dirs, key_type, new_str_key, new_key_len, 0, HASH_UPDATE_KEY_ANYWAY, NULL); efree(new_str_key); } - PHAR_STR_FREE(str_key); } for (zend_hash_internal_pointer_reset(&phar->mounted_dirs); - HASH_KEY_NON_EXISTENT != (key_type = zend_hash_get_current_key_ex(&phar->mounted_dirs, &key, &key_len, &unused, 0, NULL)) && + HASH_KEY_NON_EXISTENT != (key_type = zend_hash_get_current_key_ex(&phar->mounted_dirs, &str_key, &key_len, &unused, 0, NULL)) && SUCCESS == zend_hash_get_current_data(&phar->mounted_dirs, (void **) &entry); - zend_hash_move_forward(&phar->mounted_dirs)) { - - PHAR_STR(key, str_key); - + zend_hash_move_forward(&phar->mounted_dirs) + ) { if (key_len >= from_len && memcmp(str_key, resource_from->path+1, from_len) == 0 && (key_len == from_len || IS_SLASH(str_key[from_len]))) { @@ -995,15 +968,9 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from memcpy(new_str_key + to_len, str_key + from_len, key_len - from_len); new_str_key[new_key_len] = 0; - PHAR_ZSTR(new_str_key, new_key); -#if PHP_VERSION_ID < 50300 - zend_hash_update_current_key_ex(&phar->mounted_dirs, key_type, new_key, new_key_len, 0, NULL); -#else - zend_hash_update_current_key_ex(&phar->mounted_dirs, key_type, new_key, new_key_len, 0, HASH_UPDATE_KEY_ANYWAY, NULL); -#endif + zend_hash_update_current_key_ex(&phar->mounted_dirs, key_type, new_str_key, new_key_len, 0, HASH_UPDATE_KEY_ANYWAY, NULL); efree(new_str_key); } - PHAR_STR_FREE(str_key); } } diff --git a/ext/phar/tar.c b/ext/phar/tar.c index 0e60e3db134b4..180675a9d23b8 100644 --- a/ext/phar/tar.c +++ b/ext/phar/tar.c @@ -783,7 +783,7 @@ static int phar_tar_writeheaders(void *pDest, void *argument TSRMLS_DC) /* {{{ * return ZEND_HASH_APPLY_STOP; } - if (SUCCESS != phar_stream_copy_to_stream(phar_get_efp(entry, 0 TSRMLS_CC), fp->new, entry->uncompressed_filesize, NULL)) { + if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(entry, 0 TSRMLS_CC), fp->new, entry->uncompressed_filesize, NULL)) { if (fp->error) { spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, contents of file \"%s\" could not be written", entry->phar->fname, entry->filename); } @@ -1288,7 +1288,7 @@ int phar_tar_flush(phar_archive_data *phar, char *user_stub, long len, int defau if (!filter) { /* copy contents uncompressed rather than lose them */ - phar_stream_copy_to_stream(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); + php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); php_stream_close(newfile); if (error) { spprintf(error, 4096, "unable to compress all contents of phar \"%s\" using zlib, PHP versions older than 5.2.6 have a buggy zlib", phar->fname); @@ -1297,7 +1297,7 @@ int phar_tar_flush(phar_archive_data *phar, char *user_stub, long len, int defau } php_stream_filter_append(&phar->fp->writefilters, filter); - phar_stream_copy_to_stream(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); + php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); php_stream_filter_flush(filter, 1); php_stream_filter_remove(filter, 1 TSRMLS_CC); php_stream_close(phar->fp); @@ -1308,14 +1308,14 @@ int phar_tar_flush(phar_archive_data *phar, char *user_stub, long len, int defau filter = php_stream_filter_create("bzip2.compress", NULL, php_stream_is_persistent(phar->fp) TSRMLS_CC); php_stream_filter_append(&phar->fp->writefilters, filter); - phar_stream_copy_to_stream(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); + php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); php_stream_filter_flush(filter, 1); php_stream_filter_remove(filter, 1 TSRMLS_CC); php_stream_close(phar->fp); /* use the temp stream as our base */ phar->fp = newfile; } else { - phar_stream_copy_to_stream(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); + php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); /* we could also reopen the file in "rb" mode but there is no need for that */ php_stream_close(newfile); } diff --git a/ext/phar/tests/031.phpt b/ext/phar/tests/031.phpt index 4d5988621de88..d458f068f5513 100644 --- a/ext/phar/tests/031.phpt +++ b/ext/phar/tests/031.phpt @@ -22,10 +22,10 @@ require $pname; ===DONE=== --CLEAN-- --EXPECTF-- string(25) "getMessage(); ===DONE=== --CLEAN-- --EXPECTF-- -phar "%sphar_oo_test.phar.php" does not have a signature===DONE=== \ No newline at end of file +phar "%s032.phar.php" does not have a signature===DONE=== \ No newline at end of file diff --git a/ext/phar/tests/files/phar_oo_test.inc b/ext/phar/tests/files/phar_oo_test.inc index e92b4444c1572..45421568dee10 100644 --- a/ext/phar/tests/files/phar_oo_test.inc +++ b/ext/phar/tests/files/phar_oo_test.inc @@ -2,7 +2,8 @@ ini_set('date.timezone', 'GMT'); -$fname = dirname(__FILE__) . '/phar_oo_test.phar.php'; +$tname = basename(current(get_included_files()), ".php"); +$fname = dirname(__FILE__) . "/$tname.phar.php"; $pname = 'phar://' . $fname; $file = (binary)''; diff --git a/ext/phar/tests/phar_buildfromdirectory1.phpt b/ext/phar/tests/phar_buildfromdirectory1.phpt index 63e06fa474de8..957f246664f67 100644 --- a/ext/phar/tests/phar_buildfromdirectory1.phpt +++ b/ext/phar/tests/phar_buildfromdirectory1.phpt @@ -7,7 +7,7 @@ phar.require_hash=0 phar.readonly=0 --FILE-- buildFromDirectory(1); @@ -19,7 +19,7 @@ try { ===DONE=== --CLEAN-- --EXPECTF-- diff --git a/ext/phar/tests/phar_buildfromdirectory2-win.phpt b/ext/phar/tests/phar_buildfromdirectory2-win.phpt index 9dbcf965e32ba..5ed890a48bfb1 100644 --- a/ext/phar/tests/phar_buildfromdirectory2-win.phpt +++ b/ext/phar/tests/phar_buildfromdirectory2-win.phpt @@ -11,7 +11,7 @@ phar.readonly=0 --FILE-- buildFromDirectory(1); } catch (Exception $e) { var_dump(get_class($e)); @@ -21,7 +21,7 @@ try { ===DONE=== --CLEAN-- --EXPECTF-- diff --git a/ext/phar/tests/phar_buildfromdirectory2.phpt b/ext/phar/tests/phar_buildfromdirectory2.phpt index 639ff0bd4b77f..a33e50abbb0b7 100644 --- a/ext/phar/tests/phar_buildfromdirectory2.phpt +++ b/ext/phar/tests/phar_buildfromdirectory2.phpt @@ -11,7 +11,7 @@ phar.readonly=0 --FILE-- buildFromDirectory(1); } catch (Exception $e) { var_dump(get_class($e)); @@ -21,7 +21,7 @@ try { ===DONE=== --CLEAN-- --EXPECTF-- diff --git a/ext/phar/tests/phar_buildfromdirectory3.phpt b/ext/phar/tests/phar_buildfromdirectory3.phpt index 2134cbdb5397a..921e39593ddc8 100644 --- a/ext/phar/tests/phar_buildfromdirectory3.phpt +++ b/ext/phar/tests/phar_buildfromdirectory3.phpt @@ -9,7 +9,7 @@ phar.readonly=0 buildFromDirectory('files', new stdClass); } catch (Exception $e) { var_dump(get_class($e)); @@ -19,7 +19,7 @@ try { ===DONE=== --CLEAN-- --EXPECTF-- diff --git a/ext/phar/tests/phar_buildfromdirectory4.phpt b/ext/phar/tests/phar_buildfromdirectory4.phpt index 683ac4bbc8365..5ee2c33871a51 100644 --- a/ext/phar/tests/phar_buildfromdirectory4.phpt +++ b/ext/phar/tests/phar_buildfromdirectory4.phpt @@ -9,14 +9,14 @@ open_basedir= --FILE-- buildFromDirectory(dirname(__FILE__) . '/testdir'); + $phar = new Phar(dirname(__FILE__) . '/buildfromdirectory4.phar'); + $a = $phar->buildFromDirectory(dirname(__FILE__) . '/testdir4'); asort($a); var_dump($a); } catch (Exception $e) { @@ -24,28 +24,28 @@ try { echo $e->getMessage() . "\n"; } -var_dump(file_exists(dirname(__FILE__) . '/buildfromdirectory.phar')); +var_dump(file_exists(dirname(__FILE__) . '/buildfromdirectory4.phar')); ?> ===DONE=== --CLEAN-- --EXPECTF-- array(4) { ["file1.txt"]=> - string(%d) "%stestdir%cfile1.txt" + string(%d) "%stestdir4%cfile1.txt" ["file2.txt"]=> - string(%d) "%stestdir%cfile2.txt" + string(%d) "%stestdir4%cfile2.txt" ["file3.txt"]=> - string(%d) "%stestdir%cfile3.txt" + string(%d) "%stestdir4%cfile3.txt" ["file4.txt"]=> - string(%d) "%stestdir%cfile4.txt" + string(%d) "%stestdir4%cfile4.txt" } bool(true) ===DONE=== diff --git a/ext/phar/tests/phar_buildfromdirectory5.phpt b/ext/phar/tests/phar_buildfromdirectory5.phpt index 51e5cec6911af..f20c52ab91f95 100644 --- a/ext/phar/tests/phar_buildfromdirectory5.phpt +++ b/ext/phar/tests/phar_buildfromdirectory5.phpt @@ -8,14 +8,14 @@ phar.readonly=0 --FILE-- buildFromDirectory(dirname(__FILE__) . '/testdir', '/\.txt/'); + $phar = new Phar(dirname(__FILE__) . '/buildfromdirectory5.phar'); + $a = $phar->buildFromDirectory(dirname(__FILE__) . '/testdir5', '/\.txt/'); asort($a); var_dump($a); } catch (Exception $e) { @@ -23,28 +23,28 @@ try { echo $e->getMessage() . "\n"; } -var_dump(file_exists(dirname(__FILE__) . '/buildfromdirectory.phar')); +var_dump(file_exists(dirname(__FILE__) . '/buildfromdirectory5.phar')); ?> ===DONE=== --CLEAN-- --EXPECTF-- array(4) { ["file1.txt"]=> - string(%d) "%stestdir%cfile1.txt" + string(%d) "%stestdir5%cfile1.txt" ["file2.txt"]=> - string(%d) "%stestdir%cfile2.txt" + string(%d) "%stestdir5%cfile2.txt" ["file3.txt"]=> - string(%d) "%stestdir%cfile3.txt" + string(%d) "%stestdir5%cfile3.txt" ["file4.txt"]=> - string(%d) "%stestdir%cfile4.txt" + string(%d) "%stestdir5%cfile4.txt" } bool(true) ===DONE=== diff --git a/ext/phar/tests/phar_buildfromdirectory6.phpt b/ext/phar/tests/phar_buildfromdirectory6.phpt index 99566c192669e..5537ebac2358b 100644 --- a/ext/phar/tests/phar_buildfromdirectory6.phpt +++ b/ext/phar/tests/phar_buildfromdirectory6.phpt @@ -8,30 +8,30 @@ phar.readonly=0 --FILE-- buildFromDirectory(dirname(__FILE__) . '/testdir', '/\.php$/')); + $phar = new Phar(dirname(__FILE__) . '/buildfromdirectory6.phar'); + var_dump($phar->buildFromDirectory(dirname(__FILE__) . '/testdir6', '/\.php$/')); } catch (Exception $e) { var_dump(get_class($e)); echo $e->getMessage() . "\n"; } -var_dump(file_exists(dirname(__FILE__) . '/buildfromdirectory.phar')); +var_dump(file_exists(dirname(__FILE__) . '/buildfromdirectory6.phar')); ?> ===DONE=== --CLEAN-- --EXPECT-- array(0) { diff --git a/ext/phar/tests/phar_buildfromiterator1.phpt b/ext/phar/tests/phar_buildfromiterator1.phpt index 238ede6cbe160..0f656b64f2053 100644 --- a/ext/phar/tests/phar_buildfromiterator1.phpt +++ b/ext/phar/tests/phar_buildfromiterator1.phpt @@ -7,7 +7,7 @@ phar.require_hash=0 phar.readonly=0 --FILE-- buildFromIterator(1); @@ -19,7 +19,7 @@ try { ===DONE=== --CLEAN-- --EXPECTF-- diff --git a/ext/phar/tests/phar_buildfromiterator10.phpt b/ext/phar/tests/phar_buildfromiterator10.phpt index 024277ed0acc6..e6b9c025da8c8 100644 --- a/ext/phar/tests/phar_buildfromiterator10.phpt +++ b/ext/phar/tests/phar_buildfromiterator10.phpt @@ -11,7 +11,7 @@ phar.readonly=0 buildFromIterator(new RegexIterator($iter, '/_\d{3}\.phpt$/'), dirname(__FILE__) . DIRECTORY_SEPARATOR); @@ -25,7 +25,7 @@ try { ===DONE=== --CLEAN-- --EXPECTF-- diff --git a/ext/phar/tests/phar_buildfromiterator2.phpt b/ext/phar/tests/phar_buildfromiterator2.phpt index cdc2df1050be0..e9dd26e9de074 100644 --- a/ext/phar/tests/phar_buildfromiterator2.phpt +++ b/ext/phar/tests/phar_buildfromiterator2.phpt @@ -8,7 +8,7 @@ phar.readonly=0 --FILE-- buildFromIterator(new stdClass); } catch (Exception $e) { var_dump(get_class($e)); @@ -18,7 +18,7 @@ try { ===DONE=== --CLEAN-- --EXPECTF-- diff --git a/ext/phar/tests/phar_buildfromiterator3.phpt b/ext/phar/tests/phar_buildfromiterator3.phpt index 4a3bc7c0a52de..1603631278397 100644 --- a/ext/phar/tests/phar_buildfromiterator3.phpt +++ b/ext/phar/tests/phar_buildfromiterator3.phpt @@ -36,7 +36,7 @@ class myIterator implements Iterator } } try { - $phar = new Phar(dirname(__FILE__) . '/buildfromiterator.phar'); + $phar = new Phar(dirname(__FILE__) . '/buildfromiterator3.phar'); $phar->buildFromIterator(new myIterator(array()), new stdClass); } catch (Exception $e) { var_dump(get_class($e)); @@ -46,7 +46,7 @@ try { ===DONE=== --CLEAN-- --EXPECTF-- diff --git a/ext/phar/tests/phar_buildfromiterator4.phpt b/ext/phar/tests/phar_buildfromiterator4.phpt index cd261386d5d73..9277db562b481 100644 --- a/ext/phar/tests/phar_buildfromiterator4.phpt +++ b/ext/phar/tests/phar_buildfromiterator4.phpt @@ -37,7 +37,7 @@ class myIterator implements Iterator } try { chdir(dirname(__FILE__)); - $phar = new Phar(dirname(__FILE__) . '/buildfromiterator.phar'); + $phar = new Phar(dirname(__FILE__) . '/buildfromiterator4.phar'); var_dump($phar->buildFromIterator(new myIterator( array( 'a' => basename(__FILE__, 'php') . 'phpt', @@ -54,7 +54,7 @@ try { ===DONE=== --CLEAN-- --EXPECTF-- diff --git a/ext/phar/tests/phar_buildfromiterator5.phpt b/ext/phar/tests/phar_buildfromiterator5.phpt index 8431c12a7c64b..b6fafec6f4f92 100644 --- a/ext/phar/tests/phar_buildfromiterator5.phpt +++ b/ext/phar/tests/phar_buildfromiterator5.phpt @@ -37,7 +37,7 @@ class myIterator implements Iterator } try { chdir(dirname(__FILE__)); - $phar = new Phar(dirname(__FILE__) . '/buildfromiterator.phar'); + $phar = new Phar(dirname(__FILE__) . '/buildfromiterator5.phar'); var_dump($phar->buildFromIterator(new myIterator(array('a' => new stdClass)))); } catch (Exception $e) { var_dump(get_class($e)); @@ -47,7 +47,7 @@ try { ===DONE=== --CLEAN-- --EXPECTF-- diff --git a/ext/phar/tests/phar_buildfromiterator6.phpt b/ext/phar/tests/phar_buildfromiterator6.phpt index 9c506c85283f8..3a315fae4dcb3 100644 --- a/ext/phar/tests/phar_buildfromiterator6.phpt +++ b/ext/phar/tests/phar_buildfromiterator6.phpt @@ -37,7 +37,7 @@ class myIterator implements Iterator } try { chdir(dirname(__FILE__)); - $phar = new Phar(dirname(__FILE__) . '/buildfromiterator.phar'); + $phar = new Phar(dirname(__FILE__) . '/buildfromiterator6.phar'); var_dump($phar->buildFromIterator(new myIterator(array(basename(__FILE__, 'php') . 'phpt')))); } catch (Exception $e) { var_dump(get_class($e)); @@ -47,7 +47,7 @@ try { ===DONE=== --CLEAN-- --EXPECTF-- diff --git a/ext/phar/tests/phar_buildfromiterator7.phpt b/ext/phar/tests/phar_buildfromiterator7.phpt index 2bac4c8269a57..3dd8fc1b001d0 100644 --- a/ext/phar/tests/phar_buildfromiterator7.phpt +++ b/ext/phar/tests/phar_buildfromiterator7.phpt @@ -37,7 +37,7 @@ class myIterator implements Iterator } try { chdir(dirname(__FILE__)); - $phar = new Phar(dirname(__FILE__) . '/buildfromiterator.phar'); + $phar = new Phar(dirname(__FILE__) . '/buildfromiterator7.phar'); var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . '/oopsie/there.phpt')))); } catch (Exception $e) { var_dump(get_class($e)); @@ -47,7 +47,7 @@ try { ===DONE=== --CLEAN-- --EXPECTF-- diff --git a/ext/phar/tests/phar_buildfromiterator8.phpt b/ext/phar/tests/phar_buildfromiterator8.phpt index bb1b780d759b7..de37ee868784d 100644 --- a/ext/phar/tests/phar_buildfromiterator8.phpt +++ b/ext/phar/tests/phar_buildfromiterator8.phpt @@ -8,7 +8,7 @@ phar.readonly=0 buildFromIterator(new RegexIterator(new DirectoryIterator('.'), '/^\d{0,3}\.phpt\\z|^\.\\z|^\.\.\\z/'), dirname(__FILE__) . DIRECTORY_SEPARATOR); asort($a); var_dump($a); @@ -20,7 +20,7 @@ try { ===DONE=== --CLEAN-- --EXPECTF-- diff --git a/ext/phar/tests/phar_buildfromiterator9.phpt b/ext/phar/tests/phar_buildfromiterator9.phpt index 0b56307545677..2c9306b6cc86e 100644 --- a/ext/phar/tests/phar_buildfromiterator9.phpt +++ b/ext/phar/tests/phar_buildfromiterator9.phpt @@ -37,7 +37,7 @@ class myIterator implements Iterator } try { chdir(dirname(__FILE__)); - $phar = new Phar(dirname(__FILE__) . '/buildfromiterator.phar'); + $phar = new Phar(dirname(__FILE__) . '/buildfromiterator9.phar'); var_dump($phar->buildFromIterator(new myIterator(array('a' => $a = fopen(basename(__FILE__, 'php') . 'phpt', 'r'))))); fclose($a); } catch (Exception $e) { @@ -48,7 +48,7 @@ try { ===DONE=== --CLEAN-- --EXPECTF-- diff --git a/ext/phar/tests/phar_extract.phpt b/ext/phar/tests/phar_extract.phpt index 01d65f9091de0..bc545236fd886 100644 --- a/ext/phar/tests/phar_extract.phpt +++ b/ext/phar/tests/phar_extract.phpt @@ -38,9 +38,9 @@ var_dump(file_get_contents(dirname(__FILE__) . '/extract1/file1.txt')); $a->extractTo(dirname(__FILE__) . '/extract1', 'subdir/ectory/file.txt'); var_dump(file_get_contents(dirname(__FILE__) . '/extract1/subdir/ectory/file.txt')); -$a->extractTo(dirname(__FILE__) . '/extract2', array('file2.txt', 'one/level')); -var_dump(file_get_contents(dirname(__FILE__) . '/extract2/file2.txt')); -var_dump(is_dir(dirname(__FILE__) . '/extract2/one/level')); +$a->extractTo(dirname(__FILE__) . '/extract1-2', array('file2.txt', 'one/level')); +var_dump(file_get_contents(dirname(__FILE__) . '/extract1-2/file2.txt')); +var_dump(is_dir(dirname(__FILE__) . '/extract1-2/one/level')); try { $a->extractTo(dirname(__FILE__) . '/whatever', 134); @@ -119,7 +119,7 @@ $e = dirname(__FILE__) . '/extract1/'; @rmdir($e . 'subdir/ectory'); @rmdir($e . 'subdir'); @rmdir($e); -$e = dirname(__FILE__) . '/extract2/'; +$e = dirname(__FILE__) . '/extract1-2/'; @unlink($e . 'file2.txt'); @rmdir($e . 'one/level'); @rmdir($e . 'one'); diff --git a/ext/phar/tests/phar_extract2.phpt b/ext/phar/tests/phar_extract2.phpt index cac509f9dc666..7de8cee5b0e90 100644 --- a/ext/phar/tests/phar_extract2.phpt +++ b/ext/phar/tests/phar_extract2.phpt @@ -16,14 +16,14 @@ $phar->setAlias('fred'); $phar['file1.txt'] = 'hi'; $phar['file2.txt'] = 'hi2'; $phar['subdir/ectory/file.txt'] = 'hi3'; -$phar->mount($pname . '/mount', __FILE__); +$phar->mount($pname . '/mount2', __FILE__); $phar->addEmptyDir('one/level'); -$phar->extractTo(dirname(__FILE__) . '/extract', 'mount'); -$phar->extractTo(dirname(__FILE__) . '/extract'); +$phar->extractTo(dirname(__FILE__) . '/extract2', 'mount2'); +$phar->extractTo(dirname(__FILE__) . '/extract2'); $out = array(); -foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(dirname(__FILE__) . '/extract', 0x00003000), RecursiveIteratorIterator::CHILD_FIRST) as $path => $file) { +foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(dirname(__FILE__) . '/extract2', 0x00003000), RecursiveIteratorIterator::CHILD_FIRST) as $path => $file) { $extracted[] = $path; } @@ -38,7 +38,7 @@ foreach ($extracted as $out) { --CLEAN-- --EXPECTF-- -%sextract%cfile1.txt -%sextract%cfile2.txt -%sextract%cone -%sextract%csubdir -%sextract%csubdir%cectory -%sextract%csubdir%cectory%cfile.txt +%sextract2%cfile1.txt +%sextract2%cfile2.txt +%sextract2%cone +%sextract2%csubdir +%sextract2%csubdir%cectory +%sextract2%csubdir%cectory%cfile.txt ===DONE=== diff --git a/ext/phar/tests/phar_extract3.phpt b/ext/phar/tests/phar_extract3.phpt index df85211a23920..475583938bb0d 100644 --- a/ext/phar/tests/phar_extract3.phpt +++ b/ext/phar/tests/phar_extract3.phpt @@ -9,7 +9,7 @@ phar.readonly=0 $fname = dirname(__FILE__) . '/files/bogus.zip'; $fname2 = dirname(__FILE__) . '/files/notbogus.zip'; -$extract = dirname(__FILE__) . '/test'; +$extract = dirname(__FILE__) . '/test-extract3'; $phar = new PharData($fname); @@ -34,7 +34,7 @@ try { ===DONE=== --CLEAN-- --EXPECT-- diff --git a/ext/phar/tests/phar_oo_001U.phpt b/ext/phar/tests/phar_oo_001U.phpt index f13ddd4b0b206..a21026a5b6947 100644 --- a/ext/phar/tests/phar_oo_001U.phpt +++ b/ext/phar/tests/phar_oo_001U.phpt @@ -46,7 +46,7 @@ try { ===DONE=== --CLEAN-- --EXPECT-- diff --git a/ext/phar/tests/phar_oo_002.phpt b/ext/phar/tests/phar_oo_002.phpt index 3754151d42f0a..476cd7d3c216f 100644 --- a/ext/phar/tests/phar_oo_002.phpt +++ b/ext/phar/tests/phar_oo_002.phpt @@ -50,11 +50,11 @@ foreach(new RecursiveIteratorIterator($phar) as $name => $ent) ===DONE=== --CLEAN-- --EXPECTF-- -string(42) "phar://*/files/phar_oo_test.phar.php%ca.php" +string(41) "phar://*/files/phar_oo_002.phar.php%ca.php" string(5) "a.php" int(32) string(4) "file" @@ -67,7 +67,7 @@ bool(false) int(%d) int(%d) int(%d) -string(38) "phar://*/files/phar_oo_test.phar.php%cb" +string(37) "phar://*/files/phar_oo_002.phar.php%cb" string(1) "b" int(0) string(3) "dir" @@ -80,7 +80,7 @@ bool(false) int(%d) int(%d) int(%d) -string(42) "phar://*/files/phar_oo_test.phar.php%cb.php" +string(41) "phar://*/files/phar_oo_002.phar.php%cb.php" string(5) "b.php" int(32) string(4) "file" @@ -93,7 +93,7 @@ bool(false) int(%d) int(%d) int(%d) -string(42) "phar://*/files/phar_oo_test.phar.php%ce.php" +string(41) "phar://*/files/phar_oo_002.phar.php%ce.php" string(5) "e.php" int(32) string(4) "file" @@ -107,31 +107,31 @@ int(%d) int(%d) int(%d) ==RECURSIVE== -string(42) "phar://*/files/phar_oo_test.phar.php%ca.php" +string(41) "phar://*/files/phar_oo_002.phar.php%ca.php" string(5) "a.php" int(32) bool(false) NULL int(0) -string(44) "phar://*/files/phar_oo_test.phar.php/b%cc.php" +string(43) "phar://*/files/phar_oo_002.phar.php/b%cc.php" string(5) "c.php" int(34) bool(false) NULL int(0) -string(44) "phar://*/files/phar_oo_test.phar.php/b%cd.php" +string(43) "phar://*/files/phar_oo_002.phar.php/b%cd.php" string(5) "d.php" int(34) bool(false) NULL int(0) -string(42) "phar://*/files/phar_oo_test.phar.php%cb.php" +string(41) "phar://*/files/phar_oo_002.phar.php%cb.php" string(5) "b.php" int(32) bool(false) NULL int(0) -string(42) "phar://*/files/phar_oo_test.phar.php%ce.php" +string(41) "phar://*/files/phar_oo_002.phar.php%ce.php" string(5) "e.php" int(32) bool(false) diff --git a/ext/phar/tests/phar_oo_002U.phpt b/ext/phar/tests/phar_oo_002U.phpt index 26d0d68d97474..da17152b3273f 100644 --- a/ext/phar/tests/phar_oo_002U.phpt +++ b/ext/phar/tests/phar_oo_002U.phpt @@ -50,11 +50,11 @@ foreach(new RecursiveIteratorIterator($phar) as $name => $ent) ===DONE=== --CLEAN-- --EXPECTF-- -unicode(42) "phar://*/files/phar_oo_test.phar.php%ca.php" +unicode(42) "phar://*/files/phar_oo_002.phar.php%ca.php" string(5) "a.php" int(32) unicode(4) "file" @@ -67,7 +67,7 @@ bool(false) int(%d) int(%d) int(%d) -unicode(38) "phar://*/files/phar_oo_test.phar.php%cb" +unicode(38) "phar://*/files/phar_oo_002.phar.php%cb" string(1) "b" int(0) unicode(3) "dir" @@ -80,7 +80,7 @@ bool(false) int(%d) int(%d) int(%d) -unicode(42) "phar://*/files/phar_oo_test.phar.php%cb.php" +unicode(42) "phar://*/files/phar_oo_002.phar.php%cb.php" string(5) "b.php" int(32) unicode(4) "file" @@ -93,7 +93,7 @@ bool(false) int(%d) int(%d) int(%d) -unicode(42) "phar://*/files/phar_oo_test.phar.php%ce.php" +unicode(42) "phar://*/files/phar_oo_002.phar.php%ce.php" string(5) "e.php" int(32) unicode(4) "file" @@ -107,31 +107,31 @@ int(%d) int(%d) int(%d) ==RECURSIVE== -unicode(42) "phar://*/files/phar_oo_test.phar.php%ca.php" +unicode(42) "phar://*/files/phar_oo_002.phar.php%ca.php" unicode(5) "a.php" int(32) bool(false) NULL int(0) -unicode(44) "phar://*/files/phar_oo_test.phar.php/b%cc.php" +unicode(44) "phar://*/files/phar_oo_002.phar.php/b%cc.php" unicode(5) "c.php" int(34) bool(false) NULL int(0) -unicode(44) "phar://*/files/phar_oo_test.phar.php/b%cd.php" +unicode(44) "phar://*/files/phar_oo_002.phar.php/b%cd.php" unicode(5) "d.php" int(34) bool(false) NULL int(0) -unicode(42) "phar://*/files/phar_oo_test.phar.php%cb.php" +unicode(42) "phar://*/files/phar_oo_002.phar.php%cb.php" unicode(5) "b.php" int(32) bool(false) NULL int(0) -unicode(42) "phar://*/files/phar_oo_test.phar.php%ce.php" +unicode(42) "phar://*/files/phar_oo_002.phar.php%ce.php" unicode(5) "e.php" int(32) bool(false) diff --git a/ext/phar/tests/phar_oo_003.phpt b/ext/phar/tests/phar_oo_003.phpt index ccaf7c65f80d7..4395792632433 100644 --- a/ext/phar/tests/phar_oo_003.phpt +++ b/ext/phar/tests/phar_oo_003.phpt @@ -27,7 +27,7 @@ foreach($phar as $name => $ent) ===DONE=== --CLEAN-- --EXPECTF-- diff --git a/ext/phar/tests/phar_oo_004.phpt b/ext/phar/tests/phar_oo_004.phpt index ba67749843ab0..3e4581992eaab 100644 --- a/ext/phar/tests/phar_oo_004.phpt +++ b/ext/phar/tests/phar_oo_004.phpt @@ -78,7 +78,7 @@ foreach($it as $name => $ent) ===DONE=== --CLEAN-- --EXPECT-- diff --git a/ext/phar/tests/phar_oo_004U.phpt b/ext/phar/tests/phar_oo_004U.phpt index 2762ee3c3568f..51be9dab2e2bc 100644 --- a/ext/phar/tests/phar_oo_004U.phpt +++ b/ext/phar/tests/phar_oo_004U.phpt @@ -78,7 +78,7 @@ foreach($it as $name => $ent) ===DONE=== --CLEAN-- --EXPECT-- diff --git a/ext/phar/tests/phar_oo_005.phpt b/ext/phar/tests/phar_oo_005.phpt index cb3f2987280f0..b01231e9c2652 100644 --- a/ext/phar/tests/phar_oo_005.phpt +++ b/ext/phar/tests/phar_oo_005.phpt @@ -32,7 +32,7 @@ foreach($it as $name => $ent) ===DONE=== --CLEAN-- --EXPECT-- diff --git a/ext/phar/tests/phar_oo_005U.phpt b/ext/phar/tests/phar_oo_005U.phpt index bcdcb08b0dc9f..9c04b93cef33c 100644 --- a/ext/phar/tests/phar_oo_005U.phpt +++ b/ext/phar/tests/phar_oo_005U.phpt @@ -31,7 +31,7 @@ foreach($it as $name => $ent) ===DONE=== --CLEAN-- --EXPECT-- diff --git a/ext/phar/tests/phar_oo_005_5.2.phpt b/ext/phar/tests/phar_oo_005_5.2.phpt index 9e509d94b704c..399edb0dd37b1 100644 --- a/ext/phar/tests/phar_oo_005_5.2.phpt +++ b/ext/phar/tests/phar_oo_005_5.2.phpt @@ -31,7 +31,7 @@ foreach($it as $name => $ent) ===DONE=== --CLEAN-- --EXPECT-- diff --git a/ext/phar/tests/phar_oo_006.phpt b/ext/phar/tests/phar_oo_006.phpt index 556c98ce0b620..5d1d7052066c4 100644 --- a/ext/phar/tests/phar_oo_006.phpt +++ b/ext/phar/tests/phar_oo_006.phpt @@ -38,7 +38,7 @@ echo $phar['b.php']->getFilename() . "\n"; ===DONE=== --CLEAN-- --EXPECTF-- diff --git a/ext/phar/tests/phar_oo_007.phpt b/ext/phar/tests/phar_oo_007.phpt index 788b11f1f81a4..d0b5aa5ecaec0 100644 --- a/ext/phar/tests/phar_oo_007.phpt +++ b/ext/phar/tests/phar_oo_007.phpt @@ -59,11 +59,11 @@ var_dump($f->eof()); ===DONE=== --CLEAN-- --EXPECTF-- -MyFile::__construct(phar://*/files/phar_oo_test.phar.php/a.php) +MyFile::__construct(phar://*/files/phar_oo_007.phar.php/a.php) int(%d) int(%d) int(%d) @@ -79,7 +79,7 @@ int(0) string(32) "" int(32) ===AGAIN=== -MyFile::__construct(phar://*/files/phar_oo_test.phar.php/a.php) +MyFile::__construct(phar://*/files/phar_oo_007.phar.php/a.php) int(0) bool(false) string(32) "" diff --git a/ext/phar/tests/phar_oo_008.phpt b/ext/phar/tests/phar_oo_008.phpt index 80d1ece0ca97d..d95af571b3c04 100644 --- a/ext/phar/tests/phar_oo_008.phpt +++ b/ext/phar/tests/phar_oo_008.phpt @@ -83,7 +83,7 @@ foreach($v as $k => $d) ===DONE=== --CLEAN-- --EXPECTF-- diff --git a/ext/phar/tests/phar_oo_009.phpt b/ext/phar/tests/phar_oo_009.phpt index 6abd03ee30b52..3c842fabeda52 100644 --- a/ext/phar/tests/phar_oo_009.phpt +++ b/ext/phar/tests/phar_oo_009.phpt @@ -36,7 +36,7 @@ foreach($f as $k => $v) ===DONE=== --CLEAN-- --EXPECTF-- diff --git a/ext/phar/tests/phar_oo_010.phpt b/ext/phar/tests/phar_oo_010.phpt index 1d3ff73242418..331d300a8c650 100644 --- a/ext/phar/tests/phar_oo_010.phpt +++ b/ext/phar/tests/phar_oo_010.phpt @@ -36,7 +36,7 @@ var_dump(isset($phar['b'])); ===DONE=== --CLEAN-- --EXPECTF-- diff --git a/ext/phar/tests/phar_oo_011.phpt b/ext/phar/tests/phar_oo_011.phpt index cfbab702ad8c8..01fa9f01e6ec4 100644 --- a/ext/phar/tests/phar_oo_011.phpt +++ b/ext/phar/tests/phar_oo_011.phpt @@ -26,7 +26,7 @@ echo "\n"; ===DONE=== --CLEAN-- --EXPECT-- diff --git a/ext/phar/tests/phar_oo_011b.phpt b/ext/phar/tests/phar_oo_011b.phpt index 36d9963a2283d..34cae0e760b73 100644 --- a/ext/phar/tests/phar_oo_011b.phpt +++ b/ext/phar/tests/phar_oo_011b.phpt @@ -31,7 +31,7 @@ catch (BadMethodCallException $e) ===DONE=== --CLEAN-- --EXPECTF-- diff --git a/ext/phar/tests/phar_oo_012.phpt b/ext/phar/tests/phar_oo_012.phpt index e79ac0960edc6..b6f9f44b1e153 100644 --- a/ext/phar/tests/phar_oo_012.phpt +++ b/ext/phar/tests/phar_oo_012.phpt @@ -27,7 +27,7 @@ var_dump(isset($phar['f.php'])); ===DONE=== --CLEAN-- --EXPECT-- diff --git a/ext/phar/tests/phar_oo_012_confirm.phpt b/ext/phar/tests/phar_oo_012_confirm.phpt index 58a3be87b323f..ce5a58f212d7e 100644 --- a/ext/phar/tests/phar_oo_012_confirm.phpt +++ b/ext/phar/tests/phar_oo_012_confirm.phpt @@ -30,7 +30,7 @@ var_dump(isset($phar['f.php'])); ===DONE=== --CLEAN-- --EXPECT-- diff --git a/ext/phar/tests/phar_oo_012b.phpt b/ext/phar/tests/phar_oo_012b.phpt index 80d8ed8dc4d7a..066d3bc0687b1 100644 --- a/ext/phar/tests/phar_oo_012b.phpt +++ b/ext/phar/tests/phar_oo_012b.phpt @@ -34,7 +34,7 @@ catch (BadMethodCallException $e) ===DONE=== --CLEAN-- --EXPECTF-- diff --git a/ext/phar/util.c b/ext/phar/util.c index 38aa549f00d57..a887daecdce68 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -41,10 +41,6 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end, char *key, int key_len, char **signature, int *signature_len TSRMLS_DC); #endif -#if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300 -extern php_stream_wrapper php_stream_phar_wrapper; -#endif - /* for links to relative location, prepend cwd of the entry */ static char *phar_get_link_location(phar_entry_info *entry TSRMLS_DC) /* {{{ */ { @@ -256,7 +252,6 @@ int phar_mount_entry(phar_archive_data *phar, char *filename, int filename_len, char *phar_find_in_include_path(char *filename, int filename_len, phar_archive_data **pphar TSRMLS_DC) /* {{{ */ { -#if PHP_VERSION_ID >= 50300 char *path, *fname, *arch, *entry, *ret, *test; int arch_len, entry_len, fname_len, ret_len; phar_archive_data *phar; @@ -344,223 +339,6 @@ char *phar_find_in_include_path(char *filename, int filename_len, phar_archive_d } return ret; -#else /* PHP 5.2 */ - char resolved_path[MAXPATHLEN]; - char trypath[MAXPATHLEN]; - char *ptr, *end, *path = PG(include_path); - php_stream_wrapper *wrapper; - const char *p; - int n = 0; - char *fname, *arch, *entry, *ret, *test; - int arch_len, entry_len; - phar_archive_data *phar = NULL; - - if (!filename) { - return NULL; - } - - if (!zend_is_executing(TSRMLS_C) || !PHAR_G(cwd)) { - goto doit; - } - - fname = (char*)zend_get_executed_filename(TSRMLS_C); - - if (SUCCESS != phar_split_fname(fname, strlen(fname), &arch, &arch_len, &entry, &entry_len, 1, 0 TSRMLS_CC)) { - goto doit; - } - - efree(entry); - - if (*filename == '.') { - int try_len; - - if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL TSRMLS_CC)) { - efree(arch); - goto doit; - } - - try_len = filename_len; - test = phar_fix_filepath(estrndup(filename, filename_len), &try_len, 1 TSRMLS_CC); - - if (*test == '/') { - if (zend_hash_exists(&(phar->manifest), test + 1, try_len - 1)) { - spprintf(&ret, 0, "phar://%s%s", arch, test); - efree(arch); - efree(test); - return ret; - } - } else { - if (zend_hash_exists(&(phar->manifest), test, try_len)) { - spprintf(&ret, 0, "phar://%s/%s", arch, test); - efree(arch); - efree(test); - return ret; - } - } - - efree(test); - } - - efree(arch); -doit: - if (*filename == '.' || IS_ABSOLUTE_PATH(filename, filename_len) || !path || !*path) { - if (tsrm_realpath(filename, resolved_path TSRMLS_CC)) { - return estrdup(resolved_path); - } else { - return NULL; - } - } - - /* test for stream wrappers and return */ - for (p = filename; p - filename < filename_len && (isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'); ++p, ++n); - - if (n < filename_len - 3 && (*p == ':') && (!strncmp("//", p+1, 2) || ( filename_len > 4 && !memcmp("data", filename, 4)))) { - /* found stream wrapper, this is an absolute path until stream wrappers implement realpath */ - return estrndup(filename, filename_len); - } - - ptr = (char *) path; - while (ptr && *ptr) { - int len, is_stream_wrapper = 0, maybe_stream = 1; - - end = strchr(ptr, DEFAULT_DIR_SEPARATOR); -#ifndef PHP_WIN32 - /* search for stream wrapper */ - if (end - ptr <= 1) { - maybe_stream = 0; - goto not_stream; - } - - for (p = ptr, n = 0; p < end && (isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'); ++p, ++n); - - if (n == end - ptr && *p && !strncmp("//", p+1, 2)) { - is_stream_wrapper = 1; - /* seek to real end of include_path portion */ - end = strchr(end + 1, DEFAULT_DIR_SEPARATOR); - } else { - maybe_stream = 0; - } -not_stream: -#endif - if (end) { - if ((end-ptr) + 1 + filename_len + 1 >= MAXPATHLEN) { - ptr = end + 1; - continue; - } - - memcpy(trypath, ptr, end-ptr); - len = end-ptr; - trypath[end-ptr] = '/'; - memcpy(trypath+(end-ptr)+1, filename, filename_len+1); - ptr = end+1; - } else { - len = strlen(ptr); - - if (len + 1 + filename_len + 1 >= MAXPATHLEN) { - break; - } - - memcpy(trypath, ptr, len); - trypath[len] = '/'; - memcpy(trypath+len+1, filename, filename_len+1); - ptr = NULL; - } - - if (!is_stream_wrapper && maybe_stream) { - /* search for stream wrapper */ - for (p = trypath, n = 0; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; ++p, ++n); - } - - if (is_stream_wrapper || (n < len - 3 && (*p == ':') && (n > 1) && (!strncmp("//", p+1, 2) || !memcmp("data", trypath, 4)))) { - char *actual; - - wrapper = php_stream_locate_url_wrapper(trypath, &actual, STREAM_OPEN_FOR_INCLUDE TSRMLS_CC); - if (wrapper == &php_plain_files_wrapper) { - strlcpy(trypath, actual, sizeof(trypath)); - } else if (!wrapper) { - /* if wrapper is NULL, there was a mal-formed include_path stream wrapper, so skip this ptr */ - continue; - } else { - if (wrapper->wops->url_stat) { - php_stream_statbuf ssb; - - if (SUCCESS == wrapper->wops->url_stat(wrapper, trypath, 0, &ssb, NULL TSRMLS_CC)) { - if (wrapper == &php_stream_phar_wrapper) { - char *arch, *entry; - int arch_len, entry_len, ret_len; - - ret_len = strlen(trypath); - /* found phar:// */ - - if (SUCCESS != phar_split_fname(trypath, ret_len, &arch, &arch_len, &entry, &entry_len, 1, 0 TSRMLS_CC)) { - return estrndup(trypath, ret_len); - } - - zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), arch, arch_len, (void **) &pphar); - - if (!pphar && PHAR_G(manifest_cached)) { - zend_hash_find(&cached_phars, arch, arch_len, (void **) &pphar); - } - - efree(arch); - efree(entry); - - return estrndup(trypath, ret_len); - } - return estrdup(trypath); - } - } - continue; - } - } - - if (tsrm_realpath(trypath, resolved_path TSRMLS_CC)) { - return estrdup(resolved_path); - } - } /* end provided path */ - - /* check in calling scripts' current working directory as a fall back case */ - if (zend_is_executing(TSRMLS_C)) { - char *exec_fname = (char*)zend_get_executed_filename(TSRMLS_C); - int exec_fname_length = strlen(exec_fname); - const char *p; - int n = 0; - - while ((--exec_fname_length >= 0) && !IS_SLASH(exec_fname[exec_fname_length])); - if (exec_fname && exec_fname[0] != '[' && - exec_fname_length > 0 && - exec_fname_length + 1 + filename_len + 1 < MAXPATHLEN) { - memcpy(trypath, exec_fname, exec_fname_length + 1); - memcpy(trypath+exec_fname_length + 1, filename, filename_len+1); - - /* search for stream wrapper */ - for (p = trypath; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; ++p, ++n); - - if (n < exec_fname_length - 3 && (*p == ':') && (n > 1) && (!strncmp("//", p+1, 2) || !memcmp("data", trypath, 4))) { - char *actual; - - wrapper = php_stream_locate_url_wrapper(trypath, &actual, STREAM_OPEN_FOR_INCLUDE TSRMLS_CC); - - if (wrapper == &php_plain_files_wrapper) { - /* this should never technically happen, but we'll leave it here for completeness */ - strlcpy(trypath, actual, sizeof(trypath)); - } else if (!wrapper) { - /* if wrapper is NULL, there was a malformed include_path stream wrapper - this also should be impossible */ - return NULL; - } else { - return estrdup(trypath); - } - } - - if (tsrm_realpath(trypath, resolved_path TSRMLS_CC)) { - return estrdup(resolved_path); - } - } - } - - return NULL; -#endif /* PHP 5.2 */ } /* }}} */ @@ -850,11 +628,6 @@ int phar_open_archive_fp(phar_archive_data *phar TSRMLS_DC) /* {{{ */ if (phar_get_pharfp(phar TSRMLS_CC)) { return SUCCESS; } -#if PHP_API_VERSION < 20100412 - if (PG(safe_mode) && (!php_checkuid(phar->fname, NULL, CHECKUID_ALLOW_ONLY_FILE))) { - return FAILURE; - } -#endif if (php_check_open_basedir(phar->fname TSRMLS_CC)) { return FAILURE; @@ -900,7 +673,7 @@ int phar_copy_entry_fp(phar_entry_info *source, phar_entry_info *dest, char **er link = source; } - if (SUCCESS != phar_stream_copy_to_stream(phar_get_efp(link, 0 TSRMLS_CC), dest->fp, link->uncompressed_filesize, NULL)) { + if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(link, 0 TSRMLS_CC), dest->fp, link->uncompressed_filesize, NULL)) { php_stream_close(dest->fp); dest->fp_type = PHAR_FP; if (error) { @@ -1002,7 +775,7 @@ int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TS php_stream_seek(phar_get_entrypfp(entry TSRMLS_CC), phar_get_fp_offset(entry TSRMLS_CC), SEEK_SET); if (entry->uncompressed_filesize) { - if (SUCCESS != phar_stream_copy_to_stream(phar_get_entrypfp(entry TSRMLS_CC), ufp, entry->compressed_filesize, NULL)) { + if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_entrypfp(entry TSRMLS_CC), ufp, entry->compressed_filesize, NULL)) { spprintf(error, 4096, "phar error: internal corruption of phar \"%s\" (actual filesize mismatch on file \"%s\")", phar->fname, entry->filename); php_stream_filter_remove(filter, 1 TSRMLS_CC); return FAILURE; @@ -1031,47 +804,12 @@ int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TS } /* }}} */ -#if defined(PHP_VERSION_ID) && PHP_VERSION_ID < 50202 -typedef struct { - char *data; - size_t fpos; - size_t fsize; - size_t smax; - int mode; - php_stream **owner_ptr; -} php_stream_memory_data; -#endif - int phar_create_writeable_entry(phar_archive_data *phar, phar_entry_info *entry, char **error TSRMLS_DC) /* {{{ */ { if (entry->fp_type == PHAR_MOD) { /* already newly created, truncate */ -#if PHP_VERSION_ID >= 50202 php_stream_truncate_set_size(entry->fp, 0); -#else - if (php_stream_is(entry->fp, PHP_STREAM_IS_TEMP)) { - if (php_stream_is(*(php_stream**)entry->fp->abstract, PHP_STREAM_IS_MEMORY)) { - php_stream *inner = *(php_stream**)entry->fp->abstract; - php_stream_memory_data *memfp = (php_stream_memory_data*)inner->abstract; - memfp->fpos = 0; - memfp->fsize = 0; - } else if (php_stream_is(*(php_stream**)entry->fp->abstract, PHP_STREAM_IS_STDIO)) { - php_stream_truncate_set_size(*(php_stream**)entry->fp->abstract, 0); - } else { - if (error) { - spprintf(error, 0, "phar error: file \"%s\" cannot be opened for writing, no truncate support", phar->fname); - } - return FAILURE; - } - } else if (php_stream_is(entry->fp, PHP_STREAM_IS_STDIO)) { - php_stream_truncate_set_size(entry->fp, 0); - } else { - if (error) { - spprintf(error, 0, "phar error: file \"%s\" cannot be opened for writing, no truncate support", phar->fname); - } - return FAILURE; - } -#endif + entry->old_flags = entry->flags; entry->is_modified = 1; phar->is_modified = 1; @@ -1144,7 +882,7 @@ int phar_separate_entry_fp(phar_entry_info *entry, char **error TSRMLS_DC) /* {{ link = entry; } - if (SUCCESS != phar_stream_copy_to_stream(phar_get_efp(link, 0 TSRMLS_CC), fp, link->uncompressed_filesize, NULL)) { + if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(link, 0 TSRMLS_CC), fp, link->uncompressed_filesize, NULL)) { if (error) { spprintf(error, 4096, "phar error: cannot separate entry file \"%s\" contents in phar archive \"%s\" for write access", entry->filename, entry->phar->fname); } @@ -1185,6 +923,18 @@ phar_entry_info * phar_open_jit(phar_archive_data *phar, phar_entry_info *entry, } /* }}} */ +PHP_PHAR_API int phar_resolve_alias(char *alias, int alias_len, char **filename, int *filename_len TSRMLS_DC) /* {{{ */ { + phar_archive_data **fd_ptr; + if (PHAR_GLOBALS->phar_alias_map.arBuckets + && SUCCESS == zend_hash_find(&(PHAR_GLOBALS->phar_alias_map), alias, alias_len, (void**)&fd_ptr)) { + *filename = (*fd_ptr)->fname; + *filename_len = (*fd_ptr)->fname_len; + return SUCCESS; + } + return FAILURE; +} +/* }}} */ + int phar_free_alias(phar_archive_data *phar, char *alias, int alias_len TSRMLS_DC) /* {{{ */ { if (phar->refcount || phar->is_persistent) { @@ -1262,8 +1012,10 @@ int phar_get_archive(phar_archive_data **archive, char *fname, int fname_len, ch spprintf(error, 0, "alias \"%s\" is already used for archive \"%s\" cannot be overloaded with \"%s\"", alias, (*fd_ptr)->fname, fname); } if (SUCCESS == phar_free_alias(*fd_ptr, alias, alias_len TSRMLS_CC)) { - efree(*error); - *error = NULL; + if (error) { + efree(*error); + *error = NULL; + } } return FAILURE; } @@ -1547,21 +1299,17 @@ phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, in } if (phar->mounted_dirs.arBuckets && zend_hash_num_elements(&phar->mounted_dirs)) { - phar_zstr key; char *str_key; ulong unused; uint keylen; zend_hash_internal_pointer_reset(&phar->mounted_dirs); while (FAILURE != zend_hash_has_more_elements(&phar->mounted_dirs)) { - if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(&phar->mounted_dirs, &key, &keylen, &unused, 0, NULL)) { + if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(&phar->mounted_dirs, &str_key, &keylen, &unused, 0, NULL)) { break; } - PHAR_STR(key, str_key); - if ((int)keylen >= path_len || strncmp(str_key, path, keylen)) { - PHAR_STR_FREE(str_key); continue; } else { char *test; @@ -1572,7 +1320,6 @@ phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, in if (error) { spprintf(error, 4096, "phar internal error: mounted path \"%s\" could not be retrieved from manifest", str_key); } - PHAR_STR_FREE(str_key); return NULL; } @@ -1580,10 +1327,8 @@ phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, in if (error) { spprintf(error, 4096, "phar internal error: mounted path \"%s\" is not properly initialized as a mounted path", str_key); } - PHAR_STR_FREE(str_key); return NULL; } - PHAR_STR_FREE(str_key); test_len = spprintf(&test, MAXPATHLEN, "%s%s", entry->tmp, path + keylen); @@ -1675,11 +1420,7 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end, Z_TYPE_P(zdata) = IS_STRING; Z_STRLEN_P(zdata) = end; -#if PHP_MAJOR_VERSION > 5 - if (end != (off_t) php_stream_copy_to_mem(fp, (void **) &(Z_STRVAL_P(zdata)), (size_t) end, 0)) { -#else if (end != (off_t) php_stream_copy_to_mem(fp, &(Z_STRVAL_P(zdata)), (size_t) end, 0)) { -#endif zval_dtor(zdata); zval_dtor(zsig); zval_dtor(zkey); @@ -1691,11 +1432,7 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end, return FAILURE; } -#if PHP_VERSION_ID < 50300 - if (FAILURE == zend_fcall_info_init(openssl, &fci, &fcc TSRMLS_CC)) { -#else if (FAILURE == zend_fcall_info_init(openssl, 0, &fci, &fcc, NULL, NULL TSRMLS_CC)) { -#endif zval_dtor(zdata); zval_dtor(zsig); zval_dtor(zkey); @@ -1709,13 +1446,6 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end, fci.param_count = 3; fci.params = zp; -#if PHP_VERSION_ID < 50300 - ++(zdata->refcount); - if (!is_sign) { - ++(zsig->refcount); - } - ++(zkey->refcount); -#else Z_ADDREF_P(zdata); if (is_sign) { Z_SET_ISREF_P(zsig); @@ -1723,7 +1453,7 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end, Z_ADDREF_P(zsig); } Z_ADDREF_P(zkey); -#endif + fci.retval_ptr_ptr = &retval_ptr; if (FAILURE == zend_call_function(&fci, &fcc TSRMLS_CC)) { @@ -1740,21 +1470,15 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end, zval_dtor(openssl); efree(openssl); -#if PHP_VERSION_ID < 50300 - --(zdata->refcount); - if (!is_sign) { - --(zsig->refcount); - } - --(zkey->refcount); -#else Z_DELREF_P(zdata); + if (is_sign) { Z_UNSET_ISREF_P(zsig); } else { Z_DELREF_P(zsig); } Z_DELREF_P(zkey); -#endif + zval_dtor(zdata); efree(zdata); zval_dtor(zkey); @@ -2280,11 +2004,7 @@ static int phar_update_cached_entry(void *data, void *argument) /* {{{ */ ALLOC_ZVAL(entry->metadata); *entry->metadata = *t; zval_copy_ctor(entry->metadata); -#if PHP_VERSION_ID < 50300 - entry->metadata->refcount = 1; -#else Z_SET_REFCOUNT_P(entry->metadata, 1); -#endif entry->metadata_str.c = NULL; entry->metadata_str.len = 0; } @@ -2328,11 +2048,7 @@ static void phar_copy_cached_phar(phar_archive_data **pphar TSRMLS_DC) /* {{{ */ ALLOC_ZVAL(phar->metadata); *phar->metadata = *t; zval_copy_ctor(phar->metadata); -#if PHP_VERSION_ID < 50300 - phar->metadata->refcount = 1; -#else Z_SET_REFCOUNT_P(phar->metadata, 1); -#endif } } diff --git a/ext/phar/zip.c b/ext/phar/zip.c index 6ba745e9cbf74..2e977b8840fe1 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -417,11 +417,11 @@ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, php_stream_seek(fp, 0, SEEK_SET); /* copy file contents + local headers and zip comment, if any, to be hashed for signature */ - phar_stream_copy_to_stream(fp, sigfile, entry.header_offset, NULL); + php_stream_copy_to_stream_ex(fp, sigfile, entry.header_offset, NULL); /* seek to central directory */ php_stream_seek(fp, PHAR_GET_32(locator.cdir_offset), SEEK_SET); /* copy central directory header */ - phar_stream_copy_to_stream(fp, sigfile, beforeus - PHAR_GET_32(locator.cdir_offset), NULL); + php_stream_copy_to_stream_ex(fp, sigfile, beforeus - PHAR_GET_32(locator.cdir_offset), NULL); if (metadata) { php_stream_write(sigfile, metadata, PHAR_GET_16(locator.comment_len)); } @@ -578,10 +578,6 @@ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, /* construct actual offset to file start - local extra_len can be different from central extra_len */ entry.offset = entry.offset_abs = sizeof(local) + entry.header_offset + PHAR_GET_16(local.filename_len) + PHAR_GET_16(local.extra_len); -#if PHP_VERSION_ID < 50207 - /* work around Bug #46147 */ - fp->writepos = fp->readpos = 0; -#endif php_stream_seek(fp, entry.offset, SEEK_SET); /* these next lines should be for php < 5.2.6 after 5.3 filters are fixed */ fp->writepos = 0; @@ -605,9 +601,6 @@ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { pefree(entry.filename, entry.is_persistent); -#if PHP_VERSION_ID < 50207 - PHAR_ZIP_FAIL("unable to read in alias, truncated (PHP 5.2.7 and newer has a potential fix for this problem)"); -#endif PHAR_ZIP_FAIL("unable to read in alias, truncated"); } @@ -626,9 +619,6 @@ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { pefree(entry.filename, entry.is_persistent); -#if PHP_VERSION_ID < 50207 - PHAR_ZIP_FAIL("unable to read in alias, truncated (PHP 5.2.7 and newer has a potential fix for this problem)"); -#endif PHAR_ZIP_FAIL("unable to read in alias, truncated"); } @@ -915,7 +905,7 @@ static int phar_zip_changed_apply(void *data, void *arg TSRMLS_DC) /* {{{ */ php_stream_filter_append((&entry->cfp->writefilters), filter); - if (SUCCESS != phar_stream_copy_to_stream(efp, entry->cfp, entry->uncompressed_filesize, NULL)) { + if (SUCCESS != php_stream_copy_to_stream_ex(efp, entry->cfp, entry->uncompressed_filesize, NULL)) { spprintf(p->error, 0, "unable to copy compressed file contents of file \"%s\" while creating new phar \"%s\"", entry->filename, entry->phar->fname); return ZEND_HASH_APPLY_STOP; } @@ -1020,7 +1010,7 @@ static int phar_zip_changed_apply(void *data, void *arg TSRMLS_DC) /* {{{ */ if (!not_really_modified && entry->is_modified) { if (entry->cfp) { - if (SUCCESS != phar_stream_copy_to_stream(entry->cfp, p->filefp, entry->compressed_filesize, NULL)) { + if (SUCCESS != php_stream_copy_to_stream_ex(entry->cfp, p->filefp, entry->compressed_filesize, NULL)) { spprintf(p->error, 0, "unable to write compressed contents of file \"%s\" in zip-based phar \"%s\"", entry->filename, entry->phar->fname); return ZEND_HASH_APPLY_STOP; } @@ -1034,7 +1024,7 @@ static int phar_zip_changed_apply(void *data, void *arg TSRMLS_DC) /* {{{ */ phar_seek_efp(entry, 0, SEEK_SET, 0, 0 TSRMLS_CC); - if (SUCCESS != phar_stream_copy_to_stream(phar_get_efp(entry, 0 TSRMLS_CC), p->filefp, entry->uncompressed_filesize, NULL)) { + if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(entry, 0 TSRMLS_CC), p->filefp, entry->uncompressed_filesize, NULL)) { spprintf(p->error, 0, "unable to write contents of file \"%s\" in zip-based phar \"%s\"", entry->filename, entry->phar->fname); return ZEND_HASH_APPLY_STOP; } @@ -1060,7 +1050,7 @@ static int phar_zip_changed_apply(void *data, void *arg TSRMLS_DC) /* {{{ */ } } - if (!entry->is_dir && entry->compressed_filesize && SUCCESS != phar_stream_copy_to_stream(p->old, p->filefp, entry->compressed_filesize, NULL)) { + if (!entry->is_dir && entry->compressed_filesize && SUCCESS != php_stream_copy_to_stream_ex(p->old, p->filefp, entry->compressed_filesize, NULL)) { spprintf(p->error, 0, "unable to copy contents of file \"%s\" while creating zip-based phar \"%s\"", entry->filename, entry->phar->fname); return ZEND_HASH_APPLY_STOP; } @@ -1103,10 +1093,10 @@ static int phar_zip_applysignature(phar_archive_data *phar, struct _phar_zip_pas st = tell = php_stream_tell(pass->filefp); /* copy the local files, central directory, and the zip comment to generate the hash */ php_stream_seek(pass->filefp, 0, SEEK_SET); - phar_stream_copy_to_stream(pass->filefp, newfile, tell, NULL); + php_stream_copy_to_stream_ex(pass->filefp, newfile, tell, NULL); tell = php_stream_tell(pass->centralfp); php_stream_seek(pass->centralfp, 0, SEEK_SET); - phar_stream_copy_to_stream(pass->centralfp, newfile, tell, NULL); + php_stream_copy_to_stream_ex(pass->centralfp, newfile, tell, NULL); if (metadata->c) { php_stream_write(newfile, metadata->c, metadata->len); } @@ -1441,7 +1431,7 @@ int phar_zip_flush(phar_archive_data *phar, char *user_stub, long len, int defau { size_t clen; - int ret = phar_stream_copy_to_stream(pass.centralfp, pass.filefp, PHP_STREAM_COPY_ALL, &clen); + int ret = php_stream_copy_to_stream_ex(pass.centralfp, pass.filefp, PHP_STREAM_COPY_ALL, &clen); if (SUCCESS != ret || clen != cdir_size) { if (error) { spprintf(error, 4096, "phar zip flush of \"%s\" failed: unable to write central-directory", phar->fname); @@ -1511,7 +1501,7 @@ int phar_zip_flush(phar_archive_data *phar, char *user_stub, long len, int defau return EOF; } php_stream_rewind(pass.filefp); - phar_stream_copy_to_stream(pass.filefp, phar->fp, PHP_STREAM_COPY_ALL, NULL); + php_stream_copy_to_stream_ex(pass.filefp, phar->fp, PHP_STREAM_COPY_ALL, NULL); /* we could also reopen the file in "rb" mode but there is no need for that */ php_stream_close(pass.filefp); } diff --git a/ext/posix/tests/posix_getgrnam.phpt b/ext/posix/tests/posix_getgrnam.phpt deleted file mode 100644 index 854db4ac1614d..0000000000000 --- a/ext/posix/tests/posix_getgrnam.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -posix_getgrnam(): Basic tests ---SKIPIF-- - ---FILE-- - ---EXPECT-- -bool(false) -bool(false) -bool(false) diff --git a/ext/posix/tests/posix_getgrnam_basic.phpt b/ext/posix/tests/posix_getgrnam_basic.phpt deleted file mode 100644 index fd5bf23172d86..0000000000000 --- a/ext/posix/tests/posix_getgrnam_basic.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -posix_getgrnam(): Basic tests ---SKIPIF-- - ---FILE-- - -===DONE=== ---EXPECT-- -Basic test of POSIX posix_getgrnam function -bool(false) -bool(false) -bool(false) -===DONE=== \ No newline at end of file diff --git a/ext/posix/tests/posix_getpwnam.phpt b/ext/posix/tests/posix_getpwnam.phpt deleted file mode 100644 index b5de1e4ce233d..0000000000000 --- a/ext/posix/tests/posix_getpwnam.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -posix_getpwnam(): Basic tests ---SKIPIF-- - ---FILE-- - ---EXPECT-- -bool(false) -bool(false) -bool(false) diff --git a/ext/posix/tests/posix_getpwnam_basic.phpt b/ext/posix/tests/posix_getpwnam_basic.phpt deleted file mode 100644 index d675d6c182382..0000000000000 --- a/ext/posix/tests/posix_getpwnam_basic.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -posix_getpwnam(): Basic tests ---SKIPIF-- - ---FILE-- - -===DONE==== ---EXPECT-- -Basic test of POSIX posix_getpwnam function -bool(false) -bool(false) -bool(false) -===DONE==== diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index b1f7484f243ca..cc148b39c5663 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -681,8 +681,8 @@ static zend_op* _get_recv_op(zend_op_array *op_array, zend_uint offset) ++offset; while (op < end) { - if ((op->opcode == ZEND_RECV || op->opcode == ZEND_RECV_INIT) - && op->op1.num == (long)offset) + if ((op->opcode == ZEND_RECV || op->opcode == ZEND_RECV_INIT + || op->opcode == ZEND_RECV_VARIADIC) && op->op1.num == (long)offset) { return op; } @@ -715,6 +715,9 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg if (arg_info->pass_by_reference) { string_write(str, "&", sizeof("&")-1); } + if (arg_info->is_variadic) { + string_write(str, "...", sizeof("...")-1); + } if (arg_info->name) { string_printf(str, "$%s", arg_info->name); } else { @@ -2652,6 +2655,22 @@ ZEND_METHOD(reflection_parameter, getDefaultValueConstantName) } /* }}} */ +/* {{{ proto public bool ReflectionParameter::isVariadic() + Returns whether this parameter is a variadic parameter */ +ZEND_METHOD(reflection_parameter, isVariadic) +{ + reflection_object *intern; + parameter_reference *param; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + GET_REFLECTION_OBJECT_PTR(param); + + RETVAL_BOOL(param->arg_info->is_variadic); +} +/* }}} */ + /* {{{ proto public static mixed ReflectionMethod::export(mixed class, string name [, bool return]) throws ReflectionException Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_method, export) @@ -3095,6 +3114,14 @@ ZEND_METHOD(reflection_function, isGenerator) } /* }}} */ +/* {{{ proto public bool ReflectionFunction::isVariadic() + Returns whether this function is variadic */ +ZEND_METHOD(reflection_function, isVariadic) +{ + _function_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_VARIADIC); +} +/* }}} */ + /* {{{ proto public bool ReflectionFunction::inNamespace() Returns whether this function is defined in namespace */ ZEND_METHOD(reflection_function, inNamespace) @@ -5720,6 +5747,7 @@ static const zend_function_entry reflection_function_abstract_functions[] = { ZEND_ME(reflection_function, isInternal, arginfo_reflection__void, 0) ZEND_ME(reflection_function, isUserDefined, arginfo_reflection__void, 0) ZEND_ME(reflection_function, isGenerator, arginfo_reflection__void, 0) + ZEND_ME(reflection_function, isVariadic, arginfo_reflection__void, 0) ZEND_ME(reflection_function, getClosureThis, arginfo_reflection__void, 0) ZEND_ME(reflection_function, getClosureScopeClass, arginfo_reflection__void, 0) ZEND_ME(reflection_function, getDocComment, arginfo_reflection__void, 0) @@ -6022,6 +6050,7 @@ static const zend_function_entry reflection_parameter_functions[] = { ZEND_ME(reflection_parameter, getDefaultValue, arginfo_reflection__void, 0) ZEND_ME(reflection_parameter, isDefaultValueConstant, arginfo_reflection__void, 0) ZEND_ME(reflection_parameter, getDefaultValueConstantName, arginfo_reflection__void, 0) + ZEND_ME(reflection_parameter, isVariadic, arginfo_reflection__void, 0) PHP_FE_END }; diff --git a/ext/reflection/tests/ReflectionFunction_isVariadic_basic.phpt b/ext/reflection/tests/ReflectionFunction_isVariadic_basic.phpt new file mode 100644 index 0000000000000..50b6bb495e449 --- /dev/null +++ b/ext/reflection/tests/ReflectionFunction_isVariadic_basic.phpt @@ -0,0 +1,18 @@ +--TEST-- +ReflectionFunction::isVariadic() +--FILE-- +isVariadic()); +var_dump((new ReflectionFunction('test2'))->isVariadic()); +var_dump((new ReflectionFunction('test3'))->isVariadic()); + +?> +--EXPECT-- +bool(false) +bool(true) +bool(true) diff --git a/ext/reflection/tests/ReflectionParameter_canBePassedByValue.phpt b/ext/reflection/tests/ReflectionParameter_canBePassedByValue.phpt index 82c62001226b2..4772f6548dcae 100644 --- a/ext/reflection/tests/ReflectionParameter_canBePassedByValue.phpt +++ b/ext/reflection/tests/ReflectionParameter_canBePassedByValue.phpt @@ -61,6 +61,10 @@ Name: SORT_REGULAR_or_SORT_NUMERIC_or_SORT_STRING Is passed by reference: yes Can be passed by value: yes +Name: more_array_and_sort_options +Is passed by reference: yes +Can be passed by value: yes + => sort: Name: arg diff --git a/ext/reflection/tests/ReflectionParameter_isVariadic_basic.phpt b/ext/reflection/tests/ReflectionParameter_isVariadic_basic.phpt new file mode 100644 index 0000000000000..370edc388df39 --- /dev/null +++ b/ext/reflection/tests/ReflectionParameter_isVariadic_basic.phpt @@ -0,0 +1,24 @@ +--TEST-- +ReflectionParameter::isVariadic() +--FILE-- +getParameters()[0]->isVariadic()); +var_dump($r2->getParameters()[0]->isVariadic()); +var_dump($r3->getParameters()[0]->isVariadic()); +var_dump($r3->getParameters()[1]->isVariadic()); + +?> +--EXPECT-- +bool(false) +bool(true) +bool(false) +bool(true) diff --git a/ext/reflection/tests/ReflectionParameter_toString_basic.phpt b/ext/reflection/tests/ReflectionParameter_toString_basic.phpt index 268ced15eca32..d1a23c758d3a3 100644 --- a/ext/reflection/tests/ReflectionParameter_toString_basic.phpt +++ b/ext/reflection/tests/ReflectionParameter_toString_basic.phpt @@ -4,7 +4,7 @@ ReflectionParameter::__toString() Stefan Koopmanschap --FILE-- $value) { --EXPECT-- Parameter #0 [ $test ] Parameter #1 [ $test2 = NULL ] +Parameter #2 [ ...$test3 ] ==DONE== diff --git a/ext/session/tests/session_hash_function_basic.phpt b/ext/session/tests/session_hash_function_basic.phpt index 45b8bc0710a1f..663852d9d1a1c 100644 --- a/ext/session/tests/session_hash_function_basic.phpt +++ b/ext/session/tests/session_hash_function_basic.phpt @@ -2,6 +2,8 @@ Test session.hash_function ini setting : basic functionality --SKIPIF-- +--INI-- +session.hash_bits_per_character=4 --FILE-- = 4 diff --git a/ext/skeleton/skeleton.c b/ext/skeleton/skeleton.c index b9a918806c810..462e48756ff07 100644 --- a/ext/skeleton/skeleton.c +++ b/ext/skeleton/skeleton.c @@ -142,7 +142,7 @@ zend_module_entry extname_module_entry = { PHP_RINIT(extname), /* Replace with NULL if there's nothing to do at request start */ PHP_RSHUTDOWN(extname), /* Replace with NULL if there's nothing to do at request end */ PHP_MINFO(extname), - "0.1", /* Replace with version number for your extension */ + PHP_EXTNAME_VERSION, STANDARD_MODULE_PROPERTIES }; /* }}} */ diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c index 0ac4c2ed7a9bf..f8c6940c1fb1c 100644 --- a/ext/soap/php_sdl.c +++ b/ext/soap/php_sdl.c @@ -24,7 +24,7 @@ #include "libxml/uri.h" #include "ext/standard/md5.h" -#include "tsrm_virtual_cwd.h" +#include "zend_virtual_cwd.h" #include #include @@ -2644,16 +2644,17 @@ static sdlAttributePtr make_persistent_sdl_attribute(sdlAttributePtr attr, HashT zend_hash_internal_pointer_reset(pattr->extraAttributes); while (zend_hash_get_current_data(attr->extraAttributes, (void**)&tmp) == SUCCESS) { - pextra = malloc(sizeof(sdlExtraAttribute)); - memset(pextra, 0, sizeof(sdlExtraAttribute)); - if ((*tmp)->ns) { - pextra->ns = strdup((*tmp)->ns); - } - if ((*tmp)->val) { - pextra->val = strdup((*tmp)->val); - } + if (zend_hash_get_current_key_ex(attr->extraAttributes, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) { + pextra = malloc(sizeof(sdlExtraAttribute)); + memset(pextra, 0, sizeof(sdlExtraAttribute)); - if (zend_hash_get_current_key_ex(attr->extraAttributes, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) { + if ((*tmp)->ns) { + pextra->ns = strdup((*tmp)->ns); + } + if ((*tmp)->val) { + pextra->val = strdup((*tmp)->val); + } + zend_hash_add(pattr->extraAttributes, key, key_len, (void*)&pextra, sizeof(sdlExtraAttributePtr), NULL); } diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 00e80efbcbca4..c5900dc645af4 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -1560,48 +1560,45 @@ PHP_METHOD(SoapServer, handle) } if (ZEND_NUM_ARGS() == 0) { - if (SG(request_info).raw_post_data) { - char *post_data = SG(request_info).raw_post_data; - int post_data_length = SG(request_info).raw_post_data_length; + if (SG(request_info).request_body && 0 == php_stream_rewind(SG(request_info).request_body)) { zval **server_vars, **encoding; + php_stream_filter *zf = NULL; zend_is_auto_global("_SERVER", sizeof("_SERVER")-1 TSRMLS_CC); if (zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), (void **) &server_vars) == SUCCESS && Z_TYPE_PP(server_vars) == IS_ARRAY && zend_hash_find(Z_ARRVAL_PP(server_vars), "HTTP_CONTENT_ENCODING", sizeof("HTTP_CONTENT_ENCODING"), (void **) &encoding)==SUCCESS && Z_TYPE_PP(encoding) == IS_STRING) { - zval func; - zval retval; - zval param; - zval *params[1]; - - if ((strcmp(Z_STRVAL_PP(encoding),"gzip") == 0 || - strcmp(Z_STRVAL_PP(encoding),"x-gzip") == 0) && - zend_hash_exists(EG(function_table), "gzinflate", sizeof("gzinflate"))) { - ZVAL_STRING(&func, "gzinflate", 0); - params[0] = ¶m; - ZVAL_STRINGL(params[0], post_data+10, post_data_length-10, 0); - INIT_PZVAL(params[0]); - } else if (strcmp(Z_STRVAL_PP(encoding),"deflate") == 0 && - zend_hash_exists(EG(function_table), "gzuncompress", sizeof("gzuncompress"))) { - ZVAL_STRING(&func, "gzuncompress", 0); - params[0] = ¶m; - ZVAL_STRINGL(params[0], post_data, post_data_length, 0); - INIT_PZVAL(params[0]); + + if (strcmp(Z_STRVAL_PP(encoding),"gzip") == 0 + || strcmp(Z_STRVAL_PP(encoding),"x-gzip") == 0 + || strcmp(Z_STRVAL_PP(encoding),"deflate") == 0 + ) { + zval filter_params; + + INIT_PZVAL(&filter_params); + array_init_size(&filter_params, 1); + add_assoc_long_ex(&filter_params, ZEND_STRS("window"), 0x2f); /* ANY WBITS */ + + zf = php_stream_filter_create("zlib.inflate", &filter_params, 0 TSRMLS_CC); + zval_dtor(&filter_params); + + if (zf) { + php_stream_filter_append(&SG(request_info).request_body->readfilters, zf); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING,"Can't uncompress compressed request"); + return; + } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING,"Request is compressed with unknown compression '%s'",Z_STRVAL_PP(encoding)); return; } - if (call_user_function(CG(function_table), (zval**)NULL, &func, &retval, 1, params TSRMLS_CC) == SUCCESS && - Z_TYPE(retval) == IS_STRING) { - doc_request = soap_xmlParseMemory(Z_STRVAL(retval),Z_STRLEN(retval)); - zval_dtor(&retval); - } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING,"Can't uncompress compressed request"); - return; - } - } else { - doc_request = soap_xmlParseMemory(post_data, post_data_length); + } + + doc_request = soap_xmlParseFile("php://input" TSRMLS_CC); + + if (zf) { + php_stream_filter_remove(zf, 1 TSRMLS_CC); } } else { zval_ptr_dtor(&retval); diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c index ed55ed52fa754..d81484521d8c0 100644 --- a/ext/sockets/conversions.c +++ b/ext/sockets/conversions.c @@ -1257,7 +1257,7 @@ void to_zval_read_msghdr(const char *msghdr_c, zval *zv, res_context *ctx) /* CONVERSIONS for if_index */ static void from_zval_write_ifindex(const zval *zv, char *uinteger, ser_context *ctx) { - unsigned ret; + unsigned ret = 0; zval lzval = zval_used_for_init; if (Z_TYPE_P(zv) == IS_LONG) { diff --git a/ext/sockets/multicast.c b/ext/sockets/multicast.c index 7466c6266e7f1..ecf3a65a325e6 100644 --- a/ext/sockets/multicast.c +++ b/ext/sockets/multicast.c @@ -63,6 +63,28 @@ static const char *_php_source_op_to_string(enum source_op sop); static int _php_source_op_to_ipv4_op(enum source_op sop); #endif +int php_string_to_if_index(const char *val, unsigned *out TSRMLS_DC) +{ +#if HAVE_IF_NAMETOINDEX + unsigned int ind; + + ind = if_nametoindex(val); + if (ind == 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, + "no interface with name \"%s\" could be found", val); + return FAILURE; + } else { + *out = ind; + return SUCCESS; + } +#else + php_error_docref(NULL TSRMLS_CC, E_WARNING, + "this platform does not support looking up an interface by " + "name, an integer interface index must be supplied instead"); + return FAILURE; +#endif +} + static int php_get_if_index_from_zval(zval *val, unsigned *out TSRMLS_DC) { int ret; @@ -78,31 +100,17 @@ static int php_get_if_index_from_zval(zval *val, unsigned *out TSRMLS_DC) ret = SUCCESS; } } else { -#if HAVE_IF_NAMETOINDEX - unsigned int ind; zval_add_ref(&val); convert_to_string_ex(&val); - ind = if_nametoindex(Z_STRVAL_P(val)); - if (ind == 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, - "no interface with name \"%s\" could be found", Z_STRVAL_P(val)); - ret = FAILURE; - } else { - *out = ind; - ret = SUCCESS; - } + ret = php_string_to_if_index(Z_STRVAL_P(val), out TSRMLS_CC); zval_ptr_dtor(&val); -#else - php_error_docref(NULL TSRMLS_CC, E_WARNING, - "this platform does not support looking up an interface by " - "name, an integer interface index must be supplied instead"); - ret = FAILURE; -#endif } return ret; } + + static int php_get_if_index_from_array(const HashTable *ht, const char *key, php_socket *sock, unsigned int *if_index TSRMLS_DC) { diff --git a/ext/sockets/multicast.h b/ext/sockets/multicast.h index 3614306bbb219..81a1bca799322 100644 --- a/ext/sockets/multicast.h +++ b/ext/sockets/multicast.h @@ -65,6 +65,8 @@ int php_add4_to_if_index( php_socket *php_sock, unsigned *if_index TSRMLS_DC); +int php_string_to_if_index(const char *val, unsigned *out TSRMLS_DC); + int php_mcast_join( php_socket *sock, int level, diff --git a/ext/sockets/sockaddr_conv.c b/ext/sockets/sockaddr_conv.c index a40b6b4936cbb..64523c3191d0b 100644 --- a/ext/sockets/sockaddr_conv.c +++ b/ext/sockets/sockaddr_conv.c @@ -18,6 +18,7 @@ int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, php_socket *php_ struct addrinfo hints; struct addrinfo *addrinfo = NULL; #endif + char *scope = strchr(string, '%'); if (inet_pton(AF_INET6, string, &tmp)) { memcpy(&(sin6->sin6_addr.s6_addr), &(tmp.s6_addr), sizeof(struct in6_addr)); @@ -53,6 +54,22 @@ int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, php_socket *php_ } + if (scope++) { + long lval = 0; + double dval = 0; + unsigned scope_id = 0; + + if (IS_LONG == is_numeric_string(scope, strlen(scope), &lval, &dval, 0)) { + if (lval > 0 && lval <= UINT_MAX) { + scope_id = lval; + } + } else { + php_string_to_if_index(scope, &scope_id TSRMLS_CC); + } + + sin6->sin6_scope_id = scope_id; + } + return 1; } /* }}} */ diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 1a417d0f5850a..f73e8ee9f0db4 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -2290,7 +2290,7 @@ SPL_METHOD(SplFileObject, __construct) intern->u.file.open_mode = NULL; intern->u.file.open_mode_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|sbr", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|sbr!", &intern->file_name, &intern->file_name_len, &intern->u.file.open_mode, &intern->u.file.open_mode_len, &use_include_path, &intern->u.file.zcontext) == FAILURE) { @@ -2938,8 +2938,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fgetss, 0, 0, 0) ZEND_ARG_INFO(0, allowable_tags) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 1, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 0, 0, 1) ZEND_ARG_INFO(0, format) + ZEND_ARG_VARIADIC_INFO(1, vars) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fwrite, 0, 0, 1) diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index 273bc7506aa74..d5a9f83ae1411 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -603,7 +603,7 @@ SPL_METHOD(SplDoublyLinkedList, pop) zval *value; spl_dllist_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { return; } @@ -626,7 +626,7 @@ SPL_METHOD(SplDoublyLinkedList, shift) zval *value; spl_dllist_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { return; } @@ -649,7 +649,7 @@ SPL_METHOD(SplDoublyLinkedList, top) zval *value; spl_dllist_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { return; } @@ -672,7 +672,7 @@ SPL_METHOD(SplDoublyLinkedList, bottom) zval *value; spl_dllist_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { return; } @@ -695,7 +695,7 @@ SPL_METHOD(SplDoublyLinkedList, count) long count; spl_dllist_object *intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { return; } @@ -710,7 +710,7 @@ SPL_METHOD(SplDoublyLinkedList, isEmpty) { long count; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { return; } @@ -750,7 +750,7 @@ SPL_METHOD(SplDoublyLinkedList, getIteratorMode) { spl_dllist_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { return; } diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index 86a5371ed30d3..8624b35a4b616 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -583,7 +583,7 @@ SPL_METHOD(SplFixedArray, __construct) spl_fixedarray_object *intern; long size = 0; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &size)) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &size) == FAILURE) { return; } @@ -613,7 +613,7 @@ SPL_METHOD(SplFixedArray, __wakeup) HashTable *intern_ht = zend_std_get_properties(getThis() TSRMLS_CC); zval **data; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "")) { + if (zend_parse_parameters_none() == FAILURE) { return; } @@ -643,7 +643,7 @@ SPL_METHOD(SplFixedArray, count) zval *object = getThis(); spl_fixedarray_object *intern; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "")) { + if (zend_parse_parameters_none() == FAILURE) { return; } @@ -661,7 +661,7 @@ SPL_METHOD(SplFixedArray, toArray) { spl_fixedarray_object *intern; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "")) { + if (zend_parse_parameters_none() == FAILURE) { return; } @@ -693,7 +693,7 @@ SPL_METHOD(SplFixedArray, fromArray) int num; zend_bool save_indexes = 1; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|b", &data, &save_indexes)) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|b", &data, &save_indexes) == FAILURE) { return; } @@ -777,7 +777,7 @@ SPL_METHOD(SplFixedArray, getSize) zval *object = getThis(); spl_fixedarray_object *intern; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "")) { + if (zend_parse_parameters_none() == FAILURE) { return; } @@ -797,7 +797,7 @@ SPL_METHOD(SplFixedArray, setSize) spl_fixedarray_object *intern; long size; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &size)) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &size) == FAILURE) { return; } diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index cb1f68dcf1196..77b31c06dcdc7 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -587,7 +587,7 @@ SPL_METHOD(SplHeap, count) long count; spl_heap_object *intern = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { return; } @@ -602,7 +602,7 @@ SPL_METHOD(SplHeap, isEmpty) { spl_heap_object *intern = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { return; } @@ -643,7 +643,7 @@ SPL_METHOD(SplHeap, extract) zval *value; spl_heap_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { return; } @@ -705,7 +705,7 @@ SPL_METHOD(SplPriorityQueue, extract) zval *value, *value_out, **value_out_pp; spl_heap_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { return; } @@ -748,7 +748,7 @@ SPL_METHOD(SplPriorityQueue, top) zval *value, **value_out; spl_heap_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { return; } @@ -802,7 +802,7 @@ SPL_METHOD(SplHeap, recoverFromCorruption) { spl_heap_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { return; } @@ -835,7 +835,7 @@ SPL_METHOD(SplHeap, top) zval *value; spl_heap_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { return; } diff --git a/ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt b/ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt index ed1f473be9ed3..d4f22f68a1ba3 100644 --- a/ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt +++ b/ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt @@ -4,7 +4,7 @@ DirectoryIterator::getBasename() - Basic Test PHPNW Testfest 2009 - Adrian Hardy --FILE-- --CLEAN-- diff --git a/ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt b/ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt index b2df8a55c947d..ef1352023748c 100644 --- a/ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt +++ b/ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt @@ -4,7 +4,7 @@ DirectoryIterator::getBasename() - Pass unexpected array PHPNW Testfest 2009 - Adrian Hardy --FILE-- --CLEAN-- diff --git a/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt index f0b2b0182cc90..f6bc266cb1d2a 100644 --- a/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt +++ b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt @@ -5,7 +5,7 @@ Pawel Krynicki #testfest AmsterdamPHP 2012-06-23 --FILE-- diff --git a/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt b/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt index 7b12672e14c50..6527d84bfe854 100644 --- a/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt +++ b/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt @@ -5,7 +5,7 @@ Pawel Krynicki #testfest AmsterdamPHP 2012-06-23 --FILE-- --EXPECTF-- diff --git a/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt b/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt index abfe5f235f334..84b540369865c 100644 --- a/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt +++ b/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt @@ -2,7 +2,7 @@ SplFileObject::fgetcsv default path --FILE-- fgetcsv()); ?> --CLEAN-- --EXPECTF-- array(4) { diff --git a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt index 4402d6ca4c32e..a8125a0257128 100644 --- a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt +++ b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt @@ -2,7 +2,7 @@ SplFileObject::fgetcsv with alternative delimiter --FILE-- fgetcsv('|')); ?> --CLEAN-- --EXPECTF-- array(4) { diff --git a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt index 64d6514a29a4a..169ded7dc3ccd 100644 --- a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt +++ b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt @@ -2,7 +2,7 @@ SplFileObject::fgetcsv with alternative delimiter --FILE-- fgetcsv('invalid')); ?> --CLEAN-- --EXPECTF-- Warning: SplFileObject::fgetcsv(): delimiter must be a character in %s on line %d diff --git a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt index efbb5fb68559f..efe765cbf84dd 100644 --- a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt +++ b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt @@ -2,7 +2,7 @@ SplFileObject::fgetcsv with alternative delimiter --FILE-- fgetcsv(',', '"')); ?> --CLEAN-- --EXPECTF-- array(4) { diff --git a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt index 7487b8353c96a..f8c14f0e35e41 100644 --- a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt +++ b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt @@ -2,7 +2,7 @@ SplFileObject::fgetcsv with alternative delimiter --FILE-- fgetcsv(',', 'invalid')); ?> --CLEAN-- --EXPECTF-- Warning: SplFileObject::fgetcsv(): enclosure must be a character in %s on line %d diff --git a/ext/spl/tests/SplFileObject_fgetcsv_escape_basic.phpt b/ext/spl/tests/SplFileObject_fgetcsv_escape_basic.phpt index 1a94532b2b6b5..960f36d63f635 100644 --- a/ext/spl/tests/SplFileObject_fgetcsv_escape_basic.phpt +++ b/ext/spl/tests/SplFileObject_fgetcsv_escape_basic.phpt @@ -2,16 +2,16 @@ SplFileObject::fgetcsv with alternative delimiter --FILE-- fgetcsv(',', '"', '"')); ?> --CLEAN-- --EXPECTF-- array(3) { diff --git a/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt b/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt index c628ac043d82c..69089636c1166 100644 --- a/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt +++ b/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt @@ -2,16 +2,16 @@ SplFileObject::fgetcsv with default escape character --FILE-- fgetcsv()); ?> --CLEAN-- --EXPECTF-- array(3) { diff --git a/ext/spl/tests/SplFileObject_fgetcsv_escape_error.phpt b/ext/spl/tests/SplFileObject_fgetcsv_escape_error.phpt index fd90103bfa7ef..b49bcdd13c345 100644 --- a/ext/spl/tests/SplFileObject_fgetcsv_escape_error.phpt +++ b/ext/spl/tests/SplFileObject_fgetcsv_escape_error.phpt @@ -2,16 +2,16 @@ SplFileObject::fgetcsv with alternative delimiter --FILE-- fgetcsv(',', '"', 'invalid')); ?> --CLEAN-- --EXPECTF-- Warning: SplFileObject::fgetcsv(): escape must be a character in %s on line %d diff --git a/ext/spl/tests/SplFileObject_fputcsv_002.phpt b/ext/spl/tests/SplFileObject_fputcsv_002.phpt index db174931f704b..fdd4112ee6dd5 100644 --- a/ext/spl/tests/SplFileObject_fputcsv_002.phpt +++ b/ext/spl/tests/SplFileObject_fputcsv_002.phpt @@ -2,7 +2,7 @@ SplFileObject::fputcsv(): Checking data after calling the function --FILE-- --CLEAN-- --EXPECTF-- diff --git a/ext/spl/tests/SplFileObject_fputcsv_error.phpt b/ext/spl/tests/SplFileObject_fputcsv_error.phpt index 8368e4211dedc..cdee48c874b7e 100644 --- a/ext/spl/tests/SplFileObject_fputcsv_error.phpt +++ b/ext/spl/tests/SplFileObject_fputcsv_error.phpt @@ -2,7 +2,7 @@ SplFileObject::fputcsv(): error conditions --FILE-- fputcsv($fields, $delim, $enclosure, $fo) ); echo "Done\n"; --CLEAN-- --EXPECTF-- diff --git a/ext/spl/tests/SplFileObject_getflags_basic.phpt b/ext/spl/tests/SplFileObject_getflags_basic.phpt index 5addadf38046e..88cf6861a2921 100644 --- a/ext/spl/tests/SplFileObject_getflags_basic.phpt +++ b/ext/spl/tests/SplFileObject_getflags_basic.phpt @@ -7,16 +7,16 @@ Erwin Poeze --FILE-- setFlags(SplFileObject::DROP_NEW_LINE); var_dump($fo->getFlags()); ?> --CLEAN-- --EXPECT-- int(1) diff --git a/ext/spl/tests/SplFileObject_getflags_error001.phpt b/ext/spl/tests/SplFileObject_getflags_error001.phpt index 1602f88885e11..ca53c857e7e6b 100644 --- a/ext/spl/tests/SplFileObject_getflags_error001.phpt +++ b/ext/spl/tests/SplFileObject_getflags_error001.phpt @@ -7,10 +7,10 @@ Erwin Poeze --FILE-- setFlags(SplFileObject::READ_CSV); $fo->setFlags(SplFileObject::DROP_NEW_LINE); @@ -20,7 +20,7 @@ var_dump($fo->getFlags()); ?> --CLEAN-- --EXPECT-- int(1) diff --git a/ext/spl/tests/SplFileObject_getflags_error002.phpt b/ext/spl/tests/SplFileObject_getflags_error002.phpt index e2c8255f44960..00fd351db8cca 100644 --- a/ext/spl/tests/SplFileObject_getflags_error002.phpt +++ b/ext/spl/tests/SplFileObject_getflags_error002.phpt @@ -5,9 +5,9 @@ Erwin Poeze --FILE-- setFlags(SplFileObject::READ_CSV); $fo->getFlags('fake'); @@ -15,7 +15,7 @@ $fo->getFlags('fake'); ?> --CLEAN-- --EXPECTF-- Warning: SplFileObject::getFlags() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplFileObject_rewind_error001.phpt b/ext/spl/tests/SplFileObject_rewind_error001.phpt index ac536a0a44af5..5f2379aa13911 100644 --- a/ext/spl/tests/SplFileObject_rewind_error001.phpt +++ b/ext/spl/tests/SplFileObject_rewind_error001.phpt @@ -7,16 +7,16 @@ Erwin Poeze --FILE-- rewind( "invalid" ); ?> --CLEAN-- --EXPECTF-- Warning: SplFileObject::rewind() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/bug51532.phpt b/ext/spl/tests/bug51532.phpt index 3a0722b2af68d..26eaa8f82f87d 100644 --- a/ext/spl/tests/bug51532.phpt +++ b/ext/spl/tests/bug51532.phpt @@ -4,7 +4,7 @@ SPL: Allow valid extension of SplFileObject::fscanf +--EXPECTF-- +object(SplFileObject)#1 (%d) { + ["pathName":"SplFileInfo":private]=> + string(%d) "%s/bug64782.php" + ["fileName":"SplFileInfo":private]=> + string(12) "bug64782.php" + ["openMode":"SplFileObject":private]=> + string(1) "r" + ["delimiter":"SplFileObject":private]=> + string(1) "," + ["enclosure":"SplFileObject":private]=> + string(1) """ +} diff --git a/ext/spl/tests/dit_006.phpt b/ext/spl/tests/dit_006.phpt index 1e627a20e0adc..9edbb9f15716e 100644 --- a/ext/spl/tests/dit_006.phpt +++ b/ext/spl/tests/dit_006.phpt @@ -2,7 +2,7 @@ SPL: DirectoryIterator and seek --FILE-- seek(2); $n = 0; diff --git a/ext/sqlite3/config.w32 b/ext/sqlite3/config.w32 index 01e4625feddd1..8ddb6b9ac8b4b 100644 --- a/ext/sqlite3/config.w32 +++ b/ext/sqlite3/config.w32 @@ -4,7 +4,7 @@ ARG_WITH("sqlite3", "SQLite 3 support", "no"); if (PHP_SQLITE3 != "no") { - ADD_FLAG("CFLAGS_SQLITE3", "/D SQLITE_THREADSAFE=" + (PHP_ZTS == "yes" ? "1" : "0") + " /D SQLITE_ENABLE_FTS3=1 /D SQLITE_ENABLE_COLUMN_METADATA=1 /D SQLITE_CORE=1 "); + ADD_FLAG("CFLAGS_SQLITE3", "/D SQLITE_THREADSAFE=" + (PHP_ZTS == "yes" ? "1" : "0") + " /D SQLITE_ENABLE_FTS3=1 /D SQLITE_ENABLE_COLUMN_METADATA=1 /D SQLITE_CORE=1 /D SQLITE_API=__declspec(dllexport) "); EXTENSION("sqlite3", "sqlite3.c", null, "/I" + configure_module_dirname + "/libsqlite /I" + configure_module_dirname); ADD_SOURCES(configure_module_dirname + "/libsqlite", "sqlite3.c", "sqlite3"); diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 2aef0414aab69..19bf58deb8f19 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -1890,7 +1890,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3stmt_bindvalue, 0, 0, 2) ZEND_ARG_INFO(0, type) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_sqlite3stmt_construct, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3stmt_construct, 0, 0, 1) ZEND_ARG_INFO(0, sqlite3) ZEND_END_ARG_INFO() diff --git a/ext/standard/array.c b/ext/standard/array.c index 51972033ee711..17be59d6ca4b8 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -127,6 +127,9 @@ PHP_MINIT_FUNCTION(array) /* {{{ */ REGISTER_LONG_CONSTANT("COUNT_NORMAL", COUNT_NORMAL, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("COUNT_RECURSIVE", COUNT_RECURSIVE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ARRAY_FILTER_USE_BOTH", ARRAY_FILTER_USE_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ARRAY_FILTER_USE_KEY", ARRAY_FILTER_USE_KEY, CONST_CS | CONST_PERSISTENT); + return SUCCESS; } /* }}} */ @@ -830,7 +833,7 @@ PHP_FUNCTION(end) RETURN_FALSE; } - RETURN_ZVAL(*entry, 1, 0); + RETURN_ZVAL_FAST(*entry); } } /* }}} */ @@ -853,7 +856,7 @@ PHP_FUNCTION(prev) RETURN_FALSE; } - RETURN_ZVAL(*entry, 1, 0); + RETURN_ZVAL_FAST(*entry); } } /* }}} */ @@ -876,7 +879,7 @@ PHP_FUNCTION(next) RETURN_FALSE; } - RETURN_ZVAL(*entry, 1, 0); + RETURN_ZVAL_FAST(*entry); } } /* }}} */ @@ -899,7 +902,7 @@ PHP_FUNCTION(reset) RETURN_FALSE; } - RETURN_ZVAL(*entry, 1, 0); + RETURN_ZVAL_FAST(*entry); } } /* }}} */ @@ -918,7 +921,8 @@ PHP_FUNCTION(current) if (zend_hash_get_current_data(array, (void **) &entry) == FAILURE) { RETURN_FALSE; } - RETURN_ZVAL(*entry, 1, 0); + + RETURN_ZVAL_FAST(*entry); } /* }}} */ @@ -958,7 +962,7 @@ PHP_FUNCTION(min) RETVAL_NULL(); } else { if (zend_hash_minmax(Z_ARRVAL_PP(args[0]), php_array_data_compare, 0, (void **) &result TSRMLS_CC) == SUCCESS) { - RETVAL_ZVAL(*result, 1, 0); + RETVAL_ZVAL_FAST(*result); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array must contain at least one element"); RETVAL_FALSE; @@ -978,7 +982,7 @@ PHP_FUNCTION(min) } } - RETVAL_ZVAL(*min, 1, 0); + RETVAL_ZVAL_FAST(*min); } if (args) { @@ -1009,7 +1013,7 @@ PHP_FUNCTION(max) RETVAL_NULL(); } else { if (zend_hash_minmax(Z_ARRVAL_PP(args[0]), php_array_data_compare, 1, (void **) &result TSRMLS_CC) == SUCCESS) { - RETVAL_ZVAL(*result, 1, 0); + RETVAL_ZVAL_FAST(*result); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array must contain at least one element"); RETVAL_FALSE; @@ -1029,7 +1033,7 @@ PHP_FUNCTION(max) } } - RETVAL_ZVAL(*max, 1, 0); + RETVAL_ZVAL_FAST(*max); } if (args) { @@ -1955,7 +1959,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end) zend_hash_internal_pointer_reset(Z_ARRVAL_P(stack)); } zend_hash_get_current_data(Z_ARRVAL_P(stack), (void **)&val); - RETVAL_ZVAL(*val, 1, 0); + RETVAL_ZVAL_FAST(*val); /* Delete the first or last value */ zend_hash_get_current_key_ex(Z_ARRVAL_P(stack), &key, &key_len, &index, 0, NULL); @@ -2222,13 +2226,14 @@ PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive TSRMLS case HASH_KEY_IS_STRING: if (recursive && zend_hash_find(dest, string_key, string_key_len, (void **)&dest_entry) == SUCCESS) { HashTable *thash = Z_TYPE_PP(dest_entry) == IS_ARRAY ? Z_ARRVAL_PP(dest_entry) : NULL; + zval *src_zval; + zval *tmp = NULL; if ((thash && thash->nApplyCount > 1) || (*src_entry == *dest_entry && Z_ISREF_PP(dest_entry) && (Z_REFCOUNT_PP(dest_entry) % 2))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected"); return 0; } SEPARATE_ZVAL(dest_entry); - SEPARATE_ZVAL(src_entry); if (Z_TYPE_PP(dest_entry) == IS_NULL) { convert_to_array_ex(dest_entry); @@ -2236,23 +2241,34 @@ PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive TSRMLS } else { convert_to_array_ex(dest_entry); } - if (Z_TYPE_PP(src_entry) == IS_NULL) { - convert_to_array_ex(src_entry); - add_next_index_null(*src_entry); + if (Z_TYPE_PP(src_entry) == IS_OBJECT) { + ALLOC_ZVAL(src_zval); + INIT_PZVAL_COPY(src_zval, *src_entry); + zval_copy_ctor(src_zval); + convert_to_array(src_zval); + tmp = src_zval; } else { - convert_to_array_ex(src_entry); + src_zval = *src_entry; } - if (thash) { - thash->nApplyCount++; - } - if (!php_array_merge(Z_ARRVAL_PP(dest_entry), Z_ARRVAL_PP(src_entry), recursive TSRMLS_CC)) { + if (Z_TYPE_P(src_zval) == IS_ARRAY) { + if (thash) { + thash->nApplyCount++; + } + if (!php_array_merge(Z_ARRVAL_PP(dest_entry), Z_ARRVAL_P(src_zval), recursive TSRMLS_CC)) { + if (thash) { + thash->nApplyCount--; + } + return 0; + } if (thash) { thash->nApplyCount--; } - return 0; + } else { + Z_ADDREF_PP(src_entry); + zend_hash_next_index_insert(Z_ARRVAL_PP(dest_entry), &src_zval, sizeof(zval *), NULL); } - if (thash) { - thash->nApplyCount--; + if (tmp) { + zval_ptr_dtor(&tmp); } } else { Z_ADDREF_PP(src_entry); @@ -2356,7 +2372,6 @@ static void php_array_merge_or_replace_wrapper(INTERNAL_FUNCTION_PARAMETERS, int array_init_size(return_value, init_size); for (i = 0; i < argc; i++) { - SEPARATE_ZVAL(args[i]); if (!replace) { php_array_merge(Z_ARRVAL_P(return_value), Z_ARRVAL_PP(args[i]), recursive TSRMLS_CC); } else if (recursive && i > 0) { /* First array will be copied directly instead */ @@ -4193,9 +4208,11 @@ PHP_FUNCTION(array_filter) { zval *array; zval **operand; - zval **args[1]; + zval **args[2]; zval *retval = NULL; + zval *key = NULL; zend_bool have_callback = 0; + long use_type = 0; char *string_key; zend_fcall_info fci = empty_fcall_info; zend_fcall_info_cache fci_cache = empty_fcall_info_cache; @@ -4203,7 +4220,7 @@ PHP_FUNCTION(array_filter) ulong num_key; HashPosition pos; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|f", &array, &fci, &fci_cache) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|fl", &array, &fci, &fci_cache, &use_type) == FAILURE) { return; } @@ -4216,23 +4233,54 @@ PHP_FUNCTION(array_filter) have_callback = 1; fci.no_separation = 0; fci.retval_ptr_ptr = &retval; - fci.param_count = 1; + + if (use_type == ARRAY_FILTER_USE_BOTH) { + fci.param_count = 2; + args[1] = &key; + } else { + fci.param_count = 1; + if (use_type == ARRAY_FILTER_USE_KEY) { + args[0] = &key; + } + } } for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(array), &pos); zend_hash_get_current_data_ex(Z_ARRVAL_P(array), (void **)&operand, &pos) == SUCCESS; zend_hash_move_forward_ex(Z_ARRVAL_P(array), &pos) ) { + int key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(array), &string_key, &string_key_len, &num_key, 0, &pos); + if (have_callback) { - args[0] = operand; + if (use_type) { + MAKE_STD_ZVAL(key); + /* Set up the key */ + switch (key_type) { + case HASH_KEY_IS_LONG: + Z_TYPE_P(key) = IS_LONG; + Z_LVAL_P(key) = num_key; + break; + + case HASH_KEY_IS_STRING: + ZVAL_STRINGL(key, string_key, string_key_len - 1, 1); + break; + } + } + + if (use_type != ARRAY_FILTER_USE_KEY) { + args[0] = operand; + } fci.params = args; if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && retval) { - if (!zend_is_true(retval)) { - zval_ptr_dtor(&retval); + int retval_true = zend_is_true(retval); + + zval_ptr_dtor(&retval); + if (use_type) { + zval_ptr_dtor(&key); + } + if (!retval_true) { continue; - } else { - zval_ptr_dtor(&retval); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the filter callback"); @@ -4243,7 +4291,7 @@ PHP_FUNCTION(array_filter) } zval_add_ref(operand); - switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(array), &string_key, &string_key_len, &num_key, 0, &pos)) { + switch (key_type) { case HASH_KEY_IS_STRING: zend_hash_update(Z_ARRVAL_P(return_value), string_key, string_key_len, operand, sizeof(zval *), NULL); break; diff --git a/ext/standard/assert.c b/ext/standard/assert.c index 631834c97c0f3..1a24ade79e64f 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -200,7 +200,7 @@ PHP_FUNCTION(assert) } if (ASSERTG(callback)) { - zval **args = safe_emalloc(description_len == 0 ? 3 : 4, sizeof(zval **), 0); + zval **args = safe_emalloc(description_len == 0 ? 3 : 4, sizeof(zval *), 0); zval *retval; int i; uint lineno = zend_get_executed_lineno(TSRMLS_C); diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 3e5084e837642..cb1ada22e2a90 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -288,11 +288,11 @@ ZEND_BEGIN_ARG_INFO(arginfo_reset, 0) ZEND_ARG_INFO(1, arg) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_current, ZEND_SEND_PREFER_REF) +ZEND_BEGIN_ARG_INFO(arginfo_current, 0) ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arg) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_key, ZEND_SEND_PREFER_REF) +ZEND_BEGIN_ARG_INFO(arginfo_key, 0) ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arg) ZEND_END_ARG_INFO() @@ -564,13 +564,14 @@ ZEND_BEGIN_ARG_INFO(arginfo_array_udiff_uassoc, 0) ZEND_ARG_INFO(0, callback_key_comp_func) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_multisort, ZEND_SEND_PREFER_REF, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_multisort, 0, 0, 1) ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arr1) /* ARRAY_INFO(0, arg1, 0) */ ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, SORT_ASC_or_SORT_DESC) ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, SORT_REGULAR_or_SORT_NUMERIC_or_SORT_STRING) ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arr2) ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, SORT_ASC_or_SORT_DESC) ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, SORT_REGULAR_or_SORT_NUMERIC_or_SORT_STRING) + ZEND_ARG_VARIADIC_INFO(ZEND_SEND_PREFER_REF, more_array_and_sort_options) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_array_rand, 0, 0, 1) @@ -595,6 +596,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_array_filter, 0, 0, 1) ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ ZEND_ARG_INFO(0, callback) + ZEND_ARG_INFO(0, use_keys) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_array_map, 0, 0, 2) @@ -1139,10 +1141,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_fgetss, 0, 0, 1) ZEND_ARG_INFO(0, allowable_tags) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_fscanf, 1, 0, 2) +ZEND_BEGIN_ARG_INFO_EX(arginfo_fscanf, 0, 0, 2) ZEND_ARG_INFO(0, stream) ZEND_ARG_INFO(0, format) - ZEND_ARG_INFO(1, ...) + ZEND_ARG_VARIADIC_INFO(1, vars) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_fwrite, 0, 0, 2) @@ -2450,10 +2452,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_str_pad, 0, 0, 2) ZEND_ARG_INFO(0, pad_type) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_sscanf, 1, 0, 2) +ZEND_BEGIN_ARG_INFO_EX(arginfo_sscanf, 0, 0, 2) ZEND_ARG_INFO(0, str) ZEND_ARG_INFO(0, format) - ZEND_ARG_INFO(1, ...) + ZEND_ARG_VARIADIC_INFO(1, vars) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_str_rot13, 0) @@ -3640,6 +3642,7 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */ BASIC_ADD_SUBMODULE(dl) BASIC_ADD_SUBMODULE(mail) + BASIC_ADD_SUBMODULE(streams) BASIC_MINIT_SUBMODULE(file) BASIC_MINIT_SUBMODULE(pack) BASIC_MINIT_SUBMODULE(browscap) diff --git a/ext/standard/config.m4 b/ext/standard/config.m4 index 2af2209f2bb54..3d00d88dda151 100644 --- a/ext/standard/config.m4 +++ b/ext/standard/config.m4 @@ -182,12 +182,12 @@ AC_TRY_RUN([ main() { #if HAVE_CRYPT - char salt[30], answer[80]; - - salt[0]='$'; salt[1]='6'; salt[2]='$'; salt[3]='$'; salt[4]='b'; salt[5]='a'; salt[6]='r'; salt[7]='\0'; + char salt[21], answer[21+86]; + + strcpy(salt,"\$6\$rasmuslerdorf\$"); strcpy(answer, salt); - strcpy(&answer[29],"$6$$QMXjqd7rHQZPQ1yHsXkQqC1FBzDiVfTHXL.LaeDAeVV.IzMaV9VU4MQ8kPuZa2SOP1A0RPm772EaFYjpEJtdu."); - exit (strcmp((char *)crypt("foo",salt),answer)); + strcat(answer, "EeHCRjm0bljalWuALHSTs1NB9ipEiLEXLhYeXdOpx22gmlmVejnVXFhd84cEKbYxCo.XuUTrW.RLraeEnsvWs/"); + exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer)); #else exit(0); #endif @@ -211,12 +211,13 @@ AC_TRY_RUN([ main() { #if HAVE_CRYPT - char salt[30], answer[80]; - salt[0]='$'; salt[1]='5'; salt[2]='$'; salt[3]='$'; salt[4]='s'; salt[5]='a'; salt[6]='l'; salt[7]='t'; salt[8]='s'; salt[9]='t'; salt[10]='r'; salt[11]='i'; salt[12]='n'; salt[13]='g'; salt[14]='\0'; - strcat(salt,""); + char salt[21], answer[21+43]; + + strcpy(salt,"\$5\$rasmuslerdorf\$"); strcpy(answer, salt); - strcpy(&answer[29], "$5$saltstring$5B8vYYiY.CVt1RlTTf8KbXBH3hsxY/GNooZaBBGWEc5"); - exit (strcmp((char *)crypt("foo",salt),answer)); + strcat(answer, "cFAm2puLCujQ9t.0CxiFIIvFi4JyQx5UncCt/xRIX23"); + exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer)); + #else exit(0); #endif diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index 113a5bd0f516c..354c263afbd0c 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -272,6 +272,8 @@ PHP_FUNCTION(crypt) if (salt_in) { memcpy(salt, salt_in, MIN(PHP_MAX_SALT_LEN, salt_in_len)); + } else { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "No salt parameter was specified. You must use a randomly generated salt and a strong hash function to produce a secure hash."); } /* The automatic salt generation covers standard DES, md5-crypt and Blowfish (simple) */ diff --git a/ext/standard/file.c b/ext/standard/file.c index c880eb3745ada..2bd35bf8941ae 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -223,10 +223,14 @@ PHP_MINIT_FUNCTION(file) REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_CLIENT", STREAM_CRYPTO_METHOD_SSLv3_CLIENT, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_CLIENT", STREAM_CRYPTO_METHOD_SSLv23_CLIENT, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLS_CLIENT", STREAM_CRYPTO_METHOD_TLS_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_SERVER", STREAM_CRYPTO_METHOD_SSLv2_SERVER, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_SERVER", STREAM_CRYPTO_METHOD_SSLv3_SERVER, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_SERVER", STREAM_CRYPTO_METHOD_SSLv23_SERVER, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLS_SERVER", STREAM_CRYPTO_METHOD_TLS_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_1_SERVER", STREAM_CRYPTO_METHOD_TLSv1_1_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_2_SERVER", STREAM_CRYPTO_METHOD_TLSv1_2_SERVER, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("STREAM_SHUT_RD", STREAM_SHUT_RD, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("STREAM_SHUT_WR", STREAM_SHUT_WR, CONST_CS|CONST_PERSISTENT); @@ -818,7 +822,7 @@ PHP_FUNCTION(tempnam) if (p_len > 64) { p[63] = '\0'; } - + RETVAL_FALSE; if ((fd = php_open_temporary_fd_ex(dir, p, &opened_path, 1 TSRMLS_CC)) >= 0) { @@ -1380,13 +1384,13 @@ PHP_FUNCTION(umask) { long arg1 = 0; int oldumask; - + oldumask = umask(077); if (BG(umask) == -1) { BG(umask) = oldumask; } - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &arg1) == FAILURE) { RETURN_FALSE; } @@ -1799,22 +1803,23 @@ static const char *php_fgetcsv_lookup_trailing_spaces(const char *ptr, size_t le #define FPUTCSV_FLD_CHK(c) memchr(Z_STRVAL(field), c, Z_STRLEN(field)) -/* {{{ proto int fputcsv(resource fp, array fields [, string delimiter [, string enclosure]]) +/* {{{ proto int fputcsv(resource fp, array fields [, string delimiter [, string enclosure [, string escape_char]]]) Format line as CSV and write to file pointer */ PHP_FUNCTION(fputcsv) { - char delimiter = ','; /* allow this to be set as parameter */ - char enclosure = '"'; /* allow this to be set as parameter */ - const char escape_char = '\\'; + char delimiter = ','; /* allow this to be set as parameter */ + char enclosure = '"'; /* allow this to be set as parameter */ + char escape_char = '\\'; /* allow this to be set as parameter */ php_stream *stream; zval *fp = NULL, *fields = NULL; int ret; - char *delimiter_str = NULL, *enclosure_str = NULL; - int delimiter_str_len = 0, enclosure_str_len = 0; + char *delimiter_str = NULL, *enclosure_str = NULL, *escape_str = NULL; + int delimiter_str_len = 0, enclosure_str_len = 0, escape_str_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra|ss", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra|sss", &fp, &fields, &delimiter_str, &delimiter_str_len, - &enclosure_str, &enclosure_str_len) == FAILURE) { + &enclosure_str, &enclosure_str_len, + &escape_str, &escape_str_len) == FAILURE) { return; } @@ -1842,6 +1847,17 @@ PHP_FUNCTION(fputcsv) enclosure = *enclosure_str; } + if (escape_str != NULL) { + if (escape_str_len < 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "escape must be a character"); + RETURN_FALSE; + } else if (escape_str_len > 1) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "escape must be a single character"); + } + /* use first character from string */ + escape_char = *escape_str; + } + PHP_STREAM_TO_ZVAL(stream, &fp); ret = php_fputcsv(stream, fields, delimiter, enclosure, escape_char TSRMLS_CC); diff --git a/ext/standard/filters.c b/ext/standard/filters.c index 0a59039635881..15dae1bee69d7 100644 --- a/ext/standard/filters.c +++ b/ext/standard/filters.c @@ -951,7 +951,9 @@ static php_conv_err_t php_conv_qprint_encode_convert(php_conv_qprint_encode *ins *(pd++) = qp_digits[(c & 0x0f)]; ocnt -= 3; line_ccnt -= 3; - trail_ws--; + if (trail_ws > 0) { + trail_ws--; + } CONSUME_CHAR(ps, icnt, lb_ptr, lb_cnt); } } diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index ac6fdad4fef3a..f5184ceec6019 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -80,12 +80,38 @@ #define HTTP_HEADER_FROM 8 #define HTTP_HEADER_CONTENT_LENGTH 16 #define HTTP_HEADER_TYPE 32 +#define HTTP_HEADER_CONNECTION 64 #define HTTP_WRAPPER_HEADER_INIT 1 #define HTTP_WRAPPER_REDIRECTED 2 -php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, - char **opened_path, php_stream_context *context, int redirect_max, int flags STREAMS_DC TSRMLS_DC) /* {{{ */ +static inline void strip_header(char *header_bag, char *lc_header_bag, + const char *lc_header_name) +{ + char *lc_header_start = strstr(lc_header_bag, lc_header_name); + char *header_start = header_bag + (lc_header_start - lc_header_bag); + + if (lc_header_start + && (lc_header_start == lc_header_bag || *(lc_header_start-1) == '\n') + ) { + char *lc_eol = strchr(lc_header_start, '\n'); + char *eol = header_start + (lc_eol - lc_header_start); + + if (lc_eol) { + size_t eollen = strlen(lc_eol); + + memmove(lc_header_start, lc_eol+1, eollen); + memmove(header_start, eol+1, eollen); + } else { + *lc_header_start = '\0'; + *header_start = '\0'; + } + } +} + +php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, + const char *path, const char *mode, int options, char **opened_path, + php_stream_context *context, int redirect_max, int flags STREAMS_DC TSRMLS_DC) /* {{{ */ { php_stream *stream = NULL; php_url *resource = NULL; @@ -386,8 +412,6 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const char strlcat(scratch, " HTTP/", scratch_len); strlcat(scratch, protocol_version, scratch_len); strlcat(scratch, "\r\n", scratch_len); - efree(protocol_version); - protocol_version = NULL; } else { strlcat(scratch, " HTTP/1.0\r\n", scratch_len); } @@ -426,40 +450,17 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const char if (tmp && strlen(tmp) > 0) { char *s; - if (!header_init) { /* Remove post headers for redirects */ - int l = strlen(tmp); - char *s2, *tmp_c = estrdup(tmp); - - php_strtolower(tmp_c, l); - if ((s = strstr(tmp_c, "content-length:"))) { - if ((s2 = memchr(s, '\n', tmp_c + l - s))) { - int b = tmp_c + l - 1 - s2; - memmove(tmp, tmp + (s2 + 1 - tmp_c), b); - memmove(tmp_c, s2 + 1, b); - - } else { - tmp[s - tmp_c] = *s = '\0'; - } - l = strlen(tmp_c); - } - if ((s = strstr(tmp_c, "content-type:"))) { - if ((s2 = memchr(s, '\n', tmp_c + l - s))) { - memmove(tmp, tmp + (s2 + 1 - tmp_c), tmp_c + l - 1 - s2); - } else { - tmp[s - tmp_c] = '\0'; - } - } - - efree(tmp_c); - tmp_c = php_trim(tmp, strlen(tmp), NULL, 0, NULL, 3 TSRMLS_CC); - efree(tmp); - tmp = tmp_c; - } - user_headers = estrdup(tmp); /* Make lowercase for easy comparison against 'standard' headers */ php_strtolower(tmp, strlen(tmp)); + + if (!header_init) { + /* strip POST headers on redirect */ + strip_header(user_headers, tmp, "content-length:"); + strip_header(user_headers, tmp, "content-type:"); + } + if ((s = strstr(tmp, "user-agent:")) && (s == tmp || *(s-1) == '\r' || *(s-1) == '\n' || *(s-1) == '\t' || *(s-1) == ' ')) { @@ -490,6 +491,11 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const char *(s-1) == '\t' || *(s-1) == ' ')) { have_header |= HTTP_HEADER_TYPE; } + if ((s = strstr(tmp, "connection:")) && + (s == tmp || *(s-1) == '\r' || *(s-1) == '\n' || + *(s-1) == '\t' || *(s-1) == ' ')) { + have_header |= HTTP_HEADER_CONNECTION; + } /* remove Proxy-Authorization header */ if (use_proxy && use_ssl && (s = strstr(tmp, "proxy-authorization:")) && (s == tmp || *(s-1) == '\r' || *(s-1) == '\n' || @@ -563,6 +569,16 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const char } } + /* Send a Connection: close header when using HTTP 1.1 or later to avoid + * hanging when the server interprets the RFC literally and establishes a + * keep-alive connection, unless the user specifically requests something + * else by specifying a Connection header in the context options. */ + if (protocol_version && + ((have_header & HTTP_HEADER_CONNECTION) == 0) && + (strncmp(protocol_version, "1.0", MIN(protocol_version_len, 3)) > 0)) { + php_stream_write_string(stream, "Connection: close\r\n"); + } + if (context && php_stream_context_get_option(context, "http", "user_agent", &ua_zval) == SUCCESS && Z_TYPE_PP(ua_zval) == IS_STRING) { diff --git a/ext/standard/password.c b/ext/standard/password.c index ca852038a67ed..9c5280a4cb7c2 100644 --- a/ext/standard/password.c +++ b/ext/standard/password.c @@ -183,7 +183,7 @@ PHP_FUNCTION(password_get_info) return; } - if (hash_len < 0 || (size_t) hash_len < 0) { + if (hash_len < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Supplied password hash too long to safely identify"); RETURN_FALSE; } diff --git a/ext/standard/php_array.h b/ext/standard/php_array.h index 1cf27790718d7..ef43cddfcc416 100644 --- a/ext/standard/php_array.h +++ b/ext/standard/php_array.h @@ -117,6 +117,9 @@ PHPAPI int php_multisort_compare(const void *a, const void *b TSRMLS_DC); #define PHP_SORT_NATURAL 6 #define PHP_SORT_FLAG_CASE 8 +#define ARRAY_FILTER_USE_BOTH 1 +#define ARRAY_FILTER_USE_KEY 2 + ZEND_BEGIN_MODULE_GLOBALS(array) int *multisort_flags[2]; int (*compare_func)(zval *result, zval *op1, zval *op2 TSRMLS_DC); diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c index 0fb27baacd8e5..0adb1e05290a0 100644 --- a/ext/standard/php_fopen_wrapper.c +++ b/ext/standard/php_fopen_wrapper.c @@ -63,6 +63,12 @@ php_stream_ops php_stream_output_ops = { NULL /* set_option */ }; +typedef struct php_stream_input { /* {{{ */ + php_stream **body_ptr; + off_t position; +} php_stream_input_t; +/* }}} */ + static size_t php_stream_input_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) /* {{{ */ { return -1; @@ -71,42 +77,36 @@ static size_t php_stream_input_write(php_stream *stream, const char *buf, size_t static size_t php_stream_input_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) /* {{{ */ { - off_t *position = (off_t*)stream->abstract; - size_t read_bytes = 0; - - if (!stream->eof) { - if (SG(request_info).raw_post_data) { /* data has already been read by a post handler */ - read_bytes = SG(request_info).raw_post_data_length - *position; - if (read_bytes <= count) { - stream->eof = 1; - } else { - read_bytes = count; - } - if (read_bytes) { - memcpy(buf, SG(request_info).raw_post_data + *position, read_bytes); - } - } else if (sapi_module.read_post) { - read_bytes = sapi_module.read_post(buf, count TSRMLS_CC); - if (read_bytes <= 0) { - stream->eof = 1; - read_bytes = 0; - } - /* Increment SG(read_post_bytes) only when something was actually read. */ - SG(read_post_bytes) += read_bytes; - } else { - stream->eof = 1; + php_stream_input_t *input = stream->abstract; + size_t read; + + if (!SG(post_read) && SG(read_post_bytes) < input->position + count) { + /* read requested data from SAPI */ + int read_bytes = sapi_read_post_block(buf, count TSRMLS_CC); + + if (read_bytes > 0) { + php_stream_seek(*input->body_ptr, 0, SEEK_END); + php_stream_write(*input->body_ptr, buf, read_bytes); } } - *position += read_bytes; + php_stream_seek(*input->body_ptr, input->position, SEEK_SET); + read = php_stream_read(*input->body_ptr, buf, count); + + if (!read || read == (size_t) -1) { + stream->eof = 1; + } else { + input->position += read; + } - return read_bytes; + return read; } /* }}} */ static int php_stream_input_close(php_stream *stream, int close_handle TSRMLS_DC) /* {{{ */ { efree(stream->abstract); + stream->abstract = NULL; return 0; } @@ -118,13 +118,27 @@ static int php_stream_input_flush(php_stream *stream TSRMLS_DC) /* {{{ */ } /* }}} */ +static int php_stream_input_seek(php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC) /* {{{ */ +{ + php_stream_input_t *input = stream->abstract; + + if (*input->body_ptr) { + int sought = php_stream_seek(*input->body_ptr, offset, whence); + *newoffset = (*input->body_ptr)->position; + return sought; + } + + return -1; +} +/* }}} */ + php_stream_ops php_stream_input_ops = { php_stream_input_write, php_stream_input_read, php_stream_input_close, php_stream_input_flush, "Input", - NULL, /* seek */ + php_stream_input_seek, NULL, /* cast */ NULL, /* stat */ NULL /* set_option */ @@ -204,13 +218,23 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa } if (!strcasecmp(path, "input")) { + php_stream_input_t *input; + if ((options & STREAM_OPEN_FOR_INCLUDE) && !PG(allow_url_include) ) { if (options & REPORT_ERRORS) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "URL file-access is disabled in the server configuration"); } return NULL; } - return php_stream_alloc(&php_stream_input_ops, ecalloc(1, sizeof(off_t)), 0, "rb"); + + input = ecalloc(1, sizeof(*input)); + if (*(input->body_ptr = &SG(request_info).request_body)) { + php_stream_rewind(*input->body_ptr); + } else { + *input->body_ptr = php_stream_temp_create(TEMP_STREAM_DEFAULT, SAPI_POST_BLOCK_SIZE); + } + + return php_stream_alloc(&php_stream_input_ops, input, 0, "rb"); } if (!strcasecmp(path, "stdin")) { @@ -259,8 +283,8 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa fd = dup(STDERR_FILENO); } } else if (!strncasecmp(path, "fd/", 3)) { - char *start, - *end; + const char *start; + char *end; long fildes_ori; int dtablesize; diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h index 65219f257adee..1ce98ee07a21e 100644 --- a/ext/standard/php_string.h +++ b/ext/standard/php_string.h @@ -156,7 +156,7 @@ PHPAPI char *php_strerror(int errnum); # define php_mblen(ptr, len) 1 #else # if defined(_REENTRANT) && defined(HAVE_MBRLEN) && defined(HAVE_MBSTATE_T) -# define php_mblen(ptr, len) ((ptr) == NULL ? mbsinit(&BG(mblen_state)): (int)mbrlen(ptr, len, &BG(mblen_state))) +# define php_mblen(ptr, len) ((ptr) == NULL ? memset(&BG(mblen_state), 0, sizeof(BG(mblen_state))): (int)mbrlen(ptr, len, &BG(mblen_state))) # else # define php_mblen(ptr, len) mblen(ptr, len) # endif diff --git a/ext/standard/tests/array/array_filter_error.phpt b/ext/standard/tests/array/array_filter_error.phpt index 20e89aa4b776e..3f8f51bc14a5b 100644 --- a/ext/standard/tests/array/array_filter_error.phpt +++ b/ext/standard/tests/array/array_filter_error.phpt @@ -28,7 +28,7 @@ $extra_arg = 10; // with one more than the expected number of arguments echo "-- Testing array_filter() function with more than expected no. of arguments --"; -var_dump( array_filter($input, "odd", $extra_arg) ); +var_dump( array_filter($input, "odd", $extra_arg, $extra_arg) ); // with incorrect callback function echo "-- Testing array_filter() function with incorrect callback --"; @@ -42,7 +42,7 @@ echo "Done" Warning: array_filter() expects at least 1 parameter, 0 given in %s on line %d NULL -- Testing array_filter() function with more than expected no. of arguments -- -Warning: array_filter() expects at most 2 parameters, 3 given in %s on line %d +Warning: array_filter() expects at most 3 parameters, 4 given in %s on line %d NULL -- Testing array_filter() function with incorrect callback -- Warning: array_filter() expects parameter 2 to be a valid callback, function 'even' not found or invalid function name in %s on line %d diff --git a/ext/standard/tests/array/array_filter_variation10.phpt b/ext/standard/tests/array/array_filter_variation10.phpt new file mode 100644 index 0000000000000..f0a6115f79ccf --- /dev/null +++ b/ext/standard/tests/array/array_filter_variation10.phpt @@ -0,0 +1,103 @@ +--TEST-- +Test array_filter() function : usage variations - using the array keys inside 'callback' +--FILE-- + 4; +} + +var_dump( array_filter($input, 'dump2', true) ); + +echo "*** Testing array_filter() : usage variations - 'callback' expecting second argument ***\n"; + +var_dump( array_filter($small, 'dump', false) ); + +echo "*** Testing array_filter() with various use types ***\n"; + +$mixed = array(1 => 'a', 2 => 'b', 'a' => 1, 'b' => 2); + +var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_KEY)); + +var_dump(array_filter($mixed, 'is_numeric', 0)); + +var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_BOTH)); + +echo "Done" +?> +--EXPECTF-- +*** Testing array_filter() : usage variations - using array keys in 'callback' *** +0 = 0 +1 = 1 +2 = -1 +3 = 10 +4 = 100 +5 = 1000 +6 = Hello +7 = +array(0) { +} +*** Testing array_filter() : usage variations - 'callback' filters based on key value *** +array(3) { + [5]=> + int(1000) + [6]=> + string(5) "Hello" + [7]=> + NULL +} +*** Testing array_filter() : usage variations - 'callback' expecting second argument *** + +Warning: Missing argument 2 for dump() in %s on line %d + +Notice: Undefined variable: key in %s on line %d + = 123 +array(0) { +} +*** Testing array_filter() with various use types *** +array(2) { + [1]=> + string(1) "a" + [2]=> + string(1) "b" +} +array(2) { + ["a"]=> + int(1) + ["b"]=> + int(2) +} + +Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 44 + +Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 44 + +Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 44 + +Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 44 +array(0) { +} +Done diff --git a/ext/standard/tests/dir/chdir_basic.phpt b/ext/standard/tests/dir/chdir_basic.phpt index 5fc0e5b8867f0..81d3c7c9d1a1f 100644 --- a/ext/standard/tests/dir/chdir_basic.phpt +++ b/ext/standard/tests/dir/chdir_basic.phpt @@ -14,40 +14,40 @@ Test chdir() function : basic functionality echo "*** Testing chdir() : basic functionality ***\n"; $base_dir_path = dirname(__FILE__); -$level_one_dir_name = "level_one"; -$level_one_dir_path = "$base_dir_path/$level_one_dir_name"; +$level1_one_dir_name = "level1_one"; +$level1_one_dir_path = "$base_dir_path/$level1_one_dir_name"; -$level_two_dir_name = "level_two"; -$level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name"; +$level1_two_dir_name = "level1_two"; +$level1_two_dir_path = "$base_dir_path/$level1_one_dir_name/$level1_two_dir_name"; // create directories -mkdir($level_one_dir_path); -mkdir($level_two_dir_path); +mkdir($level1_one_dir_path); +mkdir($level1_two_dir_path); echo "\n-- Testing chdir() with absolute path: --\n"; chdir($base_dir_path); -var_dump(chdir($level_one_dir_path)); +var_dump(chdir($level1_one_dir_path)); var_dump(getcwd()); echo "\n-- Testing chdir() with relative paths: --\n"; -var_dump(chdir($level_two_dir_name)); +var_dump(chdir($level1_two_dir_name)); var_dump(getcwd()); ?> ===DONE=== --CLEAN-- --EXPECTF-- *** Testing chdir() : basic functionality *** -- Testing chdir() with absolute path: -- bool(true) -string(%d) "%slevel_one" +string(%d) "%slevel1_one" -- Testing chdir() with relative paths: -- bool(true) -string(%d) "%slevel_one%elevel_two" +string(%d) "%slevel1_one%elevel1_two" ===DONE=== diff --git a/ext/standard/tests/dir/chdir_variation2.phpt b/ext/standard/tests/dir/chdir_variation2.phpt index fa70f9e104f5d..9ca6a9774873d 100644 --- a/ext/standard/tests/dir/chdir_variation2.phpt +++ b/ext/standard/tests/dir/chdir_variation2.phpt @@ -15,32 +15,32 @@ echo "*** Testing chdir() : usage variations ***\n"; $base_dir_path = dirname(__FILE__); -$level_one_dir_name = "level_one"; -$level_one_dir_path = "$base_dir_path/$level_one_dir_name"; +$level2_one_dir_name = "level2_one"; +$level2_one_dir_path = "$base_dir_path/$level2_one_dir_name"; -$level_two_dir_name = "level_two"; -$level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name"; +$level2_two_dir_name = "level2_two"; +$level2_two_dir_path = "$base_dir_path/$level2_one_dir_name/$level2_two_dir_name"; // create directories -mkdir($level_one_dir_path); -mkdir($level_two_dir_path); +mkdir($level2_one_dir_path); +mkdir($level2_two_dir_path); -echo "\n-- \$directory = './level_one': --\n"; +echo "\n-- \$directory = './level2_one': --\n"; var_dump(chdir($base_dir_path)); -var_dump(chdir("./$level_one_dir_name")); +var_dump(chdir("./$level2_one_dir_name")); var_dump(getcwd()); -echo "\n-- \$directory = 'level_one/level_two': --\n"; +echo "\n-- \$directory = 'level2_one/level2_two': --\n"; var_dump(chdir($base_dir_path)); -var_dump(chdir("$level_one_dir_name/$level_two_dir_name")); +var_dump(chdir("$level2_one_dir_name/$level2_two_dir_name")); var_dump(getcwd()); echo "\n-- \$directory = '..': --\n"; var_dump(chdir('..')); var_dump(getcwd()); -echo "\n-- \$directory = 'level_two', '.': --\n"; -var_dump(chdir($level_two_dir_path)); +echo "\n-- \$directory = 'level2_two', '.': --\n"; +var_dump(chdir($level2_two_dir_path)); var_dump(chdir('.')); var_dump(getcwd()); @@ -49,13 +49,13 @@ var_dump(chdir('../')); var_dump(getcwd()); echo "\n-- \$directory = './': --\n"; -var_dump(chdir($level_two_dir_path)); +var_dump(chdir($level2_two_dir_path)); var_dump(chdir('./')); var_dump(getcwd()); -echo "\n-- \$directory = '../../'level_one': --\n"; -var_dump(chdir($level_two_dir_path)); -var_dump(chdir("../../$level_one_dir_name")); +echo "\n-- \$directory = '../../'level2_one': --\n"; +var_dump(chdir($level2_two_dir_path)); +var_dump(chdir("../../$level2_one_dir_name")); var_dump(getcwd()); ?> @@ -63,42 +63,42 @@ var_dump(getcwd()); --CLEAN-- --EXPECTF-- *** Testing chdir() : usage variations *** --- $directory = './level_one': -- +-- $directory = './level2_one': -- bool(true) bool(true) -string(%d) "%slevel_one" +string(%d) "%slevel2_one" --- $directory = 'level_one/level_two': -- +-- $directory = 'level2_one/level2_two': -- bool(true) bool(true) -string(%d) "%slevel_one%elevel_two" +string(%d) "%slevel2_one%elevel2_two" -- $directory = '..': -- bool(true) -string(%d) "%slevel_one" +string(%d) "%slevel2_one" --- $directory = 'level_two', '.': -- +-- $directory = 'level2_two', '.': -- bool(true) bool(true) -string(%d) "%slevel_one%elevel_two" +string(%d) "%slevel2_one%elevel2_two" -- $directory = '../': -- bool(true) -string(%d) "%slevel_one" +string(%d) "%slevel2_one" -- $directory = './': -- bool(true) bool(true) -string(%d) "%slevel_one%elevel_two" +string(%d) "%slevel2_one%elevel2_two" --- $directory = '../../'level_one': -- +-- $directory = '../../'level2_one': -- bool(true) bool(true) -string(%d) "%slevel_one" +string(%d) "%slevel2_one" ===DONE=== diff --git a/ext/standard/tests/file/bug41655_2.phpt b/ext/standard/tests/file/bug41655_2.phpt index d406f1ba0404b..96f5cc86f0e54 100644 --- a/ext/standard/tests/file/bug41655_2.phpt +++ b/ext/standard/tests/file/bug41655_2.phpt @@ -5,11 +5,13 @@ open_basedir=/ --FILE-- --EXPECTF-- Array ( [0] => %stest.csv + [1] => %stest2.csv + [2] => %stest3.csv ) diff --git a/ext/standard/tests/file/copy_variation16-win32.phpt b/ext/standard/tests/file/copy_variation16-win32.phpt index 7688f5eeabf86..d95d24adacb56 100644 --- a/ext/standard/tests/file/copy_variation16-win32.phpt +++ b/ext/standard/tests/file/copy_variation16-win32.phpt @@ -22,7 +22,7 @@ mkdir($base_dir); $sub_dir = $base_dir."/copy_variation16_sub"; mkdir($sub_dir); -$dirname_with_blank = $sub_dir."/copy variation6"; +$dirname_with_blank = $sub_dir."/copy variation16"; mkdir($dirname_with_blank); $src_file_name = dirname(__FILE__)."/copy_variation16.tmp"; @@ -139,6 +139,6 @@ Existence of destination file => bool(false) Size of source file => int(3500) Copy operation => bool(true) Existence of destination file => bool(true) -Destination file name is => %s/copy_variation16/copy_variation16_sub/copy variation6/copy_copy_variation16.tmp +Destination file name is => %s/copy_variation16/copy_variation16_sub/copy variation16/copy_copy_variation16.tmp Size of destination file => int(3500) *** Done *** diff --git a/ext/standard/tests/file/copy_variation16.phpt b/ext/standard/tests/file/copy_variation16.phpt index 9ad834bdb4192..e36fee1d666b7 100644 --- a/ext/standard/tests/file/copy_variation16.phpt +++ b/ext/standard/tests/file/copy_variation16.phpt @@ -22,7 +22,7 @@ mkdir($base_dir); $sub_dir = $base_dir."/copy_variation16_sub"; mkdir($sub_dir); -$dirname_with_blank = $sub_dir."/copy variation6"; +$dirname_with_blank = $sub_dir."/copy variation16"; mkdir($dirname_with_blank); $src_file_name = dirname(__FILE__)."/copy_variation16.tmp"; @@ -138,6 +138,6 @@ Size of destination file => int(3500) Size of source file => int(3500) Copy operation => bool(true) Existence of destination file => bool(true) -Destination file name is => %s/copy_variation16/copy_variation16_sub/copy variation6/copy_copy_variation16.tmp +Destination file name is => %s/copy_variation16/copy_variation16_sub/copy variation16/copy_copy_variation16.tmp Size of destination file => int(3500) *** Done *** diff --git a/ext/standard/tests/file/disk_free_space_basic.phpt b/ext/standard/tests/file/disk_free_space_basic.phpt index 7ea8d36153f06..2904ff9a5bfe0 100644 --- a/ext/standard/tests/file/disk_free_space_basic.phpt +++ b/ext/standard/tests/file/disk_free_space_basic.phpt @@ -1,5 +1,9 @@ --TEST-- Test disk_free_space and its alias diskfreespace() functions : basic functionality +--SKIPIF-- + --INI-- memory_limit=32M --FILE-- @@ -25,7 +29,7 @@ $space1 = disk_free_space($file_path.$dir); var_dump( $space1 ); $fh = fopen($file_path.$dir."/disk_free_space.tmp", "a"); -$data = str_repeat("x", 4096); +$data = str_repeat("x", 0xffff); fwrite($fh, (binary)$data); fclose($fh); @@ -33,10 +37,12 @@ echo "\n Free Space after writing to a file\n"; $space2 = disk_free_space($file_path.$dir); var_dump( $space2 ); -if( $space1 > $space2 ) +if($space1 > $space2 ) echo "\n Free Space Value Is Correct\n"; -else +else { echo "\n Free Space Value Is Incorrect\n"; + var_dump($space1, $space2); +} echo "*** Testing with Binary Input ***\n"; var_dump( disk_free_space(b"$file_path") ); diff --git a/ext/standard/tests/file/fgets_socket_variation1.phpt b/ext/standard/tests/file/fgets_socket_variation1.phpt index 57944d8b563c1..429ad67d69677 100644 --- a/ext/standard/tests/file/fgets_socket_variation1.phpt +++ b/ext/standard/tests/file/fgets_socket_variation1.phpt @@ -5,11 +5,17 @@ Dave Kelsey --FILE-- +--FILE-- + 'aaa,bbb', + 1 => 'aaa,"bbb"', + 2 => '"aaa","bbb"', + 3 => 'aaa,bbb', + 4 => '"aaa",bbb', + 5 => '"aaa", "bbb"', + 6 => ',', + 7 => 'aaa,', + 8 => ',"aaa"', + 9 => '"",""', + 10 => '"""""",', + 11 => '""""",aaa', + 12 => 'aaa,bbb ', + 13 => 'aaa,"bbb "', + 14 => 'aaa"aaa","bbb"bbb', + 15 => 'aaa"aaa""",bbb', + 16 => 'aaa,"/"bbb,ccc', + 17 => 'aaa"/"a","bbb"', + 18 => '"/"","aaa"', + 19 => '"/""",aaa', +); + +$file = dirname(__FILE__) . 'fgetcsv.csv'; +@unlink($file); + +$fp = fopen($file, "w"); +foreach ($list as $v) { + fputcsv($fp, explode(',', $v), ',', '"', '/'); +} +fclose($fp); + +$res = file($file); +foreach($res as &$val) +{ + $val = substr($val, 0, -1); +} +echo '$list = ';var_export($res);echo ";\n"; + +$fp = fopen($file, "r"); +$res = array(); +while($l=fgetcsv($fp, 0, ',', '"', '/')) +{ + $res[] = join(',',$l); +} +fclose($fp); + +echo '$list = ';var_export($res);echo ";\n"; + +@unlink($file); + +?> +===DONE=== + +--EXPECT-- +$list = array ( + 0 => 'aaa,bbb', + 1 => 'aaa,"""bbb"""', + 2 => '"""aaa""","""bbb"""', + 3 => 'aaa,bbb', + 4 => '"""aaa""",bbb', + 5 => '"""aaa"""," ""bbb"""', + 6 => ',', + 7 => 'aaa,', + 8 => ',"""aaa"""', + 9 => '"""""",""""""', + 10 => '"""""""""""""",', + 11 => '"""""""""""",aaa', + 12 => 'aaa,"bbb "', + 13 => 'aaa,"""bbb """', + 14 => '"aaa""aaa""","""bbb""bbb"', + 15 => '"aaa""aaa""""""",bbb', + 16 => 'aaa,"""/"bbb",ccc', + 17 => '"aaa""/"a""","""bbb"""', + 18 => '"""/"""","""aaa"""', + 19 => '"""/"""""",aaa', +); +$list = array ( + 0 => 'aaa,bbb', + 1 => 'aaa,"bbb"', + 2 => '"aaa","bbb"', + 3 => 'aaa,bbb', + 4 => '"aaa",bbb', + 5 => '"aaa", "bbb"', + 6 => ',', + 7 => 'aaa,', + 8 => ',"aaa"', + 9 => '"",""', + 10 => '"""""",', + 11 => '""""",aaa', + 12 => 'aaa,bbb ', + 13 => 'aaa,"bbb "', + 14 => 'aaa"aaa","bbb"bbb', + 15 => 'aaa"aaa""",bbb', + 16 => 'aaa,"/"bbb,ccc', + 17 => 'aaa"/"a","bbb"', + 18 => '"/"","aaa"', + 19 => '"/""",aaa', +); +===DONE=== diff --git a/ext/standard/tests/file/fread_socket_variation1.phpt b/ext/standard/tests/file/fread_socket_variation1.phpt index a615d2f414c5c..d65565d3cc11a 100644 --- a/ext/standard/tests/file/fread_socket_variation1.phpt +++ b/ext/standard/tests/file/fread_socket_variation1.phpt @@ -3,13 +3,20 @@ Testing fread() on a TCP server socket --FILE-- --EXPECT-- diff --git a/ext/standard/tests/file/fscanf_variation53.phpt b/ext/standard/tests/file/fscanf_variation53.phpt index b65bccf8fdddc..a553a966934df 100644 --- a/ext/standard/tests/file/fscanf_variation53.phpt +++ b/ext/standard/tests/file/fscanf_variation53.phpt @@ -30,7 +30,7 @@ $counter = 1; foreach($modes as $mode) { // create an empty file - $filename = "$file_path/fscanf_variation52.tmp"; + $filename = "$file_path/fscanf_variation53.tmp"; $file_handle = fopen($filename, "w"); if($file_handle == false) exit("Error:failed to open file $filename"); diff --git a/ext/standard/tests/file/rename_variation1.phpt b/ext/standard/tests/file/rename_variation1.phpt index 0f7321e20506c..54338d74601a7 100644 --- a/ext/standard/tests/file/rename_variation1.phpt +++ b/ext/standard/tests/file/rename_variation1.phpt @@ -16,16 +16,16 @@ $file_path = dirname(__FILE__); echo "\n*** Testing rename() : renaming directory across directories ***\n"; $src_dirs = array ( /* Testing simple directory tree */ - "$file_path/rename_variation/", + "$file_path/rename_variation1/", /* Testing a dir with trailing slash */ - "$file_path/rename_variation/", + "$file_path/rename_variation1/", /* Testing dir with double trailing slashes */ - "$file_path//rename_variation//", + "$file_path//rename_variation1//", ); -$dest_dir = "$file_path/rename_variation_dir"; +$dest_dir = "$file_path/rename_variation1_dir"; // create the $dest_dir mkdir($dest_dir); @@ -35,7 +35,7 @@ foreach($src_dirs as $src_dir) { echo "-- Iteration $counter --\n"; // create the src dir - mkdir("$file_path/rename_variation/"); + mkdir("$file_path/rename_variation1/"); // rename the src dir to a new dir in dest dir var_dump( rename($src_dir, $dest_dir."/new_dir") ); // ensure that dir was renamed @@ -52,7 +52,7 @@ echo "Done\n"; --CLEAN-- --EXPECTF-- *** Testing rename() : renaming directory across directories *** diff --git a/ext/standard/tests/file/rename_variation2-win32.phpt b/ext/standard/tests/file/rename_variation2-win32.phpt index 87f4e7ddb139c..9627a9fa53012 100644 --- a/ext/standard/tests/file/rename_variation2-win32.phpt +++ b/ext/standard/tests/file/rename_variation2-win32.phpt @@ -15,27 +15,27 @@ if (substr(PHP_OS, 0, 3) != 'WIN') { require dirname(__FILE__).'/file.inc'; $file_path = dirname(__FILE__); -mkdir("$file_path/rename_variation_dir"); +mkdir("$file_path/rename_variation2_dir"); /* Renaming a file and directory to numeric name */ echo "\n*** Testing rename() by renaming a file and directory to numeric name ***\n"; -$fp = fopen($file_path."/rename_variation.tmp", "w"); +$fp = fopen($file_path."/rename_variation2.tmp", "w"); fclose($fp); // renaming existing file to numeric name -var_dump( rename($file_path."/rename_variation.tmp", $file_path."/12345") ); +var_dump( rename($file_path."/rename_variation2.tmp", $file_path."/12345") ); // ensure that rename worked fine -var_dump( file_exists($file_path."/rename_variation.tmp" ) ); // expecting false +var_dump( file_exists($file_path."/rename_variation2.tmp" ) ); // expecting false var_dump( file_exists($file_path."/12345" ) ); // expecting true unlink($file_path."/12345"); // renaming a directory to numeric name -var_dump( rename($file_path."/rename_variation_dir/", $file_path."/12345") ); +var_dump( rename($file_path."/rename_variation2_dir/", $file_path."/12345") ); // ensure that rename worked fine -var_dump( file_exists($file_path."/rename_variation_dir" ) ); // expecting false +var_dump( file_exists($file_path."/rename_variation2_dir" ) ); // expecting false var_dump( file_exists($file_path."/12345" ) ); // expecting true rmdir($file_path."/12345"); @@ -45,9 +45,9 @@ echo "Done\n"; --CLEAN-- --EXPECTF-- *** Testing rename() by renaming a file and directory to numeric name *** diff --git a/ext/standard/tests/file/rename_variation2.phpt b/ext/standard/tests/file/rename_variation2.phpt index fa3ee1e017f6b..1e0a5d9edd306 100644 --- a/ext/standard/tests/file/rename_variation2.phpt +++ b/ext/standard/tests/file/rename_variation2.phpt @@ -11,7 +11,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { $file_path = dirname(__FILE__); -$dest_dir = "$file_path/rename_variation_dir"; +$dest_dir = "$file_path/rename_variation2_dir"; // create the $dest_dir mkdir($dest_dir); @@ -23,11 +23,11 @@ $filename = $file_path."/rename_variation2.tmp"; var_dump(touch($filename)); // create the soft links to the file -$linkname = $file_path."/rename_variation_soft_link1.tmp"; +$linkname = $file_path."/rename_variation2_soft_link1.tmp"; var_dump(symlink($filename, $linkname)); //rename the link to a new name in the same dir -$dest_linkname = $file_path."/rename_variation_soft_link2.tmp"; +$dest_linkname = $file_path."/rename_variation2_soft_link2.tmp"; var_dump( rename( $linkname, $dest_linkname) ); //ensure that link was renamed clearstatcache(); @@ -35,14 +35,14 @@ var_dump( file_exists($linkname) ); // expecting false var_dump( file_exists($dest_linkname) ); // expecting true // rename a link across dir -var_dump( rename($dest_linkname, $dest_dir."/rename_variation_soft_link2.tmp")); +var_dump( rename($dest_linkname, $dest_dir."/rename_variation2_soft_link2.tmp")); //ensure that link got renamed clearstatcache(); var_dump( file_exists($dest_linkname) ); // expecting false -var_dump( file_exists($dest_dir."/rename_variation_soft_link2.tmp") ); // expecting true +var_dump( file_exists($dest_dir."/rename_variation2_soft_link2.tmp") ); // expecting true // delete the link file now -unlink($dest_dir."/rename_variation_soft_link2.tmp"); +unlink($dest_dir."/rename_variation2_soft_link2.tmp"); echo "Done\n"; ?> @@ -50,7 +50,7 @@ echo "Done\n"; --EXPECTF-- *** Testing rename() on soft links *** diff --git a/ext/standard/tests/file/rename_variation3.phpt b/ext/standard/tests/file/rename_variation3.phpt index ce8921630b73c..7c47040729c77 100644 --- a/ext/standard/tests/file/rename_variation3.phpt +++ b/ext/standard/tests/file/rename_variation3.phpt @@ -11,41 +11,41 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { $file_path = dirname(__FILE__); -$dest_dir = "$file_path/rename_variation_dir"; +$dest_dir = "$file_path/rename_variation3_dir"; // create the $dest_dir mkdir($dest_dir); echo "\n*** Testing rename() on hard links ***\n"; -$filename = $file_path."/rename_variation1.tmp"; +$filename = $file_path."/rename_variation31.tmp"; @unlink($filename); var_dump(touch($filename)); -$linkname = $file_path."/rename_variation_hard_link1.tmp"; +$linkname = $file_path."/rename_variation3_hard_link1.tmp"; var_dump(link($filename, $linkname)); //rename the link to a new name in the same dir -$dest_linkname = $file_path."/rename_variation_hard_link2.tmp"; +$dest_linkname = $file_path."/rename_variation3_hard_link2.tmp"; var_dump( rename( $filename, $dest_linkname) ); //ensure that link was renamed var_dump( file_exists($filename) ); // expecting false var_dump( file_exists($dest_linkname) ); // expecting true // rename a hard link across dir -var_dump( rename($dest_linkname, $dest_dir."/rename_variation_hard_link2.tmp") ); +var_dump( rename($dest_linkname, $dest_dir."/rename_variation3_hard_link2.tmp") ); //ensure that link got renamed var_dump( file_exists($dest_linkname) ); // expecting false -var_dump( file_exists($dest_dir."/rename_variation_hard_link2.tmp") ); // expecting true +var_dump( file_exists($dest_dir."/rename_variation3_hard_link2.tmp") ); // expecting true // delete the link file now -unlink($dest_dir."/rename_variation_hard_link2.tmp"); +unlink($dest_dir."/rename_variation3_hard_link2.tmp"); echo "Done\n"; ?> --CLEAN-- --EXPECTF-- *** Testing rename() on hard links *** diff --git a/ext/standard/tests/file/rename_variation4.phpt b/ext/standard/tests/file/rename_variation4.phpt index 2965f7534a64d..69753bc322fa7 100644 --- a/ext/standard/tests/file/rename_variation4.phpt +++ b/ext/standard/tests/file/rename_variation4.phpt @@ -15,22 +15,22 @@ require dirname(__FILE__).'/file.inc'; /* Renaming a file, link and directory to numeric name */ echo "\n*** Testing rename() by renaming a file, link and directory to numeric name ***\n"; -$fp = fopen($file_path."/rename_variation.tmp", "w"); +$fp = fopen($file_path."/rename_variation4.tmp", "w"); fclose($fp); // renaming existing file to numeric name -var_dump( rename($file_path."/rename_variation.tmp", $file_path."/12345") ); +var_dump( rename($file_path."/rename_variation4.tmp", $file_path."/12345") ); // ensure that rename worked fine -var_dump( file_exists($file_path."/rename_variation.tmp" ) ); // expecting false +var_dump( file_exists($file_path."/rename_variation4.tmp" ) ); // expecting false var_dump( file_exists($file_path."/12345" ) ); // expecting true // remove the file unlink($file_path."/12345"); -mkdir($file_path."/rename_variation_dir"); +mkdir($file_path."/rename_variation4_dir"); // renaming a directory to numeric name -var_dump( rename($file_path."/rename_variation_dir/", $file_path."/12345") ); +var_dump( rename($file_path."/rename_variation4_dir/", $file_path."/12345") ); // ensure that rename worked fine -var_dump( file_exists($file_path."/rename_variation_dir" ) ); // expecting false +var_dump( file_exists($file_path."/rename_variation4_dir" ) ); // expecting false var_dump( file_exists($file_path."/12345" ) ); // expecting true echo "Done\n"; diff --git a/ext/standard/tests/file/rename_variation5.phpt b/ext/standard/tests/file/rename_variation5.phpt index bf43e49510f3e..2518cf48ea8b8 100644 --- a/ext/standard/tests/file/rename_variation5.phpt +++ b/ext/standard/tests/file/rename_variation5.phpt @@ -13,14 +13,14 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { and one another */ // create a dir $file_path = dirname(__FILE__); -$dirname = "$file_path/rename_variation_dir"; +$dirname = "$file_path/rename_variation5_dir"; mkdir($dirname); //create a file -$filename = "$file_path/rename_variation.tmp"; +$filename = "$file_path/rename_variation5.tmp"; $fp = fopen($filename, "w"); fclose($fp); // create a link -$linkname = "$file_path/rename_variation_link.tmp"; +$linkname = "$file_path/rename_variation5_link.tmp"; symlink($filename, $linkname); echo "\n-- Renaming link to same link name --\n"; @@ -54,9 +54,9 @@ echo "Done\n"; --CLEAN-- --EXPECTF-- -- Renaming link to same link name -- diff --git a/ext/standard/tests/general_functions/bug41445_1.phpt b/ext/standard/tests/general_functions/bug41445_1.phpt index e65e7afcc8c2c..4698de436a04d 100644 --- a/ext/standard/tests/general_functions/bug41445_1.phpt +++ b/ext/standard/tests/general_functions/bug41445_1.phpt @@ -3,7 +3,7 @@ Bug #41445 (parse_ini_file() function parses octal numbers in section names) - 2 --FILE-- 10.5, - 1 => 5.6, + 1 => 5.5999999999999996, ) array ( 0 => 10.5, - 1 => 5.6, + 1 => 5.5999999999999996, ) -string(34) "array ( +string(49) "array ( 0 => 10.5, - 1 => 5.6, + 1 => 5.5999999999999996, )" diff --git a/ext/standard/tests/general_functions/var_export_basic3.phpt b/ext/standard/tests/general_functions/var_export_basic3.phpt index 299721591071b..9e27d90425817 100644 --- a/ext/standard/tests/general_functions/var_export_basic3.phpt +++ b/ext/standard/tests/general_functions/var_export_basic3.phpt @@ -96,9 +96,9 @@ string(1) "0" -- Iteration: -0.1 -- --0.1 --0.1 -string(4) "-0.1" +-0.10000000000000001 +-0.10000000000000001 +string(20) "-0.10000000000000001" -- Iteration: 10.0000000000000000005 -- @@ -120,9 +120,9 @@ string(6) "100000" -- Iteration: 1e-5 -- -1.0E-5 -1.0E-5 -string(6) "1.0E-5" +1.0000000000000001E-5 +1.0000000000000001E-5 +string(21) "1.0000000000000001E-5" -- Iteration: 1e+5 -- @@ -144,9 +144,9 @@ string(6) "100000" -- Iteration: 1E-5 -- -1.0E-5 -1.0E-5 -string(6) "1.0E-5" +1.0000000000000001E-5 +1.0000000000000001E-5 +string(21) "1.0000000000000001E-5" -- Iteration: .5e+7 -- @@ -156,20 +156,20 @@ string(7) "5000000" -- Iteration: .6e-19 -- -6.0E-20 -6.0E-20 -string(7) "6.0E-20" +6.0000000000000006E-20 +6.0000000000000006E-20 +string(22) "6.0000000000000006E-20" -- Iteration: .05E+44 -- -5.0E+42 -5.0E+42 -string(7) "5.0E+42" +5.0000000000000001E+42 +5.0000000000000001E+42 +string(22) "5.0000000000000001E+42" -- Iteration: .0034E-30 -- -3.4E-33 -3.4E-33 -string(7) "3.4E-33" +3.4000000000000001E-33 +3.4000000000000001E-33 +string(22) "3.4000000000000001E-33" ===DONE=== diff --git a/ext/standard/tests/general_functions/var_export_basic5.phpt b/ext/standard/tests/general_functions/var_export_basic5.phpt index 96b3f54cc9e88..1512fa8377b01 100644 --- a/ext/standard/tests/general_functions/var_export_basic5.phpt +++ b/ext/standard/tests/general_functions/var_export_basic5.phpt @@ -233,15 +233,15 @@ string(20) "array ( --Iteration: array(10.5, 5.6) -- array ( 0 => 10.5, - 1 => 5.6, + 1 => 5.5999999999999996, ) array ( 0 => 10.5, - 1 => 5.6, + 1 => 5.5999999999999996, ) -string(34) "array ( +string(49) "array ( 0 => 10.5, - 1 => 5.6, + 1 => 5.5999999999999996, )" @@ -274,4 +274,4 @@ string(41) "array ( 1 => 'test', )" -===DONE=== \ No newline at end of file +===DONE=== diff --git a/ext/standard/tests/http/bug61548.phpt b/ext/standard/tests/http/bug61548.phpt new file mode 100644 index 0000000000000..138b15a338c06 --- /dev/null +++ b/ext/standard/tests/http/bug61548.phpt @@ -0,0 +1,118 @@ +--TEST-- +Bug #61548 (content-type must appear at the end of headers) +--INI-- +allow_url_fopen=1 +--SKIPIF-- + +--FILE-- + [ + 'method' => 'POST', + 'header' => $header, + 'follow_location' => true, + ], + ]; + + $ctx = stream_context_create($options); + + $responses = [ + "data://text/plain,HTTP/1.1 201\r\nLocation: /foo\r\n\r\n", + "data://text/plain,HTTP/1.1 200\r\nConnection: close\r\n\r\n", + ]; + $pid = http_server('tcp://127.0.0.1:12342', $responses, $output); + + $fd = fopen('http://127.0.0.1:12342/', 'rb', false, $ctx); + fseek($output, 0, SEEK_SET); + echo stream_get_contents($output); + + http_server_kill($pid); +} + +do_test("First:1\nSecond:2\nContent-type: text/plain"); +do_test("First:1\nSecond:2\nContent-type: text/plain\n"); +do_test("First:1\nSecond:2\nContent-type: text/plain\nThird:"); +do_test("First:1\nContent-type:text/plain\nSecond:2"); +do_test("First:1\nContent-type:text/plain\nSecond:2\n"); +do_test("First:1\nContent-type:text/plain\nSecond:2\nThird:"); + +?> +Done +--EXPECT-- +POST / HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Second:2 +Content-type: text/plain + +GET /foo HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Second:2 + + +POST / HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Second:2 +Content-type: text/plain + +GET /foo HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Second:2 + + +POST / HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Second:2 +Content-type: text/plain +Third: + +GET /foo HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Second:2 +Third: + +POST / HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Content-type:text/plain +Second:2 + +GET /foo HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Second:2 + +POST / HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Content-type:text/plain +Second:2 + +GET /foo HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Second:2 + +POST / HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Content-type:text/plain +Second:2 +Third: + +GET /foo HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Second:2 +Third: + +Done + diff --git a/ext/standard/tests/http/bug65634.phpt b/ext/standard/tests/http/bug65634.phpt new file mode 100644 index 0000000000000..8f358cc6cfc84 --- /dev/null +++ b/ext/standard/tests/http/bug65634.phpt @@ -0,0 +1,81 @@ +--TEST-- +Bug #65634 (HTTP wrapper is very slow with protocol_version 1.1) +--INI-- +allow_url_fopen=1 +--SKIPIF-- + +--FILE-- + [ + 'protocol_version' => $version, + ], + ]; + + if ($connection) { + $options['http']['header'] = "Connection: $connection"; + } + + $ctx = stream_context_create($options); + + $responses = ["data://text/plain,HTTP/$version 204 No Content\r\n\r\n"]; + $pid = http_server('tcp://127.0.0.1:12342', $responses, $output); + + $fd = fopen('http://127.0.0.1:12342/', 'rb', false, $ctx); + fseek($output, 0, SEEK_SET); + echo stream_get_contents($output); + + http_server_kill($pid); +} + +echo "HTTP/1.0, default behaviour:\n"; +do_test('1.0', null); + +echo "HTTP/1.0, connection: close:\n"; +do_test('1.0', 'close'); + +echo "HTTP/1.0, connection: keep-alive:\n"; +do_test('1.0', 'keep-alive'); + +echo "HTTP/1.1, default behaviour:\n"; +do_test('1.1', null); + +echo "HTTP/1.1, connection: close:\n"; +do_test('1.1', 'close'); + +echo "HTTP/1.1, connection: keep-alive:\n"; +do_test('1.1', 'keep-alive'); +?> +--EXPECT-- +HTTP/1.0, default behaviour: +GET / HTTP/1.0 +Host: 127.0.0.1:12342 + +HTTP/1.0, connection: close: +GET / HTTP/1.0 +Host: 127.0.0.1:12342 +Connection: close + +HTTP/1.0, connection: keep-alive: +GET / HTTP/1.0 +Host: 127.0.0.1:12342 +Connection: keep-alive + +HTTP/1.1, default behaviour: +GET / HTTP/1.1 +Host: 127.0.0.1:12342 +Connection: close + +HTTP/1.1, connection: close: +GET / HTTP/1.1 +Host: 127.0.0.1:12342 +Connection: close + +HTTP/1.1, connection: keep-alive: +GET / HTTP/1.1 +Host: 127.0.0.1:12342 +Connection: keep-alive + diff --git a/ext/standard/tests/network/fsockopen_basic.phpt b/ext/standard/tests/network/fsockopen_basic.phpt index 3ec9366331eb1..227762f899d2b 100644 --- a/ext/standard/tests/network/fsockopen_basic.phpt +++ b/ext/standard/tests/network/fsockopen_basic.phpt @@ -11,12 +11,18 @@ Test fsockopen() function : basic functionality echo "*** Testing fsockopen() : basic functionality ***\n"; echo "Open a server socket\n"; -$server = stream_socket_server('tcp://127.0.0.1:31337'); +for ($i=0; $i<100; $i++) { + $port = rand(10000, 65000); + /* Setup socket server */ + $server = @stream_socket_server("tcp://127.0.0.1:$port"); + if ($server) { + break; + } +} // Initialise all required variables $hostname = 'tcp://127.0.0.1'; // loopback address -$port = 31337; $errno = null; $errstr = null; $timeout = 1.5; diff --git a/ext/standard/tests/network/fsockopen_variation1.phpt b/ext/standard/tests/network/fsockopen_variation1.phpt index 2e5f8d9ada706..bb1b0f15c7f48 100644 --- a/ext/standard/tests/network/fsockopen_variation1.phpt +++ b/ext/standard/tests/network/fsockopen_variation1.phpt @@ -4,11 +4,17 @@ testing fsockopen without a protocol string --FILE-- --EXPECTF-- diff --git a/ext/standard/tests/network/tcp4loop.phpt b/ext/standard/tests/network/tcp4loop.phpt index afd955918e8fb..a163cd9b35816 100644 --- a/ext/standard/tests/network/tcp4loop.phpt +++ b/ext/standard/tests/network/tcp4loop.phpt @@ -2,14 +2,21 @@ Streams Based IPv4 TCP Loopback test --FILE-- --FILE-- --FILE-- a[] = new B(1); + $this->a[] = new B(2); + } +} + +class B implements Serializable +{ + public $b; + + public function __construct($c) + { + $this->b = new C($c); + } + + public function serialize() + { + return serialize(clone $this->b); + } + + public function unserialize($data) + { + $this->b = unserialize($data); + } +} + +class C +{ + public $c; + + public function __construct($c) + { + $this->c = $c; + } +} + +$a = unserialize(serialize(new A())); + +print $a->a[0]->b->c . "\n"; +print $a->a[1]->b->c . "\n"; + +?> +Done +--EXPECT-- +Test +1 +2 +Done diff --git a/ext/standard/tests/serialize/bug65806.phpt b/ext/standard/tests/serialize/bug65806.phpt new file mode 100644 index 0000000000000..19fab95c6430d --- /dev/null +++ b/ext/standard/tests/serialize/bug65806.phpt @@ -0,0 +1,83 @@ +--TEST-- +Bug #65806 (unserialize fails with object which is referenced multiple times) +--FILE-- +_obj = $obj; + $this->_serialized = serialize($this->_obj); + } + public function get() + { + return $this->_obj; + } + public function __sleep() + { + $this->_serialized = serialize($this->_obj); + return array( + "\0" . __CLASS__ . "\0_serialized", + ); + } + public function __wakeup() + { + $this->_obj = unserialize($this->_serialized); + } +} + +echo "SCRIPT START" . PHP_EOL; + +$objA = new myObjA(); +$objB = new myObjB(); +$objC = new myObjC(); + +$objB->attrA = new ArrayIterator(); +$objB->attrB = $objA; + +$objC->attrC = $objB; +$objC->attrD = $objA; + +$list = new myList($objC); + +echo 'check ' . check($list->get()) . PHP_EOL; + +echo "start serialize/unserialize" . PHP_EOL; +$newList = unserialize(serialize($list)); +echo "finish serialize/unserialize" . PHP_EOL; + +//after unserialize the property myObjC::attrD is null instead of expected object +echo 'check ' . check($newList->get()) . PHP_EOL; + +echo "SCRIPT END" . PHP_EOL ; + +function check(myObjC $obj) { + + if (!is_object($obj->attrC)) { + return 'failed (myObjC::attrC => ' . var_export($obj->attrC, true) . ')'; + } + if (!is_object($obj->attrD)) { + return 'failed (myObjC::attrD => ' . var_export($obj->attrD, true) . ')'; + } + return 'successful'; +} +?> +--EXPECT-- +SCRIPT START +check successful +start serialize/unserialize +finish serialize/unserialize +check successful +SCRIPT END + diff --git a/ext/standard/tests/streams/bug65483.phpt b/ext/standard/tests/streams/bug65483.phpt new file mode 100644 index 0000000000000..d214bbbbcc4a4 --- /dev/null +++ b/ext/standard/tests/streams/bug65483.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #65483: quoted-printable encode stream filter incorrectly encoding spaces +--FILE-- + +--EXPECT-- +string(9) "a b=3Dc d" diff --git a/ext/standard/tests/streams/stream_get_meta_data_socket_basic.phpt b/ext/standard/tests/streams/stream_get_meta_data_socket_basic.phpt index 86056114b877c..86c9cd77c8a4a 100644 --- a/ext/standard/tests/streams/stream_get_meta_data_socket_basic.phpt +++ b/ext/standard/tests/streams/stream_get_meta_data_socket_basic.phpt @@ -3,7 +3,7 @@ stream_get_meta_data() on a udp socket --FILE-- nApplyCount > 0){ + if (myht->nApplyCount > 0){ smart_str_appendl(buf, "NULL", 4); zend_error(E_WARNING, "var_export does not handle circular references"); return; @@ -549,11 +549,9 @@ static inline int php_add_var_hash(HashTable *var_hash, zval *var, void *var_old char id[32], *p; register int len; - /* relies on "(long)" being a perfect hash function for data pointers, - * however the actual identity of an object has had to be determined - * by its object handle since 5.0. */ if ((Z_TYPE_P(var) == IS_OBJECT) && Z_OBJ_HT_P(var)->get_class_entry) { - p = smart_str_print_long(id + sizeof(id) - 1, (long) Z_OBJ_HANDLE_P(var)); + p = smart_str_print_long(id + sizeof(id) - 1, + (long) zend_objects_get_address(var TSRMLS_CC)); *(--p) = 'O'; len = id + sizeof(id) - 1 - p; } else { diff --git a/ext/tokenizer/tokenizer_data.c b/ext/tokenizer/tokenizer_data.c index 57b29e1dd7006..8c4786575effc 100644 --- a/ext/tokenizer/tokenizer_data.c +++ b/ext/tokenizer/tokenizer_data.c @@ -38,6 +38,7 @@ void tokenizer_register_constants(INIT_FUNC_ARGS) { REGISTER_LONG_CONSTANT("T_LOGICAL_XOR", T_LOGICAL_XOR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_LOGICAL_AND", T_LOGICAL_AND, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_PRINT", T_PRINT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_YIELD", T_YIELD, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_SR_EQUAL", T_SR_EQUAL, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_SL_EQUAL", T_SL_EQUAL, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_XOR_EQUAL", T_XOR_EQUAL, CONST_CS | CONST_PERSISTENT); @@ -108,7 +109,6 @@ void tokenizer_register_constants(INIT_FUNC_ARGS) { REGISTER_LONG_CONSTANT("T_FUNCTION", T_FUNCTION, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_CONST", T_CONST, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_RETURN", T_RETURN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_YIELD", T_YIELD, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_TRY", T_TRY, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_CATCH", T_CATCH, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_FINALLY", T_FINALLY, CONST_CS | CONST_PERSISTENT); @@ -158,6 +158,7 @@ void tokenizer_register_constants(INIT_FUNC_ARGS) { REGISTER_LONG_CONSTANT("T_NS_C", T_NS_C, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_DIR", T_DIR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_NS_SEPARATOR", T_NS_SEPARATOR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_ELLIPSIS", T_ELLIPSIS, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_DOUBLE_COLON", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT); } @@ -174,6 +175,7 @@ char *get_token_type_name(int token_type) case T_LOGICAL_XOR: return "T_LOGICAL_XOR"; case T_LOGICAL_AND: return "T_LOGICAL_AND"; case T_PRINT: return "T_PRINT"; + case T_YIELD: return "T_YIELD"; case T_SR_EQUAL: return "T_SR_EQUAL"; case T_SL_EQUAL: return "T_SL_EQUAL"; case T_XOR_EQUAL: return "T_XOR_EQUAL"; @@ -244,7 +246,6 @@ char *get_token_type_name(int token_type) case T_FUNCTION: return "T_FUNCTION"; case T_CONST: return "T_CONST"; case T_RETURN: return "T_RETURN"; - case T_YIELD: return "T_YIELD"; case T_TRY: return "T_TRY"; case T_CATCH: return "T_CATCH"; case T_FINALLY: return "T_FINALLY"; @@ -294,6 +295,7 @@ char *get_token_type_name(int token_type) case T_NS_C: return "T_NS_C"; case T_DIR: return "T_DIR"; case T_NS_SEPARATOR: return "T_NS_SEPARATOR"; + case T_ELLIPSIS: return "T_ELLIPSIS"; } return "UNKNOWN"; diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c index 02ebc7738ef8e..76cd56f144ed7 100644 --- a/ext/xmlreader/php_xmlreader.c +++ b/ext/xmlreader/php_xmlreader.c @@ -588,9 +588,6 @@ PHP_METHOD(xmlreader, getAttributeNo) if (retchar) { RETVAL_STRING(retchar, 1); xmlFree(retchar); - return; - } else { - RETURN_EMPTY_STRING(); } } /* }}} */ @@ -622,9 +619,6 @@ PHP_METHOD(xmlreader, getAttributeNs) if (retchar) { RETVAL_STRING(retchar, 1); xmlFree(retchar); - return; - } else { - RETURN_EMPTY_STRING(); } } /* }}} */ @@ -805,7 +799,6 @@ PHP_METHOD(xmlreader, read) if (intern != NULL && intern->ptr != NULL) { retval = xmlTextReaderRead(intern->ptr); if (retval == -1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "An Error Occurred while reading"); RETURN_FALSE; } else { RETURN_BOOL(retval); @@ -847,7 +840,6 @@ PHP_METHOD(xmlreader, next) retval = xmlTextReaderNext(intern->ptr); } if (retval == -1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "An Error Occurred while reading"); RETURN_FALSE; } else { RETURN_BOOL(retval); @@ -1320,6 +1312,7 @@ PHP_MINIT_FUNCTION(xmlreader) xmlreader_object_handlers.read_property = xmlreader_read_property; xmlreader_object_handlers.write_property = xmlreader_write_property; xmlreader_object_handlers.get_property_ptr_ptr = xmlreader_get_property_ptr_ptr; + xmlreader_object_handlers.clone_obj = NULL; INIT_CLASS_ENTRY(ce, "XMLReader", xmlreader_functions); ce.create_object = xmlreader_objects_new; diff --git a/ext/xmlreader/tests/bug51936.phpt b/ext/xmlreader/tests/bug51936.phpt new file mode 100644 index 0000000000000..4b5f1012e79c0 --- /dev/null +++ b/ext/xmlreader/tests/bug51936.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #51936 (Crash with clone XMLReader) +--SKIPIF-- + +--FILE-- +xml(""); + +$xmlreader->next(); +$xmlreader2 = clone $xmlreader; +$xmlreader2->next(); +?> +Done +--EXPECTF-- +Test + +Fatal error: Trying to clone an uncloneable object of class XMLReader in %s on line %d diff --git a/ext/xmlreader/tests/bug64230.phpt b/ext/xmlreader/tests/bug64230.phpt new file mode 100644 index 0000000000000..0b070925f30d3 --- /dev/null +++ b/ext/xmlreader/tests/bug64230.phpt @@ -0,0 +1,50 @@ +--TEST-- +Bug #64230 (XMLReader does not suppress errors) +--SKIPIF-- + +--FILE-- +message); + } + libxml_clear_errors(); +} + +echo "Internal errors TRUE\n"; +libxml_use_internal_errors(true); + +$x = new XMLReader; +$x->xml(""); +$x->read(); + +show_internal_errors(); + +echo "Internal errors FALSE\n"; +libxml_use_internal_errors(false); + +$x = new XMLReader; +$x->xml(""); +$x->read(); + +show_internal_errors(); + +?> +Done +--EXPECTF-- +Test +Internal errors TRUE +Internal: Specification mandate value for attribute att + +Internal errors FALSE + +Warning: XMLReader::read(): %s: parser error : Specification mandate value for attribute att in %s on line %d + +Warning: XMLReader::read(): in %s on line %d + +Warning: XMLReader::read(): ^ in %s on line %d +Done diff --git a/ext/xmlrpc/tests/005.phpt b/ext/xmlrpc/tests/005.phpt new file mode 100644 index 0000000000000..613dfde249910 --- /dev/null +++ b/ext/xmlrpc/tests/005.phpt @@ -0,0 +1,47 @@ +--TEST-- +xmlrpc_encode() Simple test encode type double and String + +--CREDITS-- +Michel Araujo +#PHPSP 2013-08-22 + +--SKIPIF-- + + +--FILE-- + + + + + 3.24234 + + + + + + + + -3.24234 + + + + + + + + Is string + + + \ No newline at end of file diff --git a/ext/xmlrpc/tests/006.phpt b/ext/xmlrpc/tests/006.phpt new file mode 100644 index 0000000000000..f33932d5a210f --- /dev/null +++ b/ext/xmlrpc/tests/006.phpt @@ -0,0 +1,29 @@ +--TEST-- +xmlrpc_decode() Simple test decode type string + +--CREDITS-- +Michel Araujo +#PHPSP 2013-08-22 + +--SKIPIF-- + + +--FILE-- + + + + + Is string + + + +XML; + +$response = xmlrpc_decode($xml); +echo $response; + +--EXPECT-- +Is string \ No newline at end of file diff --git a/ext/xmlrpc/tests/007.phpt b/ext/xmlrpc/tests/007.phpt new file mode 100644 index 0000000000000..84c15a7d8a36c --- /dev/null +++ b/ext/xmlrpc/tests/007.phpt @@ -0,0 +1,29 @@ +--TEST-- +xmlrpc_decode() Simple test decode type int + +--CREDITS-- +Michel Araujo +#PHPSP 2013-08-22 + +--SKIPIF-- + + +--FILE-- + + + + + 1 + + + +XML; + +$response = xmlrpc_decode($xml); +echo $response; + +--EXPECT-- +1 \ No newline at end of file diff --git a/ext/zip/CREDITS b/ext/zip/CREDITS index 6c7e42d417160..59b7ef097e531 100644 --- a/ext/zip/CREDITS +++ b/ext/zip/CREDITS @@ -1,2 +1,2 @@ Zip -Pierre-Alain Joye +Pierre-Alain Joye, Remi Collet diff --git a/ext/zip/LICENSE_libzip b/ext/zip/LICENSE_libzip new file mode 100644 index 0000000000000..9b2fda07b1054 --- /dev/null +++ b/ext/zip/LICENSE_libzip @@ -0,0 +1,27 @@ +Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner +The authors can be contacted at + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. +3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/ext/zip/config.m4 b/ext/zip/config.m4 index 805d92442e017..83e32feca76ee 100644 --- a/ext/zip/config.m4 +++ b/ext/zip/config.m4 @@ -11,10 +11,14 @@ if test -z "$PHP_ZLIB_DIR"; then fi PHP_ARG_WITH(pcre-dir, pcre install prefix, -[ --with-pcre-dir ZIP: pcre install prefix], no, no) +[ --with-pcre-dir ZIP: pcre install prefix], no, no) + +PHP_ARG_WITH(libzip, libzip, +[ --with-libzip[=DIR] ZIP: use libzip], no, no) if test "$PHP_ZIP" != "no"; then + dnl libzip, depends on zlib if test "$PHP_ZLIB_DIR" != "no" && test "$PHP_ZLIB_DIR" != "yes"; then if test -f "$PHP_ZLIB_DIR/include/zlib/zlib.h"; then PHP_ZLIB_DIR="$PHP_ZLIB_DIR" @@ -47,61 +51,124 @@ if test "$PHP_ZIP" != "no"; then PHP_ADD_INCLUDE($PHP_ZLIB_INCDIR) fi - dnl This is PECL build, check if bundled PCRE library is used - old_CPPFLAGS=$CPPFLAGS - CPPFLAGS=$INCLUDES - AC_EGREP_CPP(yes,[ -#include
-#if defined(HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE) -yes -#endif - ],[ - PHP_PCRE_REGEX=yes - ],[ - AC_EGREP_CPP(yes,[ -#include
-#if defined(HAVE_PCRE) && !defined(COMPILE_DL_PCRE) -yes -#endif - ],[ - PHP_PCRE_REGEX=pecl - ],[ - PHP_PCRE_REGEX=no + if test "$PHP_LIBZIP" != "no"; then + + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + + dnl system libzip, depends on libzip + AC_MSG_CHECKING(for libzip) + if test -r $PHP_LIBZIP/include/zip.h; then + LIBZIP_CFLAGS="-I$PHP_LIBZIP/include" + LIBZIP_LIBDIR="$PHP_LIBZIP/$PHP_LIBDIR" + AC_MSG_RESULT(from option: found in $PHP_LIBZIP) + + elif test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libzip; then + LIBZIP_CFLAGS=`$PKG_CONFIG libzip --cflags` + LIBZIP_LIBDIR=`$PKG_CONFIG libzip --variable=libdir` + AC_MSG_RESULT(from pkgconfig: found in $LIBZIP_LIBDIR) + + else + for i in /usr/local /usr; do + if test -r $i/include/zip.h; then + LIBZIP_CFLAGS="-I$i/include" + LIBZIP_LIBDIR="$i/$PHP_LIBDIR" + AC_MSG_RESULT(in default path: found in $i) + break + fi + done + fi + + if test -z "$LIBZIP_LIBDIR"; then + AC_MSG_RESULT(not found) + AC_MSG_ERROR(Please reinstall the libzip distribution) + fi + + dnl Could not think of a simple way to check libzip for overwrite support + PHP_CHECK_LIBRARY(zip, zip_open, + [ + PHP_ADD_LIBRARY_WITH_PATH(zip, $LIBZIP_LIBDIR, ZIP_SHARED_LIBADD) + AC_DEFINE(HAVE_LIBZIP,1,[ ]) + ], [ + AC_MSG_ERROR(could not find usable libzip) + ], [ + -L$LIBZIP_LIBDIR ]) - ]) - CPPFLAGS=$old_CPPFLAGS - - PHP_ZIP_SOURCES="$PHP_ZIP_SOURCES lib/zip_add.c lib/zip_error.c lib/zip_fclose.c \ - lib/zip_fread.c lib/zip_open.c lib/zip_source_filep.c \ - lib/zip_strerror.c lib/zip_close.c lib/zip_error_get.c \ - lib/zip_file_error_get.c lib/zip_free.c lib/zip_rename.c \ - lib/zip_source_free.c lib/zip_unchange_all.c lib/zip_delete.c \ - lib/zip_error_get_sys_type.c lib/zip_file_get_offset.c \ - lib/zip_get_name.c lib/zip_replace.c lib/zip_source_function.c \ - lib/zip_unchange.c lib/zip_dirent.c lib/zip_error_strerror.c \ - lib/zip_filerange_crc.c lib/zip_file_strerror.c lib/zip_get_num_files.c \ - lib/zip_get_archive_flag.c lib/zip_set_archive_flag.c \ - lib/zip_set_name.c lib/zip_source_zip.c lib/zip_unchange_data.c \ - lib/zip_entry_free.c lib/zip_error_to_str.c lib/zip_fopen.c \ - lib/zip_name_locate.c lib/zip_source_buffer.c lib/zip_stat.c \ - lib/zip_entry_new.c lib/zip_err_str.c lib/zip_fopen_index.c \ - lib/zip_get_archive_comment.c lib/zip_get_file_comment.c \ - lib/zip_new.c lib/zip_source_file.c lib/zip_stat_index.c \ - lib/zip_set_archive_comment.c lib/zip_set_file_comment.c \ - lib/zip_unchange_archive.c lib/zip_memdup.c lib/zip_stat_init.c lib/zip_add_dir.c \ - lib/zip_error_clear.c lib/zip_file_error_clear.c \ - lib/zip_fdopen.c lib/zip_fopen_encrypted.c lib/zip_fopen_index_encrypted.c \ - lib/zip_get_compression_implementation.c lib/zip_get_encryption_implementation.c \ - lib/zip_get_file_extra.c lib/zip_get_num_entries.c lib/zip_set_default_password.c \ - lib/zip_set_file_extra.c lib/zip_source_close.c lib/zip_source_crc.c \ - lib/zip_source_deflate.c lib/zip_source_error.c lib/zip_source_layered.c \ - lib/zip_source_open.c lib/zip_source_pkware.c lib/zip_source_pop.c \ - lib/zip_source_read.c lib/zip_source_stat.c" + + AC_DEFINE(HAVE_ZIP,1,[ ]) + PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c, $ext_shared,, $LIBZIP_CFLAGS) + PHP_SUBST(ZIP_SHARED_LIBADD) + else + + + PHP_ZIP_SOURCES="$PHP_ZIP_SOURCES lib/zip_add.c lib/zip_add_dir.c lib/zip_add_entry.c\ + lib/zip_close.c lib/zip_delete.c lib/zip_dir_add.c lib/zip_dirent.c lib/zip_discard.c lib/zip_entry.c\ + lib/zip_err_str.c lib/zip_error.c lib/zip_error_clear.c lib/zip_error_get.c lib/zip_error_get_sys_type.c\ + lib/zip_error_strerror.c lib/zip_error_to_str.c lib/zip_extra_field.c lib/zip_extra_field_api.c\ + lib/zip_fclose.c lib/zip_fdopen.c lib/zip_file_add.c lib/zip_file_error_clear.c lib/zip_file_error_get.c\ + lib/zip_file_get_comment.c lib/zip_file_get_offset.c lib/zip_file_rename.c lib/zip_file_replace.c\ + lib/zip_file_set_comment.c lib/zip_file_strerror.c lib/zip_filerange_crc.c lib/zip_fopen.c\ + lib/zip_fopen_encrypted.c lib/zip_fopen_index.c lib/zip_fopen_index_encrypted.c lib/zip_fread.c\ + lib/zip_get_archive_comment.c lib/zip_get_archive_flag.c lib/zip_get_compression_implementation.c\ + lib/zip_get_encryption_implementation.c lib/zip_get_file_comment.c lib/zip_get_name.c lib/zip_get_num_entries.c \ + lib/zip_get_num_files.c lib/zip_memdup.c lib/zip_name_locate.c lib/zip_new.c lib/zip_open.c lib/zip_rename.c lib/zip_replace.c\ + lib/zip_set_archive_comment.c lib/zip_set_archive_flag.c lib/zip_set_default_password.c lib/zip_set_file_comment.c\ + lib/zip_set_file_compression.c lib/zip_set_name.c lib/zip_source_buffer.c lib/zip_source_close.c lib/zip_source_crc.c\ + lib/zip_source_deflate.c lib/zip_source_error.c lib/zip_source_file.c lib/zip_source_filep.c lib/zip_source_free.c\ + lib/zip_source_function.c lib/zip_source_layered.c lib/zip_source_open.c lib/zip_source_pkware.c lib/zip_source_pop.c\ + lib/zip_source_read.c lib/zip_source_stat.c lib/zip_source_window.c lib/zip_source_zip.c lib/zip_source_zip_new.c\ + lib/zip_stat.c lib/zip_stat_index.c lib/zip_stat_init.c lib/zip_strerror.c lib/zip_string.c lib/zip_unchange.c lib/zip_unchange_all.c\ + lib/zip_unchange_archive.c lib/zip_unchange_data.c lib/zip_utf-8.c lib/mkstemp.c" AC_DEFINE(HAVE_ZIP,1,[ ]) PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c $PHP_ZIP_SOURCES, $ext_shared) PHP_ADD_BUILD_DIR($ext_builddir/lib, 1) PHP_SUBST(ZIP_SHARED_LIBADD) +fi + + +AC_CHECK_TYPES([int8_t]) +AC_CHECK_TYPES([int16_t]) +AC_CHECK_TYPES([int32_t]) +AC_CHECK_TYPES([int64_t]) +AC_CHECK_TYPES([uint8_t]) +AC_CHECK_TYPES([uint16_t]) +AC_CHECK_TYPES([uint32_t]) +AC_CHECK_TYPES([uint64_t]) +AC_CHECK_TYPES([ssize_t]) + +AC_CHECK_SIZEOF([short]) +AC_CHECK_SIZEOF([int]) +AC_CHECK_SIZEOF([long]) +AC_CHECK_SIZEOF([long long]) +AC_CHECK_SIZEOF([off_t]) +AC_CHECK_SIZEOF([size_t]) + +AC_PATH_PROG([TOUCH], [touch]) +AC_PATH_PROG([UNZIP], [unzip]) + +AC_STRUCT_TIMEZONE + +case $host_os +in + *bsd*) MANFMT=mdoc;; + *) MANFMT=man;; +esac +AC_SUBST([MANFMT]) + +AH_BOTTOM([ +#ifndef HAVE_SSIZE_T +# if SIZEOF_SIZE_T == SIZEOF_INT +typedef int ssize_t; +# elif SIZEOF_SIZE_T == SIZEOF_LONG +typedef long ssize_t; +# elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG +typedef long long ssize_t; +# else +#error no suitable type for ssize_t found +# endif +#endif +]) + dnl so we always include the known-good working hack. PHP_ADD_MAKEFILE_FRAGMENT diff --git a/ext/zip/config.w32 b/ext/zip/config.w32 index fa0a5180df5ce..5b9f09575a769 100644 --- a/ext/zip/config.w32 +++ b/ext/zip/config.w32 @@ -9,36 +9,28 @@ if (PHP_ZIP != "no") { (PHP_ZLIB_SHARED && CHECK_LIB("zlib.lib", "zip", PHP_ZIP)) || (PHP_ZLIB == "yes" && (!PHP_ZLIB_SHARED))) ) { EXTENSION('zip', 'php_zip.c zip_stream.c'); - ADD_SOURCES(configure_module_dirname + "/lib", "zip_add.c zip_error.c zip_fclose.c \ - zip_fread.c zip_open.c zip_source_filep.c \ - zip_strerror.c zip_close.c zip_error_get.c \ - zip_file_error_get.c zip_free.c zip_rename.c \ - zip_source_free.c zip_unchange_all.c zip_delete.c \ - zip_error_get_sys_type.c zip_file_get_offset.c \ - zip_get_name.c zip_replace.c zip_source_function.c \ - zip_unchange.c zip_dirent.c zip_error_strerror.c \ - zip_filerange_crc.c zip_file_strerror.c zip_get_num_files.c \ - zip_get_archive_flag.c zip_set_archive_flag.c \ - zip_set_name.c zip_source_zip.c zip_unchange_data.c \ - zip_entry_free.c zip_error_to_str.c zip_fopen.c \ - zip_name_locate.c zip_source_buffer.c zip_stat.c \ - zip_entry_new.c zip_err_str.c zip_fopen_index.c \ - zip_new.c zip_source_file.c zip_stat_index.c \ - zip_get_archive_comment.c zip_get_file_comment.c \ - zip_set_archive_comment.c zip_set_file_comment.c \ - zip_unchange_archive.c zip_memdup.c zip_stat_init.c \ - zip_add_dir.c zip_file_error_clear.c zip_error_clear.c \ - zip_fdopen.c zip_fopen_encrypted.c zip_fopen_index_encrypted.c \ - zip_get_compression_implementation.c zip_get_encryption_implementation.c \ - zip_get_file_extra.c zip_get_num_entries.c zip_set_default_password.c \ - zip_set_file_extra.c zip_source_close.c zip_source_crc.c \ - zip_source_deflate.c zip_source_error.c zip_source_layered.c \ - zip_source_open.c zip_source_pkware.c zip_source_pop.c \ - zip_source_read.c zip_source_stat.c", "zip"); + ADD_SOURCES(configure_module_dirname + "/lib", "zip_add.c zip_add_dir.c zip_add_entry.c\ + zip_close.c zip_delete.c zip_dir_add.c zip_dirent.c zip_discard.c zip_entry.c\ + zip_err_str.c zip_error.c zip_error_clear.c zip_error_get.c zip_error_get_sys_type.c\ + zip_error_strerror.c zip_error_to_str.c zip_extra_field.c zip_extra_field_api.c\ + zip_fclose.c zip_fdopen.c zip_file_add.c zip_file_error_clear.c zip_file_error_get.c\ + zip_file_get_comment.c zip_file_get_offset.c zip_file_rename.c zip_file_replace.c\ + zip_file_set_comment.c zip_file_strerror.c zip_filerange_crc.c zip_fopen.c\ + zip_fopen_encrypted.c zip_fopen_index.c zip_fopen_index_encrypted.c zip_fread.c\ + zip_get_archive_comment.c zip_get_archive_flag.c zip_get_compression_implementation.c\ + zip_get_encryption_implementation.c zip_get_file_comment.c zip_get_name.c zip_get_num_entries.c \ + zip_get_num_files.c zip_memdup.c zip_name_locate.c zip_new.c zip_open.c zip_rename.c zip_replace.c\ + zip_set_archive_comment.c zip_set_archive_flag.c zip_set_default_password.c zip_set_file_comment.c\ + zip_set_file_compression.c zip_set_name.c zip_source_buffer.c zip_source_close.c zip_source_crc.c\ + zip_source_deflate.c zip_source_error.c zip_source_file.c zip_source_filep.c zip_source_free.c\ + zip_source_function.c zip_source_layered.c zip_source_open.c zip_source_pkware.c zip_source_pop.c\ + zip_source_read.c zip_source_stat.c zip_source_window.c zip_source_zip.c zip_source_zip_new.c\ + zip_stat.c zip_stat_index.c zip_stat_init.c zip_strerror.c zip_string.c zip_unchange.c zip_unchange_all.c\ + zip_unchange_archive.c zip_unchange_data.c zip_utf-8.c mkstemp.c", "zip"); AC_DEFINE('HAVE_ZIP', 1); + ADD_FLAG("CFLAGS_ZIP", "/D _WIN32"); } else { WARNING("zip not enabled; libraries and headers not found"); } } - diff --git a/ext/zip/examples/addglob.php b/ext/zip/examples/addglob.php new file mode 100644 index 0000000000000..790312b4d586a --- /dev/null +++ b/ext/zip/examples/addglob.php @@ -0,0 +1,14 @@ +open('a.zip', ZIPARCHIVE::CREATE); + +/* or 'remove_all_path' => 0*/ +$options = array( + 'remove_path' => '/home/francis/myimages', + 'add_path' => 'images/', +); +$found = $z->addGlob("/home/pierre/cvs/gd/libgd/tests/*.png", 0, $options); +var_dump($found); +$z->close(); + diff --git a/ext/zip/examples/addpattern.php b/ext/zip/examples/addpattern.php new file mode 100644 index 0000000000000..a1a9b122914e5 --- /dev/null +++ b/ext/zip/examples/addpattern.php @@ -0,0 +1,13 @@ +open('a.zip', ZIPARCHIVE::CREATE); + +/* or 'remove_all_path' => 0*/ +$options = array('remove_path' => '/home/pierre/cvs/gd/libgd/tests', +'add_path' => 'images/', +); + +$found = $z->addPattern("/(\.png)$/i", "/home/pierre/cvs/gd/libgd/tests", $options); +var_dump($found); +$z->close(); + diff --git a/ext/zip/lib/mkstemp.c b/ext/zip/lib/mkstemp.c new file mode 100644 index 0000000000000..843d5e3613143 --- /dev/null +++ b/ext/zip/lib/mkstemp.c @@ -0,0 +1,151 @@ +/* Adapted from NetBSB libc by Dieter Baron */ + +/* NetBSD: gettemp.c,v 1.13 2003/12/05 00:57:36 uebayasi Exp */ + +/* + * Copyright (c) 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +#include +#include +#include +#include +#ifdef _WIN32 +#include +#endif +#include +#include + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + + + +int +_zip_mkstemp(char *path) +{ +#ifdef _WIN32 + int ret; + ret = _creat(_mktemp(path), _S_IREAD|_S_IWRITE); + if (ret == -1) { + return 0; + } else { + return ret; + } +#else + int fd; + char *start, *trv; + struct stat sbuf; + pid_t pid; + + /* To guarantee multiple calls generate unique names even if + the file is not created. 676 different possibilities with 7 + or more X's, 26 with 6 or less. */ + static char xtra[2] = "aa"; + int xcnt = 0; + + pid = getpid(); + + /* Move to end of path and count trailing X's. */ + for (trv = path; *trv; ++trv) + if (*trv == 'X') + xcnt++; + else + xcnt = 0; + + /* Use at least one from xtra. Use 2 if more than 6 X's. */ + if (*(trv - 1) == 'X') + *--trv = xtra[0]; + if (xcnt > 6 && *(trv - 1) == 'X') + *--trv = xtra[1]; + + /* Set remaining X's to pid digits with 0's to the left. */ + while (*--trv == 'X') { + *trv = (pid % 10) + '0'; + pid /= 10; + } + + /* update xtra for next call. */ + if (xtra[0] != 'z') + xtra[0]++; + else { + xtra[0] = 'a'; + if (xtra[1] != 'z') + xtra[1]++; + else + xtra[1] = 'a'; + } + + /* + * check the target directory; if you have six X's and it + * doesn't exist this runs for a *very* long time. + */ + for (start = trv + 1;; --trv) { + if (trv <= path) + break; + if (*trv == '/') { + *trv = '\0'; + if (stat(path, &sbuf)) + return (0); + if (!S_ISDIR(sbuf.st_mode)) { + errno = ENOTDIR; + return (0); + } + *trv = '/'; + break; + } + } + + for (;;) { + if ((fd=open(path, O_CREAT|O_EXCL|O_RDWR|O_BINARY, 0600)) >= 0) + return (fd); + if (errno != EEXIST) + return (0); + + /* tricky little algorithm for backward compatibility */ + for (trv = start;;) { + if (!*trv) + return (0); + if (*trv == 'z') + *trv++ = 'a'; + else { + if (isdigit((unsigned char)*trv)) + *trv = 'a'; + else + ++*trv; + break; + } + } + } + /*NOTREACHED*/ +#endif +} diff --git a/ext/zip/lib/php_zip_config.w32.h b/ext/zip/lib/php_zip_config.w32.h new file mode 100644 index 0000000000000..8956839c62c32 --- /dev/null +++ b/ext/zip/lib/php_zip_config.w32.h @@ -0,0 +1,57 @@ +#ifndef HAD_CONFIG_H +#define HAD_CONFIG_H +#define HAVE__CLOSE +#define HAVE__DUP +#define HAVE__FDOPEN +#define HAVE__FILENO +#define HAVE__OPEN +#define HAVE__SNPRINTF +/* #undef HAVE__STRCMPI */ +#define HAVE__STRDUP +#define HAVE__STRICMP +/* #undef HAVE_FSEEKO */ +/* #undef HAVE_FTELLO */ +/* #undef HAVE_MKSTEMP */ +#define HAVE_MOVEFILEEXA +/* #undef HAVE_SNPRINTF */ +/* #undef HAVE_STRCASECMP */ +/* #undef HAVE_STRINGS_H */ +/* #undef HAVE_STRUCT_TM_TM_ZONE */ +/* #undef HAVE_UNISTD_H */ +#define PACKAGE "libzip" +#define VERSION "0.10.b" + +/* #undef HAVE_SSIZE_T */ + +#ifndef HAVE_SSIZE_T + +#ifndef SIZE_T_LIBZIP +#define SIZE_T_LIBZIP 4 +#endif +#ifndef INT_LIBZIP +#define INT_LIBZIP 4 +#endif +#ifndef LONG_LIBZIP +#define LONG_LIBZIP 4 +#endif +#ifndef LONG_LONG_LIBZIP +#define LONG_LONG_LIBZIP 8 +#endif +#ifndef SIZEOF_OFF_T +#define SIZEOF_OFF_T 4 +#endif + +# if SIZE_T_LIBZIP == INT_LIBZIP +# ifndef ssize_t +typedef int ssize_t; +# endif +# elif SIZE_T_LIBZIP == LONG_LIBZIP +typedef long ssize_t; +# elif SIZE_T_LIBZIP == LONG_LONG_LIBZIP +typedef long long ssize_t; +# else +#error no suitable type for ssize_t found +# endif +#endif + +#endif /* HAD_CONFIG_H */ diff --git a/ext/zip/lib/zip.h b/ext/zip/lib/zip.h index f11c9aba7f99c..1fb1dbf5e0f5b 100644 --- a/ext/zip/lib/zip.h +++ b/ext/zip/lib/zip.h @@ -3,7 +3,7 @@ /* zip.h -- exported declarations. - Copyright (C) 1999-2011 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2012 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -38,18 +38,30 @@ #include "main/php.h" #ifdef PHP_WIN32 -# include "zip_win32.h" -# ifdef PHP_ZIP_EXPORTS -# define ZIP_EXTERN(rt) __declspec(dllexport)rt _stdcall -# else -# define ZIP_EXTERN(rt) rt -# endif +#ifdef PHP_ZIP_EXPORTS +# define ZIP_EXTERN __declspec(dllexport) _stdcall +# else +# define ZIP_EXTERN +# endif #elif defined(__GNUC__) && __GNUC__ >= 4 -# define ZIP_EXTERN(rt) __attribute__ ((visibility("default"))) rt +# define ZIP_EXTERN __attribute__ ((visibility("default"))) #else -# define ZIP_EXTERN(rt) rt +# define ZIP_EXTERN #endif + +#ifndef ZIP_EXTERN +#ifdef _WIN32 +#define ZIP_EXTERN __declspec(dllimport) +#elif defined(__GNUC__) && __GNUC__ >= 4 +#define ZIP_EXTERN __attribute__ ((visibility ("default"))) +#else +#define ZIP_EXTERN +#endif +#endif + + + BEGIN_EXTERN_C() #include "zipconf.h" @@ -63,27 +75,40 @@ BEGIN_EXTERN_C() #define ZIP_CREATE 1 #define ZIP_EXCL 2 #define ZIP_CHECKCONS 4 -#define ZIP_OVERWRITE 8 - +#define ZIP_TRUNCATE 8 /* flags for zip_name_locate, zip_fopen, zip_stat, ... */ -#define ZIP_FL_NOCASE 1 /* ignore case on name lookup */ -#define ZIP_FL_NODIR 2 /* ignore directory component */ -#define ZIP_FL_COMPRESSED 4 /* read compressed data */ -#define ZIP_FL_UNCHANGED 8 /* use original data, ignoring changes */ -#define ZIP_FL_RECOMPRESS 16 /* force recompression of data */ -#define ZIP_FL_ENCRYPTED 32 /* read encrypted data - (implies ZIP_FL_COMPRESSED) */ +#define ZIP_FL_NOCASE 1u /* ignore case on name lookup */ +#define ZIP_FL_NODIR 2u /* ignore directory component */ +#define ZIP_FL_COMPRESSED 4u /* read compressed data */ +#define ZIP_FL_UNCHANGED 8u /* use original data, ignoring changes */ +#define ZIP_FL_RECOMPRESS 16u /* force recompression of data */ +#define ZIP_FL_ENCRYPTED 32u /* read encrypted data (implies ZIP_FL_COMPRESSED) */ +#define ZIP_FL_ENC_GUESS 0u /* guess string encoding (is default) */ +#define ZIP_FL_ENC_RAW 64u /* get unmodified string */ +#define ZIP_FL_ENC_STRICT 128u /* follow specification strictly */ +#define ZIP_FL_LOCAL 256u /* in local header */ +#define ZIP_FL_CENTRAL 512u /* in central directory */ +/* 1024u reserved for internal use */ +#define ZIP_FL_ENC_UTF_8 2048u /* string is UTF-8 encoded */ +#define ZIP_FL_ENC_CP437 4096u /* string is CP437 encoded */ +#define ZIP_FL_OVERWRITE 8192u /* zip_file_add: if file with name exists, overwrite (replace) it */ /* archive global flags flags */ -#define ZIP_AFL_TORRENT 1 /* torrent zipped */ -#define ZIP_AFL_RDONLY 2 /* read only -- cannot be cleared */ +#define ZIP_AFL_TORRENT 1u /* torrent zipped */ +#define ZIP_AFL_RDONLY 2u /* read only -- cannot be cleared */ + +/* create a new extra field */ + +#define ZIP_EXTRA_FIELD_ALL ZIP_UINT16_MAX +#define ZIP_EXTRA_FIELD_NEW ZIP_UINT16_MAX /* flags for compression and encryption sources */ +#define ZIP_CODEC_DECODE 0 /* decompress/decrypt (encode flag not set) */ #define ZIP_CODEC_ENCODE 1 /* compress/encrypt */ @@ -178,15 +203,15 @@ enum zip_source_cmd { #define ZIP_SOURCE_ERR_LOWER -2 -#define ZIP_STAT_NAME 0x0001 -#define ZIP_STAT_INDEX 0x0002 -#define ZIP_STAT_SIZE 0x0004 -#define ZIP_STAT_COMP_SIZE 0x0008 -#define ZIP_STAT_MTIME 0x0010 -#define ZIP_STAT_CRC 0x0020 -#define ZIP_STAT_COMP_METHOD 0x0040 -#define ZIP_STAT_ENCRYPTION_METHOD 0x0080 -#define ZIP_STAT_FLAGS 0x0100 +#define ZIP_STAT_NAME 0x0001u +#define ZIP_STAT_INDEX 0x0002u +#define ZIP_STAT_SIZE 0x0004u +#define ZIP_STAT_COMP_SIZE 0x0008u +#define ZIP_STAT_MTIME 0x0010u +#define ZIP_STAT_CRC 0x0020u +#define ZIP_STAT_COMP_METHOD 0x0040u +#define ZIP_STAT_ENCRYPTION_METHOD 0x0080u +#define ZIP_STAT_FLAGS 0x0100u struct zip_stat { zip_uint64_t valid; /* which fields have valid values */ @@ -205,72 +230,78 @@ struct zip; struct zip_file; struct zip_source; +typedef zip_uint32_t zip_flags_t; + typedef zip_int64_t (*zip_source_callback)(void *, void *, zip_uint64_t, enum zip_source_cmd); -ZIP_EXTERN(zip_int64_t) zip_add(struct zip *, const char *, struct zip_source *); -ZIP_EXTERN(zip_int64_t) zip_add_dir(struct zip *, const char *); -ZIP_EXTERN(int) zip_close(struct zip *); -ZIP_EXTERN(int) zip_delete(struct zip *, zip_uint64_t); -ZIP_EXTERN(void) zip_error_clear(struct zip *); -ZIP_EXTERN(void) zip_error_get(struct zip *, int *, int *); -ZIP_EXTERN(int) zip_error_get_sys_type(int); -ZIP_EXTERN(int) zip_error_to_str(char *, zip_uint64_t, int, int); -ZIP_EXTERN(int) zip_fclose(struct zip_file *); -ZIP_EXTERN(struct zip *)zip_fdopen(int, int, int *); -ZIP_EXTERN(void) zip_file_error_clear(struct zip_file *); -ZIP_EXTERN(void) zip_file_error_get(struct zip_file *, int *, int *); -ZIP_EXTERN(const char *)zip_file_strerror(struct zip_file *); -ZIP_EXTERN(struct) zip_file *zip_fopen(struct zip *, const char *, int); -ZIP_EXTERN(struct) zip_file *zip_fopen_encrypted(struct zip *, const char *, - int, const char *); -ZIP_EXTERN(struct zip_file *)zip_fopen_index(struct zip *, zip_uint64_t, int); -ZIP_EXTERN(struct zip_file *)zip_fopen_index_encrypted(struct zip *, - zip_uint64_t, int, - const char *); -ZIP_EXTERN(zip_int64_t) zip_fread(struct zip_file *, void *, zip_uint64_t); -ZIP_EXTERN(const char *)zip_get_archive_comment(struct zip *, int *, int); -ZIP_EXTERN(int) zip_get_archive_flag(struct zip *, int, int); -ZIP_EXTERN(const char *)zip_get_file_comment(struct zip *, zip_uint64_t, - int *, int); -ZIP_EXTERN(const char *)zip_get_file_extra(struct zip *, zip_uint64_t, - int *, int); -ZIP_EXTERN(const char *)zip_get_name(struct zip *, zip_uint64_t, int); -ZIP_EXTERN(zip_uint64_t) zip_get_num_entries(struct zip *, int); -ZIP_EXTERN(int) zip_get_num_files(struct zip *); /* deprecated, use zip_get_num_entries instead */ -ZIP_EXTERN(int) zip_name_locate(struct zip *, const char *, int); -ZIP_EXTERN(struct zip *)zip_open(const char *, int, int *); -ZIP_EXTERN(int) zip_rename(struct zip *, zip_uint64_t, const char *); -ZIP_EXTERN(int) zip_replace(struct zip *, zip_uint64_t, struct zip_source *); -ZIP_EXTERN(int) zip_set_archive_comment(struct zip *, const char *, int); -ZIP_EXTERN(int) zip_set_archive_flag(struct zip *, int, int); -ZIP_EXTERN(int) zip_set_default_password(struct zip *, const char *); -ZIP_EXTERN(int) zip_set_file_comment(struct zip *, zip_uint64_t, - const char *, int); -ZIP_EXTERN(int) zip_set_file_extra(struct zip *, zip_uint64_t, - const char *, int); -ZIP_EXTERN(struct) zip_source *zip_source_buffer(struct zip *, const void *, - zip_uint64_t, int); -ZIP_EXTERN(struct) zip_source *zip_source_file(struct zip *, const char *, - zip_uint64_t, zip_int64_t); -ZIP_EXTERN(struct) zip_source *zip_source_filep(struct zip *, FILE *, - zip_uint64_t, zip_int64_t); -ZIP_EXTERN(void) zip_source_free(struct zip_source *); -ZIP_EXTERN(struct zip_source *)zip_source_function(struct zip *, - zip_source_callback, void *); -ZIP_EXTERN(struct zip_source *)zip_source_zip(struct zip *, struct zip *, - zip_uint64_t, int, - zip_uint64_t, zip_int64_t); -ZIP_EXTERN(int) zip_stat(struct zip *, const char *, int, struct zip_stat *); -ZIP_EXTERN(int) zip_stat_index(struct zip *, zip_uint64_t, int, - struct zip_stat *); -ZIP_EXTERN(void) zip_stat_init(struct zip_stat *); -ZIP_EXTERN(const char *)zip_strerror(struct zip *); -ZIP_EXTERN(int) zip_unchange(struct zip *, zip_uint64_t); -ZIP_EXTERN(int) zip_unchange_all(struct zip *); -ZIP_EXTERN(int) zip_unchange_archive(struct zip *); +#ifndef ZIP_DISABLE_DEPRECATED +ZIP_EXTERN zip_int64_t zip_add(struct zip *, const char *, struct zip_source *); /* use zip_file_add */ +ZIP_EXTERN zip_int64_t zip_add_dir(struct zip *, const char *); /* use zip_dir_add */ +ZIP_EXTERN const char *zip_get_file_comment(struct zip *, zip_uint64_t, int *, int); /* use zip_file_get_comment */ +ZIP_EXTERN int zip_get_num_files(struct zip *); /* use zip_get_num_entries instead */ +ZIP_EXTERN int zip_rename(struct zip *, zip_uint64_t, const char *); /* use zip_file_rename */ +ZIP_EXTERN int zip_replace(struct zip *, zip_uint64_t, struct zip_source *); /* use zip_file_replace */ +ZIP_EXTERN int zip_set_file_comment(struct zip *, zip_uint64_t, const char *, int); /* use zip_file_set_comment */ +#endif + +ZIP_EXTERN int zip_archive_set_tempdir(struct zip *, const char *); +ZIP_EXTERN zip_int64_t zip_file_add(struct zip *, const char *, struct zip_source *, zip_flags_t); +ZIP_EXTERN zip_int64_t zip_dir_add(struct zip *, const char *, zip_flags_t); +ZIP_EXTERN int zip_close(struct zip *); +ZIP_EXTERN void zip_discard(struct zip *); +ZIP_EXTERN int zip_delete(struct zip *, zip_uint64_t); +ZIP_EXTERN int zip_file_extra_field_delete(struct zip *, zip_uint64_t, zip_uint16_t, zip_flags_t); +ZIP_EXTERN int zip_file_extra_field_delete_by_id(struct zip *, zip_uint64_t, zip_uint16_t, zip_uint16_t, zip_flags_t); +ZIP_EXTERN void zip_error_clear(struct zip *); +ZIP_EXTERN void zip_error_get(struct zip *, int *, int *); +ZIP_EXTERN int zip_error_get_sys_type(int); +ZIP_EXTERN int zip_error_to_str(char *, zip_uint64_t, int, int); +ZIP_EXTERN int zip_fclose(struct zip_file *); +ZIP_EXTERN struct zip *zip_fdopen(int, int, int *); +ZIP_EXTERN void zip_file_error_clear(struct zip_file *); +ZIP_EXTERN void zip_file_error_get(struct zip_file *, int *, int *); +ZIP_EXTERN const char *zip_file_strerror(struct zip_file *); +ZIP_EXTERN struct zip_file *zip_fopen(struct zip *, const char *, zip_flags_t); +ZIP_EXTERN struct zip_file *zip_fopen_encrypted(struct zip *, const char *, zip_flags_t, const char *); +ZIP_EXTERN struct zip_file *zip_fopen_index(struct zip *, zip_uint64_t, zip_flags_t); +ZIP_EXTERN struct zip_file *zip_fopen_index_encrypted(struct zip *, zip_uint64_t, zip_flags_t, const char *); +ZIP_EXTERN zip_int64_t zip_fread(struct zip_file *, void *, zip_uint64_t); +ZIP_EXTERN const char *zip_get_archive_comment(struct zip *, int *, zip_flags_t); +ZIP_EXTERN int zip_get_archive_flag(struct zip *, zip_flags_t, zip_flags_t); +ZIP_EXTERN const char *zip_file_get_comment(struct zip *, zip_uint64_t, zip_uint32_t *, zip_flags_t); +ZIP_EXTERN const zip_uint8_t *zip_file_extra_field_get(struct zip *, zip_uint64_t, zip_uint16_t, zip_uint16_t *, zip_uint16_t *, zip_flags_t); +ZIP_EXTERN const zip_uint8_t *zip_file_extra_field_get_by_id(struct zip *, zip_uint64_t, zip_uint16_t, zip_uint16_t, zip_uint16_t *, zip_flags_t); +ZIP_EXTERN zip_int16_t zip_file_extra_fields_count(struct zip *, zip_uint64_t, zip_flags_t); +ZIP_EXTERN zip_int16_t zip_file_extra_fields_count_by_id(struct zip *, zip_uint64_t, zip_uint16_t, zip_flags_t); +ZIP_EXTERN const char *zip_get_name(struct zip *, zip_uint64_t, zip_flags_t); +ZIP_EXTERN zip_int64_t zip_get_num_entries(struct zip *, zip_flags_t); +ZIP_EXTERN zip_int64_t zip_name_locate(struct zip *, const char *, zip_flags_t); +ZIP_EXTERN struct zip *zip_open(const char *, int, int *); +ZIP_EXTERN int zip_file_rename(struct zip *, zip_uint64_t, const char *, zip_flags_t); +ZIP_EXTERN int zip_file_replace(struct zip *, zip_uint64_t, struct zip_source *, zip_flags_t); +ZIP_EXTERN int zip_set_archive_comment(struct zip *, const char *, zip_uint16_t); +ZIP_EXTERN int zip_set_archive_flag(struct zip *, zip_flags_t, int); +ZIP_EXTERN int zip_set_default_password(struct zip *, const char *); +ZIP_EXTERN int zip_file_set_comment(struct zip *, zip_uint64_t, const char *, zip_uint16_t, zip_flags_t); +ZIP_EXTERN int zip_set_file_compression(struct zip *, zip_uint64_t, zip_int32_t, zip_uint32_t); +ZIP_EXTERN int zip_file_extra_field_set(struct zip *, zip_uint64_t, zip_uint16_t, zip_uint16_t, const zip_uint8_t *, zip_uint16_t, zip_flags_t); +ZIP_EXTERN struct zip_source *zip_source_buffer(struct zip *, const void *, zip_uint64_t, int); +ZIP_EXTERN struct zip_source *zip_source_file(struct zip *, const char *, zip_uint64_t, zip_int64_t); +ZIP_EXTERN struct zip_source *zip_source_filep(struct zip *, FILE *, zip_uint64_t, zip_int64_t); +ZIP_EXTERN void zip_source_free(struct zip_source *); +ZIP_EXTERN struct zip_source *zip_source_function(struct zip *, zip_source_callback, void *); +ZIP_EXTERN struct zip_source *zip_source_zip(struct zip *, struct zip *, zip_uint64_t, zip_flags_t, zip_uint64_t, zip_int64_t); +ZIP_EXTERN int zip_stat(struct zip *, const char *, zip_flags_t, struct zip_stat *); +ZIP_EXTERN int zip_stat_index(struct zip *, zip_uint64_t, zip_flags_t, struct zip_stat *); +ZIP_EXTERN void zip_stat_init(struct zip_stat *); +ZIP_EXTERN const char *zip_strerror(struct zip *); +ZIP_EXTERN int zip_unchange(struct zip *, zip_uint64_t); +ZIP_EXTERN int zip_unchange_all(struct zip *); +ZIP_EXTERN int zip_unchange_archive(struct zip *); + END_EXTERN_C(); #endif /* _HAD_ZIP_H */ diff --git a/ext/zip/lib/zip_add.c b/ext/zip/lib/zip_add.c index 6067abbac491f..4bce3fd4af274 100644 --- a/ext/zip/lib/zip_add.c +++ b/ext/zip/lib/zip_add.c @@ -1,6 +1,6 @@ /* zip_add.c -- add file via callback function - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2012 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -33,6 +33,7 @@ +#define _ZIP_COMPILING_DEPRECATED #include "zipint.h" @@ -44,13 +45,8 @@ ZIP_UINT64_MAX, and each entry is larger than 2 bytes. */ -ZIP_EXTERN(zip_int64_t) +ZIP_EXTERN zip_int64_t zip_add(struct zip *za, const char *name, struct zip_source *source) { - if (name == NULL || source == NULL) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return -1; - } - - return _zip_replace(za, ZIP_UINT64_MAX, name, source); + return zip_file_add(za, name, source, 0); } diff --git a/ext/zip/lib/zip_add_dir.c b/ext/zip/lib/zip_add_dir.c index 0a9d7f4863011..22a28bd856253 100644 --- a/ext/zip/lib/zip_add_dir.c +++ b/ext/zip/lib/zip_add_dir.c @@ -1,6 +1,6 @@ /* zip_add_dir.c -- add directory - Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2013 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -33,56 +33,15 @@ -#include -#include - +#define _ZIP_COMPILING_DEPRECATED #include "zipint.h" /* NOTE: Signed due to -1 on error. See zip_add.c for more details. */ -ZIP_EXTERN(zip_int64_t) +ZIP_EXTERN zip_int64_t zip_add_dir(struct zip *za, const char *name) { - int len; - zip_int64_t ret; - char *s; - struct zip_source *source; - - if (ZIP_IS_RDONLY(za)) { - _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); - return -1; - } - - if (name == NULL) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return -1; - } - - s = NULL; - len = strlen(name); - - if (name[len-1] != '/') { - if ((s=(char *)malloc(len+2)) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - return -1; - } - strcpy(s, name); - s[len] = '/'; - s[len+1] = '\0'; - } - - if ((source=zip_source_buffer(za, NULL, 0, 0)) == NULL) { - free(s); - return -1; - } - - ret = _zip_replace(za, -1, s ? s : name, source); - - free(s); - if (ret < 0) - zip_source_free(source); - - return ret; + return zip_dir_add(za, name, 0); } diff --git a/ext/zip/lib/zip_add_entry.c b/ext/zip/lib/zip_add_entry.c new file mode 100644 index 0000000000000..3a7e2ccbe920f --- /dev/null +++ b/ext/zip/lib/zip_add_entry.c @@ -0,0 +1,66 @@ +/* + zip_add_entry.c -- create and init struct zip_entry + Copyright (C) 1999-2012 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include + +#include "zipint.h" + + + +/* NOTE: Signed due to -1 on error. See zip_add.c for more details. */ + +zip_int64_t +_zip_add_entry(struct zip *za) +{ + zip_uint64_t idx; + + if (za->nentry+1 >= za->nentry_alloc) { + struct zip_entry *rentries; + zip_uint64_t nalloc = za->nentry_alloc + 16; + rentries = (struct zip_entry *)realloc(za->entry, sizeof(struct zip_entry) * nalloc); + if (!rentries) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + za->entry = rentries; + za->nentry_alloc = nalloc; + } + + idx = za->nentry++; + + _zip_entry_init(za->entry+idx); + + return (zip_int64_t)idx; +} diff --git a/ext/zip/lib/zip_close.c b/ext/zip/lib/zip_close.c index 576be3b3536fb..c9c7e58088644 100644 --- a/ext/zip/lib/zip_close.c +++ b/ext/zip/lib/zip_close.c @@ -38,6 +38,9 @@ #include #include #include +#ifdef HAVE_STRINGS_H +#include +#endif #include #ifdef HAVE_UNISTD_H #include @@ -49,110 +52,106 @@ #include #endif -static int add_data(struct zip *, struct zip_source *, struct zip_dirent *, - FILE *); -static int copy_data(FILE *, off_t, FILE *, struct zip_error *); + + +/* max deflate size increase: size + ceil(size/16k)*5+6 */ +#define MAX_DEFLATE_SIZE_32 4293656963u + +static int add_data(struct zip *, struct zip_source *, struct zip_dirent *, FILE *); +static int copy_data(FILE *, zip_uint64_t, FILE *, struct zip_error *); static int copy_source(struct zip *, struct zip_source *, FILE *); -static int write_cdir(struct zip *, struct zip_cdir *, FILE *); -static int _zip_cdir_set_comment(struct zip_cdir *, struct zip *); +static int write_cdir(struct zip *, const struct zip_filelist *, zip_uint64_t, FILE *); static char *_zip_create_temp_output(struct zip *, FILE **); static int _zip_torrentzip_cmp(const void *, const void *); -struct filelist { - int idx; - const char *name; -}; - - - -ZIP_EXTERN(int) +ZIP_EXTERN int zip_close(struct zip *za) { - int survivors; - int i, j, error; + zip_uint64_t i, j, survivors; + int error; char *temp; FILE *out; #ifndef PHP_WIN32 mode_t mask; #endif - struct zip_cdir *cd; - struct zip_dirent de; - struct filelist *filelist; + struct zip_filelist *filelist; int reopen_on_error; int new_torrentzip; + int changed; reopen_on_error = 0; if (za == NULL) return -1; - if (!_zip_changed(za, &survivors)) { - _zip_free(za); - return 0; - } + changed = _zip_changed(za, &survivors); /* don't create zip files with no entries */ if (survivors == 0) { - if (za->zn && za->zp) { + if (za->zn && ((za->open_flags & ZIP_TRUNCATE) || (changed && za->zp))) { if (remove(za->zn) != 0) { _zip_error_set(&za->error, ZIP_ER_REMOVE, errno); return -1; } } - _zip_free(za); + zip_discard(za); return 0; } - if ((filelist=(struct filelist *)malloc(sizeof(filelist[0])*survivors)) - == NULL) - return -1; - - if ((cd=_zip_cdir_new(survivors, &za->error)) == NULL) { - free(filelist); - return -1; + if (!changed) { + zip_discard(za); + return 0; } - for (i=0; ientry[i]); + if (survivors > za->nentry) { + _zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); + return -1; + } + + if ((filelist=(struct zip_filelist *)malloc(sizeof(filelist[0])*survivors)) == NULL) + return -1; /* archive comment is special for torrentzip */ if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) { - cd->comment = _zip_memdup(TORRENT_SIG "XXXXXXXX", - TORRENT_SIG_LEN + TORRENT_CRC_LEN, - &za->error); - if (cd->comment == NULL) { - _zip_cdir_free(cd); - free(filelist); - return -1; - } - cd->comment_len = TORRENT_SIG_LEN + TORRENT_CRC_LEN; - } - else if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, ZIP_FL_UNCHANGED) == 0) { - if (_zip_cdir_set_comment(cd, za) == -1) { - _zip_cdir_free(cd); + /* XXX: use internal function when zip_set_archive_comment clears TORRENT flag */ + if (zip_set_archive_comment(za, TORRENT_SIG "XXXXXXXX", TORRENT_SIG_LEN + TORRENT_CRC_LEN) < 0) { free(filelist); return -1; } } - - if ((temp=_zip_create_temp_output(za, &out)) == NULL) { - _zip_cdir_free(cd); - free(filelist); - return -1; - } + /* XXX: if no longer torrentzip and archive comment not changed by user, delete it */ /* create list of files with index into original archive */ for (i=j=0; inentry; i++) { - if (za->entry[i].state == ZIP_ST_DELETED) + if (za->entry[i].deleted) continue; + if (j >= survivors) { + free(filelist); + _zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); + return -1; + } + filelist[j].idx = i; filelist[j].name = zip_get_name(za, i, 0); j++; } + if (j < survivors) { + free(filelist); + _zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); + return -1; + } + + + if ((temp=_zip_create_temp_output(za, &out)) == NULL) { + free(filelist); + return -1; + } + + if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) qsort(filelist, survivors, sizeof(filelist[0]), _zip_torrentzip_cmp); @@ -162,106 +161,49 @@ zip_close(struct zip *za) ZIP_FL_UNCHANGED) == 0); error = 0; for (j=0; jentry+i; - _zip_dirent_init(&de); + new_data = (ZIP_ENTRY_DATA_CHANGED(entry) || new_torrentzip || ZIP_ENTRY_CHANGED(entry, ZIP_DIRENT_COMP_METHOD)); /* create new local directory entry */ - if (ZIP_ENTRY_DATA_CHANGED(za->entry+i) || new_torrentzip) { - - if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) - _zip_dirent_torrent_normalize(&de); - - /* use it as central directory entry */ - memcpy(cd->entry+j, &de, sizeof(cd->entry[j])); - - /* set/update file name */ - if (za->entry[i].ch_filename == NULL) { - if (za->entry[i].state == ZIP_ST_ADDED) { - de.filename = strdup("-"); - de.filename_len = 1; - cd->entry[j].filename = "-"; - cd->entry[j].filename_len = 1; - } - else { - de.filename = strdup(za->cdir->entry[i].filename); - de.filename_len = strlen(de.filename); - cd->entry[j].filename = za->cdir->entry[i].filename; - cd->entry[j].filename_len = de.filename_len; - } + if (entry->changes == NULL) { + if ((entry->changes=_zip_dirent_clone(entry->orig)) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + error = 1; + break; } } - else { - /* copy existing directory entries */ - if ((NULL == za->zp) || (fseeko(za->zp, za->cdir->entry[i].offset, SEEK_SET) != 0)) { - _zip_error_set(&za->error, ZIP_ER_SEEK, errno); - error = 1; - break; - } - if (_zip_dirent_read(&de, za->zp, NULL, NULL, 1, - &za->error) != 0) { - error = 1; - break; - } - memcpy(cd->entry+j, za->cdir->entry+i, sizeof(cd->entry[j])); - if (de.bitflags & ZIP_GPBF_DATA_DESCRIPTOR) { - de.crc = za->cdir->entry[i].crc; - de.comp_size = za->cdir->entry[i].comp_size; - de.uncomp_size = za->cdir->entry[i].uncomp_size; - de.bitflags &= ~ZIP_GPBF_DATA_DESCRIPTOR; - cd->entry[j].bitflags &= ~ZIP_GPBF_DATA_DESCRIPTOR; - } - } + de = entry->changes; - if (za->entry[i].ch_filename) { - free(de.filename); - if ((de.filename=strdup(za->entry[i].ch_filename)) == NULL) { - error = 1; - break; - } - de.filename_len = strlen(de.filename); - cd->entry[j].filename = za->entry[i].ch_filename; - cd->entry[j].filename_len = de.filename_len; + if (_zip_read_local_ef(za, i) < 0) { + error = 1; + break; } - if (za->entry[i].ch_extra_len != -1) { - free(de.extrafield); - if ((de.extrafield=malloc(za->entry[i].ch_extra_len)) == NULL) { - error = 1; - break; - } - memcpy(de.extrafield, za->entry[i].ch_extra, za->entry[i].ch_extra_len); - de.extrafield_len = za->entry[i].ch_extra_len; - /* as the rest of cd entries, its malloc/free is done by za */ - /* TODO unsure if this should also be set in the CD -- - * not done for now - cd->entry[j].extrafield = za->entry[i].ch_extra; - cd->entry[j].extrafield_len = za->entry[i].ch_extra_len; - */ - } + if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) + _zip_dirent_torrent_normalize(entry->changes); - if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0) == 0 - && za->entry[i].ch_comment_len != -1) { - /* as the rest of cd entries, its malloc/free is done by za */ - cd->entry[j].comment = za->entry[i].ch_comment; - cd->entry[j].comment_len = za->entry[i].ch_comment_len; - } - cd->entry[j].offset = ftello(out); + de->offset = (zip_uint64_t)ftello(out); /* XXX: check for errors */ - if (ZIP_ENTRY_DATA_CHANGED(za->entry+i) || new_torrentzip) { + if (new_data) { struct zip_source *zs; zs = NULL; - if (!ZIP_ENTRY_DATA_CHANGED(za->entry+i)) { - if ((zs=zip_source_zip(za, za, i, ZIP_FL_RECOMPRESS, 0, -1)) - == NULL) { + if (!ZIP_ENTRY_DATA_CHANGED(entry)) { + if ((zs=_zip_source_zip_new(za, za, i, ZIP_FL_UNCHANGED, 0, 0, NULL)) == NULL) { error = 1; break; } } - if (add_data(za, zs ? zs : za->entry[i].source, &de, out) < 0) { + /* add_data writes dirent */ + if (add_data(za, zs ? zs : entry->source, de, out) < 0) { error = 1; if (zs) zip_source_free(zs); @@ -269,51 +211,49 @@ zip_close(struct zip *za) } if (zs) zip_source_free(zs); - - cd->entry[j].last_mod = de.last_mod; - cd->entry[j].comp_method = de.comp_method; - cd->entry[j].comp_size = de.comp_size; - cd->entry[j].uncomp_size = de.uncomp_size; - cd->entry[j].crc = de.crc; } else { - if (_zip_dirent_write(&de, out, 1, &za->error) < 0) { + zip_uint64_t offset; + + /* when copying data, all sizes are known -> no data descriptor needed */ + de->bitflags &= ~ZIP_GPBF_DATA_DESCRIPTOR; + if (_zip_dirent_write(de, out, ZIP_FL_LOCAL, &za->error) < 0) { error = 1; break; } - /* we just read the local dirent, file is at correct position */ - if (copy_data(za->zp, cd->entry[j].comp_size, out, - &za->error) < 0) { + if ((offset=_zip_file_get_offset(za, i, &za->error)) == 0) { + error = 1; + break; + } + if ((fseek(za->zp, (off_t)offset, SEEK_SET) < 0)) { + _zip_error_set(&za->error, ZIP_ER_SEEK, errno); + error = 1; + break; + } + if (copy_data(za->zp, de->comp_size, out, &za->error) < 0) { error = 1; break; } } - - _zip_dirent_finalize(&de); } - free(filelist); - if (!error) { - if (write_cdir(za, cd, out) < 0) + if (write_cdir(za, filelist, survivors, out) < 0) error = 1; } - /* pointers in cd entries are owned by za */ - cd->nentry = 0; - _zip_cdir_free(cd); + free(filelist); if (error) { - _zip_dirent_finalize(&de); fclose(out); - remove(temp); + (void)remove(temp); free(temp); return -1; } if (fclose(out) != 0) { _zip_error_set(&za->error, ZIP_ER_CLOSE, errno); - remove(temp); + (void)remove(temp); free(temp); return -1; } @@ -325,7 +265,7 @@ zip_close(struct zip *za) } if (_zip_rename(temp, za->zn) != 0) { _zip_error_set(&za->error, ZIP_ER_RENAME, errno); - remove(temp); + (void)remove(temp); free(temp); if (reopen_on_error) { /* ignore errors, since we're already in an error case */ @@ -339,56 +279,112 @@ zip_close(struct zip *za) chmod(za->zn, 0666&~mask); #endif - _zip_free(za); - free(temp); - + zip_discard(za); + free(temp); + return 0; } static int -add_data(struct zip *za, struct zip_source *src, struct zip_dirent *de, - FILE *ft) +add_data(struct zip *za, struct zip_source *src, struct zip_dirent *de, FILE *ft) { off_t offstart, offdata, offend; struct zip_stat st; struct zip_source *s2; - zip_compression_implementation comp_impl; int ret; + int is_zip64; + zip_flags_t flags; if (zip_source_stat(src, &st) < 0) { _zip_error_set_from_source(&za->error, src); return -1; } + if ((st.valid & ZIP_STAT_COMP_METHOD) == 0) { + st.valid |= ZIP_STAT_COMP_METHOD; + st.comp_method = ZIP_CM_STORE; + } + + if (ZIP_CM_IS_DEFAULT(de->comp_method) && st.comp_method != ZIP_CM_STORE) + de->comp_method = st.comp_method; + else if (de->comp_method == ZIP_CM_STORE && (st.valid & ZIP_STAT_SIZE)) { + st.valid |= ZIP_STAT_COMP_SIZE; + st.comp_size = st.size; + } + else { + /* we'll recompress */ + st.valid &= ~ZIP_STAT_COMP_SIZE; + } + + + flags = ZIP_EF_LOCAL; + + if ((st.valid & ZIP_STAT_SIZE) == 0) + flags |= ZIP_FL_FORCE_ZIP64; + else { + de->uncomp_size = st.size; + + if ((st.valid & ZIP_STAT_COMP_SIZE) == 0) { + if (( ((de->comp_method == ZIP_CM_DEFLATE || ZIP_CM_IS_DEFAULT(de->comp_method)) && st.size > MAX_DEFLATE_SIZE_32) + || (de->comp_method != ZIP_CM_STORE && de->comp_method != ZIP_CM_DEFLATE && !ZIP_CM_IS_DEFAULT(de->comp_method)))) + flags |= ZIP_FL_FORCE_ZIP64; + } + else + de->comp_size = st.comp_size; + } + + offstart = ftello(ft); - if (_zip_dirent_write(de, ft, 1, &za->error) < 0) + /* as long as we don't support non-seekable output, clear data descriptor bit */ + de->bitflags &= ~ZIP_GPBF_DATA_DESCRIPTOR; + if ((is_zip64=_zip_dirent_write(de, ft, flags, &za->error)) < 0) return -1; - if ((s2=zip_source_crc(za, src, 0)) == NULL) { - zip_source_pop(s2); - return -1; - } - - /* XXX: deflate 0-byte files for torrentzip? */ - if (((st.valid & ZIP_STAT_COMP_METHOD) == 0 - || st.comp_method == ZIP_CM_STORE) - && ((st.valid & ZIP_STAT_SIZE) == 0 || st.size != 0)) { - comp_impl = NULL; - if ((comp_impl=zip_get_compression_implementation(ZIP_CM_DEFLATE)) - == NULL) { - _zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0); - zip_source_pop(s2); - return -1; + + if (st.comp_method == ZIP_CM_STORE || (ZIP_CM_IS_DEFAULT(de->comp_method) && st.comp_method != de->comp_method)) { + struct zip_source *s_store, *s_crc; + zip_compression_implementation comp_impl; + + if (st.comp_method != ZIP_CM_STORE) { + if ((comp_impl=_zip_get_compression_implementation(st.comp_method)) == NULL) { + _zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0); + return -1; + } + if ((s_store=comp_impl(za, src, st.comp_method, ZIP_CODEC_DECODE)) == NULL) { + /* error set by comp_impl */ + return -1; + } } - if ((s2=comp_impl(za, s2, ZIP_CM_DEFLATE, ZIP_CODEC_ENCODE)) - == NULL) { - /* XXX: set error? */ - zip_source_pop(s2); + else + s_store = src; + + if ((s_crc=zip_source_crc(za, s_store, 0)) == NULL) { + if (s_store != src) + zip_source_pop(s_store); return -1; } + + /* XXX: deflate 0-byte files for torrentzip? */ + if (de->comp_method != ZIP_CM_STORE && ((st.valid & ZIP_STAT_SIZE) == 0 || st.size != 0)) { + if ((comp_impl=_zip_get_compression_implementation(de->comp_method)) == NULL) { + _zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0); + zip_source_pop(s_crc); + if (s_store != src) + zip_source_pop(s_store); + return -1; + } + if ((s2=comp_impl(za, s_crc, de->comp_method, ZIP_CODEC_ENCODE)) == NULL) { + zip_source_pop(s_crc); + if (s_store != src) + zip_source_pop(s_store); + return -1; + } + } + else + s2 = s_crc; } else s2 = src; @@ -418,18 +414,33 @@ add_data(struct zip *za, struct zip_source *src, struct zip_dirent *de, return -1; } - de->last_mod = st.mtime; + if ((st.valid & (ZIP_STAT_COMP_METHOD|ZIP_STAT_CRC|ZIP_STAT_SIZE)) != (ZIP_STAT_COMP_METHOD|ZIP_STAT_CRC|ZIP_STAT_SIZE)) { + _zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); + return -1; + } + + if (st.valid & ZIP_STAT_MTIME) + de->last_mod = st.mtime; + else + time(&de->last_mod); de->comp_method = st.comp_method; de->crc = st.crc; de->uncomp_size = st.size; - de->comp_size = offend - offdata; + de->comp_size = (zip_uint64_t)(offend - offdata); if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) _zip_dirent_torrent_normalize(de); - if (_zip_dirent_write(de, ft, 1, &za->error) < 0) + if ((ret=_zip_dirent_write(de, ft, flags, &za->error)) < 0) return -1; - + + if (is_zip64 != ret) { + /* Zip64 mismatch between preliminary file header written before data and final file header written afterwards */ + _zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); + return -1; + } + + if (fseeko(ft, offend, SEEK_SET) < 0) { _zip_error_set(&za->error, ZIP_ER_SEEK, errno); return -1; @@ -441,24 +452,26 @@ add_data(struct zip *za, struct zip_source *src, struct zip_dirent *de, static int -copy_data(FILE *fs, off_t len, FILE *ft, struct zip_error *error) +copy_data(FILE *fs, zip_uint64_t len, FILE *ft, struct zip_error *error) { char buf[BUFSIZE]; - int n, nn; + size_t n, nn; if (len == 0) return 0; while (len > 0) { nn = len > sizeof(buf) ? sizeof(buf) : len; - if ((n=fread(buf, 1, nn, fs)) < 0) { - _zip_error_set(error, ZIP_ER_READ, errno); - return -1; - } - else if (n == 0) { - _zip_error_set(error, ZIP_ER_EOF, 0); - return -1; - } + if ((n=fread(buf, 1, nn, fs)) == 0) { + if (ferror(fs)) { + _zip_error_set(error, ZIP_ER_READ, errno); + return -1; + } + else { + _zip_error_set(error, ZIP_ER_EOF, 0); + return -1; + } + } if (fwrite(buf, 1, n, ft) != (size_t)n) { _zip_error_set(error, ZIP_ER_WRITE, errno); @@ -487,7 +500,7 @@ copy_source(struct zip *za, struct zip_source *src, FILE *ft) ret = 0; while ((n=zip_source_read(src, buf, sizeof(buf))) > 0) { - if (fwrite(buf, 1, n, ft) != (size_t)n) { + if (fwrite(buf, 1, (size_t)n, ft) != (size_t)n) { _zip_error_set(&za->error, ZIP_ER_WRITE, errno); ret = -1; break; @@ -508,29 +521,32 @@ copy_source(struct zip *za, struct zip_source *src, FILE *ft) static int -write_cdir(struct zip *za, struct zip_cdir *cd, FILE *out) +write_cdir(struct zip *za, const struct zip_filelist *filelist, zip_uint64_t survivors, FILE *out) { - off_t offset; + off_t cd_start, end; + zip_int64_t size; uLong crc; char buf[TORRENT_CRC_LEN+1]; - if (_zip_cdir_write(cd, out, &za->error) < 0) + cd_start = ftello(out); + + if ((size=_zip_cdir_write(za, filelist, survivors, out)) < 0) return -1; + end = ftello(out); + if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0) == 0) return 0; /* fix up torrentzip comment */ - offset = ftello(out); - - if (_zip_filerange_crc(out, cd->offset, cd->size, &crc, &za->error) < 0) + if (_zip_filerange_crc(out, cd_start, size, &crc, &za->error) < 0) return -1; snprintf(buf, sizeof(buf), "%08lX", (long)crc); - if (fseeko(out, offset-TORRENT_CRC_LEN, SEEK_SET) < 0) { + if (fseeko(out, end-TORRENT_CRC_LEN, SEEK_SET) < 0) { _zip_error_set(&za->error, ZIP_ER_SEEK, errno); return -1; } @@ -545,47 +561,22 @@ write_cdir(struct zip *za, struct zip_cdir *cd, FILE *out) -static int -_zip_cdir_set_comment(struct zip_cdir *dest, struct zip *src) -{ - if (src->ch_comment_len != -1) { - dest->comment = _zip_memdup(src->ch_comment, - src->ch_comment_len, &src->error); - if (dest->comment == NULL) - return -1; - dest->comment_len = src->ch_comment_len; - } else { - if (src->cdir && src->cdir->comment) { - dest->comment = _zip_memdup(src->cdir->comment, - src->cdir->comment_len, &src->error); - if (dest->comment == NULL) - return -1; - dest->comment_len = src->cdir->comment_len; - } - } - - return 0; -} - - - int -_zip_changed(struct zip *za, int *survivorsp) +_zip_changed(const struct zip *za, zip_uint64_t *survivorsp) { - int changed, i, survivors; + int changed; + zip_uint64_t i, survivors; - changed = survivors = 0; + changed = 0; + survivors = 0; - if (za->ch_comment_len != -1 - || za->ch_flags != za->flags) + if (za->comment_changed || za->ch_flags != za->flags) changed = 1; for (i=0; inentry; i++) { - if ((za->entry[i].state != ZIP_ST_UNCHANGED) - || (za->entry[i].ch_extra_len != -1) - || (za->entry[i].ch_comment_len != -1)) + if (za->entry[i].deleted || za->entry[i].source || (za->entry[i].changes && za->entry[i].changes->changed != 0)) changed = 1; - if (za->entry[i].state != ZIP_ST_DELETED) + if (!za->entry[i].deleted) survivors++; } @@ -603,14 +594,21 @@ _zip_create_temp_output(struct zip *za, FILE **outp) char *temp; int tfd; FILE *tfp; - int len = strlen(za->zn) + 8; - - if ((temp=(char *)malloc(len)) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - return NULL; + + if (za->tempdir) { + if ((temp=(char *)malloc(strlen(za->tempdir)+13)) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return NULL; + } + sprintf(temp, "%s/.zip.XXXXXX", za->tempdir); + } + else { + if ((temp=(char *)malloc(strlen(za->zn)+8)) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return NULL; + } + sprintf(temp, "%s.XXXXXX", za->zn); } - - snprintf(temp, len, "%s.XXXXXX", za->zn); if ((tfd=mkstemp(temp)) == -1) { _zip_error_set(&za->error, ZIP_ER_TMPOPEN, errno); @@ -621,7 +619,7 @@ _zip_create_temp_output(struct zip *za, FILE **outp) if ((tfp=fdopen(tfd, "r+b")) == NULL) { _zip_error_set(&za->error, ZIP_ER_TMPOPEN, errno); close(tfd); - remove(temp); + (void)remove(temp); free(temp); return NULL; } @@ -630,7 +628,7 @@ _zip_create_temp_output(struct zip *za, FILE **outp) According to Pierre Joye, Windows in some environments per default creates text files, so force binary mode. */ - _setmode(_fileno(tfp), _O_BINARY ); + _setmode(_fileno(tfp), _O_BINARY ); #endif *outp = tfp; @@ -642,6 +640,13 @@ _zip_create_temp_output(struct zip *za, FILE **outp) static int _zip_torrentzip_cmp(const void *a, const void *b) { - return strcasecmp(((const struct filelist *)a)->name, - ((const struct filelist *)b)->name); + const char *aname = ((const struct zip_filelist *)a)->name; + const char *bname = ((const struct zip_filelist *)b)->name; + + if (aname == NULL) + return (bname != NULL) * -1; + else if (bname == NULL) + return 1; + + return strcasecmp(aname, bname); } diff --git a/ext/zip/lib/zip_delete.c b/ext/zip/lib/zip_delete.c index 131d444124c4b..cb769367cc6f6 100644 --- a/ext/zip/lib/zip_delete.c +++ b/ext/zip/lib/zip_delete.c @@ -37,7 +37,7 @@ -ZIP_EXTERN(int) +ZIP_EXTERN int zip_delete(struct zip *za, zip_uint64_t idx) { if (idx >= za->nentry) { @@ -55,7 +55,7 @@ zip_delete(struct zip *za, zip_uint64_t idx) if (_zip_unchange(za, idx, 1) != 0) return -1; - za->entry[idx].state = ZIP_ST_DELETED; + za->entry[idx].deleted = 1; return 0; } diff --git a/ext/zip/lib/zip_entry_new.c b/ext/zip/lib/zip_dir_add.c similarity index 61% rename from ext/zip/lib/zip_entry_new.c rename to ext/zip/lib/zip_dir_add.c index ad5d59975a927..0a74bd608764e 100644 --- a/ext/zip/lib/zip_entry_new.c +++ b/ext/zip/lib/zip_dir_add.c @@ -1,6 +1,6 @@ /* - zip_entry_new.c -- create and init struct zip_entry - Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner + zip_dir_add.c -- add directory + Copyright (C) 1999-2012 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -34,48 +34,55 @@ #include +#include #include "zipint.h" -struct zip_entry * -_zip_entry_new(struct zip *za) +/* NOTE: Signed due to -1 on error. See zip_add.c for more details. */ + +ZIP_EXTERN zip_int64_t +zip_dir_add(struct zip *za, const char *name, zip_flags_t flags) { - struct zip_entry *ze; - if (!za) { - ze = (struct zip_entry *)malloc(sizeof(struct zip_entry)); - if (!ze) { - return NULL; - } + size_t len; + zip_int64_t ret; + char *s; + struct zip_source *source; + + if (ZIP_IS_RDONLY(za)) { + _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; } - else { - if (za->nentry+1 >= za->nentry_alloc) { - struct zip_entry *rentries; - za->nentry_alloc += 16; - rentries = (struct zip_entry *)realloc(za->entry, - sizeof(struct zip_entry) - * za->nentry_alloc); - if (!rentries) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - return NULL; - } - za->entry = rentries; - } - ze = za->entry+za->nentry; + + if (name == NULL) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; } - ze->state = ZIP_ST_UNCHANGED; + s = NULL; + len = strlen(name); - ze->ch_filename = NULL; - ze->ch_extra = NULL; - ze->ch_extra_len = -1; - ze->ch_comment = NULL; - ze->ch_comment_len = -1; - ze->source = NULL; + if (name[len-1] != '/') { + if ((s=(char *)malloc(len+2)) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + strcpy(s, name); + s[len] = '/'; + s[len+1] = '\0'; + } + + if ((source=zip_source_buffer(za, NULL, 0, 0)) == NULL) { + free(s); + return -1; + } + + ret = _zip_file_replace(za, ZIP_UINT64_MAX, s ? s : name, source, flags); - if (za) - za->nentry++; + free(s); + if (ret < 0) + zip_source_free(source); - return ze; + return ret; } diff --git a/ext/zip/lib/zip_dirent.c b/ext/zip/lib/zip_dirent.c index b9dac5c989e32..f4f2deb6fc5b9 100644 --- a/ext/zip/lib/zip_dirent.c +++ b/ext/zip/lib/zip_dirent.c @@ -1,6 +1,6 @@ /* zip_dirent.c -- read directory entry (local or central), clean dirent - Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2013 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -42,48 +42,54 @@ #include "zipint.h" -static time_t _zip_d2u_time(int, int); -static char *_zip_readfpstr(FILE *, unsigned int, int, struct zip_error *); -static char *_zip_readstr(unsigned char **, int, int, struct zip_error *); -static void _zip_write2(unsigned short, FILE *); -static void _zip_write4(unsigned int, FILE *); +static time_t _zip_d2u_time(zip_uint16_t, zip_uint16_t); +static struct zip_string *_zip_read_string(const unsigned char **, FILE *, zip_uint16_t, int, struct zip_error *); +static struct zip_string *_zip_dirent_process_ef_utf_8(const struct zip_dirent *, zip_uint16_t, struct zip_string *); +static struct zip_extra_field *_zip_ef_utf8(zip_uint16_t, struct zip_string *, struct zip_error *); void _zip_cdir_free(struct zip_cdir *cd) { - int i; + zip_uint64_t i; if (!cd) return; for (i=0; inentry; i++) - _zip_dirent_finalize(cd->entry+i); - free(cd->comment); + _zip_entry_finalize(cd->entry+i); free(cd->entry); + _zip_string_free(cd->comment); free(cd); } int -_zip_cdir_grow(struct zip_cdir *cd, int nentry, struct zip_error *error) +_zip_cdir_grow(struct zip_cdir *cd, zip_uint64_t nentry, struct zip_error *error) { - struct zip_dirent *entry; + struct zip_entry *entry; + zip_uint64_t i; - if (nentry < cd->nentry) { + if (nentry < cd->nentry_alloc) { _zip_error_set(error, ZIP_ER_INTERNAL, 0); return -1; } - if ((entry=((struct zip_dirent *) + if (nentry == cd->nentry_alloc) + return 0; + + if ((entry=((struct zip_entry *) realloc(cd->entry, sizeof(*(cd->entry))*nentry))) == NULL) { _zip_error_set(error, ZIP_ER_MEMORY, 0); return -1; } + + for (i=cd->nentry_alloc; inentry = nentry; + cd->nentry_alloc = nentry; cd->entry = entry; return 0; @@ -92,64 +98,132 @@ _zip_cdir_grow(struct zip_cdir *cd, int nentry, struct zip_error *error) struct zip_cdir * -_zip_cdir_new(int nentry, struct zip_error *error) +_zip_cdir_new(zip_uint64_t nentry, struct zip_error *error) { struct zip_cdir *cd; + zip_uint64_t i; if ((cd=(struct zip_cdir *)malloc(sizeof(*cd))) == NULL) { _zip_error_set(error, ZIP_ER_MEMORY, 0); return NULL; } - if ((cd->entry=(struct zip_dirent *)malloc(sizeof(*(cd->entry))*nentry)) - == NULL) { + if (nentry == 0) + cd->entry = NULL; + else if ((cd->entry=(struct zip_entry *)malloc(sizeof(*(cd->entry))*nentry)) == NULL) { _zip_error_set(error, ZIP_ER_MEMORY, 0); free(cd); return NULL; } - /* entries must be initialized by caller */ + for (i=0; ientry+i); - cd->nentry = nentry; + cd->nentry = cd->nentry_alloc = nentry; cd->size = cd->offset = 0; cd->comment = NULL; - cd->comment_len = 0; return cd; } -int -_zip_cdir_write(struct zip_cdir *cd, FILE *fp, struct zip_error *error) +zip_int64_t +_zip_cdir_write(struct zip *za, const struct zip_filelist *filelist, zip_uint64_t survivors, FILE *fp) { - int i; + off_t off; + zip_uint64_t offset, size; + struct zip_string *comment; + zip_uint64_t i; + int is_zip64; + int ret; + + if ((off=ftello(fp)) < 0) { + _zip_error_set(&za->error, ZIP_ER_READ, errno); + return -1; + } + offset = (zip_uint64_t)off; - cd->offset = ftello(fp); + is_zip64 = 0; - for (i=0; inentry; i++) { - if (_zip_dirent_write(cd->entry+i, fp, 0, error) != 0) + for (i=0; ientry+filelist[i].idx; + + if ((ret=_zip_dirent_write(entry->changes ? entry->changes : entry->orig, fp, ZIP_FL_CENTRAL, &za->error)) < 0) return -1; + if (ret) + is_zip64 = 1; + } + + if ((off=ftello(fp)) < 0) { + _zip_error_set(&za->error, ZIP_ER_READ, errno); + return -1; + } + size = (zip_uint64_t)off - offset; + + if (offset > ZIP_UINT32_MAX || survivors > ZIP_UINT16_MAX) + is_zip64 = 1; + + if (is_zip64) { + fwrite(EOCD64_MAGIC, 1, 4, fp); + _zip_write8(EOCD64LEN-12, fp); + _zip_write2(45, fp); + _zip_write2(45, fp); + _zip_write4(0, fp); + _zip_write4(0, fp); + _zip_write8(survivors, fp); + _zip_write8(survivors, fp); + _zip_write8(size, fp); + _zip_write8(offset, fp); + + fwrite(EOCD64LOC_MAGIC, 1, 4, fp); + _zip_write4(0, fp); + _zip_write8(offset+size, fp); + _zip_write4(1, fp); + } - cd->size = ftello(fp) - cd->offset; - /* clearerr(fp); */ fwrite(EOCD_MAGIC, 1, 4, fp); _zip_write4(0, fp); - _zip_write2((unsigned short)cd->nentry, fp); - _zip_write2((unsigned short)cd->nentry, fp); - _zip_write4(cd->size, fp); - _zip_write4(cd->offset, fp); - _zip_write2(cd->comment_len, fp); - fwrite(cd->comment, 1, cd->comment_len, fp); + _zip_write2(survivors >= ZIP_UINT16_MAX ? ZIP_UINT16_MAX : (zip_uint16_t)survivors, fp); + _zip_write2(survivors >= ZIP_UINT16_MAX ? ZIP_UINT16_MAX : (zip_uint16_t)survivors, fp); + _zip_write4(size >= ZIP_UINT32_MAX ? ZIP_UINT32_MAX : (zip_uint32_t)size, fp); + _zip_write4(offset >= ZIP_UINT32_MAX ? ZIP_UINT32_MAX : (zip_uint32_t)offset, fp); + + comment = za->comment_changed ? za->comment_changes : za->comment_orig; + + _zip_write2(comment ? comment->length : 0, fp); + if (comment) + fwrite(comment->raw, 1, comment->length, fp); if (ferror(fp)) { - _zip_error_set(error, ZIP_ER_WRITE, errno); + _zip_error_set(&za->error, ZIP_ER_WRITE, errno); return -1; } - return 0; + return (zip_int64_t)size; +} + + + +struct zip_dirent * +_zip_dirent_clone(const struct zip_dirent *sde) +{ + struct zip_dirent *tde; + + if ((tde=(struct zip_dirent *)malloc(sizeof(*tde))) == NULL) + return NULL; + + if (sde) + memcpy(tde, sde, sizeof(*sde)); + else + _zip_dirent_init(tde); + + tde->changed = 0; + tde->cloned = 1; + + return tde; } @@ -157,18 +231,24 @@ _zip_cdir_write(struct zip_cdir *cd, FILE *fp, struct zip_error *error) void _zip_dirent_finalize(struct zip_dirent *zde) { - if (zde->filename_len > 0) { - free(zde->filename); - } - zde->filename = NULL; - if (zde->extrafield_len > 0) { - free(zde->extrafield); - } - zde->extrafield = NULL; - if (zde->comment_len > 0) { - free(zde->comment); - } - zde->comment = NULL; + if (!zde->cloned || zde->changed & ZIP_DIRENT_FILENAME) + _zip_string_free(zde->filename); + if (!zde->cloned || zde->changed & ZIP_DIRENT_EXTRA_FIELD) + _zip_ef_free(zde->extra_fields); + if (!zde->cloned || zde->changed & ZIP_DIRENT_COMMENT) + _zip_string_free(zde->comment); +} + + + +void +_zip_dirent_free(struct zip_dirent *zde) +{ + if (zde == NULL) + return; + + _zip_dirent_finalize(zde); + free(zde); } @@ -176,20 +256,21 @@ _zip_dirent_finalize(struct zip_dirent *zde) void _zip_dirent_init(struct zip_dirent *de) { - de->version_madeby = 0; + de->changed = 0; + de->local_extra_fields_read = 0; + de->cloned = 0; + + de->version_madeby = 20; de->version_needed = 20; /* 2.0 */ de->bitflags = 0; - de->comp_method = 0; + de->comp_method = ZIP_CM_DEFAULT; de->last_mod = 0; de->crc = 0; de->comp_size = 0; de->uncomp_size = 0; de->filename = NULL; - de->filename_len = 0; - de->extrafield = NULL; - de->extrafield_len = 0; + de->extra_fields = NULL; de->comment = NULL; - de->comment_len = 0; de->disk_number = 0; de->int_attrib = 0; de->ext_attrib = 0; @@ -198,6 +279,32 @@ _zip_dirent_init(struct zip_dirent *de) +int +_zip_dirent_needs_zip64(const struct zip_dirent *de, zip_flags_t flags) +{ + if (de->uncomp_size >= ZIP_UINT32_MAX || de->comp_size >= ZIP_UINT32_MAX + || ((flags & ZIP_FL_CENTRAL) && de->offset >= ZIP_UINT32_MAX)) + return 1; + + return 0; +} + + + +struct zip_dirent * +_zip_dirent_new(void) +{ + struct zip_dirent *de; + + if ((de=(struct zip_dirent *)malloc(sizeof(*de))) == NULL) + return NULL; + + _zip_dirent_init(de); + return de; +} + + + /* _zip_dirent_read(zde, fp, bufp, left, localp, error): Fills the zip directory entry zde. @@ -218,13 +325,14 @@ _zip_dirent_init(struct zip_dirent *de) int _zip_dirent_read(struct zip_dirent *zde, FILE *fp, - unsigned char **bufp, zip_uint32_t *leftp, int local, + const unsigned char **bufp, zip_uint64_t *leftp, int local, struct zip_error *error) { unsigned char buf[CDENTRYSIZE]; - unsigned char *cur; - unsigned short dostime, dosdate; + const unsigned char *cur; + zip_uint16_t dostime, dosdate; zip_uint32_t size; + zip_uint16_t filename_len, comment_len, ef_len; if (local) size = LENTRYSIZE; @@ -255,9 +363,10 @@ _zip_dirent_read(struct zip_dirent *zde, FILE *fp, } cur += 4; - + /* convert buffercontents to zip_dirent */ - + + _zip_dirent_init(zde); if (!local) zde->version_madeby = _zip_read2(&cur); else @@ -275,17 +384,17 @@ _zip_dirent_read(struct zip_dirent *zde, FILE *fp, zde->comp_size = _zip_read4(&cur); zde->uncomp_size = _zip_read4(&cur); - zde->filename_len = _zip_read2(&cur); - zde->extrafield_len = _zip_read2(&cur); + filename_len = _zip_read2(&cur); + ef_len = _zip_read2(&cur); if (local) { - zde->comment_len = 0; + comment_len = 0; zde->disk_number = 0; zde->int_attrib = 0; zde->ext_attrib = 0; zde->offset = 0; } else { - zde->comment_len = _zip_read2(&cur); + comment_len = _zip_read2(&cur); zde->disk_number = _zip_read2(&cur); zde->int_attrib = _zip_read2(&cur); zde->ext_attrib = _zip_read4(&cur); @@ -293,56 +402,102 @@ _zip_dirent_read(struct zip_dirent *zde, FILE *fp, } zde->filename = NULL; - zde->extrafield = NULL; + zde->extra_fields = NULL; zde->comment = NULL; - size += zde->filename_len+zde->extrafield_len+zde->comment_len; + size += filename_len+ef_len+comment_len; if (leftp && (*leftp < size)) { - _zip_error_set(error, ZIP_ER_NOZIP, 0); + _zip_error_set(error, ZIP_ER_INCONS, 0); return -1; } - if (bufp) { - if (zde->filename_len) { - zde->filename = _zip_readstr(&cur, zde->filename_len, 1, error); - if (!zde->filename) - return -1; - } + if (filename_len) { + zde->filename = _zip_read_string(bufp ? &cur : NULL, fp, filename_len, 1, error); + if (!zde->filename) + return -1; - if (zde->extrafield_len) { - zde->extrafield = _zip_readstr(&cur, zde->extrafield_len, 0, - error); - if (!zde->extrafield) + if (zde->bitflags & ZIP_GPBF_ENCODING_UTF_8) { + if (_zip_guess_encoding(zde->filename, ZIP_ENCODING_UTF8_KNOWN) == ZIP_ENCODING_ERROR) { + _zip_error_set(error, ZIP_ER_INCONS, 0); return -1; + } } + } - if (zde->comment_len) { - zde->comment = _zip_readstr(&cur, zde->comment_len, 0, error); - if (!zde->comment) - return -1; + if (ef_len) { + zip_uint8_t *ef = _zip_read_data(bufp ? &cur : NULL, fp, ef_len, 0, error); + + if (ef == NULL) + return -1; + if ((zde->extra_fields=_zip_ef_parse(ef, ef_len, local ? ZIP_EF_LOCAL : ZIP_EF_CENTRAL, error)) == NULL) { + free(ef); + return -1; } + free(ef); + if (local) + zde->local_extra_fields_read = 1; } - else { - if (zde->filename_len) { - zde->filename = _zip_readfpstr(fp, zde->filename_len, 1, error); - if (!zde->filename) - return -1; - } - if (zde->extrafield_len) { - zde->extrafield = _zip_readfpstr(fp, zde->extrafield_len, 0, - error); - if (!zde->extrafield) + if (comment_len) { + zde->comment = _zip_read_string(bufp ? &cur : NULL, fp, comment_len, 0, error); + if (!zde->comment) + return -1; + + if (zde->bitflags & ZIP_GPBF_ENCODING_UTF_8) { + if (_zip_guess_encoding(zde->comment, ZIP_ENCODING_UTF8_KNOWN) == ZIP_ENCODING_ERROR) { + _zip_error_set(error, ZIP_ER_INCONS, 0); return -1; + } } + } - if (zde->comment_len) { - zde->comment = _zip_readfpstr(fp, zde->comment_len, 0, error); - if (!zde->comment) - return -1; + zde->filename = _zip_dirent_process_ef_utf_8(zde, ZIP_EF_UTF_8_NAME, zde->filename); + zde->comment = _zip_dirent_process_ef_utf_8(zde, ZIP_EF_UTF_8_COMMENT, zde->comment); + + /* Zip64 */ + + if (zde->uncomp_size == ZIP_UINT32_MAX || zde->comp_size == ZIP_UINT32_MAX || zde->offset == ZIP_UINT32_MAX) { + zip_uint16_t got_len, needed_len; + const zip_uint8_t *ef = _zip_ef_get_by_id(zde->extra_fields, &got_len, ZIP_EF_ZIP64, 0, local ? ZIP_EF_LOCAL : ZIP_EF_CENTRAL, error); + /* XXX: if got_len == 0 && !ZIP64_EOCD: no error, 0xffffffff is valid value */ + if (ef == NULL) + return -1; + + + if (local) + needed_len = 16; + else + needed_len = ((zde->uncomp_size == ZIP_UINT32_MAX) + (zde->comp_size == ZIP_UINT32_MAX) + (zde->offset == ZIP_UINT32_MAX)) * 8 + + (zde->disk_number == ZIP_UINT16_MAX) * 4; + + if (got_len != needed_len) { + _zip_error_set(error, ZIP_ER_INCONS, 0); + return -1; } + + if (zde->uncomp_size == ZIP_UINT32_MAX) + zde->uncomp_size = _zip_read8(&ef); + else if (local) + ef += 8; + if (zde->comp_size == ZIP_UINT32_MAX) + zde->comp_size = _zip_read8(&ef); + if (!local) { + if (zde->offset == ZIP_UINT32_MAX) + zde->offset = _zip_read8(&ef); + if (zde->disk_number == ZIP_UINT16_MAX) + zde->disk_number = _zip_read4(&ef); + } + } + + if (!local) { + if (zde->offset > ZIP_OFF_MAX) { + _zip_error_set(error, ZIP_ER_SEEK, EFBIG); + return -1; + } } + + zde->extra_fields = _zip_ef_remove_internal(zde->extra_fields); if (bufp) *bufp = cur; @@ -354,6 +509,65 @@ _zip_dirent_read(struct zip_dirent *zde, FILE *fp, +static struct zip_string * +_zip_dirent_process_ef_utf_8(const struct zip_dirent *de, zip_uint16_t id, struct zip_string *str) +{ + zip_uint16_t ef_len; + zip_uint32_t ef_crc; + + const zip_uint8_t *ef = _zip_ef_get_by_id(de->extra_fields, &ef_len, id, 0, ZIP_EF_BOTH, NULL); + + if (ef == NULL || ef_len < 5 || ef[0] != 1) + return str; + + ef++; + ef_crc = _zip_read4(&ef); + + if (_zip_string_crc32(str) == ef_crc) { + struct zip_string *ef_str = _zip_string_new(ef, ef_len-5, ZIP_ENCODING_UTF8_KNOWN, NULL); + + if (ef_str != NULL) { + _zip_string_free(str); + str = ef_str; + } + } + + return str; +} + + + +zip_int32_t +_zip_dirent_size(FILE *f, zip_uint16_t flags, struct zip_error *error) +{ + zip_int32_t size; + int local = (flags & ZIP_EF_LOCAL); + int i; + unsigned char b[6]; + const unsigned char *p; + + size = local ? LENTRYSIZE : CDENTRYSIZE; + + if (fseek(f, local ? 26 : 28, SEEK_CUR) < 0) { + _zip_error_set(error, ZIP_ER_SEEK, errno); + return -1; + } + + if (fread(b, (local ? 4 : 6), 1, f) != 1) { + _zip_error_set(error, ZIP_ER_READ, errno); + return -1; + } + + p = b; + for (i=0; i<(local ? 2 : 3); i++) { + size += _zip_read2(&p); + } + + return size; +} + + + /* _zip_dirent_torrent_normalize(de); Set values suitable for torrentzip. */ @@ -399,84 +613,157 @@ _zip_dirent_torrent_normalize(struct zip_dirent *de) de->disk_number = 0; de->int_attrib = 0; de->ext_attrib = 0; - de->offset = 0; - free(de->extrafield); - de->extrafield = NULL; - de->extrafield_len = 0; - free(de->comment); + _zip_ef_free(de->extra_fields); + de->extra_fields = NULL; + _zip_string_free(de->comment); de->comment = NULL; - de->comment_len = 0; } -/* _zip_dirent_write(zde, fp, localp, error): +/* _zip_dirent_write(zde, fp, flags, error): Writes zip directory entry zde to file fp. - If localp != 0, it writes a local header instead of a central - directory entry. + If flags & ZIP_EF_LOCAL, it writes a local header instead of a central + directory entry. If flags & ZIP_EF_FORCE_ZIP64, a ZIP64 extra field is written, even if not needed. - Returns 0 if successful. On error, error is filled in and -1 is + Returns 0 if successful, 1 if successful and wrote ZIP64 extra field. On error, error is filled in and -1 is returned. */ int -_zip_dirent_write(struct zip_dirent *zde, FILE *fp, int localp, - struct zip_error *error) +_zip_dirent_write(struct zip_dirent *de, FILE *fp, zip_flags_t flags, struct zip_error *error) { unsigned short dostime, dosdate; + enum zip_encoding_type com_enc, name_enc; + struct zip_extra_field *ef; + zip_uint8_t ef_zip64[24], *ef_zip64_p; + int is_zip64; + int is_really_zip64; + + ef = NULL; - fwrite(localp ? LOCAL_MAGIC : CENTRAL_MAGIC, 1, 4, fp); + is_zip64 = 0; - if (!localp) - _zip_write2(zde->version_madeby, fp); - _zip_write2(zde->version_needed, fp); - _zip_write2(zde->bitflags, fp); - _zip_write2(zde->comp_method, fp); + fwrite((flags & ZIP_FL_LOCAL) ? LOCAL_MAGIC : CENTRAL_MAGIC, 1, 4, fp); - _zip_u2d_time(zde->last_mod, &dostime, &dosdate); + name_enc = _zip_guess_encoding(de->filename, ZIP_ENCODING_UNKNOWN); + com_enc = _zip_guess_encoding(de->comment, ZIP_ENCODING_UNKNOWN); + + if ((name_enc == ZIP_ENCODING_UTF8_KNOWN && com_enc == ZIP_ENCODING_ASCII) || + (name_enc == ZIP_ENCODING_ASCII && com_enc == ZIP_ENCODING_UTF8_KNOWN) || + (name_enc == ZIP_ENCODING_UTF8_KNOWN && com_enc == ZIP_ENCODING_UTF8_KNOWN)) + de->bitflags |= ZIP_GPBF_ENCODING_UTF_8; + else { + de->bitflags &= ~ZIP_GPBF_ENCODING_UTF_8; + if (name_enc == ZIP_ENCODING_UTF8_KNOWN) { + ef = _zip_ef_utf8(ZIP_EF_UTF_8_NAME, de->filename, error); + if (ef == NULL) + return -1; + } + if ((flags & ZIP_FL_LOCAL) == 0 && com_enc == ZIP_ENCODING_UTF8_KNOWN){ + struct zip_extra_field *ef2 = _zip_ef_utf8(ZIP_EF_UTF_8_COMMENT, de->comment, error); + if (ef2 == NULL) { + _zip_ef_free(ef); + return -1; + } + ef2->next = ef; + ef = ef2; + } + } + + ef_zip64_p = ef_zip64; + if (flags & ZIP_FL_LOCAL) { + if ((flags & ZIP_FL_FORCE_ZIP64) || de->comp_size > ZIP_UINT32_MAX || de->uncomp_size > ZIP_UINT32_MAX) { + _zip_poke8(de->comp_size, &ef_zip64_p); + _zip_poke8(de->uncomp_size, &ef_zip64_p); + } + } + else { + if ((flags & ZIP_FL_FORCE_ZIP64) || de->comp_size > ZIP_UINT32_MAX || de->uncomp_size > ZIP_UINT32_MAX || de->offset > ZIP_UINT32_MAX) { + if (de->comp_size >= ZIP_UINT32_MAX) + _zip_poke8(de->comp_size, &ef_zip64_p); + if (de->uncomp_size >= ZIP_UINT32_MAX) + _zip_poke8(de->uncomp_size, &ef_zip64_p); + if (de->offset >= ZIP_UINT32_MAX) + _zip_poke8(de->offset, &ef_zip64_p); + } + } + + if (ef_zip64_p != ef_zip64) { + struct zip_extra_field *ef64 = _zip_ef_new(ZIP_EF_ZIP64, (zip_uint16_t)(ef_zip64_p-ef_zip64), ef_zip64, ZIP_EF_BOTH); + ef64->next = ef; + ef = ef64; + is_zip64 = 1; + } + + if ((flags & (ZIP_FL_LOCAL|ZIP_FL_FORCE_ZIP64)) == (ZIP_FL_LOCAL|ZIP_FL_FORCE_ZIP64)) + is_really_zip64 = _zip_dirent_needs_zip64(de, flags); + else + is_really_zip64 = is_zip64; + + if ((flags & ZIP_FL_LOCAL) == 0) + _zip_write2(is_really_zip64 ? 45 : de->version_madeby, fp); + _zip_write2(is_really_zip64 ? 45 : de->version_needed, fp); + _zip_write2(de->bitflags&0xfff9, fp); /* clear compression method specific flags */ + _zip_write2((zip_uint16_t)de->comp_method, fp); /* XXX: can it be ZIP_CM_DEFAULT? */ + + _zip_u2d_time(de->last_mod, &dostime, &dosdate); _zip_write2(dostime, fp); _zip_write2(dosdate, fp); + + _zip_write4(de->crc, fp); + if (de->comp_size < ZIP_UINT32_MAX) + _zip_write4((zip_uint32_t)de->comp_size, fp); + else + _zip_write4(ZIP_UINT32_MAX, fp); + if (de->uncomp_size < ZIP_UINT32_MAX) + _zip_write4((zip_uint32_t)de->uncomp_size, fp); + else + _zip_write4(ZIP_UINT32_MAX, fp); + + _zip_write2(_zip_string_length(de->filename), fp); + _zip_write2(_zip_ef_size(de->extra_fields, flags) + _zip_ef_size(ef, ZIP_EF_BOTH), fp); - _zip_write4(zde->crc, fp); - _zip_write4(zde->comp_size, fp); - _zip_write4(zde->uncomp_size, fp); - - _zip_write2(zde->filename_len, fp); - _zip_write2(zde->extrafield_len, fp); - - if (!localp) { - _zip_write2(zde->comment_len, fp); - _zip_write2(zde->disk_number, fp); - _zip_write2(zde->int_attrib, fp); - _zip_write4(zde->ext_attrib, fp); - _zip_write4(zde->offset, fp); + if ((flags & ZIP_FL_LOCAL) == 0) { + _zip_write2(_zip_string_length(de->comment), fp); + _zip_write2((zip_uint16_t)de->disk_number, fp); + _zip_write2(de->int_attrib, fp); + _zip_write4(de->ext_attrib, fp); + if (de->offset < ZIP_UINT32_MAX) + _zip_write4((zip_uint32_t)de->offset, fp); + else + _zip_write4(ZIP_UINT32_MAX, fp); } - if (zde->filename_len) - fwrite(zde->filename, 1, zde->filename_len, fp); + if (de->filename) + _zip_string_write(de->filename, fp); - if (zde->extrafield_len) - fwrite(zde->extrafield, 1, zde->extrafield_len, fp); + if (ef) + _zip_ef_write(ef, ZIP_EF_BOTH, fp); + if (de->extra_fields) + _zip_ef_write(de->extra_fields, flags, fp); - if (!localp) { - if (zde->comment_len) - fwrite(zde->comment, 1, zde->comment_len, fp); + if ((flags & ZIP_FL_LOCAL) == 0) { + if (de->comment) + _zip_string_write(de->comment, fp); } + _zip_ef_free(ef); + if (ferror(fp)) { _zip_error_set(error, ZIP_ER_WRITE, errno); return -1; } - return 0; + return is_zip64; } static time_t -_zip_d2u_time(int dtime, int ddate) +_zip_d2u_time(zip_uint16_t dtime, zip_uint16_t ddate) { struct tm tm; @@ -498,12 +785,72 @@ _zip_d2u_time(int dtime, int ddate) -unsigned short -_zip_read2(unsigned char **a) +static struct zip_extra_field * +_zip_ef_utf8(zip_uint16_t id, struct zip_string *str, struct zip_error *error) { - unsigned short ret; + const zip_uint8_t *raw; + zip_uint8_t *data, *p; + zip_uint32_t len; + struct zip_extra_field *ef; + + raw = _zip_string_get(str, &len, ZIP_FL_ENC_RAW, NULL); + + if (len+5 > ZIP_UINT16_MAX) { + /* XXX: error */ + } + + if ((data=(zip_uint8_t *)malloc(len+5)) == NULL) { + _zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + p = data; + *(p++) = 1; + _zip_poke4(_zip_string_crc32(str), &p); + memcpy(p, raw, len); + p += len; + + ef = _zip_ef_new(id, (zip_uint16_t)(p-data), data, ZIP_EF_BOTH); + free(data); + return ef; +} + + + +struct zip_dirent * +_zip_get_dirent(struct zip *za, zip_uint64_t idx, zip_flags_t flags, struct zip_error *error) +{ + if (error == NULL) + error = &za->error; + + if (idx >= za->nentry) { + _zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((flags & ZIP_FL_UNCHANGED) || za->entry[idx].changes == NULL) { + if (za->entry[idx].orig == NULL) { + _zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + if (za->entry[idx].deleted && (flags & ZIP_FL_UNCHANGED) == 0) { + _zip_error_set(error, ZIP_ER_DELETED, 0); + return NULL; + } + return za->entry[idx].orig; + } + else + return za->entry[idx].changes; +} + + - ret = (*a)[0]+((*a)[1]<<8); +zip_uint16_t +_zip_read2(const zip_uint8_t **a) +{ + zip_uint16_t ret; + + ret = (zip_uint16_t)((*a)[0]+((*a)[1]<<8)); *a += 2; return ret; @@ -511,12 +858,12 @@ _zip_read2(unsigned char **a) -unsigned int -_zip_read4(unsigned char **a) +zip_uint32_t +_zip_read4(const zip_uint8_t **a) { - unsigned int ret; + zip_uint32_t ret; - ret = ((((((*a)[3]<<8)+(*a)[2])<<8)+(*a)[1])<<8)+(*a)[0]; + ret = ((((((zip_uint32_t)(*a)[3]<<8)+(*a)[2])<<8)+(*a)[1])<<8)+(*a)[0]; *a += 4; return ret; @@ -524,65 +871,108 @@ _zip_read4(unsigned char **a) -static char * -_zip_readfpstr(FILE *fp, unsigned int len, int nulp, struct zip_error *error) +zip_uint64_t +_zip_read8(const zip_uint8_t **a) { - char *r, *o; + zip_uint64_t x, y; + + x = ((((((zip_uint64_t)(*a)[3]<<8)+(*a)[2])<<8)+(*a)[1])<<8)+(*a)[0]; + *a += 4; + y = ((((((zip_uint64_t)(*a)[3]<<8)+(*a)[2])<<8)+(*a)[1])<<8)+(*a)[0]; + *a += 4; + + return x+(y<<32); +} - r = (char *)malloc(nulp ? len+1 : len); + + +zip_uint8_t * +_zip_read_data(const zip_uint8_t **buf, FILE *fp, size_t len, int nulp, struct zip_error *error) +{ + zip_uint8_t *r; + + if (len == 0 && nulp == 0) + return NULL; + + r = (zip_uint8_t *)malloc(nulp ? len+1 : len); if (!r) { _zip_error_set(error, ZIP_ER_MEMORY, 0); return NULL; } - if (fread(r, 1, len, fp)>8)&0xff; + *((*p)++) = (i>>16)&0xff; + *((*p)++) = (i>>24)&0xff; +} + + + +void +_zip_poke8(zip_uint64_t i, zip_uint8_t **p) +{ + *((*p)++) = i&0xff; + *((*p)++) = (i>>8)&0xff; + *((*p)++) = (i>>16)&0xff; + *((*p)++) = (i>>24)&0xff; + *((*p)++) = (i>>32)&0xff; + *((*p)++) = (i>>40)&0xff; + *((*p)++) = (i>>48)&0xff; + *((*p)++) = (i>>56)&0xff; } -static void -_zip_write2(unsigned short i, FILE *fp) +void +_zip_write2(zip_uint16_t i, FILE *fp) { putc(i&0xff, fp); putc((i>>8)&0xff, fp); @@ -592,13 +982,30 @@ _zip_write2(unsigned short i, FILE *fp) -static void -_zip_write4(unsigned int i, FILE *fp) +void +_zip_write4(zip_uint32_t i, FILE *fp) +{ + putc(i&0xff, fp); + putc((i>>8)&0xff, fp); + putc((i>>16)&0xff, fp); + putc((i>>24)&0xff, fp); + + return; +} + + + +void +_zip_write8(zip_uint64_t i, FILE *fp) { putc(i&0xff, fp); putc((i>>8)&0xff, fp); putc((i>>16)&0xff, fp); putc((i>>24)&0xff, fp); + putc((i>>32)&0xff, fp); + putc((i>>40)&0xff, fp); + putc((i>>48)&0xff, fp); + putc((i>>56)&0xff, fp); return; } @@ -606,15 +1013,13 @@ _zip_write4(unsigned int i, FILE *fp) void -_zip_u2d_time(time_t time, unsigned short *dtime, unsigned short *ddate) +_zip_u2d_time(time_t time, zip_uint16_t *dtime, zip_uint16_t *ddate) { struct tm *tm; tm = localtime(&time); - *ddate = ((tm->tm_year+1900-1980)<<9) + ((tm->tm_mon+1)<<5) - + tm->tm_mday; - *dtime = ((tm->tm_hour)<<11) + ((tm->tm_min)<<5) - + ((tm->tm_sec)>>1); + *ddate = (zip_uint16_t)(((tm->tm_year+1900-1980)<<9) + ((tm->tm_mon+1)<<5) + tm->tm_mday); + *dtime = (zip_uint16_t)(((tm->tm_hour)<<11) + ((tm->tm_min)<<5) + ((tm->tm_sec)>>1)); return; } diff --git a/ext/zip/lib/zip_free.c b/ext/zip/lib/zip_discard.c similarity index 86% rename from ext/zip/lib/zip_free.c rename to ext/zip/lib/zip_discard.c index 9932c14fec9a2..37ba8c2ea64de 100644 --- a/ext/zip/lib/zip_free.c +++ b/ext/zip/lib/zip_discard.c @@ -1,6 +1,6 @@ /* - zip_free.c -- free struct zip - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + zip_discard.c -- discard and free struct zip + Copyright (C) 1999-2012 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -39,14 +39,14 @@ -/* _zip_free: +/* zip_discard: frees the space allocated to a zipfile struct, and closes the corresponding file. */ void -_zip_free(struct zip *za) +zip_discard(struct zip *za) { - int i; + zip_uint64_t i; if (za == NULL) return; @@ -58,13 +58,12 @@ _zip_free(struct zip *za) fclose(za->zp); free(za->default_password); - _zip_cdir_free(za->cdir); - free(za->ch_comment); + _zip_string_free(za->comment_orig); + _zip_string_free(za->comment_changes); if (za->entry) { - for (i=0; inentry; i++) { - _zip_entry_free(za->entry+i); - } + for (i=0; inentry; i++) + _zip_entry_finalize(za->entry+i); free(za->entry); } diff --git a/ext/zip/lib/zip_entry_free.c b/ext/zip/lib/zip_entry.c similarity index 79% rename from ext/zip/lib/zip_entry_free.c rename to ext/zip/lib/zip_entry.c index e8a77707f0bfa..58663e8d0c88e 100644 --- a/ext/zip/lib/zip_entry_free.c +++ b/ext/zip/lib/zip_entry.c @@ -1,6 +1,6 @@ /* - zip_entry_free.c -- free struct zip_entry - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + zip_entry.c -- struct zip_entry helper functions + Copyright (C) 1999-2012 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -33,23 +33,23 @@ -#include - #include "zipint.h" +void +_zip_entry_finalize(struct zip_entry *e) +{ + _zip_unchange_data(e); + _zip_dirent_free(e->orig); + _zip_dirent_free(e->changes); +} + void -_zip_entry_free(struct zip_entry *ze) +_zip_entry_init(struct zip_entry *e) { - free(ze->ch_filename); - ze->ch_filename = NULL; - free(ze->ch_extra); - ze->ch_extra = NULL; - ze->ch_extra_len = -1; - free(ze->ch_comment); - ze->ch_comment = NULL; - ze->ch_comment_len = -1; - - _zip_unchange_data(ze); + e->orig = NULL; + e->changes = NULL; + e->source = NULL; + e->deleted = 0; } diff --git a/ext/zip/lib/zip_error.c b/ext/zip/lib/zip_error.c index b8d907abf4d9a..4b1f27921a256 100644 --- a/ext/zip/lib/zip_error.c +++ b/ext/zip/lib/zip_error.c @@ -1,6 +1,6 @@ /* zip_error.c -- struct zip_error helper functions - Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2013 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -42,6 +42,9 @@ void _zip_error_clear(struct zip_error *err) { + if (err == NULL) + return; + err->zip_err = ZIP_ER_OK; err->sys_err = 0; } @@ -49,7 +52,7 @@ _zip_error_clear(struct zip_error *err) void -_zip_error_copy(struct zip_error *dst, struct zip_error *src) +_zip_error_copy(struct zip_error *dst, const struct zip_error *src) { dst->zip_err = src->zip_err; dst->sys_err = src->sys_err; @@ -67,7 +70,7 @@ _zip_error_fini(struct zip_error *err) void -_zip_error_get(struct zip_error *err, int *zep, int *sep) +_zip_error_get(const struct zip_error *err, int *zep, int *sep) { if (zep) *zep = err->zip_err; diff --git a/ext/zip/lib/zip_error_clear.c b/ext/zip/lib/zip_error_clear.c index 34e7dea48ebba..b4ff10391290a 100644 --- a/ext/zip/lib/zip_error_clear.c +++ b/ext/zip/lib/zip_error_clear.c @@ -37,8 +37,11 @@ -ZIP_EXTERN(void) +ZIP_EXTERN void zip_error_clear(struct zip *za) { + if (za == NULL) + return; + _zip_error_clear(&za->error); } diff --git a/ext/zip/lib/zip_error_get.c b/ext/zip/lib/zip_error_get.c index c15705e32fccd..6d1c958c17766 100644 --- a/ext/zip/lib/zip_error_get.c +++ b/ext/zip/lib/zip_error_get.c @@ -37,7 +37,7 @@ -ZIP_EXTERN(void) +ZIP_EXTERN void zip_error_get(struct zip *za, int *zep, int *sep) { _zip_error_get(&za->error, zep, sep); diff --git a/ext/zip/lib/zip_error_get_sys_type.c b/ext/zip/lib/zip_error_get_sys_type.c index 47aa93e69b927..6c6f38074040e 100644 --- a/ext/zip/lib/zip_error_get_sys_type.c +++ b/ext/zip/lib/zip_error_get_sys_type.c @@ -37,7 +37,7 @@ -ZIP_EXTERN(int) +ZIP_EXTERN int zip_error_get_sys_type(int ze) { if (ze < 0 || ze >= _zip_nerr_str) diff --git a/ext/zip/lib/zip_error_to_str.c b/ext/zip/lib/zip_error_to_str.c index bafe74335a049..11a0cd2bb0e6d 100644 --- a/ext/zip/lib/zip_error_to_str.c +++ b/ext/zip/lib/zip_error_to_str.c @@ -42,7 +42,7 @@ -ZIP_EXTERN(int) +ZIP_EXTERN int zip_error_to_str(char *buf, zip_uint64_t len, int ze, int se) { const char *zs, *ss; diff --git a/ext/zip/lib/zip_extra_field.c b/ext/zip/lib/zip_extra_field.c new file mode 100644 index 0000000000000..41fd2b1d901af --- /dev/null +++ b/ext/zip/lib/zip_extra_field.c @@ -0,0 +1,386 @@ +/* + zip_extra_field.c -- manipulate extra fields + Copyright (C) 2012-2013 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include "zipint.h" + +#include +#include +#include + + + +struct zip_extra_field * +_zip_ef_clone(const struct zip_extra_field *ef, struct zip_error *error) +{ + struct zip_extra_field *head, *prev, *def; + + head = prev = NULL; + + while (ef) { + if ((def=_zip_ef_new(ef->id, ef->size, ef->data, ef->flags)) == NULL) { + _zip_error_set(error, ZIP_ER_MEMORY, 0); + _zip_ef_free(head); + return NULL; + } + + if (head == NULL) + head = def; + if (prev) + prev->next = def; + prev = def; + + ef = ef->next; + } + + return head; +} + + +struct zip_extra_field * +_zip_ef_delete_by_id(struct zip_extra_field *ef, zip_uint16_t id, zip_uint16_t id_idx, zip_flags_t flags) +{ + struct zip_extra_field *head, *prev; + int i; + + i = 0; + head = ef; + prev = NULL; + for (; ef; ef=(prev ? prev->next : head)) { + if ((ef->flags & flags & ZIP_EF_BOTH) && ef->id == id) { + if (id_idx == ZIP_EXTRA_FIELD_ALL || i == id_idx) { + ef->flags &= ~(flags & ZIP_EF_BOTH); + if ((ef->flags & ZIP_EF_BOTH) == 0) { + if (prev) + prev->next = ef->next; + else + head = ef->next; + ef->next = NULL; + _zip_ef_free(ef); + + if (id_idx == ZIP_EXTRA_FIELD_ALL) + continue; + } + } + + i++; + if (i > id_idx) + break; + } + prev = ef; + } + + return head; +} + + + + +void +_zip_ef_free(struct zip_extra_field *ef) +{ + struct zip_extra_field *ef2; + + while (ef) { + ef2 = ef->next; + free(ef->data); + free(ef); + ef = ef2; + } +} + + + +const zip_uint8_t * +_zip_ef_get_by_id(const struct zip_extra_field *ef, zip_uint16_t *lenp, zip_uint16_t id, zip_uint16_t id_idx, zip_flags_t flags, struct zip_error *error) +{ + static const zip_uint8_t empty[1] = { '\0' }; + + int i; + + i = 0; + for (; ef; ef=ef->next) { + if (ef->id == id && (ef->flags & flags & ZIP_EF_BOTH)) { + if (i < id_idx) { + i++; + continue; + } + + if (lenp) + *lenp = ef->size; + if (ef->size > 0) + return ef->data; + else + return empty; + } + } + + _zip_error_set(error, ZIP_ER_NOENT, 0); + return NULL; +} + + + +struct zip_extra_field * +_zip_ef_merge(struct zip_extra_field *to, struct zip_extra_field *from) +{ + struct zip_extra_field *ef2, *tt, *tail; + int duplicate; + + if (to == NULL) + return from; + + for (tail=to; tail->next; tail=tail->next) + ; + + for (; from; from=ef2) { + ef2 = from->next; + + duplicate = 0; + for (tt=to; tt; tt=tt->next) { + if (tt->id == from->id && tt->size == from->size && memcmp(tt->data, from->data, tt->size) == 0) { + tt->flags |= (from->flags & ZIP_EF_BOTH); + duplicate = 1; + break; + } + } + + from->next = NULL; + if (duplicate) + _zip_ef_free(from); + else + tail = tail->next = from; + } + + return to; +} + + + +struct zip_extra_field * +_zip_ef_new(zip_uint16_t id, zip_uint16_t size, const zip_uint8_t *data, zip_flags_t flags) +{ + struct zip_extra_field *ef; + + if ((ef=(struct zip_extra_field *)malloc(sizeof(*ef))) == NULL) + return NULL; + + ef->next = NULL; + ef->flags = flags; + ef->id = id; + ef->size = size; + if (size > 0) { + if ((ef->data=(zip_uint8_t *)_zip_memdup(data, size, NULL)) == NULL) { + free(ef); + return NULL; + } + } + else + ef->data = NULL; + + return ef; +} + + + +struct zip_extra_field * +_zip_ef_parse(const zip_uint8_t *data, zip_uint16_t len, zip_flags_t flags, struct zip_error *error) +{ + struct zip_extra_field *ef, *ef2, *ef_head; + const zip_uint8_t *p; + zip_uint16_t fid, flen; + + ef_head = NULL; + for (p=data; p data+len) { + _zip_error_set(error, ZIP_ER_INCONS, 0); + _zip_ef_free(ef_head); + return NULL; + } + + fid = _zip_read2(&p); + flen = _zip_read2(&p); + + if (p+flen > data+len) { + _zip_error_set(error, ZIP_ER_INCONS, 0); + _zip_ef_free(ef_head); + return NULL; + } + + if ((ef2=_zip_ef_new(fid, flen, p, flags)) == NULL) { + _zip_error_set(error, ZIP_ER_MEMORY, 0); + _zip_ef_free(ef_head); + return NULL; + } + + if (ef_head) { + ef->next = ef2; + ef = ef2; + } + else + ef_head = ef = ef2; + } + + return ef_head; +} + + + +struct zip_extra_field * +_zip_ef_remove_internal(struct zip_extra_field *ef) +{ + struct zip_extra_field *ef_head; + struct zip_extra_field *prev, *next; + + ef_head = ef; + prev = NULL; + + while (ef) { + if (ZIP_EF_IS_INTERNAL(ef->id)) { + next = ef->next; + if (ef_head == ef) + ef_head = next; + ef->next = NULL; + _zip_ef_free(ef); + if (prev) + prev->next = next; + ef = next; + } + else { + prev = ef; + ef = ef->next; + } + } + + return ef_head; +} + + +zip_uint16_t +_zip_ef_size(const struct zip_extra_field *ef, zip_flags_t flags) +{ + zip_uint16_t size; + + size = 0; + for (; ef; ef=ef->next) { + if (ef->flags & flags & ZIP_EF_BOTH) + size += 4+ef->size; + } + + return size; +} + + + +void +_zip_ef_write(const struct zip_extra_field *ef, zip_flags_t flags, FILE *f) +{ + for (; ef; ef=ef->next) { + if (ef->flags & flags & ZIP_EF_BOTH) { + _zip_write2(ef->id, f); + _zip_write2(ef->size, f); + if (ef->size > 0) + fwrite(ef->data, ef->size, 1, f); + } + } +} + + + +int +_zip_read_local_ef(struct zip *za, zip_uint64_t idx) +{ + struct zip_entry *e; + unsigned char b[4]; + const unsigned char *p; + zip_uint16_t fname_len, ef_len; + + if (idx >= za->nentry) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + e = za->entry+idx; + + if (e->orig == NULL || e->orig->local_extra_fields_read) + return 0; + + + if (fseeko(za->zp, (off_t)(e->orig->offset + 26), SEEK_SET) < 0) { + _zip_error_set(&za->error, ZIP_ER_SEEK, errno); + return -1; + } + + if (fread(b, sizeof(b), 1, za->zp) != 1) { + _zip_error_set(&za->error, ZIP_ER_READ, errno); + return -1; + } + + p = b; + fname_len = _zip_read2(&p); + ef_len = _zip_read2(&p); + + if (ef_len > 0) { + struct zip_extra_field *ef; + zip_uint8_t *ef_raw; + + if (fseek(za->zp, fname_len, SEEK_CUR) < 0) { + _zip_error_set(&za->error, ZIP_ER_SEEK, errno); + return -1; + } + + ef_raw = _zip_read_data(NULL, za->zp, ef_len, 0, &za->error); + + if (ef_raw == NULL) + return -1; + + if ((ef=_zip_ef_parse(ef_raw, ef_len, ZIP_EF_LOCAL, &za->error)) == NULL) { + free(ef_raw); + return -1; + } + free(ef_raw); + + ef = _zip_ef_remove_internal(ef); + e->orig->extra_fields = _zip_ef_merge(e->orig->extra_fields, ef); + } + + e->orig->local_extra_fields_read = 1; + + if (e->changes && e->changes->local_extra_fields_read == 0) { + e->changes->extra_fields = e->orig->extra_fields; + e->changes->local_extra_fields_read = 1; + } + + return 0; +} diff --git a/ext/zip/lib/zip_extra_field_api.c b/ext/zip/lib/zip_extra_field_api.c new file mode 100644 index 0000000000000..02ed4555e0c0d --- /dev/null +++ b/ext/zip/lib/zip_extra_field_api.c @@ -0,0 +1,364 @@ +/* + zip_extra_field_api.c -- public extra fields API functions + Copyright (C) 2012-2013 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include "zipint.h" + + + +ZIP_EXTERN int +zip_file_extra_field_delete(struct zip *za, zip_uint64_t idx, zip_uint16_t ef_idx, zip_flags_t flags) +{ + struct zip_dirent *de; + + if ((flags & ZIP_EF_BOTH) == 0) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (_zip_get_dirent(za, idx, 0, NULL) == NULL) + return -1; + + if (ZIP_IS_RDONLY(za)) { + _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + if (_zip_file_extra_field_prepare_for_change(za, idx) < 0) + return -1; + + de = za->entry[idx].changes; + + de->extra_fields = _zip_ef_delete_by_id(de->extra_fields, ZIP_EXTRA_FIELD_ALL, ef_idx, flags); + return 0; +} + + + +ZIP_EXTERN int +zip_file_extra_field_delete_by_id(struct zip *za, zip_uint64_t idx, zip_uint16_t ef_id, zip_uint16_t ef_idx, zip_flags_t flags) +{ + struct zip_dirent *de; + + if ((flags & ZIP_EF_BOTH) == 0) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (_zip_get_dirent(za, idx, 0, NULL) == NULL) + return -1; + + if (ZIP_IS_RDONLY(za)) { + _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + if (_zip_file_extra_field_prepare_for_change(za, idx) < 0) + return -1; + + de = za->entry[idx].changes; + + de->extra_fields = _zip_ef_delete_by_id(de->extra_fields, ef_id, ef_idx, flags); + return 0; +} + + + +ZIP_EXTERN const zip_uint8_t * +zip_file_extra_field_get(struct zip *za, zip_uint64_t idx, zip_uint16_t ef_idx, zip_uint16_t *idp, zip_uint16_t *lenp, zip_flags_t flags) +{ + static const zip_uint8_t empty[1] = { '\0' }; + + struct zip_dirent *de; + struct zip_extra_field *ef; + int i; + + if ((flags & ZIP_EF_BOTH) == 0) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((de=_zip_get_dirent(za, idx, flags, &za->error)) == NULL) + return NULL; + + if (flags & ZIP_FL_LOCAL) + if (_zip_read_local_ef(za, idx) < 0) + return NULL; + + i = 0; + for (ef=de->extra_fields; ef; ef=ef->next) { + if (ef->flags & flags & ZIP_EF_BOTH) { + if (i < ef_idx) { + i++; + continue; + } + + if (idp) + *idp = ef->id; + if (lenp) + *lenp = ef->size; + if (ef->size > 0) + return ef->data; + else + return empty; + } + } + + _zip_error_set(&za->error, ZIP_ER_NOENT, 0); + return NULL; + +} + + + +ZIP_EXTERN const zip_uint8_t * +zip_file_extra_field_get_by_id(struct zip *za, zip_uint64_t idx, zip_uint16_t ef_id, zip_uint16_t ef_idx, zip_uint16_t *lenp, zip_flags_t flags) +{ + struct zip_dirent *de; + + if ((flags & ZIP_EF_BOTH) == 0) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((de=_zip_get_dirent(za, idx, flags, &za->error)) == NULL) + return NULL; + + if (flags & ZIP_FL_LOCAL) + if (_zip_read_local_ef(za, idx) < 0) + return NULL; + + return _zip_ef_get_by_id(de->extra_fields, lenp, ef_id, ef_idx, flags, &za->error); +} + + + +ZIP_EXTERN zip_int16_t +zip_file_extra_fields_count(struct zip *za, zip_uint64_t idx, zip_flags_t flags) +{ + struct zip_dirent *de; + struct zip_extra_field *ef; + zip_uint16_t n; + + if ((flags & ZIP_EF_BOTH) == 0) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if ((de=_zip_get_dirent(za, idx, flags, &za->error)) == NULL) + return -1; + + if (flags & ZIP_FL_LOCAL) + if (_zip_read_local_ef(za, idx) < 0) + return -1; + + n = 0; + for (ef=de->extra_fields; ef; ef=ef->next) + if (ef->flags & flags & ZIP_EF_BOTH) + n++; + + return (zip_int16_t)n; +} + + + +ZIP_EXTERN zip_int16_t +zip_file_extra_fields_count_by_id(struct zip *za, zip_uint64_t idx, zip_uint16_t ef_id, zip_flags_t flags) +{ + struct zip_dirent *de; + struct zip_extra_field *ef; + zip_uint16_t n; + + if ((flags & ZIP_EF_BOTH) == 0) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if ((de=_zip_get_dirent(za, idx, flags, &za->error)) == NULL) + return -1; + + if (flags & ZIP_FL_LOCAL) + if (_zip_read_local_ef(za, idx) < 0) + return -1; + + n = 0; + for (ef=de->extra_fields; ef; ef=ef->next) + if (ef->id == ef_id && (ef->flags & flags & ZIP_EF_BOTH)) + n++; + + return (zip_int16_t)n; +} + + + +ZIP_EXTERN int +zip_file_extra_field_set(struct zip *za, zip_uint64_t idx, zip_uint16_t ef_id, zip_uint16_t ef_idx, const zip_uint8_t *data, zip_uint16_t len, zip_flags_t flags) +{ + struct zip_dirent *de; + zip_uint16_t ls, cs; + struct zip_extra_field *ef, *ef_prev, *ef_new; + int i, found, new_len; + + if ((flags & ZIP_EF_BOTH) == 0) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (_zip_get_dirent(za, idx, 0, NULL) == NULL) + return -1; + + if (ZIP_IS_RDONLY(za)) { + _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + if (ZIP_EF_IS_INTERNAL(ef_id)) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (_zip_file_extra_field_prepare_for_change(za, idx) < 0) + return -1; + + de = za->entry[idx].changes; + + ef = de->extra_fields; + ef_prev = NULL; + i = 0; + found = 0; + + for (; ef; ef=ef->next) { + if (ef->id == ef_id && (ef->flags & flags & ZIP_EF_BOTH)) { + if (i == ef_idx) { + found = 1; + break; + } + i++; + } + ef_prev = ef; + } + + if (i < ef_idx && ef_idx != ZIP_EXTRA_FIELD_NEW) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (flags & ZIP_EF_LOCAL) + ls = _zip_ef_size(de->extra_fields, ZIP_EF_LOCAL); + else + ls = 0; + if (flags & ZIP_EF_CENTRAL) + cs = _zip_ef_size(de->extra_fields, ZIP_EF_CENTRAL); + else + cs = 0; + + new_len = ls > cs ? ls : cs; + if (found) + new_len -= ef->size + 4; + new_len += len + 4; + + if (new_len > ZIP_UINT16_MAX) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if ((ef_new=_zip_ef_new(ef_id, len, data, flags)) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + + if (found) { + if ((ef->flags & ZIP_EF_BOTH) == (flags & ZIP_EF_BOTH)) { + ef_new->next = ef->next; + ef->next = NULL; + _zip_ef_free(ef); + if (ef_prev) + ef_prev->next = ef_new; + else + de->extra_fields = ef_new; + } + else { + ef->flags &= ~(flags & ZIP_EF_BOTH); + ef_new->next = ef->next; + ef->next = ef_new; + } + } + else if (ef_prev) { + ef_new->next = ef_prev->next; + ef_prev->next = ef_new; + } + else + de->extra_fields = ef_new; + + return 0; +} + + + +int +_zip_file_extra_field_prepare_for_change(struct zip *za, zip_uint64_t idx) +{ + struct zip_entry *e; + + if (idx >= za->nentry) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + e = za->entry+idx; + + if (e->changes && (e->changes->changed & ZIP_DIRENT_EXTRA_FIELD)) + return 0; + + if (e->orig) { + if (_zip_read_local_ef(za, idx) < 0) + return -1; + } + + if (e->changes == NULL) { + if ((e->changes=_zip_dirent_clone(e->orig)) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + } + + if (e->orig && e->orig->extra_fields) { + if ((e->changes->extra_fields=_zip_ef_clone(e->orig->extra_fields, &za->error)) == NULL) + return -1; + } + e->changes->changed |= ZIP_DIRENT_EXTRA_FIELD; + + return 0; +} + diff --git a/ext/zip/lib/zip_fclose.c b/ext/zip/lib/zip_fclose.c index eb55ddbcea455..093c30eada9f1 100644 --- a/ext/zip/lib/zip_fclose.c +++ b/ext/zip/lib/zip_fclose.c @@ -39,20 +39,23 @@ -ZIP_EXTERN(int) +ZIP_EXTERN int zip_fclose(struct zip_file *zf) { - int i, ret; + int ret; + unsigned int i; if (zf->src) zip_source_free(zf->src); - for (i=0; iza->nfile; i++) { - if (zf->za->file[i] == zf) { - zf->za->file[i] = zf->za->file[zf->za->nfile-1]; - zf->za->nfile--; - break; - } + if (zf->za) { + for (i=0; iza->nfile; i++) { + if (zf->za->file[i] == zf) { + zf->za->file[i] = zf->za->file[zf->za->nfile-1]; + zf->za->nfile--; + break; + } + } } ret = 0; diff --git a/ext/zip/lib/zip_fdopen.c b/ext/zip/lib/zip_fdopen.c index df70f27561ace..bda9aabac4915 100644 --- a/ext/zip/lib/zip_fdopen.c +++ b/ext/zip/lib/zip_fdopen.c @@ -37,11 +37,24 @@ -ZIP_EXTERN(struct zip *) -zip_fdopen(int fd_orig, int flags, int *zep) +ZIP_EXTERN struct zip * +zip_fdopen(int fd_orig, int _flags, int *zep) { int fd; FILE *fp; + unsigned int flags; + + if (_flags < 0) { + if (zep) + *zep = ZIP_ER_INVAL; + return NULL; + } + flags = (unsigned int)_flags; + + if (flags & ZIP_TRUNCATE) { + *zep = ZIP_ER_INVAL; + return NULL; + } /* We dup() here to avoid messing with the passed in fd. We could not restore it to the original state in case of error. */ @@ -58,5 +71,5 @@ zip_fdopen(int fd_orig, int flags, int *zep) } close(fd_orig); - return _zip_open(NULL, fp, flags, ZIP_AFL_RDONLY, zep); + return _zip_open(NULL, fp, flags, zep); } diff --git a/ext/zip/lib/zip_file_add.c b/ext/zip/lib/zip_file_add.c new file mode 100644 index 0000000000000..995cb91c1a287 --- /dev/null +++ b/ext/zip/lib/zip_file_add.c @@ -0,0 +1,55 @@ +/* + zip_file_add.c -- add file via callback function + Copyright (C) 1999-2012 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include "zipint.h" + + +/* + NOTE: Return type is signed so we can return -1 on error. + The index can not be larger than ZIP_INT64_MAX since the size + of the central directory cannot be larger than + ZIP_UINT64_MAX, and each entry is larger than 2 bytes. +*/ + +ZIP_EXTERN zip_int64_t +zip_file_add(struct zip *za, const char *name, struct zip_source *source, zip_flags_t flags) +{ + if (name == NULL || source == NULL) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + return _zip_file_replace(za, ZIP_UINT64_MAX, name, source, flags); +} diff --git a/ext/zip/lib/zip_file_error_clear.c b/ext/zip/lib/zip_file_error_clear.c index 6c9c2a02b3f0f..ce8b6cbd9403a 100644 --- a/ext/zip/lib/zip_file_error_clear.c +++ b/ext/zip/lib/zip_file_error_clear.c @@ -37,8 +37,11 @@ -ZIP_EXTERN(void) +ZIP_EXTERN void zip_file_error_clear(struct zip_file *zf) { + if (zf == NULL) + return; + _zip_error_clear(&zf->error); } diff --git a/ext/zip/lib/zip_file_error_get.c b/ext/zip/lib/zip_file_error_get.c index a53fa7e003324..f20e011fc747e 100644 --- a/ext/zip/lib/zip_file_error_get.c +++ b/ext/zip/lib/zip_file_error_get.c @@ -37,7 +37,7 @@ -ZIP_EXTERN(void) +ZIP_EXTERN void zip_file_error_get(struct zip_file *zf, int *zep, int *sep) { _zip_error_get(&zf->error, zep, sep); diff --git a/ext/zip/lib/zip_get_file_extra.c b/ext/zip/lib/zip_file_get_comment.c similarity index 72% rename from ext/zip/lib/zip_get_file_extra.c rename to ext/zip/lib/zip_file_get_comment.c index a27edd8ee9452..766731ea268ef 100644 --- a/ext/zip/lib/zip_get_file_extra.c +++ b/ext/zip/lib/zip_file_get_comment.c @@ -1,6 +1,6 @@ /* - zip_get_file_extra.c -- get file extra field - Copyright (C) 2006-2010 Dieter Baron and Thomas Klausner + zip_file_get_comment.c -- get file comment + Copyright (C) 2006-2012 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,28 +31,28 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include "zipint.h" + +/* lenp is 32 bit because converted comment can be longer than ZIP_UINT16_MAX */ - -ZIP_EXTERN(const char *) -zip_get_file_extra(struct zip *za, zip_uint64_t idx, int *lenp, int flags) +ZIP_EXTERN const char * +zip_file_get_comment(struct zip *za, zip_uint64_t idx, zip_uint32_t *lenp, zip_flags_t flags) { - if (idx >= za->nentry) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + struct zip_dirent *de; + zip_uint32_t len; + const zip_uint8_t *str; + + if ((de=_zip_get_dirent(za, idx, flags, NULL)) == NULL) return NULL; - } - - if ((flags & ZIP_FL_UNCHANGED) - || (za->entry[idx].ch_extra_len == -1)) { - if (lenp != NULL) - *lenp = za->cdir->entry[idx].extrafield_len; - return za->cdir->entry[idx].extrafield; - } - - if (lenp != NULL) - *lenp = za->entry[idx].ch_extra_len; - return za->entry[idx].ch_extra; + + if ((str=_zip_string_get(de->comment, &len, flags, &za->error)) == NULL) + return NULL; + + if (lenp) + *lenp = len; + + return (const char *)str; } diff --git a/ext/zip/lib/zip_file_get_offset.c b/ext/zip/lib/zip_file_get_offset.c index b96fd5e480907..65a011fc077c3 100644 --- a/ext/zip/lib/zip_file_get_offset.c +++ b/ext/zip/lib/zip_file_get_offset.c @@ -50,25 +50,27 @@ On error, fills in za->error and returns 0. */ -unsigned int -_zip_file_get_offset(struct zip *za, int idx) +zip_uint64_t +_zip_file_get_offset(const struct zip *za, zip_uint64_t idx, struct zip_error *error) { - struct zip_dirent de; - unsigned int offset; + zip_uint64_t offset; + zip_int32_t size; - offset = za->cdir->entry[idx].offset; + offset = za->entry[idx].orig->offset; - if (fseeko(za->zp, offset, SEEK_SET) != 0) { - _zip_error_set(&za->error, ZIP_ER_SEEK, errno); + if (fseeko(za->zp, (off_t)offset, SEEK_SET) != 0) { + _zip_error_set(error, ZIP_ER_SEEK, errno); return 0; } - if (_zip_dirent_read(&de, za->zp, NULL, NULL, 1, &za->error) != 0) + /* XXX: cache? */ + if ((size=_zip_dirent_size(za->zp, ZIP_EF_LOCAL, error)) < 0) return 0; - offset += LENTRYSIZE + de.filename_len + de.extrafield_len; - - _zip_dirent_finalize(&de); - - return offset; + if (offset+(zip_uint32_t)size > ZIP_OFF_MAX) { + _zip_error_set(error, ZIP_ER_SEEK, EFBIG); + return 0; + } + + return offset + (zip_uint32_t)size; } diff --git a/ext/zip/lib/zip_set_file_extra.c b/ext/zip/lib/zip_file_rename.c similarity index 70% rename from ext/zip/lib/zip_set_file_extra.c rename to ext/zip/lib/zip_file_rename.c index db829e2e0a842..383a52adae714 100644 --- a/ext/zip/lib/zip_set_file_extra.c +++ b/ext/zip/lib/zip_file_rename.c @@ -1,6 +1,6 @@ /* - zip_set_file_extra.c -- set extra field for file in archive - Copyright (C) 2006-2010 Dieter Baron and Thomas Klausner + zip_file_rename.c -- rename file in zip archive + Copyright (C) 1999-2012 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,23 +31,21 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + - -#include +#include #include "zipint.h" + - -ZIP_EXTERN(int) -zip_set_file_extra(struct zip *za, zip_uint64_t idx, - const char *extra, int len) +ZIP_EXTERN int +zip_file_rename(struct zip *za, zip_uint64_t idx, const char *name, zip_flags_t flags) { - char *tmpext; - - if (idx >= za->nentry - || len < 0 || len > MAXEXTLEN - || (len > 0 && extra == NULL)) { + const char *old_name; + int old_is_dir, new_is_dir; + + if (idx >= za->nentry || (name != NULL && strlen(name) > ZIP_UINT16_MAX)) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } @@ -57,16 +55,16 @@ zip_set_file_extra(struct zip *za, zip_uint64_t idx, return -1; } - if (len > 0) { - if ((tmpext=(char *)_zip_memdup(extra, len, &za->error)) == NULL) - return -1; - } - else - tmpext = NULL; + if ((old_name=zip_get_name(za, idx, 0)) == NULL) + return -1; + + new_is_dir = (name != NULL && name[strlen(name)-1] == '/'); + old_is_dir = (old_name[strlen(old_name)-1] == '/'); - free(za->entry[idx].ch_extra); - za->entry[idx].ch_extra = tmpext; - za->entry[idx].ch_extra_len = len; + if (new_is_dir != old_is_dir) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } - return 0; + return _zip_set_name(za, idx, name, flags); } diff --git a/ext/zip/lib/zip_file_replace.c b/ext/zip/lib/zip_file_replace.c new file mode 100644 index 0000000000000..7e7e942168478 --- /dev/null +++ b/ext/zip/lib/zip_file_replace.c @@ -0,0 +1,111 @@ +/* + zip_file_replace.c -- replace file via callback function + Copyright (C) 1999-2012 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include "zipint.h" + + + +ZIP_EXTERN int +zip_file_replace(struct zip *za, zip_uint64_t idx, struct zip_source *source, zip_flags_t flags) +{ + if (idx >= za->nentry || source == NULL) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (_zip_file_replace(za, idx, NULL, source, flags) == -1) + return -1; + + return 0; +} + + + + +/* NOTE: Signed due to -1 on error. See zip_add.c for more details. */ + +zip_int64_t +_zip_file_replace(struct zip *za, zip_uint64_t idx, const char *name, struct zip_source *source, zip_flags_t flags) +{ + zip_uint64_t za_nentry_prev; + + if (ZIP_IS_RDONLY(za)) { + _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + za_nentry_prev = za->nentry; + if (idx == ZIP_UINT64_MAX) { + zip_int64_t i = -1; + + if (flags & ZIP_FL_OVERWRITE) + i = _zip_name_locate(za, name, flags, NULL); + + if (i == -1) { + /* create and use new entry, used by zip_add */ + if ((i=_zip_add_entry(za)) < 0) + return -1; + } + idx = (zip_uint64_t)i; + } + + if (name && _zip_set_name(za, idx, name, flags) != 0) { + if (za->nentry != za_nentry_prev) { + _zip_entry_finalize(za->entry+idx); + za->nentry = za_nentry_prev; + } + return -1; + } + + /* does not change any name related data, so we can do it here; + * needed for a double add of the same file name */ + _zip_unchange_data(za->entry+idx); + + if (za->entry[idx].orig != NULL && (za->entry[idx].changes == NULL || (za->entry[idx].changes->changed & ZIP_DIRENT_COMP_METHOD) == 0)) { + if (za->entry[idx].changes == NULL) { + if ((za->entry[idx].changes=_zip_dirent_clone(za->entry[idx].orig)) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + } + + za->entry[idx].changes->comp_method = ZIP_CM_REPLACED_DEFAULT; + za->entry[idx].changes->changed |= ZIP_DIRENT_COMP_METHOD; + } + + za->entry[idx].source = source; + + return (zip_int64_t)idx; +} diff --git a/ext/zip/lib/zip_file_set_comment.c b/ext/zip/lib/zip_file_set_comment.c new file mode 100644 index 0000000000000..722f3d43cc3d3 --- /dev/null +++ b/ext/zip/lib/zip_file_set_comment.c @@ -0,0 +1,105 @@ +/* + zip_file_set_comment.c -- set comment for file in archive + Copyright (C) 2006-2012 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include + +#include "zipint.h" + + + +ZIP_EXTERN int +zip_file_set_comment(struct zip *za, zip_uint64_t idx, + const char *comment, zip_uint16_t len, zip_flags_t flags) +{ + struct zip_entry *e; + struct zip_string *cstr; + int changed; + + if (_zip_get_dirent(za, idx, 0, NULL) == NULL) + return -1; + + if (ZIP_IS_RDONLY(za)) { + _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + if (len > 0 && comment == NULL) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (len > 0) { + if ((cstr=_zip_string_new((const zip_uint8_t *)comment, len, flags, &za->error)) == NULL) + return -1; + if ((flags & ZIP_FL_ENCODING_ALL) == ZIP_FL_ENC_GUESS && _zip_guess_encoding(cstr, ZIP_ENCODING_UNKNOWN) == ZIP_ENCODING_UTF8_GUESSED) + cstr->encoding = ZIP_ENCODING_UTF8_KNOWN; + } + else + cstr = NULL; + + e = za->entry+idx; + + if (e->changes) { + _zip_string_free(e->changes->comment); + e->changes->comment = NULL; + e->changes->changed &= ~ZIP_DIRENT_COMMENT; + } + + if (e->orig && e->orig->comment) + changed = !_zip_string_equal(e->orig->comment, cstr); + else + changed = (cstr != NULL); + + if (changed) { + if (e->changes == NULL) { + if ((e->changes=_zip_dirent_clone(e->orig)) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + _zip_string_free(cstr); + return -1; + } + } + e->changes->comment = cstr; + e->changes->changed |= ZIP_DIRENT_COMMENT; + } + else { + _zip_string_free(cstr); + if (e->changes && e->changes->changed == 0) { + _zip_dirent_free(e->changes); + e->changes = NULL; + } + } + + return 0; +} diff --git a/ext/zip/lib/zip_file_strerror.c b/ext/zip/lib/zip_file_strerror.c index c2864f2ba1aaf..9ba70f14ff52b 100644 --- a/ext/zip/lib/zip_file_strerror.c +++ b/ext/zip/lib/zip_file_strerror.c @@ -37,7 +37,7 @@ -ZIP_EXTERN(const char *) +ZIP_EXTERN const char * zip_file_strerror(struct zip_file *zf) { return _zip_error_strerror(&zf->error); diff --git a/ext/zip/lib/zip_filerange_crc.c b/ext/zip/lib/zip_filerange_crc.c index 4d1ad566929f8..3b1c868407ef9 100644 --- a/ext/zip/lib/zip_filerange_crc.c +++ b/ext/zip/lib/zip_filerange_crc.c @@ -1,6 +1,6 @@ /* zip_filerange_crc.c -- compute CRC32 for a range of a file - Copyright (C) 2008 Dieter Baron and Thomas Klausner + Copyright (C) 2008-2013 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -56,13 +56,13 @@ _zip_filerange_crc(FILE *fp, off_t start, off_t len, uLong *crcp, } while (len > 0) { - n = len > BUFSIZE ? BUFSIZE : len; - if ((n=fread(buf, 1, n, fp)) <= 0) { + n = len > BUFSIZE ? BUFSIZE : (size_t)len; + if ((n=fread(buf, 1, n, fp)) == 0) { _zip_error_set(errp, ZIP_ER_READ, errno); return -1; } - *crcp = crc32(*crcp, buf, n); + *crcp = crc32(*crcp, buf, (uInt)n); len-= n; } diff --git a/ext/zip/lib/zip_fopen.c b/ext/zip/lib/zip_fopen.c index f62adbbf92692..331f79ea36149 100644 --- a/ext/zip/lib/zip_fopen.c +++ b/ext/zip/lib/zip_fopen.c @@ -37,13 +37,13 @@ -ZIP_EXTERN(struct zip_file *) -zip_fopen(struct zip *za, const char *fname, int flags) +ZIP_EXTERN struct zip_file * +zip_fopen(struct zip *za, const char *fname, zip_flags_t flags) { - int idx; + zip_int64_t idx; if ((idx=zip_name_locate(za, fname, flags)) < 0) return NULL; - return zip_fopen_index_encrypted(za, idx, flags, za->default_password); + return zip_fopen_index_encrypted(za, (zip_uint64_t)idx, flags, za->default_password); } diff --git a/ext/zip/lib/zip_fopen_encrypted.c b/ext/zip/lib/zip_fopen_encrypted.c index 8aba0625672bc..34230f00d7c0a 100644 --- a/ext/zip/lib/zip_fopen_encrypted.c +++ b/ext/zip/lib/zip_fopen_encrypted.c @@ -37,14 +37,13 @@ -ZIP_EXTERN(struct zip_file *) -zip_fopen_encrypted(struct zip *za, const char *fname, int flags, - const char *password) +ZIP_EXTERN struct zip_file * +zip_fopen_encrypted(struct zip *za, const char *fname, zip_flags_t flags, const char *password) { - int idx; + zip_int64_t idx; if ((idx=zip_name_locate(za, fname, flags)) < 0) return NULL; - return zip_fopen_index_encrypted(za, idx, flags, password); + return zip_fopen_index_encrypted(za, (zip_uint64_t)idx, flags, password); } diff --git a/ext/zip/lib/zip_fopen_index.c b/ext/zip/lib/zip_fopen_index.c index b60fd33e8f53e..30466ffa19a59 100644 --- a/ext/zip/lib/zip_fopen_index.c +++ b/ext/zip/lib/zip_fopen_index.c @@ -1,6 +1,6 @@ /* zip_fopen_index.c -- open file in zip archive for reading by index - Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2013 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -41,8 +41,8 @@ -ZIP_EXTERN(struct zip_file *) -zip_fopen_index(struct zip *za, zip_uint64_t fileno, int flags) +ZIP_EXTERN struct zip_file * +zip_fopen_index(struct zip *za, zip_uint64_t index, zip_flags_t flags) { - return zip_fopen_index_encrypted(za, fileno, flags, za->default_password); + return zip_fopen_index_encrypted(za, index, flags, za->default_password); } diff --git a/ext/zip/lib/zip_fopen_index_encrypted.c b/ext/zip/lib/zip_fopen_index_encrypted.c index 988a78fe03f9a..cc81ca7f53b67 100644 --- a/ext/zip/lib/zip_fopen_index_encrypted.c +++ b/ext/zip/lib/zip_fopen_index_encrypted.c @@ -1,6 +1,6 @@ /* zip_fopen_index_encrypted.c -- open file for reading by index w/ password - Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2013 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -43,103 +43,15 @@ static struct zip_file *_zip_file_new(struct zip *za); -ZIP_EXTERN(struct zip_file *) -zip_fopen_index_encrypted(struct zip *za, zip_uint64_t fileno, int flags, +ZIP_EXTERN struct zip_file * +zip_fopen_index_encrypted(struct zip *za, zip_uint64_t index, zip_flags_t flags, const char *password) { struct zip_file *zf; - zip_compression_implementation comp_impl; - zip_encryption_implementation enc_impl; - struct zip_source *src, *s2; - zip_uint64_t start; - struct zip_stat st; - - if (fileno >= za->nentry) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return NULL; - } + struct zip_source *src; - if ((flags & ZIP_FL_UNCHANGED) == 0 - && ZIP_ENTRY_DATA_CHANGED(za->entry+fileno)) { - _zip_error_set(&za->error, ZIP_ER_CHANGED, 0); + if ((src=_zip_source_zip_new(za, za, index, flags, 0, 0, password)) == NULL) return NULL; - } - - if (fileno >= za->cdir->nentry) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return NULL; - } - - if (flags & ZIP_FL_ENCRYPTED) - flags |= ZIP_FL_COMPRESSED; - - zip_stat_index(za, fileno, flags, &st); - - enc_impl = NULL; - if ((flags & ZIP_FL_ENCRYPTED) == 0) { - if (st.encryption_method != ZIP_EM_NONE) { - if (password == NULL) { - _zip_error_set(&za->error, ZIP_ER_NOPASSWD, 0); - return NULL; - } - if ((enc_impl=zip_get_encryption_implementation( - st.encryption_method)) == NULL) { - _zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0); - return NULL; - } - } - } - - comp_impl = NULL; - if ((flags & ZIP_FL_COMPRESSED) == 0) { - if (st.comp_method != ZIP_CM_STORE) { - if ((comp_impl=zip_get_compression_implementation( - st.comp_method)) == NULL) { - _zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0); - return NULL; - } - } - } - - if ((start=_zip_file_get_offset(za, fileno)) == 0) - return NULL; - - if (st.comp_size == 0) { - if ((src=zip_source_buffer(za, NULL, 0, 0)) == NULL) - return NULL; - } - else { - if ((src=_zip_source_file_or_p(za, NULL, za->zp, start, st.comp_size, - 0, &st)) == NULL) - return NULL; - if (enc_impl) { - if ((s2=enc_impl(za, src, ZIP_EM_TRAD_PKWARE, 0, - password)) == NULL) { - zip_source_free(src); - /* XXX: set error (how?) */ - return NULL; - } - src = s2; - } - if (comp_impl) { - if ((s2=comp_impl(za, src, za->cdir->entry[fileno].comp_method, - 0)) == NULL) { - zip_source_free(src); - /* XXX: set error (how?) */ - return NULL; - } - src = s2; - } - if ((flags & ZIP_FL_COMPRESSED) == 0 - || st.comp_method == ZIP_CM_STORE ) { - if ((s2=zip_source_crc(za, src, 1)) == NULL) { - zip_source_free(src); - /* XXX: set error (how?) */ - return NULL; - } - src = s2; - } - } if (zip_source_open(src) < 0) { _zip_error_set_from_source(&za->error, src); @@ -147,7 +59,10 @@ zip_fopen_index_encrypted(struct zip *za, zip_uint64_t fileno, int flags, return NULL; } - zf = _zip_file_new(za); + if ((zf=_zip_file_new(za)) == NULL) { + zip_source_free(src); + return NULL; + } zf->src = src; @@ -160,14 +75,14 @@ static struct zip_file * _zip_file_new(struct zip *za) { struct zip_file *zf, **file; - int n; if ((zf=(struct zip_file *)malloc(sizeof(struct zip_file))) == NULL) { _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); return NULL; } - if (za->nfile >= za->nfile_alloc-1) { + if (za->nfile+1 >= za->nfile_alloc) { + unsigned int n; n = za->nfile_alloc + 10; file = (struct zip_file **)realloc(za->file, n*sizeof(struct zip_file *)); diff --git a/ext/zip/lib/zip_fread.c b/ext/zip/lib/zip_fread.c index a6c0851b0aaac..8235c6dfacf80 100644 --- a/ext/zip/lib/zip_fread.c +++ b/ext/zip/lib/zip_fread.c @@ -37,7 +37,7 @@ -ZIP_EXTERN(zip_int64_t) +ZIP_EXTERN zip_int64_t zip_fread(struct zip_file *zf, void *outbuf, zip_uint64_t toread) { zip_int64_t n; diff --git a/ext/zip/lib/zip_get_archive_comment.c b/ext/zip/lib/zip_get_archive_comment.c index fe97e6e8c18a1..202f761f4e852 100644 --- a/ext/zip/lib/zip_get_archive_comment.c +++ b/ext/zip/lib/zip_get_archive_comment.c @@ -1,6 +1,6 @@ /* zip_get_archive_comment.c -- get archive comment - Copyright (C) 2006-2007 Dieter Baron and Thomas Klausner + Copyright (C) 2006-2012 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -33,28 +33,29 @@ +#include + #include "zipint.h" -ZIP_EXTERN(const char *) -zip_get_archive_comment(struct zip *za, int *lenp, int flags) +ZIP_EXTERN const char * +zip_get_archive_comment(struct zip *za, int *lenp, zip_flags_t flags) { - if ((flags & ZIP_FL_UNCHANGED) - || (za->ch_comment_len == -1)) { - if (za->cdir) { - if (lenp != NULL) - *lenp = za->cdir->comment_len; - return za->cdir->comment; - } - else { - if (lenp != NULL) - *lenp = -1; - return NULL; - } - } - - if (lenp != NULL) - *lenp = za->ch_comment_len; - return za->ch_comment; + struct zip_string *comment; + zip_uint32_t len; + const zip_uint8_t *str; + + if ((flags & ZIP_FL_UNCHANGED) || (za->comment_changes == NULL)) + comment = za->comment_orig; + else + comment = za->comment_changes; + + if ((str=_zip_string_get(comment, &len, flags, &za->error)) == NULL) + return NULL; + + if (lenp) + *lenp = (int)len; + + return (const char *)str; } diff --git a/ext/zip/lib/zip_get_archive_flag.c b/ext/zip/lib/zip_get_archive_flag.c index 2d46aa39ffbb4..c3be5c14fec38 100644 --- a/ext/zip/lib/zip_get_archive_flag.c +++ b/ext/zip/lib/zip_get_archive_flag.c @@ -37,10 +37,10 @@ -ZIP_EXTERN(int) -zip_get_archive_flag(struct zip *za, int flag, int flags) +ZIP_EXTERN int +zip_get_archive_flag(struct zip *za, unsigned int flag, zip_flags_t flags) { - int fl; + unsigned int fl; fl = (flags & ZIP_FL_UNCHANGED) ? za->flags : za->ch_flags; diff --git a/ext/zip/lib/zip_get_compression_implementation.c b/ext/zip/lib/zip_get_compression_implementation.c index 197cd49635d41..aa4a1605c0f36 100644 --- a/ext/zip/lib/zip_get_compression_implementation.c +++ b/ext/zip/lib/zip_get_compression_implementation.c @@ -37,10 +37,10 @@ -ZIP_EXTERN(zip_compression_implementation) -zip_get_compression_implementation(zip_uint16_t cm) +zip_compression_implementation +_zip_get_compression_implementation(zip_int32_t cm) { - if (cm == ZIP_CM_DEFLATE) + if (cm == ZIP_CM_DEFLATE || ZIP_CM_IS_DEFAULT(cm)) return zip_source_deflate; return NULL; } diff --git a/ext/zip/lib/zip_get_encryption_implementation.c b/ext/zip/lib/zip_get_encryption_implementation.c index 783d538d3f6ff..7dcb99210d498 100644 --- a/ext/zip/lib/zip_get_encryption_implementation.c +++ b/ext/zip/lib/zip_get_encryption_implementation.c @@ -37,8 +37,8 @@ -ZIP_EXTERN(zip_encryption_implementation) -zip_get_encryption_implementation(zip_uint16_t em) +zip_encryption_implementation +_zip_get_encryption_implementation(zip_uint16_t em) { if (em == ZIP_EM_TRAD_PKWARE) return zip_source_pkware; diff --git a/ext/zip/lib/zip_get_file_comment.c b/ext/zip/lib/zip_get_file_comment.c index 43c1520e1d438..3be459d4da6b0 100644 --- a/ext/zip/lib/zip_get_file_comment.c +++ b/ext/zip/lib/zip_get_file_comment.c @@ -1,6 +1,6 @@ /* zip_get_file_comment.c -- get file comment - Copyright (C) 2006-2007 Dieter Baron and Thomas Klausner + Copyright (C) 2006-2012 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -33,26 +33,21 @@ +#define _ZIP_COMPILING_DEPRECATED #include "zipint.h" -ZIP_EXTERN(const char *) +ZIP_EXTERN const char * zip_get_file_comment(struct zip *za, zip_uint64_t idx, int *lenp, int flags) { - if (idx >= za->nentry) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return NULL; - } + zip_uint32_t len; + const char *s; - if ((flags & ZIP_FL_UNCHANGED) - || (za->entry[idx].ch_comment_len == -1)) { - if (lenp != NULL) - *lenp = za->cdir->entry[idx].comment_len; - return za->cdir->entry[idx].comment; + if ((s=zip_file_get_comment(za, idx, &len, (zip_flags_t)flags)) != NULL) { + if (lenp) + *lenp = (int)len; } - - if (lenp != NULL) - *lenp = za->entry[idx].ch_comment_len; - return za->entry[idx].ch_comment; + + return s; } diff --git a/ext/zip/lib/zip_get_name.c b/ext/zip/lib/zip_get_name.c index 945e24e1501d5..f67c7caf4305f 100644 --- a/ext/zip/lib/zip_get_name.c +++ b/ext/zip/lib/zip_get_name.c @@ -1,6 +1,6 @@ /* zip_get_name.c -- get filename for a file in zip file - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2012 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -33,12 +33,14 @@ +#include + #include "zipint.h" -ZIP_EXTERN(const char *) -zip_get_name(struct zip *za, zip_uint64_t idx, int flags) +ZIP_EXTERN const char * +zip_get_name(struct zip *za, zip_uint64_t idx, zip_flags_t flags) { return _zip_get_name(za, idx, flags, &za->error); } @@ -46,27 +48,16 @@ zip_get_name(struct zip *za, zip_uint64_t idx, int flags) const char * -_zip_get_name(struct zip *za, zip_uint64_t idx, int flags, - struct zip_error *error) +_zip_get_name(struct zip *za, zip_uint64_t idx, zip_flags_t flags, struct zip_error *error) { - if (idx >= za->nentry) { - _zip_error_set(error, ZIP_ER_INVAL, 0); - return NULL; - } + struct zip_dirent *de; + const zip_uint8_t *str; - if ((flags & ZIP_FL_UNCHANGED) == 0) { - if (za->entry[idx].state == ZIP_ST_DELETED) { - _zip_error_set(error, ZIP_ER_DELETED, 0); - return NULL; - } - if (za->entry[idx].ch_filename) - return za->entry[idx].ch_filename; - } + if ((de=_zip_get_dirent(za, idx, flags, error)) == NULL) + return NULL; - if (za->cdir == NULL || idx >= za->cdir->nentry) { - _zip_error_set(error, ZIP_ER_INVAL, 0); + if ((str=_zip_string_get(de->filename, NULL, flags, error)) == NULL) return NULL; - } - - return za->cdir->entry[idx].filename; + + return (const char *)str; } diff --git a/ext/zip/lib/zip_get_num_entries.c b/ext/zip/lib/zip_get_num_entries.c index dd392e909592e..26484baff22a6 100644 --- a/ext/zip/lib/zip_get_num_entries.c +++ b/ext/zip/lib/zip_get_num_entries.c @@ -37,16 +37,19 @@ -ZIP_EXTERN(zip_uint64_t) -zip_get_num_entries(struct zip *za, int flags) +ZIP_EXTERN zip_int64_t +zip_get_num_entries(struct zip *za, zip_flags_t flags) { + zip_uint64_t n; + if (za == NULL) return -1; if (flags & ZIP_FL_UNCHANGED) { - if (za->cdir == NULL) - return 0; - return za->cdir->nentry; + n = za->nentry; + while (n>0 && za->entry[n-1].orig == NULL) + --n; + return (zip_int64_t)n; } - return za->nentry; + return (zip_int64_t)za->nentry; } diff --git a/ext/zip/lib/zip_get_num_files.c b/ext/zip/lib/zip_get_num_files.c index a442f293ec350..29b06dc8193ff 100644 --- a/ext/zip/lib/zip_get_num_files.c +++ b/ext/zip/lib/zip_get_num_files.c @@ -33,15 +33,17 @@ +#define _ZIP_COMPILING_DEPRECATED #include "zipint.h" -ZIP_EXTERN(int) +ZIP_EXTERN int zip_get_num_files(struct zip *za) { if (za == NULL) return -1; - return za->nentry; + /* XXX: check for overflow */ + return (int)za->nentry; } diff --git a/ext/zip/lib/zip_memdup.c b/ext/zip/lib/zip_memdup.c index 641125ed2d1b2..06af2dabd36c7 100644 --- a/ext/zip/lib/zip_memdup.c +++ b/ext/zip/lib/zip_memdup.c @@ -1,6 +1,6 @@ /* zip_memdup.c -- internal zip function, "strdup" with len - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2012 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -43,6 +43,9 @@ _zip_memdup(const void *mem, size_t len, struct zip_error *error) { void *ret; + if (len == 0) + return NULL; + ret = malloc(len); if (!ret) { _zip_error_set(error, ZIP_ER_MEMORY, 0); diff --git a/ext/zip/lib/zip_name_locate.c b/ext/zip/lib/zip_name_locate.c index 8cdd2c4d7ea0b..3cac110543672 100644 --- a/ext/zip/lib/zip_name_locate.c +++ b/ext/zip/lib/zip_name_locate.c @@ -34,26 +34,28 @@ #include +#ifdef HAVE_STRINGS_H +#include +#endif #include "zipint.h" -ZIP_EXTERN(int) -zip_name_locate(struct zip *za, const char *fname, int flags) +ZIP_EXTERN zip_int64_t +zip_name_locate(struct zip *za, const char *fname, zip_flags_t flags) { return _zip_name_locate(za, fname, flags, &za->error); } -int -_zip_name_locate(struct zip *za, const char *fname, int flags, - struct zip_error *error) +zip_int64_t +_zip_name_locate(struct zip *za, const char *fname, zip_flags_t flags, struct zip_error *error) { int (*cmp)(const char *, const char *); const char *fn, *p; - int i, n; + zip_uint64_t i; if (za == NULL) return -1; @@ -63,21 +65,12 @@ _zip_name_locate(struct zip *za, const char *fname, int flags, return -1; } - if ((flags & ZIP_FL_UNCHANGED) && za->cdir == NULL) { - _zip_error_set(error, ZIP_ER_NOENT, 0); - return -1; - } - - cmp = (flags & ZIP_FL_NOCASE) ? strcmpi : strcmp; + cmp = (flags & ZIP_FL_NOCASE) ? strcasecmp : strcmp; - n = (flags & ZIP_FL_UNCHANGED) ? za->cdir->nentry : za->nentry; - for (i=0; icdir->entry[i].filename; - else - fn = _zip_get_name(za, i, flags, error); + for (i=0; inentry; i++) { + fn = _zip_get_name(za, i, flags, error); - /* newly added (partially filled) entry */ + /* newly added (partially filled) entry or error */ if (fn == NULL) continue; @@ -87,11 +80,12 @@ _zip_name_locate(struct zip *za, const char *fname, int flags, fn = p+1; } - if (cmp(fname, fn) == 0) - return i; + if (cmp(fname, fn) == 0) { + _zip_error_clear(error); + return (zip_int64_t)i; + } } -/* Look for an entry should not raise an error */ -/* _zip_error_set(error, ZIP_ER_NOENT, 0);*/ + _zip_error_set(error, ZIP_ER_NOENT, 0); return -1; } diff --git a/ext/zip/lib/zip_new.c b/ext/zip/lib/zip_new.c index 7ce1237cdbabd..f77634a389f36 100644 --- a/ext/zip/lib/zip_new.c +++ b/ext/zip/lib/zip_new.c @@ -1,6 +1,6 @@ /* zip_new.c -- create and init struct zip - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2012 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -56,16 +56,17 @@ _zip_new(struct zip_error *error) za->zn = NULL; za->zp = NULL; + za->open_flags = 0; _zip_error_init(&za->error); - za->cdir = NULL; - za->ch_comment = NULL; - za->ch_comment_len = -1; + za->flags = za->ch_flags = 0; + za->default_password = NULL; + za->comment_orig = za->comment_changes = NULL; + za->comment_changed = 0; za->nentry = za->nentry_alloc = 0; za->entry = NULL; za->nfile = za->nfile_alloc = 0; za->file = NULL; - za->flags = za->ch_flags = 0; - za->default_password = NULL; + za->tempdir = NULL; return za; } diff --git a/ext/zip/lib/zip_open.c b/ext/zip/lib/zip_open.c index 5ce1c1070ae03..e6a30d5ae7066 100644 --- a/ext/zip/lib/zip_open.c +++ b/ext/zip/lib/zip_open.c @@ -1,6 +1,6 @@ /* zip_open.c -- open zip archive by name - Copyright (C) 1999-2011 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2012 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -42,38 +42,53 @@ #include "zipint.h" -static void set_error(int *, struct zip_error *, int); -static struct zip *_zip_allocate_new(const char *, int *); -static int _zip_checkcons(FILE *, struct zip_cdir *, struct zip_error *); -static void _zip_check_torrentzip(struct zip *); -static struct zip_cdir *_zip_find_central_dir(FILE *, int, int *, off_t); -static int _zip_file_exists(const char *, int, int *); -static int _zip_headercomp(struct zip_dirent *, int, - struct zip_dirent *, int); -static unsigned char *_zip_memmem(const unsigned char *, int, - const unsigned char *, int); -static struct zip_cdir *_zip_readcdir(FILE *, off_t, unsigned char *, unsigned char *, - int, int, struct zip_error *); +static void set_error(int *, const struct zip_error *, int); +static struct zip *_zip_allocate_new(const char *, unsigned int, int *); +static zip_int64_t _zip_checkcons(FILE *, struct zip_cdir *, struct zip_error *); +static void _zip_check_torrentzip(struct zip *, const struct zip_cdir *); +static struct zip_cdir *_zip_find_central_dir(FILE *, unsigned int, int *, off_t); +static int _zip_file_exists(const char *, unsigned int, int *); +static int _zip_headercomp(const struct zip_dirent *, const struct zip_dirent *); +static unsigned char *_zip_memmem(const unsigned char *, size_t, + const unsigned char *, size_t); +static struct zip_cdir *_zip_readcdir(FILE *, off_t, unsigned char *, const unsigned char *, + size_t, unsigned int, struct zip_error *); +static struct zip_cdir *_zip_read_eocd(const unsigned char *, const unsigned char *, off_t, + size_t, unsigned int, struct zip_error *); +static struct zip_cdir *_zip_read_eocd64(FILE *, const unsigned char *, const unsigned char *, + off_t, size_t, unsigned int, struct zip_error *); -ZIP_EXTERN(struct zip *) -zip_open(const char *fn, int flags, int *zep) +ZIP_EXTERN struct zip * +zip_open(const char *fn, int _flags, int *zep) { FILE *fp; - - if (flags & ZIP_OVERWRITE) { - return _zip_allocate_new(fn, zep); + unsigned int flags; + + if (_flags < 0) { + if (zep) + *zep = ZIP_ER_INVAL; + return NULL; } - + flags = (unsigned int)_flags; + switch (_zip_file_exists(fn, flags, zep)) { case -1: - if (!(flags & ZIP_OVERWRITE)) { - return NULL; - } + return NULL; case 0: - return _zip_allocate_new(fn, zep); + return _zip_allocate_new(fn, flags, zep); default: + if (flags & ZIP_TRUNCATE) { + FILE *f; + + if ((f = fopen(fn, "rb")) == NULL) { + set_error(zep, NULL, ZIP_ER_OPEN); + return NULL; + } + fclose(f); + return _zip_allocate_new(fn, flags, zep); + } break; } @@ -82,17 +97,36 @@ zip_open(const char *fn, int flags, int *zep) return NULL; } - return _zip_open(fn, fp, flags, 0, zep); + return _zip_open(fn, fp, flags, zep); } + +ZIP_EXTERN int +zip_archive_set_tempdir(struct zip *za, const char *tempdir) +{ + char *new_tempdir; + + if (tempdir) { + if ((new_tempdir = strdup(tempdir)) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, errno); + return -1; + } + } + else + new_tempdir = NULL; + + free(za->tempdir); + za->tempdir = new_tempdir; + + return 0; +} struct zip * -_zip_open(const char *fn, FILE *fp, int flags, int aflags, int *zep) +_zip_open(const char *fn, FILE *fp, unsigned int flags, int *zep) { struct zip *za; struct zip_cdir *cdir; - int i; off_t len; if (fseeko(fp, 0, SEEK_END) < 0) { @@ -103,7 +137,7 @@ _zip_open(const char *fn, FILE *fp, int flags, int aflags, int *zep) /* treat empty files as empty archives */ if (len == 0) { - if ((za=_zip_allocate_new(fn, zep)) == NULL) + if ((za=_zip_allocate_new(fn, flags, zep)) == NULL) fclose(fp); else za->zp = fp; @@ -116,34 +150,32 @@ _zip_open(const char *fn, FILE *fp, int flags, int aflags, int *zep) return NULL; } - if ((za=_zip_allocate_new(fn, zep)) == NULL) { + if ((za=_zip_allocate_new(fn, flags, zep)) == NULL) { _zip_cdir_free(cdir); fclose(fp); return NULL; } - za->cdir = cdir; + za->entry = cdir->entry; + za->nentry = cdir->nentry; + za->nentry_alloc = cdir->nentry_alloc; + za->comment_orig = cdir->comment; + za->zp = fp; - if ((za->entry=(struct zip_entry *)malloc(sizeof(*(za->entry)) - * cdir->nentry)) == NULL) { - set_error(zep, NULL, ZIP_ER_MEMORY); - _zip_free(za); - return NULL; - } - for (i=0; inentry; i++) - _zip_entry_new(za); + _zip_check_torrentzip(za, cdir); - _zip_check_torrentzip(za); za->ch_flags = za->flags; + free(cdir); + return za; } static void -set_error(int *zep, struct zip_error *err, int ze) +set_error(int *zep, const struct zip_error *err, int ze) { int se; @@ -166,16 +198,17 @@ set_error(int *zep, struct zip_error *err, int ze) entries, or NULL if unsuccessful. */ static struct zip_cdir * -_zip_readcdir(FILE *fp, off_t buf_offset, unsigned char *buf, unsigned char *eocd, int buflen, - int flags, struct zip_error *error) +_zip_readcdir(FILE *fp, off_t buf_offset, unsigned char *buf, const unsigned char *eocd, size_t buflen, + unsigned int flags, struct zip_error *error) { struct zip_cdir *cd; - unsigned char *cdp, **bufp; - int i, comlen, nentry; - zip_uint32_t left; + const unsigned char *cdp; + const unsigned char **bufp; + zip_int64_t tail_len, comment_len; + zip_uint64_t i, left; - comlen = buf + buflen - eocd - EOCDLEN; - if (comlen < 0) { + tail_len = buf + buflen - eocd - EOCDLEN; + if (tail_len < 0) { /* not enough bytes left for comment */ _zip_error_set(error, ZIP_ER_NOZIP, 0); return NULL; @@ -192,46 +225,32 @@ _zip_readcdir(FILE *fp, off_t buf_offset, unsigned char *buf, unsigned char *eoc return NULL; } - cdp = eocd + 8; - /* number of cdir-entries on this disk */ - i = _zip_read2(&cdp); - /* number of cdir-entries */ - nentry = _zip_read2(&cdp); + if (eocd-EOCD64LOCLEN >= buf && memcmp(eocd-EOCD64LOCLEN, EOCD64LOC_MAGIC, 4) == 0) + cd = _zip_read_eocd64(fp, eocd-EOCD64LOCLEN, buf, buf_offset, buflen, flags, error); + else + cd = _zip_read_eocd(eocd, buf, buf_offset, buflen, flags, error); - if ((cd=_zip_cdir_new(nentry, error)) == NULL) + if (cd == NULL) return NULL; - cd->size = _zip_read4(&cdp); - cd->offset = _zip_read4(&cdp); - cd->comment = NULL; - cd->comment_len = _zip_read2(&cdp); + cdp = eocd + 20; + comment_len = _zip_read2(&cdp); - if (((zip_uint64_t)cd->offset)+cd->size > buf_offset + (eocd-buf)) { + if ((zip_uint64_t)cd->offset+(zip_uint64_t)cd->size > (zip_uint64_t)buf_offset + (zip_uint64_t)(eocd-buf)) { /* cdir spans past EOCD record */ _zip_error_set(error, ZIP_ER_INCONS, 0); - cd->nentry = 0; _zip_cdir_free(cd); return NULL; } - if ((comlen < cd->comment_len) || (cd->nentry != i)) { - _zip_error_set(error, ZIP_ER_NOZIP, 0); - cd->nentry = 0; - _zip_cdir_free(cd); - return NULL; - } - if ((flags & ZIP_CHECKCONS) && comlen != cd->comment_len) { + if (tail_len < comment_len || ((flags & ZIP_CHECKCONS) && tail_len != comment_len)) { _zip_error_set(error, ZIP_ER_INCONS, 0); - cd->nentry = 0; _zip_cdir_free(cd); return NULL; } - if (cd->comment_len) { - if ((cd->comment=(char *)_zip_memdup(eocd+EOCDLEN, - cd->comment_len, error)) - == NULL) { - cd->nentry = 0; + if (comment_len) { + if ((cd->comment=_zip_string_new(eocd+EOCDLEN, (zip_uint16_t)comment_len, ZIP_FL_ENC_GUESS, error)) == NULL) { _zip_cdir_free(cd); return NULL; } @@ -249,40 +268,32 @@ _zip_readcdir(FILE *fp, off_t buf_offset, unsigned char *buf, unsigned char *eoc fseeko(fp, cd->offset, SEEK_SET); /* possible consistency check: cd->offset = len-(cd->size+cd->comment_len+EOCDLEN) ? */ - if (ferror(fp) || ((unsigned long)ftello(fp) != cd->offset)) { + if (ferror(fp) || (ftello(fp) != cd->offset)) { /* seek error or offset of cdir wrong */ if (ferror(fp)) _zip_error_set(error, ZIP_ER_SEEK, errno); else _zip_error_set(error, ZIP_ER_NOZIP, 0); - cd->nentry = 0; _zip_cdir_free(cd); return NULL; } } - left = cd->size; + left = (zip_uint64_t)cd->size; i=0; while (inentry && left > 0) { - if ((_zip_dirent_read(cd->entry+i, fp, bufp, &left, 0, error)) < 0) { - cd->nentry = i; + if ((cd->entry[i].orig=_zip_dirent_new()) == NULL + || (_zip_dirent_read(cd->entry[i].orig, fp, bufp, &left, 0, error)) < 0) { _zip_cdir_free(cd); return NULL; } i++; - - if (i == cd->nentry && left > 0) { - /* Infozip extension for more than 64k entries: - nentries wraps around, size indicates correct EOCD */ - if (_zip_cdir_grow(cd, cd->nentry+ZIP_UINT16_MAX, error) < 0) { - cd->nentry = i; - _zip_cdir_free(cd); - return NULL; - } - } } - - cd->nentry = i; + if (i != cd->nentry || ((flags & ZIP_CHECKCONS) && left != 0)) { + _zip_error_set(error, ZIP_ER_INCONS, 0); + _zip_cdir_free(cd); + return NULL; + } return cd; } @@ -295,84 +306,88 @@ _zip_readcdir(FILE *fp, off_t buf_offset, unsigned char *buf, unsigned char *eoc file and header offsets. Returns -1 if not plausible, else the difference between the lowest and the highest fileposition reached */ -static int +static zip_int64_t _zip_checkcons(FILE *fp, struct zip_cdir *cd, struct zip_error *error) { - int i; - unsigned int min, max, j; + zip_uint64_t i; + zip_uint64_t min, max, j; struct zip_dirent temp; if (cd->nentry) { - max = cd->entry[0].offset; - min = cd->entry[0].offset; + max = cd->entry[0].orig->offset; + min = cd->entry[0].orig->offset; } else min = max = 0; for (i=0; inentry; i++) { - if (cd->entry[i].offset < min) - min = cd->entry[i].offset; - if (min > cd->offset) { + if (cd->entry[i].orig->offset < min) + min = cd->entry[i].orig->offset; + if (min > (zip_uint64_t)cd->offset) { _zip_error_set(error, ZIP_ER_NOZIP, 0); return -1; } - j = cd->entry[i].offset + cd->entry[i].comp_size - + cd->entry[i].filename_len + LENTRYSIZE; + j = cd->entry[i].orig->offset + cd->entry[i].orig->comp_size + + _zip_string_length(cd->entry[i].orig->filename) + LENTRYSIZE; if (j > max) max = j; - if (max > cd->offset) { + if (max > (zip_uint64_t)cd->offset) { _zip_error_set(error, ZIP_ER_NOZIP, 0); return -1; } - if (fseeko(fp, cd->entry[i].offset, SEEK_SET) != 0) { - _zip_error_set(error, ZIP_ER_SEEK, 0); + if (fseeko(fp, (off_t)cd->entry[i].orig->offset, SEEK_SET) != 0) { + _zip_error_set(error, ZIP_ER_SEEK, errno); return -1; } if (_zip_dirent_read(&temp, fp, NULL, NULL, 1, error) == -1) return -1; - if (_zip_headercomp(cd->entry+i, 0, &temp, 1) != 0) { + if (_zip_headercomp(cd->entry[i].orig, &temp) != 0) { _zip_error_set(error, ZIP_ER_INCONS, 0); _zip_dirent_finalize(&temp); return -1; } + + cd->entry[i].orig->extra_fields = _zip_ef_merge(cd->entry[i].orig->extra_fields, temp.extra_fields); + cd->entry[i].orig->local_extra_fields_read = 1; + temp.extra_fields = NULL; + _zip_dirent_finalize(&temp); } - return max - min; + return (max-min) < ZIP_INT64_MAX ? (zip_int64_t)(max-min) : ZIP_INT64_MAX; } /* _zip_check_torrentzip: - check whether ZA has a valid TORRENTZIP comment, i.e. is torrentzipped */ + check wether ZA has a valid TORRENTZIP comment, i.e. is torrentzipped */ static void -_zip_check_torrentzip(struct zip *za) +_zip_check_torrentzip(struct zip *za, const struct zip_cdir *cdir) { uLong crc_got, crc_should; char buf[8+1]; char *end; - if (za->zp == NULL || za->cdir == NULL) + if (za->zp == NULL || cdir == NULL) return; - if (za->cdir->comment_len != TORRENT_SIG_LEN+8 - || strncmp(za->cdir->comment, TORRENT_SIG, TORRENT_SIG_LEN) != 0) + if (_zip_string_length(cdir->comment) != TORRENT_SIG_LEN+8 + || strncmp((const char *)cdir->comment->raw, TORRENT_SIG, TORRENT_SIG_LEN) != 0) return; - memcpy(buf, za->cdir->comment+TORRENT_SIG_LEN, 8); + memcpy(buf, cdir->comment->raw+TORRENT_SIG_LEN, 8); buf[8] = '\0'; errno = 0; crc_should = strtoul(buf, &end, 16); if ((crc_should == UINT_MAX && errno != 0) || (end && *end)) return; - if (_zip_filerange_crc(za->zp, za->cdir->offset, za->cdir->size, - &crc_got, NULL) < 0) + if (_zip_filerange_crc(za->zp, cdir->offset, cdir->size, &crc_got, NULL) < 0) return; if (crc_got == crc_should) @@ -383,68 +398,32 @@ _zip_check_torrentzip(struct zip *za) /* _zip_headercomp: - compares two headers h1 and h2; if they are local headers, set - local1p or local2p respectively to 1, else 0. Return 0 if they - are identical, -1 if not. */ + compares a central directory entry and a local file header + Return 0 if they are consistent, -1 if not. */ static int -_zip_headercomp(struct zip_dirent *h1, int local1p, struct zip_dirent *h2, - int local2p) +_zip_headercomp(const struct zip_dirent *central, const struct zip_dirent *local) { - if ((h1->version_needed != h2->version_needed) + if ((central->version_needed != local->version_needed) #if 0 /* some zip-files have different values in local and global headers for the bitflags */ - || (h1->bitflags != h2->bitflags) + || (central->bitflags != local->bitflags) #endif - || (h1->comp_method != h2->comp_method) - || (h1->last_mod != h2->last_mod) - || (h1->filename_len != h2->filename_len) - || !h1->filename || !h2->filename - || strcmp(h1->filename, h2->filename)) + || (central->comp_method != local->comp_method) + || (central->last_mod != local->last_mod) + || !_zip_string_equal(central->filename, local->filename)) return -1; - /* check that CRC and sizes are zero if data descriptor is used */ - if ((h1->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) && local1p - && (h1->crc != 0 - || h1->comp_size != 0 - || h1->uncomp_size != 0)) - return -1; - if ((h2->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) && local2p - && (h2->crc != 0 - || h2->comp_size != 0 - || h2->uncomp_size != 0)) - return -1; - - /* check that CRC and sizes are equal if no data descriptor is used */ - if (((h1->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) == 0 || local1p == 0) - && ((h2->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) == 0 || local2p == 0)) { - if ((h1->crc != h2->crc) - || (h1->comp_size != h2->comp_size) - || (h1->uncomp_size != h2->uncomp_size)) + + if ((central->crc != local->crc) || (central->comp_size != local->comp_size) + || (central->uncomp_size != local->uncomp_size)) { + /* InfoZip stores valid values in local header even when data descriptor is used. + This is in violation of the appnote. */ + if (((local->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) == 0 + || local->crc != 0 || local->comp_size != 0 || local->uncomp_size != 0)) return -1; } - - if ((local1p == local2p) - && ((h1->extrafield_len != h2->extrafield_len) - || (h1->extrafield_len && h2->extrafield - && memcmp(h1->extrafield, h2->extrafield, - h1->extrafield_len)))) - return -1; - - /* if either is local, nothing more to check */ - if (local1p || local2p) - return 0; - - if ((h1->version_madeby != h2->version_madeby) - || (h1->disk_number != h2->disk_number) - || (h1->int_attrib != h2->int_attrib) - || (h1->ext_attrib != h2->ext_attrib) - || (h1->offset != h2->offset) - || (h1->comment_len != h2->comment_len) - || (h1->comment_len && h2->comment - && memcmp(h1->comment, h2->comment, h1->comment_len))) - return -1; return 0; } @@ -452,7 +431,7 @@ _zip_headercomp(struct zip_dirent *h1, int local1p, struct zip_dirent *h2, static struct zip * -_zip_allocate_new(const char *fn, int *zep) +_zip_allocate_new(const char *fn, unsigned int flags, int *zep) { struct zip *za; struct zip_error error; @@ -467,18 +446,19 @@ _zip_allocate_new(const char *fn, int *zep) else { za->zn = strdup(fn); if (!za->zn) { - _zip_free(za); + zip_discard(za); set_error(zep, NULL, ZIP_ER_MEMORY); return NULL; } } + za->open_flags = flags; return za; } static int -_zip_file_exists(const char *fn, int flags, int *zep) +_zip_file_exists(const char *fn, unsigned int flags, int *zep) { struct stat st; @@ -488,7 +468,7 @@ _zip_file_exists(const char *fn, int flags, int *zep) } if (stat(fn, &st) != 0) { - if (flags & ZIP_CREATE || flags & ZIP_OVERWRITE) + if (flags & ZIP_CREATE) return 0; else { set_error(zep, NULL, ZIP_ER_OPEN); @@ -508,12 +488,14 @@ _zip_file_exists(const char *fn, int flags, int *zep) static struct zip_cdir * -_zip_find_central_dir(FILE *fp, int flags, int *zep, off_t len) +_zip_find_central_dir(FILE *fp, unsigned int flags, int *zep, off_t len) { struct zip_cdir *cdir, *cdirnew; unsigned char *buf, *match; off_t buf_offset; - int a, best, buflen, i; + size_t buflen; + zip_int64_t a, i; + zip_int64_t best; struct zip_error zerr; i = fseeko(fp, -(len < CDBUFSIZE ? len : CDBUFSIZE), SEEK_END); @@ -541,10 +523,10 @@ _zip_find_central_dir(FILE *fp, int flags, int *zep, off_t len) best = -1; cdir = NULL; - match = buf; + match = buf+ (buflen < CDBUFSIZE ? 0 : EOCD64LOCLEN); _zip_error_set(&zerr, ZIP_ER_NOZIP, 0); - while ((match=_zip_memmem(match, buflen-(match-buf)-18, + while ((match=_zip_memmem(match, buflen-(size_t)(match-buf)-(EOCDLEN-4), (const unsigned char *)EOCD_MAGIC, 4))!=NULL) { /* found match -- check, if good */ /* to avoid finding the same match all over again */ @@ -589,8 +571,7 @@ _zip_find_central_dir(FILE *fp, int flags, int *zep, off_t len) static unsigned char * -_zip_memmem(const unsigned char *big, int biglen, const unsigned char *little, - int littlelen) +_zip_memmem(const unsigned char *big, size_t biglen, const unsigned char *little, size_t littlelen) { const unsigned char *p; @@ -598,11 +579,159 @@ _zip_memmem(const unsigned char *big, int biglen, const unsigned char *little, return NULL; p = big-1; while ((p=(const unsigned char *) - memchr(p+1, little[0], (size_t)(big-(p+1)+biglen-littlelen+1))) - != NULL) { + memchr(p+1, little[0], (size_t)(big-(p+1))+(size_t)(biglen-littlelen)+1)) != NULL) { if (memcmp(p+1, little+1, littlelen-1)==0) return (unsigned char *)p; } return NULL; } + + + +static struct zip_cdir * +_zip_read_eocd(const unsigned char *eocd, const unsigned char *buf, off_t buf_offset, size_t buflen, + unsigned int flags, struct zip_error *error) +{ + struct zip_cdir *cd; + const unsigned char *cdp; + zip_uint64_t i, nentry, size, offset; + + if (eocd+EOCDLEN > buf+buflen) { + _zip_error_set(error, ZIP_ER_INCONS, 0); + return NULL; + } + + cdp = eocd + 8; + + /* number of cdir-entries on this disk */ + i = _zip_read2(&cdp); + /* number of cdir-entries */ + nentry = _zip_read2(&cdp); + + if (nentry != i) { + _zip_error_set(error, ZIP_ER_NOZIP, 0); + return NULL; + } + + size = _zip_read4(&cdp); + offset = _zip_read4(&cdp); + + if (size > ZIP_OFF_MAX || offset > ZIP_OFF_MAX || offset+size > ZIP_OFF_MAX) { + _zip_error_set(error, ZIP_ER_SEEK, EFBIG); + return NULL; + } + + if (offset+size > (zip_uint64_t)(buf_offset + (eocd-buf))) { + /* cdir spans past EOCD record */ + _zip_error_set(error, ZIP_ER_INCONS, 0); + return NULL; + } + + if ((flags & ZIP_CHECKCONS) && offset+size != (zip_uint64_t)(buf_offset + (eocd-buf))) { + _zip_error_set(error, ZIP_ER_INCONS, 0); + return NULL; + } + + if ((cd=_zip_cdir_new(nentry, error)) == NULL) + return NULL; + + cd->size = (off_t)size; + cd->offset = (off_t)offset; + + return cd; +} + + + +static struct zip_cdir * +_zip_read_eocd64(FILE *f, const zip_uint8_t *eocd64loc, const zip_uint8_t *buf, + off_t buf_offset, size_t buflen, unsigned int flags, struct zip_error *error) +{ + struct zip_cdir *cd; + zip_uint64_t offset; + const zip_uint8_t *cdp; + zip_uint8_t eocd[EOCD64LEN]; + zip_uint64_t eocd_offset; + zip_uint64_t size, nentry, i; + + cdp = eocd64loc+8; + eocd_offset = _zip_read8(&cdp); + + if (eocd_offset > ZIP_OFF_MAX || eocd_offset + EOCD64LEN > ZIP_OFF_MAX) { + _zip_error_set(error, ZIP_ER_SEEK, EFBIG); + return NULL; + } + + if (eocd64loc < buf || (off_t)eocd_offset+EOCD64LEN > (buf_offset+(eocd64loc-buf))) { + _zip_error_set(error, ZIP_ER_INCONS, 0); + return NULL; + } + + if ((off_t)eocd_offset >= buf_offset && (off_t)eocd_offset+EOCD64LEN <= buf_offset+(ssize_t)buflen) + cdp = buf+((off_t)eocd_offset-buf_offset); + else { + if (fseeko(f, (off_t)eocd_offset, SEEK_SET) != 0) { + _zip_error_set(error, ZIP_ER_SEEK, errno); + return NULL; + } + + clearerr(f); + if (fread(eocd, 1, EOCD64LEN, f) < EOCD64LEN) { + _zip_error_set(error, ZIP_ER_READ, errno); + return NULL; + } + + if (ferror(f)) { + _zip_error_set(error, ZIP_ER_READ, errno); + return NULL; + } + + cdp = eocd; + } + + if (memcmp(cdp, EOCD64_MAGIC, 4) != 0) { + _zip_error_set(error, ZIP_ER_INCONS, 0); + return NULL; + } + cdp += 4; + + size = _zip_read8(&cdp); + + if ((flags & ZIP_CHECKCONS) && size+eocd_offset+12 != (zip_uint64_t)(buf_offset+(eocd64loc-buf))) { + _zip_error_set(error, ZIP_ER_INCONS, 0); + return NULL; + } + + cdp += 4; /* skip version made by/needed */ + cdp += 8; /* skip num disks */ + + nentry = _zip_read8(&cdp); + i = _zip_read8(&cdp); + + if (nentry != i) { + _zip_error_set(error, ZIP_ER_MULTIDISK, 0); + return NULL; + } + + size = _zip_read8(&cdp); + offset = _zip_read8(&cdp); + + if (size > ZIP_OFF_MAX || offset > ZIP_OFF_MAX || offset+size > ZIP_OFF_MAX) { + _zip_error_set(error, ZIP_ER_SEEK, EFBIG); + return NULL; + } + if ((flags & ZIP_CHECKCONS) && offset+size != eocd_offset) { + _zip_error_set(error, ZIP_ER_INCONS, 0); + return NULL; + } + + if ((cd=_zip_cdir_new(nentry, error)) == NULL) + return NULL; + + + cd->size = (off_t)size; + cd->offset = (off_t)offset; + + return cd; +} diff --git a/ext/zip/lib/zip_rename.c b/ext/zip/lib/zip_rename.c index 6b5a0359172da..8841caeca9a9e 100644 --- a/ext/zip/lib/zip_rename.c +++ b/ext/zip/lib/zip_rename.c @@ -1,6 +1,6 @@ /* zip_rename.c -- rename file in zip archive - Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2012 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -35,36 +35,13 @@ #include +#define _ZIP_COMPILING_DEPRECATED #include "zipint.h" -ZIP_EXTERN(int) +ZIP_EXTERN int zip_rename(struct zip *za, zip_uint64_t idx, const char *name) { - const char *old_name; - int old_is_dir, new_is_dir; - - if (idx >= za->nentry || name[0] == '\0') { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return -1; - } - - if (ZIP_IS_RDONLY(za)) { - _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); - return -1; - } - - if ((old_name=zip_get_name(za, idx, 0)) == NULL) - return -1; - - new_is_dir = (name[strlen(name)-1] == '/'); - old_is_dir = (old_name[strlen(old_name)-1] == '/'); - - if (new_is_dir != old_is_dir) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return -1; - } - - return _zip_set_name(za, idx, name); + return zip_file_rename(za, idx, name, 0); } diff --git a/ext/zip/lib/zip_replace.c b/ext/zip/lib/zip_replace.c index 6dc3dd5ab508f..de717afec7dd1 100644 --- a/ext/zip/lib/zip_replace.c +++ b/ext/zip/lib/zip_replace.c @@ -1,6 +1,6 @@ /* zip_replace.c -- replace file via callback function - Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2012 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -33,53 +33,13 @@ +#define _ZIP_COMPILING_DEPRECATED #include "zipint.h" -ZIP_EXTERN(int) +ZIP_EXTERN int zip_replace(struct zip *za, zip_uint64_t idx, struct zip_source *source) { - if (idx >= za->nentry || source == NULL) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return -1; - } - - if (_zip_replace(za, idx, NULL, source) == -1) - return -1; - - return 0; -} - - - - -/* NOTE: Signed due to -1 on error. See zip_add.c for more details. */ - -zip_int64_t -_zip_replace(struct zip *za, zip_uint64_t idx, const char *name, - struct zip_source *source) -{ - if (ZIP_IS_RDONLY(za)) { - _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); - return -1; - } - - if (idx == ZIP_UINT64_MAX) { - if (_zip_entry_new(za) == NULL) - return -1; - - idx = za->nentry - 1; - } - - _zip_unchange_data(za->entry+idx); - - if (name && _zip_set_name(za, idx, name) != 0) - return -1; - - za->entry[idx].state = ((za->cdir == NULL || idx >= za->cdir->nentry) - ? ZIP_ST_ADDED : ZIP_ST_REPLACED); - za->entry[idx].source = source; - - return idx; + return zip_file_replace(za, idx, source, 0); } diff --git a/ext/zip/lib/zip_set_archive_comment.c b/ext/zip/lib/zip_set_archive_comment.c index 3cd069c7577c9..df1caee06b116 100644 --- a/ext/zip/lib/zip_set_archive_comment.c +++ b/ext/zip/lib/zip_set_archive_comment.c @@ -1,6 +1,6 @@ /* zip_set_archive_comment.c -- set archive comment - Copyright (C) 2006-2009 Dieter Baron and Thomas Klausner + Copyright (C) 2006-2013 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -39,32 +39,46 @@ -ZIP_EXTERN(int) -zip_set_archive_comment(struct zip *za, const char *comment, int len) +ZIP_EXTERN int +zip_set_archive_comment(struct zip *za, const char *comment, zip_uint16_t len) { - char *tmpcom; + struct zip_string *cstr; - if (len < 0 || len > MAXCOMLEN - || (len > 0 && comment == NULL)) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + if (ZIP_IS_RDONLY(za)) { + _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); return -1; } - if (ZIP_IS_RDONLY(za)) { - _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + if (len > 0 && comment == NULL) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } if (len > 0) { - if ((tmpcom=(char *)_zip_memdup(comment, len, &za->error)) == NULL) + if ((cstr=_zip_string_new((const zip_uint8_t *)comment, len, ZIP_FL_ENC_GUESS, &za->error)) == NULL) return -1; + + if (_zip_guess_encoding(cstr, ZIP_ENCODING_UNKNOWN) == ZIP_ENCODING_CP437) { + _zip_string_free(cstr); + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } } else - tmpcom = NULL; + cstr = NULL; + + _zip_string_free(za->comment_changes); + za->comment_changes = NULL; - free(za->ch_comment); - za->ch_comment = tmpcom; - za->ch_comment_len = len; + if (((za->comment_orig && _zip_string_equal(za->comment_orig, cstr)) + || (za->comment_orig == NULL && cstr == NULL))) { + _zip_string_free(cstr); + za->comment_changed = 0; + } + else { + za->comment_changes = cstr; + za->comment_changed = 1; + } return 0; } diff --git a/ext/zip/lib/zip_set_archive_flag.c b/ext/zip/lib/zip_set_archive_flag.c index 07bcfbe304d85..b6cdab120ddb2 100644 --- a/ext/zip/lib/zip_set_archive_flag.c +++ b/ext/zip/lib/zip_set_archive_flag.c @@ -37,8 +37,8 @@ -ZIP_EXTERN(int) -zip_set_archive_flag(struct zip *za, int flag, int value) +ZIP_EXTERN int +zip_set_archive_flag(struct zip *za, unsigned int flag, int value) { unsigned int new_flags; diff --git a/ext/zip/lib/zip_set_default_password.c b/ext/zip/lib/zip_set_default_password.c index c274d1100bb3a..b9aa80acffc25 100644 --- a/ext/zip/lib/zip_set_default_password.c +++ b/ext/zip/lib/zip_set_default_password.c @@ -40,7 +40,7 @@ -ZIP_EXTERN(int) +ZIP_EXTERN int zip_set_default_password(struct zip *za, const char *passwd) { if (za == NULL) diff --git a/ext/zip/lib/zip_set_file_comment.c b/ext/zip/lib/zip_set_file_comment.c index 5e63dc2730ad4..7acd0eb36de29 100644 --- a/ext/zip/lib/zip_set_file_comment.c +++ b/ext/zip/lib/zip_set_file_comment.c @@ -1,6 +1,6 @@ /* zip_set_file_comment.c -- set comment for file in archive - Copyright (C) 2006-2009 Dieter Baron and Thomas Klausner + Copyright (C) 2006-2012 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -35,38 +35,17 @@ #include +#define _ZIP_COMPILING_DEPRECATED #include "zipint.h" -ZIP_EXTERN(int) -zip_set_file_comment(struct zip *za, zip_uint64_t idx, - const char *comment, int len) +ZIP_EXTERN int +zip_set_file_comment(struct zip *za, zip_uint64_t idx, const char *comment, int len) { - char *tmpcom; - - if (idx >= za->nentry - || len < 0 || len > MAXCOMLEN - || (len > 0 && comment == NULL)) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return -1; - } - - if (ZIP_IS_RDONLY(za)) { - _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); - return -1; + if (len < 0 || len > ZIP_UINT16_MAX) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; } - - if (len > 0) { - if ((tmpcom=(char *)_zip_memdup(comment, len, &za->error)) == NULL) - return -1; - } - else - tmpcom = NULL; - - free(za->entry[idx].ch_comment); - za->entry[idx].ch_comment = tmpcom; - za->entry[idx].ch_comment_len = len; - - return 0; + return zip_file_set_comment(za, idx, comment, (zip_uint16_t)len, 0); } diff --git a/ext/zip/lib/zip_set_file_compression.c b/ext/zip/lib/zip_set_file_compression.c new file mode 100644 index 0000000000000..ea8517d70e602 --- /dev/null +++ b/ext/zip/lib/zip_set_file_compression.c @@ -0,0 +1,90 @@ +/* + zip_set_file_compression.c -- set compression for file in archive + Copyright (C) 2012 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include "zipint.h" + + + +ZIP_EXTERN int +zip_set_file_compression(struct zip *za, zip_uint64_t idx, + zip_int32_t method, zip_uint32_t flags) +{ + struct zip_entry *e; + zip_int32_t old_method; + + if (idx >= za->nentry) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (ZIP_IS_RDONLY(za)) { + _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + if (method != ZIP_CM_DEFAULT && method != ZIP_CM_STORE && method != ZIP_CM_DEFLATE) { + _zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0); + return -1; + } + + e = za->entry+idx; + + old_method = (e->orig == NULL ? ZIP_CM_DEFAULT : e->orig->comp_method); + + /* XXX: revisit this when flags are supported, since they may require a recompression */ + + if (method == old_method) { + if (e->changes) { + e->changes->changed &= ~ZIP_DIRENT_COMP_METHOD; + if (e->changes->changed == 0) { + _zip_dirent_free(e->changes); + e->changes = NULL; + } + } + } + else { + if (e->changes == NULL) { + if ((e->changes=_zip_dirent_clone(e->orig)) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + } + + e->changes->comp_method = method; + e->changes->changed |= ZIP_DIRENT_COMP_METHOD; + } + + return 0; +} diff --git a/ext/zip/lib/zip_set_name.c b/ext/zip/lib/zip_set_name.c index 2a90601bfec35..60c9e7d5bf59a 100644 --- a/ext/zip/lib/zip_set_name.c +++ b/ext/zip/lib/zip_set_name.c @@ -1,6 +1,6 @@ /* zip_set_name.c -- rename helper function - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2012 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -41,35 +41,77 @@ int -_zip_set_name(struct zip *za, zip_uint64_t idx, const char *name) +_zip_set_name(struct zip *za, zip_uint64_t idx, const char *name, zip_flags_t flags) { - char *s; + struct zip_entry *e; + struct zip_string *str; + int changed; zip_int64_t i; - - if (idx >= za->nentry || name == NULL) { + + if (idx >= za->nentry) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } - if ((i=_zip_name_locate(za, name, 0, NULL)) != -1 && i != idx) { + if (ZIP_IS_RDONLY(za)) { + _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + if (name && strlen(name) > 0) { + /* XXX: check for string too long */ + if ((str=_zip_string_new((const zip_uint8_t *)name, (zip_uint16_t)strlen(name), flags, &za->error)) == NULL) + return -1; + if ((flags & ZIP_FL_ENCODING_ALL) == ZIP_FL_ENC_GUESS && _zip_guess_encoding(str, ZIP_ENCODING_UNKNOWN) == ZIP_ENCODING_UTF8_GUESSED) + str->encoding = ZIP_ENCODING_UTF8_KNOWN; + } + else + str = NULL; + + /* XXX: encoding flags needed for CP437? */ + if ((i=_zip_name_locate(za, name, 0, NULL)) >= 0 && (zip_uint64_t)i != idx) { + _zip_string_free(str); _zip_error_set(&za->error, ZIP_ER_EXISTS, 0); return -1; } /* no effective name change */ - if (i == idx) + if (i>=0 && (zip_uint64_t)i == idx) { + _zip_string_free(str); return 0; - - if ((s=strdup(name)) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - return -1; } - - if (za->entry[idx].state == ZIP_ST_UNCHANGED) - za->entry[idx].state = ZIP_ST_RENAMED; - free(za->entry[idx].ch_filename); - za->entry[idx].ch_filename = s; + e = za->entry+idx; + + if (e->changes) { + _zip_string_free(e->changes->filename); + e->changes->filename = NULL; + e->changes->changed &= ~ZIP_DIRENT_FILENAME; + } + + if (e->orig) + changed = !_zip_string_equal(e->orig->filename, str); + else + changed = 1; + + if (changed) { + if (e->changes == NULL) { + if ((e->changes=_zip_dirent_clone(e->orig)) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + _zip_string_free(str); + return -1; + } + } + e->changes->filename = str; + e->changes->changed |= ZIP_DIRENT_FILENAME; + } + else { + _zip_string_free(str); + if (e->changes && e->changes->changed == 0) { + _zip_dirent_free(e->changes); + e->changes = NULL; + } + } return 0; } diff --git a/ext/zip/lib/zip_source_buffer.c b/ext/zip/lib/zip_source_buffer.c index 8c9154ce3c5ba..8a13e7602d195 100644 --- a/ext/zip/lib/zip_source_buffer.c +++ b/ext/zip/lib/zip_source_buffer.c @@ -48,7 +48,7 @@ static zip_int64_t read_data(void *, void *, zip_uint64_t, enum zip_source_cmd); -ZIP_EXTERN(struct zip_source *) +ZIP_EXTERN struct zip_source * zip_source_buffer(struct zip *za, const void *data, zip_uint64_t len, int freep) { struct read_data *f; @@ -98,9 +98,7 @@ read_data(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) return 0; case ZIP_SOURCE_READ: - /* XXX: return error if (len > ZIP_INT64_MAX) */ - - n = z->end - z->buf; + n = (zip_uint64_t)(z->end - z->buf); if (n > len) n = len; @@ -109,7 +107,7 @@ read_data(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) z->buf += n; } - return n; + return (zip_int64_t)n; case ZIP_SOURCE_CLOSE: return 0; @@ -125,7 +123,7 @@ read_data(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) zip_stat_init(st); st->mtime = z->mtime; - st->size = z->end - z->data; + st->size = (zip_uint64_t)(z->end - z->data); st->comp_size = st->size; st->comp_method = ZIP_CM_STORE; st->encryption_method = ZIP_EM_NONE; diff --git a/ext/zip/lib/zip_source_close.c b/ext/zip/lib/zip_source_close.c index a3bf7e5e1d9bd..7b89d5fc15f68 100644 --- a/ext/zip/lib/zip_source_close.c +++ b/ext/zip/lib/zip_source_close.c @@ -37,7 +37,7 @@ -ZIP_EXTERN(void) +void zip_source_close(struct zip_source *src) { if (!src->is_open) diff --git a/ext/zip/lib/zip_source_crc.c b/ext/zip/lib/zip_source_crc.c index 7fd78f56970cf..99bc965228898 100644 --- a/ext/zip/lib/zip_source_crc.c +++ b/ext/zip/lib/zip_source_crc.c @@ -38,7 +38,7 @@ #include "zipint.h" -struct crc { +struct crc_context { int eof; int validate; int e[2]; @@ -51,23 +51,27 @@ static zip_int64_t crc_read(struct zip_source *, void *, void * -ZIP_EXTERN(struct zip_source *) +struct zip_source * zip_source_crc(struct zip *za, struct zip_source *src, int validate) { - struct crc *ctx; + struct crc_context *ctx; if (src == NULL) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return NULL; } - if ((ctx=(struct crc *)malloc(sizeof(*ctx))) == NULL) { + if ((ctx=(struct crc_context *)malloc(sizeof(*ctx))) == NULL) { _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); return NULL; } + ctx->eof = 0; ctx->validate = validate; - + ctx->e[0] = ctx->e[1] = 0; + ctx->size = 0; + ctx->crc = 0; + return zip_source_layered(za, src, crc_read, ctx); } @@ -77,15 +81,15 @@ static zip_int64_t crc_read(struct zip_source *src, void *_ctx, void *data, zip_uint64_t len, enum zip_source_cmd cmd) { - struct crc *ctx; + struct crc_context *ctx; zip_int64_t n; - ctx = (struct crc *)_ctx; + ctx = (struct crc_context *)_ctx; switch (cmd) { case ZIP_SOURCE_OPEN: ctx->eof = 0; - ctx->crc = crc32(0, NULL, 0); + ctx->crc = (zip_uint32_t)crc32(0, NULL, 0); ctx->size = 0; return 0; @@ -120,8 +124,8 @@ crc_read(struct zip_source *src, void *_ctx, void *data, } } else { - ctx->size += n; - ctx->crc = crc32(ctx->crc, data, n); + ctx->size += (zip_uint64_t)n; + ctx->crc = (zip_uint32_t)crc32(ctx->crc, (const Bytef *)data, (uInt)n); /* XXX: check for overflow, use multiple crc calls if needed */ } return n; @@ -139,7 +143,10 @@ crc_read(struct zip_source *src, void *_ctx, void *data, After all, this only works for uncompressed data. */ st->size = ctx->size; st->crc = ctx->crc; - st->valid |= ZIP_STAT_SIZE|ZIP_STAT_CRC; + st->comp_size = ctx->size; + st->comp_method = ZIP_CM_STORE; + st->encryption_method = ZIP_EM_NONE; + st->valid |= ZIP_STAT_SIZE|ZIP_STAT_CRC|ZIP_STAT_COMP_SIZE|ZIP_STAT_COMP_METHOD|ZIP_STAT_ENCRYPTION_METHOD;; } } return 0; diff --git a/ext/zip/lib/zip_source_deflate.c b/ext/zip/lib/zip_source_deflate.c index 5d9c5e67bb605..879953144ce56 100644 --- a/ext/zip/lib/zip_source_deflate.c +++ b/ext/zip/lib/zip_source_deflate.c @@ -60,14 +60,14 @@ static void deflate_free(struct deflate *); -ZIP_EXTERN(struct zip_source *) +struct zip_source * zip_source_deflate(struct zip *za, struct zip_source *src, - zip_uint16_t cm, int flags) + zip_int32_t cm, int flags) { struct deflate *ctx; struct zip_source *s2; - if (src == NULL || cm != ZIP_CM_DEFLATE) { + if (src == NULL || (cm != ZIP_CM_DEFLATE && !ZIP_CM_IS_DEFAULT(cm))) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return NULL; } @@ -113,7 +113,7 @@ compress_read(struct zip_source *src, struct deflate *ctx, return 0; ctx->zstr.next_out = (Bytef *)data; - ctx->zstr.avail_out = len; + ctx->zstr.avail_out = (uInt)len; /* XXX: check for overflow */ end = 0; while (!end) { @@ -136,8 +136,7 @@ compress_read(struct zip_source *src, struct deflate *ctx, break; } - if ((n=zip_source_read(src, ctx->buffer, - sizeof(ctx->buffer))) < 0) { + if ((n=zip_source_read(src, ctx->buffer, sizeof(ctx->buffer))) < 0) { zip_source_error(src, ctx->e, ctx->e+1); end = 1; break; @@ -149,7 +148,7 @@ compress_read(struct zip_source *src, struct deflate *ctx, } else { ctx->zstr.next_in = (Bytef *)ctx->buffer; - ctx->zstr.avail_in = n; + ctx->zstr.avail_in = (uInt)n; } continue; } @@ -167,7 +166,7 @@ compress_read(struct zip_source *src, struct deflate *ctx, } if (ctx->zstr.avail_out < len) - return len - ctx->zstr.avail_out; + return (zip_int64_t)(len - ctx->zstr.avail_out); return (ctx->e[0] == 0) ? 0 : -1; } @@ -188,7 +187,7 @@ decompress_read(struct zip_source *src, struct deflate *ctx, return 0; ctx->zstr.next_out = (Bytef *)data; - ctx->zstr.avail_out = len; + ctx->zstr.avail_out = (uInt)len; /* XXX: check for overflow */ end = 0; while (!end && ctx->zstr.avail_out) { @@ -210,8 +209,7 @@ decompress_read(struct zip_source *src, struct deflate *ctx, break; } - if ((n=zip_source_read(src, ctx->buffer, - sizeof(ctx->buffer))) < 0) { + if ((n=zip_source_read(src, ctx->buffer, sizeof(ctx->buffer))) < 0) { zip_source_error(src, ctx->e, ctx->e+1); end = 1; break; @@ -220,7 +218,7 @@ decompress_read(struct zip_source *src, struct deflate *ctx, ctx->eof = 1; else { ctx->zstr.next_in = (Bytef *)ctx->buffer; - ctx->zstr.avail_in = n; + ctx->zstr.avail_in = (uInt)n; } continue; } @@ -237,7 +235,7 @@ decompress_read(struct zip_source *src, struct deflate *ctx, } if (ctx->zstr.avail_out < len) - return len - ctx->zstr.avail_out; + return (zip_int64_t)(len - ctx->zstr.avail_out); return (ctx->e[0] == 0) ? 0 : -1; } @@ -334,7 +332,7 @@ deflate_decompress(struct zip_source *src, void *ud, void *data, ctx->zstr.zfree = Z_NULL; ctx->zstr.opaque = NULL; ctx->zstr.next_in = (Bytef *)ctx->buffer; - ctx->zstr.avail_in = n; + ctx->zstr.avail_in = (uInt)n /* XXX: check for overflow */; /* negative value to tell zlib that there is no header */ if ((ret=inflateInit2(&ctx->zstr, -MAX_WBITS)) != Z_OK) { diff --git a/ext/zip/lib/zip_source_error.c b/ext/zip/lib/zip_source_error.c index ffb4652d33621..a1efd551ea3dd 100644 --- a/ext/zip/lib/zip_source_error.c +++ b/ext/zip/lib/zip_source_error.c @@ -1,6 +1,6 @@ /* zip_source_error.c -- get last error from zip_source - Copyright (C) 2009 Dieter Baron and Thomas Klausner + Copyright (C) 2009-2013 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -37,24 +37,21 @@ -ZIP_EXTERN(void) +void zip_source_error(struct zip_source *src, int *ze, int *se) { int e[2]; if (src->src == NULL) { + if (src->cb.f(src->ud, e, sizeof(e), ZIP_SOURCE_ERROR) < 0) { + e[0] = ZIP_ER_INTERNAL; + e[1] = 0; + } } else { switch (src->error_source) { case ZIP_LES_NONE: - if (src->src == NULL) { - if (src->cb.f(src->ud, e, sizeof(e), ZIP_SOURCE_ERROR) < 0) { - e[0] = ZIP_ER_INTERNAL; - e[1] = 0; - } - } - else - e[0] = e[1] = 0; + e[0] = e[1] = 0; break; case ZIP_LES_INVAL: @@ -67,8 +64,7 @@ zip_source_error(struct zip_source *src, int *ze, int *se) return; case ZIP_LES_UPPER: - if (src->cb.l(src->src, src->ud, e, sizeof(e), - ZIP_SOURCE_ERROR) < 0) { + if (src->cb.l(src->src, src->ud, e, sizeof(e), ZIP_SOURCE_ERROR) < 0) { e[0] = ZIP_ER_INTERNAL; e[1] = 0; } @@ -77,6 +73,7 @@ zip_source_error(struct zip_source *src, int *ze, int *se) default: e[0] = ZIP_ER_INTERNAL; e[1] = 0; + break; } } diff --git a/ext/zip/lib/zip_source_file.c b/ext/zip/lib/zip_source_file.c index 681cc2f3ea643..79c8ee5aca22b 100644 --- a/ext/zip/lib/zip_source_file.c +++ b/ext/zip/lib/zip_source_file.c @@ -40,7 +40,7 @@ -ZIP_EXTERN(struct zip_source *) +ZIP_EXTERN struct zip_source * zip_source_file(struct zip *za, const char *fname, zip_uint64_t start, zip_int64_t len) { diff --git a/ext/zip/lib/zip_source_filep.c b/ext/zip/lib/zip_source_filep.c index 4d896a4c01bfc..0bd2d6846e5a3 100644 --- a/ext/zip/lib/zip_source_filep.c +++ b/ext/zip/lib/zip_source_filep.c @@ -58,14 +58,14 @@ static zip_int64_t read_file(void *state, void *data, zip_uint64_t len, -ZIP_EXTERN(struct zip_source *) +ZIP_EXTERN struct zip_source * zip_source_filep(struct zip *za, FILE *file, zip_uint64_t start, zip_int64_t len) { if (za == NULL) return NULL; - if (file == NULL || start < 0 || len < -1) { + if (file == NULL || len < -1) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return NULL; } @@ -125,7 +125,7 @@ read_file(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) { struct read_file *z; char *buf; - int i, n; + size_t i, n; z = (struct read_file *)state; buf = (char *)data; @@ -140,7 +140,7 @@ read_file(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) } } - if (z->closep) { + if (z->closep && z->off > 0) { if (fseeko(z->f, (off_t)z->off, SEEK_SET) < 0) { z->e[0] = ZIP_ER_SEEK; z->e[1] = errno; @@ -153,30 +153,31 @@ read_file(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) case ZIP_SOURCE_READ: /* XXX: return INVAL if len > size_t max */ if (z->remain != -1) - n = len > z->remain ? z->remain : len; + n = len > (zip_uint64_t)z->remain ? (zip_uint64_t)z->remain : len; else n = len; if (!z->closep) { /* we might share this file with others, so let's be safe */ - if (fseeko(z->f, (off_t)(z->off + z->len-z->remain), - SEEK_SET) < 0) { + if (fseeko(z->f, (off_t)(z->off + (zip_uint64_t)(z->len-z->remain)), SEEK_SET) < 0) { z->e[0] = ZIP_ER_SEEK; z->e[1] = errno; return -1; } } - if ((i=fread(buf, 1, n, z->f)) < 0) { - z->e[0] = ZIP_ER_READ; - z->e[1] = errno; - return -1; + if ((i=fread(buf, 1, n, z->f)) == 0) { + if (ferror(z->f)) { + z->e[0] = ZIP_ER_READ; + z->e[1] = errno; + return -1; + } } if (z->remain != -1) z->remain -= i; - return i; + return (zip_int64_t)i; case ZIP_SOURCE_CLOSE: if (z->fname) { @@ -214,11 +215,11 @@ read_file(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) st->mtime = fst.st_mtime; st->valid |= ZIP_STAT_MTIME; if (z->len != -1) { - st->size = z->len; + st->size = (zip_uint64_t)z->len; st->valid |= ZIP_STAT_SIZE; } else if ((fst.st_mode&S_IFMT) == S_IFREG) { - st->size = fst.st_size; + st->size = (zip_uint64_t)fst.st_size; st->valid |= ZIP_STAT_SIZE; } } diff --git a/ext/zip/lib/zip_source_free.c b/ext/zip/lib/zip_source_free.c index f71c71ed6c577..b1e78404965c2 100644 --- a/ext/zip/lib/zip_source_free.c +++ b/ext/zip/lib/zip_source_free.c @@ -39,7 +39,7 @@ -ZIP_EXTERN(void) +ZIP_EXTERN void zip_source_free(struct zip_source *src) { if (src == NULL) diff --git a/ext/zip/lib/zip_source_function.c b/ext/zip/lib/zip_source_function.c index 984b107f7baa6..cb92e339b4bb2 100644 --- a/ext/zip/lib/zip_source_function.c +++ b/ext/zip/lib/zip_source_function.c @@ -39,7 +39,7 @@ -ZIP_EXTERN(struct zip_source *) +ZIP_EXTERN struct zip_source * zip_source_function(struct zip *za, zip_source_callback zcb, void *ud) { struct zip_source *zs; diff --git a/ext/zip/lib/zip_source_layered.c b/ext/zip/lib/zip_source_layered.c index 86ed420407071..ad2870333cdee 100644 --- a/ext/zip/lib/zip_source_layered.c +++ b/ext/zip/lib/zip_source_layered.c @@ -39,7 +39,7 @@ -ZIP_EXTERN(struct zip_source *) +struct zip_source * zip_source_layered(struct zip *za, struct zip_source *src, zip_source_layered_callback cb, void *ud) { diff --git a/ext/zip/lib/zip_source_open.c b/ext/zip/lib/zip_source_open.c index 2c768f7f3a4e5..a5010393e7b9c 100644 --- a/ext/zip/lib/zip_source_open.c +++ b/ext/zip/lib/zip_source_open.c @@ -1,6 +1,6 @@ /* zip_source_open.c -- open zip_source (prepare for reading) - Copyright (C) 2009 Dieter Baron and Thomas Klausner + Copyright (C) 2009-2013 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -37,7 +37,7 @@ -ZIP_EXTERN(int) +int zip_source_open(struct zip_source *src) { zip_int64_t ret; @@ -60,7 +60,7 @@ zip_source_open(struct zip_source *src) ret = src->cb.l(src->src, src->ud, NULL, 0, ZIP_SOURCE_OPEN); if (ret < 0) { - (void)zip_source_close(src->src); + zip_source_close(src->src); if (ret == ZIP_SOURCE_ERR_LOWER) src->error_source = ZIP_LES_LOWER; diff --git a/ext/zip/lib/zip_source_pkware.c b/ext/zip/lib/zip_source_pkware.c index 83b5cc5ad5b22..ec53dfeef0468 100644 --- a/ext/zip/lib/zip_source_pkware.c +++ b/ext/zip/lib/zip_source_pkware.c @@ -49,10 +49,6 @@ struct trad_pkware { #define KEY1 591751049 #define KEY2 878082192 -static const uLongf *crc = NULL; - -#define CRC32(c, b) (crc[((c) ^ (b)) & 0xff] ^ ((c) >> 8)) - static void decrypt(struct trad_pkware *, zip_uint8_t *, @@ -64,7 +60,7 @@ static void pkware_free(struct trad_pkware *); -ZIP_EXTERN(struct zip_source *) +struct zip_source * zip_source_pkware(struct zip *za, struct zip_source *src, zip_uint16_t em, int flags, const char *password) { @@ -80,9 +76,6 @@ zip_source_pkware(struct zip *za, struct zip_source *src, return NULL; } - if (crc == NULL) - crc = get_crc_table(); - if ((ctx=(struct trad_pkware *)malloc(sizeof(*ctx))) == NULL) { _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); return NULL; @@ -118,7 +111,7 @@ decrypt(struct trad_pkware *ctx, zip_uint8_t *out, const zip_uint8_t *in, if (!update_only) { /* decrypt next byte */ - tmp = ctx->key[2] | 2; + tmp = (zip_uint16_t)(ctx->key[2] | 2); tmp = (tmp * (tmp ^ 1)) >> 8; b ^= tmp; } @@ -128,10 +121,10 @@ decrypt(struct trad_pkware *ctx, zip_uint8_t *out, const zip_uint8_t *in, out[i] = b; /* update keys */ - ctx->key[0] = CRC32(ctx->key[0], b); + ctx->key[0] = (zip_uint32_t)crc32(ctx->key[0] ^ 0xffffffffUL, &b, 1) ^ 0xffffffffUL; ctx->key[1] = (ctx->key[1] + (ctx->key[0] & 0xff)) * 134775813 + 1; b = ctx->key[1] >> 24; - ctx->key[2] = CRC32(ctx->key[2], b); + ctx->key[2] = (zip_uint32_t)crc32(ctx->key[2] ^ 0xffffffffUL, &b, 1) ^ 0xffffffffUL; } } @@ -196,7 +189,7 @@ pkware_decrypt(struct zip_source *src, void *ud, void *data, if ((n=zip_source_read(src, data, len)) < 0) return ZIP_SOURCE_ERR_LOWER; - decrypt(ud, (zip_uint8_t *)data, (zip_uint8_t *)data, (zip_uint64_t)n, + decrypt((struct trad_pkware *)ud, (zip_uint8_t *)data, (zip_uint8_t *)data, (zip_uint64_t)n, 0); return n; diff --git a/ext/zip/lib/zip_source_pop.c b/ext/zip/lib/zip_source_pop.c index 406093869b962..cd9cb529b5cc7 100644 --- a/ext/zip/lib/zip_source_pop.c +++ b/ext/zip/lib/zip_source_pop.c @@ -39,7 +39,7 @@ -ZIP_EXTERN(struct zip_source *) +struct zip_source * zip_source_pop(struct zip_source *src) { struct zip_source *lower; diff --git a/ext/zip/lib/zip_source_read.c b/ext/zip/lib/zip_source_read.c index 7246f9ccb5367..81b90ba42de35 100644 --- a/ext/zip/lib/zip_source_read.c +++ b/ext/zip/lib/zip_source_read.c @@ -37,7 +37,7 @@ -ZIP_EXTERN(zip_int64_t) +zip_int64_t zip_source_read(struct zip_source *src, void *data, zip_uint64_t len) { zip_int64_t ret; diff --git a/ext/zip/lib/zip_source_stat.c b/ext/zip/lib/zip_source_stat.c index 662779eb6cfba..85ae6a2fd6a26 100644 --- a/ext/zip/lib/zip_source_stat.c +++ b/ext/zip/lib/zip_source_stat.c @@ -37,7 +37,7 @@ -ZIP_EXTERN(int) +int zip_source_stat(struct zip_source *src, struct zip_stat *st) { zip_int64_t ret; diff --git a/ext/zip/lib/zip_source_window.c b/ext/zip/lib/zip_source_window.c new file mode 100644 index 0000000000000..fd202099b5aa8 --- /dev/null +++ b/ext/zip/lib/zip_source_window.c @@ -0,0 +1,150 @@ +/* + zip_source_window.c -- return part of lower source + Copyright (C) 2012-2013 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include +#include + +#include "zipint.h" + +struct window { + zip_uint64_t skip; + zip_uint64_t len; + zip_uint64_t left; + int e[2]; +}; + +static zip_int64_t window_read(struct zip_source *, void *, void *, + zip_uint64_t, enum zip_source_cmd); + + + +struct zip_source * +zip_source_window(struct zip *za, struct zip_source *src, zip_uint64_t start, zip_uint64_t len) +{ + struct window *ctx; + + if (src == NULL) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((ctx=(struct window *)malloc(sizeof(*ctx))) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return NULL; + } + + ctx->skip = start; + ctx->len = len; + ctx->left = len; + + return zip_source_layered(za, src, window_read, ctx); +} + + + +static zip_int64_t +window_read(struct zip_source *src, void *_ctx, void *data, + zip_uint64_t len, enum zip_source_cmd cmd) +{ + struct window *ctx; + zip_int64_t ret; + zip_uint64_t n, i; + char b[8192]; + + ctx = (struct window *)_ctx; + + switch (cmd) { + case ZIP_SOURCE_OPEN: + for (n=0; nskip; n+=(zip_uint64_t)ret) { + i = (ctx->skip-n > sizeof(b) ? sizeof(b) : ctx->skip-n); + if ((ret=zip_source_read(src, b, i)) < 0) + return ZIP_SOURCE_ERR_LOWER; + if (ret==0) { + ctx->e[0] = ZIP_ER_EOF; + ctx->e[1] = 0; + return -1; + } + } + return 0; + + case ZIP_SOURCE_READ: + if (len > ctx->left) + len = ctx->left; + + if (len == 0) + return 0; + + if ((ret=zip_source_read(src, data, len)) < 0) + return ZIP_SOURCE_ERR_LOWER; + + ctx->left -= (zip_uint64_t)ret; + + if (ret == 0) { + if (ctx->left > 0) { + ctx->e[0] = ZIP_ER_EOF; + ctx->e[1] = 0; + return -1; + } + } + return ret; + + case ZIP_SOURCE_CLOSE: + return 0; + + case ZIP_SOURCE_STAT: + { + struct zip_stat *st; + + st = (struct zip_stat *)data; + + st->size = ctx->len; + st->valid |= ZIP_STAT_SIZE; + st->valid &= ~(ZIP_STAT_CRC|ZIP_STAT_COMP_SIZE); + } + return 0; + + case ZIP_SOURCE_ERROR: + memcpy(data, ctx->e, sizeof(ctx->e)); + return 0; + + case ZIP_SOURCE_FREE: + free(ctx); + return 0; + + default: + return -1; + } + +} diff --git a/ext/zip/lib/zip_source_zip.c b/ext/zip/lib/zip_source_zip.c index 228803c717f6a..e4fc2229f782c 100644 --- a/ext/zip/lib/zip_source_zip.c +++ b/ext/zip/lib/zip_source_zip.c @@ -38,153 +38,24 @@ #include "zipint.h" -struct read_zip { - struct zip_file *zf; - struct zip_stat st; - zip_uint64_t off; - zip_int64_t len; -}; - -static zip_int64_t read_zip(void *st, void *data, zip_uint64_t len, - enum zip_source_cmd cmd); - -ZIP_EXTERN(struct zip_source *) +ZIP_EXTERN struct zip_source * zip_source_zip(struct zip *za, struct zip *srcza, zip_uint64_t srcidx, - int flags, zip_uint64_t start, zip_int64_t len) + zip_flags_t flags, zip_uint64_t start, zip_int64_t len) { - struct zip_error error; - struct zip_source *zs; - struct read_zip *p; - - /* XXX: ZIP_FL_RECOMPRESS */ - - if (za == NULL) - return NULL; - - if (srcza == NULL || len < -1 || srcidx < 0 || srcidx >= srcza->nentry) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return NULL; + if (len < -1) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; } - - if ((flags & ZIP_FL_UNCHANGED) == 0 - && ZIP_ENTRY_DATA_CHANGED(srcza->entry+srcidx)) { - _zip_error_set(&za->error, ZIP_ER_CHANGED, 0); - return NULL; - } - - if (len == 0) - len = -1; - - if (start == 0 && len == -1 && (flags & ZIP_FL_RECOMPRESS) == 0) + + if (len == -1) + len = 0; + + if (start == 0 && len == 0) flags |= ZIP_FL_COMPRESSED; else flags &= ~ZIP_FL_COMPRESSED; - if ((p=(struct read_zip *)malloc(sizeof(*p))) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - return NULL; - } - - _zip_error_copy(&error, &srcza->error); - - if (zip_stat_index(srcza, srcidx, flags, &p->st) < 0 - || (p->zf=zip_fopen_index(srcza, srcidx, flags)) == NULL) { - free(p); - _zip_error_copy(&za->error, &srcza->error); - _zip_error_copy(&srcza->error, &error); - - return NULL; - } - p->off = start; - p->len = len; - - if ((flags & ZIP_FL_COMPRESSED) == 0) { - p->st.size = p->st.comp_size = len; - p->st.comp_method = ZIP_CM_STORE; - p->st.crc = 0; - } - - if ((zs=zip_source_function(za, read_zip, p)) == NULL) { - free(p); - return NULL; - } - - return zs; -} - - - -static zip_int64_t -read_zip(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) -{ - struct read_zip *z; - char b[8192], *buf; - int i; - zip_uint64_t n; - - z = (struct read_zip *)state; - buf = (char *)data; - - switch (cmd) { - case ZIP_SOURCE_OPEN: - for (n=0; noff; n+= i) { - i = (z->off-n > sizeof(b) ? sizeof(b) : z->off-n); - if ((i=zip_fread(z->zf, b, i)) < 0) { - zip_fclose(z->zf); - z->zf = NULL; - return -1; - } - } - return 0; - - case ZIP_SOURCE_READ: - if (z->len != -1) - n = len > z->len ? z->len : len; - else - n = len; - - - if ((i=zip_fread(z->zf, buf, n)) < 0) - return -1; - - if (z->len != -1) - z->len -= i; - - return i; - - case ZIP_SOURCE_CLOSE: - return 0; - - case ZIP_SOURCE_STAT: - if (len < sizeof(z->st)) - return -1; - len = sizeof(z->st); - - memcpy(data, &z->st, len); - return len; - - case ZIP_SOURCE_ERROR: - { - int *e; - - if (len < sizeof(int)*2) - return -1; - - e = (int *)data; - zip_file_error_get(z->zf, e, e+1); - } - return sizeof(int)*2; - - case ZIP_SOURCE_FREE: - zip_fclose(z->zf); - free(z); - return 0; - - default: - ; - } - - return -1; + return _zip_source_zip_new(za, srcza, srcidx, flags, start, (zip_uint64_t)len, NULL); } diff --git a/ext/zip/lib/zip_source_zip_new.c b/ext/zip/lib/zip_source_zip_new.c new file mode 100644 index 0000000000000..8e48f6f3faa0c --- /dev/null +++ b/ext/zip/lib/zip_source_zip_new.c @@ -0,0 +1,172 @@ +/* + zip_source_zip_new.c -- prepare data structures for zip_fopen/zip_source_zip + Copyright (C) 2012 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include + +#include "zipint.h" + + + +struct zip_source * +_zip_source_zip_new(struct zip *za, struct zip *srcza, zip_uint64_t srcidx, zip_flags_t flags, + zip_uint64_t start, zip_uint64_t len, const char *password) +{ + zip_compression_implementation comp_impl; + zip_encryption_implementation enc_impl; + struct zip_source *src, *s2; + zip_uint64_t offset; + struct zip_stat st; + + if (za == NULL) + return NULL; + + if (srcza == NULL || srcidx >= srcza->nentry) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((flags & ZIP_FL_UNCHANGED) == 0 + && (ZIP_ENTRY_DATA_CHANGED(srcza->entry+srcidx) || srcza->entry[srcidx].deleted)) { + _zip_error_set(&za->error, ZIP_ER_CHANGED, 0); + return NULL; + } + + if (zip_stat_index(srcza, srcidx, flags|ZIP_FL_UNCHANGED, &st) < 0) { + _zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); + return NULL; + } + + if (flags & ZIP_FL_ENCRYPTED) + flags |= ZIP_FL_COMPRESSED; + + if ((start > 0 || len > 0) && (flags & ZIP_FL_COMPRESSED)) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + /* overflow or past end of file */ + if ((start > 0 || len > 0) && (start+len < start || start+len > st.size)) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + enc_impl = NULL; + if (((flags & ZIP_FL_ENCRYPTED) == 0) && (st.encryption_method != ZIP_EM_NONE)) { + if (password == NULL) { + _zip_error_set(&za->error, ZIP_ER_NOPASSWD, 0); + return NULL; + } + if ((enc_impl=_zip_get_encryption_implementation(st.encryption_method)) == NULL) { + _zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0); + return NULL; + } + } + + comp_impl = NULL; + if ((flags & ZIP_FL_COMPRESSED) == 0) { + if (st.comp_method != ZIP_CM_STORE) { + if ((comp_impl=_zip_get_compression_implementation(st.comp_method)) == NULL) { + _zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0); + return NULL; + } + } + } + + if ((offset=_zip_file_get_offset(srcza, srcidx, &za->error)) == 0) + return NULL; + + if (st.comp_size == 0) { + if ((src=zip_source_buffer(za, NULL, 0, 0)) == NULL) + return NULL; + } + else { + if (start+len > 0 && enc_impl == NULL && comp_impl == NULL) { + struct zip_stat st2; + + st2.size = len ? len : st.size-start; + st2.comp_size = st2.size; + st2.comp_method = ZIP_CM_STORE; + st2.mtime = st.mtime; + st2.valid = ZIP_STAT_SIZE|ZIP_STAT_COMP_SIZE|ZIP_STAT_COMP_METHOD|ZIP_STAT_MTIME; + + /* XXX: check for overflow of st2.size */ + if ((src=_zip_source_file_or_p(za, NULL, srcza->zp, offset+start, (zip_int64_t)st2.size, 0, &st2)) == NULL) + return NULL; + } + else { + /* XXX: check for overflow of st.comp_size */ + if ((src=_zip_source_file_or_p(za, NULL, srcza->zp, offset, (zip_int64_t)st.comp_size, 0, &st)) == NULL) + return NULL; + } + + if (enc_impl) { + if ((s2=enc_impl(za, src, st.encryption_method, 0, password)) == NULL) { + zip_source_free(src); + /* XXX: set error (how?) */ + return NULL; + } + src = s2; + } + if (comp_impl) { + if ((s2=comp_impl(za, src, st.comp_method, 0)) == NULL) { + zip_source_free(src); + /* XXX: set error (how?) */ + return NULL; + } + src = s2; + } + if (((flags & ZIP_FL_COMPRESSED) == 0 || st.comp_method == ZIP_CM_STORE) + && (len == 0 || len == st.comp_size)) { + /* when reading the whole file, check for crc errors */ + if ((s2=zip_source_crc(za, src, 1)) == NULL) { + zip_source_free(src); + /* XXX: set error (how?) */ + return NULL; + } + src = s2; + } + + if (start+len > 0 && (comp_impl || enc_impl)) { + if ((s2=zip_source_window(za, src, start, len ? len : st.size-start)) == NULL) { + zip_source_free(src); + /* XXX: set error (how?) (why?) */ + return NULL; + } + src = s2; + } + } + + return src; +} diff --git a/ext/zip/lib/zip_stat.c b/ext/zip/lib/zip_stat.c index c8a25e1d84ac3..8254627d929f4 100644 --- a/ext/zip/lib/zip_stat.c +++ b/ext/zip/lib/zip_stat.c @@ -37,13 +37,13 @@ -ZIP_EXTERN(int) -zip_stat(struct zip *za, const char *fname, int flags, struct zip_stat *st) +ZIP_EXTERN int +zip_stat(struct zip *za, const char *fname, zip_flags_t flags, struct zip_stat *st) { - int idx; + zip_int64_t idx; if ((idx=zip_name_locate(za, fname, flags)) < 0) return -1; - return zip_stat_index(za, idx, flags, st); + return zip_stat_index(za, (zip_uint64_t)idx, flags, st); } diff --git a/ext/zip/lib/zip_stat_index.c b/ext/zip/lib/zip_stat_index.c index 8faa8cc394972..f4ce72aaa82d8 100644 --- a/ext/zip/lib/zip_stat_index.c +++ b/ext/zip/lib/zip_stat_index.c @@ -37,16 +37,15 @@ -ZIP_EXTERN(int) -zip_stat_index(struct zip *za, zip_uint64_t index, int flags, +ZIP_EXTERN int +zip_stat_index(struct zip *za, zip_uint64_t index, zip_flags_t flags, struct zip_stat *st) { const char *name; - - if (index >= za->nentry) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + struct zip_dirent *de; + + if ((de=_zip_get_dirent(za, index, flags, NULL)) == NULL) return -1; - } if ((name=zip_get_name(za, index, flags)) == NULL) return -1; @@ -60,20 +59,15 @@ zip_stat_index(struct zip *za, zip_uint64_t index, int flags, } } else { - if (za->cdir == NULL || index >= za->cdir->nentry) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return -1; - } - zip_stat_init(st); - st->crc = za->cdir->entry[index].crc; - st->size = za->cdir->entry[index].uncomp_size; - st->mtime = za->cdir->entry[index].last_mod; - st->comp_size = za->cdir->entry[index].comp_size; - st->comp_method = za->cdir->entry[index].comp_method; - if (za->cdir->entry[index].bitflags & ZIP_GPBF_ENCRYPTED) { - if (za->cdir->entry[index].bitflags & ZIP_GPBF_STRONG_ENCRYPTION) { + st->crc = de->crc; + st->size = de->uncomp_size; + st->mtime = de->last_mod; + st->comp_size = de->comp_size; + st->comp_method = (zip_uint16_t)de->comp_method; + if (de->bitflags & ZIP_GPBF_ENCRYPTED) { + if (de->bitflags & ZIP_GPBF_STRONG_ENCRYPTION) { /* XXX */ st->encryption_method = ZIP_EM_UNKNOWN; } diff --git a/ext/zip/lib/zip_stat_init.c b/ext/zip/lib/zip_stat_init.c index 74e1ffd0b0dce..d17613bf5e7e8 100644 --- a/ext/zip/lib/zip_stat_init.c +++ b/ext/zip/lib/zip_stat_init.c @@ -37,7 +37,7 @@ -ZIP_EXTERN(void) +ZIP_EXTERN void zip_stat_init(struct zip_stat *st) { st->valid = 0; diff --git a/ext/zip/lib/zip_strerror.c b/ext/zip/lib/zip_strerror.c index ad23bafed6c62..9ebee144f908a 100644 --- a/ext/zip/lib/zip_strerror.c +++ b/ext/zip/lib/zip_strerror.c @@ -36,7 +36,8 @@ #include "zipint.h" -ZIP_EXTERN(const char *) + +ZIP_EXTERN const char * zip_strerror(struct zip *za) { return _zip_error_strerror(&za->error); diff --git a/ext/zip/lib/zip_string.c b/ext/zip/lib/zip_string.c new file mode 100644 index 0000000000000..a2d5eb5d3fdae --- /dev/null +++ b/ext/zip/lib/zip_string.c @@ -0,0 +1,196 @@ +/* + zip_string.c -- string handling (with encoding) + Copyright (C) 2012 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include +#include + +#include "zipint.h" + + + +zip_uint32_t +_zip_string_crc32(const struct zip_string *s) +{ + zip_uint32_t crc; + + crc = (zip_uint32_t)crc32(0L, Z_NULL, 0); + + if (s != NULL) + crc = (zip_uint32_t)crc32(crc, s->raw, s->length); + + return crc; +} + + + +int +_zip_string_equal(const struct zip_string *a, const struct zip_string *b) +{ + if (a == NULL || b == NULL) + return a == b; + + if (a->length != b->length) + return 0; + + /* XXX: encoding */ + + return (memcmp(a->raw, b->raw, a->length) == 0); +} + + + +void +_zip_string_free(struct zip_string *s) +{ + if (s == NULL) + return; + + free(s->raw); + free(s->converted); + free(s); +} + + + +const zip_uint8_t * +_zip_string_get(struct zip_string *string, zip_uint32_t *lenp, zip_flags_t flags, struct zip_error *error) +{ + static const zip_uint8_t empty[1] = ""; + + if (string == NULL) { + if (lenp) + *lenp = 0; + return empty; + } + + if ((flags & ZIP_FL_ENC_RAW) == 0) { + /* start guessing */ + if (string->encoding == ZIP_ENCODING_UNKNOWN) + _zip_guess_encoding(string, ZIP_ENCODING_UNKNOWN); + + if (((flags & ZIP_FL_ENC_STRICT) + && string->encoding != ZIP_ENCODING_ASCII && string->encoding != ZIP_ENCODING_UTF8_KNOWN) + || (string->encoding == ZIP_ENCODING_CP437)) { + if (string->converted == NULL) { + if ((string->converted=_zip_cp437_to_utf8(string->raw, string->length, + &string->converted_length, error)) == NULL) + return NULL; + } + if (lenp) + *lenp = string->converted_length; + return string->converted; + } + } + + if (lenp) + *lenp = string->length; + return string->raw; +} + + + +zip_uint16_t +_zip_string_length(const struct zip_string *s) +{ + if (s == NULL) + return 0; + + return s->length; +} + + + +struct zip_string * +_zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags, struct zip_error *error) +{ + struct zip_string *s; + enum zip_encoding_type expected_encoding; + + if (length == 0) + return NULL; + + switch (flags & ZIP_FL_ENCODING_ALL) { + case ZIP_FL_ENC_GUESS: + expected_encoding = ZIP_ENCODING_UNKNOWN; + break; + case ZIP_FL_ENC_UTF_8: + expected_encoding = ZIP_ENCODING_UTF8_KNOWN; + break; + case ZIP_FL_ENC_CP437: + expected_encoding = ZIP_ENCODING_CP437; + break; + default: + _zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((s=(struct zip_string *)malloc(sizeof(*s))) == NULL) { + _zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + if ((s->raw=(zip_uint8_t *)malloc(length+1)) == NULL) { + free(s); + return NULL; + } + + memcpy(s->raw, raw, length); + s->raw[length] = '\0'; + s->length = length; + s->encoding = ZIP_ENCODING_UNKNOWN; + s->converted = NULL; + s->converted_length = 0; + + if (expected_encoding != ZIP_ENCODING_UNKNOWN) { + if (_zip_guess_encoding(s, expected_encoding) == ZIP_ENCODING_ERROR) { + _zip_string_free(s); + _zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + } + + return s; +} + + + +void +_zip_string_write(const struct zip_string *s, FILE *f) +{ + if (s == NULL) + return; + + fwrite(s->raw, s->length, 1, f); +} diff --git a/ext/zip/lib/zip_unchange.c b/ext/zip/lib/zip_unchange.c index 550e8b99031f2..5f0e753b78634 100644 --- a/ext/zip/lib/zip_unchange.c +++ b/ext/zip/lib/zip_unchange.c @@ -39,7 +39,7 @@ -ZIP_EXTERN(int) +ZIP_EXTERN int zip_unchange(struct zip *za, zip_uint64_t idx) { return _zip_unchange(za, idx, 0); @@ -50,34 +50,23 @@ zip_unchange(struct zip *za, zip_uint64_t idx) int _zip_unchange(struct zip *za, zip_uint64_t idx, int allow_duplicates) { - int i; + zip_int64_t i; if (idx >= za->nentry) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } - if (za->entry[idx].ch_filename) { - if (!allow_duplicates) { - i = _zip_name_locate(za, - _zip_get_name(za, idx, ZIP_FL_UNCHANGED, NULL), - 0, NULL); - if (i != -1 && i != idx) { - _zip_error_set(&za->error, ZIP_ER_EXISTS, 0); - return -1; - } + if (!allow_duplicates && za->entry[idx].changes && (za->entry[idx].changes->changed & ZIP_DIRENT_FILENAME)) { + i = _zip_name_locate(za, _zip_get_name(za, idx, ZIP_FL_UNCHANGED, NULL), 0, NULL); + if (i >= 0 && (zip_uint64_t)i != idx) { + _zip_error_set(&za->error, ZIP_ER_EXISTS, 0); + return -1; } - - free(za->entry[idx].ch_filename); - za->entry[idx].ch_filename = NULL; } - free(za->entry[idx].ch_extra); - za->entry[idx].ch_extra = NULL; - za->entry[idx].ch_extra_len = -1; - free(za->entry[idx].ch_comment); - za->entry[idx].ch_comment = NULL; - za->entry[idx].ch_comment_len = -1; + _zip_dirent_free(za->entry[idx].changes); + za->entry[idx].changes = NULL; _zip_unchange_data(za->entry+idx); diff --git a/ext/zip/lib/zip_unchange_all.c b/ext/zip/lib/zip_unchange_all.c index 01282f89dbbaf..bbc2825eb6265 100644 --- a/ext/zip/lib/zip_unchange_all.c +++ b/ext/zip/lib/zip_unchange_all.c @@ -39,10 +39,11 @@ -ZIP_EXTERN(int) +ZIP_EXTERN int zip_unchange_all(struct zip *za) { - int ret, i; + int ret; + zip_uint64_t i; ret = 0; for (i=0; inentry; i++) diff --git a/ext/zip/lib/zip_unchange_archive.c b/ext/zip/lib/zip_unchange_archive.c index ca2b67854435a..e24ee21727002 100644 --- a/ext/zip/lib/zip_unchange_archive.c +++ b/ext/zip/lib/zip_unchange_archive.c @@ -39,13 +39,15 @@ -ZIP_EXTERN(int) +ZIP_EXTERN int zip_unchange_archive(struct zip *za) { - free(za->ch_comment); - za->ch_comment = NULL; - za->ch_comment_len = -1; - + if (za->comment_changed) { + _zip_string_free(za->comment_changes); + za->comment_changes = NULL; + za->comment_changed = 0; + } + za->ch_flags = za->flags; return 0; diff --git a/ext/zip/lib/zip_unchange_data.c b/ext/zip/lib/zip_unchange_data.c index 7dd93b768a87a..fa25feb03885f 100644 --- a/ext/zip/lib/zip_unchange_data.c +++ b/ext/zip/lib/zip_unchange_data.c @@ -1,8 +1,6 @@ /* - $NiH: zip_unchange_data.c,v 1.14 2004/11/30 23:02:47 wiz Exp $ - zip_unchange_data.c -- undo helper function - Copyright (C) 1999, 2004 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2012 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -35,8 +33,6 @@ -#include - #include "zipint.h" void @@ -46,7 +42,15 @@ _zip_unchange_data(struct zip_entry *ze) zip_source_free(ze->source); ze->source = NULL; } - - ze->state = ze->ch_filename ? ZIP_ST_RENAMED : ZIP_ST_UNCHANGED; + + if (ze->changes != NULL && (ze->changes->changed & ZIP_DIRENT_COMP_METHOD) && ze->changes->comp_method == ZIP_CM_REPLACED_DEFAULT) { + ze->changes->changed &= ~ZIP_DIRENT_COMP_METHOD; + if (ze->changes->changed == 0) { + _zip_dirent_free(ze->changes); + ze->changes = NULL; + } + } + + ze->deleted = 0; } diff --git a/ext/zip/lib/zip_utf-8.c b/ext/zip/lib/zip_utf-8.c new file mode 100644 index 0000000000000..c36fad13f5f45 --- /dev/null +++ b/ext/zip/lib/zip_utf-8.c @@ -0,0 +1,255 @@ +/* + zip_utf-8.c -- UTF-8 support functions for libzip + Copyright (C) 2011-2012 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include "zipint.h" + +#include + + + +static const zip_uint16_t _cp437_to_unicode[256] = { + /* 0x00 - 0x0F */ + 0x2007, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, + 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, + + /* 0x10 - 0x1F */ + 0x25BA, 0x25C4, 0x2195, 0x203C, 0x00B6, 0x00A7, 0x25AC, 0x21A8, + 0x2191, 0x2193, 0x2192, 0x2190, 0x221F, 0x2194, 0x25B2, 0x25BC, + + /* 0x20 - 0x2F */ + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + + /* 0x30 - 0x3F */ + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + + /* 0x40 - 0x4F */ + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + + /* 0x50 - 0x5F */ + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + + /* 0x60 - 0x6F */ + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + + /* 0x70 - 0x7F */ + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x2302, + + /* 0x80 - 0x8F */ + 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, + 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, + + /* 0x90 - 0x9F */ + 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, + 0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192, + + /* 0xA0 - 0xAF */ + 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, + 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, + + /* 0xB0 - 0xBF */ + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, + 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, + + /* 0xC0 - 0xCF */ + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, + + /* 0xD0 - 0xDF */ + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, + 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, + + /* 0xE0 - 0xEF */ + 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, + 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, + + /* 0xF0 - 0xFF */ + 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, + 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 +}; + +#define UTF_8_LEN_2_MASK 0xe0 +#define UTF_8_LEN_2_MATCH 0xc0 +#define UTF_8_LEN_3_MASK 0xf0 +#define UTF_8_LEN_3_MATCH 0xe0 +#define UTF_8_LEN_4_MASK 0xf8 +#define UTF_8_LEN_4_MATCH 0xf0 +#define UTF_8_CONTINUE_MASK 0xc0 +#define UTF_8_CONTINUE_MATCH 0x80 + + + +enum zip_encoding_type +_zip_guess_encoding(struct zip_string *str, enum zip_encoding_type expected_encoding) +{ + enum zip_encoding_type enc; + const zip_uint8_t *name; + zip_uint32_t i, j, ulen; + + if (str == NULL) + return ZIP_ENCODING_ASCII; + + name = str->raw; + + if (str->encoding != ZIP_ENCODING_UNKNOWN) + enc = str->encoding; + else { + enc = ZIP_ENCODING_ASCII; + for (i=0; ilength; i++) { + if ((name[i] > 31 && name[i] < 128) || name[i] == '\r' || name[i] == '\n' || name[i] == '\t') + continue; + + enc = ZIP_ENCODING_UTF8_GUESSED; + if ((name[i] & UTF_8_LEN_2_MASK) == UTF_8_LEN_2_MATCH) + ulen = 1; + else if ((name[i] & UTF_8_LEN_3_MASK) == UTF_8_LEN_3_MATCH) + ulen = 2; + else if ((name[i] & UTF_8_LEN_4_MASK) == UTF_8_LEN_4_MATCH) + ulen = 3; + else { + enc = ZIP_ENCODING_CP437; + break; + } + + if (i + ulen >= str->length) { + enc = ZIP_ENCODING_CP437; + break; + } + + for (j=1; j<=ulen; j++) { + if ((name[i+j] & UTF_8_CONTINUE_MASK) != UTF_8_CONTINUE_MATCH) { + enc = ZIP_ENCODING_CP437; + goto done; + } + } + i += ulen; + } + } + +done: + str->encoding = enc; + + if (expected_encoding != ZIP_ENCODING_UNKNOWN) { + if (expected_encoding == ZIP_ENCODING_UTF8_KNOWN && enc == ZIP_ENCODING_UTF8_GUESSED) + str->encoding = enc = ZIP_ENCODING_UTF8_KNOWN; + + if (expected_encoding != enc && enc != ZIP_ENCODING_ASCII) + return ZIP_ENCODING_ERROR; + } + + return enc; +} + + + +static zip_uint32_t +_zip_unicode_to_utf8_len(zip_uint32_t codepoint) +{ + if (codepoint < 0x0080) + return 1; + if (codepoint < 0x0800) + return 2; + if (codepoint < 0x10000) + return 3; + return 4; +} + + + +static zip_uint32_t +_zip_unicode_to_utf8(zip_uint32_t codepoint, zip_uint8_t *buf) +{ + if (codepoint < 0x0080) { + buf[0] = codepoint & 0xff; + return 1; + } + if (codepoint < 0x0800) { + buf[0] = UTF_8_LEN_2_MATCH | ((codepoint >> 6) & 0x1f); + buf[1] = UTF_8_CONTINUE_MATCH | (codepoint & 0x3f); + return 2; + } + if (codepoint < 0x10000) { + buf[0] = UTF_8_LEN_3_MATCH | ((codepoint >> 12) & 0x0f); + buf[1] = UTF_8_CONTINUE_MATCH | ((codepoint >> 6) & 0x3f); + buf[2] = UTF_8_CONTINUE_MATCH | (codepoint & 0x3f); + return 3; + } + buf[0] = UTF_8_LEN_4_MATCH | ((codepoint >> 18) & 0x07); + buf[1] = UTF_8_CONTINUE_MATCH | ((codepoint >> 12) & 0x3f); + buf[2] = UTF_8_CONTINUE_MATCH | ((codepoint >> 6) & 0x3f); + buf[3] = UTF_8_CONTINUE_MATCH | (codepoint & 0x3f); + return 4; +} + + + +zip_uint8_t * +_zip_cp437_to_utf8(const zip_uint8_t * const _cp437buf, zip_uint32_t len, + zip_uint32_t *utf8_lenp, struct zip_error *error) +{ + zip_uint8_t *cp437buf = (zip_uint8_t *)_cp437buf; + zip_uint8_t *utf8buf; + zip_uint32_t buflen, i, offset; + + if (len == 0) { + if (utf8_lenp) + *utf8_lenp = 0; + return NULL; + } + + buflen = 1; + for (i=0; i -#include -#include -#include -#include - -#ifndef strcasecmp -# define strcmpi _strcmpi -#endif - -#ifndef ssize_t -# define ssize_t SSIZE_T -#endif - -#ifndef mode_t -# define mode_t int -#endif - -#ifndef snprintf -# define snprintf _snprintf -#endif - -#ifndef mkstemp -# define mkstemp(t) _creat(_mktemp(t), _S_IREAD|_S_IWRITE) -#endif -/* -#ifndef fseeko -# define fseeko fseek -#endif -*/ diff --git a/ext/zip/lib/zipconf.h b/ext/zip/lib/zipconf.h index 646c0bde53f0e..1cb5c0467aeb8 100644 --- a/ext/zip/lib/zipconf.h +++ b/ext/zip/lib/zipconf.h @@ -1,47 +1,129 @@ -#ifndef _HAD_ZIPCONF_H -#define _HAD_ZIPCONF_H - -/* - zipconf.h -- platform specific include file - - This file was generated automatically by ./make_zipconf.sh - based on ../config.h. - */ - -#define LIBZIP_VERSION "0.10.1" -#define LIBZIP_VERSION_MAJOR 0 -#define LIBZIP_VERSION_MINOR 10 -#define LIBZIP_VERSION_MICRO 0 - -#include - -typedef int8_t zip_int8_t; -#define ZIP_INT8_MIN INT8_MIN -#define ZIP_INT8_MAX INT8_MAX - -typedef uint8_t zip_uint8_t; -#define ZIP_UINT8_MAX UINT8_MAX - -typedef int16_t zip_int16_t; -#define ZIP_INT16_MIN INT16_MIN -#define ZIP_INT16_MAX INT16_MAX - -typedef uint16_t zip_uint16_t; -#define ZIP_UINT16_MAX UINT16_MAX - -typedef int32_t zip_int32_t; -#define ZIP_INT32_MIN INT32_MIN -#define ZIP_INT32_MAX INT32_MAX - -typedef uint32_t zip_uint32_t; -#define ZIP_UINT32_MAX UINT32_MAX - -typedef int64_t zip_int64_t; -#define ZIP_INT64_MIN INT64_MIN -#define ZIP_INT64_MAX INT64_MAX - -typedef uint64_t zip_uint64_t; -#define ZIP_UINT64_MAX UINT64_MAX - - -#endif /* zipconf.h */ +#ifndef _HAD_ZIPCONF_H +#define _HAD_ZIPCONF_H + +/* + zipconf.h -- platform specific include file + + This file was generated automatically by CMake + based on ../cmake-zipconf.h.in. + */ +#define LIBZIP_VERSION "0.11.1" +/* #undef HAVE_INTTYPES_H_LIBZIP */ + +#if defined(_WIN32) +# if _MSC_VER > 1500 +# define HAVE_STDINT_H_LIBZIP +# else +# include "win32/php_stdint.h" +# endif +#else +# include +#endif +#define HAVE_SYS_TYPES_H_LIBZIP +#define HAVE___INT8_LIBZIP +#define HAVE_INT8_T_LIBZIP +#define HAVE_UINT8_T_LIBZIP +#define HAVE___INT16_LIBZIP +#define HAVE_INT16_T_LIBZIP +#define HAVE_UINT16_T_LIBZIP +#define HAVE___INT32_LIBZIP +#define HAVE_INT32_T_LIBZIP +#define HAVE_UINT32_T_LIBZIP +#define HAVE___INT64_LIBZIP +#define HAVE_INT64_T_LIBZIP +#define HAVE_UINT64_T_LIBZIP +#define SHORT_LIBZIP 2 +#define INT_LIBZIP 4 +#define LONG_LIBZIP 4 +#define LONG_LONG_LIBZIP 8 + +#if defined(HAVE_STDINT_H_LIBZIP) +#include +#elif defined(HAVE_INTTYPES_H_LIBZIP) +#include +#elif defined(HAVE_SYS_TYPES_H_LIBZIP) +#include +#endif + +#if defined(HAVE_INT8_T_LIBZIP) +typedef int8_t zip_int8_t; +#elif defined(HAVE___INT8_LIBZIP) +typedef __int8 zip_int8_t; +#else +typedef signed char zip_int8_t; +#endif +#if defined(HAVE_UINT8_T_LIBZIP) +typedef uint8_t zip_uint8_t; +#elif defined(HAVE___INT8_LIBZIP) +typedef unsigned __int8 zip_uint8_t; +#else +typedef unsigned char zip_uint8_t; +#endif +#if defined(HAVE_INT16_T_LIBZIP) +typedef int16_t zip_int16_t; +#elif defined(HAVE___INT16_LIBZIP) +typedef __int16 zip_int16_t; +#elif defined(SHORT_LIBZIP) && SHORT_LIBZIP == 2 +typedef signed short zip_int16_t; +#endif +#if defined(HAVE_UINT16_T_LIBZIP) +typedef uint16_t zip_uint16_t; +#elif defined(HAVE___INT16_LIBZIP) +typedef unsigned __int16 zip_uint16_t; +#elif defined(SHORT_LIBZIP) && SHORT_LIBZIP == 2 +typedef unsigned short zip_uint16_t; +#endif +#if defined(HAVE_INT32_T_LIBZIP) +typedef int32_t zip_int32_t; +#elif defined(HAVE___INT32_LIBZIP) +typedef __int32 zip_int32_t; +#elif defined(INT_LIBZIP) && INT_LIBZIP == 4 +typedef signed int zip_int32_t; +#elif defined(LONG_LIBZIP) && LONG_LIBZIP == 4 +typedef signed long zip_int32_t; +#endif +#if defined(HAVE_UINT32_T_LIBZIP) +typedef uint32_t zip_uint32_t; +#elif defined(HAVE___INT32_LIBZIP) +typedef unsigned __int32 zip_uint32_t; +#elif defined(INT_LIBZIP) && INT_LIBZIP == 4 +typedef unsigned int zip_uint32_t; +#elif defined(LONG_LIBZIP) && LONG_LIBZIP == 4 +typedef unsigned long zip_uint32_t; +#endif +#if defined(HAVE_INT64_T_LIBZIP) +typedef int64_t zip_int64_t; +#elif defined(HAVE___INT64_LIBZIP) +typedef __int64 zip_int64_t; +#elif defined(LONG_LIBZIP) && LONG_LIBZIP == 8 +typedef signed long zip_int64_t; +#elif defined(LONG_LONG_LIBZIP) && LONG_LONG_LIBZIP == 8 +typedef signed long long zip_int64_t; +#endif +#if defined(HAVE_UINT64_T_LIBZIP) +typedef uint64_t zip_uint64_t; +#elif defined(HAVE___INT64_LIBZIP) +typedef unsigned __int64 zip_uint64_t; +#elif defined(LONG_LIBZIP) && LONG_LONG_LIBZIP == 8 +typedef unsigned long zip_uint64_t; +#elif defined(LONG_LONG_LIBZIP) && LONG_LONG_LIBZIP == 8 +typedef unsigned long long zip_uint64_t; +#endif + +#define ZIP_INT8_MIN -0x80 +#define ZIP_INT8_MAX 0x7f +#define ZIP_UINT8_MAX 0xff + +#define ZIP_INT16_MIN -0x8000 +#define ZIP_INT16_MAX 0x7fff +#define ZIP_UINT16_MAX 0xffff + +#define ZIP_INT32_MIN -0x80000000L +#define ZIP_INT32_MAX 0x7fffffffL +#define ZIP_UINT32_MAX 0xffffffffLU + +#define ZIP_INT64_MIN -0x8000000000000000LL +#define ZIP_INT64_MAX 0x7fffffffffffffffLL +#define ZIP_UINT64_MAX 0xffffffffffffffffULL + +#endif /* zipconf.h */ diff --git a/ext/zip/lib/zipint.h b/ext/zip/lib/zipint.h index ea21dddcd4257..e8765c5b6619f 100644 --- a/ext/zip/lib/zipint.h +++ b/ext/zip/lib/zipint.h @@ -3,7 +3,7 @@ /* zipint.h -- internal declarations. - Copyright (C) 1999-2011 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2013 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -20,7 +20,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -34,69 +34,123 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +/* to have *_MAX definitions for all types when compiling with g++ */ +#define __STDC_LIMIT_MACROS -#include "zip.h" +#include -#ifndef HAVE_FSEEKO -#define fseeko(s, o, w) (fseek((s), (long int)(o), (w))) +#ifdef PHP_WIN32 +/* for dup(), close(), etc. */ +#include +#include "config.w32.h" #endif -#ifndef HAVE_FTELLO -#define ftello(s) ((long)ftell((s))) +#ifndef _ZIP_COMPILING_DEPRECATED +#define ZIP_DISABLE_DEPRECATED #endif -#ifndef PHP_WIN32 -#ifndef HAVE_MKSTEMP -int _zip_mkstemp(char *); -#define mkstemp _zip_mkstemp -#endif +#include "zip.h" +#ifdef PHP_WIN32 +# include "php_zip_config.w32.h" +#else +# include "config.h" #endif -#ifdef PHP_WIN32 +#if defined(HAVE_MOVEFILEEXA) && defined(_WIN32) #include -#include #define _zip_rename(s, t) \ - (!MoveFileExA((s), (t), \ - MOVEFILE_COPY_ALLOWED|MOVEFILE_REPLACE_EXISTING)) + (!MoveFileExA((s), (t), MOVEFILE_COPY_ALLOWED|MOVEFILE_REPLACE_EXISTING)) +#else +#define _zip_rename rename +#endif -/* for dup(), close(), etc. */ -#include +#ifdef _WIN32 +#undef strcasecmp +# define strcasecmp _strcmpi +#endif -#if !defined(HAVE_OPEN) +#if defined(HAVE__CLOSE) +#define close _close +#endif +#if defined(HAVE__DUP) +#define dup _dup +#endif +/* crashes reported when using fdopen instead of _fdopen on Windows/Visual Studio 10/Win64 */ +#if defined(HAVE__FDOPEN) +#define fdopen _fdopen +#endif +#if defined(HAVE__FILENO) +#define fileno _fileno +#endif +/* Windows' open() doesn't understand Unix permissions */ #if defined(HAVE__OPEN) #define open(a, b, c) _open((a), (b)) #endif +#if defined(HAVE__SNPRINTF) +#define snprintf _snprintf +#endif +#if defined(HAVE__STRDUP) && !defined(strdup) +#define strdup _strdup #endif -#else -#define _zip_rename rename +#ifndef HAVE_FSEEKO +#define fseeko(s, o, w) (fseek((s), (long int)(o), (w))) #endif -#ifndef strcasecmp -# define strcmpi strcasecmp +#ifndef HAVE_FTELLO +#define ftello(s) ((long)ftell((s))) #endif +#ifndef HAVE_MKSTEMP +int _zip_mkstemp(char *); +#define mkstemp _zip_mkstemp +#endif - +#if !defined(HAVE_STRCASECMP) +#if defined(HAVE__STRICMP) +#define strcasecmp _stricmp +#endif +#endif + +#if SIZEOF_OFF_T == 8 +#define ZIP_OFF_MAX ZIP_INT64_MAX +#elif SIZEOF_OFF_T == 4 +#define ZIP_OFF_MAX ZIP_INT32_MAX +#elif SIZEOF_OFF_T == 2 +#define ZIP_OFF_MAX ZIP_INT16_MAX +#else +#error unsupported size of off_t +#endif #define CENTRAL_MAGIC "PK\1\2" #define LOCAL_MAGIC "PK\3\4" #define EOCD_MAGIC "PK\5\6" #define DATADES_MAGIC "PK\7\8" +#define EOCD64LOC_MAGIC "PK\6\7" +#define EOCD64_MAGIC "PK\6\6" #define TORRENT_SIG "TORRENTZIPPED-" #define TORRENT_SIG_LEN 14 #define TORRENT_CRC_LEN 8 #define TORRENT_MEM_LEVEL 8 #define CDENTRYSIZE 46u #define LENTRYSIZE 30 -#undef MAXCOMLEN /* defined as 19 on BSD for max command name */ #define MAXCOMLEN 65536 #define MAXEXTLEN 65536 #define EOCDLEN 22 -#define CDBUFSIZE (MAXCOMLEN+EOCDLEN) +#define EOCD64LOCLEN 20 +#define EOCD64LEN 56 +#define CDBUFSIZE (MAXCOMLEN+EOCDLEN+EOCD64LOCLEN) #define BUFSIZE 8192 +#define ZIP_CM_REPLACED_DEFAULT (-2) + +#define ZIP_CM_IS_DEFAULT(x) ((x) == ZIP_CM_DEFAULT || (x) == ZIP_CM_REPLACED_DEFAULT) + +#define ZIP_EF_UTF_8_COMMENT 0x6375 +#define ZIP_EF_UTF_8_NAME 0x7075 +#define ZIP_EF_ZIP64 0x0001 + +#define ZIP_EF_IS_INTERNAL(id) ((id) == ZIP_EF_UTF_8_COMMENT || (id) == ZIP_EF_UTF_8_NAME || (id) == ZIP_EF_ZIP64) /* This section contains API that won't materialize like this. It's @@ -104,20 +158,22 @@ int _zip_mkstemp(char *); typedef struct zip_source *(*zip_compression_implementation)(struct zip *, struct zip_source *, - zip_uint16_t, int); + zip_int32_t, int); typedef struct zip_source *(*zip_encryption_implementation)(struct zip *, struct zip_source *, zip_uint16_t, int, const char *); -ZIP_EXTERN(zip_compression_implementation) zip_get_compression_implementation( - zip_uint16_t); -ZIP_EXTERN(zip_encryption_implementation) zip_get_encryption_implementation( - zip_uint16_t); +zip_compression_implementation _zip_get_compression_implementation(zip_int32_t); +zip_encryption_implementation _zip_get_encryption_implementation(zip_uint16_t); +/* This API is not final yet, but we need it internally, so it's private for now. */ + +const zip_uint8_t *zip_get_extra_field_by_id(struct zip *, int, int, zip_uint16_t, int, zip_uint16_t *); + /* This section contains API that is of limited use until support for user-supplied compression/encryption implementation is finished. Thus we will keep it private for now. */ @@ -126,40 +182,37 @@ typedef zip_int64_t (*zip_source_layered_callback)(struct zip_source *, void *, void *, zip_uint64_t, enum zip_source_cmd); -ZIP_EXTERN(void) zip_source_close(struct zip_source *); -ZIP_EXTERN(struct zip_source *)zip_source_crc(struct zip *, struct zip_source *, - int); -ZIP_EXTERN(struct zip_source *)zip_source_deflate(struct zip *, - struct zip_source *, - zip_uint16_t, int); -ZIP_EXTERN(void) zip_source_error(struct zip_source *, int *, int *); -ZIP_EXTERN(struct zip_source *)zip_source_layered(struct zip *, - struct zip_source *, - zip_source_layered_callback, - void *); -ZIP_EXTERN(int) zip_source_open(struct zip_source *); -ZIP_EXTERN(struct zip_source *)zip_source_pkware(struct zip *, - struct zip_source *, - zip_uint16_t, int, - const char *); -ZIP_EXTERN(zip_int64_t) zip_source_read(struct zip_source *, void *, - zip_uint64_t); -ZIP_EXTERN(int) zip_source_stat(struct zip_source *, struct zip_stat *); +void zip_source_close(struct zip_source *); +struct zip_source *zip_source_crc(struct zip *, struct zip_source *, + int); +struct zip_source *zip_source_deflate(struct zip *, + struct zip_source *, + zip_int32_t, int); +void zip_source_error(struct zip_source *, int *, int *); +struct zip_source *zip_source_layered(struct zip *, + struct zip_source *, + zip_source_layered_callback, + void *); +int zip_source_open(struct zip_source *); +struct zip_source *zip_source_pkware(struct zip *, + struct zip_source *, + zip_uint16_t, int, + const char *); +zip_int64_t zip_source_read(struct zip_source *, void *, + zip_uint64_t); +int zip_source_stat(struct zip_source *, struct zip_stat *); +struct zip_source *zip_source_window(struct zip *, struct zip_source *, + zip_uint64_t, zip_uint64_t); /* This function will probably remain private. It is not needed to implement compression/encryption routines. (We should probably rename it to _zip_source_pop.) */ -ZIP_EXTERN(struct zip_source *)zip_source_pop(struct zip_source *); +struct zip_source *zip_source_pop(struct zip_source *); -/* state of change of a file in zip archive */ - -enum zip_state { ZIP_ST_UNCHANGED, ZIP_ST_DELETED, ZIP_ST_REPLACED, - ZIP_ST_ADDED, ZIP_ST_RENAMED }; - /* error source for layered sources */ enum zip_les { ZIP_LES_NONE, ZIP_LES_UPPER, ZIP_LES_LOWER, ZIP_LES_INVAL }; @@ -169,6 +222,28 @@ enum zip_les { ZIP_LES_NONE, ZIP_LES_UPPER, ZIP_LES_LOWER, ZIP_LES_INVAL }; #define ZIP_GPBF_ENCRYPTED 0x0001 /* is encrypted */ #define ZIP_GPBF_DATA_DESCRIPTOR 0x0008 /* crc/size after file data */ #define ZIP_GPBF_STRONG_ENCRYPTION 0x0040 /* uses strong encryption */ +#define ZIP_GPBF_ENCODING_UTF_8 0x0800 /* file name encoding is UTF-8 */ + + +/* extra fields */ +#define ZIP_EF_LOCAL ZIP_FL_LOCAL /* include in local header */ +#define ZIP_EF_CENTRAL ZIP_FL_CENTRAL /* include in central directory */ +#define ZIP_EF_BOTH (ZIP_EF_LOCAL|ZIP_EF_CENTRAL) /* include in both */ + +#define ZIP_FL_FORCE_ZIP64 1024 /* force zip64 extra field (_zip_dirent_write) */ + +#define ZIP_FL_ENCODING_ALL (ZIP_FL_ENC_GUESS|ZIP_FL_ENC_CP437|ZIP_FL_ENC_UTF_8) + + +/* encoding type */ +enum zip_encoding_type { + ZIP_ENCODING_UNKNOWN, /* not yet analyzed */ + ZIP_ENCODING_ASCII, /* plain ASCII */ + ZIP_ENCODING_UTF8_KNOWN, /* is UTF-8 */ + ZIP_ENCODING_UTF8_GUESSED, /* possibly UTF-8 */ + ZIP_ENCODING_CP437, /* Code Page 437 */ + ZIP_ENCODING_ERROR /* should be UTF-8 but isn't */ +}; /* error information */ @@ -181,25 +256,29 @@ struct zip_error { /* zip archive, part of API */ struct zip { - char *zn; /* file name */ - FILE *zp; /* file */ - struct zip_error error; /* error information */ + char *zn; /* file name */ + FILE *zp; /* file */ + unsigned int open_flags; /* flags passed to zip_open */ + struct zip_error error; /* error information */ - unsigned int flags; /* archive global flags */ - unsigned int ch_flags; /* changed archive global flags */ - - char *default_password; /* password used when no other supplied */ - - struct zip_cdir *cdir; /* central directory */ - char *ch_comment; /* changed archive comment */ - int ch_comment_len; /* length of changed zip archive - * comment, -1 if unchanged */ - zip_uint64_t nentry; /* number of entries */ - zip_uint64_t nentry_alloc; /* number of entries allocated */ - struct zip_entry *entry; /* entries */ - int nfile; /* number of opened files within archive */ - int nfile_alloc; /* number of files allocated */ - struct zip_file **file; /* opened files within archive */ + unsigned int flags; /* archive global flags */ + unsigned int ch_flags; /* changed archive global flags */ + + char *default_password; /* password used when no other supplied */ + + struct zip_string *comment_orig; /* archive comment */ + struct zip_string *comment_changes; /* changed archive comment */ + int comment_changed; /* whether archive comment was changed */ + + zip_uint64_t nentry; /* number of entries */ + zip_uint64_t nentry_alloc; /* number of entries allocated */ + struct zip_entry *entry; /* entries */ + + unsigned int nfile; /* number of opened files within archive */ + unsigned int nfile_alloc; /* number of files allocated */ + struct zip_file **file; /* opened files within archive */ + + char *tempdir; /* custom temp dir (needed e.g. for OS X sandboxing) */ }; /* file in zip archive, part of API */ @@ -213,37 +292,52 @@ struct zip_file { /* zip archive directory entry (central or local) */ +#define ZIP_DIRENT_COMP_METHOD 0x0001u +#define ZIP_DIRENT_FILENAME 0x0002u +#define ZIP_DIRENT_COMMENT 0x0004u +#define ZIP_DIRENT_EXTRA_FIELD 0x0008u +#define ZIP_DIRENT_ALL 0xffffu + struct zip_dirent { - unsigned short version_madeby; /* (c) version of creator */ - unsigned short version_needed; /* (cl) version needed to extract */ - unsigned short bitflags; /* (cl) general purpose bit flag */ - unsigned short comp_method; /* (cl) compression method used */ - time_t last_mod; /* (cl) time of last modification */ - unsigned int crc; /* (cl) CRC-32 of uncompressed data */ - unsigned int comp_size; /* (cl) size of commpressed data */ - unsigned int uncomp_size; /* (cl) size of uncommpressed data */ - char *filename; /* (cl) file name (NUL-terminated) */ - unsigned short filename_len; /* (cl) length of filename (w/o NUL) */ - char *extrafield; /* (cl) extra field */ - unsigned short extrafield_len; /* (cl) length of extra field */ - char *comment; /* (c) file comment */ - unsigned short comment_len; /* (c) length of file comment */ - unsigned short disk_number; /* (c) disk number start */ - unsigned short int_attrib; /* (c) internal file attributes */ - unsigned int ext_attrib; /* (c) external file attributes */ - unsigned int offset; /* (c) offset of local header */ + zip_uint32_t changed; + int local_extra_fields_read; /* whether we already read in local header extra fields */ + int cloned; /* wether this instance is cloned, and thus shares non-changed strings */ + + zip_uint16_t version_madeby; /* (c) version of creator */ + zip_uint16_t version_needed; /* (cl) version needed to extract */ + zip_uint16_t bitflags; /* (cl) general purpose bit flag */ + zip_int32_t comp_method; /* (cl) compression method used (uint16 and ZIP_CM_DEFAULT (-1)) */ + time_t last_mod; /* (cl) time of last modification */ + zip_uint32_t crc; /* (cl) CRC-32 of uncompressed data */ + zip_uint64_t comp_size; /* (cl) size of compressed data */ + zip_uint64_t uncomp_size; /* (cl) size of uncompressed data */ + struct zip_string *filename; /* (cl) file name (NUL-terminated) */ + struct zip_extra_field *extra_fields; /* (cl) extra fields, parsed */ + struct zip_string *comment; /* (c) file comment */ + zip_uint32_t disk_number; /* (c) disk number start */ + zip_uint16_t int_attrib; /* (c) internal file attributes */ + zip_uint32_t ext_attrib; /* (c) external file attributes */ + zip_uint64_t offset; /* (c) offset of local header */ }; /* zip archive central directory */ struct zip_cdir { - struct zip_dirent *entry; /* directory entries */ - int nentry; /* number of entries */ + struct zip_entry *entry; /* directory entries */ + zip_uint64_t nentry; /* number of entries */ + zip_uint64_t nentry_alloc; /* number of entries allocated */ - unsigned int size; /* size of central direcotry */ - unsigned int offset; /* offset of central directory in file */ - char *comment; /* zip archive comment */ - unsigned short comment_len; /* length of zip archive comment */ + off_t size; /* size of central directory */ + off_t offset; /* offset of central directory in file */ + struct zip_string *comment; /* zip archive comment */ +}; + +struct zip_extra_field { + struct zip_extra_field *next; + zip_flags_t flags; /* in local/central header */ + zip_uint16_t id; /* header id */ + zip_uint16_t size; /* data size */ + zip_uint8_t *data; }; @@ -262,13 +356,31 @@ struct zip_source { /* entry in zip archive directory */ struct zip_entry { - enum zip_state state; + struct zip_dirent *orig; + struct zip_dirent *changes; struct zip_source *source; - char *ch_filename; - char *ch_extra; - int ch_extra_len; - char *ch_comment; - int ch_comment_len; + int deleted; +}; + + + +/* file or archive comment, or filename */ + +struct zip_string { + zip_uint8_t *raw; /* raw string */ + zip_uint16_t length; /* length of raw string */ + enum zip_encoding_type encoding; /* autorecognized encoding */ + zip_uint8_t *converted; /* autoconverted string */ + zip_uint32_t converted_length; /* length of converted */ +}; + + + +/* which files to write, and in which order (name is for torrentzip sorting) */ + +struct zip_filelist { + zip_uint64_t idx; + const char *name; }; @@ -279,66 +391,111 @@ extern const int _zip_err_type[]; -#define ZIP_ENTRY_DATA_CHANGED(x) \ - ((x)->state == ZIP_ST_REPLACED \ - || (x)->state == ZIP_ST_ADDED) +#define ZIP_ENTRY_CHANGED(e, f) ((e)->changes && ((e)->changes->changed & (f))) + +#define ZIP_ENTRY_DATA_CHANGED(x) ((x)->source != NULL) #define ZIP_IS_RDONLY(za) ((za)->ch_flags & ZIP_AFL_RDONLY) +zip_int64_t _zip_add_entry(struct zip *); + int _zip_cdir_compute_crc(struct zip *, uLong *); void _zip_cdir_free(struct zip_cdir *); -int _zip_cdir_grow(struct zip_cdir *, int, struct zip_error *); -struct zip_cdir *_zip_cdir_new(int, struct zip_error *); -int _zip_cdir_write(struct zip_cdir *, FILE *, struct zip_error *); +int _zip_cdir_grow(struct zip_cdir *, zip_uint64_t, struct zip_error *); +struct zip_cdir *_zip_cdir_new(zip_uint64_t, struct zip_error *); +zip_int64_t _zip_cdir_write(struct zip *, const struct zip_filelist *, zip_uint64_t, FILE *); +struct zip_dirent *_zip_dirent_clone(const struct zip_dirent *); +void _zip_dirent_free(struct zip_dirent *); void _zip_dirent_finalize(struct zip_dirent *); void _zip_dirent_init(struct zip_dirent *); -int _zip_dirent_read(struct zip_dirent *, FILE *, unsigned char **, - zip_uint32_t *, int, struct zip_error *); +int _zip_dirent_needs_zip64(const struct zip_dirent *, zip_flags_t); +struct zip_dirent *_zip_dirent_new(void); +int _zip_dirent_read(struct zip_dirent *, FILE *, const unsigned char **, + zip_uint64_t *, int, struct zip_error *); +zip_int32_t _zip_dirent_size(FILE *, zip_uint16_t, struct zip_error *); void _zip_dirent_torrent_normalize(struct zip_dirent *); -int _zip_dirent_write(struct zip_dirent *, FILE *, int, struct zip_error *); - -void _zip_entry_free(struct zip_entry *); -void _zip_entry_init(struct zip *, int); -struct zip_entry *_zip_entry_new(struct zip *); +int _zip_dirent_write(struct zip_dirent *, FILE *, zip_flags_t, struct zip_error *); + +struct zip_extra_field *_zip_ef_clone(const struct zip_extra_field *, struct zip_error *); +struct zip_extra_field *_zip_ef_delete_by_id(struct zip_extra_field *, zip_uint16_t, zip_uint16_t, zip_flags_t); +void _zip_ef_free(struct zip_extra_field *); +const zip_uint8_t *_zip_ef_get_by_id(const struct zip_extra_field *, zip_uint16_t *, zip_uint16_t, zip_uint16_t, zip_flags_t, struct zip_error *); +struct zip_extra_field *_zip_ef_merge(struct zip_extra_field *, struct zip_extra_field *); +struct zip_extra_field *_zip_ef_new(zip_uint16_t, zip_uint16_t, const zip_uint8_t *, zip_flags_t); +struct zip_extra_field *_zip_ef_parse(const zip_uint8_t *, zip_uint16_t, zip_flags_t, struct zip_error *); +struct zip_extra_field *_zip_ef_remove_internal(struct zip_extra_field *); +zip_uint16_t _zip_ef_size(const struct zip_extra_field *, zip_flags_t); +void _zip_ef_write(const struct zip_extra_field *, zip_flags_t, FILE *); + +void _zip_entry_finalize(struct zip_entry *); +void _zip_entry_init(struct zip_entry *); void _zip_error_clear(struct zip_error *); -void _zip_error_copy(struct zip_error *, struct zip_error *); +void _zip_error_copy(struct zip_error *, const struct zip_error *); void _zip_error_fini(struct zip_error *); -void _zip_error_get(struct zip_error *, int *, int *); +void _zip_error_get(const struct zip_error *, int *, int *); void _zip_error_init(struct zip_error *); void _zip_error_set(struct zip_error *, int, int); void _zip_error_set_from_source(struct zip_error *, struct zip_source *); const char *_zip_error_strerror(struct zip_error *); +const zip_uint8_t *_zip_extract_extra_field_by_id(struct zip_error *, zip_uint16_t, int, const zip_uint8_t *, zip_uint16_t, zip_uint16_t *); + +int _zip_file_extra_field_prepare_for_change(struct zip *, zip_uint64_t); int _zip_file_fillbuf(void *, size_t, struct zip_file *); -unsigned int _zip_file_get_offset(struct zip *, int); +zip_uint64_t _zip_file_get_offset(const struct zip *, zip_uint64_t, struct zip_error *); int _zip_filerange_crc(FILE *, off_t, off_t, uLong *, struct zip_error *); -struct zip *_zip_open(const char *, FILE *, int, int, int *); +struct zip_dirent *_zip_get_dirent(struct zip *, zip_uint64_t, zip_flags_t, struct zip_error *); + +enum zip_encoding_type _zip_guess_encoding(struct zip_string *, enum zip_encoding_type); +zip_uint8_t *_zip_cp437_to_utf8(const zip_uint8_t * const, zip_uint32_t, + zip_uint32_t *, struct zip_error *error); + +struct zip *_zip_open(const char *, FILE *, unsigned int, int *); + +int _zip_read_local_ef(struct zip *, zip_uint64_t); struct zip_source *_zip_source_file_or_p(struct zip *, const char *, FILE *, zip_uint64_t, zip_int64_t, int, const struct zip_stat *); struct zip_source *_zip_source_new(struct zip *); - -int _zip_changed(struct zip *, int *); -void _zip_free(struct zip *); -const char *_zip_get_name(struct zip *, zip_uint64_t, int, struct zip_error *); +struct zip_source *_zip_source_zip_new(struct zip *, struct zip *, zip_uint64_t, zip_flags_t, + zip_uint64_t, zip_uint64_t, const char *); + +int _zip_string_equal(const struct zip_string *, const struct zip_string *); +void _zip_string_free(struct zip_string *); +zip_uint32_t _zip_string_crc32(const struct zip_string *); +const zip_uint8_t *_zip_string_get(struct zip_string *, zip_uint32_t *, zip_flags_t, struct zip_error *); +zip_uint16_t _zip_string_length(const struct zip_string *); +struct zip_string *_zip_string_new(const zip_uint8_t *, zip_uint16_t, zip_flags_t, struct zip_error *); +void _zip_string_write(const struct zip_string *, FILE *); + +int _zip_changed(const struct zip *, zip_uint64_t *); +const char *_zip_get_name(struct zip *, zip_uint64_t, zip_flags_t, struct zip_error *); int _zip_local_header_read(struct zip *, int); void *_zip_memdup(const void *, size_t, struct zip_error *); -int _zip_name_locate(struct zip *, const char *, int, struct zip_error *); +zip_int64_t _zip_name_locate(struct zip *, const char *, zip_flags_t, struct zip_error *); struct zip *_zip_new(struct zip_error *); -unsigned short _zip_read2(unsigned char **); -unsigned int _zip_read4(unsigned char **); -zip_int64_t _zip_replace(struct zip *, zip_uint64_t, const char *, - struct zip_source *); -int _zip_set_name(struct zip *, zip_uint64_t, const char *); -void _zip_u2d_time(time_t, unsigned short *, unsigned short *); +zip_uint16_t _zip_read2(const zip_uint8_t **); +zip_uint32_t _zip_read4(const zip_uint8_t **); +zip_uint64_t _zip_read8(const zip_uint8_t **); +zip_uint8_t *_zip_read_data(const zip_uint8_t **, FILE *, size_t, int, struct zip_error *); +zip_int64_t _zip_file_replace(struct zip *, zip_uint64_t, const char *, struct zip_source *, zip_flags_t); +int _zip_set_name(struct zip *, zip_uint64_t, const char *, zip_flags_t); +void _zip_u2d_time(time_t, zip_uint16_t *, zip_uint16_t *); int _zip_unchange(struct zip *, zip_uint64_t, int); void _zip_unchange_data(struct zip_entry *); +void _zip_poke4(zip_uint32_t, zip_uint8_t **); +void _zip_poke8(zip_uint64_t, zip_uint8_t **); +void _zip_write2(zip_uint16_t, FILE *); +void _zip_write4(zip_uint32_t, FILE *); +void _zip_write8(zip_uint64_t, FILE *); + + #endif /* zipint.h */ diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 969bac1aa6b5d..cd1d7cd425f74 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -30,8 +30,6 @@ #include "ext/pcre/php_pcre.h" #include "ext/standard/php_filestat.h" #include "php_zip.h" -#include "lib/zip.h" -#include "lib/zipint.h" /* zip_open is a macro for renaming libzip zipopen, so we need to use PHP_NAMED_FUNCTION */ static PHP_NAMED_FUNCTION(zif_zip_open); @@ -53,6 +51,24 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_close); #endif #endif +#if PHP_VERSION_ID < 50400 +#define ARG_PATH "s" +#define KEY_ARG_DC +#define KEY_ARG_CC +#else +#define ARG_PATH "p" +#define KEY_ARG_DC , const zend_literal *key +#define KEY_ARG_CC , key +#endif + +#if PHP_VERSION_ID < 50500 +#define TYPE_ARG_DC +#define TYPE_ARG_CC +#else +#define TYPE_ARG_DC , int type +#define TYPE_ARG_CC , type +#endif + /* {{{ Resource le */ static int le_zip_dir; #define le_zip_dir_name "Zip Directory" @@ -102,14 +118,14 @@ static char * php_zip_make_relative_path(char *path, int path_len) /* {{{ */ char *path_begin = path; size_t i; - if (IS_SLASH(path[0])) { - return path + 1; - } - if (path_len < 1 || path == NULL) { return NULL; } + if (IS_SLASH(path[0])) { + return path + 1; + } + i = path_len; while (1) { @@ -154,7 +170,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil size_t path_cleaned_len; cwd_state new_state; - new_state.cwd = (char*)malloc(1); + new_state.cwd = (char*)emalloc(1); new_state.cwd[0] = '\0'; new_state.cwd_length = 0; @@ -191,7 +207,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil if (ZIP_OPENBASEDIR_CHECKPATH(file_dirname_fullpath)) { efree(file_dirname_fullpath); efree(file_basename); - free(new_state.cwd); + efree(new_state.cwd); return 0; } } @@ -215,7 +231,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil efree(file_dirname_fullpath); if (!is_dir_only) { efree(file_basename); - free(new_state.cwd); + efree(new_state.cwd); } return 0; } @@ -224,7 +240,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil /* it is a standalone directory, job done */ if (is_dir_only) { efree(file_dirname_fullpath); - free(new_state.cwd); + efree(new_state.cwd); return 1; } @@ -232,13 +248,13 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil if (!len) { efree(file_dirname_fullpath); efree(file_basename); - free(new_state.cwd); + efree(new_state.cwd); return 0; } else if (len > MAXPATHLEN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Full extraction path exceed MAXPATHLEN (%i)", MAXPATHLEN); efree(file_dirname_fullpath); efree(file_basename); - free(new_state.cwd); + efree(new_state.cwd); return 0; } @@ -250,7 +266,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil efree(fullpath); efree(file_dirname_fullpath); efree(file_basename); - free(new_state.cwd); + efree(new_state.cwd); return 0; } @@ -285,7 +301,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil efree(fullpath); efree(file_basename); efree(file_dirname_fullpath); - free(new_state.cwd); + efree(new_state.cwd); if (n<0) { return 0; @@ -299,7 +315,6 @@ static int php_zip_add_file(struct zip *za, const char *filename, size_t filenam char *entry_name, size_t entry_name_len, long offset_start, long offset_len TSRMLS_DC) /* {{{ */ { struct zip_source *zs; - int cur_idx; char resolved_path[MAXPATHLEN]; zval exists_flag; @@ -321,25 +336,11 @@ static int php_zip_add_file(struct zip *za, const char *filename, size_t filenam if (!zs) { return -1; } - - cur_idx = zip_name_locate(za, (const char *)entry_name, 0); - /* TODO: fix _zip_replace */ - if (cur_idx<0) { - /* reset the error */ - if (za->error.str) { - _zip_error_fini(&za->error); - } - _zip_error_init(&za->error); - } else { - if (zip_delete(za, cur_idx) == -1) { - zip_source_free(zs); - return -1; - } - } - - if (zip_add(za, entry_name, zs) == -1) { + if (zip_file_add(za, entry_name, zs, ZIP_FL_OVERWRITE) < 0) { + zip_source_free(zs); return -1; } else { + zip_error_clear(za); return 1; } } @@ -780,7 +781,11 @@ static const zend_function_entry zip_functions[] = { PHP_FE(zip_entry_name, arginfo_zip_entry_name) PHP_FE(zip_entry_compressedsize, arginfo_zip_entry_compressedsize) PHP_FE(zip_entry_compressionmethod, arginfo_zip_entry_compressionmethod) +#ifdef PHP_FE_END PHP_FE_END +#else + {NULL,NULL,NULL} +#endif }; /* }}} */ @@ -869,7 +874,7 @@ static int php_zip_property_reader(ze_zip_object *obj, zip_prop_handler *hnd, zv } /* }}} */ -static zval **php_zip_get_property_ptr_ptr(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC) /* {{{ */ +static zval **php_zip_get_property_ptr_ptr(zval *object, zval *member TYPE_ARG_DC KEY_ARG_DC TSRMLS_DC) /* {{{ */ { ze_zip_object *obj; zval tmp_member; @@ -884,24 +889,27 @@ static zval **php_zip_get_property_ptr_ptr(zval *object, zval *member, int type, zval_copy_ctor(&tmp_member); convert_to_string(&tmp_member); member = &tmp_member; +#if PHP_VERSION_ID >= 50400 key = NULL; +#endif } ret = FAILURE; obj = (ze_zip_object *)zend_objects_get_address(object TSRMLS_CC); if (obj->prop_handler != NULL) { +#if PHP_VERSION_ID >= 50400 if (key) { ret = zend_hash_quick_find(obj->prop_handler, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, key->hash_value, (void **) &hnd); - } else { + } else +#endif ret = zend_hash_find(obj->prop_handler, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &hnd); - } } if (ret == FAILURE) { std_hnd = zend_get_std_object_handlers(); - retval = std_hnd->get_property_ptr_ptr(object, member, type, key TSRMLS_CC); + retval = std_hnd->get_property_ptr_ptr(object, member TYPE_ARG_CC KEY_ARG_CC TSRMLS_CC); } if (member == &tmp_member) { @@ -911,7 +919,7 @@ static zval **php_zip_get_property_ptr_ptr(zval *object, zval *member, int type, } /* }}} */ -static zval* php_zip_read_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC) /* {{{ */ +static zval* php_zip_read_property(zval *object, zval *member, int type KEY_ARG_DC TSRMLS_DC) /* {{{ */ { ze_zip_object *obj; zval tmp_member; @@ -925,18 +933,21 @@ static zval* php_zip_read_property(zval *object, zval *member, int type, const z zval_copy_ctor(&tmp_member); convert_to_string(&tmp_member); member = &tmp_member; +#if PHP_VERSION_ID >= 50400 key = NULL; +#endif } ret = FAILURE; obj = (ze_zip_object *)zend_objects_get_address(object TSRMLS_CC); if (obj->prop_handler != NULL) { +#if PHP_VERSION_ID >= 50400 if (key) { ret = zend_hash_quick_find(obj->prop_handler, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, key->hash_value, (void **) &hnd); - } else { + } else +#endif ret = zend_hash_find(obj->prop_handler, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &hnd); - } } if (ret == SUCCESS) { @@ -949,7 +960,7 @@ static zval* php_zip_read_property(zval *object, zval *member, int type, const z } } else { std_hnd = zend_get_std_object_handlers(); - retval = std_hnd->read_property(object, member, type, key TSRMLS_CC); + retval = std_hnd->read_property(object, member, type KEY_ARG_CC TSRMLS_CC); } if (member == &tmp_member) { @@ -959,7 +970,7 @@ static zval* php_zip_read_property(zval *object, zval *member, int type, const z } /* }}} */ -static int php_zip_has_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC) /* {{{ */ +static int php_zip_has_property(zval *object, zval *member, int type KEY_ARG_DC TSRMLS_DC) /* {{{ */ { ze_zip_object *obj; zval tmp_member; @@ -972,18 +983,21 @@ static int php_zip_has_property(zval *object, zval *member, int type, const zend zval_copy_ctor(&tmp_member); convert_to_string(&tmp_member); member = &tmp_member; +#if PHP_VERSION_ID >= 50400 key = NULL; +#endif } ret = FAILURE; obj = (ze_zip_object *)zend_objects_get_address(object TSRMLS_CC); if (obj->prop_handler != NULL) { +#if PHP_VERSION_ID >= 50400 if (key) { ret = zend_hash_quick_find(obj->prop_handler, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, key->hash_value, (void **) &hnd); - } else { + } else +#endif ret = zend_hash_find(obj->prop_handler, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &hnd); - } } if (ret == SUCCESS) { @@ -1005,7 +1019,7 @@ static int php_zip_has_property(zval *object, zval *member, int type, const zend zval_ptr_dtor(&tmp); } else { std_hnd = zend_get_std_object_handlers(); - retval = std_hnd->has_property(object, member, type, key TSRMLS_CC); + retval = std_hnd->has_property(object, member, type KEY_ARG_CC TSRMLS_CC); } if (member == &tmp_member) { @@ -1059,7 +1073,8 @@ static void php_zip_object_free_storage(void *object TSRMLS_DC) /* {{{ */ } if (intern->za) { if (zip_close(intern->za) != 0) { - _zip_free(intern->za); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot destroy the zip context"); + return; } intern->za = NULL; } @@ -1096,6 +1111,9 @@ static void php_zip_object_free_storage(void *object TSRMLS_DC) /* {{{ */ static zend_object_value php_zip_object_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ { +#if PHP_VERSION_ID < 50400 + zval *tmp; +#endif ze_zip_object *intern; zend_object_value retval; @@ -1116,8 +1134,13 @@ static zend_object_value php_zip_object_new(zend_class_entry *class_type TSRMLS_ intern->zo.ce = class_type; #endif - object_properties_init(&intern->zo, class_type); +#if PHP_VERSION_ID < 50400 + zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, + (void *) &tmp, sizeof(zval *)); +#else + object_properties_init(&intern->zo, class_type); +#endif retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) php_zip_object_free_storage, @@ -1140,7 +1163,7 @@ static void php_zip_free_dir(zend_rsrc_list_entry *rsrc TSRMLS_DC) if (zip_int) { if (zip_int->za) { if (zip_close(zip_int->za) != 0) { - _zip_free(zip_int->za); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot destroy the zip context"); } zip_int->za = NULL; } @@ -1159,13 +1182,7 @@ static void php_zip_free_entry(zend_rsrc_list_entry *rsrc TSRMLS_DC) if (zr_rsrc) { if (zr_rsrc->zf) { - if (zr_rsrc->zf->za) { - zip_fclose(zr_rsrc->zf); - } else { - if (zr_rsrc->zf->src) - zip_source_free(zr_rsrc->zf->src); - free(zr_rsrc->zf); - } + zip_fclose(zr_rsrc->zf); zr_rsrc->zf = NULL; } efree(zr_rsrc); @@ -1195,7 +1212,7 @@ zend_module_entry zip_module_entry = { NULL, NULL, PHP_MINFO(zip), - PHP_ZIP_VERSION_STRING, + PHP_ZIP_VERSION, STANDARD_MODULE_PROPERTIES }; /* }}} */ @@ -1215,7 +1232,7 @@ static PHP_NAMED_FUNCTION(zif_zip_open) zip_rsrc *rsrc_int; int err = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ARG_PATH, &filename, &filename_len) == FAILURE) { return; } @@ -1498,7 +1515,7 @@ static ZIPARCHIVE_METHOD(open) zval *this = getThis(); ze_zip_object *ze_obj = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &filename, &filename_len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ARG_PATH "|l", &filename, &filename_len, &flags) == FAILURE) { return; } @@ -1523,7 +1540,8 @@ static ZIPARCHIVE_METHOD(open) if (ze_obj->za) { /* we already have an opened zip, free it */ if (zip_close(ze_obj->za) != 0) { - _zip_free(ze_obj->za); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty string as source"); + RETURN_FALSE; } ze_obj->za = NULL; } @@ -1543,6 +1561,38 @@ static ZIPARCHIVE_METHOD(open) } /* }}} */ +/* {{{ proto resource ZipArchive::setPassword(string password) +Set the password for the active archive */ +static ZIPARCHIVE_METHOD(setPassword) +{ + struct zip *intern; + zval *this = getThis(); + char *password; + int password_len; + + if (!this) { + RETURN_FALSE; + } + + ZIP_FROM_OBJECT(intern, this); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &password, &password_len) == FAILURE) { + return; + } + + if (password_len < 1) { + RETURN_FALSE; + } else { + int res = zip_set_default_password(intern, (const char *)password); + if (res == 0) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } + } +} +/* }}} */ + /* {{{ proto bool ZipArchive::close() close the zip archive */ static ZIPARCHIVE_METHOD(close) @@ -1552,7 +1602,7 @@ static ZIPARCHIVE_METHOD(close) ze_zip_object *ze_obj; if (!this) { - RETURN_FALSE; + RETURN_FALSE; } ZIP_FROM_OBJECT(intern, this); @@ -1560,7 +1610,7 @@ static ZIPARCHIVE_METHOD(close) ze_obj = (ze_zip_object*) zend_object_store_get_object(this TSRMLS_CC); if (zip_close(intern)) { - RETURN_FALSE; + zip_discard(intern); } efree(ze_obj->filename); @@ -1637,6 +1687,7 @@ static ZIPARCHIVE_METHOD(addEmptyDir) if (zip_add_dir(intern, (const char *)s) == -1) { RETVAL_FALSE; } + zip_error_clear(intern); RETVAL_TRUE; } @@ -1654,7 +1705,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* char *path = NULL; char *remove_path = NULL; char *add_path = NULL; - int pattern_len, add_path_len = 0, remove_path_len = 0, path_len = 0; + int pattern_len, add_path_len, remove_path_len = 0, path_len = 0; long remove_all_path = 0; long flags = 0; zval *options = NULL; @@ -1667,12 +1718,12 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* ZIP_FROM_OBJECT(intern, this); /* 1 == glob, 2==pcre */ if (type == 1) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|la", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ARG_PATH "|la", &pattern, &pattern_len, &flags, &options) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|sa", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ARG_PATH "|sa", &pattern, &pattern_len, &path, &path_len, &options) == FAILURE) { return; } @@ -1703,13 +1754,12 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* zval **zval_file = NULL; for (i = 0; i < found; i++) { - char *file, *file_stripped, *entry_name; + char *file_stripped, *entry_name; size_t entry_name_len, file_stripped_len; char entry_name_buf[MAXPATHLEN]; char *basename = NULL; if (zend_hash_index_find(Z_ARRVAL_P(return_value), i, (void **) &zval_file) == SUCCESS) { - file = Z_STRVAL_PP(zval_file); if (remove_all_path) { php_basename(Z_STRVAL_PP(zval_file), Z_STRLEN_PP(zval_file), NULL, 0, &basename, (size_t *)&file_stripped_len TSRMLS_CC); @@ -1786,7 +1836,7 @@ static ZIPARCHIVE_METHOD(addFile) ZIP_FROM_OBJECT(intern, this); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|sll", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ARG_PATH "|sll", &filename, &filename_len, &entry_name, &entry_name_len, &offset_start, &offset_len) == FAILURE) { return; } @@ -1856,13 +1906,16 @@ static ZIPARCHIVE_METHOD(addFromString) /* TODO: fix _zip_replace */ if (cur_idx >= 0) { if (zip_delete(intern, cur_idx) == -1) { + zip_source_free(zs); RETURN_FALSE; } } if (zip_add(intern, name, zs) == -1) { + zip_source_free(zs); RETURN_FALSE; } else { + zip_error_clear(intern); RETURN_TRUE; } } @@ -1885,7 +1938,7 @@ static ZIPARCHIVE_METHOD(statName) ZIP_FROM_OBJECT(intern, this); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ARG_PATH "|l", &name, &name_len, &flags) == FAILURE) { return; } @@ -1941,7 +1994,7 @@ static ZIPARCHIVE_METHOD(locateName) ZIP_FROM_OBJECT(intern, this); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ARG_PATH "|l", &name, &name_len, &flags) == FAILURE) { return; } @@ -2521,7 +2574,7 @@ static void php_zip_get_from(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */ ZIP_FROM_OBJECT(intern, this); if (type == 1) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ll", &filename, &filename_len, &len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ARG_PATH "|ll", &filename, &filename_len, &len, &flags) == FAILURE) { return; } PHP_ZIP_STAT_PATH(intern, filename, filename_len, flags, sb); @@ -2597,7 +2650,7 @@ static ZIPARCHIVE_METHOD(getStream) ZIP_FROM_OBJECT(intern, this); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ARG_PATH, &filename, &filename_len) == FAILURE) { return; } @@ -2620,6 +2673,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_open, 0, 0, 1) ZEND_ARG_INFO(0, flags) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setpassword, 0, 0, 1) + ZEND_ARG_INFO(0, password) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO(arginfo_ziparchive__void, 0) ZEND_END_ARG_INFO() @@ -2732,6 +2789,7 @@ ZEND_END_ARG_INFO() /* {{{ ze_zip_object_class_functions */ static const zend_function_entry zip_class_functions[] = { ZIPARCHIVE_ME(open, arginfo_ziparchive_open, ZEND_ACC_PUBLIC) + ZIPARCHIVE_ME(setPassword, arginfo_ziparchive_setpassword, ZEND_ACC_PUBLIC) ZIPARCHIVE_ME(close, arginfo_ziparchive__void, ZEND_ACC_PUBLIC) ZIPARCHIVE_ME(getStatusString, arginfo_ziparchive__void, ZEND_ACC_PUBLIC) ZIPARCHIVE_ME(addEmptyDir, arginfo_ziparchive_addemptydir, ZEND_ACC_PUBLIC) @@ -2874,7 +2932,7 @@ static PHP_MINFO_FUNCTION(zip) php_info_print_table_row(2, "Zip", "enabled"); php_info_print_table_row(2, "Extension Version","$Id$"); - php_info_print_table_row(2, "Zip version", PHP_ZIP_VERSION_STRING); + php_info_print_table_row(2, "Zip version", PHP_ZIP_VERSION); php_info_print_table_row(2, "Libzip version", LIBZIP_VERSION); php_info_print_table_end(); diff --git a/ext/zip/php_zip.h b/ext/zip/php_zip.h index dace407d14f31..c8da941b7a82d 100644 --- a/ext/zip/php_zip.h +++ b/ext/zip/php_zip.h @@ -28,9 +28,17 @@ extern zend_module_entry zip_module_entry; #include "TSRM.h" #endif +#if defined(HAVE_LIBZIP) +#include +#else #include "lib/zip.h" +#endif -#define PHP_ZIP_VERSION_STRING "1.11.0" +#ifndef ZIP_OVERWRITE +#define ZIP_OVERWRITE ZIP_TRUNCATE +#endif + +#define PHP_ZIP_VERSION "1.12.3" #if ((PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 2) || PHP_MAJOR_VERSION >= 6) # define PHP_ZIP_USE_OO 1 @@ -67,8 +75,9 @@ typedef struct _ze_zip_read_rsrc { } zip_read_rsrc; #ifdef PHP_ZIP_USE_OO -#define ZIPARCHIVE_ME(name, arg_info, flags) ZEND_FENTRY(name, c_ziparchive_ ##name, arg_info, flags) -#define ZIPARCHIVE_METHOD(name) ZEND_NAMED_FUNCTION(c_ziparchive_##name) +#define ZIPARCHIVE_ME(name, arg_info, flags) {#name, c_ziparchive_ ##name, arg_info,(zend_uint) (sizeof(arg_info)/sizeof(struct _zend_arg_info)-1), flags }, +#define ZIPARCHIVE_METHOD(name) ZEND_NAMED_FUNCTION(c_ziparchive_ ##name) + /* Extends zend object */ typedef struct _ze_zip_object { diff --git a/ext/zip/tests/bug38943.inc b/ext/zip/tests/bug38943.inc new file mode 100644 index 0000000000000..a6f45e8294eff --- /dev/null +++ b/ext/zip/tests/bug38943.inc @@ -0,0 +1,16 @@ +testarray[] = 1; + var_dump($this->testarray); + } +} + +$z = new myZip; +$z->testp = "foobar"; +var_dump($z); + diff --git a/ext/zip/tests/bug38943_2.phpt b/ext/zip/tests/bug38943_2.phpt new file mode 100644 index 0000000000000..bdbad94517cc9 --- /dev/null +++ b/ext/zip/tests/bug38943_2.phpt @@ -0,0 +1,38 @@ +--TEST-- +#38943, properties in extended class cannot be set (5.3) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +array(1) { + [0]=> + int(1) +} +object(myZip)#1 (%d) { + ["test":"myZip":private]=> + int(0) + ["testp"]=> + string(6) "foobar" + ["testarray":"myZip":private]=> + array(1) { + [0]=> + int(1) + } + ["status"]=> + int(0) + ["statusSys"]=> + int(0) + ["numFiles"]=> + int(0) + ["filename"]=> + string(0) "" + ["comment"]=> + string(0) "" +} diff --git a/ext/zip/tests/doubleclose.phpt b/ext/zip/tests/doubleclose.phpt new file mode 100644 index 0000000000000..abc62c8434789 --- /dev/null +++ b/ext/zip/tests/doubleclose.phpt @@ -0,0 +1,43 @@ +--TEST-- +close() called twice +--SKIPIF-- + +--FILE-- +open(dirname(__FILE__) . '/test.zip')) { + die('Failure'); +} +if ($zip->status == ZIPARCHIVE::ER_OK) { + var_dump($zip->close()); + var_dump($zip->close()); +} else { + die("Failure"); +} + +?> +Done +--EXPECTF-- +Procedural +NULL + +Warning: zip_close(): %i is not a valid Zip Directory resource in %s +bool(false) +Object +bool(true) + +Warning: ZipArchive::close(): Invalid or uninitialized Zip object in %s +bool(false) +Done diff --git a/ext/zip/tests/zip_entry_close.phpt b/ext/zip/tests/zip_entry_close.phpt new file mode 100644 index 0000000000000..82b7819054f49 --- /dev/null +++ b/ext/zip/tests/zip_entry_close.phpt @@ -0,0 +1,24 @@ +--TEST-- +zip_entry_close() function: simple and double call +--SKIPIF-- + +--FILE-- + +Done +--EXPECTF-- +entry_open: bool(true) +entry_close: bool(true) +entry_close: +Warning: zip_entry_close(): %d is not a valid Zip Entry resource in %s +bool(false) +Done diff --git a/ext/zip/zip_stream.c b/ext/zip/zip_stream.c index 79b54cbbb0cdc..02fbc70f85e60 100644 --- a/ext/zip/zip_stream.c +++ b/ext/zip/zip_stream.c @@ -1,3 +1,21 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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 | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt. | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Piere-Alain Joye | + +----------------------------------------------------------------------+ +*/ + /* $Id$ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -6,8 +24,6 @@ #if HAVE_ZIP #ifdef ZEND_ENGINE_2 -#include "lib/zip.h" - #include "php_streams.h" #include "ext/standard/file.h" #include "ext/standard/php_string.h" diff --git a/ext/zlib/tests/gzeof_variation1.phpt b/ext/zlib/tests/gzeof_variation1.phpt index 6d1e0401dff1c..77a1eccb66bb3 100644 --- a/ext/zlib/tests/gzeof_variation1.phpt +++ b/ext/zlib/tests/gzeof_variation1.phpt @@ -9,7 +9,7 @@ if (!extension_loaded("zlib")) { --FILE-- string(17) "for all languages" } -===DONE=== \ No newline at end of file +===DONE=== diff --git a/ext/zlib/tests/gzfile_basic2.phpt b/ext/zlib/tests/gzfile_basic2.phpt index 9f31eb0f87380..2bbf315a1ad71 100644 --- a/ext/zlib/tests/gzfile_basic2.phpt +++ b/ext/zlib/tests/gzfile_basic2.phpt @@ -12,7 +12,7 @@ is a very common test for all languages EOT; $dirname = 'gzfile_temp'; -$filename = $dirname.'/plainfile.txt'; +$filename = $dirname.'/gzfile_basic2.txt'; mkdir($dirname); $h = fopen($filename, 'w'); fwrite($h, $plaintxt); @@ -36,4 +36,4 @@ array(3) { [2]=> string(17) "for all languages" } -===DONE=== \ No newline at end of file +===DONE=== diff --git a/ext/zlib/tests/gzopen_basic2.phpt b/ext/zlib/tests/gzopen_basic2.phpt index 5cc02cd182267..90766b18170cf 100644 --- a/ext/zlib/tests/gzopen_basic2.phpt +++ b/ext/zlib/tests/gzopen_basic2.phpt @@ -18,7 +18,7 @@ echo "*** Testing gzopen() : basic functionality ***\n"; // Initialise all required variables -$filename = "temp.txt.gz"; +$filename = "gzopen_basic2.txt.gz"; $modes = array('w', 'w+'); $data = "This was the information that was written"; diff --git a/ext/zlib/tests/gzputs_basic.phpt b/ext/zlib/tests/gzputs_basic.phpt index 7566e74e72393..6456e4b55f96c 100644 --- a/ext/zlib/tests/gzputs_basic.phpt +++ b/ext/zlib/tests/gzputs_basic.phpt @@ -9,7 +9,7 @@ if (!extension_loaded("zlib")) { --FILE-- --FILE-- post_handler(SG(request_info).content_type_dup, arg TSRMLS_CC); - if (SG(request_info).post_data) { - efree(SG(request_info).post_data); - SG(request_info).post_data = NULL; - } efree(SG(request_info).content_type_dup); SG(request_info).content_type_dup = NULL; } @@ -249,39 +241,63 @@ static void sapi_read_post_data(TSRMLS_D) } } - -SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data) +SAPI_API int sapi_read_post_block(char *buffer, size_t buflen TSRMLS_DC) { int read_bytes; - int allocated_bytes=SAPI_POST_BLOCK_SIZE+1; + if (!sapi_module.read_post) { + return -1; + } + + read_bytes = sapi_module.read_post(buffer, buflen TSRMLS_CC); + + if (read_bytes > 0) { + /* gogo */ + SG(read_post_bytes) += read_bytes; + } + if (read_bytes < buflen) { + /* done */ + SG(post_read) = 1; + } + + return read_bytes; +} + +SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data) +{ if ((SG(post_max_size) > 0) && (SG(request_info).content_length > SG(post_max_size))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "POST Content-Length of %ld bytes exceeds the limit of %ld bytes", SG(request_info).content_length, SG(post_max_size)); return; } - SG(request_info).post_data = emalloc(allocated_bytes); - for (;;) { - read_bytes = sapi_module.read_post(SG(request_info).post_data+SG(read_post_bytes), SAPI_POST_BLOCK_SIZE TSRMLS_CC); - if (read_bytes<=0) { - break; - } - SG(read_post_bytes) += read_bytes; - if ((SG(post_max_size) > 0) && (SG(read_post_bytes) > SG(post_max_size))) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Actual POST length does not match Content-Length, and exceeds %ld bytes", SG(post_max_size)); - break; - } - if (read_bytes < SAPI_POST_BLOCK_SIZE) { - break; - } - if (SG(read_post_bytes)+SAPI_POST_BLOCK_SIZE >= allocated_bytes) { - allocated_bytes = SG(read_post_bytes)+SAPI_POST_BLOCK_SIZE+1; - SG(request_info).post_data = erealloc(SG(request_info).post_data, allocated_bytes); + + SG(request_info).request_body = php_stream_temp_create(TEMP_STREAM_DEFAULT, SAPI_POST_BLOCK_SIZE); + + if (sapi_module.read_post) { + int read_bytes; + + for (;;) { + char buffer[SAPI_POST_BLOCK_SIZE]; + + read_bytes = sapi_read_post_block(buffer, SAPI_POST_BLOCK_SIZE TSRMLS_CC); + + if (read_bytes > 0) { + php_stream_write(SG(request_info).request_body, buffer, read_bytes); + } + + if ((SG(post_max_size) > 0) && (SG(read_post_bytes) > SG(post_max_size))) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Actual POST length does not match Content-Length, and exceeds %ld bytes", SG(post_max_size)); + break; + } + + if (read_bytes < SAPI_POST_BLOCK_SIZE) { + /* done */ + break; + } } + php_stream_rewind(SG(request_info).request_body); } - SG(request_info).post_data[SG(read_post_bytes)] = 0; /* terminating NULL */ - SG(request_info).post_data_length = SG(read_post_bytes); } @@ -387,8 +403,7 @@ SAPI_API void sapi_activate_headers_only(TSRMLS_D) SG(sapi_headers).http_status_line = NULL; SG(sapi_headers).mimetype = NULL; SG(read_post_bytes) = 0; - SG(request_info).post_data = NULL; - SG(request_info).raw_post_data = NULL; + SG(request_info).request_body = NULL; SG(request_info).current_user = NULL; SG(request_info).current_user_length = 0; SG(request_info).no_headers = 0; @@ -433,8 +448,7 @@ SAPI_API void sapi_activate(TSRMLS_D) SG(callback_run) = 0; SG(callback_func) = NULL; SG(read_post_bytes) = 0; - SG(request_info).post_data = NULL; - SG(request_info).raw_post_data = NULL; + SG(request_info).request_body = NULL; SG(request_info).current_user = NULL; SG(request_info).current_user_length = 0; SG(request_info).no_headers = 0; @@ -452,20 +466,13 @@ SAPI_API void sapi_activate(TSRMLS_D) /* Handle request method */ if (SG(server_context)) { - if (PG(enable_post_data_reading) && SG(request_info).request_method) { - if (SG(request_info).content_type && !strcmp(SG(request_info).request_method, "POST")) { - /* HTTP POST may contain form data to be processed into variables - * depending on given content type */ - sapi_read_post_data(TSRMLS_C); - } else { - /* Any other method with content payload will fill $HTTP_RAW_POST_DATA - * if it is enabled by always_populate_raw_post_data. - * It's up to the webserver to decide whether to allow a method or not. */ - SG(request_info).content_type_dup = NULL; - if (sapi_module.default_post_reader) { - sapi_module.default_post_reader(TSRMLS_C); - } - } + if (PG(enable_post_data_reading) + && SG(request_info).content_type + && SG(request_info).request_method + && !strcmp(SG(request_info).request_method, "POST")) { + /* HTTP POST may contain form data to be processed into variables + * depending on given content type */ + sapi_read_post_data(TSRMLS_C); } else { SG(request_info).content_type_dup = NULL; } @@ -494,22 +501,19 @@ static void sapi_send_headers_free(TSRMLS_D) SAPI_API void sapi_deactivate(TSRMLS_D) { zend_llist_destroy(&SG(sapi_headers).headers); - if (SG(request_info).post_data) { - efree(SG(request_info).post_data); - } else if (SG(server_context)) { - if(sapi_module.read_post) { + if (SG(request_info).request_body) { + SG(request_info).request_body = NULL; + } else if (SG(server_context)) { + if (!SG(post_read)) { /* make sure we've consumed all request input data */ char dummy[SAPI_POST_BLOCK_SIZE]; int read_bytes; - while((read_bytes = sapi_module.read_post(dummy, sizeof(dummy)-1 TSRMLS_CC)) > 0) { - SG(read_post_bytes) += read_bytes; - } + do { + read_bytes = sapi_read_post_block(dummy, SAPI_POST_BLOCK_SIZE TSRMLS_CC); + } while (SAPI_POST_BLOCK_SIZE == read_bytes); } } - if (SG(request_info).raw_post_data) { - efree(SG(request_info).raw_post_data); - } if (SG(request_info).auth_user) { efree(SG(request_info).auth_user); } diff --git a/main/SAPI.h b/main/SAPI.h index 6fc60c886513e..928fca95da72e 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -32,8 +32,7 @@ #include #define SAPI_OPTION_NO_CHDIR 1 - -#define SAPI_POST_BLOCK_SIZE 4000 +#define SAPI_POST_BLOCK_SIZE 0x4000 #ifdef PHP_WIN32 # ifdef SAPI_EXPORTS @@ -80,14 +79,15 @@ END_EXTERN_C() typedef struct { const char *request_method; char *query_string; - char *post_data, *raw_post_data; char *cookie_data; long content_length; - int64_t post_data_length, raw_post_data_length; char *path_translated; char *request_uri; + /* Do not use request_body directly, but the php://input stream wrapper instead */ + struct _php_stream *request_body; + const char *content_type; zend_bool headers_only; @@ -121,6 +121,7 @@ typedef struct _sapi_globals_struct { sapi_request_info request_info; sapi_headers_struct sapi_headers; int64_t read_post_bytes; + unsigned char post_read; unsigned char headers_sent; struct stat global_stat; char *default_mimetype; @@ -189,7 +190,7 @@ SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bo SAPI_API int sapi_send_headers(TSRMLS_D); SAPI_API void sapi_free_header(sapi_header_struct *sapi_header); SAPI_API void sapi_handle_post(void *arg TSRMLS_DC); - +SAPI_API int sapi_read_post_block(char *buffer, size_t buflen TSRMLS_DC); SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entry TSRMLS_DC); SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry TSRMLS_DC); SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry TSRMLS_DC); diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index eb33ac7ba1264..6722798598af5 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -775,7 +775,12 @@ PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, co * we cannot cannot getcwd() and the requested, * relatively referenced file is accessible */ copy_len = strlen(filepath) > MAXPATHLEN - 1 ? MAXPATHLEN - 1 : strlen(filepath); - real_path = estrndup(filepath, copy_len); + if (real_path) { + memcpy(real_path, filepath, copy_len); + real_path[copy_len] = '\0'; + } else { + real_path = estrndup(filepath, copy_len); + } close(fdtest); return real_path; } else { @@ -786,11 +791,11 @@ PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, co } } - new_state.cwd = strdup(cwd); + new_state.cwd = estrdup(cwd); new_state.cwd_length = strlen(cwd); if (virtual_file_ex(&new_state, filepath, NULL, realpath_mode TSRMLS_CC)) { - free(new_state.cwd); + efree(new_state.cwd); return NULL; } @@ -801,7 +806,7 @@ PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, co } else { real_path = estrndup(new_state.cwd, new_state.cwd_length); } - free(new_state.cwd); + efree(new_state.cwd); return real_path; } diff --git a/main/main.c b/main/main.c index 2f56afa03a3fc..f2bf878426cb0 100644 --- a/main/main.c +++ b/main/main.c @@ -562,7 +562,6 @@ PHP_INI_BEGIN() STD_PHP_INI_BOOLEAN("allow_url_fopen", "1", PHP_INI_SYSTEM, OnUpdateBool, allow_url_fopen, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("allow_url_include", "0", PHP_INI_SYSTEM, OnUpdateBool, allow_url_include, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("enable_post_data_reading", "1", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, enable_post_data_reading, php_core_globals, core_globals) - STD_PHP_INI_BOOLEAN("always_populate_raw_post_data", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, always_populate_raw_post_data, php_core_globals, core_globals) STD_PHP_INI_ENTRY("realpath_cache_size", "16K", PHP_INI_SYSTEM, OnUpdateLong, realpath_cache_size_limit, virtual_cwd_globals, cwd_globals) STD_PHP_INI_ENTRY("realpath_cache_ttl", "120", PHP_INI_SYSTEM, OnUpdateLong, realpath_cache_ttl, virtual_cwd_globals, cwd_globals) @@ -1817,6 +1816,9 @@ void php_request_shutdown(void *dummy) sapi_deactivate(TSRMLS_C); } zend_end_try(); + /* 9.5 free virtual CWD memory */ + virtual_cwd_deactivate(TSRMLS_C); + /* 10. Destroy stream hashes */ zend_try { php_shutdown_stream_hashes(TSRMLS_C); @@ -2244,9 +2246,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod } #endif -#ifdef ZTS zend_post_startup(TSRMLS_C); -#endif module_initialized = 1; @@ -2316,6 +2316,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod shutdown_memory_manager(1, 0 TSRMLS_CC); zend_interned_strings_snapshot(TSRMLS_C); + virtual_cwd_activate(TSRMLS_C); /* we're done */ return retval; diff --git a/main/php.h b/main/php.h index 17ac8b4fd29d9..ed8a2bb08e5dc 100644 --- a/main/php.h +++ b/main/php.h @@ -26,7 +26,7 @@ #include #endif -#define PHP_API_VERSION 20121113 +#define PHP_API_VERSION 20131106 #define PHP_HAVE_STREAMS #define YYDEBUG 0 @@ -400,7 +400,7 @@ END_EXTERN_C() /* Virtual current working directory support */ -#include "tsrm_virtual_cwd.h" +#include "zend_virtual_cwd.h" #include "zend_constants.h" diff --git a/main/php_content_types.c b/main/php_content_types.c index c4433978ed2be..3346efc50ec6e 100644 --- a/main/php_content_types.c +++ b/main/php_content_types.c @@ -37,34 +37,11 @@ static sapi_post_entry php_post_entries[] = { */ SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader) { - char *data; - int length; - - /* $HTTP_RAW_POST_DATA registration */ if (!strcmp(SG(request_info).request_method, "POST")) { if (NULL == SG(request_info).post_entry) { /* no post handler registered, so we just swallow the data */ sapi_read_standard_form_data(TSRMLS_C); } - - /* For unknown content types we create HTTP_RAW_POST_DATA even if always_populate_raw_post_data off, - * this is in-effecient, but we need to keep doing it for BC reasons (for now) */ - if ((PG(always_populate_raw_post_data) || NULL == SG(request_info).post_entry) && SG(request_info).post_data) { - length = SG(request_info).post_data_length; - data = estrndup(SG(request_info).post_data, length); - SET_VAR_STRINGL("HTTP_RAW_POST_DATA", data, length); - } - } - - /* for php://input stream: - some post handlers modify the content of request_info.post_data - so for now we need a copy for the php://input stream - in the long run post handlers should be changed to not touch - request_info.post_data for memory preservation reasons - */ - if (SG(request_info).post_data) { - SG(request_info).raw_post_data = estrndup(SG(request_info).post_data, SG(request_info).post_data_length); - SG(request_info).raw_post_data_length = SG(request_info).post_data_length; } } /* }}} */ diff --git a/main/php_globals.h b/main/php_globals.h index 256765d665a53..fa2fe3b232962 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -131,7 +131,6 @@ struct _php_core_globals { zend_bool during_request_startup; zend_bool allow_url_fopen; zend_bool enable_post_data_reading; - zend_bool always_populate_raw_post_data; zend_bool report_zend_debug; int last_error_type; diff --git a/main/php_open_temporary_file.c b/main/php_open_temporary_file.c index 054d497be6d5c..8315297738165 100644 --- a/main/php_open_temporary_file.c +++ b/main/php_open_temporary_file.c @@ -124,11 +124,11 @@ static int php_do_open_temporary_file(const char *path, const char *pfx, char ** cwd[0] = '\0'; } - new_state.cwd = strdup(cwd); + new_state.cwd = estrdup(cwd); new_state.cwd_length = strlen(cwd); if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC)) { - free(new_state.cwd); + efree(new_state.cwd); return -1; } @@ -140,7 +140,7 @@ static int php_do_open_temporary_file(const char *path, const char *pfx, char ** if (spprintf(&opened_path, 0, "%s%s%sXXXXXX", new_state.cwd, trailing_slash, pfx) >= MAXPATHLEN) { efree(opened_path); - free(new_state.cwd); + efree(new_state.cwd); return -1; } @@ -151,7 +151,7 @@ static int php_do_open_temporary_file(const char *path, const char *pfx, char ** * which means that opening it will fail... */ if (VCWD_CHMOD(opened_path, 0600)) { efree(opened_path); - free(new_state.cwd); + efree(new_state.cwd); return -1; } fd = VCWD_OPEN_MODE(opened_path, open_flags, 0600); @@ -170,7 +170,7 @@ static int php_do_open_temporary_file(const char *path, const char *pfx, char ** } else { *opened_path_p = opened_path; } - free(new_state.cwd); + efree(new_state.cwd); return fd; } /* }}} */ diff --git a/main/php_streams.h b/main/php_streams.h index c56014c62e17f..c9732b484849a 100644 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -242,7 +242,7 @@ PHPAPI php_stream *_php_stream_alloc(php_stream_ops *ops, void *abstract, END_EXTERN_C() #define php_stream_alloc(ops, thisptr, persistent_id, mode) _php_stream_alloc((ops), (thisptr), (persistent_id), (mode) STREAMS_CC TSRMLS_CC) -#define php_stream_get_resource_id(stream) (stream)->rsrc_id +#define php_stream_get_resource_id(stream) ((php_stream *)(stream))->rsrc_id #if ZEND_DEBUG /* use this to tell the stream that it is OK if we don't explicitly close it */ # define php_stream_auto_cleanup(stream) { (stream)->__exposed++; } diff --git a/main/php_variables.c b/main/php_variables.c index 7018eae57bbd8..ab9aee3ae3c42 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -23,11 +23,15 @@ #include "php.h" #include "ext/standard/php_standard.h" #include "ext/standard/credits.h" +#include "ext/standard/php_smart_str.h" #include "php_variables.h" #include "php_globals.h" #include "php_content_types.h" #include "SAPI.h" #include "zend_globals.h" +#ifdef PHP_WIN32 +# include "win32/php_inttypes.h" +#endif /* for systems that need to override reading of environment variables */ void _php_import_environment_variables(zval *array_ptr TSRMLS_DC); @@ -228,44 +232,115 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars free_alloca(var_orig, use_heap); } +typedef struct post_var_data { + smart_str str; + char *ptr; + char *end; + uint64_t cnt; +} post_var_data_t; + +static zend_bool add_post_var(zval *arr, post_var_data_t *var, zend_bool eof TSRMLS_DC) +{ + char *ksep, *vsep; + size_t klen, vlen; + /* FIXME: string-size_t */ + unsigned int new_vlen; + + if (var->ptr >= var->end) { + return 0; + } + + vsep = memchr(var->ptr, '&', var->end - var->ptr); + if (!vsep) { + if (!eof) { + return 0; + } else { + vsep = var->end; + } + } + + ksep = memchr(var->ptr, '=', vsep - var->ptr); + if (ksep) { + *ksep = '\0'; + /* "foo=bar&" or "foo=&" */ + klen = ksep - var->ptr; + vlen = vsep - ++ksep; + } else { + ksep = ""; + /* "foo&" */ + klen = vsep - var->ptr; + vlen = 0; + } + + + php_url_decode(var->ptr, klen); + if (vlen) { + vlen = php_url_decode(ksep, vlen); + } + + if (sapi_module.input_filter(PARSE_POST, var->ptr, &ksep, vlen, &new_vlen TSRMLS_CC)) { + php_register_variable_safe(var->ptr, ksep, new_vlen, arr TSRMLS_CC); + } + + var->ptr = vsep + (vsep != var->end); + return 1; +} + +static inline int add_post_vars(zval *arr, post_var_data_t *vars, zend_bool eof TSRMLS_DC) +{ + uint64_t max_vars = PG(max_input_vars); + + vars->ptr = vars->str.c; + vars->end = vars->str.c + vars->str.len; + while (add_post_var(arr, vars, eof TSRMLS_CC)) { + if (++vars->cnt > max_vars) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, + "Input variables exceeded %" PRIu64 ". " + "To increase the limit change max_input_vars in php.ini.", + max_vars); + return FAILURE; + } + } + + if (!eof) { + memmove(vars->str.c, vars->ptr, vars->str.len = vars->end - vars->ptr); + } + return SUCCESS; +} + SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler) { - char *var, *val, *e, *s, *p; - zval *array_ptr = (zval *) arg; - long count = 0; + zval *arr = (zval *) arg; + php_stream *s = SG(request_info).request_body; + post_var_data_t post_data; - if (SG(request_info).post_data == NULL) { - return; - } + if (s && SUCCESS == php_stream_rewind(s)) { + memset(&post_data, 0, sizeof(post_data)); - s = SG(request_info).post_data; - e = s + SG(request_info).post_data_length; + while (!php_stream_eof(s)) { + char buf[BUFSIZ] = {0}; + size_t len = php_stream_read(s, buf, BUFSIZ); - while (s < e && (p = memchr(s, '&', (e - s)))) { -last_value: - if ((val = memchr(s, '=', (p - s)))) { /* have a value */ - unsigned int val_len, new_val_len; + if (len && len != (size_t) -1) { + smart_str_appendl(&post_data.str, buf, len); - if (++count > PG(max_input_vars)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded %ld. To increase the limit change max_input_vars in php.ini.", PG(max_input_vars)); - return; + if (SUCCESS != add_post_vars(arr, &post_data, 0 TSRMLS_CC)) { + if (post_data.str.c) { + efree(post_data.str.c); + } + return; + } } - var = s; - php_url_decode(var, (val - s)); - val++; - val_len = php_url_decode(val, (p - val)); - val = estrndup(val, val_len); - if (sapi_module.input_filter(PARSE_POST, var, &val, val_len, &new_val_len TSRMLS_CC)) { - php_register_variable_safe(var, val, new_val_len, array_ptr TSRMLS_CC); + if (len != BUFSIZ){ + break; } - efree(val); } - s = p + 1; - } - if (s < e) { - p = e; - goto last_value; + + add_post_vars(arr, &post_data, 1 TSRMLS_CC); + if (post_data.str.c) { + efree(post_data.str.c); + } } } diff --git a/main/streams/php_stream_transport.h b/main/streams/php_stream_transport.h index 52df73d731a44..15ba09430f981 100644 --- a/main/streams/php_stream_transport.h +++ b/main/streams/php_stream_transport.h @@ -170,10 +170,14 @@ typedef enum { STREAM_CRYPTO_METHOD_SSLv3_CLIENT, STREAM_CRYPTO_METHOD_SSLv23_CLIENT, STREAM_CRYPTO_METHOD_TLS_CLIENT, + STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT, + STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT, STREAM_CRYPTO_METHOD_SSLv2_SERVER, STREAM_CRYPTO_METHOD_SSLv3_SERVER, STREAM_CRYPTO_METHOD_SSLv23_SERVER, - STREAM_CRYPTO_METHOD_TLS_SERVER + STREAM_CRYPTO_METHOD_TLS_SERVER, + STREAM_CRYPTO_METHOD_TLSv1_1_SERVER, + STREAM_CRYPTO_METHOD_TLSv1_2_SERVER } php_stream_xport_crypt_method_t; BEGIN_EXTERN_C() diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 949b827679ecd..4dbf6889d7c11 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -1436,7 +1436,7 @@ PHPAPI php_stream *_php_stream_fopen_with_path(const char *filename, const char php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s/%s path was truncated to %d", cwd, filename, MAXPATHLEN); } - free(cwd); + efree(cwd); if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(trypath TSRMLS_CC)) { return NULL; diff --git a/php.ini-development b/php.ini-development index 99532d20d9430..2a01555b7f6a7 100644 --- a/php.ini-development +++ b/php.ini-development @@ -199,13 +199,12 @@ engine = On ; This directive determines whether or not PHP will recognize code between -; tags as PHP source which should be processed as such. For several -; years we recommended that you not use the short tag shortcut and -; instead to use the full tag combination. With the widespread use -; of XML and use of these tags by other languages, the server can become easily -; confused and end up parsing the wrong code in the wrong context. -; This shortcut is still supported for backwards compatibility, but we -; recommend against its use. +; tags as PHP source which should be processed as such. It is +; generally recommended that should be used and that this feature +; should be disabled, as enabling it may result in issues when generating XML +; documents, however this remains supported for backward compatibility reasons. +; Note that this directive does not control the tags as PHP source which should be processed as such. For several -; years we recommended that you not use the short tag shortcut and -; instead to use the full tag combination. With the widespread use -; of XML and use of these tags by other languages, the server can become easily -; confused and end up parsing the wrong code in the wrong context. -; This shortcut is still supported for backwards compatibility, but we -; recommend against its use. -; Default Value: On +; tags as PHP source which should be processed as such. It is +; generally recommended that should be used and that this feature +; should be disabled, as enabling it may result in issues when generating XML +; documents, however this remains supported for backward compatibility reasons. +; Note that this directive does not control the "); + return 'SKIPPED'; + } if (@count($section_text['REDIRECTTEST']) == 1) { $test_files = array(); diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 221b0021756dc..3ffdc1eaf06d8 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -524,8 +524,11 @@ static int sapi_fcgi_read_post(char *buffer, uint count_bytes TSRMLS_DC) uint read_bytes = 0; int tmp_read_bytes; fcgi_request *request = (fcgi_request*) SG(server_context); + size_t remaining = SG(request_info).content_length - SG(read_post_bytes); - count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - SG(read_post_bytes)); + if (remaining < count_bytes) { + count_bytes = remaining; + } while (read_bytes < count_bytes) { tmp_read_bytes = fcgi_read(request, buffer + read_bytes, count_bytes - read_bytes); if (tmp_read_bytes <= 0) { @@ -815,7 +818,7 @@ static void php_cgi_ini_activate_user_config(char *path, int path_len, const cha } if (real_path) { - free(real_path); + efree(real_path); } entry->expires = request_time + PG(user_ini_cache_ttl); } @@ -1396,7 +1399,7 @@ static void init_request_info(fcgi_request *request TSRMLS_DC) } else { SG(request_info).request_uri = env_script_name; } - free(real_path); + efree(real_path); } } else { /* pre 4.3 behaviour, shouldn't be used but provides BC */ diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index cbe9c7bd66180..ab4ac4341b723 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -268,6 +268,7 @@ static php_cli_server_ext_mime_type_pair mime_type_map[] = { { "jpg", "image/jpeg" }, { "jpeg", "image/jpeg" }, { "jpe", "image/jpeg" }, + { "pdf", "application/pdf" }, { "png", "image/png" }, { "svg", "image/svg+xml" }, { "txt", "text/plain" }, @@ -412,7 +413,7 @@ static void append_essential_headers(smart_str* buffer, php_cli_server_client *c { { char **val; - if (SUCCESS == zend_hash_find(&client->request.headers, "Host", sizeof("Host"), (void**)&val)) { + if (SUCCESS == zend_hash_find(&client->request.headers, "host", sizeof("host"), (void**)&val)) { smart_str_appendl_ex(buffer, "Host", sizeof("Host") - 1, persistent); smart_str_appendl_ex(buffer, ": ", sizeof(": ") - 1, persistent); smart_str_appends_ex(buffer, *val, persistent); @@ -568,7 +569,7 @@ static char *sapi_cli_server_read_cookies(TSRMLS_D) /* {{{ */ { php_cli_server_client *client = SG(server_context); char **val; - if (FAILURE == zend_hash_find(&client->request.headers, "Cookie", sizeof("Cookie"), (void**)&val)) { + if (FAILURE == zend_hash_find(&client->request.headers, "cookie", sizeof("cookie"), (void**)&val)) { return NULL; } return *val; @@ -1566,12 +1567,9 @@ static int php_cli_server_client_read_request_on_header_value(php_http_parser *p return 1; } { - char *header_name = client->current_header_name; - size_t header_name_len = client->current_header_name_len; - char c = header_name[header_name_len]; - header_name[header_name_len] = '\0'; - zend_hash_add(&client->request.headers, header_name, header_name_len + 1, &value, sizeof(char *), NULL); - header_name[header_name_len] = c; + char *header_name = zend_str_tolower_dup(client->current_header_name, client->current_header_name_len); + zend_hash_add(&client->request.headers, header_name, client->current_header_name_len + 1, &value, sizeof(char *), NULL); + efree(header_name); } if (client->current_header_name_allocated) { @@ -1602,6 +1600,7 @@ static int php_cli_server_client_read_request_on_body(php_http_parser *parser, c } client->request.content_len = 0; } + client->request.content = perealloc(client->request.content, client->request.content_len + length, 1); memmove(client->request.content + client->request.content_len, at, length); client->request.content_len += length; return 0; @@ -1726,10 +1725,9 @@ static void php_cli_server_client_populate_request_info(const php_cli_server_cli request_info->request_uri = client->request.request_uri; request_info->path_translated = client->request.path_translated; request_info->query_string = client->request.query_string; - request_info->post_data = client->request.content; - request_info->content_length = request_info->post_data_length = client->request.content_len; + request_info->content_length = client->request.content_len; request_info->auth_user = request_info->auth_password = request_info->auth_digest = NULL; - if (SUCCESS == zend_hash_find(&client->request.headers, "Content-Type", sizeof("Content-Type"), (void**)&val)) { + if (SUCCESS == zend_hash_find(&client->request.headers, "content-type", sizeof("content-type"), (void**)&val)) { request_info->content_type = *val; } } /* }}} */ @@ -1967,7 +1965,7 @@ static int php_cli_server_begin_send_static(php_cli_server *server, php_cli_serv static int php_cli_server_request_startup(php_cli_server *server, php_cli_server_client *client TSRMLS_DC) { /* {{{ */ char **auth; php_cli_server_client_populate_request_info(client, &SG(request_info)); - if (SUCCESS == zend_hash_find(&client->request.headers, "Authorization", sizeof("Authorization"), (void**)&auth)) { + if (SUCCESS == zend_hash_find(&client->request.headers, "authorization", sizeof("authorization"), (void**)&auth)) { php_handle_auth_data(*auth TSRMLS_CC); } SG(sapi_headers).http_response_code = 200; diff --git a/sapi/cli/tests/bug65633.phpt b/sapi/cli/tests/bug65633.phpt new file mode 100644 index 0000000000000..55834095b1877 --- /dev/null +++ b/sapi/cli/tests/bug65633.phpt @@ -0,0 +1,48 @@ +--TEST-- +Bug #65633 (built-in server treat some http headers as case-sensitive) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +HTTP/1.1 200 OK +Connection: close +X-Powered-By: %s +Content-type: text/html + +array(1) { + ["foo"]=> + string(3) "bar" +} +string(3) "bar" diff --git a/sapi/cli/tests/cli_process_title_windows.phpt b/sapi/cli/tests/cli_process_title_windows.phpt index 309c09c0e192e..472f9c10fed42 100644 --- a/sapi/cli/tests/cli_process_title_windows.phpt +++ b/sapi/cli/tests/cli_process_title_windows.phpt @@ -20,7 +20,7 @@ if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') // no warnings/errors. $is_windows8 = false; -$ps_output = shell_exec("PowerShell \"(Get-Host).UI.RawUI.WindowTitle\""); +$ps_output = shell_exec("PowerShell -NoProfile \"(Get-Host).UI.RawUI.WindowTitle\""); if ($ps_output === null) { echo "Get-Host failed\n"; @@ -28,7 +28,8 @@ if ($ps_output === null) } $ps_output = trim($ps_output); -if (($ps_output == "Windows PowerShell") || ($ps_output == "Administrator: Windows PowerShell")) +$end_title_windows8 = ": Windows PowerShell"; +if (($ps_output == "Windows PowerShell") || (strlen($ps_output) > strlen($end_title_windows8) && substr($ps_output,-strlen($end_title_windows8)) === $end_title_windows8)) $is_windows8 = true; echo "*** Testing setting the process title ***\n"; @@ -45,7 +46,7 @@ if ($is_windows8) } else { - $loaded_title = shell_exec("PowerShell \"get-process cmd*,powershell* | Select-Object mainWindowTitle | ft -hide\""); + $loaded_title = shell_exec("PowerShell -NoProfile \"get-process cmd*,powershell* | Select-Object mainWindowTitle | ft -hide\""); if ($loaded_title === null) { diff --git a/sapi/cli/tests/upload_2G.phpt b/sapi/cli/tests/upload_2G.phpt index fe13d90007036..b8416ea730972 100644 --- a/sapi/cli/tests/upload_2G.phpt +++ b/sapi/cli/tests/upload_2G.phpt @@ -89,7 +89,7 @@ array(1) { ["type"]=> string(10) "text/plain" ["tmp_name"]=> - string(14) "/tmp/php%s" + string(%d) "%s" ["error"]=> int(0) ["size"]=> diff --git a/sapi/fpm/fpm/fastcgi.c b/sapi/fpm/fpm/fastcgi.c index 99905c8b605a6..ec579eadf6ebf 100644 --- a/sapi/fpm/fpm/fastcgi.c +++ b/sapi/fpm/fpm/fastcgi.c @@ -426,8 +426,9 @@ static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *e char buf[128]; char *tmp = buf; size_t buf_size = sizeof(buf); - int name_len, val_len; - uint eff_name_len; + int name_len = 0; + int val_len = 0; + uint eff_name_len = 0; char *s; int ret = 1; size_t bytes_consumed; diff --git a/sapi/fpm/fpm/fpm_children.c b/sapi/fpm/fpm/fpm_children.c index 84a9474332215..45cc075b42a6c 100644 --- a/sapi/fpm/fpm/fpm_children.c +++ b/sapi/fpm/fpm/fpm_children.c @@ -251,7 +251,7 @@ void fpm_children_bury() /* {{{ */ } zlog(severity, "[pool %s] child %d exited %s after %ld.%06d seconds from start", child->wp->config->name, (int) pid, buf, tv2.tv_sec, (int) tv2.tv_usec); } else { - zlog(ZLOG_DEBUG, "[pool %s] child %d has been killed by the process managment after %ld.%06d seconds from start", child->wp->config->name, (int) pid, tv2.tv_sec, (int) tv2.tv_usec); + zlog(ZLOG_DEBUG, "[pool %s] child %d has been killed by the process management after %ld.%06d seconds from start", child->wp->config->name, (int) pid, tv2.tv_sec, (int) tv2.tv_usec); } fpm_child_close(child, 1 /* in event_loop */); diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 043e0e00a47c0..91abfea959f3a 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -498,8 +498,11 @@ static int sapi_cgi_read_post(char *buffer, uint count_bytes TSRMLS_DC) { uint read_bytes = 0; int tmp_read_bytes; + size_t remaining = SG(request_info).content_length - SG(read_post_bytes); - count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - SG(read_post_bytes)); + if (remaining < count_bytes) { + count_bytes = remaining; + } while (read_bytes < count_bytes) { fcgi_request *request = (fcgi_request*) SG(server_context); if (request_body_fd == -1) { @@ -1982,8 +1985,9 @@ consult the installation file that came with this distribution, or visit \n\ out: SG(server_context) = NULL; + php_module_shutdown(TSRMLS_C); + if (parent) { - php_module_shutdown(TSRMLS_C); sapi_shutdown(); } diff --git a/sapi/fpm/fpm/fpm_php_trace.c b/sapi/fpm/fpm/fpm_php_trace.c index d95d66a754c3e..925f2de64e93f 100644 --- a/sapi/fpm/fpm/fpm_php_trace.c +++ b/sapi/fpm/fpm/fpm_php_trace.c @@ -138,7 +138,7 @@ static int fpm_php_trace_dump(struct fpm_child_s *child, FILE *slowlog TSRMLS_DC void fpm_php_trace(struct fpm_child_s *child) /* {{{ */ { TSRMLS_FETCH(); - fpm_scoreboard_update(0, 0, 0, 0, 0, 0, 1, FPM_SCOREBOARD_ACTION_SET, child->wp->scoreboard); + fpm_scoreboard_update(0, 0, 0, 0, 0, 0, 1, FPM_SCOREBOARD_ACTION_INC, child->wp->scoreboard); FILE *slowlog; zlog(ZLOG_NOTICE, "about to trace %d", (int) child->pid); diff --git a/sapi/fpm/fpm/fpm_scoreboard.c b/sapi/fpm/fpm/fpm_scoreboard.c index 24463a90dddfd..8d0868182d763 100644 --- a/sapi/fpm/fpm/fpm_scoreboard.c +++ b/sapi/fpm/fpm/fpm_scoreboard.c @@ -111,7 +111,7 @@ void fpm_scoreboard_update(int idle, int active, int lq, int lq_len, int request scoreboard->max_children_reached = max_children_reached; } if (slow_rq > 0) { - scoreboard->slow_rq += slow_rq; + scoreboard->slow_rq = slow_rq; } } else { if (scoreboard->idle + idle > 0) { @@ -137,6 +137,12 @@ void fpm_scoreboard_update(int idle, int active, int lq, int lq_len, int request } else { scoreboard->max_children_reached = 0; } + + if (scoreboard->slow_rq + slow_rq > 0) { + scoreboard->slow_rq += slow_rq; + } else { + scoreboard->slow_rq = 0; + } } if (scoreboard->active > scoreboard->active_max) { diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c index 145b2550c3bad..e056565ea4119 100644 --- a/sapi/fpm/fpm/fpm_sockets.c +++ b/sapi/fpm/fpm/fpm_sockets.c @@ -487,6 +487,7 @@ int fpm_socket_unix_test_connect(struct sockaddr_un *sock, size_t socklen) /* {{ } if (connect(fd, (struct sockaddr *)sock, socklen) == -1) { + close(fd); return -1; } diff --git a/sapi/fpm/fpm/fpm_sockets.h b/sapi/fpm/fpm/fpm_sockets.h index cce5712b8cfbf..121c016a7b89b 100644 --- a/sapi/fpm/fpm/fpm_sockets.h +++ b/sapi/fpm/fpm/fpm_sockets.h @@ -19,7 +19,7 @@ #if (__FreeBSD__) || (__OpenBSD__) #define FPM_BACKLOG_DEFAULT -1 #else -#define FPM_BACKLOG_DEFAULT 128 +#define FPM_BACKLOG_DEFAULT 65535 #endif enum fpm_address_domain fpm_sockets_domain_from_address(char *addr); diff --git a/sapi/fpm/php-fpm.8.in b/sapi/fpm/php-fpm.8.in index a4e7e74e208d8..b02aa25ba74d4 100644 --- a/sapi/fpm/php-fpm.8.in +++ b/sapi/fpm/php-fpm.8.in @@ -96,7 +96,7 @@ Specify alternative path to FastCGI process manager configuration file (the defa .PD 1 .B \-t Test FPM configuration file and exit -If called twice (-tt), the configuration is dumped before exiting. +If called twice (\-tt), the configuration is dumped before exiting. .TP .PD 0 .B \-\-daemonize diff --git a/sapi/fpm/php-fpm.conf.in b/sapi/fpm/php-fpm.conf.in index af4f2fa325a3f..9002a2933bb26 100644 --- a/sapi/fpm/php-fpm.conf.in +++ b/sapi/fpm/php-fpm.conf.in @@ -159,8 +159,8 @@ group = @php_fpm_group@ listen = 127.0.0.1:9000 ; Set listen(2) backlog. -; Default Value: 128 (-1 on FreeBSD and OpenBSD) -;listen.backlog = 128 +; Default Value: 65535 (-1 on FreeBSD and OpenBSD) +;listen.backlog = 65535 ; Set permissions for unix socket, if one is used. In Linux, read/write ; permissions must be set in order to allow connections from a web server. Many diff --git a/sapi/litespeed/Makefile.frag b/sapi/litespeed/Makefile.frag index b70e5e8702933..767c2e5eb1719 100644 --- a/sapi/litespeed/Makefile.frag +++ b/sapi/litespeed/Makefile.frag @@ -4,6 +4,6 @@ $(SAPI_LITESPEED_PATH): $(PHP_GLOBAL_OBJS) $(PHP_BINARY_OBJS) $(PHP_LITESPEED_OB $(BUILD_LITESPEED) install-litespeed: $(SAPI_LITESPEED_PATH) - @echo "Installing PHP LitSpeed binary: $(INSTALL_ROOT)$(bindir)/" + @echo "Installing PHP LiteSpeed binary: $(INSTALL_ROOT)$(bindir)/" @$(INSTALL) -m 0755 $(SAPI_LITESPEED_PATH) $(INSTALL_ROOT)$(bindir)/lsphp diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c index 19364c66e06f2..33ebb988a66b1 100644 --- a/sapi/litespeed/lsapi_main.c +++ b/sapi/litespeed/lsapi_main.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2013 The PHP Group | + | Copyright (c) 1997-2007 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id$ */ +/* $Id: lsapi_main.c,v 1.57 2013/08/23 14:50:25 gwang Exp $ */ #include "php.h" #include "SAPI.h" @@ -75,7 +75,9 @@ static int lsapi_mode = 1; static char *php_self = ""; static char *script_filename = ""; static int source_highlight = 0; - +static int ignore_php_ini = 0; +static char * argv0 = NULL; +static int engine = 1; #ifdef ZTS zend_compiler_globals *compiler_globals; zend_executor_globals *executor_globals; @@ -90,40 +92,65 @@ zend_module_entry litespeed_module_entry; */ static int php_lsapi_startup(sapi_module_struct *sapi_module) { - if (php_module_startup(sapi_module, NULL, 0)==FAILURE) { - return FAILURE; - } - return SUCCESS; + if (php_module_startup(sapi_module, NULL, 0)==FAILURE) { + return FAILURE; + } + argv0 = sapi_module->executable_location; + return SUCCESS; } /* }}} */ +/* {{{ sapi_lsapi_ini_defaults */ + +/* overwriteable ini defaults must be set in sapi_cli_ini_defaults() */ +#define INI_DEFAULT(name,value)\ + ZVAL_STRING(tmp, value, 0);\ + zend_hash_update(configuration_hash, name, sizeof(name), tmp, sizeof(zval), (void**)&entry);\ + Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry)) + +static void sapi_lsapi_ini_defaults(HashTable *configuration_hash) +{ + zval *tmp, *entry; + +#if PHP_MAJOR_VERSION > 4 +/* + MAKE_STD_ZVAL(tmp); + + INI_DEFAULT("register_long_arrays", "0"); + + FREE_ZVAL(tmp); +*/ +#endif + +} +/* }}} */ /* {{{ sapi_lsapi_ub_write */ static int sapi_lsapi_ub_write(const char *str, uint str_length TSRMLS_DC) { - int ret; - int remain; - if ( lsapi_mode ) { - ret = LSAPI_Write( str, str_length ); - if ( ret < str_length ) { - php_handle_aborted_connection(); - return str_length - ret; - } - } else { - remain = str_length; - while( remain > 0 ) { - ret = write( 1, str, remain ); - if ( ret <= 0 ) { - php_handle_aborted_connection(); - return str_length - remain; - } - str += ret; - remain -= ret; - } - } - return str_length; + int ret; + int remain; + if ( lsapi_mode ) { + ret = LSAPI_Write( str, str_length ); + if ( ret < str_length ) { + php_handle_aborted_connection(); + return str_length - ret; + } + } else { + remain = str_length; + while( remain > 0 ) { + ret = write( 1, str, remain ); + if ( ret <= 0 ) { + php_handle_aborted_connection(); + return str_length - remain; + } + str += ret; + remain -= ret; + } + } + return str_length; } /* }}} */ @@ -132,11 +159,11 @@ static int sapi_lsapi_ub_write(const char *str, uint str_length TSRMLS_DC) */ static void sapi_lsapi_flush( void * server_context ) { - if ( lsapi_mode ) { - if ( LSAPI_Flush() == -1) { - php_handle_aborted_connection(); - } - } + if ( lsapi_mode ) { + if ( LSAPI_Flush() == -1) { + php_handle_aborted_connection(); + } + } } /* }}} */ @@ -145,8 +172,12 @@ static void sapi_lsapi_flush( void * server_context ) */ static int sapi_lsapi_deactivate(TSRMLS_D) { - LSAPI_Finish(); - return SUCCESS; + if ( SG(request_info).path_translated ) + { + efree( SG(request_info).path_translated ); + } + + return SUCCESS; } /* }}} */ @@ -157,46 +188,99 @@ static int sapi_lsapi_deactivate(TSRMLS_D) */ static char *sapi_lsapi_getenv( char * name, size_t name_len TSRMLS_DC ) { - if ( lsapi_mode ) { - return LSAPI_GetEnv( name ); - } else { - return getenv( name ); - } + if ( lsapi_mode ) { + return LSAPI_GetEnv( name ); + } else { + return getenv( name ); + } } /* }}} */ +/* +static int add_variable( const char * pKey, int keyLen, const char * pValue, int valLen, + void * arg ) +{ + php_register_variable_safe((char *)pKey, (char *)pValue, valLen, (zval *)arg TSRMLS_CC); + return 1; +} +*/ static int add_variable( const char * pKey, int keyLen, const char * pValue, int valLen, - void * arg ) + void * arg ) { - php_register_variable_safe((char *)pKey, (char *)pValue, valLen, (zval *)arg TSRMLS_CC); - return 1; + zval * gpc_element, **gpc_element_p; + HashTable * symtable1 = Z_ARRVAL_P((zval * )arg); + register char * pKey1 = (char *)pKey; + + MAKE_STD_ZVAL(gpc_element); + Z_STRLEN_P( gpc_element ) = valLen; + Z_STRVAL_P( gpc_element ) = estrndup(pValue, valLen); + Z_TYPE_P( gpc_element ) = IS_STRING; +#if PHP_MAJOR_VERSION > 4 + zend_symtable_update( symtable1, pKey1, keyLen + 1, &gpc_element, sizeof( zval *), (void **) &gpc_element_p ); +#else + zend_hash_update( symtable1, pKey1, keyLen + 1, &gpc_element, sizeof( zval *), (void **) &gpc_element_p ); +#endif + return 1; } +#if ((PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || PHP_MAJOR_VERSION < 5) +static int add_variable_magic_quote( const char * pKey, int keyLen, const char * pValue, int valLen, + void * arg ) +{ + zval * gpc_element, **gpc_element_p; + HashTable * symtable1 = Z_ARRVAL_P((zval * )arg); + register char * pKey1 = (char *)pKey; + + MAKE_STD_ZVAL(gpc_element); + Z_STRLEN_P( gpc_element ) = valLen; + Z_STRVAL_P( gpc_element ) = php_addslashes((char *)pValue, valLen, &Z_STRLEN_P( gpc_element ), 0 ); + Z_TYPE_P( gpc_element ) = IS_STRING; +#if PHP_MAJOR_VERSION > 4 + zend_symtable_update( symtable1, pKey1, keyLen + 1, &gpc_element, sizeof( zval *), (void **) &gpc_element_p ); +#else + zend_hash_update( symtable1, pKey1, keyLen + 1, &gpc_element, sizeof( zval *), (void **) &gpc_element_p ); +#endif + return 1; +} + +#endif /* {{{ sapi_lsapi_register_variables */ static void sapi_lsapi_register_variables(zval *track_vars_array TSRMLS_DC) { + char * php_self = ""; + if ( lsapi_mode ) { + if ( (SG(request_info).request_uri ) ) + php_self = (SG(request_info).request_uri ); - if ( lsapi_mode ) { - LSAPI_ForeachHeader( add_variable, track_vars_array ); - LSAPI_ForeachEnv( add_variable, track_vars_array ); - php_import_environment_variables(track_vars_array TSRMLS_CC); - - php_register_variable("PHP_SELF", (SG(request_info).request_uri ? SG(request_info).request_uri:""), track_vars_array TSRMLS_CC); - } else { - php_import_environment_variables(track_vars_array TSRMLS_CC); +#if ((PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || PHP_MAJOR_VERSION < 5) + if (!PG(magic_quotes_gpc)) { +#endif + LSAPI_ForeachHeader( add_variable, track_vars_array ); + LSAPI_ForeachEnv( add_variable, track_vars_array ); + add_variable("PHP_SELF", 8, php_self, strlen( php_self ), track_vars_array ); +#if ((PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || PHP_MAJOR_VERSION < 5) + } else { + LSAPI_ForeachHeader( add_variable_magic_quote, track_vars_array ); + LSAPI_ForeachEnv( add_variable_magic_quote, track_vars_array ); + add_variable_magic_quote("PHP_SELF", 8, php_self, strlen( php_self ), track_vars_array ); + } +#endif + php_import_environment_variables(track_vars_array TSRMLS_CC); + } else { + php_import_environment_variables(track_vars_array TSRMLS_CC); - php_register_variable("PHP_SELF", php_self, track_vars_array TSRMLS_CC); - php_register_variable("SCRIPT_NAME", php_self, track_vars_array TSRMLS_CC); - php_register_variable("SCRIPT_FILENAME", script_filename, track_vars_array TSRMLS_CC); - php_register_variable("PATH_TRANSLATED", script_filename, track_vars_array TSRMLS_CC); - php_register_variable("DOCUMENT_ROOT", "", track_vars_array TSRMLS_CC); + php_register_variable("PHP_SELF", php_self, track_vars_array TSRMLS_CC); + php_register_variable("SCRIPT_NAME", php_self, track_vars_array TSRMLS_CC); + php_register_variable("SCRIPT_FILENAME", script_filename, track_vars_array TSRMLS_CC); + php_register_variable("PATH_TRANSLATED", script_filename, track_vars_array TSRMLS_CC); + php_register_variable("DOCUMENT_ROOT", "", track_vars_array TSRMLS_CC); - } + } } /* }}} */ @@ -205,11 +289,11 @@ static void sapi_lsapi_register_variables(zval *track_vars_array TSRMLS_DC) */ static int sapi_lsapi_read_post(char *buffer, uint count_bytes TSRMLS_DC) { - if ( lsapi_mode ) { - return LSAPI_ReadReqBody( buffer, count_bytes ); - } else { - return 0; - } + if ( lsapi_mode ) { + return LSAPI_ReadReqBody( buffer, (unsigned long long)count_bytes ); + } else { + return 0; + } } /* }}} */ @@ -220,11 +304,11 @@ static int sapi_lsapi_read_post(char *buffer, uint count_bytes TSRMLS_DC) */ static char *sapi_lsapi_read_cookies(TSRMLS_D) { - if ( lsapi_mode ) { - return LSAPI_GetHeader( H_COOKIE ); - } else { - return NULL; - } + if ( lsapi_mode ) { + return LSAPI_GetHeader( H_COOKIE ); + } else { + return NULL; + } } /* }}} */ @@ -233,33 +317,33 @@ static char *sapi_lsapi_read_cookies(TSRMLS_D) */ static int sapi_lsapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) { - sapi_header_struct *h; - zend_llist_position pos; - if ( lsapi_mode ) { - LSAPI_SetRespStatus( SG(sapi_headers).http_response_code ); - - h = zend_llist_get_first_ex(&sapi_headers->headers, &pos); - while (h) { - if ( h->header_len > 0 ) { - LSAPI_AppendRespHeader(h->header, h->header_len); - } - h = zend_llist_get_next_ex(&sapi_headers->headers, &pos); - } - if (SG(sapi_headers).send_default_content_type) { - char *hd; - int len; - char headerBuf[SAPI_LSAPI_MAX_HEADER_LENGTH]; - - hd = sapi_get_default_content_type(TSRMLS_C); - len = snprintf( headerBuf, SAPI_LSAPI_MAX_HEADER_LENGTH - 1, - "Content-type: %s", hd ); - efree(hd); - - LSAPI_AppendRespHeader( headerBuf, len ); - } - } - LSAPI_FinalizeRespHeaders(); - return SAPI_HEADER_SENT_SUCCESSFULLY; + sapi_header_struct *h; + zend_llist_position pos; + if ( lsapi_mode ) { + LSAPI_SetRespStatus( SG(sapi_headers).http_response_code ); + + h = zend_llist_get_first_ex(&sapi_headers->headers, &pos); + while (h) { + if ( h->header_len > 0 ) { + LSAPI_AppendRespHeader(h->header, h->header_len); + } + h = zend_llist_get_next_ex(&sapi_headers->headers, &pos); + } + if (SG(sapi_headers).send_default_content_type) { + char *hd; + int len; + char headerBuf[SAPI_LSAPI_MAX_HEADER_LENGTH]; + + hd = sapi_get_default_content_type(TSRMLS_C); + len = snprintf( headerBuf, SAPI_LSAPI_MAX_HEADER_LENGTH - 1, + "Content-type: %s", hd ); + efree(hd); + + LSAPI_AppendRespHeader( headerBuf, len ); + } + } + LSAPI_FinalizeRespHeaders(); + return SAPI_HEADER_SENT_SUCCESSFULLY; } @@ -270,8 +354,15 @@ static int sapi_lsapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) */ static void sapi_lsapi_log_message(char *message TSRMLS_DC) { - int len = strlen( message ); - LSAPI_Write_Stderr( message, len); + char buf[8192]; + int len = strlen( message ); + if ( *(message + len - 1 ) != '\n' ) + { + snprintf( buf, 8191, "%s\n", message ); + message = buf; + ++len; + } + LSAPI_Write_Stderr( message, len); } /* }}} */ @@ -280,158 +371,251 @@ static void sapi_lsapi_log_message(char *message TSRMLS_DC) */ static sapi_module_struct lsapi_sapi_module = { - "litespeed", - "LiteSpeed", + "litespeed", + "LiteSpeed V6.4", - php_lsapi_startup, /* startup */ - php_module_shutdown_wrapper, /* shutdown */ + php_lsapi_startup, /* startup */ + php_module_shutdown_wrapper, /* shutdown */ - NULL, /* activate */ - sapi_lsapi_deactivate, /* deactivate */ + NULL, /* activate */ + sapi_lsapi_deactivate, /* deactivate */ - sapi_lsapi_ub_write, /* unbuffered write */ - sapi_lsapi_flush, /* flush */ - NULL, /* get uid */ - sapi_lsapi_getenv, /* getenv */ + sapi_lsapi_ub_write, /* unbuffered write */ + sapi_lsapi_flush, /* flush */ + NULL, /* get uid */ + sapi_lsapi_getenv, /* getenv */ - php_error, /* error handler */ + php_error, /* error handler */ - NULL, /* header handler */ - sapi_lsapi_send_headers, /* send headers handler */ - NULL, /* send header handler */ + NULL, /* header handler */ + sapi_lsapi_send_headers, /* send headers handler */ + NULL, /* send header handler */ - sapi_lsapi_read_post, /* read POST data */ - sapi_lsapi_read_cookies, /* read Cookies */ + sapi_lsapi_read_post, /* read POST data */ + sapi_lsapi_read_cookies, /* read Cookies */ - sapi_lsapi_register_variables, /* register server variables */ - sapi_lsapi_log_message, /* Log message */ + sapi_lsapi_register_variables, /* register server variables */ + sapi_lsapi_log_message, /* Log message */ - NULL, /* php.ini path override */ - NULL, /* block interruptions */ - NULL, /* unblock interruptions */ - NULL, /* default post reader */ - NULL, /* treat data */ - NULL, /* executable location */ + NULL, /* php.ini path override */ + NULL, /* block interruptions */ + NULL, /* unblock interruptions */ + NULL, /* default post reader */ + NULL, /* treat data */ + NULL, /* executable location */ - 0, /* php.ini ignore */ + 0, /* php.ini ignore */ - STANDARD_SAPI_MODULE_PROPERTIES + STANDARD_SAPI_MODULE_PROPERTIES }; /* }}} */ static int init_request_info( TSRMLS_D ) { - char * pContentType = LSAPI_GetHeader( H_CONTENT_TYPE ); - char * pAuth; - - SG(request_info).content_type = pContentType ? pContentType : ""; - SG(request_info).request_method = LSAPI_GetRequestMethod(); - SG(request_info).query_string = LSAPI_GetQueryString(); - SG(request_info).request_uri = LSAPI_GetScriptName(); - SG(request_info).content_length = LSAPI_GetReqBodyLen(); - SG(request_info).path_translated = LSAPI_GetScriptFileName(); + char * pContentType = LSAPI_GetHeader( H_CONTENT_TYPE ); + char * pAuth; + + SG(request_info).content_type = pContentType ? pContentType : ""; + SG(request_info).request_method = LSAPI_GetRequestMethod(); + SG(request_info).query_string = LSAPI_GetQueryString(); + SG(request_info).request_uri = LSAPI_GetScriptName(); + SG(request_info).content_length = LSAPI_GetReqBodyLen(); + SG(request_info).path_translated = estrdup( LSAPI_GetScriptFileName()); + + /* It is not reset by zend engine, set it to 0. */ + SG(sapi_headers).http_response_code = 0; + + pAuth = LSAPI_GetHeader( H_AUTHORIZATION ); + php_handle_auth_data(pAuth TSRMLS_CC); +} - /* It is not reset by zend engine, set it to 0. */ - SG(sapi_headers).http_response_code = 0; - - pAuth = LSAPI_GetHeader( H_AUTHORIZATION ); - php_handle_auth_data(pAuth TSRMLS_CC); +static char s_cur_chdir[4096] = ""; + +static int lsapi_chdir_primary_script( zend_file_handle * file_handle ) +{ +#if PHP_MAJOR_VERSION > 4 + char * p; + char ch; + + SG(options) |= SAPI_OPTION_NO_CHDIR; + getcwd( s_cur_chdir, sizeof( s_cur_chdir ) ); + + p = strrchr( file_handle->filename, '/' ); + if ( *p ) + { + *p = 0; + if ( strcmp( file_handle->filename, s_cur_chdir ) != 0 ) { + chdir( file_handle->filename ); + } + *p++ = '/'; + ch = *p; + *p = 0; + if ( !CWDG(cwd).cwd || + ( strcmp( file_handle->filename, CWDG(cwd).cwd ) != 0 ) ) { + CWDG(cwd).cwd_length = p - file_handle->filename; + CWDG(cwd).cwd = (char *) realloc(CWDG(cwd).cwd, CWDG(cwd).cwd_length+1); + memmove( CWDG(cwd).cwd, file_handle->filename, CWDG(cwd).cwd_length+1 ); + } + *p = ch; + } + /* virtual_file_ex(&CWDG(cwd), file_handle->filename, NULL, CWD_REALPATH); */ +#else + VCWD_CHDIR_FILE( file_handle->filename ); +#endif + return 0; } -static int lsapi_module_main(int show_source TSRMLS_DC) +static int lsapi_fopen_primary_script( zend_file_handle * file_handle ) +{ + FILE * fp; + char * p; + fp = fopen( SG(request_info).path_translated, "rb" ); + if ( !fp ) + { + return -1; + } + file_handle->type = ZEND_HANDLE_FP; + file_handle->handle.fp = fp; + file_handle->filename = SG(request_info).path_translated; + file_handle->free_filename = 0; + file_handle->opened_path = NULL; + + lsapi_chdir_primary_script( file_handle ); + + return 0; +} + +static int lsapi_execute_script( zend_file_handle * file_handle TSRMLS_DC) { - zend_file_handle file_handle = {0}; + char *p; + int len; + file_handle->type = ZEND_HANDLE_FILENAME; + file_handle->handle.fd = 0; + file_handle->filename = SG(request_info).path_translated; + file_handle->free_filename = 0; + file_handle->opened_path = NULL; + + p = argv0; + *p++ = ':'; + len = strlen( SG(request_info).path_translated ); + if ( len > 45 ) + len = len - 45; + else + len = 0; + memccpy( p, SG(request_info).path_translated + len, 0, 46 ); + + php_execute_script(file_handle TSRMLS_CC); + return 0; - if (php_request_startup(TSRMLS_C) == FAILURE ) { - return -1; - } - if (show_source) { - zend_syntax_highlighter_ini syntax_highlighter_ini; +} - php_get_highlight_struct(&syntax_highlighter_ini); - highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC); - } else { - file_handle.type = ZEND_HANDLE_FILENAME; - file_handle.handle.fd = 0; - file_handle.filename = SG(request_info).path_translated; - file_handle.free_filename = 0; - file_handle.opened_path = NULL; - php_execute_script(&file_handle TSRMLS_CC); - } - zend_try { - php_request_shutdown(NULL); - } zend_end_try(); - return 0; +static int lsapi_module_main(int show_source TSRMLS_DC) +{ + zend_file_handle file_handle = {0}; + + if (php_request_startup(TSRMLS_C) == FAILURE ) { + return -1; + } + if (show_source) { + zend_syntax_highlighter_ini syntax_highlighter_ini; + + php_get_highlight_struct(&syntax_highlighter_ini); + highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC); + } else { + lsapi_execute_script( &file_handle TSRMLS_CC); + } + zend_try { + php_request_shutdown(NULL); + memset( argv0, 0, 46 ); + } zend_end_try(); + return 0; } static int alter_ini( const char * pKey, int keyLen, const char * pValue, int valLen, - void * arg ) + void * arg ) { - int type = ZEND_INI_PERDIR; - if ( '\001' == *pKey ) { - ++pKey; - if ( *pKey == 4 ) { - type = ZEND_INI_SYSTEM; - } - ++pKey; - --keyLen; - zend_alter_ini_entry((char *)pKey, keyLen, - (char *)pValue, valLen, - type, PHP_INI_STAGE_ACTIVATE); - } - return 1; + int type = ZEND_INI_PERDIR; + if ( '\001' == *pKey ) { + ++pKey; + if ( *pKey == 4 ) { + type = ZEND_INI_SYSTEM; + } + ++pKey; + --keyLen; + if (( keyLen == 7 )&&( strncasecmp( pKey, "engine", 6 )== 0 )) + { + if ( *pValue == '0' ) + engine = 0; + } + else + zend_alter_ini_entry((char *)pKey, keyLen, + (char *)pValue, valLen, + type, PHP_INI_STAGE_ACTIVATE); + } + return 1; } static void override_ini() { - LSAPI_ForeachSpecialEnv( alter_ini, NULL ); + LSAPI_ForeachSpecialEnv( alter_ini, NULL ); } + static int processReq( TSRMLS_D ) { - int ret = 0; - zend_first_try { - /* avoid server_context==NULL checks */ - SG(server_context) = (void *) 1; - - init_request_info( TSRMLS_C ); - - override_ini(); - - if ( lsapi_module_main( source_highlight TSRMLS_CC ) == -1 ) { - ret = -1; - } - } zend_end_try(); - return ret; + int ret = 0; + zend_first_try { + + /* avoid server_context==NULL checks */ + SG(server_context) = (void *) 1; + + engine = 1; + override_ini(); + + if ( engine ) { + init_request_info( TSRMLS_C ); + + if ( lsapi_module_main( source_highlight TSRMLS_CC ) == -1 ) { + ret = -1; + } + } else { + LSAPI_AppendRespHeader( "status: 403", 11 ); + LSAPI_AppendRespHeader( "content-type: text/html", 23 ); + LSAPI_Write( "Forbidden: PHP engine is disable.\n", 34 ); + } + } zend_end_try(); + return ret; } static void cli_usage( TSRMLS_D ) { - static const char * usage = - "Usage: php\n" - " php -[b|c|h|i|q|s|v|?] [] [args...]\n" - " Run in LSAPI mode, only '-b', '-s' and '-c' are effective\n" - " Run in Command Line Interpreter mode when parameters are specified\n" - "\n" - " -b | Bind Path for external LSAPI Server mode\n" - " -c | Look for php.ini file in this directory\n" - " -h This help\n" - " -i PHP information\n" - " -q Quiet-mode. Suppress HTTP Header output.\n" - " -s Display colour syntax highlighted source.\n" - " -v Version number\n" - " -? This help\n" - "\n" - " args... Arguments passed to script.\n"; - php_output_startup(); - php_output_activate(TSRMLS_C); - php_printf( "%s", usage ); + static const char * usage = + "Usage: php\n" + " php -[b|c|n|h|i|q|s|v|?] [] [args...]\n" + " Run in LSAPI mode, only '-b', '-s' and '-c' are effective\n" + " Run in Command Line Interpreter mode when parameters are specified\n" + "\n" + " -b | Bind Path for external LSAPI Server mode\n" + " -c | Look for php.ini file in this directory\n" + " -n No php.ini file will be used\n" + " -h This help\n" + " -i PHP information\n" + " -l Syntax check\n" + " -q Quiet-mode. Suppress HTTP Header output.\n" + " -s Display colour syntax highlighted source.\n" + " -v Version number\n" + " -? This help\n" + "\n" + " args... Arguments passed to script.\n"; + php_output_startup(); + php_output_activate(TSRMLS_C); + php_printf( usage ); #ifdef PHP_OUTPUT_NEWAPI php_output_end_all(TSRMLS_C); #else @@ -440,349 +624,419 @@ static void cli_usage( TSRMLS_D ) } static int parse_opt( int argc, char * argv[], int *climode, - char **php_ini_path, char ** php_bind ) -{ - char ** p = &argv[1]; - char ** argend= &argv[argc]; - int c; - while (( p < argend )&&(**p == '-' )) { - c = *((*p)+1); - ++p; - switch( c ) { - case 'b': - if ( p >= argend ) { - fprintf( stderr, "TCP or socket address must be specified following '-b' option.\n"); - return -1; - } - *php_bind = *p++; - break; - - case 'c': - if ( p >= argend ) { - fprintf( stderr, " or must be specified following '-c' option.\n"); - - return -1; - } - *php_ini_path = *p++; - break; - case 's': - source_highlight = 1; - break; - case 'h': - case 'i': - case 'q': - case 'v': - case '?': - default: - *climode = 1; - break; - } - } - if ( p - argv < argc ) { - *climode = 1; - } - return 0; + char **php_ini_path, char ** php_bind ) +{ + char ** p = &argv[1]; + char ** argend= &argv[argc]; + int c; + while (( p < argend )&&(**p == '-' )) { + c = *((*p)+1); + ++p; + switch( c ) { + case 'b': + if ( p >= argend ) { + fprintf( stderr, "TCP or socket address must be specified following '-b' option.\n"); + return -1; + } + *php_bind = strdup(*p++); + break; + + case 'c': + if ( p >= argend ) { + fprintf( stderr, " or must be specified following '-c' option.\n"); + + return -1; + } + *php_ini_path = strdup( *p++ ); + break; + case 's': + source_highlight = 1; + break; + case 'n': + ignore_php_ini = 1; + break; + case '?': + if ( *((*(p-1))+2) == 's' ) + exit( 99 ); + case 'h': + case 'i': + case 'l': + case 'q': + case 'v': + default: + *climode = 1; + break; + } + } + if ( p - argv < argc ) { + *climode = 1; + } + return 0; } static int cli_main( int argc, char * argv[] ) { - static const char * ini_defaults[] = { - "report_zend_debug", "0", - "display_errors", "1", - "register_argc_argv", "1", - "html_errors", "0", - "implicit_flush", "1", - "output_buffering", "0", - "max_execution_time", "0", - "max_input_time", "-1", - NULL - }; - - const char ** ini; - char ** p = &argv[1]; - char ** argend= &argv[argc]; - int ret = 0; - int c; - lsapi_mode = 0; /* enter CLI mode */ + static const char * ini_defaults[] = { + "report_zend_debug", "0", + "display_errors", "1", + "register_argc_argv", "1", + "html_errors", "0", + "implicit_flush", "1", + "output_buffering", "0", + "max_execution_time", "0", + "max_input_time", "-1", + NULL + }; + + const char ** ini; + char ** p = &argv[1]; + char ** argend= &argv[argc]; + int ret = -1; + int c; + lsapi_mode = 0; /* enter CLI mode */ #ifdef PHP_WIN32 - _fmode = _O_BINARY; /*sets default for file streams to binary */ - setmode(_fileno(stdin), O_BINARY); /* make the stdio mode be binary */ - setmode(_fileno(stdout), O_BINARY); /* make the stdio mode be binary */ - setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */ + _fmode = _O_BINARY; /*sets default for file streams to binary */ + setmode(_fileno(stdin), O_BINARY); /* make the stdio mode be binary */ + setmode(_fileno(stdout), O_BINARY); /* make the stdio mode be binary */ + setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */ #endif - zend_first_try { - SG(server_context) = (void *) 1; - - zend_uv.html_errors = 0; /* tell the engine we're in non-html mode */ - CG(in_compilation) = 0; /* not initialized but needed for several options */ - EG(uninitialized_zval_ptr) = NULL; - - for( ini = ini_defaults; *ini; ini+=2 ) { - zend_alter_ini_entry( (char *)*ini, strlen( *ini )+1, - (char *)*(ini+1), strlen( *(ini+1) ), - PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); - } - - while (( p < argend )&&(**p == '-' )) { - c = *((*p)+1); - ++p; - switch( c ) { - case 'q': - break; - case 'i': - if (php_request_startup(TSRMLS_C) != FAILURE) { - php_print_info(0xFFFFFFFF TSRMLS_CC); + zend_first_try { + SG(server_context) = (void *) 1; + + zend_uv.html_errors = 0; /* tell the engine we're in non-html mode */ + CG(in_compilation) = 0; /* not initialized but needed for several options */ + EG(uninitialized_zval_ptr) = NULL; + + for( ini = ini_defaults; *ini; ini+=2 ) { + zend_alter_ini_entry( (char *)*ini, strlen( *ini )+1, + (char *)*(ini+1), strlen( *(ini+1) ), + PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); + } + + while (( p < argend )&&(**p == '-' )) { + c = *((*p)+1); + ++p; + switch( c ) { + case 'q': + break; + case 'i': + if (php_request_startup(TSRMLS_C) != FAILURE) { + php_print_info(0xFFFFFFFF TSRMLS_CC); #ifdef PHP_OUTPUT_NEWAPI php_output_end_all(TSRMLS_C); #else php_end_ob_buffers(1 TSRMLS_CC); #endif - php_request_shutdown( NULL ); - } - ret = 1; - break; - case 'v': - if (php_request_startup(TSRMLS_C) != FAILURE) { + php_request_shutdown( NULL ); + ret = 0; + } + break; + case 'v': + if (php_request_startup(TSRMLS_C) != FAILURE) { #if ZEND_DEBUG - php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2013 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); + php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2004 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); #else - php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2013 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); + php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2004 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); #endif #ifdef PHP_OUTPUT_NEWAPI php_output_end_all(TSRMLS_C); #else php_end_ob_buffers(1 TSRMLS_CC); #endif - php_request_shutdown( NULL ); - } - ret = 1; - break; - case 'c': - ++p; - /* fall through */ - case 's': - break; - - case 'h': - case '?': - default: - cli_usage(TSRMLS_C); - ret = 1; - break; - - } - } - if ( !ret ) { - if ( *p ) { - zend_file_handle file_handle = {0}; - - file_handle.type = ZEND_HANDLE_FP; - file_handle.handle.fp = VCWD_FOPEN(*p, "rb"); - - if ( file_handle.handle.fp ) { - script_filename = *p; - php_self = *p; - - SG(request_info).path_translated = *p; - SG(request_info).argc = argc - (p - argv); - SG(request_info).argv = p; - - if (php_request_startup(TSRMLS_C) == FAILURE ) { - fclose( file_handle.handle.fp ); - ret = 2; - } else { - if (source_highlight) { - zend_syntax_highlighter_ini syntax_highlighter_ini; - - php_get_highlight_struct(&syntax_highlighter_ini); - highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC); - } else { - file_handle.filename = *p; - file_handle.free_filename = 0; - file_handle.opened_path = NULL; - - php_execute_script(&file_handle TSRMLS_CC); - } - - php_request_shutdown( NULL ); - } - } else { - php_printf("Could not open input file: %s.\n", *p); - } - } else { - cli_usage(TSRMLS_C); - } - } - - }zend_end_try(); - - php_module_shutdown(TSRMLS_C); + php_request_shutdown( NULL ); + ret = 0; + } + break; + case 'c': + ++p; + /* fall through */ + case 's': + break; + case 'l': + source_highlight = 2; + break; + case 'h': + case '?': + default: + cli_usage(TSRMLS_C); + ret = 0; + break; + + } + } + if ( ret == -1 ) { + if ( *p ) { + zend_file_handle file_handle = {0}; + + file_handle.type = ZEND_HANDLE_FP; + file_handle.handle.fp = VCWD_FOPEN(*p, "rb"); + + if ( file_handle.handle.fp ) { + script_filename = *p; + php_self = *p; + + SG(request_info).path_translated = estrdup(*p); + SG(request_info).argc = argc - (p - argv); + SG(request_info).argv = p; + + if (php_request_startup(TSRMLS_C) == FAILURE ) { + fclose( file_handle.handle.fp ); + ret = 2; + } else { + if (source_highlight == 1) { + zend_syntax_highlighter_ini syntax_highlighter_ini; + + php_get_highlight_struct(&syntax_highlighter_ini); + highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC); + } else if (source_highlight == 2) { + file_handle.filename = *p; + file_handle.free_filename = 0; + file_handle.opened_path = NULL; + ret = php_lint_script(&file_handle TSRMLS_CC); + if (ret==SUCCESS) { + zend_printf("No syntax errors detected in %s\n", file_handle.filename); + } else { + zend_printf("Errors parsing %s\n", file_handle.filename); + } + + } else { + file_handle.filename = *p; + file_handle.free_filename = 0; + file_handle.opened_path = NULL; + + php_execute_script(&file_handle TSRMLS_CC); + ret = EG(exit_status); + } + + php_request_shutdown( NULL ); + } + } else { + php_printf("Could not open input file: %s.\n", *p); + } + } else { + cli_usage(TSRMLS_C); + } + } + + }zend_end_try(); + + php_module_shutdown(TSRMLS_C); #ifdef ZTS - tsrm_shutdown(); + tsrm_shutdown(); #endif - return ret; + return ret; } static int s_stop; void litespeed_cleanup(int signal) { - s_stop = signal; + s_stop = signal; } void start_children( int children ) { - struct sigaction act, old_term, old_quit, old_int, old_usr1; - int running = 0; - int status; - pid_t pid; - - /* Create a process group */ - setsid(); - - /* Set up handler to kill children upon exit */ - act.sa_flags = 0; - act.sa_handler = litespeed_cleanup; - if( sigaction( SIGTERM, &act, &old_term ) || - sigaction( SIGINT, &act, &old_int ) || - sigaction( SIGUSR1, &act, &old_usr1 ) || - sigaction( SIGQUIT, &act, &old_quit )) { - perror( "Can't set signals" ); - exit( 1 ); - } - s_stop = 0; - while( 1 ) { - while((!s_stop )&&( running < children )) { - pid = fork(); - switch( pid ) { - case 0: /* children process */ - - /* don't catch our signals */ - sigaction( SIGTERM, &old_term, 0 ); - sigaction( SIGQUIT, &old_quit, 0 ); - sigaction( SIGINT, &old_int, 0 ); - sigaction( SIGUSR1, &old_usr1, 0 ); - return ; - case -1: - perror( "php (pre-forking)" ); - exit( 1 ); - break; - default: /* parent process */ - running++; - break; - } - } - if ( s_stop ) { - break; - } - pid = wait( &status ); - running--; - } - kill( -getpgrp(), SIGUSR1 ); - exit( 0 ); + struct sigaction act, old_term, old_quit, old_int, old_usr1; + int running = 0; + int status; + pid_t pid; + + /* Create a process group */ + setsid(); + + /* Set up handler to kill children upon exit */ + act.sa_flags = 0; + act.sa_handler = litespeed_cleanup; + if( sigaction( SIGTERM, &act, &old_term ) || + sigaction( SIGINT, &act, &old_int ) || + sigaction( SIGUSR1, &act, &old_usr1 ) || + sigaction( SIGQUIT, &act, &old_quit )) { + perror( "Can't set signals" ); + exit( 1 ); + } + s_stop = 0; + while( 1 ) { + while((!s_stop )&&( running < children )) { + pid = fork(); + switch( pid ) { + case 0: /* children process */ + + /* don't catch our signals */ + sigaction( SIGTERM, &old_term, 0 ); + sigaction( SIGQUIT, &old_quit, 0 ); + sigaction( SIGINT, &old_int, 0 ); + sigaction( SIGUSR1, &old_usr1, 0 ); + return ; + case -1: + perror( "php (pre-forking)" ); + exit( 1 ); + break; + default: /* parent process */ + running++; + break; + } + } + if ( s_stop ) { + break; + } + pid = wait( &status ); + running--; + } + kill( -getpgrp(), SIGUSR1 ); + exit( 0 ); } - +void setArgv0( int argc, char * argv[] ) +{ + char * p; + int i; + argv0 = argv[0] + strlen( argv[0] ); + p = argv0; + while(( p > argv[0] )&&( p[-1] != '/')) + --p; + if ( p > argv[0] ) + { + memmove( argv[0], p, argv0 - p ); + memset( argv[0] + ( argv0 - p ), 0, p - argv[0] ); + argv0 = argv[0] + (argv0 - p); + } + for( i = 1; i < argc; ++i ) + { + memset( argv[i], 0, strlen( argv[i] ) ); + } +} #include int main( int argc, char * argv[] ) { - int ret; - int bindFd; - - char * php_ini_path = NULL; - char * php_bind = NULL; - char * p; - int n; - int climode = 0; - + int ret; + int bindFd; + + char * php_ini_path = NULL; + char * php_bind = NULL; + int n; + int climode = 0; + struct timeval tv_req_begin; + struct timeval tv_req_end; + int slow_script_msec = 0; + char time_buf[40]; + #ifdef HAVE_SIGNAL_H #if defined(SIGPIPE) && defined(SIG_IGN) - signal(SIGPIPE, SIG_IGN); + signal(SIGPIPE, SIG_IGN); #endif #endif #ifdef ZTS - tsrm_startup(1, 1, 0, NULL); + tsrm_startup(1, 1, 0, NULL); #endif - if (argc > 1 ) { - if ( parse_opt( argc, argv, &climode, - &php_ini_path, &php_bind ) == -1 ) { - return 1; - } - } - if ( climode ) { - lsapi_sapi_module.phpinfo_as_text = 1; - } - sapi_startup(&lsapi_sapi_module); + if (argc > 1 ) { + if ( parse_opt( argc, argv, &climode, + &php_ini_path, &php_bind ) == -1 ) { + return 1; + } + } + if ( climode ) { + lsapi_sapi_module.phpinfo_as_text = 1; + } else { + setArgv0(argc, argv ); + } + + sapi_startup(&lsapi_sapi_module); #ifdef ZTS - compiler_globals = ts_resource(compiler_globals_id); - executor_globals = ts_resource(executor_globals_id); - core_globals = ts_resource(core_globals_id); - sapi_globals = ts_resource(sapi_globals_id); - tsrm_ls = ts_resource(0); + compiler_globals = ts_resource(compiler_globals_id); + executor_globals = ts_resource(executor_globals_id); + core_globals = ts_resource(core_globals_id); + sapi_globals = ts_resource(sapi_globals_id); + tsrm_ls = ts_resource(0); - SG(request_info).path_translated = NULL; + SG(request_info).path_translated = NULL; #endif - lsapi_sapi_module.executable_location = argv[0]; + lsapi_sapi_module.executable_location = argv[0]; + + if ( ignore_php_ini ) + lsapi_sapi_module.php_ini_ignore = 1; + + if ( php_ini_path ) { + lsapi_sapi_module.php_ini_path_override = php_ini_path; + } - if ( php_ini_path ) { - lsapi_sapi_module.php_ini_path_override = php_ini_path; - } - if (php_module_startup(&lsapi_sapi_module, &litespeed_module_entry, 1) == FAILURE) { + lsapi_sapi_module.ini_defaults = sapi_lsapi_ini_defaults; + + if (php_module_startup(&lsapi_sapi_module, &litespeed_module_entry, 1) == FAILURE) { #ifdef ZTS - tsrm_shutdown(); + tsrm_shutdown(); #endif - return FAILURE; - } - - if ( climode ) { - return cli_main(argc, argv); - } - - - if ( php_bind ) { - bindFd = LSAPI_CreateListenSock( php_bind, 10 ); - if ( bindFd == -1 ) { - fprintf( stderr, - "Failed to bind socket [%s]: %s\n", php_bind, strerror( errno ) ); - exit( 2 ); - } - if ( bindFd != 0 ) { - dup2( bindFd, 0 ); - close( bindFd ); - } - } - - LSAPI_Init(); + return FAILURE; + } + + if ( climode ) { + return cli_main(argc, argv); + } + + if ( php_bind ) { + bindFd = LSAPI_CreateListenSock( php_bind, 10 ); + if ( bindFd == -1 ) { + fprintf( stderr, + "Failed to bind socket [%s]: %s\n", php_bind, strerror( errno ) ); + exit( 2 ); + } + if ( bindFd != 0 ) { + dup2( bindFd, 0 ); + close( bindFd ); + } + } + + LSAPI_Init(); - LSAPI_Init_Env_Parameters( NULL ); - - if ( php_bind ) { - LSAPI_No_Check_ppid(); - } - - while( LSAPI_Prefork_Accept_r( &g_req ) >= 0 ) { - ret = processReq(TSRMLS_C); - LSAPI_Finish(); - if ( ret ) { - break; - } - } - php_module_shutdown(TSRMLS_C); + LSAPI_Init_Env_Parameters( NULL ); + + slow_script_msec = LSAPI_Get_Slow_Req_Msecs(); + + if ( php_bind ) { + LSAPI_No_Check_ppid(); + free( php_bind ); + php_bind = NULL; + } + + while( LSAPI_Prefork_Accept_r( &g_req ) >= 0 ) { + if ( slow_script_msec ) { + gettimeofday( &tv_req_begin, NULL ); + } + ret = processReq(TSRMLS_C); + if ( slow_script_msec ) { + gettimeofday( &tv_req_end, NULL ); + n = ((long) tv_req_end.tv_sec - tv_req_begin.tv_sec ) * 1000 + + (tv_req_end.tv_usec - tv_req_begin.tv_usec) / 1000; + if ( n > slow_script_msec ) + { + strftime( time_buf, 30, "%d/%b/%Y:%H:%M:%S", localtime( &tv_req_end.tv_sec ) ); + fprintf( stderr, "[%s] Slow PHP script: %d ms\n URL: %s %s\n Query String: %s\n Script: %s\n", + time_buf, n, LSAPI_GetRequestMethod(), + LSAPI_GetScriptName(), LSAPI_GetQueryString(), + LSAPI_GetScriptFileName() ); + + } + } + LSAPI_Finish(); + if ( ret ) { + break; + } + } + php_module_shutdown(TSRMLS_C); #ifdef ZTS - tsrm_shutdown(); + tsrm_shutdown(); #endif - return ret; + return ret; } @@ -795,49 +1049,51 @@ ZEND_END_ARG_INFO() PHP_FUNCTION(litespeed_request_headers); PHP_FUNCTION(litespeed_response_headers); +PHP_FUNCTION(apache_get_modules); PHP_MINFO_FUNCTION(litespeed); zend_function_entry litespeed_functions[] = { - PHP_FE(litespeed_request_headers, arginfo_litespeed__void) - PHP_FE(litespeed_response_headers, arginfo_litespeed__void) - PHP_FALIAS(getallheaders, litespeed_request_headers, arginfo_litespeed__void) - PHP_FALIAS(apache_request_headers, litespeed_request_headers, arginfo_litespeed__void) - PHP_FALIAS(apache_response_headers, litespeed_response_headers, arginfo_litespeed__void) - {NULL, NULL, NULL} + PHP_FE(litespeed_request_headers, arginfo_litespeed__void) + PHP_FE(litespeed_response_headers, arginfo_litespeed__void) + PHP_FE(apache_get_modules, arginfo_litespeed__void) + PHP_FALIAS(getallheaders, litespeed_request_headers, arginfo_litespeed__void) + PHP_FALIAS(apache_request_headers, litespeed_request_headers, arginfo_litespeed__void) + PHP_FALIAS(apache_response_headers, litespeed_response_headers, arginfo_litespeed__void) + {NULL, NULL, NULL} }; static PHP_MINIT_FUNCTION(litespeed) { - /* REGISTER_INI_ENTRIES(); */ - return SUCCESS; + /* REGISTER_INI_ENTRIES(); */ + return SUCCESS; } static PHP_MSHUTDOWN_FUNCTION(litespeed) { - /* UNREGISTER_INI_ENTRIES(); */ - return SUCCESS; + /* UNREGISTER_INI_ENTRIES(); */ + return SUCCESS; } zend_module_entry litespeed_module_entry = { - STANDARD_MODULE_HEADER, - "litespeed", - litespeed_functions, - PHP_MINIT(litespeed), - PHP_MSHUTDOWN(litespeed), - NULL, - NULL, - NULL, - NO_VERSION_YET, - STANDARD_MODULE_PROPERTIES + STANDARD_MODULE_HEADER, + "litespeed", + litespeed_functions, + PHP_MINIT(litespeed), + PHP_MSHUTDOWN(litespeed), + NULL, + NULL, + NULL, + NO_VERSION_YET, + STANDARD_MODULE_PROPERTIES }; static int add_associate_array( const char * pKey, int keyLen, const char * pValue, int valLen, - void * arg ) + void * arg ) { - add_assoc_string_ex( (zval *)arg, (char *)pKey, keyLen+1, (char *)pValue, 1 ); - return 1; + add_assoc_string_ex( (zval *)arg, (char *)pKey, keyLen+1, (char *)pValue, 1 ); + return 1; } @@ -845,13 +1101,13 @@ static int add_associate_array( const char * pKey, int keyLen, const char * pVal Fetch all HTTP request headers */ PHP_FUNCTION(litespeed_request_headers) { - /* TODO: */ - if (ZEND_NUM_ARGS() > 0) { - WRONG_PARAM_COUNT; - } - array_init(return_value); + /* TODO: */ + if (ZEND_NUM_ARGS() > 0) { + WRONG_PARAM_COUNT; + } + array_init(return_value); - LSAPI_ForeachOrgHeader( add_associate_array, return_value ); + LSAPI_ForeachOrgHeader( add_associate_array, return_value ); } /* }}} */ @@ -862,45 +1118,62 @@ PHP_FUNCTION(litespeed_request_headers) Fetch all HTTP response headers */ PHP_FUNCTION(litespeed_response_headers) { - sapi_header_struct *h; - zend_llist_position pos; - char * p; - int len; - char headerBuf[SAPI_LSAPI_MAX_HEADER_LENGTH]; - - if (ZEND_NUM_ARGS() > 0) { - WRONG_PARAM_COUNT; - } - - if (!&SG(sapi_headers).headers) { - RETURN_FALSE; - } - array_init(return_value); - - h = zend_llist_get_first_ex(&SG(sapi_headers).headers, &pos); - while (h) { - if ( h->header_len > 0 ) { - p = strchr( h->header, ':' ); - len = p - h->header; - if (( p )&&( len > 0 )) { - memmove( headerBuf, h->header, len ); - while( len > 0 && (isspace( headerBuf[len-1])) ) { - --len; - } - headerBuf[len] = 0; - if ( len ) { - while( isspace(*++p)); - add_assoc_string_ex(return_value, headerBuf, len+1, p, 1 ); - } - } - } - h = zend_llist_get_next_ex(&SG(sapi_headers).headers, &pos); - } + sapi_header_struct *h; + zend_llist_position pos; + char * p; + int len; + char headerBuf[SAPI_LSAPI_MAX_HEADER_LENGTH]; + + if (ZEND_NUM_ARGS() > 0) { + WRONG_PARAM_COUNT; + } + + if (!&SG(sapi_headers).headers) { + RETURN_FALSE; + } + array_init(return_value); + + h = zend_llist_get_first_ex(&SG(sapi_headers).headers, &pos); + while (h) { + if ( h->header_len > 0 ) { + p = strchr( h->header, ':' ); + len = p - h->header; + if (( p )&&( len > 0 )) { + memmove( headerBuf, h->header, len ); + while( len > 0 && (isspace( headerBuf[len-1])) ) { + --len; + } + headerBuf[len] = 0; + if ( len ) { + while( isspace(*++p)); + add_assoc_string_ex(return_value, headerBuf, len+1, p, 1 ); + } + } + } + h = zend_llist_get_next_ex(&SG(sapi_headers).headers, &pos); + } } /* }}} */ +/* {{{ proto array apache_get_modules(void) + Fetch all loaded module names */ +PHP_FUNCTION(apache_get_modules) +{ + /* TODO: */ + if (ZEND_NUM_ARGS() > 0) { + WRONG_PARAM_COUNT; + } + array_init(return_value); + add_next_index_string(return_value, "mod_rewrite", 1); + add_next_index_string(return_value, "mod_mime", 1); + add_next_index_string(return_value, "mod_headers", 1); + add_next_index_string(return_value, "mod_expires", 1); +} +/* }}} */ + + /* * Local variables: * tab-width: 4 diff --git a/sapi/litespeed/lsapidef.h b/sapi/litespeed/lsapidef.h index c8940a930e947..5d5b4c1687a6c 100644 --- a/sapi/litespeed/lsapidef.h +++ b/sapi/litespeed/lsapidef.h @@ -1,25 +1,5 @@ - -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: George Wang | - +----------------------------------------------------------------------+ -*/ - - /* -Copyright (c) 2007, Lite Speed Technologies Inc. +Copyright (c) 2005, Lite Speed Technologies Inc. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -50,6 +30,13 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/*************************************************************************** + $Id: lsapidef.h,v 1.17 2012/12/01 19:23:31 gwang Exp $ + ------------------- + begin : Thu Feb 10 2005 + author : George Wang + email : gwang@litespeedtech.com + ***************************************************************************/ #ifndef _LSAPIDEF_H_ #define _LSAPIDEF_H_ @@ -113,12 +100,14 @@ enum #define LSAPI_RESP_END 5 #define LSAPI_STDERR_STREAM 6 #define LSAPI_REQ_RECEIVED 7 +#define LSAPI_CONN_CLOSE 8 +#define LSAPI_INTERNAL_ERROR 9 #define LSAPI_MAX_HEADER_LEN 65535 #define LSAPI_MAX_DATA_PACKET_LEN 16384 -#define LSAPI_RESP_HTTP_HEADER_MAX 4096 +#define LSAPI_RESP_HTTP_HEADER_MAX 32768 #define LSAPI_PACKET_HEADER_LEN 8 diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c index 3a13000e11f28..4a9affc60f213 100644 --- a/sapi/litespeed/lsapilib.c +++ b/sapi/litespeed/lsapilib.c @@ -1,25 +1,5 @@ /* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: George Wang | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -/* -Copyright (c) 2007, Lite Speed Technologies Inc. +Copyright (c) 2013, Lite Speed Technologies Inc. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -50,17 +30,21 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +/*************************************************************************** + lsapilib.c - description + ------------------- + begin : Mon Feb 21 2005 + copyright : (C) 2005 by George Wang + email : gwang@litespeedtech.com + ***************************************************************************/ + #include +#include #include #include -#include -#include -#include -#include -#include +#include #include #include #include @@ -71,8 +55,48 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include +#include #include #include +#include +#include +#include +#include +#include + +#include "lsapilib.h" + +#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__) +#include +#endif + +#if defined(__FreeBSD__ ) || defined(__NetBSD__) || defined(__OpenBSD__) \ + || defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) +#include +#endif + +#include +#ifndef uint32 +#define uint32 uint32_t +#endif + +struct lsapi_MD5Context { + uint32 buf[4]; + uint32 bits[2]; + unsigned char in[64]; +}; + +void lsapi_MD5Init(struct lsapi_MD5Context *context); +void lsapi_MD5Update(struct lsapi_MD5Context *context, unsigned char const *buf, + unsigned len); +void lsapi_MD5Final(unsigned char digest[16], struct lsapi_MD5Context *context); + +/* + * This is needed to make RSAREF happy on some MS-DOS compilers. + */ +typedef struct lsapi_MD5Context lsapi_MD5_CTX; + #define LSAPI_ST_REQ_HEADER 1 #define LSAPI_ST_REQ_BODY 2 @@ -83,11 +107,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define LSAPI_INIT_RESP_HEADER_LEN 4096 + static int g_inited = 0; static int g_running = 1; static int s_ppid; +static int s_slow_req_msecs = 0; +static int s_keepListener = 0; +static int s_dump_debug_info = 0; +static int s_pid_dump_debug_info = 0; + LSAPI_Request g_req = { -1, -1 }; +static char s_pSecret[24]; + + void Flush_RespBuf_r( LSAPI_Request * pReq ); static const char *CGI_HEADERS[H_TRANSFER_ENCODING+1] = @@ -111,13 +144,13 @@ static const char *CGI_HEADERS[H_TRANSFER_ENCODING+1] = "HTTP_TRANSFER_ENCODING" }; -static int CGI_HEADER_LEN[H_TRANSFER_ENCODING+1] = { - 11, 19, 20, 20, 18, 15, 12, 14, 11, 12, 9, 11, 12, 15, 18, - 22, 13, 18, 13, 24, 15, 10, 20, 8, 22 -}; +static int CGI_HEADER_LEN[H_TRANSFER_ENCODING+1] = +{ 11, 19, 20, 20, 18, 15, 12, 14, 11, 12, 9, 11, 12, 15, 18, + 22, 13, 18, 13, 24, 15, 10, 20, 8, 22 }; -static const char *HTTP_HEADERS[H_TRANSFER_ENCODING+1] = { +static const char *HTTP_HEADERS[H_TRANSFER_ENCODING+1] = +{ "Accept", "Accept-Charset", "Accept-Encoding", "Accept-Language", "Authorization", @@ -137,8 +170,8 @@ static const char *HTTP_HEADERS[H_TRANSFER_ENCODING+1] = { "Transfer-Encoding" }; -static int HTTP_HEADER_LEN[H_TRANSFER_ENCODING+1] = { - 6, 14, 15, 15, 13, 10, 12, 14, 6, 7, 4, 6, 7, 10, /* user-agent */ +static int HTTP_HEADER_LEN[H_TRANSFER_ENCODING+1] = +{ 6, 14, 15, 15, 13, 10, 12, 14, 6, 7, 4, 6, 7, 10, //user-agent 13,17, 8, 13, 8, 19, 10, 5, 15, 3, 17 }; @@ -160,7 +193,8 @@ static void lsapi_signal(int signo, sighandler_t handler) sigaction(signo, NULL, &sa); - if (sa.sa_handler == SIG_DFL) { + if (sa.sa_handler == SIG_DFL) + { sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sa.sa_handler = handler; @@ -169,6 +203,34 @@ static void lsapi_signal(int signo, sighandler_t handler) } +static int s_enable_core_dump = 0; +static void lsapi_enable_core_dump() +{ +#if defined(__FreeBSD__ ) || defined(__NetBSD__) || defined(__OpenBSD__) \ + || defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) + int mib[2]; + size_t len; + + len = 2; + if ( sysctlnametomib("kern.sugid_coredump", mib, &len) == 0 ) + { + len = sizeof(s_enable_core_dump); + if (sysctl(mib, 2, NULL, 0, &s_enable_core_dump, len) == -1) + perror( "sysctl: Failed to set 'kern.sugid_coredump', " + "core dump may not be available!"); + } + + +#endif + +#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__) + if (prctl(PR_SET_DUMPABLE, s_enable_core_dump,0,0,0) == -1) + perror( "prctl: Failed to set dumpable, " + "core dump may not be available!"); +#endif +} + + static inline void lsapi_buildPacketHeader( struct lsapi_packet_header * pHeader, char type, int len ) { @@ -199,75 +261,115 @@ static int lsapi_set_nblock( int fd, int nonblock ) return 0; } - static int lsapi_close( int fd ) { int ret; - while( 1 ) { + while( 1 ) + { ret = close( fd ); - if (( ret == -1 )&&( errno == EINTR )&&(g_running)) { + if (( ret == -1 )&&( errno == EINTR )&&(g_running)) continue; - } return ret; } } -static inline int lsapi_read( int fd, void * pBuf, int len ) +static inline ssize_t lsapi_read( int fd, void * pBuf, size_t len ) { - int ret; - while( 1 ) { + ssize_t ret; + while( 1 ) + { ret = read( fd, (char *)pBuf, len ); - if (( ret == -1 )&&( errno == EINTR )&&(g_running)) { + if (( ret == -1 )&&( errno == EINTR )&&(g_running)) continue; - } return ret; } } +/* +static int lsapi_write( int fd, const void * pBuf, int len ) +{ + int ret; + const char * pCur; + const char * pEnd; + if ( len == 0 ) + return 0; + pCur = (const char *)pBuf; + pEnd = pCur + len; + while( g_running && (pCur < pEnd) ) + { + ret = write( fd, pCur, pEnd - pCur ); + if ( ret >= 0) + pCur += ret; + else if (( ret == -1 )&&( errno != EINTR )) + return ret; + } + return pCur - (const char *)pBuf; +} +*/ static int lsapi_writev( int fd, struct iovec ** pVec, int count, int totalLen ) { int ret; int left = totalLen; int n = count; - while(( left > 0 )&&g_running ) { + while(( left > 0 )&&g_running ) + { ret = writev( fd, *pVec, n ); - if ( ret > 0 ) { + if ( ret > 0 ) + { left -= ret; - if (( left <= 0)||( !g_running )) { + if (( left <= 0)||( !g_running )) return totalLen - left; - } - while( ret > 0 ) { - if ( (*pVec)->iov_len <= ret ) { + while( ret > 0 ) + { + if ( (*pVec)->iov_len <= (unsigned int )ret ) + { ret -= (*pVec)->iov_len; ++(*pVec); - } else { + } + else + { (*pVec)->iov_base = (char *)(*pVec)->iov_base + ret; (*pVec)->iov_len -= ret; break; } } - } else if ( ret == -1 ) { - if ( errno == EAGAIN ) { - if ( totalLen - left > 0 ) { + } + else if ( ret == -1 ) + { + if ( errno == EAGAIN ) + { + if ( totalLen - left > 0 ) return totalLen - left; - } else { + else return -1; - } - } else { - if ( errno != EINTR ) { - return ret; - } } + else if ( errno != EINTR ) + return ret; } } return totalLen - left; } +/* +static int getTotalLen( struct iovec * pVec, int count ) +{ + struct iovec * pEnd = pVec + count; + int total = 0; + while( pVec < pEnd ) + { + total += pVec->iov_len; + ++pVec; + } + return total; +} +*/ + static inline int allocateBuf( LSAPI_Request * pReq, int size ) { char * pBuf = (char *)realloc( pReq->m_pReqBuf, size ); - if ( pBuf ) { + if ( pBuf ) + { pReq->m_pReqBuf = pBuf; pReq->m_reqBufSize = size; pReq->m_pHeader = (struct lsapi_req_header *)pReq->m_pReqBuf; @@ -281,9 +383,8 @@ static int allocateIovec( LSAPI_Request * pReq, int n ) { struct iovec * p = (struct iovec *)realloc( pReq->m_pIovec, sizeof(struct iovec) * n ); - if ( !p ) { + if ( !p ) return -1; - } pReq->m_pIovecToWrite = p + ( pReq->m_pIovecToWrite - pReq->m_pIovec ); pReq->m_pIovecCur = p + ( pReq->m_pIovecCur - pReq->m_pIovec ); pReq->m_pIovec = p; @@ -294,9 +395,8 @@ static int allocateIovec( LSAPI_Request * pReq, int n ) static int allocateRespHeaderBuf( LSAPI_Request * pReq, int size ) { char * p = (char *)realloc( pReq->m_pRespHeaderBuf, size ); - if ( !p ) { + if ( !p ) return -1; - } pReq->m_pRespHeaderBufPos = p + ( pReq->m_pRespHeaderBufPos - pReq->m_pRespHeaderBuf ); pReq->m_pRespHeaderBuf = p; pReq->m_pRespHeaderBufEnd = p + size; @@ -308,10 +408,10 @@ static inline int verifyHeader( struct lsapi_packet_header * pHeader, char pktTy { if (( LSAPI_VERSION_B0 != pHeader->m_versionB0 )|| ( LSAPI_VERSION_B1 != pHeader->m_versionB1 )|| - ( pktType != pHeader->m_type )) { + ( pktType != pHeader->m_type )) return -1; - } - if ( LSAPI_ENDIAN != (pHeader->m_flag & LSAPI_ENDIAN_BIT )) { + if ( LSAPI_ENDIAN != (pHeader->m_flag & LSAPI_ENDIAN_BIT )) + { register char b; b = pHeader->m_packetLen.m_bytes[0]; pHeader->m_packetLen.m_bytes[0] = pHeader->m_packetLen.m_bytes[3]; @@ -327,21 +427,20 @@ static int allocateEnvList( struct LSAPI_key_value_pair ** pEnvList, int *curSize, int newSize ) { struct LSAPI_key_value_pair * pBuf; - if ( *curSize >= newSize ) { + if ( *curSize >= newSize ) return 0; - } - if ( newSize > 8192 ) { + if ( newSize > 8192 ) return -1; - } pBuf = (struct LSAPI_key_value_pair *)realloc( *pEnvList, newSize * sizeof(struct LSAPI_key_value_pair) ); - if ( pBuf ) { + if ( pBuf ) + { *pEnvList = pBuf; *curSize = newSize; return 0; - } else { - return -1; } + else + return -1; } @@ -350,36 +449,32 @@ static inline int isPipe( int fd ) char achPeer[128]; socklen_t len = 128; if (( getpeername( fd, (struct sockaddr *)achPeer, &len ) != 0 )&& - ( errno == ENOTCONN )) { + ( errno == ENOTCONN )) return 0; - } else { + else return 1; - } } static int parseEnv( struct LSAPI_key_value_pair * pEnvList, int count, char **pBegin, char * pEnd ) { struct LSAPI_key_value_pair * pEnvEnd; - int keyLen = 0, valLen = 0; - if ( count > 8192 ) { + int keyLen = 0, valLen = 0; + if ( count > 8192 ) return -1; - } pEnvEnd = pEnvList + count; - while( pEnvList != pEnvEnd ) { - if ( pEnd - *pBegin < 4 ) { + while( pEnvList != pEnvEnd ) + { + if ( pEnd - *pBegin < 4 ) return -1; - } keyLen = *((unsigned char *)((*pBegin)++)); keyLen = (keyLen << 8) + *((unsigned char *)((*pBegin)++)); valLen = *((unsigned char *)((*pBegin)++)); valLen = (valLen << 8) + *((unsigned char *)((*pBegin)++)); - if ( *pBegin + keyLen + valLen > pEnd ) { + if ( *pBegin + keyLen + valLen > pEnd ) return -1; - } - if (( !keyLen )||( !valLen )) { + if (( !keyLen )||( !valLen )) return -1; - } pEnvList->pKey = *pBegin; *pBegin += keyLen; @@ -390,9 +485,8 @@ static int parseEnv( struct LSAPI_key_value_pair * pEnvList, int count, pEnvList->valLen = valLen - 1; ++pEnvList; } - if ( memcmp( *pBegin, "\0\0\0\0", 4 ) != 0 ) { + if ( memcmp( *pBegin, "\0\0\0\0", 4 ) != 0 ) return -1; - } *pBegin += 4; return 0; } @@ -427,8 +521,10 @@ static inline void fixEndian( LSAPI_Request * pReq ) static void fixHeaderIndexEndian( LSAPI_Request * pReq ) { int i; - for( i = 0; i < H_TRANSFER_ENCODING; ++i ) { - if ( pReq->m_pHeaderIndex->m_headerOff[i] ) { + for( i = 0; i < H_TRANSFER_ENCODING; ++i ) + { + if ( pReq->m_pHeaderIndex->m_headerOff[i] ) + { register char b; char * p = (char *)(&pReq->m_pHeaderIndex->m_headerLen[i]); b = p[0]; @@ -437,20 +533,434 @@ static void fixHeaderIndexEndian( LSAPI_Request * pReq ) swapIntEndian( &pReq->m_pHeaderIndex->m_headerOff[i] ); } } - if ( pReq->m_pHeader->m_cntUnknownHeaders > 0 ) { + if ( pReq->m_pHeader->m_cntUnknownHeaders > 0 ) + { struct lsapi_header_offset * pCur, *pEnd; pCur = pReq->m_pUnknownHeader; pEnd = pCur + pReq->m_pHeader->m_cntUnknownHeaders; - while( pCur < pEnd ) { + while( pCur < pEnd ) + { swapIntEndian( &pCur->nameOff ); swapIntEndian( &pCur->nameLen ); swapIntEndian( &pCur->valueOff ); swapIntEndian( &pCur->valueLen ); ++pCur; } - } + } +} + +static uid_t s_uid = 0; +static uid_t s_defaultUid; //web server need set this +static gid_t s_defaultGid; + +#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__) + +#define LSAPI_LVE_DISABLED 0 +#define LSAPI_LVE_ENABLED 1 +#define LSAPI_CAGEFS_ENABLED 2 +#define LSAPI_CAGEFS_NO_SUEXEC 3 +struct liblve; +static int s_enable_lve = LSAPI_LVE_DISABLED; +static struct liblve * s_lve = NULL; + +static void *s_liblve; +static int (*fp_lve_is_available)(void) = NULL; +static int (*fp_lve_instance_init)(struct liblve *) = NULL; +static int (*fp_lve_destroy)(struct liblve *) = NULL; +static int (*fp_lve_enter)(struct liblve *, uint32_t, int32_t, int32_t, uint32_t *) = NULL; +static int (*fp_lve_leave)(struct liblve *, uint32_t *) = NULL; +static int (*fp_lve_jail)( struct passwd *, char *) = NULL; +static int lsapi_load_lve_lib() +{ + s_liblve = dlopen("liblve.so.0", RTLD_LAZY); + if (s_liblve) + { + fp_lve_is_available = dlsym(s_liblve, "lve_is_available"); + if (dlerror() == NULL) + { + if ( !(*fp_lve_is_available)() ) + { + int uid = getuid(); + if ( uid ) + { + setreuid( s_uid, uid ); + if ( !(*fp_lve_is_available)() ) + s_enable_lve = 0; + setreuid( uid, s_uid ); + } + } + } + } + else + { + s_enable_lve = LSAPI_LVE_DISABLED; + } + return (s_liblve)? 0 : -1; } +static int init_lve_ex() +{ + int rc; + if ( !s_liblve ) + return -1; + fp_lve_instance_init = dlsym(s_liblve, "lve_instance_init"); + fp_lve_destroy = dlsym(s_liblve, "lve_destroy"); + fp_lve_enter = dlsym(s_liblve, "lve_enter"); + fp_lve_leave = dlsym(s_liblve, "lve_leave"); + if ( s_enable_lve >= LSAPI_CAGEFS_ENABLED ) + fp_lve_jail = dlsym(s_liblve, "jail" ); + + if ( s_lve == NULL ) + { + rc = (*fp_lve_instance_init)(NULL); + s_lve = malloc(rc); + } + rc = (*fp_lve_instance_init)(s_lve); + if (rc != 0) + { + perror( "LSAPI: Unable to initialize LVE" ); + free( s_lve ); + s_lve = NULL; + return -1; + } + return 0; + +} + +#endif + + + +static int readSecret( const char * pSecretFile ) +{ + struct stat st; + int fd = open( pSecretFile, O_RDONLY , 0600 ); + if ( fd == -1 ) + { + fprintf( stderr, "LSAPI: failed to open secret file: %s!\n", pSecretFile ); + return -1; + } + if ( fstat( fd, &st ) == -1 ) + { + fprintf( stderr, "LSAPI: failed to check state of file: %s!\n", pSecretFile ); + close( fd ); + return -1; + } +/* + if ( st.st_uid != s_uid ) + { + fprintf( stderr, "LSAPI: file owner check failure: %s!\n", pSecretFile ); + close( fd ); + return -1; + } +*/ + if ( st.st_mode & 0077 ) + { + fprintf( stderr, "LSAPI: file permission check failure: %s\n", pSecretFile ); + close( fd ); + return -1; + } + if ( read( fd, s_pSecret, 16 ) < 16 ) + { + fprintf( stderr, "LSAPI: failed to read secret from secret file: %s\n", pSecretFile ); + close( fd ); + return -1; + } + close( fd ); + return 0; +} + +int LSAPI_is_suEXEC_Daemon() +{ + if (( !s_uid )&&( s_pSecret[0] )) + return 1; + else + return 0; +} + +static int LSAPI_perror_r( LSAPI_Request * pReq, const char * pErr1, const char *pErr2 ) +{ + char achError[1024]; + int n = snprintf(achError, 1024, "%s:%s: %s\n", pErr1, (pErr2)?pErr2:"", strerror( errno ) ); + if ( pReq ) + LSAPI_Write_Stderr_r( pReq, achError, n ); + else + write( STDERR_FILENO, achError, n ); + return 0; +} + +static int lsapi_lve_error( LSAPI_Request * pReq ) +{ + static const char * headers[] = + { + "Cache-Control: private, no-cache, no-store, must-revalidate, max-age=0", + "Pragma: no-cache", + "Retry-After: 60", + "Content-Type: text/html", + NULL + }; + static const char achBody[] = + "\n" + "\n508 Resource Limit Is Reached\n" + "\n" "

Resource Limit Is Reached

\n" + "The website is temporarily unable to service your request as it exceeded resource limit.\n" + "Please try again later.\n" + "
\n" + "\n"; + + LSAPI_ErrResponse_r( pReq, 508, headers, achBody, sizeof( achBody ) - 1 ); + return 0; +} + +static int lsapi_enterLVE( LSAPI_Request * pReq, uid_t uid ) +{ +#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__) + if ( s_lve && uid ) //root user should not do that + { + uint32_t cookie; + int ret = -1; + ret = (*fp_lve_enter)(s_lve, uid, -1, -1, &cookie); + if ( ret < 0 ) + { + fprintf( stderr, "Pid (%d): enter LVE (%d) : ressult: %d !\n", getpid(), uid, ret ); + LSAPI_perror_r(pReq, "LSAPI: lve_enter() failure, reached resource limit.", NULL ); + lsapi_lve_error( pReq ); + return -1; + } + } +#endif + + return 0; +} + +static int lsapi_jailLVE( LSAPI_Request * pReq, uid_t uid, struct passwd * pw ) +{ + int ret = 0; +#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__) + char error_msg[1024] = ""; + ret = (*fp_lve_jail)( pw, error_msg ); + if ( ret < 0 ) + { + fprintf( stderr, "LSAPI (%d): LVE jail(%d) ressult: %d, error: %s !\n", + getpid(), uid, ret, error_msg ); + LSAPI_perror_r( pReq, "LSAPI: jail() failure.", NULL ); + return -1; + } +#endif + return ret; +} + + +#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__) +static int lsapi_initLVE() +{ + const char * pEnv; + if ( (pEnv = getenv( "LSAPI_LVE_ENABLE" ))!= NULL ) + { + s_enable_lve = atol( pEnv ); + pEnv = NULL; + } + else if ( (pEnv = getenv( "LVE_ENABLE" ))!= NULL ) + { + s_enable_lve = atol( pEnv ); + pEnv = NULL; + } + if ( s_enable_lve && !s_uid ) + { + lsapi_load_lve_lib(); + if ( s_enable_lve ) + { + return init_lve_ex(); + } + + } + return 0; +} +#endif + + +static int setUID_LVE(LSAPI_Request * pReq, uid_t uid, gid_t gid, const char * pChroot) +{ + int rv; + struct passwd * pw; + pw = getpwuid( uid ); +#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__) + if ( s_lve ) + { + if( lsapi_enterLVE( pReq, uid ) == -1 ) + return -1; + if ( pw && fp_lve_jail) + { + rv = lsapi_jailLVE( pReq, uid, pw ); + if ( rv == -1 ) + return -1; + if (( rv == 1 )&&(s_enable_lve == LSAPI_CAGEFS_NO_SUEXEC )) //this mode only use cageFS, does not use suEXEC + { + uid = s_defaultUid; + gid = s_defaultGid; + pw = getpwuid( uid ); + } + } + } +#endif + //if ( !uid || !gid ) //do not allow root + //{ + // return -1; + //} + +#if defined(__FreeBSD__ ) || defined(__NetBSD__) || defined(__OpenBSD__) \ + || defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) + if ( s_enable_core_dump ) + lsapi_enable_core_dump(); +#endif + + rv = setgid(gid); + if (rv == -1) + { + LSAPI_perror_r(pReq, "LSAPI: setgid()", NULL); + return -1; + } + if ( pw && (pw->pw_gid == gid )) + { + rv = initgroups( pw->pw_name, gid ); + if (rv == -1) + { + LSAPI_perror_r(pReq, "LSAPI: initgroups()", NULL); + return -1; + } + } + else + { + rv = setgroups(1, &gid); + if (rv == -1) + { + LSAPI_perror_r(pReq, "LSAPI: setgroups()", NULL); + } + } + if ( pChroot ) + { + rv = chroot( pChroot ); + if ( rv == -1 ) + { + LSAPI_perror_r(pReq, "LSAPI: chroot()", NULL); + return -1; + } + } + rv = setuid(uid); + if (rv == -1) + { + LSAPI_perror_r(pReq, "LSAPI: setuid()", NULL); + return -1; + } +#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__) + if ( s_enable_core_dump ) + lsapi_enable_core_dump(); +#endif + return 0; +} + +static int lsapi_suexec_auth( LSAPI_Request *pReq, + char * pAuth, int len, char * pUgid, int ugidLen ) +{ + lsapi_MD5_CTX md5ctx; + unsigned char achMD5[16]; + if ( len < 32 ) + return -1; + memmove( achMD5, pAuth + 16, 16 ); + memmove( pAuth + 16, s_pSecret, 16 ); + lsapi_MD5Init( &md5ctx ); + lsapi_MD5Update( &md5ctx, (unsigned char *)pAuth, 32 ); + lsapi_MD5Update( &md5ctx, (unsigned char *)pUgid, 8 ); + lsapi_MD5Final( (unsigned char *)pAuth + 16, &md5ctx); + if ( memcmp( achMD5, pAuth + 16, 16 ) == 0 ) + return 0; + return 1; +} + + +static int lsapi_changeUGid( LSAPI_Request * pReq ) +{ + int uid = s_defaultUid; + int gid = s_defaultGid; + const char * pChroot = NULL; + struct LSAPI_key_value_pair * pEnv; + struct LSAPI_key_value_pair * pAuth; + int i; + if ( s_uid ) + return 0; + //with special ID 0x00 + //authenticate the suEXEC request; + //first one should be MD5( nonce + lscgid secret ) + //remember to clear the secret after verification + //it should be set at the end of special env + i = pReq->m_pHeader->m_cntSpecialEnv - 1; + if ( i >= 0 ) + { + pEnv = pReq->m_pSpecialEnvList + i; + if (( *pEnv->pKey == '\000' )&& + ( strcmp( pEnv->pKey+1, "SUEXEC_AUTH" ) == 0 )) + { + --pReq->m_pHeader->m_cntSpecialEnv; + pAuth = pEnv--; + if (( *pEnv->pKey == '\000' )&& + ( strcmp( pEnv->pKey+1, "SUEXEC_UGID" ) == 0 )) + { + --pReq->m_pHeader->m_cntSpecialEnv; + uid = *(uint32_t *)pEnv->pValue; + gid = *(((uint32_t *)pEnv->pValue) + 1 ); + //fprintf( stderr, "LSAPI: SUEXEC_UGID set UID: %d, GID: %d\n", uid, gid ); + } + else + { + fprintf( stderr, "LSAPI: missing SUEXEC_UGID env, use default user!\n" ); + pEnv = NULL; + } + if ( pEnv&& lsapi_suexec_auth( pReq, pAuth->pValue, pAuth->valLen, pEnv->pValue, pEnv->valLen ) == 0 ) + { + //read UID, GID from specialEnv + + } + else + { + //authentication error + fprintf( stderr, "LSAPI: SUEXEC_AUTH authentication failed, use default user!\n" ); + uid = 0; + } + } + else + { + //fprintf( stderr, "LSAPI: no SUEXEC_AUTH env, use default user!\n" ); + } + } + + + if ( !uid ) + { + uid = s_defaultUid; + gid = s_defaultGid; + } + + //change uid + if ( setUID_LVE( pReq, uid, gid, pChroot ) == -1 ) + { + return -1; + } + + s_uid = uid; + + return 0; + +} + +static int parseContentLenFromHeader(LSAPI_Request * pReq) +{ + const char * pContentLen = LSAPI_GetHeader_r( pReq, H_CONTENT_LENGTH ); + if ( pContentLen ) + pReq->m_reqBodyLen = strtoll( pContentLen, NULL, 10 ); + return 0; +} + + static int parseRequest( LSAPI_Request * pReq, int totalLen ) { int shouldFixEndian; @@ -458,29 +968,28 @@ static int parseRequest( LSAPI_Request * pReq, int totalLen ) char * pEnd = pReq->m_pReqBuf + totalLen; shouldFixEndian = ( LSAPI_ENDIAN != ( pReq->m_pHeader->m_pktHeader.m_flag & LSAPI_ENDIAN_BIT ) ); - if ( shouldFixEndian ) { + if ( shouldFixEndian ) + { fixEndian( pReq ); } if ( (pReq->m_specialEnvListSize < pReq->m_pHeader->m_cntSpecialEnv )&& allocateEnvList( &pReq->m_pSpecialEnvList, - &pReq->m_specialEnvListSize, - pReq->m_pHeader->m_cntSpecialEnv ) == -1 ) { + &pReq->m_specialEnvListSize, + pReq->m_pHeader->m_cntSpecialEnv ) == -1 ) return -1; - } if ( (pReq->m_envListSize < pReq->m_pHeader->m_cntEnv )&& allocateEnvList( &pReq->m_pEnvList, &pReq->m_envListSize, - pReq->m_pHeader->m_cntEnv ) == -1 ) { + pReq->m_pHeader->m_cntEnv ) == -1 ) return -1; - } + if ( parseEnv( pReq->m_pSpecialEnvList, - pReq->m_pHeader->m_cntSpecialEnv, - &pBegin, pEnd ) == -1 ) { + pReq->m_pHeader->m_cntSpecialEnv, + &pBegin, pEnd ) == -1 ) return -1; - } if ( parseEnv( pReq->m_pEnvList, pReq->m_pHeader->m_cntEnv, - &pBegin, pEnd ) == -1 ) { + &pBegin, pEnd ) == -1 ) return -1; - } + pReq->m_pScriptFile = pReq->m_pReqBuf + pReq->m_pHeader->m_scriptFileOff; pReq->m_pScriptName = pReq->m_pReqBuf + pReq->m_pHeader->m_scriptNameOff; pReq->m_pQueryString = pReq->m_pReqBuf + pReq->m_pHeader->m_queryStringOff; @@ -496,85 +1005,183 @@ static int parseRequest( LSAPI_Request * pReq, int totalLen ) pReq->m_pHttpHeader = pBegin; pBegin += pReq->m_pHeader->m_httpHeaderLen; - if ( pBegin != pEnd ) { + if ( pBegin != pEnd ) + { + fprintf( stderr, "%d: request header does match total size, total: %d, real: %ld\n", getpid(), totalLen, + pBegin - pReq->m_pReqBuf ); return -1; } - - if ( shouldFixEndian ) { + if ( shouldFixEndian ) + { fixHeaderIndexEndian( pReq ); } - + pReq->m_reqBodyLen = pReq->m_pHeader->m_reqBodyLen; + if ( pReq->m_reqBodyLen == -2 ) + { + parseContentLenFromHeader(pReq); + } + return 0; } -static struct lsapi_packet_header ack = {'L', 'S', +//OPTIMIZATION +static char s_accept_notify = 0; +static char s_schedule_notify = 0; +static char s_notify_scheduled = 0; +static char s_notified_pid = 0; + +static struct lsapi_packet_header s_ack = {'L', 'S', LSAPI_REQ_RECEIVED, LSAPI_ENDIAN, {LSAPI_PACKET_HEADER_LEN} }; -static inline int notify_req_received( LSAPI_Request * pReq ) + + +static inline int write_req_received_notification( int fd ) { - if ( write( pReq->m_fd, &ack, LSAPI_PACKET_HEADER_LEN ) - < LSAPI_PACKET_HEADER_LEN ) { + if ( write( fd, &s_ack, LSAPI_PACKET_HEADER_LEN ) + < LSAPI_PACKET_HEADER_LEN ) return -1; + return 0; +} + +static void lsapi_sigalarm( int sig ) +{ + if ( s_notify_scheduled ) + { + s_notify_scheduled = 0; + if ( g_req.m_fd != -1 ) + write_req_received_notification( g_req.m_fd ); + } +} + +static inline int lsapi_schedule_notify() +{ + if ( !s_notify_scheduled ) + { + alarm( 2 ); + s_notify_scheduled = 1; } return 0; } +static inline int notify_req_received( int fd ) +{ + if ( s_schedule_notify ) + return lsapi_schedule_notify(); + return write_req_received_notification( fd ); + +} + + +static inline int lsapi_notify_pid( int fd ) +{ + char achBuf[16]; + lsapi_buildPacketHeader( (struct lsapi_packet_header *)achBuf, LSAPI_STDERR_STREAM, + 8 + LSAPI_PACKET_HEADER_LEN ); + memmove( &achBuf[8], "\0PID", 4 ); + *((int *)&achBuf[12]) = getpid(); + + if ( write( fd, achBuf, 16 ) < 16 ) + return -1; + return 0; +} + +static char s_conn_key_packet[16]; +static inline int init_conn_key( int fd ) +{ + struct lsapi_packet_header * pHeader = (struct lsapi_packet_header *)s_conn_key_packet; + struct timeval tv; + int i; + gettimeofday( &tv, NULL ); + srand( (tv.tv_sec % 0x1000 + tv.tv_usec) ^ rand() ); + for( i = 8; i < 16; ++i ) + { + s_conn_key_packet[i]=(int) (256.0*rand()/(RAND_MAX+1.0)); + } + lsapi_buildPacketHeader( pHeader, LSAPI_REQ_RECEIVED, + 8 + LSAPI_PACKET_HEADER_LEN ); + if ( write( fd, s_conn_key_packet, LSAPI_PACKET_HEADER_LEN+8 ) + < LSAPI_PACKET_HEADER_LEN+8 ) + return -1; + return 0; + + +} static int readReq( LSAPI_Request * pReq ) { int len; int packetLen; - if ( !pReq ) { + if ( !pReq ) return -1; - } - if ( pReq->m_reqBufSize < 8192 ) { - if ( allocateBuf( pReq, 8192 ) == -1 ) { + if ( pReq->m_reqBufSize < 8192 ) + { + if ( allocateBuf( pReq, 8192 ) == -1 ) return -1; - } } - while ( pReq->m_bufRead < LSAPI_PACKET_HEADER_LEN ) { + while ( pReq->m_bufRead < LSAPI_PACKET_HEADER_LEN ) + { len = lsapi_read( pReq->m_fd, pReq->m_pReqBuf, pReq->m_reqBufSize ); - if ( len <= 0 ) { + if ( len <= 0 ) return -1; - } pReq->m_bufRead += len; } pReq->m_reqState = LSAPI_ST_REQ_HEADER; packetLen = verifyHeader( &pReq->m_pHeader->m_pktHeader, LSAPI_BEGIN_REQUEST ); - if ( packetLen < 0 ) { + if ( packetLen < 0 ) + { + fprintf( stderr, "%d: packetLen < 0\n", getpid() ); return -1; } - if ( packetLen > LSAPI_MAX_HEADER_LEN ) { + if ( packetLen > LSAPI_MAX_HEADER_LEN ) + { + fprintf( stderr, "%d: packetLen > %d\n", getpid(), LSAPI_MAX_HEADER_LEN ); return -1; } - if ( packetLen + 1024 > pReq->m_reqBufSize ) { - if ( allocateBuf( pReq, packetLen + 1024 ) == -1 ) { + if ( packetLen + 1024 > pReq->m_reqBufSize ) + { + if ( allocateBuf( pReq, packetLen + 1024 ) == -1 ) return -1; - } } - while( packetLen > pReq->m_bufRead ) { + while( packetLen > pReq->m_bufRead ) + { len = lsapi_read( pReq->m_fd, pReq->m_pReqBuf + pReq->m_bufRead, packetLen - pReq->m_bufRead ); - if ( len <= 0 ) { + if ( len <= 0 ) return -1; - } pReq->m_bufRead += len; } - if ( parseRequest( pReq, packetLen ) < 0 ) { + if ( parseRequest( pReq, packetLen ) < 0 ) + { + fprintf( stderr, "%d: parseRequest error\n", getpid() ); return -1; } - pReq->m_bufProcessed = packetLen; + pReq->m_reqState = LSAPI_ST_REQ_BODY | LSAPI_ST_RESP_HEADER; - return notify_req_received( pReq ); + if ( !s_uid ) + if ( lsapi_changeUGid( pReq ) ) + return -1; + pReq->m_bufProcessed = packetLen; + + //OPTIMIZATION + if ( !s_accept_notify && !s_notified_pid ) + return notify_req_received( pReq->m_fd ); + else + { + s_notified_pid = 0; + return 0; + } } int LSAPI_Init(void) { - if ( !g_inited ) { + if ( !g_inited ) + { + s_uid = geteuid(); + s_pSecret[0] = 0; lsapi_signal(SIGPIPE, lsapi_sigpipe); lsapi_signal(SIGUSR1, lsapi_siguser1); @@ -583,11 +1190,9 @@ int LSAPI_Init(void) #endif /* let STDOUT function as STDERR, just in case writing to STDOUT directly */ - dup2( 2, 1 ); - - if ( LSAPI_InitRequest( &g_req, LSAPI_SOCK_FILENO ) == -1 ) { + dup2( 2, 1 ); + if ( LSAPI_InitRequest( &g_req, LSAPI_SOCK_FILENO ) == -1 ) return -1; - } g_inited = 1; s_ppid = getppid(); } @@ -606,28 +1211,27 @@ int LSAPI_IsRunning(void) int LSAPI_InitRequest( LSAPI_Request * pReq, int fd ) { - if ( !pReq ) { + if ( !pReq ) return -1; - } memset( pReq, 0, sizeof( LSAPI_Request ) ); - if ( allocateIovec( pReq, 16 ) == -1 ) { + if ( allocateIovec( pReq, 16 ) == -1 ) return -1; - } pReq->m_pRespBuf = pReq->m_pRespBufPos = (char *)malloc( LSAPI_RESP_BUF_SIZE ); - if ( !pReq->m_pRespBuf ) { + if ( !pReq->m_pRespBuf ) return -1; - } pReq->m_pRespBufEnd = pReq->m_pRespBuf + LSAPI_RESP_BUF_SIZE; pReq->m_pIovecCur = pReq->m_pIovecToWrite = pReq->m_pIovec + 1; pReq->m_respPktHeaderEnd = &pReq->m_respPktHeader[5]; - if ( allocateRespHeaderBuf( pReq, LSAPI_INIT_RESP_HEADER_LEN ) == -1 ) { + if ( allocateRespHeaderBuf( pReq, LSAPI_INIT_RESP_HEADER_LEN ) == -1 ) return -1; - } - if ( isPipe( fd ) ) { + if ( isPipe( fd ) ) + { pReq->m_fdListen = -1; pReq->m_fd = fd; - } else { + } + else + { pReq->m_fdListen = fd; pReq->m_fd = -1; lsapi_set_nblock( fd, 1 ); @@ -653,38 +1257,48 @@ int LSAPI_Accept_r( LSAPI_Request * pReq ) socklen_t len; int nodelay = 1; - if ( !pReq ) { + if ( !pReq ) return -1; - } - if ( LSAPI_Finish_r( pReq ) == -1 ) { + if ( LSAPI_Finish_r( pReq ) == -1 ) return -1; - } - while( g_running ) { - if ( pReq->m_fd == -1 ) { - if ( pReq->m_fdListen != -1) { + lsapi_set_nblock( pReq->m_fdListen , 0 ); + while( g_running ) + { + if ( pReq->m_fd == -1 ) + { + if ( pReq->m_fdListen != -1) + { len = sizeof( achPeer ); pReq->m_fd = accept( pReq->m_fdListen, (struct sockaddr *)&achPeer, &len ); - if ( pReq->m_fd == -1 ) { - if (( errno == EINTR )||( errno == EAGAIN)) { + if ( pReq->m_fd == -1 ) + { + if (( errno == EINTR )||( errno == EAGAIN)) continue; - } else { + else return -1; - } - } else { + } + else + { lsapi_set_nblock( pReq->m_fd , 0 ); - if (((struct sockaddr *)&achPeer)->sa_family == AF_INET ) { + if (((struct sockaddr *)&achPeer)->sa_family == AF_INET ) + { setsockopt(pReq->m_fd, IPPROTO_TCP, TCP_NODELAY, - (char *)&nodelay, sizeof(nodelay)); + (char *)&nodelay, sizeof(nodelay)); } + //init_conn_key( pReq->m_fd ); + //OPTIMIZATION + if ( s_accept_notify ) + if ( notify_req_received( pReq->m_fd ) == -1 ) + return -1; } - } else { - return -1; } + else + return -1; } - if ( !readReq( pReq ) ) { + if ( !readReq( pReq ) ) break; - } + //abort(); lsapi_close( pReq->m_fd ); pReq->m_fd = -1; LSAPI_Reset_r( pReq ); @@ -698,15 +1312,18 @@ static struct lsapi_packet_header finish = {'L', 'S', int LSAPI_Finish_r( LSAPI_Request * pReq ) { /* finish req body */ - if ( !pReq ) { + if ( !pReq ) return -1; - } - if (pReq->m_reqState) { - if ( pReq->m_fd != -1 ) { - if ( pReq->m_reqState & LSAPI_ST_RESP_HEADER ) { + if (pReq->m_reqState) + { + if ( pReq->m_fd != -1 ) + { + if ( pReq->m_reqState & LSAPI_ST_RESP_HEADER ) + { LSAPI_FinalizeRespHeaders_r( pReq ); } - if ( pReq->m_pRespBufPos != pReq->m_pRespBuf ) { + if ( pReq->m_pRespBufPos != pReq->m_pRespBuf ) + { Flush_RespBuf_r( pReq ); } @@ -735,18 +1352,14 @@ void LSAPI_Reset_r( LSAPI_Request * pReq ) int LSAPI_Release_r( LSAPI_Request * pReq ) { - if ( pReq->m_pReqBuf ) { + if ( pReq->m_pReqBuf ) free( pReq->m_pReqBuf ); - } - if ( pReq->m_pSpecialEnvList ) { + if ( pReq->m_pSpecialEnvList ) free( pReq->m_pSpecialEnvList ); - } - if ( pReq->m_pEnvList ) { + if ( pReq->m_pEnvList ) free( pReq->m_pEnvList ); - } - if ( pReq->m_pRespHeaderBuf ) { + if ( pReq->m_pRespHeaderBuf ) free( pReq->m_pRespHeaderBuf ); - } return 0; } @@ -754,55 +1367,48 @@ int LSAPI_Release_r( LSAPI_Request * pReq ) char * LSAPI_GetHeader_r( LSAPI_Request * pReq, int headerIndex ) { int off; - if ( !pReq || ((unsigned int)headerIndex > H_TRANSFER_ENCODING) ) { + if ( !pReq || ((unsigned int)headerIndex > H_TRANSFER_ENCODING) ) return NULL; - } off = pReq->m_pHeaderIndex->m_headerOff[ headerIndex ]; - if ( !off ) { + if ( !off ) return NULL; - } - if ( *(pReq->m_pHttpHeader + off + - pReq->m_pHeaderIndex->m_headerLen[ headerIndex ]) ) { - *( pReq->m_pHttpHeader + off + - pReq->m_pHeaderIndex->m_headerLen[ headerIndex ]) = 0; - } + if ( *(pReq->m_pHttpHeader + off + + pReq->m_pHeaderIndex->m_headerLen[ headerIndex ]) ) + *( pReq->m_pHttpHeader + off + + pReq->m_pHeaderIndex->m_headerLen[ headerIndex ]) = 0; return pReq->m_pHttpHeader + off; } static int readBodyToReqBuf( LSAPI_Request * pReq ) { - int bodyLeft; - int len = pReq->m_bufRead - pReq->m_bufProcessed; - if ( len > 0 ) { + off_t bodyLeft; + ssize_t len = pReq->m_bufRead - pReq->m_bufProcessed; + if ( len > 0 ) return len; - } pReq->m_bufRead = pReq->m_bufProcessed = pReq->m_pHeader->m_pktHeader.m_packetLen.m_iLen; - bodyLeft = pReq->m_pHeader->m_reqBodyLen - pReq->m_reqBodyRead; + bodyLeft = pReq->m_reqBodyLen - pReq->m_reqBodyRead; len = pReq->m_reqBufSize - pReq->m_bufRead; - if ( len < 0 ) { + if ( len < 0 ) return -1; - } - if ( len > bodyLeft ) { + if ( len > bodyLeft ) len = bodyLeft; - } + len = lsapi_read( pReq->m_fd, pReq->m_pReqBuf + pReq->m_bufRead, len ); - if ( len > 0 ) { + if ( len > 0 ) pReq->m_bufRead += len; - } return len; } int LSAPI_ReqBodyGetChar_r( LSAPI_Request * pReq ) { - if (!pReq || (pReq->m_fd ==-1) ) { + if (!pReq || (pReq->m_fd ==-1) ) return EOF; - } - if ( pReq->m_bufProcessed >= pReq->m_bufRead ) { - if ( readBodyToReqBuf( pReq ) <= 0 ) { + if ( pReq->m_bufProcessed >= pReq->m_bufRead ) + { + if ( readBodyToReqBuf( pReq ) <= 0 ) return EOF; - } } ++pReq->m_reqBodyRead; return (unsigned char)*(pReq->m_pReqBuf + pReq->m_bufProcessed++); @@ -810,42 +1416,43 @@ int LSAPI_ReqBodyGetChar_r( LSAPI_Request * pReq ) -int LSAPI_ReqBodyGetLine_r( LSAPI_Request * pReq, char * pBuf, int bufLen, int *getLF ) +int LSAPI_ReqBodyGetLine_r( LSAPI_Request * pReq, char * pBuf, size_t bufLen, int *getLF ) { - int len; - int left; + ssize_t len; + ssize_t left; char * pBufEnd = pBuf + bufLen - 1; char * pBufCur = pBuf; char * pCur; char * p; - if (!pReq || (pReq->m_fd ==-1) ||( !pBuf )||(bufLen < 0 )|| !getLF ) { + if (!pReq || (pReq->m_fd ==-1) ||( !pBuf )||(bufLen < 0 )|| !getLF ) return -1; - } *getLF = 0; - while( (left = pBufEnd - pBufCur ) > 0 ) { + while( (left = pBufEnd - pBufCur ) > 0 ) + { len = pReq->m_bufRead - pReq->m_bufProcessed; - if ( len <= 0 ) { - if ( (len = readBodyToReqBuf( pReq )) <= 0 ) { + if ( len <= 0 ) + { + if ( (len = readBodyToReqBuf( pReq )) <= 0 ) + { *getLF = 1; break; } } - if ( len > left ) { + if ( len > left ) len = left; - } pCur = pReq->m_pReqBuf + pReq->m_bufProcessed; p = memchr( pCur, '\n', len ); - if ( p ) { + if ( p ) len = p - pCur + 1; - } memmove( pBufCur, pCur, len ); pBufCur += len; pReq->m_bufProcessed += len; pReq->m_reqBodyRead += len; - if ( p ) { + if ( p ) + { *getLF = 1; break; } @@ -856,48 +1463,47 @@ int LSAPI_ReqBodyGetLine_r( LSAPI_Request * pReq, char * pBuf, int bufLen, int * } -int LSAPI_ReadReqBody_r( LSAPI_Request * pReq, char * pBuf, int bufLen ) +ssize_t LSAPI_ReadReqBody_r( LSAPI_Request * pReq, char * pBuf, size_t bufLen ) { - int len; - int total; + ssize_t len; + off_t total; /* char *pOldBuf = pBuf; */ - if (!pReq || (pReq->m_fd ==-1) || ( !pBuf )||(bufLen < 0 )) { + if (!pReq || (pReq->m_fd ==-1) || ( !pBuf )||(bufLen < 0 )) return -1; - } - total = pReq->m_pHeader->m_reqBodyLen - pReq->m_reqBodyRead; + + total = pReq->m_reqBodyLen - pReq->m_reqBodyRead; - if ( total <= 0 ) { + if ( total <= 0 ) return 0; - } - if ( total < bufLen ) { + if ( total < bufLen ) bufLen = total; - } total = 0; len = pReq->m_bufRead - pReq->m_bufProcessed; - if ( len > 0 ) { - if ( len > bufLen ) { + if ( len > 0 ) + { + if ( len > bufLen ) len = bufLen; - } memmove( pBuf, pReq->m_pReqBuf + pReq->m_bufProcessed, len ); pReq->m_bufProcessed += len; total += len; pBuf += len; bufLen -= len; } - while( bufLen > 0 ) { + while( bufLen > 0 ) + { len = lsapi_read( pReq->m_fd, pBuf, bufLen ); - if ( len > 0 ) { + if ( len > 0 ) + { total += len; pBuf += len; bufLen -= len; - } else { - if ( len <= 0 ) { - if ( !total) { - return -1; - } - break; - } + } + else if ( len <= 0 ) + { + if ( !total) + return -1; + break; } } pReq->m_reqBodyRead += total; @@ -906,37 +1512,52 @@ int LSAPI_ReadReqBody_r( LSAPI_Request * pReq, char * pBuf, int bufLen ) } -int LSAPI_Write_r( LSAPI_Request * pReq, const char * pBuf, int len ) +ssize_t LSAPI_Write_r( LSAPI_Request * pReq, const char * pBuf, size_t len ) { struct lsapi_packet_header * pHeader; const char * pEnd; const char * p; - int bufLen; - int toWrite; - int packetLen; + ssize_t bufLen; + ssize_t toWrite; + ssize_t packetLen; + int skip = 0; - if ( !pReq || !pBuf || (pReq->m_fd == -1) ) { + if ( !pReq || !pBuf || (pReq->m_fd == -1) ) return -1; + if ( pReq->m_reqState & LSAPI_ST_RESP_HEADER ) + { + LSAPI_FinalizeRespHeaders_r( pReq ); +/* + if ( *pBuf == '\r' ) + { + ++skip; + } + if ( *pBuf == '\n' ) + { + ++skip; + } +*/ } - if ( len < pReq->m_pRespBufEnd - pReq->m_pRespBufPos ) { - memmove( pReq->m_pRespBufPos, pBuf, len ); - pReq->m_pRespBufPos += len; + pReq->m_reqState |= LSAPI_ST_RESP_BODY; + + if ( (len - skip) < pReq->m_pRespBufEnd - pReq->m_pRespBufPos ) + { + memmove( pReq->m_pRespBufPos, pBuf + skip, len - skip ); + pReq->m_pRespBufPos += len - skip; return len; } - if ( pReq->m_reqState & LSAPI_ST_RESP_HEADER ) { - LSAPI_FinalizeRespHeaders_r( pReq ); - } - pReq->m_reqState |= LSAPI_ST_RESP_BODY; pHeader = pReq->m_respPktHeader; - p = pBuf; + p = pBuf + skip; pEnd = pBuf + len; bufLen = pReq->m_pRespBufPos - pReq->m_pRespBuf; - while( ( toWrite = pEnd - p ) > 0 ) { + while( ( toWrite = pEnd - p ) > 0 ) + { packetLen = toWrite + bufLen; - if ( LSAPI_MAX_DATA_PACKET_LEN < packetLen) { + if ( LSAPI_MAX_DATA_PACKET_LEN < packetLen) + { packetLen = LSAPI_MAX_DATA_PACKET_LEN; toWrite = packetLen - bufLen; } @@ -949,7 +1570,8 @@ int LSAPI_Write_r( LSAPI_Request * pReq, const char * pBuf, int len ) pReq->m_pIovecCur->iov_len = LSAPI_PACKET_HEADER_LEN; ++pReq->m_pIovecCur; ++pHeader; - if ( bufLen > 0 ) { + if ( bufLen > 0 ) + { pReq->m_pIovecCur->iov_base = (void *)pReq->m_pRespBuf; pReq->m_pIovecCur->iov_len = bufLen; pReq->m_pRespBufPos = pReq->m_pRespBuf; @@ -962,21 +1584,108 @@ int LSAPI_Write_r( LSAPI_Request * pReq, const char * pBuf, int len ) ++pReq->m_pIovecCur; p += toWrite; - if ( pHeader >= pReq->m_respPktHeaderEnd - 1) { - if ( LSAPI_Flush_r( pReq ) == -1 ) { + if ( pHeader >= pReq->m_respPktHeaderEnd - 1) + { + if ( LSAPI_Flush_r( pReq ) == -1 ) return -1; - } pHeader = pReq->m_respPktHeader; } } - if ( pHeader != pReq->m_respPktHeader ) { - if ( LSAPI_Flush_r( pReq ) == -1 ) { + if ( pHeader != pReq->m_respPktHeader ) + if ( LSAPI_Flush_r( pReq ) == -1 ) return -1; - } - } return p - pBuf; } +#if defined(__FreeBSD__ ) || defined(__NetBSD__) || defined(__OpenBSD__) +ssize_t gsendfile( int fdOut, int fdIn, off_t* off, size_t size ) +{ + ssize_t ret; + off_t written; + ret = sendfile( fdIn, fdOut, *off, size, NULL, &written, 0 ); + if ( written > 0 ) + { + ret = written; + *off += ret; + } + return ret; +} +#endif + +#if defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) +ssize_t gsendfile( int fdOut, int fdIn, off_t* off, size_t size ) +{ + ssize_t ret; + off_t len = size; + ret = sendfile( fdIn, fdOut, *off, &len, NULL, 0 ); + if (( ret == 0 )&&( len > 0 )) + { + ret = len; + *off += len; + } + return ret; +} +#endif + +#if defined(sun) || defined(__sun) +#include +ssize_t gsendfile( int fdOut, int fdIn, off_t *off, size_t size ) +{ + int n = 0 ; + sendfilevec_t vec[1]; + + vec[n].sfv_fd = fdIn; + vec[n].sfv_flag = 0; + vec[n].sfv_off = *off; + vec[n].sfv_len = size; + ++n; + + size_t written; + ssize_t ret = sendfilev( fdOut, vec, n, &written ); + if (( !ret )||( errno == EAGAIN )) + ret = written; + if ( ret > 0 ) + *off += ret; + return ret; +} +#endif + +#if defined(linux) || defined(__linux) || defined(__linux__) || \ + defined(__gnu_linux__) +#include +#define gsendfile sendfile +#endif +#if defined(HPUX) +ssize_t gsendfile( int fdOut, int fdIn, off_t * off, size_t size ) +{ + return sendfile( fdOut, fdIn, off, size, NULL, 0 ); +} +#endif + +ssize_t LSAPI_sendfile_r( LSAPI_Request * pReq, int fdIn, off_t* off, size_t size ) +{ + struct lsapi_packet_header * pHeader = pReq->m_respPktHeader; + if ( !pReq || (pReq->m_fd == -1) || fdIn == -1 ) + return -1; + if ( pReq->m_reqState & LSAPI_ST_RESP_HEADER ) + { + LSAPI_FinalizeRespHeaders_r( pReq ); + } + pReq->m_reqState |= LSAPI_ST_RESP_BODY; + + LSAPI_Flush_r(pReq); + + lsapi_buildPacketHeader( pHeader, LSAPI_RESP_STREAM, + size + LSAPI_PACKET_HEADER_LEN ); + + + if (write(pReq->m_fd, (const char *) pHeader, LSAPI_PACKET_HEADER_LEN ) != LSAPI_PACKET_HEADER_LEN) + return -1; + + return gsendfile( pReq->m_fd, fdIn, off, size ); +} + + void Flush_RespBuf_r( LSAPI_Request * pReq ) { struct lsapi_packet_header * pHeader = pReq->m_respPktHeader; @@ -990,7 +1699,8 @@ void Flush_RespBuf_r( LSAPI_Request * pReq ) pReq->m_pIovecCur->iov_len = LSAPI_PACKET_HEADER_LEN; ++pReq->m_pIovecCur; ++pHeader; - if ( bufLen > 0 ) { + if ( bufLen > 0 ) + { pReq->m_pIovecCur->iov_base = (void *)pReq->m_pRespBuf; pReq->m_pIovecCur->iov_len = bufLen; pReq->m_pRespBufPos = pReq->m_pRespBuf; @@ -1006,32 +1716,35 @@ int LSAPI_Flush_r( LSAPI_Request * pReq ) { int ret = 0; int n; - if ( !pReq ) { + if ( !pReq ) return -1; - } n = pReq->m_pIovecCur - pReq->m_pIovecToWrite; - if (( 0 == n )&&( pReq->m_pRespBufPos == pReq->m_pRespBuf )) { + if (( 0 == n )&&( pReq->m_pRespBufPos == pReq->m_pRespBuf )) return 0; - } - if ( pReq->m_fd == -1 ) { + if ( pReq->m_fd == -1 ) + { pReq->m_pRespBufPos = pReq->m_pRespBuf; pReq->m_totalLen = 0; pReq->m_pIovecCur = pReq->m_pIovecToWrite = pReq->m_pIovec; return -1; } - if ( pReq->m_reqState & LSAPI_ST_RESP_HEADER ) { + if ( pReq->m_reqState & LSAPI_ST_RESP_HEADER ) + { LSAPI_FinalizeRespHeaders_r( pReq ); } - if ( pReq->m_pRespBufPos != pReq->m_pRespBuf ) { + if ( pReq->m_pRespBufPos != pReq->m_pRespBuf ) + { Flush_RespBuf_r( pReq ); } n = pReq->m_pIovecCur - pReq->m_pIovecToWrite; - if ( n > 0 ) { + if ( n > 0 ) + { ret = lsapi_writev( pReq->m_fd, &pReq->m_pIovecToWrite, n, pReq->m_totalLen ); - if ( ret < pReq->m_totalLen ) { + if ( ret < pReq->m_totalLen ) + { lsapi_close( pReq->m_fd ); pReq->m_fd = -1; ret = -1; @@ -1043,32 +1756,33 @@ int LSAPI_Flush_r( LSAPI_Request * pReq ) } -int LSAPI_Write_Stderr_r( LSAPI_Request * pReq, const char * pBuf, int len ) +ssize_t LSAPI_Write_Stderr_r( LSAPI_Request * pReq, const char * pBuf, size_t len ) { struct lsapi_packet_header header; const char * pEnd; const char * p; - int packetLen; - int totalLen; + ssize_t packetLen; + ssize_t totalLen; int ret; struct iovec iov[2]; struct iovec *pIov; - if ( !pReq ) { + if ( !pReq ) return -1; - } - if (( pReq->m_fd == -1 )||(pReq->m_fd == pReq->m_fdListen )) { + if (( pReq->m_fd == -1 )||(pReq->m_fd == pReq->m_fdListen )) return write( 2, pBuf, len ); - } - if ( pReq->m_pRespBufPos != pReq->m_pRespBuf ) { + if ( pReq->m_pRespBufPos != pReq->m_pRespBuf ) + { LSAPI_Flush_r( pReq ); } p = pBuf; pEnd = pBuf + len; - while( ( packetLen = pEnd - p ) > 0 ) { - if ( LSAPI_MAX_DATA_PACKET_LEN < packetLen) { + while( ( packetLen = pEnd - p ) > 0 ) + { + if ( LSAPI_MAX_DATA_PACKET_LEN < packetLen) + { packetLen = LSAPI_MAX_DATA_PACKET_LEN; } @@ -1085,7 +1799,8 @@ int LSAPI_Write_Stderr_r( LSAPI_Request * pReq, const char * pBuf, int len ) pIov = iov; ret = lsapi_writev( pReq->m_fd, &pIov, 2, totalLen ); - if ( ret < totalLen ) { + if ( ret < totalLen ) + { lsapi_close( pReq->m_fd ); pReq->m_fd = -1; ret = -1; @@ -1097,14 +1812,16 @@ int LSAPI_Write_Stderr_r( LSAPI_Request * pReq, const char * pBuf, int len ) static char * GetHeaderVar( LSAPI_Request * pReq, const char * name ) { int i; - for( i = 0; i < H_TRANSFER_ENCODING; ++i ) { - if ( pReq->m_pHeaderIndex->m_headerOff[i] ) { - if ( strcmp( name, CGI_HEADERS[i] ) == 0 ) { + for( i = 0; i < H_TRANSFER_ENCODING; ++i ) + { + if ( pReq->m_pHeaderIndex->m_headerOff[i] ) + { + if ( strcmp( name, CGI_HEADERS[i] ) == 0 ) return pReq->m_pHttpHeader + pReq->m_pHeaderIndex->m_headerOff[i]; - } } } - if ( pReq->m_pHeader->m_cntUnknownHeaders > 0 ) { + if ( pReq->m_pHeader->m_cntUnknownHeaders > 0 ) + { const char *p; char *pKey; char *pKeyEnd; @@ -1112,22 +1829,22 @@ static char * GetHeaderVar( LSAPI_Request * pReq, const char * name ) struct lsapi_header_offset * pCur, *pEnd; pCur = pReq->m_pUnknownHeader; pEnd = pCur + pReq->m_pHeader->m_cntUnknownHeaders; - while( pCur < pEnd ) { + while( pCur < pEnd ) + { pKey = pReq->m_pHttpHeader + pCur->nameOff; keyLen = pCur->nameLen; pKeyEnd = pKey + keyLen; p = &name[5]; - while(( pKey < pKeyEnd )&&( *p )) { + while(( pKey < pKeyEnd )&&( *p )) + { char ch = toupper( *pKey ); - if ((ch != *p )||(( *p == '_' )&&( ch != '-'))) { + if ((ch != *p )||(( *p == '_' )&&( ch != '-'))) break; - } ++p; ++pKey; } - if (( pKey == pKeyEnd )&& (!*p )) { + if (( pKey == pKeyEnd )&& (!*p )) return pReq->m_pHttpHeader + pCur->valueOff; - } ++pCur; } } @@ -1139,21 +1856,35 @@ char * LSAPI_GetEnv_r( LSAPI_Request * pReq, const char * name ) { struct LSAPI_key_value_pair * pBegin = pReq->m_pEnvList; struct LSAPI_key_value_pair * pEnd = pBegin + pReq->m_pHeader->m_cntEnv; - if ( !pReq || !name ) { + if ( !pReq || !name ) return NULL; - } - if ( strncmp( name, "HTTP_", 5 ) == 0 ) { + if ( strncmp( name, "HTTP_", 5 ) == 0 ) + { return GetHeaderVar( pReq, name ); } - while( pBegin < pEnd ) { - if ( strcmp( name, pBegin->pKey ) == 0 ) { + while( pBegin < pEnd ) + { + if ( strcmp( name, pBegin->pKey ) == 0 ) return pBegin->pValue; - } ++pBegin; } return NULL; } +struct _headerInfo +{ + const char * _name; + int _nameLen; + const char * _value; + int _valueLen; +}; + +int compareValueLocation(const void * v1, const void *v2 ) +{ + return ((const struct _headerInfo *)v1)->_value - + ((const struct _headerInfo *)v2)->_value; +} + int LSAPI_ForeachOrgHeader_r( LSAPI_Request * pReq, LSAPI_CB_EnvHandler fn, void * arg ) { @@ -1162,43 +1893,66 @@ int LSAPI_ForeachOrgHeader_r( LSAPI_Request * pReq, char * pValue; int ret; int count = 0; - if ( !pReq || !fn ) { + struct _headerInfo headers[512]; + if ( !pReq || !fn ) return -1; - } - for( i = 0; i < H_TRANSFER_ENCODING; ++i ) { - if ( pReq->m_pHeaderIndex->m_headerOff[i] ) { + + for( i = 0; i < H_TRANSFER_ENCODING; ++i ) + { + if ( pReq->m_pHeaderIndex->m_headerOff[i] ) + { len = pReq->m_pHeaderIndex->m_headerLen[i]; pValue = pReq->m_pHttpHeader + pReq->m_pHeaderIndex->m_headerOff[i]; *(pValue + len ) = 0; - ret = (*fn)( HTTP_HEADERS[i], HTTP_HEADER_LEN[i], - pValue, len, arg ); + headers[count]._name = HTTP_HEADERS[i]; + headers[count]._nameLen = HTTP_HEADER_LEN[i]; + headers[count]._value = pValue; + headers[count]._valueLen = len; ++count; - if ( ret <= 0 ) { - return ret; - } + + //ret = (*fn)( HTTP_HEADERS[i], HTTP_HEADER_LEN[i], + // pValue, len, arg ); + //if ( ret <= 0 ) + // return ret; } } - if ( pReq->m_pHeader->m_cntUnknownHeaders > 0 ) { + if ( pReq->m_pHeader->m_cntUnknownHeaders > 0 ) + { char *pKey; int keyLen; struct lsapi_header_offset * pCur, *pEnd; pCur = pReq->m_pUnknownHeader; pEnd = pCur + pReq->m_pHeader->m_cntUnknownHeaders; - while( pCur < pEnd ) { + while( pCur < pEnd ) + { pKey = pReq->m_pHttpHeader + pCur->nameOff; keyLen = pCur->nameLen; pValue = pReq->m_pHttpHeader + pCur->valueOff; *(pValue + pCur->valueLen ) = 0; - ret = (*fn)( pKey, keyLen, - pValue, pCur->valueLen, arg ); - if ( ret <= 0 ) { - return ret; - } + headers[count]._name = pKey; + headers[count]._nameLen = keyLen; + headers[count]._value = pValue; + headers[count]._valueLen = pCur->valueLen; + ++count; + if ( count == 512 ) + break; + //ret = (*fn)( pKey, keyLen, + // pValue, pCur->valueLen, arg ); + //if ( ret <= 0 ) + // return ret; ++pCur; } } - return count + pReq->m_pHeader->m_cntUnknownHeaders; + qsort( headers, count, sizeof( struct _headerInfo ), compareValueLocation ); + for( i = 0; i < count; ++i ) + { + ret = (*fn)( headers[i]._name, headers[i]._nameLen, + headers[i]._value, headers[i]._valueLen, arg ); + if ( ret <= 0 ) + return ret; + } + return count; } @@ -1211,23 +1965,24 @@ int LSAPI_ForeachHeader_r( LSAPI_Request * pReq, char * pValue; int ret; int count = 0; - if ( !pReq || !fn ) { + if ( !pReq || !fn ) return -1; - } - for( i = 0; i < H_TRANSFER_ENCODING; ++i ) { - if ( pReq->m_pHeaderIndex->m_headerOff[i] ) { + for( i = 0; i < H_TRANSFER_ENCODING; ++i ) + { + if ( pReq->m_pHeaderIndex->m_headerOff[i] ) + { len = pReq->m_pHeaderIndex->m_headerLen[i]; pValue = pReq->m_pHttpHeader + pReq->m_pHeaderIndex->m_headerOff[i]; *(pValue + len ) = 0; ret = (*fn)( CGI_HEADERS[i], CGI_HEADER_LEN[i], pValue, len, arg ); ++count; - if ( ret <= 0 ) { + if ( ret <= 0 ) return ret; - } } } - if ( pReq->m_pHeader->m_cntUnknownHeaders > 0 ) { + if ( pReq->m_pHeader->m_cntUnknownHeaders > 0 ) + { char achHeaderName[256]; char *p; char *pKey; @@ -1236,23 +1991,23 @@ int LSAPI_ForeachHeader_r( LSAPI_Request * pReq, struct lsapi_header_offset * pCur, *pEnd; pCur = pReq->m_pUnknownHeader; pEnd = pCur + pReq->m_pHeader->m_cntUnknownHeaders; - while( pCur < pEnd ) { + while( pCur < pEnd ) + { pKey = pReq->m_pHttpHeader + pCur->nameOff; keyLen = pCur->nameLen; + if ( keyLen > 250 ) + keyLen = 250; pKeyEnd = pKey + keyLen; memcpy( achHeaderName, "HTTP_", 5 ); p = &achHeaderName[5]; - if ( keyLen > 250 ) { - keyLen = 250; - } - while( pKey < pKeyEnd ) { + while( pKey < pKeyEnd ) + { char ch = *pKey++; - if ( ch == '-' ) { + if ( ch == '-' ) *p++ = '_'; - } else { + else *p++ = toupper( ch ); - } } *p = 0; keyLen += 5; @@ -1261,9 +2016,8 @@ int LSAPI_ForeachHeader_r( LSAPI_Request * pReq, *(pValue + pCur->valueLen ) = 0; ret = (*fn)( achHeaderName, keyLen, pValue, pCur->valueLen, arg ); - if ( ret <= 0 ) { + if ( ret <= 0 ) return ret; - } ++pCur; } } @@ -1276,15 +2030,14 @@ static int EnvForeach( struct LSAPI_key_value_pair * pEnv, { struct LSAPI_key_value_pair * pEnd = pEnv + n; int ret; - if ( !pEnv || !fn ) { + if ( !pEnv || !fn ) return -1; - } - while( pEnv < pEnd ) { + while( pEnv < pEnd ) + { ret = (*fn)( pEnv->pKey, pEnv->keyLen, pEnv->pValue, pEnv->valLen, arg ); - if ( ret <= 0 ) { + if ( ret <= 0 ) return ret; - } ++pEnv; } return n; @@ -1295,10 +2048,10 @@ static int EnvForeach( struct LSAPI_key_value_pair * pEnv, int LSAPI_ForeachEnv_r( LSAPI_Request * pReq, LSAPI_CB_EnvHandler fn, void * arg ) { - if ( !pReq || !fn ) { + if ( !pReq || !fn ) return -1; - } - if ( pReq->m_pHeader->m_cntEnv > 0 ) { + if ( pReq->m_pHeader->m_cntEnv > 0 ) + { return EnvForeach( pReq->m_pEnvList, pReq->m_pHeader->m_cntEnv, fn, arg ); } @@ -1310,10 +2063,10 @@ int LSAPI_ForeachEnv_r( LSAPI_Request * pReq, int LSAPI_ForeachSpecialEnv_r( LSAPI_Request * pReq, LSAPI_CB_EnvHandler fn, void * arg ) { - if ( !pReq || !fn ) { + if ( !pReq || !fn ) return -1; - } - if ( pReq->m_pHeader->m_cntSpecialEnv > 0 ) { + if ( pReq->m_pHeader->m_cntSpecialEnv > 0 ) + { return EnvForeach( pReq->m_pSpecialEnvList, pReq->m_pHeader->m_cntSpecialEnv, fn, arg ); @@ -1326,14 +2079,13 @@ int LSAPI_ForeachSpecialEnv_r( LSAPI_Request * pReq, int LSAPI_FinalizeRespHeaders_r( LSAPI_Request * pReq ) { - if ( !pReq || !pReq->m_pIovec ) { + if ( !pReq || !pReq->m_pIovec ) return -1; - } - if ( !( pReq->m_reqState & LSAPI_ST_RESP_HEADER ) ) { + if ( !( pReq->m_reqState & LSAPI_ST_RESP_HEADER ) ) return 0; - } pReq->m_reqState &= ~LSAPI_ST_RESP_HEADER; - if ( pReq->m_pRespHeaderBufPos > pReq->m_pRespHeaderBuf ) { + if ( pReq->m_pRespHeaderBufPos > pReq->m_pRespHeaderBuf ) + { pReq->m_pIovecCur->iov_base = (void *)pReq->m_pRespHeaderBuf; pReq->m_pIovecCur->iov_len = pReq->m_pRespHeaderBufPos - pReq->m_pRespHeaderBuf; pReq->m_totalLen += pReq->m_pIovecCur->iov_len; @@ -1352,25 +2104,87 @@ int LSAPI_FinalizeRespHeaders_r( LSAPI_Request * pReq ) } - - -int LSAPI_AppendRespHeader_r( LSAPI_Request * pReq, char * pBuf, int len ) +int LSAPI_AppendRespHeader2_r( LSAPI_Request * pReq, const char * pHeaderName, + const char * pHeaderValue ) { - if ( !pReq || !pBuf || len <= 0 || len > LSAPI_RESP_HTTP_HEADER_MAX ) { + int nameLen, valLen, len; + if ( !pReq || !pHeaderName || !pHeaderValue ) + return -1; + if ( pReq->m_reqState & LSAPI_ST_RESP_BODY ) + return -1; + if ( pReq->m_respHeader.m_respInfo.m_cntHeaders >= LSAPI_MAX_RESP_HEADERS ) + return -1; + nameLen = strlen( pHeaderName ); + valLen = strlen( pHeaderValue ); + if ( nameLen == 0 ) return -1; + while( nameLen > 0 ) + { + char ch = *(pHeaderName + nameLen - 1 ); + if (( ch == '\n' )||( ch == '\r' )) + --nameLen; + else + break; + } + if ( nameLen <= 0 ) + return 0; + while( valLen > 0 ) + { + char ch = *(pHeaderValue + valLen - 1 ); + if (( ch == '\n' )||( ch == '\r' )) + --valLen; + else + break; } - if ( pReq->m_reqState & LSAPI_ST_RESP_BODY ) { + len = nameLen + valLen + 1; + if ( len > LSAPI_RESP_HTTP_HEADER_MAX ) return -1; + + if ( pReq->m_pRespHeaderBufPos + len + 1 > pReq->m_pRespHeaderBufEnd ) + { + int newlen = pReq->m_pRespHeaderBufPos + len + 4096 - pReq->m_pRespHeaderBuf; + newlen -= newlen % 4096; + if ( allocateRespHeaderBuf( pReq, newlen ) == -1 ) + return -1; } - if ( pReq->m_respHeader.m_respInfo.m_cntHeaders >= LSAPI_MAX_RESP_HEADERS ) { + memmove( pReq->m_pRespHeaderBufPos, pHeaderName, nameLen ); + pReq->m_pRespHeaderBufPos += nameLen; + *pReq->m_pRespHeaderBufPos++ = ':'; + memmove( pReq->m_pRespHeaderBufPos, pHeaderValue, valLen ); + pReq->m_pRespHeaderBufPos += valLen; + *pReq->m_pRespHeaderBufPos++ = 0; + ++len; /* add one byte padding for \0 */ + pReq->m_respHeaderLen[pReq->m_respHeader.m_respInfo.m_cntHeaders] = len; + ++pReq->m_respHeader.m_respInfo.m_cntHeaders; + return 0; +} + + + +int LSAPI_AppendRespHeader_r( LSAPI_Request * pReq, const char * pBuf, int len ) +{ + if ( !pReq || !pBuf || len <= 0 || len > LSAPI_RESP_HTTP_HEADER_MAX ) + return -1; + if ( pReq->m_reqState & LSAPI_ST_RESP_BODY ) return -1; + if ( pReq->m_respHeader.m_respInfo.m_cntHeaders >= LSAPI_MAX_RESP_HEADERS ) + return -1; + while( len > 0 ) + { + char ch = *(pBuf + len - 1 ); + if (( ch == '\n' )||( ch == '\r' )) + --len; + else + break; } - if ( pReq->m_pRespHeaderBufPos + len + 1 > pReq->m_pRespHeaderBufEnd ) { + if ( len <= 0 ) + return 0; + if ( pReq->m_pRespHeaderBufPos + len + 1 > pReq->m_pRespHeaderBufEnd ) + { int newlen = pReq->m_pRespHeaderBufPos + len + 4096 - pReq->m_pRespHeaderBuf; newlen -= newlen % 4096; - if ( allocateRespHeaderBuf( pReq, newlen ) == -1 ) { + if ( allocateRespHeaderBuf( pReq, newlen ) == -1 ) return -1; - } } memmove( pReq->m_pRespHeaderBufPos, pBuf, len ); pReq->m_pRespHeaderBufPos += len; @@ -1389,7 +2203,8 @@ int LSAPI_CreateListenSock2( const struct sockaddr * pServerAddr, int backlog ) int flag = 1; int addr_len; - switch( pServerAddr->sa_family ) { + switch( pServerAddr->sa_family ) + { case AF_INET: addr_len = 16; break; @@ -1405,20 +2220,20 @@ int LSAPI_CreateListenSock2( const struct sockaddr * pServerAddr, int backlog ) } fd = socket( pServerAddr->sa_family, SOCK_STREAM, 0 ); - if ( fd == -1 ) { + if ( fd == -1 ) return -1; - } fcntl( fd, F_SETFD, FD_CLOEXEC ); if(setsockopt( fd, SOL_SOCKET, SO_REUSEADDR, - (char *)( &flag ), sizeof(flag)) == 0) { + (char *)( &flag ), sizeof(flag)) == 0) + { ret = bind( fd, pServerAddr, addr_len ); - if ( !ret ) { + if ( !ret ) + { ret = listen( fd, backlog ); - if ( !ret ) { + if ( !ret ) return fd; - } } } @@ -1438,17 +2253,16 @@ int LSAPI_ParseSockAddr( const char * pBind, struct sockaddr * pAddr ) int doAddrInfo = 0; int port; - if ( !pBind ) { + if ( !pBind ) return -1; - } - while( isspace( *pBind ) ) { + while( isspace( *pBind ) ) ++pBind; - } strncpy( achAddr, pBind, 256 ); - switch( *p ) { + switch( *p ) + { case '/': pAddr->sa_family = AF_UNIX; strncpy( ((struct sockaddr_un *)pAddr)->sun_path, p, @@ -1463,7 +2277,8 @@ int LSAPI_ParseSockAddr( const char * pBind, struct sockaddr * pAddr ) return -1; *pEnd++ = 0; - if ( *p == '*' ) { + if ( *p == '*' ) + { strcpy( achAddr, "::" ); p = achAddr; } @@ -1473,35 +2288,35 @@ int LSAPI_ParseSockAddr( const char * pBind, struct sockaddr * pAddr ) default: pAddr->sa_family = AF_INET; pEnd = strchr( p, ':' ); - if ( !pEnd ) { + if ( !pEnd ) return -1; - } *pEnd++ = 0; doAddrInfo = 0; - if ( *p == '*' ) { + if ( *p == '*' ) + { ((struct sockaddr_in *)pAddr)->sin_addr.s_addr = htonl(INADDR_ANY); - } else { - if (!strcasecmp( p, "localhost" ) ) { - ((struct sockaddr_in *)pAddr)->sin_addr.s_addr = htonl( INADDR_LOOPBACK ); - } else { - ((struct sockaddr_in *)pAddr)->sin_addr.s_addr = inet_addr( p ); - if ( ((struct sockaddr_in *)pAddr)->sin_addr.s_addr == INADDR_BROADCAST) { - doAddrInfo = 1; - } + } + else if (!strcasecmp( p, "localhost" ) ) + ((struct sockaddr_in *)pAddr)->sin_addr.s_addr = htonl( INADDR_LOOPBACK ); + else + { + ((struct sockaddr_in *)pAddr)->sin_addr.s_addr = inet_addr( p ); + if ( ((struct sockaddr_in *)pAddr)->sin_addr.s_addr == INADDR_BROADCAST) + { + doAddrInfo = 1; } } break; } - if ( *pEnd == ':' ) { + if ( *pEnd == ':' ) ++pEnd; - } port = atoi( pEnd ); - if (( port <= 0 )||( port > 65535 )) { + if (( port <= 0 )||( port > 65535 )) return -1; - } - if ( doAddrInfo ) { + if ( doAddrInfo ) + { memset(&hints, 0, sizeof(hints)); @@ -1509,7 +2324,8 @@ int LSAPI_ParseSockAddr( const char * pBind, struct sockaddr * pAddr ) hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; - if ( getaddrinfo(p, NULL, &hints, &res) ) { + if ( getaddrinfo(p, NULL, &hints, &res) ) + { return -1; } @@ -1517,11 +2333,10 @@ int LSAPI_ParseSockAddr( const char * pBind, struct sockaddr * pAddr ) freeaddrinfo(res); } - if ( pAddr->sa_family == AF_INET ) { + if ( pAddr->sa_family == AF_INET ) ((struct sockaddr_in *)pAddr)->sin_port = htons( port ); - } else { + else ((struct sockaddr_in6 *)pAddr)->sin6_port = htons( port ); - } return 0; } @@ -1532,7 +2347,8 @@ int LSAPI_CreateListenSock( const char * pBind, int backlog ) int ret; int fd = -1; ret = LSAPI_ParseSockAddr( pBind, (struct sockaddr *)serverAddr ); - if ( !ret ) { + if ( !ret ) + { fd = LSAPI_CreateListenSock2( (struct sockaddr *)serverAddr, backlog ); } return fd; @@ -1543,9 +2359,11 @@ static fn_select_t g_fnSelect = select; typedef struct _lsapi_child_status { int m_pid; + long m_tmStart; volatile short m_iKillSent; volatile short m_inProcess; + volatile int m_iReqCounter; volatile long m_tmWaitBegin; volatile long m_tmReqBegin; @@ -1575,43 +2393,42 @@ static lsapi_prefork_server * g_prefork_server = NULL; int LSAPI_Init_Prefork_Server( int max_children, fn_select_t fp, int avoidFork ) { - if ( g_prefork_server ) { + int pid; + if ( g_prefork_server ) return 0; - } - if ( max_children <= 1 ) { + if ( max_children <= 1 ) return -1; - } - if ( max_children >= 10000) { + if ( max_children >= 10000) max_children = 10000; - } g_prefork_server = (lsapi_prefork_server *)malloc( sizeof( lsapi_prefork_server ) ); - if ( !g_prefork_server ) { + if ( !g_prefork_server ) return -1; - } memset( g_prefork_server, 0, sizeof( lsapi_prefork_server ) ); - if ( fp != NULL ) { + if ( fp != NULL ) g_fnSelect = fp; - } s_ppid = getppid(); + pid = getpid(); + setpgid( pid, pid ); g_prefork_server->m_iAvoidFork = avoidFork; g_prefork_server->m_iMaxChildren = max_children; g_prefork_server->m_iExtraChildren = ( avoidFork ) ? 0 : (max_children / 3) ; g_prefork_server->m_iMaxIdleChildren = ( avoidFork ) ? (max_children + 1) : (max_children / 3); + if ( g_prefork_server->m_iMaxIdleChildren == 0 ) + g_prefork_server->m_iMaxIdleChildren = 1; g_prefork_server->m_iChildrenMaxIdleTime = 300; - g_prefork_server->m_iMaxReqProcessTime = 300; + g_prefork_server->m_iMaxReqProcessTime = 3600; return 0; } void LSAPI_Set_Server_fd( int fd ) { - if( g_prefork_server ) { + if( g_prefork_server ) g_prefork_server->m_fd = fd; - } } @@ -1624,11 +2441,17 @@ static int lsapi_accept( int fdListen ) len = sizeof( achPeer ); fd = accept( fdListen, (struct sockaddr *)&achPeer, &len ); - if ( fd != -1 ) { - if (((struct sockaddr *)&achPeer)->sa_family == AF_INET ) { + if ( fd != -1 ) + { + if (((struct sockaddr *)&achPeer)->sa_family == AF_INET ) + { setsockopt( fd, IPPROTO_TCP, TCP_NODELAY, (char *)&nodelay, sizeof(nodelay)); } + + //OPTIMIZATION + //if ( s_accept_notify ) + // notify_req_received( fd ); } return fd; @@ -1652,10 +2475,10 @@ static lsapi_child_status * find_child_status( int pid ) { lsapi_child_status * pStatus = g_prefork_server->m_pChildrenStatus; lsapi_child_status * pEnd = g_prefork_server->m_pChildrenStatus + g_prefork_server->m_iMaxChildren * 2; - while( pStatus < pEnd ) { - if ( pStatus->m_pid == pid ) { + while( pStatus < pEnd ) + { + if ( pStatus->m_pid == pid ) return pStatus; - } ++pStatus; } return NULL; @@ -1667,16 +2490,30 @@ static void lsapi_sigchild( int signal ) { int status, pid; lsapi_child_status * child_status; - while( 1 ) { + while( 1 ) + { pid = waitpid( -1, &status, WNOHANG|WUNTRACED ); - if ( pid <= 0 ) { + if ( pid <= 0 ) + { break; } + if ( WIFSIGNALED( status )) + { + int sig_num = WTERMSIG( status ); + int dump = WCOREDUMP( status ); + fprintf( stderr, "Child process with pid: %d was killed by signal: %d, core dump: %d\n", pid, sig_num, dump ); + } + if ( pid == s_pid_dump_debug_info ) + { + pid = 0; + continue; + } child_status = find_child_status( pid ); - if ( child_status ) { + if ( child_status ) + { child_status->m_pid = 0; + --g_prefork_server->m_iCurChildren; } - --g_prefork_server->m_iCurChildren; } } @@ -1690,76 +2527,108 @@ static int lsapi_init_children_status() size = (size + 4095 ) / 4096 * 4096; pBuf =( char*) mmap( NULL, size, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0 ); - if ( pBuf == MAP_FAILED ) { + if ( pBuf == MAP_FAILED ) + { perror( "Anonymous mmap() failed" ); return -1; } memset( pBuf, 0, size ); - g_prefork_server->m_pChildrenStatus = (lsapi_child_status *)pBuf; + g_prefork_server->m_pChildrenStatus = (lsapi_child_status *)pBuf; return 0; } +static void dump_debug_info( lsapi_child_status * pStatus, long tmCur ) +{ + char achCmd[1024]; + if ( s_pid_dump_debug_info ) + { + if ( kill( s_pid_dump_debug_info, 0 ) == 0 ) + return; + } + s_pid_dump_debug_info = fork(); + + fprintf( stderr, "[%s] Possible runaway process, PPID: %d, PID: %d, reqCount: %d, process time: %ld, checkpoint time: %ld, start time: %ld\n", + ctime(&tmCur), getpid(), pStatus->m_pid, pStatus->m_iReqCounter, + tmCur - pStatus->m_tmReqBegin, tmCur - pStatus->m_tmLastCheckPoint, tmCur - pStatus->m_tmStart ); + snprintf( achCmd, 1024, "gdb --batch -ex \"attach %d\" -ex \"set height 0\" -ex \"bt\" >&2;PATH=$PATH:/usr/sbin lsof -p %d >&2", pStatus->m_pid, pStatus->m_pid ); + if ( system( achCmd ) == -1 ) + perror( "system()" ); + exit( 0 ); +} + static void lsapi_check_child_status( long tmCur ) { int idle = 0; int tobekilled; int dying = 0; + int count = 0; lsapi_child_status * pStatus = g_prefork_server->m_pChildrenStatus; lsapi_child_status * pEnd = g_prefork_server->m_pChildrenStatus + g_prefork_server->m_iMaxChildren * 2; - while( pStatus < pEnd ) { - tobekilled = pStatus->m_iKillSent; - if ( pStatus->m_pid != 0 ) { - if ( !tobekilled ) { - if ( !pStatus->m_inProcess ) { - - if (( g_prefork_server->m_iCurChildren - dying > g_prefork_server->m_iMaxChildren)|| - ( idle >= g_prefork_server->m_iMaxIdleChildren )) { - - tobekilled = 1; - } else { - if (( s_max_idle_secs> 0)&&(tmCur - pStatus->m_tmWaitBegin > s_max_idle_secs + 5 )) { - tobekilled = 1; - } - } - if ( !tobekilled ) { - ++idle; - } - } else { - if ( tmCur - pStatus->m_tmReqBegin > - g_prefork_server->m_iMaxReqProcessTime ) { - tobekilled = 1; - } + while( pStatus < pEnd ) + { + tobekilled = 0; + if ( pStatus->m_pid != 0 ) + { + ++count; + if ( !pStatus->m_inProcess ) + { + + if (( g_prefork_server->m_iCurChildren - dying > g_prefork_server->m_iMaxChildren)|| + ( idle > g_prefork_server->m_iMaxIdleChildren )) + { + tobekilled = SIGUSR1; } - } else { - if ( pStatus->m_inProcess ) { - tobekilled = pStatus->m_iKillSent = 0; + else + { + if (( s_max_idle_secs> 0)&&(tmCur - pStatus->m_tmWaitBegin > s_max_idle_secs + 5 )) + { + tobekilled = SIGUSR1; + } } + if ( !tobekilled ) + ++idle; } - if ( tobekilled ) { - tobekilled = 0; - if ( pStatus->m_iKillSent > 5 ) { - tobekilled = SIGKILL; - } else { - if ( pStatus->m_iKillSent == 3 ) { + else + { + if ( tmCur - pStatus->m_tmReqBegin > + g_prefork_server->m_iMaxReqProcessTime ) + { + if (( ( pStatus->m_iKillSent % 5 ) == 0 )&&( s_dump_debug_info )) + dump_debug_info( pStatus, tmCur ); + if ( pStatus->m_iKillSent > 5 ) + { + tobekilled = SIGKILL; + fprintf( stderr, "Force killing runaway process PID: %d with SIGKILL\n", pStatus->m_pid ); + } + else + { tobekilled = SIGTERM; - } else { - if ( pStatus->m_iKillSent == 1 ) { - tobekilled = SIGUSR1; - } + fprintf( stderr, "Killing runaway process PID: %d with SIGTERM\n", pStatus->m_pid ); } } - if ( tobekilled ) { - kill( pStatus->m_pid, tobekilled ); + } + if ( tobekilled ) + { + if (( kill( pStatus->m_pid, tobekilled ) == -1 )&&( errno == ESRCH )) + { + pStatus->m_pid = 0; + --count; + } + else + { + ++pStatus->m_iKillSent; + ++dying; } - ++pStatus->m_iKillSent; - ++dying; } - - } else { - ++dying; } ++pStatus; } + if ( abs( g_prefork_server->m_iCurChildren - count ) > 1 ) + { + fprintf( stderr, "Children tracking is wrong: PID: %d, Cur Childen: %d, count: %d, idle: %d, dying: %d\n", getpid(), + g_prefork_server->m_iCurChildren, count, idle, dying ); + + } } static int lsapi_all_children_must_die() @@ -1770,14 +2639,14 @@ static int lsapi_all_children_must_die() g_prefork_server->m_iMaxIdleChildren = -1; maxWait = 15; - while( g_prefork_server->m_iCurChildren && (sec < maxWait) ) { + while( g_prefork_server->m_iCurChildren && (sec < maxWait) ) + { lsapi_check_child_status(time(NULL)); sleep( 1 ); sec++; } - if ( g_prefork_server->m_iCurChildren != 0 ) { + if ( g_prefork_server->m_iCurChildren != 0 ) kill( -getpgrp(), SIGKILL ); - } return 0; } @@ -1796,13 +2665,17 @@ static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer, LSAPI_Re fd_set readfds; struct timeval timeout; + sigset_t mask; + sigset_t orig_mask; + lsapi_init_children_status(); setsid(); act.sa_flags = 0; act.sa_handler = lsapi_sigchild; - if( sigaction( SIGCHLD, &act, &old_child ) ) { + if( sigaction( SIGCHLD, &act, &old_child ) ) + { perror( "Can't set signal handler for SIGCHILD" ); return -1; } @@ -1813,36 +2686,36 @@ static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer, LSAPI_Re if( sigaction( SIGTERM, &act, &old_term ) || sigaction( SIGINT, &act, &old_int ) || sigaction( SIGUSR1, &act, &old_usr1 ) || - sigaction( SIGQUIT, &act, &old_quit )) { + sigaction( SIGQUIT, &act, &old_quit )) + { perror( "Can't set signals" ); return -1; } s_stop = 0; - while( !s_stop ) { - if ( ret ) { - curTime = time( NULL ); - } else { - ++curTime; - } - if (curTime != lastTime ) { + while( !s_stop ) + { + curTime = time( NULL ); + if (curTime != lastTime ) + { lastTime = curTime; - if (s_ppid && (getppid() != s_ppid )) { + if (s_ppid && (getppid() != s_ppid )) break; - } lsapi_check_child_status(curTime ); - if (pServer->m_iServerMaxIdle) { - if ( pServer->m_iCurChildren <= 0 ) { + if (pServer->m_iServerMaxIdle) + { + if ( pServer->m_iCurChildren <= 0 ) + { ++wait_secs; - if ( wait_secs > pServer->m_iServerMaxIdle ) { + if ( wait_secs > pServer->m_iServerMaxIdle ) return -1; - } - } else { - wait_secs = 0; } + else + wait_secs = 0; } } - if ( pServer->m_iCurChildren >= (pServer->m_iMaxChildren + pServer->m_iExtraChildren ) ) { + if ( pServer->m_iCurChildren >= (pServer->m_iMaxChildren + pServer->m_iExtraChildren ) ) + { usleep( 100000 ); continue; } @@ -1850,66 +2723,100 @@ static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer, LSAPI_Re FD_ZERO( &readfds ); FD_SET( pServer->m_fd, &readfds ); timeout.tv_sec = 1; timeout.tv_usec = 0; - if ((ret = (*g_fnSelect)(pServer->m_fd+1, &readfds, NULL, NULL, &timeout)) == 1 ) { - if ( pServer->m_iCurChildren >= 0 ) { + if ((ret = (*g_fnSelect)(pServer->m_fd+1, &readfds, NULL, NULL, &timeout)) == 1 ) + { + /* + if ( pServer->m_iCurChildren >= 0 ) + { usleep( 10 ); FD_ZERO( &readfds ); FD_SET( pServer->m_fd, &readfds ); timeout.tv_sec = 0; timeout.tv_usec = 0; - if ( (*g_fnSelect)(pServer->m_fd+1, &readfds, NULL, NULL, &timeout) == 0 ) { - continue; - } - } - } else { - if ( ret == -1 ) { - if ( errno == EINTR ) { + if ( (*g_fnSelect)(pServer->m_fd+1, &readfds, NULL, NULL, &timeout) == 0 ) continue; - } - /* perror( "select()" ); */ - break; - } else { + }*/ + } + else if ( ret == -1 ) + { + if ( errno == EINTR ) continue; - } + /* perror( "select()" ); */ + break; + } + else + { + continue; } pReq->m_fd = lsapi_accept( pServer->m_fd ); - if ( pReq->m_fd != -1 ) { + if ( pReq->m_fd != -1 ) + { child_status = find_child_status( 0 ); + if ( child_status ) + memset( child_status, 0, sizeof( *child_status ) ); + + sigemptyset( &mask ); + sigaddset( &mask, SIGCHLD ); + + if ( sigprocmask(SIG_BLOCK, &mask, &orig_mask) < 0 ) + { + perror( "sigprocmask(SIG_BLOCK) to block SIGCHLD" ); + } + pid = fork(); - if ( !pid ) { + + if ( !pid ) + { + if (sigprocmask(SIG_SETMASK, &orig_mask, NULL) < 0) + perror( "sigprocmask( SIG_SETMASK ) to restore SIGMASK in child" ); g_prefork_server = NULL; s_ppid = getppid(); s_req_processed = 0; s_pChildStatus = child_status; - child_status->m_iKillSent = 0; lsapi_set_nblock( pReq->m_fd, 0 ); - + if ( pReq->m_fdListen != -1 ) + { + close( pReq->m_fdListen ); + pReq->m_fdListen = -1; + } /* don't catch our signals */ sigaction( SIGCHLD, &old_child, 0 ); sigaction( SIGTERM, &old_term, 0 ); sigaction( SIGQUIT, &old_quit, 0 ); sigaction( SIGINT, &old_int, 0 ); sigaction( SIGUSR1, &old_usr1, 0 ); + //init_conn_key( pReq->m_fd ); + lsapi_notify_pid( pReq->m_fd ); + s_notified_pid = 1; + //if ( s_accept_notify ) + // return notify_req_received( pReq->m_fd ); return 0; - } else { - if ( pid == -1 ) { - perror( "fork() failed, please increase process limit" ); - } else { - ++pServer->m_iCurChildren; - if ( child_status ) { - child_status->m_pid = pid; - child_status->m_iKillSent = 0; - child_status->m_tmWaitBegin = time(NULL); - } + } + else if ( pid == -1 ) + { + perror( "fork() failed, please increase process limit" ); + } + else + { + ++pServer->m_iCurChildren; + if ( child_status ) + { + child_status->m_pid = pid; + child_status->m_tmWaitBegin = curTime; + child_status->m_tmStart = curTime; } } close( pReq->m_fd ); pReq->m_fd = -1; - } else { - if (( errno == EINTR )||( errno == EAGAIN)) { + if (sigprocmask(SIG_SETMASK, &orig_mask, NULL) < 0) + perror( "sigprocmask( SIG_SETMASK ) to restore SIGMASK" ); + + } + else + { + if (( errno == EINTR )||( errno == EAGAIN)) continue; - } perror( "accept() failed" ); return -1; } @@ -1921,6 +2828,11 @@ static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer, LSAPI_Re } +void lsapi_error( const char * pMessage, int err_no ) +{ + fprintf( stderr, "%d: %s, errno: %d (%s)\n", getpid(), pMessage, err_no, strerror( err_no ) ); +} + int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq ) { int fd; @@ -1932,88 +2844,105 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq ) LSAPI_Finish_r( pReq ); - if ( g_prefork_server ) { - if ( g_prefork_server->m_fd != -1 ) { - if ( lsapi_prefork_server_accept( g_prefork_server, pReq ) == -1 ) { + if ( g_prefork_server ) + { + if ( g_prefork_server->m_fd != -1 ) + if ( lsapi_prefork_server_accept( g_prefork_server, pReq ) == -1 ) return -1; - } - } } - if ( s_req_processed >= s_max_reqs ) { + if ( s_req_processed >= s_max_reqs ) return -1; - } - if ( s_pChildStatus ) { + if ( s_pChildStatus ) + { s_pChildStatus->m_tmWaitBegin = time( NULL ); } + - while( g_running ) { - if ( pReq->m_fd != -1 ) { + while( g_running ) + { + if ( pReq->m_fd != -1 ) + { fd = pReq->m_fd; - } else { - if ( pReq->m_fdListen != -1 ) { - fd = pReq->m_fdListen; - } else { - return -1; - } + } + else if ( pReq->m_fdListen != -1 ) + fd = pReq->m_fdListen; + else + { + break; } wait_secs = 0; - while( 1 ) { - if ( !g_running ) { + while( 1 ) + { + if ( !g_running ) return -1; - } - if (( s_pChildStatus )&&( s_pChildStatus->m_iKillSent )) { + if (( s_pChildStatus )&&( s_pChildStatus->m_iKillSent )) return -1; - } FD_ZERO( &readfds ); FD_SET( fd, &readfds ); timeout.tv_sec = 1; timeout.tv_usec = 0; ret = (*g_fnSelect)(fd+1, &readfds, NULL, NULL, &timeout); - if ( ret == 0 ) { - if ( s_pChildStatus ) { + if ( ret == 0 ) + { + if ( s_pChildStatus ) + { s_pChildStatus->m_inProcess = 0; } ++wait_secs; - if (( s_max_idle_secs > 0 )&&(wait_secs >= s_max_idle_secs )) { + if (( s_max_idle_secs > 0 )&&(wait_secs >= s_max_idle_secs )) return -1; - } - if ( s_ppid &&( getppid() != s_ppid)) { + if ( s_ppid &&( getppid() != s_ppid)) return -1; - } - } else { - if ( ret == -1 ) { - if ( errno == EINTR ) { - continue; - } else { - return -1; - } - } else { - if ( ret >= 1 ) { - if (( s_pChildStatus )&&( s_pChildStatus->m_iKillSent )) { - return -1; + } + else if ( ret == -1 ) + { + if ( errno == EINTR ) + continue; + else + return -1; + } + else if ( ret >= 1 ) + { + if (( s_pChildStatus )&&( s_pChildStatus->m_iKillSent )) + return -1; + if ( fd == pReq->m_fdListen ) + { + pReq->m_fd = lsapi_accept( pReq->m_fdListen ); + if ( pReq->m_fd != -1 ) + { + fd = pReq->m_fd; + lsapi_set_nblock( fd, 0 ); + //init_conn_key( pReq->m_fd ); + if ( !s_keepListener ) + { + close( pReq->m_fdListen ); + pReq->m_fdListen = -1; } - if ( fd == pReq->m_fdListen ) { - pReq->m_fd = lsapi_accept( pReq->m_fdListen ); - if ( pReq->m_fd != -1 ) { - fd = pReq->m_fd; - lsapi_set_nblock( fd, 0 ); - } else { - if (( errno == EINTR )||( errno == EAGAIN)) { - continue; - } + if ( s_accept_notify ) + if ( notify_req_received( pReq->m_fd ) == -1 ) return -1; - } - } else { - break; - } + } + else + { + if (( errno == EINTR )||( errno == EAGAIN)) + continue; + lsapi_error( "lsapi_accept() error", errno ); + return -1; } } + else + break; } } - if ( !readReq( pReq ) ) { - if ( s_pChildStatus ) { + + if ( !readReq( pReq ) ) + { + if ( s_pChildStatus ) + { + s_pChildStatus->m_iKillSent = 0; s_pChildStatus->m_inProcess = 1; + ++s_pChildStatus->m_iReqCounter; s_pChildStatus->m_tmReqBegin = s_pChildStatus->m_tmLastCheckPoint = time(NULL); } ++s_req_processed; @@ -2028,49 +2957,50 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq ) } void LSAPI_Set_Max_Reqs( int reqs ) -{ - s_max_reqs = reqs; -} +{ s_max_reqs = reqs; } void LSAPI_Set_Max_Idle( int secs ) -{ - s_max_idle_secs = secs; -} +{ s_max_idle_secs = secs; } void LSAPI_Set_Max_Children( int maxChildren ) { - if ( g_prefork_server ) { + if ( g_prefork_server ) g_prefork_server->m_iMaxChildren = maxChildren; - } } void LSAPI_Set_Extra_Children( int extraChildren ) { - if (( g_prefork_server )&&( extraChildren >= 0 )) { + if (( g_prefork_server )&&( extraChildren >= 0 )) g_prefork_server->m_iExtraChildren = extraChildren; - } } void LSAPI_Set_Max_Process_Time( int secs ) { - if (( g_prefork_server )&&( secs > 0 )) { + if (( g_prefork_server )&&( secs > 0 )) g_prefork_server->m_iMaxReqProcessTime = secs; - } } void LSAPI_Set_Max_Idle_Children( int maxIdleChld ) { - if (( g_prefork_server )&&( maxIdleChld > 0 )) { + if (( g_prefork_server )&&( maxIdleChld > 0 )) g_prefork_server->m_iMaxIdleChildren = maxIdleChld; - } } void LSAPI_Set_Server_Max_Idle_Secs( int serverMaxIdle ) { - if ( g_prefork_server ) { + if ( g_prefork_server ) g_prefork_server->m_iServerMaxIdle = serverMaxIdle; - } +} + +void LSAPI_Set_Slow_Req_Msecs( int msecs ) +{ + s_slow_req_msecs = msecs; +} + +int LSAPI_Get_Slow_Req_Msecs() +{ + return s_slow_req_msecs; } @@ -2092,101 +3022,419 @@ static void unset_lsapi_envs() #else env = environ; #endif - while( env != NULL && *env != NULL ) { - if ( !strncmp(*env, "LSAPI_", 6) || - !strncmp( *env, "PHP_LSAPI_", 10 ) ) { + while( env != NULL && *env != NULL ) + { + if (!strncmp(*env, "LSAPI_", 6) || !strncmp( *env, "PHP_LSAPI_", 10 ) + || (!strncmp( *env, "PHPRC=", 6 )&&(!s_uid))) + { char ** del = env; - do { + do *del = del[1]; - } while( *del++ ); - } else { - ++env; + while( *del++ ); } + else + ++env; } } -void LSAPI_Init_Env_Parameters( fn_select_t fp ) +static int lsapi_initSuEXEC() +{ + int i; + struct passwd * pw; + s_defaultUid = 0; + s_defaultGid = 0; + if ( s_uid == 0 ) + { + const char * p = getenv( "LSAPI_DEFAULT_UID" ); + if ( p ) + { + i = atoi( p ); + if ( i > 0 ) + s_defaultUid = i; + } + p = getenv( "LSAPI_DEFAULT_GID" ); + if ( p ) + { + i = atoi( p ); + if ( i > 0 ) + s_defaultGid = i; + } + p = getenv( "LSAPI_SECRET" ); + if (( !p )||( readSecret(p) == -1 )) + return -1; + if ( g_prefork_server ) + { + if ( g_prefork_server->m_iMaxChildren < 100 ) + g_prefork_server->m_iMaxChildren = 100; + } + } + if ( !s_defaultUid || !s_defaultGid ) + { + pw = getpwnam( "nobody" ); + if ( !s_defaultUid ) + s_defaultUid = pw->pw_uid; + if ( !s_defaultGid ) + s_defaultGid = pw->pw_gid; + } + return 0; +} + + +int LSAPI_Init_Env_Parameters( fn_select_t fp ) { const char *p; int n; int avoidFork = 0; p = getenv( "PHP_LSAPI_MAX_REQUESTS" ); - if ( !p ) { + if ( !p ) p = getenv( "LSAPI_MAX_REQS" ); - } - if ( p ) { + if ( p ) + { n = atoi( p ); - if ( n > 0 ) { + if ( n > 0 ) LSAPI_Set_Max_Reqs( n ); - } } p = getenv( "LSAPI_AVOID_FORK" ); - if ( p ) { + if ( p ) + { avoidFork = atoi( p ); } + p = getenv( "LSAPI_ACCEPT_NOTIFY" ); + if ( p ) + { + s_accept_notify = atoi( p ); + } + + p = getenv( "LSAPI_SLOW_REQ_MSECS" ); + if ( p ) + { + n = atoi( p ); + LSAPI_Set_Slow_Req_Msecs( n ); + } + #if defined( RLIMIT_CORE ) p = getenv( "LSAPI_ALLOW_CORE_DUMP" ); - if ( !p ) { + if ( !p ) + { struct rlimit limit = { 0, 0 }; setrlimit( RLIMIT_CORE, &limit ); } -#endif + else + s_enable_core_dump = 1; + +#endif p = getenv( "LSAPI_MAX_IDLE" ); - if ( p ) { + if ( p ) + { n = atoi( p ); LSAPI_Set_Max_Idle( n ); } - if ( LSAPI_Is_Listen() ) { + p = getenv( "LSAPI_KEEP_LISTEN" ); + if ( p ) + { + n = atoi( p ); + s_keepListener = n; + } + + + if ( LSAPI_Is_Listen() ) + { n = 0; p = getenv( "PHP_LSAPI_CHILDREN" ); - if ( !p ) { + if ( !p ) p = getenv( "LSAPI_CHILDREN" ); - } - if ( p ) { + if ( p ) n = atoi( p ); - } - if ( n > 1 ) { + if ( n > 1 ) + { LSAPI_Init_Prefork_Server( n, fp, avoidFork ); LSAPI_Set_Server_fd( g_req.m_fdListen ); } p = getenv( "LSAPI_EXTRA_CHILDREN" ); - if ( p ) { + if ( p ) LSAPI_Set_Extra_Children( atoi( p ) ); - } p = getenv( "LSAPI_MAX_IDLE_CHILDREN" ); - if ( p ) { + if ( p ) LSAPI_Set_Max_Idle_Children( atoi( p ) ); - } + p = getenv( "LSAPI_PGRP_MAX_IDLE" ); - if ( p ) { + if ( p ) + { LSAPI_Set_Server_Max_Idle_Secs( atoi( p ) ); } p = getenv( "LSAPI_MAX_PROCESS_TIME" ); - if ( p ) { + if ( p ) LSAPI_Set_Max_Process_Time( atoi( p ) ); - } - if ( getenv( "LSAPI_PPID_NO_CHECK" ) ) { + + if ( getenv( "LSAPI_PPID_NO_CHECK" ) ) + { LSAPI_No_Check_ppid(); } + + p = getenv( "LSAPI_DUMP_DEBUG_INFO" ); + if ( p ) + s_dump_debug_info = atoi( p ); + + if ( lsapi_initSuEXEC() == -1 ) + return -1; +#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__) + lsapi_initLVE(); +#endif } unset_lsapi_envs(); + return 0; +} + + +int LSAPI_ErrResponse_r( LSAPI_Request * pReq, int code, const char ** pRespHeaders, + const char * pBody, int bodyLen ) +{ + LSAPI_SetRespStatus_r( pReq, code ); + if ( pRespHeaders ) + { + while( *pRespHeaders ) + { + LSAPI_AppendRespHeader_r( pReq, *pRespHeaders, strlen( *pRespHeaders ) ); + ++pRespHeaders; + } + } + if ( pBody &&( bodyLen > 0 )) + { + LSAPI_Write_r( pReq, pBody, bodyLen ); + } + LSAPI_Finish_r( pReq ); + return 0; +} + + +static void lsapi_MD5Transform(uint32 buf[4], uint32 const in[16]); + +/* + * Note: this code is harmless on little-endian machines. + */ +static void byteReverse(unsigned char *buf, unsigned longs) +{ + uint32 t; + do { + t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 | + ((unsigned) buf[1] << 8 | buf[0]); + *(uint32 *) buf = t; + buf += 4; + } while (--longs); +} + +/* + * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious + * initialization constants. + */ +void lsapi_MD5Init(struct lsapi_MD5Context *ctx) +{ + ctx->buf[0] = 0x67452301; + ctx->buf[1] = 0xefcdab89; + ctx->buf[2] = 0x98badcfe; + ctx->buf[3] = 0x10325476; + + ctx->bits[0] = 0; + ctx->bits[1] = 0; } +/* + * Update context to reflect the concatenation of another buffer full + * of bytes. + */ +void lsapi_MD5Update(struct lsapi_MD5Context *ctx, unsigned char const *buf, unsigned len) +{ + register uint32 t; + + /* Update bitcount */ + + t = ctx->bits[0]; + if ((ctx->bits[0] = t + ((uint32) len << 3)) < t) + ctx->bits[1]++; /* Carry from low to high */ + ctx->bits[1] += len >> 29; + + t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ + + /* Handle any leading odd-sized chunks */ + + if (t) { + unsigned char *p = (unsigned char *) ctx->in + t; + + t = 64 - t; + if (len < t) { + memmove(p, buf, len); + return; + } + memmove(p, buf, t); + byteReverse(ctx->in, 16); + lsapi_MD5Transform(ctx->buf, (uint32 *) ctx->in); + buf += t; + len -= t; + } + /* Process data in 64-byte chunks */ + + while (len >= 64) { + memmove(ctx->in, buf, 64); + byteReverse(ctx->in, 16); + lsapi_MD5Transform(ctx->buf, (uint32 *) ctx->in); + buf += 64; + len -= 64; + } + + /* Handle any remaining bytes of data. */ + + memmove(ctx->in, buf, len); +} /* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 + * Final wrapup - pad to 64-byte boundary with the bit pattern + * 1 0* (64-bit count of bits processed, MSB-first) */ +void lsapi_MD5Final(unsigned char digest[16], struct lsapi_MD5Context *ctx) +{ + unsigned int count; + unsigned char *p; + /* Compute number of bytes mod 64 */ + count = (ctx->bits[0] >> 3) & 0x3F; + + /* Set the first char of padding to 0x80. This is safe since there is + always at least one byte free */ + p = ctx->in + count; + *p++ = 0x80; + + /* Bytes of padding needed to make 64 bytes */ + count = 64 - 1 - count; + + /* Pad out to 56 mod 64 */ + if (count < 8) { + /* Two lots of padding: Pad the first block to 64 bytes */ + memset(p, 0, count); + byteReverse(ctx->in, 16); + lsapi_MD5Transform(ctx->buf, (uint32 *) ctx->in); + + /* Now fill the next block with 56 bytes */ + memset(ctx->in, 0, 56); + } else { + /* Pad block to 56 bytes */ + memset(p, 0, count - 8); + } + byteReverse(ctx->in, 14); + + /* Append length in bits and transform */ + ((uint32 *) ctx->in)[14] = ctx->bits[0]; + ((uint32 *) ctx->in)[15] = ctx->bits[1]; + + lsapi_MD5Transform(ctx->buf, (uint32 *) ctx->in); + byteReverse((unsigned char *) ctx->buf, 4); + memmove(digest, ctx->buf, 16); + memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ +} + +/* The four core functions - F1 is optimized somewhat */ + +/* #define F1(x, y, z) (x & y | ~x & z) */ +#define F1(x, y, z) (z ^ (x & (y ^ z))) +#define F2(x, y, z) F1(z, x, y) +#define F3(x, y, z) (x ^ y ^ z) +#define F4(x, y, z) (y ^ (x | ~z)) + +/* This is the central step in the MD5 algorithm. */ +#define MD5STEP(f, w, x, y, z, data, s) \ + ( w += f(x, y, z) + data, w = w<>(32-s), w += x ) + +/* + * The core of the MD5 algorithm, this alters an existing MD5 hash to + * reflect the addition of 16 longwords of new data. MD5Update blocks + * the data and converts bytes into longwords for this routine. + */ +static void lsapi_MD5Transform(uint32 buf[4], uint32 const in[16]) +{ + register uint32 a, b, c, d; + + a = buf[0]; + b = buf[1]; + c = buf[2]; + d = buf[3]; + + MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); + MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); + MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); + MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); + MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); + MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); + MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); + MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); + MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); + MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); + MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); + MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); + MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); + MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); + MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); + MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); + + MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); + MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); + MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); + MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); + MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); + MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); + MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); + MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); + MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); + MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); + MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); + MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); + MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); + MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); + MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); + MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); + + MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); + MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); + MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); + MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); + MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); + MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); + MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); + MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); + MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); + MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); + MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); + MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); + MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); + MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); + MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); + MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); + + MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); + MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); + MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); + MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); + MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); + MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); + MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); + MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); + MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); + MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); + MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); + MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); + MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); + MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); + MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); + MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); + + buf[0] += a; + buf[1] += b; + buf[2] += c; + buf[3] += d; +} diff --git a/sapi/litespeed/lsapilib.h b/sapi/litespeed/lsapilib.h index 538a170b44cd8..b0638fd436a09 100644 --- a/sapi/litespeed/lsapilib.h +++ b/sapi/litespeed/lsapilib.h @@ -1,24 +1,5 @@ - -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: George Wang | - +----------------------------------------------------------------------+ -*/ - /* -Copyright (c) 2007, Lite Speed Technologies Inc. +Copyright (c) 2013, Lite Speed Technologies Inc. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -49,6 +30,13 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/*************************************************************************** + lsapilib.h - description + ------------------- + begin : Mon Feb 21 2005 + copyright : (C) 2005 by George Wang + email : gwang@litespeedtech.com + ***************************************************************************/ #ifndef _LSAPILIB_H_ @@ -118,7 +106,8 @@ typedef struct lsapi_request char * m_pRequestMethod; int m_totalLen; int m_reqState; - int m_reqBodyRead; + off_t m_reqBodyLen; + off_t m_reqBodyRead; int m_bufProcessed; int m_bufRead; @@ -126,6 +115,7 @@ typedef struct lsapi_request struct lsapi_resp_header m_respHeader; short m_respHeaderLen[LSAPI_MAX_RESP_HEADERS]; + void * m_pAppData; }LSAPI_Request; @@ -170,22 +160,30 @@ int LSAPI_ForeachSpecialEnv_r( LSAPI_Request * pReq, char * LSAPI_GetEnv_r( LSAPI_Request * pReq, const char * name ); -int LSAPI_ReadReqBody_r( LSAPI_Request * pReq, char * pBuf, int len ); +ssize_t LSAPI_ReadReqBody_r( LSAPI_Request * pReq, char * pBuf, size_t len ); int LSAPI_ReqBodyGetChar_r( LSAPI_Request * pReq ); -int LSAPI_ReqBodyGetLine_r( LSAPI_Request * pReq, char * pBuf, int bufLen, int *getLF ); +int LSAPI_ReqBodyGetLine_r( LSAPI_Request * pReq, char * pBuf, size_t bufLen, int *getLF ); int LSAPI_FinalizeRespHeaders_r( LSAPI_Request * pReq ); -int LSAPI_Write_r( LSAPI_Request * pReq, const char * pBuf, int len ); +ssize_t LSAPI_Write_r( LSAPI_Request * pReq, const char * pBuf, size_t len ); -int LSAPI_Write_Stderr_r( LSAPI_Request * pReq, const char * pBuf, int len ); +ssize_t LSAPI_sendfile_r( LSAPI_Request * pReq, int fdIn, off_t* off, size_t size ); + +ssize_t LSAPI_Write_Stderr_r( LSAPI_Request * pReq, const char * pBuf, size_t len ); int LSAPI_Flush_r( LSAPI_Request * pReq ); -int LSAPI_AppendRespHeader_r( LSAPI_Request * pHeader, char * pBuf, int len ); +int LSAPI_AppendRespHeader_r( LSAPI_Request * pReq, const char * pBuf, int len ); + +int LSAPI_AppendRespHeader2_r( LSAPI_Request * pReq, const char * pHeaderName, + const char * pHeaderValue ); + +int LSAPI_ErrResponse_r( LSAPI_Request * pReq, int code, const char ** pRespHeaders, + const char * pBody, int bodyLen ); static inline int LSAPI_SetRespStatus_r( LSAPI_Request * pReq, int code ) { @@ -195,6 +193,21 @@ static inline int LSAPI_SetRespStatus_r( LSAPI_Request * pReq, int code ) return 0; } +static inline int LSAPI_SetAppData_r( LSAPI_Request * pReq, void * data ) +{ + if ( !pReq ) + return -1; + pReq->m_pAppData = data; + return 0; +} + +static inline void * LSAPI_GetAppData_r( LSAPI_Request * pReq ) +{ + if ( !pReq ) + return NULL; + return pReq->m_pAppData; +} + static inline char * LSAPI_GetQueryString_r( LSAPI_Request * pReq ) { if ( pReq ) @@ -228,21 +241,22 @@ static inline char * LSAPI_GetRequestMethod_r( LSAPI_Request * pReq) -static inline int LSAPI_GetReqBodyLen_r( LSAPI_Request * pReq ) +static inline off_t LSAPI_GetReqBodyLen_r( LSAPI_Request * pReq ) { if ( pReq ) - return pReq->m_pHeader->m_reqBodyLen; + return pReq->m_reqBodyLen; return -1; } -static inline int LSAPI_GetReqBodyRemain_r( LSAPI_Request * pReq ) +static inline off_t LSAPI_GetReqBodyRemain_r( LSAPI_Request * pReq ) { if ( pReq ) - return pReq->m_pHeader->m_reqBodyLen - pReq->m_reqBodyRead; + return pReq->m_reqBodyLen - pReq->m_reqBodyRead; return -1; } + int LSAPI_Is_Listen(void); static inline int LSAPI_Accept( void ) @@ -282,13 +296,13 @@ static inline char * LSAPI_GetScriptName() static inline char * LSAPI_GetRequestMethod() { return LSAPI_GetRequestMethod_r( &g_req ); } -static inline int LSAPI_GetReqBodyLen() +static inline off_t LSAPI_GetReqBodyLen() { return LSAPI_GetReqBodyLen_r( &g_req ); } -static inline int LSAPI_GetReqBodyRemain() +static inline off_t LSAPI_GetReqBodyRemain() { return LSAPI_GetReqBodyRemain_r( &g_req ); } -static inline int LSAPI_ReadReqBody( char * pBuf, int len ) +static inline ssize_t LSAPI_ReadReqBody( char * pBuf, size_t len ) { return LSAPI_ReadReqBody_r( &g_req, pBuf, len ); } static inline int LSAPI_ReqBodyGetChar() @@ -302,10 +316,15 @@ static inline int LSAPI_ReqBodyGetLine( char * pBuf, int len, int *getLF ) static inline int LSAPI_FinalizeRespHeaders(void) { return LSAPI_FinalizeRespHeaders_r( &g_req ); } -static inline int LSAPI_Write( const char * pBuf, int len ) +static inline ssize_t LSAPI_Write( const char * pBuf, ssize_t len ) { return LSAPI_Write_r( &g_req, pBuf, len ); } -static inline int LSAPI_Write_Stderr( const char * pBuf, int len ) +static inline ssize_t LSAPI_sendfile( int fdIn, off_t* off, size_t size ) +{ + return LSAPI_sendfile_r(&g_req, fdIn, off, size ); +} + +static inline ssize_t LSAPI_Write_Stderr( const char * pBuf, ssize_t len ) { return LSAPI_Write_Stderr_r( &g_req, pBuf, len ); } static inline int LSAPI_Flush() @@ -317,6 +336,9 @@ static inline int LSAPI_AppendRespHeader( char * pBuf, int len ) static inline int LSAPI_SetRespStatus( int code ) { return LSAPI_SetRespStatus_r( &g_req, code ); } +static inline int LSAPI_ErrResponse( int code, const char ** pRespHeaders, const char * pBody, int bodyLen ) +{ return LSAPI_ErrResponse_r( &g_req, code, pRespHeaders, pBody, bodyLen ); } + int LSAPI_IsRunning(void); int LSAPI_CreateListenSock( const char * pBind, int backlog ); @@ -341,7 +363,13 @@ void LSAPI_Set_Server_Max_Idle_Secs( int serverMaxIdle ); void LSAPI_Set_Max_Process_Time( int secs ); -void LSAPI_Init_Env_Parameters( fn_select_t fp ); +int LSAPI_Init_Env_Parameters( fn_select_t fp ); + +void LSAPI_Set_Slow_Req_Msecs( int msecs ); + +int LSAPI_Get_Slow_Req_Msecs( ); + +int LSAPI_is_suEXEC_Daemon(); #if defined (c_plusplus) || defined (__cplusplus) } diff --git a/tests/basic/024.phpt b/tests/basic/024.phpt deleted file mode 100644 index bf8a206b3ac9d..0000000000000 --- a/tests/basic/024.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -Test HTTP_RAW_POST_DATA creation ---INI-- -always_populate_raw_post_data=1 -max_input_vars=1000 ---POST-- -a=ABC&y=XYZ&c[]=1&c[]=2&c[a]=3 ---FILE-- - ---EXPECT-- -array(3) { - ["a"]=> - string(3) "ABC" - ["y"]=> - string(3) "XYZ" - ["c"]=> - array(3) { - [0]=> - string(1) "1" - [1]=> - string(1) "2" - ["a"]=> - string(1) "3" - } -} -string(30) "a=ABC&y=XYZ&c[]=1&c[]=2&c[a]=3" diff --git a/tests/basic/026.phpt b/tests/basic/026.phpt deleted file mode 100644 index b98a31f430772..0000000000000 --- a/tests/basic/026.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Registration of HTTP_RAW_POST_DATA due to unknown content-type ---INI-- -always_populate_raw_post_data=0 ---POST_RAW-- -Content-Type: unknown/type -a=1&b=ZYX ---FILE-- - ---EXPECT-- -array(0) { -} -string(9) "a=1&b=ZYX" diff --git a/tests/basic/enable_post_data_reading_01.phpt b/tests/basic/enable_post_data_reading_01.phpt index 1a0e33f617480..19ee5d583f762 100644 --- a/tests/basic/enable_post_data_reading_01.phpt +++ b/tests/basic/enable_post_data_reading_01.phpt @@ -11,6 +11,7 @@ var_dump($_FILES); var_dump($_POST); var_dump($HTTP_RAW_POST_DATA); var_dump(file_get_contents("php://input")); +var_dump(file_get_contents("php://input")); --EXPECTF-- array(0) { } @@ -20,3 +21,4 @@ array(0) { Notice: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d NULL string(9) "a=1&b=ZYX" +string(9) "a=1&b=ZYX" diff --git a/tests/basic/enable_post_data_reading_02.phpt b/tests/basic/enable_post_data_reading_02.phpt index dc7f6b127ad8e..4e1643ebd02d5 100644 --- a/tests/basic/enable_post_data_reading_02.phpt +++ b/tests/basic/enable_post_data_reading_02.phpt @@ -15,6 +15,7 @@ Content-Type: text/plain-file var_dump($_FILES); var_dump($_POST); var_dump(file_get_contents("php://input")); +var_dump(file_get_contents("php://input")); --EXPECTF-- array(0) { } @@ -26,3 +27,9 @@ Content-Type: text/plain-file 1 -----------------------------20896060251896012921717172737--" +string(%d) "-----------------------------20896060251896012921717172737 +Content-Disposition: form-data; name="file1"; filename="file1.txt" +Content-Type: text/plain-file + +1 +-----------------------------20896060251896012921717172737--" diff --git a/tests/basic/enable_post_data_reading_03.phpt b/tests/basic/enable_post_data_reading_03.phpt index cdabe910ca45c..6a62282ea2e56 100644 --- a/tests/basic/enable_post_data_reading_03.phpt +++ b/tests/basic/enable_post_data_reading_03.phpt @@ -12,6 +12,7 @@ var_dump($_FILES); var_dump($_POST); var_dump($HTTP_RAW_POST_DATA); var_dump(file_get_contents("php://input")); +var_dump(file_get_contents("php://input")); --EXPECTF-- array(0) { } @@ -21,3 +22,4 @@ array(0) { Notice: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d NULL string(9) "a=1&b=ZYX" +string(9) "a=1&b=ZYX" diff --git a/tests/basic/enable_post_data_reading_04.phpt b/tests/basic/enable_post_data_reading_04.phpt index a1685040bb957..a7c7e496d8c16 100644 --- a/tests/basic/enable_post_data_reading_04.phpt +++ b/tests/basic/enable_post_data_reading_04.phpt @@ -12,6 +12,7 @@ var_dump($_FILES); var_dump($_POST); var_dump($HTTP_RAW_POST_DATA); var_dump(file_get_contents("php://input")); +var_dump(file_get_contents("php://input")); --EXPECTF-- array(0) { } @@ -21,3 +22,4 @@ array(0) { Notice: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d NULL string(9) "a=1&b=ZYX" +string(9) "a=1&b=ZYX" diff --git a/tests/basic/enable_post_data_reading_05.phpt b/tests/basic/enable_post_data_reading_05.phpt new file mode 100644 index 0000000000000..d8efa0129eaae --- /dev/null +++ b/tests/basic/enable_post_data_reading_05.phpt @@ -0,0 +1,26 @@ +--TEST-- +enable_post_data_reading: using multiple input streams +--INI-- +enable_post_data_reading=0 +max_execution_time=2 +--POST_RAW-- +Content-Type: application/unknown +One line of data +--FILE-- + + +Done +--EXPECT-- +Test +OOnnee lliinnee ooff ddaattaa +Done diff --git a/tests/basic/enable_post_data_reading_06.phpt b/tests/basic/enable_post_data_reading_06.phpt new file mode 100644 index 0000000000000..fbed195c03d1e --- /dev/null +++ b/tests/basic/enable_post_data_reading_06.phpt @@ -0,0 +1,271 @@ +--TEST-- +enable_post_data_reading: using multiple input streams (more than 8k data) +--INI-- +enable_post_data_reading=0 +--POST_RAW-- +Content-Type: application/unknown +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +. +--FILE-- + + +Done +--EXPECT-- +Test +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +.. +Done diff --git a/tests/lang/bug24640.phpt b/tests/lang/bug24640.phpt index 919b38e29e44a..e41d0201b7795 100644 --- a/tests/lang/bug24640.phpt +++ b/tests/lang/bug24640.phpt @@ -36,22 +36,22 @@ test(1.7e-1000); ===DONE=== --EXPECTF-- -1.7E+300 +1.7000000000000001E+300 float(1.7E+300) 1.7E+300 1.7E+300 ------ -1.7E-300 +1.7000000000000001E-300 float(1.7E-300) 1.7E-300 1.7E-300 ------ -1.7E+79 +1.7000000000000002E+79 float(1.7E+79) 1.7E+79 1.7E+79 ------ -1.7E-79 +1.6999999999999999E-79 float(1.7E-79) 1.7E-79 1.7E-79 @@ -71,7 +71,7 @@ float(1.7E+81) 1.7E+81 1.7E+81 ------ -1.7E-81 +1.6999999999999999E-81 float(1.7E-81) 1.7E-81 1.7E-81 @@ -81,7 +81,7 @@ float(I%s) I%s I%s ------ -1.69998107421E-319 +1.6999810742105611E-319 float(1.69998107421E-319) 1.69998107421E-319 1.69998107421E-319 @@ -91,7 +91,7 @@ float(I%s) I%s I%s ------ -1.70007988734E-320 +1.7000798873397294E-320 float(1.70007988734E-320) 1.70007988734E-320 1.70007988734E-320 @@ -101,7 +101,7 @@ float(I%s) I%s I%s ------ -1.69958582169E-321 +1.6995858216938881E-321 float(1.69958582169E-321) 1.69958582169E-321 1.69958582169E-321 diff --git a/tests/run-test/test011.phpt b/tests/run-test/test011.phpt new file mode 100644 index 0000000000000..17f1f7aee6c9e --- /dev/null +++ b/tests/run-test/test011.phpt @@ -0,0 +1,6 @@ +--TEST-- +EXPECT_EXTERNAL +--FILE-- +abc +--EXPECT_EXTERNAL-- +test011.txt diff --git a/tests/run-test/test011.txt b/tests/run-test/test011.txt new file mode 100644 index 0000000000000..8baef1b4abc47 --- /dev/null +++ b/tests/run-test/test011.txt @@ -0,0 +1 @@ +abc diff --git a/tests/run-test/test012.phpt b/tests/run-test/test012.phpt new file mode 100644 index 0000000000000..8213aa2a5610e --- /dev/null +++ b/tests/run-test/test012.phpt @@ -0,0 +1,12 @@ +--TEST-- +EXPECTF_EXTERNAL +--FILE-- +123 +-123 ++123 ++1.1 +abc +0abc +x +--EXPECTF_EXTERNAL-- +test012.txt diff --git a/tests/run-test/test012.txt b/tests/run-test/test012.txt new file mode 100644 index 0000000000000..bb293214b1da9 --- /dev/null +++ b/tests/run-test/test012.txt @@ -0,0 +1,7 @@ +%d +%i +%i +%f +%s +%x +%c diff --git a/tests/run-test/test013.phpt b/tests/run-test/test013.phpt new file mode 100644 index 0000000000000..79ccd20de218c --- /dev/null +++ b/tests/run-test/test013.phpt @@ -0,0 +1,6 @@ +--TEST-- +EXPECTREGEX_EXTERNAL +--FILE-- +abcde12314235xyz34264768286abcde +--EXPECTREGEX_EXTERNAL-- +test013.txt diff --git a/tests/run-test/test013.txt b/tests/run-test/test013.txt new file mode 100644 index 0000000000000..6c280ece4d44f --- /dev/null +++ b/tests/run-test/test013.txt @@ -0,0 +1 @@ +[abcde]+[0-5]*xyz[2-8]+abcde diff --git a/travis/compile.sh b/travis/compile.sh index a56db63c127a0..2b53099651c30 100755 --- a/travis/compile.sh +++ b/travis/compile.sh @@ -33,5 +33,6 @@ --with-gettext \ --enable-sockets \ --with-bz2 \ +--with-openssl \ --enable-bcmath make --quiet diff --git a/travis/ext/mysql/setup.sh b/travis/ext/mysql/setup.sh index 994fad13766d8..a3ba75cb2d837 100755 --- a/travis/ext/mysql/setup.sh +++ b/travis/ext/mysql/setup.sh @@ -1,2 +1,2 @@ #!/bin/bash -mysql -u root -e "CREATE DATABASE IF NOT EXISTS test" +mysql -e "CREATE DATABASE IF NOT EXISTS test" diff --git a/travis/ext/mysqli/setup.sh b/travis/ext/mysqli/setup.sh index 994fad13766d8..a3ba75cb2d837 100755 --- a/travis/ext/mysqli/setup.sh +++ b/travis/ext/mysqli/setup.sh @@ -1,2 +1,2 @@ #!/bin/bash -mysql -u root -e "CREATE DATABASE IF NOT EXISTS test" +mysql -e "CREATE DATABASE IF NOT EXISTS test" diff --git a/travis/ext/pdo_mysql/setup.sh b/travis/ext/pdo_mysql/setup.sh index 994fad13766d8..a3ba75cb2d837 100755 --- a/travis/ext/pdo_mysql/setup.sh +++ b/travis/ext/pdo_mysql/setup.sh @@ -1,2 +1,2 @@ #!/bin/bash -mysql -u root -e "CREATE DATABASE IF NOT EXISTS test" +mysql -e "CREATE DATABASE IF NOT EXISTS test" diff --git a/win32/build/config.w32 b/win32/build/config.w32 index 3face08a8c2b5..af92eb0d4c050 100644 --- a/win32/build/config.w32 +++ b/win32/build/config.w32 @@ -155,7 +155,7 @@ if (VCVERS >= 1400) { // disable annoying warnings. In addition, time_t defaults // to 64-bit. Ask for 32-bit. if (X64) { - ADD_FLAG('CFLAGS', ' /wd4996 /Wp64 '); + ADD_FLAG('CFLAGS', ' /wd4996 '); } else { ADD_FLAG('CFLAGS', ' /wd4996 /D_USE_32BIT_TIME_T=1 '); } @@ -364,7 +364,7 @@ ADD_SOURCES("Zend", "zend_language_parser.c zend_language_scanner.c \ zend_stream.c zend_iterators.c zend_interfaces.c zend_objects.c \ zend_object_handlers.c zend_objects_API.c \ zend_default_classes.c zend_execute.c zend_strtod.c zend_gc.c zend_closures.c \ - zend_float.c zend_string.c zend_generators.c"); + zend_float.c zend_string.c zend_generators.c zend_virtual_cwd.c"); if (VCVERS == 1200) { AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1); diff --git a/win32/build/config.w32.phpize.in b/win32/build/config.w32.phpize.in index b8bf45ea5779d..7b3b40633b980 100644 --- a/win32/build/config.w32.phpize.in +++ b/win32/build/config.w32.phpize.in @@ -134,7 +134,7 @@ if (VCVERS >= 1400) { // disable annoying warnings. In addition, time_t defaults // to 64-bit. Ask for 32-bit. if (X64) { - ADD_FLAG('CFLAGS', ' /wd4996 /Wp64 '); + ADD_FLAG('CFLAGS', ' /wd4996 '); } else { ADD_FLAG('CFLAGS', ' /wd4996 /D_USE_32BIT_TIME_T=1 '); } diff --git a/win32/build/libs_version.txt b/win32/build/libs_version.txt index 096d723a9c3ce..44420ddec82da 100644 --- a/win32/build/libs_version.txt +++ b/win32/build/libs_version.txt @@ -1,25 +1,16 @@ bz2-1.0.6 -cclient-2007e cclient-2007f freetype-2.4.10 -icu-49.1.2 -icu-50.1.2 -jpeglib-8 +icu-51.2 jpeglib-9 libcurl-7.30.0 libiconv-1.14 libmcrypt-2.5.8 -libmpir-2.5.1 libmpir-2.6.0 -libpng-1.2.50 -libpng-1.5.13 -libpq-8.3.6 +libpng-1.5.14 libpq-9.2.2 libssh2-1.4.2 -libtidy-20090325 libtidy-20090406 libxslt-1.1.27 -libxml-2.7.8 libxml-2.9.1 -openssl-0.9.8y openssl-1.0.1e diff --git a/win32/php_inttypes.h b/win32/php_inttypes.h new file mode 100644 index 0000000000000..25542771f591c --- /dev/null +++ b/win32/php_inttypes.h @@ -0,0 +1,305 @@ +// ISO C9x compliant inttypes.h for Microsoft Visual Studio +// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 +// +// Copyright (c) 2006 Alexander Chemeris +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. The name of the author may be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _MSC_VER // [ +#error "Use this header only with Microsoft Visual C++ compilers!" +#endif // _MSC_VER ] + +#ifndef _MSC_INTTYPES_H_ // [ +#define _MSC_INTTYPES_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#include "stdint.h" + +// 7.8 Format conversion of integer types + +typedef struct { + intmax_t quot; + intmax_t rem; +} imaxdiv_t; + +// 7.8.1 Macros for format specifiers + +#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198 + +// The fprintf macros for signed integers are: +#define PRId8 "d" +#define PRIi8 "i" +#define PRIdLEAST8 "d" +#define PRIiLEAST8 "i" +#define PRIdFAST8 "d" +#define PRIiFAST8 "i" + +#define PRId16 "hd" +#define PRIi16 "hi" +#define PRIdLEAST16 "hd" +#define PRIiLEAST16 "hi" +#define PRIdFAST16 "hd" +#define PRIiFAST16 "hi" + +#define PRId32 "I32d" +#define PRIi32 "I32i" +#define PRIdLEAST32 "I32d" +#define PRIiLEAST32 "I32i" +#define PRIdFAST32 "I32d" +#define PRIiFAST32 "I32i" + +#define PRId64 "I64d" +#define PRIi64 "I64i" +#define PRIdLEAST64 "I64d" +#define PRIiLEAST64 "I64i" +#define PRIdFAST64 "I64d" +#define PRIiFAST64 "I64i" + +#define PRIdMAX "I64d" +#define PRIiMAX "I64i" + +#define PRIdPTR "Id" +#define PRIiPTR "Ii" + +// The fprintf macros for unsigned integers are: +#define PRIo8 "o" +#define PRIu8 "u" +#define PRIx8 "x" +#define PRIX8 "X" +#define PRIoLEAST8 "o" +#define PRIuLEAST8 "u" +#define PRIxLEAST8 "x" +#define PRIXLEAST8 "X" +#define PRIoFAST8 "o" +#define PRIuFAST8 "u" +#define PRIxFAST8 "x" +#define PRIXFAST8 "X" + +#define PRIo16 "ho" +#define PRIu16 "hu" +#define PRIx16 "hx" +#define PRIX16 "hX" +#define PRIoLEAST16 "ho" +#define PRIuLEAST16 "hu" +#define PRIxLEAST16 "hx" +#define PRIXLEAST16 "hX" +#define PRIoFAST16 "ho" +#define PRIuFAST16 "hu" +#define PRIxFAST16 "hx" +#define PRIXFAST16 "hX" + +#define PRIo32 "I32o" +#define PRIu32 "I32u" +#define PRIx32 "I32x" +#define PRIX32 "I32X" +#define PRIoLEAST32 "I32o" +#define PRIuLEAST32 "I32u" +#define PRIxLEAST32 "I32x" +#define PRIXLEAST32 "I32X" +#define PRIoFAST32 "I32o" +#define PRIuFAST32 "I32u" +#define PRIxFAST32 "I32x" +#define PRIXFAST32 "I32X" + +#define PRIo64 "I64o" +#define PRIu64 "I64u" +#define PRIx64 "I64x" +#define PRIX64 "I64X" +#define PRIoLEAST64 "I64o" +#define PRIuLEAST64 "I64u" +#define PRIxLEAST64 "I64x" +#define PRIXLEAST64 "I64X" +#define PRIoFAST64 "I64o" +#define PRIuFAST64 "I64u" +#define PRIxFAST64 "I64x" +#define PRIXFAST64 "I64X" + +#define PRIoMAX "I64o" +#define PRIuMAX "I64u" +#define PRIxMAX "I64x" +#define PRIXMAX "I64X" + +#define PRIoPTR "Io" +#define PRIuPTR "Iu" +#define PRIxPTR "Ix" +#define PRIXPTR "IX" + +// The fscanf macros for signed integers are: +#define SCNd8 "d" +#define SCNi8 "i" +#define SCNdLEAST8 "d" +#define SCNiLEAST8 "i" +#define SCNdFAST8 "d" +#define SCNiFAST8 "i" + +#define SCNd16 "hd" +#define SCNi16 "hi" +#define SCNdLEAST16 "hd" +#define SCNiLEAST16 "hi" +#define SCNdFAST16 "hd" +#define SCNiFAST16 "hi" + +#define SCNd32 "ld" +#define SCNi32 "li" +#define SCNdLEAST32 "ld" +#define SCNiLEAST32 "li" +#define SCNdFAST32 "ld" +#define SCNiFAST32 "li" + +#define SCNd64 "I64d" +#define SCNi64 "I64i" +#define SCNdLEAST64 "I64d" +#define SCNiLEAST64 "I64i" +#define SCNdFAST64 "I64d" +#define SCNiFAST64 "I64i" + +#define SCNdMAX "I64d" +#define SCNiMAX "I64i" + +#ifdef _WIN64 // [ +# define SCNdPTR "I64d" +# define SCNiPTR "I64i" +#else // _WIN64 ][ +# define SCNdPTR "ld" +# define SCNiPTR "li" +#endif // _WIN64 ] + +// The fscanf macros for unsigned integers are: +#define SCNo8 "o" +#define SCNu8 "u" +#define SCNx8 "x" +#define SCNX8 "X" +#define SCNoLEAST8 "o" +#define SCNuLEAST8 "u" +#define SCNxLEAST8 "x" +#define SCNXLEAST8 "X" +#define SCNoFAST8 "o" +#define SCNuFAST8 "u" +#define SCNxFAST8 "x" +#define SCNXFAST8 "X" + +#define SCNo16 "ho" +#define SCNu16 "hu" +#define SCNx16 "hx" +#define SCNX16 "hX" +#define SCNoLEAST16 "ho" +#define SCNuLEAST16 "hu" +#define SCNxLEAST16 "hx" +#define SCNXLEAST16 "hX" +#define SCNoFAST16 "ho" +#define SCNuFAST16 "hu" +#define SCNxFAST16 "hx" +#define SCNXFAST16 "hX" + +#define SCNo32 "lo" +#define SCNu32 "lu" +#define SCNx32 "lx" +#define SCNX32 "lX" +#define SCNoLEAST32 "lo" +#define SCNuLEAST32 "lu" +#define SCNxLEAST32 "lx" +#define SCNXLEAST32 "lX" +#define SCNoFAST32 "lo" +#define SCNuFAST32 "lu" +#define SCNxFAST32 "lx" +#define SCNXFAST32 "lX" + +#define SCNo64 "I64o" +#define SCNu64 "I64u" +#define SCNx64 "I64x" +#define SCNX64 "I64X" +#define SCNoLEAST64 "I64o" +#define SCNuLEAST64 "I64u" +#define SCNxLEAST64 "I64x" +#define SCNXLEAST64 "I64X" +#define SCNoFAST64 "I64o" +#define SCNuFAST64 "I64u" +#define SCNxFAST64 "I64x" +#define SCNXFAST64 "I64X" + +#define SCNoMAX "I64o" +#define SCNuMAX "I64u" +#define SCNxMAX "I64x" +#define SCNXMAX "I64X" + +#ifdef _WIN64 // [ +# define SCNoPTR "I64o" +# define SCNuPTR "I64u" +# define SCNxPTR "I64x" +# define SCNXPTR "I64X" +#else // _WIN64 ][ +# define SCNoPTR "lo" +# define SCNuPTR "lu" +# define SCNxPTR "lx" +# define SCNXPTR "lX" +#endif // _WIN64 ] + +#endif // __STDC_FORMAT_MACROS ] + +// 7.8.2 Functions for greatest-width integer types + +// 7.8.2.1 The imaxabs function +#define imaxabs _abs64 + +// 7.8.2.2 The imaxdiv function + +// This is modified version of div() function from Microsoft's div.c found +// in %MSVC.NET%\crt\src\div.c +#ifdef STATIC_IMAXDIV // [ +static +#else // STATIC_IMAXDIV ][ +_inline +#endif // STATIC_IMAXDIV ] +imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) +{ + imaxdiv_t result; + + result.quot = numer / denom; + result.rem = numer % denom; + + if (numer < 0 && result.rem > 0) { + // did division wrong; must fix up + ++result.quot; + result.rem -= denom; + } + + return result; +} + +// 7.8.2.3 The strtoimax and strtoumax functions +#define strtoimax _strtoi64 +#define strtoumax _strtoui64 + +// 7.8.2.4 The wcstoimax and wcstoumax functions +#define wcstoimax _wcstoi64 +#define wcstoumax _wcstoui64 + + +#endif // _MSC_INTTYPES_H_ ] diff --git a/win32/readdir.c b/win32/readdir.c index 9525fc0d6b499..0edd5764d4988 100644 --- a/win32/readdir.c +++ b/win32/readdir.c @@ -45,6 +45,7 @@ DIR *opendir(const char *dir) dp = (DIR *) malloc(sizeof(DIR)); if (dp == NULL) { + free(filespec); return NULL; } dp->offset = 0;