diff --git a/.gitattributes b/.gitattributes index 1f4a7195b7614..9ed6e5f4b9b1f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -15,6 +15,7 @@ ext/dba/libflatfile/flatfile.c ident ext/dba/libcdb/cdb_make.c ident ext/dba/libcdb/cdb.c ident ext/filter/filter.c ident +ext/zip/php_zip.c ident README.input_filter ident run-tests.php ident sapi/nsapi/nsapi.c ident diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000000..2939e3e92a150 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,24 @@ +language: php + +php: + # We only specify one version so we only get one worker + - 5.4 + +notifications: + email: false + +env: + - REPORT_EXIT_STATUS=1 TEST_PHP_EXECUTABLE=./sapi/cli/php + +before_script: + # Compile PHP + - ./travis/compile.sh + # Setup Extensions + - . ./travis/ext/mysql/setup.sh + - . ./travis/ext/mysqli/setup.sh + - . ./travis/ext/pdo_mysql/setup.sh + - . ./travis/ext/pgsql/setup.sh + - . ./travis/ext/pdo_pgsql/setup.sh + +# Run PHPs run-tests.php +script: ./sapi/cli/php run-tests.php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" diff --git a/NEWS b/NEWS index 42c2f834ca29e..58eeabd37f2bc 100644 --- a/NEWS +++ b/NEWS @@ -3,12 +3,22 @@ PHP NEWS ?? ??? 201?, PHP 5.5.0 - General improvements: + . Implemented 'finally' keyword (https://wiki.php.net/rfc/finally). (Laruence) . Drop Windows XP and 2003 support. (Pierre) . World domination . Improve set_exception_handler while doing reset.(Laruence) . Support constant array/string dereferencing. (Laruence) + . Add support for using empty() on the result of function calls and + other expressions (https://wiki.php.net/rfc/empty_isset_exprs). + (Nikita Popov) + +- Calendar: + . Fixed bug #54254 (cal_from_jd returns month = 6 when there is only one Adar) + (Stas, Eitan Mosenkis). - Core: + . Added boolval(). (Jille Timmermans). + . Fixed bug #18556 (Engine uses locale rules to handle class names). (Stas) . Fixed bug #61681 (Malformed grammar). (Nikita Popov, Etienne, Laruence). . Fixed bug #61038 (unpack("a5", "str\0\0") does not work as expected). (srgoogleguy, Gustavo) @@ -35,9 +45,16 @@ PHP NEWS CURLOPT_TRANSFER_ENCODING, CURLOPT_DNS_SERVERS and CURLOPT_USE_SSL. (Pierrick) . Fixed bug #55635 (CURLOPT_BINARYTRANSFER no longer used. The constant - still exists for backward compatibility but is doing nothing). (Pierrick) + still exists for backward compatibility but is doing nothing). (Pierrick) . Fixed bug #54995 (Missing CURLINFO_RESPONSE_CODE support). (Pierrick) +- Datetime + . Fixed bug #61642 (modify("+5 weekdays") returns Sunday). + (Dmitri Iouchtchenko) + +- Hash + . Added support for PBKDF2 via hash_pbkdf2(). (Anthony Ferrara) + - MySQLi . Dropped support for LOAD DATA LOCAL INFILE handlers when using libmysql. Known for stability problems. (Andrey) @@ -49,4 +66,7 @@ PHP NEWS - pgsql . Added pg_escape_literal() and pg_escape_identifier() (Yasuo) +- Zip: + . Upgraded libzip to 0.10.1 (Anatoliy) + <<< NOTE: Insert NEWS from last stable release here prior to actual release! >>> diff --git a/README.md b/README.md new file mode 100644 index 0000000000000..51973854db86f --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +The PHP Interpreter +=================== + +This is the github mirror of the official PHP repository located at +http://git.php.net. + +[![Build Status](https://secure.travis-ci.org/php/php-src.png?branch=master)](http://travis-ci.org/php/php-src) + +Pull Requests +============= +PHP accepts pull requests via github. Discussions are done on github, but +depending on the topic can also be relayed to the official PHP developer +mailinglist internals@lists.php.net. + +New features require an RFC and must be accepted by the developers. +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. + + Fix #55371: get_magic_quotes_gpc() throws deprecation warning + + After removing magic quotes, the get_magic_quotes_gpc function caused + a deprecate warning. get_magic_quotes_gpc can be used to detected + the magic_quotes behavior and therefore should not raise a warning at any + time. The patch removes this warning + +We do not merge pull requests directly on github. All PRs will be +pulled and pushed through http://git.php.net. diff --git a/UPGRADING b/UPGRADING index 27d01cbe94930..f95ab4962b176 100755 --- a/UPGRADING +++ b/UPGRADING @@ -21,13 +21,23 @@ PHP X.Y UPGRADE NOTES ======================================== - Drop Windows XP and 2003 support. (Pierre) +- All internal case insensitivity handling for class, function and constant + names is done according to ASCII rules, current locale settings are ignored. +- php_logo_guid(), php_egg_logo_guid(), php_real_logo_guid() and + zend_logo_guid() have been removed +- Removal of Logo GUIDs ======================================== 2. New Features ======================================== +- Support finally keyword. (Laruence) + (wiki.php.net/rfc/finally) - Support constant array/string dereferencing. (Laruence) (https://wiki.php.net/rfc/constdereference) +- Add support for using empty() on the result of function calls and + other expressions. Thus it is now possible to write empty(getArray()), + for example. (https://wiki.php.net/rfc/empty_isset_exprs) ======================================== 2. Changes in SAPI modules @@ -51,13 +61,63 @@ PHP X.Y UPGRADE NOTES - Implemented format character "Z": NUL-padded string - "a" now does not remove trailing NUL characters on unpack() anymore - "A" will now strip all trailing ASCII whitespace on unpack() (it used to - remove only trailing spaces. + remove only trailing spaces). +- MessageFormatter::format() and related functions now accepted named arguments + and mixed numeric/named arguments in ICU 4.8+. +- MessageFormatter::format() and related functions now don't error out when + an insufficient argument count is provided. Instead, the placeholders will + remain unsubstituted. +- MessageFormatter::parse() and MessageFormat::format() (and their static + equivalents) now don't throw away better than second precision in the + arguments. +- IntlDateFormatter::__construct and datefmt_create() now accept for the + $timezone argument time zone identifiers, IntlTimeZone objects, DateTimeZone + objects and NULL. It used to accept only time zone identifiers and NULL. + Invalid time zone identifiers are no longer accepted. Emptry strings are + no longer accepted. +- The default time zone used in IntlDateFormatter::__construct and + datefmt_create() (when the corresponding argument is not passed or NULL is + passed) is now the one given by date_default_timezone_get(), not the + default ICU time zone. +- The time zone passed to the IntlDateFormatter is ignored if it is NULL and if + the calendar passed is an IntlCalendar object -- in this case, the + IntlCalendar's time zone will be used instead. Otherwise, the time zone + specified in the $timezone argument is used instead. This does not affect + old code, as IntlCalendar was introduced in this version. +- IntlDateFormatter::__construct and datefmt_create() now accept for the + $calendar argument also IntlCalendar objects. +- IntlDateFormatter::getCalendar() and datefmt_get_calendar() return false + if the IntlDateFormatter was set up with an IntlCalendar instead of the + constants IntlDateFormatter::GREGORIAN/TRADITIONAL. IntlCalendar did not + exist before this version. +- IntlDateFormatter::setCalendar() and datefmt_set_calendar() now also accept + an IntlCalendar object, in which case its time zone is taken. Passing a + constant is still allowed, and still keeps the time zone. +- IntlDateFormatter::setTimeZoneID() and datefmt_set_timezone_id() are + deprecated. Use IntlDateFormatter::setTimeZone() or datefmt_set_timezone() + instead. +- IntlDateFormatter::format() and datefmt_format() now also accept an + IntlCalendar object for formatting. +- Deprecated mcrypt_ecb() made to produce E_DEPRECATED. +- php_logo_guid(), php_egg_logo_guid(), php_real_logo_guid() and + zend_logo_guid() have been removed ======================================== 5. New Functions ======================================== +- Core: + - boolval() + +- Hash: + - hash_pbkdf2() + - Intl: + - datefmt_format_object() + - datefmt_get_calendar_object() + - datefmt_get_timezone() + - datefmt_set_timezone() + - datefmt_get_calendar_object() - intlcal_create_instance() - intlcal_get_keyword_values_for_locale() - intlcal_get_now() @@ -98,6 +158,8 @@ PHP X.Y UPGRADE NOTES - intlcal_get_skipped_wall_time_option() - intlcal_set_repeated_wall_time_option() - intlcal_set_skipped_wall_time_option() + - intlcal_from_date_time() + - intlcal_to_date_time() - intlcal_get_error_code() - intlcal_get_error_message() - intlgregcal_create_instance() @@ -122,9 +184,16 @@ PHP X.Y UPGRADE NOTES - intltz_has_same_rules() - intltz_get_display_name() - intltz_get_dst_savings() + - intltz_from_date_time_zone() + - intltz_to_date_time_zone() - intltz_get_error_code() - intltz_get_error_message() + - IntlDateFormatter::formatObject() + - IntlDateFormatter::getCalendarObject() + - IntlDateFormatter::getTimeZone() + - IntlDateFormatter::setTimeZone() + - SPL: - SplFixedArray::__wakeup() @@ -136,6 +205,9 @@ PHP X.Y UPGRADE NOTES - IntlCalendar - IntlGregorianCalendar - IntlTimeZone + - IntlBreakIterator + - IntlRuleBasedBreakIterator + - IntlCodePointBreakIterator ======================================== 7. Removed Extensions @@ -146,6 +218,10 @@ PHP X.Y UPGRADE NOTES 8. Other Changes to Extensions ======================================== +- Intl: + - This extension now requires ICU 4.0+. + - Added intl.use_exceptions INI directive, which controls what happens when + global errors are set together with intl.error_level. ======================================== 9. New Global Constants @@ -160,3 +236,5 @@ PHP X.Y UPGRADE NOTES ======================================== 11. Other Changes ======================================== + +- Logo GUIDs will no longer work diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 015c752ad0620..90c7a4394fd5d 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -4,6 +4,7 @@ UPGRADE NOTES - PHP X.Y 1. Internal API changes a. Streams pooling API + b. Lowercasing and locales 2. Build system changes a. Unix build system changes @@ -26,6 +27,32 @@ PHPAPI int php_stream_context_set_link(php_stream_context *context, PHPAPI int php_stream_context_del_link(php_stream_context *context, php_stream *stream); + b. Lowercasing and locales + +The lowercasing functions in zend_operators.c were split into those that do +lowercasing according to locale rules and those that do ASCII lowercasing. +ASCII: + + zend_str_tolower_copy + zend_str_tolower_dup + zend_str_tolower + zend_binary_strcasecmp + zend_binary_strncasecmp + +Locale-based: + zend_binary_strncasecmp_l + zend_binary_strcasecmp_l + zend_binary_zval_strcasecmp + zend_binary_zval_strncasecmp + string_compare_function_ex + string_case_compare_function + +Internal engine lowercasing will be using ASCII-only rules. User-facing functions, +such as strcasecmp, will be using locale rules. + +Two new functions - zend_binary_strncasecmp_l and zend_binary_strcasecmp_l - added as +locale-based counterparts to zend_binary_strcasecmp and zend_binary_strncasecmp. + ======================== 2. Build system changes ======================== @@ -34,5 +61,5 @@ PHPAPI int php_stream_context_del_link(php_stream_context *context, - b. Windows build system changes - - + - Drop Windows XP and 2003 support. diff --git a/Zend/ChangeLog b/Zend/ChangeLog deleted file mode 100644 index ef4e71c87a0f3..0000000000000 --- a/Zend/ChangeLog +++ /dev/null @@ -1,22097 +0,0 @@ -2005-08-05 Dmitry Stogov - - * zend_execute.c - tests/array_type_hint_001.phpt - tests/bug33996.phpt: - Fixed bug #33996 (No information given for fatal error on passing invalid - value to typed argument) - - * zend_operators.c - tests/bug33999.phpt: - Fixed bug #33999 (object remains object when cast to int) - - * zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Fixed memory leak in foreach() on undefined variable - (Zend/tests/foreach_undefined.php) - -2005-08-04 Antony Dovgal - - * tests/foreach_undefined.phpt: - add test for the last Dmitry's fix - -2005-08-04 Dmitry Stogov - - * zend_compile.c: - Fixed possible memory corryption during compilation of - - * (PHP_5_0) - zend_objects.c: - Fixed clone bug in ze1_compatibility mode - - * zend_objects.c: - Fixed clone bug in ze1_compatibilty mode - -2005-08-03 Jani Taskinen - - * LICENSE: - - Bumber up year - - * acconfig.h - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.nw.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_default_classes.c - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_exceptions.c - zend_exceptions.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_ini.c - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l - zend_interfaces.c - zend_interfaces.h - zend_istdiostream.h - zend_iterators.c - zend_iterators.h - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_mm.c - zend_mm.h - zend_modules.h - zend_multibyte.c - zend_multibyte.h - zend_multiply.h - zend_object_handlers.c - zend_object_handlers.h - zend_objects.c - zend_objects.h - zend_objects_API.c - zend_objects_API.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_qsort.c - zend_qsort.h - zend_reflection_api.c - zend_reflection_api.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_static_allocator.c - zend_static_allocator.h - zend_stream.c - zend_stream.h - zend_strtod.h - zend_ts_hash.c - zend_ts_hash.h - zend_types.h - zend_variables.c - zend_variables.h - zend_vm.h: - Bump up the year - - * README.ZEND_VM: - Nuked DOS EOLs - -2005-08-02 Dmitry Stogov - - * zend_execute_API.c - zend_execute_API.c: - Fixed bug #33942 (the patch to #33156 crash cygwin except cli) - -2005-08-02 Jani Taskinen - - * zend_exceptions.c: - - Fixed bug #33967 (misuse of Exception constructor doesn\'t display - errorfile) - -2005-08-02 Dmitry Stogov - - * bench.php: - Removed warnings - -2005-07-29 Ilia Alshanetsky - - * zend_vm_def.h - zend_vm_execute.h: - Fixed warning message generated when isset() or empty() are given invalid - offset type. - -2005-07-29 Anantha Kesari H Y - - * acconfig.h - acconfig.h: - In NetWare few of the programs like apache2 and ldap use winsock inclusinf - sys/socket.h is not desirable. - --Kamesh - -2005-07-29 Jani Taskinen - - * zend_vm_execute.h: - update generated file - -2005-07-28 Andi Gutmans - - * zend_vm_def.h: - - Tiny fixlet - -2005-07-28 Marcus Boerger - - * zend_API.c - zend_API.h: - - Add convenience function zend_is_callable_ex() and base zend_is_callable - and zend_make_callable on it. This functions allows to check if a php - variable is a callable function and returns its function pointer as well - as object if possible. - -2005-07-26 Jani Taskinen - - * zend_execute_API.c: - bug #33865 - -2005-07-25 Marcus Boerger - - * zend_API.c: - - Fix #33853 - -2005-07-22 Dmitry Stogov - - * zend.c - zend.c - tests/bug33802.phpt - tests/bug33802.phpt - tests/bug33802.phpt: - Fixed bug #33802 (throw Exception in error handler causes crash) - -2005-07-21 Marcus Boerger - - * zend_execute_API.c: - - Fix error generation logic (found by johannes) - -2005-07-21 Dmitry Stogov - - * zend_vm_def.h: - Fixed bug with returning from internal function by reference - -2005-07-19 Marcus Boerger - - * zend_interfaces.c: - - Dont't warn in case an exception is pending - in this case it'd - superflous - -2005-07-19 Dmitry Stogov - - * zend_compile.c - zend_compile.c - zend_execute.c - zend_vm_execute.h - zend_vm_opcodes.h: - Fixed bug #33710 (ArrayAccess objects doen't initialize $this) - -2005-07-18 Rasmus Lerdorf - - * zend_language_scanner.l: - Valgrind is unhappy that this is not initialized - -2005-07-18 Dmitry Stogov - - * zend_API.c - zend_API.h: - Fixed bug in new module statrup mechanism - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug33558.phpt: - Fixed bug #33558 (warning with nested calls to functions returning by - reference) - - * tests/bug33558.phpt - tests/bug33558.phpt: - - Fixed bug #33558 (warning with nested calls to functions returning by - reference) - - * zend_vm_def.h - zend_vm_execute.h - zend_vm_gen.php - zend_vm_opcodes.h: - Removed some compilation warnings. - -2005-07-18 Jani Taskinen - - * tests/bug33710.phpt: - typo - -2005-07-17 Marcus Boerger - - * tests/bug33710.phpt: - - Add new test - -2005-07-17 Ilia Alshanetsky - - * zend_compile.c: - Added missing init. - -2005-07-14 Andi Gutmans - - * zend.h: - - Back to -dev - - * (php_5_1_0b3) - zend.h: - - Beta 3 - -2005-07-12 Andi Gutmans - - * zend.h: - - Back to -dev - - * (php_5_1_0b3) - zend.h: - - Beta 3 - -2005-07-12 Dmitry Stogov - - * (php_5_1_0b3) - zend_execute_API.c - zend_execute_API.c: - Fixed bug #33156 (cygwin version of setitimer doesn't accept ITIMER_PROF). - (Nuno) - -2005-07-11 Ilia Alshanetsky - - * zend_vm_def.h - zend_vm_execute.h: - Make references misuse emit E_NOTICE rather E_STRICT to be compatible with - PHP 4.4.0 - -2005-07-08 Jani Taskinen - - * tests/unset_cv05.phpt - tests/unset_cv06.phpt: - fix test when session.save_handler is "user" - -2005-07-07 Dmitry Stogov - - * zend.h - zend_API.c - zend_API.h - zend_compile.c - zend_compile.h - zend_object_handlers.c - zend_objects.c - zend_reflection_api.c: - Fixed bug #33512 (Add missing support for isset()/unset() overloading to - complement the property get/set methods) - -2005-07-07 Anantha Kesari H Y - - * zend_stream.c - zend_stream.c: - zend_stream_getc uses fread internally. NetWare LibC fread reads 4(Which I - believe EOT) for EOF(^D) character. This happens when fread is asked to - read one and only character as is the case with cl interactive mode. - -- Kamesh - -2005-07-07 Dmitry Stogov - - * zend_execute_API.c - zend_hash.c - zend_hash.h - tests/bug28072.phpt: - Fixed bug #28072 (static array with some constant keys will be incorrectly - ordered). - -2005-07-04 Dmitry Stogov - - * zend_compile.h - zend_execute.c - zend_language_parser.y - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Fixed SIGSEGV on 'global ${"{$blah}_ID"};' - - * zend_API.h - zend_execute_API.c: - Fixed bug #31158 (array_splice on $GLOBALS crashes) - -2005-07-03 Dmitry Stogov - - * zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Fixed memory leak - -2005-06-30 Dmitry Stogov - - * zend_API.c - zend_API.h: - Restored old behavior of zend_statup_module() - -2005-06-29 Stanislav Malyshev - - * zend_execute.c - zend_vm_def.h - zend_vm_execute.h: - fix conditions for freeing - - * zend_API.c - zend_API.c: - add comment - - * (PHP_5_0) - zend_execute.c: - fix conditions - -2005-06-28 Antony Dovgal - - * zend_execute.c: - fix leak: when dup was ful zend_std_object_get_class_name() - returns SUCCESS aka 0 - -2005-06-28 Stanislav Malyshev - - * zend_execute.c - zend_vm_def.h - zend_vm_execute.h: - fix previous patch - - * zend_vm_execute.h: - update - - * zend_execute.c - zend_vm_def.h: - fixes for non-php objects - - * (PHP_5_0) - zend_execute.c: - fixes fo rnon-php objects (John Coggeshall) - -2005-06-27 Jani Taskinen - - * zend.c: - - Fixed bug #31358 (Older GCC versions do not provide portable va_copy()). - -2005-06-27 Stanislav Malyshev - - * zend_API.c - zend_API.c - zend_API.h - zend_API.h - zend_builtin_functions.c - zend_builtin_functions.c - zend_exceptions.c - zend_exceptions.c: - fix various "Class entry requested for an object without PHP class" - messages - when working with non-PHP objects. - -2005-06-27 Dmitry Stogov - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Fixed SIGSEGV on assigment string offset by reference - - * zend_builtin_functions.c - zend_builtin_functions.c: - Fixed wrong include/requre occurrences in debug backtrace. - -2005-06-24 Dmitry Stogov - - * zend_execute.h - zend_vm_def.h - zend_vm_execute.h - zend_vm_gen.php - zend_vm_opcodes.h: - Export zend_do_fcall() helper from executor - - * zend_compile.c - zend_compile.c: - Partial fix for bug #26584 (Class member - array key overflow) - It doesn't fix integer overflow problem, but allows null, boolean and - double keys in array constants in the same way as in runtime. - - * tests/bug30519.phpt - tests/bug30519.phpt: - - Fixed bug #30519 (Interface not existing says Class not found) - - * zend_compile.c - zend_compile.c - zend_compile.h - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_execute_API.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug30519.phpt: - Fixed bug #30519 (Interface not existing says Class not found) - -2005-06-23 Dmitry Stogov - - * zend_builtin_functions.c - zend_builtin_functions.c - tests/bug28377.phpt: - Fixed bug #28377 (debug_backtrace is intermittently passing args) - - * tests/bug28377.phpt - tests/bug28377.phpt: - - file bug28377.phpt was initially added on branch PHP_5_0. - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug32660.phpt: - Fixed bug #32660 (Assignment by reference causes crash when field access is - overloaded (__get)) - - * tests/bug32660.phpt - tests/bug32660.phpt: - - Fixed bug #32660 (Assignment by reference causes crash when field access - is overloaded (__get)) - - * zend_builtin_functions.c - zend_builtin_functions.c - tests/bug30828.phpt: - Fixed bug #30828 (debug_backtrace() reports incorrect class in overridden - methods) - - * tests/bug30828.phpt - tests/bug30828.phpt: - - file bug30828.phpt was initially added on branch PHP_5_0. - - * (PHP_5_0) - tests/bug27268.phpt: - Test for bug #27268. It is fixed in HEAD but not in PHP_5_0. - - * zend_execute.c - tests/bug27268.phpt - tests/bug27268.phpt: - Fixed bug #27268 (Bad references accentuated by clone). - -2005-06-23 Andi Gutmans - - * zend.h: - - Back to -dev - - * (php_5_1_0b2) - zend.h: - - Beta 2 - -2005-06-22 Dmitry Stogov - - * (php_5_1_0b2) - zend_builtin_functions.c - zend_builtin_functions.c - zend_execute_API.c - zend_execute_API.c - tests/bug29896.phpt: - Fixed bug #29896 (Backtrace argument list out of sync) - - * tests/bug29896.phpt - tests/bug29896.phpt: - - file bug29896.phpt was initially added on branch PHP_5_0. - -2005-06-22 Stanislav Malyshev - - * (php_5_1_0b2) - zend_vm.h - zend_vm_execute.h - zend_vm_gen.php: - export zend_vm_set_opcode_handler - -2005-06-22 Antony Dovgal - - * (php_5_1_0b2) - zend_ini.c: - - allow to use "yes" and "true" with ini_set() and in commandline (through - -d flag) - - fix #15854 that was caused by wrong consideration that - zend_ini_boolean_displayer_cb() - always recieves converted to "0"/"1" values. - -2005-06-22 Dmitry Stogov - - * (php_5_1_0b2) - zend_compile.c - zend_compile.c - zend_compile.h - zend_compile.h - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug33257.phpt: - Fixed bug #33257 (array_splice() inconsistent when passed function instead - of variable) - - * tests/bug33257.phpt - tests/bug33257.phpt: - - file bug33257.phpt was initially added on branch PHP_5_0. - -2005-06-22 Jani Taskinen - - * (php_5_1_0b2) - tests/unset_cv05.phpt - tests/unset_cv06.phpt: - fix tests - -2005-06-21 Dmitry Stogov - - * tests/unset_cv07.phpt: - Fixed test file - -2005-06-21 Andi Gutmans - - * zend.h: - - Back to -dev. Guys (n' Girls), give at least 1 hour before you start - - complaining about not going back to -dev. I like checking the tarball - - before I change it back. - - * (php_5_1_0b2) - zend.h: - - Take #3 :) - -2005-06-21 Ilia Alshanetsky - - * (php_5_1_0b2) - zend_reflection_api.c: - Fixed memory leak. - - -2005-06-21 Dmitry Stogov - - * (PHP_5_0) - zend_compile.c: - Remove unnecessary ZEND_FETCH_CLASS together with - ZEND_DECLARE_INHERITED_CLASS - in case of early binding - - * (php_5_1_0b2) - zend_compile.c: - Remove unnecessary ZEND_FETCH_CLASS together with - ZEND_DECLARE_INHERITED_CLASS in case of early binding - -2005-06-20 Andi Gutmans - - * zend.h: - - Back to -dev - - * (php_5_1_0b2) - zend.h: - - Beta 2 - -2005-06-20 Dmitry Stogov - - * (php_5_1_0b2) - zend_object_handlers.c - zend_object_handlers.c: - Fixed possible crash on $x = $obj->$non_string - -2005-06-20 Marcus Boerger - - * (php_5_1_0b2) - zend_reflection_api.c: - - Fix bug #33389 by fixing copying - - * zend_reflection_api.c: - - Show true/flase - -2005-06-19 Derick Rethans - - * tests/bug32226.phpt: - - Fixed layout of test description. - -2005-06-17 Jani Taskinen - - * tests/bug29368.phpt - tests/bug30856.phpt - tests/bug30961.phpt - tests/bug31720.phpt - tests/bug32226.phpt - tests/bug33277.phpt: - No short-tags! - -2005-06-17 Dmitry Stogov - - * zend_compile.h - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Removed EX(fbc_constructor) (it is no longer needed) - -2005-06-17 Antony Dovgal - - * (PHP_5_0) - zend_API.c - zend_list.c: - MFH: improve error messages in internal classes - - * zend_API.c - zend_list.c: - improve error messages when error raised from an internal class (do not - hide class name) - -2005-06-17 Dmitry Stogov - - * zend_object_handlers.c - zend_object_handlers.c: - Fixed bug #33277 (private method accessed by child class) - -2005-06-17 Antony Dovgal - - * zend_hash.c: - fix bug #33382 (array_reverse() fails after *sort()) - no need to MFH - the bug existed only in HEAD - -2005-06-17 Dmitry Stogov - - * zend_API.c - zend_API.h - zend_extensions.h - zend_modules.h: - Improved PHP extension loading mechanism with support for module - dependencies and conflicts. - -2005-06-16 Marcus Boerger - - * zend_reflection_api.c: - - Internal functions/methods can now return by reference - - * zend_execute.c: - - Fix TSRM build - -2005-06-16 Dmitry Stogov - - * bench.php: - typo - - * zend.h - zend_API.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_extensions.h - zend_modules.h - zend_object_handlers.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Allowed return by refrence from internal functions - -2005-06-16 Stanislav Malyshev - - * zend_execute.c - zend_execute.h: - rename to zend_ - -2005-06-16 Dmitry Stogov - - * zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug33318.phpt: - Fixed bug #33318 (throw 1; results in Invalid opcode 108/1/8) - -2005-06-16 Zeev Suraski - - * zend_language_scanner.l: - Fixlet - -2005-06-16 Dmitry Stogov - - * zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Compilation warnings - - * zend_compile.c - zend_compile.h - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - ZEND_UNSET_DIM_OBJ is splitted to ZEND_UNSET_DIM and ZEND_UNSET_OBJ. - -2005-06-16 Stanislav Malyshev - - * zend_execute.c - zend_execute.h: - export zval getters - -2005-06-16 Dmitry Stogov - - * zend_execute.h - zend_vm_def.h - zend_vm_execute.h - zend_vm_gen.php - zend_vm_opcodes.h: - USER_OPCODE API is improvet. - Implemented ability to dispatch from user handler to internal handler of - another opcode. - -2005-06-15 Dmitry Stogov - - * zend.c - zend.h: - Fixed OS X compatibility - -2005-06-15 Jani Taskinen - - * tests/bug32428.phpt: - typofix - -2005-06-14 Ilia Alshanetsky - - * bench.php: - more accurate timing function. - -2005-06-14 Dmitry Stogov - - * zend_vm_execute.h - zend_vm_gen.php - zend_vm_opcodes.h: - Removed old executor - -2005-06-14 Jani Taskinen - - * Zend.m4: - reordered + added msg to configure output for PHP_ZEND_VM - - * Zend.m4: - typofix - - * Zend.m4 - acinclude.m4: - fix standalone build - -2005-06-13 Dmitry Stogov - - * zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_gen.php - zend_vm_opcodes.h: - Specializer optimization - - * zend.c - zend.h - zend_execute.c: - Fixed bug #33212 ([GCC 4]: 'zend_error_noreturn' aliased to external symbol - 'zend_error'). - The fix is not tested on Solaris and DARWIN! - - * zend_reflection_api.c - tests/bug33312.phpt: - Fixed bug #33312 (ReflectionParameter methods do not work correctly) - -2005-06-11 Andi Gutmans - - * zend.h: - - Back to -dev - - * (php_5_1_0b2) - zend.h: - - b2 (will post it to internals@) - -2005-06-10 Andi Gutmans - - * zend.h: - - Back to -dev - - * (php_5_1_0b1) - zend.h: - - Go with 5.1.0b1 - -2005-06-10 Dmitry Stogov - - * (php_5_1_0b1) - tests/bug30162.phpt: - Added test for bug #30162 (it is already fixed but test file was forgotten) - - * (php_5_1_0b1) - tests/bug31177.phpt: - Added test file for bug #31177 (not fixed yet) - - * tests/bug31177.phpt - tests/bug31177.phpt: - - file bug31177.phpt was initially added on branch PHP_5_0. - - * (php_5_1_0b1) - tests/bug29689.phpt: - typos - - * (php_5_1_0b1) - zend_reflection_api.c - zend_reflection_api.c: - Fixed support for ZEND_ACC_SHADOW in ReflectionProperty constructor - - * (php_5_1_0b1) - zend_execute.c - zend_execute.h - zend_extensions.h - zend_vm_def.h - zend_vm_execute.h - zend_vm_gen.php - zend_vm_opcodes.h: - Fix so that extensions like xdebug, can overload opcodes in all execution - modes including goto/switch - - * (php_5_1_0b1) - zend_compile.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Merge three opcodes (ZEND_NEW, ZEND_JMP_NO_CTOR, ZEND_INIT_CTOR) into one - (ZEND_NEW). There was no real reason for this anymore and API should be - changed before 5.1 - -2005-06-09 Stanislav Malyshev - - * zend_compile.c - zend_compile.h - zend_object_handlers.c - zend_reflection_api.c - tests/bug29689.phpt: - MF50: fix #29689 and more private property problems - - * tests/bug33277.phpt: - add test for this TBF bug - - * zend_compile.c: - disallow abstrace private methods - - * (PHP_5_0) - zend_compile.c: - Disallow abstract privae methods - - * (PHP_5_0) - zend_compile.c - zend_compile.h - zend_object_handlers.c - zend_reflection_api.c - tests/bug29689.phpt: - fix #29689 and more private property problems - -2005-06-09 Dmitry Stogov - - * zend.c - zend.c - zend_execute_API.c - zend_execute_API.c: - Fixed double call to php_stream_close() on compiler errors - -2005-06-09 Stanislav Malyshev - - * tests/bug33277.phpt - tests/bug33277.phpt: - - file bug33277.phpt was initially added on branch PHP_5_0. - -2005-06-09 Dmitry Stogov - - * zend.c - zend.c: - Fixed bug #25922 (In error handler, modifying 5th arg (errcontext) may - result in seg fault) - - * zend_language_scanner.l - zend_language_scanner.l: - Fixed bug (Crash on Windows and ZTS) that was introduced with fix for bug - #26456 - -2005-06-08 Dmitry Stogov - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Fixed exception handling in getIterator() callback (bugs #26229 & #30725) - - * zend_compile.c - zend_compile.c: - Fixed valgrind errors - - * zend_reflection_api.c: - Fixed ReflectionClass::setStaticPropertyValue() - -2005-06-08 Jani Taskinen - - * zend_config.w32.h: - Hopefully fixes win32 builds - -2005-06-08 Dmitry Stogov - - * zend_compile.c: - Fixed lookups for previos opcodes - - * zend_execute_API.c - zend_execute_API.c - tests/bug30140.phpt: - Fixed bug #30140 (Problem with array in static properties) - - * tests/bug30140.phpt - tests/bug30140.phpt: - - file bug30140.phpt was initially added on branch PHP_5_0. - - * (PHP_5_0) - tests/bug32322.phpt: - Added test for bug #32322 (Return values by reference broken( using - self::),example singleton instance) - - * tests/bug32322.phpt - tests/bug32322.phpt: - - Added test for bug #32322 (Return values by reference broken( using - self::),example singleton instance) - - * zend_object_handlers.c - zend_object_handlers.c - tests/bug30820.phpt: - Fixed bug #30820 (static member conflict with $this->member silently - ignored) - - * tests/bug30820.phpt - tests/bug30820.phpt: - - file bug30820.phpt was initially added on branch PHP_5_0. - - * zend_compile.c - zend_compile.c - zend_language_parser.y - zend_language_parser.y - tests/bug30961.phpt: - Fixed bug #30961 (Wrong linenumber in ReflectionClass getStartLine()) - - * tests/bug30961.phpt - tests/bug30961.phpt: - - file bug30961.phpt was initially added on branch PHP_5_0. - -2005-06-07 Dmitry Stogov - - * zend_compile.c - zend_compile.c - zend_compile.h - zend_compile.h - zend_language_scanner.l - zend_language_scanner.l: - Fixed bug #26456 (Wrong results from Reflection-API getDocComment() when - called via STDIN) - -2005-06-07 Jani Taskinen - - * Zend.m4: - -Moved --disable-zend-memory-manager where it belongs - - * acinclude.m4: - - Show "none" when nothing is found - -2005-06-07 Ilia Alshanetsky - - * zend_objects.c: - Fixed ZTS build. - -2005-06-07 Derick Rethans - - * (PHP_5_0) - zend_alloc.h: - - MFH: Added the --disable-zend-memory-manager switch to disable the Zend - memory manager. - - * zend_alloc.h: - - Added the --disable-zend-memory-manager switch to disable the Zend memory - manager. - -2005-06-07 Dmitry Stogov - - * zend_builtin_functions.c - zend_builtin_functions.c: - Fixed memory leak in debug_print_backtrace() - - * zend_execute.c - zend_execute.c: - fixed memory leak in bug #28972 ([] operator overflow treatment is - incorrect), not the bug itself. - -2005-06-07 Derick Rethans - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - - MF44: Problems with user defined error handler and references - -2005-06-07 Dmitry Stogov - - * zend_objects.c - zend_objects.c - tests/bug33243.phpt: - Fixed bug #33243 (ze1_compatibility_mode does not work as expected) - - * tests/bug33243.phpt - tests/bug33243.phpt: - - file bug33243.phpt was initially added on branch PHP_5_0. - -2005-06-07 Dmitry Stogov - - * zend_compile.c - zend_compile.c - zend_compile.h - zend_compile.h - zend_language_scanner.l - zend_language_scanner.l: - Fixed bug #26456 (Wrong results from Reflection-API getDocComment() when - called via STDIN) - -2005-06-07 Jani Taskinen - - * Zend.m4: - -Moved --disable-zend-memory-manager where it belongs - - * acinclude.m4: - - Show "none" when nothing is found - -2005-06-07 Ilia Alshanetsky - - * zend_objects.c: - Fixed ZTS build. - -2005-06-07 Derick Rethans - - * (PHP_5_0) - zend_alloc.h: - - MFH: Added the --disable-zend-memory-manager switch to disable the Zend - memory manager. - - * zend_alloc.h: - - Added the --disable-zend-memory-manager switch to disable the Zend memory - manager. - -2005-06-07 Dmitry Stogov - - * zend_builtin_functions.c - zend_builtin_functions.c: - Fixed memory leak in debug_print_backtrace() - - * zend_execute.c - zend_execute.c: - fixed memory leak in bug #28972 ([] operator overflow treatment is - incorrect), not the bug itself. - -2005-06-07 Derick Rethans - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - - MF44: Problems with user defined error handler and references - -2005-06-07 Dmitry Stogov - - * zend_objects.c - zend_objects.c - tests/bug33243.phpt: - Fixed bug #33243 (ze1_compatibility_mode does not work as expected) - - * tests/bug33243.phpt - tests/bug33243.phpt: - - file bug33243.phpt was initially added on branch PHP_5_0. - -2005-06-06 Derick Rethans - - * zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - - Regenerate VM files and add warning about regeneration - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h: - - MH44: Problems with user defined error handler and wrong usage of - references - -2005-06-06 Dmitry Stogov - - * zend_compile.c - tests/bug32428.phpt: - Fixed bug #32428 (The @ warning error supression operator is broken) - - * zend_objects_API.c - zend_objects_API.c - tests/bug32799.phpt: - Fixed bug #32799 (crash: calling the corresponding global var during the - destruct) - - * tests/bug32799.phpt - tests/bug32799.phpt: - - file bug32799.phpt was initially added on branch PHP_5_0. - - * tests/bug32596.phpt: - Added test for bug #32596 (Segfault/Memory Leak by getClass (etc) in - __destruct) - - * tests/bug32596.phpt - tests/bug32596.phpt: - - file bug32596.phpt was initially added on branch PHP_5_0. - - * (PHP_5_0) - zend_execute_API.c: - Fixed bug #32596 (Segfault/Memory Leak by getClass (etc) in __destruct) - - * (PHP_5_0) - tests/bug32993.phpt: - Added test for bug #32993 (implemented Iterator function current() don't - throw - exception) - - * tests/bug32993.phpt - tests/bug32993.phpt: - - Fixed bug #32993 (implemented Iterator function current() don't throw - exception) - - * zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Fixed bug #32993 (implemented Iterator function current() don't throw - exception) - - * zend_object_handlers.c - zend_object_handlers.c - tests/bug33171.phpt: - Fixed bug #33171 (foreach enumerates private fields declared in base - classes) - - * tests/bug33171.phpt - tests/bug33171.phpt: - - file bug33171.phpt was initially added on branch PHP_5_0. - -2005-06-06 Wez Furlong - - * zend_language_scanner.l: - Avoid double-freeing streams. - This can happen because all streams are registered as resources; - the engine also tracks them in the open_files global. - - Avoid the potential for double-freeing by simply making streams exposed to - the - engine have no closer for the engine to call; they will already be in the - resource list, and thus will be shut down properly at request end. - -2005-06-04 Zeev Suraski - - * zend_compile.h - zend_language_parser.y - zend_language_scanner.l - zend_stream.c - zend_stream.h - tests/halt01.phpt - tests/halt02.phpt - tests/halt03.phpt: - Thought I committed it ages ago... Anyway, without further delays, the - final - __halt_compiler() patch - -2005-06-03 Dmitry Stogov - - * tests/bug30394.phpt: - Added test for 5.0 specific bug #30394 (Assignment operators yield wrong - result with __get/__set) - - * (PHP_5_0) - zend.c - zend_execute_API.c - tests/bug30394.phpt - tests/bug30394.phpt: - Fixed bug #30394 (Assignment operators yield wrong result with __get/__set) - - * zend_compile.c - zend_compile.c - tests/bug30080.phpt: - Fixed bug #30080 (Passing array or non array of objects) - - * tests/bug30080.phpt - tests/bug30080.phpt: - - file bug30080.phpt was initially added on branch PHP_5_0. - - * zend_compile.c - zend_compile.c - zend_execute.c - tests/bug27598.phpt: - Fixed bug #27598 (list() array key assignment causes HUGE memory leak) - - * tests/bug27598.phpt - tests/bug27598.phpt: - - file bug27598.phpt was initially added on branch PHP_5_0. - - * zend_execute.c - zend_object_handlers.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/object_handlers.phpt: - Fixed memory allocation bugs related to magic object handlers (__get(), - __set(), - ...) - - * tests/object_handlers.phpt - tests/object_handlers.phpt: - - file object_handlers.phpt was initially added on branch PHP_5_0. - - * (PHP_5_0) - zend_execute.c - zend_object_handlers.c: - Fixed memory allocation bugs related to magic object handlers (__get(), - __set(), ...) - -2005-06-01 Dmitry Stogov - - * zend_object_handlers.c - zend_object_handlers.c - tests/bug30791.phpt: - Fixed bug #30791 (magic methods (__sleep/__wakeup/__toString) call __call - if object is overloaded) - - * tests/bug30791.phpt - tests/bug30791.phpt: - - file bug30791.phpt was initially added on branch PHP_5_0. - -2005-05-31 Magnus Määttä - - * tests/bug27304.phpt: - Fix test - -2005-05-31 Dmitry Stogov - - * zend_operators.c: - Reverted wrong fix for bug #30572. - Seems the bug was already fixed in other way. - But reverted patch produced a lot of valgrind errors, because IS_TMP_VAR - operands don't initialize refcount. - -2005-05-31 Marcus Boerger - - * zend_compile.c: - - Only allow changing return ref agnostic when a script method overrides an - internal method (found by dmitry) - -2005-05-29 Jani Taskinen - - * Zend.m4: - - Unify the "configure --help" texts - -2005-05-29 Hartmut Holzgraefe - - * acinclude.m4: - forgot to re-add 1.875 as a valid bison version after testing - - * acinclude.m4: - bison may be installed under a different executable name, e.g. - - YACC="bison-1.75" configure ... - - removing the check for "bison -y" allows for this - the check was redundant anyway as the following one filters - for "GNU Bison" in the --version output - - * Zend.m4 - acinclude.m4: - avoid code duplication in bison version test - -2005-05-28 Marcus Boerger - - * zend_compile.c - zend_compile.h: - - Make zend_do_inheritance ZEND_API - -2005-05-27 Dmitry Stogov - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug22836.phpt - tests/bug22836.phpt: - Fixed bug #22836 (returning reference to uninitialized variable) - -2005-05-26 Dmitry Stogov - - * (PHP_5_0) - zend_execute_API.c - tests/bug33116.phpt: - Fixed bug #33116 (crash when assigning class name to global variable in - __autoload) - - * tests/bug33116.phpt - tests/bug33116.phpt: - - Fixed bug #33116 (crash when assigning class name to global variable in - __autoload). - - * zend_execute_API.c: - Fixed bug #33116 (crash when assigning class name to global variable in - __autoload). - - * zend_API.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_reflection_api.c - tests/array_type_hint_001.phpt: - Added array type hinting. (This patch requires full re-make) - -2005-05-26 Marcus Boerger - - * (PHP_5_0) - tests/bug27304.phpt - tests/bug32981.phpt: - - Add new tests - - * tests/bug27304.phpt - tests/bug27304.phpt - tests/bug32981.phpt - tests/bug32981.phpt: - - - Add new tests - -2005-05-22 Ilia Alshanetsky - - * (PHP_5_0) - zend_highlight.c: - MFH: Fixed bug #29338 (unencoded spaces get ignored after certain tags). - - * zend_highlight.c: - Fixed bug #29338 (unencoded spaces get ignored after certain tags). - -2005-05-22 Stanislav Malyshev - - * zend.c - zend.c: - fix leak - -2005-05-19 Dmitry Stogov - - * (PHP_5_0) - zend_object_handlers.c: - Backported fix for bug #30451 - - * tests/bug31828.phpt - tests/bug31828.phpt - tests/bug32080.phpt - tests/bug32080.phpt: - Strict warnings - -2005-05-18 Stanislav Malyshev - - * zend.c - zend.c: - fix for #29890 - part 2 - - * (PHP_5_0) - tests/bug29890.phpt: - test - - * tests/bug29890.phpt - tests/bug29890.phpt: - - test - - * zend_execute_API.c - zend_execute_API.c: - fix #29890 - crash when function call fails - - * zend_object_handlers.c: - revert - seems to be fixed elsewhere - - * zend_object_handlers.c: - fix #30451 static properties don't work properly - - * tests/bug29689.phpt - tests/bug30451.phpt: - tests - - * tests/bug29689.phpt - tests/bug29689.phpt - tests/bug30451.phpt - tests/bug30451.phpt: - - file bug29689.phpt was initially added on branch PHP_5_0. - -2005-05-17 Magnus Määttä - - * tests/bug31828.phpt - tests/bug32080.phpt: - Fix tests. - -2005-05-13 Antony Dovgal - - * (PHP_5_0) - zend.c: - MFH: fix bug #29975 (memory leaks when set_error_handler() is used inside - error handler) - - * zend.c: - fix bug #29975 (memory leaks when set_error_handler() is used inside error - handler) - -2005-05-12 Marcus Boerger - - * zend_reflection_api.c: - - Make ReflectionObject::hasProperty() recognize dynamically added props - -2005-05-06 Jani Taskinen - - * zend_object_handlers.h: - typofix :) - -2005-05-05 Dmitry Stogov - - * zend_compile.c - zend_compile.c - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug31525.phpt: - Fixed bug #31525 (object reference being dropped. $this getting lost) - - * tests/bug31525.phpt - tests/bug31525.phpt: - - file bug31525.phpt was initially added on branch PHP_5_0. - -2005-05-04 Stanislav Malyshev - - * zend.c: - fix bug #32924: prepend does not add file to included files - - * (PHP_5_0) - zend_execute.c: - clarify some magic - -2005-05-04 Dmitry Stogov - - * zend_execute.c: - Fixed bug #30641 (Compile error: error: symbol "zend_error" is used but not - defined) - - * tests/bug30707.phpt - tests/bug30707.phpt: - - file bug30707.phpt was initially added on branch PHP_5_0. - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug30707.phpt: - Fixed bug #30707 (Segmentation fault on exception in method) - - * (PHP_5_0) - zend_execute.c: - ws - - * tests/bug30162.phpt - tests/bug30162.phpt: - - file bug30162.phpt was initially added on branch PHP_5_0. - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug30161.phpt: - Fixed bug #30162 (Catching exception in constructor couses lose of $this) - -2005-05-03 Dmitry Stogov - - * tests/unset_cv07.phpt: - Fixed notice message - -2005-05-03 Marcus Boerger - - * (PHP_5_0) - tests/bug32252.phpt: - - Add test - -2005-05-03 Dmitry Stogov - - * zend_object_handlers.c: - Fixed destruction of zval after returning from __call() - - * zend_builtin_functions.c - zend_builtin_functions.c - tests/bug32296.phpt: - Fixed bug #32296 (get_class_methods output has changed between 5.0.2 and - 5.0.3) - Now get_class_methods() shows accessible private and protected methods if - it is called from class scope. - - * tests/bug32296.phpt - tests/bug32296.phpt: - - file bug32296.phpt was initially added on branch PHP_5_0. - -2005-05-02 Marcus Boerger - - * zend_builtin_functions.c - zend_object_handlers.c - zend_object_handlers.h: - - Extend API to support real existance test without the need to add any new - functions or change any behavior - - * zend_execute_API.c: - - Part 2 of #30126: Enhancement for error message for abstract classes - - * zend_execute_API.c: - - Part 1 of #30126: Enhancement for error message for abstract classes - -2005-04-29 Jani Taskinen - - * zend_object_handlers.c: - compile fix - - * tests/bug30332.phpt - tests/bug32852.phpt: - Make sure E_STRICT is set always - -2005-04-29 Dmitry Stogov - - * zend_API.c - zend_API.c - tests/bug30332.phpt: - Fixed bug #30332 (zend.ze1_compatibility_mode isnt fully compatable with - array_push()) - - * tests/bug30332.phpt - tests/bug30332.phpt: - - file bug30332.phpt was initially added on branch PHP_5_0. - - * zend_execute.c - zend_execute.c - tests/bug31828.phpt - tests/bug32080.phpt - tests/bug32852.phpt: - Fixed bug #32852 (Crash with singleton and __destruct when - zend.ze1_compatibility_mode = On) - Fixed bug #31828 (Crash with zend.ze1_compatibility_mode=On) - Fixed bug #32080 (segfault when assigning object to itself with - zend.ze1_compatibility_mode=On) - - * tests/bug31828.phpt - tests/bug31828.phpt - tests/bug32080.phpt - tests/bug32080.phpt - tests/bug32852.phpt - tests/bug32852.phpt: - - file bug31828.phpt was initially added on branch PHP_5_0. - -2005-04-29 Jani Taskinen - - * tests/bug22836.phpt - tests/bug27641.phpt: - - Unify error_reporting setting + make sure E_STRICT is set when wanted - -2005-04-28 Dmitry Stogov - - * zend_object_handlers.c - zend_object_handlers.c - tests/bug29015.phpt: - Fixed bug #29015 (Incorrect behavior of member vars(non string - ones)-numeric mem vars und others) - - * tests/bug29015.phpt - tests/bug29015.phpt: - - file bug29015.phpt was initially added on branch PHP_5_0. - -2005-04-27 Dmitry Stogov - - * zend_API.c - zend_API.h - zend_object_handlers.c - zend_object_handlers.h - tests/bug29210.phpt: - Fixed bug #29210 (Function: is_callable - no support for private and - protected classes) - - * (PHP_5_0) - zend_API.c - zend_API.h - zend_object_handlers.c - zend_object_handlers.h - tests/bug29210.phpt - tests/bug29210.phpt: - Fixed bug #29210 (Function: is_callable - no support for private and - protected classes). - - * zend_compile.c - zend_compile.c - tests/bug29104.phpt - tests/bug29104.phpt - tests/bug29104.phpt: - Fixed bug #29104 (Function declaration in method doesn't work) - - * zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug32833.phpt: - Fixed bug #32833 (Invalid opcode) - - * tests/bug32674.phpt - tests/bug32674.phpt: - - file bug32674.phpt was initially added on branch PHP_5_0. - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug32674.phpt: - Fixed bug #32674 (exception in iterator causes crash) - -2005-04-26 Dmitry Stogov - - * tests/bug30889.phpt - tests/bug30889.phpt: - - file bug30889.phpt was initially added on branch PHP_5_0. - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug30889.phpt: - Fixed bug #30889 (Conflict between __get/__set and ++ operator) - - * tests/bug32429.phpt: - fix - - * zend_API.c - zend_API.c - tests/bug30702.phpt: - Fixed bug #30702 (cannot initialize class variable from class constant) - - * tests/bug30702.phpt - tests/bug30702.phpt: - - file bug30702.phpt was initially added on branch PHP_5_0. - - * zend_compile.c - tests/bug32427.phpt: - Fixed bug #32427 (Interfaces are not allowed 'static' access modifier). - - * zend_builtin_functions.c - tests/bug32429.phpt: - Fixed bug #32429 (method_exists() always return TRUE if __call method - exists) - -2005-04-25 Andrei Zmievski - - * zend_object_handlers.c: - Reverting. Let's not introduce major BC breakage like this without a - good reason. - -2005-04-25 Dmitry Stogov - - * tests/bug29944.phpt - tests/bug29944.phpt: - - Fixed bug #29944 (Function defined in switch, crashes). - - * zend_compile.c - zend_compile.c - tests/bug29944.phpt: - Fixed bug #29944 (Function defined in switch, crashes). - -2005-04-25 Jani Taskinen - - * zend_hash.c: - ws - -2005-04-25 Dmitry Stogov - - * zend_hash.c: - Fixed call to estrndup() with invalid length - - * (PHP_5_0) - zend_hash.c: - Fixed call to estrndup() with invalid lengt - -2005-04-25 Sebastian Bergmann - - * zend_reflection_api.c: - Correct grammar. - -2005-04-24 Marcus Boerger - - * zend_compile.c: - - Need to copy doc comments correct for properties - -2005-04-23 Marcus Boerger - - * tests/bug29674.phpt - tests/bug30161.phpt - tests/bug30346.phpt: - - Add new tests - -2005-04-21 Jani Taskinen - - * tests/unset_cv05.phpt: - Fix test when register_long_arrays is off in your php.ini - -2005-04-19 Marcus Boerger - - * zend_API.c - zend_API.h - zend_compile.c - zend_compile.h - zend_reflection_api.c: - - Add ReflectionProperty::getDocComment() - -2005-04-19 Jani Taskinen - - * zend_compile.c - zend_exceptions.c: - No c++ comments in C code - -2005-04-18 Dmitry Stogov - - * zend_builtin_functions.c - zend_builtin_functions.c - zend_execute.c: - Fixed memory leak in debug_backtrace() - -2005-04-17 Marcus Boerger - - * zend_builtin_functions.c: - - Fix special cases of property_exists() - - * zend_object_handlers.c: - - Fix logic - -2005-04-16 Sara Golemon - - * tests/method_exists.phpt: - method_exists() regression test - - * zend_builtin_functions.c: - Fix method_exists(), pce is fetched, but ce is used - -2005-04-15 Marcus Boerger - - * zend_builtin_functions.c: - - Fix even though we already know that the function will be renamed - -2005-04-15 Andrei Zmievski - - * zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Fix certain operations to stop relying on presence of read_property and - write_property handlers. They may be NULL'ed out by certain objects - pretending to be pure arrays, for example. Do checks first. - -2005-04-12 Stanislav Malyshev - - * zend_ini.c: - fix memory corruption if one on the on_modify handlers errors out - - * (PHP_5_0) - zend_ini.c: - fi memory corruption if one on the on_modify handlers errors out - -2005-04-08 Marcus Boerger - - * zend_operators.c: - - Fix memory corruption found by rob - - * tests/bug22836.phpt: - - Ensure we see all errors. No need for () in return - - * zend_builtin_functions.c: - - Add property_exits() - - * zend_object_handlers.c: - - No E_ERROR when we just check (where did my 0->1 change go on first - commit?) - - * zend_object_handlers.c: - - No E_ERROR when we just check, here visibility simply means there is none - - * zend_object_handlers.c - zend_object_handlers.h: - - Simplify getting property info and make it an api function - -2005-04-07 Jani Taskinen - - * zend_alloc.c - zend_alloc.h: - - Nuke the code duplication - - * zend_alloc.h: - Fix build when USE_ZEND_ALLOC is 0 - -2005-04-07 Zeev Suraski - - * (PHP_5_0) - zend_alloc.c - zend_alloc.h: - MFH (Fix strdup() bug when USE_ZEND_ALLOC was disabled) - - * zend_alloc.c - zend_alloc.h: - Fix strdup() bug when USE_ZEND_ALLOC is disabled - -2005-04-05 Marcus Boerger - - * zend_interfaces.c: - - Just return FAILURE & allow NULL without emmidiate error - -2005-04-04 Stanislav Malyshev - - * zend_builtin_functions.c: - MF50: fix backtraces - non-Zend classes have names too - - * (PHP_5_0) - zend_builtin_functions.c: - fix backtraces - non-Zend classes have names too - -2005-04-03 Jani Taskinen - - * (PHP_5_0) - zend_execute_API.c: - MFH: - Fixed bug #28839 (SIGSEGV in interactive mode (php -a)). - MFH: (kameshj at fastmail dot fm) - -2005-03-31 Derick Rethans - - * (PHP_5_0) - zend_API.c: - - MFH: internal_function->fn_flags is not initialized at this point - -2005-03-26 Jani Taskinen - - * zend_execute_API.c: - - Fixed bug #28839 (SIGSEGV in interactive mode (php -a)) - (kameshj at fastmail dot fm) - -2005-03-24 Marcus Boerger - - * zend_vm_execute.h: - - Second part of removing temp solution - - * zend_vm_def.h: - - Remove potential bad solution for now - -2005-03-23 Andrei Zmievski - - * zend_execute.c: - Consolidate: call _get_zval_ptr_var() for IS_VAR case in - _get_zval_ptr(). - -2005-03-21 Andi Gutmans - - * (PHP_5_0) - zend_execute.c: - - Fix memset() bug (Joe Orton) - -2005-03-21 Andrei Zmievski - - * zend_API.c: - internal_function->fn_flags is not initialized at this point - -2005-03-20 Marcus Boerger - - * tests/bug31102.phpt: - - Added missing description (thanks jani) - - * tests/bug31102.phpt: - - Add new test - -2005-03-19 Marcus Boerger - - * zend_object_handlers.c: - - More fixes to gracefully act on exception thrown in overload methods - - * zend_object_handlers.c: - - Fix #31185 - - * zend_execute_API.c: - - Fix all incarnations of bug #30266 - -2005-03-19 Andi Gutmans - - * zend_interfaces.c - zend_interfaces.h: - - Fix typos - -2005-03-16 Wez Furlong - - * (PHP_5_0) - zend_API.c: - MFH: don't call rshutdown twice for dl()'d modules. - - * zend_API.c: - don't call rshutdown twice for dl()'d modules. - Spotted by Andrei. - -2005-03-15 Wez Furlong - - * zend.c - zend_API.c - zend_modules.h: - fix shutdown so that dl()'d modules are unloaded after all the dtors have - been called. - -2005-03-14 Zeev Suraski - - * zend_ini.c: - Clarify logic - -2005-03-14 Stanislav Malyshev - - * zend_builtin_functions.c - zend_builtin_functions.c: - ws - -2005-03-13 Stanislav Malyshev - - * zend_stream.c - zend_stream.c: - Do not convert ZEND_HANDLE_FP to ZEND_HANDLE_STREAM but allow using - reader/closer - on it - -2005-03-13 Marcus Boerger - - * zend_interfaces.c: - - More exact signatures (even though complete correct not possible atm) - -2005-03-13 Stanislav Malyshev - - * zend_builtin_functions.c - zend_builtin_functions.c: - Fix get_extension_funcs() - extension names are now lowercased, so should - be function arguments. - -2005-03-13 Marcus Boerger - - * zend_execute_API.c: - - Actually this is a much better error decription - - * zend_execute_API.c - tests/bug32290.phpt - tests/bug32290.phpt: - - Bugfix #32290 - -2005-03-12 Marcus Boerger - - * zend_vm_def.h - zend_vm_execute.h: - - If an exception is pending we don't bail out but show the unhandled - exception - -2005-03-11 Anantha Kesari H Y - - * (PHP_5_0) - acconfig.h: - NetWare LibC's sys/types.h does not include sys/select.h implicitly as it - is the case with Linux LibC - -2005-03-11 Marcus Boerger - - * tests/bug32252.phpt: - - Add new test - - * tests/bug27145.phpt - tests/bug27145.phpt: - - Irrelevant - - * zend_object_handlers.c: - - Don't touch refcount/is_ref - -2005-03-10 Marcus Boerger - - * tests/bug28442.phpt - tests/bug28442.phpt: - - - Bugfix #28442 - - * zend_compile.c: - - Bugfix #28442 - -2005-03-10 Anantha Kesari H Y - - * (PHP_5_0) - acconfig.h: - Autoconf based build can be used for NetWare - - * (PHP_5_0) - zend.h: - NetWare can make use of ./configure generated zend_config.h - - * (PHP_5_0) - Zend.m4: - This patch is needed for cross compilation to go through - -2005-03-10 Marcus Boerger - - * zend_vm_execute.h: - - #31562 2nd part - - * zend_vm_def.h: - - Fix #31562 - -2005-03-07 Marcus Boerger - - * zend.h - zend_compile.c - zend_interfaces.c - zend_interfaces.h: - - New Interface Serializeable - - Change signature of unserialize() callback to ease inheritance and - support code reuse of handlers - - * tests/bug32226.phpt - tests/bug32226.phpt: - - - Add updated description - - * zend_builtin_functions.c - tests/bug32226.phpt: - - Fix #32226 - -2005-03-07 Zeev Suraski - - * zend_language_scanner.l - zend_language_scanner.l: - Revert // patch - -2005-03-06 Marcus Boerger - - * zend_reflection_api.c: - - Fix by Tim - -2005-03-06 Jani Taskinen - - * zend_compile.c - zend_compile.c: - Fixed compile warning (bug #32046) - - * zend_mm.c: - Fix compile warning (bug #32047) - -2005-03-01 Marcus Boerger - - * zend_interfaces.c: - - Support statuc methods/functions - -2005-03-01 Jani Taskinen - - * (PHP_5_0) - zend_language_scanner.l: - MFH: - Fixed bug #31672 ( not considered closing tag if - MFH: preceded by one-line comment) - - * zend_language_scanner.l: - Fix the fix for one line comments with tags - -2005-02-28 Marcus Boerger - - * zend_builtin_functions.c: - - Add support for methods dynamically added through object handlers - -2005-02-27 Marcus Boerger - - * zend_object_handlers.c: - - If silence if wanted we do not error out - - * zend_reflection_api.c: - - Add two new methods - - Fix signature, no need to cast it - - * zend_API.h: - - These must be initailized - - * zend_builtin_functions.c: - - Update method_exists to new handlers and allow first parameter as string - -2005-02-27 Jani Taskinen - - * Zend.m4: - - Cache the version check results - -2005-02-24 Andi Gutmans - - * zend_language_scanner.l: - - Make one line comments work the same with as with - - other tags. This will break scripts that have whitespace at the end - - of the closing tag but this is barely used as it is - - and I doubt ppl used whitespace. (patch by Jani) - - * zend_objects_API.h: - - This part of the patch was right - -2005-02-24 Dmitry Stogov - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Fixed bug in ZEND_POST_INC/ZEND_POST_DEC handlers. - These opcodes assume IS_TMP_VAR as result. - -2005-02-24 Andi Gutmans - - * zend_modules.h: - - Need zend_Compile.h for struct _zend_arg_info definiton (thanks to Joe - Orton) - - * zend_objects.c - zend_objects.h - zend_objects_API.h: - - Revert following patch until we decide what is the right way to handle - - this: - - Fix signatures they are all meant to be able to deal with any type in - any - object storage (though we are still missing several parts) - -2005-02-23 Derick Rethans - - * (PHP_5_0) - zend_reflection_api.c: - - MFH: fixed bug #32076 (ReflectionMethod :: isDestructor() always return - true). - - * zend_reflection_api.c: - - Fixed bug #32076 (ReflectionMethod :: isDestructor() always return true) - (Patch by Antony Dogval) - -2005-02-23 Stanislav Malyshev - - * zend.h - zend_compile.c: - Custom object serializer infrastructure - -2005-02-23 Jani Taskinen - - * Zend.m4: - Hack the planet - -2005-02-23 Marcus Boerger - - * zend_interfaces.c: - - Allow to convert Traversable into Aggregate - -2005-02-22 Marcus Boerger - - * zend_objects_API.c: - - We cannot provide this fallback becuase it requires zend_object ptr's. - -2005-02-22 Jani Taskinen - - * Zend.m4: - Fix cross-compile - - * acconfig.h: - Fix build (it was #ifNdef NETWARE..) - -2005-02-22 Marcus Boerger - - * zend_objects.c - zend_objects.h - zend_objects_API.h: - - Fix signatures they are all meant to be able to deal with any type in any - object storage (though we are still missing several parts) - - * zend_objects_API.c: - - Force calling of dtors unless otherwise specified (fixes several - __destruct bugs) - -2005-02-22 Anantha Kesari H Y - - * zend.h: - NetWare can include autoconf generated config headers - - * acconfig.h: - NetWare can make use of the configure script generated header file. - -2005-02-21 Moriyoshi Koizumi - - * Makefile.am: - - Add missing entry. - -2005-02-20 Dmitry Stogov - - * zend_compile.c: - Fixed possible memory corruption - -2005-02-19 Rui Hirokawa - - * (PHP_5_0) - zend_language_scanner.l: - MFH: fixed #31987 zend-multibyte in ZTS. - - * zend_language_scanner.l: - fixed #31987 zend-multibyte in ZTS. - -2005-02-17 Marcus Boerger - - * zend_API.c: - - A little optimization to prevent problems when trying to reimplement an - interface inherited from an interfaces that was just implemented...... - - * zend_API.c: - - No C++ ruleZ here - - * zend_API.c: - - Actually we must do this in two steps: 1st resize the table and set all - interfaces, 2nd implement the interfaces - - * zend_API.c: - - Incrementation is done elsewhere - - * zend_API.c: - - Fix windows build (funny MS compiler) - -2005-02-17 Jani Taskinen - - * (PHP_5_0) - Zend.m4 - zend_strtod.c: - MFH: - Compile fix for systems without int32_t typedef - - * Zend.m4 - zend_strtod.c: - - Compile fix for systems without int32_t typedef - -2005-02-13 Marcus Boerger - - * zend_execute_API.c - zend_reflection_api.c: - - Be more gracious in reflection API - - * zend_language_scanner.l: - - Fix doc comment handling - -2005-02-12 Marcus Boerger - - * zend_execute_API.c: - - Bugfix #30682 (autoconversion from false/true to 0/1 missing in case of - static property default value) - -2005-02-11 Marcus Boerger - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - - Cleanup foreach handling - -2005-02-10 Jani Taskinen - - * zend_strtod.c - zend_strtod.c: - - Fixed bug #31920 (zend_strtod.c error: conflicting types for 'int8_t') - -2005-02-10 Dmitry Stogov - - * zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug30407.phpt: - Fixed bug #30407 (Strange behaviour of default arguments) - -2005-02-07 Dmitry Stogov - - * zend_compile.c: - Fixed bug introduced with foreach() optimization patch - - * zend_compile.c: - Fixed FE_RESET/FE_FETCH bug. - Now FE_RESET instruction takes jump-address from itself, not from the - following FE_FETCH instruction. - - * zend_compile.c - zend_compile.h - zend_language_parser.y - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - foreash($a as $key => $val) optimization - Removed temorary array creation on each iteration. - -2005-02-07 Marcus Boerger - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - - Remove part of the cleanup which causes a problem with unnormal code - like tests/lang/040.phpt - -2005-02-06 Zeev Suraski - - * (PHP_5_0) - zend_ini_scanner.l: - Correct fix for #28803 - - * zend_ini_scanner.l: - Correct fix for #28804 - -2005-02-05 Marcus Boerger - - * zend_compile.c - zend_compile.h - zend_language_parser.y - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - - Cleanup foreach statement - -2005-02-04 Hartmut Holzgraefe - - * zend_API.c - zend_API.h: - added some missing zend_[declare|update]_property_...() convenience - functions for bool, double and binary safe string data - -2005-02-03 Jani Taskinen - - * (PHP_5_0) - zend_ini_scanner.l: - MFH: Fixed bug #28804 (ini-file section parsing pattern is buggy). - - * zend_ini_scanner.l: - - Fixed bug #28804 (ini-file section parsing pattern is buggy). - - * zend_ini_scanner.l - zend_ini_scanner.l: - ws fix - -2005-02-02 Stanislav Malyshev - - * zend_execute_API.c: - Fix #31720 Invalid object callbacks not caught in array_walk() (patch - from Antony Dovgal) - - * tests/bug31720.phpt: - test for Bug #31720 - - * tests/bug31720.phpt - tests/bug31720.phpt: - - file bug31720.phpt was initially added on branch PHP_5_0. - - * (PHP_5_0) - zend_execute_API.c: - Fix #31720 Invalid object callbacks not caught in array_walk() (patch - from Antony Dovgal) - -2005-02-02 Dmitry Stogov - - * zend.h - zend.h - zend_object_handlers.c - zend_object_handlers.c - tests/bug31683.phpt: - Fixed bugs #29767 and #31683 (__get and __set methods must not modify - property name). - - * tests/bug31683.phpt - tests/bug31683.phpt: - - file bug31683.phpt was initially added on branch PHP_5_0. - -2005-02-01 Stanislav Malyshev - - * zend_builtin_functions.c - zend_builtin_functions.c: - Fix debug_trace with eval (patch from Antony Dovgal) - - * tests/bug_debug_backtrace.phpt: - test for eval debug_backtrace bug - - * tests/bug_debug_backtrace.phpt - tests/bug_debug_backtrace.phpt: - - file bug_debug_backtrace.phpt was initially added on branch PHP_5_0. - -2005-01-31 Marcus Boerger - - * zend_reflection_api.c: - - Add ReclectionClass:hasProperty(), ReflectionClass::hasConstant() - to complete api (johannes@php.net) - -2005-01-28 Marcus Boerger - - * zend_execute_API.c: - - Fix severity (found by johannes) - -2005-01-25 Jani Taskinen - - * zend.h: - New versions of glibc support a RTLD_DEEPBIND flag to dlopen. The - effect of this flag when loading a "foo.so" with undefined symbols is - that the search that symbol starts at foo.so and its dependencies - *before* the loading process' global symbol table. - - This is an effective workaround for symbol namespace collisions between - various modules and the libraries on which they depend (where fixing the - respective modules or libraries is not possible e.g. due to API - constraints). - - (By: Joe Orton) - -2005-01-25 Marcus Boerger - - * (PHP_5_0) - zend_execute.c - zend_interfaces.c - tests/bug26229.phpt: - - MFH #26229 (getIterator() segfaults when it returns arrays or scalars) - - * zend_interfaces.c - zend_vm_def.h - zend_vm_execute.h - tests/bug26229.phpt: - - Bugfix #26229 (getIterator() segfaults when it returns arrays or scalars) - - * Makefile.frag: - - Fix dependency - - * zend_vm_def.h - zend_vm_execute.h: - - Use correct freeing (thx Dmitry) - -2005-01-24 Marcus Boerger - - * zend_vm_def.h - zend_vm_execute.h - tests/bug30725.phpt: - - Second and last part of #30725 fix - - * zend_interfaces.c: - - Allow getIterator() to fail - - * tests/bug30725.phpt: - - - Add new test - -2005-01-22 Jani Taskinen - - * (PHP_5_0) - Zend.m4 - configure.in - zend_strtod.c: - MFH: Compile fix for systems without uint32_t typedef - - * Zend.m4 - configure.in - zend_strtod.c: - - Compile fix for systems without uint32_t typedef - -2005-01-22 Marcus Boerger - - * zend_API.c - zend_API.h - zend_reflection_api.c: - - Fix #31651 (ReflectionClass::getDefaultProperties segfaults with arrays.) - -2005-01-22 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h: - - Two new API calls for Derick (retreive CV name and value) by Dmitry - -2005-01-20 Jani Taskinen - - * zend.h - zend_constants.c: - - Revert the weird change of ZEND_STRS() macro and use the correct - ZEND_STRL() macro. - -2005-01-19 Jani Taskinen - - * zend_object_handlers.c: - - Fixed bug #29183 (Undefined symbol zend_check_private with Solaris CC) - -2005-01-19 Marcus Boerger - - * zend_ini_parser.y: - - Fix memleak - -2005-01-18 Dmitry Stogov - - * zend_compile.c: - Fixed patch for bug #31478 (SegFault/Memory Leak with empty()) - - * zend_execute.c: - Fixed bug #28444 (Cannot access undefined property for object with - overloaded property access). - - * (PHP_5_0) - zend_execute.c: - Fixed bug #28444 (Cannot access undefined property for object with - overloaded property access). (Dmitry) - -2005-01-18 Ilia Alshanetsky - - * (PHP_5_0) - zend_operators.h: - MFH: Fixed bug #30726 (-.1 like numbers are not being handled correctly). - - * zend_operators.h: - Fixed bug #30726 (-.1 like numbers are not being handled correctly). - -2005-01-17 Jani Taskinen - - * (PHP_5_0) - zend_language_scanner.l: - MFH: - Fixed bug #31444 (Memory leak in zend_language_scanner.c) - - * zend_language_scanner.l: - - Fixed bug #31444 (Memory leak in zend_language_scanner.c) - -2005-01-15 Andi Gutmans - - * (PHP_5_0) - zend_API.c: - - Fix WS - - * (PHP_5_0) - zend_API.c: - - Change to using DL_UNLOAD macro. - - * zend_API.c: - - Unload on MAC OS X (shouldn't be a reason not to) - -2005-01-14 Dmitry Stogov - - * zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug31098.phpt: - Restore behavior of $str["str"]. (Now $str["str"] is equivalent to $str[0] - again) - - * (PHP_5_0) - tests/bug31098.phpt: - Path -> pattern - - * (PHP_5_0) - zend_execute.c - tests/bug31098.phpt: - Revert to old behavior of $str["str"]. ($str["str"] is equivalent of - $str[0]) - -2005-01-13 Dmitry Stogov - - * zend_execute.c - zend_execute.c: - Additional fix for fix of bug #29883 - -2005-01-12 Dmitry Stogov - - * zend_execute.c - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug31098.phpt - tests/bug31098.phpt: - Fixed bug #31098 (isset false positive) - -2005-01-11 Moriyoshi Koizumi - - * (PHP_5_0) - zend_execute.c - tests/bug31098.phpt: - - MFH: fix for bug #31098. - - * tests/bug31098.phpt - tests/bug31436.phpt: - - - Test renaming - - * zend_vm_execute.h - tests/bug31436.phpt: - - Fix bug #31436 (isset() incorrectly returns true in dereference of a - wrong type) - - * zend_compile.c: - - Fix bug #31478 (segfault with empty()) - -2005-01-10 Rasmus Lerdorf - - * zend.h - zend_API.c: - Fix OSX DL_UNLOAD macro and actually use it to make shared extensions - work on OSX. - -2005-01-10 Jani Taskinen - - * header - zend_arg_defs.c - zend_strtod.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_gen.php - zend_vm_opcodes.h: - - Added missing header sections. - - * acinclude.m4 - configure.in: - - Added AC_ZEND_C_BIGENDIAN macro (as requested by Andi) - -2005-01-09 Jani Taskinen - - * (PHP_5_0) - zend.h: - MFH: - Fix outside-source-tree builds. Always include generated header - files - with #include to make sure the correct file is - used. - - * zend.h: - - Fix outside-source-tree builds. Always include generated header files - with #include to make sure the correct file is used. - - * zend.c: - MFB: - Rationalize code a bit - -2005-01-03 Stanislav Malyshev - - * (PHP_5_0) - zend_language_scanner.l: - MFH: - Fix the following nasty bug: - - if compile bails out from the middle of compiling, current_buffer is not - restored - - if current_buffer is not null, yy_switch_to_buffer will do: *yy_c_buf_p - = yy_hold_char; on - the next request - - which would lead to memory corruption on next request - - * zend_language_scanner.l: - Fix the following nasty bug: - - if compile bails out from the middle of compiling, current_buffer is not - restored - - if current_buffer is not null, yy_switch_to_buffer will do: *yy_c_buf_p - = yy_hold_char; on - the next request - - which would lead to memory corruption on next request - -2005-01-02 Ilia Alshanetsky - - * (PHP_5_0) - zend_highlight.c: - MFH: Fixed bug #31371 (highlight_file() trims new line after heredoc). - - * zend_highlight.c: - Fixed bug #31371 (highlight_file() trims new line after heredoc). - -2004-12-30 Jani Taskinen - - * (PHP_5_0) - zend_compile.c - zend_highlight.c - zend_indent.c - zend_ini_scanner.l - zend_language_scanner.l: - MFH: - Fixed bug #28930 (PHP sources pick wrong header files generated by - bison). - - * zend_compile.c - zend_highlight.c - zend_indent.c - zend_ini_scanner.l - zend_language_scanner.l: - - Fixed bug #28930 (PHP sources pick wrong header files generated by bison) - - * Zend.m4 - acinclude.m4: - MFB_4_3: Quote macro names in AC_DEFUN() - -2004-12-27 Zeev Suraski - - * zend_builtin_functions.c: - MFB - - * (PHP_5_0) - zend_builtin_functions.c: - Fix desc - -2004-12-27 Marcus Boerger - - * (PHP_5_0) - zend_reflection_api.c: - - MFH: Need to unmangle the class name here - - * zend_reflection_api.c: - - Need to unmangle the class name here - -2004-12-27 Zeev Suraski - - * (PHP_5_0) - zend_exceptions.c: - Add descriptions - -2004-12-27 Dmitry Stogov - - * zend_execute.c - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - tests/bug22836.phpt - tests/bug22836.phpt - tests/unset_cv01.phpt - tests/unset_cv02.phpt - tests/unset_cv03.phpt - tests/unset_cv04.phpt - tests/unset_cv06.phpt - tests/unset_cv08.phpt - tests/unset_cv09.phpt - tests/unset_cv10.phpt: - "Undefined variable: %s" noticies were fixed to use one space - -2004-12-27 Marcus Boerger - - * zend_reflection_api.c: - - More proto/error message fixes - - * zend_reflection_api.c: - - Small fixlet (by Tony) - -2004-12-24 Dmitry Stogov - - * zend_vm_def.h - zend_vm_execute.h: - New sarbage collector's bug was fixed (the behavior should be the same as - in PHP_5_0) - - * zend_execute.c - tests/unset_cv01.phpt - tests/unset_cv02.phpt - tests/unset_cv03.phpt - tests/unset_cv04.phpt - tests/unset_cv06.phpt - tests/unset_cv08.phpt - tests/unset_cv09.phpt - tests/unset_cv10.phpt: - "Undefined variable: %s" noticies were fixed to be compatible with PHP_5_0 - -2004-12-21 Jani Taskinen - - * (PHP_5_0) - zend_strtod.c: - MFH: - Use correct header files (in c99 compliant way). uint32_t is - preferred. - - * zend_strtod.c: - - Use correct header files (in c99 compliant way). uint32_t is preferred. - -2004-12-20 Jani Taskinen - - * zend_strtod.c: - Better fix for endian compile problems. - -2004-12-17 Andi Gutmans - - * zend_object_handlers.c: - - Fixed Bug #30562 Segmentation fault with __call() - -2004-12-17 Derick Rethans - - * zend_strtod.c - zend_strtod.c: - - MF43: Fixed strtod for Irix and some other strange platform - -2004-12-16 Derick Rethans - - * zend_strtod.c - zend_strtod.c: - - MF43: Make it compile on HPUX on Itanium 2 - - * zend_strtod.c - zend_strtod.c: - - MF43: Fixed bug #31107 (strtod on solaris9/intel) - -2004-12-16 Jani Taskinen - - * (PHP_5_0) - ChangeLog: - - MFH: Fix typo (avaliable -> available). (bug #28725) - - * ChangeLog: - - Fix typo (avaliable -> available). (bug #28725) - -2004-12-16 Derick Rethans - - * zend_strtod.c: - - MF43: Fixed bug #31110 and #31111 (Zend/zend_strtod.c problems) - - * (PHP_5_0) - zend_strtod.c: - - Fixed bug #31110 and #31111 (Zend/zend_strtod.c problems) - -2004-12-15 Andi Gutmans - - * (PHP_5_0) - zend.h: - - 5.0.4-dev - - * (PHP_5_0) - zend.h: - - Redo 5.0.3 - - * (PHP_5_0) - zend.h: - - Back to -dev - - * (PHP_5_0) - zend.h: - - Roll PHP 5.0.3 - -2004-12-14 Derick Rethans - - * zend_strtod.c - zend_strtod.c: - - MFH: Fixed compile error related to bug #28605. - -2004-12-13 Derick Rethans - - * zend_operators.c: - - Added "G" modifier to ini setting number format. - -2004-12-10 Andi Gutmans - - * (PHP_5_0) - zend.h: - - Back to -dev - - * (PHP_5_0) - zend.h: - - 5.0.3RC2 - -2004-12-07 Dmitry Stogov - - * zend_exceptions.c - zend_exceptions.c: - Fixed bug #30904 (segfault when recording soapclient into session). - -2004-12-06 Stanislav Malyshev - - * tests/bug30998.phpt: - add test - - * zend.c - zend.c: - port fix for #30998: Crash when user error handler returns false on amd64 - -2004-12-06 Dmitry Stogov - - * zend_compile.c - zend_compile.c - tests/bug30922.phpt: - Fixed bug #30922 (reflective functions crash PHP when interfaces extend - themselves) - - * tests/bug30922.phpt - tests/bug30922.phpt: - - file bug30922.phpt was initially added on branch PHP_5_0. - -2004-12-06 Stanislav Malyshev - - * (PHP_5_0) - zend_builtin_functions.c: - if fetch called not from PHP function, ptr can be NULL - -2004-12-01 Ilia Alshanetsky - - * zend_strtod.c: - MFB: Removed extra space that causes problems for some compilers. - - * (PHP_5_0) - zend_strtod.c: - Removed extra space that causes problems for some compilers. - -2004-12-01 Derick Rethans - - * (PHP_5_0) - zend_strtod.c: - - revert unwanted change - - * zend_strtod.c - zend_strtod.c: - - Fixed MacOSX compilation (Patch by Christian) - - * (PHP_5_0) - zend.h: - - And in Zend/ too. - -2004-12-01 Dmitry Stogov - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - tests/bug29883.phpt - tests/bug29883.phpt - tests/bug29883.phpt: - Fixed bug #29883 (isset gives invalid values on strings). - -2004-11-30 Andi Gutmans - - * (PHP_5_0) - zend.h: - - Go with 5.0.3RC1 - -2004-11-29 Derick Rethans - - * (PHP_5_0) - zend_operators.c: - - MF43: Revert Joe's work around a bug in GCC patch as it breaks too many - things. - - * zend_operators.c: - - MFH: Revert Joe's work around a bug in GCC patch as it breaks too many - things. - -2004-11-25 Zeev Suraski - - * (PHP_5_0) - zend_execute.c - zend_execute_API.c - zend_extensions.h - zend_object_handlers.c - zend_object_handlers.h: - Reverting get_method() signature change - -2004-11-24 Marcus Boerger - - * zend_reflection_api.c: - - Fix Bug #30856 (ReflectionClass::getStaticProperties segfaults) - - * tests/bug30856.phpt: - - - Add new test - -2004-11-17 Stanislav Malyshev - - * (PHP_5_0) - zend_execute_API.c: - fix #30543 - - * zend_execute_API.c: - fix crash - -2004-11-16 Derick Rethans - - * zend_strtod.c - zend_strtod.c: - - Make this compile for the Mac again - -2004-11-15 Derick Rethans - - * (PHP_5_0) - zend_strtod.c: - - MFH: Fixed bug #30779 (Compile of Zend/zend_strtod.c fails on Sparc) - - * zend_strtod.c: - - Fixed bug #30779 (Compile of Zend/zend_strtod.c fails on Sparc) - -2004-11-14 Marcus Boerger - - * (PHP_5_0) - zend_reflection_api.c: - MFH #30783 Apache crash when using ReflectionFunction::getStaticVariables() - MFH proto fixes - - * zend_reflection_api.c: - - Bugix #30783: Apache crash when using - ReflectionFunction::getStaticVariables() - -2004-11-09 Andrei Zmievski - - * zend_ini_parser.y: - Revert inadvertent commit. - - * zend_ini_parser.y: - .dylib extension are Mach-O shared libraries that meant for linking - against. Loadable modules (aka bundles) can have any extension, so we - should probably stick with .so - - http://fink.sourceforge.net/doc/porting/shared.php?phpLang=en#lib-and-mod - -2004-11-05 Derick Rethans - - * (PHP_5_0) - zend_execute_API.c: - - Fix for bug #30367, #30490 and possibly #30011. - -2004-11-04 Edin Kadribasic - - * Zend.dsp - ZendTS.dsp: - Added zend_strtod.* to the build - - * zend_strtod.c - zend_strtod.h: - Make zend_strtod compile on windows - -2004-11-04 Moriyoshi Koizumi - - * (PHP_5_0) - Makefile.am: - - MFH: Add entry for zend_strtod.c in belief that this is still active. - - * Makefile.am: - - Add entry for zend_strtod.c in belief that this is still active. - -2004-11-03 Moriyoshi Koizumi - - * Zend.m4: - - Don't show grep outputs - -2004-11-03 Derick Rethans - - * (PHP_5_0) - zend_execute_API.c - zend_globals.h - zend_ini.c - zend_language_scanner.l - zend_operators.c - zend_operators.h - zend_strtod.c - zend_strtod.h: - - MFH: Fixed bug #30630: Added a BSD based strtod function that is - locale-independent. - - * zend_execute_API.c - zend_globals.h - zend_ini.c - zend_language_scanner.l - zend_operators.c - zend_operators.h - zend_strtod.c - zend_strtod.h: - - Fixed bug #30630: Added a BSD based strtod function that is - locale-independent. - -2004-11-03 Moriyoshi Koizumi - - * Zend.m4 - zend.h - zend_execute.c: - - Checks for Darwin'ish systems that uses Mach-O, which apparently doesn't - support weak symbol aliasing at this time. - -2004-11-03 Marcus Boerger - - * zend_reflection_api.c: - - Trying to invoke function not methot here - - * zend_reflection_api.c: - - Fix invokeargs() with static methods - -2004-11-03 Dmitry Stogov - - * zend_vm_def.h - zend_vm_execute.h: - Fixed "isset() and the new VM" bug. - -2004-11-02 Sebastian Bergmann - - * (PHP_5_0) - zend_API.c: - MFH: Patch by Joe Orton . - - * zend_API.c: - Patch by Joe Orton . - -2004-10-31 Marcus Boerger - - * zend_reflection_api.c: - - Add ReflectionFunction::invokeArgs(array) - - Add ReflectionMethod::invokeArgs(obj, array) - -2004-10-31 Sebastian Bergmann - - * zend_reflection_api.c: - Invokation -> Invocation - -2004-10-30 Marcus Boerger - - * zend.h: - Bump version (as discussed with Andi) - - * (PHP_5_0) - zend_execute.c: - - Fix (readd function name which got lost during earlier comit) - - * zend_reflection_api.c: - - Be consistent and use names as keys (found by johannes) - - * zend_extensions.h - zend_modules.h: - - Bump API version - - * (PHP_5_0) - zend_extensions.h - zend_modules.h: - Bump api after latest changes - - * (PHP_5_0) - zend_execute.c - zend_object_handlers.c - zend_object_handlers.h: - MFH change zend_object_handlers->get_method() - - * zend_execute_API.c - zend_object_handlers.c - zend_object_handlers.h - zend_vm_def.h - zend_vm_execute.h: - - Change zend_object_handlers->get_method() to allow aggregation for - internal classes - - * Makefile.frag: - - New architecture needs one more dependency - - * zend_exceptions.c - zend_reflection_api.c: - - Fix protos - -2004-10-29 Andi Gutmans - - * zend_operators.c: - - For Ilia: - - MFH: Fixed bug #30572 (crash when comparing SimpleXML attribute to a - boolean). - - Hope this works well. I will MFH tomorrow if no one complains. - -2004-10-28 Dmitry Stogov - - * README.ZEND_VM - zend_vm_gen.php: - --without-lines changed to --with-lines - -2004-10-28 Andi Gutmans - - * zend_vm_execute.skl - zend_vm_gen.php: - - Fix typo - -2004-10-27 Andi Gutmans - - * zend_vm_opcodes.h: - - Oops missed this one - - * zend_operators.c: - - Revert Fixed bug #30228 (crash when comparing SimpleXML attribute to a - boolean). - - Need to discuss where the real problem is. - - * README.ZEND_VM: - - Tiny fixes - - * README.ZEND_VM - zend_compile.h - zend_vm_execute.h - zend_vm_gen.php: - - Improve comments, docs, code... - -2004-10-26 Andi Gutmans - - * zend_builtin_functions.c: - - Patch from Andrey Hristov: - I have cooked a small patch which allows is_subclass_of() the accept - not only an object as first parameter but a string as well. When string - is passed the function checks whether the class specified is subclass of - the second parameter - class a{} - class b{} extends a{} - is_subclass_of("a", "a") //false - is_subclass_of("b", "a") //true - currently only objects are allowed as first parameter - -2004-10-26 Ilia Alshanetsky - - * (PHP_5_0) - zend_operators.c: - MFH: Fixed bug #30572 (crash when comparing SimpleXML attribute to a - boolean). - - * zend_operators.c: - Fixed bug #30228 (crash when comparing SimpleXML attribute to a boolean). - -2004-10-23 Andi Gutmans - - * zend_vm_execute.h: - - Add missing file - -2004-10-22 Andi Gutmans - - * zend_vm_handlers.h - zend_vm_spec.h: - - Nuke another two files - - * Makefile.frag - zend_execute.c - zend_vm.h - zend_vm_def.h - zend_vm_execute.skl - zend_vm_gen.php: - - Commit new VM - - Old one is tagged as PRE_NEW_VM_GEN_PATCH - - Still doing work so more commits to come. Don't complain (yet) :) - - * (PRE_NEW_VM_GEN_PATCH) - zend_execute.c: - - Fix crash (MFB PHP5_0) - -2004-10-21 Andi Gutmans - - * (PHP_5_0) - zend_execute.c: - - Fix bug #30395 (Apache Child Segmentation fault in specific PHP-Code) - -2004-10-20 Andi Gutmans - - * zend_operators.c: - - If object handles are equal then save the comparison of properties in - - the == operator. - -2004-10-18 Anantha Kesari H Y - - * zend_modules.h: - including zend_compile.h for NetWare as NetWare uses MetroWerks Code - warrior compiler which does not allow declarations of following kind - before defining the types. - extern struct _zend_arg_info first_arg_force_ref[2]; - -2004-10-16 Andi Gutmans - - * zend_compile.c: - - One more test (WS) - - * zend_compile.c: - - WS fix to test commit - -2004-10-16 Anantha Kesari H Y - - * zend_compile.c - zend_compile.c: - Fix for 30457 - -2004-10-14 Marcus Boerger - - * zend_builtin_functions.c: - - Allow to omit object/classname in get_parent_class() which makes it - compatible with the signature and behavior of get_class() - -2004-10-13 Andi Gutmans - - * zend_compile.c: - - Don't allow access modifiers in interfaces. Explicitly stating public - - should also be disallowed but we don't have a way to detect it today. - -2004-10-12 Marcus Boerger - - * zend_builtin_functions.c: - Bug #30381 Strange results with get_class_vars() - - * (PHP_5_0) - zend_builtin_functions.c: - MFH Fix visibility of get_class_vars() and get_class_methods() - - * zend_builtin_functions.c: - - Fix visibility in get_class_vars() and get_class_methods() - - * zend_builtin_functions.c: - - Fix set_exception_handler - -2004-10-10 Sebastian Bergmann - - * .cvsignore - tests/.cvsignore: - Add *.gcda and *.gcno (from gcc -fprofile-{use|generate}) to .cvsignore. - -2004-10-08 Marcus Boerger - - * zend_compile.c - zend_compile.h - zend_vm_handlers.h: - - Revert automatic pass arg_info - -2004-10-08 Andi Gutmans - - * zend_compile.c: - - Fix BC break with default in switch() having to be at the end. - -2004-10-08 Anantha Kesari H Y - - * acconfig.h - zend_config.nw.h: - explicitly including sys/select.h as NetWare LibC sys/types.h does not - include sys/select.h implicitly as other LibC - -2004-10-06 Marcus Boerger - - * zend_reflection_api.c: - - Fix Bug #30344 - -2004-10-05 Marcus Boerger - - * zend_compile.c - zend_compile.h - zend_vm_handlers.h: - - Add arginfo ZEND_ARG_SEND_AUTOMATIC which lets the compiler automatically - determine whether pass by ref is possible or pass by value is needed. - -2004-10-05 Dmitry Stogov - - * tests/unset_cv06.phpt - tests/unset_cv07.phpt - tests/unset_cv07.phpt: - Test files are fixed. - - * zend_execute.c - zend_vm_handlers.h - tests/unset_cv11.phpt: - Fixed unset() bug that was introduced with CV optimization patch - - * zend_execute_API.c - zend_vm_handlers.h - tests/unset.inc - tests/unset_cv01.phpt - tests/unset_cv02.phpt - tests/unset_cv03.phpt - tests/unset_cv04.phpt - tests/unset_cv05.phpt - tests/unset_cv06.phpt - tests/unset_cv07.phpt - tests/unset_cv08.phpt - tests/unset_cv09.phpt - tests/unset_cv10.phpt: - Added test cases for CV optimization patch - -2004-10-04 Andi Gutmans - - * zend_API.h - zend_execute_API.c: - - Rename delete_global_variable() to zend_delete_global_variable() - - * Zend.m4 - zend_API.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_language_parser.y - zend_opcode.c - zend_vm.h - zend_vm_handlers.h - zend_vm_spec.h: - - Commit the variable fetch optimization. - - Extensions which delete global variables need to use new special - function - - delete_global_variable() (I'm about to rename it) to remove them. - - Will post to internals@ or via commit messages if there's anything else. - -2004-10-04 Marcus Boerger - - * zend_builtin_functions.c: - - Bugfix #27798 - - * tests/bug27798.phpt: - - - Add new test - -2004-10-02 Marcus Boerger - - * (PHP_5_0) - tests/bug28444.phpt - tests/bug29368.phpt: - - Add new tests - - * tests/bug28444.phpt - tests/bug29368.phpt: - - - Add new test - -2004-10-01 Marcus Boerger - - * Makefile.frag: - - Add makefile fragment which simplifies working on the executer - -2004-09-30 Andi Gutmans - - * zend_operators.c: - - Small improvement to DVAL_TO_ZVAL macro - -2004-09-29 Marcus Boerger - - * zend_API.c: - - MFB (synch correctly not only for one problem) - - * zend_API.c: - - Refix the fix - -2004-09-29 Andi Gutmans - - * bench.php - tests/bench.php: - - Move bench.php to Zend/ - -2004-09-28 Marcus Boerger - - * zend_API.c - zend_API.h - zend_object_handlers.c - zend_objects.c: - Simplify/Optmize magic method calls (__get/__set/__call/__clone/__destruct) - -2004-09-28 Andi Gutmans - - * zend_execute_API.c: - - Return the warning until we check if we can change the type of str.len - -2004-09-28 Marcus Boerger - - * zend_reflection_api.c - zend_reflection_api.h: - - publish reflection_class_factory() as zend_reflection_class_factory() - -2004-09-27 Marcus Boerger - - * (PHP_5_0) - zend_reflection_api.c: - MFH fix several property handling issues - - * zend_reflection_api.c: - - Make internally used properties read-only and fix default properties - - * zend_exceptions.c: - - Fix memeleak - - * zend_reflection_api.c: - - Declare properties - -2004-09-27 Andi Gutmans - - * README.ZEND_VM: - - Document zend_vm_use_old_executor() for Derick. - -2004-09-27 Marcus Boerger - - * zend_reflection_api.c: - Fix Reflection_Class to ReflectionClass in docu/messages - - * zend_execute_API.c: - - Fix warning - - * zend_compile.c - zend_stream.c: - - Fix warning - - * zend_builtin_functions.c - zend_reflection_api.c: - - Fix warnings - - * zend_interfaces.c: - Fix warnign - -2004-09-27 Andi Gutmans - - * zend_variables.c - zend_variables.h: - - Use zval_ctor_func() for wrapper and update the prototype to void - - * zend_variables.c - zend_variables.h: - - Make zval_copy_ctor() return void like dtor(). No one ever checks the - - return value which is SUCCESS always. - -2004-09-26 Marcus Boerger - - * zend.h - zend_variables.h: - - Fix build - -2004-09-26 Andi Gutmans - - * zend.h - zend_variables.c - zend_variables.h: - - Apply Thies and Sterling's patch which doesn't call ctor/dtor functions - - for types which don't require it (BOOL/NULL/LONG/DOUBLE) - - Breaks serialization!!! - -2004-09-24 Anantha Kesari H Y - - * zend_API.c: - selectively avoiding module cleanup code for apache 1 build and removing a - duplicate code - -2004-09-24 Dmitry Stogov - - * zend_vm_spec.h: - Fixed specializer bug. - -2004-09-23 Andi Gutmans - - * (PHP_5_0) - zend.h: - - PHP 5.0.3-dev - - * zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_opcode.c - zend_vm.h: - - Commit new VM architecture. This one allows people (aka Derick) to - - ask the engine to use function handler mode. Will update the README - - about that. - - * (PHP_5_0) - zend.h: - - Roll 5.0.2 - -2004-09-23 Ilia Alshanetsky - - * tests/bug20240.phpt: - Fixed test. - -2004-09-23 Marcus Boerger - - * zend_reflection_api.c: - Bugfix # 30209 - -2004-09-23 Andi Gutmans - - * tests/bench.php: - - Commit synthetic benchmark - -2004-09-23 Anantha Kesari H Y - - * zend_execute.c - zend_execute_API.c - zend_globals.h: - Reverted the NetWare Specific Stack limit related patches as asked by Andi - -2004-09-22 Anantha Kesari H Y - - * zend_execute_API.c - zend_globals.h: - NetWare specific stack limit checks - - * zend_API.c: - Aligned the ifdef NETWARE blocks to first column. - - * zend_execute.c: - Stack limit will be checked while executing the script - - * zend_config.nw.h: - To avoid redefinition (of free, alloca etc.) compilation errors in Zend. - - * zend_API.c: - When Apache is unloaded, it calls dlclose on all the PHP extensions - that are loaded in memory. In the case of Apache 1.3, this call is - blocking indefinitely. As a work around, this call is bypassed for Apache - 1.3 build on NetWare only. This means that none of the loaded PHP - extensions are unloaded. They will have to be manually unloaded before - re-loading the Apache 1.3 again. - - * zend.h: - defined ZEND_PATHS_SEPERATOR to semicolon for NetWare - - * acconfig.h: - enabled macros to call the proper LibC functions - -2004-09-22 Dmitry Stogov - - * zend_vm_handlers.h - zend_vm_spec.h: - Specializer was updated with executor's fixes. - - * zend_execute.c - zend_execute.c: - Fixed bug #29566 (foreach/string handling strangeness (crash)). - - * zend_execute.c: - Fixed bug in fix for bug #29707 - -2004-09-21 Andi Gutmans - - * zend_execute.c - zend_execute.h: - - Fix for bug #29707 - -2004-09-19 Marcus Boerger - - * zend_reflection_api.c: - Bugfix #30146 (ReflectionProperty->getValue() requires instance for static - property) - - * zend_reflection_api.c: - Bugfix #30148 (ReflectionMethod->isConstructor() fails for inherited - classes) - -2004-09-17 Stanislav Malyshev - - * zend_execute_API.c - zend_objects_API.c - zend_objects_API.h: - fix crash when dtor is fialing on shutdown - -2004-09-16 Andi Gutmans - - * (PHP_5_0) - zend.h: - - Go with PHP 5.0.2RC1 - - * tests/bug27669.phpt: - - Add test for bug #27669 - -2004-09-16 Sebastian Bergmann - - * zend_language_parser.y: - ZTS fix. - -2004-09-16 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - - Fix bug #27669 (Dmitry). - Fixes: - - -2004-09-15 Ilia Alshanetsky - - * zend_operators.h: - MFH: Fixed a bug causing ".123" * "90" and alike to return a 0. - - * (PHP_5_0) - zend_operators.h: - Fixed a bug causing ".123" * "90" and alike to return a 0. - -2004-09-15 Derick Rethans - - * zend_config.w32.h: - - Windows support strcoll too. - -2004-09-13 Stanislav Malyshev - - * zend_execute.c: - Antony Dovgal's error message improvement - #27290 - -2004-09-11 Derick Rethans - - * zend_operators.c - zend_operators.h: - - MFB: Added the sorting flag SORT_LOCALE_STRING to the sort() functions - which - makes them sort based on the current locale. (Derick) - - * (PHP_5_0) - zend_operators.c - zend_operators.h: - - Added the sorting flag SORT_LOCALE_STRING to the sort() functions which - makes - them sort based on the current locale. (Derick) - -2004-09-11 Andi Gutmans - - * zend_operators.c: - - Resolve undefined behavior (joe at redhat) - -2004-09-10 Andi Gutmans - - * zend_compile.c: - - This one fixes rather strange problem - ZE allows multiple declarations - of the same class constant. - - It could be a minor BC break, but I'm sure it's a bug. (Antony Dovgal - aka tony2001) - -2004-09-09 Andi Gutmans - - * zend_extensions.h: - - Revert API bump - - * README.ZEND_VM: - - Commit VM explanation. - - * zend.c: - - Recommit - - * zend_API.c - zend_API.h - zend_compile.c: - - Recommit: - - Check signature of magic methods - - Register __get/__set/__call for internal classes - - * zend_extensions.h: - - Recommit: - - Bump the API number to work around this major breakage. - - * ChangeLog - zend.c - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_exceptions.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.h - zend_opcode.c: - - Roll back VM commit - -2004-09-09 Marcus Boerger - - * zend.c: - - Drop namespace relict - - * (PHP_5_0) - zend_API.c - zend_API.h - zend_compile.c: - MFH signature check/method registration - - * zend_API.c - zend_API.h - zend_compile.c: - - Check signature of magic methods - - Register __get/__set/__call for internal classes - -2004-09-09 Derick Rethans - - * zend_extensions.h: - - Bump the API number to work around this major breakage. - -2004-09-09 Dmitry Stogov - - * zend_vm.h: - We will use CALL dispatch method for compilers other then GCC. It is more - safe. - -2004-09-09 Andi Gutmans - - * zend_API.c: - - Fix the fix. - -2004-09-06 Marcus Boerger - - * zend_objects.c: - - Fix handling of exceptions in dtors - -2004-09-05 Zeev Suraski - - * zend.c - zend.h - zend_ini_parser.y: - Fix reverse dependency - -2004-09-04 Andi Gutmans - - * zend_API.c: - - Don't destroy object when calling overloaded cast method in - - zend_parse_parameters() - -2004-09-02 Sebastian Bergmann - - * zend_compile.c: - Fugbix typo. - -2004-08-30 Marcus Boerger - - * (PHP_5_0) - ZEND_CHANGES: - MFH: Add some information about array overloading - - * ZEND_CHANGES: - Add some information about array overloading - -2004-08-30 Stanislav Malyshev - - * zend_execute.c: - fix crash #29893 - -2004-08-29 Marcus Boerger - - * zend_execute.c: - String offset starts with 0, fix isset($str[$len]) - - * (PHP_5_0) - zend_compile.c: - MFH: Bugfix #29882 isset crashes on arrays - - * zend_compile.c: - Bugfix #29882 isset crashes on arrays - -2004-08-27 Andi Gutmans - - * zend_alloc.c: - - Fix leak report for 0 byte allocations (Dmitry) - -2004-08-26 Marcus Boerger - - * (PHP_5_0) - zend_compile.c: - MFH: Enforce semantics: Classes cannot extend Interfaces - - * zend_compile.c: - Enforce semantics: Classes cannot extend Interfaces - - * tests/bug29828.phpt: - Fix test: Classes cannot extend Interfaces - - * zend_compile.c: - Drop doubled check - - * zend_compile.c: - - Bugfix #29828 Interfaces no longer work - - * tests/bug29828.phpt: - - Add new test - -2004-08-25 Andi Gutmans - - * zend_builtin_functions.c: - - Add interface_exists() and differentiate between classes and interfaces - (Andrey Hristov) - -2004-08-24 Marcus Boerger - - * zend_API.c: - - Add missing brackets - -2004-08-23 Marcus Boerger - - * zend_compile.c: - - Drop unused variable - - * zend_execute_API.c - zend_globals.h: - - Boost up __autoload() calls by caching the lookup - -2004-08-23 Andi Gutmans - - * zend_compile.c: - - Improve performance of switch() - -2004-08-23 Zeev Suraski - - * (PHP_5_0) - zend_reflection_api.c: - Fix names - -2004-08-21 Sara Golemon - - * zend_compile.c: - Bugfix#29777 Some compilers don't like // style comments - -2004-08-20 Sara Golemon - - * zend_ini_parser.y: - Fix compile - -2004-08-19 Andi Gutmans - - * zend_execute.c: - - Cleanup - - * zend.c - zend_execute_API.c - zend_globals.h: - - Second wave of garbage removal. - - * zend_compile.h - zend_execute.c: - - Stop using garbage. Please let me know if you find any bugs resulting - - of this patch (very likely). (Dmitry, Andi) - -2004-08-19 Marcus Boerger - - * zend_reflection_api.c: - - Implement #29728: Reflection API Feature: Default parameter value. - . ReflectionParameter::isDefaultValueAvailable() - . ReflectionParameter::getDefaultValue() - - * zend_reflection_api.c: - - Nedd to work on copy - -2004-08-18 Marcus Boerger - - * zend_reflection_api.c: - - Show default value of optional parameters of user defined functions. - -2004-08-18 Andrei Zmievski - - * zend_ini_parser.y: - Forgot to turn off debugging. - - * zend_ini_parser.y - zend_ini_scanner.l: - Re-add my patch for .ini variable access. - -2004-08-16 Marcus Boerger - - * (PHP_5_0) - zend_reflection_api.c: - MFH: Fix bug #29447: Reflection API issues - - * zend_reflection_api.c: - - Fix bug #29447: Reflection API issues - -2004-08-15 Marcus Boerger - - * zend_compile.c: - Remove unnecessary check - -2004-08-14 Marcus Boerger - - * zend_compile.c: - Add missing check - -2004-08-12 Andi Gutmans - - * (PHP_5_0) - zend.h: - - Back to 5.0.2-dev - - * (PHP_5_0) - zend.h: - - Roll 5.0.1 - - * (PHP_5_0) - zend.h: - - Back to -dev - - * (PHP_5_0) - zend.h: - - 5.0.1RC2 - - * zend_compile.c - zend_compile.h - zend_execute.c: - - Don't use magic numbers - - * zend_compile.c - zend_execute.c: - - Significantly improve performance of foreach($arr as $data). (Marcus) - -2004-08-11 Ilia Alshanetsky - - * zend_highlight.c: - MFH: Fixed bug #29607 (highlighting code with HEREDOC produces invalid - output). - - * (PHP_5_0) - zend_highlight.c: - Fixed bug #29607 (highlighting code with HEREDOC produces invalid output). - -2004-08-11 Marcus Boerger - - * zend_execute.c: - More meaningfull error message - -2004-08-11 Derick Rethans - - * (PHP_5_0) - zend_alloc.h: - - MFH: Patch to allow the Zend memory allocators to be disabled. - - * zend_alloc.h: - - Added missing defines. - -2004-08-10 Ilia Alshanetsky - - * (PHP_5_0) - zend_highlight.c: - MFH: Fixed bug #29606 (php_strip_whitespace() prints to stdout rather then - returning the value). - - * zend_highlight.c: - Fixed bug #29606 (php_strip_whitespace() prints to stdout rather then - returning the value). - -2004-08-10 Andi Gutmans - - * (PHP_5_0) - zend.h: - - Back to -dev - - * (PHP_5_0) - zend.h: - - 5.0.1RC1 - -2004-08-10 Marcus Boerger - - * zend_execute.c: - - Fix warnings - -2004-08-07 Andi Gutmans - - * zend_alloc.h: - - Commit Derick's patch for allowing Zend to use regular libc memory - - allocation functions. Mainly useful in conjunction with tools such as - - valgrind which enables us to find bugs we might not find with the - - current memory managers boundary protection. - -2004-08-05 Ilia Alshanetsky - - * zend_builtin_functions.c: - Eliminate unneeded variable. - -2004-08-04 Marcus Boerger - - * zend_reflection_api.c - tests/bug29523.phpt: - - Fix bug #29523 (ReflectionParameter::isOptional() is incorrect) - -2004-08-03 Marcus Boerger - - * ZEND_CHANGES: - Update - - * (PHP_5_0) - zend_builtin_functions.c - tests/bug29505.phpt: - - MFH Bug #29505 get_class_vars() severely broken when used with arrays - - * tests/bug29505.phpt: - - Add new test - - * zend_builtin_functions.c: - - Fixed Bug #29505 get_class_vars() severely broken when used with arrays - -2004-08-02 Marcus Boerger - - * zend_reflection_api.c: - - Add methods to check parameter count - - * (PHP_5_0) - zend_compile.c: - MFH Change to use memcmp instead of strcmp - - * zend_compile.c: - - Change to use memcmp instead of strcmp - -2004-08-02 Andi Gutmans - - * zend_compile.c: - - Fix typo - -2004-08-02 Marcus Boerger - - * zend_language_parser.y - zend_language_scanner.l: - - Remove all for now - - * zend_compile.c - zend_compile.h - zend_execute_API.c: - MFB: Enforce protocol on magic methods/functions - -2004-08-02 Ilia Alshanetsky - - * (PHP_5_0) - zend_execute.c: - MFH: A gentler (performance wise) allocation of buffer for temp variables. - - * zend_execute.c: - A gentler (performance wise) allocation of buffer for temp variables. - -2004-08-01 Marcus Boerger - - * (PHP_5_0) - zend_compile.c - zend_compile.h - zend_execute_API.c: - - Enforce protocol on magic methods/functions - -2004-07-30 Andi Gutmans - - * zend_execute.c - zend_execute_API.c - zend_ptr_stack.c - zend_ptr_stack.h: - - More ptr_stack optimizations and cleanups - - * zend_alloc.c - zend_alloc.h - zend_execute.c - zend_fast_cache.h - zend_ptr_stack.h: - - Improve performance by inlining zend_ptr_stack_n_push(). var_args can - usually not be inlined by compilers. - -2004-07-29 Marcus Boerger - - * zend_hash.c: - - Increase performance of *sort() and some internal sort operations. - -2004-07-29 Sara Golemon - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_language_scanner.l - zend_opcode.c: - Revert goto opcode - - * zend_execute.c: - &tmp and label are the same thing, don't free it till we're done with it. - - * zend_compile.c - zend_execute.c: - Plug some memory leaks and promote unknown label to E_ERROR. - If someone tries to jump to a non-existant label execution really - shouldn't try to carry on. - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_language_scanner.l - zend_opcode.c: - Add goto operator by popular request. - -2004-07-28 Wez Furlong - - * zend_ini.c: - Fix: ini entries for dl()'d modules now work under ZTS - Side-effect: avoid possible crashes when multiple threads load/unload - modules and mess with the global hash table. - -2004-07-28 Andi Gutmans - - * zend.h - zend.h: - - Fix MAC OSX to always use native DSO loading - -2004-07-27 Marcus Boerger - - * zend_exceptions.c: - - Be specific about visibility - -2004-07-27 Wez Furlong - - * zend_builtin_functions.c: - Fix two possible crashes. Latter is unlikely unless you are doing scary - things, but former looks nasty. - -2004-07-26 Stanislav Malyshev - - * zend_interfaces.c: - quick fix for #29382 - -2004-07-25 Marcus Boerger - - * zend_reflection_api.c: - - Show visibility errors (try to fix #29354) - - * (PHP_5_0) - zend_execute.c - zend_objects_API.c - zend_objects_API.h: - - MFH: Fix bug #29368 : The destructor is called when an exception is - thrown from the constructor - - * zend_execute.c - zend_objects_API.c - zend_objects_API.h: - - Fix bug #29368 : The destructor is called when an exception is thrown - from the constructor - - * zend.c - zend.h - zend_execute.h - zend_execute_API.c: - - Execute destructors earlier (Florian Schaper, fschaper at intux org) - - * zend_reflection_api.c: - - Add ReflectionParameter::isOptional() to test whether a parameter is - optional and also show this information in export. - - * zend_exceptions.c: - - Add optional parameters $filename and $lineno to ErrorException - constructor to allow overwriting automatically retrieved information. - -2004-07-23 Marcus Boerger - - * zend_execute.c: - Fix 0 Byte leak after alloca to emalloc change - -2004-07-22 Zeev Suraski - - * zend_object_handlers.c: - Fix bug in handling of protected properties - -2004-07-21 Edin Kadribasic - - * zend_builtin_functions.c: - Fixed build - -2004-07-21 Marcus Boerger - - * (PHP_5_0) - zend_builtin_functions.c: - MFH: Fixded #29291: get_class_vars() return names with NULLs - - * zend_builtin_functions.c: - - Fixded #29291: get_class_vars() return names with NULLs - -2004-07-20 Moriyoshi Koizumi - - * zend_alloc.c - zend_alloc.h: - - Add safe_pemalloc() - -2004-07-20 Marcus Boerger - - * zend_reflection_api.c: - - Fixed bug 28895 again (long live the dead) - -2004-07-20 Zeev Suraski - - * zend_exceptions.c: - Fix prototypes - - * zend_exceptions.c: - Add descriptions - -2004-07-20 Stanislav Malyshev - - * zend_compile.c: - add todo - - * (PHP_5_0) - zend_ini.h - zend_ini_parser.y: - export ini parser - -2004-07-19 Sebastian Bergmann - - * zend_reflection_api.c: - Fix prototypes: Reflection_* -> Reflection*. - - * zend_reflection_api.c: - Make ReflectionClass::getMethod() and ReflectionClass::getProperty() raise - an ReflectionException instead of returning NULL on failure. - - * zend_reflection_api.c: - Do not use contracted forms. - -2004-07-19 Stanislav Malyshev - - * zend_ini.h - zend_ini_parser.y: - export INI parser - - * zend_object_handlers.c: - __set and __get will be called not only when variable doesn't exist but - also when it's - invisible - -2004-07-19 Andi Gutmans - - * zend_extensions.h - zend_modules.h: - - Bump API number due to empty_string change - - * zend.c - zend.h - zend_API.h - zend_alloc.h - zend_execute.c - zend_object_handlers.c - zend_operators.c - zend_variables.c: - - Nuke empty_string. It is a reminanent from the time where RETURN_FALSE() - used to return "" and not bool(false). It's not worth keeping it because - STR_FREE() and zval_dtor() always have to check for it and it slows down - the general case. In addition, it seems that empty_string has been - abused - quite a lot, and was used not only for setting zval's but generally in - PHP code instead of "", which wasn't the intention. Last but not least, - nuking empty_string should improve stability as I doubt every place - correctly checked if they are not mistakenly erealloc()'ing it or - calling efree() on it. - NOTE: Some code is probably broken. Each extension maintainer should - check and see that my changes are OK. Also, I haven't had time to touch - PECL yet. Will try and do it tomorrow. - -2004-07-18 Wez Furlong - - * zend_execute_API.c: - No point allocating 0 bytes - -2004-07-16 Marcus Boerger - - * zend_language_parser.y - zend_language_scanner.l: - - Speed up by making null/false/true reserved word which allows to drop - an opcode (FETCH_CONSTANT) for every usage. - - * zend_execute.c: - Bugfix #28464 catch() does not catch exceptions by interfaces - -2004-07-16 Ilia Alshanetsky - - * zend_operators.h: - MFB: Fixed bug #28800 (strings beginning with "inf" improperly converted). - - * (PHP_5_0) - zend_operators.h: - Fixed bug #28800 (strings beginning with "inf" improperly converted). - -2004-07-15 Andi Gutmans - - * zend_alloc.c - zend_alloc.h: - - Improve performance of zend_alloc by stopping the size from being a bit - - field. - -2004-07-15 Marcus Boerger - - * zend_exceptions.c - zend_exceptions.h: - - Add new class ErrorException to encapsulate errors in exceptions - - * zend_dynamic_array.h: - - Fix prototype - -2004-07-14 Stanislav Malyshev - - * zend_object_handlers.c: - be consistent with write_dimension - - * zend_object_handlers.c: - fix #28957 - -2004-07-13 Andi Gutmans - - * zend.h: - - 5.0.1-dev - -2004-07-13 Marcus Boerger - - * zend_constants.c: - Bugfix #29116 Zend constant warning uses memory after free (jdolecek at - NetBSD dot org) - -2004-07-13 Andi Gutmans - - * (php_5_0_0) - zend.h: - - Roll PHP 5.0.0 - -2004-07-12 Ilia Alshanetsky - - * (php_5_0_0RC4) - zend_execute.c: - Fixed bug #29086 & #28064 (PHP crashes on extremly long scripts). - -2004-07-12 Andi Gutmans - - * (php_5_0_0RC4) - zend.c: - - Convert zend_class_entry -> zend_class_entry * - -2004-07-10 Jon Parise - - * zend.c: - DragonFly BSD is derived from FreeBSD and requires the same floating point - precision fix. - -2004-07-10 Andi Gutmans - - * zend_alloc.c - zend_hash.c - zend_variables.c: - - Better stability during premature shutdown of request startup - -2004-07-05 Andi Gutmans - - * zend_mm.h: - - Disable zend_mm for 5.0.0 - -2004-07-03 Andi Gutmans - - * zend_alloc.c: - - Should fix mem leak with ZEND_MM. I made this change a while ago and - - rolled it back but I don't remember why. Please test! - -2004-07-01 Ilia Alshanetsky - - * zend_constants.c: - Do not use alloca() where it can be easily abused by the users. - - -2004-06-25 Wez Furlong - - * zend_stream.c - zend_stream.h: - export zend stream functions for zend extensions under windows - -2004-06-24 Sara Golemon - - * zend_execute.c: - Ease off on severity of new error (Using Resources as array offsets) - -2004-06-23 Sara Golemon - - * zend_execute.c: - BugFix #28879 Inconsistent behavior between explicit and implicit array - creation. - - Changes: - - Throw E_WARNING "Illegal offset type" when explicitly creating - array elements with objects, arrays, or resorces as indexes. - This matches implicit creation w/ obj/arr indices. - - Throw E_WARNING "Resource ID#%ld used as offset, casting to integer (%ld)" - when implicitly creating array with resource as index. (BC) - -2004-06-19 Sebastian Bergmann - - * zend_reflection_api.c: - Reflection_* -> Reflection*. Patch by Timm Friebe. - -2004-06-18 Sara Golemon - - * zend_execute.c: - Another typo in converting array index doubles to long. - -2004-06-18 George Schlossnagle - - * zend_builtin_functions.c: - fix for 28213. - - class_name and call_type should be reinitialized on every loop iter. - -2004-06-17 Sara Golemon - - * zend_builtin_functions.c: - String length in parse_parameters should be int - -2004-06-15 Marcus Boerger - - * zend_reflection_api.c: - - -2004-06-14 Marcus Boerger - - * zend_language_scanner.l: - Need {} here - -2004-06-10 Marcus Boerger - - * zend_language_scanner.l: - - Require a single white-space char after /** to start a doc comment that - way we prevent /*** from becoming a doc comment (as requested Derick). - - * zend_API.h: - Add missing declaration - - * zend_reflection_api.c: - Small code layout change - - * zend_language_scanner.l: - Do not require NEWLINE at start of doccomment - - * zend_reflection_api.c: - Bugfix #28699: Reflection api bugs - -2004-06-09 Marcus Boerger - - * zend_reflection_api.c: - Fix Bug #28694 ReflectionExtension::getFunctions() crashes PHP - -2004-06-07 Andi Gutmans - - * zend.h: - - Go back to -dev (Shouldn't need another RC) - - * (php_5_0_0RC3) - zend.h: - - Roll RC3 - -2004-06-06 Stefan Esser - - * zend_compile.h - zend_opcode.c: - Fixed Zend Function Destructor to use correct TSRM handle. - -2004-06-05 Marcus Boerger - - * zend_API.c: - Fix #28641: Instance of Interface - -2004-06-03 Andi Gutmans - - * (php_5_0_0RC3RC2) - zend.h: - - Prepare for RC3RC2 - -2004-06-02 Andi Gutmans - - * zend_mm.h: - - Don't use ZEND_MM in Windows - -2004-06-02 Stanislav Malyshev - - * zend_execute.c: - fix incdec - make value's refcount non-zero when passing to - write_property - otherwise __set caller cleanup could kill it. - -2004-06-01 Andi Gutmans - - * zend.c: - - If user error handler returns "false" then we relay to the built in error - handler - -2004-05-31 Marcus Boerger - - * zend_reflection_api.c: - Refcount must not be set separatley again. - - * zend_reflection_api.c - zend_reflection_api.c: - Add missing initialization - - * zend_compile.c: - - -2004-05-28 Andrei Zmievski - - * zend.c: - Allow user-defined error handlers to indicate whether default error - handler should be re-invoked, by returning true or false. - -2004-05-28 Marcus Boerger - - * zend_execute.c: - Prevent possible problems with illegal properties - -2004-05-28 Derick Rethans - - * zend_builtin_functions.c: - - Make the default mask for user defined error handlers include ALL errors, - including E_STRICT. - -2004-05-27 Andi Gutmans - - * zend.h: - - Back to RC3-dev until we roll final - - * (php_5_0_0RC3RC1) - zend_execute.c: - - Fix problem with exceptions returning from include(). (Dmitry) - - * (php_5_0_0RC3RC1) - zend.h: - - RC3RC1 - -2004-05-26 Wez Furlong - - * zend_object_handlers.c: - Fix leak on systems where alloca isn't really alloca. - -2004-05-26 Andrei Zmievski - - * zend_constants.c: - Avoid unnecessary and silly copying of constant name when registering. - -2004-05-26 Andi Gutmans - - * zend_alloc.c: - - Fix memory manager problem - -2004-05-26 Sebastian Bergmann - - * ZEND_CHANGES: - Update Reflection API class names. Whitespace fixes. - -2004-05-25 Andi Gutmans - - * zend_objects_API.h: - - Nuke unused decleration - - * zend_alloc.c - zend_alloc.h: - - More fixes - - * zend_alloc.c - zend_alloc.h: - - Make fix compile. - - * zend_alloc.c - zend_alloc.h: - - Fix memory leak in mem cache in conjunction with Zend MM. How come no one - - noticed this? :) - -2004-05-23 Andi Gutmans - - * zend_objects_API.c: - - Fix problem with object being destroyed more than once - - * zend_builtin_functions.c: - - Fix the following script (it crashed): - - -2004-05-20 Wez Furlong - - * zend_exceptions.c - zend_exceptions.h: - Revert; obviously I missed the function at the bottom of the file... - - * zend_exceptions.c - zend_exceptions.h: - Export this, so extensions may throw their own exception objects that - they have already instantiated. - -2004-05-18 Marcus Boerger - - * zend_API.c: - - Need to operate on module pointer in hash table - -2004-05-18 Wez Furlong - - * zend_execute_API.c: - Fix bug #28438: win32 build fails in non-zts mode - -2004-05-18 Stanislav Malyshev - - * zend_API.c: - Z_TYPE_P is for zvals - -2004-05-18 Wez Furlong - - * zend_API.c: - Register according to the type specified by the module. - (Helps to fix dl() bug) - -2004-05-18 Sara Golemon - - * zend_execute.c: - Bugfix#28404 When type is double we need to access dval, not lval - -2004-05-17 Andrei Zmievski - - * zend_ini_parser.y - zend_ini_scanner.l: - Revert the .ini vars patch. Will have to try again next Christmas - apparently. - - * zend_ini_parser.y: - Fix the apparent bug (; at the end of parse rule block). - -2004-05-17 Wez Furlong - - * zend_objects_API.c - zend_objects_API.h: - As discussed with Andi, add this helper API for setting the object pointer - from - within the constructor. - - Please read the comment for notes about how to use it; in general, you - don't - need it, so don't use it. - -2004-05-14 Andrei Zmievski - - * zend_ini_parser.y - zend_ini_scanner.l: - Adding ability to refer to existing .ini variables from within .ini - files. Example: - - open_basedir = ${open_basedir} ":/new/dir" - -2004-05-12 Marcus Boerger - - * zend_API.c: - - Centralize register and hash operations for startup/register_module - in new zend_register_module_ex(). - - * zend_API.c: - - Revert to 1.249 - -2004-05-11 Andi Gutmans - - * zend_compile.c: - - Don't allow passing NULL to type hinted parameter. - -2004-05-10 Zeev Suraski - - * zend_operators.c: - - Fix comparison of objects - - Clarify convert_object_to_type() - -2004-05-10 Stefan Esser - - * zend_alloc.c: - Checking MEMORY_LIMIT before doing emalloc/erealloc solves several ugly - problems. - -2004-05-04 Wez Furlong - - * zend_iterators.c - zend_object_handlers.c - zend_object_handlers.h - zend_objects_API.c: - Add count_elements handler for overloaded objects. - -2004-05-02 Andi Gutmans - - * zend_operators.c: - - Fix comparison of two objects in non-compatibility mode. - -2004-05-01 Marcus Boerger - - * zend_API.c: - Don't load modules twice - -2004-04-29 Stanislav Malyshev - - * zend_execute.c: - Fix bug #27876 - -2004-04-28 Marcus Boerger - - * zend_exceptions.h: - Fix c++ builds - -2004-04-27 Marcus Boerger - - * zend_builtin_functions.c: - - Optional parameter to class_exists() that can be used to bypass - __autoload() which can be helpfull in __autoload() itself. - - * zend_interfaces.c: - - Fix warnings - - * zend_interfaces.c - zend_interfaces.h - zend_iterators.h: - - no unneccessary retval initialization - - new c-level iterator handler invalidate_current that is optionally - used to clear internal caching like in implementation of Iterator - -2004-04-27 Andi Gutmans - - * zend_reflection_api.c: - - Fix prototypes - -2004-04-26 Marcus Boerger - - * zend_reflection_api.c: - Fix prototype - -2004-04-25 Marcus Boerger - - * zend_builtin_functions.c: - Skip correct amount of stack entries - - * zend_interfaces.c: - Capture potential problem by error message - - * zend_reflection_api.c: - Show number of classes - -2004-04-25 Andi Gutmans - - * zend.h: - - RC3-dev - - * (php_5_0_0RC2) - zend.h: - - RC2 - -2004-04-23 Andi Gutmans - - * zend_compile.c: - - Fixed bug #27923. foreach() without a key should not check if the key - - is a reference (Adam) - -2004-04-21 Andi Gutmans - - * zend.h: - - RC2-dev - - * (php_5_0_0RC2RC2) - zend.h: - - Prepare for RC2RC2 (if everything is OK especially Zeev's interface - - patch I'll roll RC2 tomorrow). - -2004-04-21 Zeev Suraski - - * (php_5_0_0RC2RC2) - zend_compile.c: - Restore fatal error in case a method that's supposed to implement an - interface/abstract method, breaks its prototype - -2004-04-20 Andi Gutmans - - * zend_language_parser.y: - - Fix bug #27283 - Exceptions where the last catch() statement was - sometimes - - skipped. - -2004-04-19 Marcus Boerger - - * zend_reflection_api.c: - show ini entries and classes for extensions. - -2004-04-17 Marcus Boerger - - * zend.c: - Retval may not be set when zend_execute() is overloaded - -2004-04-15 Marcus Boerger - - * zend_execute.c: - Handle failure in get_current_data - -2004-04-14 Andi Gutmans - - * zend_extensions.h: - - Add comment - - * zend.h: - - RC2-dev - - * (php_5_0_0RC2RC1) - zend.h: - - RC2RC1 - -2004-04-13 Marcus Boerger - - * zend_exceptions.c: - Classnames shall start with an uppercase character - -2004-04-13 Zeev Suraski - - * zend_builtin_functions.c: - Fix debug_backtrace to show arguments again - We need to merge code from debug_backtrace & debug_print_backtrace at - some point! - -2004-04-13 Andi Gutmans - - * zend_extensions.h: - - Fix API no of Engine 2. The first number is the engine version and the - - rest is the API_NO. This way engine2_api_no is always greater than - - engine1_api_no. - - * zend.c - zend_exceptions.c - zend_exceptions.h: - - Add hook for exception handler (Derick) - -2004-04-12 Marcus Boerger - - * zend_API.h: - Fix order of macro parameter (synch with other macros) - -2004-04-12 Andi Gutmans - - * OBJECTS2_HOWTO - zend_extensions.h - zend_ini.c - zend_ini.h - zend_modules.h: - - modifyable -> modifiable - -2004-04-09 Andi Gutmans - - * zend_object_handlers.c: - - Fix bug #26441 (When __set() returned a value it corrupted it) - -2004-04-08 Marcus Boerger - - * zend_reflection_api.c: - Bugfix #27519 Reflection_Function constructor crashes with non-existant - function's name - -2004-04-07 Andi Gutmans - - * zend_builtin_functions.c: - - Hopefully fix the debug_backtrace() code. - - * zend_builtin_functions.c: - - Fix crash bug in zend_debug_backtrace(). No idea how come this survived - - for so long.... - -2004-04-04 Ilia Alshanetsky - - * zend_objects_API.c: - Removed unused variable. - -2004-04-03 Andi Gutmans - - * zend_builtin_functions.c: - Patch by Timm Friebe: - It changes - set_exception_handler() to accept the pseudo-type "callable" (instead of - a string referring to a global function). - - - Examples: - set_exception_handler('function_name'); - set_exception_handler(array('class_name', 'static_method')); - set_exception_handler(array($instance, 'instance_method')); - - - This also makes set_exception_handler() more consistent with all the - other callback functionality, e.g. set_error_handler(). - - * zend_operators.c: - - Nuke more old junk - - * zend.h - zend_operators.c - zend_operators.h: - - Nuke code which hasn't been in use for ages. - -2004-04-01 Ilia Alshanetsky - - * zend_builtin_functions.c: - MFB: Revert patch for bug #27782. - - * zend_execute.c - tests/bug27731.phpt: - Fixed reversed condition for error reporting. - -2004-03-31 Dmitry Stogov - - * zend_execute.c: - Fixed BUG in zend_post_incdec_property - -2004-03-31 Andi Gutmans - - * zend_reflection_api.c: - - Fix typo - -2004-03-30 Marcus Boerger - - * tests/bug26695.phpt: - Fix test - -2004-03-30 Ilia Alshanetsky - - * zend_builtin_functions.c: - Fixed bug #27782 (Wrong behaviour of next(), prev() and each()). - -2004-03-30 Marcus Boerger - - * zend_reflection_api.c: - TSRM fix - - * zend.c - zend.h - zend_API.c - zend_API.h - zend_globals.h - zend_reflection_api.c: - - Fix Reflection class names - - Add ability to get the extension an internal class was defined in - -2004-03-29 Marcus Boerger - - * acconfig.h: - NAN==NAN doest work (Ard) - - * zend_builtin_functions.c: - Allow mixed case search for extensions - -2004-03-29 Sebastian Bergmann - - * zend_execute.c: - -clonning+cloning - -2004-03-29 Dmitry Stogov - - * zend_execute.c: - Implicit clonning strict warning was added for ze1_compatibility_mode - -2004-03-29 Ilia Alshanetsky - - * zend_execute.c - tests/bug27731.phpt: - Fixed bug #27731 (error_reporting() inside @ block fails to set - error_reporting level). - -2004-03-28 Marcus Boerger - - * zend_API.c: - Use lowercasing here - - * zend.c: - Initialize the complete struct - -2004-03-28 Stanislav Malyshev - - * zend_language_parser.y: - check writability on =& too - - * zend_execute.c: - - call set handler if assigning to object having this handler - - cleanup: use macros to access object internal vars - - * zend_interfaces.c: - preserve ZEND_API in definition - - * zend_interfaces.h: - declare as extern - -2004-03-28 Marcus Boerger - - * zend_reflection_api.c: - Fix memleak found by Timm - -2004-03-28 Stanislav Malyshev - - * zend_operators.c: - centralize object-to-scalar conversion, make it work with get handler - - * zend.c: - try get handler on printable conversion - - * zend_object_handlers.h: - some more clear comments - - * zend_operators.c: - Use macros for object parts access - -2004-03-28 Dmitry Stogov - - * zend_execute_API.c: - fix of fix related to __autoload. (ext/standard/tests/network/bug20134.phpt - passes again) - -2004-03-27 Marcus Boerger - - * zend.c: - Even though it is uncommented it should be right - -2004-03-26 Marcus Boerger - - * zend_API.c - zend_compile.c: - Force destructors to have empty signatures - -2004-03-26 Andi Gutmans - - * zend_execute.c: - - Fix build (thanks to Timm) - -2004-03-25 Derick Rethans - - * zend_language_scanner.l: - - Remove old and deprecated scanner token. - -2004-03-25 Andi Gutmans - - * zend_compile.c: - - If __construct() is defined then it will always take precedence over - - old style constructors. - -2004-03-25 Stanislav Malyshev - - * zend_execute.c: - no need to use result for RECV's - as in PHP4 - - * zend_execute.c: - Use get/set handlers for increment.decrement ops on objects - -2004-03-25 Andi Gutmans - - * zend_execute_API.c: - /* The compiler is not-reentrant. Make sure we __autoload() only during - run-time - * (doesn't impact fuctionality of __autoload() - */ - -2004-03-25 Dmitry Stogov - - * zend_execute_API.c: - Using ALLOC_HASHTABLE/FREE_HASHTABLE instead of emalloc/free. - -2004-03-24 Dmitry Stogov - - * zend.c - zend_execute_API.c - zend_globals.h: - New autoload protection schema was implemented (Using HashTable instead of - boolean flag) - -2004-03-24 Derick Rethans - - * zend_operators.c: - - Revert bogus commit - - * zend_operators.c: - - Fixed NEWS - -2004-03-24 Dmitry Stogov - - * tests/bug27641.phpt: - Fixed bug #27641 (Object cloning in ze1_compatibility_mode was - reimplemented) - - * zend_execute.c - zend_variables.c: - Object cloning in ze1 compatibility mode (zend.ze1_compatibility_mode) was - reimplemented (Dmitry, Andi) - -2004-03-22 Andi Gutmans - - * zend_compile.c: - - Fix bug - - * zend_execute.c: - - Remove whitespace - -2004-03-21 Andi Gutmans - - * zend_execute.c: - - Improve consistency - -2004-03-21 Stanislav Malyshev - - * zend_objects_API.c - zend_objects_API.h: - return zval *, to make it useful for read_property - - * zend_objects_API.c: - update to new API - - * zend_execute.c - zend_object_handlers.c - zend_object_handlers.h: - API change for read_property: - instead of bool silent it now gets fetch type - This can be used for creating proxy objects for write contexts - -2004-03-21 Andi Gutmans - - * zend_execute.c: - - Nuke unused code - -2004-03-18 Andi Gutmans - - * zend.h: - - Back to RC2-dev - -2004-03-18 Zeev Suraski - - * (php_5_0_0RC1) - zend.h: - Prepare to roll RC1 - - * (php_5_0_0RC1) - zend_execute.c: - Fix possible data corruption with __set() - -2004-03-18 Stanislav Malyshev - - * zend_execute.c: - Improve error message - on E_STRICT, method is actually called, - so the error shouldn't say it cannot be called. - -2004-03-18 Andi Gutmans - - * (php_5_0_0RC1) - zend_compile.c: - - Change redefinition of constructor from E_COMPILE_ERROR to E_STRICT. - - * (php_5_0_0RC1) - ZEND_CHANGES: - - Update Changes - -2004-03-17 Sascha Schumann - - * zend_multiply.h: - Readd x86 implementation - -2004-03-17 Andi Gutmans - - * (php_5_0_0RC1RC2) - zend_multiply.h: - - Improved patch for support multiplication on 64bit machines - - * (php_5_0_0RC1RC2) - zend_execute.c: - - Fix tiny bug (one of the reasons we can't support __toString() for - - regular objects). - - * (php_5_0_0RC1RC2) - zend.c: - - Stop make_printable_zval() from calling __toString() - - * zend_execute.c: - - Fixed problem with __toString(). Due to the engine's architecture it is - - currently not possible to call __toString() anywhere besides print & - eval. - - Follow up will be on internals@ - -2004-03-17 Stanislav Malyshev - - * (php_5_0_0RC1RC2) - zend_compile.c: - fix typo - -2004-03-17 Andi Gutmans - - * zend_multiply.h - zend_operators.c: - - Apply Ard's patch to support multiplication & overflow on both 32bit - and 64bit machines - -2004-03-16 Derick Rethans - - * zend.c - zend.h - zend_API.h - zend_modules.h: - - Replaced the exec_finished hook by the zend_post_deactive hook for - extensions. The new hook will be run after the symbol table and - destructors - are run. (Derick) - - * zend_modules.h: - - Bump API number so that it actually differs from PHP 4. This is needed - because we don't want PHP 4 and PHP 5 extensions to be in the same - directory - when doing "make install" for shared, or phpize'd extensions. - -2004-03-16 Marcus Boerger - - * zend_execute_API.c: - Fix SEGV in certain conditions while calling static methods - -2004-03-16 Zeev Suraski - - * zend_compile.c - zend_compile.h: - Add ability to disable JIT for a particular auto global - -2004-03-16 Marcus Boerger - - * zend_execute_API.c: - TSRM fix - -2004-03-16 Sascha Schumann - - * zend.h: - Enable ptr format check for GCC 3.1 and higher - -2004-03-16 Ilia Alshanetsky - - * zend.h: - Do not allow 3.0.4 for __attribute__. - - * zend.h: - Fixed bug #27600 (GCC 3.0.4 does not like __attribute__ directive) - -2004-03-16 Andi Gutmans - - * zend_compile.c: - - Fix problem when using old-style constructors it wasn't being inherited - correctly. - -2004-03-16 Derick Rethans - - * zend_execute_API.c: - - Spaces to tabs - -2004-03-16 Andi Gutmans - - * zend_execute_API.c: - - If the called method is static then don't define $this - - * zend_execute.c - zend_execute_API.c: - - Error out if get_method() isn't defined. - - Use calling scope of internal function callee when calling a method - using static syntax (array("A", "func")); - -2004-03-16 Marcus Boerger - - * zend_execute.c - zend_execute.h - zend_execute_API.c: - Improve error message - -2004-03-15 Andi Gutmans - - * zend_operators.c: - - Restore E_NOTICE for longs and doubles. - -2004-03-15 Jani Taskinen - - * zend.h: - - Fixed bug #24582 (extensions can not be loaded dynamically in - Solaris/iPlanet) - -2004-03-15 Andi Gutmans - - * zend_operators.c: - - Nuke E_NOTICE. This caused a notice when doing if ($obj == NULL) - -2004-03-14 Marcus Boerger - - * zend_builtin_functions.c: - Make object parameter optional - -2004-03-14 Ilia Alshanetsky - - * zend.c: - Fixed bug #27590 (crash during shutdown when freeing persistent resources - in ZTS mode). - -2004-03-14 Andi Gutmans - - * zend_execute_API.c: - - Fix windows build - - * zend_execute_API.c: - - Fix for bug #27504 - - * zend_builtin_functions.c: - - Fixing bug #27123 - - * zend_operators.c: - - Improve compatibility mode and compare objects according to property - - comparison (sucky but this is how PHP 4 behaved). - - * zend.c: - - Fix flow of logic - - * zend_operators.c: - - Support old style of converting objects to long/double/bool. - - This is only enabled in compatibility mode, else it calls cast_object() - - and if that is not available we return 1 (true) so that the following - - code would work: - if ($obj) { - } - -2004-03-14 Marcus Boerger - - * zend_operators.c: - Fix: Add return type void - -2004-03-14 Andi Gutmans - - * zend.c - zend_object_handlers.c - zend_object_handlers.h - zend_operators.c: - - Support Cast operator in convert_to_* so that we support internal - - extensions such as SimpleXML. This is for Sterling. - - * zend_operators.c: - - Fix memory leak in the following code (Dmitry): - - - * zend_operators.c: - - Initial commit which allows comparing overloaded objects with native - - types (only for internal classes and not for user-land classes). - -2004-03-11 Andi Gutmans - - * zend_objects_API.c: - - Real fix for bug #27535 (Dmitry) - - * zend_objects_API.c: - - Attempt to fix bug #27535 - -2004-03-09 Marcus Boerger - - * ZEND_CHANGES: - Rename hasMore() to valid() as discussed. (Part VI) - - * zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_interfaces.c - zend_language_parser.y - zend_reflection_api.c: - Clearify the different method/class flags (as discussed with Andi). - - * zend.h: - No longer needed - -2004-03-09 Andi Gutmans - - * zend_constants.c: - - Fix crash: - - - * zend_compile.c - zend_compile.h - zend_execute.c: - - Nuke unused code. - -2004-03-08 Marcus Boerger - - * zend_execute.c - zend_interfaces.c - zend_iterators.h: - Rename hasMore() to valid() as discussed. (Part II) - - * zend_interfaces.c: - Rename hasMore() to valid() as discussed. (Part I) - - * zend_execute_API.c: - Check count. - - * zend_reflection_api.c: - Add another missing conversion - -2004-03-05 Andi Gutmans - - * zend_compile.c: - - Fix some small problems I introduce in last patch. - - * zend_compile.c: - - Finally fix the following: - $xml_mem = - simplexml_load_string('1'); - /* The following works fine */ - foreach ($xml_mem->part as $part) { - foreach($part->chapter->page as $page) { - print $page; - } - } - /* The following segfaults */ - foreach ($xml_mem->part as $part) { - foreach($part->chapter as $chapter) { // Difference here from previous - example - print $chapter; - } - } - -2004-03-04 Moriyoshi Koizumi - - * zend_language_scanner.l: - - Fix memleak when scanner is called from within tokenizer extension. - -2004-03-04 Stanislav Malyshev - - * zend_execute.h: - fix the fix - - * zend_execute.h: - oops, fix cut&paste gone bad - - * zend_execute.h: - Fix object true value: if we are in compat mode and it's Zend object - - use PHP4 rules. Otherwise, object is always true. - -2004-03-04 Derick Rethans - - * zend_constants.h - zend_operators.h: - - Fixed a 64bit issue (for zend_builtin_functions.c, module_number is an - int). - - Change the MAX_LENGTH_OF_LONG constant to 20, as LONG_MAX is 20 - characters. - (Patches by Ard Biesheuven) - - * tests/zend_operators.phpt: - - Added instance_of test (patch by Ard Biesheuvel) - -2004-03-04 Stanislav Malyshev - - * zend_compile.c: - Disallow redefining ctors and cleanup - - * zend_mm.c: - Handle out of memory/bad size situation gracefully, without getting into - loop - -2004-03-03 Andi Gutmans - - * zend_objects_API.c: - - Fix crash: - x as $x); - } - } - new foo(); - echo 'OK'; - ?> - -2004-03-02 Marcus Boerger - - * zend_API.c - zend_API.h: - Fix zend_parse_method_parameters_ex() and make it consistant with - zend_parse_method_parameters(). - -2004-03-02 Andi Gutmans - - * zend_compile.c: - - Fix leaks (although there might be still a problem here). - - * zend_execute.c: - - Fix leak (Dmitry) - - * zend_compile.c: - - Fix crash in: - attributes as $name => $attr) { - } - } - } - - $f= new Foo(); - $f->export(); - ?> - - * zend_objects.c: - - Improve fix for protecting destructor's from exceptions. - - I was killing the current exception completely which was wrong. - -2004-03-01 Andi Gutmans - - * zend_objects.c: - - Fix crash in destructors(). You can't throw an exception in destructors - as there is no guaranteed time when the destructor will be called. - - * zend_reflection_api.c: - - Fix leak - - * zend_reflection_api.c: - - Fix crash in reflection API (pierre) - - * zend.c - zend_exceptions.c - zend_execute_API.c: - - Fix crash in exception handling (zend_exception_error(...) and - zend_eval_string_ex() were buggy (Dmitry, Andi) - -2004-03-01 Derick Rethans - - * zend_compile.h: - - Typo fix (by Jan) - - * zend_builtin_functions.c: - - Fixed bug #27443 (defined() returns wrong type). - -2004-02-29 Andi Gutmans - - * zend_reflection_api.c: - - Apply fixes by Timm. - - * zend_compile.c: - - Change prototype isA check not to check the constructor. - - Only give an E_STRICT for non-isA compliant code as opposed to - E_COMPILE_ERROR. - -2004-02-29 Stanislav Malyshev - - * zend_compile.h: - add ZEND_API there too for opcode handlers - -2004-02-29 Derick Rethans - - * zend_execute.c: - - Initialize memory to \0 so that we can reliable detect whether a specific - opcode element is in use. - -2004-02-29 Stanislav Malyshev - - * zend_execute.c: - export opcode table - -2004-02-27 Marcus Boerger - - * zend_API.c - zend_compile.h: - Add some comments - - * zend_API.c - zend_compile.c - zend_execute.c: - Fixes for abstract classes/methods - -2004-02-26 Marcus Boerger - - * zend_language_parser.y - zend_language_scanner.l: - Fix __METHOD__ (noticed by Davey Sahfik) - - * zend_reflection_api.c: - Fix problem with Reflection_Property (patch from Timm slightly modified). - -2004-02-25 Marcus Boerger - - * zend_objects_API.c: - As Andi found out the dtor may increase the refcount. - -2004-02-25 Jani Taskinen - - * zend_builtin_functions.c: - ws + cs - -2004-02-25 Zeev Suraski - - * zend_compile.c - zend_execute.c: - Fix leak in foreach ($o->mthd()->arr) - - * zend_API.c - zend_API.h - zend_compile.c - zend_compile.h - zend_execute.c: - - Improve ARG_INFO() macros to support supplying required_num_args - - Initial fix for foreach($o->mthd()->arr) crash (now leaks) - -2004-02-25 Derick Rethans - - * zend_highlight.c: - - Use instead of in highlight_string(). (Patch by - mg@iceni.pl) - -2004-02-25 Jani Taskinen - - * zend_exceptions.c: - Improve error messages - -2004-02-25 Zeev Suraski - - * zend.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_variables.c: - - Rename compatiblity mode to zend.ze2_compatibility_mode (it doesn't - only affect auto-clone). - - Perform implementation checks even with simple inheritance (off when - compatibility mode is enabled). - - Restore default arguments in interfaces and handle it correctly. - - Move registration of internal classes later in the startup sequence - in order to have INI options available. - -2004-02-25 Derick Rethans - - * zend_exceptions.c: - - Fixed bug #27391 (typo in Fatal Error message). - -2004-02-25 Zeev Suraski - - * zend_API.c - zend_compile.c - zend_compile.h - zend_opcode.c: - - Abstract methods cannot have defaults for arguments - - Make function foo($a, $b=null) satisfy both foo($a) and foo($a, $b) - prototypes - -2004-02-25 Sebastian Bergmann - - * zend_reflection_api.c: - Proto fixes. - -2004-02-25 Marcus Boerger - - * zend_objects_API.c: - Fix object destruction/free in shutdown - - set destructor_called even when no dtor is given - - use free_storage even when no dtor hat to be called - - * zend_objects_API.c: - Checking once for dtor is enough - -2004-02-24 Marcus Boerger - - * zend_API.c: - Fix class flags when handling abstract methods - -2004-02-23 Andi Gutmans - - * zend_language_parser.y: - - Improve precendence: - - foo = "Blah"; - - if (!$obj instanceof StdClass) { - print "No"; - } else { - print "Yes"; - } - - * zend_language_parser.y: - - Decrease precedence of instanceof so that the following is true: - php -r 'var_export((object)1 instanceof stdClass);'; - Patch by Jan Lehnardt - -2004-02-22 Derick Rethans - - * zend_operators.c: - - Fixed bug #27354 (Modulus operator crashes PHP). - -2004-02-22 Marcus Boerger - - * ZEND_CHANGES: - Add some more obviously needed information - -2004-02-20 Hartmut Holzgraefe - - * zend.h - zend_API.h - zend_iterators.h - zend_operators.h - zend_variables.h: - more EXTERN_C wrapping of ZEND_API prototypes - -2004-02-20 Jani Taskinen - - * zend_opcode.c: - ws fix - -2004-02-18 Hartmut Holzgraefe - - * zend.h - zend_builtin_functions.h - zend_extensions.h - zend_indent.h - zend_interfaces.h - zend_object_handlers.h - zend_objects.h - zend_objects_API.h - zend_ptr_stack.h - zend_stack.h - zend_stream.h: - wrap ZEND_API prototypes into BEGIN_EXTERN_C/END_EXTERN_C - for C++ extension support - -2004-02-18 Zeev Suraski - - * zend.c: - Forward-port fixlet from PHP 4 (thanks to Michael Sisolak) - -2004-02-17 Jani Taskinen - - * zend_list.c: - MFB: - Fix bug #26753 (zend_fetch_list_dtor_id() does not check NULL - strings) - -2004-02-16 Derick Rethans - - * ZEND_CHANGES: - - Clearify clone behavior, fixed clone example (Patch by Jan Lehnardt) - -2004-02-16 Marcus Boerger - - * zend_compile.c: - Bugfix #27227 Mixed case class names causes Fatal Error in Constructor call - -2004-02-14 Marcus Boerger - - * zend_iterators.c: - dtor's may not be called from free_storage handlers - -2004-02-12 Andi Gutmans - - * (php_5_0_0b4) - zend_execute.c: - - Remove old code - -2004-02-12 Hartmut Holzgraefe - - * (php_5_0_0b4) - ZEND_CHANGES: - making sure that the provided examples actualy work (or at least do not - generate no parse errors) unless they are really expected to fail - -2004-02-12 Andi Gutmans - - * (php_5_0_0b4) - zend_object_handlers.c: - - This was too strict. - -2004-02-12 Zeev Suraski - - * (php_5_0_0b4) - zend_API.c - zend_API.h - zend_compile.c - zend_compile.h - zend_interfaces.c - zend_object_handlers.c: - - Check return-by-reference bit when implementing interface prototypes - - Add infrastructure for built-in functions to hint whether they - return by reference or not. It is NOT currently used for anything, - except for interface prototypes (you can use it to request that the - function that implements your prototype returns by reference or - doesn't return by reference). - For downwards compatibility - by default, interface prototypes are - agnostic as to whether the function that implements them returns - by reference or not. Use ZEND_BEGIN_ARG_INFO_EX() with - ZEND_RETURN_VALUE/ZEND_RETURN_REFERENCE to change that. - - Fix ArrayAccess::getOffset() to conduct additional checks. - If your getOffset() should work with multidimensional arrays - it - must return by reference. - -2004-02-12 Andi Gutmans - - * (php_5_0_0b4) - zend_object_handlers.h: - - Add comments to read/write property/dimension for extension authors - -2004-02-12 Zeev Suraski - - * zend_default_classes.h: - zend_default_classes.h -> zend_exceptions.h - -2004-02-12 Andi Gutmans - - * (php_5_0_0b4) - Makefile.am: - - Add zend_exceptions.c - -2004-02-12 Zeev Suraski - - * (php_5_0_0b4) - ZendTS.dsp - zend.c - zend_default_classes.c - zend_exceptions.c - zend_exceptions.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_reflection_api.c: - Centralize exceptions code in zend_exceptions.[ch]. - Remove zend_default_classes.h (use zend_exceptions.h instead) - - NOTE: This currently breaks the build, fixes to php-src and pecl coming - soon - -2004-02-12 Andi Gutmans - - * zend_execute.c: - - Use zend_throw_exception_object() in throw_handler to make sure it - - does all the checks - -2004-02-12 Zeev Suraski - - * zend_default_classes.c - zend_default_classes.h - zend_exceptions.c - zend_exceptions.h - zend_execute.h - zend_execute_API.c: - Exceptions updates: - - - Enforce exceptions to be derived from class Exception. This allows - users to perform catch-all. It's not yet complete, so don't get - comfortable with it just yet :) Updates are coming soon. - - Implement zend_throw_exception() using zend_throw_exception_ex() - -2004-02-12 Andi Gutmans - - * zend_execute.h - zend_execute_API.c: - - Add API function to throw exception by using an object - -2004-02-11 Marcus Boerger - - * zend.c: - Must be initialized in ZTS mode - - * ZEND_CHANGES - ZEND_CHANGES: - Update - - * zend_compile.c - zend_language_parser.y: - Fix: [extends [, ]* ] - -2004-02-11 Zeev Suraski - - * zend_execute.c: - Fix leaks in assignments to overloaded objects - - * zend_execute.c: - Fix leak with overloaded objects, when they're used just "for the hell - of it" :) - - * zend_execute.c: - Fixed a bug the caused overloaded array indices to be converted to strings - - * zend_execute.c: - Turn off bogus warnings with overloaded dimensions and += (and friends) - - * zend_execute.c: - Improve the implementation of unset() on array dimensions to be more - consistent with that of regular variables and string offsets - - * zend_execute_API.c: - Fix bug #25038 - - * zend_reflection_api.c: - Fix crash (patch by Rob Richards) - - * zend.c - zend_execute_API.c: - Fix exceptions thrown without a stack frame - Always enable set_exception_handler() - - * zend_list.h: - Change FETCH_RESOURCE to return false on error instead of null, for - consistency with other error situations - - * zend_compile.c: - Fix bug #26802 (the right aspects of it found by Marcus, anyway :) - - * tests/bug26802.phpt: - Fix and clarify the test case - - * zend_execute_API.c: - Complete the fix for handling of exceptions happening during the - argument passing phase of function calls (fixes bug #26866) - - * zend_execute_API.c: - whitespace - -2004-02-10 Zeev Suraski - - * tests/bug26698.phpt: - Ignore the memleak in this test - - * zend_execute.c: - Fix bug #26698 (exceptions handled properly during argument passing to - functions) - - * zend_default_classes.c: - Fix bug #27186 - - * zend_execute_API.c: - Fix bug #26869 - - * zend_execute.c: - Fix refcounting of ++/+= overloading (fix leak in __get()/__set() - based classes) - -2004-02-10 Andi Gutmans - - * zend_compile.c: - - Nuke more unused code - -2004-02-10 Zeev Suraski - - * zend_execute.c: - Fix handling in assignment using multidimensional array syntax to string - offset ($s = "FUBAR"; $s[0][0] = 1;) - -2004-02-10 Andi Gutmans - - * ZEND_CHANGES: - - We will go with PHP 4 behavior. With the new object model assigning by - reference has lost a lot of its importance. - - * zend_compile.c: - - Remove junk - -2004-02-10 Zeev Suraski - - * zend_execute.c: - Fix exception handling in opcodes spanned across multiple oplines (fixes - the crash in __set()) - - * zend_execute.c: - - Fix pre/post increment for overloaded objects - - Fix binary-assign-op for overloaded objects - - NOTE: This requires the implementation of the 'get' callback! - -2004-02-10 Moriyoshi Koizumi - - * tests/bug22836.phpt: - - Correcting test. - -2004-02-08 Zeev Suraski - - * zend_execute.c - zend_object_handlers.c - zend_object_handlers.h: - Fix write-mode of overloaded objects when using array dimensions - -2004-02-08 Andi Gutmans - - * zend_objects_API.c: - - Check if free_storage exists - -2004-02-05 Sebastian Bergmann - - * ZEND_CHANGES: - Committing for Jan. - -2004-02-05 Ilia Alshanetsky - - * zend_compile.c - tests/bug27145.phpt: - Fixed bug #27145 (Unmangle private/protected property names before printing - then inside error messages). - -2004-02-04 Zeev Suraski - - * zend_execute_API.c: - Fix exceptions happening inside internal functions called through - zend_user_function() - - * zend_execute_API.c: - Remove double initialization - -2004-02-04 Marcus Boerger - - * zend_objects.h: - Add new prototype - - * zend_reflection_api.c: - Fix reflection - - * zend_iterators.c: - Fix warnings - -2004-02-04 Zeev Suraski - - * zend_compile.c: - Fixlet - - * zend_compile.c: - Fix handling of $this in some cases - - * zend_compile.c: - Handle additional cases - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_language_parser.y: - Reinstate early-binding for classes. - - Note that this is available for downwards compatibility only - and it - doesn't - work if you use new features (namely, interfaces). Generally, people - should - declare their classes before using them, but we just didn't want hell to - break - loose (c) - - * zend_opcode.c: - Optimize - - * zend_compile.c: - - Improve $this assignment detection and generalize some code in - zend_compile.c - - * zend_compile.c: - -Error out when trying to re-assign $this - - * zend_objects_API.c - zend_objects_API.h: - The valid bit was necessary after all - restored - - * zend_objects_API.c: - Fixlets - - * zend_compile.c - zend_objects.c: - - Small fixes - - * zend_execute.c: - - Improve wording - - * zend_execute_API.c - zend_iterators.c - zend_objects.c - zend_objects_API.c - zend_objects_API.h - zend_reflection_api.c: - Change destructor implementation (details will follow on internals@) - -2004-02-03 Marcus Boerger - - * tests/bug24884.phpt: - Update tests - - * zend_objects.c: - Nuke unused variable - - * zend_compile.c: - Fix Warning - -2004-02-03 Sebastian Bergmann - - * ZEND_CHANGES: - clone/__clone() related changes. - -2004-02-03 Zeev Suraski - - * zend_compile.c: - Remove unused variable - - * zend_objects_API.c - zend_objects_API.h: - Remove more garbage - valid bit was not really necessary - - * zend_execute_API.c - zend_object_handlers.c - zend_object_handlers.h - zend_objects_API.c - zend_objects_API.h: - - Clean garbage (delete was nuked a long time ago) - -2004-02-03 Ilia Alshanetsky - - * zend_execute.c: - More unneeded code removed. - -2004-02-03 Zeev Suraski - - * zend_execute.c - zend_language_scanner.l: - Abort on parse error in an include file (patch by Ilia) - - * zend_compile.c: - Remove redundant code - - * zend_execute.c: - Fix try/catch block logic - - * zend_compile.c - zend_objects.c: - Perform a bitwise copy of the object even when __clone() is defined. - __clone() is back to not requiring any arguments, as $that is no longer - needed ($this already contains a copy of the original object, by the time - we __clone() is executed). - Calling the parent clone is done using parent::__clone() - - * zend_compile.c - zend_compile.h - zend_default_classes.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l - zend_opcode.c: - Rewrote exception support. Fixes a few limitations and bugs in the old - implementation, and allows exceptions to 'fire' much earlier than before. - - Instructions on how to use the new mechanism will follow on internals@ - shortly... - - Note - this (most probably) breaks the current implementation of - set_exception_handler() - -2004-02-02 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_language_parser.y - zend_language_scanner.l - zend_objects.c: - Redesign the clone() feature to fix some fundamental flaws in the previous - implementation. - - Using clone directly is now done using - $replica = clone $src; - - Clone methods must now be declared as follows: - function __clone($that) - { - } - - Clone methods in derived classes can call the __clone method of their - parent - classes using parent::__clone($that) - -2004-01-31 Marcus Boerger - - * zend_reflection_api.c: - Throw an exception in case a reflection object cannot be found and do not - override the exception from constructors in static method calls. - -2004-01-30 Ilia Alshanetsky - - * zend_execute.c: - Apply the same parse error handling to (include|require)_once as the one - for - their non-once counterparts. - -2004-01-28 Zeev Suraski - - * zend_compile.c: - Tweak checks to detect some additional cases. - Reorder checks to make more sense. - - * zend_compile.c: - - Error message fix - - Prevent inheritance of the same constant from two interfaces - - * zend_compile.c: - Fixlets - - * zend_compile.c - zend_compile.h: - Prevent classes from implementing interfaces that have the same function - - * zend_execute.c: - Whitespace - - * zend_compile.c: - Code relayout - - * zend_execute_API.c: - Forward-port fix for timeouts under Windows - -2004-01-26 Marcus Boerger - - * zend_interfaces.c - zend_interfaces.h: - - Export struct zend_user_iterator - - Ad 'it' to function prefix to prevent naming clashes - - Export zend_user_it_free_current - -2004-01-25 Ilia Alshanetsky - - * zend_execute.c: - Fixed bug #26814 (On parse error include included file, terminate - execution script). - -2004-01-25 Marcus Boerger - - * zend_execute.c - zend_iterators.c - zend_iterators.h: - Respect proeprty visibility in foreach - - * tests/bug26696.phpt: - Update test - -2004-01-24 Marcus Boerger - - * zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c: - Switch from ZEND_ACC_DYNAMIC to ZEND_ACC_ALLOW_STATIC and disallow calling - internal non-static methods statically. - -2004-01-24 Sebastian Bergmann - - * zend_execute.c - zend_execute_API.c: - Change message as proposed by Jon. - -2004-01-23 Marcus Boerger - - * zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c: - Simplify detection of methods that must be called dynamic (with object) - - * zend_execute.c - zend_execute_API.c: - Disallow calling __clone/__construct/__destruct static - Send an E_STRICT when calling a non static method static - - * zend_API.c - zend_compile.c - zend_compile.h: - Disallow static declaration of clone - -2004-01-23 Jani Taskinen - - * zend_constants.h - zend_ini.h: - Silence some compile warnings - -2004-01-22 Marcus Boerger - - * zend_default_classes.c: - Fix internal access to exception properties - -2004-01-19 Andi Gutmans - - * zend_execute.c - zend_execute.h: - - Hopefully fix bug #26696. - - Please let me know if hell-breaks loose - -2004-01-19 Marcus Boerger - - * zend_API.c - zend_API.h: - Add zend_get_module_started() to quickly check whether a module is present - and its MINIT function has been called. - -2004-01-18 Marcus Boerger - - * zend_execute.h - zend_execute_API.c: - Improove debug capabilities - - * zend_reflection_api.c: - Fix some casing issues - -2004-01-17 Marcus Boerger - - * zend_interfaces.c: - - - * zend_interfaces.c: - Fix inheritance rule for interface Traversable - -2004-01-17 Jani Taskinen - - * tests/bug26802.phpt: - - Renamed all *php4* files to *php5*, changed all php4/PHP4 to php5/PHP5 - -2004-01-17 Ilia Alshanetsky - - * zend_object_handlers.c - zend_object_handlers.h: - Expose zend_std_call_user_call(), needed for implementation of things like - __call handlers. - -2004-01-17 Jani Taskinen - - * zend_compile.c - zend_language_scanner.h - zend_language_scanner.l: - Nuke compile warning by using the LANG_SCNG macro instead - -2004-01-16 Jani Taskinen - - * zend_reflection_api.c: - - Fixed bug #26640 (__autoload() not invoked by Reflection classes) - - -2004-01-15 Zeev Suraski - - * zend.c: - Nice patch Christian, but it wasn't at all enabled? :) - - Fix bug #26883 - -2004-01-14 Zeev Suraski - - * zend_compile.c: - Don't allow interfaces to implement anything - -2004-01-14 Andi Gutmans - - * zend_operators.h: - - Remove bogus macros - -2004-01-13 Wez Furlong - - * zend_ini_parser.y: - Don't treat strings containing : as potential constant names in - the .ini parser. - This fixes Bug #26893 - -2004-01-12 Andi Gutmans - - * zend_compile.c: - - Return the PHP 4 behavior of not allowing class declerations within - - class declerations. This happened when declaring a class within a - - method. - class A { - function foo() { - class B { - } - } - } - -2004-01-12 Marcus Boerger - - * zend_API.h: - Add missing macro - -2004-01-11 Wez Furlong - - * zend_compile.c - zend_language_scanner.h - zend_language_scanner.l: - TSRMLS fix - -2004-01-11 Andi Gutmans - - * zend_language_parser.y: - - Re-allow conditional class declerations. Needless to say that I also - - think it's not great coding.. Use polymorphism instead :) - - * zend_compile.c - zend_language_scanner.h - zend_language_scanner.l: - - This should fix the problem of conditional function decleration on the - - same line of code not to work. You should re-evaluate your coding style - - if you really code this way :) - -2004-01-10 Zeev Suraski - - * zend_operators.c: - Remove conflict - - * zend_builtin_functions.c - zend_execute_API.c - zend_globals.h - zend_operators.c: - Added error mask to set_error_handler() - Patch by Christian Schneider - -2004-01-09 Wez Furlong - - * acconfig.h: - support for building asm in the unix buildsys. - Also, when ZEND_ACCONFIG_H_NO_C_PROTOS is defined, - omit the C prototypes from the configuration header - so that it can be included into asm files. - -2004-01-09 Marcus Boerger - - * RFCs/002.txt: - this one is declined - -2004-01-09 Wez Furlong - - * zend_object_handlers.h: - must be extern to avoid problems with some compilers - -2004-01-09 Stanislav Malyshev - - * tests/bug26077.phpt: - fix expect - - * zend_compile.c: - Bug #25816 - disallow arrays in class constants - - * tests/bug26077.phpt: - add test - - * zend_compile.c - zend_execute.c: - Fix Bug #26077 - memory leak when new() result is not assigned - and no constructor defined - -2004-01-08 Jani Taskinen - - * acconfig.h - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.nw.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_default_classes.c - zend_default_classes.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_ini.c - zend_ini.h - zend_ini_scanner.h - zend_interfaces.c - zend_interfaces.h - zend_istdiostream.h - zend_iterators.c - zend_iterators.h - zend_language_scanner.h - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_mm.c - zend_mm.h - zend_modules.h - zend_multibyte.c - zend_multibyte.h - zend_multiply.h - zend_object_handlers.c - zend_object_handlers.h - zend_objects.c - zend_objects.h - zend_objects_API.c - zend_objects_API.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_qsort.c - zend_qsort.h - zend_reflection_api.c - zend_reflection_api.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_static_allocator.c - zend_static_allocator.h - zend_stream.c - zend_stream.h - zend_ts_hash.c - zend_ts_hash.h - zend_types.h - zend_variables.c - zend_variables.h: - - Happy new year and PHP 5 for rest of the files too.. - -2004-01-08 Andi Gutmans - - * zend_ini_parser.y - zend_ini_scanner.l - zend_language_parser.y - zend_language_scanner.l: - - - A belated happy holidays (by two years) - -2004-01-07 Marcus Boerger - - * zend_execute.c: - Reimplement part of Bug #24608 that was reverted too - - * zend_execute.c: - Revert patch that allowed to call sttaic methods via $method() - -2004-01-06 Ilia Alshanetsky - - * zend_mm.c: - Check if realloc() succeeds or not. (Noticed by Andrey) - -2004-01-06 Marcus Boerger - - * tests/bug26802.phpt: - Update - -2004-01-05 Marcus Boerger - - * zend_execute.c - tests/bug26802.phpt: - Fixed bug #26802 - - * tests/bug26802.phpt: - Fix test - - * tests/bug26801.phpt - tests/bug26802.phpt: - Add new test - - * tests/bug26696.phpt: - Update test - -2004-01-05 Stanislav Malyshev - - * zend_API.c: - Fix bug #26543 - check parent:: and self:: in class names - - * zend_execute.c - zend_object_handlers.c: - Bug #24608 - fix interaction between __accessors and get_property_ptr - -2004-01-03 Derick Rethans - - * zend.c - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_object_handlers.c - zend_reflection_api.c: - - Fixed var_export() to show public, protected and private modifiers - properly. - - Exported (un)mangle_property_name. - -2004-01-02 Andrei Zmievski - - * zend_default_classes.c: - Do not show exception message if it's empty. - - -2003-12-31 Andrei Zmievski - - * zend_default_classes.c: - Make default message look better. - -2003-12-30 Andi Gutmans - - * ZEND_CHANGES: - - Fix typos - -2003-12-30 Marcus Boerger - - * ZEND_CHANGES: - Update - -2003-12-30 Ilia Alshanetsky - - * tests/bug26696.phpt: - Added test case for bug #26696. - -2003-12-29 Marcus Boerger - - * zend_execute.c: - Fix (string) conversion - - * zend.c: - Add missing notice - - * zend_execute_API.c: - Fix __autoload() with derived classes - -2003-12-28 Marcus Boerger - - * zend_API.c: - WS - - * zend_API.h - zend_compile.c: - Fix order of class_entry member initialization (needed for example for DOM) - -2003-12-27 Marcus Boerger - - * zend_language_parser.y: - Fixed bug #26065 (Crash when nesting classes) - - * tests/bug26698.phpt: - Add new test - - * zend_objects.c: - Simplify - - * zend_object_handlers.c: - Fix __tostring() and concatenation - -2003-12-25 Marcus Boerger - - * zend_execute.c - zend_execute.c: - Fix warning - -2003-12-25 Ilia Alshanetsky - - * zend_highlight.c: - Fixed Bug #26703 (Certain characters inside strings incorrectly treated as - keywords). Original patch by vrana@php.net. - -2003-12-23 Marcus Boerger - - * zend.c - zend_execute_API.c - zend_globals.h - tests/bug26697.phpt: - Fixed bug #26697 (calling class_exists on a nonexistent class in __autoload - results in segfault). - -2003-12-22 Marcus Boerger - - * tests/bug26229.phpt - tests/bug26695.phpt: - Add more tests - - * tests/bug24884.phpt - tests/bug26166.phpt: - Fix tests now that class names are shown in correct casing - - * zend_compile.c: - Preserve class name casing. - - * zend_reflection_api.c: - Fixed bug #26695 (Reflection API does not recognize mixed-case class hints) - - * zend_object_handlers.c: - Fixed bug #26675 (Segfault on ArrayAccess use) - Update NEWS - -2003-12-22 Wez Furlong - - * zend_API.c - zend_API.h - zend_object_handlers.c - zend_object_handlers.h: - export these symbols for use by SPL as a shared extension - -2003-12-19 Andi Gutmans - - * (php_5_0_0b3RC2) - zend_language_parser.y: - - Nuke another rule (thanks to Jan for noticing this) - -2003-12-19 Dmitry Stogov - - * (php_5_0_0b3RC2) - zend.c: - Bug #25547 (error_handler and array index with function call) was fixed - tests/lang/bug25547.phpt - -2003-12-19 Andi Gutmans - - * zend_language_parser.y: - - Nuke unused code - -2003-12-19 Dmitry Stogov - - * (php_5_0_0b3RC2) - zend_execute.c: - Error reporting on unset string offset was added (Bug #24773 - Zend/tests/bug24773.phpt) - - * zend_execute.c: - Assign_op operators (+=) were fixed for elements of overloaded objects - -2003-12-18 Andi Gutmans - - * zend_execute.c: - - Nuke C++ comment - - * zend_execute.c: - - Revert patch 1.566 - -2003-12-18 Marcus Boerger - - * zend_execute.c - zend_object_handlers.c - zend_object_handlers.h: - Fixed bug #24837 Incorrect behaviour of PPP using foreach. - -2003-12-17 Zeev Suraski - - * (php_5_0_0b3RC1) - zend_execute.c: - This part of the if was necessary after all. - Refix bug #22510 - -2003-12-17 Dmitry Stogov - - * (php_5_0_0b3RC1) - zend_execute_API.c: - -** empty log message *** - - * (php_5_0_0b3RC1) - zend_compile.c: - Dynamic function call from object's property was fixed - (See "tests/lang/bug24926.phpt" and "tests/lang/bug25652.phpt") - - * zend_execute_API.c: - Access to globals/autoglobals from class __destructor was fixed. - (see "tests/lang/bug24908.phpt" and - "tests/classes/destructor_and_globals.phpt") - -2003-12-16 Sebastian Bergmann - - * zend_compile.h - zend_object_handlers.h - zend_stream.h: - Sync: Export externally used functions. - -2003-12-16 Stanislav Malyshev - - * zend_compile.c: - export class initialization function - - * zend_object_handlers.c: - export externally used functions - - * zend_stream.c: - export function - -2003-12-15 Marcus Boerger - - * zend.c - zend_object_handlers.c - zend_object_handlers.h: - Reenable __tostring() magic for print,echo,concatenation,function naming... - but not for other internal things. - -2003-12-15 Jani Taskinen - - * zend_execute.c: - ws + cs (no c++ comments in c code) - -2003-12-15 Dmitry Stogov - - * zend_execute.c: - Bug #24773 was fixed (Zend/tests/bug24773.phpt) - Assign_op operators (+=) were fixed for elements of overloaded objects - Memory leaks during accessing ptoperies/elements of overloaded objects - were fixed - - * zend_execute_API.c - zend_reflection_api.c: - Memory corruptions were fixed in zend_str_tolower_copy() - -2003-12-14 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h: - Fix behavior of return-by-reference functions. Remove erroneous warnings, - add E_STRICT warnings in case you return something by reference that - you're - not supposed to (anything that's not a variable, or a return-value of a - function that returned by reference). - - * zend.h - zend_execute.c - zend_execute.h: - Some cleanup - -2003-12-13 Moriyoshi Koizumi - - * zend_operators.c: - Fixes for POSIX compliancy. - -2003-12-12 Marcus Boerger - - * zend.c: - Free is needed in non ZTS too - - * zend.c: - Fix memleaks in ZTS mode - - * zend.c: - Fix memleaks - -2003-12-12 Ilia Alshanetsky - - * zend_constants.c: - Do not copy extra byte. - -2003-12-11 Ilia Alshanetsky - - * zend.h: - Fixed extra byte allocation for TRUE/FALSE/ZEND_THREAD_SAFE/NULL constants. - -2003-12-11 Marcus Boerger - - * zend_execute_API.c: - Bugfix: #26591 [NEW]: "__autoload threw an exception" during an uncaught - Exception - -2003-12-11 Andi Gutmans - - * zend_execute.c: - - Refix bug #24773 - -2003-12-11 Marcus Boerger - - * zend_object_handlers.c: - Handle getter failure and allow to bypass thrown exceptions. - - * zend_execute.c: - read_dimension() handler might return 0, handle this. - -2003-12-10 Marcus Boerger - - * zend_execute_API.c: - Do not double copy the string - -2003-12-09 Jani Taskinen - - * zend_operators.c - zend_operators.h: - - Brought ext/bcmath to the new millennium - -2003-12-09 Andi Gutmans - - * zend_constants.c: - - Fix overallocation (thanks to Ilia) - -2003-12-08 Derick Rethans - - * zend_builtin_functions.c: - - Make it compile again - -2003-12-07 Stanislav Malyshev - - * zend_builtin_functions.c: - Apply Andrey Hristov's patch adding get_declared_interfaces() - -2003-12-06 Marcus Boerger - - * zend_compile.c: - This test is against interfaces not abstract classes. - - * zend_default_classes.c: - Show the exception message again after __toString() magic has been dropped. - -2003-12-05 Andi Gutmans - - * zend_compile.c - zend_execute.c: - - Remove two unneeded convert_to_string() (found by Marcus) - - Change illegal use of string offset to E_ERROR - -2003-12-05 Ilia Alshanetsky - - * zend_default_classes.c: - Fixed crash demonstrated with ext/dom/tests/dom003.phpt test case. - -2003-12-04 Moriyoshi Koizumi - - * zend_execute.c: - Revert crap. - - * zend_execute.c: - Raise error in case dereference is performed on a scalar value. - -2003-12-03 Ilia Alshanetsky - - * tests/bug24773.phpt: - Test case for bug #24773. - -2003-12-03 Moriyoshi Koizumi - - * zend_execute.c: - This kind of error should be caught. (suggested by Andi, thanks) - - * zend_execute.c: - Fix bug #24773 (unset()ing string offsets crashes PHP) - -2003-12-03 Derick Rethans - - * zend_execute.c: - - Remove newline from error message - -2003-12-02 Marcus Boerger - - * zend_object_handlers.c: - Remove automatic call to __toString() since it is supposed to cause too - much trouble. See discussion on the mailing list. - -2003-12-02 Andi Gutmans - - * zend_API.c - zend_operators.c: - - Revert the revert of these patches. This overloading can only be used - - by C extensions such as SimpleXML and *NOT* PHP code. Reasons given - - on the mailing list and problem with reentrancy inside the opcodes. - - * zend_compile.c: - - Fix for bug #26182 - - * zend_errors.h: - - Don't include E_STRICT in E_ALL. - -2003-12-02 Marcus Boerger - - * zend_API.h: - Free the zval container only if it should be freed and was not copied. - -2003-12-01 Andi Gutmans - - * zend_execute.c: - - Change to E_STRICT so as not to break existing scripts. - - Thanks Edin - - * zend_builtin_functions.c: - - Nuke property_exists(). We need to fix isset() and this is already - - supported in reflection API. In any case, it's best not to add new - - functions in the general namespace except for keeping engine consistency - (which would have been true in this case) - - * zend_API.c: - - Revert auto-conversion in parameter API - - * zend_operators.c: - - Don't automatically call __toString() in convert_to_string_ex(). - - use __toString() in your code. - - Keep the auto-case in make_printable_zval. - -2003-11-30 Marcus Boerger - - * zend_default_classes.c: - Check return value of exception::__tostring() - - * tests/bug20240.phpt: - Fix test - -2003-11-29 Marcus Boerger - - * zend_compile.c - zend_iterators.c: - Fix memleak - -2003-11-29 Ilia Alshanetsky - - * zend_highlight.c - zend_language_scanner.l: - Fixed bug #26463 (Incorrect handling of semicolons after heredoc) - -2003-11-29 Marcus Boerger - - * zend_API.h: - This takes the address of a zval ptr - - * zend_API.h: - Add macros to return values of other zvals. - This is needed because one cannot use REPLACE_ZVAL_VALUE with - return_value. - -2003-11-29 Ilia Alshanetsky - - * zend_execute.c: - Restore original patch for bug #26281. - - -2003-11-29 Marcus Boerger - - * zend_compile.c: - Revert accidential commit until decision - - * zend_compile.c - zend_default_classes.c: - Make exception code more robust: - - Fix error in calculation of trace-string length - - Allow to overload __strostring() and make it work for uncaught - exceptions - - Show exception thrown while displaying exceptions - -2003-11-28 Ilia Alshanetsky - - * zend_API.c: - Add removed lcname, it is still needed. - -2003-11-27 Marcus Boerger - - * zend_API.c: - Convert objects to string if string is required by newer parameter parsing - since we do this for older parameter parsing does so too. - - * zend_object_handlers.c: - The macro REPLACE_ZVAL_VALUE cannot be used since we only have zval * - writeobj. to allow it the api needs to be changed to zval **writeobj. - - * zend_builtin_functions.c: - Add a support function to check for property existance which is different - from checking a property from being empty/set. - Update test #26182. - -2003-11-24 Marcus Boerger - - * zend_execute.c - zend_interfaces.c - zend_interfaces.h - zend_object_handlers.c - zend_operators.c - zend_operators.h: - Add new interface ArrayAccess to use objects as Arrays - -2003-11-24 Andi Gutmans - - * zend_constants.c: - - Fix newly introduced bug which stopped class constants from working. - - Thanks to Jan Lehnardt for reporting it. - -2003-11-24 Sebastian Bergmann - - * RFCs/004.txt: - No longer needed. - -2003-11-24 Andi Gutmans - - * zend_API.c - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_reflection_api.c: - - Fix __autoload() to preserve class case. - - Heads up, this patch might break stuff so please let me know if you - - bump into any problems. - -2003-11-23 Andi Gutmans - - * zend_reflection_api.c: - - Allocation optimizations by Timm Friebe - -2003-11-21 Ilia Alshanetsky - - * zend_execute.c: - Cleaner patch for bug #26281. - -2003-11-19 Ilia Alshanetsky - - * zend_execute.c - tests/bug26281.phpt: - Possible fix for bug #26281 & test case. - -2003-11-18 Marcus Boerger - - * zend_API.h: - Add method alias macro - -2003-11-18 Andi Gutmans - - * zend.c - zend_builtin_functions.c - zend_constants.c - zend_errors.h - zend_language_parser.y: - - Add E_STRICT, to be used to warn purists (like Jani :) - -2003-11-18 Marcus Boerger - - * zend_compile.c: - Backpatch the correct opcode for list(), property overloading needs more - opcodes (Bugfix #26257). - - * zend_interfaces.c: - Use correct order - - * zend_interfaces.c: - Use correct macro/function - -2003-11-17 Marcus Boerger - - * zend_interfaces.c: - Correct destruction - -2003-11-13 Moriyoshi Koizumi - - * zend_operators.c: - Bugfix #26156 (REPLACE_ZVAL_VALUE works on uninit stack-based zvals) - -2003-11-13 Marcus Boerger - - * ZEND_CHANGES - zend_interfaces.c: - IteratorAggregate::getIterator() cannot return anythingy else than objects - -2003-11-13 Andi Gutmans - - * zend_compile.c: - - Make sure internal clasess are malloced - -2003-11-10 Marcus Boerger - - * zend_iterators.c: - Don't use zend_class_entry indirection - - * zend_builtin_functions.c: - Bugfix #26010 (Bug on get_object_vars() function) - - * zend_object_handlers.c: - Correct default handlers - - * zend_iterators.c: - Need to update iterators handler table too. - - * zend_execute.c - zend_object_handlers.c: - Fix those warnings - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_object_handlers.c - zend_object_handlers.h - zend_objects_API.c: - Split isset/isempty for object property and object dimension hooking. - - * zend_interfaces.c: - Little iterator improvement: ability to store index in iterator - -2003-11-08 Marcus Boerger - - * zend_reflection_api.c: - Add method reflection_class::implementsInterface() - Allow string & reflection_class in isSubclassOf() - - * zend_reflection_api.c: - Fix reflection_class::isSubclassOf() - - * zend.c - zend_object_handlers.c - zend_operators.c - tests/bug26166.phpt: - Handle exceptions in casting more gracefully. - This fixes bug #26166 - -2003-11-07 Marcus Boerger - - * zend_execute_API.c: - Make __autoload() faster - - * zend_execute.c - zend_iterators.h: - Update Iterators: Call next at the correct point in time. - - * zend_compile.c: - Add missing initialization. - - * zend_interfaces.h: - Make these class entries available for inheriting classes - -2003-11-06 Ilia Alshanetsky - - * zend_operators.c: - Fixed bug #26148 (Print the notice before modifying variable on type - mismatch). - - - Patch by: morten-bugs dot php dot net at afdelingp dot dk - -2003-11-04 Marcus Boerger - - * zend_execute.c - zend_interfaces.c: - Prevent some SEGV's when Exceptions are thorown inside iterators. - - * zend_builtin_functions.c: - Removedouble efree call - -2003-11-04 Moriyoshi Koizumi - - * zend_object_handlers.c: - __tostring() handler should be binary-safe - - * tests/bug26010.phpt: - Fix one more test - -2003-11-04 Stanislav Malyshev - - * Makefile.am: - add zend_iterators.c zend_interfaces.c to make - -2003-10-31 Moriyoshi Koizumi - - * tests/bug26010.phpt: - Add test case for bug #26010 - -2003-10-30 Stanislav Malyshev - - * zend_compile.c: - make CATCH opcode use "class" T like other opcodes do - via IS_CONST - -2003-10-30 Andi Gutmans - - * (php_5_0_0b2) - ZEND_CHANGES: - - Beta 2 - -2003-10-29 Moriyoshi Koizumi - - * zend_operators.h: - Use pretty macro instead. - -2003-10-28 Andi Gutmans - - * zend_language_parser.y: - - Head up! I'm reverting the patch which allows for expressions in constant - - declerations. Allowing the access of other constants in this code is - - flawed. We are reverting back to PHP 4's static scalars. - - Don't worry if you get the following msg when compiling: - - "zend_language_parser.y contains 3 useless nonterminals and 22 useless - rules" - - I didn't nuke the code in case we have some brilliant ideas after beta 2 - -2003-10-28 Marcus Boerger - - * zend_interfaces.c: - Give some freedon to c iterators but not in userspace. - -2003-10-28 Shane Caraveo - - * zend_compile.c: - fix crash in do_implement_interface when compiling - pear/PHPUnit/Framework/TestCase.php line 63 - while only interface_gets_implemented is the issue in this instance, both - these vars were unitialized, causing potential other issues - -2003-10-25 Marcus Boerger - - * zend_API.c - zend_API.h: - Add zend_make_callable() which allows to make zval's callable zval's. - At the moment this function only converts strings of the form - class::method - to an array(class,method). - - * zend_default_classes.c - zend_reflection_api.c: - This forces a better error message for non working clone calls. - - * zend_default_classes.c: - And use things to throw an exception here - - * zend_default_classes.c: - You shall not clone Exception instances - - * zend_reflection_api.c: - You shall not clone reflection_xx instances - - * ZEND_CHANGES - ZEND_CHANGES: - Update - -2003-10-25 Sebastian Bergmann - - * ZEND_CHANGES: - Fugbix typo. - - * ZEND_CHANGES: - s/Throwable/Printable: Exception has become an internal class since I - initially documented interfaces. - -2003-10-24 Andi Gutmans - - * ZEND_CHANGES: - - Fix typo - -2003-10-24 Marcus Boerger - - * zend_API.c - zend_execute_API.c: - Revert accidental commit - - * ZEND_CHANGES - zend_API.c - zend_execute_API.c: - Zend/ZEND_CHANGES - -2003-10-23 Sebastian Bergmann - - * Zend.dsp - ZendTS.dsp: - Add zend_interfaces.{c|h}. - -2003-10-22 Ilia Alshanetsky - - * zend.c: - Fixed bug #25922 (Crash in error handler when 5th argument is modified). - -2003-10-22 Marcus Boerger - - * zend_default_classes.c - zend_interfaces.c - zend_interfaces.h: - Impement userspace iterator interfaces and tests. See tests for details - on the names. - - * zend.h - zend_API.c - zend_API.h - zend_compile.c - zend_compile.h - zend_execute.c: - Expand Interface C API. - In short: zend_class_entry->interface_gets_implemented() allows to modify - the class entry of a class when an interface gets implemented. - - * zend_default_classes.c: - The string conversion method should be named __toString() - -2003-10-21 Marcus Boerger - - * ZEND_CHANGES: - Make this clear - -2003-10-20 Andi Gutmans - - * ZEND_CHANGES: - - Add comment from Timm - -2003-10-20 Marcus Boerger - - * ZEND_CHANGES - ZEND_CHANGES: - Update - -2003-10-19 Andi Gutmans - - * zend_language_parser.y: - - Nuke const in function parameters. I just can't remember why this exists - - and it seems no one else remembers either. It has no semantic meaning. - -2003-10-18 Marcus Boerger - - * zend.h - zend_API.h - zend_compile.c - zend_iterators.h: - Fix class/iterator relationship & handling - - * zend_iterators.c: - Fallback to old behavior until we have a default iterator that respects - visibility we do the array trick. - - * zend_iterators.h: - Change order: Optional rewind() to end of structure - -2003-10-17 Marcus Boerger - - * ZendTS.dsp: - WS - - * zend_reflection_api.c: - Show if a class/object is iterateable - - * ZendTS.dsp - zend.h - zend_API.h - zend_default_classes.c - zend_execute.c - zend_iterators.c - zend_iterators.h: - Added c-api for iterators - - * zend_reflection_api.c: - Fix showing final/abstract for classes - -2003-10-17 Ilia Alshanetsky - - * zend_ini_parser.y: - Fixed formatting issue. - - * zend_alloc.c: - Fixed if() condition. - -2003-10-15 Marcus Boerger - - * zend_API.c - zend_API.h: - Add oo support function zend_class_implements() - - * zend_default_classes.c: - Fix cast function - -2003-10-14 Andi Gutmans - - * zend_mm.c: - - Argh, the suffering copy&paste can cause - - * zend_alloc.c: - - Fix compile problem. - - * zend_mm.c: - - Fix the fix by making sure the new block is in the right free list. - -2003-10-14 Stanislav Malyshev - - * zend_execute_API.c: - The freed one is a hashtable - may matter if Hashtables are allocated - differently - -2003-10-14 Andi Gutmans - - * zend_mm.c: - - Support merging free block which was created by reallocing to smaller - - size. This should fix some performance issues. This code is still not - - thoroughly tested. - -2003-10-09 Zeev Suraski - - * zend_compile.c - zend_execute.c - zend_language_parser.y: - Allow foo::$bar() - -2003-10-07 Rasmus Lerdorf - - * Zend.m4: - MFB bison configure test fix - -2003-10-07 Zeev Suraski - - * zend_execute.c: - Fix bug #17997 (Warning when switch & reference are combined) - - * zend_ini_parser.y: - Fix the fix :) - Not thoroughly tested, but appears to work fine - -2003-10-07 Marcus Boerger - - * zend_ini_parser.y: - Bugfix #25770 Segfault with PHP and bison 1.875 - -2003-10-05 Zeev Suraski - - * zend_object_handlers.c: - Remove unused callback - - * zend_execute.c - zend_object_handlers.c - zend_object_handlers.h - zend_objects_API.c: - Remove redundant callback, simplify API - -2003-10-05 Shane Caraveo - - * (BEFORE_HANDLERS_RESHUFFLE) - zend_API.h: - this little piggy broke lots of things...eg. _function_check_flag in - reflection api. - -2003-10-03 Moriyoshi Koizumi - - * zend_API.c: - Fixed bug #24766 (strange result array from unpack()) - - * zend.h: - Bug #25738 (alloca() related problems on the Darwin platform) - - * zend_API.h: - Ensure lval to have a *boolean* value. - -2003-10-03 Jani Taskinen - - * Zend.m4: - Aligned configure help texts. - -2003-09-30 Moriyoshi Koizumi - - * zend_compile.c: - Remove redundant '\n' - -2003-09-26 Hartmut Holzgraefe - - * zend_alloc.c: - signed/unsigned compiler warning fixes - -2003-09-25 Georg Richter - - * zend_alloc.c: - fixed compiler warning - removed dead code - - * zend_hash.h: - changed ulong to long to avoid compiler warnings (comparison between signed - and unsigned) - -2003-09-22 Ilia Alshanetsky - - * zend.c - zend_language_scanner.l: - Added missing format. - -2003-09-20 Marcus Boerger - - * zend_reflection_api.c: - Add public array Reflection_Class::getDefaultProperties() - -2003-09-18 Marcus Boerger - - * zend_builtin_functions.c: - Nuke vars no longer needed - - * zend_builtin_functions.c - zend_reflection_api.c: - Go with studlyCaps - - * zend_reflection_api.c: - Change tostring() into __toString() to match method name used in casting. - - * zend.c - zend_operators.c: - Fallback to default behaviour for unsupported object type conversions - - * zend_object_handlers.c - zend_object_handlers.h - zend_operators.c: - - Allow partial type conversion support for objects. - - Add support for object to string conversion from userspace by method - __toString() and add a test. - - * zend_API.c: - Add missing check - -2003-09-17 Marcus Boerger - - * zend_compile.c - zend_execute.c: - Show name of missing function as typed - - * zend_default_classes.c: - Use studlyCaps in exception class - - * zend_compile.c: - Go with studlyCaps in error messages/backtrace/reflection output - -2003-09-16 Marcus Boerger - - * zend_reflection_api.c: - - Make it clear whether it is an interface or a class - - Fix static properties - -2003-09-15 Marcus Boerger - - * zend_execute.c: - Revert - need to look for a better solution - - * zend_execute.c: - Bugfix #25547 - -2003-09-15 Zeev Suraski - - * zend_operators.c: - Simplify / fix - -2003-09-14 Marcus Boerger - - * zend.c: - Bugfix #25335 - -2003-09-14 Zeev Suraski - - * zend_operators.c: - Commit 64-bit fixes to the standard operators - by Ard Biesheuvel (abies@php.net) - -2003-09-14 Marcus Boerger - - * zend.h: - Bugfix #25528 (by Ard Biesheuvel) - -2003-09-13 Marcus Boerger - - * zend_alloc.c: - Fix warnings - -2003-09-11 Stanislav Malyshev - - * tests/dtor_scope.phpt: - add test - - * zend_execute_API.c: - ws - - * zend_execute_API.c: - Use scope from method, not from object - -2003-09-11 Marcus Boerger - - * zend_default_classes.c: - Use type instead of constant - -2003-09-08 Marcus Boerger - - * zend_compile.c: - Fix property inheritance where a derived class inherits a public property - and owns it as an implicit public property already (noticed by Brad). - - * zend.c: - Fix registering/derigistering of stdClass in ZTS and NON ZTS mode - -2003-09-07 Marcus Boerger - - * zend_execute.c: - Fix foreach() called with non array - -2003-09-07 Stanislav Malyshev - - * Zend.m4: - check for mach-o/dyld.h - needed for non-PHP ZE build - -2003-09-06 Marcus Boerger - - * zend_default_classes.c: - Disallow to changing the backtrace - - * zend_reflection_api.c: - Add missing newline if no static methods are available - - * zend_reflection_api.c: - - Internal functions shall be static - - Fix more nesting - - * zend_reflection_api.c: - Fix logic - - * zend_reflection_api.c: - - Fix CS: {{{ / }}} - - Fix static reflection_*::export() - - Add class reflection_object which allows to show dynamic properties - - * zend_reflection_api.c: - Use %s where it makes more sense - -2003-09-05 Marcus Boerger - - * zend_reflection_api.c: - Simplify reflection_property::__constructor() and fix property factory - - * zend_reflection_api.c: - - Don't use resorved words as variable names. - - Improve several exception messages. - - Fix Reflection_Property::_construct() / getDeclaringClass() - - * zend_reflection_api.c: - Fix reflection_api::__construct() (noticed by Andrey) - - * zend_default_classes.c: - Provide string casting for exceptions by calling toString() - -2003-09-04 Marcus Boerger - - * zend_API.c - zend_execute.c - zend_object_handlers.c: - Tests show updating consts must happen once at runtime (revert - optimization). - Add tests for static properties. - - * zend_reflection_api.c: - Add reflection_class::getstaticproerties() - -2003-09-03 Marcus Boerger - - * zend_compile.c: - Partly revert and reintroduce hash table entries for the ctor. - - * zend_compile.c: - Nuke unused variable, too - - * zend_compile.c: - - Inheritance applies to __clone() too. - - No need to add additional functions for the constructor. - The handler uses the pointer as intended and doesn't look the the name. - - * zend_compile.c: - Cannot turn a static property into a non static one and vice versa - - * zend_API.c - zend_API.h - zend_compile.c - zend_default_classes.c: - Fix handling of static properties initialized to arrays - - * zend_compile.c: - Add missing error messages when violating static property inheritance - rules. - - * zend_API.c - zend_compile.c - zend_execute.c - zend_object_handlers.c: - Fix static properties. - - * zend_compile.c: - Allow redeclareing a protected property as public. - -2003-09-03 Zeev Suraski - - * zend_compile.c: - Revert bogus patch - One must *never* use E_CORE_* error levels! - -2003-09-03 Marcus Boerger - - * zend_reflection_api.c: - Clearly distinguish between Const, Static and Other members. - -2003-09-02 Marcus Boerger - - * zend_compile.c: - Fix error messages - - * zend_API.c: - Allow redeclaring of protected properties as public (for internal classes). - - * zend_reflection_api.c: - Use appropriate function for property name unmangling. - - * zend_reflection_api.c: - Make these static as noticed by Andrey - - * zend_execute.c - zend_object_handlers.c - zend_objects.c: - Synch/Unify error messages related to function/method calls - - * zend_compile.c: - Fix error level - - * zend_API.c - zend_compile.c: - Currently we cannot support static ctor/dtor - - * zend_reflection_api.c: - These are implicit properties as denoted by the flag. Dynamic properties - only - exist in one single object and currently reflection api is not capable of - showing those. - -2003-08-31 Marcus Boerger - - * zend_reflection_api.c: - Don't repeat first const count(consts) time - - * zend_reflection_api.c: - Beautify output - - * zend_reflection_api.c: - Add reflection_parameters, patch by Timm Friebe - - * zend_default_classes.c: - Excluded chars < 32 when displaying string parameters that would obliterate - output. - -2003-08-31 Zeev Suraski - - * zend_arg_defs.c - zend_builtin_functions.c - zend_modules.h: - Attempt at fixing the linkage problem in Win32 - -2003-08-31 Marcus Boerger - - * zend_execute.c: - Synch error message with other one to fix tests - - * zend_reflection_api.c: - Check whether we may access tat union - - * zend.c: - Revisited: Replace the non portable code by spprintf - - * zend_reflection_api.c: - Using zend_spprintf should be faster here - - * zend.c - zend.h - zend_default_classes.c: - Make vspprintf available as zend utility function. Use it in exception - output. - -2003-08-30 Marcus Boerger - - * zend_default_classes.c: - Actually fetch the parameter - - * zend_default_classes.c - zend_default_classes.h - zend_execute.c - zend_reflection_api.c: - - Calling abstract methods should be a error for consistency reason. - - So in reflection_api we use the reflection_exception again. - -2003-08-30 Andi Gutmans - - * zend_default_classes.c: - - PLEASE stop commiting ^M's - -2003-08-30 Marcus Boerger - - * zend_default_classes.c: - Even though it is ignored this should be correct - - * zend_default_classes.c: - Add frame numer and finally display stack trace in the message. - - * zend_default_classes.c: - Add exception::traceAsString() and exception::toString() - - * zend_reflection_api.c: - fci.function_table & fci.function_name are not needed since we use - zend_fcall_info_cache - - * zend_reflection_api.c: - Be precise - - * zend_reflection_api.c: - Actually using fcc would be a good idea - - * zend_default_classes.c - zend_default_classes.h - zend_execute.c: - - The compiler can't detect all abstract function calls so we need to - check. - - * zend_default_classes.c: - Make those final (see comment) - -2003-08-29 Marcus Boerger - - * zend_API.c - zend_API.h: - - Add zend_merge_properties() which is designed to serve *_fetch_object(). - - Explain drawbacks of object_and_properties_init and - zend_merge_properties. - - * zend_reflection_api.c: - - Use zend_fcall_info_cache in invoke() to improve speed. - -2003-08-29 Zeev Suraski - - * zend_compile.c: - Fix a problem in implicit public properties and inheritance - -2003-08-29 Sascha Schumann - - * zend_hash.c: - improve a number of zend_debug format strings - -2003-08-29 Marcus Boerger - - * zend_builtin_functions.c - zend_builtin_functions.h - zend_default_classes.c: - Need to tell zend_fetch_debug_backtrace() whether to skip top function or - not. - -2003-08-28 Marcus Boerger - - * zend_default_classes.c: - Add public read access to protected - - * zend_default_classes.c - zend_default_classes.h: - Add zend_throw_exception_ex() which allows to format exception messages. - - * zend.c: - Classe tables work this way - - * zend_builtin_functions.c - zend_builtin_functions.h - zend_default_classes.c: - - Split debug_backtrace() into lowlevel c function and php function wrapper - - Add trace property to default method based on new - zend_fetch_debug_backtrace - -2003-08-28 Sascha Schumann - - * zend.h: - older gccs don't understand attribute((format)) on function pointers - - * zend.h: - ZEND_GCC_VERSION should always be defined to a number so we can use - simple comparisons all the time. - - * zend.h - zend_alloc.c - zend_builtin_functions.c - zend_compile.c - zend_execute.c: - Add format attribute to a number of functions - - Kill a few warnings - - * zend.h - zend_alloc.h: - cleanup & centralize ZEND_GCC_VERSION and ZEND_ATTRIBUTE_MALLOC so that - they can be used by downstream applications - - * zend_alloc.h: - Enable attribute((malloc)) for GCC 2.96 - - * zend_alloc.h: - GCC 2 does not know about malloc yet. - - * zend_alloc.h: - provide attribute((malloc)) where appropiate - -2003-08-27 Marcus Boerger - - * zend_reflection_api.c: - Nuke unused variable - - * zend_reflection_api.c: - Fix reflection_class::newInstance() - -2003-08-25 Jani Taskinen - - * zend.h: - - Fixed bug #25240 (spaces before pre-processor directives) - -2003-08-24 Marcus Boerger - - * zend_API.c: - Add missing check - - * zend_API.c: - Fix memory source of string duplication for non internal properties - - * zend_API.c - zend_API.h - zend_compile.c - zend_default_classes.c - zend_execute_API.c - zend_variables.c - zend_variables.h: - - Provide appropriate way to destroy internal zval's. - - Allow internal zval's of type string and disallow complex types. - - Define the default string for extensions at class level instead of ctor. - - * zend_API.h - zend_compile.h - zend_reflection_api.c: - Don't identify alias'ed functions - -2003-08-24 Zeev Suraski - - * zend_API.c: - Use ""'s if you want empty strings. We want to crash on errors. - - * zend_compile.c: - Use pemalloc() - -2003-08-24 Marcus Boerger - - * zend_API.c: - Allow NULL, too - -2003-08-24 Zeev Suraski - - * zend_API.c: - Get rid of more ^M's - Marcus, please check your CVS client! - - * zend_default_classes.c: - Get rid of more ^M's - - * zend_compile.c: - line endings fix - - * zend_execute.c: - Never, ever, overwrite the refcount element of a connected zval! - -2003-08-24 Marcus Boerger - - * zend_reflection_api.c: - Add dedicated reflection_exception - - * zend_default_classes.c - zend_default_classes.h: - Allow to throw instances of classes derived from exception - - * zend.c - zend_default_classes.c - zend_default_classes.h - zend_execute.h - zend_execute_API.c: - - Provide a unified way to display uncaught exceptions, which shows - file/line/message info if possible. - - Add zend_eval_string_ex() to be able to handle exceptions in eval'd - code. - - Use above function to fix memleaks in CLI. - - * zend_reflection_api.c: - Make invoke() work - - * zend_reflection_api.c: - zend_parse_parameters 'O' works the way we need here - - * zend_reflection_api.c: - Not needed - - * zend_default_classes.c: - Make use method macros - - * zend_API.h: - One of PPP is needed, too - - * zend_reflection_api.c: - - Add Reflection_Function::isAlias - - Use ZEND_ME/ZEND_METHOD - - Fix static entries - - * zend_API.h - zend_compile.h: - - Add fn_flag ZEND_ACC_ALIAS - - Unify way of function_entry generation by new macro ZEND_FENTRY - - * zend_API.c: - Fix fn_flags handling - - * zend_API.c - zend_API.h - zend_default_classes.c: - Add property read code and use that in default exception class - -2003-08-23 Marcus Boerger - - * zend_default_classes.c - zend_default_classes.h - zend_reflection_api.c: - Allow zend_throw_exception() to also set the exception code - - * zend_default_classes.c: - Exception has 4 protected default properties (message,code,file,line). - They are all initialized at c-level constructor correctly. - - * zend_API.c - zend_API.h - zend_compile.c - zend_compile.h: - Internal classes can now have default properties. - - * zend_reflection_api.c: - Show ctor/dtor information and those don't return anything - - * zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c: - - Flag ctor/dtor methods - - Use this to prevent memleaks when an exception gets thrown in ctors. - - * zend_default_classes.c: - Make exception code more robust - -2003-08-22 Ilia Alshanetsky - - * zend_builtin_functions.c - zend_constants.h: - Replace *magic number* with a much nicer define. - - * zend_builtin_functions.c: - Set 2147483647 as the module number of user defined constants - Fixed a few bugs and cleaned up get_defined_constants(). - -2003-08-21 Marcus Boerger - - * zend_default_classes.c - zend_default_classes.h - zend_reflection_api.c: - Add function 'zend_throw_exception(char *message, int duplicate - TSRMLS_DC);' - to provide an easy way to throw exceptions for extension developers. - - * zend_API.c: - If ce not given than any object would do - - * zend_API.c: - Paramspec 'O' / zend_parse_method_params(): only if given check the class - type - -2003-08-20 Zeev Suraski - - * zend_alloc.c: - adhere to silence - -2003-08-20 Marcus Boerger - - * zend_alloc.c: - Fix counting number of leaks - -2003-08-19 Wez Furlong - - * zend_execute.c: - fix build - -2003-08-18 Wez Furlong - - * zend_ini.h: - linkage for C++ - -2003-08-18 Zeev Suraski - - * ZendTS.dsp - zend_execute.c - zend_execute_locks.h: - Prevent access to internal engine functionality - - * zend.h - zend_alloc.c - zend_compile.h - zend_execute.c: - - Improve tracking - - Fix several overloading issues - - * zend_API.c - zend_alloc.h - zend_hash.c - zend_hash.h - zend_ts_hash.c - zend_ts_hash.c - zend_ts_hash.h - zend_ts_hash.h: - Improve tracking - - * zend_compile.c: - ws - -2003-08-17 Marcus Boerger - - * zend_API.h - zend_builtin_functions.c - zend_execute.c - zend_object_handlers.c - zend_operators.c - zend_reflection_api.c: - Fix warnings - -2003-08-17 Sascha Schumann - - * zend.h: - One bit fields need to be unsigned, otherwise there is no storage for - the sign bit - - "A signed bit field has a length of 1 bit." - - * zend_API.h: - explicitly cast size_t to zend_uint to avoid warnings on 64 bit platforms. - -2003-08-17 Marcus Boerger - - * zend_execute.c: - Remove unnecessary if - - * zend_execute.c: - Put the code where it belongs - fixes a warning and confusion - - * zend_compile.c - zend_execute.c: - Implement a TBD: JMP to the end of foreach - - * zend_compile.c: - WS - - * zend_API.c: - - Show class names in error messages when dealing with methods - - Mark class as abstract if it gets an abstract method - -2003-08-16 Marcus Boerger - - * zend_API.c - zend_API.h - zend_reflection_api.c: - Simplify abstract method declaration - - * zend_object_handlers.h: - WS - -2003-08-15 Sascha Schumann - - * zend_execute.c - zend_object_handlers.c: - Restrict scope of inline functions to compile unit - - Submitted by: Jason Greene - -2003-08-13 Marcus Boerger - - * zend_objects_API.c: - Add missing entry - - * zend_API.c: - - Show classes in case of methods - - Using sprintf here was a bad idea - -2003-08-12 Zeev Suraski - - * zend_hash.c: - Remove bogus patch - the number of elements is unrelated - -2003-08-12 Zeev Suraski - - * zend_hash.c: - Remove bogus patch - the number of elements is unrelated - -2003-08-12 Zeev Suraski - - * zend_hash.c: - Remove bogus patch - the number of elements is unrelated - -2003-08-12 Zeev Suraski - - * zend_hash.c: - Remove bogus patch - the number of elements is unrelated - -2003-08-12 Zeev Suraski - - * zend_hash.c: - Remove bogus patch - the number of elements is unrelated - -2003-08-11 Marcus Boerger - - * zend_hash.c - zend_hash.h: - Bugfix 21918 - -2003-08-11 Masaki Fujimoto - - * Zend.m4 - flex.skl - zend_compile.c - zend_globals.h - zend_highlight.c - zend_language_scanner.h - zend_language_scanner.l - zend_multibyte.c - zend_multibyte.h: - - added script encoding support to Zend Engine 2. - this enables ZE2 to gracefully parse scripts written in UTF-8 (with - BOM), - UTF-16, UTF-32, Shift_JIS, ISO-2022-JP etc... (when configured with - '--enable-zend-multibyte' and '--enable-mbstring') - -2003-08-10 Marcus Boerger - - * zend_compile.c: - Bugfix #24637 __destruct not called - -2003-08-09 Moriyoshi Koizumi - - * zend_compile.c: - Fix segfault when a referenced parameter is specified with typehint. - Result of the node will never be used because verify_instanceof handler - has - been eliminated. - -2003-08-09 Marcus Boerger - - * zend_objects.c: - Precise destructor errors - -2003-08-07 Moriyoshi Koizumi - - * tests/bug21478.phpt: - Add missing right parensis - -2003-08-07 Zeev Suraski - - * zend_execute_API.c: - Clarify use of original_function_state_ptr - -2003-08-07 Marcus Boerger - - * zend_execute_API.c: - - Fix warnings - - Fix code - -2003-08-06 Zeev Suraski - - * zend_execute_API.c: - clarify :) - -2003-08-05 Jani Taskinen - - * zend_execute_API.c: - Fix the build - -2003-08-05 Zeev Suraski - - * zend_API.h - zend_execute_API.c - zend_reflection_api.c: - Try to put an end to the endless number of call_user_function variants. - zend_call_function() now takes a structure that should contain all of the - necessary information. If further information is necessary in the future, - then we'll be able to add it without having to introduce a new function. - - As for caching - the 2nd, optional argument is a struct that can hold all - of the information that's necessary to invoke the function, including its - handler, scope and object it operates on (if any). Note that you may only - use a cache if the arguments you provide to zend_call_function() are - identical to the ones of the last call, except for the argument and return - value information. - - - The recently introduced fast_call_user_function() was removed - - I fixed most of the places that used fast_call_user_function() to use - caching - but there are still some that need to be fixed (XML and reflection) - -2003-08-05 Stanislav Malyshev - - * tests/bug24699.phpt: - fix syntax - - * zend_execute_API.c: - remove stack clean - it makes trouble - -2003-08-04 Marcus Boerger - - * zend_execute.c: - Fix ZTS - - * zend_execute_API.c: - Nuke unused variables - - * zend_reflection_api.c: - Add function/method parameter reflection - -2003-08-04 Ilia Alshanetsky - - * zend_execute_API.c - tests/bug23104.phpt: - Fixed bug #23104 (hash position of static arrays not being reset) - -2003-08-04 Stanislav Malyshev - - * zend_execute_API.c: - oops. forgot function - - * zend_execute_API.c: - fix crash #24842 - - * zend_compile.c: - fix leaks: bug #24831 - - * zend_execute.c: - use get_obj_zval_ptr - - * tests/bug24884.phpt: - add test - - * zend_execute.c: - Fix #24884 - clone $this - -2003-08-04 Zeev Suraski - - * zend_compile.c: - Simplify code using XOR - - * zend.h: - Add logical XOR, proves to be quite useful lately - - * zend_opcode.c: - This check shouldn't be necessary - -2003-08-03 Marcus Boerger - - * zend_opcode.c: - Fix crash - - * zend_compile.c: - Fix test and add missing initialization - -2003-08-03 Zeev Suraski - - * zend_API.c: - Ensure functions have a valid access level - - * zend_API.c: - Default to public - -2003-08-03 Marcus Boerger - - * zend_API.c: - Not needed, will be copied from ptr->flags later - - * zend_builtin_functions.c: - Add missing arg info - -2003-08-03 Moriyoshi Koizumi - - * tests/bug24635.phpt - tests/bug24699.phpt: - Style & WS fixes - -2003-08-03 Zeev Suraski - - * (BEFORE_ARG_INFO) - zend_API.c: - No need for this initialization - this function initializes all of the - elements of zend_internal_function - - * (BEFORE_ARG_INFO) - zend_execute.c: - Clean up. extended_value can only contain either ZEND_UNSET_DIM or - ZEND_UNSET_OBJ. - - * (BEFORE_ARG_INFO) - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c: - Generalize fetch_class - -2003-08-02 Marcus Boerger - - * zend_API.c: - Initialize all struct members: Necessary for reflection - - * zend_reflection_api.c: - Show interfaces - -2003-08-02 Wez Furlong - - * zend_API.c: - fix usage of instanceof here too - -2003-08-02 Marcus Boerger - - * zend_execute.c: - Fix warning - -2003-08-01 Wez Furlong - - * zend_API.c: - better fix... - - * zend_API.c: - Fix "O" format for zend_parse_parameters - -2003-07-31 Zeev Suraski - - * zend_API.c: - Use instanceof_function() - - * zend_compile.c - zend_execute.c: - Finish the array overloading patch - - * zend_execute.c: - Cleanup - -2003-07-31 Andi Gutmans - - * zend_hash.c: - - Fix logic. It was the wrong way around. - -2003-07-30 Andi Gutmans - - * zend_execute.c - zend_hash.c: - - Fix problem with hash when updating same bucket with data of different - sizes one after another. - - Fix number of arguments to read_dimension. - -2003-07-30 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_execute.c: - Get rid of an opcode - - * zend_compile.c - zend_execute.c: - Support overloading of $foo["bar"] += "baz" - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_object_handlers.c - zend_object_handlers.h: - Improve array overloading - support unset($foo["bar"]) - - * zend_compile.h: - Remove garbage - - * zend.c - zend.h - zend_API.c - zend_API.h - zend_compile.h - zend_modules.h: - Add exec_finished() callback for modules - this is the last place where the - modules may touch the symbol table reliably - -2003-07-29 Ilia Alshanetsky - - * tests/bug22836.phpt: - Test case for bug #22836. - -2003-07-29 Jani Taskinen - - * zend.c: - Remove the obfuscation caused by the double "#ifdef ZTS" - -2003-07-27 Stanislav Malyshev - - * zend_compile.c: - fix compare - - * zend_compile.c: - use zend_binary_strncasecmp - - * zend_execute_API.c: - change shutdown order so that dtors would coexist with object error - handlers - - * zend_execute.c: - clean the right one - - * zend_execute_API.c: - make shutdown more granular so in case some dtor goes ape we still - can shut down cleanly - - * zend_compile.c - zend_execute.c - zend_objects.c: - make clone and throw coexist peacefully - - * tests/bug24635.phpt - tests/bug24699.phpt: - add test - - * zend_execute.c: - fix #24635: clean hash before putting into cache - - * zend_language_scanner.l: - fix crash #24550 - - * zend_compile.c - zend_constants.c: - fix leaks with class constants (bug #24699) - - * zend_compile.c: - make __clone call case insensitive, just as other calls are - -2003-07-24 Jani Taskinen - - * tests/bug19859.phpt - tests/bug20240.phpt - tests/bug20242.phpt - tests/bug21478.phpt - tests/bug21888.phpt - tests/bug22725.phpt - tests/bug24436.phpt: - cleanup (CS+ws) - -2003-07-24 Zeev Suraski - - * tests/bug24436.phpt: - Fix expectations :) - - * zend_execute.c: - Fix logic and comments in ASSIGN_DIM - - * zend_compile.c: - Fix another HANDLE_NUMERIC bug. Looks like you opened Pandora's box, - Sterling ;) - - * zend_builtin_functions.c: - Fix each() binary safety for keys - - * zend_execute.c: - Fix assignments to numeric array indices - - * zend_compile.c: - Remove useless code - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - Support references in foreach() - Syntax: - foreach ($arr as &$val) - foreach ($arr as $key => &$val) - - * zend_execute.c: - Fix binary safety in foreach() keys (fixes bug #24783) - - * zend.c: - Make print_r() binary safe with keys - -2003-07-23 Stanislav Malyshev - - * zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_opcode.c: - Remove namespace leftovers - -2003-07-23 Zeev Suraski - - * zend_hash.c - zend_hash.h: - Go back to ZE1-like code - -2003-07-23 Sebastian Bergmann - - * zend_reflection_api.c: - Fix segfault. Patch by Timm Friebe . - -2003-07-22 Marcus Boerger - - * zend_hash.h: - Fix for the moment - -2003-07-22 Zeev Suraski - - * zend_execute.c - zend_hash.c - zend_hash.h - zend_operators.c - zend_operators.h: - Improve infrastructure of numeric handling of elements in symbol tables. - - When you want to work with a symbol table, and you don't know whether you - have a numeric ("string that looks like a number") or a string element in - your hands, use zend_symtable_*() functions, in place of zend_hash_*() - functions. - - * zend_execute.c - zend_object_handlers.c - zend_object_handlers.h - zend_objects_API.c: - Fix isset()/empty() for non-trivial object elements - (API change - read_property now accepts an extra element) - Fixes bug #24436 - -2003-07-21 Zeev Suraski - - * zend_object_handlers.c: - Fix bug #24499 - - * zend_execute.c: - Revert fix for #24729, and refix - -2003-07-21 Marcus Boerger - - * zend_execute.c: - Go with a better fix for #24729 - -2003-07-21 George Schlossnagle - - * zend_API.h: - reverted at Andi's request. replaced with more generic wrapper. - -2003-07-20 Marcus Boerger - - * zend_execute.c: - Bugfix #24729 = new ; causes crash when is not set - -2003-07-20 George Schlossnagle - - * zend_reflection_api.c: - should nt here - -2003-07-20 Marcus Boerger - - * zend_reflection_api.c: - Fix warnings and whitespace in output - - * zend_reflection_api.c: - Add support for instances in Reflection_Class. - -2003-07-20 George Schlossnagle - - * zend_reflection_api.c: - removed references to smart_str, replaced with private string management - function. When snprintf is integrated into the engine, string_printf - should be altered to use that. - -2003-07-20 Marcus Boerger - - * zend_objects_API.c: - More informative errors here and these are real core errors - - * zend_execute.c: - Fix uncloneable objetcs - -2003-07-20 George Schlossnagle - - * zend_reflection_api.c: - more of Timm's implementation. - -2003-07-20 Marcus Boerger - - * zend_hash.c - zend_hash.h: - Make it a macro - -2003-07-19 Marcus Boerger - - * zend_hash.c: - This is meant to be used in for(;has_more;next) - - * zend_hash.c - zend_hash.h: - Add missing function to ease implementations - -2003-07-19 Jani Taskinen - - * zend.h: - Fix the HPUX alloca fix as suggested by Sascha - -2003-07-19 Marcus Boerger - - * zend_objects.c - zend_objects.h: - Shuffle code to ease writing clone handlers - -2003-07-19 Andi Gutmans - - * zend.h: - - Don't use alloca on HP-UX (Moriyoshi Koizumi ) - -2003-07-16 Zeev Suraski - - * zend_compile.c: - Fix bug in the verification of interface-function implementation - - * zend_compile.c - zend_compile.h - zend_execute.c: - More cleanup for assign-op handling of objects - - * zend_alloc.c: - Fix warning - -2003-07-12 Andi Gutmans - - * zend_API.c: - - WS - -2003-07-11 Andi Gutmans - - * zend_API.c: - - Add support for Z in zend_parse_parameters(). It will allow the extension - - to retreive the zval **, thus allowing it to use the convert_to_*_ex() - - family of functions to do type conversions without effecting the value - in - - the engine itself. (Josh Fuhs ) - -2003-07-08 Zeev Suraski - - * zend_execute.c: - initial refactoring for assign-op handling of objects - -2003-07-07 Zeev Suraski - - * zend_API.c - zend_API.h - zend_compile.c - zend_compile.h: - Rework zend_do_declare_property and related code into one code base - - * zend_API.c: - Fix bug - - * zend_execute.c - zend_object_handlers.c - zend_object_handlers.h - zend_objects_API.c: - Add get_dim callback - - * zend_execute.c: - Fix naming convention - -2003-07-07 Derick Rethans - - * zend_execute.c: - - Help Zeev fixing ghosts :) - -2003-07-07 Zeev Suraski - - * zend_object_handlers.c - zend_object_handlers.h: - whitespace - - * zend_objects_API.c: - Fix & whitespace - - * zend_object_handlers.c: - fixlet - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_object_handlers.c - zend_object_handlers.h: - Initial support for overloading of array syntax for objects (very initial) - -2003-07-06 George Schlossnagle - - * zend_API.c - zend_API.h: - add convenience functions or adding class properties. Ok'd for commit by - Andi. - -2003-07-04 Andi Gutmans - - * zend_alloc.c - zend_mm.c - zend_mm.h: - - Add heap to memory manager. This should improve performance. - - Enabling it by default so that it gets tested. We should decide before - beta 2 if we want to revert back to malloc or not. - - Thanks to Sebastian for benchmarking it - -2003-07-04 Sebastian Bergmann - - * zend_reflection_api.c: - 2 * TSRMLS_FETCH() -> 1 * TSRMLS_DC - -2003-07-04 George Schlossnagle - - * zend_reflection_api.c: - ws fix - -2003-07-03 Marcus Boerger - - * zend_compile.c: - Allow final private methods - -2003-07-03 George Schlossnagle - - * zend_reflection_api.c: - win build fixes (Rob Richards) - - * zend_reflection_api.c: - can't forget Andrei - -2003-07-03 Stanislav Malyshev - - * zend_compile.c - zend_execute.c: - enable Classname() constructor to be called via parent::__constructor() - - * tests/bug19859.phpt: - add test for Bug #19859 - - * zend_API.c - zend_execute_API.c: - Fix bug #19859 - allow fast_call_user_function to support __call - - * zend_builtin_functions.c: - fix the get_parent_class fix - -2003-07-03 George Schlossnagle - - * zend_reflection_api.c: - more of Timm's patches, and mod authors line to give credit where credit is - due. - -2003-07-02 Marcus Boerger - - * zend_objects.c: - Temporairy solution to overcome shutdown propbelms with objects that have - hidden destructors. - - * zend_objects.c: - Reorganize this a bit to ensure the object memory is destructed before - showing the error. - - * zend_builtin_functions.c: - Bug #24399: is_subclass_of(): fix memleak, too - -2003-07-02 Zeev Suraski - - * zend_execute.c: - Throughly fix scoping change. Fixes, among other things, bug #24403 - -2003-07-02 Andi Gutmans - - * zend_compile.c - zend_globals.h: - - Nuke CG(in_clone_method) - -2003-07-02 Zeev Suraski - - * zend_execute.c: - Fix for bug #22367. - Heads up - this will break syntactical compatiblity, return($foo) will - not work with functions that return references - return $foo should be - used - instead. It never worked well before, and caused all sorts of odd bugs. - It *might* be possible to support this specifically, albeit unlikely - -2003-07-02 Sterling Hughes - - * zend_execute_API.c: - optimize the case where the object is really a class name, as we don't need - to set EX(object) here. - - * zend_execute_API.c: - Timm Friebe points out that object detection should be done regardless of - the function pointer - -2003-07-02 Marcus Boerger - - * zend_objects.c: - Finally fix property cloning and fix the tests accordingly. - - -2003-07-02 Sterling Hughes - - * zend_builtin_functions.c: - Fix bug #24445 - -2003-07-01 Marcus Boerger - - * zend_objects.c: - Fix __clone(). - - - * tests/bug20240.phpt: - Use both destructor and shutdown - - * zend_execute_API.c: - small bugfix - - * tests/bug24436.php - tests/bug24436.phpt: - Rename test to correct extension - - * zend_execute.c: - __clone might not be defined - - * zend_execute.c: - Fix __clone visibility - - * zend_object_handlers.c - zend_object_handlers.h - zend_objects.c: - Fix destructor visibility - -2003-07-01 Derick Rethans - - * tests/bug24436.php: - - Added test for bug #24436 - -2003-07-01 George Schlossnagle - - * zend_reflection_api.c: - Timm Friebe's patches for code celanup and additional functions. - -2003-07-01 Jani Taskinen - - * tests/.cvsignore - tests/bug21478.phpt - tests/zend2.php - tests/zend2.php.txt: - Missing .cvsignore, broken test, renamed zend2.php -> zend2.php.txt - -2003-07-01 Sebastian Bergmann - - * zend_reflection_api.c: - ZTS fixes. - -2003-07-01 George Schlossnagle - - * zend_reflection_api.c: - more incremental changes. add anything that needs a class factory. - - * zend_reflection_api.c: - all the easy parts of Reflection_Class - -2003-06-30 Shane Caraveo - - * zend_operators.h: - this fixes including this header in a c++ file (vs6) - -2003-06-30 Sterling Hughes - - * zend_compile.c: - nuke "main" as a reserved keyword - -2003-06-30 Andi Gutmans - - * zend.c - zend_API.c - zend_compile.c - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_mm.c - zend_opcode.c - zend_reflection_api.c: - - ZE coding style requires if ( instead of if( - -2003-06-30 Sebastian Bergmann - - * zend_reflection_api.c: - ZTS fixes. Remove unused local variables. - -2003-06-30 George Schlossnagle - - * Makefile.am - Zend.dsp - ZendTS.dsp - zend_default_classes.c - zend_reflection_api.c - zend_reflection_api.h: - added support for Reflection_Function, the first part of - the reflection api - -2003-06-30 Sterling Hughes - - * zend_builtin_functions.c: - move the check down a little so it catches all cases - - * zend_builtin_functions.c: - Fix bug #24399 from an excellent test case by edin - -2003-06-30 Zeev Suraski - - * zend_execute.c: - Semantically it's a refcount increase, not a lock... - - * zend_execute.c: - Fix 'global' implementation (fixes, at least, bug #24396 - -2003-06-30 Sterling Hughes - - * zend_operators.c: - revert back the optimization for now. - -2003-06-29 Ilia Alshanetsky - - * zend_object_handlers.c: - Fixed bug #24279 (__get() crash when no value is returned) - -2003-06-29 Sebastian Bergmann - - * ZEND_CHANGES: - Remove namespace references. - -2003-06-29 Sterling Hughes - - * zend_operators.c: - Very simple, but very effective optimization. Provides a signifigant speed - improvement to matches done via '=='. This checks that the lengths of two - strings are equal before performing a memcmp() on them. - -2003-06-23 Zeev Suraski - - * zend_execute.c: - Fix crash :) - -2003-06-23 Stanislav Malyshev - - * zend_execute.c: - FIx leak - -2003-06-22 Zeev Suraski - - * zend_execute.c - zend_language_parser.y: - Fix complex expressions for class names in NEW - - * zend_language_parser.y: - Simplify - -2003-06-21 Marcus Boerger - - * zend_language_parser.y: - WS - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Add final classes - -2003-06-16 Stanislav Malyshev - - * zend_execute.c: - no need to init zval - assignment will init - - * zend_execute.c: - Fix bug #22592 - cascading assignments to string offsets - - * zend_constants.c: - support for self:: and parent:: constants - - * zend_builtin_functions.c: - fix lambda function static vars (related to #17115) - -2003-06-15 Sebastian Bergmann - - * zend_constants.c: - Fix ZTS build. - -2003-06-15 Stanislav Malyshev - - * zend.c: - Fix bug #23279 - exception handler exits after first function call - - * zend_execute_API.c: - No need to duplicate code - zend_get_constant() knows to - handle class constants now - - * zend_execute_API.c: - Fix bug #18872 - Improper handling of class constants used as default - function argument values - - * zend_constants.c: - set ending \0 for string - - * zend_compile.c - zend_constants.c - zend_language_parser.y: - Fix bug #23384 - static class::constant constants should now - work in static & array expressions. - - * zend_execute_API.c: - Fix bug #21800 - initialize opcode handlers in interactive mode - -2003-06-14 Marcus Boerger - - * zend_hash.c: - ecalloc doesn't return NULL - - * zend.c: - Bugfix #24182: va_arg macro error in Zend/zend.c - -2003-06-10 Jani Taskinen - - * zend_multiply.h: - - Missing $Id$ tag - -2003-06-10 James Cox - - * acconfig.h - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.nw.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_default_classes.c - zend_default_classes.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_execute_locks.h - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_ini.c - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l - zend_istdiostream.h - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_mm.c - zend_mm.h - zend_modules.h - zend_multiply.h - zend_object_handlers.c - zend_object_handlers.h - zend_objects.c - zend_objects.h - zend_objects_API.c - zend_objects_API.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_qsort.c - zend_qsort.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_static_allocator.c - zend_static_allocator.h - zend_stream.c - zend_stream.h - zend_ts_hash.c - zend_ts_hash.h - zend_types.h - zend_variables.c - zend_variables.h: - updating license information in the headers. - -2003-06-09 Wez Furlong - - * zend_execute_API.c: - Fix for Bug #23951 - -2003-06-09 Stanislav Malyshev - - * zend_execute.c: - remove NS leftover - -2003-06-09 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Fix bogus implicit declarations of properties (squash bug #23671) - -2003-06-09 Stanislav Malyshev - - * zend_API.c - zend_execute_API.c: - Support 'self' and 'parent' in call_user_func() - -2003-06-09 Zeev Suraski - - * zend_execute.c: - Fix indirect reference calls to bogus function names - -2003-06-09 Jani Taskinen - - * zend_builtin_functions.c: - ws - -2003-06-08 Zeev Suraski - - * zend_object_handlers.c: - Fix casing issues in access level checks - - * zend.c - zend_compile.c - zend_compile.h: - Nicer handling of protected/private members in print_r() - - * zend_execute.c: - Fix handling of object property assignments in switch expressions - (bug #23925) - - * zend_builtin_functions.c: - Fix set_error_handler() - -2003-06-06 Sascha Schumann - - * zend_multiply.h: - mfb #24025 fix - -2003-06-04 Stanislav Malyshev - - * zend.c: - fix non-ZTS build - -2003-06-04 Sebastian Bergmann - - * zend.c: - Fix segfault. Again. - -2003-06-04 Stanislav Malyshev - - * zend.c - zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_object_handlers.c: - rm namespace leftovers - -2003-06-04 Sebastian Bergmann - - * zend.c: - Fix segfault. #Hopefully not a Voodoo Fix[TM]. - -2003-06-02 Sebastian Bergmann - - * zend.c - zend_execute.h: - Leftover. - -2003-06-02 Stanislav Malyshev - - * zend.c - zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_constants.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l - zend_object_handlers.c - zend_opcode.c: - MEGA-patch: namespaces are R.I.P. - -2003-06-01 Marcus Boerger - - * tests/zend2.php: - No nested classes - - * tests/bug20240.phpt - tests/bug20242.phpt - tests/bug21478.phpt - tests/bug21888.phpt - tests/bug22725.phpt: - Add some ZE2 bug tests - - * zend_opcode.c: - Bugfix #23670: implements and extends cause Apache 2 crash - - * zend_constants.c: - Do it correct always - - * zend_compile.h: - Defining it once is enough - -2003-05-31 Marcus Boerger - - * zend.c: - Fix init shutdown - -2003-05-31 Sterling Hughes - - * zend_compile.c - zend_execute.c: - revert the function call caching patch until a new solution is decided - upon. - -2003-05-31 Marcus Boerger - - * zend_constants.c: - Fix constants (noticed by David Brown ) - - * zend_constants.c: - c->name_len already contains the '\0' - -2003-05-30 Stanislav Malyshev - - * zend_execute.c: - fix crash on exceptions when return value of the inside function is used - -2003-05-29 Marcus Boerger - - * zend_compile.c - zend_language_parser.y: - Fix ~ operator in class constants. - - * zend_compile.c - zend_compile.h - zend_operators.c: - Faster interface inheritance & faster inheritance checks - - * zend_language_scanner.l: - CS - -2003-05-29 Wez Furlong - - * zend_compile.c: - Fix Bug #23285 (Potential Stack Overflow in zendlex). - -2003-05-28 Sterling Hughes - - * zend_alloc.c: - no reason to do this at runtime - - * zend_compile.c - zend_execute.c: - Cache function call lookups with loops (store in a temporary variable on - the - result opline). - Assuming lazy concensus on message that GeorgeS sent to the list last week - -2003-05-27 Sterling Hughes - - * zend.c - zend_object_handlers.c - zend_object_handlers.h - zend_operators.c: - Assume lazy consensus regarding the cast_object() patch. *Only* - implemented - from a internals perspective. This callback has been very useful for both - ext/mono and ext/simplexml - -2003-05-26 Marcus Boerger - - * zend_language_scanner.l: - Add pseudo constant __METHOD__ to easily report namespace::class::method. - - -2003-05-23 Marcus Boerger - - * zend_API.h: - Revert to sizeof() - -2003-05-23 Sterling Hughes - - * zend_execute.c - zend_hash.c - zend_operators.c - zend_operators.h: - move HANDLE_NUMERIC() from the hash table implementation upstream to the - places that actually need to use it. - -2003-05-22 Marcus Boerger - - * zend_execute.c: - No need to copy here unless implicit_clone is active (noticed by rob) - -2003-05-21 Marcus Boerger - - * zend_API.c - zend_builtin_functions.c - zend_constants.c - zend_object_handlers.c: - Make use optimized string lowering - - * zend_operators.c - zend_operators.h: - Use same parameter order as strcpy() - - * zend_API.c - zend_execute.c - zend_execute_API.c - zend_operators.c - zend_operators.h: - Make zend_str_tolower_copy() a copy function (like stccpy). - Supply a dup version (like estrdup). - Fix tolower() handling. - -2003-05-21 Jani Taskinen - - * zend_builtin_functions.c: - Fixed bug #23619 (set_error_handler() registered handler not called for - object instances). (Jani, waboring@qualys.com) - -2003-05-21 Sterling Hughes - - * zend_operators.c: - optimize loops. The check only exists for integers because that's the more - common optimization, and you actually lose performance if you check for - a double too (wierd but true). - - * zend_mm.h: - add some logic to detect zend_mm, which is really only useful when thread - safety support is enabled. - - * zend_mm.h: - leave this off until its more ready/stable - php5 actually beats php4.3.* in my benchmarks now - - - * zend_API.c: - use zend_str_tolower_copy() - - * zend_execute.c: - Bottom drawer optimization to avoid this comparison, but this OP is - executed - quite often (all of the fetch_* ops) - -2003-05-20 Sterling Hughes - - * zend_operators.c: - bah humbug, use the pointer based version, which turns out to be an - instruction - faster - - * zend_operators.c: - use pointer arithmetic for the normal zend_str_tolower() - -2003-05-20 Marcus Boerger - - * zend_execute.c: - No need to copy the zval unless __clone() is called - -2003-05-20 Sterling Hughes - - * zend_operators.c: - make this faster and sexier - - * zend_execute.c: - use the new zend_str_tolower_copy() function - - * zend_operators.c: - doesn't need to be register - - * zend_execute_API.c - zend_operators.c - zend_operators.h: - optimize the lookups by avoiding a copy and then another pass - - Naked Dancing Girls should be given to: Myself, Zeev, Marcus, - and George Schlossnagle (in no particular order) - - * zend_API.h - zend_execute_API.c: - add fast_call_user_function() - -2003-05-20 Hartmut Holzgraefe - - * zend_API.h - zend_constants.h - zend_operators.h: - C++ compile fixes - -2003-05-19 Marcus Boerger - - * zend_execute.c: - Fix exception memleak - -2003-05-19 Stanislav Malyshev - - * zend_compile.c - zend_execute.c: - fix __clone - -2003-05-12 Marcus Boerger - - * zend_execute_API.c: - One function call is enough - -2003-05-08 Marcus Boerger - - * zend_compile.c: - Inheritance fix - -2003-05-07 Edin Kadribasic - - * zend_compile.c: - Reverting Marcus' incomplete patch which broke the build. - -2003-05-07 Marcus Boerger - - * zend_compile.c: - Inheritance fixes - -2003-05-04 Marcus Boerger - - * zend_API.c: - Fix namespace issue: Only CG is needed here - - * zend_API.c - zend_API.h: - Allow functions in internal namespaces (for example factories) - - * zend_execute.c: - Modify the abstract error message so that it shows up to three methods not - implemented. - - * zend_execute.c: - Fix warnings - - * zend_compile.c: - Don't inherit twice what is needed only once - - * zend.c: - Fix bug #23162 user_error() crashs if > 1024 bytes (Marcus, Moriyoshi) - -2003-05-04 Sterling Hughes - - * zend_default_classes.h: - semicolon - -2003-05-03 Sterling Hughes - - * zend_default_classes.h: - proto - - * zend_default_classes.c: - add an accessor for the default exception - -2003-04-29 Sascha Schumann - - * zend_multiply.h: - Fix the *= operator - - Slightly modified patch by Wez Furlong - -2003-04-25 Jani Taskinen - - * zend_language_scanner.l: - Fixed bug #21820 ("$arr[foo]" generates bogus E_NOTICE, should be E_PARSE) - -2003-04-24 Sascha Schumann - - * zend_alloc.c - zend_alloc.h - zend_multiply.h: - add safe_emalloc - -2003-04-21 Stanislav Malyshev - - * zend.c - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_object_handlers.c: - Change get_class() so that it returns qualified names for namespaced - classes. - - *HEADS UP*: get_class_name() handler interface is changed, now it should - allocate the space it returns with emalloc, and the users free it. If - anyone has problems with it or has suggestions how to do it without this - - please tell. - - Also: make function_exists() understand namespaces. - - * zend_execute.c: - make import * fail if such classes or functions already there - -2003-04-20 Sterling Hughes - - * zend_compile.c: - Add check for final properties - -2003-04-20 Stanislav Malyshev - - * zend_execute_API.c: - Check name before '::' so that it would be a namespace in - zend_lookup_ns_class - - * zend_builtin_functions.c: - refine the set_error_handler fix - - * zend_builtin_functions.c: - Fix for bug #21094 (set_error_handler can not accept methods), - by Timm Friebe - -2003-04-19 Sebastian Bergmann - - * zend.c: - Corrected patch by Marcus Börger . - -2003-04-18 Sterling Hughes - - * zend.c - zend_opcode.c: - Patch by Marcus Börger to fix some memleaks - -2003-04-18 Derick Rethans - - * zend.h - zend_extensions.c: - - Revert my symbol fix patch, and merge in Stas' fixes to Zend Engine 1. - - * zend.h: - - MacOSX also prepends the _ before symbols in bundles - -2003-04-17 Sebastian Bergmann - - * zend.c: - Patch by Marcus Börger . - -2003-04-11 Sebastian Bergmann - - * zend_compile.c - zend_compile.h: - Fix warnings. - -2003-04-10 Sterling Hughes - - * zend_compile.c: - satisfy andi's switch fetish ;-) - -2003-04-10 Sebastian Bergmann - - * zend_compile.c: - Fix ZTS build. Fix warning. - - * ZEND_CHANGES: - Document 'const' keyword. - -2003-04-10 Sterling Hughes - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - allow expressions within constants, so the following is possible - - class foo { - const a = 1<<0; - const b = 1<<1; - const c = a | b; - } - - this makes const a compile-time expression. all other operators are - unaffected. - -2003-04-10 Zeev Suraski - - * zend_language_parser.y - zend_language_scanner.l: - Revert Harald's commit - -2003-04-10 George Schlossnagle - - * zend_language_parser.y: - One line fix so that it will compile - -2003-04-09 Harald Radi - - * zend_language_parser.y - zend_language_scanner.l: - removing the *syntactical sugar* again - - -2003-04-08 Andrei Zmievski - - * zend_builtin_functions.c: - Switch some functions to use new zend_lookup_ns_class() methods. This - means that they will accept both simple and fully qualified class names. - - * zend_API.c - zend_API.h: - Rename zend_register_internal_class_in_ns() to a better, less filling, - but with the same great taste zend_register_internal_ns_class(). - - * zend_execute.h - zend_execute_API.c: - Add zend_lookup_ns_class() function. - - * zend_operators.h: - Move memnstr into Zend and make an alias for BC in PHP. - -2003-04-07 Jani Taskinen - - * zend_language_scanner.l: - Fixed bug #23093 (highlight_string() crashed with __FUNCTION__) - -2003-04-07 Sterling Hughes - - * zend_compile.h: - add markers that make this file easy to parse for external sources - -2003-04-04 Andrei Zmievski - - * zend_API.h: - Introduce ZEND_ME() and ZEND_METHOD() macros. Use these for declaring - class methods to avoid name collisions. - -2003-04-04 Stanislav Malyshev - - * zend_API.c - zend_API.h: - Fix namespace issues - -2003-04-03 Andrei Zmievski - - * zend_API.c: - Patch from Timm Friede for when EG(active_namespace) is NULL initially. - - * zend.c - zend_API.c - zend_compile.c: - Initialize all relevant zend_class_entry fields to avoid accidental - crashes. - -2003-04-03 Sebastian Bergmann - - * zend_list.c: - Leftover. - -2003-04-03 Sterling Hughes - - * zend_list.c - zend_list.h: - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - -2003-04-02 Andrei Zmievski - - * zend_API.c - zend_API.h: - - Add zend_register_internal_namespace() API function. - - Add zend_register_internal_class_in_ns() API function. - - * zend_compile.h: - Simplify. - -2003-04-02 Derick Rethans - - * zend_list.c: - - Fix whitespace - -2003-04-02 Sterling Hughes - - * zend_list.c - zend_list.h: - add the ability for curl_multi_info to introspect the handles. - - -2003-04-02 Andrei Zmievski - - * zend_compile.c - zend_compile.h - zend_globals.h - zend_language_parser.y - zend_language_scanner.l: - Implement a different way to catch documentation comments. - - * zend_compile.c - zend_compile.h - zend_highlight.c - zend_language_parser.y - zend_language_scanner.l: - Revert portions of the doc comment patch. There should be no parser - errors now. - -2003-04-02 Stanislav Malyshev - - * zend_builtin_functions.c - zend_compile.h - zend_execute.c: - allow class_exists() to work with namespaces too. - add CLASS_IS_NAMESPACE macro - - * zend_builtin_functions.c: - fix typo - - * zend_builtin_functions.c: - fix parameterless get_declared_classes call - -2003-04-01 Andrei Zmievski - - * zend_execute.c: - Stas's patch on zend_execute.c (1.448 -> 1.449) resulted in a bug where - the namespaced member accesses didn't work. This should hopefully - correct it. - - * zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_object_handlers.c - zend_opcode.c: - Split ZEND_NAMESPACE into user and internal namespaces. Hope this is - okay with engine folks. - -2003-04-01 Stanislav Malyshev - - * zend_builtin_functions.c: - improve namespace name hanfling - - * zend_builtin_functions.c: - fix get_declared_classes() - - * zend_language_parser.y - zend_language_scanner.l: - Add __NAMESPACE__ auto-constant. - - * zend_builtin_functions.c: - make get_declared_classes() work with namespaces (based on Tal Peer's - patch) - -2003-03-31 Andrei Zmievski - - * zend.h - zend_compile.c - zend_compile.h - zend_globals.h - zend_language_parser.y - zend_language_scanner.l - zend_opcode.c: - Multi-purpose patch: - - The fields of zend_namespace were not completely initialized which - led to a variety of problems. - - The occurrence of class/interface/namespace definition is now - captured. - - Functions/classes/interfaces/namespaces can be preceded by doc - comments which are stored for use by extensions. - -2003-03-31 Stanislav Malyshev - - * zend.c: - Use strncpy instead of sprintf - -2003-03-30 Andrei Zmievski - - * zend_language_parser.y: - Since zend_do_begin_class_member_function_call assumes the previous - opcode is FETCH_CONSTANT, swap the calls around. - -2003-03-30 Sebastian Bergmann - - * zend_execute.c: - ZTS fix. - -2003-03-30 Stanislav Malyshev - - * zend.c: - Try to report class name of the exception - - * zend_execute.c: - Fix namespace switch - -2003-03-29 Zeev Suraski - - * zend_compile.c: - Add missing initialization - - * zend_compile.c: - Fix crash - - * zend_API.c - zend_compile.c - zend_compile.h: - Initial support for enforcing prototype of abstract/interface method - implementations - -2003-03-29 Sterling Hughes - - * zend.c: - remove unused variable - -2003-03-27 Stanislav Malyshev - - * zend_execute.c: - fix fetch_class buglet - -2003-03-26 Stanislav Malyshev - - * zend_execute.c - zend_language_parser.y: - Un-nest namespaces - now namespace X { namespace Y {} } is a parse error - Also refine namespaced includes - -2003-03-26 Ilia Alshanetsky - - * zend_compile.c: - Fixed bug #22900 (declaration of namespaces with same name results in - leaks). - -2003-03-26 Sebastian Bergmann - - * zend.c - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_opcode.c - zend_operators.h: - Eliminate TSRMLS_FETCH() calls in destroy_op_array() and - zend_get_class_entry(). - - * zend_API.c - zend_object_handlers.c - zend_objects.c - zend_objects.h: - Eliminate TSRMLS_FETCH() calls in zend_objects_new() and - zend_objects_get_address(). - -2003-03-25 Andi Gutmans - - * zend_compile.c: - - Temporarily fix problem with inheriting from an internal class. This - might - - need some rework in the future (thanks to Marcus) - -2003-03-24 Stanislav Malyshev - - * zend_execute.c: - Fix {include|require}_once error message - if open - fails, don't use tream, use original name. - -2003-03-23 Andi Gutmans - - * zend.c: - - Fix win32 build - -2003-03-23 Stanislav Malyshev - - * zend.c: - resore namespace on shutdown - since some functions use - EG() and CG() pointers - -2003-03-23 Sebastian Bergmann - - * zend_default_classes.c: - ZTS fix. - -2003-03-23 Zeev Suraski - - * zend_compile.c: - Another fix for implicit public, perhaps it was not such a good idea :I - -2003-03-23 Sebastian Bergmann - - * Zend.dsp - ZendTS.dsp - zend_default_classes.c: - Add new files to ZendTS.dsp. Sync list of files in Zend.dsp with - ZendTS.dsp. ZTS fixes. - -2003-03-23 Sterling Hughes - - * zend_default_classes.h: - DEFAULT_CLASSES_H not DEFAULT_INTERFACES_H - - * Makefile.am - zend.c - zend_default_classes.c - zend_default_classes.h: - add a standard Exception class. - -2003-03-22 Shane Caraveo - - * zend_compile.h: - export functions needed by cli - - * zend_language_scanner.l: - fix crash in win32 debug build - -2003-03-20 Stanislav Malyshev - - * Zend.m4: - Add stdlib.h too - it is needed fot strto{ld} - -2003-03-19 Andrei Zmievski - - * zend_compile.c - zend_compile.h - zend_globals.h - zend_highlight.c - zend_language_parser.y - zend_language_scanner.l: - - Keep track of starting/ending line numbers for user functions. - - Store last parsed doc comment in a compiler global for future use. - - * zend_API.c: - Lowercase the function name when used as key in the function name. The - original case is still preserved in zend_function structure. - -2003-03-18 Zeev Suraski - - * zend_compile.c - zend_object_handlers.c: - - Fix situation where a derived class declares a public (or implicit - public) - with the same name as a private in the parent - - Optimize 'static binding' of private properties a bit - -2003-03-18 Stig Bakken - - * RFCs/002.txt: - - email address change - -2003-03-17 Stanislav Malyshev - - * zend_extensions.c: - MFZE1 - -2003-03-17 Jani Taskinen - - * Makefile.am: - Added missing zend_mm.c file and renamed zend_object_API.c -> - zend_objects_API.c - -2003-03-13 Andrei Zmievski - - * zend_API.c: - Fix warning in va_start(). - -2003-03-12 Andrei Zmievski - - * zend_API.c: - Initialize the namespace when registering functions. - -2003-03-12 Zeev Suraski - - * zend_compile.c: - Fix a crash bug in the implicit public declaration - -2003-03-11 Zeev Suraski - - * zend_execute.c - zend_object_handlers.c: - Fix handling of ::func() - -2003-03-10 Zeev Suraski - - * zend_compile.c: - Clean redundant code - -2003-03-10 Jani Taskinen - - * zend_compile.c: - Fixed some leaks. Patch by Moriyoshi - -2003-03-10 Shane Caraveo - - * zend_config.w32.h: - fix isinf for win32 - -2003-03-09 Zeev Suraski - - * zend_language_parser.y: - Optimize - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Fix handling of ::foo - - * zend_compile.c: - Cleanup - -2003-03-09 Andi Gutmans - - * zend_language_scanner.l: - - Nuke junk - -2003-03-09 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Fix parsing rules of namespaces/classes - - * zend_language_parser.y: - Add ability to use ::interface_name in implements - - * zend_compile.c: - Fix :: handling - -2003-03-07 Sebastian Bergmann - - * ZEND_CHANGES: - Dedicated to Greg Beaver . - - * ZEND_CHANGES: - Document 'final'. - - * ZEND_CHANGES: - Fix class type hints example. - - * ZEND_CHANGES: - Update 'abstract' section. - -2003-03-07 Jani Taskinen - - * zend_ini.c - zend_ini.h: - Renamed OnUpdateInt -> OnUpdateLong to prevent further misunderstandings. - - * zend_execute.c: - Better fix for the memleaks (bug 19943) by Moriyoshi - -2003-03-06 Zeev Suraski - - * zend_compile.c - zend_execute.c: - Fix warnings - - * zend_execute.c: - Fix error message - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - Require abstract classes to be explicitly declared 'abstract', in order to - avoid making developers traverse the entire class/interface hierarchy - before they can figure out whether a class is instantiable - (ok, so it makes sense :) - -2003-03-06 Sebastian Bergmann - - * ZEND_CHANGES: - -german+english+. - - * ZEND_CHANGES: - D some TBDs - -2003-03-06 Jani Taskinen - - * zend_execute.c: - Fixed bug #19943 (the memleaks) - -2003-03-06 Ilia Alshanetsky - - * zend_highlight.c: - More cleanup of the zend_strip() function. - No longer strip __LINE__, since while it may become useless it could break - code where __LINE__ is passed as a function parameter. - - * zend_highlight.c: - Fixed in zend_strip() that corrupted heredoc. - Optimized the writing routine by moving from putchar() to fwrite(). - Changed hardcoded opcode # to it's defined name. - -2003-03-06 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_execute.c: - Change opcode name - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - Add class type hints - -2003-03-05 Zeev Suraski - - * zend_compile.c: - Fix auto globals - - * zend_compile.c - zend_execute.c - zend_language_parser.y: - Implement $obj::static_func() - - * zend.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l - zend_opcode.c - zend_operators.c - zend_operators.h: - Add support for interfaces - -2003-03-04 Zeev Suraski - - * zend_compile.c - zend_language_parser.y: - Remove legacy code - - * zend_compile.c: - Remove redundant code - -2003-03-03 Harald Radi - - * zend_API.c: - add missing strtolower - - * zend_API.c - zend_API.h: - commiting zend_disable_class patch for George: - disabled classes will be replaced by dummy classes - that print a warning upon instanciation - -2003-03-02 Zeev Suraski - - * zend_execute_API.c: - Fix destructors some more - - * zend_compile.c - zend_compile.h: - Improve infrastructure - - * zend.c - zend_compile.c - zend_compile.h: - Add infrastructure for JIT initialization of auto globals - -2003-03-01 Zeev Suraski - - * zend_compile.c: - Fix mem leak - -2003-03-01 Andi Gutmans - - * zend_compile.c: - - Make __construct() have higher priority than class name functions - - for constructors. - - Fix problem with the engine allowing final/abstract for the same method. - - Both patches are by Marcus Börger. - -2003-02-27 Rasmus Lerdorf - - * zend_ini_scanner.l: - MFB: We know ini file scanning will never be interactive, so speed it up a - bit. Need a dynamic check for the language scanner. - -2003-02-26 Sebastian Bergmann - - * ZEND_CHANGES: - Syntactic sugar is sweet. - -2003-02-25 Zeev Suraski - - * zend_compile.c: - Get the bits right - final/private fix - -2003-02-25 Jani Taskinen - - * acconfig.h: - Do not redefine zend_isnan if it is already defined. - - * Zend.m4: - - Fixed bug #14245 ('make install' fails on AIX when using --with-apxs). - -2003-02-24 Stanislav Malyshev - - * zend_compile.c: - fix exception handling - -2003-02-24 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_language_parser.y - zend_language_scanner.l: - Add 'final' - -2003-02-24 Sebastian Bergmann - - * ZEND_CHANGES: - Remove obsolete not on redeclaring protected members. - - * ZEND_CHANGES: - Leftover. - - * ZEND_CHANGES: - Initial documentation of namespace {}. - -2003-02-23 Zeev Suraski - - * zend_compile.c: - Move abstract inheritance logic to the right spot - - * zend_compile.c: - Fixed abstract handling in inheritence - -2003-02-20 Wez Furlong - - * zend_stream.c: - -cough* - Fix another stupid mistake. - -2003-02-20 Stanislav Malyshev - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_opcode.c: - Allow namespaces to have a number of parts. I.e., now you can do: - namespace foo { - function abc() {} - } - ... - namespace foo { - functio def() {} - } - -2003-02-19 Wez Furlong - - * zend_stream.c: - Fix stupid mistake that only affected interactive mode. - -2003-02-18 Rasmus Lerdorf - - * zend_stream.c: - fileno() needs a FILE * here, and at least on FreeBSD with gcc-2.95.3 - it is unable to figure out that this is indeed a FILE * and hence it - won't compile without this cast. - -2003-02-18 Zeev Suraski - - * zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_language_scanner.l - zend_opcode.c: - Avoid using a C++ reserved word - -2003-02-18 Wez Furlong - - * ZendTS.dsp - flex.skl: - Fixup build for win32 - - * Makefile.am - flex.skl - zend.c - zend.h - zend_compile.h - zend_execute.c - zend_globals.h - zend_ini_scanner.l - zend_language_scanner.h - zend_language_scanner.l - zend_stream.c - zend_stream.h: - Implement simple stream support in the ZE scanners. - -2003-02-17 Zeev Suraski - - * zend_language_parser.y: - Whitespace & minor renames - - * zend_language_parser.y: - whitespace - - * zend_execute.c - zend_object_handlers.c - zend_object_handlers.h: - Improve handling of static member variables - - * zend_config.w32.h - zend_ini_parser.y: - Improve Win32 build performance - -2003-02-16 Zeev Suraski - - * zend_execute.c: - Fix complex cases of self-assignments (bugs #21600, #22231) - - * zend_execute.c: - Make EG(This) and EG(scope) available to internal methods - - * zend_execute.c: - Revert patches - they weren't ready yet! - - * zend.c: - Fix initialization - -2003-02-16 Georg Richter - - * zend_execute.c: - fixed compiler warning - - * zend_execute.c: - tested patch from Zeev (fixes oo-bug in ext/mysqli) - -2003-02-16 Stanislav Malyshev - - * zend_compile.c - zend_language_parser.y: - add support for ::foo syntax meaning "global one" - - * zend_compile.c: - remove debug prints - -2003-02-16 Sebastian Bergmann - - * zend.c - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c: - ZTS fixes - -2003-02-16 Stanislav Malyshev - - * zend_object_handlers.c: - namespace patch - static variable access - - * zend.c - zend.h - zend_compile.c - zend_compile.h - zend_constants.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l - zend_opcode.c: - Namespace patch. Big changes: - 1. Nested classes are gone. - 2. New syntax for namespaces: - namespace foo { - class X { ... } - function bar { ... } - var x = 1; - const ZZ = 2; - } - 3. Namespaced symbol access: $x = new foo::X; - etc. - For now, namespaces are case insensitive, just like classes. - Also, there can be no global class and namespace with the same name - (to avoid ambiguities in :: resolution). - -2003-02-15 Ilia Alshanetsky - - * zend_ini_scanner.l: - Added feature #19645 (ini parser can now handle quoted multi-line values). - -2003-02-14 Thies C. Arntzen - - * zend_execute_API.c: - init current_execute_data befor we start executing - - * Makefile.am: - ups - - * Makefile.am: - add really nice dump_bt function for debugging in gdb - -2003-02-13 Zeev Suraski - - * zend_object_handlers.c: - Fix error handling in illegal property access - -2003-02-13 Harald Radi - - * zend_language_scanner.l: - MFB PHP_4_3 - -2003-02-12 Ilia Alshanetsky - - * zend_API.c - zend_API.h: - Removed zend_get_module(), this function is not used by anything and more - importantly. it does not work. It tries to find data based on numeric keys - in hash table using string keys. - -2003-02-12 Zeev Suraski - - * zend_compile.c: - Fix declaration of class members that don't have an explicit access - modifier - -2003-02-11 Zeev Suraski - - * zend_compile.c: - Fix require() handling - that's an old bug! - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Improve parser handling of 'abstract' - -2003-02-10 Zeev Suraski - - * zend_compile.c: - Fix zend_initialize_class_data() - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_compile.h: - Centralize class initialization - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - - Treat $this->foo inside class X as an implicit 'public $foo' if X::$foo - is not explicitly declared - - Forbid multiple declaration of the same variable - - * zend_execute.c: - whitespace - - * zend_API.c - zend_compile.c: - Add missing destructors - -2003-02-10 Stanislav Malyshev - - * zend_object_handlers.c: - update static constants too - -2003-02-10 Zeev Suraski - - * zend_builtin_functions.c: - Fix get_parent_class() - - * zend_object_handlers.c: - Restore missing check - - * zend_execute.c - zend_execute_API.c: - Add ability to reference self:: and parent:: in constant initializers - (bug #21849) - - * zend_execute.c: - Remove redundant code - -2003-02-09 Zeev Suraski - - * zend_execute.c: - Fix the array() problem (and probably some other problems too) - -2003-02-08 Georg Richter - - * zend_API.c - zend_API.h: - fixed zend_parse_method_param - -2003-02-08 Sebastian Bergmann - - * zend_builtin_functions.c: - zend_config.h (and its Win32 version) is already included by zend.h - -2003-02-08 Ilia Alshanetsky - - * zend_builtin_functions.c: - The string.h is already available through zend.h, so the manual inclusion - is not necessary. - -2003-02-07 Ilia Alshanetsky - - * zend_builtin_functions.c: - Added a check to ensure that string.h is available before trying to use it. - - Thanks Andi. - - * zend_builtin_functions.c: - Added missing header. - -2003-02-07 Zeev Suraski - - * zend_globals.h - zend_object_handlers.c: - Improve PPP handling of properties - - * zend_config.w32.h: - Better fix - - * zend_config.w32.h: - Fix Windows build - -2003-02-07 Ilia Alshanetsky - - * zend_builtin_functions.c: - Fixed bug #15734 (Added an optional parameter to get_defined_constants(), - which if passed, will include information regarding who created the - constant). - -2003-02-06 Ilia Alshanetsky - - * zend_builtin_functions.c: - Fixed bug #19506 (get_extension_funcs() can now retrieve a list of built-in - Zend Engine functions, if "zend" is specified as the module name). - Made get_extension_funcs() on failure. - -2003-02-06 Zeev Suraski - - * zend_compile.c: - Fix the 2nd buglet in the error message :) - - * zend_object_handlers.c: - Fix check - - * zend_hash.c - zend_hash.h: - Fix prototype (may have caused stack corruption) - -2003-02-05 Zeev Suraski - - * zend_execute.c - zend_object_handlers.c - zend_object_handlers.h - zend_objects_API.c: - - read_property cleanup - - Implement unset/isset/empty for PPP - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_execute.c - zend_object_handlers.c - zend_object_handlers.h - zend_opcode.c: - Rework static class properties - now supports access restrictions - - * zend_hash.c - zend_hash.h: - Add quick_exists() - - * zend_object_handlers.c: - Add PPP support for arrays - - * zend_compile.c: - Fix buglet in error message - -2003-02-04 Zeev Suraski - - * zend_object_handlers.c: - Missing update - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_globals.h - zend_hash.c - zend_hash.h - zend_object_handlers.c - zend_opcode.c - zend_ts_hash.c - zend_ts_hash.h: - Reimplement PPP properties - -2003-02-03 Sebastian Bergmann - - * zend_API.h: - Build fix. - -2003-02-02 Harald Radi - - * zend_API.c - zend_API.h: - extend the parameter parsing API by two functions - for parsing method parameters with automatic - detection if the function was called as such or as - a class method (with a valid this ptr). - if called as a function the first parameter has to be - the object it is operating on, if called as a method - this is used. - - -2003-02-02 Zeev Suraski - - * zend.h - zend_operators.h: - whitespace - - * zend_execute.c - zend_object_handlers.c - zend_object_handlers.h: - Core rearrangements - move Zend Objects specific code to their - specific implementation file - -2003-02-02 Andi Gutmans - - * zend_compile.c: - - Fix warning - -2003-02-01 Sebastian Bergmann - - * zend_ini_scanner.l - zend_language_scanner.l: - Fix build. - -2003-02-01 Jani Taskinen - - * acconfig.h - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.nw.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_execute_locks.h - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_ini.c - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l - zend_istdiostream.h - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_mm.c - zend_mm.h - zend_modules.h - zend_object_handlers.c - zend_object_handlers.h - zend_objects.c - zend_objects.h - zend_objects_API.c - zend_objects_API.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_qsort.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_static_allocator.c - zend_static_allocator.h - zend_ts_hash.c - zend_ts_hash.h - zend_types.h - zend_variables.c - zend_variables.h: - - Added some missing CVS $Id$ tags, headers and footers. - -2003-01-30 Ilia Alshanetsky - - * zend_operators.c: - Fixed compiler warning regarding signed/unsigned int comparisons. - -2003-01-30 Harald Radi - - * zend_ts_hash.c - zend_ts_hash.h: - fix non-zts build for wez - -2003-01-30 Ilia Alshanetsky - - * zend_execute_API.c: - Fix ZTS build. - -2003-01-29 Stanislav Malyshev - - * zend_compile.h - zend_execute_API.c - zend_opcode.c: - Add additional stage to post-session cleanup. - We need separate cleanup stage because of the following problem: - Suppose we destroy class X, which destroys function table, - and in function table we have function foo() that has static $bar. Now if - object of class X was assigned to $bar, its destructor will be called and - will - fail since X's function table is in mid-destruction. - So we want first of all to clean up all data and then move to tables - destruction. - Note that only run-time accessed data need to be cleaned up, pre-defined - data can not contain objects and thus are not probelmatic. - -2003-01-29 Zeev Suraski - - * zend_execute.c - zend_object_handlers.c: - Code rearrangements - -2003-01-29 Stanislav Malyshev - - * zend_execute_API.c: - Fix object destructors: - zend_objects_store_call_destructors is not used anymore, we rely on - symbol tables cleaners to destroy all objects. - - * zend_objects_API.c: - extra safety - - * zend_compile.c: - fix memory leak - -2003-01-29 Zeev Suraski - - * zend_execute.c - zend_object_handlers.c: - Fix assignments to $this. - Fixes the 'make install' problem reported on php-dev - -2003-01-28 Zeev Suraski - - * zend_compile.c: - Fix a ticks related crash - - * (PHP_5_0_dev_before_13561_fix) - zend_execute.c: - Allow methods in parent classes to call protected methods in derived - classes - -2003-01-27 Stanislav Malyshev - - * zend_compile.c - zend_compile.h - zend_execute.c: - Replace MAKE_VAR opcode with special 'data' opcode - This opcode is not executeable but only holds data for opcodes - that need more than two arguments (presently only ASSIGN_OBJ and the ilk - but - in the future also ASSIGN_DIM) - -2003-01-26 Sascha Schumann - - * zend_API.c: - Replace snprintf() call using zend_error's capabilities - -2003-01-23 Zeev Suraski - - * zend_execute.c: - Let the scope propagate to internal functions - -2003-01-23 Jani Taskinen - - * zend_execute_API.c: - Fixed bug: #14542, register_shutdown_function() timeout problem - -2003-01-22 Stanislav Malyshev - - * OBJECTS2_HOWTO: - some small refinements for get_class_* - -2003-01-22 Ilia Alshanetsky - - * zend_execute.c: - Fixed bug #21814 (Allow booleans to be used as array keys). - -2003-01-21 Sterling Hughes - - * zend_objects_API.c: - fix by phanto to the cloning - -2003-01-19 Zeev Suraski - - * Zend.m4: - relabel - -2003-01-19 Stanislav Malyshev - - * zend_compile.c: - Restore for now old statics behaviour (so that indirect $$var references - would work again). Comprehensive fix will follow later. - -2003-01-19 Harald Radi - - * zend_ini.h - zend_ini_parser.y - zend_ini_scanner.l: - ini patch to allow 'entry[] = value' entries - -2003-01-17 Harald Radi - - * zend_objects.c - zend_objects.h: - export zend_objects_destroy_object() - static inline was meaningless anyways as the function - was only used as a callback handler and was never - called directly - - * zend_objects_API.c - zend_objects_API.h: - make std_object_handlers struct available for shared modules - -2003-01-16 Ilia Alshanetsky - - * zend_execute.c: - Fixed bug #20933 (isset/empty didn't work when used on string offsets). - -2003-01-15 Andi Gutmans - - * zend_compile.c: - - Revert int -> unsigned int change for str.len - -2003-01-15 Sascha Schumann - - * zend.h: - Revert commit which turned the lengths of strings into zend_uint. - -2003-01-14 Andi Gutmans - - * ZEND_CHANGES - zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_language_scanner.l - zend_operators.c - zend_operators.h: - - Change "is" to "instanceof" as it explains better what the operator - means. - - "is_a" was also appropriate but ugly. - -2003-01-14 Stanislav Malyshev - - * zend_API.c: - fix memory leaks and key size - -2003-01-14 Ilia Alshanetsky - - * zend_ini_parser.y: - MFZE2 - -2003-01-14 Stanislav Malyshev - - * zend_compile.c: - fix warning - - * zend_API.c - zend_API.h: - Make add_property_ functions work via write_property handler - - * zend.c - zend_object_handlers.c: - ws - -2003-01-14 Ilia Alshanetsky - - * zend_ini_parser.y: - Reverting previous patch. - -2003-01-13 Ilia Alshanetsky - - * zend_ini_parser.y: - MFZE2 - -2003-01-13 Andi Gutmans - - * zend_objects_API.c: - - Don't check if the handle is bogus. We should crash. - -2003-01-12 Harald Radi - - * zend_modules.h: - fix wrong dereferenciation - -2003-01-12 Stanislav Malyshev - - * zend_compile.c: - fix inheritance - - * zend_API.h: - Remove handle_property from here too - - * zend.c - zend.h - zend_compile.c: - RIP handle_* functions. ZE2 will use __ handlers instead. - - * zend_object_handlers.c: - Move Z_OBJ_P here. - - * zend_operators.h: - Remove Z_OBJ - it's internal to Zend objects, no generic function except - those in zend_object_handlers.c should use it. - Add Z_OBJ_HANDLER macro for easy access to handlers - -2003-01-12 Sebastian Bergmann - - * zend.c - zend.h - zend_builtin_functions.c: - ZTS fixes. - -2003-01-12 Stanislav Malyshev - - * zend_object_handlers.c: - add get_class_name handler - - * zend.c: - Use generic handlers instead of Z_OBJ - -2003-01-12 Harald Radi - - * zend_modules.h: - - - * zend_ini.h - zend_ini_entry.h - zend_modules.h: - partially revert previous commit and - change zend_modules.h to include - a forward declaration to zend_ini_entry - - * zend_ini.h - zend_ini_entry.h - zend_modules.h: - added zend_ini_entry to zend_modules_entry as - discussed with zeev - - * zend_builtin_functions.c: - fix 'use of uninitialized variable' warning - -2003-01-12 Stanislav Malyshev - - * zend_objects_API.c: - validate handle - -2003-01-12 Zeev Suraski - - * zend.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_ini.c - zend_ini.h - zend_variables.c: - Implemented compatibility mode - To enable - zend2.implicit_clone = on in php.ini or using ini_set() - -2003-01-11 Andi Gutmans - - * zend_execute.c: - - Fix typo and whitespace - -2003-01-11 Derick Rethans - - * zend.c - zend_execute.c - zend_execute.h - zend_execute_API.c: - - Ported the zend_execute_internal hook to ZendEngine2. - -2003-01-11 Harald Radi - - * zend_ts_hash.c: - freed reader twice instead of writer and reader - -2003-01-10 Ilia Alshanetsky - - * zend_alloc.c: - MFZE2 - -2003-01-10 Andrei Zmievski - - * zend_API.c: - Automatically register constructor, destructor, and clone function when - class methods are registered. - -2003-01-09 Zeev Suraski - - * zend_compile.c: - Found some more occurences of that elusive bug... - - * zend_compile.c: - Fix one lousy, annoying lurking bug (memory corruption) - Sebastian - try coWiki again please... - - * zend_API.h: - Unify and make it easy to add code into the broken-string error handler - - * zend_language_parser.y: - Fix writability checks - - * zend.c: - Fix leak - -2003-01-08 James Cox - - * zend.h: - cvs is dev not alpha. - -2003-01-08 Ilia Alshanetsky - - * zend_builtin_functions.c: - MFZE2 - -2003-01-05 Zeev Suraski - - * zend_compile.c - zend_globals.h - zend_language_scanner.l: - MFZE1 - lineno fix - -2003-01-02 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_execute.c: - Fix incorrect linkage of access-levels, when using private methods - -2003-01-01 Zeev Suraski - - * zend_API.c - zend_operators.h: - Win32 build fix - -2003-01-01 Stanislav Malyshev - - * zend_operators.h: - use handler for Z_OBJPROP - -2003-01-01 Zeev Suraski - - * zend_API.c: - Fix Wez's problem - -2002-12-31 Sebastian Bergmann - - * LICENSE - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.nw.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_ini.c - zend_ini.h - zend_language_scanner.h - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_mm.c - zend_mm.h - zend_modules.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_qsort.c - zend_qsort.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_static_allocator.c - zend_static_allocator.h - zend_ts_hash.c - zend_ts_hash.h - zend_types.h - zend_variables.c - zend_variables.h: - Bump year. - -2002-12-31 Stanislav Malyshev - - * zend_object_handlers.h: - fix level of indirection - -2002-12-30 Andrei Zmievski - - * zend_execute_API.c: - Adjust the error message. - -2002-12-30 Stanislav Malyshev - - * zend_object_handlers.h: - Oops, fix it indeed - - * zend_object_handlers.h: - Better check - -2002-12-26 Andrei Zmievski - - * zend_compile.c: - do_inherit_method_check() is supposed to return 0 or 1, not SUCCESS or - FAILURE. - -2002-12-14 Ilia Alshanetsky - - * zend_language_scanner.l: - MFZE2 - -2002-12-10 Zeev Suraski - - * zend_compile.c: - Fix check to allow for static+access level modifiers - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - - Allow variables to have both 'static' modifier and an access level. - NOTE: This only works at the syntax level right now (parser). It - doesn't actually work as of yet - all statics are considered - public for now - - Prevent users from putting more restrictions on methods in derived - classes - (i.e., you cannot make a public method private in a derived class, etc.) - -2002-12-09 Andi Gutmans - - * zend_mm.c: - - Fix a bug which I just introduced. - - * zend_mm.c: - - Fix typo - - * zend_mm.c: - - Improvements - - * zend_mm.c - zend_mm.h: - - First attempt to improve memory manager during realloc()'s - -2002-12-08 Zeev Suraski - - * zend_compile.c: - Remove comment - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Treat the absence of an access type just as if 'public' was supplied - - * zend_compile.c: - Simplify/fix inheritance checks - - * zend_execute.c: - Support private/protected constructors - -2002-12-07 Sebastian Bergmann - - * ZEND_CHANGES: - Update. - -2002-12-07 Zeev Suraski - - * zend_execute.c: - Fix error messages - - * zend_language_parser.y - zend_language_scanner.l: - Remove unintentional code - -2002-12-07 Andi Gutmans - - * zend_compile.c: - - Dissallow using parent, self and main as class names - -2002-12-06 Zeev Suraski - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_hash.h - zend_language_parser.y - zend_language_scanner.l: - - Implement public/protected/private methods. - - Prevent instantiation of classes with abstract methods. - Based in part on Marcus's patch. - -2002-12-01 Andi Gutmans - - * zend_alloc.c: - - Allow enabling of memory cache with zend_mm - - * zend.c - zend.c - zend.h - zend.h - zend_builtin_functions.c - zend_builtin_functions.c: - - MFZE1 - - * zend.c - zend.h - zend_builtin_functions.c: - - Revert as the patch doesn't compile - - * zend.c - zend_API.c - zend_builtin_functions.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_indent.c - zend_object_handlers.c - zend_opcode.c - zend_operators.c - zend_operators.h - zend_variables.c: - h WHitespace - - * zend.c: - - Initialize constants_updated (by Marcus) - - * zend_builtin_functions.c: - - Nuke use of deprecated macro - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - - FN_IS_STATIC -> FN_STATIC - - * zend.c: - - Fix crash - - * zend_compile.c - zend_compile.h: - - My personal cleanups - - * zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_language_parser.y - zend_object_handlers.c: - - Commit Marcus' cleanup of abstract and static inheritance and improve - - error messages - -2002-11-22 Derick Rethans - - * zend_API.c: - - Initialize all functions to non-static (patch by Marcus Börger - . - -2002-11-22 Sebastian Bergmann - - * zend_execute.c: - Show class name as well. Patch by Marcus Börger. - - * zend_execute.c: - Show the name of the abstract method in the error. - - * zend_compile.h: - Fix prototype. - -2002-11-20 Derick Rethans - - * zend_builtin_functions.c: - - MFZE1: Disable leak() and crash() when not using debug mode - -2002-11-20 Andi Gutmans - - * ZEND_CHANGES: - - Add abstract methods - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_language_scanner.l: - - Fix build (thanks Marcus) - - Implement abstract methods, syntax: - - abstract function foo($vars); - - I don't see any reason why modifiers such as static/public need to be - - used with abstract. PHP is weakly typed and there would be no meaning to - - this anyway. People who want a strictly typed compiled language are - - looking in the wrong place. - -2002-11-19 Zeev Suraski - - * zend.c - zend.h - zend_builtin_functions.c - zend_execute.c - zend_execute_API.c: - MFZE1 - error_reporting fix - -2002-11-18 Andi Gutmans - - * zend_language_scanner.l: - - MFZE1 - -2002-11-17 Stanislav Malyshev - - * zend_execute.c: - fix the leak - -2002-11-16 Andi Gutmans - - * zend_language_scanner.l - zend_language_scanner.l: - - MFZE1 - - * Zend.m4 - configure.in: - - MFZE1 - - * zend_hash.c: - - Commit fix for bug #19566 (I think it's by Marcus :) - -2002-11-14 Andrei Zmievski - - * zend_llist.h: - MFZE1 - -2002-11-13 Stanislav Malyshev - - * zend_execute.c: - semi-fix string offsets crash - now it doesn't crash, but still leaks - - * zend_object_handlers.c: - fix static - -2002-11-11 Andi Gutmans - - * ZEND_CHANGES: - - Update with statics - -2002-11-11 Sebastian Bergmann - - * zend_execute.c: - Fugbix typo. - -2002-11-11 Ilia Alshanetsky - - * zend.h: - MFZE1 - -2002-11-10 Andi Gutmans - - * zend_compile.c: - - MFZE1 - -2002-11-10 Stanislav Malyshev - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - fix statics - make it behave like $this (fetch type "static") - Side effect: indirect references to statics won't work. - -2002-11-06 Sebastian Bergmann - - * zend_execute.c: - Fix ZTS build. - -2002-11-06 Stanislav Malyshev - - * zend_execute.c: - fix zend_assign_to_object_op - -2002-11-05 Ilia Alshanetsky - - * zend_language_scanner.l: - MFZE1 - -2002-11-05 Andi Gutmans - - * zend_compile.h: - - Shift around zend_op members - - * ZEND_CHANGES: - - A couple of updates - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - - Add support for static methods. Basically methods which are defined as - - static don't have $this. That's the whole difference. - - * tests/zend2.php: - - $clone -> $that - - * zend_execute_API.c: - - Fix bug introduced with type change of free_op1/2 - - * zend_language_parser.y - zend_language_scanner.l: - - ATTENTION: Finally nuke old_function and cfunction. I think it is time - - to get rid of these BC notations. This is from the days of the move from - - PHP/FI 2 -> PHP 3 - -2002-11-05 Ilia Alshanetsky - - * zend_hash.c: - Revert of previous patch. - -2002-11-05 Andi Gutmans - - * zend_compile.c - zend_objects.c: - - Change the automatically created variable $clone in __clone() to - - $that as discussed at the PHP Conference. If there are any objections - - alternative names please let me know. The reason for changing it from - - $clone is because $clone sounds as if it's the newly cloned object and - - not the old one. - -2002-11-05 Stanislav Malyshev - - * zend_compile.c - zend_compile.h: - avoid using 'class' in exported functions - it annoys c++ - -2002-11-05 Stig Bakken - - * zend.c: - Fixed some special cases that were crashing for the exception default - handler. - -2002-11-04 Ilia Alshanetsky - - * zend_compile.c: - Silence compiler warnings. - - * zend_hash.c: - If ordered is not set a random compiler assigned value of *p2 would be - used, - this patch fixes the problem by initializing *p2 to NULL. - - * zend_operators.c: - Silence compile warning, ctype.h is needed for tolower() function. - - * zend_language_scanner.l: - MFZE1 - -2002-11-02 Derick Rethans - - * zend_language_scanner.l: - - Fix segfault when __CLASS__ was used outside a class definition - - * zend.c: - - MFZE1 - -2002-11-02 Ilia Alshanetsky - - * zend_language_scanner.l: - MFZE1 (20214). - -2002-11-01 Andi Gutmans - - * zend_execute.c: - Fix unset($this->foo) - -2002-10-24 Andi Gutmans - - * zend_execute.c - zend_opcode.c: - Also tune jmpz_ex - - * zend_execute.c - zend_opcode.c - zend_compile.h: - - Improve performance of part of the jmps. More to follow. - -2002-10-23 Andi Gutmans - - * zend_execute.c - zend_compile.c: - - This might improve performance. Commiting it so that I can check it on - - Linux - - * zend_execute.c: - - Make Ts access a macro. I need this for my next patch which should - - improve performance but not sure yet if it will. - -2002-10-22 Andi Gutmans - - * zend_execute.c: - Nuke unused get_incdec_op() - - Nuke old comment - - * zend_compile.h - zend_execute.c - zend_globals.h: - Improve overall engine performance - - * zend_execute.c: - Fix bug reported by Daniel T. Gorski - -2002-10-21 Thies C. Arntzen - - * zend_builtin_functions.c: MFZE1 - -2002-10-20 Stanislav Malyshev - - * zend_object_handlers.c: looks like this message should go - - * zend_compile.c: Fix private handling - -2002-10-20 Sebastian Bergmann - - * zend_highlight.c - zend_highlight.h: Sync zend_html_puts parameter list with Zend Engine 1. - -2002-10-19 Andi Gutmans - - * zend_compile.h: - Fix compile warning. - - * zend_opcode.c - zend_compile.h - zend_execute.c: - Improve opcode dispatching - -2002-10-18 Andi Gutmans - - * zend.c - zend_compile.c - zend_execute.c: - - Change opcode dispatch mechanism to use a function per opcode and use - - a lookup table using the opcode # to call the correct function. - - Still have lots of tuning to do. - - * zend_execute.c: - Cleanup - -2002-10-16 Sebastian Bergmann - - * zend_execute.c: Fix ZTS build. - -2002-10-16 Stanislav Malyshev - - * zend_compile.c - zend_execute.c: Fix class static members: now the following code works: - - and returns "Hello" (class statics are not copied anymore, but looked up in - runtime) - - * zend_compile.c - zend_compile.h - zend_execute.c: Fix and generalize $this handling. - ZEND_FETCH_FROM_THIS is removed, IS_UNUSED type on class variables will be - used instead as the sign that it's a fetch from $this - -2002-10-14 Ilia Alshanetsky - - * zend_ini_parser.y - zend_ini_scanner.l - zend_globals.h: MFZE1 - -2002-10-14 Andi Gutmans - - * zend_execute.c - zend_language_parser.y: - Support new classname::$class_name, e.g.: - hello; - ?> - -2002-10-13 Ilia Alshanetsky - - * zend_extensions.h: Increased the API number. (re: floats patch) - -2002-10-12 Ilia Alshanetsky - - * zend_operators.c - zend_operators.h - zend.c - zend_execute_API.c - zend_globals.h: MFZE1 (floats & locale issue) - -2002-10-10 Sebastian Bergmann - - * ZEND_CHANGES: Fugbix typo. - -2002-10-10 Stanislav Malyshev - - * zend_object_handlers.c: add comment - - * zend_object_handlers.c: fix memory leaks - -2002-10-09 Stanislav Malyshev - - * zend_object_handlers.c: Fix object write handler behaviour: - * If this value is already set to given value, don't try to set it again. - * If we have reference, we should not move it. - * If we are assigning referenced variable, we should separate it. - -2002-10-09 Ilia Alshanetsky - - * zend_API.c - zend_builtin_functions.c - zend_compile.c - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_language_parser.y - zend_object_handlers.c - zend_operators.c - zend_operators.h: MFZE1 zend_str_tolower issue. - -2002-10-07 Andi Gutmans - - * tests/zend2.php: - Fix test - - * zend_execute.c: - - Require $this-> when calling a methods. This whole automatic lookup - - first in the class and then in the global scope is confusing, slow and - - not quite BC compatible. - - * zend.c - zend_compile.c - zend_globals.h: - - Allow access to private/protected variables of $clone inside the __clone() - - method - -2002-10-06 Andi Gutmans - - * zend_execute.c: - Fix problem with unsetting object members. - -2002-10-01 Andi Gutmans - - * zend_language_parser.y: - - Fix problem when crashing on illegal tokens in class name during class - - definition. - -2002-09-30 Derick Rethans - - * ZEND_CHANGES: - No tabs :) - -2002-09-28 Derick Rethans - - * zend_builtin_functions.c: - Fix for defines... - - * zend_builtin_functions.c: - Fix build in non-ZTS mode - -2002-09-26 Ilia Alshanetsky - - * zend_API.c - zend_builtin_functions.c - zend_compile.c - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_language_parser.y - zend_object_handlers.c - zend_operators.c - zend_operators.h: MFZE1 - -2002-09-25 Stanislav Malyshev - - * zend_extensions.h: - Propmote API NO year, so that it will never be the same as ZE1 API NO - -2002-09-24 Andi Gutmans - - * zend_compile.c: - Fix leak - - * zend_language_parser.y - zend_compile.c - zend_compile.h - zend_execute.c: - - Megapatch to try and support inheritance from sub-classes. Things might - - be *very* buggy now so don't get too upset if that happens. - - I still need to improve some stuff but it's a good step (hopefully). - -2002-09-23 Andi Gutmans - - * zend_globals.h - zend_ini.c - zend_language_parser.y: - MFZE1. - -2002-09-21 Andi Gutmans - - * zend_extensions.h: - Someone screwed this up. - -2002-09-19 Derick Rethans - - * zend_ini.c: - Make Colin happy - -2002-09-19 Zeev Suraski - - * zend.c - zend.h - zend_execute_API.c: MFZE1 - connection_status() fix - - * zend.c: Fix non ZTS build - - * zend.c: Fix that obscure crash in Debug_TS mode - -2002-09-18 Zeev Suraski - - * zend.c: - Fix the thread-safe initialization of the ZE2. This should solve some - sporadic crashes, as well as the problem with the built-in constants. - - * zend_constants.c: Remove dead code - - * zend_builtin_functions.c: Add useful debugging function - -2002-09-17 Zeev Suraski - - * zend_hash.c - zend_hash.h: Add tracking for hashtable allocation - - * zend.c: ZE2 fix - - * zend_compile.c: whitespace - - * zend.c - zend.h: MFZE1 - threading fix - -2002-09-16 Andrei Zmievski - - * zend_API.h - zend_builtin_functions.c - zend_API.c - zend_execute_API.c: MFZE1 - -2002-09-15 Ilia Alshanetsky - - * zend_highlight.c: Make zend actually strip comments. Bug #18151 - - * zend.c: - Make zend return a proper exit error code when it encounters a parse error. - -2002-09-15 Andi Gutmans - - * zend_compile.c: - - Hopefully fix problem with __autoload not working well with inherited classes. - - There might still be some weird situations I haven't thought of. - - * zend_list.c - zend_execute.c: - WS fix - "while (" instead of "while(" - - * zend_execute_API.c - zend_ini.c - zend_list.c - zend_object_handlers.c - zend_objects_API.c - zend_operators.c - zend_API.c - zend_builtin_functions.c - zend_compile.c - zend_execute.c: - WS - Always use "if (" and not "if(" - - * zend_execute_API.c: - WS - -2002-09-10 Stanislav Malyshev - - * zend_execute_API.c - zend_variables.c: MFZE1 - -2002-09-09 Stanislav Malyshev - - * zend_object_handlers.c: remove comment - -2002-09-08 Andi Gutmans - - * zend.h: - Prepare for alpha 3 - -2002-09-05 Stanislav Malyshev - - * zend_compile.c: quick-n-dirty inheritance support for __handlers - -2002-09-04 Sebastian Bergmann - - * ZEND_CHANGES: Whitespace fixes. - -2002-09-04 Stanislav Malyshev - - * zend_object_handlers.c: remove dead code - - * ZEND_CHANGES - zend_object_handlers.c: Fix __call and add some docs - -2002-09-04 Sebastian Bergmann - - * zend_object_handlers.c: Fix ZTS build. - - * ZEND_CHANGES: TBD: __call(), __get(), __set(). - -2002-09-04 Stanislav Malyshev - - * zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_extensions.h - zend_object_handlers.c - zend_objects.c: Support for __get, __set and __call in classes. - This should work as follows: if class hasn't member with given name, - __get/__set is called. If class has no method with given name, __call is called. - __get/__set are not recursive, __call can be. - -2002-09-04 Sebastian Bergmann - - * ZEND_CHANGES: Workaround for superfluous comma in var_export() result. - - * ZEND_CHANGES: - Let debug_backtrace() example print out the class name, if applicable, and the function/method arguments. - -2002-09-03 Thies C. Arntzen - - * zend_builtin_functions.c: nuke warning - - * zend_builtin_functions.c: nuke unneeded stuff - -2002-09-03 Zeev Suraski - - * zend.c - zend.h - zend_ini.c: MFZE1 - -2002-09-03 Derick Rethans - - * zend_ini.c: - Revert - - * zend_ini.c: - - MFH for: Apply rest of html errors fix (Patch by Jan Lehnardt ) - -2002-09-03 Sebastian Bergmann - - * zend.h: - Add html_errors to zend_utility_values. Patch by Jan Lehnardt . - -2002-09-03 Andi Gutmans - - * zend_builtin_functions.c: - Fix typo - -2002-09-02 Thies C. Arntzen - - * zend_builtin_functions.c: - refine last patch. if the argument-stack is not consistent don't try to show - arguments. no call to zend_error is made as we might end up in an infinite - recursion if called from an error_handler. - so: if the arguments to functions aren't shown in debug_backtrace this is 'cause - the arument stack was not consistent when debug_backtrace was called. - - * zend_builtin_functions.c: - debug_backtrace() now checks the complete argument-stack for consistency. - -2002-09-02 Stanislav Malyshev - - * zend_execute.c: MFZE1 - -2002-09-01 Andi Gutmans - - * zend_llist.c: - Fix leak reported by "l0t3k" - -2002-09-01 Stanislav Malyshev - - * zend_operators.c: MFZE1 - -2002-08-28 Thies Arntzen - - * zend_builtin_functions.c - zend_execute_API.c: debug_backtrace() - - make args passed to functions called vy call_user_function available again. - - * zend_builtin_functions.c: debug_backtrace(): - - make args work if called from the error_handler - - fix refcount for args - - * zend.c: - clear current_execute_data on bailout as it would point into some freed area - on the stack. - -2002-08-28 derick - - * zend.c: - MFZE1 - -2002-08-26 Thies Arntzen - - * zend_builtin_functions.c: - debug_backtrace(): show name of included file for include and require calls - plus some small fixes suggested by andi. - -2002-08-24 Andi Gutmans - - * zend_builtin_functions.c: - Whitespace - - * zend_builtin_functions.c: - Whitespace and better variable name - -2002-08-24 Thies Arntzen - - * zend_builtin_functions.c: fix warning - -2002-08-23 Andi Gutmans - - * Zend.m4: - Add \n to configure fprintf - - * zend_extensions.c: - dlerror -> DL_ERROR - -2002-08-23 Thies Arntzen - - * zend_builtin_functions.c: - debug_backtrace: show include/require/eval as normal functions on the stack - -2002-08-23 derick - - * zend_builtin_functions.c: - No spaces :) - -2002-08-23 Thies Arntzen - - * zend_builtin_functions.c: - - debug_backtrace now also returns an array containing the arguments of the - called function. - - zeev, andi - is knowing the structure of the stack considered a bad thing in - zend_builtin_function? if yes i would have to create a new function in - zend_ptr_stack.c (but i think we are save this way) - - * zend_builtin_functions.c - zend_execute_API.c: - debug_backtrace: - added "type" ('->' or '::') for object calls. - made calls done thru call_user_func show-up correct in backtraces. - - andi, - does this look correct to you? - - * zend_execute.c: those are set by RETURN_FROM_EXECUTE - -2002-08-21 Thies Arntzen - - * zend_execute.c: - zend_execute: make sure that current_execute_data points to the right thing - after coming back from recursion. - -2002-08-19 Zeev Suraski - - * zend_operators.c: MFZE1 - -2002-08-17 Andi Gutmans - - * zend_execute.c: MFZE1 - -2002-08-17 Zeev Suraski - - * zend_execute.c - zend_hash.c: MFZE1 - -2002-08-16 Stig Bakken - - * zend.c: * append emacs footer - - * zend.c: * remove builtin exception class - -2002-08-16 Andi Gutmans - - * zend.c: - Fix whitespace - -2002-08-16 Stig Bakken - - * zend_execute_API.c - zend_globals.h - zend.c - zend_builtin_functions.c: - - Added set_exception_handler() function for registering a global, - catch-all exception handling function - - Added set_exception_handler() function for registering a global, - catch-all exception handling function (Stig) - -2002-08-15 Zeev Suraski - - * flex.skl - zend.c - zend_globals.h - zend_language_scanner.l: MFZE1 - -2002-08-14 jason - - * zend_compile.c - zend_compile.h - zend_globals.h - zend_language_parser.y: - MFZE1 (use token instead of global for opcode counting) - -2002-08-13 Andi Gutmans - - * zend_execute_API.c: - - Fix crash when exception is raised in __autoload function - -2002-08-13 Zeev Suraski - - * zend.h: MFZE1 - -2002-08-08 sebastian - - * zend_objects.c: Fix warning. - -2002-08-08 stas - - * zend_objects.c - zend_objects.h - zend_objects_API.c - zend_objects_API.h: Add ZEND_API to functions - -2002-08-08 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_language_scanner.l - zend_operators.c - zend_operators.h: - - Make new 'is' operator work with classes only and return false when - - the object isn't of the said class or the value isn't an object. - - * zend_static_allocator.c: - Bad Harald! :) - -2002-08-08 Zeev Suraski - - * zend_alloc.c: MFZE1 - -2002-08-07 phanto - - * zend_static_allocator.c - zend_alloc.c - zend_config.w32.h - zend_hash.c - zend_ini.c - zend_llist.h - zend_mm.c - zend_operators.c: make win32 debug output more verbose - -2002-08-03 Andi Gutmans - - * tests/zend2.php: - Small fix - -2002-08-03 Zeev Suraski - - * zend_execute.c: MFZE1 - -2002-08-01 stas - - * zend_execute.c - zend_hash.c: MFZE1 - -2002-07-30 jason - - * zend_compile.c - zend_execute.c - zend_globals.h: MFZE1 global declare - - * zend_compile.c: Fix segfault - -2002-07-30 Andrei Zmievski - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_language_scanner.l - zend_operators.c - zend_operators.h: - - Adding 'is' operator that can be used to check the type of a variable, - or its class. - -2002-07-28 phanto - - * OBJECTS2_HOWTO: update the handlers struct - -2002-07-27 Andi Gutmans - - * zend_compile.c - zend_execute_API.c: - - Make sure classes are first looked for in the current scope. - - Make sure that during inheritance the global scope is searched if the - - current one doesn't work. - -2002-07-26 Andi Gutmans - - * zend_execute.c - zend.c - zend_builtin_functions.c - zend_compile.h: - - Fix problem with debug_backtrace() reported by Stig. We weren't reporting - - global function information because it wasn't available. We have to do - - an additional assignment per-function call so that it'll be available. - - Also don't define the global scope as function name _main_ but leave it - - empty so that frameworks like Pear can decide what they want to do. - -2002-07-25 sniper - - * Zend.m4: Fixed 3 major failures in this test: - - 1. Tests work better when they are actually run.. - 2. When file is opened, it should be closed sometime too. - 3. AC_TRY_RUN cleans after itself (rm -f conftest.*), so it's - good idea to read the values while the file still exists. - - -2002-07-24 Andi Gutmans - - * zend_mm.c: - Fix some compile problems with the new configure checks. - -2002-07-24 James Cox - - * Zend.m4 - zend_mm.c: move testing for the alignment values into configure. - - * Zend.m4: ws fixes. - -2002-07-23 Andi Gutmans - - * zend_hash.c: - Fix WS. - -2002-07-21 Andi Gutmans - - * zend_compile.c: - - Fix bug reported by Sebastian where old constructors didn't work in - - nested classes. - -2002-07-18 derick - - * zend.h - zend_extensions.c: - MFZE1 - MacOSX fixes by Marko Karppinen - -2002-07-17 Andi Gutmans - - * zend_compile.c: - - Remove code which wasn't supposed to go into the patch. - - * zend_compile.c - zend_language_parser.y: - Rejuggle some code. - -2002-07-17 sniper - - * ZEND_CHANGES: This was mentioned already above (with an example too :) - -2002-07-16 Andi Gutmans - - * ZEND_CHANGES: - Before I forget to list it, this was also added. - - * zend_language_scanner.l: - - Syntactic sugar - Add "public" as a synonym for "var". - - Now we have the three P's. - You can do: - - - -2002-07-15 derick - - * zend_operators.c: - MFH of the crap removal - -2002-07-15 Andi Gutmans - - * ZEND_CHANGES - zend.c - zend.h - zend_API.c - zend_compile.c - zend_language_parser.y - zend_language_scanner.l - zend_opcode.c: - - Commit patch to support protected member variables (by Timm Friebe w/ - - some fixes by me). - - You can't access protected variables from outside the object. If you want - - to see a protected member from your ancestors you need to declare the - - member as protected in the class you want to use it in. You can't - - redeclare a protected variable as private nor the other way around. - - * zend_operators.c: - - Really implement bool increment/decrement as flip-flop. - -2002-07-14 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_language_scanner.l - ZEND_CHANGES: - - Nuke delete(). It was a big mistake to introduce it and I finally - - understand why Java didn't do so. - - If you still want to control destruction of your object then either make - - sure you kill all references or create a destruction method which you - - call yourself. - - * zend_execute.c: - Nuke some unused code - -2002-07-14 derick - - * zend_operators.c: MFZE1 - - * zend_operators.c: - MFZE1 - -2002-07-07 Andi Gutmans - - * zend_objects_API.c: - Path which should improve previous fix. - - * zend_objects_API.c: - - First try at solving problem with different objects being allocated the - - same id. - -2002-07-07 Stanislav Malyshev - - * zend_object_handlers.c: name length should be strlen+1 - -2002-07-07 Sebastian Bergmann - - * zend_language_parser.y: - Allow for 'class Namespace::Bar extends Foo' syntax. Patch by Timm Friebe . - -2002-07-06 Andi Gutmans - - * zend_execute.c: - - Fix problem where scope was lost in nested function calls. - - Thanks to Timm Friebe for diving into this one. - -2002-07-06 Zeev Suraski - - * zend_language_parser.y: spelling fix - -2002-07-05 Stig Bakken - - * zend_builtin_functions.c: * folding fixes - -2002-07-01 Andi Gutmans - - * zend_compile.c: - Fix bug when acccessing $this not in class scope. - - * zend_objects.h - zend_objects.c: - Export zend_object_get_address() - -2002-06-30 Andi Gutmans - - * ZEND_CHANGES: - Remember to document autoload when I have time. - -2002-06-30 Derick Rethans - - * zend_modules.h: - MFZE1 - -2002-06-29 Andi Gutmans - - * zend.h: - Get ready for alpha2 - - * zend_execute_API.c: - Invalid -> Undefined - - * zend_language_parser.y: - Add missing semi-colon. - - * zend_execute_API.c - zend_execute.c: - Improve some error messages. - - * zend_compile.c: - Revert previous fix. - - * zend_compile.c: - Change E_ERROR -> E_COMPILE_ERROR where needed. - - * zend_compile.c: - - Fix for bug #17882. We complain if the same method is declared twice. - - * zend.h - zend_operators.c: - Fix bug 15037 - - Bump version to alpha2-dev - -2002-06-28 Andi Gutmans - - * zend_operators.c: - WS fix - -2002-06-26 Andi Gutmans - - * zend_execute_API.c: - - Autoloading support based on patch from Ivan Ristic. - - Again I hope this feature ends up working well because if it doesn't we - - might need to nuke it. This only works for global scoped classes and it - - will never work for sub-classes so don't even ask!!!!! - - Just define an __autoload() function in the global scope and it will be - - called with the class name as the parameter if it doesn't manage to find - - the class. - - * zend_API.c - zend_builtin_functions.c - zend_mm.h: - Centralize global class fetch - - * zend_alloc.c - zend_execute.c: - - Fix problem with scope's not changing correctly during method calls. - - Reapply a tiny optimization to the allocator so that in non-debug mode - - we clean memory without detecting leaks. - -2002-06-24 Andi Gutmans - - * zend_fast_cache.h: - - MFZE1 (Turn off fast cache until we make sure it performs well.) - - * zend_alloc.c: - More fixes (warnings, bug fixes etc.) - - * zend_execute.c: - - Revert patch which checks at run-time if you're allowed to assign - - certain values by reference. - - We still need to find a solution for cases when this shouldn't be allowed - - as it might cause leaks. - - * zend_alloc.c: - Fix crash bug and clean up a bit. - -2002-06-24 Sebastian Bergmann - - * Zend.m4: IMHO, ZTS should no longer be labeled experimental. - -2002-06-24 Andi Gutmans - - * zend_alloc.c: - MFZE1 - - * zend_alloc.c: - Don't use cache if we're using ZEND_MM - - * zend_mm.c: - - Hardcode alignment to 8. We might need a configure check for this. - - * zend_mm.c - zend_mm.h: - Improve memory manager to allocate small blocks quickly. - - * zend_alloc.h - zend_mm.h - zend_alloc.c: - - Don't keep allocated blocks in a linked list if we're in non-debug mode - - as now the memory manager takes care to nuke all leaking blocks. - - * zend.h - zend_types.h: - MFZE1 - -2002-06-23 Andi Gutmans - - * zend_compile.c - zend_execute.c: - - Fix problem with constructor not being inherited and called correctly. - - * zend_mm.c: - Fix small bug - - * zend_mm.c: - - Almost completely implement realloc(). It now resizes in place when - - possible. - -2002-06-22 Andi Gutmans - - * zend_alloc.c - zend_mm.c: - Fix crash when zend_mm_shutdown is called more than once. - - * zend_alloc.c - zend_alloc.h - zend_globals.h - zend_language_parser.y: - MFZE1 - - * zend_constants.h - zend_objects.c - zend_variables.c - zend_variables.h - zend_constants.c - zend_alloc.c - zend_alloc.h: - Nuke persist_alloc(). - -2002-06-19 Andi Gutmans - - * zend_globals.h: - - This was also supposed to be part of the previous ZEND_MM commit :) - - * zend_alloc.c: - - Oops, this was supposed to be part of the previous #ifdef ZEND_MM change - - * zend_mm.h: - Use #ifdef for ZEND_MM - - * zend_mm.c: - Make sure MAX is defined - - * zend_constants.c: - - Fix problem where you couldn't define constants with different cases but - - the same name. - -2002-06-18 Derick Rethans - - * zend.c: - MFZE1 - -2002-06-17 Andi Gutmans - - * zend_mm.c: - Improve speed of alignment calculation - - * zend_mm.c - zend_mm.h - zend_alloc.c: - - Fix a bug and add code which frees actual allocated segments at the end - - of execution (this still doesn't work because some blocks remain - - referenced after the memory manager is killed. - - * zend_mm.c - zend_mm.h: - Save space per-allocated block. - -2002-06-16 Andi Gutmans - - * zend_execute.c - zend_execute.h - zend_execute_API.c: - Fix bug in class constants - - Start centralizing main class lookups. This will help implement - - __autload() - - * zend_mm.c - zend_mm.h: - - Remove debug code which doesn't work anymore and add headers. - - * zend_globals.h - zend_mm.c - zend_mm.h - zend_alloc.c - ZendTS.dsp: - Commit an initial version of a home made memory manager. - - It's just for seeing if this would be an advantage to PHP in MT - - environments. If this is to become production material there is still - - a long way to go. - -2002-06-15 Andi Gutmans - - * zend_objects.h - zend_objects_API.c: - - Fix copy&paste problem where we allocated according to an old structure - - decleration and not the new one. - -2002-06-11 Andi Gutmans - - * zend_builtin_functions.c: - - Don't show debug_backtrace() in the trace itself. - - This patch is a bit ugly because the whole code itself is pretty complex - - and hard to re-order. - - * zend_execute.c - zend_language_parser.y: - - Fix problem with assigning functions by reference. - -2002-06-11 Sebastian Bergmann - - * RFCs/004.txt: Add __delegate(). - -2002-06-10 Harald Radi - - * zend_ts_hash.h - zend_ts_hash.c: added TS_HASH macro - -2002-06-10 Stanislav Malyshev - - * zend_execute.c: Fix leak - -2002-06-09 Harald Radi - - * zend_API.h - zend_builtin_functions.c - zend_object_handlers.h: - only check for an available class entry instead of - the std_object_handlers on some places - - -2002-06-08 Andi Gutmans - - * zend_hash.h - zend.h: - This should improve performance on Windows - - * zend_hash.h: - - Add a loop unrolled version of the hash function and a bit of an - - explanation about our hash function (Ralf S. Engelschall) - -2002-06-06 Sebastian Bergmann - - * RFCs/004.txt: Add RFC on delegation. - -2002-06-05 Sebastian Bergmann - - * zend_execute.c: Remove unused local variable. - -2002-06-05 Andi Gutmans - - * zend_compile.c - zend_execute.c - zend_object_handlers.c: - - Allow overloaded objects to receive the method name in its original - - case. - -2002-06-05 Derick Rethans - - * zend_llist.c: - Fix memleak (patch by Stefan Sesser) - -2002-06-04 Derick Rethans - - * zend_ini_scanner.l: - Fix for bug #17462 (Patch by Edin Kadribasic) - -2002-05-31 Andi Gutmans - - * ZendTS.dsp: - Add zend_objects_API.* to dsp - - * zend_objects_API.c: - Fix build (one more coming up) - - * zend_objects.c: - Fix build - -2002-05-31 Sebastian Bergmann - - * Zend.dsp: Add zend_objects_API.c to project. - -2002-05-31 Stanislav Malyshev - - * Makefile.am - zend_execute_API.c - zend_globals.h - zend_object_handlers.c - zend_objects.c - zend_objects.h - zend_objects_API.c - zend_objects_API.h: Generalize object storage and reference bookkeeping - -2002-05-30 Venkat Raghavan S - - * zend.h - zend_config.nw.h - acconfig.h: NetWare changes - -2002-05-26 Andi Gutmans - - * zend_multibyte.c: - - Add empty zend_multibyte.c to allow build with 4.3.0-dev. - -2002-05-24 Sebastian Bergmann - - * ZEND_CHANGES: Fugbix typo. - -2002-05-24 Andi Gutmans - - * ZEND_CHANGES: - Add a bit of information. - -2002-05-20 Zeev Suraski - - * zend_API.h - zend_execute.h - zend_list.h: MFZE1 (Expose more C++ APIs) - -2002-05-14 Andi Gutmans - - * zend_objects.c - zend_objects.h: - constructor_called is supposed to be destructor_called - -2002-05-13 Sterling Hughes - - * zend_qsort.c: MFZE1 - -2002-05-13 Derick Rethans - - * zend_builtin_functions.c: - MFZE1 - -2002-05-12 Zeev Suraski - - * zend_highlight.c: MFZE1 - -2002-05-12 Sebastian Bergmann - - * ZEND_CHANGES: Rephrase. - - * ZEND_CHANGES: Beautify. - - * ZEND_CHANGES: Start documenting the debug backtracing. - - * ZEND_CHANGES: Whitespace fixes. - -2002-05-11 Zeev Suraski - - * zend_highlight.c - zend_highlight.h: MFZE1 - -2002-05-10 Andi Gutmans - - * zend_builtin_functions.c: - Nuke C++ comment - - * zend_builtin_functions.c: - - Make debug_backtrace() return an array. Still not finished because I - might want to differentiate between method calls and static methods. - - Example: - $bt = debug_backtrace(); - foreach ($bt as $frame) { - if (isset($frame['class'])) { - print $frame['class']; - print "::"; - } - print $frame['function']; - print " ["; - print $frame['file']; - print ":"; - print $frame['line']; - print "]\n"; - } - -2002-05-08 Andi Gutmans - - * zend_execute.c - zend_builtin_functions.c: - - Hopefully fix problems with debug_backtrace() - -2002-05-08 Derick Rethans - - * zend_builtin_functions.c: - MFZE1 - -2002-05-07 Andi Gutmans - - * zend.c - zend_builtin_functions.c - zend_compile.h - zend_execute.c: - - More debug backtrace work. It still doesn't work very well... - -2002-05-02 Andi Gutmans - - * zend.h - zend_builtin_functions.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h: Initial support for built-in backtracing. - There are still a few problems such as includes and calling other functions - from internal functions which aren't seen (will have to think if and how to - fix this). - Also the main scripts filename isn't available. Need to think about that. - -2002-04-30 Stanislav Malyshev - - * zend_API.h - zend_builtin_functions.c - zend_object_handlers.c - zend_object_handlers.h - zend_operators.h - zend_API.c: Make OBJCE return zend_class_entry*, also some cleanups - -2002-04-28 Sebastian Bergmann - - * zend_alloc.c - zend_alloc.h: Revert. - -2002-04-27 Sebastian Bergmann - - * zend_alloc.c - zend_alloc.h: - MFZE1: If the size-operands of memset are constants, the compiler can turn them into fast inline code. So, instead of using ecalloc, we use emalloc + memset in macro form now. emalloc will not return NULL, so the chosen macro form is safe. This is not true for malloc(3). An inline function accomodates our needs here. Suggested by: http://www.mail-archive.com/dev%40httpd.apache.org/msg02492.html (Sascha) - -2002-04-25 Harald Radi - - * zend_config.w32.h: unbreak the win32 build - -2002-04-24 Harald Radi - - * zend_API.c: MFZE1 saschas 'Avoid exceeding buffer limits' patch - -2002-04-23 Harald Radi - - * zend_hash.c - zend_hash.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ts_hash.c - zend_ts_hash.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_API.c - zend_API.h - zend.h: some type cleanup work - -2002-04-22 Harald Radi - - * zend_object_handlers.c - zend_object_handlers.h - zend_objects.h - zend_operators.h - zend_API.c - zend_API.h - zend_builtin_functions.c: added get_class_entry callback handler to the - object handlers structure - -2002-04-22 Sebastian Bergmann - - * Zend.m4: MFZE1: Change default value of inline-opt to yes (Sascha). - -2002-04-22 Harald Radi - - * zend_config.w32.h - acconfig.h - flex.skl: fixed linkage warning under win32 - -2002-04-20 Zeev Suraski - - * zend_execute_API.c: MFZE1 - -2002-04-19 Sebastian Bergmann - - * zend_list.c - zend_hash.c - zend_hash.h: - MFZE1: make sure the resource-list is always consistent during shutdown (Thies). - - * zend_hash.c: MFZE1: Fix imbalance bug (Zeev). - -2002-04-10 Jani Taskinen - - * zend_language_scanner.l - zend_language_parser.y: MFZE1 - -2002-04-07 Stanislav Malyshev - - * zend.h: make compatible with current PHP - - * zend_compile.c: sync - -2002-03-29 Derick Rethans - - * zend_compile.c: - revert patch - -2002-03-25 Derick Rethans - - * zend_compile.c: - MFZE1 - -2002-03-23 Andi Gutmans - - * zend_ts_hash.c - zend_ts_hash.h: - - Fix build without ZTS. If someone has a nicer fix let me know. - -2002-03-21 Andi Gutmans - - * zend_language_parser.y: - - No idea how this slipped in. Fix delete $obj statement. - -2002-03-20 Harald Radi - - * ZendTS.dsp - zend.h - zend_ts_hash.c - zend_ts_hash.h: added thread safe hashtable which allows concurrent - reads but only exclusive writes - -2002-03-19 Andi Gutmans - - * zend_language_parser.y - zend.h: - - Finish covering all parsed methods to check for validity in parser. - - Change zval's refcount to zend_uint (If it doesn't slow down the Engine - - too much it should probably stay this way). If anyone has time to test - - the difference in speed between zend_ushort & zend_uint in zend.h of - - the struct _zval_struct (one line change) I'd be glad to get some - - figures. - -2002-03-18 Andi Gutmans - - * zend_compile.c - zend_language_parser.y: - - More fixes to check for member/function call legality. - -2002-03-17 Andi Gutmans - - * zend_language_parser.y - zend_compile.c: - - Start putting error handling where method calls are being used in a - - context where only writable variables should be used. - -2002-03-15 Andi Gutmans - - * zend_execute.c - zend_object_handlers.h - zend_objects.c - zend_objects.h - zend_variables.c: - Pass TSRMLS to callbacks. - - * zend_execute.c: - - Scope fix. When calling an imported function the scope will change - - correctly to the scope of the functions class. - - - * zend_opcode.c - zend_execute.c - zend_compile.h - zend_compile.c: - - Fix issues with $this when using it by itself without indirection such as - - $this->foo. - -2002-03-14 Stanislav Malyshev - - * OBJECTS2_HOWTO: more cleanup - - * OBJECTS2_HOWTO: Update howto - - * zend_execute.c: fix for delete $this and unset $this - - * zend_execute_API.c: Fix call_user_function - -2002-03-12 Andi Gutmans - - * zend.h: - Forgot to close comment. - - * zend.h: - Macro for duality between Engine 1 and 2 - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_opcode.c - zend_operators.c: - Another couple of indirection fixes. - - Make class_entry->refcount be part of the structure and not allocated. - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_opcode.c: - Fix bug introduced with latest class hash table change. - -2002-03-12 Stanislav Malyshev - - * zend_API.c: Fix standard object creation - - * zend_API.c - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_opcode.c - zend.c - zend.h: - make class tables contain class_entry *, not class_entry - - fix isset($this) - -2002-03-10 Andi Gutmans - - * zend_execute.c: - Fix build in ZTS mode. - -2002-03-10 Stanislav Malyshev - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_object_handlers.c - zend_object_handlers.h: New stuff for objects API: - - Better assignment handling - - More flexible operations with zval-containing objects - -2002-03-09 Andi Gutmans - - * tests/zend2.php: - - Add the original example script to the CVS so that it's always available. - -2002-03-08 Sebastian Bergmann - - * ZEND_CHANGES: Add 'import const' example. - -2002-03-08 Andi Gutmans - - * zend_execute.c: - Support importing constants. e.g.: - - - * ZEND_CHANGES: - Add another 'import' example and merge 'import' section into 'Namespaces' section. - -2002-03-06 Andi Gutmans - - * zend_execute.c: - - Add function * and class * functionality. Only constants are left. - - - * ZEND_CHANGES: Consistency. - - * ZEND_CHANGES: Add 'import statement' section. - -2002-03-02 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l: - - Initial patch to support importing from class scopes (for Stig). - - It isn't complete yet but I want to work on it from another machine. It - - shouldn't break anything else so just don't try and use it. - - The following is a teaser of something that already works: - - -2002-03-02 Derick Rethans - - * zend_builtin_functions.c: - MFZE1 - -2002-03-01 Andrei Zmievski - - * zend_API.c: MFZE1 - -2002-03-01 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l: - - Remove use of C++ reserved words namespace/this - - * zend_opcode.c - zend_language_parser.y - zend_compile.h - zend_compile.c - zend_API.c: - Fix bug in nested try/catch's - - Infrastructure for implementing imports of methods. - - * zend_objects.c: - - Fix crash reported by Sebastian when destructor function causes a fatal - - error. I hope this does it and we don't find any other problems. - -2002-02-26 Andi Gutmans - - * zend_alloc.h - zend_alloc.c - zend.c: - MFZE1 - -2002-02-21 Sebastian Bergmann - - * ZEND_CHANGES: - Maintain ZEND_CHANGES to account for the addition of private member variables. - -2002-02-21 Andi Gutmans - - * zend_object_handlers.c - zend_opcode.c - zend_language_parser.y - zend_language_scanner.l - zend_compile.c - zend.c - zend.h - zend_API.c: - Experimental support for private members. - Hello; - } - } - - class MyClass2 extends MyClass { - function printHello() - { - MyClass::printHello(); /* Should print */ - print $this->Hello; /* Shouldn't print out anything */ - } - } - - $obj = new MyClass(); - print $obj->Hello; /* Shouldn't print out anything */ - $obj->printHello(); /* Should print */ - - $obj = new MyClass2(); - print $obj->Hello; /* Shouldn't print out anything */ - $obj->printHello(); - ?> - -2002-02-14 Stanislav Malyshev - - * zend.h - zend_API.c: Pass TSRM to create_object - -2002-02-14 Andrei Zmievski - - * zend_compile.c: - Fix the bug where the declared properties without init values were not - entered into the table. - -2002-02-13 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - - * zend_compile.h: - Export lex_scan(). Both the PHPDoc and tokenizer extension need this. I hope this is okay with Z&A. - -2002-02-08 Andi Gutmans - - * zend_objects.c: - Remove object debug messages. - -2002-02-07 Stanislav Malyshev - - * Makefile.am - OBJECTS2_HOWTO - ZendTS.dsp - configure.in - zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_object_handlers.c - zend_object_handlers.h - zend_objects.c - zend_objects.h - zend_operators.c - zend_operators.h - zend_variables.c: Mega-commit: Enter the new object model - Note: only standard Zend objects are working now. This is definitely going to - break custom objects like COM, Java, etc. - this will be fixed later. - Also, this may break other things that access objects' internals directly. - -2002-02-04 Andi Gutmans - - * zend_execute.c: - - This small patch should also take care of allowing unseting of $this->foo - - and static members. The unset() opcode was luckily already suitable for - - object overloading. - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_objects.c: - - Fix problem with the objects_destructor called during shutdown. It was - - freeing objects from id 0 instead of id 1. id 0 is not used. - - Change isset/empty opcodes to support static members and the new way of - - doing $this->foobar. Also the opcodes operate now on the hash table - - combined with the variable names so that they can be overloaded by the - - soon to be added overloading patch. - -2002-02-03 Adam Dickmeiss - - * Makefile.am - configure.in: - Zend config sets ZEND_EXTRA_LIBS. Bugs 14452, 14602, 14616, 14824 - -2002-02-02 Sebastian Bergmann - - * zend_builtin_functions.c: Revert per Andi's request. Sorry :-( - - * zend_builtin_functions.c: Fix warning. Again :-) - -2002-02-02 Andi Gutmans - - * zend_builtin_functions.c: - - Please don't use strcmp() and friends in Zend but only the mem* - - functions. I didn't check this patch so please check that it works. - -2002-02-02 Sebastian Bergmann - - * zend_builtin_functions.c: Fix a warning. - -2002-02-02 Andi Gutmans - - * zend_modules.h: - Nice catch by Derick. GINIT is dead. - -2002-02-01 Sebastian Bergmann - - * zend_builtin_functions.c: MFZE1: is_a() - -2002-01-27 Sebastian Bergmann - - * zend_config.w32.h: - MFZE1: define a couple of macros under win32. (Patch By: Jon Parise ) - -2002-01-25 Andi Gutmans - - * zend_compile.c - zend_execute_API.c - zend_objects.c - zend_objects.h - zend_opcode.c: - - First destructor hell fix. There was a situation where an object's - - destructor could be run after its class was already dead. Right now - - object destructors is the first thing whic happens during shutdown in - - order to prevent this problem. It's very likely that destructors will - - cause more grief and we'll have to outline exactly when you should use - - them and what kind of logic you're allowed to do inside of them. - - This bug was reported by sebastian. - -2002-01-22 Andi Gutmans - - * zend_execute.c: - - Fix a bug reported by Sebastian with indirect class names not working. - -2002-01-20 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_language_parser.y - zend_opcode.c: - Improve performance of functions that use $GLOBALS[] - - Please check this and make sure it doesn't break anything. - -2002-01-19 Thies C. Arntzen - - * zend_language_parser.y: MFZE1 - -2002-01-14 Andi Gutmans - - * zend_execute_API.c: - - Fix crash bug in call_user_function_ex(). Thanks to Sebastian for the - - very nice and short reproducing script. - - -2002-01-14 Sebastian Bergmann - - * ZEND_CHANGES: Update Exceptions example. - -2002-01-13 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_language_parser.y: - - Change exception handling to use the Java-like catch(MyException $exception) - - semantics. Example: - exception = $exception; - } - - function Display() - { - print "MyException: $this->exception\n"; - } - - } - class MyExceptionFoo extends MyException { - function __construct($exception) - { - $this->exception = $exception; - } - function Display() - { - print "MyException: $this->exception\n"; - } - } - - try { - throw new MyExceptionFoo("Hello"); - } catch (MyException $exception) { - $exception->Display(); - } - ?> - - * zend_ini_scanner.l: - MFZE1 - -2002-01-06 Andi Gutmans - - * zend.c: - - Output error when there's an uncaught exception (by Timm Friebe) - - * zend_execute.c: - Make sure $this is passed on to methods - -2002-01-06 Sebastian Bergmann - - * zend_ini.h - zend_ini_parser.y - zend_ini_scanner.l - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_modules.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_qsort.c - zend_qsort.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_static_allocator.c - zend_static_allocator.h - zend_variables.c - zend_variables.h - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_ini.c: Happy New Year. - -2002-01-05 Andi Gutmans - - * zend_compile.c: - Small fix - - * zend_compile.c - zend_compile.h - zend_execute.c: - Allow passing of $this as function arguments. - - Fix a bug which I introduced a couple of months ago - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h: - - Significantly improve the performance of method calls and $this->member - - lookups. - -2002-01-04 Andi Gutmans - - * zend_execute.c: - - Improve performance of indirect-referenced function calls - - * zend_compile.c: - Nuke C++ comments - - * zend_compile.c - zend_compile.h - zend_execute.c: - Separate other kinds of function calls too. - - Significantly improve performance of function calls by moving lowercasing - - the function name to compile-time when possible. - - * zend_compile.c - zend_compile.h - zend_execute.c: - - Start splitting up different kinds of function calls into different - - opcodes. - -2002-01-03 Derick Rethans - - * zend_API.c - zend_API.h - zend_execute.c - zend_list.c: - - MFZE1 for exit fix, exposing current function name in error messages and - exposing zend_zval_type_name(). - -2001-12-31 Sebastian Bergmann - - * ZEND_CHANGES: Consistency. - -2001-12-31 Andi Gutmans - - * ZEND_CHANGES: - - Add example of default argument for argument passed by-ref - -2001-12-30 Sebastian Bergmann - - * ZEND_CHANGES: Typo. - -2001-12-29 Andi Gutmans - - * zend.h: - - #define to help #ifdef stuff in PHP sources to make them work w/ ZE1 and - - 2 - - * ZEND_CHANGES: - A few clarifications - -2001-12-29 Sebastian Bergmann - - * ZEND_CHANGES: Integrate Andi's examples and some notes by Stig. - - * ZEND_CHANGES: Update Exceptions example. - -2001-12-28 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - - Fix some case insensitivity stuff in respect to classes - - * zend_execute.c - zend_language_parser.y: - - Support default arguments for reference parameters - - Fix two compile warnings - - * zend_compile.c: - - Wasn't adding the lower case version of the class name to the hash - -2001-12-27 Andi Gutmans - - * zend_compile.c - zend_objects.c: - - Use two underscores for __construct(), __clone and friends... - - * zend_objects.c: - - Only check refcount of object if the destructor was called. - - * zend.c - zend.h - zend_API.h - zend_compile.c - zend_objects.c - zend_objects.h: - - Experimental support for destructors. We need to see if destructors - - will actually work well in the context of PHP so we should consider this - - as experimental. Possible problems might be that when the constructor is - - run PHP might not be in a stable state. - - * zend_compile.c - zend_compile.h - zend_execute.c: - Support parent:: again - - * zend_compile.c: - Support unified constructor name _construct() - -2001-12-26 Andi Gutmans - - * zend_execute.c - zend_execute_API.c: - Fix scoping issue. The following works now: - id = self::$id++; - } - - function _clone() - { - $this->name = $clone->name; - $this->address = "New York"; - $this->id = self::$id++; - } - } - - - - $obj = new MyClass(); - - $obj->name = "Hello"; - $obj->address = "Tel-Aviv"; - - print $obj->id; - print "\n"; - - $obj = $obj->_clone(); - - print $obj->id; - print "\n"; - print $obj->name; - print "\n"; - print $obj->address; - print "\n"; - - * zend.c: - Print out object id for easier debugging - - * zend.c - zend.h - zend_API.h - zend_compile.c - zend_objects.c: - Pretty much finish _clone() support - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - Initial support for _clone() - - * zend_compile.c - zend_language_parser.y: - - Start fixing the parsing rules so that function and method calls - - can't be used in a write context. - - * zend.c: - Fix crash correctly. - -2001-12-25 Andi Gutmans - - * zend_language_parser.y: - Revert delete syntax patch - - * zend.c - zend_execute.c: - Fix a crash (not a thorough fix). - - Commented old code - -2001-12-24 Andi Gutmans - - * zend_execute.c: - - Fixed bug where global functions weren't called if they didn't exist - - in the class scope - -2001-12-23 Andi Gutmans - - * zend.c: - - Fix a bug where function's didn't work anymore in multi-threaded - - servers after the latest startup changes. - -2001-12-22 Andi Gutmans - - * zend_compile.c - zend_execute_API.c - zend_language_parser.y: - - Add initial capability of defining nested classes as class foo::bar - -2001-12-18 Zeev Suraski - - * zend_language_scanner.h - zend_language_scanner.l: MFZE1 - -2001-12-16 Sebastian Bergmann - - * ZEND_CHANGES: I'm too trigger-happy. - - * ZEND_CHANGES: delete is now function - -2001-12-16 Andi Gutmans - - * zend_language_parser.y: - - Seems like most people prefer delete($obj) over delete $obj. - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Start adding parsed variable checks. - - * zend_compile.h - zend_language_parser.y: - - Framework for knowing what kind of variable we just parsed. - - This will be used in compile-time error checking which couldn't be done - - at the level of the grammar. - -2001-12-13 Andi Gutmans - - * zend_language_parser.y: - - Rearrange grammar to allow dereferencing of objects returned from - - functions. It still crashes though. - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_opcode.c: - Fix crash bug in startup code. - - Start work on being able to reference global and local scope - -2001-12-12 Andi Gutmans - - * Zend.dsp - zend.c - zend_constants.c - zend_globals.h: - - Infrastructure changes for allowing to access the global scope from - - within a class scope. - - Fix the Zend.dsp project a bit. It seems someone pretty much killed it - - when commiting their own personal configuration. Please be careful in - - future. - - * zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_language_parser.y: - - Make classes have scope and function/constant lookups default to the class - -2001-12-11 Andi Gutmans - - * zend.c: - Merge from ZE1 - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_opcode.c: - - Rename zend_class_entry.constants -> zend_class_entry.constants_table - - * zend_execute.c: - - Start making scope change correctly when calling namespace functions. - - When inside a namespace fallback to global namespace when function - - or constant is not found. - -2001-12-11 Sebastian Bergmann - - * LICENSE: Forgot to update the LICENSE. - - * LICENSE - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_ini.c - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.l - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_modules.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_qsort.c - zend_qsort.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_static_allocator.c - zend_static_allocator.h - zend_variables.c - zend_variables.h: Update headers. - - * Zend.m4 - zend.h: MFZE1 (AIX fixes) - - * zend_highlight.h - zend_highlight.c: MFZE1 (added zend_strip mode in the highliter) - -2001-12-10 Andi Gutmans - - * zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - More namespaces work. - - Nuke memory leak. - -2001-12-08 Andi Gutmans - - * zend.c: - Fix crash with unhandled exceptions - -2001-12-06 Andi Gutmans - - * zend_execute.c: - Support constants. The following works now: - - - * zend_language_parser.y - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_globals.h: - - Initial work on changing namespace scope. Only methods & variables - - right now. - - - * zend.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_language_parser.y: - - Nuke the namespace work I did. It'll be redone differently. - -2001-12-05 Sebastian Bergmann - - * ZEND_CHANGES: Document recent changes. - -2001-12-04 Andi Gutmans - - * zend_builtin_functions.c: - Damn Zeev :) - -2001-12-01 Andi Gutmans - - * zend_API.c: - - Revert one of the changes because it might be before the memory - - manager has started. - - * zend_API.c - zend_constants.c: - Use alloca() when possible. - -2001-11-30 Andi Gutmans - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_language_parser.y - zend_opcode.c: - - Initial support for class constants. There are still a few semantic - - issues which need to be looked into but basically it seems to work. - - Example: - - - * Zend.m4: - Fix typo - -2001-11-27 Andi Gutmans - - * zend_language_parser.y: - - Support syntax for class constants (doesn't do anything yet but - - required some reworking of the grammar). - -2001-11-26 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - - Support static $var = 0; style initialization of static class - - members. For example: - - class foo { - - static $my_static = 5; - - - - } - - - - print foo::$my_static; - -2001-11-25 Andi Gutmans - - * zend.c - zend_compile.c: - Fix crash and leak - - * zend_compile.c: - Whitespace - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_opcode.c: - Support static members. The following script works: - - -2001-11-24 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c: - MFZE1 - -2001-11-15 Zeev Suraski - - * zend_compile.c: MFZE1 - -2001-11-05 stig - - * zend_objects.h: add newline at end of file to avoid warnings - - * zend_language_parser.y: non-zts compile fix - -2001-11-04 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - - Support instantiation of nested class. The following script now should - - work: - -bar(); - - - - $obj = new foo::barbara(); - - $obj->bar(); - - - -2001-11-03 Andi Gutmans - - * zend.h: - RISC OS patch by Alex Waugh - - * zend.c - zend_API.h - zend_compile.c: - Add some initializations - - * zend_compile.c - zend_execute.c - zend.h: - - Add constructor to the zend_class_entry instead of looking it up each - - time by name. - - This will allow the next patch of being able to instantiate nested - - classes such as new foo::bar::barbara(); - -2001-10-29 Andi Gutmans - - * zend_API.c - zend_opcode.c: - Fix internal classes - - * zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_globals.h - zend_language_parser.y - zend_opcode.c: - Initial support for nested class definitions - -2001-10-27 Zeev Suraski - - * zend_execute.c: MFTGZE1 - -2001-10-26 Andi Gutmans - - * zend_execute_API.c: - Fix Zeev's MFZE1 - -2001-10-23 Zeev Suraski - - * zend_constants.c - zend_execute_API.c - zend_globals.h: MFZE1 - -2001-10-20 Andrei Zmievski - - * zend_API.c: MFHZ1 - -2001-10-12 Sebastian Bergmann - - * zend_API.c - zend_API.h - zend_modules.h: MFZE1: Introduced extension version numbers (Stig) - -2001-10-04 Sebastian Bergmann - - * zend_hash.c: MFZE1 - -2001-09-30 Andi Gutmans - - * zend.c - zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l: - - Merge the NAMESPACES_BRANCH. It wasn't a good idea to have a branch when - - the whole CVS tree is work in progress - - * zend_compile.h - zend_execute.c: - - At last I've had some time to move all execute() locals into one struct. - - No immediate gain but it makes it more clear what variables are temps - - and which ones are execute() locals. - -2001-09-27 Andi Gutmans - - * zend_modules.h: - Bump it up in the right place - - * zend_modules.h: - Increase API number - -2001-09-26 Andi Gutmans - - * zend.c - zend.h - zend_compile.c - zend_execute.c: - Good catch by Sterling - -2001-09-24 Andi Gutmans - - * zend_execute.c - zend_execute_API.c - zend_globals.h: - More namespaces work - -2001-09-22 Sebastian Bergmann - - * ZEND_CHANGES: Keep ZEND_CHANGES up-to-date. - -2001-09-22 Zeev Suraski - - * zend_globals.h - flex.skl - zend.c - zend_ini_scanner.l - zend_language_scanner.l: MFZE1 - -2001-09-20 Andi Gutmans - - * zend.c - zend_compile.c: - Fix build on Win32 - - * zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l - zend.c: - - Create a branch for namespaces. This isn't even remotely close to - - working. - - * zend_list.h: - Nuke unused enum - -2001-09-19 Zeev Suraski - - * flex.skl - zend.c - zend_globals.h - zend_ini_scanner.l - zend_language_scanner.l: MFZE1 - -2001-09-19 Andi Gutmans - - * Makefile.am: - MFZE1 - -2001-09-19 Sebastian Bergmann - - * Makefile.am - zend_hash.c - zend_hash.h - zend_ini.c - zend_llist.c - zend_llist.h - zend_qsort.c - zend_qsort.h - Zend.dsp - ZendTS.dsp: MFZE1 - -2001-09-17 Brian L. Moon - - * RFCs/003.txt: adding RFC for loose type requirements for functions - -2001-09-16 Zeev Suraski - - * zend_compile.c: MFZE1 - -2001-09-10 Zeev Suraski - - * zend_compile.h - zend_globals.h - zend_ini_scanner.h - zend_ini_scanner.l - zend_language_scanner.h - zend_language_scanner.l: MFZE1 (nuke cplusplus code) - - * zend.c - zend_execute_API.c - zend_globals.h: MFZE1 (support return value in execute_scripts) - -2001-09-08 stig - - * RFCs/002.txt: remove bogus comment :) - - * RFCs/002.txt: RFC document for namespaces - - * RFCs/001.txt: wrapped to 80 columns :) - -2001-09-07 Andi Gutmans - - * zend_compile.c - zend_language_parser.y: - - Shift around the variable parsing code to make it simpler. - - * zend_llist.c: - - Fix warning (was fixed in ZE1 and not merged at some point). Please make - sure you merge patches! - -2001-09-05 Stanislav Malyshev - - * zend_operators.c: MFZE1 - -2001-09-03 Andi Gutmans - - * zend_language_parser.y: - CLS_CC -> TSRMLS_CC - -2001-08-31 Sterling Hughes - - * zend_llist.h: spaces->tabs - - * zend_llist.c - zend_llist.h - zend_execute_locks.h: MFZE1 - -2001-08-31 Zeev Suraski - - * zend.c - zend_compile.h: MFZE1 - -2001-08-30 Andi Gutmans - - * zend_compile.h - zend_compile.c: - Make it compile in thread-safe mode. - - * zend_compile.c - zend_compile.h - zend_execute.c: - Get rid of warning and C++ comments - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l: - Initial support for exceptions. - -2001-08-30 Zeev Suraski - - * zend_execute.c: MFZE1 - -2001-08-28 Zeev Suraski - - * zend_language_scanner.l: MFZE1 - -2001-08-27 Andi Gutmans - - * RFCs/001.txt: - Add sample RFC - -2001-08-26 Stanislav Malyshev - - * Zend.m4 - zend.h: Add dlsym underscore detection, by Jani Taskinen - -2001-08-26 Andi Gutmans - - * zend_operators.c: - MFZE1 - - * zend_API.c: - - Merge Andrei's fix from Engine 1. Please commit patches to both trees! - -2001-08-21 Zeev Suraski - - * zend.c - zend_execute_API.c: MFZE1 - -2001-08-20 Zeev Suraski - - * zend_hash.c - zend_hash.h: MFZE1 - -2001-08-19 Andi Gutmans - - * zend.h: - Fix compile problem - -2001-08-19 Zeev Suraski - - * zend_compile.c: MFZE1 - -2001-08-18 Andi Gutmans - - * zend_execute.c - zend_llist.c - zend_llist.h: - Merge Sterling's patches from ZE1 - -2001-08-17 Andrei Zmievski - - * zend_execute.c: MFZE1 - -2001-08-17 Zeev Suraski - - * zend_alloc.c: MFZE1 - -2001-08-16 Zeev Suraski - - * flex.skl - zend_ini_scanner.l - zend_language_scanner.l: MFZE1 - -2001-08-16 Andi Gutmans - - * zend_execute.c: - Try and nuke get_object_zval_ptr() - - * zend_objects.c: - Remove bogus notice - - * zend_variables.c: - Sync with ZE1 - - * zend.h - zend_execute.c - zend_objects.c - zend_objects.h - zend_operators.c - zend_operators.h - zend_variables.c: - Fix a bug in method calls. - - Try to get the old copying behavior of objects to work (doesn't work yet). - -2001-08-15 Zeev Suraski - - * zend_extensions.c: MFZE1 - -2001-08-14 Zeev Suraski - - * zend_constants.c - zend_constants.h - zend_variables.c - zend_variables.h: MFZE1 - -2001-08-13 Andi Gutmans - - * zend_execute.c: - MFZE1 - - * zend_execute.c: - Merge from Engine 1 - -2001-08-13 Zeev Suraski - - * zend_API.c - zend_operators.c - zend_operators.h: MFZE1 - -2001-08-12 Stanislav Malyshev - - * zend_API.h: _FUNCTION is used in definition, so use _D - -2001-08-11 Andi Gutmans - - * zend_API.c - zend_API.h - zend_objects.c - zend_operators.c: - More work on making objects work - - * zend_API.c - zend_objects.c - zend_objects.h - zend_operators.c: - - Fix some places which create objects. The fixes are ugly and will be - revised when things start working well - -2001-08-11 Zeev Suraski - - * zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_compile.c - zend_constants.c - zend_constants.h - zend_execute_API.c - zend_hash.c - zend_hash.h - zend_ini.h - zend_ini_scanner.l - zend_language_parser.y - zend_language_scanner.l - zend_list.c - zend_list.h - zend_llist.c - zend_operators.c: Whitespace - -2001-08-11 Andi Gutmans - - * Makefile.am - zend_objects.c: - Fix UNIX build. - - * zend_compile.c: - - Need to do some rewriting in the parser instead of this. - - * zend.h: - - For Sebastian. Will allow to see you're using the Engine 2 CVS via - phpinfo() - -2001-08-10 Andi Gutmans - - * zend_API.h: - Merge from Engine 1 - - * zend_compile.c: - A couple of fixes - - * zend_API.h: - Merge from Engine 1 CVS - -2001-08-09 Andi Gutmans - - * zend.c: - Merge from Engine 1 tree - -2001-08-08 Andi Gutmans - - * zend.c - zend_compile.c - zend_compile.h - zend_globals.h: - Merge new $_GET, $_POST etc. patch from Engine 1 tree - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Preliminary patch for method() dereferencing - - * zend.c - zend.h: - Merge zend_try fix from Engine 1 - -2001-08-07 Zeev Suraski - - * ZendTS.dsp: Migrate .dsp patches - -2001-08-07 Andi Gutmans - - * ZendTS.dsp: - Forgot to commit the updated dsp - - * ZendTS.dsp: - More sync with latest CVS - - * zend_objects.c - zend_objects.h - zend_operators.h - zend_variables.c - ZendTS.dsp - zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l: - Sync Engine2 CVS with latest Engine CVS - -2001-08-06 Zeev Suraski - - * zend_indent.c: Commit uncommitted build fix - - * zend_compile.c - zend_globals.h - zend_language_scanner.l: - Fix an off by one lineno issue, in case of an implicit ; - - * flex.skl - zend_highlight.c: Better shared code - - * Makefile.am - Zend.dsp - Zend.m4 - ZendTS.dsp - flex.skl - zend.c - zend_globals.h - zend_globals_macros.h - zend_highlight.c - zend_indent.c - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l - zend_language_scanner.h - zend_language_scanner.l: - Merge from branch - move to standard C scanners in thread safe mode - - * Makefile.am - Zend.m4 - flex.skl - zend_ini_scanner.l - zend_language_scanner.l: Make the C++less scanner compile under UNIX - -2001-08-06 Andi Gutmans - - * zend_execute.c: - Move to using Z_ macros - - * zend_API.h: - Use Z_ macros - -2001-08-05 Zeev Suraski - - * zend_globals_macros.h: More nulled-out macros - - * zend.c - zend_API.c - zend_API.h: TSRMLS_FETCH work - -2001-08-04 stig - - * .cvsignore: added some more stuff to .cvsignore - -2001-08-03 Zeev Suraski - - * zend_alloc.c: Fix buglet - - * zend_alloc.c: Fix macro - - * zend.c - zend_alloc.c - zend_globals.h: - Implement fast memory allocation and reduced fragmentation under Windows. - - * zend_globals_macros.h: Some compat macros - -2001-08-02 Zeev Suraski - - * zend_execute.c: - require_once()/include_once will return true in case a file was not included - because it was already included earlier. - Changed the default return value type of the include() family from long to - boolean - - * zend_constants.c - zend_execute_API.c - zend_hash.c - zend_hash.h: - Avoid going over huge lists of functions, classes and constants. - Special thanks to the guys from the MS lab for the profiling tools :) - - * zend.c - zend_execute_API.c - zend_hash.c - zend_hash.h - zend_list.c - zend_list.h: Some cleanup - - * zend_builtin_functions.c - zend_hash.c - zend_hash.h: TSRMLS fixes - - * zend_ini_parser.y: non ZTS build fix - - * Zend.dsp - ZendTS.dsp - flex.skl - zend.c - zend_globals.h - zend_globals_macros.h - zend_highlight.c - zend_indent.c - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l - zend_language_scanner.h - zend_language_scanner.l: - Implement a standard C thread safe scanner within flex - -2001-08-01 Zeev Suraski - - * flex.skl - zend_language_scanner.l: - Implement fast scanning in the multithreaded environment - -2001-07-31 Zeev Suraski - - * zend_language_scanner.l: the make Sebastian happy part of the day :) - - * zend_ini.c - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l: More TSRMLS_FETCH work - - * zend_list.c - zend_list.h: More TSRMLS_FETCH annihilation - - * zend.c - zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_constants.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_hash.c - zend_hash.h - zend_ini.c - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_modules.h - zend_opcode.c: More TSRMLS_FETCH work - -2001-07-30 Zeev Suraski - - * zend_language_scanner.l: Compile fix - - * zend.c - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_constants.c - zend_constants.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_highlight.c - zend_highlight.h - zend_ini.c - zend_ini.h - zend_ini_parser.y - zend_language_scanner.l - zend_modules.h: More TSRMLS_FETCH work - - * zend_API.c - zend_API.h - zend_builtin_functions.c - zend_modules.h: - More TSRMLS_FETCH work, and get rid of redundant ParametersPassedByRef - -2001-07-30 Andrei Zmievski - - * zend_API.c - zend_API.h: - Let's be consisten and keep TSRMLS_DC declaration after num_args. - -2001-07-30 Zeev Suraski - - * zend_API.c - zend_API.h - zend_builtin_functions.c - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_hash.c - zend_hash.h - zend_highlight.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l - zend_language_parser.y - zend_language_scanner.l - zend_list.c - zend_list.h - zend_operators.c - zend_operators.h - zend_variables.c: More TSRMLS_FETCH annihilation - - * zend_API.c - zend_API.h: Get rid of more TSRMLS_FETCH's - - * zend.c - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.h - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_opcode.c: Avoid TSRMLS_FETCH()'s (still lots of work left) - -2001-07-29 Andi Gutmans - - * zend_execute.h: - More object junk - - * zend.c: - Object macros... - -2001-07-28 Andi Gutmans - - * zend_operators.c: - Fix build - - * zend_operators.c: - More object macros. - - * zend_builtin_functions.c: - Use the Z_OBJ* macros for accessing objects - - * zend.h - zend_operators.h: - - Small patch to allow fixing the PHP tree to be compatible w/ the initial - - Zend 2 objects patch. Hopefully I can commit that this week. - -2001-07-28 Zeev Suraski - - * Zend.dsp - ZendTS.dsp - zend.c - zend.h - zend_API.c - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_fast_cache.h - zend_globals_macros.h - zend_highlight.c - zend_indent.c - zend_ini_parser.y - zend_ini_scanner.l - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l - zend_opcode.c: Redesigned thread safety mechanism - nua nua - -2001-07-28 sascha - - * zend.h: Fix build - -2001-07-27 Zeev Suraski - - * zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_constants.c - zend_constants.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_execute_locks.h - zend_globals_macros.h - zend_ini.c - zend_ini.h - zend_language_parser.y - zend_language_scanner.l - zend_list.c - zend_list.h - zend_modules.h - zend_operators.c - zend_variables.c - zend.c: Get rid of ELS_*(), and use TSRMLS_*() instead. - This patch is *bound* to break some files, as I must have had typos somewhere. - If you use any uncommon extension, please try to build it... - -2001-07-23 sascha - - * zend_alloc.c: tsrm_error is only available, if TSRM_DEBUG is defined. - -2001-07-21 Zeev Suraski - - * zend.c - zend.h: Always track bailout file/lineno - - * zend.c: Fix Release builds - - * zend.c - zend.h - zend_execute_API.c - zend_globals.h - zend_list.c: - Improve bailout mechanism, supports nesting of bailouts a-la try..catch - - * zend_hash.c: Fix compile warning - -2001-07-21 Andrei Zmievski - - * zend_compile.c: - Fix certain cases where inheritance of base class's overloaded handlers wasn't - being done. - -2001-07-20 Zeev Suraski - - * zend.c - zend_execute_API.c - zend_list.c: - Implement a more granular shutdown mechanism for the executor - - prevent corruption of constants and missing destructions of resources - -2001-07-19 Zeev Suraski - - * zend_compile.c: Unfix, it has too strong effects - - * zend_compile.c: Catch all cases - - * zend_compile.c: Fix bug #11970, strike 2 - - * zend_execute.c: Revert bogus patch - -2001-07-18 Stanislav Malyshev - - * zend_operators.c: fix double->long conversion - -2001-07-17 Andi Gutmans - - * zend_hash.c: - Remove unused code - -2001-07-16 Zeev Suraski - - * zend_API.h - zend_compile.c - zend_globals.h - zend_variables.c: - Fix bug #10287 - avoid crashing under a bogus usage of list() - - * zend.h - zend_compile.c - zend_execute_API.c: Fix bug #10467 - -2001-07-15 Zeev Suraski - - * zend_hash.h: Minor cleaning - - * zend_language_parser.y: Optimize the parser a bit - - * zend_language_scanner.h - zend_language_scanner.l: Fix an inline - - * zend_variables.c - zend_variables.h: - Time to bid this old timer goodbye - get rid of var_uninit() - - * zend_hash.c: Fix bug #6239 - - * zend_language_parser.y: - Allow indirect reference to method names in class::method() construct - - * zend_execute_API.c: Fix bug #10257 - - * zend_execute.c: Fix bug #11970 - - * zend_compile.c: Fix bug #9884 - - * zend.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_language_scanner.l - zend_opcode.c: - Improved interactive mode - it is now available in all builds, without any significant slowdown - - * zend.c: Early initialization - -2001-07-13 Zeev Suraski - - * zend_hash.c: layout - -2001-07-13 Thies C. Arntzen - - * zend_hash.c - zend_hash.h - zend_list.c: - the resource-lists are now destroyed backwards. this will make sure that - resources get destroyed in the opposite order they were created and thereby - db-cursors will always be released before their corresponding connection etc. - this sould not break anything! - -2001-07-11 Zeev Suraski - - * zend_API.c - zend_ptr_stack.c - zend_ptr_stack.h: Remove the last couple of bogus inlines - -2001-07-11 Andi Gutmans - - * zend_hash.c - zend_hash.h: - Move inline_zend_hash_func() to header file - -2001-07-11 Thies C. Arntzen - - * zend_API.h: fixed ZVAL_FALSE and ZVAL_TRUE - -2001-07-11 Stanislav Malyshev - - * zend_hash.h: No hashpjw anymore, but we have zend_hash_func - -2001-07-11 Zeev Suraski - - * zend_operators.c - zend_variables.h: Get rid of ZVAL_RESET... - - * zend_API.c - zend_operators.c - zend_variables.c - zend_variables.h: Get rid of some inlines - -2001-07-10 Andi Gutmans - - * zend_extensions.h - zend_hash.c - zend_hash.h: - Merge faster hash implementation. - - The hash function parameter in hash_init(...) is not used anymore. - - It should be removed but it is "to be decided" if we want to do that now - - or in a major version as it means changing MANY places and third party - - modules might stop working. - -2001-07-10 Thies C. Arntzen - - * zend_API.h - zend_variables.c: cleaned up the RETVAL_ RETURN_ and ZVAL_ macros - - added check for \0 at end-of-string at some places. all strings in PHP - have to be terminated with \0 because 3th party libraries might not be - binary-safe. - -2001-07-10 Andi Gutmans - - * zend_compile.c: - Commit Thies' patch. str.len was too long. - -2001-07-09 Andrei Zmievski - - * zend_API.c - zend_API.h: Adding new parameter parsing API. - -2001-07-09 Andi Gutmans - - * zend_hash.c - zend_hash.h: - - Significantly improve hash table performance by using djb's hash function - instead of hashpjw() and by using power of two sizes of hash tables (this - saves the % and isn't necessary with a good hash function). - Please try this patch. - -2001-07-03 Rasmus Lerdorf - - * zend_API.c: Trivial fix - but the period looks odd in error messages - -2001-06-30 Andi Gutmans - - * zend_alloc.c: - Fix the memory limit fix. - -2001-06-29 Andi Gutmans - - * zend_operators.c: - Remove bogus comment. - -2001-06-29 Zeev Suraski - - * zend_alloc.c: Fix memory_limit, kill warning - -2001-06-28 Zeev Suraski - - * zend_execute_locks.h: Fix warnings - -2001-06-27 Zeev Suraski - - * zend_execute.c: - Fix leak in the patch, and revert a couple of lines I didn't mean to commit - - * zend_execute.c: - Warn about illegal offsets - - Allow assignments to uninitialized string offsets (automatically pads the - string with spaces) - -2001-06-26 Zeev Suraski - - * zend_operators.c: - Fixed autoconversion of negative values to double (Fix bug #11685) - -2001-06-26 Andi Gutmans - - * zend_builtin_functions.c: - Fix crash bug (fix by Jani). - -2001-06-24 Andi Gutmans - - * zend.h: - Bump Zend version - -2001-06-21 Andi Gutmans - - * zend_execute.c - zend_execute_locks.h - zend_globals.h: - - Hopefully fix bug #11476 and improve garbage to be freed very quickly. - Tree tagged as PRE_GRANULAR_GARBAGE_FIX before commiting. - - * zend_execute_locks.h: - - Use inline instead of macro for PZVAL_LOCK()/PZVAL_UNLOCK() so that it - can be debugged. - - * zend_execute.c - zend_execute.h - zend_execute_API.c: - - Nuke dependency of all of PHP on zend_execute_locks.h. - -2001-06-21 Zeev Suraski - - * zend_execute.c: - Eliminate the leak that the original bogus code tried to solve - - * zend_compile.c - zend_execute.c - zend_globals.h: - parent::methodname() now works better with runtime classes (fix bug #11589) - - * zend_execute.c: - Fix bug #11590 (I want Andi to also review this patch before it goes into 4.0.6) - -2001-06-20 Andi Gutmans - - * zend_execute.c: - MFH - - * zend_execute.c: - Fix string offsets crash. - -2001-06-19 Andi Gutmans - - * zend_alloc.c: - Real MFH of memory fragmentation patch - - * zend_alloc.c: - Bad merge. Revert the previous patch (damn CVS). - - * zend_alloc.c: - MFH - - * zend_alloc.c: - - Fix memory fragmention problem which could lead to web server processes - growing much more than they should. (bug #11344?) - - * zend_execute.c - zend_execute.h: - MFH - -2001-06-19 Zeev Suraski - - * zend_execute.c - zend_execute.h: Add missing exports - - * zend_execute.c: Fix warning - -2001-06-13 Zeev Suraski - - * zend.c: MFH - - * zend.c: - Avoid crashing if the error reporting function is called after a bailout during shutdown - -2001-06-12 Zeev Suraski - - * zend_highlight.c: - Improve XHTML compliance (suggested by Anil Madhavapeddy) - -2001-06-10 Zeev Suraski - - * zend.c: Fix ZTS build problem - -2001-06-07 Andi Gutmans - - * zend_compile.h: - Avoid breaking op_array compatibility for 4.0.6 - -2001-05-30 Zeev Suraski - - * Zend.m4 - zend_execute_API.c: Add missing check - -2001-05-25 Andi Gutmans - - * zend_compile.c: - - Change if() to while() to make sure we skip enough opcodes - - * zend_compile.c: - MFH - - * zend_compile.c: - Fix memory leak - -2001-05-23 Andrei Zmievski - - * zend_builtin_functions.c: - Fix segfault -- need to copy-construct constant value. - -2001-05-21 Andrei Zmievski - - * zend_builtin_functions.c: Moving some functions into Zend. - -2001-05-20 sascha - - * .cvsignore: ignore ylwrap - -2001-05-20 Andi Gutmans - - * zend_list.h: - The previous name could be confused with resource # - - * zend_list.c - zend_list.h: - - Whitespace and change the name of the macro to something more verbose - ZEND_GET_RESOURCE_ID(...) - -2001-05-20 James Moore - - * zend_list.c - zend_list.h: - Add new ZEND_GET_LE macro for retrieving destructor - id's from remote extensions. (Jmoore, Zend Engine) - -2001-05-20 Andi Gutmans - - * zend_list.c: - Don't allow resource types of 0 - -2001-05-19 sascha - - * zend_hash.c: Fix segfault when using zend_hash_add_empty_element - -2001-05-18 Thies C. Arntzen - - * zend_alloc.c: reset allocated_memory_peak after each request. - -2001-05-17 Zeev Suraski - - * zend_language_scanner.l: That's slightly clearer that way :) - - * zend_alloc.c: Fix build - - * zend.c: MFH - - * zend.c: Fix corruption issue - -2001-05-16 Zeev Suraski - - * zend_hash.c - zend_hash.h: - Implement zend_hash_add_empty_element() using the existing infrastructure - - * zend_globals.h: Commit missing fix - - * Zend.m4 - zend_alloc.c - zend_globals.h: Merge memory usage into memory limit - -2001-05-14 sascha - - * zend_hash.c: - Initialize empty pDataPtr to a pseudo value to prevent a pefree on - pData. - -2001-05-12 Andi Gutmans - - * zend_variables.c: - Remove check for ht == NULL in copy_ctor. - If ht is NULL at this point then we are better off crashing and fixing - the bug that caused it. - -2001-05-11 sascha - - * zend.h: add missing closing paranthesis - - * zend_hash.c: Some extensions don't associate any data with hash entries, - except the key. Prior to this change, a separate chunk of memory - was allocated in that case to store exactly zero bytes (plus - memory manager overhead). We treat that case similar to the - pointer case, but don't copy any data at all (because the pointer - is usually the NULL pointer). - - * zend_constants.c: - Fix a memory leak which occured upon registering an already existing - constant. - -2001-05-11 Thies C. Arntzen - - * Zend.m4 - zend_alloc.c - zend_globals.h: added --enable-memory-usage-info - -2001-05-11 Andi Gutmans - - * zend_opcode.c: - MFH - - * zend_opcode.c: - - Fix crash bug when opcodes array is erealloc()'ed to a different memory - area before it reaches the loop. - - Some whitespace stuff - -2001-05-10 Zeev Suraski - - * zend_operators.c: - Treat numeric strings as numbers in the increment operator - -2001-05-09 Andrei Zmievski - - * zend_API.c: Nuke unused variable. - - * zend_API.c: Fix a few bugs in zend_is_callable() and make it stricter. - -2001-05-08 Andi Gutmans - - * zend_language_scanner.l: - Fix line numbers when some lines end with \r - - * zend_opcode.c: - Fix crash bug reported by DBG author Dmitri Dmitrienko. - -2001-05-07 Zeev Suraski - - * zend.c: Make zend_execute_scripts() reentrant - -2001-05-06 Zeev Suraski - - * zend.c - zend_compile.c - zend_compile.h: - Recover from a parse error in include files (before, it could result in a crash under certain circumstances). Fix bug #8663 - -2001-05-06 Andi Gutmans - - * .cvsignore: - .cc files were renamed. Update .cvsignore. - -2001-05-06 Zeev Suraski - - * zend_operators.h: Yikes, that would have been a very bad bug :) - - * zend_execute.c: - Floating point keys didn't work in array() (fix bug #6662) - - * zend_compile.c - zend_execute_API.c: - Hear hear, interactive mode is finally showing some progress: - - Support function calls - - Fix crash bug - - * zend_compile.h - zend_language_parser.y - zend_language_scanner.l: Support interactive mode in thread-safe builds - - * zend_operators.h: Fix autoconversion of hexadecimal strings - It's time to close bug #5404 :) - - * zend_highlight.c: Retain single spaces as spaces to condense HTML - -2001-05-02 Andi Gutmans - - * zend_ini_scanner.l: - Support \r as newline in the ini scanner - - * zend_language_scanner.l: - Handle MAC OS X \r line endings - - * zend_execute.c: - - Patch by Andrei to prevent crash in error situation when not all - object overloading handles are defined. - -2001-05-01 Andi Gutmans - - * zend.h: - Bump up Zend version - -2001-04-30 Andi Gutmans - - * zend_builtin_functions.c: - Add mistakenly removen closing bracket - - * zend_builtin_functions.c: - Get rid of warning - - * zend_alloc.c: - - Try to solve crash on OS400. There is actually no reason I can see for - why his fix should solve a crash but it doesn't harm. - - * zend_execute_API.c: - Fix crash bug in interactive mode - -2001-04-29 Andi Gutmans - - * zend_alloc.h: - Whitespace - - * zend_alloc.c - zend_alloc.h: - Improve overwrite detection in debug mode. - - * zend_operators.c: - - Previous patch for too early freeing of resources seemed to have worked. - - Clean it up a bit. - - * zend_operators.c: - - Try and solve the too early resource destruction problem. - -2001-04-28 Zeev Suraski - - * zend.h - zend_hash.c - zend_language_scanner.l - zend_operators.c: include limits.h if available - - * zend.h: Fix bug 5661 - -2001-04-28 Andi Gutmans - - * zend_operators.c: - Move all cases into switch(). - - * zend_alloc.c: - Just some little whitespace stuff. - - * zend_alloc.c: - - Don't add/remove cached memory blocks from blocks list as this will slow - - down performance a bit. - -2001-04-28 Zeev Suraski - - * zend_operators.c: - Resources weren't being properly destroyed by the convert_to_*() functions - -2001-04-27 Andi Gutmans - - * zend_API.c - zend_builtin_functions.c - zend_hash.c - zend_language_scanner.l - zend_operators.c - zend_operators.h: - More whitespace fixes while I'm at it. - - * zend.h - zend_alloc.c - zend_builtin_functions.c - zend_execute_API.c - zend_extensions.c - zend_language_scanner.l: - - Whitespace changes to be standard like the rest of Zend - -2001-04-24 Andi Gutmans - - * zend_execute.c: - Due to popular demand merge the foreach() crash fix. - -2001-04-24 Andrei Zmievski - - * zend_builtin_functions.c: MFH. - -2001-04-21 Andi Gutmans - - * zend_llist.c - zend_llist.h: - Add typedef for function pointer of llist dtor - -2001-04-20 Andi Gutmans - - * zend_execute.c: - - Fix for crash bug when using invalid arguments in the foreach() loop. - - Reported by Yasuo Ohgaki - -2001-04-19 Andi Gutmans - - * zend_API.h: - Patch from Jason Greene. - - Make it easier to write PHP function definitions in more than just one .c - file while accessing the same module globals. - -2001-04-17 Zeev Suraski - - * zend_alloc.c: small beautification - -2001-03-28 Zeev Suraski - - * zend_list.c: Fix warning - - * zend_list.c: Make Windows happy - - * zend_list.c: Get rid of more redundant code - - * zend_list.c: - Cleaner way of making sure resources start at 1 and not 0... - - * zend_list.c - zend_list.h: Remove redundant code - -2001-03-27 Zeev Suraski - - * zend_list.c - zend_list.h: God knows what this code was doing... - -2001-03-26 Andrei Zmievski - - * zend_builtin_functions.c: - Updated get_class_methods() to take class instance as well as class name. - - * zend_builtin_functions.c: - Making it possible to pass a class name to get_parent_class() as well - as a class instance. - -2001-03-23 Andrei Zmievski - - * zend_builtin_functions.c: Fixing function name length. - -2001-03-19 Andi Gutmans - - * zend_language_parser.y: - - Add support for isset($var1, $var2, $var3); - Will be true only if all - - variables are set. - -2001-03-15 Andi Gutmans - - * zend_language_parser.y: - Nuke commented code - -2001-03-12 Andrei Zmievski - - * zend_API.c: Name length is already known. - -2001-03-12 Andi Gutmans - - * zend_API.c: - Missed second place. - - * zend_API.c: - Nuke snprintf() - - * zend_language_scanner.l: - White space - - * zend_language_scanner.l: - - Fix by Jani Taskinen for whole path also to work - with include_once()/require_once(). - -2001-03-12 Andrei Zmievski - - * zend_API.c - zend_API.h: - Improve zend_is_callable() to the point where it's actually useful. - Now it just needs to be invoked everywhere in PHP where a callback is - expected. - -2001-03-11 Andi Gutmans - - * Zend.m4 - acconfig.h: - Fix for Solaris. - -2001-03-10 Andi Gutmans - - * zend_execute.c: - Whitespace - -2001-03-07 Zeev Suraski - - * zend_ini.h: Add missing #define's - - * zend_compile.c - zend_execute.c: Make parent:: work in runtime bindings as well - -2001-03-06 sascha - - * Zend.m4: We actually only need AC_PROG_LEX here. - -2001-03-04 Zeev Suraski - - * zend_execute.c: Fix bug #8899 (thanks Jani) - -2001-03-03 sascha - - * Zend.m4: -Os is a valid GCC optimization level. - -2001-03-02 Zeev Suraski - - * zend_compile.c: Whitespace fix - -2001-02-28 Andrei Zmievski - - * zend_execute_API.c: Do case-insensitive class name matching when parsing - array('Class', 'method') structure. - You guys can clean it up, if there is a better way. - -2001-02-27 Andi Gutmans - - * zend_variables.c - zend_variables.h: - Nuke zval_del_ref() - -2001-02-27 Andrei Zmievski - - * zend_compile.c: Don't overwrite existing handlers with parent ones. - -2001-02-26 Andi Gutmans - - * Zend.dsp - ZendCore.dep - ZendTS.dsp - zend.c - zend_API.c - zend_API.h: - Rename modules.h to zend_modules.h - - * LICENSE: - One more copyright year update - - * zend_ini.h - zend_ini_parser.y - zend_ini_scanner.l - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_static_allocator.c - zend_static_allocator.h - zend_variables.c - zend_variables.h - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_ini.c - zend_modules.h: - Update copyright year - -2001-02-25 Andi Gutmans - - * zend_modules.h: - Fix dll linkage warnings - -2001-02-24 Andi Gutmans - - * zend_builtin_functions.c - zend_modules.h: - Add exports from Daniel Beulshausen - -2001-02-14 Stanislav Malyshev - - * zend.h: allow more extensions with resources - -2001-02-13 Zeev Suraski - - * zend_extensions.c: Move version registration to a more correct place - -2001-02-12 Andi Gutmans - - * zend_operators.c - zend_operators.h: - Remove two unused functions - - * zend_execute_API.c: - Fix whitespace. - -2001-02-12 Zeev Suraski - - * zend_execute_API.c: - Fix a bug that could cause corruption in case of an error during - get_zval_ptr() - -2001-02-09 Andi Gutmans - - * zend_execute.c: - - Remove duplicate code and do a tiny optimization in DO_FCALL - -2001-02-05 Zeev Suraski - - * zend_execute.c: Fix string offset data corruption - -2001-02-04 Andrei Zmievski - - * zend_execute_API.c: - Allow passing class name as well as an object instance to call methods. - -2001-02-03 Andrei Zmievski - - * zend_execute_API.c: - Set the correct function state during execution. This is mainly to have - get_active_function_name() to return proper value. - - * zend_compile.c: Inherit overloaded handlers. - -2001-02-01 Andrei Zmievski - - * zend_API.c - zend_API.h: - Added zend_is_callable() function that checks whether passed zval - represents a valid and exiting callable construct. - -2001-01-31 Andi Gutmans - - * zend_API.h - zend_API.c: - Change unset() functions to null(). unset() is legacy - - * zend_API.h: - - Quick fix. I'm for changing these to add_property_null() as we've nuked - - unset. - -2001-01-27 Andi Gutmans - - * zend_execute.c: - That doesn't seem like a smart thing to do :) - - I wonder if gcc optimized it out. - -2001-01-23 Thies C. Arntzen - - * zend_extensions.h - zend_ini_scanner.h - zend_list.c - zend_list.h: fix a couple of warnings - - * zend_API.c: fixed crash in add_index_bool. - -2001-01-22 Andrei Zmievski - - * zend_API.h: Make add_index_zval() available to the outside world. - -2001-01-21 Andi Gutmans - - * zend.h: - - Make people happy who like the Zend version number bumped up in parallel - with PHP. - -2001-01-20 Andi Gutmans - - * zend_API.c - zend_API.h: - - Patch from Sterling. Add API calls to add zval's as array indeces/ - object properties. Add _ex functions which take the string length as an - argument for better performance. - -2001-01-19 Andi Gutmans - - * zend_API.h - zend_API.c: - - For Sterling. I wonder if not all of the API functions should take the - - key_length as a parameter in order to save that strlen(). - -2001-01-17 Andi Gutmans - - * zend_execute.c: - - Fix leak in fetch_dim_address() which was already fixed in - - fetch_dim_object(). Take the oppertunity to make both use the same - - function and not duplicate the code. - -2001-01-16 Zeev Suraski - - * zend_list.c: Fix persistent resources, once and for all... - -2001-01-15 Zeev Suraski - - * zend.c - zend.h - zend_compile.c: Add free_estring() - -2001-01-12 Zeev Suraski - - * zend_istdiostream.h: Add newline - -2001-01-12 Rasmus Lerdorf - - * zend_highlight.c: Fix for bug number 8666 - -2001-01-07 Zeev Suraski - - * zend_ini.c: Fix mismatch in return values - - * zend.c - zend.h - zend_alloc.c - zend_ini.c - zend_ini.h: - Remove backward dependency from PHP -> Zend - - Rename get_ini_entry() as get_configuration_directive() for clarity - (it doesn't use the INI subsystem, but the module-supplied function for - retrieving configuration directives) - - * Zend.dsp - ZendTS.dsp: Remove -S option on all bison calls - - * zend.c: - Fix possibility of a crash during startup (very unlikely, but possible) - -2001-01-06 Zeev Suraski - - * ZendTS.dsp: Remove -S - -2001-01-06 Andi Gutmans - - * zend_ini.c: - This slipped in by mistake. - -2001-01-05 Zeev Suraski - - * zend_ini.c - zend_ini.h: - Merge in some ZEND_API additions from Daniel Beulshausen (needed for the - Win32 Apache module) - -2001-01-04 Andi Gutmans - - * zend_list.c: - - Make plist_destructor work like list_destructor to allow it to call - extended destructors. - -2001-01-03 Zeev Suraski - - * zend.h: Fix Zend version while we're at it - - * zend_execute_API.c: Merge call_user_function_ex() fixes - - * zend_language_scanner.l: Merge line number corruption bug fix - - * zend_language_scanner.l: - Fix another case of possible line number corruption - - * zend.h: Commit missing declaration - -2001-01-01 Andi Gutmans - - * zend_execute.c: - Remove unreachable code - -2000-12-30 Zeev Suraski - - * zend_language_scanner.l - zend_opcode.c: Fix possible corruption in line number information - -2000-12-27 Zeev Suraski - - * zend.c - zend_globals.h - zend_ini.c - zend_ini.h - ZendTS.dsp: - Make the INI mechanism thread safe (or at least thread safer :) - -2000-12-26 Zeev Suraski - - * zend_compile.h: - Use iostream.h instead of istream.h (IBM's compiler doesn't come with istream.h, - and iostream.h should include it) - - * ZendTS.dsp - zend_ini_scanner.l - zend_istdiostream.h - zend_language_scanner.l: - - Use supplied istdiostream definition for the INI scanner too - - Add Release_TSDbg configuration - -2000-12-24 Zeev Suraski - - * zend_extensions.h: This needs updating as well - - * zend_execute_API.c: - More aggressive protection in call_user_function_ex() - -2000-12-23 Zeev Suraski - - * zend_execute_API.c: - Fix a possible crash bug in call_user_function_ex(), if the function is - in fact not a user function - -2000-12-22 sascha - - * zend.c - zend_modules.h: - Set the floating-point exception mask on FreeBSD to 0 (as do other - FreeBSD system applications). Also bump up the module API number - as the zend_hash_get_current_key change affects source and binary - compatibility. - -2000-12-22 Zeev Suraski - - * zend.c - zend_builtin_functions.c - zend_execute.c - zend_hash.c - zend_hash.h: - Allow get_current_key() not to return the key itself, instead of a duplicate - - * zend_hash.c: * Fixed a possible crash in get_class_methods() - -2000-12-19 Stanislav Malyshev - - * zend_language_scanner.l: Add support for ASP tags in one-line comment - -2000-12-18 Andi Gutmans - - * flex.skl: - Success! Yay! - - * flex.skl: - Yet another one. - - * flex.skl: - Testing - - * flex.skl: - No luck - - * flex.skl: - Make this damn commit stuff work. - - * flex.skl: - Testing - -2000-12-18 Stanislav Malyshev - - * zend.c: - Use HashPosition iterator instead of saving/restoring internal pointer - - * zend.c: Preserve internal pointer over print_r (fix #8289) - -2000-12-18 Andi Gutmans - - * zend_compile.c: - Fix leak with useless statements such as "foo"; - - * flex.skl: - - Testing Sascha's CVS commit script which should work with branches. - - * flex.skl: - Testing - - * flex.skl: - Testin - -2000-12-18 Zeev Suraski - - * flex.skl: Test, ignore - -2000-12-18 Stanislav Malyshev - - * zend_operators.c: Add notice when auto-converting array to string - -2000-12-17 Andi Gutmans - - * zend_language_scanner.l: - - Clean up the scanner a tiny bit while messing with it. - - * zend_language_scanner.l: - - %> without asp_tags should not be treated as inline_html but as regular - tokens. Of course the parser will die with a parse error which is the - correct behavior. - - * zend_language_scanner.l: - - Fix problem in one line comments with line endings such as ??> - -2000-12-17 Stanislav Malyshev - - * zend_operators.c: Fix #8279 (-2147483647 > 2147483647). - -2000-12-14 Zeev Suraski - - * zend_modules.h: Update module_api_no - -2000-12-13 Zeev Suraski - - * zend_API.h - zend_execute_API.c: - Fix call_user_function() with objects - it could leak under certain circumstances - -2000-12-12 Stanislav Malyshev - - * zend_operators.c: Fix #8195: strncasecmp returns incorrect value - -2000-12-07 sascha - - * zend_builtin_functions.c: - Hardcode strlen due to problems on SCO OpenServer 5.0.4 which defines - strlen to __std_hdr_strlen. - -2000-12-07 Stanislav Malyshev - - * zend_compile.c: Whitespace fix - - * zend_compile.c: Allow var $foo = array(ABC => 1) constructs - - * zend_builtin_functions.c: - Fix memory leak - get_current_key mallocs it's result, no need to - copy it. - -2000-12-06 sascha - - * zend_hash.c: - INIT_DATA/UPDATE_DATA assumed that pData elements of the size of a void - pointer would actually be aligned like a void pointer. This lead - to bus errors on architectures which don't allow unaligned 32-bit accesses. - -2000-12-05 Andi Gutmans - - * zend_language_parser.y: - - Support for $var =& new foo() syntax. This allows you to use objects - which create extra references to themselves in the constructor. - -2000-12-05 Zeev Suraski - - * zend_execute.h: Expose all timeout functions - -2000-12-02 sascha - - * acconfig.h - configure.in: - Use the hardly-documented third parameter of AM_INIT_AUTOMAKE to suppress - defining PACKAGE/VERSION. - -2000-11-27 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c: - - Allow passing references which are returned from functions and new - - statements to be passed by reference. - -2000-11-27 Andrei Zmievski - - * zend_builtin_functions.c: - Update class constants before trying to get default properties. - -2000-11-22 Andi Gutmans - - * zend_compile.c: - Remove code which has been commented out for ages. - -2000-11-22 sascha - - * zend_execute.c - zend_globals.h: Pass on the exit status - -2000-11-21 Zeev Suraski - - * zend_operators.c - zend_operators.h: Fix build - -2000-11-21 Andi Gutmans - - * zend_execute.c: - The baby patch wasn't that innocent :) - -2000-11-21 Andrei Zmievski - - * zend_builtin_functions.c: - Sterling's patch to make get_defined_vars() simpler and better. - -2000-11-20 Andi Gutmans - - * zend_execute.c: - NEVER copy and paste :) - - * zend_compile.c - zend_execute.c: - Baby patch towards making the damn pass-by-ref work. - -2000-11-20 Zeev Suraski - - * zend_extensions.h: Update API number - -2000-11-20 Stanislav Malyshev - - * zend.h: - Add macro to replace value of zval with another value while preserving - referencing structure - -2000-11-20 Andi Gutmans - - * zend_execute.c: - This patch is broken and needs more thorough fixing. - -2000-11-19 Andi Gutmans - - * zend_execute.c: - - Try and fix the problem when sending references returned from a function by reference. - -2000-11-19 Zeev Suraski - - * zend_alloc.h: Fix Zend build for non ZTS - -2000-11-18 Zeev Suraski - - * zend_alloc.c: Forgot to commit the non-debug build fix yesterday... - - * zend_alloc.c - zend_alloc.h: - Add thread-safety debugging information (idea - Dmitri Dmitrienko) - -2000-11-14 Stanislav Malyshev - - * zend_language_scanner.l: Restore compatibility with old broken way - - * zend_language_scanner.l: - Better 0x handling - not change non-0x number behaviour - - * zend_language_scanner.l: - Attempt at better handling long 0x-numbers, like 0xffffffff - -2000-11-13 Andi Gutmans - - * zend_extensions.c - zend_extensions.h: - Remove unused function - - * zend_extensions.h: - - Use typedef's for function pointers so that we can easily define arrays - - of these function pointers. - -2000-11-13 Stanislav Malyshev - - * zend_llist.c: - Fix zend_llist_apply_with_del - it should remove from list, - not only call dtor - -2000-11-12 Zeev Suraski - - * ZEND_CHANGES: Test, ignore - -2000-11-11 Andi Gutmans - - * zend_compile.c - zend_compile.h: - Move SET_UNUSED() to header - - * zend_opcode.c: - Beautify by using the standard #define. - -2000-11-10 Andi Gutmans - - * zend_compile.h - zend_compile.c: - Remove this damn thing once again. - - * .cvsignore: - Add files to .cvsignore thanks to Jon Parise - -2000-11-09 Andi Gutmans - - * zend_compile.c - zend_compile.h: - Maybe it's OK now? :) - - * zend_compile.c - zend_compile.h: - Undo the previous commit for fixing $obj = new foo(). - - * zend_compile.c - zend_compile.h: - - Commit experimental patch to fix the problem when doing $a = new foo() - and the constructor assigns $this by reference to other symbol table - elements. Thanks to Daniel J. Rodriguez on this one. - -2000-11-08 Zeev Suraski - - * zend_extensions.c - zend_extensions.h: Add ability to find extensions by name - -2000-11-06 sascha - - * zend_ini.c: Kill a misleading warning which is intended for old code - which assumes sizeof(int) == sizeof(void *). - -2000-11-03 Andi Gutmans - - * zend_ini_scanner.h: - Add trailing \n? - -2000-11-03 Zeev Suraski - - * zend_ini_scanner.l: Fix for bug #5571 (by mookid@sigent.ru) - -2000-11-03 Andi Gutmans - - * Makefile.am: - Fix dependency. - -2000-11-03 Zeev Suraski - - * zend_operators.h: Fix build - - * zend_operators.h: Add RESVAL macros - -2000-11-02 Zeev Suraski - - * zend.c: Fix bug #7599 - - * zend_language_parser.y - zend_language_scanner.l: Missed those - - * zend_API.c - zend_compile.c - zend_compile.h: Maintain consistency - -2000-11-02 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Replace do_exit() with zend_do_exit(). - - Problem reported by David Hedbor - -2000-11-02 Zeev Suraski - - * zend_ini_parser.y: Remove unnecessary variables - - * zend_ini.c: - explicit declaration here too - sigh, way too early in the morning - - * zend_ini.h: oops - - * zend_ini.h: explicit declaration - -2000-10-31 Zeev Suraski - - * zend_highlight.h: Fix Apache build - - * zend_ini.c - zend_ini.h: Remove unnecessary code, fix phpinfo() - - * Zend.m4: Require bison 1.28 - -2000-10-30 Zeev Suraski - - * Zend.dsp: Fix non-thread-safe Windows build - - * zend_globals.h - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l: Final touches on the INI parser - -2000-10-30 Stanislav Malyshev - - * Makefile.am: Another attempt to make it build - - * Makefile.am - zend_ini_scanner.l: Fix build - -2000-10-29 Zeev Suraski - - * zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l: Fix leaks - - * zend_alloc.h - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l: The new INI parser is showing some signs of life - - * zend_compile.c - zend_compile.h - zend_execute.c: - Fix a corruption bug, when erroneously allowing to send non-variables by reference (several - bug-db reports seem to originate in this bug) - - * zend_extensions.c - zend_ini_parser.y: Fix build - - * zend_ini_scanner.h: Forgot this one - - * Makefile.am - ZendTS.dsp - zend_globals.h - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.l: Generalization work - -2000-10-29 Stanislav Malyshev - - * zend_extensions.c - zend_extensions.h: - Allow module to proclaim compatibility with any Zend version - -2000-10-29 Zeev Suraski - - * Makefile.am - ZendTS.dsp - zend_ini_parser.y - zend_ini_scanner.l - zend_language_scanner.l: Some more work on the INI parser/scanner - - * Makefile.am - zend_ini_parser.y - zend_ini_scanner.l: Initial step in rewriting the INI parsing mechanism - - * .cvsignore - Makefile.am - Zend.dsp - ZendCore.dep - ZendTS.dsp - zend-parser.y - zend-scanner.h - zend-scanner.l - zend_compile.c - zend_compile.h - zend_highlight.c - zend_indent.c - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l: Unify the names of these last 3 files... - - * Zend.dsp - ZendTS.dsp: Fix Windows build - - * Makefile.am - zend_ini.c - zend_ini.h - zend_operators.c - zend_operators.h: - Initial steps to move the INI mechanism to the Zend engine - -2000-10-27 Andrei Zmievski - - * zend_operators.h: Added macros for object properties and class entry. - -2000-10-26 Andi Gutmans - - * zend_API.c - zend_modules.h: - Fix new -m on Windows - -2000-10-25 Andrei Zmievski - - * zend_list.h: Remove the patch to register_list_destructors(). - -2000-10-20 Andrei Zmievski - - * zend_list.c - zend_list.h: - Fixed a bug in zend_rsrc_list_get_rsrc_type() - - Switched register_list_destructors() to use - zend_register_list_destructors_ex() instead - -2000-10-19 Andi Gutmans - - * zend_compile.c: - - Constant expressions which are used multiple times need to be copy_ctored - -2000-10-18 Andi Gutmans - - * zend_llist.c: - Fix whitespace - - * zend_extensions.c - zend_llist.c - zend_llist.h: - - Try #2. Wasn't allowed to delete in the previous manner because we were - in the middle of an llist_apply() - -2000-10-18 sascha - - * zend_fast_cache.h: - Add explicit conversion from 'void *', otherwise ANSI C++ compilers - will break out. - -2000-10-18 Andi Gutmans - - * zend_extensions.c: - Fix crash - -2000-10-17 Andi Gutmans - - * zend_builtin_functions.c: - Fix copy&paste bug - -2000-10-15 Andi Gutmans - - * zend_opcode.c: - - Increase op_array size faster and make eralloc() it in the end to save - memory. - -2000-10-14 Andi Gutmans - - * zend_builtin_functions.c: - Add another patch from Sterling. - - * zend_builtin_functions.c: - - Preliminary commit of Sterlings get_defined_functions()/get_defined_vars - functions - - * zend_extensions.c: - - Only run startup() if ZEND_EXTENSIONS is defined to 1. - This fixes a link error on platforms which don't support libdl - -2000-10-13 Andi Gutmans - - * zend_operators.c: - Make increment of "" become "1" - -2000-10-11 Andi Gutmans - - * zend_hash.c - zend_hash.h: Don't use 'new' symbol - -2000-10-11 Zeev Suraski - - * zend_execute.c - zend_execute_API.c: - Fix -a interactive mode (no idea how the previous commit got committed) - - * zend_execute.c: *** empty log message *** - - * zend.h: Update version - - * zend_hash.c - zend_hash.h: Add zend_hash_merge_ex(), for selective merging - -2000-10-06 Andi Gutmans - - * zend_execute.h: - Fix Bug #7061 - -2000-10-05 Andi Gutmans - - * zend-scanner.l: - - Updated included_files() also for plain include()/require(). - -2000-10-04 Andi Gutmans - - * zend_alloc.c: - Fix fprintf - -2000-10-02 Andi Gutmans - - * zend_extensions.h: - Change zend_extension_api_no - -2000-09-30 Andi Gutmans - - * zend_builtin_functions.c: - Cleanup error output - -2000-09-28 Andi Gutmans - - * zend_hash.c: - - Another has optimization/fix like the hash_copy one from earlier on - -2000-09-28 Stanislav Malyshev - - * zend_hash.c: - Make hash_copy call copy constructor on a real copy, not on a temp - -2000-09-28 Andi Gutmans - - * ZendTS.dsp: - Remove zend_gcc_inline.c - -2000-09-26 sascha - - * Makefile.am - Zend.m4 - zend_execute.h - zend_gcc_inline.c - zend_operators.h: - Remove --enable-c9x-inline option. We now use a syntax which is compatible - with all compilers by providing the function with static linkage in every - compilation unit. - -2000-09-25 Zeev Suraski - - * zend.c - zend_extensions.c - zend_extensions.h: - Fix previous update - move extension startup further down the startup sequence - - * zend.c: Move extension startup further down the startup sequence - -2000-09-19 Andi Gutmans - - * zend_operators.h: - Add Z_BVAL* macros - -2000-09-19 Stanislav Malyshev - - * zend_execute_locks.h: - Fix crash on Solaris with function parameter destruction - -2000-09-18 Stanislav Malyshev - - * zend_builtin_functions.c: - Made get_included_files() work again, in somewhat different way - -2000-09-17 Stanislav Malyshev - - * zend_compile.c: Set filename even on recursive include - -2000-09-14 Andi Gutmans - - * zend_execute.c: - - Fix NULL handling in ARRAY opcode and resolve memory leak - -2000-09-12 Zeev Suraski - - * zend-scanner.l - zend.c - zend_builtin_functions.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_highlight.h: Make compile_string() accept a description of the code - -2000-09-11 Andi Gutmans - - * zend_compile.c: - - Forgot to create extended info in include()/require() call - -2000-09-10 Stanislav Malyshev - - * zend-parser.y: Allow require_once to take expressions, just like require - - * ZEND_CHANGES: Try once more to remove dups - - * ZEND_CHANGES: Test commit - weed out duplicate messages - -2000-09-09 Zeev Suraski - - * zend.c: Don't use unsafe sprintf() - -2000-09-08 Stanislav Malyshev - - * zend.c: Don't trust snprintf return - -2000-09-06 Andi Gutmans - - * zend_config.w32.h: - Save two lines - - * zend_config.w32.h: - Fix header - -2000-09-06 sascha - - * Zend.m4: Unless overwritten, default to no optimization in debug mode. - -2000-09-05 Andi Gutmans - - * zend_operators.h - zend_operators.c: - Commiting Sterling's new multi_convert* functions - -2000-09-05 Andrei Zmievski - - * zend_builtin_functions.c: Fix memory overrun. - -2000-09-05 Stanislav Malyshev - - * zend_builtin_functions.c: - Fix crash with trigger_error having no args (#6549) - -2000-09-04 Andi Gutmans - - * Makefile.am: - Remove two tabs - -2000-09-02 Andi Gutmans - - * ZendTS.dsp: - - Defining TSRM_WIN32 in each and every dsp sucked. Revert this change - - * ZendTS.dsp: - Fix windows build - -2000-08-31 Andi Gutmans - - * ZendTS.dsp: - - This should fix the performance problem with Release builds - - * zend-scanner.l - zend.c - zend_execute.c: - - Use emalloc() for opened_path now. This was a potential leak before. - - This patch has potential to break stuff but I tested it as much as I - - could. Fixes should be easy. - - * zend.c: - Remove support for __string_value() in print $obj - -2000-08-31 Zeev Suraski - - * zend.c: Safer shutdown process - -2000-08-29 Andi Gutmans - - * zend.h: - Update Zend version. - -2000-08-26 Andi Gutmans - - * zend_builtin_functions.c: - Don't define this function in non-debug mode - -2000-08-24 Andi Gutmans - - * zend_execute.c: - - Revert patch from 9/7/2000 which seems to have broken unset(). - - I hope what made me do this patch doesn't appear again. - -2000-08-22 Andi Gutmans - - * zend_execute_API.c: - - Fix bug report by Andrei when using a method as a sort user function - - parameter in usort() like functions - -2000-08-20 Zeev Suraski - - * zend_config.w32.h: Fix Win32 build - -2000-08-20 sascha - - * zend_config.w32.h: - _isnan seems to be supported on Win32, add an appropiate macro. - - * acconfig.h: If available, use fpclassify for substituting zend_finite. - - * acconfig.h: - Including math.h before using macros defined there will work better :) - - * acconfig.h: Add zend_isinf and zend_isnan. - -2000-08-19 Andrei Zmievski - - * zend-scanner.l: One more fix to C compile. - -2000-08-19 Zeev Suraski - - * zend-scanner.l: Fix C build - - * zend-scanner.l: Fix eval() leakage in ZTS mode - - * zend_compile.c - zend_globals.h: Eliminate run-time leak with eval()'s - - * zend_alloc.c: Fix build with no memory_limit - - * zend_alloc.c: Fix memory_limit - -2000-08-19 Andi Gutmans - - * zend_execute.c: - Beautify - -2000-08-17 Stanislav Malyshev - - * zend_API.h: Fix EMPTY_STRING macros - -2000-08-15 Zeev Suraski - - * zend_extensions.h - zend-scanner.l - zend.c - zend_compile.c - zend_compile.h - zend_execute.c: - Fix warning issue (compile errors inside require()'d files were incorrectly supressed) - -2000-08-14 Zeev Suraski - - * zend_execute.c: - Fix leak and some logic - -2000-08-14 Andi Gutmans - - * zend_compile.c - zend_execute.c: - - This patch should hopefully fix situations where a constructor uses - - the $this pointer as a reference. - -2000-08-14 Stanislav Malyshev - - * zend_execute.c: Fix crash - -2000-08-14 Andi Gutmans - - * zend_compile.c - zend_execute.h: - - Unused results should be marked with EXT_TYPE_UNUSED and not IS_UNUSED - -2000-08-13 Stanislav Malyshev - - * zend-scanner.l - zend.c - zend_compile.c - zend_compile.h - zend_execute.c: Fix zend_fiel_handle handling. Should fix URL include - and various opened_path inconsistencies. - -2000-08-13 Andi Gutmans - - * zend-parser.y: - - Revert foreach() change which only allowed variables and array(...) - -2000-08-11 Andi Gutmans - - * zend-parser.y: - Only support variables and array(...) in foreach loops - -2000-08-10 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c: - Fix problem with nested foreach()'s (Andi, Zend Engine) - - * zend_compile.c: - Fix switch which only has a default rule (Andi, Zend Engine) - Change require_once() to use the same file list as include_once(). - Patch includes making require() & include() to behave the same when it - comes to scoping. require() is now an include() which isn't allowed to fail. - require() caused too many memory reallocations which ended up being quite - slow for sites that required lots of files. (Andi & Zeev, Zend Engine) - - Fix switch() which only has default rule (bug #5879, - -2000-08-09 Zeev Suraski - - * zend_modules.h: that too - - * zend_extensions.h: Update API number - - * zend-parser.y - zend-scanner.l - zend.c - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_opcode.c: - The patch we promised - redesigned the compilation/execution API: - Advantages: - - Smaller memory footprint for the op arrays - - Slightly faster compilation times (due to saved erealloc() calls and faster zend_op - initialization) - - include_once() & require_once() share the same file list - - Consistency between include() and require() - this mostly means that return() - works inside require()'d files just as it does in include() files (it used to - be meaningless in require()'d files, most of the time (see below)) - - Made require() consistent with itself. Before, if the argument was not a constant - string, require() took the include() behavior (with return()). - - Removed lots of duplicate code. - Bottom line - require() and include() are very similar now; require() is simply an include() - which isn't allowed to fail. Due to the erealloc() calls for large op arrays, require() - didn't end up being any faster than include() in the Zend engine. - -2000-08-05 Andi Gutmans - - * zend_execute.c: - - Use some more SEPARATE_ZVAL macros instead of replicated code. - -2000-08-05 Stanislav Malyshev - - * zend_execute.c: Fix memory leak - -2000-08-04 Andi Gutmans - - * zend.h - zend_execute.c: - - Beautify code. Try and use more macros for splitting instead of - - replicating the code everywhere. - -2000-08-02 Andi Gutmans - - * zend_execute.c: - Remove commented code - -2000-07-29 Zeev Suraski - - * zend-scanner.l - zend_execute.c: Fix filename issues - -2000-07-28 Stanislav Malyshev - - * zend_builtin_functions.c - zend_constants.c - zend_constants.h: - Make define return false and issue E_NOTICE when trying to redefine constant - -2000-07-27 Andi Gutmans - - * zend-scanner.l - zend_execute.c: Always store full filename as compiled file name - -2000-07-26 Zeev Suraski - - * zend_compile.c: - Fix a possible issue with runtime inheritence under fairly rare circumstance - and optimize a tiny bit - -2000-07-26 Stanislav Malyshev - - * zend_builtin_functions.c - zend_operators.c - zend_operators.h: Add strncasecmp function - -2000-07-18 Zeev Suraski - - * zend_builtin_functions.c: Forgot to link this function... - - * zend_hash.c: This is probably the oldest bug in PHP :) - Luckily it's unlikely we're ever actually bitten by this bug. - -2000-07-16 Andi Gutmans - - * zend_compile.c: - Beautify Zeev's patch a bit. - -2000-07-16 Zeev Suraski - - * zend_compile.c: Implement parent::foo() - -2000-07-15 Zeev Suraski - - * zend-parser.y - zend_compile.c: Add more extended_info calls - -2000-07-14 Zeev Suraski - - * zend_builtin_functions.c - zend_list.c - zend_list.h: Improve register_resource_ex() infrastructure - -2000-07-12 Thies C. Arntzen - - * zend.c: fix ZTS startup without filename (thanx purify!) - - * zend.c: unset active_symbol_table on zend-shutdown. - -2000-07-11 Zeev Suraski - - * zend_list.c: Another persistent hash - disable apply protection - - * zend.c - zend_hash.c - zend_hash.h: - Disable the hash_apply() protection on hashes that persist across requests - it's unsafe - because we may be aborted at any point - -2000-07-11 Stanislav Malyshev - - * zend_execute.c: - Fix a bug in passing second parameter of RECV_INIT with is_ref set - -2000-07-11 Andi Gutmans - - * zend_compile.h: - Oops. Too early in the morning - - * zend_compile.h: - Include iostream.h in C++. - -2000-07-09 Andi Gutmans - - * zend_execute.c: - Fix memory leak. - - * zend_execute.c: - Need to seperate if the hash isn't a reference - -2000-07-08 Andi Gutmans - - * zend.h: - Add zend_ulong - -2000-07-07 Stanislav Malyshev - - * zend_execute.c: Remove C++ commennts. - -2000-07-06 Andi Gutmans - - * zend-scanner.l: - - Remove code which has never been used (neither in PHP 3) - - * zend_compile.c: - - Make is_method_call() static and remove a couple of old lines - - * zend_execute.c - zend_extensions.h: - Yet another fix... - - * zend_execute.c: - One more... - - * zend_compile.c: - One more fix for the latest patch - - * zend_compile.c: - One dumb bug in my latest patch - - * zend-parser.y - zend_compile.c - zend_execute.c: - - Complex fix for solving a problem with objects & method calls. - - Previous version is tagged PRE_METHOD_CALL_SEPERATE_FIX_PATCH. - - I need to check this fix on a server so if it doesn't work I will revert - - it. - - * zend-scanner.l: - - Fix problem with newlines not being recognized under certain conditions - -2000-07-03 Andi Gutmans - - * zend_compile.c: - Fix bug #4120 - -2000-07-03 Stanislav Malyshev - - * zend_execute_API.c: Unblock SIGPROF signal when starting timer. - On Linux, this signal is blocked by default after first signal is run - -2000-07-03 sascha - - * FlexLexer.h - zend-scanner.h - zend_alloc.h - zend_compile.h - zend_constants.h - zend_dynamic_array.h - zend_execute.h - zend_globals.h - zend_hash.h - zend_highlight.h - zend_list.h - zend_operators.h - zend_static_allocator.h - zend_variables.h: - Replace macros which begin with an underscore through an appropiately - named macro. - -2000-07-02 sascha - - * zend.h - zend_API.h - zend_builtin_functions.h - zend_config.w32.h - zend_dynamic_array.h - zend_errors.h - zend_execute_locks.h - zend_extensions.h - zend_fast_cache.h - zend_globals_macros.h - zend_indent.h - zend_llist.h - zend_modules.h - zend_ptr_stack.h - zend_stack.h: Change header protection macros to conform to standard. - - Draft 3 of IEEE 1003.1 200x, "2.2 The Compilation Environment" - - All identifiers that begin with an underscore and either an uppercase - letter or another underscore are always reserved for any use by the - implementation. - -2000-07-02 Andi Gutmans - - * zend-parser.y: - Take #2 with tab size 4 - - * zend-parser.y: - - Beautify parser a bit. It still could do with some more at some point - - * zend_execute.h - zend_execute_API.c: - Forgot ZEND_API - -2000-06-30 Zeev Suraski - - * zend_config.w32.h: - Add a messagebox style that's safe to use from an ISAPI filter - - * zend_builtin_functions.c - zend_execute_API.c - zend_globals.h: error_reporting fix - -2000-06-29 Zeev Suraski - - * zend.c - zend.h: Add $context argument to error handler - -2000-06-28 Zeev Suraski - - * zend.c: Improve error handling code - - * zend-scanner.l: Be HTML friendly - -2000-06-28 Andi Gutmans - - * zend.h: version update - -2000-06-26 Zeev Suraski - - * zend.h - zend_constants.c - zend_extensions.h: - Make it possible to detect whether we're thread safe or not from PHP scripts and the php.ini - file - -2000-06-26 Andi Gutmans - - * zend_extensions.c: - Add another "\n" at the end of error messages. - -2000-06-26 Zeev Suraski - - * zend_execute_API.c: - Make max_execution_time work properly when set to 0 under Win32 (disable) - -2000-06-25 Andi Gutmans - - * zend.c: - I wrote a long msg but the commit didn't go through. - - So here is the short version: - - a) Start moving to binary opens in Windows - - b) Give checkuid_mode() a small face lift including the fopen-wrappers.c - - The mode to this function should at least be a #define but that is for - - another day. Anyway this whole stuff should be given more face lifts in - - the future. - -2000-06-24 Zeev Suraski - - * zend_alloc.c: Nuke a warning - -2000-06-23 Andi Gutmans - - * zend_static_allocator.c - zend_static_allocator.h: - Not returning a value anymore - - * zend_static_allocator.h: - Don't need SUCCESS/FAILURE anymore - - * zend_static_allocator.c - zend_static_allocator.h: - Add license - - * zend_static_allocator.c - zend_static_allocator.h: - - Commit static allocator structure which we might use in an upcoming Zend - - change - -2000-06-22 Andi Gutmans - - * zend-scanner.l: - Fix asp_tags. - - * zend_extensions.c: - Oops I miss-wrote that field - - * zend_extensions.c - zend_extensions.h: - - Change API version and make the error messages more meaningful. - - * zend_alloc.c - zend_alloc.h: - Change cache size and only initialize part of it. - -2000-06-22 Stanislav Malyshev - - * zend_alloc.c: - Cached-freed memory blocks should not be in "occupied" list - - * zend_alloc.c - zend_globals.h: Make cache counters to be unsigned int - Start collecting statistics after cache pre-fill - -2000-06-18 sascha - - * Zend.m4 - acinclude.m4 - zend.c: fp_except check for FreeBSD 1.0-2.2.5 - - * Zend.m4 - acconfig.h - zend_config.w32.h - zend_operators.h: Welcome zend_finite(n). - - This chooses the best combination of what is available: - - finite, isfinite, isinf, isnan - -2000-06-18 Stanislav Malyshev - - * zend.h - zend.c: Make error callback be publicly accessible - -2000-06-18 Andi Gutmans - - * zend.c: - Better FreeBSD fix. Does fp_except_t exist on 3.4? - - * zend.c: - - I don't know how this happened. I tested the bloody thing and I remember - - copy&pasting from code which used ~. - -2000-06-17 Zeev Suraski - - * zend_builtin_functions.c - zend_execute_API.c - zend_globals.h - zend_ptr_stack.c - zend_ptr_stack.h: - Add restore_error_handler() - error_handler's are now stored in a stack - - * zend-scanner.l - zend.c - zend_API.h - zend_execute_API.c: - Allow the symbol_table to be passed to call_user_function_ex() - - * zend-scanner.h - zend-scanner.l: Fix filenames and line numbers in ZTS mode - - * zend_hash.c - zend_hash.h: - Avoid crashing with recursive applies - limit apply nest level to 3 (I'm not aware of a place - in which applying recursively on the same hash makes sense with more than one nest level, but - 3 should be enough) - -2000-06-16 Zeev Suraski - - * zend.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h: - Ok, this time here's some real Win32 system programming :) - Redesigned the timeout system using a single timeout thread and a single window, - and used a much quicker check. - -2000-06-16 Andi Gutmans - - * zend_execute_API.c: Fix UNIX build - -2000-06-16 Zeev Suraski - - * zend_execute.c: Macro it up the right way - - * zend_execute.c: Macro this up, so it can be moved to other places - - * zend.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h: - Move timeout code to Zend - - Implement timeouts in Win32 - -2000-06-15 Zeev Suraski - - * Zend.dsp - zend.c: - Fix non thread-safe mode - asp_tags/short_tags etc weren't getting initialized properly - -2000-06-15 Andi Gutmans - - * zend_list.c: *** empty log message *** - - * zend-parser.y: - Support multiple arguments to unset() - -2000-06-15 Thies C. Arntzen - - * zend_list.h: ups. - - * zend_list.h: - changed return type of ZEND_VERIFY_RESOURCE from FALSE to NULL - -2000-06-14 sascha - - * zend_operators.h - zend_operators.c: - Move some stuff to zend_operators.h which is required by the - moved inline functions. - -2000-06-14 Andi Gutmans - - * zend_alloc.c - zend_alloc.h: - More correct way of doing bit mask - -2000-06-14 sascha - - * Zend.m4: Only replaced C0X and C0x, but not c0x.. - - * Zend.m4 - zend_execute.h - zend_gcc_inline.c - zend_operators.h: - Rename C0x-inline to C9x-inline, and frame preprocessor directives in - zend_gcc_inline.c with #ifndef C9X_INLINE_SEMANTICS..#endif. - -2000-06-14 Andi Gutmans - - * ZendTS.dsp: - Make Win32 build - -2000-06-13 Andi Gutmans - - * zend_compile.c - zend_compile.h: Add to the API - -2000-06-13 sascha - - * Makefile.am - Zend.m4 - zend_API.h - zend_compile.h - zend_execute.h - zend_execute_API.c - zend_gcc_inline.c - zend_globals.h - zend_operators.c - zend_operators.h: Add optional support for C0x inline semantics. - - These are enabled by specifying `--enable-c0x-inline' on the command - line. We might add an autoconf check for this particular feature - later. - - * zend_llist.h: - Add llist_apply_func_t and make prototypes use the typedefs. - -2000-06-12 Zeev Suraski - - * zend_builtin_functions.c: Make Egon happy :) - - * zend_builtin_functions.c: - Return the previous error handler from set_error_handler() - - * zend_API.c - zend_API.h - zend_builtin_functions.c: - Avoid using E_CORE_* errorlevels in any place which is not in the global startup sequence - - * zend-parser.y - zend-scanner.l - zend.h - zend_compile.c: Get rid of - -2000-06-11 Andi Gutmans - - * zend.c: - Solve floating point precision crash on FreeBSD. - - * zend.c: - - Fixes crash problem on FreeBSD when losing precision. Need to still see - - how to detect we're on FreeBSD - -2000-06-11 Zeev Suraski - - * zend_API.c: Fix zend_get_parameters() - -2000-06-10 Andi Gutmans - - * zend_operators.c: - - Fixed problem when using uninitialized values in comparisons with strings. - - They behave as empty strings again just like in PHP 3. - -2000-06-10 Zeev Suraski - - * zend_execute.c: - I can't think of a reason of why it should just be a notice... Make it a warning, like it was in PHP 3. - - * zend_API.c - zend_builtin_functions.c: Fix bug #4768 - -2000-06-09 Andrei Zmievski - - * zend_builtin_functions.c - zend_hash.h: Made an alias for hash apply with arguments. - -2000-06-09 Andi Gutmans - - * zend_alloc.c: - Forgot to remove the FIXME - - * zend_alloc.c: - Make the memory limit accurate - - * zend_alloc.c: - Fix cache initialization - - * zend_alloc.c - zend_alloc.h: - - Allocate and cache in 8 byte blocks. Most allocators anyway use 8 byte - - blocks. This should help fragmentation and cache hits. - - The old tree is tagged as PRE_EIGHT_BYTE_ALLOC_PATCH - -2000-06-09 Zeev Suraski - - * zend_execute.c: Fix bug #4933 - - * zend_builtin_functions.c: Fixed bug #4819 - -2000-06-09 Andi Gutmans - - * zend_modules.h: - - Time to change it. We changed register_internal_class() -> - - zend_register_internal_class() - - * zend_API.c - zend_API.h - zend_compile.c - zend_compile.h: - Andrei, this is for you! - - Add zend_register_internal_class_ex() which allows you to specify a - - parent to inherit from. You can either specify the parent directly or via - - its name. - - * zend-parser.y - zend-scanner.l: - Typo - - * zend_execute.c: - Remove old obsolete code. - - * zend_execute.c: - Make unset consistent with the way array offsets work - -2000-06-09 Stanislav Malyshev - - * zend_execute.c: Handle unset with empty key - -2000-06-09 Andi Gutmans - - * zend_API.c - zend_API.h: - - Change register_internal_class to zend_register_internal_class for - - consistency. - - Andrei: I'm still thinking about the _ex you want me to implement - -2000-06-08 sascha - - * Zend.m4 - acconfig.h: Clean up acconfig.h - - * zend_execute_API.c - zend_operators.c: Add a couple of casts - -2000-06-06 Zeev Suraski - - * zend.c - zend.h - zend_compile.c: - Enable asp_tags/short_tags/allow_call_time_pass_by_reference to work on a per-directory - basis as well - -2000-06-06 sascha - - * zend_API.c: - Add newline at the end of the file (breaks at least SCO and Tru64 C compiler). - -2000-06-05 Andi Gutmans - - * zend-scanner.l: - Revert internazionalization fix. - - * zend_builtin_functions.c: - Complete change to create_function() - -2000-06-04 Zeev Suraski - - * zend_compile.c - zend_execute_API.c: - Change shutdown order to sort out a crash when assigning a resource id to a static. - - * zend_hash.c - zend_hash.h - zend_operators.c: - Support unordered hash comparisons - - Make == perform an unordered comparison with arrays/objects, and === perform an ordered comparison - - * zend_builtin_functions.c: Rename lambda() - -2000-06-03 Zeev Suraski - - * zend_hash.c - zend_hash.h - zend_operators.c - zend_operators.h: - Support comparisons of arrays (with arrays) and objects (with objects) - -2000-06-03 Andi Gutmans - - * zend.c: - Change #if to #ifdef. - -2000-06-03 Zeev Suraski - - * ZendTS.dsp - zend.c: Don't take chances with new include files - - * zend_execute_API.c: - Improve call_user_function() to support array($obj, $method) - - * zend-parser.y - zend.h - zend_operators.c: - Export normalize_bool - - This global/static syntax fix brought us back to the 4 documented conflicts - - * zend_builtin_functions.c: Fix a lambda() bug - - * zend_builtin_functions.c: Add missing { - - * zend_globals.h - zend_hash.c - ZendTS.dsp - zend-scanner.l - zend.c - zend.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h: - Fix Win32 compilation (Use winsock2.h from now on) - - Add lambda() support - -2000-06-02 Andi Gutmans - - * zend-parser.y: - global/static require a trailing ';' - -2000-06-02 Zeev Suraski - - * zend_builtin_functions.c: Update error code - - * zend.c - zend.h - zend_config.w32.h: Nuke the old error code, use the new one - -2000-05-31 Zeev Suraski - - * zend.h: IS_BC isn't really being used, but still... - - * zend-parser.y - zend.h - zend_API.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.h - zend_variables.c: - Fix a bug in static initializers/default values/class member variables that contained - array values - -2000-05-29 Zeev Suraski - - * zend_API.c - zend_API.h: Allow disabling of functions for security reasons - -2000-05-28 Andi Gutmans - - * zend_operators.c: - - Use pointer arithmetic to speed up the function a bit - - * Zend.m4: - This should have been done for 4.0.0. - - Default build is without debug now. Use --enable-debug if you want a - - debug build which includes leak/memory overwrite etc. detection - -2000-05-26 Andi Gutmans - - * zend-scanner.l - zend_operators.c - zend_operators.h: - - Fixed scanning decimal numbers in internationalized environments. They should - - always be in standard US format e.g. 23.3 - -2000-05-25 Zeev Suraski - - * zend_compile.c: - Fix a crash bug in certain situations of class redeclarations - -2000-05-24 Thies C. Arntzen - - * zend_hash.h: rename hastable -> _hashtable to avoid clashes - - * zend-scanner.l: - add rdbuf() to our own istdiostream implementation, allowing C++ compile - using SUN and SGI native compilers. (by Jayakumar Muthukumarasamy ) - -2000-05-22 Zeev Suraski - - * zend.c: - Remove ugly Ltd. - -2000-05-21 Sam Ruby - - * zend.c: Windows build failure - -2000-05-21 Andi Gutmans - - * zend.c - zend_compile.h: - - Fix Apache php source highlighting mode. It was crashing due to the - - module shutdown functions being called when the startup functions weren't - - being called. - - * zend.h - zend_extensions.h: - Get ready for release - -2000-05-19 Zeev Suraski - - * zend_highlight.c - zend_highlight.h: Open these up for the API - -2000-05-18 Zeev Suraski - - * zend_alloc.c: Do it in thread unsafe mode for now. - -2000-05-18 sascha - - * zend_alloc.c: Kill warnings - -2000-05-18 Andi Gutmans - - * zend_alloc.c: - Do this someplace else. - - * zend_execute.c - zend_operators.c: - - Fix include() when used on resources (shouldn't work but shouldn't crash - either). - -2000-05-18 Andrei Zmievski - - * zend_operators.c: - Update for sort functions - user can now specify sort type. - -2000-05-17 Andi Gutmans - - * zend_operators.h - zend_operators.c: - - Add support for string_compare_function() and number_compare_function(). - UNTESTED! - -2000-05-17 Zeev Suraski - - * zend_operators.c: Normalize results of compare_function() - - * zend-scanner.l: - Fix crash if %> is encountered in HTML while ASP-tags are disabled - -2000-05-17 Andi Gutmans - - * zend_opcode.c: Fix order - -2000-05-17 sascha - - * zend_operators.h: Add missing prototype - -2000-05-16 Zeev Suraski - - * zend_alloc.c: - - Small optimization. Filling up the Cache helps performance. - -2000-05-12 sascha - - * Makefile.am: Fix parallel makes on BSD - -2000-05-11 Zeev Suraski - - * zend-parser.y - zend-scanner.l - zend.h - zend_operators.c: - Get rid of chval - it's really not necessary and seems to be confusing people - - * zend_compile.c: Refined fix - - * zend_compile.c: - Fix a memory corruption bug with by-ref function arguments - -2000-05-10 Andi Gutmans - - * zend_extensions.h: - Bump up Zend extension version number - -2000-05-10 Thies C. Arntzen - - * zend_compile.c: make waning readable - -2000-05-08 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_opcode.c: Thoroughly initialize IS_UNUSED for proper cleanup - - * zend.h: - Change Zend Engine version number - - * zend_alloc.c: - Return real size allocated - -2000-05-08 Zeev Suraski - - * zend_operators.c: Make zend_binary_strcasecmp compile again - -2000-05-08 sascha - - * zend_operators.c: Make strcasecmp() act correctly WRT SUS II. - - Patch by: hholzgra@php.net - PR: #3556 - -2000-05-06 Andi Gutmans - - * zend_execute.h - zend_execute_API.c: - Make zend_eval_string() return SUCCESS/FAILURE - - * zend_execute.c: - - Make $obj->test = 5; work again (assigning to uninitialized objects) - -2000-05-05 sascha - - * Zend.m4: - Linking directly against libc might result in unexpected behaviour. - We check for dlopen in libdl first, and check then whether dlopen exists. - -2000-05-03 Andi Gutmans - - * zend_compile.h: - Change fetch_type to be zend_uint - - * zend_compile.c - zend_execute.c: - Change the place CAST uses for the op_type - -2000-05-02 Zeev Suraski - - * zend_hash.c - zend_hash.h: - Change zend_hash_get_current_key_ex() to also return the string length - -2000-05-02 sascha - - * zend_API.c: - Fix segfault occuring when a temporary module was unloaded and if this - module did not have a request shutdown function. - - * zend_API.h: - Add ZEND_GET_MODULE(name). This is a short-cut for the common - get_module function. - -2000-05-01 sascha - - * zend.c: - Source file does not end with a newline. Some old compilers don't like that. - -2000-05-01 Andrei Zmievski - - * zend_builtin_functions.c: Added a way to get all declared classes. - -2000-05-01 sascha - - * Makefile.am: Fix dependency - -2000-04-29 Zeev Suraski - - * zend_extensions.h - zend_opcode.c: - Pass the op_array to the ctor/dtor, instead of just the resource - - * zend_extensions.c: crash fix - - * zend_extensions.c - zend_extensions.h - zend_llist.c - zend_llist.h: - Add zend_llist_apply_with_arguments() - - Add a message handler to the extensions - - * zend_compile.h - zend_opcode.c: - Fix possible bug with extension dtors being called without the ctors being called first - - * zend-scanner.l - zend_compile.c - zend_compile.h - zend_opcode.c: Beautify - -2000-04-28 Zeev Suraski - - * zend.c - zend_extensions.c - zend_extensions.h: Fix a bug in the resource dispencer - - * zend_operators.c - zend_operators.h: Make convert_to_string() allocations traceable - -2000-04-27 Zeev Suraski - - * zend_extensions.h - zend-scanner.l - zend.c - zend_compile.c - zend_compile.h - zend_execute.c: *** empty log message *** - - * zend-scanner.l - zend_compile.c - zend_compile.h - zend_execute.c: Change to using the #define's - - * zend.c - zend.h: More error handling work (still completely disabled) - -2000-04-26 Zeev Suraski - - * zend_execute_API.c - zend_variables.c: Fix - forgot to split away if refcount>1 - -2000-04-25 Zeev Suraski - - * zend_extensions.c: Fix bug - - * zend.h: We'll need two... - - * zend_hash.h: Add useful macros - -2000-04-25 Andi Gutmans - - * zend_llist.c: - Fix persistence of llist - -2000-04-24 Zeev Suraski - - * zend_compile.c: - Forgot to keep the ':' in the class_name - - * zend_API.c: Correct fix - -2000-04-24 Thies C. Arntzen - - * zend_API.c: MODULE_TEMPORARY should get a call to RSHUTDOWN as well! - - * zend.c: - fixed shutdown crash if MSHUTDOWN tries to php_error() something. - -2000-04-21 Thies C. Arntzen - - * zend_variables.c - zend_variables.h: export zval_add-ref and zvale_del_ref - -2000-04-20 Zeev Suraski - - * zend_operators.h: - Change macro names from Z to Z_ - - * zend_operators.h: Add some macros for nicer zval handling - -2000-04-20 Andrei Zmievski - - * zend_operators.c: Do proper ieeefp.h check. - -2000-04-20 Thies C. Arntzen - - * zend_operators.c: - compile before commit! compile before commit! compile before commit! - - * zend_operators.c: - revert andrei's path (i can't compile anymore on linux) - we're always using #ifndef HAVE_BLA instead of if !HAVE_BLA and if we need ieeefp.h for some weird platform (which one is that?) we need an autoconf check for it. - -2000-04-19 Andrei Zmievski - - * zend_operators.c: Include proper files for finite. - -2000-04-19 Zeev Suraski - - * zend.c - zend.h - zend_builtin_functions.c - zend_execute_API.c - zend_globals.h: - Initial support for trapping errors (not complete and disabled; will be enabled only - post-PHP 4.0.0) - - * zend_builtin_functions.c - zend_constants.c - zend_errors.h: - - Renamed get_used_files() to get_required_files() for consistency - - Documented some functions - - Added user-level warning messages - - Added user_error() - -2000-04-19 Andi Gutmans - - * zend_opcode.c - zend_compile.h: - Export pass_include() for Windows - -2000-04-18 Zeev Suraski - - * zend_operators.h: - Add convert_to_writable_*_ex() macros (unused at this time) - -2000-04-17 Andi Gutmans - - * zend_compile.c - zend_execute.c: - Fix order of JMPZNZ arguments - -2000-04-17 Thies C. Arntzen - - * zend_operators.c: ups, finite is already a macro on Win32 - - * Zend.m4 - zend_operators.c: HPUX11 only has isfinite() - -2000-04-15 Andi Gutmans - - * zend-scanner.l: - Fix leak in require_once() - -2000-04-15 Thies C. Arntzen - - * zend_extensions.c: fixes compile on platforms without dl() support. - -2000-04-15 Zeev Suraski - - * zend.c: Fix ZTS - -2000-04-15 Andi Gutmans - - * zend-scanner.l: - "use" is not yet supported; instead use include_once() or require_once() - for the time being (Andi, Zend library) - -2000-04-15 Zeev Suraski - - * zend.c - zend_API.c - zend_compile.c - zend_execute_API.c - zend_list.c - zend_list.h: - Clean up resource lists namespace - - Prepare extended resource list destructor APIs (currently unused) - -2000-04-13 Zeev Suraski - - * zend_operators.c: - Fix a memory leak when using assign-op bitwise operators on strings - -2000-04-12 Zeev Suraski - - * zend_execute.c: *** empty log message *** - -2000-04-11 Andi Gutmans - - * zend_execute_API.c: - Fix memory leak - -2000-04-11 Zeev Suraski - - * zend_execute.c: Fix warnings - - * zend_execute.c: Fix fd leak in include_once() - -2000-04-10 Andi Gutmans - - * zend-scanner.l - zend_execute.c: - - -2000-04-10 Zeev Suraski - - * zend.h - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_operators.c: Fix object overloading support - -2000-04-10 Andi Gutmans - - * zend_execute.c: - Add warnings - - * zend_compile.c: - Two more places needed changing - -2000-04-10 Zeev Suraski - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.h: Clean up last/size definitions - -2000-04-09 Zeev Suraski - - * zend_compile.h: *** empty log message *** - -2000-04-07 Zeev Suraski - - * zend_execute.c: Thoroughly fix include_once() - - * zend_execute.c: Fix include_once() - -2000-04-06 Andi Gutmans - - * zend-parser.y: *** empty log message *** - - * zend_execute.c - zend_execute.h: Initial preparation for OO overloading patch - -2000-04-05 Andi Gutmans - - * zend_extensions.h: - Bump up version number - - * zend_compile.c - zend_execute.c: - FIx JMPZNZ - -2000-04-03 Zeev Suraski - - * zend_list.c: - Fix the problem with dl()'d modules not freeing their resources properly - -2000-04-01 Zeev Suraski - - * zend_API.h - zend_config.w32.h: *** empty log message *** - - * acconfig.h: Have a standard way of exporting symbols - - * zend_modules.h: Use int - - * zend_API.h: Generalize some common thread-safety stuff - - * zend_modules.h: Have a standard entry for the globals id - -2000-03-31 Zeev Suraski - - * zend_compile.c: - The previous fix ended up being broken, this one should do it - -2000-03-31 Andi Gutmans - - * zend_compile.c: - Fix bug - -2000-03-30 Zeev Suraski - - * zend_extensions.c: Fix zend_register_extension() - -2000-03-30 Andi Gutmans - - * zend_extensions.h: - Bump up API number after Lars' change - -2000-03-30 sascha - - * Makefile.am: Give another hint to BSD makes - - * Makefile.am: - Specifically mention $(srcdir), so that OpenBSD's make gets it - -2000-03-29 Zeev Suraski - - * zend_stack.c - zend_stack.h - zend_compile.c: - - Make the argument order for the stack applies more consistent with other Zend - data structures - - Fix a possible corruption problem due to switch() C-level optimization - -2000-03-29 Torben Wilson - - * zend-parser.y - zend-scanner.l - zend_compile.h - zend_execute.c - zend_opcode.c - zend_operators.c - zend_operators.h: - - Added !== (is not identical) operator. - -2000-03-29 Zeev Suraski - - * zend_extensions.c - zend_extensions.h: *** empty log message *** - -2000-03-29 Andi Gutmans - - * zend_API.h: - - Make sure zend_API.h has Zend'ish versions of the ZEND macros so that - Zend'ish modules don't need to mix PHP & Zend notation. - -2000-03-28 Zeev Suraski - - * zend_builtin_functions.c: - The checks for func_num_args() and friends were broken - fixed - -2000-03-27 Sam Ruby - - * Zend.dsp: Remove debug libraries from debug build - -2000-03-26 Andi Gutmans - - * zend_execute.c - zend_execute_API.c - zend_API.c - zend_builtin_functions.c: - Stop zend_func_args() and co. from crashing - - * zend.h: - - Didn't see Thies' commit message although I can't really see how it would - make a difference - - * zend.h - zend_opcode.c: - Include Andrea's fix for alloca.h - -2000-03-26 Thies C. Arntzen - - * zend.h - zend_execute.c: - needs to be included before we define macros calling alloca() - atleast using SGI's cc - should not harm other platforms (i hope) - - * zend_opcode.c: fix cast - -2000-03-25 Andi Gutmans - - * zend_alloc.c - zend_alloc.h: *** empty log message *** - -2000-03-25 Zeev Suraski - - * zend-parser.y - zend.c - zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_opcode.c - zend_variables.c: - Some header dependencies cleanup - - Generalize zval_print() and zval_print_r() - -2000-03-25 Sam Ruby - - * zend.h: RTLD_NOW => RTLD_LAZY|RTLD_GLOBAL - -2000-03-25 Zeev Suraski - - * Zend.dsp: Update dsp's - -2000-03-24 Zeev Suraski - - * zend_execute.c: - - Fixed a crash when sending a non-variable expression to a runtime-bound function - that expected a reference. - -2000-03-24 Andi Gutmans - - * zend_API.c - zend_builtin_functions.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_hash.c - zend_hash.h: - Nuke hash_*_ptr functions - -2000-03-23 Andrei Zmievski - - * zend_builtin_functions.c: Use WRONG_PARAM_COUNT. - -2000-03-23 Zeev Suraski - - * zend_builtin_functions.c: - Make it compile - -2000-03-23 Andrei Zmievski - - * zend_builtin_functions.c: Added get_class_methods(). - -2000-03-22 Andi Gutmans - - * zend.h: - Change Zend version as API has changed - -2000-03-22 Zeev Suraski - - * zend_operators.c: - Wrong fix - - * zend_operators.c: - Only free when result != op1 - -2000-03-21 Andi Gutmans - - * zend.c - zend.h: - - Change zend_startup to accept a flag for starting builtin functions - - * zend.h - zend_API.h: - Move #defines - -2000-03-19 Thies C. Arntzen - - * zend_compile.h: kill warning - -2000-03-18 Andi Gutmans - - * zend.h: - Fix compile problem on FreeBSD - - * zend.h: - - No reason for refcount to be signed and move to zend_* typedefs - -2000-03-18 Thies C. Arntzen - - * zend.c: renamed _string_value_() to __string_value(). - -2000-03-18 Zeev Suraski - - * zend_builtin_functions.c: - The third argument to define() wasn't working right, fixed - - * zend_execute.c: - false wouldn't automaticaly switch to an array type, which resulted in an - incompatibility with PHP 3. Fixed. - -2000-03-16 Thies C. Arntzen - - * zend.c: renamed "to_string" -> "_string_value_" - -2000-03-15 Zeev Suraski - - * zend-scanner.l - zend.h - zend_execute.c: - Fix newly introduced problem reported by Sam Ruby - -2000-03-15 Andrei Zmievski - - * zend_hash.c - zend_hash.h: - Make zend_hash_move_forward()/zenv_hash_move_backwards() a little smarter. - -2000-03-15 Zeev Suraski - - * zend_opcode.c: - Fix warning (I thought I fixed this one before) - -2000-03-14 Andrei Zmievski - - * zend_llist.c - zend_llist.h: Implemented external list traversing. - -2000-03-14 Andi Gutmans - - * zend-parser.y: - - Allow array(1,2,3,) i.e. with trailing comma. You can only have one - trailing comma. - -2000-03-13 Zeev Suraski - - * zend_compile.c: - - - * zend_compile.c: - Spare a byte :) - -2000-03-13 Andi Gutmans - - * zend_compile.h - zend_modules.h: - Another zend_uchar - - * zend_compile.c: *** empty log message *** - - * zend.h - zend_compile.h: - - define zend_uint and zend_uchar and use them in a few places - -2000-03-13 Andrei Zmievski - - * zend_hash.c - zend_hash.h: - Introduced a way to traverse hashes through external pointers. - -2000-03-13 Andi Gutmans - - * zend_compile.h: - Change type from int -> char - -2000-03-13 Zeev Suraski - - * zend-scanner.l: - Fix filename/lineno initialization for do_return - -2000-03-12 Zeev Suraski - - * zend_builtin_functions.c - zend_modules.h: - - -2000-03-11 Andi Gutmans - - * zend_execute.c: - - Remove inline from functions which are pretty large and besides eating up - memory in compile time probably doesn't boost performance. - -2000-03-10 Andi Gutmans - - * zend_operators.c: - - Seems to be a problem here with the return value not being set - - * zend-parser.y - zend_builtin_functions.c - zend_execute.c - zend_execute_API.c - zend_globals.h: - Quick way of supporting include_once(). - Good enough for RC1. - - * zend-parser.y - zend-scanner.l - zend_compile.c - zend_compile.h: - Support require_once(). - - * zend_compile.h - zend_execute.c: - Cleanup old IMPORT stuff - - * zend-parser.y - zend-scanner.l: - - Nuke import, add include_once and include_require scanner/parser rules. - Hope to nuke use too :) - - * zend_modules.h: - That broke the Win32 build - - * zend_modules.h: - Fix a bug and define an API_NO for the ZEND_MODULE_API - - * zend_modules.h: - zend_config.h is enough - - * zend_modules.h: - Save ZEND_DEBUG, ZTS, ZEND_API information - -2000-03-09 Andi Gutmans - - * zend_highlight.c: - Fix bug in syntax highlighter - -2000-03-06 stig - - * zend_modules.h: added GINIT_FUNC_ARGS and GINIT_FUNC_ARGS_PASSTHRU - -2000-03-06 Zeev Suraski - - * zend_extensions.h: - Bump up Zend's API version - -2000-03-06 stig - - * zend_modules.h: Added ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU. - -2000-03-06 Andi Gutmans - - * zend-scanner.l: - Fix memory leak - - * zend.c: - Missed one - -2000-03-06 Sam Ruby - - * zend.c - zend.h: Unresolved externs - -2000-03-06 Zeev Suraski - - * zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_variables.c - zend_variables.h - LICENSE - zend-parser.y - zend-scanner.h - zend-scanner.l - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_modules.h: It's official now... - -2000-03-05 Zeev Suraski - - * ZendTS.dsp - zend.c - zend.h: Wrap some commonly unused callbacks - -2000-03-04 Zeev Suraski - - * zend-scanner.l: - The default return value from include() and eval() changed from 1 to 0 - unintentionally after the old return-reference patches - fixed - -2000-03-02 Sam Ruby - - * zend_config.w32.h: Fix Win32 build breakage - -2000-03-01 Andi Gutmans - - * zend.c: - Upgrade to year 2000 - - * ZEND_CHANGES - zend_compile.c - zend_execute.c: - Fix typos - -2000-03-01 Thies C. Arntzen - - * zend_operators.c: now - -2000-02-27 Egon Schmid - - * zend_builtin_functions.c: Fixed some protos. - -2000-02-26 Sam Ruby - - * zend_builtin_functions.c: compilation error - Win32 - -2000-02-26 Andrei Zmievski - - * zend_builtin_functions.c: - Added get_class_vars() and get_object_vars() functions. - - * zend_execute.c: Fix typo. - -2000-02-26 Zeev Suraski - - * zend_operators.c: Fix comparisons of "inf"=="inf" and "-inf"=="-inf" - -2000-02-25 Zeev Suraski - - * zend_fast_cache.h - zend_variables.c: Use the fast cache here too - -2000-02-19 Zeev Suraski - - * zend-parser.y - zend-scanner.h - zend-scanner.l - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_modules.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_variables.c - zend_variables.h: (c) patch - - * zend_API.c - zend_API.h - zend_fast_cache.h - zend_hash.c: - - Fix a nasty bug in the hash, introduced in the recent migration to macros - - Make array_init() and friends trackable - - * zend_API.c - zend_API.h - zend_execute.c - zend_operators.c - zend_operators.h: Generalize macros - -2000-02-18 Zeev Suraski - - * zend-scanner.l: *** empty log message *** - -2000-02-18 sascha - - * zend_llist.c - zend_llist.h: - Get rid of second declaration of compare_func_t. Either put in a common - header file or prefix it with i.e. zend_llist_ - -2000-02-18 Andi Gutmans - - * zend_llist.c - zend_llist.h: - - Quick and dirty hack for supporting sorts. Improve later on when I wake up. - - * ZendTS.dsp - zend_dynamic_array.c: - Didn't compile on Win32 - - * zend_dynamic_array.c: - - Tiny change (I know I don't have to cast malloc() to void * but I like - casting my malloc()'s) - - * Makefile.am - zend_dynamic_array.c - zend_dynamic_array.h: - - Preliminary support for dynamic arrays. I need it on order to try out a - new hash implementation. It isn't used anywhere. - -2000-02-17 Andi Gutmans - - * zend.c - zend.h: - Add ZEND_API - -2000-02-16 Andi Gutmans - - * zend_execute.c: -Fix bug 3504 concerning leaks with unset() - - * zend_execute.c - zend.h - zend_compile.h: - Hopefully fix Thies' bug report. - -2000-02-16 Zeev Suraski - - * zend_builtin_functions.c: - ZEND_TEST_EXCEPTIONS should be defined/undefined before it's checked - -2000-02-16 Andi Gutmans - - * zend_execute.c: - Fix bug #3309 - -2000-02-14 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c: - - Put in the infrastructure for the unset() fix. Right now it has the old - behavior but I just need time tomorrow to add the correct behavior. - - * zend_builtin_functions.c: - Fix bug in func_get_arg() - - Get rid of compiler warnings for unused function crash() - -2000-02-13 Zeev Suraski - - * zend_constants.c: Fix a memory leak - -2000-02-13 Andi Gutmans - - * zend_hash.c: - Save a function call one very hash_add - - * zend_hash.c - zend_hash.h: - - Make startup a bit faster by changing some hash_update()'s and hash_add()'s - to hash_update_ptr()/hash_add_ptr() - - * zend_hash.c: - - Fix a couple of potential bugs where we were using emalloc/efree instead - of pemalloc/pefree. - - Fix a bug were we potentially would be freeing the key by mistake - -2000-02-13 Zeev Suraski - - * zend_builtin_functions.c: *** empty log message *** - - * zend_operators.c: Make (array) false == array() and not array(false) - -2000-02-11 Andrei Zmievski - - * zend_hash.c - zend_hash.h: Made a couple of typedefs for zend_hash_apply_*() calls. - -2000-02-11 Zeev Suraski - - * Zend.dsp - ZendTS.dsp - zend_config.w32.h: Update .dsp's - - * zend-scanner.l - zend.h - zend_API.h - zend_alloc.c - zend_config.w32.h - zend_constants.c - zend_execute.c - zend_extensions.c: Fine tune Andi's patch - -2000-02-10 Andi Gutmans - - * zend.h: - #define ZEND_WIN32 differently - - * zend-scanner.l - zend.h - zend_API.h - zend_alloc.c - zend_constants.c - zend_execute.c - zend_extensions.c: - Finally beautify those WIN32|WINNT checks - - * zend_execute.c: - Shouldn't be there - - * zend_execute.c: - Cleanup the code - -2000-02-09 Zeev Suraski - - * zend-parser.y - zend_execute.c: - Fix last known nasty bugs in Zend. It'll be cool if there are no new ones :) - -2000-02-09 Thies C. Arntzen - - * zend_execute.c: foreach() works now for objects as well. - -2000-02-08 Zeev Suraski - - * zend_operators.c: Fix declaration - - * zend_execute.c: Fix an elusive bug - -2000-02-08 Andrei Zmievski - - * zend_operators.c: Fix up the patch. - - * zend_builtin_functions.c - zend_operators.c - zend_operators.h: Patches from Walter for strncmp() stuff. - -2000-02-07 Zeev Suraski - - * zend_highlight.c: Remove old unnecessary check - - * zend-parser.y - zend-scanner.l - zend_compile.c - zend_highlight.c: - Syntax highlighting was erronously emitting more than one semicolon and/or garbage with heredocs - -2000-02-06 Andi Gutmans - - * zend_compile.c: - - Support the string offset syntax $a{2} with the regular array opcodes. - Will need to write new opcodes sometime but right now it's good enough - to announce the change to this string offset syntax for beta 4. - -2000-02-05 Andi Gutmans - - * zend-parser.y - zend_compile.c: - - This hopefully fixes the list($a, $a) = array(1,2) crash, i.e. when list - by mistake contains the same variable twice. - - BTW, there is no defined order of assignment. The value of $a after the - previous example is undefined, and should not be assumed to be either 1 - nor 2. - -2000-02-05 Zeev Suraski - - * zend_execute.c: More cleanup - - * zend.h - zend_builtin_functions.c - zend_execute.c - zend_execute_API.c: Pass the executor globals to internal functions - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_hash.c - zend_hash.h - zend_modules.h - zend_variables.c: - Stop passing list/plist to internal functions - - Add a typedef for the pCopyConstructor function pointer - - Minor hacks - - * zend-scanner.l: - That was the broken downcasting that prevented the interactive C++ mode from working properly under UNIX - -2000-02-04 Zeev Suraski - - * zend-scanner.l - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_opcode.c: - Maintain a state of whether we're compiling and/or executing - -2000-02-03 Andrei Zmievski - - * zend_API.c - zend_API.h: *** empty log message *** - -2000-02-02 Zeev Suraski - - * zend_API.c: - Fix built-in classes with more than 5 methods - - * zend_compile.c: - - Fix the annoying problem with list(), that surfaced up after our recent cleaning - patches - -2000-02-01 Andrei Zmievski - - * zend_API.c - zend_API.h: Added add_property_unset() and add_property_bool(). - -2000-02-01 Zeev Suraski - - * ZendTS.dsp - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_execute_locks.h: Improve dependencies - - * zend_execute.c: Sort out a gdb problem - - * zend_execute.c: Fix warning - -2000-02-01 Andi Gutmans - - * zend_compile.c - zend_execute_API.c - zend_globals.h: - Get rid of remains of garbage. - - This should fix Thies' UMR - -2000-02-01 Thies C. Arntzen - - * zend_execute_API.c: - moved destroying of garbage before resource-list gets destroyed - (see my previous mail) - zeev, andi - please comment! - - * zend.c: added missing break. - - * zend_hash.c - zend_hash.h: - took out zend_hash_pointer_update() & zend_hash_pointer_index_update_or_next_insert() - i really prefer link-errors instead of runtime-errors, don't you? - -2000-01-31 Andi Gutmans - - * zend_compile.h: - This has to always be done. - -2000-01-31 Zeev Suraski - - * zend-parser.y - zend_compile.h - zend_execute.c - zend_execute_API.c: - Optimized garbage mechanism - - Fixed another buglet in the parser - - * zend-parser.y - zend_alloc.c - zend_execute.c - zend_fast_cache.h: - Fix foreach() - - Fix indirect reference with object properties - -2000-01-30 Andi Gutmans - - * zend_execute.c: - - Fix the bug Thies found where I forgot to change a break; to NEXT_OPCODE(); - - If you find anymore let me know - - * zend_alloc.h: - Run it on align_test - -2000-01-29 Zeev Suraski - - * zend_compile.c: Fix ``'s - - * zend-parser.y - zend-scanner.l - zend_compile.h: Fix require() - -2000-01-29 Andi Gutmans - - * zend-parser.y: - Get rid of another rule which isn't needed. - - * zend-parser.y - zend_compile.c - zend_compile.h: - - Add parser support for string offsets. This added three shift/reduce - conflicts but they all seem to be fine. - - Cleaned up the parsing rules a bit and made them much more compact and - elegant. - - Please CVS update and see that I didn't break anything. - - * zend_alloc.h: - - This will save some memory w/ GCC compilers on some platforms - - * zend_execute.c: - Yet another tiny optimization. - -2000-01-28 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_execute.c: - Make loop a bit faster. - - * zend.h: - Make sure its use is understood. - - * zend.h - zend_execute.c: - Double the speed of some key switch() tests for Win32. - - * zend_execute.c: - - This makes the switch() statement twice as quick. Moving to enum - might make this a general speed up for other platforms too - -2000-01-26 Andi Gutmans - - * zend_execute_API.c: - Keep objects as references. - - * zend_execute_API.c - zend_opcode.c: - - Allow is_ref to become 0 in case the refcount is back to 1. - -2000-01-24 Andi Gutmans - - * zend_compile.c - zend_execute.c: - - Make foreach() now copy the array but use the original array. It can - still be optimized A LOT but it's only a performance issue and not - a feature issue. - -2000-01-24 Zeev Suraski - - * zend-parser.y - zend-scanner.l - zend.c - zend.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_operators.c - zend_operators.h: - Implement declare() with declarables framework - - Implement ticks - Germany&Norway - 5 points! - - * zend_execute.c - zend_execute_API.c: Fixes - -2000-01-22 Zeev Suraski - - * zend_execute_API.c: Fix an elusive bug - -2000-01-20 Zeev Suraski - - * zend_hash.c: Add some order... - - * zend_hash.c: Indentation fixes - -2000-01-19 Andi Gutmans - - * zend_hash.c: - Optimize zend_hash_del a tiny bit. - - * zend_hash.c - zend_hash.h: - Hopefully fix the hash problem. - - * zend_hash.c: - Hrm I'm not concentrating - - * zend_hash.c: - - Actually the destructor should run after the data is already detached - from the hash but before the bucket is freed. - - * zend_hash.c: - - Rollback hash_apply and friends. They assume now that hash_del is reentrant - as it first applies the destructor and only later nukes the bucket - - * zend_hash.c: - - Run destructor before the hash structure is modified, thus, making - hash_del, reentrant (BLOCK_INTERRUPTIONS needs to be made a counter now). - - * zend_hash.c: - Undo a bug we introduced. (Another one out there). - -2000-01-19 Thies C. Arntzen - - * zend_API.h: - RETURN_NULL -> RETURN_NULL() // we don't want macros without an argumnet - -2000-01-18 Zeev Suraski - - * zend_execute.c: Leak fix - -2000-01-18 Thies C. Arntzen - - * zend_API.h: RETURN_NULL & RETVAL_NULL don't need (). - -2000-01-17 Thies C. Arntzen - - * zend_hash.c: use defines - -2000-01-17 Zeev Suraski - - * zend_hash.c - zend_hash.h - zend_variables.c: Get rid of the IsPointer functionality in the hash. - - * zend_hash.c: - Fixes a newly introduced bug in the hash - - * zend_compile.c - zend_compile.h - zend_constants.c - zend_constants.h - zend_execute_API.c - zend_hash.c - zend_hash.h - zend_list.c - zend_list.h - zend_modules.h - zend_opcode.c - zend_variables.c - zend_variables.h: - Destructors no longer return ints, the low level problem it was intended to solve is long gone now... - -2000-01-16 Zeev Suraski - - * zend.c - zend_execute_API.c - zend_hash.c - zend_hash.h - zend_list.c - zend_list.h: - - Make zend_hash_apply() (and friends) reentrant and much, much quicker - - Introduce zend_hash_graceful_destroy(), which allows the destructor functions to - use zend_hash_apply() and/or zend_hash_graceful_destroy() - - Switch to zend_hash_graceful_destroy() in the resource list shutdowns - - * zend.c - zend_compile.c - zend_compile.h: - Allow module startup to be separate from the compiler/executor startup - -2000-01-16 Thies C. Arntzen - - * zend_hash.c: make the ht->inconsistent stuff less ugly:) - -2000-01-15 Zeev Suraski - - * zend_execute_API.c - zend_list.c: Fix a bug in call_user_function_ex() - - * zend-parser.y: - Added support for $foo->{$bar}["foobar"] notation (was supported in PHP 3) - -2000-01-15 Thies C. Arntzen - - * zend_hash.c - zend_hash.h: - if ZEND_DEBUG mode is on we'll now see warnings when a HashTable is accessed - while it's inconsistent. - - Zeev, Andi - you welcome to revert this patch if you don't like it - i find it - useful! accesssing inconsistent hashtables is one of the hardest things to track! - -2000-01-14 Andrei Zmievski - - * zend_highlight.c: - Since we're highlighting code, put and around the code. - -2000-01-13 Zeev Suraski - - * zend.h - zend_config.w32.h: Make Win32 compile again - -2000-01-12 sascha - - * acconfig.h - zend.h: - Move dl stuff from acconfig.h into zend.h. That allows us finer control - when it comes to suppressing dlfcn.h. - -2000-01-09 Zeev Suraski - - * zend_execute.c: Functionality & crash fixes - -2000-01-04 Andi Gutmans - - * zend.h - zend_operators.c: - - Rename IS_BC to FLAG_IS_BC. We will probably nuke it. - -2000-01-04 Thies C. Arntzen - - * zend_API.h: added ZVAL_*() macros. - -2000-01-04 Andi Gutmans - - * zend.h - zend_execute.c: - - Separate the overloaded objects' types from Zend's data types. - There is no reason for them to be the same, and IS_METHOD just cluttered - there data types. - - * zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_operators.c - zend_variables.c - zend-parser.y - zend.c: - Change IS_UNSET -> IS_NULL - -2000-01-03 Zeev Suraski - - * zend_execute.c: Fix a bug when using [] on a string - -2000-01-03 Joey Smith - - * zend_operators.c: number.h comes from ext/bcmath, not functions/ - -2000-01-03 Zeev Suraski - - * zend_execute.c: Fix - -2000-01-03 Andi Gutmans - - * zend_operators.c: - Fix compare_function() for IS_UNSET - -2000-01-02 Zeev Suraski - - * zend_execute.c: Fix - -2000-01-02 Thies C. Arntzen - - * zend_API.h: renamed RET???_UNSET -> RET???_NULL - -2000-01-01 sascha - - * Zend.m4 - acconfig.h - acinclude.m4: Some cleanup - -2000-01-01 Andi Gutmans - - * zend_operators.c: - - IS_NULL should be 0 when converted to a long although I don't think it - really should be documented. - -2000-01-01 Zeev Suraski - - * zend_operators.c: Fix buglet - -1999-12-31 Zeev Suraski - - * Zend.dsp - ZendTS.dsp: .dsp updates - - * Zend.dsp - ZendTS.dsp - zend_config.w32.h: - Add Release_inline builds - - * zend-parser.y - zend-scanner.l - zend.c - zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_operators.c - zend_operators.h - zend_variables.c: - Nuke undefined_variable_string - - Introduce IS_UNSET - -1999-12-31 Andi Gutmans - - * ZendTS.dsp - zend-parser.y - zend_compile.c - zend_compile.h: - - Fix bug #3073. continue in do..while() loops should work now - -1999-12-30 Zeev Suraski - - * zend.c - zend_alloc.c - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h: - This should enable people to use ALLOC_ZVAL() in code outside the php4.dll - -1999-12-30 sascha - - * Zend.m4: - Solaris' sed does not like this expression. Since -O0 is the default, - we can also omit it. - -1999-12-29 Zeev Suraski - - * zend_variables.c: - - Change var_reset() to set bool(0) instead of string("") - - Authors should go over their code and change it to use var_reset() instead of manually - setting it to string(""), in case they're interested in the false value. - - * zend_alloc.c: time_t is an int under Linux... this should always work. - -1999-12-28 sascha - - * zend_alloc.c: Fix warnings - -1999-12-28 Thies C. Arntzen - - * zend_API.h - zend_constants.c: new constant: SQL_NULL - new macros: RETURN_SQLNULL,RETVAL_SQLNULL,IS_SQLNULL - -1999-12-27 Zeev Suraski - - * zend_fast_cache.h: Fix - -1999-12-27 Andi Gutmans - - * zend_API.c: - Get rid of warning - -1999-12-27 Zeev Suraski - - * Zend.dsp - ZendTS.dsp - zend_API.c - zend_API.h - zend_alloc.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_fast_cache.h - zend_globals.h - zend_opcode.c - zend_operators.c - zend_variables.c - zend_zval_alloc.h: - Generalize the fast cache mechanism - - Add the HashTable struct to the fast cache mechanism - -1999-12-27 Andi Gutmans - - * zend_API.c: - - Make zend_internal_function allocate a full zend_function structure so - that we don't get memory overruns and Thies doesn't get angry :) - -1999-12-27 Zeev Suraski - - * zend_alloc.c: *** empty log message *** - - * zend_globals.h - zend_zval_alloc.h - zend_alloc.c: Add cache statistics support - -1999-12-27 Thies C. Arntzen - - * zend.c: fix UMR in ZTS mode - -1999-12-26 Zeev Suraski - - * Zend.dsp - ZendTS.dsp - zend_alloc.c - zend_globals.h - zend_zval_alloc.h: - - Enable the new zval cache on debug too. No real reason not to, and it keeps - the code cleaner. - - ZTS compile fixes - - * zend_alloc.c: Fix buglet - - * zend_zval_alloc.h: Add missing file - - * zend.h - zend_API.h - zend_alloc.c - zend_compile.c - zend_execute.c - zend_globals.h - zend_operators.c: - Introduce a zval-specific cache - 5-15% speed improvement - -1999-12-26 sascha - - * Makefile.am - acinclude.m4: Makefile.am: Add dummy target for dependencies - acinclude.m4: Cache result of broken sprintf check - -1999-12-26 Zeev Suraski - - * zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_operators.c: Change ALLOC_ZVAL() semantics - - * zend_alloc.c - zend_alloc.h - zend_globals.h: namespace protection - -1999-12-25 Zeev Suraski - - * zend_ptr_stack.c - zend_ptr_stack.h: inline functions cannot accept varargs - -1999-12-25 Andi Gutmans - - * zend-parser.y: - Prepare Zend for the new $a{2} string offset syntax. - -1999-12-24 Zeev Suraski - - * zend_config.w32.h: - Use __forceinline under Win32 (inlining under Win32 gives roughly 30% performance - increase) - - * zend-scanner.l: Shut gcc up - - * zend_compile.c: Optimize - -1999-12-24 Andi Gutmans - - * zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_operators.c - zend_variables.c: - - Create two new macro's. ALLOC_ZVAL() and FREE_ZVAL(z) and make Zend use - them. - -1999-12-24 Zeev Suraski - - * zend_compile.c: - Use function_add_ref() here too - -1999-12-23 Zeev Suraski - - * zend_compile.c - zend_opcode.c: - Fix a class inheritence leak, when using static varibles in a parent class member function - - * zend_compile.c: This one slipped away - -1999-12-23 sascha - - * Zend.m4: Rename option to match description string - -1999-12-23 Zeev Suraski - - * zend-parser.y - zend-scanner.l - zend_compile.c - zend_compile.h - zend_execute.c: - - require() of a dynamic expression now has the standard require() semantics - - Fixed a memory leak in require() of a dynamic expression - -1999-12-23 sascha - - * Makefile.am - Zend.m4: - Compile zend_execute.c with special CFLAGS. For GCC, INLINE_CFLAGS - contains -O0 to disable optimizations. This can be disabled by using - the appropiate parameter. - -1999-12-22 sascha - - * zend_builtin_functions.c: Kill compiler warning - - * Zend.m4: Don't set DEBUG_CFLAGS to -g, if -g is already in CFLAGS - -1999-12-22 Zeev Suraski - - * zend.c - zend.h: export - - * zend_extensions.h: Those void's don't belong in there - - * zend_API.h - zend_builtin_functions.c: - Fix function_exists() - - * zend_execute.c: - - Fix a very old legacy memory leak in break(n) statements - - * zend_execute.c: Fix for the array() initialization bug Stas found - -1999-12-22 Andi Gutmans - - * zend_compile.c: - Remove unused variable. - -1999-12-21 Zeev Suraski - - * zend-scanner.l - zend.h - zend_compile.c - zend_execute.c: - Fix the highlighting problem. STR_REALLOC() should be used instead of plain erealloc() - whenever you're dealing with strings that might be coming back from the engine - there seem - to be a few other places like this in PHP. - -1999-12-21 Andrei Zmievski - - * zend.c - zend_API.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_operators.c - zend_variables.c - zend_variables.h: We're using ZVAL's now. - -1999-12-21 Zeev Suraski - - * zend_execute.c: - Fix Sascha's leak. Good report! - - * zend_alloc.c: No need to block for interruptions so early - -1999-12-21 sascha - - * Zend.m4: - Explicitly check for C++ preprocessor, otherwise autoconf forces it onto - us at the wrong place (subsequent autoconf checks failed). - -1999-12-20 Zeev Suraski - - * zend_compile.c: - Fix @expr - - * zend.h - zend_compile.c - zend_execute.c: - - Fix the crash Thies was experiencing (returning a function call could cause a crash) - - Fix the leak Thies was experiencing (@fcall() leaked) - -1999-12-19 Zeev Suraski - - * Zend.dsp: Some updates - - * Zend.dsp - ZendTS.dsp: Make these work again - - * FlexLexer.h - Makefile.am - Zend.dsp - Zend.m4 - ZendTS.dsp - configure.in - flex.skl - libzend.dsp - libzend.m4 - libzendts.dsp: libzend -> Zend - - * zend.h - zend_API.h - zend_compile.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h: - - Made things work again (Thies, everybody - please check the latest CVS and see if you're - still getting any problems) - - Changed the interface of call_user_function_ex() to support returning of references - -1999-12-19 Andi Gutmans - - * zend.c - zend.h - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_globals.h: - More fixes related to the return references patch - - eval_string() and call_user_function_ex() still don't work. - - The libzend tree is untested and might not be stabl yet. - -1999-12-19 sascha - - * Makefile.am: Add zend_sprintf.c - - * acconfig.h - zend_sprintf.c: configure sets ZEND_BROKEN_SPRINTF - - * acinclude.m4: Variables are not interpolated unless we use _UNQUOTED - -1999-12-18 Zeev Suraski - - * zend.h - zend_API.h: - The tree compiles again - -1999-12-18 sascha - - * libzend.m4: Let autoconf check for the proper inline keyword - - * Makefile.am - libzend.m4: - automake created illegal target names due to the ZEND_SCANNER definition. - We now substitute @ZEND_SCANNER@ directly - -1999-12-18 Zeev Suraski - - * zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c: - - Introduce ZEND_NUM_ARGS(), to replace ARG_COUNT(ht) - - Rename getParameters() and friends for consistency and namespace cleanliness - -1999-12-17 Zeev Suraski - - * zend_constants.c: - Made PHP_VERSION and PHP_OS work again - - More php3_ cleanup - - Restored the PHP_VERSION and PHP_OS constants - -1999-12-17 sascha - - * libzend.m4: Define inline to inline explicitly - - * Makefile.am - acinclude.m4 - configure.in - libzend.m4: Move config code into separate file - -1999-12-17 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_compile.h: - - By mistake commited this to the branch. It fixes a bug we introduced with - the return reference patch. - -1999-12-15 Andrei Zmievski - - * zend_builtin_functions.c: Doh! I'm an idiot. - - * zend_builtin_functions.c - zend_compile.c: - s/inheritence/inheritance/g - - Added is_subclass_of() function - -1999-12-15 Zeev Suraski - - * zend-parser.y - zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_opcode.c: - Implement return by reference: - - In function declaration instead of the return statement - - In the assignment phase - - Implement ability to turn off support for call-time pass by reference - -1999-12-15 Andrei Zmievski - - * zend_builtin_functions.c: val->len - - * zend_builtin_functions.c: Faster, must go faster. - -1999-12-15 Andi Gutmans - - * zend_execute.c - zend_opcode.c - zend-parser.y - zend_compile.c - zend_compile.h: - - Preliminary return ref patch. It breaks libzend so don't use this branch - right now. - -1999-12-14 Andrei Zmievski - - * zend_builtin_functions.c: - Added class_exists() - - Moved function_exists() here from from the basic_functions.c - - Modified method_exists() to convert method name to lowercase - when checking - -1999-12-13 Andi Gutmans - - * zend_execute.c: - - Fix problem when return_value's is_ref/refcount is overwritten by the - internal function. - -1999-12-11 Andi Gutmans - - * zend_execute.c: - Another small fix. - - * zend_execute.c: - Support returning references - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h: - - This is supposed to be commited to the RETURN_REF_PATCH branch which is - the beginning of work on allowing returning of references from functions. - -1999-12-07 Andi Gutmans - - * zend-scanner.l: - - opened_path should not be freed here as the zend_file_dtor() takes care - of it. This doesn't fix the bug report for the crash of highlight_file() - though. - -1999-12-07 Zeev Suraski - - * zend-parser.y: Support ZTS definition in zend_config.h - -1999-12-06 Zeev Suraski - - * zend-scanner.l - zend_compile.c - zend_compile.h - zend_highlight.c - zend_indent.c: Move the #include of zend-parser.h out of zend_compile.h - - * zend-parser.y - zend_globals_macros.h: More localization - - * zend-parser.y - zend_compile.h - zend_globals_macros.h: Localize a couple of macros - -1999-12-05 Zeev Suraski - - * zend-scanner.l: *** empty log message *** - -1999-12-05 sascha - - * .cvsignore - zend-parser.y - zend.c - zend_API.c - zend_compile.c - zend_execute_API.c: Fix some warnings - -1999-12-04 Andrei Zmievski - - * zend_API.c: *** empty log message *** - - * zend_API.c - zend_API.h - zend_hash.h: Added zend_set_hash_symbol() function. - -1999-12-04 Thies C. Arntzen - - * zend_API.h: - backed out last change after andi decided on a different approach. - -1999-12-04 Andi Gutmans - - * zend_API.h: - - Call ZEND_SET_SYMBOL_WITH_LENGTH() with refcount 1 from the standard - ZEND_SET_SYMBOL() - -1999-12-04 Zeev Suraski - - * zend-scanner.l - zend_builtin_functions.c - zend_compile.c: - Implement get_used_files() and get_imported_files() - - * zend-parser.y - zend-scanner.l - zend.c - zend.h - zend_compile.c - zend_compile.h: - - Break the zend->PHP dependency introduced by the .php extension for use(), - by providing an API - - Enable Stig's patch for use() extensions (it wasn't refered to by the parser) - - Fix a memory leak in that code - -1999-12-04 Thies C. Arntzen - - * zend_API.h: the new SET_VAR_* macros forgot to set the refcount! - -1999-12-04 Sam Ruby - - * zend-scanner.l: build error - windows - -1999-12-04 stig - - * zend-scanner.l - zend_compile.h: Fix typo, add prototype for use_filename(). - - * zend-scanner.l: "use" should use arg+".php" as parameter to require - -1999-12-04 Zeev Suraski - - * zend-scanner.l: This should fix the fd leak with include()/require() - -1999-12-03 Andrei Zmievski - - * zend_API.h: *** empty log message *** - - * zend_API.h: Added ZEND_SET_GLOBAL_VAR_WITH_LENGTH_EX() macro. - -1999-12-03 Thies C. Arntzen - - * zend-scanner.l: revert my last patch - WARNING: we leak fd's again. - add initialzation of opened_path highlight_file() - -1999-12-03 Andi Gutmans - - * zend_API.h: - Remove _EX and make it the old _LENGTH - -1999-12-02 Andi Gutmans - - * zend_API.h: - Add _EX macro for Andrei - -1999-12-02 Zeev Suraski - - * zend-scanner.h - zend_compile.h: Solve a couple of compile issues - -1999-12-02 Thies C. Arntzen - - * zend-scanner.l: - php_fopen_wrapper_for_zend() does *NOT* insert the opened files into any list - the caller needs to fclose() the file. (not sure if this is desired) - fixed "Uninitialized memory read" when including URLs - -1999-12-01 stig - - * zend-scanner.h - zend.c - zend.h - zend_alloc.h - zend_builtin_functions.h - zend_compile.h - zend_constants.h - zend_execute.c - zend_execute.h - zend_extensions.h - zend_globals_macros.h - zend_hash.h - zend_indent.h: Fix warnings surfacing in maintainer-mode. - -1999-12-01 Zeev Suraski - - * zend_API.h: - Make it possible to explicitly set refcount in ZEND_SET_SYMBOL_WITH_LENGTH(), part 2 - - * libzendts.dsp - zend_API.h: - Allow to set the reference count explicitly for ZEND_SET_SYMBOL_WITH_LENGTH() - -1999-12-01 Andi Gutmans - - * zend_execute.c: - - Forgot to check for BP_VAR_IS in the fix made for Thies' string offset - problem. - -1999-11-30 Andi Gutmans - - * zend_API.c: - Applied Thies' bug fix. Great work! - - * zend-parser.y - zend-scanner.l - zend.c - zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h: - - Add use support (behaves like require, but will not use the same file twice) - - Add import support (behaves like include, but requires parentheses; will not - use the same file twice; Currently, it is not yet properly implemented, and - only behaves like include) - - * zend_execute.c: - - Fix problem Thies reported. We by mistake separated variables which were - being fetched for read only. - -1999-11-27 Zeev Suraski - - * zend_alloc.c: Add ability to disable the memory cache - -1999-11-26 Zeev Suraski - - * zend-scanner.l: - Fix fd leak in ZTS mode - - * zend-scanner.l - zend_compile.c: UNIX/non ZTS compile fixes - - * zend-scanner.l - zend_compile.c - zend_compile.h: - Improve the file handle closing code - - * zend_llist.c - zend_llist.h: - Modify zend_llist_del() to receive a comparison function - - * zend_API.c: - This request_shutdown() is no longer needed (never was needed really) - - * zend-scanner.l: This should get the file to close properly - -1999-11-26 sascha - - * Makefile.am: Rebuild libzend.la, if the scanner was rebuilt - -1999-11-26 Zeev Suraski - - * zend_API.c - zend_modules.h: Remove request_started, increase thread safety - -1999-11-25 Zeev Suraski - - * zend_execute.c: That's a more thorough fix... - - * zend_execute.c: - Fix bug #2817 - assignments to string offsets could erronously modify unrelated strings - -1999-11-22 Zeev Suraski - - * zend_alloc.c: Fix compile problem with enable-memory-limit - - * zend-scanner.l: Fix inconsistencies with here-docs implementation - - * zend-scanner.l - zend_globals.h: Fix #2744 - -1999-11-21 Andi Gutmans - - * zend_execute.c: That slipped away - -1999-11-21 Zeev Suraski - - * zend.h - zend_API.c - zend_compile.c - zend_execute.h - zend_execute_API.c: - Optimize class instanciation - - Fix constant instanciation for array elements inside objects - -1999-11-19 Andi Gutmans - - * zend_execute.c: - - Moved var_uninit() for return_value to the beginning of DO_FCALL. - We forgot to do it for overloaded methods - - * zend.h - zend_execute.c: - - Functions whose return values aren't used have them freed in DO_FCALL - and don't need a special ZEND_FREE opcode following them anymore - -1999-11-17 Andi Gutmans - - * zend_compile.c - zend_execute.c: - - If a function's return value is unused then don't create a ZEND_FREE - opcode but free it after the function call in zend_execute. - - * zend_execute.c: - Forgot this - -1999-11-16 Andi Gutmans - - * zend_execute_API.c: - Weird that this compiled for me. - - * zend.h: - CHange used_return_value -> return_value_used - - * zend_compile.c: - - In any case create the free opcode. Need to allow the functions to - create a hint. - - * zend.h - zend_compile.c - zend_execute.c: - - Add support for used_return_value passed to internal functions. - -1999-11-14 Andi Gutmans - - * zend_compile.h: - Fix comment as to Joey's findings - -1999-11-13 Andi Gutmans - - * zend_execute.c: - Fix crash with string offset assignments. - -1999-11-04 Andrei Zmievski - - * zend_hash.c - zend_hash.h: Made zend_hash_rehash() callable from outside. - -1999-11-03 Andi Gutmans - - * zend_API.h - zend_compile.c - zend_compile.h - zend_execute.c: - Add support for BYREF_FORCE_REST - -1999-10-28 Andi Gutmans - - * zend_compile.c - zend_execute.c: - Fix for Thies' leak and Andrei's crash - -1999-10-25 Zeev Suraski - - * zend_compile.h: *** empty log message *** - -1999-10-23 Sam Ruby - - * libzend.dsp - libzendts.dsp: - Allow CYGWIN directory to be specified as via environment variable - -1999-10-22 Andi Gutmans - - * zend_execute.c: - Fix isset() with string offsets. - -1999-10-19 Thies C. Arntzen - - * zend_operators.c: fixed is_identicat_function() - -1999-10-19 Andi Gutmans - - * zend_compile.h: - Move IS_IDENTICAL next to IS_EQUAL - - * zend_operators.c: - Fix is_identical function - - * zend-parser.y - zend-scanner.l - zend_compile.h - zend_execute.c - zend_opcode.c - zend_operators.c - zend_operators.h: - - Preliminary submit of Thie's patch. Will fix the rest on Windows - as this was added on UNIX with patch. Changed IS_SAME -> IS_IDENTICAL - -1999-10-18 Andrei Zmievski - - * zend_API.h: Be safe, use (). - -1999-10-15 Andrei Zmievski - - * zend_operators.c - zend_operators.h: unstatic'fy is_numeric_string() - - * zend_hash.c - zend_hash.h - zend_compile.c: *** empty log message *** - -1999-10-15 Andi Gutmans - - * zend_operators.h: - Add convert_to_number_ex() - -1999-10-14 sascha - - * configure.in: - Add "--disable-inline" for low-memory machines (be it limited - RAM or virtual memory). It's also useful for Digital C where - the C++ compiler thinks "inline" is an invalid specifier. - - * Makefile.am: Use sources from $(srcdir) - -1999-10-13 sascha - - * Makefile.am: Do not use $< for anything but implicit rules. - -1999-10-13 Thies C. Arntzen - - * zend_list.c: - (zend_fetch_resource) added warinig if resource is of wrong type - -1999-10-13 sascha - - * acconfig.h: Disable ZEND_EXTENSIONS_SUPPORT, if RTLD_NOW is not defined. - - Note that this part could be made platform independent by using - libltdl (for Solaris, Linux, *BSD, HP-UX, Win16/32, BeOS). - -1999-10-12 Thies C. Arntzen - - * zend_list.c - zend_list.h: new improved resource-API - -1999-10-12 sascha - - * acconfig.h: - Use DL_LAZY for OpenBSD. This seems to be a compatibility flag which - should be used for the 2nd parameter to dlopen. - - http://www.openbsd.org/cgi-bin/cvsweb/src/share/man/man3/dlfcn.3?rev=1.8 - -1999-10-12 Andi Gutmans - - * zend_execute.c: - - object.ptr was made NULL in DO_FCALL but wasn't restored. Right now I - push it in DO_FCALL and at the end of do_fcall_common it always gets - popped. We might be able to optimize it out. - -1999-10-11 Andrei Zmievski - - * .cvsignore: *** empty log message *** - - * zend_hash.c - zend_hash.h: Modified zend_hash() to accept a pointer to sort function. - -1999-10-11 Andi Gutmans - - * zend_execute.c: - - No idea why this bug didn't exist before. But I'm too tired to think of it. - During a regular do_fcall we need to set object.ptr to NULL and, thus, - push it in the beginning and pop it in the end. - I hope this fix more or less cuts it. I just want to sleep :) - -1999-10-10 Andi Gutmans - - * zend_execute.c: - - Didn't lower refcount when doing an internal function call linked to a regular object. - -1999-10-10 Thies C. Arntzen - - * .cvsignore: added some more autoconf/libtool stuff to be ignored - -1999-10-10 Andi Gutmans - - * zend_execute.c: - - Clean up a bit. Separate before the locking so that we can use SEPARATE_ZVAL - macro. - -1999-10-10 sascha - - * build.mk: Add clean target which removes standard targets - - * build.mk: build.mk can be used to generate build tools. It is usually - faster than buildconf, since it rebuilds only components, if - it is necessary. To use it, run - - $ make -f build.mk - -1999-10-09 Andi Gutmans - - * zend_execute.c: - Shouldn't be needed - - * zend_execute.c: - - God damn this sucked. I hopefully fixed the problems with classes although - we might need to clean stuff up a bit. - -1999-10-09 sascha - - * acconfig.h: - Define RTLD_NOW to DL_NOW, if RTLD_NOW is not defined (for OpenBSD). - -1999-10-07 Thies C. Arntzen - - * zend_variables.c - zend_variables.h: added zval_del_ref() function - -1999-10-07 Andi Gutmans - - * zend_execute.c: - Reverse my patch - -1999-10-06 Andi Gutmans - - * zend_execute.c: - - Fixed memory leak with this pointer. It was somtimes initialized with refcount - of 2 instead of 1. - - Also fixed a place where object.ptr_ptr is set to pointing to a zval* instead - of zval**. I don't think this is ever used so we might be able to remove it - altogether. - -1999-10-06 Thies C. Arntzen - - * zend_execute.c: fix for using resources as array indices - -1999-10-05 sascha - - * configure.in - zend.h - zend_globals.h: More portability stuff - - * configure.in: OSF/1 V4.0 wants -lcxx - - * zend_compile.h: - This causes link problems with anything higher than -O0. - -1999-10-04 sascha - - * Makefile.am: Add necessary rule. - - * Makefile.am - acconfig.h - acinclude.m4 - buildconf - configure.in - zend_config.in: Use libtool to build. - -1999-10-04 Thies C. Arntzen - - * zend_builtin_functions.c: use getParametersEx for all builtin functions - - * zend_API.c - zend_API.h: added add_*_resource() and add_*_bool() functions - -1999-10-03 Andi Gutmans - - * zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h: - Hooray. This might actually work. (I hope) - -1999-10-03 sascha - - * configure.in: Make it executable. - -1999-10-02 Andi Gutmans - - * zend_execute.c: - Another locking fix. - - * zend_execute.c: - Fixed locking problem when fetching string offsets - -1999-10-02 Zeev Suraski - - * zend_execute.c: - Fix the leak reported on the PHP 3 list (isset() on string offsets) - -1999-10-01 Andi Gutmans - - * zend.h - zend_API.h - zend_builtin_functions.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_opcode.c - zend_operators.h: - - Move is_ref back to being an unsigned char and not a bit field. - - * zend.h - zend_API.h - zend_builtin_functions.c - zend_compile.h - zend_execute.c - zend_execute_API.c: - Remove locking support completely - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c: - - For Andrei. Implement references in array() initializations - -1999-09-29 Zeev Suraski - - * zend_config.w32.h: *** empty log message *** - -1999-09-29 Andi Gutmans - - * zend_operators.c: Fix leak in += with arrays - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c: - - Fix SEND_VAR problem after fetch'ing a variable and not knowing the fetch type - -1999-09-29 Thies C. Arntzen - - * zend_API.c - zend_API.h: added add_property_resource - -1999-09-28 Andi Gutmans - - * zend_compile.h - zend_execute.c - zend_execute_API.c: - - Stop using the locking mechanism and start using refcount. - Now we know when we need to free but we still need to support it - - * zend_execute.c - zend_execute.h - zend_execute_API.c: - - First part of the patch which makes reads use ptr and not ptr_ptr. - -1999-09-28 sascha - - * acconfig.h - configure.in - zend-scanner.l: Provide alternative istdiostream. - - This has been tested with Sun WorkShop 4.2 C++ which does not - contain class istdiostream. - -1999-09-26 sascha - - * Makefile.am - configure.in: Actually allow to set CXXFLAGS - - * configure.in - zend_config.in: - Build communication channel and add checks for C++ library - -1999-09-26 Andi Gutmans - - * zend_execute.c - zend_execute.h - zend_execute_API.c: - Changed Ts{}.var to Ts{}.var.ptr_ptr. - -1999-09-24 sascha - - * zend_operators.h: Add _ex API implementation for booleans. - -1999-09-24 Zeev Suraski - - * zend_list.c - zend_list.h: Exify the standardized resource stuff - -1999-09-23 Andi Gutmans - - * zend_operators.c: - Fix bug #2364. - I haven't checked all of the conversion macros yet but there's a change - there are more such bugs there. - -1999-09-23 sascha - - * configure.in: Fix vpath build w/ thread-safe enabled on Unix. - -1999-09-22 Thies C. Arntzen - - * zend_builtin_functions.c: - preliminary fix for each until andi & zeev clean up! - - * zend_list.c: - if you pass NULL as the resource_type_name to zend_fetch_resource*&friends the functions will not print any warnings if the resource is not found! - -1999-09-21 Andi Gutmans - - * zend_compile.c: - - Fix problem where function parameter fetches were created too late. - -1999-09-21 Zeev Suraski - - * zend_builtin_functions.c: Add get_func_args() - - * zend_builtin_functions.c: *** empty log message *** - -1999-09-20 Andi Gutmans - - * zend_builtin_functions.c: - - Move some more Zend internal functions from PHP - - * zend-parser.y: - Next part of locking fix. - $var = expr; and $var += expr; first create code for expr and later on - for the fetch_w of $var. - - * zend_builtin_functions.c: - Newline for Sun's compiler - - * zend_API.h - zend_builtin_functions.c: - Add some internal functions to Zend - - * zend_compile.c - zend_compile.h - zend_opcode.c: - - First step in fixing locking problem. Array fetches are now always done last. - Later on we will want to delay the write fetches even longer until after their - resulting expression is parsed. The way it is now, will make it very easy - to delay as long as we need. - - * zend_compile.c - zend_compile.h: - - Indirect references had all of the fetches by mistakenly backpatched. - Actually all of the fetches are supposed to be read, except for the last - one. - -1999-09-20 Zeev Suraski - - * libzend.dsp - libzendts.dsp - zend_builtin_functions.c: Added zend_num_args() and zend_get_arg() - - * Makefile.am - zend.c - zend_builtin_functions.c - zend_builtin_functions.h: - Add a file in which we can put Zend builtin functions - -1999-09-18 Andi Gutmans - - * zend_execute.c: - - Try to fix the leak Rasmus reported. It's pretty sucky code so I'm really - not sure this fix is OK.I can't remember all of what we did there. - -1999-09-18 Zeev Suraski - - * zend_list.c: Safer behavior - -1999-09-17 Thies C. Arntzen - - * zend_execute.c: make SUNs c89 happy - - * zend_execute_API.c: no // in the sources please - - * zend_globals_macros.h: added newline at end of file - -1999-09-17 Zeev Suraski - - * zend_execute.c: - Fix bug #2318 - -1999-09-16 Zeev Suraski - - * zend_operators.h: Introduce convert_to_*_ex() - -1999-09-16 sascha - - * configure.in: this helps compiling on non-ANSI C compliant platforms - -1999-09-13 stig - - * acconfig.h - configure.in: Make sure HAVE_LIBDL gets defined. - Disable more C++ tests when not configured for thread safety. - -1999-09-12 Zeev Suraski - - * zend.c: Make this class instanciatable - -1999-09-12 sascha - - * configure.in: check for c++ only, if thread safety is enabled - -1999-09-10 Zeev Suraski - - * zend_compile.c: Shut up a warning - -1999-09-09 Andi Gutmans - - * zend_compile.c - zend_globals.h - zend_stack.c - zend_stack.h: - Add foreach() freeing code. - - Fix switch() freeing code to only free current function's switch expressions. - - I have a feeling break expr; in a switch where expr > 1 leaks because it - won't free all of the expressions. Fix is probably not trivial. - - * zend_operators.c: - - Fix leak when decrementing strings which actually are longs. - -1999-09-08 Andi Gutmans - - * zend_execute.c: - - Fix for floating point array offsets. Same behaviour as in PHP 3.0. We - casted to (long). - - * Makefile.am - libzendts.dsp: - Add -b option to flex++ - -1999-09-07 stig - - * acconfig.h: define tests first, use after. - -1999-09-06 Andi Gutmans - - * zend_config.w32.h: - Fix win32 compile - - * zend_config.w32.h: - Make zend compile again in Win32. - -1999-09-06 stig - - * .cvsignore: ignore zend-scanner.cc - - * ZendCore.dep - libzend.dsp - libzendts.dsp: hand-patched some MSVC files - - * Makefile.am - acconfig.h - acinclude.m4 - config.unix.h - config.w32.h - configure.in - zend-scanner.l - zend.h - zend_API.c - zend_alloc.c - zend_compile.h - zend_config.w32.h - zend_execute.c - zend_hash.c - zend_list.c - zend_ptr_stack.c - zend_sprintf.c: * header file cleanup - * fixed --enable-thread-safety build for UNIX - - I don't have a Win32 environment available, could someone please try - compiling on Win32 to see if I got all the header file stuff right there? - -1999-09-05 Andi Gutmans - - * zend_globals_macros.h: - Oops - - * libzendts.dsp - zend.c - zend.h - zend_alloc.c - zend_alloc.h - zend_globals.h: - Shift around header files. - -1999-09-04 Zeev Suraski - - * zend_list.c: Fix a stupid bug (from stefan@roehri.ch) - -1999-09-03 Zeev Suraski - - * zend_list.h: Damn, forgot to commit that - - * zend_list.c - zend_list.h - zend_modules.h: Add new API for resources - -1999-09-03 sascha - - * zend_modules.h: Add global startup/shutdown functions - -1999-09-03 Zeev Suraski - - * zend_operators.c: - Revert the IS_RESOURCE patch. It had some unintended behavior. - - * zend_variables.c: Let $GLOBALS actually work... - - * zend_operators.c: - Release resources when converting to other types (fix Thies's reported problem) - -1999-09-02 Zeev Suraski - - * zend_compile.c: - Use \0NameFilenameLineno as key instead of numeric index for runtime defined functions - -1999-08-28 Zeev Suraski - - * zend_extensions.c - zend.h - zend_alloc.c - zend_extensions.h - zend_variables.c - zend_variables.h: *** empty log message *** - - * zend.h - zend_alloc.c - zend_alloc.h - zend_variables.c: Beef up debug macros - -1999-08-27 Zeev Suraski - - * zend_execute_API.c: Fix a crash bug in case of aborted execution - - * zend.h - zend_alloc.c - zend_alloc.h - zend_execute_API.c - zend_variables.c - zend_variables.h: Better debug macros - -1999-08-26 Andi Gutmans - - * zend_execute_API.c: - Damn. It wasn't a correct fix. This should do it. - When the zval ** are equal we don't want to assign_ref, in any other case - I can think of we do want to assign_ref. - - * zend_execute_API.c: - Fix leak when global is used in the global scope. - - * zend_compile.c: - Fix when redefining classes at run-time. - -1999-08-25 sascha - - * zend.h: make it compile with gcc again - -1999-08-25 Andi Gutmans - - * zend_hash.c - zend_hash.h: - Add hash_apply_with_arguments() - - * zend-scanner.l: - More elegant fix for Win32 include_path - - * zend-scanner.l: - - Temporary fix to allow Win32 MT safe version to use zend_fopen(). - -1999-08-23 Andi Gutmans - - * zend_execute.c: - Fixed a specific memory leak linked to locking. - -1999-08-22 sascha - - * zend.h - zend_globals.h: This changes makes it work on egcs 1.1.2/Alpha - - * configure.in - zend.h: remove checks - -1999-08-20 Zeev Suraski - - * zend_constants.c - zend_constants.h - zend.c: Fix for Thies's UMR - -1999-08-19 Andi Gutmans - - * zend-parser.y - zend_opcode.c: - - Make sure expr_list and echo_list are either empty or comma seperated - expressions - -1999-08-18 Thies C. Arntzen - - * zend-scanner.l: on unix ZTS gets defined in zend_config.h - -1999-08-17 Zeev Suraski - - * zend_execute_API.c: Fix #2012 - - * zend_execute.c: Fix #2070 - -1999-08-17 Andi Gutmans - - * zend.c - zend.h: - Add some ZENDAPI's - -1999-08-15 Andi Gutmans - - * zend_execute.c: - Oopsie - - * zend.h - zend_compile.h - zend_execute.c - zend_globals.h: - Optimize the execute stack a bit. - -1999-08-14 Zeev Suraski - - * zend_compile.c: Fix several class issues - - * zend_compile.c - zend_compile.h: - Generate better warnings for class/function redefinitions - -1999-08-10 Andi Gutmans - - * zend_compile.c - zend_constants.c: - Got rid of the C++ comments. - -1999-08-09 Andi Gutmans - - * zend_execute.c: - Thies's crash fix. - -1999-08-07 Zeev Suraski - - * zend_compile.h - zend_execute.c - zend_execute_API.c: Fix a few leaks - -1999-08-06 Zeev Suraski - - * zend_execute_API.c: Fix a bug in call_user_func_ex() - - * zend_API.h: Now that's an annoying bug. - - * zend_API.h - zend_execute_API.c: Introduce call_user_func_ex() - - * zend_execute.c: *** empty log message *** - -1999-08-03 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_opcode.c: - - Initialize extended value's and put the fetch_type in it's own variable - name. - -1999-08-02 Andi Gutmans - - * zend_compile.c - zend_compile.h: - Make set_compiled_filename() return a pointer to the allocated file name - -1999-07-31 Zeev Suraski - - * zend_API.h: These aren't necessary - -1999-07-30 Zeev Suraski - - * zend_API.h: Support symbols in any symbol table, not just the active one - -1999-07-30 Andi Gutmans - - * zend_ptr_stack.c: - Damn that's more like it. - - * zend_ptr_stack.c: - Cut&paste crap - - * zend_execute.c - zend_ptr_stack.c - zend_ptr_stack.h: - - Add ptr_stack_n_{push,pop} in order to speed up function calls a bit. - There seems to be no reason for stack->top in the ptr_stack except for - when realloc()'in the stack. I think I'll remove it. - -1999-07-30 Zeev Suraski - - * zend_API.h: - * Setting variables in the global scope wasn't handling is_ref's properly - -1999-07-29 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_compile.h: - - Fixed a leak when doing inheritance. The parent class name wasn't being freed. - - Fixed a stack leak. Functions that had late argument binding were set up as - INIT_FCALL_BY_NAME but were using DO_FCALL and not the corresponding - DO_FCALL_BY_NAME. - -1999-07-28 Andi Gutmans - - * zend_compile.c - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_hash.c: - Fixed various inheritance problems & Andrey's leak - -1999-07-27 Zeev Suraski - - * zend_compile.c: Inherit parent's constructor - - * zend_compile.c: - Fix runtime inheritence (child functions/members should have higher precedence) - -1999-07-27 Andi Gutmans - - * zend_execute.c: - Add missing lock - - * zend_execute.c: - Fix up the new operator a bit more. - -1999-07-27 Zeev Suraski - - * zend_execute.c: Set reference count and is_ref values for new objects - -1999-07-26 Zeev Suraski - - * zend_operators.c: - - Fixed a memory leak when using assignment-op operators with lvalue of type - string (or array/object) - - * zend_compile.c: *** empty log message *** - - * zend_compile.c - zend_compile.h - zend_execute.c: - Fix a bug in inheritence from classes defined in include files, that are - inherited from require()'d files - -1999-07-26 Andi Gutmans - - * zend_execute.c: - Oops I erased this by mistake - - * zend_execute.c: - - Should be a complete fix now. This break away code should maybe be made - somewhat generic - - * zend_execute.c: - Temporary fix for "this". Have to fix it tomorrow. - - * zend_execute.c: - - Fix compile error. Weird that Visual didn't catch this one. - - * zend-parser.y - zend.h - zend_compile.c - zend_compile.h - zend_execute.c: - Fix the new operator incompatibility. - - I commented PHP_FUNCTION(strtotime) in datetime.c because it stopped - win32 from compiling. This needs to be fixed!!! - - Check out libzend to compile the tree now. - - * zend.h - zend_execute.c: - new operator fixes - -1999-07-25 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c: - Commiting to branch newoperator. - - To check it out do cvs checkout -rnewoperator libzend - -1999-07-24 Zeev Suraski - - * zend_compile.c: Fix that memory leak... nested function issue remains - - * zend_compile.c - zend_stack.c - zend_stack.h: Fix RETURN & SWITCH memory leak issue - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c: - Thoroughly fix the SWITCH problem. No RETURN handling yet. - -1999-07-23 Zeev Suraski - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h: Fix bug #1812 - - * zend.h - zend_operators.c: - * Add an API macro users can use to ensure an array member can be modifed - before they modify it. - * Fix a bug and remove redundant code in convert_to_long() (booleans and - resources weren't changing their types - -1999-07-22 Zeev Suraski - - * zend_constants.c: New constants - -1999-07-22 stig - - * buildconf: identify ourselves - -1999-07-20 Andi Gutmans - - * zend_execute.c: - Include alloca.h when need and available. - - * zend_compile.c - zend_execute_API.c - zend_list.c - zend_operators.c: - Get rid of C++ comments - -1999-07-19 Zeev Suraski - - * config.unix.h - config.w32.h - zend-parser.y - zend-scanner.h - zend-scanner.l - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_compile.c - zend_compile.h - zend_constants.c - zend_constants.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_globals.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_modules.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_variables.c - zend_variables.h: 0.91 update - -1999-07-19 Andi Gutmans - - * zend.h - zend_execute.c - zend_extensions.h: * Fix Zend version - * Fix a method call bug - - * LICENSE - libzendts.dsp: License update - - * zend_errors.h: Make error codes PHP 3.0 compatible - -1999-07-18 Andi Gutmans - - * zend_execute_API.c: - - Should fix the memory leak when returning from the main scope. - -1999-07-17 Zeev Suraski - - * configure.in: Debug on by default - -1999-07-16 Zeev Suraski - - * zend_compile.c: - Ignore T_PHP_TRACK_VARS in the parser (handled in the scanner) - - * config.unix.h - config.w32.h - zend-parser.y - zend-scanner.h - zend-scanner.l - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_compile.c - zend_compile.h - zend_constants.c - zend_constants.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_globals.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_modules.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_variables.c - zend_variables.h: License update - -1999-07-15 Andi Gutmans - - * zend.c: Change true/false back to 1/"" - - * zend_execute.c: Fix a lock issue - -1999-07-15 sascha - - * zend_execute_API.c: disable zend_handle_sigsegv - -1999-07-14 Andi Gutmans - - * libzendts.dsp - zend.c: Fix thread unsafe constants startup - - * LICENSE - zend.c - zend_constants.c - zend_constants.h: - License update - - Fix multithreaded constants startup - - * zend_operators.c: - Fix for boolean convert to number - -1999-07-12 Andi Gutmans - - * zend_execute.c: - Fixed a purify warning - -1999-07-10 Zeev Suraski - - * zend_alloc.c: Oh, that dumb bug. - -1999-07-10 Andi Gutmans - - * zend_execute.c - zend_hash.c: Ok, so we do have to lock in there - - * zend.c - zend_execute.c: Fix assignments of reference variables - -1999-07-10 Zeev Suraski - - * zend_execute_API.c: Woops, fix. - - * zend_execute.c - zend_execute_API.c - zend_globals.h: Put the garbage in the garbage bin - - * zend_alloc.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_variables.c: Get rid of AiCount completely - - * zend_execute.c: Final tweaks - - * zend_execute.c - zend_hash.c: More locking work - -1999-07-09 Zeev Suraski - - * zend_execute.c: *** empty log message *** - - * zend_execute.c: More stuff - - * zend-parser.y - zend.h - zend_API.c - zend_API.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_opcode.c - zend_operators.c - zend_variables.c: Step 4: - Move to a 7-bit counter (not fully implemented yet) - - * zend_API.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_opcode.c - zend_variables.c: Phase 3: - Use a single bit to mark IS_REF variables - - * zend-parser.y - zend.h - zend_API.c - zend_API.h - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_opcode.c - zend_operators.c: Step 2: - Rename is_ref to EA - - * zend.c - zend_API.c - zend_compile.c - zend_compile.h - zend_constants.c - zend_constants.h - zend_execute_API.c - zend_hash.c - zend_hash.h - zend_list.c - zend_list.h - zend_modules.h - zend_opcode.c - zend_variables.c - zend_variables.h: Step 1 in nuking the garbage collector: - - Change the hash destructor to return int - - Don't kill the bucket on hash_destroy if the destructor returns 0 - - * config.w32.h - configure.in - zend_alloc.c: *** empty log message *** - - * zend_alloc.c: Send a SIGSEGV instead of exiting, to trigger a core dump - - * zend_alloc.c - zend_alloc.h - zend_hash.c: * Support recoverable failure from erealloc() - * Fix the shutdown code on an unrecoverable erealloc() failure - - * zend_execute_API.c: Fix the mess in SIGSEGV handling, hopefully - -1999-07-08 Zeev Suraski - - * zend_compile.h - zend_compile.c: - Support definition of classes that are derived from classes that are defined in runtime - -1999-07-06 sascha - - * zend.h: enable it, until we find a better way - -1999-07-05 sascha - - * zend.h: make Solaris gcc happy - - * configure.in - zend.h: use void * instead of long for 64-bit test - -1999-07-05 Thies C. Arntzen - - * zend_API.h: added RETVAL_RESOURCE and RETURN_RESOURCE - -1999-07-04 Zeev Suraski - - * zend_operators.c: - Make convert_to_string() regard false as "" instead of "0" - -1999-07-03 sascha - - * Makefile.am: don't wipe files for distributions - - * configure.in - zend.h: - checking for ints won't work, since they are 32 bit on both platforms - -1999-07-03 Zeev Suraski - - * zend_execute.c: Support isset()/empty() for string offsets - - * zend-scanner.l: Fix a crash - -1999-07-03 sascha - - * configure.in: add usual rhapsody hack - - * config.unix.h: missing DL_HANDLE broke build - - * zend_extensions.c: typo - -1999-07-02 sascha - - * acconfig.h - configure.in - zend.h: workaround for 64-bit platforms - -1999-07-02 Zeev Suraski - - * acconfig.h - configure.in - zend_globals.h: define zend_bool - -1999-06-30 Zeev Suraski - - * zend-parser.y: Make require accept any parameter - -1999-06-26 Zeev Suraski - - * zend_alloc.h - zend_operators.c - zend_alloc.c: - * Make the memory leak reporting code much better with repeats - * Remove useless variables - -1999-06-22 Zeev Suraski - - * zend_compile.c: Fix Thies's bug report - - * zend_alloc.c - zend_compile.c - zend_operators.c: - * Fix concatenation of arrays (it was PHP 3.0 style, copying zval's instead - of zval *, and it wasn't using reference counting) - * Fix a memory leak in static array()'s with textual indices - -1999-06-19 Zeev Suraski - - * zend.c: *** empty log message *** - - * zend.h - zend_extensions.h: - Add a standard get_ini_entry() to interface between Zend and the outside world - - * configure.in: *** empty log message *** - -1999-06-16 stig - - * zend_modules.h: - added INIT_FUNC_ARGS_PASSTHRU and SHUTDOWN_FUNC_ARGS_PASSTHRU - -1999-06-15 stig - - * zend_operators.c - zend_operators.h: * added zend_binary_strcasecmp() - -1999-06-12 Zeev Suraski - - * zend-parser.y: - We can't quite go with expr there (shift/reduce conflict), go with scalar. - - * zend-parser.y: require() improvement as per Andi's suggestion - -1999-06-11 Zeev Suraski - - * zend_operators.c: - Make the concatenation operator use make_printable as well - - * zend-scanner.l: Don't take failing on an include file so badly - - * zend-scanner.l: Support E_COMPILE_ERROR in the compiler - - * zend_compile.c: Two fixes: - * The error generated by a failed class inheritence wasn't properly - displaying the file in which he error occured. - * Inheritence didn't work if the parent class had uppercase letters in it. - - * zend-parser.y - zend-scanner.l - zend_execute.c: * Use to_string() instead of __print() - * Support boolean casts ((bool) and (boolean)) - - * zend.c: Change __print into to_string() - - * zend.c - zend.h - zend_execute.c - zend_execute_API.c: - * Make the output handling of variables much, much cooler. - Uses zend_make_printable_zval() instead of convert_to_string() now: - - $foo = true; - print "\$foo is $foo"; - will now print - $foo is true - (instead of "$foo is 1", earlier). - - Also, with objects, it automatically tries to call __print() and use it as a printing - function. - - For example: - - class foo { - function __print() { return "Foo Object"; } - }; - - $foo = new foo; - print $foo; - - will print "Foo Object". - -1999-06-10 Zeev Suraski - - * zend_operators.c: Now THAT's an annoying bug. - -1999-06-09 Zeev Suraski - - * zend_extensions.c: Fix - - * zend_API.c - zend_execute.c: - * Fix cases where you assign an array element to the parent array (the array was - being erased before the assignment, so the element was being smashed). - - * zend_execute.c - zend_execute_API.c: * Fix foreach() that receives a non array argument - * Clean up some C++ comments - -1999-06-09 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_operators.c: - Fix the static array() initializing - -1999-06-08 Zeev Suraski - - * zend_extensions.c: Replace error messages - -1999-06-08 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c: * Fix a by-name call/method call bug - * Clean and optimize the whole function call process - -1999-06-07 Zeev Suraski - - * zend_hash.c - zend_hash.h: Add zend_hash_get_current_key_type() - -1999-06-06 Andi Gutmans - - * zend_compile.c: - Work around a compiler bug - mark variables that are sent to functions that aren't yet - defined as FETCH_W (because they might end up being sent by reference) - -1999-06-05 Zeev Suraski - - * zend.c - zend.h - zend_compile.c - zend_compile.h: * Centralized shutdown - * Change shutdown order again - - * zend_compile.c: - Call the request_shutdown on modules before destroying symbol tables, so that - the session module can be implemented - - * zend-scanner.l - zend_compile.c - zend_execute.c: - - Fixed Karl's bug report. It's not really a thorough fix, we really need to rethink the INIT_FCALL/DO_FCALL issue. - - Fixed numerous AiCount problems - -1999-06-04 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_opcode.c: New $GLOBALS init - - * zend_execute_API.c: - Fix that GLOBALS leak. We were explicitly adding GLOBALS to the main symbol table, - but there's no reason to do it (INIT_GLOBALS takes care of it if necessary.) - - * zend.c - zend.h - zend_API.c - zend_API.h - zend_list.c - zend_list.h - zend_opcode.c - zend_operators.c: Minor updates (mostly __declspec() stuff) - -1999-06-04 Thies C. Arntzen - - * zend_API.h: added is_ref=0 and refcount=1 to SET_VAR_* macros - -1999-06-03 Zeev Suraski - - * zend-parser.y: T_BAD_CHARACTER is actually a string. - -1999-06-03 Andi Gutmans - - * zend-scanner.l - zend_execute.c: - - We weren't counting newlines in heredocs. The only place which is still questionable - is when there's a \ followed by a newline but it seems we have a parse error in this - case anyways. - - Fixed the alloca() macros so that the alloca() #define in win32 mode won't clash - with the real win32 alloca(). - -1999-06-01 Andi Gutmans - - * zend_execute.c: - - Make execute() use less stack in thread-safe win32 due to Microsoft's shitty 256kb stack. - -1999-05-31 Zeev Suraski - - * zend.h - zend_alloc.c: *** empty log message *** - -1999-05-31 Andi Gutmans - - * zend-scanner.l - zend_compile.c - zend_execute.c - zend_execute_API.c: Fixes - -1999-05-30 sascha - - * zend_alloc.c - zend_compile.h - zend_execute_API.c - zend_indent.c - zend_opcode.c: * fix some casts - * introduce unary_op_type - cleaner than casting data voids to function ptrs - -1999-05-29 Zeev Suraski - - * zend_execute_API.c: - That got fucked up when we went back to using uninitialized_zval - -1999-05-29 sascha - - * Makefile.am: another VPATH related change - -1999-05-29 Zeev Suraski - - * zend-parser.y: Fix a bug - - * zend_hash.c - zend_hash.h - zend_operators.c: Support overwrite mode in zend_hash_merge() - -1999-05-29 sascha - - * Makefile.am: - clean is not called from automake. use CLEANFILES instead - - allow VPATH compilation - -1999-05-29 Zeev Suraski - - * zend_execute.c: Correct fix - - * zend_execute_API.c: *** empty log message *** - - * zend_execute.c: Fix a leak - -1999-05-28 Zeev Suraski - - * zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c: * Support getThis() for internal functions. - * Fix 'new object or die' and AiCount issue thoroughly (earlier fix didn't - work with the optimizer). - * Add new macros for standardized definition of classes. - * Only report AiCount problems if shutdown was not silent. - -1999-05-27 Zeev Suraski - - * zend_execute.c: Fix the AiCount issue with objects - - * zend_API.h: Moved all #define's for SET_ and RETURN_ to zend_API.h - -1999-05-25 Zeev Suraski - - * zend_execute_API.c: - Avoid crashing if an error occurs before we open the first file. - -1999-05-24 Zeev Suraski - - * zend_operators.c: The last fix was wrong - - * zend_operators.c: Another operators fix - -1999-05-23 Zeev Suraski - - * zend_operators.c: - boolean comparison didn't work with smaller-than and greater-than, something that - fucked up berber's site a bit. fixed. - -1999-05-22 Zeev Suraski - - * zend_execute.c: - Sigh, another leak bites the dust. FREE_OP missing in case of a SEND_VAR. - - * zend-parser.y: I'm on a roll. Fix a nasty yet stupid AiCount bug - - * zend_alloc.c: Warn about AiCount not zeroing out - - * zend-parser.y - zend-scanner.h - zend.h - zend_alloc.c - zend_alloc.h - zend_compile.c - zend_compile.h - zend_constants.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.h - zend_highlight.h - zend_list.h - zend_llist.h - zend_ptr_stack.h - zend_stack.h: - * Add struct name to all typedef's so that they can be debugged with MSVC - * Fix an AiCount bug - list(...) = $var was using $var multiple times, and thus - causing AiCount to be decreased multiple times even though it was increased only - once for $var. Mark all FETCH_DIM's so that they won't decrease AiCount, and only - decrease AiCount on the last FETCH_DIM. - * Fix a stupid bug - forgot to pass CLS_C to some compiler function. For some reason - MSVC doesn't report these :I - - * zend.h - zend_alloc.c - zend_execute_API.c: - Give more information and save log lines in memory leak reports - - * zend-scanner.l - zend_compile.c - zend_compile.h - zend_globals.h - zend_llist.c - zend_llist.h: Avoid leaking fd's in case of failures - - * zend-scanner.l: more fixes - -1999-05-21 Zeev Suraski - - * zend-scanner.l: That wasn't supposed to slip in - - * zend-scanner.l: * Properly handle failed file opens in C++ - * Properly handle failed require()'s within libzend - - * zend-scanner.l: * Fix the comments issue. yymore() worked like a charm. - * Change all flex states to be prefixed with ST_ - -1999-05-20 Zeev Suraski - - * zend_compile.h - zend_execute.c: Optimize allocations into uninitialized_zval assignments - -1999-05-20 Andi Gutmans - - * config.w32.h - libzend.dsp - libzendts.dsp - zend_compile.c - zend_compile.h: - Updates we did today - - * zend_compile.c: - Fix a small problem with class decelerations. - - * zend-scanner.l: -Open curly braces fix? - -1999-05-15 Zeev Suraski - - * zend.c - zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_hash.c - zend-parser.y: - * Fix all hash checks that checked Bucket.arKey for NULL, when it was changed - to char[1], these checks should have been changed to Bucket.nKeyLength==0 - * Support runtime declaration of functions. I ended up changing the grammar - to catch top level functions vs. nested functions. The reason is simple - - if we don't have functions properly declared at compile-time, function calls - cannot be resolved at compile time, and have to be resolved at runtime, which - ends up being much much slower (without the optimizer, that is). - It's no biggy though, the grammar change isn't that bad. - -1999-05-14 Zeev Suraski - - * configure.in - zend-scanner.l: - If a require() dies, we must bail out (since it corrupts an existing op_array - - * zend-scanner.l: Fix a bug - -1999-05-14 stig - - * Makefile.am: don't install Zend on the system - -1999-05-14 Zeev Suraski - - * zend-scanner.l: - Add \012 and \xff missing support to constant quoted string - -1999-05-12 Zeev Suraski - - * zend.h: *** empty log message *** - -1999-05-12 stig - - * Makefile.am: install libzend.a and header files on "make install" - - * acconfig.h - configure.in: add --enable-thread-safety option - -1999-05-12 Zeev Suraski - - * zend_llist.c - zend_llist.h: Added prepend to llist - -1999-05-11 Zeev Suraski - - * zend-scanner.l - zend.c: Fixes: - * Avoid closing stdin (I could have sworn I've committed that already) - * unclean_shutdown patches - - * zend_alloc.c: Easier Win32 debug code - - * zend-scanner.l - zend_compile.c - zend_globals.h - zend_highlight.c: - * Fix a bug that occured in case of parse errors. We need to restore the lexical state - even if the compilation failed. - -1999-05-10 Zeev Suraski - - * zend-scanner.h - zend-scanner.l - zend.c - zend_alloc.c - zend_compile.h: - Weed out all BoundsChecker-found bugs (including a serious file descriptor leak - in the C++ scanner) - -1999-05-09 Zeev Suraski - - * zend_modules.h: Change argument name - - * zend.c - zend_API.c - zend_API.h - zend_modules.h: Almost forgot to commit those - -1999-05-06 Zeev Suraski - - * zend-scanner.l: Ok, I tested it now. It works very nicely! - -1999-05-05 Andi Gutmans - - * zend_llist.c - zend_llist.h: llist improvements - -1999-05-02 Andi Gutmans - - * zend.c - zend_compile.h: - Don't support interactive mode when thread safe. - -1999-05-01 Zeev Suraski - - * zend_operators.c: Several operator fixes. Should fix the MySQL problem. - -1999-04-30 Andi Gutmans - - * zend_opcode.c: - Free refcount when destroying the last class reference. - - * zend-parser.y: - Missed one place - - * zend-parser.y: - First try at fixing $a->foo[] syntax. - - * zend-scanner.l: - - Move back to yyless(). I haven't tested it yet because it's taking too long - to compile and I have to disconnect - -1999-04-30 Zeev Suraski - - * zend-parser.y - zend-scanner.l: - Fix Boris's problem (in my never ending struggle to show I never mean what I say - when I say something's not gonna happen :) - - * zend-scanner.l - zend_compile.c: - * Fix a problem with constant quoted strings, that was causing Thies's problem - * Remove a development-time printf - -1999-04-29 Andi Gutmans - - * zend-scanner.l: - No reason to handle newlines here. - -1999-04-28 Zeev Suraski - - * zend-scanner.l: Make the C++ scanner support interactive input - -1999-04-27 Zeev Suraski - - * zend-scanner.l - zend_compile.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_opcode.c: * Fix debugger+interactive mode bug - * Recognize whether an extension is with debug information or not - -1999-04-26 Zeev Suraski - - * libzendts.dsp: fix - - * config.w32.h - libzend.dsp - libzendts.dsp - zend-scanner.l - zend.c - zend_alloc.c - zend_compile.h - zend_globals.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_opcode.c - zend_sprintf.c: Various thread safety fixes and DLL updates - -1999-04-26 Andi Gutmans - - * zend-scanner.l - zend.c - zend_alloc.c - zend_globals.h: -More commits - -1999-04-24 Zeev Suraski - - * zend_compile.c: Another small fix - - * libzendts.dsp: dsp update - - * zend.c - zend_globals.h: Thread safety fixes - - * zend_list.c: Remove redundant includes - -1999-04-24 zeevread - - * zend-scanner.l: g++ compile fix - -1999-04-24 Zeev Suraski - - * Makefile.am - zend-scanner.l: *** empty log message *** - - * zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_opcode.c - zend-parser.y - zend-scanner.l: Cleanups, remove old ts code - -1999-04-23 Zeev Suraski - - * zend_operators.c: Arithmetics bug fix - - * zend-scanner.h - zend-scanner.l: Support eval() and highlight_string() in the C++ scanner - -1999-04-23 Andi Gutmans - - * zend-scanner.l: - - Use yyless() instead of unput() where possible. I'll erase the commented - out code in a day or so. - -1999-04-23 Zeev Suraski - - * FlexLexer.h - flex.skl - zend-scanner.h - zend-scanner.l - zend.h - zend_alloc.c - zend_alloc.h - zend_compile.h - zend_globals.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_operators.h - zend_variables.h: Ok, call me crazy, because I probably am. - Thread safe version now uses a C++ scanner object. Works fully. - -1999-04-22 Zeev Suraski - - * acconfig.h - zend-parser.y - zend-scanner.l - zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_highlight.c - zend_indent.c - zend_opcode.c: Make token names uniform, they all begin with T_ now. - -1999-04-21 stig - - * buildconf: state which aclocal.m4 and configure files are created - - * Makefile.am: - zend-parser.o and zend-scanner.o were included twice in libzend.a - -1999-04-21 Zeev Suraski - - * FlexLexer.h - flex.skl - libzendts.dsp - zend_API.c - zend_API.h - zend_globals.h: - * Change the thread safe project to create a C++ scanner. - * Add in a slightly modified skeleton file (only a couple of #if's for #include's - that we dont have in Windows) - - It does NOT compile or work yet :) - - * zend_list.h: Fix - - * zend.c - zend_compile.c - zend_constants.c - zend_constants.h - zend_list.c - zend_list.h: - Thread safety patch. It works now with 'just in time' resource initialization! - - * libzend.dsp - libzendts.dsp - zend_globals.h: Thread-safe project - -1999-04-21 stig - - * buildconf: move automake back to before autoconf - - * buildconf: - autoheader must be called after autoconf, automake after autoheader - - * zend_config.h.in: think before one commits - - * zend_config.h.in: doh. cvs appears to ignore .in files by default - -1999-04-21 Zeev Suraski - - * zend-parser.y - zend-scanner.l - zend.c - zend_API.c - zend_API.h - zend_alloc.c - zend_compile.c - zend_compile.h - zend_constants.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_opcode.c: - Thread safety patch. We're still not quite there but it compiles again, and - more logic has been implemented. - -1999-04-20 stig - - * .cvsignore - Makefile.am - Makefile.in - aclocal.m4 - buildconf: Makefile.in and aclocal.m4 are generated - added buildconf script - -1999-04-19 Zeev Suraski - - * zend_extensions.c - zend_extensions.h: - Return a success value from the startup function, so we can unload immediately - if it fails. - -1999-04-19 stig - - * .cvsignore - Makefile.am - Makefile.in - acconfig.h - acinclude.m4 - aclocal.m4 - config.h.in - configure.in - zend.h: convert to automake - -1999-04-19 Andi Gutmans - - * zend_API.c - zend_API.h: Add a couple of ZEND_API's - - * config.w32.h - zend-parser.y - zend_compile.c - zend_execute.c: Support =unset as arguments - -1999-04-19 stig - - * acconfig.h - config.h.in - configure.in: removed -lnsl and -lsocket checks from zend - -1999-04-18 Zeev Suraski - - * zend_execute.c: AiCount needs to be decreased here - - * configure.in - zend-scanner.l - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_compile.c - zend_extensions.c - zend_extensions.h - zend_globals.h - zend_llist.c - zend_modules.h - zend_opcode.c: Whatnot: - * updated alloc_persist to use critical sections - * changed extension shutdown to two-phase - * updated dependencies - * PR support (don't remember if there was any really) - -1999-04-15 Andi Gutmans - - * zend_execute.c: - - one more place which seems to have needed fixing. I don't have time to look - more into it. I hope we don't have anymore places which need fixing. - - * zend_compile.c: - - Should fix the pass by reference problem. This happened because we moved - start from arg 1 now and not arg 0. There might be more places which need fixing - like in the executor but the bug seems OK now. - -1999-04-14 Zeev Suraski - - * zend_compile.h: Compile fix - -1999-04-14 Andi Gutmans - - * config.w32.h - libzend.dsp - zend-scanner.l - zend_API.c - zend_API.h - zend_compile.c - zend_compile.h - zend_opcode.c: -Tiny patches - -1999-04-13 Zeev Suraski - - * zend_execute.c: Better detection - - * zend_execute.c: - Move Ai stuff before get_zval_*(), like Andi suggested. Fixes Sascha's huge - memory leak - -1999-04-13 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_execute.c - zend_execute_API.c: - Fix various memory leaks. - - * zend_execute.c: Refcount bugfix - - * libzend.dsp - zend_API.c - zend_execute_API.c - zend_ptr_stack.c: * Optimize argument_stack top lookup - * Fix a nasty bug in zend_ptr_stack_clean() - -1999-04-12 Zeev Suraski - - * zend_execute_API.c - zend_globals.h: Remove unnecessary stack - - * zend_API.c: off by one - - * zend_execute.c: Minor optimization - - * zend_API.c: Make functions that don't take arguments somewhat happier:) - - * zend_execute.c: - This should take care of "this" for user-defined functions. It wasn't yet working - for built-in functions anyway, this one is coming soon. - - * zend_compile.c - zend_execute_API.c: - Destroy the resource list after destroying the symbol table, otherwise the - auto-destructor for resources are run when the resource list is no longer valid - - * zend-parser.y - zend.h - zend_API.c - zend_API.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_ptr_stack.c: - This patch is a go. Not fully optimized yet, but working properly. - Prepatch tagged as BEFORE_STACK_PATCH. - - * zend_compile.c - zend_execute.c: Minor fixes: - missing zval_copy_ctor() - messed up AiCount fix - -1999-04-10 Zeev Suraski - - * zend_alloc.c - zend_alloc.h: Allow runtime setting of the memory limit - - * zend_alloc.c - zend_alloc.h - zend_globals.h: Get rid of php3_ini in Zend - - * zend.c - zend.h: - We need to initialize the utility values after we initialize the INI file, which in - turn, is after we initialize Zend. Set the utility values separately from Zend's - initialization - -1999-04-09 Andi Gutmans - - * zend-scanner.l: - Changed here-docs to <<< followed by whitespace. - -1999-04-09 stig - - * .cvsignore: ignore file - -1999-04-09 Andi Gutmans - - * zend-parser.y - zend_compile.h: - - I guess print $GLOBALS and print "$GLOBALS" should yield the same result - so I returned the one in encaps_var. - - Made INITAL_OP_ARRAY_SIZE smaller (64? can't remeber). I don't think the - erealloc()'s during compile time are such a biggy, we might make it even - smaller. We can have a configure time option as to it's size. - - * zend-parser.y: - - Support $GLOBALS in cvar's. Now list(..) = each($GLOBALS) will work. - - Remove support of $GLOBALS in enacapsed strings. print "$GLOBALS" isn't - supposed to work in any case. - -1999-04-09 Zeev Suraski - - * zend-scanner.l: - Honor a semicolon on the same line as an ending token of a heredoc - - * zend_compile.c: Prevent class redeclarations - -1999-04-08 Zeev Suraski - - * zend_API.c - zend_modules.h: * Add arguments to shutdown functions - * Remove traces of php_ini stuff - - * zend-parser.y: "Our favourite mistake" - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c - zend_opcode.c: $GLOBALS support - -1999-04-08 Andi Gutmans - - * ZEND_CHANGES: foreach() syntax has changed - -1999-04-08 Zeev Suraski - - * zend_compile.c - zend_execute.c: Fix static assignment - -1999-04-07 Zeev Suraski - - * zend_execute_API.c: Remove an unused variable - - * libzend.dsp: That's better. - - * libzend.dsp: We didn't save the .dsp back then... - - * ZendCore.dsp - ZendCore.dsw - ZendCore.mak - diffs - libzend.dsp: Cleanups: ZendCore->libzend - -1999-04-07 Rasmus Lerdorf - - * zend.c: *** empty log message *** - -1999-04-07 Andi Gutmans - - * LICENSE - Makefile.in - ZEND_CHANGES - configure.in - zend-parser.y - zend-scanner.h - zend-scanner.l - zend.h - zend_API.c - zend_API.h - zend_compile.h - zend_errors.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_hash.c - zend_hash.h - zend_list.c - zend_list.h - zend_llist.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_stack.c - zend_stack.h - zend_variables.c - zend_variables.h: New file. - - * LICENSE - Makefile.in - ZEND_CHANGES - configure.in - zend-parser.y - zend-scanner.h - zend-scanner.l - zend.h - zend_API.c - zend_API.h - zend_compile.h - zend_errors.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_hash.c - zend_hash.h - zend_list.c - zend_list.h - zend_llist.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_stack.c - zend_stack.h - zend_variables.c - zend_variables.h: Zend Library - - * ZendCore.dep - ZendCore.dsp - ZendCore.dsw - ZendCore.mak - acconfig.h - aclocal.m4 - config.h.in - config.unix.h - config.w32.h - diffs - zend.c - zend.ico - zend_alloc.c - zend_alloc.h - zend_compile.c - zend_constants.c - zend_constants.h - zend_execute.h - zend_extensions.c - zend_extensions.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_llist.c - zend_modules.h - zend_sprintf.c: New file. - - * ZendCore.dep - ZendCore.dsp - ZendCore.dsw - ZendCore.mak - acconfig.h - aclocal.m4 - config.h.in - config.unix.h - config.w32.h - diffs - zend.c - zend.ico - zend_alloc.c - zend_alloc.h - zend_compile.c - zend_constants.c - zend_constants.h - zend_execute.h - zend_extensions.c - zend_extensions.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_llist.c - zend_modules.h - zend_sprintf.c: Zend Library - diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4 index 97d5d647bb200..a7358fa85df49 100644 --- a/Zend/acinclude.m4 +++ b/Zend/acinclude.m4 @@ -4,7 +4,7 @@ dnl This file contains local autoconf functions. AC_DEFUN([LIBZEND_BISON_CHECK],[ # we only support certain bison versions - bison_version_list="1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5" + bison_version_list="1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5 2.5.1" # for standalone build of Zend Engine test -z "$SED" && SED=sed diff --git a/Zend/tests/bug18556.phpt b/Zend/tests/bug18556.phpt new file mode 100644 index 0000000000000..036abb2ada873 --- /dev/null +++ b/Zend/tests/bug18556.phpt @@ -0,0 +1,37 @@ +--TEST-- +Bug #18556 (Setting locale to 'tr_TR' lowercases class names) +--FILE-- +foo = "Foo"; + } +} + +echo "Instantiating an infoBlob with a lowercase i\n"; +$foobar = new infoBlob(); +echo $foobar->foo; +echo "\nInstantiating an InfoBlob with an uppercase I\n"; +$foobar = new InfoBlob(); +echo $foobar->foo; +echo "\n"; +setlocale(LC_ALL, "tr_TR.utf8"); +foreach(get_declared_classes() as $class) +{ + if(!class_exists($class)) + echo "$class No Longer Exists!\n"; + +} +echo "Done.\n"; +?> +--EXPECT-- +Instantiating an infoBlob with a lowercase i +Foo +Instantiating an InfoBlob with an uppercase I +Foo +Done. diff --git a/Zend/tests/bug39018.phpt b/Zend/tests/bug39018.phpt index e1968ad041626..32566ba864636 100644 --- a/Zend/tests/bug39018.phpt +++ b/Zend/tests/bug39018.phpt @@ -62,17 +62,17 @@ print "\nDone\n"; ?> --EXPECTF-- -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d Notice: Uninitialized string offset: 0 in %s on line %d Notice: Uninitialized string offset: 0 in %s on line %d -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d Notice: Uninitialized string offset: %i in %s on line %d -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d Notice: Uninitialized string offset: %i in %s on line %d @@ -88,16 +88,16 @@ Notice: Uninitialized string offset: 4 in %s on line %d Notice: Uninitialized string offset: 4 in %s on line %d -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d Notice: Uninitialized string offset: 12 in %s on line %d -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d Notice: Uninitialized string offset: 12 in %s on line %d -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d b Done diff --git a/Zend/tests/bug54547.phpt b/Zend/tests/bug54547.phpt new file mode 100644 index 0000000000000..452cbb8a53ab0 --- /dev/null +++ b/Zend/tests/bug54547.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #54547: wrong equality of string numbers near LONG_MAX with 64-bit longs +--SKIPIF-- +"00999223372036854775807"); +--EXPECT-- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) diff --git a/Zend/tests/bug55509.phpt b/Zend/tests/bug55509.phpt index b78fceb0da55f..5268789df67cd 100644 --- a/Zend/tests/bug55509.phpt +++ b/Zend/tests/bug55509.phpt @@ -5,6 +5,12 @@ Bug #55509 (segfault on x86_64 using more than 2G memory) if (PHP_INT_SIZE == 4) { die('skip Not for 32-bits OS'); } + +$zend_mm_enabled = getenv("USE_ZEND_ALLOC"); +if ($zend_mm_enabled === "0") { + die("skip Zend MM disabled"); +} + if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); // check the available memory if (PHP_OS == 'Linux') { diff --git a/Zend/tests/bug61782.phpt b/Zend/tests/bug61782.phpt new file mode 100644 index 0000000000000..95bf4e6cff388 --- /dev/null +++ b/Zend/tests/bug61782.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #61782 (__clone/__destruct do not match other methods when checking access controls) +--FILE-- +energy += $points; + print_r($player); +} +add_points(NULL, 2); +--EXPECTF-- +Warning: Creating default object from empty value in %sbug62005.php on line %d +stdClass Object +( + [energy] => 2 +) diff --git a/Zend/tests/bug62097.phpt b/Zend/tests/bug62097.phpt new file mode 100644 index 0000000000000..07e93bfa8806e --- /dev/null +++ b/Zend/tests/bug62097.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #62097: fix for bug #54547 is wrong for 32-bit machines +--SKIPIF-- +"bar"); +$foo = "10.0000"; // gettype($foo) = "string" +$foo /= 2; //Makes $foo = 5 but still gettype($foo) = "double" +unset($array[$foo]); +print_r($array); + +$array = array("5"=>"bar"); +$foo = "5"; +unset($array[(float)$foo]); +print_r($array); + +$array = array("5"=>"bar"); +$foo = "10.0000"; +$foo /= 2; //Makes $foo = 5 but still gettype($foo) = "double" +$name = "foo"; +unset($array[$$name]); +print_r($array); + +?> +--EXPECT-- +Array +( +) +Array +( +) +Array +( +) diff --git a/Zend/tests/bug62680.phpt b/Zend/tests/bug62680.phpt new file mode 100644 index 0000000000000..e2a2366e7a924 --- /dev/null +++ b/Zend/tests/bug62680.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #62680 (Function isset() throws fatal error on set array if non-existent key depth >= 3) +--FILE-- + +--EXPECT-- +bool(false) +bool(false) diff --git a/Zend/tests/bug62763.phpt b/Zend/tests/bug62763.phpt new file mode 100644 index 0000000000000..50c27bdf35e5e --- /dev/null +++ b/Zend/tests/bug62763.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #62763 (register_shutdown_function and extending class) +--FILE-- + +--EXPECT-- +test1::shutdowntest2::__destruct diff --git a/Zend/tests/catch_finally_001.phpt b/Zend/tests/catch_finally_001.phpt new file mode 100644 index 0000000000000..2b58fa713267c --- /dev/null +++ b/Zend/tests/catch_finally_001.phpt @@ -0,0 +1,32 @@ +--TEST-- +Try catch finally +--FILE-- + +--EXPECTF-- +try +finally +end + +try +catch +finally +end diff --git a/Zend/tests/catch_finally_002.phpt b/Zend/tests/catch_finally_002.phpt new file mode 100644 index 0000000000000..5f36ae2aa8b48 --- /dev/null +++ b/Zend/tests/catch_finally_002.phpt @@ -0,0 +1,21 @@ +--TEST-- +Try catch finally return +--FILE-- + +--EXPECTF-- +try +finally +int(1) diff --git a/Zend/tests/catch_finally_003.phpt b/Zend/tests/catch_finally_003.phpt new file mode 100644 index 0000000000000..a47c6f0f2c3c5 --- /dev/null +++ b/Zend/tests/catch_finally_003.phpt @@ -0,0 +1,40 @@ +--TEST-- +Try catch finally multi-return +--FILE-- + +--EXPECTF-- +string(3) "try" +string(7) "finally" +string(7) "finally" +try +string(4) "para" diff --git a/Zend/tests/catch_finally_004.phpt b/Zend/tests/catch_finally_004.phpt new file mode 100644 index 0000000000000..be32a435c3aff --- /dev/null +++ b/Zend/tests/catch_finally_004.phpt @@ -0,0 +1,41 @@ +--TEST-- +Nesting try catch finally +--FILE-- +getMessage()); +} while ($ex = $ex->getPrevious()); +?> +--EXPECT-- +123432int(1) +string(7) "finally" +string(5) "catch" diff --git a/Zend/tests/catch_finally_005.phpt b/Zend/tests/catch_finally_005.phpt new file mode 100644 index 0000000000000..d8573bd4e28c2 --- /dev/null +++ b/Zend/tests/catch_finally_005.phpt @@ -0,0 +1,21 @@ +--TEST-- +Try catch finally with return +--FILE-- + +--EXPECTF-- +int(3) diff --git a/Zend/tests/catch_finally_006.phpt b/Zend/tests/catch_finally_006.phpt new file mode 100644 index 0000000000000..48937c40d44d2 --- /dev/null +++ b/Zend/tests/catch_finally_006.phpt @@ -0,0 +1,28 @@ +--TEST-- +Try catch finally: re-throw exception in catch block +--FILE-- +getMessage()); +} +?> +--EXPECT-- +string(4) "para" +string(7) "finally" +string(2) "ex" diff --git a/Zend/tests/empty_with_expr.phpt b/Zend/tests/empty_with_expr.phpt new file mode 100644 index 0000000000000..582eb3d2d0b68 --- /dev/null +++ b/Zend/tests/empty_with_expr.phpt @@ -0,0 +1,32 @@ +--TEST-- +empty() with arbitrary expressions +--FILE-- + +--EXPECTF-- +Fatal error: Cannot use isset() on the result of an expression (you can use "null !== expression" instead) in %s on line %d diff --git a/Zend/tests/isset_func_error.phpt b/Zend/tests/isset_func_error.phpt new file mode 100644 index 0000000000000..7d1036def8e2a --- /dev/null +++ b/Zend/tests/isset_func_error.phpt @@ -0,0 +1,8 @@ +--TEST-- +Error message for isset(func()) +--FILE-- + +--EXPECTF-- +Fatal error: Cannot use isset() on the result of a function call (you can use "null !== func()" instead) in %s on line %d diff --git a/Zend/tests/offset_string.phpt b/Zend/tests/offset_string.phpt index 128350158e55f..c546b371830f4 100644 --- a/Zend/tests/offset_string.phpt +++ b/Zend/tests/offset_string.phpt @@ -30,10 +30,10 @@ echo "Done\n"; --EXPECTF-- string(1) "i" -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d string(1) "S" -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d string(1) "S" Warning: Illegal string offset 'run away' in %s on line %d @@ -46,10 +46,10 @@ string(1) "o" Notice: A non well formed numeric value encountered in %s on line %d string(1) "r" -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d string(1) "i" -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d string(1) "S" Warning: Illegal offset type in %s on line %d diff --git a/Zend/tests/traits/bug61998.phpt b/Zend/tests/traits/bug61998.phpt new file mode 100644 index 0000000000000..612caa0662ff6 --- /dev/null +++ b/Zend/tests/traits/bug61998.phpt @@ -0,0 +1,68 @@ +--TEST-- +Bug #61998 (Using traits with method aliases appears to result in crash during execution) +--FILE-- +newFunc(); //from T1 +$f->func(); //from Foo + +$b = new Bar(); +$b->newFunc(); //from T1 +$b->func(); //from Bar +$b->func2(); //from Bar +$b->newFunc2(); //from T2 +$b->newFunc3(); //from T2 +$b->func3(); //from Bar +--EXPECTF-- +From T1 +From Foo +From T1 +From Bar +From Bar +From T2 +From T2 +From Bar diff --git a/Zend/tests/try_catch_finally_001.phpt b/Zend/tests/try_catch_finally_001.phpt new file mode 100644 index 0000000000000..3d478f461aeca --- /dev/null +++ b/Zend/tests/try_catch_finally_001.phpt @@ -0,0 +1,36 @@ +--TEST-- +Try catch finally +--FILE-- + +--EXPECTF-- +1234int(1) diff --git a/Zend/tests/try_catch_finally_002.phpt b/Zend/tests/try_catch_finally_002.phpt new file mode 100644 index 0000000000000..94143f6fd1eca --- /dev/null +++ b/Zend/tests/try_catch_finally_002.phpt @@ -0,0 +1,42 @@ +--TEST-- +Try catch finally +--FILE-- + +--EXPECTF-- +123456int(7) diff --git a/Zend/tests/try_catch_finally_003.phpt b/Zend/tests/try_catch_finally_003.phpt new file mode 100644 index 0000000000000..78b37be1248d2 --- /dev/null +++ b/Zend/tests/try_catch_finally_003.phpt @@ -0,0 +1,38 @@ +--TEST-- +Try catch finally +--FILE-- + +--EXPECTF-- +1234int(4) diff --git a/Zend/tests/try_catch_finally_004.phpt b/Zend/tests/try_catch_finally_004.phpt new file mode 100644 index 0000000000000..c6946012d9c4d --- /dev/null +++ b/Zend/tests/try_catch_finally_004.phpt @@ -0,0 +1,30 @@ +--TEST-- +Try catch finally +--CREDITS-- +adoy +--FILE-- + +--EXPECTF-- +string(3) "try" +string(7) "finally" +string(8) "finally2" diff --git a/Zend/tests/try_finally_001.phpt b/Zend/tests/try_finally_001.phpt new file mode 100644 index 0000000000000..1c168da275cdd --- /dev/null +++ b/Zend/tests/try_finally_001.phpt @@ -0,0 +1,23 @@ +--TEST-- +Try finally +--FILE-- + +--EXPECTF-- +string(7) "finally" + +Fatal error: Uncaught exception 'Exception' with message 'ex' %s +Stack trace: +#0 %stry_finally_001.php(%d): foo('finally') +#1 {main} + thrown in %stry_finally_001.php on line %d + diff --git a/Zend/tests/try_finally_002.phpt b/Zend/tests/try_finally_002.phpt new file mode 100644 index 0000000000000..44676966fe259 --- /dev/null +++ b/Zend/tests/try_finally_002.phpt @@ -0,0 +1,23 @@ +--TEST-- +Try finally +--FILE-- +getMessage()); + } while ($e = $e->getPrevious()); +} +?> +--EXPECT-- +string(7) "finally" +string(3) "try" diff --git a/Zend/tests/try_finally_003.phpt b/Zend/tests/try_finally_003.phpt new file mode 100644 index 0000000000000..c5a380995ab26 --- /dev/null +++ b/Zend/tests/try_finally_003.phpt @@ -0,0 +1,27 @@ +--TEST-- +Try finally +--FILE-- + +--EXPECTF-- +1234 +Fatal error: Uncaught exception 'Exception' with message 'ex' %s +Stack trace: +#0 %stry_finally_003.php(%d): foo() +#1 {main} + thrown in %stry_finally_003.php on line %d diff --git a/Zend/zend.c b/Zend/zend.c index 37a1a27c7d67b..09338e7f83436 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -258,6 +258,9 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop { TSRMLS_FETCH(); + if (zend_std_cast_object_tostring(expr, expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) { + break; + } if (Z_OBJ_HANDLER_P(expr, cast_object)) { zval *val; @@ -270,12 +273,6 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop } zval_ptr_dtor(&val); } - /* Standard PHP objects */ - if (Z_OBJ_HT_P(expr) == &std_object_handlers || !Z_OBJ_HANDLER_P(expr, cast_object)) { - if (zend_std_cast_object_tostring(expr, expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) { - break; - } - } if (!Z_OBJ_HANDLER_P(expr, cast_object) && Z_OBJ_HANDLER_P(expr, get)) { zval *z = Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC); @@ -1261,6 +1258,7 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co zend_file_handle *file_handle; zend_op_array *orig_op_array = EG(active_op_array); zval **orig_retval_ptr_ptr = EG(return_value_ptr_ptr); + long orig_interactive = CG(interactive); va_start(files, file_count); for (i = 0; i < file_count; i++) { @@ -1268,6 +1266,15 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co if (!file_handle) { continue; } + + if (orig_interactive) { + if (file_handle->filename[0] != '-' || file_handle->filename[1]) { + CG(interactive) = 0; + } else { + CG(interactive) = 1; + } + } + EG(active_op_array) = zend_compile_file(file_handle, type TSRMLS_CC); if (file_handle->opened_path) { int dummy = 1; @@ -1309,12 +1316,14 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co va_end(files); EG(active_op_array) = orig_op_array; EG(return_value_ptr_ptr) = orig_retval_ptr_ptr; + CG(interactive) = orig_interactive; return FAILURE; } } va_end(files); EG(active_op_array) = orig_op_array; EG(return_value_ptr_ptr) = orig_retval_ptr_ptr; + CG(interactive) = orig_interactive; return SUCCESS; } diff --git a/Zend/zend.h b/Zend/zend.h index 3226f8ce03ec4..39bf5be512fcf 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -133,6 +133,11 @@ char *alloca (); # endif #endif +/* Compatibility with non-clang compilers */ +#ifndef __has_attribute +# define __has_attribute(x) 0 +#endif + /* GCC x.y.z supplies __GNUC__ = x and __GNUC_MINOR__ = y */ #ifdef __GNUC__ # define ZEND_GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) @@ -146,6 +151,14 @@ char *alloca (); # define ZEND_ATTRIBUTE_MALLOC #endif +#if ZEND_GCC_VERSION >= 4003 || __has_attribute(alloc_size) +# define ZEND_ATTRIBUTE_ALLOC_SIZE(X) __attribute__ ((alloc_size(X))) +# define ZEND_ATTRIBUTE_ALLOC_SIZE2(X,Y) __attribute__ ((alloc_size(X,Y))) +#else +# define ZEND_ATTRIBUTE_ALLOC_SIZE(X) +# define ZEND_ATTRIBUTE_ALLOC_SIZE2(X,Y) +#endif + #if ZEND_GCC_VERSION >= 2007 # define ZEND_ATTRIBUTE_FORMAT(type, idx, first) __attribute__ ((format(type, idx, first))) #else diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 98a33e544508f..827446b26da58 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2547,16 +2547,15 @@ static const zend_function_entry disabled_class_new[] = { ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_DC) /* {{{ */ { - zend_class_entry disabled_class; + zend_class_entry **disabled_class; zend_str_tolower(class_name, class_name_length); - if (zend_hash_del(CG(class_table), class_name, class_name_length+1)==FAILURE) { + if (zend_hash_find(CG(class_table), class_name, class_name_length+1, (void **)&disabled_class)==FAILURE) { return FAILURE; } - INIT_OVERLOADED_CLASS_ENTRY_EX(disabled_class, class_name, class_name_length, disabled_class_new, NULL, NULL, NULL, NULL, NULL); - disabled_class.create_object = display_disabled_class; - disabled_class.name_length = class_name_length; - zend_register_internal_class(&disabled_class TSRMLS_CC); + INIT_CLASS_ENTRY_INIT_METHODS((**disabled_class), disabled_class_new, NULL, NULL, NULL, NULL, NULL); + (*disabled_class)->create_object = display_disabled_class; + zend_hash_clean(&((*disabled_class)->function_table)); return SUCCESS; } /* }}} */ @@ -2630,7 +2629,6 @@ static int zend_is_callable_check_class(const char *name, int name_len, zend_fca } /* }}} */ - static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fcall_info_cache *fcc, int strict_class, char **error TSRMLS_DC) /* {{{ */ { zend_class_entry *ce_org = fcc->calling_scope; diff --git a/Zend/zend_API.h b/Zend/zend_API.h index f54db7f2e87cc..d7fbc3c3afd1d 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -175,6 +175,11 @@ typedef struct _zend_fcall_info_cache { class_container.name = zend_strndup(cl_name, _len); \ } \ class_container.name_length = _len; \ + INIT_CLASS_ENTRY_INIT_METHODS(class_container, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \ + } + +#define INIT_CLASS_ENTRY_INIT_METHODS(class_container, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \ + { \ class_container.constructor = NULL; \ class_container.destructor = NULL; \ class_container.clone = NULL; \ diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 66cd23c7cbb5d..a29350d7bf11b 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -658,9 +658,9 @@ static unsigned int _mem_block_end_magic = 0; #define ZEND_MM_LARGE_BUCKET_INDEX(S) zend_mm_high_bit(S) -static void *_zend_mm_alloc_int(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; +static void *_zend_mm_alloc_int(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_ALLOC_SIZE(2); static void _zend_mm_free_int(zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); -static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); +static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_ALLOC_SIZE(3); static inline unsigned int zend_mm_high_bit(size_t _size) { diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h index b8b800e0d9717..6b071c28947e7 100644 --- a/Zend/zend_alloc.h +++ b/Zend/zend_alloc.h @@ -54,12 +54,12 @@ BEGIN_EXTERN_C() ZEND_API char *zend_strndup(const char *s, unsigned int length) ZEND_ATTRIBUTE_MALLOC; -ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; +ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_ALLOC_SIZE(1); ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; ZEND_API void *_safe_malloc(size_t nmemb, size_t size, size_t offset) ZEND_ATTRIBUTE_MALLOC; ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); -ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; -ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); +ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_ALLOC_SIZE2(1,2); +ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_ALLOC_SIZE(2); ZEND_API void *_safe_erealloc(void *ptr, size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); ZEND_API void *_safe_realloc(void *ptr, size_t nmemb, size_t size, size_t offset); ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 483ff30ddc7fd..427f56d72edac 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1685,7 +1685,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n zval key; if (CG(current_namespace)) { - /* Prefix function name with current namespcae name */ + /* Prefix function name with current namespace name */ znode tmp; tmp.u.constant = *CG(current_namespace); @@ -2731,6 +2731,7 @@ static int zend_add_try_element(zend_uint try_op TSRMLS_DC) /* {{{ */ CG(active_op_array)->try_catch_array = erealloc(CG(active_op_array)->try_catch_array, sizeof(zend_try_catch_element)*CG(active_op_array)->last_try_catch); CG(active_op_array)->try_catch_array[try_catch_offset].try_op = try_op; + CG(active_op_array)->try_catch_array[try_catch_offset].finally_op = 0; return try_catch_offset; } /* }}} */ @@ -2747,7 +2748,7 @@ void zend_do_first_catch(znode *open_parentheses TSRMLS_DC) /* {{{ */ } /* }}} */ -void zend_initialize_try_catch_element(const znode *try_token TSRMLS_DC) /* {{{ */ +void zend_initialize_try_catch_element(znode *catch_token TSRMLS_DC) /* {{{ */ { int jmp_op_number = get_next_op_number(CG(active_op_array)); zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -2764,7 +2765,7 @@ void zend_initialize_try_catch_element(const znode *try_token TSRMLS_DC) /* {{{ zend_stack_top(&CG(bp_stack), (void **) &jmp_list_ptr); zend_llist_add_element(jmp_list_ptr, &jmp_op_number); - zend_add_catch_element(try_token->u.op.opline_num, get_next_op_number(CG(active_op_array)) TSRMLS_CC); + catch_token->EA = get_next_op_number(CG(active_op_array)); } /* }}} */ @@ -2790,7 +2791,11 @@ void zend_do_try(znode *try_token TSRMLS_DC) /* {{{ */ } /* }}} */ -void zend_do_begin_catch(znode *try_token, znode *class_name, znode *catch_var, znode *first_catch TSRMLS_DC) /* {{{ */ +void zend_do_finally(znode *finally_token TSRMLS_DC) /* {{{ */ { + finally_token->u.op.opline_num = get_next_op_number(CG(active_op_array)); +} /* }}} */ + +void zend_do_begin_catch(znode *catch_token, znode *class_name, znode *catch_var, znode *first_catch TSRMLS_DC) /* {{{ */ { long catch_op_number; zend_op *opline; @@ -2818,11 +2823,11 @@ void zend_do_begin_catch(znode *try_token, znode *class_name, znode *catch_var, 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 */ - try_token->u.op.opline_num = catch_op_number; + catch_token->u.op.opline_num = catch_op_number; } /* }}} */ -void zend_do_end_catch(const znode *try_token TSRMLS_DC) /* {{{ */ +void zend_do_end_catch(znode *catch_token TSRMLS_DC) /* {{{ */ { int jmp_op_number = get_next_op_number(CG(active_op_array)); zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -2836,7 +2841,39 @@ void zend_do_end_catch(const znode *try_token TSRMLS_DC) /* {{{ */ zend_stack_top(&CG(bp_stack), (void **) &jmp_list_ptr); zend_llist_add_element(jmp_list_ptr, &jmp_op_number); - CG(active_op_array)->opcodes[try_token->u.op.opline_num].extended_value = get_next_op_number(CG(active_op_array)); + CG(active_op_array)->opcodes[catch_token->u.op.opline_num].extended_value = get_next_op_number(CG(active_op_array)); +} +/* }}} */ + +void zend_do_bind_catch(znode *try_token, znode *catch_token TSRMLS_DC) /* {{{ */ { + if (catch_token->op_type != IS_UNUSED) { + zend_add_catch_element(try_token->u.op.opline_num, catch_token->EA TSRMLS_CC); + } +} +/* }}} */ + + +void zend_do_end_finally(znode *try_token, znode* catch_token, znode *finally_token TSRMLS_DC) /* {{{ */ +{ + zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); + + 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"); + } + if (finally_token->op_type != IS_UNUSED) { + CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].finally_op = finally_token->u.op.opline_num; + //try_token->u.op.opline_num = catch_token->u.op.opline_num; + + opline->opcode = ZEND_LEAVE; + SET_UNUSED(opline->op1); + SET_UNUSED(opline->op2); + } + if (catch_token->op_type == IS_UNUSED) { + CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].catch_op = 0; + } //else { + // try_token->u.op.opline_num = catch_token->u.op.opline_num; + //} + } /* }}} */ @@ -3689,6 +3726,7 @@ ZEND_API void zend_do_implement_trait(zend_class_entry *ce, zend_class_entry *tr } } ce->traits[ce->num_traits++] = trait; + trait->refcount++; } } /* }}} */ @@ -3781,7 +3819,7 @@ static int zend_traits_merge_functions(zend_function *fn TSRMLS_DC, int num_args } else { /* Add it to result function table */ if (zend_hash_quick_add(resulting_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, fn, sizeof(zend_function), NULL)==FAILURE) { - zend_error(E_COMPILE_ERROR, "Trait method %s has not been applied, because failure occured during updating resulting trait method table", fn->common.function_name); + zend_error(E_COMPILE_ERROR, "Trait method %s has not been applied, because failure occurred during updating resulting trait method table", fn->common.function_name); } } @@ -3898,7 +3936,7 @@ static int zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int function_add_ref(&fn_copy); if (zend_hash_quick_update(&ce->function_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, &fn_copy, sizeof(zend_function), (void**)&fn_copy_p)==FAILURE) { - zend_error(E_COMPILE_ERROR, "Trait method %s has not been applied, because failure occured during updating class method table", hash_key->arKey); + zend_error(E_COMPILE_ERROR, "Trait method %s has not been applied, because failure occurred during updating class method table", hash_key->arKey); } zend_add_magic_methods(ce, hash_key->arKey, hash_key->nKeyLength, fn_copy_p TSRMLS_CC); @@ -3940,8 +3978,8 @@ static int zend_traits_copy_functions(zend_function *fn TSRMLS_DC, int num_args, fn_copy = *fn; function_add_ref(&fn_copy); /* this function_name is never destroyed, because its refcount - greater than 1, classes are always destoyed in reverse order - and trait is declared early than this class */ + greater than 1 and classes are always destoyed before the + traits they use */ fn_copy.common.function_name = aliases[i]->alias; /* if it is 0, no modifieres has been changed */ @@ -4146,14 +4184,14 @@ static void zend_do_traits_method_binding(zend_class_entry *ce TSRMLS_DC) /* {{{ size_t i; /* prepare copies of trait function tables for combination */ - function_tables = malloc(sizeof(HashTable*) * ce->num_traits); - resulting_table = (HashTable *) malloc(sizeof(HashTable)); + function_tables = emalloc(sizeof(HashTable*) * ce->num_traits); + resulting_table = (HashTable *)emalloc(sizeof(HashTable)); /* TODO: revisit this start size, may be its not optimal */ - zend_hash_init_ex(resulting_table, 10, NULL, NULL, 1, 0); + zend_hash_init_ex(resulting_table, 10, NULL, NULL, 0, 0); for (i = 0; i < ce->num_traits; i++) { - function_tables[i] = (HashTable *) malloc(sizeof(HashTable)); + function_tables[i] = (HashTable *)emalloc(sizeof(HashTable)); zend_hash_init_ex(function_tables[i], ce->traits[i]->function_table.nNumOfElements, NULL, NULL, 1, 0); if (ce->trait_precedences) { @@ -4186,14 +4224,14 @@ static void zend_do_traits_method_binding(zend_class_entry *ce TSRMLS_DC) /* {{{ for (i = 0; i < ce->num_traits; i++) { /* zend_hash_destroy(function_tables[i]); */ zend_hash_graceful_destroy(function_tables[i]); - free(function_tables[i]); + efree(function_tables[i]); } - free(function_tables); + efree(function_tables); /* free temporary resulting table */ /* zend_hash_destroy(resulting_table); */ zend_hash_graceful_destroy(resulting_table); - free(resulting_table); + efree(resulting_table); } /* }}} */ @@ -6159,7 +6197,16 @@ void zend_do_isset_or_isempty(int type, znode *result, znode *variable TSRMLS_DC zend_do_end_variable_parse(variable, BP_VAR_IS, 0 TSRMLS_CC); - zend_check_writable_variable(variable); + if (zend_is_function_or_method_call(variable)) { + if (type == ZEND_ISEMPTY) { + /* 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)"); + } + + return; + } if (variable->op_type == IS_CV) { last_op = get_next_op(CG(active_op_array) TSRMLS_CC); diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 1972f85c66785..bafc90044b0d2 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -132,6 +132,7 @@ typedef struct _zend_label { typedef struct _zend_try_catch_element { zend_uint try_op; zend_uint catch_op; /* ketchup! */ + zend_uint finally_op; } zend_try_catch_element; #if SIZEOF_LONG == 8 @@ -382,6 +383,7 @@ struct _zend_execute_data { zend_class_entry *current_called_scope; zval *current_this; zval *current_object; + zend_bool leaving; }; #define EX(element) execute_data.element @@ -499,7 +501,7 @@ void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC); void zend_do_try(znode *try_token TSRMLS_DC); void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var, znode *first_catch TSRMLS_DC); -void zend_do_end_catch(const znode *try_token TSRMLS_DC); +void zend_do_end_catch(znode *catch_token TSRMLS_DC); void zend_do_throw(const znode *expr TSRMLS_DC); ZEND_API int do_bind_function(const zend_op_array *op_array, zend_op *opline, HashTable *function_table, zend_bool compile_time); @@ -521,10 +523,6 @@ void zend_prepare_trait_precedence(znode *result, znode *method_reference, znode void zend_prepare_reference(znode *result, znode *class_name, znode *method_name TSRMLS_DC); void zend_prepare_trait_alias(znode *result, znode *method_reference, znode *modifiers, znode *alias TSRMLS_DC); -void init_trait_alias_list(znode* result, const znode* trait_alias TSRMLS_DC); -void add_trait_alias(znode* result, const znode* trait_alias TSRMLS_DC); -void init_trait_alias(znode* result, const znode* method_name, const znode* alias, const znode* modifiers TSRMLS_DC); - ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce TSRMLS_DC); void zend_do_early_binding(TSRMLS_D); ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array TSRMLS_DC); @@ -669,7 +667,7 @@ void print_op_array(zend_op_array *op_array, int optimizations); ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC); zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array); void zend_do_first_catch(znode *open_parentheses TSRMLS_DC); -void zend_initialize_try_catch_element(const znode *try_token TSRMLS_DC); +void zend_initialize_try_catch_element(znode *catch_token TSRMLS_DC); void zend_do_mark_last_catch(const znode *first_catch, const znode *last_additional_catch TSRMLS_DC); ZEND_API zend_bool zend_is_compiling(TSRMLS_D); ZEND_API char *zend_make_compiled_string_description(const char *name TSRMLS_DC); diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 7bb7792a4c805..787e66bfe991d 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -29,8 +29,8 @@ #include "zend_vm.h" #include "zend_dtrace.h" -zend_class_entry *default_exception_ce; -zend_class_entry *error_exception_ce; +static zend_class_entry *default_exception_ce; +static zend_class_entry *error_exception_ce; static zend_object_handlers default_exception_handlers; ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC); diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 0e40650fb5e7f..149b91233cc79 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -555,11 +555,10 @@ static inline void make_real_object(zval **object_ptr TSRMLS_DC) || (Z_TYPE_PP(object_ptr) == IS_BOOL && Z_LVAL_PP(object_ptr) == 0) || (Z_TYPE_PP(object_ptr) == IS_STRING && Z_STRLEN_PP(object_ptr) == 0) ) { - zend_error(E_WARNING, "Creating default object from empty value"); - SEPARATE_ZVAL_IF_NOT_REF(object_ptr); zval_dtor(*object_ptr); object_init(*object_ptr); + zend_error(E_WARNING, "Creating default object from empty value"); } } @@ -1163,7 +1162,7 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container case IS_DOUBLE: case IS_NULL: case IS_BOOL: - zend_error(E_NOTICE, "String offset cast occured"); + zend_error(E_NOTICE, "String offset cast occurred"); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -1286,7 +1285,7 @@ static void zend_fetch_dimension_address_read(temp_variable *result, zval **cont case IS_NULL: case IS_BOOL: if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "String offset cast occured"); + zend_error(E_NOTICE, "String offset cast occurred"); } break; default: diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index 84ca1de345217..1bd64394ac192 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -330,7 +330,7 @@ END_EXTERN_C() if (idx-1 > LONG_MAX) { /* overflow */ \ break; \ } \ - idx = (ulong)(-(long)idx); \ + idx = 0 - idx; \ } else if (idx > LONG_MAX) { /* overflow */ \ break; \ } \ diff --git a/Zend/zend_ini_scanner.c b/Zend/zend_ini_scanner.c index 4bbf604bd4969..470f5236003e4 100644 --- a/Zend/zend_ini_scanner.c +++ b/Zend/zend_ini_scanner.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Sat Feb 25 22:04:14 2012 */ +/* Generated by re2c 0.13.5 on Thu Jun 7 17:55:40 2012 */ #line 1 "Zend/zend_ini_scanner.l" /* +----------------------------------------------------------------------+ @@ -481,7 +481,7 @@ int ini_lex(zval *ini_lval TSRMLS_DC) yy5: YYDEBUG(5, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 547 "Zend/zend_ini_scanner.l" +#line 568 "Zend/zend_ini_scanner.l" { /* eat whitespace */ goto restart; @@ -493,7 +493,7 @@ int ini_lex(zval *ini_lval TSRMLS_DC) yy7: YYDEBUG(7, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 552 "Zend/zend_ini_scanner.l" +#line 573 "Zend/zend_ini_scanner.l" { SCNG(lineno)++; return END_OF_LINE; @@ -533,7 +533,7 @@ int ini_lex(zval *ini_lval TSRMLS_DC) ++YYCURSOR; YYDEBUG(11, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 475 "Zend/zend_ini_scanner.l" +#line 496 "Zend/zend_ini_scanner.l" { /* Disallow these chars outside option values */ return yytext[0]; } @@ -554,7 +554,7 @@ int ini_lex(zval *ini_lval TSRMLS_DC) goto yy54; YYDEBUG(15, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" +#line 596 "Zend/zend_ini_scanner.l" { return 0; } @@ -926,7 +926,7 @@ int ini_lex(zval *ini_lval TSRMLS_DC) yy56: YYDEBUG(56, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 557 "Zend/zend_ini_scanner.l" +#line 578 "Zend/zend_ini_scanner.l" { /* Comment */ BEGIN(INITIAL); SCNG(lineno)++; @@ -1012,7 +1012,7 @@ int ini_lex(zval *ini_lval TSRMLS_DC) yy65: YYDEBUG(65, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 563 "Zend/zend_ini_scanner.l" +#line 584 "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); @@ -1159,7 +1159,7 @@ int ini_lex(zval *ini_lval TSRMLS_DC) yy76: YYDEBUG(76, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 507 "Zend/zend_ini_scanner.l" +#line 528 "Zend/zend_ini_scanner.l" { /* Escape double quoted string contents */ if (YYCURSOR > YYLIMIT) { return 0; @@ -1204,7 +1204,7 @@ int ini_lex(zval *ini_lval TSRMLS_DC) yy78: YYDEBUG(78, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 502 "Zend/zend_ini_scanner.l" +#line 523 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string ends */ yy_pop_state(TSRMLS_C); return '"'; @@ -1323,7 +1323,7 @@ int ini_lex(zval *ini_lval TSRMLS_DC) yy87: YYDEBUG(87, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 493 "Zend/zend_ini_scanner.l" +#line 514 "Zend/zend_ini_scanner.l" { /* Get rest as section/offset value */ RETURN_TOKEN(TC_STRING, yytext, yyleng); } @@ -1344,7 +1344,7 @@ int ini_lex(zval *ini_lval TSRMLS_DC) yy90: YYDEBUG(90, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" +#line 596 "Zend/zend_ini_scanner.l" { return 0; } @@ -1355,7 +1355,7 @@ int ini_lex(zval *ini_lval TSRMLS_DC) yy92: YYDEBUG(92, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 497 "Zend/zend_ini_scanner.l" +#line 518 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string start */ yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); return '"'; @@ -1422,7 +1422,7 @@ int ini_lex(zval *ini_lval TSRMLS_DC) yy98: YYDEBUG(98, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 471 "Zend/zend_ini_scanner.l" +#line 492 "Zend/zend_ini_scanner.l" { /* Get number option value as string */ RETURN_TOKEN(TC_NUMBER, yytext, yyleng); } @@ -1452,7 +1452,7 @@ int ini_lex(zval *ini_lval TSRMLS_DC) yy100: YYDEBUG(100, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 467 "Zend/zend_ini_scanner.l" +#line 488 "Zend/zend_ini_scanner.l" { /* Get constant option value */ RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); } @@ -1833,7 +1833,7 @@ int ini_lex(zval *ini_lval TSRMLS_DC) 160, 224, 0, 160, 160, 0, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, - 224, 160, 160, 160, 160, 160, 160, 160, + 224, 160, 32, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 32, 160, 160, 160, 160, @@ -1865,66 +1865,64 @@ int ini_lex(zval *ini_lval TSRMLS_DC) YYDEBUG(135, *YYCURSOR); YYFILL(3); yych = *YYCURSOR; - if (yych <= '\f') { - if (yych <= 0x08) { - if (yych >= 0x01) goto yy139; + if (yych <= '\r') { + if (yych <= '\t') { + if (yych <= 0x00) goto yy137; + if (yych <= 0x08) goto yy139; + goto yy141; } else { - if (yych <= '\t') goto yy141; if (yych <= '\n') goto yy142; - goto yy139; + if (yych <= '\f') goto yy139; + goto yy144; } } else { - if (yych <= ' ') { - if (yych <= '\r') goto yy144; - if (yych <= 0x1F) goto yy139; - goto yy141; + if (yych <= '!') { + if (yych == ' ') goto yy141; + goto yy139; } else { - if (yych == ';') goto yy145; + if (yych <= '"') goto yy145; + if (yych == ';') goto yy147; goto yy139; } } +yy137: YYDEBUG(137, *YYCURSOR); ++YYCURSOR; YYDEBUG(138, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 570 "Zend/zend_ini_scanner.l" +#line 591 "Zend/zend_ini_scanner.l" { /* End of option value (if EOF is reached before EOL */ BEGIN(INITIAL); return END_OF_LINE; } -#line 1896 "Zend/zend_ini_scanner.c" +#line 1899 "Zend/zend_ini_scanner.c" yy139: YYDEBUG(139, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy156; + goto yy158; yy140: YYDEBUG(140, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 448 "Zend/zend_ini_scanner.l" +#line 474 "Zend/zend_ini_scanner.l" { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ - /* Eat leading and trailing double quotes */ - if (yytext[0] == '"' && yytext[yyleng - 1] == '"') { - SCNG(yy_text)++; - yyleng = yyleng - 2; - } RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 1914 "Zend/zend_ini_scanner.c" +#line 1912 "Zend/zend_ini_scanner.c" yy141: YYDEBUG(141, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 64) { - goto yy152; + goto yy154; } if (yych <= '\f') { - if (yych == '\n') goto yy151; - goto yy156; + if (yych == '\n') goto yy153; + goto yy158; } else { - if (yych <= '\r') goto yy154; - if (yych == ';') goto yy146; - goto yy156; + if (yych <= '\r') goto yy156; + if (yych == ';') goto yy148; + goto yy158; } yy142: YYDEBUG(142, *YYCURSOR); @@ -1932,89 +1930,129 @@ int ini_lex(zval *ini_lval TSRMLS_DC) yy143: YYDEBUG(143, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 461 "Zend/zend_ini_scanner.l" +#line 482 "Zend/zend_ini_scanner.l" { /* End of option value */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 1942 "Zend/zend_ini_scanner.c" +#line 1940 "Zend/zend_ini_scanner.c" yy144: YYDEBUG(144, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '\n') goto yy151; + if (yych == '\n') goto yy153; goto yy143; yy145: YYDEBUG(145, *YYCURSOR); - yyaccept = 1; - yych = *(YYMARKER = ++YYCURSOR); - goto yy147; -yy146: - YYDEBUG(146, *YYCURSOR); ++YYCURSOR; - YYFILL(2); - yych = *YYCURSOR; + YYDEBUG(146, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 448 "Zend/zend_ini_scanner.l" + { + while (YYCURSOR < YYLIMIT) { + switch (*YYCURSOR++) { + case '\n': + SCNG(lineno)++; + break; + case '\r': + if (*YYCURSOR != '\n') { + SCNG(lineno)++; + } + break; + case '"': + yyleng = YYCURSOR - SCNG(yy_text) - 2; + SCNG(yy_text)++; + RETURN_TOKEN(TC_RAW, yytext, yyleng); + case '\\': + if (YYCURSOR < YYLIMIT) { + YYCURSOR++; + } + break; + } + } + yyleng = YYCURSOR - SCNG(yy_text); + RETURN_TOKEN(TC_RAW, yytext, yyleng); +} +#line 1977 "Zend/zend_ini_scanner.c" yy147: YYDEBUG(147, *YYCURSOR); - if (yybm[0+yych] & 32) { - goto yy146; - } - if (yych >= '\r') goto yy150; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + goto yy149; yy148: YYDEBUG(148, *YYCURSOR); ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; yy149: YYDEBUG(149, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy148; + } + if (yych >= '\r') goto yy152; +yy150: + YYDEBUG(150, *YYCURSOR); + ++YYCURSOR; +yy151: + YYDEBUG(151, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 557 "Zend/zend_ini_scanner.l" +#line 578 "Zend/zend_ini_scanner.l" { /* Comment */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 1976 "Zend/zend_ini_scanner.c" -yy150: - YYDEBUG(150, *YYCURSOR); +#line 2006 "Zend/zend_ini_scanner.c" +yy152: + YYDEBUG(152, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '\n') goto yy148; - goto yy149; -yy151: - YYDEBUG(151, *YYCURSOR); + if (yych == '\n') goto yy150; + goto yy151; +yy153: + YYDEBUG(153, *YYCURSOR); yych = *++YYCURSOR; goto yy143; -yy152: - YYDEBUG(152, *YYCURSOR); +yy154: + YYDEBUG(154, *YYCURSOR); yyaccept = 0; YYMARKER = ++YYCURSOR; YYFILL(2); yych = *YYCURSOR; - YYDEBUG(153, *YYCURSOR); + YYDEBUG(155, *YYCURSOR); if (yybm[0+yych] & 64) { - goto yy152; + goto yy154; } - if (yych <= '\f') { - if (yych <= 0x00) goto yy140; - if (yych == '\n') goto yy151; - goto yy155; + if (yych <= '\r') { + if (yych <= '\t') { + if (yych <= 0x00) goto yy140; + goto yy157; + } else { + if (yych <= '\n') goto yy153; + if (yych <= '\f') goto yy157; + } } else { - if (yych <= '\r') goto yy154; - if (yych == ';') goto yy146; - goto yy155; + if (yych <= '"') { + if (yych <= '!') goto yy157; + goto yy140; + } else { + if (yych == ';') goto yy148; + goto yy157; + } } -yy154: - YYDEBUG(154, *YYCURSOR); +yy156: + YYDEBUG(156, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '\n') goto yy151; + if (yych == '\n') goto yy153; goto yy143; -yy155: - YYDEBUG(155, *YYCURSOR); +yy157: + YYDEBUG(157, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy156: - YYDEBUG(156, *YYCURSOR); +yy158: + YYDEBUG(158, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy155; + goto yy157; } goto yy140; } @@ -2055,44 +2093,44 @@ int ini_lex(zval *ini_lval TSRMLS_DC) 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, }; - YYDEBUG(157, *YYCURSOR); + YYDEBUG(159, *YYCURSOR); YYFILL(3); yych = *YYCURSOR; if (yych <= '\f') { - if (yych == '\n') goto yy161; + if (yych == '\n') goto yy163; } else { - if (yych <= '\r') goto yy161; - if (yych == ']') goto yy163; + if (yych <= '\r') goto yy163; + if (yych == ']') goto yy165; } - YYDEBUG(159, *YYCURSOR); + YYDEBUG(161, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy170; -yy160: - YYDEBUG(160, *YYCURSOR); + goto yy172; +yy162: + YYDEBUG(162, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 457 "Zend/zend_ini_scanner.l" +#line 478 "Zend/zend_ini_scanner.l" { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 2079 "Zend/zend_ini_scanner.c" -yy161: - YYDEBUG(161, *YYCURSOR); +#line 2117 "Zend/zend_ini_scanner.c" +yy163: + YYDEBUG(163, *YYCURSOR); ++YYCURSOR; - YYDEBUG(162, *YYCURSOR); + YYDEBUG(164, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" +#line 596 "Zend/zend_ini_scanner.l" { return 0; } -#line 2089 "Zend/zend_ini_scanner.c" -yy163: - YYDEBUG(163, *YYCURSOR); +#line 2127 "Zend/zend_ini_scanner.c" +yy165: + YYDEBUG(165, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy166; -yy164: - YYDEBUG(164, *YYCURSOR); + goto yy168; +yy166: + YYDEBUG(166, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 377 "Zend/zend_ini_scanner.l" { /* End of section */ @@ -2100,40 +2138,40 @@ int ini_lex(zval *ini_lval TSRMLS_DC) SCNG(lineno)++; return ']'; } -#line 2104 "Zend/zend_ini_scanner.c" -yy165: - YYDEBUG(165, *YYCURSOR); +#line 2142 "Zend/zend_ini_scanner.c" +yy167: + YYDEBUG(167, *YYCURSOR); ++YYCURSOR; YYFILL(2); yych = *YYCURSOR; -yy166: - YYDEBUG(166, *YYCURSOR); - if (yybm[0+yych] & 64) { - goto yy165; - } - if (yych == '\n') goto yy167; - if (yych == '\r') goto yy168; - goto yy164; -yy167: - YYDEBUG(167, *YYCURSOR); - yych = *++YYCURSOR; - goto yy164; yy168: YYDEBUG(168, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy167; - goto yy164; + if (yybm[0+yych] & 64) { + goto yy167; + } + if (yych == '\n') goto yy169; + if (yych == '\r') goto yy170; + goto yy166; yy169: YYDEBUG(169, *YYCURSOR); + yych = *++YYCURSOR; + goto yy166; +yy170: + YYDEBUG(170, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy169; + goto yy166; +yy171: + YYDEBUG(171, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy170: - YYDEBUG(170, *YYCURSOR); +yy172: + YYDEBUG(172, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy169; + goto yy171; } - goto yy160; + goto yy162; } /* *********************************** */ yyc_ST_SECTION_VALUE: @@ -2172,203 +2210,203 @@ int ini_lex(zval *ini_lval TSRMLS_DC) 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, }; - YYDEBUG(171, *YYCURSOR); + YYDEBUG(173, *YYCURSOR); YYFILL(3); yych = *YYCURSOR; if (yych <= '-') { if (yych <= ' ') { if (yych <= '\n') { - if (yych <= 0x08) goto yy173; - if (yych <= '\t') goto yy175; - goto yy176; + if (yych <= 0x08) goto yy175; + if (yych <= '\t') goto yy177; + goto yy178; } else { - if (yych == '\r') goto yy176; - if (yych >= ' ') goto yy175; + if (yych == '\r') goto yy178; + if (yych >= ' ') goto yy177; } } else { if (yych <= '$') { - if (yych == '"') goto yy178; - if (yych >= '$') goto yy180; + if (yych == '"') goto yy180; + if (yych >= '$') goto yy182; } else { - if (yych == '\'') goto yy181; - if (yych >= '-') goto yy182; + if (yych == '\'') goto yy183; + if (yych >= '-') goto yy184; } } } else { if (yych <= 'Z') { if (yych <= '9') { - if (yych <= '.') goto yy183; - if (yych >= '0') goto yy184; + if (yych <= '.') goto yy185; + if (yych >= '0') goto yy186; } else { - if (yych == ';') goto yy176; - if (yych >= 'A') goto yy186; + if (yych == ';') goto yy178; + if (yych >= 'A') goto yy188; } } else { if (yych <= '^') { - if (yych <= '[') goto yy173; - if (yych <= '\\') goto yy188; - if (yych <= ']') goto yy189; + if (yych <= '[') goto yy175; + if (yych <= '\\') goto yy190; + if (yych <= ']') goto yy191; } else { - if (yych == '`') goto yy173; - if (yych <= 'z') goto yy186; + if (yych == '`') goto yy175; + if (yych <= 'z') goto yy188; } } } -yy173: - YYDEBUG(173, *YYCURSOR); +yy175: + YYDEBUG(175, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); - goto yy196; -yy174: - YYDEBUG(174, *YYCURSOR); + goto yy198; +yy176: + YYDEBUG(176, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 493 "Zend/zend_ini_scanner.l" +#line 514 "Zend/zend_ini_scanner.l" { /* Get rest as section/offset value */ RETURN_TOKEN(TC_STRING, yytext, yyleng); } -#line 2230 "Zend/zend_ini_scanner.c" -yy175: - YYDEBUG(175, *YYCURSOR); +#line 2268 "Zend/zend_ini_scanner.c" +yy177: + YYDEBUG(177, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); if (yych <= 0x1F) { - if (yych == '\t') goto yy222; - goto yy196; + if (yych == '\t') goto yy224; + goto yy198; } else { - if (yych <= ' ') goto yy222; - if (yych == '"') goto yy224; - goto yy196; + if (yych <= ' ') goto yy224; + if (yych == '"') goto yy226; + goto yy198; } -yy176: - YYDEBUG(176, *YYCURSOR); +yy178: + YYDEBUG(178, *YYCURSOR); ++YYCURSOR; -yy177: - YYDEBUG(177, *YYCURSOR); +yy179: + YYDEBUG(179, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" +#line 596 "Zend/zend_ini_scanner.l" { return 0; } -#line 2253 "Zend/zend_ini_scanner.c" -yy178: - YYDEBUG(178, *YYCURSOR); +#line 2291 "Zend/zend_ini_scanner.c" +yy180: + YYDEBUG(180, *YYCURSOR); ++YYCURSOR; -yy179: - YYDEBUG(179, *YYCURSOR); +yy181: + YYDEBUG(181, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 497 "Zend/zend_ini_scanner.l" +#line 518 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string start */ yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); return '"'; } -#line 2265 "Zend/zend_ini_scanner.c" -yy180: - YYDEBUG(180, *YYCURSOR); +#line 2303 "Zend/zend_ini_scanner.c" +yy182: + YYDEBUG(182, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '\\') { - if (yych <= 0x00) goto yy177; - if (yych <= '[') goto yy195; - goto yy200; + if (yych <= 0x00) goto yy179; + if (yych <= '[') goto yy197; + goto yy202; } else { - if (yych == '{') goto yy220; - goto yy195; + if (yych == '{') goto yy222; + goto yy197; } -yy181: - YYDEBUG(181, *YYCURSOR); +yy183: + YYDEBUG(183, *YYCURSOR); yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 128) { - goto yy216; + goto yy218; } - goto yy177; -yy182: - YYDEBUG(182, *YYCURSOR); + goto yy179; +yy184: + YYDEBUG(184, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy196; - if (yych <= '9') goto yy214; - goto yy196; -yy183: - YYDEBUG(183, *YYCURSOR); + if (yych <= '/') goto yy198; + if (yych <= '9') goto yy216; + goto yy198; +yy185: + YYDEBUG(185, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy196; - if (yych <= '9') goto yy212; - goto yy196; -yy184: - YYDEBUG(184, *YYCURSOR); + if (yych <= '/') goto yy198; + if (yych <= '9') goto yy214; + goto yy198; +yy186: + YYDEBUG(186, *YYCURSOR); yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '\'') { if (yych <= '\r') { - if (yych == '\n') goto yy185; - if (yych <= '\f') goto yy196; + if (yych == '\n') goto yy187; + if (yych <= '\f') goto yy198; } else { - if (yych == '"') goto yy185; - if (yych <= '&') goto yy196; + if (yych == '"') goto yy187; + if (yych <= '&') goto yy198; } } else { if (yych <= '9') { - if (yych == '.') goto yy208; - if (yych <= '/') goto yy196; - goto yy210; + if (yych == '.') goto yy210; + if (yych <= '/') goto yy198; + goto yy212; } else { if (yych <= ';') { - if (yych <= ':') goto yy196; + if (yych <= ':') goto yy198; } else { - if (yych != ']') goto yy196; + if (yych != ']') goto yy198; } } } -yy185: - YYDEBUG(185, *YYCURSOR); +yy187: + YYDEBUG(187, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 471 "Zend/zend_ini_scanner.l" +#line 492 "Zend/zend_ini_scanner.l" { /* Get number option value as string */ RETURN_TOKEN(TC_NUMBER, yytext, yyleng); } -#line 2331 "Zend/zend_ini_scanner.c" -yy186: - YYDEBUG(186, *YYCURSOR); +#line 2369 "Zend/zend_ini_scanner.c" +yy188: + YYDEBUG(188, *YYCURSOR); yyaccept = 3; yych = *(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 32) { - goto yy206; + goto yy208; } if (yych <= '"') { if (yych <= '\f') { - if (yych != '\n') goto yy196; + if (yych != '\n') goto yy198; } else { - if (yych <= '\r') goto yy187; - if (yych <= '!') goto yy196; + if (yych <= '\r') goto yy189; + if (yych <= '!') goto yy198; } } else { if (yych <= ':') { - if (yych != '\'') goto yy196; + if (yych != '\'') goto yy198; } else { - if (yych <= ';') goto yy187; - if (yych != ']') goto yy196; + if (yych <= ';') goto yy189; + if (yych != ']') goto yy198; } } -yy187: - YYDEBUG(187, *YYCURSOR); +yy189: + YYDEBUG(189, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 467 "Zend/zend_ini_scanner.l" +#line 488 "Zend/zend_ini_scanner.l" { /* Get constant option value */ RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); } -#line 2361 "Zend/zend_ini_scanner.c" -yy188: - YYDEBUG(188, *YYCURSOR); +#line 2399 "Zend/zend_ini_scanner.c" +yy190: + YYDEBUG(190, *YYCURSOR); yych = *++YYCURSOR; - goto yy195; -yy189: - YYDEBUG(189, *YYCURSOR); + goto yy197; +yy191: + YYDEBUG(191, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy192; -yy190: - YYDEBUG(190, *YYCURSOR); + goto yy194; +yy192: + YYDEBUG(192, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 377 "Zend/zend_ini_scanner.l" { /* End of section */ @@ -2376,97 +2414,86 @@ int ini_lex(zval *ini_lval TSRMLS_DC) SCNG(lineno)++; return ']'; } -#line 2380 "Zend/zend_ini_scanner.c" -yy191: - YYDEBUG(191, *YYCURSOR); +#line 2418 "Zend/zend_ini_scanner.c" +yy193: + YYDEBUG(193, *YYCURSOR); ++YYCURSOR; YYFILL(2); yych = *YYCURSOR; -yy192: - YYDEBUG(192, *YYCURSOR); - if (yybm[0+yych] & 2) { - goto yy191; - } - if (yych == '\n') goto yy193; - if (yych == '\r') goto yy194; - goto yy190; -yy193: - YYDEBUG(193, *YYCURSOR); - yych = *++YYCURSOR; - goto yy190; yy194: YYDEBUG(194, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy193; - goto yy190; + if (yybm[0+yych] & 2) { + goto yy193; + } + if (yych == '\n') goto yy195; + if (yych == '\r') goto yy196; + goto yy192; yy195: YYDEBUG(195, *YYCURSOR); + yych = *++YYCURSOR; + goto yy192; +yy196: + YYDEBUG(196, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy195; + goto yy192; +yy197: + YYDEBUG(197, *YYCURSOR); yyaccept = 0; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy196: - YYDEBUG(196, *YYCURSOR); +yy198: + YYDEBUG(198, *YYCURSOR); if (yybm[0+yych] & 4) { - goto yy195; + goto yy197; } - if (yych == '$') goto yy198; - if (yych != '\\') goto yy174; -yy197: - YYDEBUG(197, *YYCURSOR); + if (yych == '$') goto yy200; + if (yych != '\\') goto yy176; +yy199: + YYDEBUG(199, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - goto yy195; -yy198: - YYDEBUG(198, *YYCURSOR); + goto yy197; +yy200: + YYDEBUG(200, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; if (yych <= '\\') { - if (yych <= 0x00) goto yy199; - if (yych <= '[') goto yy195; - goto yy200; + if (yych <= 0x00) goto yy201; + if (yych <= '[') goto yy197; + goto yy202; } else { - if (yych != '{') goto yy195; + if (yych != '{') goto yy197; } -yy199: - YYDEBUG(199, *YYCURSOR); +yy201: + YYDEBUG(201, *YYCURSOR); YYCURSOR = YYMARKER; if (yyaccept <= 1) { if (yyaccept <= 0) { - goto yy174; + goto yy176; } else { - goto yy177; + goto yy179; } } else { if (yyaccept <= 2) { - goto yy185; - } else { goto yy187; + } else { + goto yy189; } } -yy200: - YYDEBUG(200, *YYCURSOR); +yy202: + YYDEBUG(202, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; if (yybm[0+yych] & 8) { - goto yy201; - } - if (yych == '\\') goto yy203; - goto yy195; -yy201: - YYDEBUG(201, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(202, *YYCURSOR); - if (yybm[0+yych] & 8) { - goto yy201; + goto yy203; } if (yych == '\\') goto yy205; - goto yy195; + goto yy197; yy203: YYDEBUG(203, *YYCURSOR); ++YYCURSOR; @@ -2474,219 +2501,230 @@ int ini_lex(zval *ini_lval TSRMLS_DC) yych = *YYCURSOR; YYDEBUG(204, *YYCURSOR); if (yybm[0+yych] & 8) { - goto yy201; + goto yy203; } - if (yych == '\\') goto yy203; - goto yy195; + if (yych == '\\') goto yy207; + goto yy197; yy205: YYDEBUG(205, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; + YYDEBUG(206, *YYCURSOR); if (yybm[0+yych] & 8) { - goto yy201; + goto yy203; } - if (yych == '\\') goto yy203; - goto yy195; -yy206: - YYDEBUG(206, *YYCURSOR); + if (yych == '\\') goto yy205; + goto yy197; +yy207: + YYDEBUG(207, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 8) { + goto yy203; + } + if (yych == '\\') goto yy205; + goto yy197; +yy208: + YYDEBUG(208, *YYCURSOR); yyaccept = 3; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(207, *YYCURSOR); + YYDEBUG(209, *YYCURSOR); if (yybm[0+yych] & 32) { - goto yy206; + goto yy208; } if (yych <= '$') { if (yych <= '\r') { - if (yych == '\n') goto yy187; - if (yych <= '\f') goto yy195; - goto yy187; + if (yych == '\n') goto yy189; + if (yych <= '\f') goto yy197; + goto yy189; } else { - if (yych == '"') goto yy187; - if (yych <= '#') goto yy195; - goto yy198; + if (yych == '"') goto yy189; + if (yych <= '#') goto yy197; + goto yy200; } } else { if (yych <= ';') { - if (yych == '\'') goto yy187; - if (yych <= ':') goto yy195; - goto yy187; + if (yych == '\'') goto yy189; + if (yych <= ':') goto yy197; + goto yy189; } else { - if (yych <= '[') goto yy195; - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy187; - goto yy195; + if (yych <= '[') goto yy197; + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy189; + goto yy197; } } -yy208: - YYDEBUG(208, *YYCURSOR); +yy210: + YYDEBUG(210, *YYCURSOR); yyaccept = 2; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(209, *YYCURSOR); + YYDEBUG(211, *YYCURSOR); if (yybm[0+yych] & 64) { - goto yy208; + goto yy210; } if (yych <= '$') { if (yych <= '\r') { - if (yych == '\n') goto yy185; - if (yych <= '\f') goto yy195; - goto yy185; + if (yych == '\n') goto yy187; + if (yych <= '\f') goto yy197; + goto yy187; } else { - if (yych == '"') goto yy185; - if (yych <= '#') goto yy195; - goto yy198; + if (yych == '"') goto yy187; + if (yych <= '#') goto yy197; + goto yy200; } } else { if (yych <= ';') { - if (yych == '\'') goto yy185; - if (yych <= ':') goto yy195; - goto yy185; + if (yych == '\'') goto yy187; + if (yych <= ':') goto yy197; + goto yy187; } else { - if (yych <= '[') goto yy195; - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy185; - goto yy195; + if (yych <= '[') goto yy197; + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy187; + goto yy197; } } -yy210: - YYDEBUG(210, *YYCURSOR); +yy212: + YYDEBUG(212, *YYCURSOR); yyaccept = 2; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(211, *YYCURSOR); + YYDEBUG(213, *YYCURSOR); if (yych <= '\'') { if (yych <= '!') { if (yych <= '\n') { - if (yych <= '\t') goto yy195; - goto yy185; + if (yych <= '\t') goto yy197; + goto yy187; } else { - if (yych == '\r') goto yy185; - goto yy195; + if (yych == '\r') goto yy187; + goto yy197; } } else { if (yych <= '#') { - if (yych <= '"') goto yy185; - goto yy195; + if (yych <= '"') goto yy187; + goto yy197; } else { - if (yych <= '$') goto yy198; - if (yych <= '&') goto yy195; - goto yy185; + if (yych <= '$') goto yy200; + if (yych <= '&') goto yy197; + goto yy187; } } } else { if (yych <= ':') { if (yych <= '.') { - if (yych <= '-') goto yy195; - goto yy208; + if (yych <= '-') goto yy197; + goto yy210; } else { - if (yych <= '/') goto yy195; - if (yych <= '9') goto yy210; - goto yy195; + if (yych <= '/') goto yy197; + if (yych <= '9') goto yy212; + goto yy197; } } else { if (yych <= '[') { - if (yych <= ';') goto yy185; - goto yy195; + if (yych <= ';') goto yy187; + goto yy197; } else { - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy185; - goto yy195; + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy187; + goto yy197; } } } -yy212: - YYDEBUG(212, *YYCURSOR); +yy214: + YYDEBUG(214, *YYCURSOR); yyaccept = 2; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(213, *YYCURSOR); + YYDEBUG(215, *YYCURSOR); if (yych <= '&') { if (yych <= '\r') { - if (yych == '\n') goto yy185; - if (yych <= '\f') goto yy195; - goto yy185; + if (yych == '\n') goto yy187; + if (yych <= '\f') goto yy197; + goto yy187; } else { if (yych <= '"') { - if (yych <= '!') goto yy195; - goto yy185; + if (yych <= '!') goto yy197; + goto yy187; } else { - if (yych == '$') goto yy198; - goto yy195; + if (yych == '$') goto yy200; + goto yy197; } } } else { if (yych <= ':') { - if (yych <= '\'') goto yy185; - if (yych <= '/') goto yy195; - if (yych <= '9') goto yy212; - goto yy195; + if (yych <= '\'') goto yy187; + if (yych <= '/') goto yy197; + if (yych <= '9') goto yy214; + goto yy197; } else { if (yych <= '[') { - if (yych <= ';') goto yy185; - goto yy195; + if (yych <= ';') goto yy187; + goto yy197; } else { - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy185; - goto yy195; + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy187; + goto yy197; } } } -yy214: - YYDEBUG(214, *YYCURSOR); +yy216: + YYDEBUG(216, *YYCURSOR); yyaccept = 2; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(215, *YYCURSOR); + YYDEBUG(217, *YYCURSOR); if (yych <= '&') { if (yych <= '\r') { - if (yych == '\n') goto yy185; - if (yych <= '\f') goto yy195; - goto yy185; + if (yych == '\n') goto yy187; + if (yych <= '\f') goto yy197; + goto yy187; } else { if (yych <= '"') { - if (yych <= '!') goto yy195; - goto yy185; + if (yych <= '!') goto yy197; + goto yy187; } else { - if (yych == '$') goto yy198; - goto yy195; + if (yych == '$') goto yy200; + goto yy197; } } } else { if (yych <= ':') { - if (yych <= '\'') goto yy185; - if (yych <= '/') goto yy195; - if (yych <= '9') goto yy214; - goto yy195; + if (yych <= '\'') goto yy187; + if (yych <= '/') goto yy197; + if (yych <= '9') goto yy216; + goto yy197; } else { if (yych <= '[') { - if (yych <= ';') goto yy185; - goto yy195; + if (yych <= ';') goto yy187; + goto yy197; } else { - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy185; - goto yy195; + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy187; + goto yy197; } } } -yy216: - YYDEBUG(216, *YYCURSOR); +yy218: + YYDEBUG(218, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(217, *YYCURSOR); + YYDEBUG(219, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy216; + goto yy218; } - YYDEBUG(218, *YYCURSOR); + YYDEBUG(220, *YYCURSOR); ++YYCURSOR; - YYDEBUG(219, *YYCURSOR); + YYDEBUG(221, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 368 "Zend/zend_ini_scanner.l" { /* Raw string */ @@ -2697,65 +2735,65 @@ int ini_lex(zval *ini_lval TSRMLS_DC) } RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 2701 "Zend/zend_ini_scanner.c" -yy220: - YYDEBUG(220, *YYCURSOR); +#line 2739 "Zend/zend_ini_scanner.c" +yy222: + YYDEBUG(222, *YYCURSOR); ++YYCURSOR; - YYDEBUG(221, *YYCURSOR); + YYDEBUG(223, *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 2712 "Zend/zend_ini_scanner.c" -yy222: - YYDEBUG(222, *YYCURSOR); +#line 2750 "Zend/zend_ini_scanner.c" +yy224: + YYDEBUG(224, *YYCURSOR); yyaccept = 0; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(223, *YYCURSOR); + YYDEBUG(225, *YYCURSOR); if (yych <= '"') { if (yych <= '\f') { - if (yych <= 0x08) goto yy195; - if (yych <= '\t') goto yy222; - if (yych <= '\n') goto yy174; - goto yy195; + if (yych <= 0x08) goto yy197; + if (yych <= '\t') goto yy224; + if (yych <= '\n') goto yy176; + goto yy197; } else { if (yych <= 0x1F) { - if (yych <= '\r') goto yy174; - goto yy195; + if (yych <= '\r') goto yy176; + goto yy197; } else { - if (yych <= ' ') goto yy222; - if (yych <= '!') goto yy195; + if (yych <= ' ') goto yy224; + if (yych <= '!') goto yy197; } } } else { if (yych <= ':') { if (yych <= '$') { - if (yych <= '#') goto yy195; - goto yy198; + if (yych <= '#') goto yy197; + goto yy200; } else { - if (yych == '\'') goto yy174; - goto yy195; + if (yych == '\'') goto yy176; + goto yy197; } } else { if (yych <= '[') { - if (yych <= ';') goto yy174; - goto yy195; + if (yych <= ';') goto yy176; + goto yy197; } else { - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy174; - goto yy195; + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy176; + goto yy197; } } } -yy224: - YYDEBUG(224, *YYCURSOR); +yy226: + YYDEBUG(226, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy179; + goto yy181; } /* *********************************** */ yyc_ST_VALUE: @@ -2794,27 +2832,27 @@ int ini_lex(zval *ini_lval TSRMLS_DC) 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, }; - YYDEBUG(225, *YYCURSOR); + YYDEBUG(227, *YYCURSOR); YYFILL(6); yych = *YYCURSOR; YYDEBUG(-1, yych); switch (yych) { - case 0x00: goto yy227; + case 0x00: goto yy229; case '\t': - case ' ': goto yy231; - case '\n': goto yy233; - case '\r': goto yy235; + case ' ': goto yy233; + case '\n': goto yy235; + case '\r': goto yy237; case '!': case '&': case '(': case ')': case '|': - case '~': goto yy236; - case '"': goto yy238; - case '$': goto yy240; - case '\'': goto yy241; - case '-': goto yy242; - case '.': goto yy243; + case '~': goto yy238; + case '"': goto yy240; + case '$': goto yy242; + case '\'': goto yy243; + case '-': goto yy244; + case '.': goto yy245; case '0': case '1': case '2': @@ -2824,9 +2862,9 @@ int ini_lex(zval *ini_lval TSRMLS_DC) case '6': case '7': case '8': - case '9': goto yy244; - case ';': goto yy246; - case '=': goto yy247; + case '9': goto yy246; + case ';': goto yy248; + case '=': goto yy249; case 'A': case 'B': case 'C': @@ -2869,1529 +2907,1529 @@ int ini_lex(zval *ini_lval TSRMLS_DC) case 'v': case 'w': case 'x': - case 'z': goto yy249; + case 'z': goto yy251; case 'F': - case 'f': goto yy251; + case 'f': goto yy253; case 'N': - case 'n': goto yy252; + case 'n': goto yy254; case 'O': - case 'o': goto yy253; + case 'o': goto yy255; case 'T': - case 't': goto yy254; + case 't': goto yy256; case 'Y': - case 'y': goto yy255; - default: goto yy229; + case 'y': goto yy257; + default: goto yy231; } -yy227: - YYDEBUG(227, *YYCURSOR); +yy229: + YYDEBUG(229, *YYCURSOR); ++YYCURSOR; -yy228: - YYDEBUG(228, *YYCURSOR); +yy230: + YYDEBUG(230, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 570 "Zend/zend_ini_scanner.l" +#line 591 "Zend/zend_ini_scanner.l" { /* End of option value (if EOF is reached before EOL */ BEGIN(INITIAL); return END_OF_LINE; } -#line 2897 "Zend/zend_ini_scanner.c" -yy229: - YYDEBUG(229, *YYCURSOR); +#line 2935 "Zend/zend_ini_scanner.c" +yy231: + YYDEBUG(231, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); - goto yy257; -yy230: - YYDEBUG(230, *YYCURSOR); + goto yy259; +yy232: + YYDEBUG(232, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 489 "Zend/zend_ini_scanner.l" +#line 510 "Zend/zend_ini_scanner.l" { /* Get everything else as option/offset value */ RETURN_TOKEN(TC_STRING, yytext, yyleng); } -#line 2910 "Zend/zend_ini_scanner.c" -yy231: - YYDEBUG(231, *YYCURSOR); +#line 2948 "Zend/zend_ini_scanner.c" +yy233: + YYDEBUG(233, *YYCURSOR); yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); - goto yy307; -yy232: - YYDEBUG(232, *YYCURSOR); + goto yy309; +yy234: + YYDEBUG(234, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 543 "Zend/zend_ini_scanner.l" +#line 564 "Zend/zend_ini_scanner.l" { RETURN_TOKEN(TC_WHITESPACE, yytext, yyleng); } -#line 2923 "Zend/zend_ini_scanner.c" -yy233: - YYDEBUG(233, *YYCURSOR); +#line 2961 "Zend/zend_ini_scanner.c" +yy235: + YYDEBUG(235, *YYCURSOR); ++YYCURSOR; -yy234: - YYDEBUG(234, *YYCURSOR); +yy236: + YYDEBUG(236, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 461 "Zend/zend_ini_scanner.l" +#line 482 "Zend/zend_ini_scanner.l" { /* End of option value */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 2936 "Zend/zend_ini_scanner.c" -yy235: - YYDEBUG(235, *YYCURSOR); +#line 2974 "Zend/zend_ini_scanner.c" +yy237: + YYDEBUG(237, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '\n') goto yy305; - goto yy234; -yy236: - YYDEBUG(236, *YYCURSOR); + if (yych == '\n') goto yy307; + goto yy236; +yy238: + YYDEBUG(238, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy304; -yy237: - YYDEBUG(237, *YYCURSOR); + goto yy306; +yy239: + YYDEBUG(239, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 479 "Zend/zend_ini_scanner.l" +#line 500 "Zend/zend_ini_scanner.l" { /* Boolean operators */ return yytext[0]; } -#line 2954 "Zend/zend_ini_scanner.c" -yy238: - YYDEBUG(238, *YYCURSOR); +#line 2992 "Zend/zend_ini_scanner.c" +yy240: + YYDEBUG(240, *YYCURSOR); ++YYCURSOR; -yy239: - YYDEBUG(239, *YYCURSOR); +yy241: + YYDEBUG(241, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 497 "Zend/zend_ini_scanner.l" +#line 518 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string start */ yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); return '"'; } -#line 2966 "Zend/zend_ini_scanner.c" -yy240: - YYDEBUG(240, *YYCURSOR); +#line 3004 "Zend/zend_ini_scanner.c" +yy242: + YYDEBUG(242, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '\\') { - if (yych <= 0x00) goto yy228; - if (yych <= '[') goto yy256; - goto yy263; + if (yych <= 0x00) goto yy230; + if (yych <= '[') goto yy258; + goto yy265; } else { - if (yych == '{') goto yy301; - goto yy256; + if (yych == '{') goto yy303; + goto yy258; } -yy241: - YYDEBUG(241, *YYCURSOR); +yy243: + YYDEBUG(243, *YYCURSOR); yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 128) { - goto yy297; + goto yy299; } - goto yy228; -yy242: - YYDEBUG(242, *YYCURSOR); + goto yy230; +yy244: + YYDEBUG(244, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy257; - if (yych <= '9') goto yy295; - goto yy257; -yy243: - YYDEBUG(243, *YYCURSOR); + if (yych <= '/') goto yy259; + if (yych <= '9') goto yy297; + goto yy259; +yy245: + YYDEBUG(245, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy257; - if (yych <= '9') goto yy293; - goto yy257; -yy244: - YYDEBUG(244, *YYCURSOR); + if (yych <= '/') goto yy259; + if (yych <= '9') goto yy295; + goto yy259; +yy246: + YYDEBUG(246, *YYCURSOR); yyaccept = 3; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '.') { if (yych <= '\r') { if (yych <= 0x08) { - if (yych >= 0x01) goto yy257; + if (yych >= 0x01) goto yy259; } else { - if (yych <= '\n') goto yy245; - if (yych <= '\f') goto yy257; + if (yych <= '\n') goto yy247; + if (yych <= '\f') goto yy259; } } else { if (yych <= '%') { - if (yych <= 0x1F) goto yy257; - if (yych >= '#') goto yy257; + if (yych <= 0x1F) goto yy259; + if (yych >= '#') goto yy259; } else { - if (yych <= ')') goto yy245; - if (yych <= '-') goto yy257; - goto yy289; + if (yych <= ')') goto yy247; + if (yych <= '-') goto yy259; + goto yy291; } } } else { if (yych <= '<') { if (yych <= '9') { - if (yych <= '/') goto yy257; - goto yy291; + if (yych <= '/') goto yy259; + goto yy293; } else { - if (yych != ';') goto yy257; + if (yych != ';') goto yy259; } } else { if (yych <= '|') { - if (yych <= '=') goto yy245; - if (yych <= '{') goto yy257; + if (yych <= '=') goto yy247; + if (yych <= '{') goto yy259; } else { - if (yych != '~') goto yy257; + if (yych != '~') goto yy259; } } } -yy245: - YYDEBUG(245, *YYCURSOR); +yy247: + YYDEBUG(247, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 471 "Zend/zend_ini_scanner.l" +#line 492 "Zend/zend_ini_scanner.l" { /* Get number option value as string */ RETURN_TOKEN(TC_NUMBER, yytext, yyleng); } -#line 3046 "Zend/zend_ini_scanner.c" -yy246: - YYDEBUG(246, *YYCURSOR); +#line 3084 "Zend/zend_ini_scanner.c" +yy248: + YYDEBUG(248, *YYCURSOR); yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); - goto yy285; -yy247: - YYDEBUG(247, *YYCURSOR); + goto yy287; +yy249: + YYDEBUG(249, *YYCURSOR); ++YYCURSOR; - YYDEBUG(248, *YYCURSOR); + YYDEBUG(250, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 483 "Zend/zend_ini_scanner.l" +#line 504 "Zend/zend_ini_scanner.l" { /* Make = used in option value to trigger error */ yyless(0); BEGIN(INITIAL); return END_OF_LINE; } -#line 3063 "Zend/zend_ini_scanner.c" -yy249: - YYDEBUG(249, *YYCURSOR); +#line 3101 "Zend/zend_ini_scanner.c" +yy251: + YYDEBUG(251, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 4) { - goto yy258; + goto yy260; } if (yych <= ')') { if (yych <= '\f') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - if (yych >= '\v') goto yy257; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + if (yych >= '\v') goto yy259; } else { if (yych <= 0x1F) { - if (yych >= 0x0E) goto yy257; + if (yych >= 0x0E) goto yy259; } else { - if (yych <= '"') goto yy250; - if (yych <= '%') goto yy257; + if (yych <= '"') goto yy252; + if (yych <= '%') goto yy259; } } } else { if (yych <= '=') { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; } else { if (yych <= '|') { - if (yych <= '{') goto yy257; + if (yych <= '{') goto yy259; } else { - if (yych != '~') goto yy257; + if (yych != '~') goto yy259; } } } -yy250: - YYDEBUG(250, *YYCURSOR); +yy252: + YYDEBUG(252, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 467 "Zend/zend_ini_scanner.l" +#line 488 "Zend/zend_ini_scanner.l" { /* Get constant option value */ RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); } -#line 3103 "Zend/zend_ini_scanner.c" -yy251: - YYDEBUG(251, *YYCURSOR); +#line 3141 "Zend/zend_ini_scanner.c" +yy253: + YYDEBUG(253, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '<') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '/') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - goto yy257; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + goto yy259; } else { - if (yych <= '9') goto yy258; - if (yych == ';') goto yy250; - goto yy257; + if (yych <= '9') goto yy260; + if (yych == ';') goto yy252; + goto yy259; } } } else { if (yych <= '`') { if (yych <= 'A') { - if (yych <= '=') goto yy250; - if (yych <= '@') goto yy257; - goto yy281; + if (yych <= '=') goto yy252; + if (yych <= '@') goto yy259; + goto yy283; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych <= 'a') goto yy281; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych <= 'a') goto yy283; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } -yy252: - YYDEBUG(252, *YYCURSOR); +yy254: + YYDEBUG(254, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); if (yych <= 'N') { if (yych <= '%') { if (yych <= '\f') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - if (yych <= '\n') goto yy250; - goto yy257; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + if (yych <= '\n') goto yy252; + goto yy259; } else { - if (yych <= '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - if (yych <= '"') goto yy250; - goto yy257; + if (yych <= '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + if (yych <= '"') goto yy252; + goto yy259; } } else { if (yych <= ':') { - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - if (yych <= '9') goto yy258; - goto yy257; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + if (yych <= '9') goto yy260; + goto yy259; } else { if (yych <= '<') { - if (yych <= ';') goto yy250; - goto yy257; + if (yych <= ';') goto yy252; + goto yy259; } else { - if (yych <= '=') goto yy250; - if (yych <= '@') goto yy257; - goto yy258; + if (yych <= '=') goto yy252; + if (yych <= '@') goto yy259; + goto yy260; } } } } else { if (yych <= 'n') { if (yych <= 'Z') { - if (yych <= 'O') goto yy277; - if (yych == 'U') goto yy278; - goto yy258; + if (yych <= 'O') goto yy279; + if (yych == 'U') goto yy280; + goto yy260; } else { - if (yych == '_') goto yy258; - if (yych <= '`') goto yy257; - goto yy258; + if (yych == '_') goto yy260; + if (yych <= '`') goto yy259; + goto yy260; } } else { if (yych <= 'z') { - if (yych <= 'o') goto yy277; - if (yych == 'u') goto yy278; - goto yy258; + if (yych <= 'o') goto yy279; + if (yych == 'u') goto yy280; + goto yy260; } else { if (yych <= '|') { - if (yych <= '{') goto yy257; - goto yy250; + if (yych <= '{') goto yy259; + goto yy252; } else { - if (yych == '~') goto yy250; - goto yy257; + if (yych == '~') goto yy252; + goto yy259; } } } } -yy253: - YYDEBUG(253, *YYCURSOR); +yy255: + YYDEBUG(255, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); if (yych <= 'E') { if (yych <= '%') { if (yych <= '\f') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - if (yych <= '\n') goto yy250; - goto yy257; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + if (yych <= '\n') goto yy252; + goto yy259; } else { - if (yych <= '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - if (yych <= '"') goto yy250; - goto yy257; + if (yych <= '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + if (yych <= '"') goto yy252; + goto yy259; } } else { if (yych <= ':') { - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - if (yych <= '9') goto yy258; - goto yy257; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + if (yych <= '9') goto yy260; + goto yy259; } else { if (yych <= '<') { - if (yych <= ';') goto yy250; - goto yy257; + if (yych <= ';') goto yy252; + goto yy259; } else { - if (yych <= '=') goto yy250; - if (yych <= '@') goto yy257; - goto yy258; + if (yych <= '=') goto yy252; + if (yych <= '@') goto yy259; + goto yy260; } } } } else { if (yych <= 'e') { if (yych <= 'Z') { - if (yych <= 'F') goto yy272; - if (yych == 'N') goto yy266; - goto yy258; + if (yych <= 'F') goto yy274; + if (yych == 'N') goto yy268; + goto yy260; } else { - if (yych == '_') goto yy258; - if (yych <= '`') goto yy257; - goto yy258; + if (yych == '_') goto yy260; + if (yych <= '`') goto yy259; + goto yy260; } } else { if (yych <= 'z') { - if (yych <= 'f') goto yy272; - if (yych == 'n') goto yy266; - goto yy258; + if (yych <= 'f') goto yy274; + if (yych == 'n') goto yy268; + goto yy260; } else { if (yych <= '|') { - if (yych <= '{') goto yy257; - goto yy250; + if (yych <= '{') goto yy259; + goto yy252; } else { - if (yych == '~') goto yy250; - goto yy257; + if (yych == '~') goto yy252; + goto yy259; } } } } -yy254: - YYDEBUG(254, *YYCURSOR); +yy256: + YYDEBUG(256, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { if (yych <= 'R') { - if (yych <= '@') goto yy257; - if (yych <= 'Q') goto yy258; - goto yy270; + if (yych <= '@') goto yy259; + if (yych <= 'Q') goto yy260; + goto yy272; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'r') goto yy270; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'r') goto yy272; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } -yy255: - YYDEBUG(255, *YYCURSOR); +yy257: + YYDEBUG(257, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { if (yych <= 'E') { - if (yych <= '@') goto yy257; - if (yych <= 'D') goto yy258; - goto yy260; + if (yych <= '@') goto yy259; + if (yych <= 'D') goto yy260; + goto yy262; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'e') goto yy260; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'e') goto yy262; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } -yy256: - YYDEBUG(256, *YYCURSOR); +yy258: + YYDEBUG(258, *YYCURSOR); yyaccept = 0; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy257: - YYDEBUG(257, *YYCURSOR); +yy259: + YYDEBUG(259, *YYCURSOR); if (yybm[0+yych] & 2) { - goto yy256; + goto yy258; } - if (yych == '$') goto yy261; - goto yy230; -yy258: - YYDEBUG(258, *YYCURSOR); + if (yych == '$') goto yy263; + goto yy232; +yy260: + YYDEBUG(260, *YYCURSOR); yyaccept = 4; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(259, *YYCURSOR); + YYDEBUG(261, *YYCURSOR); if (yybm[0+yych] & 4) { - goto yy258; + goto yy260; } if (yych <= '%') { if (yych <= '\r') { if (yych <= 0x08) { - if (yych <= 0x00) goto yy250; - goto yy256; + if (yych <= 0x00) goto yy252; + goto yy258; } else { - if (yych <= '\n') goto yy250; - if (yych <= '\f') goto yy256; - goto yy250; + if (yych <= '\n') goto yy252; + if (yych <= '\f') goto yy258; + goto yy252; } } else { if (yych <= '"') { - if (yych <= 0x1F) goto yy256; - goto yy250; + if (yych <= 0x1F) goto yy258; + goto yy252; } else { - if (yych == '$') goto yy261; - goto yy256; + if (yych == '$') goto yy263; + goto yy258; } } } else { if (yych <= '=') { if (yych <= ':') { - if (yych <= ')') goto yy250; - goto yy256; + if (yych <= ')') goto yy252; + goto yy258; } else { - if (yych == '<') goto yy256; - goto yy250; + if (yych == '<') goto yy258; + goto yy252; } } else { if (yych <= '|') { - if (yych <= '{') goto yy256; - goto yy250; + if (yych <= '{') goto yy258; + goto yy252; } else { - if (yych == '~') goto yy250; - goto yy256; + if (yych == '~') goto yy252; + goto yy258; } } } -yy260: - YYDEBUG(260, *YYCURSOR); +yy262: + YYDEBUG(262, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { if (yych <= 'S') { - if (yych <= '@') goto yy257; - if (yych <= 'R') goto yy258; - goto yy266; + if (yych <= '@') goto yy259; + if (yych <= 'R') goto yy260; + goto yy268; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 's') goto yy266; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 's') goto yy268; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } -yy261: - YYDEBUG(261, *YYCURSOR); +yy263: + YYDEBUG(263, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; if (yych <= '\\') { - if (yych <= 0x00) goto yy262; - if (yych <= '[') goto yy256; - goto yy263; + if (yych <= 0x00) goto yy264; + if (yych <= '[') goto yy258; + goto yy265; } else { - if (yych != '{') goto yy256; + if (yych != '{') goto yy258; } -yy262: - YYDEBUG(262, *YYCURSOR); +yy264: + YYDEBUG(264, *YYCURSOR); YYCURSOR = YYMARKER; if (yyaccept <= 3) { if (yyaccept <= 1) { if (yyaccept <= 0) { - goto yy230; - } else { goto yy232; + } else { + goto yy234; } } else { if (yyaccept <= 2) { - goto yy228; + goto yy230; } else { - goto yy245; + goto yy247; } } } else { if (yyaccept <= 5) { if (yyaccept <= 4) { - goto yy250; + goto yy252; } else { - goto yy267; + goto yy269; } } else { - goto yy274; + goto yy276; } } -yy263: - YYDEBUG(263, *YYCURSOR); +yy265: + YYDEBUG(265, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; if (yybm[0+yych] & 8) { - goto yy264; + goto yy266; } - goto yy256; -yy264: - YYDEBUG(264, *YYCURSOR); + goto yy258; +yy266: + YYDEBUG(266, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(265, *YYCURSOR); + YYDEBUG(267, *YYCURSOR); if (yybm[0+yych] & 8) { - goto yy264; + goto yy266; } - if (yych <= 0x00) goto yy230; - if (yych == '\\') goto yy263; - goto yy256; -yy266: - YYDEBUG(266, *YYCURSOR); + if (yych <= 0x00) goto yy232; + if (yych == '\\') goto yy265; + goto yy258; +yy268: + YYDEBUG(268, *YYCURSOR); yyaccept = 5; yych = *(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 16) { - goto yy268; + goto yy270; } if (yych <= ';') { if (yych <= ' ') { if (yych <= '\n') { - if (yych <= 0x00) goto yy267; - if (yych <= '\t') goto yy257; + if (yych <= 0x00) goto yy269; + if (yych <= '\t') goto yy259; } else { - if (yych != '\r') goto yy257; + if (yych != '\r') goto yy259; } } else { if (yych <= ')') { - if (yych <= '"') goto yy267; - if (yych <= '%') goto yy257; + if (yych <= '"') goto yy269; + if (yych <= '%') goto yy259; } else { - if (yych <= '/') goto yy257; - if (yych <= '9') goto yy258; - if (yych <= ':') goto yy257; + if (yych <= '/') goto yy259; + if (yych <= '9') goto yy260; + if (yych <= ':') goto yy259; } } } else { if (yych <= '_') { if (yych <= '@') { - if (yych != '=') goto yy257; + if (yych != '=') goto yy259; } else { - if (yych <= 'Z') goto yy258; - if (yych <= '^') goto yy257; - goto yy258; + if (yych <= 'Z') goto yy260; + if (yych <= '^') goto yy259; + goto yy260; } } else { if (yych <= '{') { - if (yych <= '`') goto yy257; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych <= '`') goto yy259; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych >= 0x7F) goto yy257; + if (yych == '}') goto yy259; + if (yych >= 0x7F) goto yy259; } } } -yy267: - YYDEBUG(267, *YYCURSOR); +yy269: + YYDEBUG(269, *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 3599 "Zend/zend_ini_scanner.c" -yy268: - YYDEBUG(268, *YYCURSOR); +#line 3637 "Zend/zend_ini_scanner.c" +yy270: + YYDEBUG(270, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(269, *YYCURSOR); + YYDEBUG(271, *YYCURSOR); if (yybm[0+yych] & 16) { - goto yy268; + goto yy270; } - goto yy267; -yy270: - YYDEBUG(270, *YYCURSOR); + goto yy269; +yy272: + YYDEBUG(272, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { if (yych <= 'U') { - if (yych <= '@') goto yy257; - if (yych <= 'T') goto yy258; + if (yych <= '@') goto yy259; + if (yych <= 'T') goto yy260; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'u') goto yy271; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'u') goto yy273; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } -yy271: - YYDEBUG(271, *YYCURSOR); +yy273: + YYDEBUG(273, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { if (yych <= 'E') { - if (yych <= '@') goto yy257; - if (yych <= 'D') goto yy258; - goto yy266; + if (yych <= '@') goto yy259; + if (yych <= 'D') goto yy260; + goto yy268; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'e') goto yy266; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'e') goto yy268; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } -yy272: - YYDEBUG(272, *YYCURSOR); +yy274: + YYDEBUG(274, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { if (yych <= 'F') { - if (yych <= '@') goto yy257; - if (yych <= 'E') goto yy258; + if (yych <= '@') goto yy259; + if (yych <= 'E') goto yy260; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'f') goto yy273; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'f') goto yy275; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } -yy273: - YYDEBUG(273, *YYCURSOR); +yy275: + YYDEBUG(275, *YYCURSOR); yyaccept = 6; yych = *(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 4) { - goto yy258; + goto yy260; } if (yych <= '%') { if (yych <= '\f') { if (yych <= 0x08) { - if (yych >= 0x01) goto yy257; + if (yych >= 0x01) goto yy259; } else { - if (yych <= '\t') goto yy275; - if (yych >= '\v') goto yy257; + if (yych <= '\t') goto yy277; + if (yych >= '\v') goto yy259; } } else { if (yych <= 0x1F) { - if (yych >= 0x0E) goto yy257; + if (yych >= 0x0E) goto yy259; } else { - if (yych <= ' ') goto yy275; - if (yych >= '#') goto yy257; + if (yych <= ' ') goto yy277; + if (yych >= '#') goto yy259; } } } else { if (yych <= '=') { if (yych <= ':') { - if (yych >= '*') goto yy257; + if (yych >= '*') goto yy259; } else { - if (yych == '<') goto yy257; + if (yych == '<') goto yy259; } } else { if (yych <= '|') { - if (yych <= '{') goto yy257; + if (yych <= '{') goto yy259; } else { - if (yych != '~') goto yy257; + if (yych != '~') goto yy259; } } } -yy274: - YYDEBUG(274, *YYCURSOR); +yy276: + YYDEBUG(276, *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 3803 "Zend/zend_ini_scanner.c" -yy275: - YYDEBUG(275, *YYCURSOR); +#line 3841 "Zend/zend_ini_scanner.c" +yy277: + YYDEBUG(277, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(276, *YYCURSOR); - if (yych == '\t') goto yy275; - if (yych == ' ') goto yy275; - goto yy274; -yy277: - YYDEBUG(277, *YYCURSOR); + YYDEBUG(278, *YYCURSOR); + if (yych == '\t') goto yy277; + if (yych == ' ') goto yy277; + goto yy276; +yy279: + YYDEBUG(279, *YYCURSOR); yyaccept = 6; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '<') { if (yych <= ' ') { if (yych <= '\n') { - if (yych <= 0x00) goto yy274; - if (yych <= 0x08) goto yy257; - if (yych <= '\t') goto yy275; - goto yy274; + if (yych <= 0x00) goto yy276; + if (yych <= 0x08) goto yy259; + if (yych <= '\t') goto yy277; + goto yy276; } else { - if (yych == '\r') goto yy274; - if (yych <= 0x1F) goto yy257; - goto yy275; + if (yych == '\r') goto yy276; + if (yych <= 0x1F) goto yy259; + goto yy277; } } else { if (yych <= '/') { - if (yych <= '"') goto yy274; - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy274; - goto yy257; + if (yych <= '"') goto yy276; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy276; + goto yy259; } else { - if (yych <= '9') goto yy258; - if (yych == ';') goto yy274; - goto yy257; + if (yych <= '9') goto yy260; + if (yych == ';') goto yy276; + goto yy259; } } } else { if (yych <= '`') { if (yych <= 'N') { - if (yych <= '=') goto yy274; - if (yych <= '@') goto yy257; - if (yych <= 'M') goto yy258; - goto yy280; + if (yych <= '=') goto yy276; + if (yych <= '@') goto yy259; + if (yych <= 'M') goto yy260; + goto yy282; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'n') goto yy280; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'n') goto yy282; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy274; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy276; + goto yy259; } } } -yy278: - YYDEBUG(278, *YYCURSOR); +yy280: + YYDEBUG(280, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { if (yych <= 'L') { - if (yych <= '@') goto yy257; - if (yych <= 'K') goto yy258; + if (yych <= '@') goto yy259; + if (yych <= 'K') goto yy260; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'l') goto yy279; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'l') goto yy281; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } -yy279: - YYDEBUG(279, *YYCURSOR); +yy281: + YYDEBUG(281, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { if (yych <= 'L') { - if (yych <= '@') goto yy257; - if (yych <= 'K') goto yy258; - goto yy273; + if (yych <= '@') goto yy259; + if (yych <= 'K') goto yy260; + goto yy275; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'l') goto yy273; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'l') goto yy275; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } -yy280: - YYDEBUG(280, *YYCURSOR); +yy282: + YYDEBUG(282, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { if (yych <= 'E') { - if (yych <= '@') goto yy257; - if (yych <= 'D') goto yy258; - goto yy273; + if (yych <= '@') goto yy259; + if (yych <= 'D') goto yy260; + goto yy275; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'e') goto yy273; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'e') goto yy275; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } -yy281: - YYDEBUG(281, *YYCURSOR); +yy283: + YYDEBUG(283, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { if (yych <= 'L') { - if (yych <= '@') goto yy257; - if (yych <= 'K') goto yy258; + if (yych <= '@') goto yy259; + if (yych <= 'K') goto yy260; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'l') goto yy282; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'l') goto yy284; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } -yy282: - YYDEBUG(282, *YYCURSOR); +yy284: + YYDEBUG(284, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { if (yych <= 'S') { - if (yych <= '@') goto yy257; - if (yych <= 'R') goto yy258; + if (yych <= '@') goto yy259; + if (yych <= 'R') goto yy260; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 's') goto yy283; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 's') goto yy285; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } -yy283: - YYDEBUG(283, *YYCURSOR); +yy285: + YYDEBUG(285, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { if (yych <= 'E') { - if (yych <= '@') goto yy257; - if (yych <= 'D') goto yy258; - goto yy273; + if (yych <= '@') goto yy259; + if (yych <= 'D') goto yy260; + goto yy275; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'e') goto yy273; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'e') goto yy275; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } -yy284: - YYDEBUG(284, *YYCURSOR); +yy286: + YYDEBUG(286, *YYCURSOR); ++YYCURSOR; YYFILL(2); yych = *YYCURSOR; -yy285: - YYDEBUG(285, *YYCURSOR); +yy287: + YYDEBUG(287, *YYCURSOR); if (yybm[0+yych] & 32) { - goto yy284; + goto yy286; } - if (yych >= '\r') goto yy288; -yy286: - YYDEBUG(286, *YYCURSOR); + if (yych >= '\r') goto yy290; +yy288: + YYDEBUG(288, *YYCURSOR); ++YYCURSOR; -yy287: - YYDEBUG(287, *YYCURSOR); +yy289: + YYDEBUG(289, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 557 "Zend/zend_ini_scanner.l" +#line 578 "Zend/zend_ini_scanner.l" { /* Comment */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 4185 "Zend/zend_ini_scanner.c" -yy288: - YYDEBUG(288, *YYCURSOR); +#line 4223 "Zend/zend_ini_scanner.c" +yy290: + YYDEBUG(290, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '\n') goto yy286; - goto yy287; -yy289: - YYDEBUG(289, *YYCURSOR); + if (yych == '\n') goto yy288; + goto yy289; +yy291: + YYDEBUG(291, *YYCURSOR); yyaccept = 3; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(290, *YYCURSOR); + YYDEBUG(292, *YYCURSOR); if (yybm[0+yych] & 64) { - goto yy289; + goto yy291; } if (yych <= '%') { if (yych <= '\r') { if (yych <= 0x08) { - if (yych <= 0x00) goto yy245; - goto yy256; + if (yych <= 0x00) goto yy247; + goto yy258; } else { - if (yych <= '\n') goto yy245; - if (yych <= '\f') goto yy256; - goto yy245; + if (yych <= '\n') goto yy247; + if (yych <= '\f') goto yy258; + goto yy247; } } else { if (yych <= '"') { - if (yych <= 0x1F) goto yy256; - goto yy245; + if (yych <= 0x1F) goto yy258; + goto yy247; } else { - if (yych == '$') goto yy261; - goto yy256; + if (yych == '$') goto yy263; + goto yy258; } } } else { if (yych <= '=') { if (yych <= ':') { - if (yych <= ')') goto yy245; - goto yy256; + if (yych <= ')') goto yy247; + goto yy258; } else { - if (yych == '<') goto yy256; - goto yy245; + if (yych == '<') goto yy258; + goto yy247; } } else { if (yych <= '|') { - if (yych <= '{') goto yy256; - goto yy245; + if (yych <= '{') goto yy258; + goto yy247; } else { - if (yych == '~') goto yy245; - goto yy256; + if (yych == '~') goto yy247; + goto yy258; } } } -yy291: - YYDEBUG(291, *YYCURSOR); +yy293: + YYDEBUG(293, *YYCURSOR); yyaccept = 3; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(292, *YYCURSOR); + YYDEBUG(294, *YYCURSOR); if (yych <= '-') { if (yych <= 0x1F) { if (yych <= '\n') { - if (yych <= 0x00) goto yy245; - if (yych <= 0x08) goto yy256; - goto yy245; + if (yych <= 0x00) goto yy247; + if (yych <= 0x08) goto yy258; + goto yy247; } else { - if (yych == '\r') goto yy245; - goto yy256; + if (yych == '\r') goto yy247; + goto yy258; } } else { if (yych <= '$') { - if (yych <= '"') goto yy245; - if (yych <= '#') goto yy256; - goto yy261; + if (yych <= '"') goto yy247; + if (yych <= '#') goto yy258; + goto yy263; } else { - if (yych <= '%') goto yy256; - if (yych <= ')') goto yy245; - goto yy256; + if (yych <= '%') goto yy258; + if (yych <= ')') goto yy247; + goto yy258; } } } else { if (yych <= '<') { if (yych <= '9') { - if (yych <= '.') goto yy289; - if (yych <= '/') goto yy256; - goto yy291; + if (yych <= '.') goto yy291; + if (yych <= '/') goto yy258; + goto yy293; } else { - if (yych == ';') goto yy245; - goto yy256; + if (yych == ';') goto yy247; + goto yy258; } } else { if (yych <= '|') { - if (yych <= '=') goto yy245; - if (yych <= '{') goto yy256; - goto yy245; + if (yych <= '=') goto yy247; + if (yych <= '{') goto yy258; + goto yy247; } else { - if (yych == '~') goto yy245; - goto yy256; + if (yych == '~') goto yy247; + goto yy258; } } } -yy293: - YYDEBUG(293, *YYCURSOR); +yy295: + YYDEBUG(295, *YYCURSOR); yyaccept = 3; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(294, *YYCURSOR); + YYDEBUG(296, *YYCURSOR); if (yych <= ')') { if (yych <= '\r') { if (yych <= 0x08) { - if (yych <= 0x00) goto yy245; - goto yy256; + if (yych <= 0x00) goto yy247; + goto yy258; } else { - if (yych <= '\n') goto yy245; - if (yych <= '\f') goto yy256; - goto yy245; + if (yych <= '\n') goto yy247; + if (yych <= '\f') goto yy258; + goto yy247; } } else { if (yych <= '#') { - if (yych <= 0x1F) goto yy256; - if (yych <= '"') goto yy245; - goto yy256; + if (yych <= 0x1F) goto yy258; + if (yych <= '"') goto yy247; + goto yy258; } else { - if (yych <= '$') goto yy261; - if (yych <= '%') goto yy256; - goto yy245; + if (yych <= '$') goto yy263; + if (yych <= '%') goto yy258; + goto yy247; } } } else { if (yych <= '<') { if (yych <= '9') { - if (yych <= '/') goto yy256; - goto yy293; + if (yych <= '/') goto yy258; + goto yy295; } else { - if (yych == ';') goto yy245; - goto yy256; + if (yych == ';') goto yy247; + goto yy258; } } else { if (yych <= '|') { - if (yych <= '=') goto yy245; - if (yych <= '{') goto yy256; - goto yy245; + if (yych <= '=') goto yy247; + if (yych <= '{') goto yy258; + goto yy247; } else { - if (yych == '~') goto yy245; - goto yy256; + if (yych == '~') goto yy247; + goto yy258; } } } -yy295: - YYDEBUG(295, *YYCURSOR); +yy297: + YYDEBUG(297, *YYCURSOR); yyaccept = 3; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(296, *YYCURSOR); + YYDEBUG(298, *YYCURSOR); if (yych <= ')') { if (yych <= '\r') { if (yych <= 0x08) { - if (yych <= 0x00) goto yy245; - goto yy256; + if (yych <= 0x00) goto yy247; + goto yy258; } else { - if (yych <= '\n') goto yy245; - if (yych <= '\f') goto yy256; - goto yy245; + if (yych <= '\n') goto yy247; + if (yych <= '\f') goto yy258; + goto yy247; } } else { if (yych <= '#') { - if (yych <= 0x1F) goto yy256; - if (yych <= '"') goto yy245; - goto yy256; + if (yych <= 0x1F) goto yy258; + if (yych <= '"') goto yy247; + goto yy258; } else { - if (yych <= '$') goto yy261; - if (yych <= '%') goto yy256; - goto yy245; + if (yych <= '$') goto yy263; + if (yych <= '%') goto yy258; + goto yy247; } } } else { if (yych <= '<') { if (yych <= '9') { - if (yych <= '/') goto yy256; - goto yy295; + if (yych <= '/') goto yy258; + goto yy297; } else { - if (yych == ';') goto yy245; - goto yy256; + if (yych == ';') goto yy247; + goto yy258; } } else { if (yych <= '|') { - if (yych <= '=') goto yy245; - if (yych <= '{') goto yy256; - goto yy245; + if (yych <= '=') goto yy247; + if (yych <= '{') goto yy258; + goto yy247; } else { - if (yych == '~') goto yy245; - goto yy256; + if (yych == '~') goto yy247; + goto yy258; } } } -yy297: - YYDEBUG(297, *YYCURSOR); +yy299: + YYDEBUG(299, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(298, *YYCURSOR); + YYDEBUG(300, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy297; + goto yy299; } - YYDEBUG(299, *YYCURSOR); + YYDEBUG(301, *YYCURSOR); ++YYCURSOR; - YYDEBUG(300, *YYCURSOR); + YYDEBUG(302, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 368 "Zend/zend_ini_scanner.l" { /* Raw string */ @@ -4402,66 +4440,66 @@ int ini_lex(zval *ini_lval TSRMLS_DC) } RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 4406 "Zend/zend_ini_scanner.c" -yy301: - YYDEBUG(301, *YYCURSOR); +#line 4444 "Zend/zend_ini_scanner.c" +yy303: + YYDEBUG(303, *YYCURSOR); ++YYCURSOR; - YYDEBUG(302, *YYCURSOR); + YYDEBUG(304, *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 4417 "Zend/zend_ini_scanner.c" -yy303: - YYDEBUG(303, *YYCURSOR); +#line 4455 "Zend/zend_ini_scanner.c" +yy305: + YYDEBUG(305, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy304: - YYDEBUG(304, *YYCURSOR); - if (yych == '\t') goto yy303; - if (yych == ' ') goto yy303; - goto yy237; -yy305: - YYDEBUG(305, *YYCURSOR); - yych = *++YYCURSOR; - goto yy234; yy306: YYDEBUG(306, *YYCURSOR); + if (yych == '\t') goto yy305; + if (yych == ' ') goto yy305; + goto yy239; +yy307: + YYDEBUG(307, *YYCURSOR); + yych = *++YYCURSOR; + goto yy236; +yy308: + YYDEBUG(308, *YYCURSOR); yyaccept = 1; YYMARKER = ++YYCURSOR; YYFILL(2); yych = *YYCURSOR; -yy307: - YYDEBUG(307, *YYCURSOR); +yy309: + YYDEBUG(309, *YYCURSOR); if (yych <= 0x1F) { if (yych <= '\n') { - if (yych <= 0x08) goto yy232; - if (yych <= '\t') goto yy306; - goto yy305; + if (yych <= 0x08) goto yy234; + if (yych <= '\t') goto yy308; + goto yy307; } else { - if (yych == '\r') goto yy309; - goto yy232; + if (yych == '\r') goto yy311; + goto yy234; } } else { if (yych <= '"') { - if (yych <= ' ') goto yy306; - if (yych <= '!') goto yy232; + if (yych <= ' ') goto yy308; + if (yych <= '!') goto yy234; } else { - if (yych == ';') goto yy284; - goto yy232; + if (yych == ';') goto yy286; + goto yy234; } } - YYDEBUG(308, *YYCURSOR); + YYDEBUG(310, *YYCURSOR); yych = *++YYCURSOR; - goto yy239; -yy309: - YYDEBUG(309, *YYCURSOR); + goto yy241; +yy311: + YYDEBUG(311, *YYCURSOR); ++YYCURSOR; - if ((yych = *YYCURSOR) == '\n') goto yy305; - goto yy234; + if ((yych = *YYCURSOR) == '\n') goto yy307; + goto yy236; } /* *********************************** */ yyc_ST_VARNAME: @@ -4500,47 +4538,47 @@ int ini_lex(zval *ini_lval TSRMLS_DC) 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, }; - YYDEBUG(310, *YYCURSOR); + YYDEBUG(312, *YYCURSOR); YYFILL(2); yych = *YYCURSOR; if (yych <= '\'') { if (yych <= ' ') { if (yych <= '\n') { - if (yych >= '\t') goto yy314; + if (yych >= '\t') goto yy316; } else { - if (yych == '\r') goto yy314; + if (yych == '\r') goto yy316; } } else { if (yych <= '$') { - if (yych != '#') goto yy314; + if (yych != '#') goto yy316; } else { - if (yych == '&') goto yy314; + if (yych == '&') goto yy316; } } } else { if (yych <= 'Z') { if (yych <= ';') { - if (yych <= ')') goto yy314; - if (yych >= ';') goto yy314; + if (yych <= ')') goto yy316; + if (yych >= ';') goto yy316; } else { - if (yych == '=') goto yy314; + if (yych == '=') goto yy316; } } else { if (yych <= '|') { - if (yych <= '[') goto yy314; - if (yych >= '{') goto yy314; + if (yych <= '[') goto yy316; + if (yych >= '{') goto yy316; } else { - if (yych <= '}') goto yy316; - if (yych <= '~') goto yy314; + if (yych <= '}') goto yy318; + if (yych <= '~') goto yy316; } } } - YYDEBUG(312, *YYCURSOR); + YYDEBUG(314, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy319; -yy313: - YYDEBUG(313, *YYCURSOR); + goto yy321; +yy315: + YYDEBUG(315, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 406 "Zend/zend_ini_scanner.l" { /* Variable name */ @@ -4552,41 +4590,41 @@ int ini_lex(zval *ini_lval TSRMLS_DC) RETURN_TOKEN(TC_VARNAME, yytext, yyleng); } -#line 4556 "Zend/zend_ini_scanner.c" -yy314: - YYDEBUG(314, *YYCURSOR); +#line 4594 "Zend/zend_ini_scanner.c" +yy316: + YYDEBUG(316, *YYCURSOR); ++YYCURSOR; - YYDEBUG(315, *YYCURSOR); + YYDEBUG(317, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" +#line 596 "Zend/zend_ini_scanner.l" { return 0; } -#line 4566 "Zend/zend_ini_scanner.c" -yy316: - YYDEBUG(316, *YYCURSOR); +#line 4604 "Zend/zend_ini_scanner.c" +yy318: + YYDEBUG(318, *YYCURSOR); ++YYCURSOR; - YYDEBUG(317, *YYCURSOR); + YYDEBUG(319, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 416 "Zend/zend_ini_scanner.l" { /* Variable end */ yy_pop_state(TSRMLS_C); return '}'; } -#line 4577 "Zend/zend_ini_scanner.c" -yy318: - YYDEBUG(318, *YYCURSOR); +#line 4615 "Zend/zend_ini_scanner.c" +yy320: + YYDEBUG(320, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy319: - YYDEBUG(319, *YYCURSOR); +yy321: + YYDEBUG(321, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy318; + goto yy320; } - goto yy313; + goto yy315; } } -#line 579 "Zend/zend_ini_scanner.l" +#line 600 "Zend/zend_ini_scanner.l" } diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l index 0c452e659bfaf..8aeb076eab0a0 100644 --- a/Zend/zend_ini_scanner.l +++ b/Zend/zend_ini_scanner.l @@ -347,7 +347,7 @@ DOLLAR_CURLY "${" SECTION_RAW_CHARS [^\]\n\r] SINGLE_QUOTED_CHARS [^'] -RAW_VALUE_CHARS [^\n\r;\000] +RAW_VALUE_CHARS [^"\n\r;\000] LITERAL_DOLLAR ("$"([^{\000]|("\\"{ANY_CHAR}))) VALUE_CHARS ([^$= \t\n\r;&|~()!"'\000]|{LITERAL_DOLLAR}) @@ -445,12 +445,33 @@ SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR}) return '='; } -{RAW_VALUE_CHARS}+ { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ - /* Eat leading and trailing double quotes */ - if (yytext[0] == '"' && yytext[yyleng - 1] == '"') { - SCNG(yy_text)++; - yyleng = yyleng - 2; +["] { + while (YYCURSOR < YYLIMIT) { + switch (*YYCURSOR++) { + case '\n': + SCNG(lineno)++; + break; + case '\r': + if (*YYCURSOR != '\n') { + SCNG(lineno)++; + } + break; + case '"': + yyleng = YYCURSOR - SCNG(yy_text) - 2; + SCNG(yy_text)++; + RETURN_TOKEN(TC_RAW, yytext, yyleng); + case '\\': + if (YYCURSOR < YYLIMIT) { + YYCURSOR++; + } + break; + } } + yyleng = YYCURSOR - SCNG(yy_text); + RETURN_TOKEN(TC_RAW, yytext, yyleng); +} + +{RAW_VALUE_CHARS}+ { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ RETURN_TOKEN(TC_RAW, yytext, yyleng); } diff --git a/Zend/zend_ini_scanner_defs.h b/Zend/zend_ini_scanner_defs.h index 2bd72dcf564a6..9c99cc43d0e93 100644 --- a/Zend/zend_ini_scanner_defs.h +++ b/Zend/zend_ini_scanner_defs.h @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Sat Feb 25 22:04:14 2012 */ +/* Generated by re2c 0.13.5 on Thu Jun 7 17:55:41 2012 */ #line 3 "Zend/zend_ini_scanner_defs.h" enum YYCONDTYPE { diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 4221752dbab06..89b6ea4011de6 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -162,6 +162,7 @@ static YYSIZE_T zend_yytnamerr(char*, const char*); %token T_RETURN "return (T_RETURN)" %token T_TRY "try (T_TRY)" %token T_CATCH "catch (T_CATCH)" +%token T_FINALLY "finally (T_FINALLY)" %token T_THROW "throw (T_THROW)" %token T_USE "use (T_USE)" %token T_INSTEADOF "insteadof (T_INSTEADOF)" @@ -317,15 +318,24 @@ unticked_statement: | T_DECLARE { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')' declare_statement { zend_do_declare_end(&$1 TSRMLS_CC); } | ';' /* empty statement */ | T_TRY { zend_do_try(&$1 TSRMLS_CC); } '{' inner_statement_list '}' - T_CATCH '(' { zend_initialize_try_catch_element(&$1 TSRMLS_CC); } - fully_qualified_class_name { zend_do_first_catch(&$7 TSRMLS_CC); } - T_VARIABLE ')' { zend_do_begin_catch(&$1, &$9, &$11, &$7 TSRMLS_CC); } - '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); } - additional_catches { zend_do_mark_last_catch(&$7, &$18 TSRMLS_CC); } + catch_statement { zend_do_bind_catch(&$1, &$6 TSRMLS_CC); } + finally_statement { zend_do_end_finally(&$1, &$6, &$8 TSRMLS_CC); } | T_THROW expr ';' { zend_do_throw(&$2 TSRMLS_CC); } | T_GOTO T_STRING ';' { zend_do_goto(&$2 TSRMLS_CC); } ; +catch_statement: + /* empty */ { $$.op_type = IS_UNUSED; } + | T_CATCH '(' { zend_initialize_try_catch_element(&$1 TSRMLS_CC); } + fully_qualified_class_name { zend_do_first_catch(&$2 TSRMLS_CC); } + T_VARIABLE ')' { zend_do_begin_catch(&$1, &$4, &$6, &$2 TSRMLS_CC); } + '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); } + additional_catches { zend_do_mark_last_catch(&$2, &$13 TSRMLS_CC); $$ = $1;} + +finally_statement: + /* empty */ { $$.op_type = IS_UNUSED; } + | T_FINALLY { zend_do_finally(&$1 TSRMLS_CC); } '{' inner_statement_list '}' { $$ = $1; } +; additional_catches: non_empty_additional_catches { $$ = $1; } @@ -337,12 +347,10 @@ non_empty_additional_catches: | non_empty_additional_catches additional_catch { $$ = $2; } ; - additional_catch: T_CATCH '(' fully_qualified_class_name { $$.u.op.opline_num = get_next_op_number(CG(active_op_array)); } T_VARIABLE ')' { zend_do_begin_catch(&$1, &$3, &$5, NULL TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); } ; - unset_variables: unset_variable | unset_variables ',' unset_variable @@ -820,7 +828,7 @@ yield_expr: combined_scalar_offset: combined_scalar '[' dim_offset ']' { zend_do_begin_variable_parse(TSRMLS_C); fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); } | combined_scalar_offset '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); } - | T_CONSTANT_ENCAPSED_STRING '[' dim_offset ']' { zend_do_begin_variable_parse(TSRMLS_C); fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); } + | T_CONSTANT_ENCAPSED_STRING '[' dim_offset ']' { $1.EA = 0; zend_do_begin_variable_parse(TSRMLS_C); fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); } combined_scalar: T_ARRAY '(' array_pair_list ')' { $$ = $3; } @@ -1172,6 +1180,7 @@ encaps_var_offset: internal_functions_in_yacc: T_ISSET '(' isset_variables ')' { $$ = $3; } | T_EMPTY '(' variable ')' { zend_do_isset_or_isempty(ZEND_ISEMPTY, &$$, &$3 TSRMLS_CC); } + | T_EMPTY '(' expr_without_variable ')' { zend_do_unary_op(ZEND_BOOL_NOT, &$$, &$3 TSRMLS_CC); } | T_INCLUDE expr { zend_do_include_or_eval(ZEND_INCLUDE, &$$, &$2 TSRMLS_CC); } | T_INCLUDE_ONCE expr { zend_do_include_or_eval(ZEND_INCLUDE_ONCE, &$$, &$2 TSRMLS_CC); } | T_EVAL '(' expr ')' { zend_do_include_or_eval(ZEND_EVAL, &$$, &$3 TSRMLS_CC); } @@ -1180,8 +1189,13 @@ internal_functions_in_yacc: ; isset_variables: - variable { zend_do_isset_or_isempty(ZEND_ISSET, &$$, &$1 TSRMLS_CC); } - | isset_variables ',' { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } variable { znode tmp; zend_do_isset_or_isempty(ZEND_ISSET, &tmp, &$4 TSRMLS_CC); zend_do_boolean_and_end(&$$, &$1, &tmp, &$2 TSRMLS_CC); } + isset_variable { $$ = $1; } + | isset_variables ',' { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } isset_variable { zend_do_boolean_and_end(&$$, &$1, &$4, &$2 TSRMLS_CC); } +; + +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)"); } ; class_constant: @@ -1214,7 +1228,7 @@ static YYSIZE_T zend_yytnamerr(char *yyres, const char *yystr) if (LANG_SCNG(yy_text)[0] == 0 && LANG_SCNG(yy_leng) == 1 && - memcmp(yystr, ZEND_STRL("\"end of file\"")) == 0) { + memcmp(yystr, "\"end of file\"", sizeof("\"end of file\"") - 1) == 0) { yystpcpy(yyres, "end of file"); return sizeof("end of file")-1; } diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c index e20fc19581a2e..bcf1055ce75f8 100644 --- a/Zend/zend_language_scanner.c +++ b/Zend/zend_language_scanner.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Sat Jun 16 12:57:03 2012 */ +/* Generated by re2c 0.13.5 on Mon Aug 13 16:40:42 2012 */ #line 1 "Zend/zend_language_scanner.l" /* +----------------------------------------------------------------------+ @@ -1097,7 +1097,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy3: YYDEBUG(3, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1795 "Zend/zend_language_scanner.l" +#line 1799 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -1175,7 +1175,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy6: YYDEBUG(6, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1783 "Zend/zend_language_scanner.l" +#line 1787 "Zend/zend_language_scanner.l" { if (CG(short_tags)) { zendlval->value.str.val = yytext; /* no copying - intentional */ @@ -1194,7 +1194,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) if ((yych = *YYCURSOR) == '=') goto yy43; YYDEBUG(8, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1760 "Zend/zend_language_scanner.l" +#line 1764 "Zend/zend_language_scanner.l" { if (CG(asp_tags)) { zendlval->value.str.val = yytext; /* no copying - intentional */ @@ -1392,7 +1392,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(38, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1720 "Zend/zend_language_scanner.l" +#line 1724 "Zend/zend_language_scanner.l" { YYCTYPE *bracket = (YYCTYPE*)zend_memrchr(yytext, '<', yyleng - (sizeof("script language=php>") - 1)); @@ -1436,7 +1436,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(44, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1738 "Zend/zend_language_scanner.l" +#line 1742 "Zend/zend_language_scanner.l" { if (CG(asp_tags)) { zendlval->value.str.val = yytext; /* no copying - intentional */ @@ -1454,7 +1454,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(46, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1751 "Zend/zend_language_scanner.l" +#line 1755 "Zend/zend_language_scanner.l" { zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; @@ -1489,7 +1489,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy51: YYDEBUG(51, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1773 "Zend/zend_language_scanner.l" +#line 1777 "Zend/zend_language_scanner.l" { zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; @@ -1569,7 +1569,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy56: YYDEBUG(56, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2246 "Zend/zend_language_scanner.l" +#line 2250 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -1621,7 +1621,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(59, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2190 "Zend/zend_language_scanner.l" +#line 2194 "Zend/zend_language_scanner.l" { BEGIN(ST_IN_SCRIPTING); return '`'; @@ -1636,7 +1636,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(62, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2177 "Zend/zend_language_scanner.l" +#line 2181 "Zend/zend_language_scanner.l" { zendlval->value.lval = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); @@ -1659,7 +1659,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy65: YYDEBUG(65, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1877 "Zend/zend_language_scanner.l" +#line 1881 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; @@ -1671,7 +1671,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(67, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1453 "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; @@ -1690,7 +1690,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(71, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1869 "Zend/zend_language_scanner.l" +#line 1873 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); @@ -1716,7 +1716,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(74, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1859 "Zend/zend_language_scanner.l" +#line 1863 "Zend/zend_language_scanner.l" { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); @@ -1792,7 +1792,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy78: YYDEBUG(78, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2196 "Zend/zend_language_scanner.l" +#line 2200 "Zend/zend_language_scanner.l" { if (GET_DOUBLE_QUOTES_SCANNED_LENGTH()) { YYCURSOR += GET_DOUBLE_QUOTES_SCANNED_LENGTH() - 1; @@ -1852,7 +1852,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(81, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2185 "Zend/zend_language_scanner.l" +#line 2189 "Zend/zend_language_scanner.l" { BEGIN(ST_IN_SCRIPTING); return '"'; @@ -1867,7 +1867,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(84, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2177 "Zend/zend_language_scanner.l" +#line 2181 "Zend/zend_language_scanner.l" { zendlval->value.lval = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); @@ -1890,7 +1890,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy87: YYDEBUG(87, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1877 "Zend/zend_language_scanner.l" +#line 1881 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; @@ -1902,7 +1902,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(89, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1453 "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; @@ -1921,7 +1921,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(93, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1869 "Zend/zend_language_scanner.l" +#line 1873 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); @@ -1947,7 +1947,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(96, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1859 "Zend/zend_language_scanner.l" +#line 1863 "Zend/zend_language_scanner.l" { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); @@ -1966,7 +1966,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(100, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2164 "Zend/zend_language_scanner.l" +#line 2168 "Zend/zend_language_scanner.l" { YYCURSOR += CG(heredoc_len) - 1; yyleng = CG(heredoc_len); @@ -2040,7 +2040,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy104: YYDEBUG(104, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2288 "Zend/zend_language_scanner.l" +#line 2292 "Zend/zend_language_scanner.l" { int newline = 0; @@ -2126,7 +2126,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(108, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2177 "Zend/zend_language_scanner.l" +#line 2181 "Zend/zend_language_scanner.l" { zendlval->value.lval = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); @@ -2149,7 +2149,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy111: YYDEBUG(111, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1877 "Zend/zend_language_scanner.l" +#line 1881 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; @@ -2161,7 +2161,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(113, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1453 "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; @@ -2180,7 +2180,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(117, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1869 "Zend/zend_language_scanner.l" +#line 1873 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); @@ -2206,7 +2206,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(120, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1859 "Zend/zend_language_scanner.l" +#line 1863 "Zend/zend_language_scanner.l" { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); @@ -2381,23 +2381,23 @@ int lex_scan(zval *zendlval TSRMLS_DC) YYDEBUG(-1, yych); switch ((yych = *YYCURSOR)) { case 'C': - case 'c': goto yy732; + case 'c': goto yy735; case 'L': - case 'l': goto yy733; + case 'l': goto yy736; case 'M': - case 'm': goto yy734; + case 'm': goto yy737; case 'N': - case 'n': goto yy735; + case 'n': goto yy738; case 'V': - case 'v': goto yy736; + case 'v': goto yy739; case 'X': - case 'x': goto yy737; + case 'x': goto yy740; default: goto yy187; } yy124: YYDEBUG(124, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1900 "Zend/zend_language_scanner.l" +#line 1904 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, yytext, yyleng); zendlval->type = IS_STRING; @@ -2409,20 +2409,20 @@ int lex_scan(zval *zendlval TSRMLS_DC) yych = *++YYCURSOR; if (yych <= 'O') { if (yych <= 'H') { - if (yych == 'E') goto yy714; + if (yych == 'E') goto yy717; goto yy187; } else { - if (yych <= 'I') goto yy715; + if (yych <= 'I') goto yy718; if (yych <= 'N') goto yy187; - goto yy716; + goto yy719; } } else { if (yych <= 'h') { - if (yych == 'e') goto yy714; + if (yych == 'e') goto yy717; goto yy187; } else { - if (yych <= 'i') goto yy715; - if (yych == 'o') goto yy716; + if (yych <= 'i') goto yy718; + if (yych == 'o') goto yy719; goto yy187; } } @@ -2635,7 +2635,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy139: YYDEBUG(139, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1442 "Zend/zend_language_scanner.l" +#line 1446 "Zend/zend_language_scanner.l" { return yytext[0]; } @@ -2648,7 +2648,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy141: YYDEBUG(141, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1173 "Zend/zend_language_scanner.l" +#line 1177 "Zend/zend_language_scanner.l" { zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; @@ -2667,7 +2667,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(144, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1202 "Zend/zend_language_scanner.l" +#line 1206 "Zend/zend_language_scanner.l" { return T_NS_SEPARATOR; } @@ -2899,7 +2899,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(169, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1447 "Zend/zend_language_scanner.l" +#line 1451 "Zend/zend_language_scanner.l" { yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); return '{'; @@ -2910,7 +2910,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(171, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1459 "Zend/zend_language_scanner.l" +#line 1463 "Zend/zend_language_scanner.l" { RESET_DOC_COMMENT(); if (!zend_stack_is_empty(&SCNG(state_stack))) { @@ -2946,7 +2946,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy173: YYDEBUG(173, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1510 "Zend/zend_language_scanner.l" +#line 1514 "Zend/zend_language_scanner.l" { if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */ zendlval->value.lval = strtol(yytext, NULL, 0); @@ -2995,7 +2995,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy177: YYDEBUG(177, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1907 "Zend/zend_language_scanner.l" +#line 1911 "Zend/zend_language_scanner.l" { while (YYCURSOR < YYLIMIT) { switch (*YYCURSOR++) { @@ -3036,7 +3036,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy179: YYDEBUG(179, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1998 "Zend/zend_language_scanner.l" +#line 2002 "Zend/zend_language_scanner.l" { register char *s, *t; char *end; @@ -3111,7 +3111,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy181: YYDEBUG(181, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2067 "Zend/zend_language_scanner.l" +#line 2071 "Zend/zend_language_scanner.l" { int bprefix = (yytext[0] != '"') ? 1 : 0; @@ -3158,7 +3158,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(183, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2158 "Zend/zend_language_scanner.l" +#line 2162 "Zend/zend_language_scanner.l" { BEGIN(ST_BACKQUOTE); return '`'; @@ -3169,7 +3169,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(185, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2416 "Zend/zend_language_scanner.l" +#line 2420 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -3205,7 +3205,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy190: YYDEBUG(190, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1575 "Zend/zend_language_scanner.l" +#line 1579 "Zend/zend_language_scanner.l" { zendlval->value.dval = zend_strtod(yytext, NULL); zendlval->type = IS_DOUBLE; @@ -3303,7 +3303,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(202, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1485 "Zend/zend_language_scanner.l" +#line 1489 "Zend/zend_language_scanner.l" { char *bin = yytext + 2; /* Skip "0b" */ int len = yyleng - 2; @@ -3340,7 +3340,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(205, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1531 "Zend/zend_language_scanner.l" +#line 1535 "Zend/zend_language_scanner.l" { char *hex = yytext + 2; /* Skip "0x" */ int len = yyleng - 2; @@ -3374,7 +3374,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy207: YYDEBUG(207, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1975 "Zend/zend_language_scanner.l" +#line 1979 "Zend/zend_language_scanner.l" { zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; @@ -3416,7 +3416,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy212: YYDEBUG(212, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1877 "Zend/zend_language_scanner.l" +#line 1881 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; @@ -3436,7 +3436,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(215, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1430 "Zend/zend_language_scanner.l" +#line 1434 "Zend/zend_language_scanner.l" { return T_LOGICAL_XOR; } @@ -3449,7 +3449,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(217, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1422 "Zend/zend_language_scanner.l" +#line 1426 "Zend/zend_language_scanner.l" { return T_LOGICAL_OR; } @@ -3459,7 +3459,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(219, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1410 "Zend/zend_language_scanner.l" +#line 1414 "Zend/zend_language_scanner.l" { return T_XOR_EQUAL; } @@ -3469,7 +3469,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(221, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1414 "Zend/zend_language_scanner.l" +#line 1418 "Zend/zend_language_scanner.l" { return T_BOOLEAN_OR; } @@ -3479,7 +3479,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(223, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1406 "Zend/zend_language_scanner.l" +#line 1410 "Zend/zend_language_scanner.l" { return T_OR_EQUAL; } @@ -3489,7 +3489,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(225, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1418 "Zend/zend_language_scanner.l" +#line 1422 "Zend/zend_language_scanner.l" { return T_BOOLEAN_AND; } @@ -3499,7 +3499,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(227, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1402 "Zend/zend_language_scanner.l" +#line 1406 "Zend/zend_language_scanner.l" { return T_AND_EQUAL; } @@ -3512,7 +3512,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy229: YYDEBUG(229, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1984 "Zend/zend_language_scanner.l" +#line 1988 "Zend/zend_language_scanner.l" { if (CG(asp_tags)) { BEGIN(INITIAL); @@ -3531,7 +3531,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(231, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1390 "Zend/zend_language_scanner.l" +#line 1394 "Zend/zend_language_scanner.l" { return T_MOD_EQUAL; } @@ -3566,7 +3566,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(237, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1386 "Zend/zend_language_scanner.l" +#line 1390 "Zend/zend_language_scanner.l" { return T_CONCAT_EQUAL; } @@ -3579,7 +3579,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy239: YYDEBUG(239, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1941 "Zend/zend_language_scanner.l" +#line 1945 "Zend/zend_language_scanner.l" { int doc_com; @@ -3623,7 +3623,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(242, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1382 "Zend/zend_language_scanner.l" +#line 1386 "Zend/zend_language_scanner.l" { return T_DIV_EQUAL; } @@ -3650,7 +3650,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(247, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1378 "Zend/zend_language_scanner.l" +#line 1382 "Zend/zend_language_scanner.l" { return T_MUL_EQUAL; } @@ -3661,7 +3661,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) if ((yych = *YYCURSOR) == '=') goto yy252; YYDEBUG(249, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1438 "Zend/zend_language_scanner.l" +#line 1442 "Zend/zend_language_scanner.l" { return T_SR; } @@ -3671,7 +3671,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(251, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1366 "Zend/zend_language_scanner.l" +#line 1370 "Zend/zend_language_scanner.l" { return T_IS_GREATER_OR_EQUAL; } @@ -3681,7 +3681,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(253, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1398 "Zend/zend_language_scanner.l" +#line 1402 "Zend/zend_language_scanner.l" { return T_SR_EQUAL; } @@ -3696,7 +3696,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy255: YYDEBUG(255, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1434 "Zend/zend_language_scanner.l" +#line 1438 "Zend/zend_language_scanner.l" { return T_SL; } @@ -3712,7 +3712,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(258, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1362 "Zend/zend_language_scanner.l" +#line 1366 "Zend/zend_language_scanner.l" { return T_IS_SMALLER_OR_EQUAL; } @@ -3723,7 +3723,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy260: YYDEBUG(260, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1358 "Zend/zend_language_scanner.l" +#line 1362 "Zend/zend_language_scanner.l" { return T_IS_NOT_EQUAL; } @@ -3778,7 +3778,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(269, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1394 "Zend/zend_language_scanner.l" +#line 1398 "Zend/zend_language_scanner.l" { return T_SL_EQUAL; } @@ -3887,7 +3887,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy280: YYDEBUG(280, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2109 "Zend/zend_language_scanner.l" +#line 2113 "Zend/zend_language_scanner.l" { char *s; int bprefix = (yytext[0] != '<') ? 1 : 0; @@ -3975,7 +3975,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(286, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1350 "Zend/zend_language_scanner.l" +#line 1354 "Zend/zend_language_scanner.l" { return T_IS_NOT_IDENTICAL; } @@ -3985,7 +3985,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(288, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1370 "Zend/zend_language_scanner.l" +#line 1374 "Zend/zend_language_scanner.l" { return T_PLUS_EQUAL; } @@ -3995,7 +3995,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(290, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1338 "Zend/zend_language_scanner.l" +#line 1342 "Zend/zend_language_scanner.l" { return T_INC; } @@ -4018,7 +4018,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(294, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1326 "Zend/zend_language_scanner.l" +#line 1330 "Zend/zend_language_scanner.l" { return T_LIST; } @@ -4029,7 +4029,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) if ((yych = *YYCURSOR) == '=') goto yy299; YYDEBUG(296, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1354 "Zend/zend_language_scanner.l" +#line 1358 "Zend/zend_language_scanner.l" { return T_IS_EQUAL; } @@ -4039,7 +4039,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(298, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1322 "Zend/zend_language_scanner.l" +#line 1326 "Zend/zend_language_scanner.l" { return T_DOUBLE_ARROW; } @@ -4049,7 +4049,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(300, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1346 "Zend/zend_language_scanner.l" +#line 1350 "Zend/zend_language_scanner.l" { return T_IS_IDENTICAL; } @@ -4183,7 +4183,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(320, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1710 "Zend/zend_language_scanner.l" +#line 1714 "Zend/zend_language_scanner.l" { if (CG(current_namespace)) { *zendlval = *CG(current_namespace); @@ -4213,7 +4213,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(325, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1683 "Zend/zend_language_scanner.l" +#line 1687 "Zend/zend_language_scanner.l" { char *filename = zend_get_compiled_filename(TSRMLS_C); const size_t filename_len = strlen(filename); @@ -4265,7 +4265,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(331, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1665 "Zend/zend_language_scanner.l" +#line 1669 "Zend/zend_language_scanner.l" { zendlval->value.lval = CG(zend_lineno); zendlval->type = IS_LONG; @@ -4306,7 +4306,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(339, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1644 "Zend/zend_language_scanner.l" +#line 1648 "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; @@ -4378,7 +4378,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(350, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1628 "Zend/zend_language_scanner.l" +#line 1632 "Zend/zend_language_scanner.l" { const char *func_name = NULL; @@ -4414,7 +4414,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(355, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1671 "Zend/zend_language_scanner.l" +#line 1675 "Zend/zend_language_scanner.l" { char *filename = zend_get_compiled_filename(TSRMLS_C); @@ -4456,7 +4456,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(362, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1608 "Zend/zend_language_scanner.l" +#line 1612 "Zend/zend_language_scanner.l" { const char *trait_name = NULL; @@ -4506,7 +4506,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(369, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1581 "Zend/zend_language_scanner.l" +#line 1585 "Zend/zend_language_scanner.l" { const char *class_name = NULL; @@ -4595,7 +4595,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(382, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1290 "Zend/zend_language_scanner.l" +#line 1294 "Zend/zend_language_scanner.l" { return T_HALT_COMPILER; } @@ -4619,7 +4619,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(386, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1270 "Zend/zend_language_scanner.l" +#line 1274 "Zend/zend_language_scanner.l" { return T_USE; } @@ -4642,7 +4642,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(390, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1318 "Zend/zend_language_scanner.l" +#line 1322 "Zend/zend_language_scanner.l" { return T_UNSET; } @@ -4818,7 +4818,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(408, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1218 "Zend/zend_language_scanner.l" +#line 1222 "Zend/zend_language_scanner.l" { return T_INT_CAST; } @@ -4866,7 +4866,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(417, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1222 "Zend/zend_language_scanner.l" +#line 1226 "Zend/zend_language_scanner.l" { return T_DOUBLE_CAST; } @@ -4940,7 +4940,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(431, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1226 "Zend/zend_language_scanner.l" +#line 1230 "Zend/zend_language_scanner.l" { return T_STRING_CAST; } @@ -4977,7 +4977,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(438, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1230 "Zend/zend_language_scanner.l" +#line 1234 "Zend/zend_language_scanner.l" { return T_ARRAY_CAST; } @@ -5019,7 +5019,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(446, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1234 "Zend/zend_language_scanner.l" +#line 1238 "Zend/zend_language_scanner.l" { return T_OBJECT_CAST; } @@ -5064,7 +5064,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(454, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1238 "Zend/zend_language_scanner.l" +#line 1242 "Zend/zend_language_scanner.l" { return T_BOOL_CAST; } @@ -5128,7 +5128,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(466, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1242 "Zend/zend_language_scanner.l" +#line 1246 "Zend/zend_language_scanner.l" { return T_UNSET_CAST; } @@ -5146,7 +5146,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(469, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1214 "Zend/zend_language_scanner.l" +#line 1218 "Zend/zend_language_scanner.l" { return T_VAR; } @@ -5170,7 +5170,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(473, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1206 "Zend/zend_language_scanner.l" +#line 1210 "Zend/zend_language_scanner.l" { return T_NEW; } @@ -5213,7 +5213,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(481, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1266 "Zend/zend_language_scanner.l" +#line 1270 "Zend/zend_language_scanner.l" { return T_NAMESPACE; } @@ -5223,7 +5223,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(483, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1198 "Zend/zend_language_scanner.l" +#line 1202 "Zend/zend_language_scanner.l" { return T_PAAMAYIM_NEKUDOTAYIM; } @@ -5249,7 +5249,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(487, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1374 "Zend/zend_language_scanner.l" +#line 1378 "Zend/zend_language_scanner.l" { return T_MINUS_EQUAL; } @@ -5259,7 +5259,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(489, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1342 "Zend/zend_language_scanner.l" +#line 1346 "Zend/zend_language_scanner.l" { return T_DEC; } @@ -5269,7 +5269,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) ++YYCURSOR; YYDEBUG(491, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1168 "Zend/zend_language_scanner.l" +#line 1172 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); return T_OBJECT_OPERATOR; @@ -5319,7 +5319,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(498, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1314 "Zend/zend_language_scanner.l" +#line 1318 "Zend/zend_language_scanner.l" { return T_PUBLIC; } @@ -5378,7 +5378,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(507, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1310 "Zend/zend_language_scanner.l" +#line 1314 "Zend/zend_language_scanner.l" { return T_PROTECTED; } @@ -5412,7 +5412,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(513, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1306 "Zend/zend_language_scanner.l" +#line 1310 "Zend/zend_language_scanner.l" { return T_PRIVATE; } @@ -5425,7 +5425,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(515, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1144 "Zend/zend_language_scanner.l" +#line 1148 "Zend/zend_language_scanner.l" { return T_PRINT; } @@ -5454,7 +5454,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(520, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1136 "Zend/zend_language_scanner.l" +#line 1140 "Zend/zend_language_scanner.l" { return T_GOTO; } @@ -5482,7 +5482,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(525, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1278 "Zend/zend_language_scanner.l" +#line 1282 "Zend/zend_language_scanner.l" { return T_GLOBAL; } @@ -5523,7 +5523,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(533, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1128 "Zend/zend_language_scanner.l" +#line 1132 "Zend/zend_language_scanner.l" { return T_BREAK; } @@ -5567,7 +5567,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(541, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1112 "Zend/zend_language_scanner.l" +#line 1116 "Zend/zend_language_scanner.l" { return T_SWITCH; } @@ -5595,7 +5595,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(546, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1294 "Zend/zend_language_scanner.l" +#line 1298 "Zend/zend_language_scanner.l" { return T_STATIC; } @@ -5626,7 +5626,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(551, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1108 "Zend/zend_language_scanner.l" +#line 1112 "Zend/zend_language_scanner.l" { return T_AS; } @@ -5649,7 +5649,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(555, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1330 "Zend/zend_language_scanner.l" +#line 1334 "Zend/zend_language_scanner.l" { return T_ARRAY; } @@ -5662,7 +5662,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(557, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1426 "Zend/zend_language_scanner.l" +#line 1430 "Zend/zend_language_scanner.l" { return T_LOGICAL_AND; } @@ -5700,7 +5700,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(564, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1298 "Zend/zend_language_scanner.l" +#line 1302 "Zend/zend_language_scanner.l" { return T_ABSTRACT; } @@ -5728,7 +5728,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(569, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1068 "Zend/zend_language_scanner.l" +#line 1072 "Zend/zend_language_scanner.l" { return T_WHILE; } @@ -5741,7 +5741,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(571, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1052 "Zend/zend_language_scanner.l" +#line 1056 "Zend/zend_language_scanner.l" { return T_IF; } @@ -5797,7 +5797,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(578, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1282 "Zend/zend_language_scanner.l" +#line 1286 "Zend/zend_language_scanner.l" { return T_ISSET; } @@ -5855,7 +5855,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy586: YYDEBUG(586, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1250 "Zend/zend_language_scanner.l" +#line 1254 "Zend/zend_language_scanner.l" { return T_INCLUDE; } @@ -5888,7 +5888,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(592, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1254 "Zend/zend_language_scanner.l" +#line 1258 "Zend/zend_language_scanner.l" { return T_INCLUDE_ONCE; } @@ -5926,7 +5926,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(599, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1152 "Zend/zend_language_scanner.l" +#line 1156 "Zend/zend_language_scanner.l" { return T_INTERFACE; } @@ -5980,7 +5980,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(607, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1274 "Zend/zend_language_scanner.l" +#line 1278 "Zend/zend_language_scanner.l" { return T_INSTEADOF; } @@ -6013,7 +6013,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(613, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1104 "Zend/zend_language_scanner.l" +#line 1108 "Zend/zend_language_scanner.l" { return T_INSTANCEOF; } @@ -6061,7 +6061,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(622, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1164 "Zend/zend_language_scanner.l" +#line 1168 "Zend/zend_language_scanner.l" { return T_IMPLEMENTS; } @@ -6116,7 +6116,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(630, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1156 "Zend/zend_language_scanner.l" +#line 1160 "Zend/zend_language_scanner.l" { return T_TRAIT; } @@ -6139,7 +6139,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(634, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1048 "Zend/zend_language_scanner.l" +#line 1052 "Zend/zend_language_scanner.l" { return T_THROW; } @@ -6232,7 +6232,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy647: YYDEBUG(647, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1258 "Zend/zend_language_scanner.l" +#line 1262 "Zend/zend_language_scanner.l" { return T_REQUIRE; } @@ -6265,7 +6265,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(653, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1262 "Zend/zend_language_scanner.l" +#line 1266 "Zend/zend_language_scanner.l" { return T_REQUIRE_ONCE; } @@ -6382,7 +6382,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(668, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1132 "Zend/zend_language_scanner.l" +#line 1136 "Zend/zend_language_scanner.l" { return T_CONTINUE; } @@ -6424,7 +6424,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(675, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1210 "Zend/zend_language_scanner.l" +#line 1214 "Zend/zend_language_scanner.l" { return T_CLONE; } @@ -6442,7 +6442,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(678, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1148 "Zend/zend_language_scanner.l" +#line 1152 "Zend/zend_language_scanner.l" { return T_CLASS; } @@ -6492,7 +6492,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(687, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1334 "Zend/zend_language_scanner.l" +#line 1338 "Zend/zend_language_scanner.l" { return T_CALLABLE; } @@ -6505,7 +6505,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(689, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1120 "Zend/zend_language_scanner.l" +#line 1124 "Zend/zend_language_scanner.l" { return T_CASE; } @@ -6606,7 +6606,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy704: YYDEBUG(704, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1080 "Zend/zend_language_scanner.l" +#line 1084 "Zend/zend_language_scanner.l" { return T_FOR; } @@ -6634,7 +6634,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) } YYDEBUG(709, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1088 "Zend/zend_language_scanner.l" +#line 1092 "Zend/zend_language_scanner.l" { return T_FOREACH; } @@ -6652,557 +6652,590 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy712: YYDEBUG(712, *YYCURSOR); ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy186; + if ((yych = *YYCURSOR) <= '^') { + if (yych <= '@') { + if (yych <= '/') goto yy713; + if (yych <= '9') goto yy186; + } else { + if (yych == 'L') goto yy714; + if (yych <= 'Z') goto yy186; + } + } else { + if (yych <= 'k') { + if (yych != '`') goto yy186; + } else { + if (yych <= 'l') goto yy714; + if (yych <= 'z') goto yy186; + if (yych >= 0x7F) goto yy186; + } } +yy713: YYDEBUG(713, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1302 "Zend/zend_language_scanner.l" +#line 1306 "Zend/zend_language_scanner.l" { return T_FINAL; } -#line 6665 "Zend/zend_language_scanner.c" +#line 6680 "Zend/zend_language_scanner.c" yy714: YYDEBUG(714, *YYCURSOR); yych = *++YYCURSOR; + if (yych == 'Y') goto yy715; + if (yych != 'y') goto yy187; +yy715: + YYDEBUG(715, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(716, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1048 "Zend/zend_language_scanner.l" + { + return T_FINALLY; +} +#line 6698 "Zend/zend_language_scanner.c" +yy717: + YYDEBUG(717, *YYCURSOR); + yych = *++YYCURSOR; if (yych <= 'F') { - if (yych == 'C') goto yy720; + if (yych == 'C') goto yy723; if (yych <= 'E') goto yy187; - goto yy721; + goto yy724; } else { if (yych <= 'c') { if (yych <= 'b') goto yy187; - goto yy720; + goto yy723; } else { - if (yych == 'f') goto yy721; + if (yych == 'f') goto yy724; goto yy187; } } -yy715: - YYDEBUG(715, *YYCURSOR); +yy718: + YYDEBUG(718, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy718; - if (yych == 'e') goto yy718; + if (yych == 'E') goto yy721; + if (yych == 'e') goto yy721; goto yy187; -yy716: - YYDEBUG(716, *YYCURSOR); +yy719: + YYDEBUG(719, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(717, *YYCURSOR); + YYDEBUG(720, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1076 "Zend/zend_language_scanner.l" +#line 1080 "Zend/zend_language_scanner.l" { return T_DO; } -#line 6700 "Zend/zend_language_scanner.c" -yy718: - YYDEBUG(718, *YYCURSOR); +#line 6733 "Zend/zend_language_scanner.c" +yy721: + YYDEBUG(721, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(719, *YYCURSOR); + YYDEBUG(722, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 1020 "Zend/zend_language_scanner.l" { return T_EXIT; } -#line 6713 "Zend/zend_language_scanner.c" -yy720: - YYDEBUG(720, *YYCURSOR); +#line 6746 "Zend/zend_language_scanner.c" +yy723: + YYDEBUG(723, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy727; - if (yych == 'l') goto yy727; + if (yych == 'L') goto yy730; + if (yych == 'l') goto yy730; goto yy187; -yy721: - YYDEBUG(721, *YYCURSOR); +yy724: + YYDEBUG(724, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy722; + if (yych == 'A') goto yy725; if (yych != 'a') goto yy187; -yy722: - YYDEBUG(722, *YYCURSOR); +yy725: + YYDEBUG(725, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'U') goto yy723; + if (yych == 'U') goto yy726; if (yych != 'u') goto yy187; -yy723: - YYDEBUG(723, *YYCURSOR); +yy726: + YYDEBUG(726, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy724; + if (yych == 'L') goto yy727; if (yych != 'l') goto yy187; -yy724: - YYDEBUG(724, *YYCURSOR); +yy727: + YYDEBUG(727, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy725; + if (yych == 'T') goto yy728; if (yych != 't') goto yy187; -yy725: - YYDEBUG(725, *YYCURSOR); +yy728: + YYDEBUG(728, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(726, *YYCURSOR); + YYDEBUG(729, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1124 "Zend/zend_language_scanner.l" +#line 1128 "Zend/zend_language_scanner.l" { return T_DEFAULT; } -#line 6752 "Zend/zend_language_scanner.c" -yy727: - YYDEBUG(727, *YYCURSOR); +#line 6785 "Zend/zend_language_scanner.c" +yy730: + YYDEBUG(730, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy728; + if (yych == 'A') goto yy731; if (yych != 'a') goto yy187; -yy728: - YYDEBUG(728, *YYCURSOR); +yy731: + YYDEBUG(731, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy729; + if (yych == 'R') goto yy732; if (yych != 'r') goto yy187; -yy729: - YYDEBUG(729, *YYCURSOR); +yy732: + YYDEBUG(732, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy730; + if (yych == 'E') goto yy733; if (yych != 'e') goto yy187; -yy730: - YYDEBUG(730, *YYCURSOR); +yy733: + YYDEBUG(733, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(731, *YYCURSOR); + YYDEBUG(734, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1096 "Zend/zend_language_scanner.l" +#line 1100 "Zend/zend_language_scanner.l" { return T_DECLARE; } -#line 6780 "Zend/zend_language_scanner.c" -yy732: - YYDEBUG(732, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'H') goto yy794; - if (yych == 'h') goto yy794; - goto yy187; -yy733: - YYDEBUG(733, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'S') goto yy788; - if (yych == 's') goto yy788; - goto yy187; -yy734: - YYDEBUG(734, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'P') goto yy784; - if (yych == 'p') goto yy784; - goto yy187; +#line 6813 "Zend/zend_language_scanner.c" yy735: YYDEBUG(735, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'D') goto yy750; - if (yych == 'd') goto yy750; + if (yych == 'H') goto yy797; + if (yych == 'h') goto yy797; goto yy187; yy736: YYDEBUG(736, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy747; - if (yych == 'a') goto yy747; + if (yych == 'S') goto yy791; + if (yych == 's') goto yy791; goto yy187; yy737: YYDEBUG(737, *YYCURSOR); yych = *++YYCURSOR; - if (yych <= 'T') { - if (yych == 'I') goto yy738; - if (yych <= 'S') goto yy187; - goto yy739; - } else { - if (yych <= 'i') { - if (yych <= 'h') goto yy187; - } else { - if (yych == 't') goto yy739; - goto yy187; - } - } + if (yych == 'P') goto yy787; + if (yych == 'p') goto yy787; + goto yy187; yy738: YYDEBUG(738, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy745; - if (yych == 't') goto yy745; + if (yych == 'D') goto yy753; + if (yych == 'd') goto yy753; goto yy187; yy739: YYDEBUG(739, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy740; - if (yych != 'e') goto yy187; + if (yych == 'A') goto yy750; + if (yych == 'a') goto yy750; + goto yy187; yy740: YYDEBUG(740, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy741; - if (yych != 'n') goto yy187; + if (yych <= 'T') { + if (yych == 'I') goto yy741; + if (yych <= 'S') goto yy187; + goto yy742; + } else { + if (yych <= 'i') { + if (yych <= 'h') goto yy187; + } else { + if (yych == 't') goto yy742; + goto yy187; + } + } yy741: YYDEBUG(741, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'D') goto yy742; - if (yych != 'd') goto yy187; + if (yych == 'T') goto yy748; + if (yych == 't') goto yy748; + goto yy187; yy742: YYDEBUG(742, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'S') goto yy743; - if (yych != 's') goto yy187; + if (yych == 'E') goto yy743; + if (yych != 'e') goto yy187; yy743: YYDEBUG(743, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy744; + if (yych != 'n') goto yy187; +yy744: + YYDEBUG(744, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'D') goto yy745; + if (yych != 'd') goto yy187; +yy745: + YYDEBUG(745, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy746; + if (yych != 's') goto yy187; +yy746: + YYDEBUG(746, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(744, *YYCURSOR); + YYDEBUG(747, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1160 "Zend/zend_language_scanner.l" +#line 1164 "Zend/zend_language_scanner.l" { return T_EXTENDS; } -#line 6864 "Zend/zend_language_scanner.c" -yy745: - YYDEBUG(745, *YYCURSOR); +#line 6897 "Zend/zend_language_scanner.c" +yy748: + YYDEBUG(748, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(746, *YYCURSOR); + YYDEBUG(749, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 1016 "Zend/zend_language_scanner.l" { return T_EXIT; } -#line 6877 "Zend/zend_language_scanner.c" -yy747: - YYDEBUG(747, *YYCURSOR); +#line 6910 "Zend/zend_language_scanner.c" +yy750: + YYDEBUG(750, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy748; + if (yych == 'L') goto yy751; if (yych != 'l') goto yy187; -yy748: - YYDEBUG(748, *YYCURSOR); +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 1246 "Zend/zend_language_scanner.l" +#line 1250 "Zend/zend_language_scanner.l" { return T_EVAL; } -#line 6895 "Zend/zend_language_scanner.c" -yy750: - YYDEBUG(750, *YYCURSOR); +#line 6928 "Zend/zend_language_scanner.c" +yy753: + YYDEBUG(753, *YYCURSOR); yych = *++YYCURSOR; YYDEBUG(-1, yych); switch (yych) { case 'D': - case 'd': goto yy751; + case 'd': goto yy754; case 'F': - case 'f': goto yy752; + case 'f': goto yy755; case 'I': - case 'i': goto yy753; + case 'i': goto yy756; case 'S': - case 's': goto yy754; + case 's': goto yy757; case 'W': - case 'w': goto yy755; + case 'w': goto yy758; default: goto yy187; } -yy751: - YYDEBUG(751, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy777; - if (yych == 'e') goto yy777; - goto yy187; -yy752: - YYDEBUG(752, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'O') goto yy769; - if (yych == 'o') goto yy769; - goto yy187; -yy753: - YYDEBUG(753, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'F') goto yy767; - if (yych == 'f') goto yy767; - goto yy187; yy754: YYDEBUG(754, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'W') goto yy761; - if (yych == 'w') goto yy761; + if (yych == 'E') goto yy780; + if (yych == 'e') goto yy780; goto yy187; yy755: YYDEBUG(755, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'H') goto yy756; - if (yych != 'h') goto yy187; + if (yych == 'O') goto yy772; + if (yych == 'o') goto yy772; + goto yy187; yy756: YYDEBUG(756, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy757; - if (yych != 'i') goto yy187; + if (yych == 'F') goto yy770; + if (yych == 'f') goto yy770; + goto yy187; yy757: YYDEBUG(757, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy758; - if (yych != 'l') goto yy187; + if (yych == 'W') goto yy764; + if (yych == 'w') goto yy764; + goto yy187; yy758: YYDEBUG(758, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy759; - if (yych != 'e') goto yy187; + if (yych == 'H') goto yy759; + if (yych != 'h') goto yy187; yy759: YYDEBUG(759, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy760; + if (yych != 'i') goto yy187; +yy760: + YYDEBUG(760, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy761; + if (yych != 'l') goto yy187; +yy761: + YYDEBUG(761, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy762; + if (yych != 'e') goto yy187; +yy762: + YYDEBUG(762, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(760, *YYCURSOR); + YYDEBUG(763, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1072 "Zend/zend_language_scanner.l" +#line 1076 "Zend/zend_language_scanner.l" { return T_ENDWHILE; } -#line 6969 "Zend/zend_language_scanner.c" -yy761: - YYDEBUG(761, *YYCURSOR); +#line 7002 "Zend/zend_language_scanner.c" +yy764: + YYDEBUG(764, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy762; + if (yych == 'I') goto yy765; if (yych != 'i') goto yy187; -yy762: - YYDEBUG(762, *YYCURSOR); +yy765: + YYDEBUG(765, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy763; + if (yych == 'T') goto yy766; if (yych != 't') goto yy187; -yy763: - YYDEBUG(763, *YYCURSOR); +yy766: + YYDEBUG(766, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy764; + if (yych == 'C') goto yy767; if (yych != 'c') goto yy187; -yy764: - YYDEBUG(764, *YYCURSOR); +yy767: + YYDEBUG(767, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'H') goto yy765; + if (yych == 'H') goto yy768; if (yych != 'h') goto yy187; -yy765: - YYDEBUG(765, *YYCURSOR); +yy768: + YYDEBUG(768, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(766, *YYCURSOR); + YYDEBUG(769, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1116 "Zend/zend_language_scanner.l" +#line 1120 "Zend/zend_language_scanner.l" { return T_ENDSWITCH; } -#line 7002 "Zend/zend_language_scanner.c" -yy767: - YYDEBUG(767, *YYCURSOR); +#line 7035 "Zend/zend_language_scanner.c" +yy770: + YYDEBUG(770, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(768, *YYCURSOR); + YYDEBUG(771, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1060 "Zend/zend_language_scanner.l" +#line 1064 "Zend/zend_language_scanner.l" { return T_ENDIF; } -#line 7015 "Zend/zend_language_scanner.c" -yy769: - YYDEBUG(769, *YYCURSOR); +#line 7048 "Zend/zend_language_scanner.c" +yy772: + YYDEBUG(772, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy770; + if (yych == 'R') goto yy773; if (yych != 'r') goto yy187; -yy770: - YYDEBUG(770, *YYCURSOR); +yy773: + YYDEBUG(773, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) <= '^') { if (yych <= '@') { - if (yych <= '/') goto yy771; + if (yych <= '/') goto yy774; if (yych <= '9') goto yy186; } else { - if (yych == 'E') goto yy772; + if (yych == 'E') goto yy775; if (yych <= 'Z') goto yy186; } } else { if (yych <= 'd') { if (yych != '`') goto yy186; } else { - if (yych <= 'e') goto yy772; + if (yych <= 'e') goto yy775; if (yych <= 'z') goto yy186; if (yych >= 0x7F) goto yy186; } } -yy771: - YYDEBUG(771, *YYCURSOR); +yy774: + YYDEBUG(774, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1084 "Zend/zend_language_scanner.l" +#line 1088 "Zend/zend_language_scanner.l" { return T_ENDFOR; } -#line 7048 "Zend/zend_language_scanner.c" -yy772: - YYDEBUG(772, *YYCURSOR); +#line 7081 "Zend/zend_language_scanner.c" +yy775: + YYDEBUG(775, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy773; + if (yych == 'A') goto yy776; if (yych != 'a') goto yy187; -yy773: - YYDEBUG(773, *YYCURSOR); +yy776: + YYDEBUG(776, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy774; + if (yych == 'C') goto yy777; if (yych != 'c') goto yy187; -yy774: - YYDEBUG(774, *YYCURSOR); +yy777: + YYDEBUG(777, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'H') goto yy775; + if (yych == 'H') goto yy778; if (yych != 'h') goto yy187; -yy775: - YYDEBUG(775, *YYCURSOR); +yy778: + YYDEBUG(778, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(776, *YYCURSOR); + YYDEBUG(779, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1092 "Zend/zend_language_scanner.l" +#line 1096 "Zend/zend_language_scanner.l" { return T_ENDFOREACH; } -#line 7076 "Zend/zend_language_scanner.c" -yy777: - YYDEBUG(777, *YYCURSOR); +#line 7109 "Zend/zend_language_scanner.c" +yy780: + YYDEBUG(780, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy778; + if (yych == 'C') goto yy781; if (yych != 'c') goto yy187; -yy778: - YYDEBUG(778, *YYCURSOR); +yy781: + YYDEBUG(781, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy779; + if (yych == 'L') goto yy782; if (yych != 'l') goto yy187; -yy779: - YYDEBUG(779, *YYCURSOR); +yy782: + YYDEBUG(782, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy780; + if (yych == 'A') goto yy783; if (yych != 'a') goto yy187; -yy780: - YYDEBUG(780, *YYCURSOR); +yy783: + YYDEBUG(783, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy781; + if (yych == 'R') goto yy784; if (yych != 'r') goto yy187; -yy781: - YYDEBUG(781, *YYCURSOR); +yy784: + YYDEBUG(784, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy782; + if (yych == 'E') goto yy785; if (yych != 'e') goto yy187; -yy782: - YYDEBUG(782, *YYCURSOR); +yy785: + YYDEBUG(785, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(783, *YYCURSOR); + YYDEBUG(786, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1100 "Zend/zend_language_scanner.l" +#line 1104 "Zend/zend_language_scanner.l" { return T_ENDDECLARE; } -#line 7114 "Zend/zend_language_scanner.c" -yy784: - YYDEBUG(784, *YYCURSOR); +#line 7147 "Zend/zend_language_scanner.c" +yy787: + YYDEBUG(787, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy785; + if (yych == 'T') goto yy788; if (yych != 't') goto yy187; -yy785: - YYDEBUG(785, *YYCURSOR); +yy788: + YYDEBUG(788, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'Y') goto yy786; + if (yych == 'Y') goto yy789; if (yych != 'y') goto yy187; -yy786: - YYDEBUG(786, *YYCURSOR); +yy789: + YYDEBUG(789, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(787, *YYCURSOR); + YYDEBUG(790, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1286 "Zend/zend_language_scanner.l" +#line 1290 "Zend/zend_language_scanner.l" { return T_EMPTY; } -#line 7137 "Zend/zend_language_scanner.c" -yy788: - YYDEBUG(788, *YYCURSOR); +#line 7170 "Zend/zend_language_scanner.c" +yy791: + YYDEBUG(791, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy789; + if (yych == 'E') goto yy792; if (yych != 'e') goto yy187; -yy789: - YYDEBUG(789, *YYCURSOR); +yy792: + YYDEBUG(792, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) <= '^') { if (yych <= '@') { - if (yych <= '/') goto yy790; + if (yych <= '/') goto yy793; if (yych <= '9') goto yy186; } else { - if (yych == 'I') goto yy791; + if (yych == 'I') goto yy794; if (yych <= 'Z') goto yy186; } } else { if (yych <= 'h') { if (yych != '`') goto yy186; } else { - if (yych <= 'i') goto yy791; + if (yych <= 'i') goto yy794; if (yych <= 'z') goto yy186; if (yych >= 0x7F) goto yy186; } } -yy790: - YYDEBUG(790, *YYCURSOR); +yy793: + YYDEBUG(793, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1064 "Zend/zend_language_scanner.l" +#line 1068 "Zend/zend_language_scanner.l" { return T_ELSE; } -#line 7170 "Zend/zend_language_scanner.c" -yy791: - YYDEBUG(791, *YYCURSOR); +#line 7203 "Zend/zend_language_scanner.c" +yy794: + YYDEBUG(794, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'F') goto yy792; + if (yych == 'F') goto yy795; if (yych != 'f') goto yy187; -yy792: - YYDEBUG(792, *YYCURSOR); +yy795: + YYDEBUG(795, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy186; } - YYDEBUG(793, *YYCURSOR); + YYDEBUG(796, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1056 "Zend/zend_language_scanner.l" +#line 1060 "Zend/zend_language_scanner.l" { return T_ELSEIF; } -#line 7188 "Zend/zend_language_scanner.c" -yy794: - YYDEBUG(794, *YYCURSOR); +#line 7221 "Zend/zend_language_scanner.c" +yy797: + YYDEBUG(797, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy795; + if (yych == 'O') goto yy798; if (yych != 'o') 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 1140 "Zend/zend_language_scanner.l" +#line 1144 "Zend/zend_language_scanner.l" { return T_ECHO; } -#line 7206 "Zend/zend_language_scanner.c" +#line 7239 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_LOOKING_FOR_PROPERTY: @@ -7241,41 +7274,41 @@ int lex_scan(zval *zendlval TSRMLS_DC) 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, }; - YYDEBUG(797, *YYCURSOR); + YYDEBUG(800, *YYCURSOR); YYFILL(2); yych = *YYCURSOR; if (yych <= '-') { if (yych <= '\r') { - if (yych <= 0x08) goto yy805; - if (yych <= '\n') goto yy799; - if (yych <= '\f') goto yy805; + if (yych <= 0x08) goto yy808; + if (yych <= '\n') goto yy802; + if (yych <= '\f') goto yy808; } else { - if (yych == ' ') goto yy799; - if (yych <= ',') goto yy805; - goto yy801; + if (yych == ' ') goto yy802; + if (yych <= ',') goto yy808; + goto yy804; } } else { if (yych <= '_') { - if (yych <= '@') goto yy805; - if (yych <= 'Z') goto yy803; - if (yych <= '^') goto yy805; - goto yy803; + if (yych <= '@') goto yy808; + if (yych <= 'Z') goto yy806; + if (yych <= '^') goto yy808; + goto yy806; } else { - if (yych <= '`') goto yy805; - if (yych <= 'z') goto yy803; - if (yych <= '~') goto yy805; - goto yy803; + if (yych <= '`') goto yy808; + if (yych <= 'z') goto yy806; + if (yych <= '~') goto yy808; + goto yy806; } } -yy799: - YYDEBUG(799, *YYCURSOR); +yy802: + YYDEBUG(802, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy811; -yy800: - YYDEBUG(800, *YYCURSOR); + goto yy814; +yy803: + YYDEBUG(803, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1173 "Zend/zend_language_scanner.l" +#line 1177 "Zend/zend_language_scanner.l" { zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; @@ -7283,73 +7316,73 @@ int lex_scan(zval *zendlval TSRMLS_DC) HANDLE_NEWLINES(yytext, yyleng); return T_WHITESPACE; } -#line 7287 "Zend/zend_language_scanner.c" -yy801: - YYDEBUG(801, *YYCURSOR); +#line 7320 "Zend/zend_language_scanner.c" +yy804: + YYDEBUG(804, *YYCURSOR); ++YYCURSOR; - if ((yych = *YYCURSOR) == '>') goto yy808; -yy802: - YYDEBUG(802, *YYCURSOR); + if ((yych = *YYCURSOR) == '>') goto yy811; +yy805: + YYDEBUG(805, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1192 "Zend/zend_language_scanner.l" +#line 1196 "Zend/zend_language_scanner.l" { yyless(0); yy_pop_state(TSRMLS_C); goto restart; } -#line 7301 "Zend/zend_language_scanner.c" -yy803: - YYDEBUG(803, *YYCURSOR); +#line 7334 "Zend/zend_language_scanner.c" +yy806: + YYDEBUG(806, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy807; -yy804: - YYDEBUG(804, *YYCURSOR); + goto yy810; +yy807: + YYDEBUG(807, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1185 "Zend/zend_language_scanner.l" +#line 1189 "Zend/zend_language_scanner.l" { yy_pop_state(TSRMLS_C); zend_copy_value(zendlval, yytext, yyleng); zendlval->type = IS_STRING; return T_STRING; } -#line 7317 "Zend/zend_language_scanner.c" -yy805: - YYDEBUG(805, *YYCURSOR); +#line 7350 "Zend/zend_language_scanner.c" +yy808: + YYDEBUG(808, *YYCURSOR); yych = *++YYCURSOR; - goto yy802; -yy806: - YYDEBUG(806, *YYCURSOR); + goto yy805; +yy809: + YYDEBUG(809, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy807: - YYDEBUG(807, *YYCURSOR); +yy810: + YYDEBUG(810, *YYCURSOR); if (yybm[0+yych] & 64) { - goto yy806; + goto yy809; } - goto yy804; -yy808: - YYDEBUG(808, *YYCURSOR); + goto yy807; +yy811: + YYDEBUG(811, *YYCURSOR); ++YYCURSOR; - YYDEBUG(809, *YYCURSOR); + YYDEBUG(812, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1181 "Zend/zend_language_scanner.l" +#line 1185 "Zend/zend_language_scanner.l" { return T_OBJECT_OPERATOR; } -#line 7342 "Zend/zend_language_scanner.c" -yy810: - YYDEBUG(810, *YYCURSOR); +#line 7375 "Zend/zend_language_scanner.c" +yy813: + YYDEBUG(813, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy811: - YYDEBUG(811, *YYCURSOR); +yy814: + YYDEBUG(814, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy810; + goto yy813; } - goto yy800; + goto yy803; } /* *********************************** */ yyc_ST_LOOKING_FOR_VARNAME: @@ -7388,74 +7421,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(812, *YYCURSOR); + YYDEBUG(815, *YYCURSOR); YYFILL(2); yych = *YYCURSOR; if (yych <= '_') { - if (yych <= '@') goto yy816; - if (yych <= 'Z') goto yy814; - if (yych <= '^') goto yy816; + if (yych <= '@') goto yy819; + if (yych <= 'Z') goto yy817; + if (yych <= '^') goto yy819; } else { - if (yych <= '`') goto yy816; - if (yych <= 'z') goto yy814; - if (yych <= '~') goto yy816; + if (yych <= '`') goto yy819; + if (yych <= 'z') goto yy817; + if (yych <= '~') goto yy819; } -yy814: - YYDEBUG(814, *YYCURSOR); +yy817: + YYDEBUG(817, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '_') { if (yych <= '@') { - if (yych <= '/') goto yy815; - if (yych <= '9') goto yy818; + if (yych <= '/') goto yy818; + if (yych <= '9') goto yy821; } else { - if (yych <= '[') goto yy818; - if (yych >= '_') goto yy818; + if (yych <= '[') goto yy821; + if (yych >= '_') goto yy821; } } else { if (yych <= '|') { - if (yych <= '`') goto yy815; - if (yych <= 'z') goto yy818; + if (yych <= '`') goto yy818; + if (yych <= 'z') goto yy821; } else { - if (yych != '~') goto yy818; + if (yych != '~') goto yy821; } } -yy815: - YYDEBUG(815, *YYCURSOR); +yy818: + YYDEBUG(818, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1478 "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 7434 "Zend/zend_language_scanner.c" -yy816: - YYDEBUG(816, *YYCURSOR); +#line 7467 "Zend/zend_language_scanner.c" +yy819: + YYDEBUG(819, *YYCURSOR); yych = *++YYCURSOR; - goto yy815; -yy817: - YYDEBUG(817, *YYCURSOR); + goto yy818; +yy820: + YYDEBUG(820, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy818: - YYDEBUG(818, *YYCURSOR); +yy821: + YYDEBUG(821, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy817; + goto yy820; } - if (yych == '[') goto yy820; - if (yych == '}') goto yy820; - YYDEBUG(819, *YYCURSOR); + if (yych == '[') goto yy823; + if (yych == '}') goto yy823; + YYDEBUG(822, *YYCURSOR); YYCURSOR = YYMARKER; - goto yy815; -yy820: - YYDEBUG(820, *YYCURSOR); + goto yy818; +yy823: + YYDEBUG(823, *YYCURSOR); ++YYCURSOR; - YYDEBUG(821, *YYCURSOR); + YYDEBUG(824, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1468 "Zend/zend_language_scanner.l" +#line 1472 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); zend_copy_value(zendlval, yytext, yyleng); @@ -7464,18 +7497,18 @@ int lex_scan(zval *zendlval TSRMLS_DC) yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); return T_STRING_VARNAME; } -#line 7468 "Zend/zend_language_scanner.c" +#line 7501 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_NOWDOC: - YYDEBUG(822, *YYCURSOR); + YYDEBUG(825, *YYCURSOR); YYFILL(1); yych = *YYCURSOR; - YYDEBUG(824, *YYCURSOR); + YYDEBUG(827, *YYCURSOR); ++YYCURSOR; - YYDEBUG(825, *YYCURSOR); + YYDEBUG(828, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2360 "Zend/zend_language_scanner.l" +#line 2364 "Zend/zend_language_scanner.l" { int newline = 0; @@ -7530,7 +7563,7 @@ int lex_scan(zval *zendlval TSRMLS_DC) HANDLE_NEWLINES(yytext, yyleng - newline); return T_ENCAPSED_AND_WHITESPACE; } -#line 7534 "Zend/zend_language_scanner.c" +#line 7567 "Zend/zend_language_scanner.c" /* *********************************** */ yyc_ST_VAR_OFFSET: { @@ -7568,76 +7601,76 @@ int lex_scan(zval *zendlval TSRMLS_DC) 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, }; - YYDEBUG(826, *YYCURSOR); + YYDEBUG(829, *YYCURSOR); YYFILL(3); yych = *YYCURSOR; if (yych <= '/') { if (yych <= ' ') { if (yych <= '\f') { - if (yych <= 0x08) goto yy840; - if (yych <= '\n') goto yy836; - goto yy840; + if (yych <= 0x08) goto yy843; + if (yych <= '\n') goto yy839; + goto yy843; } else { - if (yych <= '\r') goto yy836; - if (yych <= 0x1F) goto yy840; - goto yy836; + if (yych <= '\r') goto yy839; + if (yych <= 0x1F) goto yy843; + goto yy839; } } else { if (yych <= '$') { - if (yych <= '"') goto yy835; - if (yych <= '#') goto yy836; - goto yy831; + if (yych <= '"') goto yy838; + if (yych <= '#') goto yy839; + goto yy834; } else { - if (yych == '\'') goto yy836; - goto yy835; + if (yych == '\'') goto yy839; + goto yy838; } } } else { if (yych <= '\\') { if (yych <= '@') { - if (yych <= '0') goto yy828; - if (yych <= '9') goto yy830; - goto yy835; + if (yych <= '0') goto yy831; + if (yych <= '9') goto yy833; + goto yy838; } else { - if (yych <= 'Z') goto yy838; - if (yych <= '[') goto yy835; - goto yy836; + if (yych <= 'Z') goto yy841; + if (yych <= '[') goto yy838; + goto yy839; } } else { if (yych <= '_') { - if (yych <= ']') goto yy833; - if (yych <= '^') goto yy835; - goto yy838; + if (yych <= ']') goto yy836; + if (yych <= '^') goto yy838; + goto yy841; } else { - if (yych <= '`') goto yy835; - if (yych <= 'z') goto yy838; - if (yych <= '~') goto yy835; - goto yy838; + if (yych <= '`') goto yy838; + if (yych <= 'z') goto yy841; + if (yych <= '~') goto yy838; + goto yy841; } } } -yy828: - YYDEBUG(828, *YYCURSOR); +yy831: + YYDEBUG(831, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); if (yych <= 'W') { if (yych <= '9') { - if (yych >= '0') goto yy852; + if (yych >= '0') goto yy855; } else { - if (yych == 'B') goto yy849; + if (yych == 'B') goto yy852; } } else { if (yych <= 'b') { - if (yych <= 'X') goto yy851; - if (yych >= 'b') goto yy849; + if (yych <= 'X') goto yy854; + if (yych >= 'b') goto yy852; } else { - if (yych == 'x') goto yy851; + if (yych == 'x') goto yy854; } } -yy829: - YYDEBUG(829, *YYCURSOR); +yy832: + YYDEBUG(832, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1556 "Zend/zend_language_scanner.l" +#line 1560 "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); @@ -7649,81 +7682,81 @@ int lex_scan(zval *zendlval TSRMLS_DC) } return T_NUM_STRING; } -#line 7653 "Zend/zend_language_scanner.c" -yy830: - YYDEBUG(830, *YYCURSOR); +#line 7686 "Zend/zend_language_scanner.c" +yy833: + YYDEBUG(833, *YYCURSOR); yych = *++YYCURSOR; - goto yy848; -yy831: - YYDEBUG(831, *YYCURSOR); + goto yy851; +yy834: + YYDEBUG(834, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) <= '_') { - if (yych <= '@') goto yy832; - if (yych <= 'Z') goto yy844; - if (yych >= '_') goto yy844; + if (yych <= '@') goto yy835; + if (yych <= 'Z') goto yy847; + if (yych >= '_') goto yy847; } else { - if (yych <= '`') goto yy832; - if (yych <= 'z') goto yy844; - if (yych >= 0x7F) goto yy844; + if (yych <= '`') goto yy835; + if (yych <= 'z') goto yy847; + if (yych >= 0x7F) goto yy847; } -yy832: - YYDEBUG(832, *YYCURSOR); +yy835: + YYDEBUG(835, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1888 "Zend/zend_language_scanner.l" +#line 1892 "Zend/zend_language_scanner.l" { /* Only '[' can be valid, but returning other tokens will allow a more explicit parse error */ return yytext[0]; } -#line 7678 "Zend/zend_language_scanner.c" -yy833: - YYDEBUG(833, *YYCURSOR); +#line 7711 "Zend/zend_language_scanner.c" +yy836: + YYDEBUG(836, *YYCURSOR); ++YYCURSOR; - YYDEBUG(834, *YYCURSOR); + YYDEBUG(837, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1883 "Zend/zend_language_scanner.l" +#line 1887 "Zend/zend_language_scanner.l" { yy_pop_state(TSRMLS_C); return ']'; } -#line 7689 "Zend/zend_language_scanner.c" -yy835: - YYDEBUG(835, *YYCURSOR); +#line 7722 "Zend/zend_language_scanner.c" +yy838: + YYDEBUG(838, *YYCURSOR); yych = *++YYCURSOR; - goto yy832; -yy836: - YYDEBUG(836, *YYCURSOR); + goto yy835; +yy839: + YYDEBUG(839, *YYCURSOR); ++YYCURSOR; - YYDEBUG(837, *YYCURSOR); + YYDEBUG(840, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1893 "Zend/zend_language_scanner.l" +#line 1897 "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 7706 "Zend/zend_language_scanner.c" -yy838: - YYDEBUG(838, *YYCURSOR); +#line 7739 "Zend/zend_language_scanner.c" +yy841: + YYDEBUG(841, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy843; -yy839: - YYDEBUG(839, *YYCURSOR); + goto yy846; +yy842: + YYDEBUG(842, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1900 "Zend/zend_language_scanner.l" +#line 1904 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, yytext, yyleng); zendlval->type = IS_STRING; return T_STRING; } -#line 7721 "Zend/zend_language_scanner.c" -yy840: - YYDEBUG(840, *YYCURSOR); +#line 7754 "Zend/zend_language_scanner.c" +yy843: + YYDEBUG(843, *YYCURSOR); ++YYCURSOR; - YYDEBUG(841, *YYCURSOR); + YYDEBUG(844, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2416 "Zend/zend_language_scanner.l" +#line 2420 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -7732,118 +7765,118 @@ 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 7736 "Zend/zend_language_scanner.c" -yy842: - YYDEBUG(842, *YYCURSOR); +#line 7769 "Zend/zend_language_scanner.c" +yy845: + YYDEBUG(845, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy843: - YYDEBUG(843, *YYCURSOR); +yy846: + YYDEBUG(846, *YYCURSOR); if (yybm[0+yych] & 16) { - goto yy842; + goto yy845; } - goto yy839; -yy844: - YYDEBUG(844, *YYCURSOR); + goto yy842; +yy847: + YYDEBUG(847, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(845, *YYCURSOR); + YYDEBUG(848, *YYCURSOR); if (yych <= '^') { if (yych <= '9') { - if (yych >= '0') goto yy844; + if (yych >= '0') goto yy847; } else { - if (yych <= '@') goto yy846; - if (yych <= 'Z') goto yy844; + if (yych <= '@') goto yy849; + if (yych <= 'Z') goto yy847; } } else { if (yych <= '`') { - if (yych <= '_') goto yy844; + if (yych <= '_') goto yy847; } else { - if (yych <= 'z') goto yy844; - if (yych >= 0x7F) goto yy844; + if (yych <= 'z') goto yy847; + if (yych >= 0x7F) goto yy847; } } -yy846: - YYDEBUG(846, *YYCURSOR); +yy849: + YYDEBUG(849, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1877 "Zend/zend_language_scanner.l" +#line 1881 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; return T_VARIABLE; } -#line 7778 "Zend/zend_language_scanner.c" -yy847: - YYDEBUG(847, *YYCURSOR); +#line 7811 "Zend/zend_language_scanner.c" +yy850: + YYDEBUG(850, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy848: - YYDEBUG(848, *YYCURSOR); +yy851: + YYDEBUG(851, *YYCURSOR); if (yybm[0+yych] & 32) { - goto yy847; + goto yy850; } - goto yy829; -yy849: - YYDEBUG(849, *YYCURSOR); + goto yy832; +yy852: + YYDEBUG(852, *YYCURSOR); yych = *++YYCURSOR; if (yybm[0+yych] & 128) { - goto yy857; + goto yy860; } -yy850: - YYDEBUG(850, *YYCURSOR); +yy853: + YYDEBUG(853, *YYCURSOR); YYCURSOR = YYMARKER; - goto yy829; -yy851: - YYDEBUG(851, *YYCURSOR); + goto yy832; +yy854: + YYDEBUG(854, *YYCURSOR); yych = *++YYCURSOR; if (yybm[0+yych] & 64) { - goto yy855; + goto yy858; } - goto yy850; -yy852: - YYDEBUG(852, *YYCURSOR); + goto yy853; +yy855: + YYDEBUG(855, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(853, *YYCURSOR); - if (yych <= '/') goto yy854; - if (yych <= '9') goto yy852; -yy854: - YYDEBUG(854, *YYCURSOR); + YYDEBUG(856, *YYCURSOR); + if (yych <= '/') goto yy857; + if (yych <= '9') goto yy855; +yy857: + YYDEBUG(857, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1568 "Zend/zend_language_scanner.l" +#line 1572 "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; return T_NUM_STRING; } -#line 7825 "Zend/zend_language_scanner.c" -yy855: - YYDEBUG(855, *YYCURSOR); +#line 7858 "Zend/zend_language_scanner.c" +yy858: + YYDEBUG(858, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(856, *YYCURSOR); + YYDEBUG(859, *YYCURSOR); if (yybm[0+yych] & 64) { - goto yy855; + goto yy858; } - goto yy854; -yy857: - YYDEBUG(857, *YYCURSOR); + goto yy857; +yy860: + YYDEBUG(860, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(858, *YYCURSOR); + YYDEBUG(861, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy857; + goto yy860; } - goto yy854; + goto yy857; } } -#line 2425 "Zend/zend_language_scanner.l" +#line 2429 "Zend/zend_language_scanner.l" } diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 1b9d44c587192..30a3d8ee0ae31 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -1045,6 +1045,10 @@ NEWLINE ("\r"|"\n"|"\r\n") return T_CATCH; } +"finally" { + return T_FINALLY; +} + "throw" { return T_THROW; } diff --git a/Zend/zend_language_scanner_defs.h b/Zend/zend_language_scanner_defs.h index 869d54349d996..2281cc728921e 100644 --- a/Zend/zend_language_scanner_defs.h +++ b/Zend/zend_language_scanner_defs.h @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Sat Jun 16 12:57:03 2012 */ +/* Generated by re2c 0.13.5 on Mon Aug 13 16:40:42 2012 */ #line 3 "Zend/zend_language_scanner_defs.h" enum YYCONDTYPE { diff --git a/Zend/zend_multibyte.c b/Zend/zend_multibyte.c index 9149fdcf08399..379f50b01fd2f 100644 --- a/Zend/zend_multibyte.c +++ b/Zend/zend_multibyte.c @@ -168,7 +168,7 @@ ZEND_API const zend_encoding *zend_multibyte_get_script_encoding(TSRMLS_D) ZEND_API int zend_multibyte_set_script_encoding(const zend_encoding **encoding_list, size_t encoding_list_size TSRMLS_DC) { if (CG(script_encoding_list)) { - efree(CG(script_encoding_list)); + free(CG(script_encoding_list)); } CG(script_encoding_list) = encoding_list; CG(script_encoding_list_size) = encoding_list_size; diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index ba6221ef70665..60095f7062b1c 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -66,11 +66,11 @@ ZEND_API void rebuild_object_properties(zend_object *zobj) /* {{{ */ zend_hash_get_current_data_ex(&ce->properties_info, (void**)&prop_info, &pos) == SUCCESS; zend_hash_move_forward_ex(&ce->properties_info, &pos)) { if (/*prop_info->ce == ce &&*/ - (prop_info->flags & ZEND_ACC_STATIC) == 0 && + (prop_info->flags & ZEND_ACC_STATIC) == 0 && prop_info->offset >= 0 && zobj->properties_table[prop_info->offset]) { zend_hash_quick_add(zobj->properties, prop_info->name, prop_info->name_length+1, prop_info->h, (void**)&zobj->properties_table[prop_info->offset], sizeof(zval*), (void**)&zobj->properties_table[prop_info->offset]); - } + } } while (ce->parent && ce->parent->default_properties_count) { ce = ce->parent; @@ -78,12 +78,12 @@ ZEND_API void rebuild_object_properties(zend_object *zobj) /* {{{ */ zend_hash_get_current_data_ex(&ce->properties_info, (void**)&prop_info, &pos) == SUCCESS; zend_hash_move_forward_ex(&ce->properties_info, &pos)) { if (prop_info->ce == ce && - (prop_info->flags & ZEND_ACC_STATIC) == 0 && - (prop_info->flags & ZEND_ACC_PRIVATE) != 0 && + (prop_info->flags & ZEND_ACC_STATIC) == 0 && + (prop_info->flags & ZEND_ACC_PRIVATE) != 0 && prop_info->offset >= 0 && zobj->properties_table[prop_info->offset]) { zend_hash_quick_add(zobj->properties, prop_info->name, prop_info->name_length+1, prop_info->h, (void**)&zobj->properties_table[prop_info->offset], sizeof(zval*), (void**)&zobj->properties_table[prop_info->offset]); - } + } } } } @@ -783,7 +783,7 @@ static void zend_std_unset_property(zval *object, zval *member, const zend_liter property_info = zend_get_property_info_quick(zobj->ce, member, (zobj->ce->__unset != NULL), key TSRMLS_CC); if (EXPECTED(property_info != NULL) && - EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) && + EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) && !zobj->properties && property_info->offset >= 0 && EXPECTED(zobj->properties_table[property_info->offset] != NULL)) { @@ -815,8 +815,8 @@ static void zend_std_unset_property(zval *object, zval *member, const zend_liter } } } - } else if (EXPECTED(property_info != NULL) && - EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) && + } else if (EXPECTED(property_info != NULL) && + EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) && property_info->offset >= 0) { zobj->properties_table[property_info->offset] = NULL; } @@ -960,12 +960,6 @@ ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope) } /* }}} */ -static inline zend_class_entry * zend_get_function_root_class(zend_function *fbc) /* {{{ */ -{ - return fbc->common.prototype ? fbc->common.prototype->common.scope : fbc->common.scope; -} -/* }}} */ - static inline union _zend_function *zend_get_user_call_function(zend_class_entry *ce, const char *method_name, int method_len) /* {{{ */ { zend_internal_function *call_user_call = emalloc(sizeof(zend_internal_function)); @@ -1143,7 +1137,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, const c zend_str_tolower_copy(lc_function_name, function_name_strval, function_name_strlen); hash_value = zend_hash_func(lc_function_name, function_name_strlen+1); } - + if (function_name_strlen == ce->name_length && ce->constructor) { lc_class_name = zend_str_tolower_dup(ce->name, ce->name_length); /* Only change the method to the constructor if the constructor isn't called __construct @@ -1178,7 +1172,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, const c if (UNEXPECTED(!(fbc->common.fn_flags & ZEND_ACC_STATIC))) { zend_error_noreturn(E_ERROR, "Cannot call non static method %s::%s() without object", ZEND_FN_SCOPE_NAME(fbc), fbc->common.function_name); } -#endif +#endif if (fbc->op_array.fn_flags & ZEND_ACC_PUBLIC) { /* No further checks necessary, most common case */ } else if (fbc->op_array.fn_flags & ZEND_ACC_PRIVATE) { @@ -1220,7 +1214,7 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *p { zend_property_info *property_info; ulong hash_value; - + if (UNEXPECTED(!key) || (property_info = CACHED_POLYMORPHIC_PTR(key->cache_slot, ce)) == NULL) { if (EXPECTED(key != NULL)) { diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h index 32c0a674b318c..d0d7a7b847a00 100644 --- a/Zend/zend_object_handlers.h +++ b/Zend/zend_object_handlers.h @@ -146,6 +146,9 @@ struct _zend_object_handlers { extern ZEND_API zend_object_handlers std_object_handlers; +#define zend_get_function_root_class(fbc) \ + ((fbc)->common.prototype ? (fbc)->common.prototype->common.scope : (fbc)->common.scope) + BEGIN_EXTERN_C() ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, const char *function_name_strval, int function_name_strlen, const struct _zend_literal *key TSRMLS_DC); ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *property_name, int property_name_len, zend_bool silent, const struct _zend_literal *key TSRMLS_DC); diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c index 7fadcf740b4e9..f7470fa578d11 100644 --- a/Zend/zend_objects.c +++ b/Zend/zend_objects.c @@ -28,7 +28,7 @@ ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce TSRMLS_DC) { - object->ce = ce; + object->ce = ce; object->properties = NULL; object->properties_table = NULL; object->guards = NULL; @@ -38,7 +38,7 @@ ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC) { if (object->guards) { zend_hash_destroy(object->guards); - FREE_HASHTABLE(object->guards); + FREE_HASHTABLE(object->guards); } if (object->properties) { zend_hash_destroy(object->properties); @@ -74,23 +74,23 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl if (object->ce != EG(scope)) { zend_class_entry *ce = object->ce; - zend_error(EG(in_execution) ? E_ERROR : E_WARNING, - "Call to private %s::__destruct() from context '%s'%s", - ce->name, - EG(scope) ? EG(scope)->name : "", + zend_error(EG(in_execution) ? E_ERROR : E_WARNING, + "Call to private %s::__destruct() from context '%s'%s", + ce->name, + EG(scope) ? EG(scope)->name : "", EG(in_execution) ? "" : " during shutdown ignored"); return; } } else { /* Ensure that if we're calling a protected function, we're allowed to do so. */ - if (!zend_check_protected(destructor->common.scope, EG(scope))) { + if (!zend_check_protected(zend_get_function_root_class(destructor), EG(scope))) { zend_class_entry *ce = object->ce; - zend_error(EG(in_execution) ? E_ERROR : E_WARNING, - "Call to protected %s::__destruct() from context '%s'%s", - ce->name, - EG(scope) ? EG(scope)->name : "", + zend_error(EG(in_execution) ? E_ERROR : E_WARNING, + "Call to protected %s::__destruct() from context '%s'%s", + ce->name, + EG(scope) ? EG(scope)->name : "", EG(in_execution) ? "" : " during shutdown ignored"); return; } @@ -139,7 +139,7 @@ ZEND_API void zend_objects_free_object_storage(zend_object *object TSRMLS_DC) } ZEND_API zend_object_value zend_objects_new(zend_object **object, zend_class_entry *class_type TSRMLS_DC) -{ +{ zend_object_value retval; *object = emalloc(sizeof(zend_object)); @@ -222,7 +222,7 @@ ZEND_API zend_object_value zend_objects_clone_obj(zval *zobject TSRMLS_DC) zend_object *new_object; zend_object_handle handle = Z_OBJ_HANDLE_P(zobject); - /* assume that create isn't overwritten, so when clone depends on the + /* assume that create isn't overwritten, so when clone depends on the * overwritten one then it must itself be overwritten */ old_object = zend_objects_get_address(zobject TSRMLS_CC); new_obj_val = zend_objects_new(&new_object, old_object->ce TSRMLS_CC); diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 0042c37299778..a8c07e9493824 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -215,6 +215,12 @@ ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC) void _destroy_zend_class_traits_info(zend_class_entry *ce) { if (ce->num_traits > 0 && ce->traits) { + size_t i; + for (i = 0; i < ce->num_traits; i++) { + if (ce->traits[i]) { + destroy_zend_class(&ce->traits[i]); + } + } efree(ce->traits); } diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index a849cccf13f11..93dca94f2b249 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -42,6 +42,43 @@ static _locale_t current_locale = NULL; #define TYPE_PAIR(t1,t2) (((t1) << 4) | (t2)) +static const unsigned char tolower_map[256] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x5b,0x5c,0x5d,0x5e,0x5f, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f, +0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf, +0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf, +0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf, +0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf, +0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef, +0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff +}; + +#define zend_tolower_ascii(c) (tolower_map[(unsigned char)(c)]) + +/** + * Functions using locale lowercase: + zend_binary_strncasecmp_l + zend_binary_strcasecmp_l + zend_binary_zval_strcasecmp + zend_binary_zval_strncasecmp + string_compare_function_ex + string_case_compare_function + * Functions using ascii lowercase: + zend_str_tolower_copy + zend_str_tolower_dup + zend_str_tolower + zend_binary_strcasecmp + zend_binary_strncasecmp + */ + ZEND_API int zend_atoi(const char *str, int str_len) /* {{{ */ { int retval; @@ -1605,7 +1642,8 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) && (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)))); break; case IS_ARRAY: - Z_LVAL_P(result) = zend_hash_compare(Z_ARRVAL_P(op1), Z_ARRVAL_P(op2), (compare_func_t) hash_zval_identical_function, 1 TSRMLS_CC)==0; + Z_LVAL_P(result) = (Z_ARRVAL_P(op1) == Z_ARRVAL_P(op2) || + zend_hash_compare(Z_ARRVAL_P(op1), Z_ARRVAL_P(op2), (compare_func_t) hash_zval_identical_function, 1 TSRMLS_CC)==0); break; case IS_OBJECT: if (Z_OBJ_HT_P(op1) == Z_OBJ_HT_P(op2)) { @@ -1907,7 +1945,7 @@ ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, unsigned in register unsigned char *end = str + length; while (str < end) { - *result++ = zend_tolower((int)*str++); + *result++ = zend_tolower_ascii(*str++); } *result = '\0'; @@ -1927,7 +1965,7 @@ ZEND_API void zend_str_tolower(char *str, unsigned int length) /* {{{ */ register unsigned char *end = p + length; while (p < end) { - *p = zend_tolower((int)*p); + *p = zend_tolower_ascii(*p); p++; } } @@ -1974,6 +2012,49 @@ ZEND_API int zend_binary_strcasecmp(const char *s1, uint len1, const char *s2, u return 0; } + len = MIN(len1, len2); + while (len--) { + c1 = zend_tolower_ascii(*(unsigned char *)s1++); + c2 = zend_tolower_ascii(*(unsigned char *)s2++); + if (c1 != c2) { + return c1 - c2; + } + } + + return len1 - len2; +} +/* }}} */ + +ZEND_API int zend_binary_strncasecmp(const char *s1, uint len1, const char *s2, uint len2, uint length) /* {{{ */ +{ + int len; + int c1, c2; + + if (s1 == s2) { + return 0; + } + len = MIN(length, MIN(len1, len2)); + while (len--) { + c1 = zend_tolower_ascii(*(unsigned char *)s1++); + c2 = zend_tolower_ascii(*(unsigned char *)s2++); + if (c1 != c2) { + return c1 - c2; + } + } + + return MIN(length, len1) - MIN(length, len2); +} +/* }}} */ + +ZEND_API int zend_binary_strcasecmp_l(const char *s1, uint len1, const char *s2, uint len2) /* {{{ */ +{ + int len; + int c1, c2; + + if (s1 == s2) { + return 0; + } + len = MIN(len1, len2); while (len--) { c1 = zend_tolower((int)*(unsigned char *)s1++); @@ -1987,7 +2068,7 @@ ZEND_API int zend_binary_strcasecmp(const char *s1, uint len1, const char *s2, u } /* }}} */ -ZEND_API int zend_binary_strncasecmp(const char *s1, uint len1, const char *s2, uint len2, uint length) /* {{{ */ +ZEND_API int zend_binary_strncasecmp_l(const char *s1, uint len1, const char *s2, uint len2, uint length) /* {{{ */ { int len; int c1, c2; @@ -2022,28 +2103,49 @@ ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3) /* {{{ */ ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2) /* {{{ */ { - return zend_binary_strcasecmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2)); + return zend_binary_strcasecmp_l(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2)); } /* }}} */ ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3) /* {{{ */ { - return zend_binary_strncasecmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2), Z_LVAL_P(s3)); + return zend_binary_strncasecmp_l(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2), Z_LVAL_P(s3)); } /* }}} */ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) /* {{{ */ { int ret1, ret2; + int oflow1, oflow2; long lval1, lval2; double dval1, dval2; - if ((ret1=is_numeric_string(Z_STRVAL_P(s1), Z_STRLEN_P(s1), &lval1, &dval1, 0)) && - (ret2=is_numeric_string(Z_STRVAL_P(s2), Z_STRLEN_P(s2), &lval2, &dval2, 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))) { +#if ULONG_MAX == 0xFFFFFFFF + if (oflow1 != 0 && oflow1 == oflow2 && dval1 - dval2 == 0. && + ((oflow1 == 1 && dval1 > 9007199254740991. /*0x1FFFFFFFFFFFFF*/) + || (oflow1 == -1 && dval1 < -9007199254740991.))) { +#else + if (oflow1 != 0 && oflow1 == oflow2 && dval1 - dval2 == 0.) { +#endif + /* both values are integers overflown to the same side, and the + * double comparison may have resulted in crucial accuracy lost */ + goto string_cmp; + } if ((ret1==IS_DOUBLE) || (ret2==IS_DOUBLE)) { if (ret1!=IS_DOUBLE) { + if (oflow2) { + /* 2nd operand is integer > LONG_MAX (oflow2==1) or < LONG_MIN (-1) */ + ZVAL_LONG(result, -1 * oflow2); + return; + } dval1 = (double) lval1; } else if (ret2!=IS_DOUBLE) { + if (oflow1) { + ZVAL_LONG(result, oflow1); + return; + } dval2 = (double) lval2; } else if (dval1 == dval2 && !zend_finite(dval1)) { /* Both values overflowed and have the same sign, @@ -2076,13 +2178,13 @@ static int hash_zval_compare_function(const zval **z1, const zval **z2 TSRMLS_DC ZEND_API int zend_compare_symbol_tables_i(HashTable *ht1, HashTable *ht2 TSRMLS_DC) /* {{{ */ { - return zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC); + return ht1 == ht2 ? 0 : zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC); } /* }}} */ ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC) /* {{{ */ { - ZVAL_LONG(result, zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC)); + ZVAL_LONG(result, ht1 == ht2 ? 0 : zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC)); } /* }}} */ diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index ebf959b25a404..d28140e9e5bb9 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -100,9 +100,12 @@ static zend_always_inline long zend_dval_to_lval(double d) * if the number was out of long range or contained a decimal point/exponent. * The number's value is returned into the respective pointer, *lval or *dval, * if that pointer is not NULL. + * + * This variant also gives information if a string that represents an integer + * could not be represented as such due to overflow. It writes 1 to oflow_info + * if the integer is larger than LONG_MAX and -1 if it's smaller than LONG_MIN. */ - -static inline zend_uchar is_numeric_string(const char *str, int length, long *lval, double *dval, int allow_errors) +static inline zend_uchar is_numeric_string_ex(const char *str, int length, long *lval, double *dval, int allow_errors, int *oflow_info) { const char *ptr; int base = 10, digits = 0, dp_or_e = 0; @@ -113,6 +116,10 @@ static inline zend_uchar is_numeric_string(const char *str, int length, long *lv return 0; } + if (oflow_info != NULL) { + *oflow_info = 0; + } + /* Skip any whitespace * This is much faster than the isspace() function */ while (*str == ' ' || *str == '\t' || *str == '\n' || *str == '\r' || *str == '\v' || *str == '\f') { @@ -165,6 +172,9 @@ static inline zend_uchar is_numeric_string(const char *str, int length, long *lv if (base == 10) { if (digits >= MAX_LENGTH_OF_LONG) { + if (oflow_info != NULL) { + *oflow_info = *str == '-' ? -1 : 1; + } dp_or_e = -1; goto process_double; } @@ -172,6 +182,9 @@ static inline zend_uchar is_numeric_string(const char *str, int length, long *lv if (dval) { local_dval = zend_hex_strtod(str, &ptr); } + if (oflow_info != NULL) { + *oflow_info = 1; + } type = IS_DOUBLE; } } else if (*ptr == '.' && ZEND_IS_DIGIT(ptr[1])) { @@ -207,6 +220,9 @@ static inline zend_uchar is_numeric_string(const char *str, int length, long *lv if (dval) { *dval = zend_strtod(str, NULL); } + if (oflow_info != NULL) { + *oflow_info = *str == '-' ? -1 : 1; + } return IS_DOUBLE; } @@ -226,6 +242,10 @@ static inline zend_uchar is_numeric_string(const char *str, int length, long *lv } } +static inline zend_uchar is_numeric_string(const char *str, int length, long *lval, double *dval, int allow_errors) { + return is_numeric_string_ex(str, length, lval, dval, allow_errors, NULL); +} + static inline char * zend_memnstr(char *haystack, char *needle, int needle_len, char *end) { diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c index 27df9537afd1f..30cc3a5ba4664 100644 --- a/Zend/zend_stream.c +++ b/Zend/zend_stream.c @@ -79,7 +79,7 @@ static size_t zend_stream_stdio_fsizer(void *handle TSRMLS_DC) /* {{{ */ static void zend_stream_unmap(zend_stream *stream TSRMLS_DC) { /* {{{ */ #if HAVE_MMAP if (stream->mmap.map) { - munmap(stream->mmap.map, stream->mmap.len); + munmap(stream->mmap.map, stream->mmap.len + ZEND_MMAP_AHEAD); } else #endif if (stream->mmap.buf) { diff --git a/Zend/zend_string.h b/Zend/zend_string.h index a61d2fb30d2a8..0a4738466d7a8 100644 --- a/Zend/zend_string.h +++ b/Zend/zend_string.h @@ -23,12 +23,14 @@ #include "zend.h" +BEGIN_EXTERN_C() ZEND_API extern const char *(*zend_new_interned_string)(const char *str, int len, int free_src TSRMLS_DC); ZEND_API extern void (*zend_interned_strings_snapshot)(TSRMLS_D); ZEND_API extern void (*zend_interned_strings_restore)(TSRMLS_D); void zend_interned_strings_init(TSRMLS_D); void zend_interned_strings_dtor(TSRMLS_D); +END_EXTERN_C() #ifndef ZTS diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 03768e8bd74fe..83ae5c5ba43f9 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2133,7 +2133,9 @@ ZEND_VM_HANDLER(109, ZEND_FETCH_CLASS, ANY, CONST|TMP|VAR|UNUSED|CV) USE_OPLINE SAVE_OPLINE(); - EG(exception) = NULL; + if (EG(exception)) { + zend_exception_save(TSRMLS_C); + } if (OP2_TYPE == IS_UNUSED) { EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); CHECK_EXCEPTION(); @@ -2451,7 +2453,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) if (UNEXPECTED(EX(fbc) == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), Z_STRVAL_PP(method)); } - + if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) { EX(object) = NULL; } else { @@ -2840,6 +2842,9 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) FREE_OP1(); } } else if (!IS_OP1_TMP_FREE()) { /* Not a temp var */ + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } if (OP1_TYPE == IS_CONST || (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; @@ -2861,12 +2866,59 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) } else { zval *ret; + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } + ALLOC_ZVAL(ret); INIT_PZVAL_COPY(ret, retval_ptr); *EG(return_value_ptr_ptr) = ret; } FREE_OP1_IF_VAR(); - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + + if (!(EG(active_op_array)->last_try_catch)) { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + } + } } ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) @@ -2879,6 +2931,10 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) SAVE_OPLINE(); do { + if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } + if (OP1_TYPE == IS_CONST || OP1_TYPE == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -2934,7 +2990,50 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) } while (0); FREE_OP1_IF_VAR(); - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + + if (!(EG(active_op_array)->last_try_catch)) { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + } + } } ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY) @@ -2981,7 +3080,7 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV) catch_ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { catch_ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC); - + CACHE_PTR(opline->op1.literal->cache_slot, catch_ce); } ce = Z_OBJCE_P(EG(exception)); @@ -3433,7 +3532,7 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMP|VAR|UNUSED|CV, ANY) } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { /* Ensure that if we're calling a protected function, we're allowed to do so. */ - if (UNEXPECTED(!zend_check_protected(clone->common.scope, EG(scope)))) { + if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) { zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : ""); } } @@ -3954,7 +4053,8 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV) switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - ZEND_VM_C_GOTO(num_index_dim); + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -4994,8 +5094,8 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) { zend_uint op_num = EG(opline_before_exception)-EG(active_op_array)->opcodes; int i; - zend_uint catch_op_num = 0; - int catched = 0; + zend_uint catch_op_num = 0, finally_op_num = 0; + int catched = 0, finally = 0; void **stack_frame; /* Figure out where the next stack frame (which maybe contains pushed @@ -5025,10 +5125,15 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { /* further blocks will not be relevant... */ break; - } else if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + } + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { catch_op_num = EX(op_array)->try_catch_array[i].catch_op; - catched = 1; + catched = i + 1; } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EX(op_array)->try_catch_array[i].finally_op; + finally = i + 1; + } } while (EX(fbc)) { @@ -5087,7 +5192,27 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) } EX(old_error_reporting) = NULL; - if (!catched) { + if (catched && finally) { + if (finally_op_num > catch_op_num) { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else { + zend_exception_save(TSRMLS_C); + EX(leaving) = finally; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catched) { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally) { + zend_exception_save(TSRMLS_C); + EX(leaving) = finally; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { /* For generators skip the leave handler and return directly */ if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { /* The generator object is stored in return_value_ptr_ptr */ @@ -5100,11 +5225,8 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) ZEND_VM_RETURN(); } - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); - } else { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + } } ZEND_VM_HANDLER(146, ZEND_VERIFY_ABSTRACT_CLASS, ANY, ANY) @@ -5222,7 +5344,53 @@ ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED) ZEND_VM_NEXT_OPCODE(); } -ZEND_VM_HANDLER(159, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSED) +ZEND_VM_HANDLER(159, ZEND_LEAVE, ANY, ANY) { +{ + USE_OPLINE; + SAVE_OPLINE(); + zend_uint i, op_num = opline - EG(active_op_array)->opcodes; + + zend_exception_restore(TSRMLS_C); + if (EX(leaving)) { + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i = 0; i < EX(leaving); i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(exception)) { + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + } + } else { + ZEND_VM_NEXT_OPCODE(); + } +} + +ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSED) { USE_OPLINE @@ -5375,7 +5543,7 @@ ZEND_VM_HANDLER(159, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE ZEND_VM_RETURN(); } -ZEND_VM_HANDLER(160, ZEND_DELEGATE_YIELD, CONST|TMP|VAR|CV, ANY) +ZEND_VM_HANDLER(161, ZEND_DELEGATE_YIELD, CONST|TMP|VAR|CV, ANY) { ZEND_VM_NEXT_OPCODE(); } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 5ded3e39c7e21..495b520ecb22f 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -385,6 +385,7 @@ zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array *op_arra EX(prev_execute_data) = EG(current_execute_data); EG(current_execute_data) = execute_data; EX(nested) = nested; + EX(leaving) = 0; if (!op_array->run_time_cache && op_array->last_cache_slot) { op_array->run_time_cache = ecalloc(op_array->last_cache_slot, sizeof(void*)); @@ -1057,8 +1058,8 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER { zend_uint op_num = EG(opline_before_exception)-EG(active_op_array)->opcodes; int i; - zend_uint catch_op_num = 0; - int catched = 0; + zend_uint catch_op_num = 0, finally_op_num = 0; + int catched = 0, finally = 0; void **stack_frame; /* Figure out where the next stack frame (which maybe contains pushed @@ -1088,10 +1089,15 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { /* further blocks will not be relevant... */ break; - } else if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + } + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { catch_op_num = EX(op_array)->try_catch_array[i].catch_op; - catched = 1; + catched = i + 1; } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EX(op_array)->try_catch_array[i].finally_op; + finally = i + 1; + } } while (EX(fbc)) { @@ -1150,7 +1156,27 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER } EX(old_error_reporting) = NULL; - if (!catched) { + if (catched && finally) { + if (finally_op_num > catch_op_num) { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else { + zend_exception_save(TSRMLS_C); + EX(leaving) = finally; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catched) { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally) { + zend_exception_save(TSRMLS_C); + EX(leaving) = finally; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { /* For generators skip the leave handler and return directly */ if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { /* The generator object is stored in return_value_ptr_ptr */ @@ -1163,11 +1189,8 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER ZEND_VM_RETURN(); } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } else { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } } static int ZEND_FASTCALL ZEND_VERIFY_ABSTRACT_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -1205,12 +1228,60 @@ static int ZEND_FASTCALL ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS } } +static int ZEND_FASTCALL ZEND_LEAVE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE; + SAVE_OPLINE(); + zend_uint i, op_num = opline - EG(active_op_array)->opcodes; + + zend_exception_restore(TSRMLS_C); + if (EX(leaving)) { + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i = 0; i < EX(leaving); i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(exception)) { + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } else { + ZEND_VM_NEXT_OPCODE(); + } +} + static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE SAVE_OPLINE(); - EG(exception) = NULL; + if (EG(exception)) { + zend_exception_save(TSRMLS_C); + } if (IS_CONST == IS_UNUSED) { EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); CHECK_EXCEPTION(); @@ -1511,7 +1582,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ USE_OPLINE SAVE_OPLINE(); - EG(exception) = NULL; + if (EG(exception)) { + zend_exception_save(TSRMLS_C); + } if (IS_TMP_VAR == IS_UNUSED) { EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); CHECK_EXCEPTION(); @@ -1675,7 +1748,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ USE_OPLINE SAVE_OPLINE(); - EG(exception) = NULL; + if (EG(exception)) { + zend_exception_save(TSRMLS_C); + } if (IS_VAR == IS_UNUSED) { EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); CHECK_EXCEPTION(); @@ -1839,7 +1914,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDL USE_OPLINE SAVE_OPLINE(); - EG(exception) = NULL; + if (EG(exception)) { + zend_exception_save(TSRMLS_C); + } if (IS_UNUSED == IS_UNUSED) { EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); CHECK_EXCEPTION(); @@ -1873,7 +1950,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_A USE_OPLINE SAVE_OPLINE(); - EG(exception) = NULL; + if (EG(exception)) { + zend_exception_save(TSRMLS_C); + } if (IS_CV == IS_UNUSED) { EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); CHECK_EXCEPTION(); @@ -2297,6 +2376,9 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG } } else if (!0) { /* Not a temp var */ + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } if (IS_CONST == IS_CONST || (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; @@ -2318,12 +2400,58 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG } else { zval *ret; + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } + ALLOC_ZVAL(ret); INIT_PZVAL_COPY(ret, retval_ptr); *EG(return_value_ptr_ptr) = ret; } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -2336,6 +2464,10 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND SAVE_OPLINE(); do { + if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -2390,7 +2522,49 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND } } while (0); - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_THROW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -2500,7 +2674,7 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { /* Ensure that if we're calling a protected function, we're allowed to do so. */ - if (UNEXPECTED(!zend_check_protected(clone->common.scope, EG(scope)))) { + if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) { zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : ""); } } @@ -7597,6 +7771,9 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_dtor(free_op1.var); } } else if (!1) { /* Not a temp var */ + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } if (IS_TMP_VAR == IS_CONST || (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; @@ -7618,12 +7795,58 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { zval *ret; + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } + ALLOC_ZVAL(ret); INIT_PZVAL_COPY(ret, retval_ptr); *EG(return_value_ptr_ptr) = ret; } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -7636,6 +7859,10 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE SAVE_OPLINE(); do { + if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -7690,7 +7917,49 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE } } while (0); - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -7801,7 +8070,7 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { /* Ensure that if we're calling a protected function, we're allowed to do so. */ - if (UNEXPECTED(!zend_check_protected(clone->common.scope, EG(scope)))) { + if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) { zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : ""); } } @@ -12802,6 +13071,9 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; } } else if (!0) { /* Not a temp var */ + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } if (IS_VAR == IS_CONST || (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; @@ -12823,12 +13095,59 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { zval *ret; + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } + ALLOC_ZVAL(ret); INIT_PZVAL_COPY(ret, retval_ptr); *EG(return_value_ptr_ptr) = ret; } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -12841,6 +13160,10 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE SAVE_OPLINE(); do { + if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -12896,7 +13219,50 @@ 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);}; - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -13116,7 +13482,7 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { /* Ensure that if we're calling a protected function, we're allowed to do so. */ - if (UNEXPECTED(!zend_check_protected(clone->common.scope, EG(scope)))) { + if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) { zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : ""); } } @@ -15769,7 +16135,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -17932,7 +18299,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLE switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -20305,7 +20673,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -23654,7 +24023,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -24115,7 +24485,7 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARG } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { /* Ensure that if we're calling a protected function, we're allowed to do so. */ - if (UNEXPECTED(!zend_check_protected(clone->common.scope, EG(scope)))) { + if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) { zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : ""); } } @@ -25144,7 +25514,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_H switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -26452,7 +26823,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HAN switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -27760,7 +28132,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HAN switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -29485,7 +29858,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAND switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -30323,6 +30697,9 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } else if (!0) { /* Not a temp var */ + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } if (IS_CV == IS_CONST || (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; @@ -30344,12 +30721,58 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { zval *ret; + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } + ALLOC_ZVAL(ret); INIT_PZVAL_COPY(ret, retval_ptr); *EG(return_value_ptr_ptr) = ret; } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -30362,6 +30785,10 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER SAVE_OPLINE(); do { + if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -30416,7 +30843,49 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER } } while (0); - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -30624,7 +31093,7 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { /* Ensure that if we're calling a protected function, we're allowed to do so. */ - if (UNEXPECTED(!zend_check_protected(clone->common.scope, EG(scope)))) { + if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) { zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : ""); } } @@ -32914,7 +33383,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -34946,7 +35416,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -37187,7 +37658,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -40263,7 +40735,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -44664,6 +45137,31 @@ void zend_init_opcodes_handlers(void) ZEND_JMP_SET_VAR_SPEC_CV_HANDLER, ZEND_JMP_SET_VAR_SPEC_CV_HANDLER, ZEND_JMP_SET_VAR_SPEC_CV_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, ZEND_YIELD_SPEC_CONST_CONST_HANDLER, ZEND_YIELD_SPEC_CONST_TMP_HANDLER, ZEND_YIELD_SPEC_CONST_VAR_HANDLER, diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl index 909ec8ad7a734..25b3d71534748 100644 --- a/Zend/zend_vm_execute.skl +++ b/Zend/zend_vm_execute.skl @@ -46,6 +46,7 @@ zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array *op_arra EX(prev_execute_data) = EG(current_execute_data); EG(current_execute_data) = execute_data; EX(nested) = nested; + EX(leaving) = 0; if (!op_array->run_time_cache && op_array->last_cache_slot) { op_array->run_time_cache = ecalloc(op_array->last_cache_slot, sizeof(void*)); diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h index 87fabfc2acc10..0a9cf008e3ef5 100644 --- a/Zend/zend_vm_opcodes.h +++ b/Zend/zend_vm_opcodes.h @@ -159,5 +159,6 @@ #define ZEND_SEPARATE 156 #define ZEND_QM_ASSIGN_VAR 157 #define ZEND_JMP_SET_VAR 158 -#define ZEND_YIELD 159 -#define ZEND_DELEGATE_YIELD 160 +#define ZEND_LEAVE 159 +#define ZEND_YIELD 160 +#define ZEND_DELEGATE_YIELD 161 diff --git a/configure.in b/configure.in index e9a0ef5069a0c..704801ec32f37 100644 --- a/configure.in +++ b/configure.in @@ -1443,7 +1443,7 @@ PHP_ADD_SOURCES(main, main.c snprintf.c spprintf.c php_sprintf.c \ fopen_wrappers.c alloca.c php_scandir.c \ php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \ strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c \ - network.c php_open_temporary_file.c php_logos.c \ + network.c php_open_temporary_file.c \ output.c getopt.c) PHP_ADD_SOURCES(main/streams, streams.c cast.c memory.c filter.c \ diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c index 7926fad6714ad..5947aabc986b9 100644 --- a/ext/calendar/calendar.c +++ b/ext/calendar/calendar.c @@ -140,7 +140,7 @@ const zend_function_entry calendar_functions[] = { PHP_FE(frenchtojd, arginfo_frenchtojd) PHP_FE(jddayofweek, arginfo_jddayofweek) PHP_FE(jdmonthname, arginfo_jdmonthname) - PHP_FE(easter_date, arginfo_easter_date) + PHP_FE(easter_date, arginfo_easter_date) PHP_FE(easter_days, arginfo_easter_days) PHP_FE(unixtojd, arginfo_unixtojd) PHP_FE(jdtounix, arginfo_jdtounix) @@ -199,11 +199,14 @@ static struct cal_entry_t cal_conversion_table[CAL_NUM_CALS] = { {"Julian", "CAL_JULIAN", JulianToSdn, SdnToJulian, 12, 31, MonthNameShort, MonthNameLong}, {"Jewish", "CAL_JEWISH", JewishToSdn, SdnToJewish, 13, 30, - JewishMonthName, JewishMonthName}, + JewishMonthNameLeap, JewishMonthNameLeap}, {"French", "CAL_FRENCH", FrenchToSdn, SdnToFrench, 13, 30, FrenchMonthName, FrenchMonthName} }; +#define JEWISH_MONTH_NAME(year) ((monthsPerYear[((year)-1) % 19] == 13)?JewishMonthNameLeap:JewishMonthName) +#define JEWISH_HEB_MONTH_NAME(year) ((monthsPerYear[((year)-1) % 19] == 13)?JewishMonthHebNameLeap:JewishMonthHebName) + /* For jddayofweek */ enum { CAL_DOW_DAYNO, CAL_DOW_SHORT, CAL_DOW_LONG }; @@ -288,7 +291,7 @@ static void _php_cal_info(int cal, zval **ret) PHP_FUNCTION(cal_info) { long cal = -1; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &cal) == FAILURE) { RETURN_FALSE; @@ -418,8 +421,14 @@ PHP_FUNCTION(cal_from_jd) add_assoc_string(return_value, "abbrevdayname", DayNameShort[dow], 1); add_assoc_string(return_value, "dayname", DayNameLong[dow], 1); /* month name */ - add_assoc_string(return_value, "abbrevmonth", calendar->month_name_short[month], 1); - add_assoc_string(return_value, "monthname", calendar->month_name_long[month], 1); + if(cal == CAL_JEWISH) { + /* special case for Jewish calendar */ + add_assoc_string(return_value, "abbrevmonth", JEWISH_MONTH_NAME(year)[month], 1); + add_assoc_string(return_value, "monthname", JEWISH_MONTH_NAME(year)[month], 1); + } else { + add_assoc_string(return_value, "abbrevmonth", calendar->month_name_short[month], 1); + add_assoc_string(return_value, "monthname", calendar->month_name_long[month], 1); + } } /* }}} */ @@ -608,7 +617,7 @@ PHP_FUNCTION(jdtojewish) RETURN_FALSE; } - snprintf(hebdate, sizeof(hebdate), "%s %s %s", heb_number_to_chars(day, fl, &dayp), JewishMonthHebName[month], heb_number_to_chars(year, fl, &yearp)); + snprintf(hebdate, sizeof(hebdate), "%s %s %s", heb_number_to_chars(day, fl, &dayp), JEWISH_HEB_MONTH_NAME(year)[month], heb_number_to_chars(year, fl, &yearp)); if (dayp) { efree(dayp); @@ -728,7 +737,7 @@ PHP_FUNCTION(jdmonthname) break; case CAL_MONTH_JEWISH: /* jewish month */ SdnToJewish(julday, &year, &month, &day); - monthname = JewishMonthName[month]; + monthname = JEWISH_MONTH_NAME(year)[month]; break; case CAL_MONTH_FRENCH: /* french month */ SdnToFrench(julday, &year, &month, &day); diff --git a/ext/calendar/jewish.c b/ext/calendar/jewish.c index f4dc7c35ae57c..9e5b0beced7ab 100644 --- a/ext/calendar/jewish.c +++ b/ext/calendar/jewish.c @@ -85,8 +85,8 @@ * 3 Kislev 29 30 30 29 30 30 (variable) * 4 Tevet 29 29 29 29 29 29 * 5 Shevat 30 30 30 30 30 30 - * 6 Adar I 29 29 29 30 30 30 (variable) - * 7 Adar II -- -- -- 29 29 29 (optional) + * 6 Adar I -- -- -- 30 30 30 (optional) + * 7 Adar (II) 29 29 29 29 29 29 * 8 Nisan 30 30 30 30 30 30 * 9 Iyyar 29 29 29 29 29 29 * 10 Sivan 30 30 30 30 30 30 @@ -100,8 +100,8 @@ * have multiple possible spellings in the Roman character set. I have * chosen to use the spellings found in the Encyclopedia Judaica. * - * Adar II, the month added for leap years, is sometimes referred to as - * the 13th month, but I have chosen to assign it the number 7 to keep + * Adar I, the month added for leap years, is sometimes referred to as + * the 13th month, but I have chosen to assign it the number 6 to keep * the months in chronological order. This may not be consistent with * other numbering schemes. * @@ -286,7 +286,7 @@ #define AM3_11_20 ((9 * HALAKIM_PER_HOUR) + 204) #define AM9_32_43 ((15 * HALAKIM_PER_HOUR) + 589) -static int monthsPerYear[19] = +int monthsPerYear[19] = { 12, 12, 13, 12, 12, 13, 12, 13, 12, 12, 13, 12, 12, 13, 12, 12, 13, 12, 13 }; @@ -297,16 +297,36 @@ static int yearOffset[19] = 136, 148, 160, 173, 185, 197, 210, 222 }; +/* names for leap (13-month) year */ +char *JewishMonthNameLeap[14] = +{ + "", + "Tishri", + "Heshvan", + "Kislev", + "Tevet", + "Shevat", + "Adar I", + "Adar II", + "Nisan", + "Iyyar", + "Sivan", + "Tammuz", + "Av", + "Elul" +}; + +/* names for regular year */ char *JewishMonthName[14] = { - "", + "", "Tishri", "Heshvan", "Kislev", "Tevet", "Shevat", - "AdarI", - "AdarII", + "", + "Adar", "Nisan", "Iyyar", "Sivan", @@ -315,16 +335,36 @@ char *JewishMonthName[14] = "Elul" }; +/* names for leap (13-month) year */ +char *JewishMonthHebNameLeap[14] = +{ + "", + "úùøé", + "çùåï", + "ëñìå", + "èáú", + "ùáè", + "àãø à'", + "àãø á'", + "ðéñï", + "àééø", + "ñéåï", + "úîåæ", + "àá", + "àìåì" +}; + +/* names for regular year */ char *JewishMonthHebName[14] = { - "", + "", "úùøé", "çùåï", "ëñìå", "èáú", "ùáè", + "", "àãø", - "'àãø á", "ðéñï", "àééø", "ñéåï", @@ -587,11 +627,11 @@ void SdnToJewish( (*pMonth)--; (*pDay) += 30; } else { - *pMonth = 6; + *pMonth = 7; *pDay = inputDay - tishri1 + 207; if (*pDay > 0) return; - (*pMonth)--; + (*pMonth) -= 2; (*pDay) += 30; } if (*pDay > 0) diff --git a/ext/calendar/sdncal.h b/ext/calendar/sdncal.h index 81328d1369cf5..c0463c80d45e6 100644 --- a/ext/calendar/sdncal.h +++ b/ext/calendar/sdncal.h @@ -79,7 +79,10 @@ long int JulianToSdn(int year, int month, int day); void SdnToJewish(long int sdn, int *pYear, int *pMonth, int *pDay); long int JewishToSdn(int year, int month, int day); extern char *JewishMonthName[14]; +extern char *JewishMonthNameLeap[14]; extern char *JewishMonthHebName[14]; +extern char *JewishMonthHebNameLeap[14]; +extern int monthsPerYear[19]; /* French republic calendar conversions. */ void SdnToFrench(long int sdn, int *pYear, int *pMonth, int *pDay); diff --git a/ext/calendar/tests/bug54254.phpt b/ext/calendar/tests/bug54254.phpt new file mode 100644 index 0000000000000..df9362320c0a6 --- /dev/null +++ b/ext/calendar/tests/bug54254.phpt @@ -0,0 +1,59 @@ +--TEST-- +Bug #54254 (cal_days_in_month incompatible with jdtojewish in non-leap-years) +--SKIPIF-- + +--FILE-- + Kislev [4] => Tevet [5] => Shevat - [6] => AdarI - [7] => AdarII + [6] => Adar I + [7] => Adar II [8] => Nisan [9] => Iyyar [10] => Sivan @@ -117,8 +117,8 @@ Array [3] => Kislev [4] => Tevet [5] => Shevat - [6] => AdarI - [7] => AdarII + [6] => Adar I + [7] => Adar II [8] => Nisan [9] => Iyyar [10] => Sivan diff --git a/ext/calendar/tests/jdmonthname.phpt b/ext/calendar/tests/jdmonthname.phpt index d05d3c595efca..07ed1161b1753 100644 --- a/ext/calendar/tests/jdmonthname.phpt +++ b/ext/calendar/tests/jdmonthname.phpt @@ -75,8 +75,8 @@ December --- mode 4 --- Tevet Shevat -AdarI -AdarII +Adar I +Adar II Nisan Iyyar Sivan @@ -178,7 +178,7 @@ Heshvan Kislev Tevet Shevat -AdarI +Adar Nisan Iyyar Sivan @@ -279,7 +279,7 @@ Heshvan Kislev Tevet Shevat -AdarI +Adar Nisan Iyyar Sivan diff --git a/ext/calendar/tests/jdtojewish.phpt b/ext/calendar/tests/jdtojewish.phpt index 484b95749cca9..bc0ecbdd88ec2 100644 --- a/ext/calendar/tests/jdtojewish.phpt +++ b/ext/calendar/tests/jdtojewish.phpt @@ -14,10 +14,11 @@ var_dump(jdtojewish(gregoriantojd(10,28,2002))."\r\n". jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM)."\r\n". jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n". jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM)."\r\n". - jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n"); + jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n". + jdtojewish(gregoriantojd(3,10,2007))."\r\n"); ?> ---EXPECT-- -string(184) "2/22/5763 +--EXPECTF-- +string(%d) "2/22/5763 ëá çùåï äúùñâ ëá çùåï ä'úùñâ ëá çùåï ä àìôéí úùñâ @@ -27,4 +28,5 @@ string(184) "2/22/5763 á' çùåï ä'úùñ"â á' çùåï ä àìôéí úùñ"â á' çùåï ä' àìôéí úùñ"â +7/20/5767 " diff --git a/ext/com_dotnet/com_misc.c b/ext/com_dotnet/com_misc.c index 1158354aca382..33bd6380f3bfc 100644 --- a/ext/com_dotnet/com_misc.c +++ b/ext/com_dotnet/com_misc.c @@ -42,7 +42,7 @@ void php_com_throw_exception(HRESULT code, char *message TSRMLS_DC) } } -PHPAPI void php_com_wrap_dispatch(zval *z, IDispatch *disp, +PHP_COM_DOTNET_API void php_com_wrap_dispatch(zval *z, IDispatch *disp, int codepage TSRMLS_DC) { php_com_dotnet_object *obj; @@ -65,7 +65,7 @@ PHPAPI void php_com_wrap_dispatch(zval *z, IDispatch *disp, z->value.obj.handlers = &php_com_object_handlers; } -PHPAPI void php_com_wrap_variant(zval *z, VARIANT *v, +PHP_COM_DOTNET_API void php_com_wrap_variant(zval *z, VARIANT *v, int codepage TSRMLS_DC) { php_com_dotnet_object *obj; @@ -92,7 +92,7 @@ PHPAPI void php_com_wrap_variant(zval *z, VARIANT *v, /* this is a convenience function for fetching a particular * element from a (possibly multi-dimensional) safe array */ -PHPAPI int php_com_safearray_get_elem(VARIANT *array, VARIANT *dest, LONG dim1 TSRMLS_DC) +PHP_COM_DOTNET_API int php_com_safearray_get_elem(VARIANT *array, VARIANT *dest, LONG dim1 TSRMLS_DC) { UINT dims; LONG lbound, ubound; diff --git a/ext/com_dotnet/com_olechar.c b/ext/com_dotnet/com_olechar.c index 903cd9dec3ec5..e57c7343de5c8 100644 --- a/ext/com_dotnet/com_olechar.c +++ b/ext/com_dotnet/com_olechar.c @@ -30,7 +30,7 @@ #include "php_com_dotnet_internal.h" -PHPAPI OLECHAR *php_com_string_to_olestring(char *string, uint string_len, int codepage TSRMLS_DC) +PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(char *string, uint string_len, int codepage TSRMLS_DC) { OLECHAR *olestring = NULL; DWORD flags = codepage == CP_UTF8 ? 0 : MB_PRECOMPOSED | MB_ERR_INVALID_CHARS; @@ -65,7 +65,7 @@ PHPAPI OLECHAR *php_com_string_to_olestring(char *string, uint string_len, int c return olestring; } -PHPAPI char *php_com_olestring_to_string(OLECHAR *olestring, uint *string_len, int codepage TSRMLS_DC) +PHP_COM_DOTNET_API char *php_com_olestring_to_string(OLECHAR *olestring, uint *string_len, int codepage TSRMLS_DC) { char *string; uint length = 0; diff --git a/ext/com_dotnet/com_persist.c b/ext/com_dotnet/com_persist.c index 233d4a1dc1c8d..7c035f6c4abc4 100755 --- a/ext/com_dotnet/com_persist.c +++ b/ext/com_dotnet/com_persist.c @@ -268,7 +268,7 @@ static void istream_destructor(php_istream *stm TSRMLS_DC) } /* }}} */ -PHPAPI IStream *php_com_wrapper_export_stream(php_stream *stream TSRMLS_DC) +PHP_COM_DOTNET_API IStream *php_com_wrapper_export_stream(php_stream *stream TSRMLS_DC) { php_istream *stm = (php_istream*)CoTaskMemAlloc(sizeof(*stm)); diff --git a/ext/com_dotnet/com_typeinfo.c b/ext/com_dotnet/com_typeinfo.c index f0a845003dae7..f57b97f0daf9f 100644 --- a/ext/com_dotnet/com_typeinfo.c +++ b/ext/com_dotnet/com_typeinfo.c @@ -35,7 +35,7 @@ * b) a CLSID, major, minor e.g. "{00000200-0000-0010-8000-00AA006D2EA4},2,0" * c) a Type Library name e.g. "Microsoft OLE DB ActiveX Data Objects 1.0 Library" */ -PHPAPI ITypeLib *php_com_load_typelib(char *search_string, int codepage TSRMLS_DC) +PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, int codepage TSRMLS_DC) { ITypeLib *TL = NULL; char *strtok_buf, *major, *minor; @@ -153,7 +153,7 @@ PHPAPI ITypeLib *php_com_load_typelib(char *search_string, int codepage TSRMLS_D } /* Given a type-library, merge it into the current engine state */ -PHPAPI int php_com_import_typelib(ITypeLib *TL, int mode, int codepage TSRMLS_DC) +PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepage TSRMLS_DC) { int i, j, interfaces; TYPEKIND pTKind; @@ -228,7 +228,7 @@ void php_com_typelibrary_dtor(void *pDest) ITypeLib_Release(*Lib); } -PHPAPI ITypeLib *php_com_load_typelib_via_cache(char *search_string, +PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(char *search_string, int codepage, int *cached TSRMLS_DC) { ITypeLib **TLp; diff --git a/ext/com_dotnet/com_variant.c b/ext/com_dotnet/com_variant.c index 10dba0fc324b1..2adccb588177e 100644 --- a/ext/com_dotnet/com_variant.c +++ b/ext/com_dotnet/com_variant.c @@ -98,7 +98,7 @@ static void safe_array_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC) } } -PHPAPI void php_com_variant_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC) +PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC) { OLECHAR *olestring; php_com_dotnet_object *obj; @@ -166,7 +166,7 @@ PHPAPI void php_com_variant_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_D } } -PHPAPI int php_com_zval_from_variant(zval *z, VARIANT *v, int codepage TSRMLS_DC) +PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, int codepage TSRMLS_DC) { OLECHAR *olestring = NULL; int ret = SUCCESS; @@ -258,7 +258,7 @@ PHPAPI int php_com_zval_from_variant(zval *z, VARIANT *v, int codepage TSRMLS_DC } -PHPAPI int php_com_copy_variant(VARIANT *dstvar, VARIANT *srcvar TSRMLS_DC) +PHP_COM_DOTNET_API int php_com_copy_variant(VARIANT *dstvar, VARIANT *srcvar TSRMLS_DC) { int ret = SUCCESS; diff --git a/ext/com_dotnet/com_wrapper.c b/ext/com_dotnet/com_wrapper.c index 7494d882eaf45..c8e59f95cc247 100644 --- a/ext/com_dotnet/com_wrapper.c +++ b/ext/com_dotnet/com_wrapper.c @@ -578,7 +578,7 @@ static void disp_destructor(php_dispatchex *disp TSRMLS_DC) CoTaskMemFree(disp); } -PHPAPI IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *sinkid, +PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *sinkid, HashTable *id_to_name TSRMLS_DC) { php_dispatchex *disp = disp_constructor(val TSRMLS_CC); @@ -617,7 +617,7 @@ PHPAPI IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *sinkid, return (IDispatch*)disp; } -PHPAPI IDispatch *php_com_wrapper_export(zval *val TSRMLS_DC) +PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export(zval *val TSRMLS_DC) { php_dispatchex *disp = NULL; diff --git a/ext/com_dotnet/php_com_dotnet.h b/ext/com_dotnet/php_com_dotnet.h index ddcd38132e7a1..96ea21ae6af28 100644 --- a/ext/com_dotnet/php_com_dotnet.h +++ b/ext/com_dotnet/php_com_dotnet.h @@ -28,6 +28,14 @@ extern zend_module_entry com_dotnet_module_entry; #include "TSRM.h" #endif +#ifdef PHP_WIN32 +# define PHP_COM_DOTNET_API __declspec(dllexport) +#elif defined(__GNUC__) && __GNUC__ >= 4 +# define PHP_COM_DOTNET_API __attribute__ ((visibility("default"))) +#else +# define PHP_COM_DOTNET_API +#endif + PHP_MINIT_FUNCTION(com_dotnet); PHP_MSHUTDOWN_FUNCTION(com_dotnet); PHP_RINIT_FUNCTION(com_dotnet); diff --git a/ext/com_dotnet/php_com_dotnet_internal.h b/ext/com_dotnet/php_com_dotnet_internal.h index 8b9502079daa9..f821bec976886 100644 --- a/ext/com_dotnet/php_com_dotnet_internal.h +++ b/ext/com_dotnet/php_com_dotnet_internal.h @@ -84,9 +84,9 @@ zend_object_iterator *php_com_saproxy_iter_get(zend_class_entry *ce, zval *objec int php_com_saproxy_create(zval *com_object, zval *proxy_out, zval *index TSRMLS_DC); /* com_olechar.c */ -PHPAPI char *php_com_olestring_to_string(OLECHAR *olestring, +PHP_COM_DOTNET_API char *php_com_olestring_to_string(OLECHAR *olestring, uint *string_len, int codepage TSRMLS_DC); -PHPAPI OLECHAR *php_com_string_to_olestring(char *string, +PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(char *string, uint string_len, int codepage TSRMLS_DC); @@ -112,8 +112,8 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, char *name, int namelen, /* com_wrapper.c */ int php_com_wrapper_minit(INIT_FUNC_ARGS); -PHPAPI IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *sinkid, HashTable *id_to_name TSRMLS_DC); -PHPAPI IDispatch *php_com_wrapper_export(zval *val TSRMLS_DC); +PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *sinkid, HashTable *id_to_name TSRMLS_DC); +PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export(zval *val TSRMLS_DC); /* com_persist.c */ int php_com_persist_minit(INIT_FUNC_ARGS); @@ -147,10 +147,10 @@ PHP_FUNCTION(variant_get_type); PHP_FUNCTION(variant_set_type); PHP_FUNCTION(variant_cast); -PHPAPI void php_com_variant_from_zval_with_type(VARIANT *v, zval *z, VARTYPE type, int codepage TSRMLS_DC); -PHPAPI void php_com_variant_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC); -PHPAPI int php_com_zval_from_variant(zval *z, VARIANT *v, int codepage TSRMLS_DC); -PHPAPI int php_com_copy_variant(VARIANT *dst, VARIANT *src TSRMLS_DC); +PHP_COM_DOTNET_API void php_com_variant_from_zval_with_type(VARIANT *v, zval *z, VARTYPE type, int codepage TSRMLS_DC); +PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC); +PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, int codepage TSRMLS_DC); +PHP_COM_DOTNET_API int php_com_copy_variant(VARIANT *dst, VARIANT *src TSRMLS_DC); /* com_dotnet.c */ PHP_FUNCTION(com_dotnet_create_instance); @@ -159,17 +159,17 @@ void php_com_dotnet_mshutdown(TSRMLS_D); /* com_misc.c */ void php_com_throw_exception(HRESULT code, char *message TSRMLS_DC); -PHPAPI void php_com_wrap_dispatch(zval *z, IDispatch *disp, +PHP_COM_DOTNET_API void php_com_wrap_dispatch(zval *z, IDispatch *disp, int codepage TSRMLS_DC); -PHPAPI void php_com_wrap_variant(zval *z, VARIANT *v, +PHP_COM_DOTNET_API void php_com_wrap_variant(zval *z, VARIANT *v, int codepage TSRMLS_DC); -PHPAPI int php_com_safearray_get_elem(VARIANT *array, VARIANT *dest, LONG dim1 TSRMLS_DC); +PHP_COM_DOTNET_API int php_com_safearray_get_elem(VARIANT *array, VARIANT *dest, LONG dim1 TSRMLS_DC); /* com_typeinfo.c */ -PHPAPI ITypeLib *php_com_load_typelib_via_cache(char *search_string, +PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(char *search_string, int codepage, int *cached TSRMLS_DC); -PHPAPI ITypeLib *php_com_load_typelib(char *search_string, int codepage TSRMLS_DC); -PHPAPI int php_com_import_typelib(ITypeLib *TL, int mode, +PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, int codepage TSRMLS_DC); +PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepage TSRMLS_DC); void php_com_typelibrary_dtor(void *pDest); ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj, char *dispname, int sink TSRMLS_DC); diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 35339911bad0d..0deae0f2270bd 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -1105,6 +1105,10 @@ PHP_MINIT_FUNCTION(curl) REGISTER_CURL_CONSTANT(CURLOPT_DNS_SERVERS); #endif +#if LIBCURL_VERSION_NUM >= 0x071900 /* Available since 7.25.0 */ + REGISTER_CURL_CONSTANT(CURLOPT_MAIL_AUTH); +#endif + #if CURLOPT_FTPASCII != 0 REGISTER_CURL_CONSTANT(CURLOPT_FTPASCII); #endif @@ -2214,6 +2218,9 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu #if LIBCURL_VERSION_NUM >= 0x071800 /* Available since 7.24.0 */ case CURLOPT_DNS_SERVERS: #endif +#if LIBCURL_VERSION_NUM >= 0x071900 /* Available since 7.25.0 */ + case CURLOPT_MAIL_AUTH: +#endif { #if LIBCURL_VERSION_NUM < 0x071100 char *copystr = NULL; @@ -2640,7 +2647,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu convert_to_string_ex(zvalue); - if (!Z_STRLEN_PP(zvalue) || php_check_open_basedir(Z_STRVAL_PP(zvalue) TSRMLS_CC)) { + if (Z_STRLEN_PP(zvalue) && php_check_open_basedir(Z_STRVAL_PP(zvalue) TSRMLS_CC)) { RETVAL_FALSE; return 1; } diff --git a/ext/curl/tests/bug61948-win32.phpt b/ext/curl/tests/bug61948-win32.phpt new file mode 100644 index 0000000000000..dc86526b7b594 --- /dev/null +++ b/ext/curl/tests/bug61948-win32.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction) +--SKIPIF-- + +--INI-- +open_basedir="c:/tmp" +--FILE-- + +--EXPECTF-- +%a + +Warning: curl_setopt(): open_basedir restriction in effect. File(c:/tmp/foo) is not within the allowed path(s): (c:/tmp) in %sbug61948-win32.php on line %d +bool(false) + +Warning: curl_setopt(): open_basedir restriction in effect. File(c:/xxx/bar) is not within the allowed path(s): (c:/tmp) in %sbug61948-win32.php on line %d +bool(false) diff --git a/ext/curl/tests/bug61948.phpt b/ext/curl/tests/bug61948.phpt index a03fc3b600c81..00df07d73e285 100644 --- a/ext/curl/tests/bug61948.phpt +++ b/ext/curl/tests/bug61948.phpt @@ -1,7 +1,10 @@ --TEST-- Bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction) --SKIPIF-- - + --INI-- open_basedir="/tmp" --FILE-- @@ -13,7 +16,7 @@ open_basedir="/tmp" curl_close($ch); ?> --EXPECTF-- -bool(false) +bool(true) bool(true) Warning: curl_setopt(): open_basedir restriction in effect. File(/xxx/bar) is not within the allowed path(s): (/tmp) in %sbug61948.php on line %d diff --git a/ext/curl/tests/curl_escape.phpt b/ext/curl/tests/curl_escape.phpt index 7c90fb9888324..e759144c8ac87 100644 Binary files a/ext/curl/tests/curl_escape.phpt and b/ext/curl/tests/curl_escape.phpt differ diff --git a/ext/date/lib/tm2unixtime.c b/ext/date/lib/tm2unixtime.c index c4830bbef0c7b..9055fee203f54 100644 --- a/ext/date/lib/tm2unixtime.c +++ b/ext/date/lib/tm2unixtime.c @@ -220,55 +220,52 @@ static void do_adjust_relative(timelib_time* time) static void do_adjust_special_weekday(timelib_time* time) { - timelib_sll current_dow, count; + timelib_sll count, dow, rem; count = time->relative.special.amount; + dow = timelib_day_of_week(time->y, time->m, time->d); - current_dow = timelib_day_of_week(time->y, time->m, time->d); - if (count == 0) { - /* skip over saturday and sunday */ - if (current_dow == 6) { - time->d += 2; - } - /* skip over sunday */ - if (current_dow == 0) { - time->d += 1; - } - } else if (count > 0) { - /* skip over saturday and sunday */ - if (current_dow == 5) { - time->d += 2; - } - /* skip over sunday */ - if (current_dow == 6) { + /* Add increments of 5 weekdays as a week, leaving the DOW unchanged. */ + time->d += (count / 5) * 7; + + /* Deal with the remainder. */ + rem = (count % 5); + + if (count > 0) { + if (rem == 0) { + /* Head back to Friday if we stop on the weekend. */ + if (dow == 0) { + time->d -= 2; + } else if (dow == 6) { + time->d -= 1; + } + } else if (dow == 6) { + /* We ended up on Saturday, but there's still work to do, so move + * to Sunday and continue from there. */ time->d += 1; - } - /* add increments of 5 weekdays as a week */ - time->d += (count / 5) * 7; - /* if current DOW plus the remainder > 5, add two days */ - current_dow = timelib_day_of_week(time->y, time->m, time->d); - time->d += (count % 5); - if ((count % 5) + current_dow > 5) { + } else if (dow + rem > 5) { + /* We're on a weekday, but we're going past Friday, so skip right + * over the weekend. */ time->d += 2; } - } else if (count < 0) { - /* skip over sunday and saturday */ - if (current_dow == 1) { - time->d -= 2; - } - /* skip over satruday */ - if (current_dow == 0 ) { + } else { + /* Completely mirror the forward direction. This also covers the 0 + * case, since if we start on the weekend, we want to move forward as + * if we stopped there while going backwards. */ + if (rem == 0) { + if (dow == 6) { + time->d += 2; + } else if (dow == 0) { + time->d += 1; + } + } else if (dow == 0) { time->d -= 1; - } - /* subtract increments of 5 weekdays as a week */ - time->d += (count / 5) * 7; - /* if current DOW minus the remainder < 0, subtract two days */ - current_dow = timelib_day_of_week(time->y, time->m, time->d); - time->d += (count % 5); - if ((count % 5) + current_dow < 1) { + } else if (dow + rem < 1) { time->d -= 2; } } + + time->d += rem; } static void do_adjust_special(timelib_time* time) diff --git a/ext/date/php_date.c b/ext/date/php_date.c index cd48de2731bdb..13e7b753d38fa 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -3430,10 +3430,19 @@ zval *date_interval_read_property(zval *object, zval *member, int type, const ze zval_copy_ctor(&tmp_member); convert_to_string(&tmp_member); member = &tmp_member; + key = NULL; } obj = (php_interval_obj *)zend_objects_get_address(object TSRMLS_CC); + if (!obj->initialized) { + retval = (zend_get_std_object_handlers())->read_property(object, member, type, key TSRMLS_CC); + if (member == &tmp_member) { + zval_dtor(member); + } + return retval; + } + #define GET_VALUE_FROM_STRUCT(n,m) \ if (strcmp(Z_STRVAL_P(member), m) == 0) { \ value = obj->diff->n; \ @@ -3482,9 +3491,19 @@ void date_interval_write_property(zval *object, zval *member, zval *value, const zval_copy_ctor(&tmp_member); convert_to_string(&tmp_member); member = &tmp_member; + key = NULL; } + obj = (php_interval_obj *)zend_objects_get_address(object TSRMLS_CC); + if (!obj->initialized) { + (zend_get_std_object_handlers())->write_property(object, member, value, key TSRMLS_CC); + if (member == &tmp_member) { + zval_dtor(member); + } + return; + } + #define SET_VALUE_FROM_STRUCT(n,m) \ if (strcmp(Z_STRVAL_P(member), m) == 0) { \ if (value->type != IS_LONG) { \ diff --git a/ext/date/tests/bug61642.phpt b/ext/date/tests/bug61642.phpt new file mode 100644 index 0000000000000..d03a814d88279 --- /dev/null +++ b/ext/date/tests/bug61642.phpt @@ -0,0 +1,62 @@ +--TEST-- +Bug #61642 (modify("+5 weekdays") returns Sunday) +--INI-- +date.timezone=UTC +--FILE-- +format('Y-m-d D'); +} + +echo '### ', implode(' ', $header), "\n\n"; + +foreach ($weekdays as $days) { + $line = array(); + + printf('%+3d ', $days); + + foreach ($dates as $startdate) { + $date = new DateTime($startdate); + $date->modify("{$days} weekdays"); + + $line[] = $date->format('Y-m-d D'); + } + + echo implode(' ', $line), "\n"; +} +?> +--EXPECTF-- +### 2012-03-29 Thu 2012-03-30 Fri 2012-03-31 Sat 2012-04-01 Sun 2012-04-02 Mon 2012-04-03 Tue 2012-04-04 Wed 2012-04-05 Thu + +-11 2012-03-14 Wed 2012-03-15 Thu 2012-03-16 Fri 2012-03-16 Fri 2012-03-16 Fri 2012-03-19 Mon 2012-03-20 Tue 2012-03-21 Wed +-10 2012-03-15 Thu 2012-03-16 Fri 2012-03-19 Mon 2012-03-19 Mon 2012-03-19 Mon 2012-03-20 Tue 2012-03-21 Wed 2012-03-22 Thu + -9 2012-03-16 Fri 2012-03-19 Mon 2012-03-20 Tue 2012-03-20 Tue 2012-03-20 Tue 2012-03-21 Wed 2012-03-22 Thu 2012-03-23 Fri + -8 2012-03-19 Mon 2012-03-20 Tue 2012-03-21 Wed 2012-03-21 Wed 2012-03-21 Wed 2012-03-22 Thu 2012-03-23 Fri 2012-03-26 Mon + -7 2012-03-20 Tue 2012-03-21 Wed 2012-03-22 Thu 2012-03-22 Thu 2012-03-22 Thu 2012-03-23 Fri 2012-03-26 Mon 2012-03-27 Tue + -6 2012-03-21 Wed 2012-03-22 Thu 2012-03-23 Fri 2012-03-23 Fri 2012-03-23 Fri 2012-03-26 Mon 2012-03-27 Tue 2012-03-28 Wed + -5 2012-03-22 Thu 2012-03-23 Fri 2012-03-26 Mon 2012-03-26 Mon 2012-03-26 Mon 2012-03-27 Tue 2012-03-28 Wed 2012-03-29 Thu + -4 2012-03-23 Fri 2012-03-26 Mon 2012-03-27 Tue 2012-03-27 Tue 2012-03-27 Tue 2012-03-28 Wed 2012-03-29 Thu 2012-03-30 Fri + -3 2012-03-26 Mon 2012-03-27 Tue 2012-03-28 Wed 2012-03-28 Wed 2012-03-28 Wed 2012-03-29 Thu 2012-03-30 Fri 2012-04-02 Mon + -2 2012-03-27 Tue 2012-03-28 Wed 2012-03-29 Thu 2012-03-29 Thu 2012-03-29 Thu 2012-03-30 Fri 2012-04-02 Mon 2012-04-03 Tue + -1 2012-03-28 Wed 2012-03-29 Thu 2012-03-30 Fri 2012-03-30 Fri 2012-03-30 Fri 2012-04-02 Mon 2012-04-03 Tue 2012-04-04 Wed + +0 2012-03-29 Thu 2012-03-30 Fri 2012-04-02 Mon 2012-04-02 Mon 2012-04-02 Mon 2012-04-03 Tue 2012-04-04 Wed 2012-04-05 Thu + +1 2012-03-30 Fri 2012-04-02 Mon 2012-04-02 Mon 2012-04-02 Mon 2012-04-03 Tue 2012-04-04 Wed 2012-04-05 Thu 2012-04-06 Fri + +2 2012-04-02 Mon 2012-04-03 Tue 2012-04-03 Tue 2012-04-03 Tue 2012-04-04 Wed 2012-04-05 Thu 2012-04-06 Fri 2012-04-09 Mon + +3 2012-04-03 Tue 2012-04-04 Wed 2012-04-04 Wed 2012-04-04 Wed 2012-04-05 Thu 2012-04-06 Fri 2012-04-09 Mon 2012-04-10 Tue + +4 2012-04-04 Wed 2012-04-05 Thu 2012-04-05 Thu 2012-04-05 Thu 2012-04-06 Fri 2012-04-09 Mon 2012-04-10 Tue 2012-04-11 Wed + +5 2012-04-05 Thu 2012-04-06 Fri 2012-04-06 Fri 2012-04-06 Fri 2012-04-09 Mon 2012-04-10 Tue 2012-04-11 Wed 2012-04-12 Thu + +6 2012-04-06 Fri 2012-04-09 Mon 2012-04-09 Mon 2012-04-09 Mon 2012-04-10 Tue 2012-04-11 Wed 2012-04-12 Thu 2012-04-13 Fri + +7 2012-04-09 Mon 2012-04-10 Tue 2012-04-10 Tue 2012-04-10 Tue 2012-04-11 Wed 2012-04-12 Thu 2012-04-13 Fri 2012-04-16 Mon + +8 2012-04-10 Tue 2012-04-11 Wed 2012-04-11 Wed 2012-04-11 Wed 2012-04-12 Thu 2012-04-13 Fri 2012-04-16 Mon 2012-04-17 Tue + +9 2012-04-11 Wed 2012-04-12 Thu 2012-04-12 Thu 2012-04-12 Thu 2012-04-13 Fri 2012-04-16 Mon 2012-04-17 Tue 2012-04-18 Wed ++10 2012-04-12 Thu 2012-04-13 Fri 2012-04-13 Fri 2012-04-13 Fri 2012-04-16 Mon 2012-04-17 Tue 2012-04-18 Wed 2012-04-19 Thu ++11 2012-04-13 Fri 2012-04-16 Mon 2012-04-16 Mon 2012-04-16 Mon 2012-04-17 Tue 2012-04-18 Wed 2012-04-19 Thu 2012-04-20 Fri diff --git a/ext/date/tests/bug62500.phpt b/ext/date/tests/bug62500.phpt new file mode 100644 index 0000000000000..6952332014409 --- /dev/null +++ b/ext/date/tests/bug62500.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #62500 (Segfault in DateInterval class when extended) +--INI-- +date.timezone=GMT +--FILE-- +foo); + $this->foo = 3; + var_dump($this->foo); + var_dump($this->{2}); + parent::__construct($time_spec); + } +} +try { + $c = new Crasher('blah'); +} catch (Exception $e) { + var_dump($e->getMessage()); +} +--EXPECTF-- +NULL +int(3) + +Notice: Undefined property: Crasher::$2 in %sbug62500.php on line %d +NULL +string(%s) "DateInterval::__construct(): Unknown or bad format (blah)" diff --git a/ext/dom/documenttype.c b/ext/dom/documenttype.c index d61ba796ab57d..eee3b5f887d45 100644 --- a/ext/dom/documenttype.c +++ b/ext/dom/documenttype.c @@ -205,7 +205,11 @@ int dom_documenttype_internal_subset_read(dom_object *obj, zval **retval TSRMLS_ if (buff != NULL) { xmlNodeDumpOutput (buff, NULL, (xmlNodePtr) intsubset, 0, 0, NULL); xmlOutputBufferFlush(buff); +#ifdef LIBXML2_NEW_BUFFER + ZVAL_STRINGL(*retval, xmlOutputBufferGetContent(buff), xmlOutputBufferGetSize(buff), 1); +#else ZVAL_STRINGL(*retval, buff->buffer->content, buff->buffer->use, 1); +#endif (void)xmlOutputBufferClose(buff); return SUCCESS; } diff --git a/ext/dom/node.c b/ext/dom/node.c index 4e58421e4a844..4dbce4d7901a3 100644 --- a/ext/dom/node.c +++ b/ext/dom/node.c @@ -1895,9 +1895,17 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ RETVAL_FALSE; } else { if (mode == 0) { +#ifdef LIBXML2_NEW_BUFFER + ret = xmlOutputBufferGetSize(buf); +#else ret = buf->buffer->use; +#endif if (ret > 0) { +#ifdef LIBXML2_NEW_BUFFER + RETVAL_STRINGL((char *) xmlOutputBufferGetContent(buf), ret, 1); +#else RETVAL_STRINGL((char *) buf->buffer->content, ret, 1); +#endif } else { RETVAL_EMPTY_STRING(); } diff --git a/ext/dom/tests/DOMAttr_value_basic_001.phpt b/ext/dom/tests/DOMAttr_value_basic_001.phpt index 40e00bcc4d1ae..51c4ac954de10 100755 --- a/ext/dom/tests/DOMAttr_value_basic_001.phpt +++ b/ext/dom/tests/DOMAttr_value_basic_001.phpt @@ -1,6 +1,6 @@ --TEST-- Read empty $value. ---CREDIT-- +--CREDITS-- Jason Bouffard # TestFest Atlanta 2009-05-14 --SKIPIF-- @@ -13,4 +13,4 @@ print $attr->value."\n"; ===DONE=== --EXPECTF-- ===DONE=== - \ No newline at end of file + diff --git a/ext/dom/tests/DOMAttr_value_basic_002.phpt b/ext/dom/tests/DOMAttr_value_basic_002.phpt index cf71eebf39f79..384a9ca4af7b9 100644 --- a/ext/dom/tests/DOMAttr_value_basic_002.phpt +++ b/ext/dom/tests/DOMAttr_value_basic_002.phpt @@ -1,6 +1,6 @@ --TEST-- Write non-string $value property ---CREDIT-- +--CREDITS-- Eric Berg # TestFest Atlanta 2009-05-14 --SKIPIF-- @@ -12,4 +12,4 @@ $attr->value = 1; print $attr->value; ?> --EXPECTF-- -1 \ No newline at end of file +1 diff --git a/ext/dom/tests/DOMCharacterData_data_error_002.phpt b/ext/dom/tests/DOMCharacterData_data_error_002.phpt index 9dae096e6f791..401e0f2f8cd4a 100755 --- a/ext/dom/tests/DOMCharacterData_data_error_002.phpt +++ b/ext/dom/tests/DOMCharacterData_data_error_002.phpt @@ -1,6 +1,6 @@ --TEST-- Invalid State Error when getting data on DOMCharacterData out of content. ---CREDIT-- +--CREDITS-- Eric Berg # TestFest Atlanta 2009-05-14 --SKIPIF-- @@ -11,4 +11,4 @@ $character_data = new DOMCharacterData(); print $character_data->data; ?> --EXPECTF-- -Warning: main(): Invalid State Error in %s on line %d \ No newline at end of file +Warning: main(): Invalid State Error in %s on line %d diff --git a/ext/dom/tests/DOMCharacterData_length_error_001.phpt b/ext/dom/tests/DOMCharacterData_length_error_001.phpt index 0dda492ad43dd..e8bf16ab982a6 100755 --- a/ext/dom/tests/DOMCharacterData_length_error_001.phpt +++ b/ext/dom/tests/DOMCharacterData_length_error_001.phpt @@ -1,6 +1,6 @@ --TEST-- Invalid State Error when getting length on DOMCharacterData out of content. ---CREDIT-- +--CREDITS-- Jason Bouffard # TestFest Atlanta 2009-05-14 --SKIPIF-- @@ -14,4 +14,4 @@ print $character_data->length; --EXPECTF-- Warning: main(): Invalid State Error in %s ===DONE=== - \ No newline at end of file + diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c index dd98511e9caea..342854654ecf4 100644 --- a/ext/dom/xpath.c +++ b/ext/dom/xpath.c @@ -216,7 +216,7 @@ static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, if (Z_TYPE(handler) == IS_STRING) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s()", Z_STRVAL_P(&handler)); } - /* retval is == NULL, when an exception occured, don't report anything, because PHP itself will handle that */ + /* retval is == NULL, when an exception occurred, don't report anything, because PHP itself will handle that */ } else if (retval == NULL) { } else { if (retval->type == IS_OBJECT && instanceof_function( Z_OBJCE_P(retval), dom_node_class_entry TSRMLS_CC)) { @@ -321,6 +321,7 @@ int dom_xpath_document_read(dom_object *obj, zval **retval TSRMLS_DC) xmlDoc *docp = NULL; xmlXPathContextPtr ctx; int ret; + zval *tmp; ctx = (xmlXPathContextPtr) obj->ptr; @@ -329,10 +330,16 @@ int dom_xpath_document_read(dom_object *obj, zval **retval TSRMLS_DC) } ALLOC_ZVAL(*retval); + tmp = *retval; + if (NULL == (*retval = php_dom_create_object((xmlNodePtr) docp, &ret, *retval, obj TSRMLS_CC))) { + FREE_ZVAL(tmp); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object"); return FAILURE; } + if (tmp != *retval) { + FREE_ZVAL(tmp); + } return SUCCESS; } /* }}} */ diff --git a/ext/exif/exif.c b/ext/exif/exif.c index b490ded55e2d8..9db66747421a0 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -3254,7 +3254,7 @@ static void exif_process_APP12(image_info_type *ImageInfo, char *buffer, size_t if ((l1 = php_strnlen(buffer+2, length-2)) > 0) { exif_iif_add_tag(ImageInfo, SECTION_APP12, "Company", TAG_NONE, TAG_FMT_STRING, l1, buffer+2 TSRMLS_CC); if (length > 2+l1+1) { - l2 = php_strnlen(buffer+2+l1+1, length-2-l1+1); + l2 = php_strnlen(buffer+2+l1+1, length-2-l1-1); exif_iif_add_tag(ImageInfo, SECTION_APP12, "Info", TAG_NONE, TAG_FMT_STRING, l2, buffer+2+l1+1 TSRMLS_CC); } } @@ -3404,6 +3404,10 @@ static int exif_scan_JPEG_header(image_info_type *ImageInfo TSRMLS_DC) case M_SOF13: case M_SOF14: case M_SOF15: + if ((itemlen - 2) < 6) { + return FALSE; + } + exif_process_SOFn(Data, marker, &sof_info); ImageInfo->Width = sof_info.width; ImageInfo->Height = sof_info.height; diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c index 757ba04ac14e9..e5e52f0995eac 100644 --- a/ext/fileinfo/fileinfo.c +++ b/ext/fileinfo/fileinfo.c @@ -270,7 +270,7 @@ ZEND_GET_MODULE(fileinfo) PHP_MINFO_FUNCTION(fileinfo) { php_info_print_table_start(); - php_info_print_table_header(2, "fileinfo support", "enabled"); + php_info_print_table_row(2, "fileinfo support", "enabled"); php_info_print_table_row(2, "version", PHP_FILEINFO_VERSION); php_info_print_table_end(); } diff --git a/ext/fileinfo/libmagic.patch b/ext/fileinfo/libmagic.patch index baeac1dc16ef7..30364fb978c60 100644 --- a/ext/fileinfo/libmagic.patch +++ b/ext/fileinfo/libmagic.patch @@ -1,6 +1,6 @@ -diff -u libmagic.orig/apprentice.c libmagic/apprentice.c ---- libmagic.orig/apprentice.c 2012-04-22 19:30:43.182305355 +0800 -+++ libmagic/apprentice.c 2012-04-22 19:28:57.346309536 +0800 +diff -u libmagic.origin/apprentice.c libmagic/apprentice.c +--- libmagic.origin/apprentice.c 2012-07-15 18:17:24.802087661 +0800 ++++ libmagic/apprentice.c 2012-07-15 18:22:49.650087425 +0800 @@ -29,6 +29,8 @@ * apprentice - make one pass through /etc/magic, learning its secrets. */ @@ -271,7 +271,9 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c + size_t lineno = 0; + + php_stream *stream; -+ + +- FILE *f = fopen(ms->file = fn, "r"); +- if (f == NULL) { + TSRMLS_FETCH(); + +#if PHP_API_VERSION < 20100412 @@ -279,9 +281,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c +#else + stream = php_stream_open_wrapper((char *)fn, "rb", REPORT_ERRORS, NULL); +#endif - -- FILE *f = fopen(ms->file = fn, "r"); -- if (f == NULL) { ++ + if (stream == NULL) { if (errno != ENOENT) file_error(ms, errno, "cannot read magic file `%s'", @@ -312,8 +312,12 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c } /* -@@ -757,20 +756,16 @@ - int errs = 0; +@@ -754,23 +753,19 @@ + apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, + const char *fn, int action) + { +- int errs = 0; ++ int errs = 0, mflen = 0; struct magic_entry *marray; uint32_t marraycount, i, mentrycount = 0, starttest; - size_t slen, files = 0, maxfiles = 0; @@ -352,7 +356,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c } while ((d = readdir(dir)) != NULL) { - if (asprintf(&mfn, "%s/%s", fn, d->d_name) < 0) { -+ if (snprintf(mfn, sizeof(mfn), "%s/%s", fn, d->d_name) < 0) { ++ if ((mflen = snprintf(mfn, sizeof(mfn), "%s/%s", fn, d->d_name)) < 0) { file_oomem(ms, strlen(fn) + strlen(d->d_name) + 2); errs++; @@ -364,7 +368,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c continue; } if (files >= maxfiles) { -@@ -803,7 +799,6 @@ +@@ -803,20 +799,19 @@ if ((filearr = CAST(char **, realloc(filearr, mlen))) == NULL) { file_oomem(ms, mlen); @@ -372,6 +376,21 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c closedir(dir); errs++; goto out; + } + } +- filearr[files++] = mfn; ++ filearr[files++] = estrndup(mfn, mflen); + } + closedir(dir); + qsort(filearr, files, sizeof(*filearr), cmpstrp); + for (i = 0; i < files; i++) { + load_1(ms, action, filearr[i], &errs, &marray, + &marraycount); +- free(filearr[i]); ++ efree(filearr[i]); + } + free(filearr); + } else @@ -882,12 +877,7 @@ for (i = 0; i < marraycount; i++) mentrycount += marray[i].cont_count; @@ -386,18 +405,31 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c mentrycount = 0; for (i = 0; i < marraycount; i++) { -@@ -897,8 +887,8 @@ +@@ -896,9 +886,14 @@ + mentrycount += marray[i].cont_count; } out: - for (i = 0; i < marraycount; i++) +- for (i = 0; i < marraycount; i++) - free(marray[i].mp); - free(marray); -+ efree(marray[i].mp); -+ efree(marray); ++ for (i = 0; i < marraycount; i++) { ++ if (marray[i].mp) { ++ efree(marray[i].mp); ++ } ++ } ++ if (marray) { ++ efree(marray); ++ } if (errs) { *magicp = NULL; *nmagicp = 0; -@@ -1178,11 +1168,7 @@ +@@ -1175,14 +1170,13 @@ + return -1; + } + me = &(*mentryp)[*nmentryp - 1]; ++ if (me->mp == NULL) { ++ return -1; ++ } if (me->cont_count == me->max_count) { struct magic *nm; size_t cnt = me->max_count + ALLOC_CHUNK; @@ -410,7 +442,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c me->mp = m = nm; me->max_count = CAST(uint32_t, cnt); } -@@ -1194,23 +1180,13 @@ +@@ -1194,23 +1188,13 @@ struct magic_entry *mp; maxmagic += ALLOC_INCR; @@ -437,7 +469,18 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c me->mp = m; me->max_count = ALLOC_CHUNK; } else -@@ -1361,7 +1337,7 @@ +@@ -1353,6 +1337,10 @@ + if (m->type == FILE_INVALID) { + if (ms->flags & MAGIC_CHECK) + file_magwarn(ms, "type `%s' invalid", l); ++ if (me->mp) { ++ efree(me->mp); ++ me->mp = NULL; ++ } + return -1; + } + +@@ -1361,7 +1349,7 @@ m->mask_op = 0; if (*l == '~') { @@ -446,7 +489,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c m->mask_op |= FILE_OPINVERSE; else if (ms->flags & MAGIC_CHECK) file_magwarn(ms, "'~' invalid for string types"); -@@ -1370,7 +1346,7 @@ +@@ -1370,7 +1358,7 @@ m->str_range = 0; m->str_flags = m->type == FILE_PSTRING ? PSTRING_1_LE : 0; if ((op = get_op(*l)) != -1) { @@ -455,7 +498,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c uint64_t val; ++l; m->mask_op |= op; -@@ -1558,11 +1534,6 @@ +@@ -1558,11 +1546,6 @@ if (check_format(ms, m) == -1) return -1; } @@ -467,7 +510,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c m->mimetype[0] = '\0'; /* initialise MIME type to none */ if (m->cont_level == 0) ++(*nmentryp); /* make room for next */ -@@ -2195,56 +2166,68 @@ +@@ -2195,56 +2178,69 @@ /* * handle a compiled file. @@ -542,6 +585,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c + mm = emalloc((size_t)st.sb.st_size); + if (php_stream_read(stream, mm, (size_t)st.sb.st_size) != (size_t)st.sb.st_size) { file_badread(ms); ++ ret = 1; goto error1; } -#define RET 1 @@ -559,7 +603,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c ptr = (uint32_t *)(void *)*magicp; if (*ptr != MAGICNO) { if (swap4(*ptr) != MAGICNO) { -@@ -2259,35 +2242,55 @@ +@@ -2259,35 +2255,55 @@ else version = ptr[1]; if (version != VERSIONNO) { @@ -631,7 +675,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c return -1; } -@@ -2301,42 +2304,49 @@ +@@ -2301,42 +2317,49 @@ apprentice_compile(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, const char *fn) { @@ -639,10 +683,10 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c char *dbname; int rv = -1; + php_stream *stream; ++ ++ TSRMLS_FETCH(); - dbname = mkdbname(ms, fn, 1); -+ TSRMLS_FETCH(); -+ + dbname = mkdbname(ms, fn, 0); if (dbname == NULL) @@ -692,7 +736,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c return rv; } -@@ -2349,6 +2359,7 @@ +@@ -2349,6 +2372,7 @@ { const char *p, *q; char *buf; @@ -700,7 +744,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c if (strip) { if ((p = strrchr(fn, '/')) != NULL) -@@ -2370,14 +2381,14 @@ +@@ -2370,14 +2394,14 @@ q++; /* Compatibility with old code that looked in .mime */ if (ms->flags & MAGIC_MIME) { @@ -719,7 +763,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c /* Compatibility with old code that looked in .mime */ if (strstr(p, ".mime") != NULL) -@@ -2467,7 +2478,7 @@ +@@ -2467,7 +2491,7 @@ m->offset = swap4((uint32_t)m->offset); m->in_offset = swap4((uint32_t)m->in_offset); m->lineno = swap4((uint32_t)m->lineno); @@ -728,9 +772,9 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c m->str_range = swap4(m->str_range); m->str_flags = swap4(m->str_flags); } -diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c ---- libmagic.orig/ascmagic.c 2012-04-22 19:30:43.182305355 +0800 -+++ libmagic/ascmagic.c 2012-04-22 19:28:57.330309533 +0800 +diff -u libmagic.origin/ascmagic.c libmagic/ascmagic.c +--- libmagic.origin/ascmagic.c 2012-07-15 18:17:24.762087659 +0800 ++++ libmagic/ascmagic.c 2012-07-15 18:20:42.730087520 +0800 @@ -139,10 +139,8 @@ /* malloc size is a conservative overestimate; could be improved, or at least realloced after conversion. */ @@ -754,9 +798,9 @@ diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c return rv; } -diff -u libmagic.orig/cdf.c libmagic/cdf.c ---- libmagic.orig/cdf.c 2012-04-22 19:30:43.182305355 +0800 -+++ libmagic/cdf.c 2012-04-22 19:28:57.370309531 +0800 +diff -u libmagic.origin/cdf.c libmagic/cdf.c +--- libmagic.origin/cdf.c 2012-07-15 18:17:24.822087659 +0800 ++++ libmagic/cdf.c 2012-07-15 18:20:42.730087520 +0800 @@ -43,7 +43,17 @@ #include #endif @@ -818,9 +862,9 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c cdf_print_elapsed_time(buf, sizeof(buf), tp); (void)fprintf(stderr, "timestamp %s\n", buf); } else { -diff -u libmagic.orig/cdf.h libmagic/cdf.h ---- libmagic.orig/cdf.h 2012-04-22 19:30:43.182305355 +0800 -+++ libmagic/cdf.h 2012-04-22 19:28:57.370309531 +0800 +diff -u libmagic.origin/cdf.h libmagic/cdf.h +--- libmagic.origin/cdf.h 2012-07-15 18:17:25.046087660 +0800 ++++ libmagic/cdf.h 2012-07-15 18:20:42.730087520 +0800 @@ -35,7 +35,7 @@ #ifndef _H_CDF_ #define _H_CDF_ @@ -856,9 +900,9 @@ diff -u libmagic.orig/cdf.h libmagic/cdf.h int cdf_read_header(const cdf_info_t *, cdf_header_t *); void cdf_swap_header(cdf_header_t *); void cdf_unpack_header(cdf_header_t *, char *); -diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c ---- libmagic.orig/cdf_time.c 2012-04-22 19:30:43.182305355 +0800 -+++ libmagic/cdf_time.c 2012-04-22 19:28:57.326309537 +0800 +diff -u libmagic.origin/cdf_time.c libmagic/cdf_time.c +--- libmagic.origin/cdf_time.c 2012-07-15 18:17:24.734087660 +0800 ++++ libmagic/cdf_time.c 2012-07-15 18:20:42.734087519 +0800 @@ -96,7 +96,7 @@ } @@ -915,9 +959,9 @@ diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c static const cdf_timestamp_t tst = 0x01A5E403C2D59C00ULL; static const char *ref = "Sat Apr 23 01:30:00 1977"; char *p, *q; -diff -u libmagic.orig/compress.c libmagic/compress.c ---- libmagic.orig/compress.c 2012-04-22 19:30:43.182305355 +0800 -+++ libmagic/compress.c 2012-04-22 19:28:57.314309548 +0800 +diff -u libmagic.origin/compress.c libmagic/compress.c +--- libmagic.origin/compress.c 2012-07-15 18:17:24.730087657 +0800 ++++ libmagic/compress.c 2012-07-15 18:20:42.734087519 +0800 @@ -32,6 +32,7 @@ * uncompress(method, old, n, newch) - uncompress old into new, * using method, return sizeof new @@ -1078,9 +1122,9 @@ diff -u libmagic.orig/compress.c libmagic/compress.c } -#endif +#endif /* if PHP_FILEINFO_UNCOMPRESS */ -diff -u libmagic.orig/file.h libmagic/file.h ---- libmagic.orig/file.h 2012-04-22 19:30:43.186305188 +0800 -+++ libmagic/file.h 2012-04-22 19:49:58.922256776 +0800 +diff -u libmagic.origin/file.h libmagic/file.h +--- libmagic.origin/file.h 2012-07-15 18:17:25.046087660 +0800 ++++ libmagic/file.h 2012-07-15 18:20:42.734087519 +0800 @@ -33,11 +33,9 @@ #ifndef __file_h__ #define __file_h__ @@ -1251,9 +1295,9 @@ diff -u libmagic.orig/file.h libmagic/file.h +#endif + #endif /* __file_h__ */ -diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c ---- libmagic.orig/fsmagic.c 2012-04-22 19:30:43.186305188 +0800 -+++ libmagic/fsmagic.c 2012-04-22 19:28:57.298309521 +0800 +diff -u libmagic.origin/fsmagic.c libmagic/fsmagic.c +--- libmagic.origin/fsmagic.c 2012-07-15 18:17:24.730087657 +0800 ++++ libmagic/fsmagic.c 2012-07-15 18:20:42.734087519 +0800 @@ -59,27 +59,21 @@ # define minor(dev) ((dev) & 0xff) #endif @@ -1576,9 +1620,9 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c } /* -diff -u libmagic.orig/funcs.c libmagic/funcs.c ---- libmagic.orig/funcs.c 2012-04-22 19:30:43.186305188 +0800 -+++ libmagic/funcs.c 2012-04-22 19:28:57.370309531 +0800 +diff -u libmagic.origin/funcs.c libmagic/funcs.c +--- libmagic.origin/funcs.c 2012-07-15 18:17:25.046087660 +0800 ++++ libmagic/funcs.c 2012-07-15 18:20:42.734087519 +0800 @@ -41,52 +41,42 @@ #if defined(HAVE_WCTYPE_H) #include @@ -1872,11 +1916,10 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c + return rep_cnt; } + -Only in libmagic.orig: funcs.c.orig -Only in libmagic.orig: funcs.c.rej -diff -u libmagic.orig/magic.c libmagic/magic.c ---- libmagic.orig/magic.c 2012-04-22 19:30:43.186305188 +0800 -+++ libmagic/magic.c 2012-04-22 19:28:57.370309531 +0800 +Common subdirectories: libmagic.origin/.libs and libmagic/.libs +diff -u libmagic.origin/magic.c libmagic/magic.c +--- libmagic.origin/magic.c 2012-07-15 18:17:25.046087660 +0800 ++++ libmagic/magic.c 2012-07-15 18:20:42.734087519 +0800 @@ -25,11 +25,6 @@ * SUCH DAMAGE. */ @@ -2252,9 +2295,9 @@ diff -u libmagic.orig/magic.c libmagic/magic.c public const char * magic_error(struct magic_set *ms) -diff -u libmagic.orig/magic.h libmagic/magic.h ---- libmagic.orig/magic.h 2012-04-22 19:30:43.190305058 +0800 -+++ libmagic/magic.h 2012-04-22 19:28:57.326309537 +0800 +diff -u libmagic.origin/magic.h libmagic/magic.h +--- libmagic.origin/magic.h 2012-07-15 18:17:24.734087660 +0800 ++++ libmagic/magic.h 2012-07-15 18:20:42.734087519 +0800 @@ -85,6 +85,7 @@ const char *magic_getpath(const char *, int); @@ -2271,20 +2314,20 @@ diff -u libmagic.orig/magic.h libmagic/magic.h int magic_list(magic_t, const char *); int magic_errno(magic_t); -diff -u libmagic.orig/print.c libmagic/print.c ---- libmagic.orig/print.c 2012-04-22 19:30:43.190305058 +0800 -+++ libmagic/print.c 2012-04-22 19:28:57.326309537 +0800 +diff -u libmagic.origin/print.c libmagic/print.c +--- libmagic.origin/print.c 2012-07-15 18:21:02.846087501 +0800 ++++ libmagic/print.c 2012-07-15 18:20:42.734087519 +0800 @@ -29,6 +29,9 @@ * print.c - debugging printout routines */ ++#define _GNU_SOURCE +#include "php.h" -+#include "main/snprintf.h" + #include "file.h" #ifndef lint -@@ -45,174 +48,21 @@ +@@ -46,174 +49,21 @@ #define SZOF(a) (sizeof(a) / sizeof(a[0])) @@ -2466,9 +2509,206 @@ diff -u libmagic.orig/print.c libmagic/print.c } protected const char * -diff -u libmagic.orig/readcdf.c libmagic/readcdf.c ---- libmagic.orig/readcdf.c 2012-04-22 19:30:43.190305058 +0800 -+++ libmagic/readcdf.c 2012-04-22 19:28:57.326309537 +0800 +diff -u libmagic.origin/print.c.rej libmagic/print.c.rej +--- libmagic.origin/print.c.rej 2012-07-15 18:17:24.762087659 +0800 ++++ libmagic/print.c.rej 2012-07-15 18:20:27.186087168 +0800 +@@ -1,12 +1,184 @@ +---- libmagic/print.c 2012-05-29 14:34:03.770376387 +0200 +-+++ libmagic.orig/print.c 2012-05-29 14:40:41.710960045 +0200 +-@@ -29,9 +29,6 @@ +- * print.c - debugging printout routines +- */ ++--- libmagic.orig/print.c 2012-05-29 14:40:41.710960045 +0200 +++++ libmagic/print.c 2012-05-29 14:34:03.770376387 +0200 ++@@ -48,174 +51,21 @@ + +--#include "php.h" +--#include "main/snprintf.h" ++ #define SZOF(a) (sizeof(a) / sizeof(a[0])) ++ ++-#ifndef COMPILE_ONLY ++-protected void ++-file_mdump(struct magic *m) ++-{ ++- private const char optyp[] = { FILE_OPS }; ++- ++- (void) fprintf(stderr, "%u: %.*s %u", m->lineno, ++- (m->cont_level & 7) + 1, ">>>>>>>>", m->offset); ++- ++- if (m->flag & INDIR) { ++- (void) fprintf(stderr, "(%s,", ++- /* Note: type is unsigned */ ++- (m->in_type < file_nnames) ? ++- file_names[m->in_type] : "*bad*"); ++- if (m->in_op & FILE_OPINVERSE) ++- (void) fputc('~', stderr); ++- (void) fprintf(stderr, "%c%u),", ++- ((size_t)(m->in_op & FILE_OPS_MASK) < ++- SZOF(optyp)) ? ++- optyp[m->in_op & FILE_OPS_MASK] : '?', ++- m->in_offset); ++- } ++- (void) fprintf(stderr, " %s%s", (m->flag & UNSIGNED) ? "u" : "", ++- /* Note: type is unsigned */ ++- (m->type < file_nnames) ? file_names[m->type] : "*bad*"); ++- if (m->mask_op & FILE_OPINVERSE) ++- (void) fputc('~', stderr); ++- ++- if (IS_STRING(m->type)) { ++- if (m->str_flags) { ++- (void) fputc('/', stderr); ++- if (m->str_flags & STRING_COMPACT_WHITESPACE) ++- (void) fputc(CHAR_COMPACT_WHITESPACE, stderr); ++- if (m->str_flags & STRING_COMPACT_OPTIONAL_WHITESPACE) ++- (void) fputc(CHAR_COMPACT_OPTIONAL_WHITESPACE, ++- stderr); ++- if (m->str_flags & STRING_IGNORE_LOWERCASE) ++- (void) fputc(CHAR_IGNORE_LOWERCASE, stderr); ++- if (m->str_flags & STRING_IGNORE_UPPERCASE) ++- (void) fputc(CHAR_IGNORE_UPPERCASE, stderr); ++- if (m->str_flags & REGEX_OFFSET_START) ++- (void) fputc(CHAR_REGEX_OFFSET_START, stderr); ++- if (m->str_flags & STRING_TEXTTEST) ++- (void) fputc(CHAR_TEXTTEST, stderr); ++- if (m->str_flags & STRING_BINTEST) ++- (void) fputc(CHAR_BINTEST, stderr); ++- if (m->str_flags & PSTRING_1_BE) ++- (void) fputc(CHAR_PSTRING_1_BE, stderr); ++- if (m->str_flags & PSTRING_2_BE) ++- (void) fputc(CHAR_PSTRING_2_BE, stderr); ++- if (m->str_flags & PSTRING_2_LE) ++- (void) fputc(CHAR_PSTRING_2_LE, stderr); ++- if (m->str_flags & PSTRING_4_BE) ++- (void) fputc(CHAR_PSTRING_4_BE, stderr); ++- if (m->str_flags & PSTRING_4_LE) ++- (void) fputc(CHAR_PSTRING_4_LE, stderr); ++- if (m->str_flags & PSTRING_LENGTH_INCLUDES_ITSELF) ++- (void) fputc( ++- CHAR_PSTRING_LENGTH_INCLUDES_ITSELF, ++- stderr); ++- } ++- if (m->str_range) ++- (void) fprintf(stderr, "/%u", m->str_range); ++- } ++- else { ++- if ((size_t)(m->mask_op & FILE_OPS_MASK) < SZOF(optyp)) ++- (void) fputc(optyp[m->mask_op & FILE_OPS_MASK], stderr); ++- else ++- (void) fputc('?', stderr); ++- ++- if (m->num_mask) { ++- (void) fprintf(stderr, "%.8llx", ++- (unsigned long long)m->num_mask); ++- } ++- } ++- (void) fprintf(stderr, ",%c", m->reln); ++- ++- if (m->reln != 'x') { ++- switch (m->type) { ++- case FILE_BYTE: ++- case FILE_SHORT: ++- case FILE_LONG: ++- case FILE_LESHORT: ++- case FILE_LELONG: ++- case FILE_MELONG: ++- case FILE_BESHORT: ++- case FILE_BELONG: ++- (void) fprintf(stderr, "%d", m->value.l); ++- break; ++- case FILE_BEQUAD: ++- case FILE_LEQUAD: ++- case FILE_QUAD: ++- (void) fprintf(stderr, "%" INT64_T_FORMAT "d", ++- (unsigned long long)m->value.q); ++- break; ++- case FILE_PSTRING: ++- case FILE_STRING: ++- case FILE_REGEX: ++- case FILE_BESTRING16: ++- case FILE_LESTRING16: ++- case FILE_SEARCH: ++- file_showstr(stderr, m->value.s, (size_t)m->vallen); ++- break; ++- case FILE_DATE: ++- case FILE_LEDATE: ++- case FILE_BEDATE: ++- case FILE_MEDATE: ++- (void)fprintf(stderr, "%s,", ++- file_fmttime(m->value.l, 1)); ++- break; ++- case FILE_LDATE: ++- case FILE_LELDATE: ++- case FILE_BELDATE: ++- case FILE_MELDATE: ++- (void)fprintf(stderr, "%s,", ++- file_fmttime(m->value.l, 0)); ++- break; ++- case FILE_QDATE: ++- case FILE_LEQDATE: ++- case FILE_BEQDATE: ++- (void)fprintf(stderr, "%s,", ++- file_fmttime((uint32_t)m->value.q, 1)); ++- break; ++- case FILE_QLDATE: ++- case FILE_LEQLDATE: ++- case FILE_BEQLDATE: ++- (void)fprintf(stderr, "%s,", ++- file_fmttime((uint32_t)m->value.q, 0)); ++- break; ++- case FILE_FLOAT: ++- case FILE_BEFLOAT: ++- case FILE_LEFLOAT: ++- (void) fprintf(stderr, "%G", m->value.f); ++- break; ++- case FILE_DOUBLE: ++- case FILE_BEDOUBLE: ++- case FILE_LEDOUBLE: ++- (void) fprintf(stderr, "%G", m->value.d); ++- break; ++- case FILE_DEFAULT: ++- /* XXX - do anything here? */ ++- break; ++- default: ++- (void) fputs("*bad*", stderr); ++- break; ++- } ++- } ++- (void) fprintf(stderr, ",\"%s\"]\n", m->desc); ++-} ++-#endif ++- ++ /*VARARGS*/ ++ protected void ++ file_magwarn(struct magic_set *ms, const char *f, ...) ++ { ++ va_list va; +++ char *expanded_format; +++ TSRMLS_FETCH(); ++ ++- /* cuz we use stdout for most, stderr here */ ++- (void) fflush(stdout); + - +- #include "file.h" ++- if (ms->file) ++- (void) fprintf(stderr, "%s, %lu: ", ms->file, ++- (unsigned long)ms->line); ++- (void) fprintf(stderr, "Warning: "); ++ va_start(va, f); ++- (void) vfprintf(stderr, f, va); +++ vasprintf(&expanded_format, f, va); ++ va_end(va); ++- (void) fputc('\n', stderr); +++ +++ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Warning: %s", expanded_format); +++ +++ free(expanded_format); ++ } + +- #ifndef lint ++ protected const char * +diff -u libmagic.origin/readcdf.c libmagic/readcdf.c +--- libmagic.origin/readcdf.c 2012-07-15 18:17:24.734087660 +0800 ++++ libmagic/readcdf.c 2012-07-15 18:20:42.734087519 +0800 @@ -30,7 +30,11 @@ #endif @@ -2514,9 +2754,9 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c c = cdf_ctime(&ts.tv_sec); if ((ec = strchr(c, '\n')) != NULL) *ec = '\0'; -diff -u libmagic.orig/readelf.c libmagic/readelf.c ---- libmagic.orig/readelf.c 2012-04-22 19:30:43.190305058 +0800 -+++ libmagic/readelf.c 2012-04-22 19:28:57.378309534 +0800 +diff -u libmagic.origin/readelf.c libmagic/readelf.c +--- libmagic.origin/readelf.c 2012-07-15 18:17:25.046087660 +0800 ++++ libmagic/readelf.c 2012-07-15 18:20:42.734087519 +0800 @@ -49,7 +49,7 @@ off_t, int *, int); private int doshn(struct magic_set *, int, int, int, off_t, int, size_t, @@ -2671,9 +2911,9 @@ diff -u libmagic.orig/readelf.c libmagic/readelf.c fd = file_pipe2file(ms, fd, buf, nbytes); if (fstat(fd, &st) == -1) { -diff -u libmagic.orig/softmagic.c libmagic/softmagic.c ---- libmagic.orig/softmagic.c 2012-04-22 19:30:43.194304945 +0800 -+++ libmagic/softmagic.c 2012-04-22 19:28:57.286309597 +0800 +diff -u libmagic.origin/softmagic.c libmagic/softmagic.c +--- libmagic.origin/softmagic.c 2012-07-15 18:17:24.722087658 +0800 ++++ libmagic/softmagic.c 2012-07-15 18:20:42.734087519 +0800 @@ -41,6 +41,11 @@ #include #include @@ -2860,7 +3100,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c } } -@@ -1669,6 +1642,65 @@ +@@ -1669,6 +1642,42 @@ return file_strncmp(a, b, len, flags); } @@ -2876,29 +3116,6 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c + + for (i=0; isearch.s == NULL) - return 0; - -+ zval *pattern; -+ int options = 0; -+ pcre_cache_entry *pce; -+ TSRMLS_FETCH(); -+ -+ MAKE_STD_ZVAL(pattern); -+ ZVAL_STRINGL(pattern, (char *)m->value.s, m->vallen, 0); -+ -+ options |= PCRE_MULTILINE; -+ -+ if (m->str_flags & STRING_IGNORE_CASE) { -+ options |= PCRE_CASELESS; -+ } -+ -+ convert_libmagic_pattern(pattern, options); -+ - l = 0; +- l = 0; - rc = regcomp(&rx, m->value.s, - REG_EXTENDED|REG_NEWLINE| - ((m->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0)); @@ -2970,6 +3171,23 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c - size_t l = ms->search.s_len - 1; - char c = ms->search.s[l]; - ((char *)(intptr_t)ms->search.s)[l] = '\0'; ++ zval *pattern; ++ int options = 0; ++ pcre_cache_entry *pce; ++ TSRMLS_FETCH(); ++ ++ MAKE_STD_ZVAL(pattern); ++ ZVAL_STRINGL(pattern, (char *)m->value.s, m->vallen, 0); ++ ++ options |= PCRE_MULTILINE; ++ ++ if (m->str_flags & STRING_IGNORE_CASE) { ++ options |= PCRE_CASELESS; ++ } ++ ++ convert_libmagic_pattern(pattern, options); ++ ++ l = v = 0; +#if (PHP_MAJOR_VERSION < 6) + if ((pce = pcre_get_compiled_regex_cache(Z_STRVAL_P(pattern), Z_STRLEN_P(pattern) TSRMLS_CC)) == NULL) { #else diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c index 4a54849e070e9..98bde27a2d784 100644 --- a/ext/fileinfo/libmagic/apprentice.c +++ b/ext/fileinfo/libmagic/apprentice.c @@ -753,7 +753,7 @@ private int apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, const char *fn, int action) { - int errs = 0; + int errs = 0, mflen = 0; struct magic_entry *marray; uint32_t marraycount, i, mentrycount = 0, starttest; size_t files = 0, maxfiles = 0; @@ -782,7 +782,7 @@ apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, goto out; } while ((d = readdir(dir)) != NULL) { - if (snprintf(mfn, sizeof(mfn), "%s/%s", fn, d->d_name) < 0) { + if ((mflen = snprintf(mfn, sizeof(mfn), "%s/%s", fn, d->d_name)) < 0) { file_oomem(ms, strlen(fn) + strlen(d->d_name) + 2); errs++; @@ -804,14 +804,14 @@ apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, goto out; } } - filearr[files++] = mfn; + filearr[files++] = estrndup(mfn, mflen); } closedir(dir); qsort(filearr, files, sizeof(*filearr), cmpstrp); for (i = 0; i < files; i++) { load_1(ms, action, filearr[i], &errs, &marray, &marraycount); - free(filearr[i]); + efree(filearr[i]); } free(filearr); } else @@ -886,9 +886,14 @@ apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, mentrycount += marray[i].cont_count; } out: - for (i = 0; i < marraycount; i++) - efree(marray[i].mp); - efree(marray); + for (i = 0; i < marraycount; i++) { + if (marray[i].mp) { + efree(marray[i].mp); + } + } + if (marray) { + efree(marray); + } if (errs) { *magicp = NULL; *nmagicp = 0; @@ -1165,6 +1170,9 @@ parse(struct magic_set *ms, struct magic_entry **mentryp, uint32_t *nmentryp, return -1; } me = &(*mentryp)[*nmentryp - 1]; + if (me->mp == NULL) { + return -1; + } if (me->cont_count == me->max_count) { struct magic *nm; size_t cnt = me->max_count + ALLOC_CHUNK; @@ -1329,6 +1337,10 @@ parse(struct magic_set *ms, struct magic_entry **mentryp, uint32_t *nmentryp, if (m->type == FILE_INVALID) { if (ms->flags & MAGIC_CHECK) file_magwarn(ms, "type `%s' invalid", l); + if (me->mp) { + efree(me->mp); + me->mp = NULL; + } return -1; } @@ -2219,6 +2231,7 @@ apprentice_map(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, mm = emalloc((size_t)st.sb.st_size); if (php_stream_read(stream, mm, (size_t)st.sb.st_size) != (size_t)st.sb.st_size) { file_badread(ms); + ret = 1; goto error1; } ret = 1; diff --git a/ext/fileinfo/libmagic/softmagic.c b/ext/fileinfo/libmagic/softmagic.c index 648f641697fef..f9c2836dd26ba 100644 --- a/ext/fileinfo/libmagic/softmagic.c +++ b/ext/fileinfo/libmagic/softmagic.c @@ -1654,29 +1654,6 @@ convert_libmagic_pattern(zval *pattern, int options) for (i=0; i +--FILE-- + Core\n> Me"); +file_put_contents($dir . "/test2.txt", "a\nb\n"); +@mkdir($dir . "/test-inner-folder"); + +finfo_open(FILEINFO_NONE, $dir); +echo "DONE: testing dir with files\n"; + +rmdir($dir . "/test-inner-folder"); +unlink($dir . "/test1.txt"); +unlink($dir . "/test2.txt"); + +unlink($magic_file_copy); +unlink($magic_file_copy2); +rmdir($dir); +?> +===DONE=== +--EXPECTF-- +bool(false) +resource(%d) of type (file_info) +resource(%d) of type (file_info) +bool(false) + +Notice: finfo_open(): Warning: offset `string' invalid in %sbug61964.php on line %d + +Notice: finfo_open(): Warning: offset ` Core' invalid in %sbug61964.php on line %d + +Notice: finfo_open(): Warning: type `Core' invalid in %sbug61964.php on line %d + +Notice: finfo_open(): Warning: offset `a' invalid in %sbug61964.php on line %d + +Notice: finfo_open(): Warning: type `a' invalid in %sbug61964.php on line %d + +Notice: finfo_open(): Warning: offset `b' invalid in %sbug61964.php on line %d + +Notice: finfo_open(): Warning: type `b' invalid in %sbug61964.php on line %d + +Warning: finfo_open(): Failed to load magic database at '%stest-folder'. in %sbug61964.php on line %d +DONE: testing dir with files +===DONE=== diff --git a/ext/fileinfo/tests/finfo_file_002.phpt b/ext/fileinfo/tests/finfo_file_002.phpt index 9ed19a9762eea..3593233c3996c 100644 --- a/ext/fileinfo/tests/finfo_file_002.phpt +++ b/ext/fileinfo/tests/finfo_file_002.phpt @@ -18,9 +18,11 @@ ksort($results); var_dump($results); ?> --EXPECTF-- -array(6) { +array(7) { ["%s/resources/dir.zip"]=> string(15) "application/zip" + ["%s/resources/test.awk"]=> + string(10) "text/plain" ["%s/resources/test.bmp"]=> string(14) "image/x-ms-bmp" ["%s/resources/test.gif"]=> diff --git a/ext/fileinfo/tests/finfo_file_regex-win32.phpt b/ext/fileinfo/tests/finfo_file_regex-win32.phpt new file mode 100644 index 0000000000000..1eda48c4d072c --- /dev/null +++ b/ext/fileinfo/tests/finfo_file_regex-win32.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test finfo_file() function : regex rules +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing finfo_file() : regex rules *** +string(10) "text/plain" +string(22) "awk script, ASCII text" +===DONE=== diff --git a/ext/fileinfo/tests/finfo_file_regex.phpt b/ext/fileinfo/tests/finfo_file_regex.phpt new file mode 100644 index 0000000000000..ee4c8b0b7a2bc --- /dev/null +++ b/ext/fileinfo/tests/finfo_file_regex.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test finfo_file() function : regex rules +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing finfo_file() : regex rules *** +string(28) "text/plain; charset=us-ascii" +string(22) "awk script, ASCII text" +===DONE=== diff --git a/ext/fileinfo/tests/finfo_open_error-win32.phpt b/ext/fileinfo/tests/finfo_open_error-win32.phpt new file mode 100644 index 0000000000000..0260ca5708c2e --- /dev/null +++ b/ext/fileinfo/tests/finfo_open_error-win32.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test finfo_open() function : error functionality +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing finfo_open() : error functionality *** + +Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error-win32.php on line %d + +Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error-win32.php on line %d + +Warning: finfo_open(): Failed to load magic database at '%sfoobarfile'. in %sfinfo_open_error-win32.php on line %d +bool(false) + +Warning: finfo_open() expects parameter 1 to be long, array given in %sfinfo_open_error-win32.php on line %d +bool(false) + +Warning: finfo_open() expects at most 2 parameters, 3 given in %sfinfo_open_error-win32.php on line %d +bool(false) +resource(6) of type (file_info) + +Warning: finfo_open() expects parameter 1 to be long, string given in %sfinfo_open_error-win32.php on line %d +bool(false) + +Warning: finfo::finfo() expects parameter 1 to be long, string given in %sfinfo_open_error-win32.php on line %d +NULL +===DONE=== diff --git a/ext/fileinfo/tests/finfo_open_error.phpt b/ext/fileinfo/tests/finfo_open_error.phpt index 19ae7a601335b..5d1eff5973b77 100644 --- a/ext/fileinfo/tests/finfo_open_error.phpt +++ b/ext/fileinfo/tests/finfo_open_error.phpt @@ -1,7 +1,10 @@ --TEST-- Test finfo_open() function : error functionality --SKIPIF-- - + --FILE-- +--FILE-- + +--EXPECTF-- +string(1) "3" +string(2) "41" +string(4) "-112" +string(1) "1" +string(4) "-805" +string(3) "359" +string(1) "3" +string(2) "32" +string(5) "-2257" +string(4) "3003" +string(3) "-10" +string(2) "19" +string(1) "2" +string(2) "67" +string(2) "-3" +string(2) "15" +string(7) "-601519" +string(1) "6" +string(3) "345" +string(1) "1" +string(1) "0" +string(1) "1" +string(5) "84319" +string(9) "-84241831" +string(1) "1" +string(12) "167180205823" +string(15) "-17856272782919" +string(3) "195" +string(15) "-23387298979862" +string(11) "34225091793" + +Warning: gmp_gcdext(): Unable to convert variable to GMP - wrong type in %s on line %d +bool(false) + +Warning: gmp_gcdext(): Unable to convert variable to GMP - wrong type in %s on line %d +bool(false) + +Warning: gmp_gcdext() expects exactly 2 parameters, 3 given in %s on line %d +NULL + +Warning: gmp_gcdext() expects exactly 2 parameters, 1 given in %s on line %d +NULL + +Warning: gmp_gcdext() expects exactly 2 parameters, 0 given in %s on line %d +NULL +Done + diff --git a/ext/gmp/tests/022.phpt b/ext/gmp/tests/022.phpt index 805c9b6753936..f699e8283d90e 100644 --- a/ext/gmp/tests/022.phpt +++ b/ext/gmp/tests/022.phpt @@ -1,7 +1,11 @@ --TEST-- gmp_gcdext() basic tests --SKIPIF-- - + --FILE-- +--FILE-- + +--EXPECTF-- +string(1) "2" +string(1) "2" +string(4) "-997" +string(4) "1009" +string(6) "100003" + +Warning: gmp_nextprime(): Unable to convert variable to GMP - wrong type in %s on line %d +string(1) "0" +string(1) "0" + +Warning: gmp_nextprime(): Unable to convert variable to GMP - wrong type in %s on line %d +string(1) "0" +Done + diff --git a/ext/gmp/tests/gmp_nextprime.phpt b/ext/gmp/tests/gmp_nextprime.phpt index 65506ce13b1fa..623ccbed0705c 100644 --- a/ext/gmp/tests/gmp_nextprime.phpt +++ b/ext/gmp/tests/gmp_nextprime.phpt @@ -1,7 +1,11 @@ --TEST-- gmp_nextprime() --SKIPIF-- - + --FILE-- #include "php_hash.h" #include "ext/standard/info.h" #include "ext/standard/file.h" @@ -202,10 +203,45 @@ PHP_FUNCTION(hash_file) } /* }}} */ +static inline void php_hash_string_xor_char(unsigned char *out, const unsigned char *in, const unsigned char xor_with, const int length) { + int i; + for (i=0; i < length; i++) { + out[i] = in[i] ^ xor_with; + } +} + +static inline void php_hash_string_xor(unsigned char *out, const unsigned char *in, const unsigned char *xor_with, const int length) { + int i; + for (i=0; i < length; i++) { + out[i] = in[i] ^ xor_with[i]; + } +} + +static inline void php_hash_hmac_prep_key(unsigned char *K, const php_hash_ops *ops, void *context, const unsigned char *key, const int key_len) { + memset(K, 0, ops->block_size); + if (key_len > ops->block_size) { + /* Reduce the key first */ + ops->hash_init(context); + ops->hash_update(context, key, key_len); + ops->hash_final(K, context); + } else { + memcpy(K, key, key_len); + } + /* XOR the key with 0x36 to get the ipad) */ + php_hash_string_xor_char(K, K, 0x36, ops->block_size); +} + +static inline void php_hash_hmac_round(unsigned char *final, const php_hash_ops *ops, void *context, const unsigned char *key, const unsigned char *data, const long data_size) { + ops->hash_init(context); + ops->hash_update(context, key, ops->block_size); + ops->hash_update(context, data, data_size); + ops->hash_final(final, context); +} + static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename, zend_bool raw_output_default) /* {{{ */ { char *algo, *data, *digest, *key, *K; - int algo_len, data_len, key_len, i; + int algo_len, data_len, key_len; zend_bool raw_output = raw_output_default; const php_hash_ops *ops; void *context; @@ -230,52 +266,29 @@ static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename, } context = emalloc(ops->context_size); - ops->hash_init(context); K = emalloc(ops->block_size); - memset(K, 0, ops->block_size); + digest = emalloc(ops->digest_size + 1); - if (key_len > ops->block_size) { - /* Reduce the key first */ - ops->hash_update(context, (unsigned char *) key, key_len); - ops->hash_final((unsigned char *) K, context); - /* Make the context ready to start over */ - ops->hash_init(context); - } else { - memcpy(K, key, key_len); - } - - /* XOR ipad */ - for(i=0; i < ops->block_size; i++) { - K[i] ^= 0x36; - } - ops->hash_update(context, (unsigned char *) K, ops->block_size); + php_hash_hmac_prep_key((unsigned char *) K, ops, context, (unsigned char *) key, key_len); if (isfilename) { char buf[1024]; int n; - + ops->hash_init(context); + ops->hash_update(context, (unsigned char *) K, ops->block_size); while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) { ops->hash_update(context, (unsigned char *) buf, n); } php_stream_close(stream); + ops->hash_final((unsigned char *) digest, context); } else { - ops->hash_update(context, (unsigned char *) data, data_len); + php_hash_hmac_round((unsigned char *) digest, ops, context, (unsigned char *) K, (unsigned char *) data, data_len); } - digest = emalloc(ops->digest_size + 1); - ops->hash_final((unsigned char *) digest, context); - - /* Convert K to opad -- 0x6A = 0x36 ^ 0x5C */ - for(i=0; i < ops->block_size; i++) { - K[i] ^= 0x6A; - } + php_hash_string_xor_char((unsigned char *) K, (unsigned char *) K, 0x6A, ops->block_size); - /* Feed this result into the outter hash */ - ops->hash_init(context); - ops->hash_update(context, (unsigned char *) K, ops->block_size); - ops->hash_update(context, (unsigned char *) digest, ops->digest_size); - ops->hash_final((unsigned char *) digest, context); + php_hash_hmac_round((unsigned char *) digest, ops, context, (unsigned char *) K, (unsigned char *) digest, ops->digest_size); /* Zero the key */ memset(K, 0, ops->block_size); @@ -591,6 +604,128 @@ PHP_FUNCTION(hash_algos) } /* }}} */ +/* {{{ proto string hash_pbkdf2(string algo, string password, string salt, int iterations [, int length = 0, bool raw_output = false]) +Generate a PBKDF2 hash of the given password and salt +Returns lowercase hexits by default */ +PHP_FUNCTION(hash_pbkdf2) +{ + char *returnval, *algo, *salt, *pass = NULL; + unsigned char *computed_salt, *digest, *temp, *result, *K1, *K2 = NULL; + long loops, i, j, algo_len, pass_len, iterations, length, digest_length = 0; + int argc, salt_len = 0; + zend_bool raw_output = 0; + const php_hash_ops *ops; + void *context; + + argc = ZEND_NUM_ARGS(); + if (zend_parse_parameters(argc TSRMLS_CC, "sssl|lb", &algo, &algo_len, &pass, &pass_len, &salt, &salt_len, &iterations, &length, &raw_output) == FAILURE) { + return; + } + + ops = php_hash_fetch_ops(algo, algo_len); + if (!ops) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown hashing algorithm: %s", algo); + RETURN_FALSE; + } + + if (iterations <= 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Iterations must be a positive integer: %ld", iterations); + RETURN_FALSE; + } + + if (length < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length must be greater than or equal to 0: %ld", length); + RETURN_FALSE; + } + + if (salt_len > INT_MAX - 4) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Supplied salt is too long, max of INT_MAX - 4 bytes: %d supplied", salt_len); + RETURN_FALSE; + } + + context = emalloc(ops->context_size); + ops->hash_init(context); + + K1 = emalloc(ops->block_size); + K2 = emalloc(ops->block_size); + digest = emalloc(ops->digest_size); + temp = emalloc(ops->digest_size); + + /* Setup Keys that will be used for all hmac rounds */ + php_hash_hmac_prep_key(K1, ops, context, (unsigned char *) pass, pass_len); + /* Convert K1 to opad -- 0x6A = 0x36 ^ 0x5C */ + php_hash_string_xor_char(K2, K1, 0x6A, ops->block_size); + + /* Setup Main Loop to build a long enough result */ + if (length == 0) { + length = ops->digest_size; + } + digest_length = length; + if (!raw_output) { + digest_length = (long) ceil((float) length / 2.0); + } + + loops = (long) ceil((float) digest_length / (float) ops->digest_size); + + result = safe_emalloc(loops, ops->digest_size, 0); + + computed_salt = safe_emalloc(salt_len, 1, 4); + memcpy(computed_salt, (unsigned char *) salt, salt_len); + + for (i = 1; i <= loops; i++) { + /* digest = hash_hmac(salt + pack('N', i), password) { */ + + /* pack("N", i) */ + computed_salt[salt_len] = (unsigned char) (i >> 24); + computed_salt[salt_len + 1] = (unsigned char) ((i & 0xFF0000) >> 16); + computed_salt[salt_len + 2] = (unsigned char) ((i & 0xFF00) >> 8); + computed_salt[salt_len + 3] = (unsigned char) (i & 0xFF); + + php_hash_hmac_round(digest, ops, context, K1, computed_salt, (long) salt_len + 4); + php_hash_hmac_round(digest, ops, context, K2, digest, ops->digest_size); + /* } */ + + /* temp = digest */ + memcpy(temp, digest, ops->digest_size); + + /* + * Note that the loop starting at 1 is intentional, since we've already done + * the first round of the algorithm. + */ + for (j = 1; j < iterations; j++) { + /* digest = hash_hmac(digest, password) { */ + php_hash_hmac_round(digest, ops, context, K1, digest, ops->digest_size); + php_hash_hmac_round(digest, ops, context, K2, digest, ops->digest_size); + /* } */ + /* temp ^= digest */ + php_hash_string_xor(temp, temp, digest, ops->digest_size); + } + /* result += temp */ + memcpy(result + ((i - 1) * ops->digest_size), temp, ops->digest_size); + } + /* Zero potentially sensitive variables */ + memset(K1, 0, ops->block_size); + memset(K2, 0, ops->block_size); + memset(computed_salt, 0, salt_len + 4); + efree(K1); + efree(K2); + efree(computed_salt); + efree(context); + efree(digest); + efree(temp); + + returnval = safe_emalloc(length, 1, 1); + if (raw_output) { + memcpy(returnval, result, length); + } else { + php_hash_bin2hex(returnval, result, digest_length); + } + returnval[length] = 0; + efree(result); + RETURN_STRINGL(returnval, length, 0); +} +/* }}} */ + /* Module Housekeeping */ static void php_hash_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */ @@ -1003,6 +1138,15 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_hash_algos, 0) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_pbkdf2, 0, 0, 4) + ZEND_ARG_INFO(0, algo) + ZEND_ARG_INFO(0, password) + ZEND_ARG_INFO(0, salt) + ZEND_ARG_INFO(0, iterations) + ZEND_ARG_INFO(0, length) + ZEND_ARG_INFO(0, raw_output) +ZEND_END_ARG_INFO() + /* BC Land */ #ifdef PHP_MHASH_BC ZEND_BEGIN_ARG_INFO(arginfo_mhash_get_block_size, 0) @@ -1049,6 +1193,7 @@ const zend_function_entry hash_functions[] = { PHP_FE(hash_copy, arginfo_hash_copy) PHP_FE(hash_algos, arginfo_hash_algos) + PHP_FE(hash_pbkdf2, arginfo_hash_pbkdf2) /* BC Land */ #ifdef PHP_HASH_MD5_NOT_IN_CORE @@ -1105,3 +1250,4 @@ ZEND_GET_MODULE(hash) * vim600: noet sw=4 ts=4 fdm=marker * vim<600: noet sw=4 ts=4 */ + diff --git a/ext/hash/php_hash.h b/ext/hash/php_hash.h index 87050cb8e52af..7bc72a2bcb140 100644 --- a/ext/hash/php_hash.h +++ b/ext/hash/php_hash.h @@ -127,6 +127,7 @@ PHP_FUNCTION(hash_update_stream); PHP_FUNCTION(hash_update_file); PHP_FUNCTION(hash_final); PHP_FUNCTION(hash_algos); +PHP_FUNCTION(hash_pbkdf2); PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(const char *algo, int algo_len); PHP_HASH_API void php_hash_register_algo(const char *algo, const php_hash_ops *ops); diff --git a/ext/hash/tests/hash_pbkdf2_basic.phpt b/ext/hash/tests/hash_pbkdf2_basic.phpt new file mode 100644 index 0000000000000..fdccc4b6ea460 --- /dev/null +++ b/ext/hash/tests/hash_pbkdf2_basic.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test hash_pbkdf2() function : basic functionality +--SKIPIF-- + +--FILE-- + +===Done=== +--EXPECT-- +*** Testing hash_pbkdf2() : basic functionality *** +sha1: 0c60c80f961f0e71f3a9 +sha1(raw): 0c60c80f961f0e71f3a9b524af6012062fe037a6 +sha1(rounds): 3d2eec4fe41c849b80c8d8366 +sha1(rounds)(raw): 3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038 +sha256: 120fb6cffcf8b32c43e7 +sha256(raw): 120fb6cffcf8b32c43e7225256c4f837a86548c9 +sha256(rounds): 348c89dbcbd32b2f32d814b8116e84cf2b17347e +sha256(rounds)(raw): 348c89dbcbd32b2f32d814b8116e84cf2b17347ebc1800181c4e2a1fb8dd53e1c635518c7dac47e9 +===Done=== diff --git a/ext/hash/tests/hash_pbkdf2_error.phpt b/ext/hash/tests/hash_pbkdf2_error.phpt new file mode 100644 index 0000000000000..fd70cca581ea8 --- /dev/null +++ b/ext/hash/tests/hash_pbkdf2_error.phpt @@ -0,0 +1,78 @@ +--TEST-- +Test hash_pbkdf2() function : error functionality +--SKIPIF-- + +--FILE-- + +===Done=== +--EXPECT-- +*** Testing hash_pbkdf2() : error conditions *** + +-- Testing hash_pbkdf2() function with less than expected no. of arguments -- +NULL +hash_pbkdf2() expects at least 4 parameters, 0 given +NULL +hash_pbkdf2() expects at least 4 parameters, 1 given +NULL +hash_pbkdf2() expects at least 4 parameters, 2 given +NULL +hash_pbkdf2() expects at least 4 parameters, 3 given + +-- Testing hash_pbkdf2() function with more than expected no. of arguments -- +NULL +hash_pbkdf2() expects at most 6 parameters, 7 given + +-- Testing hash_pbkdf2() function with invalid hash algorithm -- +bool(false) +hash_pbkdf2(): Unknown hashing algorithm: foo + +-- Testing hash_pbkdf2() function with invalid iterations -- +bool(false) +hash_pbkdf2(): Iterations must be a positive integer: 0 +bool(false) +hash_pbkdf2(): Iterations must be a positive integer: -1 + +-- Testing hash_pbkdf2() function with invalid length -- +bool(false) +hash_pbkdf2(): Length must be greater than or equal to 0: -1 + +===Done=== diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index 92675eb128676..9cae535138eb1 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -190,7 +190,7 @@ typedef enum _php_iconv_enc_scheme_t { #define PHP_ICONV_MIME_DECODE_STRICT (1<<0) #define PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR (1<<1) -/* {{{ prototypes */ +/* {{{ prototypes */ static php_iconv_err_t _php_iconv_appendl(smart_str *d, const char *s, size_t l, iconv_t cd); static php_iconv_err_t _php_iconv_appendc(smart_str *d, const char c, iconv_t cd); @@ -249,7 +249,7 @@ PHP_MINIT_FUNCTION(miconv) { static char buf[16]; snprintf(buf, sizeof(buf), "%d.%d", - ((_libiconv_version >> 8) & 0x0f), (_libiconv_version & 0x0f)); + ((_libiconv_version >> 8) & 0x0f), (_libiconv_version & 0x0f)); version = buf; } #elif HAVE_GLIBC_ICONV @@ -354,7 +354,7 @@ static int php_iconv_output_handler(void **nothing, php_output_context *output_c if (mimetype != NULL && !(output_context->op & PHP_OUTPUT_HANDLER_CLEAN)) { int len; - char *p = strstr(ICONVG(output_encoding), "//"); + char *p = strstr(ICONVG(output_encoding), "//"); if (p) { len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%.*s", mimetype_len ? mimetype_len : (int) strlen(mimetype), mimetype, (int)(p - ICONVG(output_encoding)), ICONVG(output_encoding)); @@ -375,7 +375,7 @@ static int php_iconv_output_handler(void **nothing, php_output_context *output_c return SUCCESS; } - + /* {{{ _php_iconv_appendl() */ static php_iconv_err_t _php_iconv_appendl(smart_str *d, const char *s, size_t l, iconv_t cd) { @@ -400,7 +400,7 @@ static php_iconv_err_t _php_iconv_appendl(smart_str *d, const char *s, size_t l, if (iconv(cd, (char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) { #if ICONV_SUPPORTS_ERRNO - switch (errno) { + switch (errno) { case EINVAL: return PHP_ICONV_ERR_ILLEGAL_CHAR; @@ -415,7 +415,7 @@ static php_iconv_err_t _php_iconv_appendl(smart_str *d, const char *s, size_t l, } #else if (prev_in_left == in_left) { - return PHP_ICONV_ERR_UNKNOWN; + return PHP_ICONV_ERR_UNKNOWN; } #endif } @@ -446,7 +446,7 @@ static php_iconv_err_t _php_iconv_appendl(smart_str *d, const char *s, size_t l, #else if (out_left != 0) { return PHP_ICONV_ERR_UNKNOWN; - } + } #endif } (d)->len += (buf_growth - out_left); @@ -492,31 +492,35 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len, in_size = in_len; cd = iconv_open(out_charset, in_charset); - + if (cd == (iconv_t)(-1)) { return PHP_ICONV_ERR_UNKNOWN; } out_buffer = (char *) emalloc(out_size + 1); out_p = out_buffer; - + #ifdef NETWARE result = iconv(cd, (char **) &in_p, &in_size, (char **) #else result = iconv(cd, (const char **) &in_p, &in_size, (char **) #endif &out_p, &out_left); - + if (result == (size_t)(-1)) { efree(out_buffer); return PHP_ICONV_ERR_UNKNOWN; } if (out_left < 8) { - out_buffer = (char *) erealloc(out_buffer, out_size + 8); + size_t pos = out_p - out_buffer; + out_buffer = (char *) safe_erealloc(out_buffer, out_size, 1, 8); + out_p = out_buffer+pos; + out_size += 7; + out_left += 7; } - /* flush the shift-out sequences */ + /* flush the shift-out sequences */ result = iconv(cd, NULL, NULL, &out_p, &out_left); if (result == (size_t)(-1)) { @@ -555,10 +559,10 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len, } } in_left= in_len; - out_left = in_len + 32; /* Avoid realloc() most cases */ + out_left = in_len + 32; /* Avoid realloc() most cases */ out_size = 0; bsz = out_left; - out_buf = (char *) emalloc(bsz+1); + out_buf = (char *) emalloc(bsz+1); out_p = out_buf; while (in_left > 0) { @@ -573,14 +577,14 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len, out_p = out_buf = tmp_buf; out_p += out_size; out_left = bsz - out_size; - continue; + continue; } } break; } if (result != (size_t)(-1)) { - /* flush the shift-out sequences */ + /* flush the shift-out sequences */ for (;;) { result = iconv(cd, NULL, NULL, (char **) &out_p, &out_left); out_size = bsz - out_left; @@ -592,7 +596,7 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len, if (errno == E2BIG) { bsz += 16; tmp_buf = (char *) erealloc(out_buf, bsz); - + out_p = out_buf = tmp_buf; out_p += out_size; out_left = bsz - out_size; @@ -684,7 +688,7 @@ static php_iconv_err_t _php_iconv_strlen(unsigned int *pretval, const char *str, } if (out_left > 0) { - cnt -= out_left / GENERIC_SUPERSET_NBYTES; + cnt -= out_left / GENERIC_SUPERSET_NBYTES; } #if ICONV_SUPPORTS_ERRNO @@ -735,12 +739,12 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval, unsigned int cnt; int total_len; - + err = _php_iconv_strlen(&total_len, str, nbytes, enc); if (err != PHP_ICONV_ERR_SUCCESS) { return err; } - + if (len < 0) { if ((len += (total_len - offset)) < 0) { return PHP_ICONV_ERR_SUCCESS; @@ -772,7 +776,7 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval, smart_str_0(pretval); return PHP_ICONV_ERR_SUCCESS; } - + cd1 = iconv_open(GENERIC_SUPERSET_NAME, enc); if (cd1 == (iconv_t)(-1)) { @@ -857,7 +861,7 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval, if (cd2 != (iconv_t)NULL) { iconv_close(cd2); - } + } return err; } @@ -1042,7 +1046,7 @@ static php_iconv_err_t _php_iconv_strpos(unsigned int *pretval, if (ndl_buf) { efree(ndl_buf); } - + iconv_close(cd); return err; @@ -1089,7 +1093,7 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn if ((fname_nbytes + 2) >= max_line_len || (out_charset_len + 12) >= max_line_len) { /* field name is too long */ - err = PHP_ICONV_ERR_TOO_BIG; + err = PHP_ICONV_ERR_TOO_BIG; goto out; } @@ -1131,7 +1135,7 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn char_cnt -= 2; in_p = fval; - in_left = fval_nbytes; + in_left = fval_nbytes; do { size_t prev_in_left; @@ -1142,8 +1146,8 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn smart_str_appendl(pretval, lfchars, lfchars_len); smart_str_appendc(pretval, ' '); char_cnt = max_line_len - 1; - } - + } + smart_str_appendl(pretval, "=?", sizeof("=?") - 1); char_cnt -= 2; smart_str_appendl(pretval, out_charset, out_charset_len); @@ -1195,7 +1199,7 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn goto out; } break; - + default: err = PHP_ICONV_ERR_UNKNOWN; goto out; @@ -1295,7 +1299,7 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn goto out; } break; - + default: err = PHP_ICONV_ERR_UNKNOWN; goto out; @@ -1372,7 +1376,7 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn } if (encoded != NULL) { efree(encoded); - } + } if (buf != NULL) { efree(buf); } @@ -1391,7 +1395,7 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st size_t str_left; unsigned int scan_stat = 0; const char *csname = NULL; - size_t csname_len; + size_t csname_len; const char *encoded_text = NULL; size_t encoded_text_len = 0; const char *encoded_word = NULL; @@ -1430,7 +1434,7 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st break; case '\n': - scan_stat = 8; + scan_stat = 8; break; case '=': /* first letter of an encoded chunk */ @@ -1455,7 +1459,7 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st case 1: /* expecting a delimiter */ if (*p1 != '?') { - err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); + err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } @@ -1470,7 +1474,7 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st csname = p1 + 1; scan_stat = 2; break; - + case 2: /* expecting a charset name */ switch (*p1) { case '?': /* normal delimiter: encoding scheme follows */ @@ -1480,7 +1484,7 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st case '*': /* new style delimiter: locale id follows */ scan_stat = 10; break; - } + } if (scan_stat != 2) { char tmpbuf[80]; @@ -1493,7 +1497,7 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st if (csname_len > sizeof(tmpbuf) - 1) { if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { - err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); + err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } @@ -1549,7 +1553,7 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st --str_left; } - err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); + err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } @@ -1608,12 +1612,12 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st } } break; - + case 4: /* expecting a delimiter */ if (*p1 != '?') { if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { /* pass the entire chunk through the converter */ - err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); + err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } @@ -1669,7 +1673,7 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st if (*p1 != '=') { if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { /* pass the entire chunk through the converter */ - err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); + err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } @@ -1696,17 +1700,17 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st switch (*p1) { default: /* Handle non-RFC-compliant formats - * + * * RFC2047 requires the character that comes right * after an encoded word (chunk) to be a whitespace, * while there are lots of broken implementations that * generate such malformed headers that don't fulfill * that requirement. - */ - if (!eos) { + */ + if (!eos) { if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { /* pass the entire chunk through the converter */ - err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); + err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } @@ -1738,7 +1742,7 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st if (decoded_text == NULL) { if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { /* pass the entire chunk through the converter */ - err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); + err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } @@ -1761,7 +1765,7 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st if (err != PHP_ICONV_ERR_SUCCESS) { if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { /* pass the entire chunk through the converter */ - err = _php_iconv_appendl(pretval, encoded_word, (size_t)(p1 - encoded_word), cd_pl); + err = _php_iconv_appendl(pretval, encoded_word, (size_t)(p1 - encoded_word), cd_pl); encoded_word = NULL; if (err != PHP_ICONV_ERR_SUCCESS) { break; @@ -1956,7 +1960,7 @@ PHP_FUNCTION(iconv_strlen) char *charset = ICONVG(internal_encoding); int charset_len = 0; char *str; - int str_len; + int str_len; php_iconv_err_t err; @@ -1972,7 +1976,7 @@ PHP_FUNCTION(iconv_strlen) RETURN_FALSE; } - err = _php_iconv_strlen(&retval, str, str_len, charset); + err = _php_iconv_strlen(&retval, str, str_len, charset); _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC); if (err == PHP_ICONV_ERR_SUCCESS) { RETVAL_LONG(retval); @@ -1989,7 +1993,7 @@ PHP_FUNCTION(iconv_substr) char *charset = ICONVG(internal_encoding); int charset_len = 0; char *str; - int str_len; + int str_len; long offset, length = 0; php_iconv_err_t err; @@ -2008,10 +2012,10 @@ PHP_FUNCTION(iconv_substr) } if (ZEND_NUM_ARGS() < 3) { - length = str_len; + length = str_len; } - err = _php_iconv_substr(&retval, str, str_len, offset, length, charset); + err = _php_iconv_substr(&retval, str, str_len, offset, length, charset); _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC); if (err == PHP_ICONV_ERR_SUCCESS && str != NULL && retval.c != NULL) { @@ -2029,7 +2033,7 @@ PHP_FUNCTION(iconv_strpos) char *charset = ICONVG(internal_encoding); int charset_len = 0; char *haystk; - int haystk_len; + int haystk_len; char *ndl; int ndl_len; long offset = 0; @@ -2059,7 +2063,7 @@ PHP_FUNCTION(iconv_strpos) } err = _php_iconv_strpos(&retval, haystk, haystk_len, ndl, ndl_len, - offset, charset); + offset, charset); _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC); if (err == PHP_ICONV_ERR_SUCCESS && retval != (unsigned int)-1) { @@ -2077,7 +2081,7 @@ PHP_FUNCTION(iconv_strrpos) char *charset = ICONVG(internal_encoding); int charset_len = 0; char *haystk; - int haystk_len; + int haystk_len; char *ndl; int ndl_len; @@ -2101,7 +2105,7 @@ PHP_FUNCTION(iconv_strrpos) } err = _php_iconv_strpos(&retval, haystk, haystk_len, ndl, ndl_len, - -1, charset); + -1, charset); _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC); if (err == PHP_ICONV_ERR_SUCCESS && retval != (unsigned int)-1) { @@ -2241,7 +2245,7 @@ PHP_FUNCTION(iconv_mime_decode) char *charset = ICONVG(internal_encoding); int charset_len = 0; long mode = 0; - + smart_str retval = {0}; php_iconv_err_t err; @@ -2282,7 +2286,7 @@ PHP_FUNCTION(iconv_mime_decode_headers) char *charset = ICONVG(internal_encoding); int charset_len = 0; long mode = 0; - + php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", @@ -2350,14 +2354,14 @@ PHP_FUNCTION(iconv_mime_decode_headers) zend_hash_update(Z_ARRVAL_P(return_value), header_name, header_name_len, (void *)&new_elem, sizeof(new_elem), NULL); elem = &new_elem; - } + } add_next_index_stringl(*elem, header_value, header_value_len, 1); } else { add_assoc_stringl_ex(return_value, header_name, header_name_len, header_value, header_value_len, 1); } } encoded_str_len -= next_pos - encoded_str; - encoded_str = next_pos; + encoded_str = next_pos; smart_str_free(&decoded_header); } @@ -2378,7 +2382,7 @@ PHP_NAMED_FUNCTION(php_if_iconv) size_t out_len; int in_charset_len = 0, out_charset_len = 0, in_buffer_len; php_iconv_err_t err; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &in_charset, &in_charset_len, &out_charset, &out_charset_len, &in_buffer, &in_buffer_len) == FAILURE) return; @@ -2390,7 +2394,7 @@ PHP_NAMED_FUNCTION(php_if_iconv) err = php_iconv_string(in_buffer, (size_t)in_buffer_len, &out_buffer, &out_len, out_charset, in_charset); - _php_iconv_show_error(err, out_charset, in_charset TSRMLS_CC); + _php_iconv_show_error(err, out_charset, in_charset TSRMLS_CC); if (err == PHP_ICONV_ERR_SUCCESS && out_buffer != NULL) { RETVAL_STRINGL(out_buffer, out_len, 0); } else { @@ -2539,7 +2543,7 @@ static int php_iconv_stream_filter_append_bucket( icnt = buf_len; } - out_buf_size = ocnt = prev_ocnt = initial_out_buf_size; + out_buf_size = ocnt = prev_ocnt = initial_out_buf_size; if (NULL == (out_buf = pemalloc(out_buf_size, persistent))) { return FAILURE; } diff --git a/ext/imap/tests/imap_errors_basic.phpt b/ext/imap/tests/imap_errors_basic.phpt index 9d2ca30ecea5c..91be3286aaeb8 100644 --- a/ext/imap/tests/imap_errors_basic.phpt +++ b/ext/imap/tests/imap_errors_basic.phpt @@ -7,7 +7,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); --FILE-- | + +----------------------------------------------------------------------+ +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include "codepointiterator_internal.h" + +#include "breakiterator_iterators.h" + +#include + +extern "C" { +#define USE_BREAKITERATOR_POINTER 1 +#include "breakiterator_class.h" +#include "breakiterator_methods.h" +#include "rulebasedbreakiterator_methods.h" +#include "codepointiterator_methods.h" +#include +#include +#include +} + +using PHP::CodePointBreakIterator; + +/* {{{ Global variables */ +zend_class_entry *BreakIterator_ce_ptr; +zend_class_entry *RuleBasedBreakIterator_ce_ptr; +zend_class_entry *CodePointBreakIterator_ce_ptr; +zend_object_handlers BreakIterator_handlers; +/* }}} */ + +U_CFUNC void breakiterator_object_create(zval *object, + BreakIterator *biter TSRMLS_DC) +{ + UClassID classId = biter->getDynamicClassID(); + zend_class_entry *ce; + + if (classId == RuleBasedBreakIterator::getStaticClassID()) { + ce = RuleBasedBreakIterator_ce_ptr; + } else if (classId == CodePointBreakIterator::getStaticClassID()) { + ce = CodePointBreakIterator_ce_ptr; + } else { + ce = BreakIterator_ce_ptr; + } + + object_init_ex(object, ce); + breakiterator_object_construct(object, biter TSRMLS_CC); +} + +U_CFUNC void breakiterator_object_construct(zval *object, + BreakIterator *biter TSRMLS_DC) +{ + BreakIterator_object *bio; + + BREAKITER_METHOD_FETCH_OBJECT_NO_CHECK; //populate to from object + assert(bio->biter == NULL); + bio->biter = biter; +} + +/* {{{ compare handler for BreakIterator */ +static int BreakIterator_compare_objects(zval *object1, + zval *object2 TSRMLS_DC) +{ + BreakIterator_object *bio1, + *bio2; + + bio1 = (BreakIterator_object*)zend_object_store_get_object(object1 TSRMLS_CC); + bio2 = (BreakIterator_object*)zend_object_store_get_object(object2 TSRMLS_CC); + + if (bio1->biter == NULL || bio2->biter == NULL) { + return bio1->biter == bio2->biter ? 0 : 1; + } + + return *bio1->biter == *bio2->biter ? 0 : 1; +} +/* }}} */ + +/* {{{ clone handler for BreakIterator */ +static zend_object_value BreakIterator_clone_obj(zval *object TSRMLS_DC) +{ + BreakIterator_object *bio_orig, + *bio_new; + zend_object_value ret_val; + + bio_orig = (BreakIterator_object*)zend_object_store_get_object(object TSRMLS_CC); + intl_errors_reset(INTL_DATA_ERROR_P(bio_orig) TSRMLS_CC); + + ret_val = BreakIterator_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC); + bio_new = (BreakIterator_object*)zend_object_store_get_object_by_handle( + ret_val.handle TSRMLS_CC); + + zend_objects_clone_members(&bio_new->zo, ret_val, + &bio_orig->zo, Z_OBJ_HANDLE_P(object) TSRMLS_CC); + + if (bio_orig->biter != NULL) { + BreakIterator *new_biter; + + new_biter = bio_orig->biter->clone(); + if (!new_biter) { + char *err_msg; + intl_errors_set_code(BREAKITER_ERROR_P(bio_orig), + U_MEMORY_ALLOCATION_ERROR TSRMLS_CC); + intl_errors_set_custom_msg(BREAKITER_ERROR_P(bio_orig), + "Could not clone BreakIterator", 0 TSRMLS_CC); + err_msg = intl_error_get_message(BREAKITER_ERROR_P(bio_orig) TSRMLS_CC); + zend_throw_exception(NULL, err_msg, 0 TSRMLS_CC); + efree(err_msg); + } else { + bio_new->biter = new_biter; + bio_new->text = bio_orig->text; + if (bio_new->text) { + zval_add_ref(&bio_new->text); + } + } + } else { + zend_throw_exception(NULL, "Cannot clone unconstructed BreakIterator", 0 TSRMLS_CC); + } + + return ret_val; +} +/* }}} */ + +/* {{{ get_debug_info handler for BreakIterator */ +static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp TSRMLS_DC) +{ + zval zv = zval_used_for_init; + BreakIterator_object *bio; + const BreakIterator *biter; + + *is_temp = 1; + + array_init_size(&zv, 8); + + bio = (BreakIterator_object*)zend_object_store_get_object(object TSRMLS_CC); + biter = bio->biter; + + if (biter == NULL) { + add_assoc_bool_ex(&zv, "valid", sizeof("valid"), 0); + return Z_ARRVAL(zv); + } + add_assoc_bool_ex(&zv, "valid", sizeof("valid"), 1); + + if (bio->text == NULL) { + add_assoc_null_ex(&zv, "text", sizeof("text")); + } else { + zval_add_ref(&bio->text); + add_assoc_zval_ex(&zv, "text", sizeof("text"), bio->text); + } + + add_assoc_string_ex(&zv, "type", sizeof("type"), + const_cast(typeid(*biter).name()), 1); + + return Z_ARRVAL(zv); +} +/* }}} */ + +/* {{{ void breakiterator_object_init(BreakIterator_object* to) + * Initialize internals of BreakIterator_object not specific to zend standard objects. + */ +static void breakiterator_object_init(BreakIterator_object *bio TSRMLS_DC) +{ + intl_error_init(BREAKITER_ERROR_P(bio) TSRMLS_CC); + bio->biter = NULL; + bio->text = NULL; +} +/* }}} */ + +/* {{{ BreakIterator_objects_dtor */ +static void BreakIterator_objects_dtor(void *object, + zend_object_handle handle TSRMLS_DC) +{ + zend_objects_destroy_object((zend_object*)object, handle TSRMLS_CC); +} +/* }}} */ + +/* {{{ BreakIterator_objects_free */ +static void BreakIterator_objects_free(zend_object *object TSRMLS_DC) +{ + BreakIterator_object* bio = (BreakIterator_object*) object; + + if (bio->text) { + zval_ptr_dtor(&bio->text); + } + if (bio->biter) { + delete bio->biter; + bio->biter = NULL; + } + intl_error_reset(BREAKITER_ERROR_P(bio) TSRMLS_CC); + + zend_object_std_dtor(&bio->zo TSRMLS_CC); + + efree(bio); +} +/* }}} */ + +/* {{{ BreakIterator_object_create */ +static zend_object_value BreakIterator_object_create(zend_class_entry *ce TSRMLS_DC) +{ + zend_object_value retval; + BreakIterator_object* intern; + + intern = (BreakIterator_object*)ecalloc(1, sizeof(BreakIterator_object)); + + zend_object_std_init(&intern->zo, ce TSRMLS_CC); +#if PHP_VERSION_ID < 50399 + zend_hash_copy(intern->zo.properties, &(ce->default_properties), + (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*)); +#else + object_properties_init((zend_object*) intern, ce); +#endif + breakiterator_object_init(intern TSRMLS_CC); + + retval.handle = zend_objects_store_put( + intern, + BreakIterator_objects_dtor, + (zend_objects_free_object_storage_t) BreakIterator_objects_free, + NULL TSRMLS_CC); + + retval.handlers = &BreakIterator_handlers; + + return retval; +} +/* }}} */ + +/* {{{ BreakIterator/RuleBasedBreakIterator methods arguments info */ + +ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_void, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_locale, 0, 0, 0) + ZEND_ARG_INFO(0, "locale") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_setText, 0, 0, 1) + ZEND_ARG_INFO(0, "text") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_next, 0, 0, 0) + ZEND_ARG_INFO(0, "offset") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_offset, 0, 0, 1) + ZEND_ARG_INFO(0, "offset") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_get_locale, 0, 0, 1) + ZEND_ARG_INFO(0, "locale_type") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_getPartsIterator, 0, 0, 0) + ZEND_ARG_INFO(0, "key_type") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(ainfo_rbbi___construct, 0, 0, 1) + ZEND_ARG_INFO(0, "rules") + ZEND_ARG_INFO(0, "areCompiled") +ZEND_END_ARG_INFO() + +/* }}} */ + +/* {{{ BreakIterator_class_functions + * Every 'BreakIterator' class method has an entry in this table + */ +static const zend_function_entry BreakIterator_class_functions[] = { + PHP_ME(BreakIterator, __construct, ainfo_biter_void, ZEND_ACC_PRIVATE) + PHP_ME_MAPPING(createWordInstance, breakiter_create_word_instance, ainfo_biter_locale, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(createLineInstance, breakiter_create_line_instance, ainfo_biter_locale, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(createCharacterInstance, breakiter_create_character_instance, ainfo_biter_locale, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(createSentenceInstance, breakiter_create_sentence_instance, ainfo_biter_locale, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(createTitleInstance, breakiter_create_title_instance, ainfo_biter_locale, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(createCodePointInstance, breakiter_create_code_point_instance, ainfo_biter_void, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(getText, breakiter_get_text, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(setText, breakiter_set_text, ainfo_biter_setText, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(first, breakiter_first, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(last, breakiter_last, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(previous, breakiter_previous, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(next, breakiter_next, ainfo_biter_next, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(current, breakiter_current, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(following, breakiter_following, ainfo_biter_offset, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(preceding, breakiter_preceding, ainfo_biter_offset, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(isBoundary, breakiter_is_boundary, ainfo_biter_offset, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(getLocale, breakiter_get_locale, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(getPartsIterator, breakiter_get_parts_iterator, ainfo_biter_getPartsIterator, ZEND_ACC_PUBLIC) + + PHP_ME_MAPPING(getErrorCode, breakiter_get_error_code, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(getErrorMessage, breakiter_get_error_message, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_FE_END +}; +/* }}} */ + +/* {{{ RuleBasedBreakIterator_class_functions + */ +static const zend_function_entry RuleBasedBreakIterator_class_functions[] = { + PHP_ME(IntlRuleBasedBreakIterator, __construct, ainfo_rbbi___construct, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(getRules, rbbi_get_rules, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(getRuleStatus, rbbi_get_rule_status, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(getRuleStatusVec, rbbi_get_rule_status_vec, ainfo_biter_void, ZEND_ACC_PUBLIC) +#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48 + PHP_ME_MAPPING(getBinaryRules, rbbi_get_binary_rules, ainfo_biter_void, ZEND_ACC_PUBLIC) +#endif + PHP_FE_END +}; +/* }}} */ + +/* {{{ CodePointBreakIterator_class_functions + */ +static const zend_function_entry CodePointBreakIterator_class_functions[] = { + PHP_ME_MAPPING(getLastCodePoint, cpbi_get_last_code_point, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_FE_END +}; +/* }}} */ + + +/* {{{ breakiterator_register_BreakIterator_class + * Initialize 'BreakIterator' class + */ +U_CFUNC void breakiterator_register_BreakIterator_class(TSRMLS_D) +{ + zend_class_entry ce; + + /* Create and register 'BreakIterator' class. */ + INIT_CLASS_ENTRY(ce, "IntlBreakIterator", BreakIterator_class_functions); + ce.create_object = BreakIterator_object_create; + ce.get_iterator = _breakiterator_get_iterator; + BreakIterator_ce_ptr = zend_register_internal_class(&ce TSRMLS_CC); + + memcpy(&BreakIterator_handlers, zend_get_std_object_handlers(), + sizeof BreakIterator_handlers); + BreakIterator_handlers.compare_objects = BreakIterator_compare_objects; + BreakIterator_handlers.clone_obj = BreakIterator_clone_obj; + BreakIterator_handlers.get_debug_info = BreakIterator_get_debug_info; + + zend_class_implements(BreakIterator_ce_ptr TSRMLS_CC, 1, + zend_ce_traversable); + + zend_declare_class_constant_long(BreakIterator_ce_ptr, + "DONE", sizeof("DONE") - 1, BreakIterator::DONE TSRMLS_CC ); + + /* Declare constants that are defined in the C header */ +#define BREAKITER_DECL_LONG_CONST(name) \ + zend_declare_class_constant_long(BreakIterator_ce_ptr, #name, \ + sizeof(#name) - 1, UBRK_ ## name TSRMLS_CC) + + BREAKITER_DECL_LONG_CONST(WORD_NONE); + BREAKITER_DECL_LONG_CONST(WORD_NONE_LIMIT); + BREAKITER_DECL_LONG_CONST(WORD_NUMBER); + BREAKITER_DECL_LONG_CONST(WORD_NUMBER_LIMIT); + BREAKITER_DECL_LONG_CONST(WORD_LETTER); + BREAKITER_DECL_LONG_CONST(WORD_LETTER_LIMIT); + BREAKITER_DECL_LONG_CONST(WORD_KANA); + BREAKITER_DECL_LONG_CONST(WORD_KANA_LIMIT); + BREAKITER_DECL_LONG_CONST(WORD_IDEO); + BREAKITER_DECL_LONG_CONST(WORD_IDEO_LIMIT); + + BREAKITER_DECL_LONG_CONST(LINE_SOFT); + BREAKITER_DECL_LONG_CONST(LINE_SOFT_LIMIT); + BREAKITER_DECL_LONG_CONST(LINE_HARD); + BREAKITER_DECL_LONG_CONST(LINE_HARD_LIMIT); + + BREAKITER_DECL_LONG_CONST(SENTENCE_TERM); + BREAKITER_DECL_LONG_CONST(SENTENCE_TERM_LIMIT); + BREAKITER_DECL_LONG_CONST(SENTENCE_SEP); + BREAKITER_DECL_LONG_CONST(SENTENCE_SEP_LIMIT); + +#undef BREAKITER_DECL_LONG_CONST + + + /* Create and register 'RuleBasedBreakIterator' class. */ + INIT_CLASS_ENTRY(ce, "IntlRuleBasedBreakIterator", + RuleBasedBreakIterator_class_functions); + RuleBasedBreakIterator_ce_ptr = zend_register_internal_class_ex(&ce, + BreakIterator_ce_ptr, NULL TSRMLS_CC); + + /* Create and register 'CodePointBreakIterator' class. */ + INIT_CLASS_ENTRY(ce, "IntlCodePointBreakIterator", + CodePointBreakIterator_class_functions); + CodePointBreakIterator_ce_ptr = zend_register_internal_class_ex(&ce, + BreakIterator_ce_ptr, NULL TSRMLS_CC); +} +/* }}} */ diff --git a/ext/intl/breakiterator/breakiterator_class.h b/ext/intl/breakiterator/breakiterator_class.h new file mode 100644 index 0000000000000..cc5d51256f926 --- /dev/null +++ b/ext/intl/breakiterator/breakiterator_class.h @@ -0,0 +1,71 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ + */ + +#ifndef BREAKITERATOR_CLASS_H +#define BREAKITERATOR_CLASS_H + +//redefinition of inline in PHP headers causes problems, so include this before +#include + +#include +#include "../intl_error.h" +#include "../intl_data.h" + +#ifndef USE_BREAKITERATOR_POINTER +typedef void BreakIterator; +#endif + +typedef struct { + zend_object zo; + + // error handling + intl_error err; + + // ICU break iterator + BreakIterator* biter; + + // current text + zval *text; +} BreakIterator_object; + +#define BREAKITER_ERROR(bio) (bio)->err +#define BREAKITER_ERROR_P(bio) &(BREAKITER_ERROR(bio)) + +#define BREAKITER_ERROR_CODE(bio) INTL_ERROR_CODE(BREAKITER_ERROR(bio)) +#define BREAKITER_ERROR_CODE_P(bio) &(INTL_ERROR_CODE(BREAKITER_ERROR(bio))) + +#define BREAKITER_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(BreakIterator, bio) +#define BREAKITER_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(BreakIterator, bio) +#define BREAKITER_METHOD_FETCH_OBJECT \ + BREAKITER_METHOD_FETCH_OBJECT_NO_CHECK; \ + if (bio->biter == NULL) \ + { \ + intl_errors_set(&bio->err, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed BreakIterator", 0 TSRMLS_CC); \ + RETURN_FALSE; \ + } + +void breakiterator_object_create(zval *object, BreakIterator *break_iter TSRMLS_DC); + +void breakiterator_object_construct(zval *object, BreakIterator *break_iter TSRMLS_DC); + +void breakiterator_register_BreakIterator_class(TSRMLS_D); + +extern zend_class_entry *BreakIterator_ce_ptr, + *RuleBasedBreakIterator_ce_ptr; + +extern zend_object_handlers BreakIterator_handlers; + +#endif /* #ifndef BREAKITERATOR_CLASS_H */ diff --git a/ext/intl/breakiterator/breakiterator_iterators.cpp b/ext/intl/breakiterator/breakiterator_iterators.cpp new file mode 100644 index 0000000000000..d88ad8a712d5b --- /dev/null +++ b/ext/intl/breakiterator/breakiterator_iterators.cpp @@ -0,0 +1,346 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "breakiterator_iterators.h" +#include "../common/common_enum.h" + +extern "C" { +#define USE_BREAKITERATOR_POINTER +#include "breakiterator_class.h" +#include "../intl_convert.h" +#include "../locale/locale.h" +#include +} + +static zend_class_entry *IntlPartsIterator_ce_ptr; +static zend_object_handlers IntlPartsIterator_handlers; + +/* BreakIterator's iterator */ + +inline BreakIterator *_breakiter_prolog(zend_object_iterator *iter TSRMLS_DC) +{ + BreakIterator_object *bio; + bio = (BreakIterator_object*)zend_object_store_get_object( + (const zval*)iter->data TSRMLS_CC); + intl_errors_reset(BREAKITER_ERROR_P(bio) TSRMLS_CC); + if (bio->biter == NULL) { + intl_errors_set(BREAKITER_ERROR_P(bio), U_INVALID_STATE_ERROR, + "The BreakIterator object backing the PHP iterator is not " + "properly constructed", 0 TSRMLS_CC); + } + return bio->biter; +} + +static void _breakiterator_destroy_it(zend_object_iterator *iter TSRMLS_DC) +{ + zval_ptr_dtor((zval**)&iter->data); +} + +static void _breakiterator_move_forward(zend_object_iterator *iter TSRMLS_DC) +{ + BreakIterator *biter = _breakiter_prolog(iter TSRMLS_CC); + zoi_with_current *zoi_iter = (zoi_with_current*)iter; + + iter->funcs->invalidate_current(iter TSRMLS_CC); + + if (biter == NULL) { + return; + } + + int32_t pos = biter->next(); + if (pos != BreakIterator::DONE) { + MAKE_STD_ZVAL(zoi_iter->current); + ZVAL_LONG(zoi_iter->current, (long)pos); + } //else we've reached the end of the enum, nothing more is required +} + +static void _breakiterator_rewind(zend_object_iterator *iter TSRMLS_DC) +{ + BreakIterator *biter = _breakiter_prolog(iter TSRMLS_CC); + zoi_with_current *zoi_iter = (zoi_with_current*)iter; + + int32_t pos = biter->first(); + MAKE_STD_ZVAL(zoi_iter->current); + ZVAL_LONG(zoi_iter->current, (long)pos); +} + +static zend_object_iterator_funcs breakiterator_iterator_funcs = { + zoi_with_current_dtor, + zoi_with_current_valid, + zoi_with_current_get_current_data, + NULL, + _breakiterator_move_forward, + _breakiterator_rewind, + zoi_with_current_invalidate_current +}; + +U_CFUNC zend_object_iterator *_breakiterator_get_iterator( + zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC) +{ + BreakIterator_object *bio; + if (by_ref) { + zend_throw_exception(NULL, + "Iteration by reference is not supported", 0 TSRMLS_CC); + return NULL; + } + + bio = (BreakIterator_object*)zend_object_store_get_object(object TSRMLS_CC); + BreakIterator *biter = bio->biter; + + if (biter == NULL) { + zend_throw_exception(NULL, + "The BreakIterator is not properly constructed", 0 TSRMLS_CC); + return NULL; + } + + zoi_with_current *zoi_iter = + static_cast(emalloc(sizeof *zoi_iter)); + zoi_iter->zoi.data = static_cast(object); + zoi_iter->zoi.funcs = &breakiterator_iterator_funcs; + zoi_iter->zoi.index = 0; + zoi_iter->destroy_it = _breakiterator_destroy_it; + zoi_iter->wrapping_obj = NULL; /* not used; object is in zoi.data */ + zoi_iter->current = NULL; + + zval_add_ref(&object); + + return reinterpret_cast(zoi_iter); +} + +/* BreakIterator parts iterator */ + +typedef struct zoi_break_iter_parts { + zoi_with_current zoi_cur; + parts_iter_key_type key_type; + BreakIterator_object *bio; /* so we don't have to fetch it all the time */ +} zoi_break_iter_parts; + +static void _breakiterator_parts_destroy_it(zend_object_iterator *iter TSRMLS_DC) +{ + zval_ptr_dtor(reinterpret_cast(&iter->data)); +} + +static int _breakiterator_parts_get_current_key(zend_object_iterator *iter, + char **str_key, + uint *str_key_len, + ulong *int_key TSRMLS_DC) +{ + /* the actual work is done in move_forward and rewind */ + *int_key = iter->index; + return HASH_KEY_IS_LONG; +} + +static void _breakiterator_parts_move_forward(zend_object_iterator *iter TSRMLS_DC) +{ + zoi_break_iter_parts *zoi_bit = (zoi_break_iter_parts*)iter; + BreakIterator_object *bio = zoi_bit->bio; + + iter->funcs->invalidate_current(iter TSRMLS_CC); + + int32_t cur, + next; + + cur = bio->biter->current(); + if (cur == BreakIterator::DONE) { + return; + } + next = bio->biter->next(); + if (next == BreakIterator::DONE) { + return; + } + + if (zoi_bit->key_type == PARTS_ITERATOR_KEY_LEFT) { + iter->index = cur; + } else if (zoi_bit->key_type == PARTS_ITERATOR_KEY_RIGHT) { + iter->index = next; + } + /* else zoi_bit->key_type == PARTS_ITERATOR_KEY_SEQUENTIAL + * No need to do anything, the engine increments ->index */ + + const char *s = Z_STRVAL_P(bio->text); + int32_t slen = Z_STRLEN_P(bio->text), + len; + char *res; + + if (next == BreakIterator::DONE) { + next = slen; + } + assert(next <= slen && next >= cur); + len = next - cur; + res = static_cast(emalloc(len + 1)); + + memcpy(res, &s[cur], len); + res[len] = '\0'; + + MAKE_STD_ZVAL(zoi_bit->zoi_cur.current); + ZVAL_STRINGL(zoi_bit->zoi_cur.current, res, len, 0); +} + +static void _breakiterator_parts_rewind(zend_object_iterator *iter TSRMLS_DC) +{ + zoi_break_iter_parts *zoi_bit = (zoi_break_iter_parts*)iter; + BreakIterator_object *bio = zoi_bit->bio; + + if (zoi_bit->zoi_cur.current) { + iter->funcs->invalidate_current(iter TSRMLS_CC); + } + + bio->biter->first(); + + iter->funcs->move_forward(iter TSRMLS_CC); +} + +static zend_object_iterator_funcs breakiterator_parts_it_funcs = { + zoi_with_current_dtor, + zoi_with_current_valid, + zoi_with_current_get_current_data, + _breakiterator_parts_get_current_key, + _breakiterator_parts_move_forward, + _breakiterator_parts_rewind, + zoi_with_current_invalidate_current +}; + +void IntlIterator_from_BreakIterator_parts(zval *break_iter_zv, + zval *object, + parts_iter_key_type key_type TSRMLS_DC) +{ + IntlIterator_object *ii; + + zval_add_ref(&break_iter_zv); + + object_init_ex(object, IntlPartsIterator_ce_ptr); + ii = (IntlIterator_object*)zend_object_store_get_object(object TSRMLS_CC); + + ii->iterator = (zend_object_iterator*)emalloc(sizeof(zoi_break_iter_parts)); + ii->iterator->data = break_iter_zv; + ii->iterator->funcs = &breakiterator_parts_it_funcs; + ii->iterator->index = 0; + ((zoi_with_current*)ii->iterator)->destroy_it = _breakiterator_parts_destroy_it; + ((zoi_with_current*)ii->iterator)->wrapping_obj = object; + ((zoi_with_current*)ii->iterator)->current = NULL; + + ((zoi_break_iter_parts*)ii->iterator)->bio = (BreakIterator_object*) + zend_object_store_get_object(break_iter_zv TSRMLS_CC); + assert(((zoi_break_iter_parts*)ii->iterator)->bio->biter != NULL); + ((zoi_break_iter_parts*)ii->iterator)->key_type = key_type; +} + +U_CFUNC zend_object_value IntlPartsIterator_object_create(zend_class_entry *ce TSRMLS_DC) +{ + zend_object_value retval; + + retval = IntlIterator_ce_ptr->create_object(ce TSRMLS_CC); + retval.handlers = &IntlPartsIterator_handlers; + + return retval; +} + +U_CFUNC zend_function *IntlPartsIterator_get_method(zval **object_ptr, + char *method, int method_len, const zend_literal *key TSRMLS_DC) +{ + zend_literal local_literal = {0}; + zend_function *ret; + ALLOCA_FLAG(use_heap) + + if (key == NULL) { + Z_STRVAL(local_literal.constant) = static_cast( + do_alloca(method_len + 1, use_heap)); + zend_str_tolower_copy(Z_STRVAL(local_literal.constant), + method, method_len); + local_literal.hash_value = zend_hash_func( + Z_STRVAL(local_literal.constant), method_len + 1); + key = &local_literal; + } + + if ((key->hash_value & 0xFFFFFFFF) == 0xA2B486A1 /* hash of getrulestatus\0 */ + && method_len == sizeof("getrulestatus") - 1 + && memcmp("getrulestatus", Z_STRVAL(key->constant), method_len) == 0) { + IntlIterator_object *obj = (IntlIterator_object*) + zend_object_store_get_object(*object_ptr TSRMLS_CC); + if (obj->iterator && obj->iterator->data) { + zval *break_iter_zv = static_cast(obj->iterator->data); + *object_ptr = break_iter_zv; + ret = Z_OBJ_HANDLER_P(break_iter_zv, get_method)(object_ptr, + method, method_len, key TSRMLS_CC); + goto end; + } + } + + ret = std_object_handlers.get_method(object_ptr, + method, method_len, key TSRMLS_CC); + +end: + if (key == &local_literal) { + free_alloca(Z_STRVAL(local_literal.constant), use_heap); + } + + return ret; +} + +U_CFUNC PHP_METHOD(IntlPartsIterator, getBreakIterator) +{ + INTLITERATOR_METHOD_INIT_VARS; + + if (zend_parse_parameters_none() == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "IntlPartsIterator::getBreakIterator: bad arguments", 0 TSRMLS_CC); + return; + } + + INTLITERATOR_METHOD_FETCH_OBJECT; + + zval *biter_zval = static_cast(ii->iterator->data); + RETURN_ZVAL(biter_zval, 1, 0); +} + +ZEND_BEGIN_ARG_INFO_EX(ainfo_parts_it_void, 0, 0, 0) +ZEND_END_ARG_INFO() + +static const zend_function_entry IntlPartsIterator_class_functions[] = { + PHP_ME(IntlPartsIterator, getBreakIterator, ainfo_parts_it_void, ZEND_ACC_PUBLIC) + PHP_FE_END +}; + +U_CFUNC void breakiterator_register_IntlPartsIterator_class(TSRMLS_D) +{ + zend_class_entry ce; + + /* Create and register 'BreakIterator' class. */ + INIT_CLASS_ENTRY(ce, "IntlPartsIterator", IntlPartsIterator_class_functions); + IntlPartsIterator_ce_ptr = zend_register_internal_class_ex(&ce, + IntlIterator_ce_ptr, NULL TSRMLS_CC); + IntlPartsIterator_ce_ptr->create_object = IntlPartsIterator_object_create; + + memcpy(&IntlPartsIterator_handlers, &IntlIterator_handlers, + sizeof IntlPartsIterator_handlers); + IntlPartsIterator_handlers.get_method = IntlPartsIterator_get_method; + +#define PARTSITER_DECL_LONG_CONST(name) \ + zend_declare_class_constant_long(IntlPartsIterator_ce_ptr, #name, \ + sizeof(#name) - 1, PARTS_ITERATOR_ ## name TSRMLS_CC) + + PARTSITER_DECL_LONG_CONST(KEY_SEQUENTIAL); + PARTSITER_DECL_LONG_CONST(KEY_LEFT); + PARTSITER_DECL_LONG_CONST(KEY_RIGHT); + +#undef PARTSITER_DECL_LONG_CONST +} \ No newline at end of file diff --git a/ext/intl/breakiterator/breakiterator_iterators.h b/ext/intl/breakiterator/breakiterator_iterators.h new file mode 100644 index 0000000000000..71620724147ec --- /dev/null +++ b/ext/intl/breakiterator/breakiterator_iterators.h @@ -0,0 +1,42 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ +#ifndef INTL_BREAKITERATOR_ITERATORS_H +#define INTL_BREAKITERATOR_ITERATORS_H + +#include + +U_CDECL_BEGIN +#include +#include +U_CDECL_END + +typedef enum { + PARTS_ITERATOR_KEY_SEQUENTIAL, + PARTS_ITERATOR_KEY_LEFT, + PARTS_ITERATOR_KEY_RIGHT, +} parts_iter_key_type; + +#ifdef __cplusplus +void IntlIterator_from_BreakIterator_parts(zval *break_iter_zv, + zval *object, + parts_iter_key_type key_type TSRMLS_DC); +#endif + +U_CFUNC zend_object_iterator *_breakiterator_get_iterator( + zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC); +U_CFUNC void breakiterator_register_IntlPartsIterator_class(TSRMLS_D); + +#endif \ No newline at end of file diff --git a/ext/intl/breakiterator/breakiterator_methods.cpp b/ext/intl/breakiterator/breakiterator_methods.cpp new file mode 100644 index 0000000000000..6a61f8cb93ed6 --- /dev/null +++ b/ext/intl/breakiterator/breakiterator_methods.cpp @@ -0,0 +1,452 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include "codepointiterator_internal.h" + +#include "breakiterator_iterators.h" + +extern "C" { +#include "../php_intl.h" +#define USE_BREAKITERATOR_POINTER 1 +#include "breakiterator_class.h" +#include "../locale/locale.h" +#include +} + +using PHP::CodePointBreakIterator; + +U_CFUNC PHP_METHOD(BreakIterator, __construct) +{ + zend_throw_exception( NULL, + "An object of this type cannot be created with the new operator", + 0 TSRMLS_CC ); +} + +static void _breakiter_factory(const char *func_name, + BreakIterator *(*func)(const Locale&, UErrorCode&), + INTERNAL_FUNCTION_PARAMETERS) +{ + BreakIterator *biter; + const char *locale_str = NULL; + int dummy; + char *msg; + UErrorCode status = UErrorCode(); + intl_error_reset(NULL TSRMLS_CC); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s!", + &locale_str, &dummy) == FAILURE) { + spprintf(&msg, NULL, "%s: bad arguments", func_name); + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); + efree(msg); + RETURN_NULL(); + } + + if (locale_str == NULL) { + locale_str = intl_locale_get_default(TSRMLS_C); + } + + biter = func(Locale::createFromName(locale_str), status); + intl_error_set_code(NULL, status TSRMLS_CC); + if (U_FAILURE(status)) { + spprintf(&msg, NULL, "%s: error creating BreakIterator", + func_name); + intl_error_set_custom_msg(NULL, msg, 1 TSRMLS_CC); + efree(msg); + RETURN_NULL(); + } + + breakiterator_object_create(return_value, biter TSRMLS_CC); +} + +U_CFUNC PHP_FUNCTION(breakiter_create_word_instance) +{ + _breakiter_factory("breakiter_create_word_instance", + &BreakIterator::createWordInstance, + INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +U_CFUNC PHP_FUNCTION(breakiter_create_line_instance) +{ + _breakiter_factory("breakiter_create_line_instance", + &BreakIterator::createLineInstance, + INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +U_CFUNC PHP_FUNCTION(breakiter_create_character_instance) +{ + _breakiter_factory("breakiter_create_character_instance", + &BreakIterator::createCharacterInstance, + INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +U_CFUNC PHP_FUNCTION(breakiter_create_sentence_instance) +{ + _breakiter_factory("breakiter_create_sentence_instance", + &BreakIterator::createSentenceInstance, + INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +U_CFUNC PHP_FUNCTION(breakiter_create_title_instance) +{ + _breakiter_factory("breakiter_create_title_instance", + &BreakIterator::createTitleInstance, + INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +U_CFUNC PHP_FUNCTION(breakiter_create_code_point_instance) +{ + UErrorCode status = UErrorCode(); + intl_error_reset(NULL TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_create_code_point_instance: bad arguments", 0 TSRMLS_CC); + RETURN_NULL(); + } + + CodePointBreakIterator *cpbi = new CodePointBreakIterator(); + breakiterator_object_create(return_value, cpbi TSRMLS_CC); +} + +U_CFUNC PHP_FUNCTION(breakiter_get_text) +{ + BREAKITER_METHOD_INIT_VARS; + object = getThis(); + + if (zend_parse_parameters_none() == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_get_text: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + if (bio->text == NULL) { + RETURN_NULL(); + } else { + RETURN_ZVAL(bio->text, 1, 0); + } +} + +U_CFUNC PHP_FUNCTION(breakiter_set_text) +{ + char *text; + int text_len; + UText *ut = NULL; + zval **textzv; + BREAKITER_METHOD_INIT_VARS; + object = getThis(); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", + &text, &text_len) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_set_text: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + int res = zend_get_parameters_ex(1, &textzv); + assert(res == SUCCESS); + + BREAKITER_METHOD_FETCH_OBJECT; + + /* assert it's safe to use text and text_len because zpp changes the + * arguments in the stack */ + assert(text == Z_STRVAL_PP(textzv)); + + ut = utext_openUTF8(ut, text, text_len, BREAKITER_ERROR_CODE_P(bio)); + INTL_CTOR_CHECK_STATUS(bio, "breakiter_set_text: error opening UText"); + + bio->biter->setText(ut, BREAKITER_ERROR_CODE(bio)); + utext_close(ut); /* ICU shallow clones the UText */ + INTL_CTOR_CHECK_STATUS(bio, "breakiter_set_text: error calling " + "BreakIterator::setText()"); + + /* When ICU clones the UText, it does not copy the buffer, so we have to + * keep the string buffer around by holding a reference to its zval. This + * also allows a faste implementation of getText() */ + if (bio->text != NULL) { + zval_ptr_dtor(&bio->text); + } + bio->text = *textzv; + zval_add_ref(&bio->text); + + RETURN_TRUE; +} + +static void _breakiter_no_args_ret_int32( + const char *func_name, + int32_t (BreakIterator::*func)(), + INTERNAL_FUNCTION_PARAMETERS) +{ + char *msg; + BREAKITER_METHOD_INIT_VARS; + object = getThis(); + + if (zend_parse_parameters_none() == FAILURE) { + spprintf(&msg, NULL, "%s: bad arguments", func_name); + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); + efree(msg); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + int32_t res = (bio->biter->*func)(); + + RETURN_LONG((long)res); +} + +static void _breakiter_int32_ret_int32( + const char *func_name, + int32_t (BreakIterator::*func)(int32_t), + INTERNAL_FUNCTION_PARAMETERS) +{ + char *msg; + long arg; + BREAKITER_METHOD_INIT_VARS; + object = getThis(); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg) == FAILURE) { + spprintf(&msg, NULL, "%s: bad arguments", func_name); + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); + efree(msg); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + if (arg < INT32_MIN || arg > INT32_MAX) { + spprintf(&msg, NULL, "%s: offset argument is outside bounds of " + "a 32-bit wide integer", func_name); + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); + efree(msg); + RETURN_FALSE; + } + + int32_t res = (bio->biter->*func)((int32_t)arg); + + RETURN_LONG((long)res); +} + +U_CFUNC PHP_FUNCTION(breakiter_first) +{ + _breakiter_no_args_ret_int32("breakiter_first", + &BreakIterator::first, + INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +U_CFUNC PHP_FUNCTION(breakiter_last) +{ + _breakiter_no_args_ret_int32("breakiter_last", + &BreakIterator::last, + INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +U_CFUNC PHP_FUNCTION(breakiter_previous) +{ + _breakiter_no_args_ret_int32("breakiter_previous", + &BreakIterator::previous, + INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +U_CFUNC PHP_FUNCTION(breakiter_next) +{ + bool no_arg_version = false; + + if (ZEND_NUM_ARGS() == 0) { + no_arg_version = true; + } else if (ZEND_NUM_ARGS() == 1) { + zval **arg; + int res = zend_get_parameters_ex(1, &arg); + assert(res == SUCCESS); + if (Z_TYPE_PP(arg) == IS_NULL) { + no_arg_version = true; + ht = 0; /* pretend we don't have any argument */ + } else { + no_arg_version = false; + } + } + + if (no_arg_version) { + _breakiter_no_args_ret_int32("breakiter_next", + &BreakIterator::next, + INTERNAL_FUNCTION_PARAM_PASSTHRU); + } else { + _breakiter_int32_ret_int32("breakiter_next", + &BreakIterator::next, + INTERNAL_FUNCTION_PARAM_PASSTHRU); + } +} + +U_CFUNC PHP_FUNCTION(breakiter_current) +{ + BREAKITER_METHOD_INIT_VARS; + object = getThis(); + + if (zend_parse_parameters_none() == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_current: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + int32_t res = bio->biter->current(); + + RETURN_LONG((long)res); +} + +U_CFUNC PHP_FUNCTION(breakiter_following) +{ + _breakiter_int32_ret_int32("breakiter_following", + &BreakIterator::following, + INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +U_CFUNC PHP_FUNCTION(breakiter_preceding) +{ + _breakiter_int32_ret_int32("breakiter_preceding", + &BreakIterator::preceding, + INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +U_CFUNC PHP_FUNCTION(breakiter_is_boundary) +{ + long offset; + BREAKITER_METHOD_INIT_VARS; + object = getThis(); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", + &offset) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_is_boundary: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + if (offset < INT32_MIN || offset > INT32_MAX) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_is_boundary: offset argument is outside bounds of " + "a 32-bit wide integer", 0 TSRMLS_CC); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + UBool res = bio->biter->isBoundary((int32_t)offset); + + RETURN_BOOL((long)res); +} + +U_CFUNC PHP_FUNCTION(breakiter_get_locale) +{ + long locale_type; + BREAKITER_METHOD_INIT_VARS; + object = getThis(); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &locale_type) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_get_locale: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + if (locale_type != ULOC_ACTUAL_LOCALE && locale_type != ULOC_VALID_LOCALE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_get_locale: invalid locale type", 0 TSRMLS_CC); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + Locale locale = bio->biter->getLocale((ULocDataLocaleType)locale_type, + BREAKITER_ERROR_CODE(bio)); + INTL_METHOD_CHECK_STATUS(bio, + "breakiter_get_locale: Call to ICU method has failed"); + + RETURN_STRING(locale.getName(), 1); +} + +U_CFUNC PHP_FUNCTION(breakiter_get_parts_iterator) +{ + long key_type = 0; + BREAKITER_METHOD_INIT_VARS; + object = getThis(); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &key_type) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_get_parts_iterator: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + if (key_type != PARTS_ITERATOR_KEY_SEQUENTIAL + && key_type != PARTS_ITERATOR_KEY_LEFT + && key_type != PARTS_ITERATOR_KEY_RIGHT) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_get_parts_iterator: bad key type", 0 TSRMLS_CC); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + IntlIterator_from_BreakIterator_parts( + object, return_value, (parts_iter_key_type)key_type TSRMLS_CC); +} + +U_CFUNC PHP_FUNCTION(breakiter_get_error_code) +{ + BREAKITER_METHOD_INIT_VARS; + object = getThis(); + + if (zend_parse_parameters_none() == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_get_error_code: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + /* Fetch the object (without resetting its last error code ). */ + bio = (BreakIterator_object*)zend_object_store_get_object(object TSRMLS_CC); + if (bio == NULL) + RETURN_FALSE; + + RETURN_LONG((long)BREAKITER_ERROR_CODE(bio)); +} + +U_CFUNC PHP_FUNCTION(breakiter_get_error_message) +{ + const char* message = NULL; + BREAKITER_METHOD_INIT_VARS; + object = getThis(); + + if (zend_parse_parameters_none() == FAILURE) { + intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_get_error_message: bad arguments", 0 TSRMLS_CC ); + RETURN_FALSE; + } + + + /* Fetch the object (without resetting its last error code ). */ + bio = (BreakIterator_object*)zend_object_store_get_object(object TSRMLS_CC); + if (bio == NULL) + RETURN_FALSE; + + /* Return last error message. */ + message = intl_error_get_message(BREAKITER_ERROR_P(bio) TSRMLS_CC); + RETURN_STRING(message, 0); +} diff --git a/ext/intl/breakiterator/breakiterator_methods.h b/ext/intl/breakiterator/breakiterator_methods.h new file mode 100644 index 0000000000000..a479ac92e8549 --- /dev/null +++ b/ext/intl/breakiterator/breakiterator_methods.h @@ -0,0 +1,64 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ + */ + +#ifndef BREAKITERATOR_METHODS_H +#define BREAKITERATOR_METHODS_H + +#include + +PHP_METHOD(BreakIterator, __construct); + +PHP_FUNCTION(breakiter_create_word_instance); + +PHP_FUNCTION(breakiter_create_line_instance); + +PHP_FUNCTION(breakiter_create_character_instance); + +PHP_FUNCTION(breakiter_create_sentence_instance); + +PHP_FUNCTION(breakiter_create_title_instance); + +PHP_FUNCTION(breakiter_create_code_point_instance); + +PHP_FUNCTION(breakiter_get_text); + +PHP_FUNCTION(breakiter_set_text); + +PHP_FUNCTION(breakiter_first); + +PHP_FUNCTION(breakiter_last); + +PHP_FUNCTION(breakiter_previous); + +PHP_FUNCTION(breakiter_next); + +PHP_FUNCTION(breakiter_current); + +PHP_FUNCTION(breakiter_following); + +PHP_FUNCTION(breakiter_preceding); + +PHP_FUNCTION(breakiter_is_boundary); + +PHP_FUNCTION(breakiter_get_locale); + +PHP_FUNCTION(breakiter_get_parts_iterator); + +PHP_FUNCTION(breakiter_get_error_code); + +PHP_FUNCTION(breakiter_get_error_message); + +#endif \ No newline at end of file diff --git a/ext/intl/breakiterator/codepointiterator_internal.cpp b/ext/intl/breakiterator/codepointiterator_internal.cpp new file mode 100644 index 0000000000000..bf9239d531ffc --- /dev/null +++ b/ext/intl/breakiterator/codepointiterator_internal.cpp @@ -0,0 +1,291 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ + */ + +#include "codepointiterator_internal.h" +#include +#include + +//copied from cmemory.h, which is not public +typedef union { + long t1; + double t2; + void *t3; +} UAlignedMemory; + +#define U_POINTER_MASK_LSB(ptr, mask) (((ptrdiff_t)(char *)(ptr)) & (mask)) +#define U_ALIGNMENT_OFFSET(ptr) U_POINTER_MASK_LSB(ptr, sizeof(UAlignedMemory) - 1) +#define U_ALIGNMENT_OFFSET_UP(ptr) (sizeof(UAlignedMemory) - U_ALIGNMENT_OFFSET(ptr)) + +using namespace PHP; + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CodePointBreakIterator); + +CodePointBreakIterator::CodePointBreakIterator() +: BreakIterator(), fCharIter(NULL), lastCodePoint(U_SENTINEL) +{ + UErrorCode uec = UErrorCode(); + this->fText = utext_openUChars(NULL, NULL, 0, &uec); +} + +CodePointBreakIterator::CodePointBreakIterator(const PHP::CodePointBreakIterator &other) +: BreakIterator(other), fText(NULL), fCharIter(NULL), lastCodePoint(U_SENTINEL) +{ + *this = other; +} + +CodePointBreakIterator& CodePointBreakIterator::operator=(const CodePointBreakIterator& that) +{ + UErrorCode uec = UErrorCode(); + UText *ut_clone = NULL; + + if (this == &that) { + return *this; + } + + this->fText = utext_clone(this->fText, that.fText, FALSE, TRUE, &uec); + + //don't bother copying the character iterator, getText() is deprecated + clearCurrentCharIter(); + + this->lastCodePoint = that.lastCodePoint; + return *this; +} + +CodePointBreakIterator::~CodePointBreakIterator() +{ + if (this->fText) { + utext_close(this->fText); + } + clearCurrentCharIter(); +} + +UBool CodePointBreakIterator::operator==(const BreakIterator& that) const +{ + if (typeid(*this) != typeid(that)) { + return FALSE; + } + + const CodePointBreakIterator& that2 = + static_cast(that); + + if (!utext_equals(this->fText, that2.fText)) { + return FALSE; + } + + return TRUE; +} + +CodePointBreakIterator* CodePointBreakIterator::clone(void) const +{ + return new CodePointBreakIterator(*this); +} + +CharacterIterator& CodePointBreakIterator::getText(void) const +{ + if (this->fCharIter == NULL) { + //this method is deprecated anyway; setup bogus iterator + static const UChar c = 0; + this->fCharIter = new UCharCharacterIterator(&c, 0); + } + + return *this->fCharIter; +} + +UText *CodePointBreakIterator::getUText(UText *fillIn, UErrorCode &status) const +{ + return utext_clone(fillIn, this->fText, FALSE, TRUE, &status); +} + +void CodePointBreakIterator::setText(const UnicodeString &text) +{ + UErrorCode uec = UErrorCode(); + + //this closes the previous utext, if any + this->fText = utext_openConstUnicodeString(this->fText, &text, &uec); + + clearCurrentCharIter(); +} + +void CodePointBreakIterator::setText(UText *text, UErrorCode &status) +{ + if (U_FAILURE(status)) { + return; + } + + this->fText = utext_clone(this->fText, text, FALSE, TRUE, &status); + + clearCurrentCharIter(); +} + +void CodePointBreakIterator::adoptText(CharacterIterator* it) +{ + UErrorCode uec = UErrorCode(); + clearCurrentCharIter(); + + this->fCharIter = it; + this->fText = utext_openCharacterIterator(this->fText, it, &uec); +} + +int32_t CodePointBreakIterator::first(void) +{ + UTEXT_SETNATIVEINDEX(this->fText, 0); + this->lastCodePoint = U_SENTINEL; + + return 0; +} + +int32_t CodePointBreakIterator::last(void) +{ + int32_t pos = (int32_t)utext_nativeLength(this->fText); + UTEXT_SETNATIVEINDEX(this->fText, pos); + this->lastCodePoint = U_SENTINEL; + + return pos; +} + +int32_t CodePointBreakIterator::previous(void) +{ + this->lastCodePoint = UTEXT_PREVIOUS32(this->fText); + if (this->lastCodePoint == U_SENTINEL) { + return BreakIterator::DONE; + } + + return (int32_t)UTEXT_GETNATIVEINDEX(this->fText); +} + +int32_t CodePointBreakIterator::next(void) +{ + this->lastCodePoint = UTEXT_NEXT32(this->fText); + if (this->lastCodePoint == U_SENTINEL) { + return BreakIterator::DONE; + } + + return (int32_t)UTEXT_GETNATIVEINDEX(this->fText); +} + +int32_t CodePointBreakIterator::current(void) const +{ + return (int32_t)UTEXT_GETNATIVEINDEX(this->fText); +} + +int32_t CodePointBreakIterator::following(int32_t offset) +{ + this->lastCodePoint = utext_next32From(this->fText, offset); + if (this->lastCodePoint == U_SENTINEL) { + return BreakIterator::DONE; + } + + return (int32_t)UTEXT_GETNATIVEINDEX(this->fText); +} + +int32_t CodePointBreakIterator::preceding(int32_t offset) +{ + this->lastCodePoint = utext_previous32From(this->fText, offset); + if (this->lastCodePoint == U_SENTINEL) { + return BreakIterator::DONE; + } + + return (int32_t)UTEXT_GETNATIVEINDEX(this->fText); +} + +UBool CodePointBreakIterator::isBoundary(int32_t offset) +{ + //this function has side effects, and it's supposed to + utext_setNativeIndex(this->fText, offset); + return (offset == utext_getNativeIndex(this->fText)); +} + +int32_t CodePointBreakIterator::next(int32_t n) +{ + UBool res = utext_moveIndex32(this->fText, n); + +#ifndef UTEXT_CURRENT32 +#define UTEXT_CURRENT32 utext_current32 +#endif + + if (res) { + this->lastCodePoint = UTEXT_CURRENT32(this->fText); + return (int32_t)UTEXT_GETNATIVEINDEX(this->fText); + } else { + this->lastCodePoint = U_SENTINEL; + return BreakIterator::DONE; + } +} + +CodePointBreakIterator *CodePointBreakIterator::createBufferClone( + void *stackBuffer, int32_t &bufferSize, UErrorCode &status) +{ + //see implementation of RuleBasedBreakIterator::createBufferClone() + if (U_FAILURE(status)) { + return NULL; + } + + if (bufferSize <= 0) { + bufferSize = sizeof(CodePointBreakIterator) + U_ALIGNMENT_OFFSET_UP(0); + return NULL; + } + + char *buf = (char*)stackBuffer; + uint32_t s = bufferSize; + + if (stackBuffer == NULL) { + s = 0; + } + + if (U_ALIGNMENT_OFFSET(stackBuffer) != 0) { + uint32_t offsetUp = (uint32_t)U_ALIGNMENT_OFFSET_UP(buf); + s -= offsetUp; + buf += offsetUp; + } + + if (s < sizeof(CodePointBreakIterator)) { + CodePointBreakIterator *clonedBI = new CodePointBreakIterator(*this); + if (clonedBI == NULL) { + status = U_MEMORY_ALLOCATION_ERROR; + } else { + status = U_SAFECLONE_ALLOCATED_WARNING; + } + + return clonedBI; + } + + return new(buf) CodePointBreakIterator(*this); +} + +CodePointBreakIterator &CodePointBreakIterator::refreshInputText(UText *input, UErrorCode &status) +{ + //see implementation of RuleBasedBreakIterator::createBufferClone() + if (U_FAILURE(status)) { + return *this; + } + if (input == NULL) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return *this; + } + + int64_t pos = utext_getNativeIndex(this->fText); + this->fText = utext_clone(this->fText, input, FALSE, TRUE, &status); + if (U_FAILURE(status)) { + return *this; + } + + utext_setNativeIndex(this->fText, pos); + if (utext_getNativeIndex(fText) != pos) { + status = U_ILLEGAL_ARGUMENT_ERROR; + } + + return *this; +} diff --git a/ext/intl/breakiterator/codepointiterator_internal.h b/ext/intl/breakiterator/codepointiterator_internal.h new file mode 100644 index 0000000000000..988b91c2009cf --- /dev/null +++ b/ext/intl/breakiterator/codepointiterator_internal.h @@ -0,0 +1,98 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ + */ + +#ifndef CODEPOINTITERATOR_INTERNAL_H +#define CODEPOINTITERATOR_INTERNAL_H + +#include + +using U_ICU_NAMESPACE::BreakIterator; + +namespace PHP { + + class CodePointBreakIterator : public BreakIterator { + + public: + static UClassID getStaticClassID(); + + CodePointBreakIterator(); + + CodePointBreakIterator(const CodePointBreakIterator &other); + + CodePointBreakIterator& operator=(const CodePointBreakIterator& that); + + virtual ~CodePointBreakIterator(); + + virtual UBool operator==(const BreakIterator& that) const; + + virtual CodePointBreakIterator* clone(void) const; + + virtual UClassID getDynamicClassID(void) const; + + virtual CharacterIterator& getText(void) const; + + virtual UText *getUText(UText *fillIn, UErrorCode &status) const; + + virtual void setText(const UnicodeString &text); + + virtual void setText(UText *text, UErrorCode &status); + + virtual void adoptText(CharacterIterator* it); + + virtual int32_t first(void); + + virtual int32_t last(void); + + virtual int32_t previous(void); + + virtual int32_t next(void); + + virtual int32_t current(void) const; + + virtual int32_t following(int32_t offset); + + virtual int32_t preceding(int32_t offset); + + virtual UBool isBoundary(int32_t offset); + + virtual int32_t next(int32_t n); + + virtual CodePointBreakIterator *createBufferClone(void *stackBuffer, + int32_t &BufferSize, + UErrorCode &status); + + virtual CodePointBreakIterator &refreshInputText(UText *input, UErrorCode &status); + + inline UChar32 getLastCodePoint() + { + return this->lastCodePoint; + } + + private: + UText *fText; + UChar32 lastCodePoint; + mutable CharacterIterator *fCharIter; + + inline void clearCurrentCharIter() + { + delete this->fCharIter; + this->fCharIter = NULL; + this->lastCodePoint = U_SENTINEL; + } + }; +} + +#endif \ No newline at end of file diff --git a/ext/intl/breakiterator/codepointiterator_methods.cpp b/ext/intl/breakiterator/codepointiterator_methods.cpp new file mode 100644 index 0000000000000..ae7e526eadac4 --- /dev/null +++ b/ext/intl/breakiterator/codepointiterator_methods.cpp @@ -0,0 +1,44 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ + */ + +#include "codepointiterator_internal.h" + +extern "C" { +#define USE_BREAKITERATOR_POINTER 1 +#include "breakiterator_class.h" +} + +using PHP::CodePointBreakIterator; + +static inline CodePointBreakIterator *fetch_cpbi(BreakIterator_object *bio) { + return (CodePointBreakIterator*)bio->biter; +} + +U_CFUNC PHP_FUNCTION(cpbi_get_last_code_point) +{ + BREAKITER_METHOD_INIT_VARS; + object = getThis(); + + if (zend_parse_parameters_none() == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "cpbi_get_last_code_point: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + RETURN_LONG(fetch_cpbi(bio)->getLastCodePoint()); +} \ No newline at end of file diff --git a/ext/intl/breakiterator/codepointiterator_methods.h b/ext/intl/breakiterator/codepointiterator_methods.h new file mode 100644 index 0000000000000..d34e5b61e2211 --- /dev/null +++ b/ext/intl/breakiterator/codepointiterator_methods.h @@ -0,0 +1,24 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ + */ + +#ifndef CODEPOINTITERATOR_METHODS_H +#define CODEPOINTITERATOR_METHODS_H + +#include + +PHP_FUNCTION(cpbi_get_last_code_point); + +#endif \ No newline at end of file diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp new file mode 100644 index 0000000000000..454e5249fde96 --- /dev/null +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp @@ -0,0 +1,221 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ + */ + +#include + +extern "C" { +#define USE_BREAKITERATOR_POINTER 1 +#include "breakiterator_class.h" +#include +#include +} + +#include "../intl_convertcpp.h" + +static inline RuleBasedBreakIterator *fetch_rbbi(BreakIterator_object *bio) { + return (RuleBasedBreakIterator*)bio->biter; +} + +static void _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAMETERS) +{ + zval *object = getThis(); + char *rules; + int rules_len; + zend_bool compiled = 0; + UErrorCode status = U_ZERO_ERROR; + intl_error_reset(NULL TSRMLS_CC); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", + &rules, &rules_len, &compiled) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "rbbi_create_instance: bad arguments", 0 TSRMLS_CC); + RETURN_NULL(); + } + + // instantiation of ICU object + RuleBasedBreakIterator *rbbi; + + if (!compiled) { + UnicodeString rulesStr; + UParseError parseError = UParseError(); + if (intl_stringFromChar(rulesStr, rules, rules_len, &status) + == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "rbbi_create_instance: rules were not a valid UTF-8 string", + 0 TSRMLS_CC); + RETURN_NULL(); + } + + rbbi = new RuleBasedBreakIterator(rulesStr, parseError, status); + intl_error_set_code(NULL, status TSRMLS_CC); + if (U_FAILURE(status)) { + char *msg; + smart_str parse_error_str; + parse_error_str = intl_parse_error_to_string(&parseError); + spprintf(&msg, 0, "rbbi_create_instance: unable to create " + "RuleBasedBreakIterator from rules (%s)", parse_error_str.c); + smart_str_free(&parse_error_str); + intl_error_set_custom_msg(NULL, msg, 1 TSRMLS_CC); + efree(msg); + delete rbbi; + RETURN_NULL(); + } + } else { // compiled +#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48 + rbbi = new RuleBasedBreakIterator((uint8_t*)rules, rules_len, status); + if (U_FAILURE(status)) { + intl_error_set(NULL, status, "rbbi_create_instance: unable to " + "create instance from compiled rules", 0 TSRMLS_CC); + delete rbbi; + RETURN_NULL(); + } +#else + intl_error_set(NULL, U_UNSUPPORTED_ERROR, "rbbi_create_instance: " + "compiled rules require ICU >= 4.8", 0 TSRMLS_CC); + RETURN_NULL(); +#endif + } + + breakiterator_object_create(return_value, rbbi TSRMLS_CC); +} + +U_CFUNC PHP_METHOD(IntlRuleBasedBreakIterator, __construct) +{ + zval orig_this = *getThis(); + + return_value = getThis(); + //changes this to IS_NULL (without first destroying) if there's an error + _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU); + + if (Z_TYPE_P(return_value) == IS_NULL) { + zend_object_store_ctor_failed(&orig_this TSRMLS_CC); + zval_dtor(&orig_this); + } +} + +U_CFUNC PHP_FUNCTION(rbbi_get_rules) +{ + BREAKITER_METHOD_INIT_VARS; + object = getThis(); + + if (zend_parse_parameters_none() == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "rbbi_get_rules: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + const UnicodeString rules = fetch_rbbi(bio)->getRules(); + + Z_TYPE_P(return_value) = IS_STRING; + if (intl_charFromString(rules, &Z_STRVAL_P(return_value), + &Z_STRLEN_P(return_value), BREAKITER_ERROR_CODE_P(bio)) == FAILURE) + { + intl_errors_set(BREAKITER_ERROR_P(bio), BREAKITER_ERROR_CODE(bio), + "rbbi_hash_code: Error converting result to UTF-8 string", + 0 TSRMLS_CC); + RETURN_FALSE; + } +} + +U_CFUNC PHP_FUNCTION(rbbi_get_rule_status) +{ + BREAKITER_METHOD_INIT_VARS; + object = getThis(); + + if (zend_parse_parameters_none() == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "rbbi_get_rule_status: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + RETURN_LONG(fetch_rbbi(bio)->getRuleStatus()); +} + +U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec) +{ + BREAKITER_METHOD_INIT_VARS; + object = getThis(); + + if (zend_parse_parameters_none() == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "rbbi_get_rule_status_vec: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + int32_t num_rules = fetch_rbbi(bio)->getRuleStatusVec(NULL, 0, + BREAKITER_ERROR_CODE(bio)); + if (BREAKITER_ERROR_CODE(bio) == U_BUFFER_OVERFLOW_ERROR) { + BREAKITER_ERROR_CODE(bio) = U_ZERO_ERROR; + } else { + // should not happen + INTL_METHOD_CHECK_STATUS(bio, "rbbi_get_rule_status_vec: failed " + " determining the number of status values"); + } + int32_t *rules = new int32_t[num_rules]; + num_rules = fetch_rbbi(bio)->getRuleStatusVec(rules, num_rules, + BREAKITER_ERROR_CODE(bio)); + if (U_FAILURE(BREAKITER_ERROR_CODE(bio))) { + delete[] rules; + intl_errors_set(BREAKITER_ERROR_P(bio), BREAKITER_ERROR_CODE(bio), + "rbbi_get_rule_status_vec: failed obtaining the status values", + 0 TSRMLS_CC); + RETURN_FALSE; + } + + array_init_size(return_value, num_rules); + for (int32_t i = 0; i < num_rules; i++) { + add_next_index_long(return_value, rules[i]); + } + delete[] rules; +} + +#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48 +U_CFUNC PHP_FUNCTION(rbbi_get_binary_rules) +{ + BREAKITER_METHOD_INIT_VARS; + object = getThis(); + + if (zend_parse_parameters_none() == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "rbbi_get_binary_rules: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + uint32_t rules_len; + const uint8_t *rules = fetch_rbbi(bio)->getBinaryRules(rules_len); + + if (rules_len > INT_MAX - 1) { + intl_errors_set(BREAKITER_ERROR_P(bio), BREAKITER_ERROR_CODE(bio), + "rbbi_get_binary_rules: the rules are too large", + 0 TSRMLS_CC); + RETURN_FALSE; + } + + char *ret_rules = static_cast(emalloc(rules_len + 1)); + memcpy(ret_rules, rules, rules_len); + ret_rules[rules_len] = '\0'; + + RETURN_STRINGL(ret_rules, rules_len, 0); +} +#endif diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.h b/ext/intl/breakiterator/rulebasedbreakiterator_methods.h new file mode 100644 index 0000000000000..edea4ea2a6976 --- /dev/null +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.h @@ -0,0 +1,32 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ + */ + +#ifndef RULEBASEDBREAKITERATOR_METHODS_H +#define RULEBASEDBREAKITERATOR_METHODS_H + +#include + +PHP_METHOD(IntlRuleBasedBreakIterator, __construct); + +PHP_FUNCTION(rbbi_get_rules); + +PHP_FUNCTION(rbbi_get_rule_status); + +PHP_FUNCTION(rbbi_get_rule_status_vec); + +PHP_FUNCTION(rbbi_get_binary_rules); + +#endif \ No newline at end of file diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp index 1a477396ddd08..beb65f718f43f 100644 --- a/ext/intl/calendar/calendar_class.cpp +++ b/ext/intl/calendar/calendar_class.cpp @@ -18,6 +18,8 @@ #include "config.h" #endif +#include "../intl_cppshims.h" + #include #include @@ -55,6 +57,14 @@ U_CFUNC void calendar_object_create(zval *object, calendar_object_construct(object, calendar TSRMLS_CC); } +U_CFUNC Calendar *calendar_fetch_native_calendar(zval *object TSRMLS_DC) +{ + Calendar_object *co = (Calendar_object*) + zend_object_store_get_object(object TSRMLS_CC); + + return co->ucal; +} + U_CFUNC void calendar_object_construct(zval *object, Calendar *calendar TSRMLS_DC) { @@ -143,6 +153,8 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp TSRMLS_DC) Calendar_object *co; const Calendar *cal; + *is_temp = 1; + array_init_size(&zv, 8); co = (Calendar_object*)zend_object_store_get_object(object TSRMLS_CC); @@ -204,8 +216,6 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp TSRMLS_DC) add_assoc_zval_ex(&zv, "fields", sizeof("fields"), zfields); - *is_temp = 1; - return Z_ARRVAL(zv); } /* }}} */ @@ -316,8 +326,8 @@ ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_add, 0, 0, 2) ZEND_ARG_INFO(0, amount) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_setTimeZone, 0, 0, 2) - ZEND_ARG_OBJ_INFO(0, timeZone, IntlTimeZone, 1) +ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_setTimeZone, 0, 0, 1) + ZEND_ARG_INFO(0, timeZone) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_set, 0, 0, 2) @@ -351,6 +361,10 @@ ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_setLenient, 0, 0, 1) ZEND_ARG_INFO(0, isLenient) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_from_date_time, 0, 0, 1) + ZEND_ARG_INFO(0, dateTime) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_wall_time_option, 0, 0, 1) ZEND_ARG_INFO(0, wallTimeOption) ZEND_END_ARG_INFO() @@ -426,6 +440,8 @@ static const zend_function_entry Calendar_class_functions[] = { PHP_ME_MAPPING(setRepeatedWallTimeOption,intlcal_set_repeated_wall_time_option,ainfo_cal_wall_time_option,ZEND_ACC_PUBLIC) PHP_ME_MAPPING(setSkippedWallTimeOption,intlcal_set_skipped_wall_time_option,ainfo_cal_wall_time_option,ZEND_ACC_PUBLIC) #endif + PHP_ME_MAPPING(fromDateTime, intlcal_from_date_time, ainfo_cal_from_date_time, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(toDateTime, intlcal_to_date_time, ainfo_cal_void, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getErrorCode, intlcal_get_error_code, ainfo_cal_void, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getErrorMessage, intlcal_get_error_message, ainfo_cal_void, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/intl/calendar/calendar_class.h b/ext/intl/calendar/calendar_class.h index c41c021fcdf25..140389b639378 100644 --- a/ext/intl/calendar/calendar_class.h +++ b/ext/intl/calendar/calendar_class.h @@ -56,12 +56,15 @@ typedef struct { void calendar_object_create(zval *object, Calendar *calendar TSRMLS_DC); +Calendar *calendar_fetch_native_calendar(zval *object TSRMLS_DC); + void calendar_object_construct(zval *object, Calendar *calendar TSRMLS_DC); void calendar_register_IntlCalendar_class(TSRMLS_D); extern zend_class_entry *Calendar_ce_ptr, *GregorianCalendar_ce_ptr; + extern zend_object_handlers Calendar_handlers; #endif /* #ifndef CALENDAR_CLASS_H */ diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index f8d977c4289d0..f2758fdcc8b29 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -18,18 +18,25 @@ #include "config.h" #endif +#include "../intl_cppshims.h" + #include #include #include + #include "../intl_convertcpp.h" +#include "../common/common_date.h" + extern "C" { +#include "../php_intl.h" #define USE_TIMEZONE_POINTER 1 #include "../timezone/timezone_class.h" #define USE_CALENDAR_POINTER 1 #include "calendar_class.h" #include "../intl_convert.h" -#include "../locale/locale.h" #include +#include +#include } #include "../common/common_enum.h" @@ -56,7 +63,7 @@ U_CFUNC PHP_FUNCTION(intlcal_create_instance) RETURN_NULL(); } - timeZone = timezone_process_timezone_argument(zv_timezone, + timeZone = timezone_process_timezone_argument(zv_timezone, NULL, "intlcal_create_instance" TSRMLS_CC); if (timeZone == NULL) { RETURN_NULL(); @@ -323,11 +330,10 @@ U_CFUNC PHP_FUNCTION(intlcal_set_time_zone) { zval *zv_timezone; TimeZone *timeZone; - TimeZone_object *tzo; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "OO!", &object, Calendar_ce_ptr, &zv_timezone, TimeZone_ce_ptr) == FAILURE) { + "Oz!", &object, Calendar_ce_ptr, &zv_timezone) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set_time_zone: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -338,18 +344,10 @@ U_CFUNC PHP_FUNCTION(intlcal_set_time_zone) if (zv_timezone == NULL) { RETURN_TRUE; /* the method does nothing if passed null */ } - - tzo = static_cast( - zend_object_store_get_object(zv_timezone TSRMLS_CC)); - if (tzo->utimezone == NULL) { - intl_errors_set(&co->err, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_set_time_zone: found unsconstructed IntlTimeZone", 0 TSRMLS_CC); - RETURN_FALSE; - } - timeZone = tzo->utimezone->clone(); + + timeZone = timezone_process_timezone_argument(&zv_timezone, + CALENDAR_ERROR_P(co), "intlcal_set_time_zone" TSRMLS_CC); if (timeZone == NULL) { - intl_errors_set(&co->err, U_MEMORY_ALLOCATION_ERROR, - "intlcal_set_time_zone: error cloning ICU TimeZone", 0 TSRMLS_CC); RETURN_FALSE; } @@ -1114,6 +1112,179 @@ U_CFUNC PHP_FUNCTION(intlcal_set_skipped_wall_time_option) #endif +U_CFUNC PHP_FUNCTION(intlcal_from_date_time) +{ + zval **zv_arg, + *zv_datetime = NULL, + *zv_timestamp = NULL; + php_date_obj *datetime; + char *locale_str = NULL; + int locale_str_len; + TimeZone *timeZone; + UErrorCode status = U_ZERO_ERROR; + Calendar *cal; + intl_error_reset(NULL TSRMLS_CC); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|s!", + &zv_arg, &locale_str, &locale_str_len) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "intlcal_from_date_time: bad arguments", 0 TSRMLS_CC); + RETURN_NULL(); + } + + if (!(Z_TYPE_PP(zv_arg) == IS_OBJECT && instanceof_function( + Z_OBJCE_PP(zv_arg), php_date_get_date_ce() TSRMLS_CC))) { + ALLOC_INIT_ZVAL(zv_datetime); + object_init_ex(zv_datetime, php_date_get_date_ce()); + zend_call_method_with_1_params(&zv_datetime, NULL, NULL, "__construct", + NULL, *zv_arg); + if (EG(exception)) { + zend_object_store_ctor_failed(zv_datetime TSRMLS_CC); + goto error; + } + } else { + zv_datetime = *zv_arg; + } + + datetime = (php_date_obj*)zend_object_store_get_object(zv_datetime TSRMLS_CC); + if (!datetime->time) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "intlcal_from_date_time: DateTime object is unconstructed", + 0 TSRMLS_CC); + goto error; + } + + zend_call_method_with_0_params(&zv_datetime, php_date_get_date_ce(), + NULL, "gettimestamp", &zv_timestamp); + if (!zv_timestamp || Z_TYPE_P(zv_timestamp) != IS_LONG) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "intlcal_from_date_time: bad DateTime; call to " + "DateTime::getTimestamp() failed", 0 TSRMLS_CC); + goto error; + } + + if (!datetime->time->is_localtime) { + timeZone = TimeZone::getGMT()->clone(); + } else { + timeZone = timezone_convert_datetimezone(datetime->time->zone_type, + datetime, 1, NULL, "intlcal_from_date_time" TSRMLS_CC); + if (timeZone == NULL) { + goto error; + } + } + + if (!locale_str) { + locale_str = const_cast(intl_locale_get_default(TSRMLS_C)); + } + + cal = Calendar::createInstance(timeZone, + Locale::createFromName(locale_str), status); + if (cal == NULL) { + delete timeZone; + intl_error_set(NULL, status, "intlcal_from_date_time: " + "error creating ICU Calendar object", 0 TSRMLS_CC); + goto error; + } + cal->setTime(((UDate)Z_LVAL_P(zv_timestamp)) * 1000., status); + if (U_FAILURE(status)) { + /* time zone was adopted by cal; should not be deleted here */ + delete cal; + intl_error_set(NULL, status, "intlcal_from_date_time: " + "error creating ICU Calendar::setTime()", 0 TSRMLS_CC); + goto error; + } + + calendar_object_create(return_value, cal TSRMLS_CC); + +error: + if (zv_datetime != *zv_arg) { + zval_ptr_dtor(&zv_datetime); + } + if (zv_timestamp) { + zval_ptr_dtor(&zv_timestamp); + } +} + +U_CFUNC PHP_FUNCTION(intlcal_to_date_time) +{ + zval *retval = NULL; + CALENDAR_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", + &object, Calendar_ce_ptr) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "intlcal_to_date_time: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + CALENDAR_METHOD_FETCH_OBJECT; + + /* There are no exported functions in ext/date to this + * in a more native fashion */ + double date = co->ucal->getTime(CALENDAR_ERROR_CODE(co)) / 1000.; + int64_t ts; + char ts_str[sizeof("@-9223372036854775808")]; + int ts_str_len; + zval ts_zval = zval_used_for_init; + + INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed"); + + if (date > (double)U_INT64_MAX || date < (double)U_INT64_MIN) { + intl_errors_set(CALENDAR_ERROR_P(co), U_ILLEGAL_ARGUMENT_ERROR, + "intlcal_to_date_time: The calendar date is out of the " + "range for a 64-bit integer", 0 TSRMLS_CC); + RETURN_FALSE; + } + + ts = (int64_t)date; + + ts_str_len = slprintf(ts_str, sizeof(ts_str), "@%I64d", ts); + ZVAL_STRINGL(&ts_zval, ts_str, ts_str_len, 0); + + /* Now get the time zone */ + const TimeZone& tz = co->ucal->getTimeZone(); + zval *timezone_zval = timezone_convert_to_datetimezone( + &tz, CALENDAR_ERROR_P(co), "intlcal_to_date_time" TSRMLS_CC); + if (timezone_zval == NULL) { + RETURN_FALSE; + } + + /* resources allocated from now on */ + + /* Finally, instantiate object and call constructor */ + object_init_ex(return_value, php_date_get_date_ce()); + zend_call_method_with_2_params(&return_value, NULL, NULL, "__construct", + NULL, &ts_zval, timezone_zval); + if (EG(exception)) { + intl_errors_set(CALENDAR_ERROR_P(co), U_ILLEGAL_ARGUMENT_ERROR, + "intlcal_to_date_time: DateTime constructor has thrown exception", + 1 TSRMLS_CC); + zend_object_store_ctor_failed(return_value TSRMLS_CC); + zval_ptr_dtor(&return_value); + + RETVAL_FALSE; + goto error; + } + + /* due to bug #40743, we have to set the time zone again */ + zend_call_method_with_1_params(&return_value, NULL, NULL, "settimezone", + &retval, timezone_zval); + if (retval == NULL || Z_TYPE_P(retval) == IS_BOOL) { + intl_errors_set(CALENDAR_ERROR_P(co), U_ILLEGAL_ARGUMENT_ERROR, + "intlcal_to_date_time: call to DateTime::setTimeZone has failed", + 1 TSRMLS_CC); + zval_ptr_dtor(&return_value); + RETVAL_FALSE; + goto error; + } + +error: + zval_ptr_dtor(&timezone_zval); + if (retval != NULL) { + zval_ptr_dtor(&retval); + } +} + U_CFUNC PHP_FUNCTION(intlcal_get_error_code) { CALENDAR_METHOD_INIT_VARS; diff --git a/ext/intl/calendar/calendar_methods.h b/ext/intl/calendar/calendar_methods.h index 95ff5375b52bc..2be13e4920224 100644 --- a/ext/intl/calendar/calendar_methods.h +++ b/ext/intl/calendar/calendar_methods.h @@ -101,6 +101,10 @@ PHP_FUNCTION(intlcal_set_repeated_wall_time_option); PHP_FUNCTION(intlcal_set_skipped_wall_time_option); +PHP_FUNCTION(intlcal_from_date_time); + +PHP_FUNCTION(intlcal_to_date_time); + PHP_FUNCTION(intlcal_get_error_code); PHP_FUNCTION(intlcal_get_error_message); diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp index 31fb8a8991457..3c05253de1e19 100644 --- a/ext/intl/calendar/gregoriancalendar_methods.cpp +++ b/ext/intl/calendar/gregoriancalendar_methods.cpp @@ -18,17 +18,17 @@ #include "config.h" #endif +#include "../intl_cppshims.h" + #include #include #include extern "C" { +#include "../php_intl.h" #define USE_TIMEZONE_POINTER 1 #include "../timezone/timezone_class.h" #define USE_CALENDAR_POINTER 1 #include "calendar_class.h" -#include "../locale/locale.h" -/* avoid redefinition of int8_t, already defined in unicode/pwin32.h */ -#define _MSC_STDINT_H_ 1 #include } @@ -88,7 +88,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS) if (variant <= 2) { // From timezone and locale (0 to 2 arguments) - TimeZone *tz = timezone_process_timezone_argument(tz_object, + TimeZone *tz = timezone_process_timezone_argument(tz_object, NULL, "intlgregcal_create_instance" TSRMLS_CC); if (tz == NULL) { RETURN_NULL(); diff --git a/ext/intl/collator/collator.c b/ext/intl/collator/collator.c old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator.h b/ext/intl/collator/collator.h old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_attr.c b/ext/intl/collator/collator_attr.c old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_attr.h b/ext/intl/collator/collator_attr.h old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_class.c b/ext/intl/collator/collator_class.c old mode 100755 new mode 100644 index de744dcefeccd..d1fa10ef2c7c7 --- a/ext/intl/collator/collator_class.c +++ b/ext/intl/collator/collator_class.c @@ -67,6 +67,7 @@ zend_object_value Collator_object_create( intern = ecalloc( 1, sizeof(Collator_object) ); intl_error_init( COLLATOR_ERROR_P( intern ) TSRMLS_CC ); zend_object_std_init( &intern->zo, ce TSRMLS_CC ); + object_properties_init(&intern->zo, ce); retval.handle = zend_objects_store_put( intern, diff --git a/ext/intl/collator/collator_class.h b/ext/intl/collator/collator_class.h old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_compare.c b/ext/intl/collator/collator_compare.c old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_compare.h b/ext/intl/collator/collator_compare.h old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_convert.c b/ext/intl/collator/collator_convert.c old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_convert.h b/ext/intl/collator/collator_convert.h old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_create.c b/ext/intl/collator/collator_create.c old mode 100755 new mode 100644 index 0f0cc193e4c34..a3b70159f2a0e --- a/ext/intl/collator/collator_create.c +++ b/ext/intl/collator/collator_create.c @@ -48,7 +48,7 @@ static void collator_ctor(INTERNAL_FUNCTION_PARAMETERS) co = (Collator_object *) zend_object_store_get_object( object TSRMLS_CC ); if(locale_len == 0) { - locale = INTL_G(default_locale); + locale = intl_locale_get_default(TSRMLS_C); } /* Open ICU collator. */ diff --git a/ext/intl/collator/collator_create.h b/ext/intl/collator/collator_create.h old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_error.c b/ext/intl/collator/collator_error.c old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_error.h b/ext/intl/collator/collator_error.h old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_is_numeric.c b/ext/intl/collator/collator_is_numeric.c old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_is_numeric.h b/ext/intl/collator/collator_is_numeric.h old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_locale.c b/ext/intl/collator/collator_locale.c old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_locale.h b/ext/intl/collator/collator_locale.h old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_sort.c b/ext/intl/collator/collator_sort.c old mode 100755 new mode 100644 index 76ee8186c9491..04a24f013e8af --- a/ext/intl/collator/collator_sort.c +++ b/ext/intl/collator/collator_sort.c @@ -595,6 +595,8 @@ PHP_FUNCTION( collator_get_sort_key ) RETURN_FALSE; } + /* ucol_getSortKey is exception in that the key length includes the + * NUL terminator*/ key_len = ucol_getSortKey(co->ucoll, ustr, ustr_len, key, 0); if(!key_len) { efree( ustr ); @@ -606,7 +608,7 @@ PHP_FUNCTION( collator_get_sort_key ) if(!key_len) { RETURN_FALSE; } - RETURN_STRINGL((char *)key, key_len, 0); + RETURN_STRINGL((char *)key, key_len - 1, 0); } /* }}} */ diff --git a/ext/intl/collator/collator_sort.h b/ext/intl/collator/collator_sort.h old mode 100755 new mode 100644 diff --git a/ext/intl/common/common_date.cpp b/ext/intl/common/common_date.cpp new file mode 100644 index 0000000000000..ee998818d989f --- /dev/null +++ b/ext/intl/common/common_date.cpp @@ -0,0 +1,250 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#include "../intl_cppshims.h" + +#include + +extern "C" { +#include "../php_intl.h" +#define USE_CALENDAR_POINTER 1 +#include "../calendar/calendar_class.h" +#include +} + +#ifndef INFINITY +#define INFINITY (DBL_MAX+DBL_MAX) +#endif + +#ifndef NAN +#define NAN (INFINITY-INFINITY) +#endif + +/* {{{ timezone_convert_datetimezone + * The timezone in DateTime and DateTimeZone is not unified. */ +U_CFUNC TimeZone *timezone_convert_datetimezone(int type, + void *object, + int is_datetime, + intl_error *outside_error, + const char *func TSRMLS_DC) +{ + char *id = NULL, + offset_id[] = "GMT+00:00"; + int id_len = 0; + char *message; + TimeZone *timeZone; + + switch (type) { + case TIMELIB_ZONETYPE_ID: + id = is_datetime + ? ((php_date_obj*)object)->time->tz_info->name + : ((php_timezone_obj*)object)->tzi.tz->name; + id_len = strlen(id); + break; + case TIMELIB_ZONETYPE_OFFSET: { + int offset_mins = is_datetime + ? -((php_date_obj*)object)->time->z + : -(int)((php_timezone_obj*)object)->tzi.utc_offset, + hours = offset_mins / 60, + minutes = offset_mins - hours * 60; + minutes *= minutes > 0 ? 1 : -1; + + if (offset_mins <= -24 * 60 || offset_mins >= 24 * 60) { + spprintf(&message, 0, "%s: object has an time zone offset " + "that's too large", func); + intl_errors_set(outside_error, U_ILLEGAL_ARGUMENT_ERROR, + message, 1 TSRMLS_CC); + efree(message); + return NULL; + } + + id = offset_id; + id_len = slprintf(id, sizeof(offset_id), "GMT%+03d:%02d", + hours, minutes); + break; + } + case TIMELIB_ZONETYPE_ABBR: + id = is_datetime + ? ((php_date_obj*)object)->time->tz_abbr + : ((php_timezone_obj*)object)->tzi.z.abbr; + id_len = strlen(id); + break; + } + + UnicodeString s = UnicodeString(id, id_len, US_INV); + timeZone = TimeZone::createTimeZone(s); +#if U_ICU_VERSION_MAJOR_NUM >= 49 + if (*timeZone == TimeZone::getUnknown()) { +#else + UnicodeString resultingId; + timeZone->getID(resultingId); + if (resultingId == UnicodeString("Etc/Unknown", -1, US_INV) + || resultingId == UnicodeString("GMT", -1, US_INV)) { +#endif + spprintf(&message, 0, "%s: time zone id '%s' " + "extracted from ext/date DateTimeZone not recognized", func, id); + intl_errors_set(outside_error, U_ILLEGAL_ARGUMENT_ERROR, + message, 1 TSRMLS_CC); + efree(message); + delete timeZone; + return NULL; + } + return timeZone; +} +/* }}} */ + +U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, + intl_error *err, const char *func TSRMLS_DC) +{ + zval retval; + zval *zfuncname; + char *message; + + if (err && U_FAILURE(err->code)) { + return FAILURE; + } + + if (millis) { + *millis = NAN; + } + if (tz) { + *tz = NULL; + } + + if (millis) { + INIT_ZVAL(retval); + MAKE_STD_ZVAL(zfuncname); + ZVAL_STRING(zfuncname, "getTimestamp", 1); + if (call_user_function(NULL, &(z), zfuncname, &retval, 0, NULL TSRMLS_CC) + != SUCCESS || Z_TYPE(retval) != IS_LONG) { + spprintf(&message, 0, "%s: error calling ::getTimeStamp() on the " + "object", func); + intl_errors_set(err, U_INTERNAL_PROGRAM_ERROR, + message, 1 TSRMLS_CC); + efree(message); + zval_ptr_dtor(&zfuncname); + return FAILURE; + } + + *millis = U_MILLIS_PER_SECOND * (double)Z_LVAL(retval); + zval_ptr_dtor(&zfuncname); + } + + if (tz) { + php_date_obj *datetime; + datetime = (php_date_obj*)zend_object_store_get_object(z TSRMLS_CC); + if (!datetime->time) { + spprintf(&message, 0, "%s: the DateTime object is not properly " + "initialized", func); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, + message, 1 TSRMLS_CC); + efree(message); + return FAILURE; + } + if (!datetime->time->is_localtime) { + *tz = TimeZone::getGMT()->clone(); + } else { + *tz = timezone_convert_datetimezone(datetime->time->zone_type, + datetime, 1, NULL, func TSRMLS_CC); + if (*tz == NULL) { + spprintf(&message, 0, "%s: could not convert DateTime's " + "time zone", func); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, + message, 1 TSRMLS_CC); + efree(message); + return FAILURE; + } + } + } + + return SUCCESS; +} + +U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TSRMLS_DC) +{ + double rv = NAN; + long lv; + int type; + char *message; + + if (err && U_FAILURE(err->code)) { + return NAN; + } + + switch (Z_TYPE_P(z)) { + case IS_STRING: + type = is_numeric_string(Z_STRVAL_P(z), Z_STRLEN_P(z), &lv, &rv, 0); + if (type == IS_DOUBLE) { + rv *= U_MILLIS_PER_SECOND; + } else if (type == IS_LONG) { + rv = U_MILLIS_PER_SECOND * (double)lv; + } else { + spprintf(&message, 0, "%s: string '%s' is not numeric, " + "which would be required for it to be a valid date", func, + Z_STRVAL_P(z)); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, + message, 1 TSRMLS_CC); + efree(message); + } + break; + case IS_LONG: + rv = U_MILLIS_PER_SECOND * (double)Z_LVAL_P(z); + break; + case IS_DOUBLE: + rv = U_MILLIS_PER_SECOND * Z_DVAL_P(z); + break; + case IS_OBJECT: + if (instanceof_function(Z_OBJCE_P(z), php_date_get_date_ce() TSRMLS_CC)) { + intl_datetime_decompose(z, &rv, NULL, err, func TSRMLS_CC); + } else if (instanceof_function(Z_OBJCE_P(z), Calendar_ce_ptr TSRMLS_CC)) { + Calendar_object *co = (Calendar_object *) + zend_object_store_get_object(z TSRMLS_CC ); + if (co->ucal == NULL) { + spprintf(&message, 0, "%s: IntlCalendar object is not properly " + "constructed", func); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, + message, 1 TSRMLS_CC); + efree(message); + } else { + UErrorCode status = UErrorCode(); + rv = (double)co->ucal->getTime(status); + if (U_FAILURE(status)) { + spprintf(&message, 0, "%s: call to internal " + "Calendar::getTime() has failed", func); + intl_errors_set(err, status, message, 1 TSRMLS_CC); + efree(message); + } + } + } else { + /* TODO: try with cast(), get() to obtain a number */ + spprintf(&message, 0, "%s: invalid object type for date/time " + "(only IntlCalendar and DateTime permitted)", func); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, + message, 1 TSRMLS_CC); + efree(message); + } + break; + default: + spprintf(&message, 0, "%s: invalid PHP type for date", func); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, + message, 1 TSRMLS_CC); + efree(message); + break; + } + + return rv; +} + diff --git a/ext/intl/common/common_date.h b/ext/intl/common/common_date.h new file mode 100644 index 0000000000000..d2396cbf5afa6 --- /dev/null +++ b/ext/intl/common/common_date.h @@ -0,0 +1,40 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#ifndef COMMON_DATE_H +#define COMMON_DATE_H + +#include + +U_CDECL_BEGIN +#include +#include "../intl_error.h" +U_CDECL_END + +#ifdef __cplusplus + +#include + +U_CFUNC TimeZone *timezone_convert_datetimezone(int type, void *object, int is_datetime, intl_error *outside_error, const char *func TSRMLS_DC); +U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, + intl_error *err, const char *func TSRMLS_DC); + +#endif + +U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TSRMLS_DC); + +#endif /* COMMON_DATE_H */ + diff --git a/ext/intl/common/common_enum.cpp b/ext/intl/common/common_enum.cpp index 14265d459711c..da47a437a67b3 100644 --- a/ext/intl/common/common_enum.cpp +++ b/ext/intl/common/common_enum.cpp @@ -18,51 +18,22 @@ #include "config.h" #endif +#include "../intl_cppshims.h" + // Fix build on Windows/old versions of ICU #include #include "common_enum.h" extern "C" { -#include "intl_error.h" -#include "intl_data.h" #include #include } -static zend_class_entry *IntlIterator_ce_ptr; -static zend_object_handlers IntlIterator_handlers; - -typedef struct { - zend_object zo; - intl_error err; - zend_object_iterator *iterator; -} IntlIterator_object; - -#define INTLITERATOR_ERROR(ii) (ii)->err -#define INTLITERATOR_ERROR_P(ii) &(INTLITERATOR_ERROR(ii)) - -#define INTLITERATOR_ERROR_CODE(ii) INTL_ERROR_CODE(INTLITERATOR_ERROR(ii)) -#define INTLITERATOR_ERROR_CODE_P(ii) &(INTL_ERROR_CODE(INTLITERATOR_ERROR(ii))) - -#define INTLITERATOR_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(IntlIterator, ii) -#define INTLITERATOR_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(IntlIterator, ii) -#define INTLITERATOR_METHOD_FETCH_OBJECT\ - object = getThis(); \ - INTLITERATOR_METHOD_FETCH_OBJECT_NO_CHECK; \ - if (ii->iterator == NULL) { \ - intl_errors_set(&ii->err, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed IntlIterator", 0 TSRMLS_CC); \ - RETURN_FALSE; \ - } - -typedef struct { - zend_object_iterator zoi; - zval *current; - zval *wrapping_obj; - void (*destroy_free_it)(zend_object_iterator *iterator TSRMLS_DC); -} zoi_with_current; +zend_class_entry *IntlIterator_ce_ptr; +zend_object_handlers IntlIterator_handlers; -static void zoi_with_current_dtor(zend_object_iterator *iter TSRMLS_DC) +void zoi_with_current_dtor(zend_object_iterator *iter TSRMLS_DC) { zoi_with_current *zoiwc = (zoi_with_current*)iter; @@ -82,22 +53,22 @@ static void zoi_with_current_dtor(zend_object_iterator *iter TSRMLS_DC) * function being called by the iterator wrapper destructor function and * not finding the memory of this iterator allocated anymore. */ iter->funcs->invalidate_current(iter TSRMLS_CC); - zoiwc->destroy_free_it(iter TSRMLS_CC); + zoiwc->destroy_it(iter TSRMLS_CC); efree(iter); } } -static int zoi_with_current_valid(zend_object_iterator *iter TSRMLS_DC) +U_CFUNC int zoi_with_current_valid(zend_object_iterator *iter TSRMLS_DC) { return ((zoi_with_current*)iter)->current != NULL ? SUCCESS : FAILURE; } -static void zoi_with_current_get_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC) +U_CFUNC void zoi_with_current_get_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC) { *data = &((zoi_with_current*)iter)->current; } -static void zoi_with_current_invalidate_current(zend_object_iterator *iter TSRMLS_DC) +U_CFUNC void zoi_with_current_invalidate_current(zend_object_iterator *iter TSRMLS_DC) { zoi_with_current *zoi_iter = (zoi_with_current*)iter; if (zoi_iter->current) { @@ -153,7 +124,7 @@ static void string_enum_rewind(zend_object_iterator *iter TSRMLS_DC) } } -static void string_enum_destroy_free_it(zend_object_iterator *iter TSRMLS_DC) +static void string_enum_destroy_it(zend_object_iterator *iter TSRMLS_DC) { delete (StringEnumeration*)iter->data; } @@ -177,7 +148,7 @@ U_CFUNC void IntlIterator_from_StringEnumeration(StringEnumeration *se, zval *ob ii->iterator->data = (void*)se; ii->iterator->funcs = &string_enum_object_iterator_funcs; ii->iterator->index = 0; - ((zoi_with_current*)ii->iterator)->destroy_free_it = string_enum_destroy_free_it; + ((zoi_with_current*)ii->iterator)->destroy_it = string_enum_destroy_it; ((zoi_with_current*)ii->iterator)->wrapping_obj = object; ((zoi_with_current*)ii->iterator)->current = NULL; } @@ -329,7 +300,7 @@ static PHP_METHOD(IntlIterator, rewind) if (ii->iterator->funcs->rewind) { ii->iterator->funcs->rewind(ii->iterator TSRMLS_CC); } else { - intl_error_set(NULL, U_UNSUPPORTED_ERROR, + intl_errors_set(INTLITERATOR_ERROR_P(ii), U_UNSUPPORTED_ERROR, "IntlIterator::rewind: rewind not supported", 0 TSRMLS_CC); } } diff --git a/ext/intl/common/common_enum.h b/ext/intl/common/common_enum.h index f3c8bfcead8b0..4c6abdb8f5494 100644 --- a/ext/intl/common/common_enum.h +++ b/ext/intl/common/common_enum.h @@ -25,10 +25,49 @@ extern "C" { #include #endif #include +#include "../intl_error.h" +#include "../intl_data.h" #ifdef __cplusplus } #endif +#define INTLITERATOR_ERROR(ii) (ii)->err +#define INTLITERATOR_ERROR_P(ii) &(INTLITERATOR_ERROR(ii)) + +#define INTLITERATOR_ERROR_CODE(ii) INTL_ERROR_CODE(INTLITERATOR_ERROR(ii)) +#define INTLITERATOR_ERROR_CODE_P(ii) &(INTL_ERROR_CODE(INTLITERATOR_ERROR(ii))) + +#define INTLITERATOR_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(IntlIterator, ii) +#define INTLITERATOR_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(IntlIterator, ii) +#define INTLITERATOR_METHOD_FETCH_OBJECT\ + object = getThis(); \ + INTLITERATOR_METHOD_FETCH_OBJECT_NO_CHECK; \ + if (ii->iterator == NULL) { \ + intl_errors_set(&ii->err, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed IntlIterator", 0 TSRMLS_CC); \ + RETURN_FALSE; \ + } + +typedef struct { + zend_object zo; + intl_error err; + zend_object_iterator *iterator; +} IntlIterator_object; + +typedef struct { + zend_object_iterator zoi; + zval *current; + zval *wrapping_obj; + void (*destroy_it)(zend_object_iterator *iterator TSRMLS_DC); +} zoi_with_current; + +extern zend_class_entry *IntlIterator_ce_ptr; +extern zend_object_handlers IntlIterator_handlers; + +U_CFUNC void zoi_with_current_dtor(zend_object_iterator *iter TSRMLS_DC); +U_CFUNC int zoi_with_current_valid(zend_object_iterator *iter TSRMLS_DC); +U_CFUNC void zoi_with_current_get_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC); +U_CFUNC void zoi_with_current_invalidate_current(zend_object_iterator *iter TSRMLS_DC); + #ifdef __cplusplus U_CFUNC void IntlIterator_from_StringEnumeration(StringEnumeration *se, zval *object TSRMLS_DC); #endif diff --git a/ext/intl/common/common_error.c b/ext/intl/common/common_error.c old mode 100755 new mode 100644 index 24ded0c9fb652..a0ee7c145ffd5 --- a/ext/intl/common/common_error.c +++ b/ext/intl/common/common_error.c @@ -24,7 +24,7 @@ #include "common_error.h" /* {{{ proto int intl_get_error_code() - * Get code of the last occured error. + * Get code of the last occurred error. */ PHP_FUNCTION( intl_get_error_code ) { @@ -33,7 +33,7 @@ PHP_FUNCTION( intl_get_error_code ) /* }}} */ /* {{{ proto string intl_get_error_message() - * Get text description of the last occured error. + * Get text description of the last occurred error. */ PHP_FUNCTION( intl_get_error_message ) { diff --git a/ext/intl/common/common_error.h b/ext/intl/common/common_error.h old mode 100755 new mode 100644 diff --git a/ext/intl/config.m4 b/ext/intl/config.m4 old mode 100755 new mode 100644 index b1845d8febd7c..7c95c130f2135 --- a/ext/intl/config.m4 +++ b/ext/intl/config.m4 @@ -33,6 +33,7 @@ if test "$PHP_INTL" != "no"; then collator/collator_error.c \ common/common_error.c \ common/common_enum.cpp \ + common/common_date.cpp \ formatter/formatter.c \ formatter/formatter_main.c \ formatter/formatter_class.c \ @@ -51,7 +52,11 @@ if test "$PHP_INTL" != "no"; then dateformat/dateformat_attr.c \ dateformat/dateformat_data.c \ dateformat/dateformat_format.c \ + dateformat/dateformat_format_object.cpp \ dateformat/dateformat_parse.c \ + dateformat/dateformat_create.cpp \ + dateformat/dateformat_attrcpp.cpp \ + dateformat/dateformat_helpers.cpp \ msgformat/msgformat.c \ msgformat/msgformat_attr.c \ msgformat/msgformat_class.c \ @@ -67,11 +72,17 @@ if test "$PHP_INTL" != "no"; then transliterator/transliterator.c \ transliterator/transliterator_class.c \ transliterator/transliterator_methods.c \ - timezone/timezone_class.cpp \ - timezone/timezone_methods.cpp \ - calendar/calendar_class.cpp \ - calendar/calendar_methods.cpp \ - calendar/gregoriancalendar_methods.cpp \ + timezone/timezone_class.cpp \ + timezone/timezone_methods.cpp \ + calendar/calendar_class.cpp \ + calendar/calendar_methods.cpp \ + calendar/gregoriancalendar_methods.cpp \ + breakiterator/breakiterator_class.cpp \ + breakiterator/breakiterator_iterators.cpp \ + breakiterator/breakiterator_methods.cpp \ + breakiterator/rulebasedbreakiterator_methods.cpp \ + breakiterator/codepointiterator_internal.cpp \ + breakiterator/codepointiterator_methods.cpp \ idn/idn.c \ $icu_spoof_src, $ext_shared,,$ICU_INCS -Wno-write-strings) PHP_ADD_BUILD_DIR($ext_builddir/collator) @@ -88,4 +99,5 @@ if test "$PHP_INTL" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/calendar) PHP_ADD_BUILD_DIR($ext_builddir/idn) PHP_ADD_BUILD_DIR($ext_builddir/spoofchecker) + PHP_ADD_BUILD_DIR($ext_builddir/breakiterator) fi diff --git a/ext/intl/config.w32 b/ext/intl/config.w32 old mode 100755 new mode 100644 index ce12d9d3420e3..a49918794c576 --- a/ext/intl/config.w32 +++ b/ext/intl/config.w32 @@ -24,6 +24,7 @@ if (PHP_INTL != "no") { ADD_SOURCES(configure_module_dirname + "/common", "\ common_error.c \ common_enum.cpp \ + common_date.cpp \ ", "intl"); ADD_SOURCES(configure_module_dirname + "/formatter", "\ formatter.c \ @@ -61,8 +62,12 @@ if (PHP_INTL != "no") { dateformat_class.c \ dateformat_attr.c \ dateformat_format.c \ + dateformat_format_object.cpp \ dateformat_parse.c \ dateformat_data.c \ + dateformat_attrcpp.cpp \ + dateformat_helpers.cpp \ + dateformat_create.cpp \ ", "intl"); ADD_SOURCES(configure_module_dirname + "/idn", "\ idn.c", @@ -99,6 +104,15 @@ if (PHP_INTL != "no") { gregoriancalendar_methods.cpp \ calendar_class.cpp", "intl"); + + ADD_SOURCES(configure_module_dirname + "/breakiterator", "\ + breakiterator_class.cpp \ + breakiterator_methods.cpp \ + breakiterator_iterators.cpp \ + rulebasedbreakiterator_methods.cpp \ + codepointiterator_internal.cpp \ + codepointiterator_methods.cpp ", + "intl"); ADD_FLAG("LIBS_INTL", "icudt.lib icuin.lib icuio.lib icule.lib iculx.lib"); AC_DEFINE("HAVE_INTL", 1, "Internationalization support enabled"); diff --git a/ext/intl/dateformat/dateformat.c b/ext/intl/dateformat/dateformat.c old mode 100755 new mode 100644 index 6f7432254ce59..fb83eeef05b76 --- a/ext/intl/dateformat/dateformat.c +++ b/ext/intl/dateformat/dateformat.c @@ -17,12 +17,9 @@ #include "config.h" #endif -#include #include -#include #include "php_intl.h" -#include "intl_convert.h" #include "dateformat_class.h" #include "dateformat.h" @@ -67,113 +64,6 @@ void dateformat_register_constants( INIT_FUNC_ARGS ) } /* }}} */ -/* {{{ */ -static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS) -{ - char* locale; - int locale_len = 0; - zval* object; - long date_type = 0; - long time_type = 0; - long calendar = UCAL_GREGORIAN; - char* timezone_str = NULL; - int timezone_str_len = 0; - char* pattern_str = NULL; - int pattern_str_len = 0; - UChar* svalue = NULL; /* UTF-16 pattern_str */ - int slength = 0; - UChar* timezone_utf16 = NULL; /* UTF-16 timezone_str */ - int timezone_utf16_len = 0; - UCalendar ucal_obj = NULL; - IntlDateFormatter_object* dfo; - - intl_error_reset( NULL TSRMLS_CC ); - object = return_value; - /* Parse parameters. */ - if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "sll|sls", - &locale, &locale_len, &date_type, &time_type, &timezone_str, &timezone_str_len, &calendar,&pattern_str, &pattern_str_len ) == FAILURE ) - { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_create: unable to parse input parameters", 0 TSRMLS_CC ); - zval_dtor(return_value); - RETURN_NULL(); - } - - INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value); - DATE_FORMAT_METHOD_FETCH_OBJECT; - /* Convert pattern (if specified) to UTF-16. */ - if( pattern_str && pattern_str_len>0 ){ - intl_convert_utf8_to_utf16(&svalue, &slength, pattern_str, pattern_str_len, &INTL_DATA_ERROR_CODE(dfo)); - INTL_CTOR_CHECK_STATUS(dfo, "datefmt_create: error converting pattern to UTF-16"); - } - - /* Convert pattern (if specified) to UTF-16. */ - if( timezone_str && timezone_str_len >0 ){ - intl_convert_utf8_to_utf16(&timezone_utf16, &timezone_utf16_len, timezone_str, timezone_str_len, &INTL_DATA_ERROR_CODE(dfo)); - INTL_CTOR_CHECK_STATUS(dfo, "datefmt_create: error converting timezone_str to UTF-16" ); - } - - if(locale_len == 0) { - locale = INTL_G(default_locale); - } - - if( pattern_str && pattern_str_len>0 ){ - DATE_FORMAT_OBJECT(dfo) = udat_open(UDAT_IGNORE, UDAT_IGNORE, locale, timezone_utf16, timezone_utf16_len, svalue, slength, &INTL_DATA_ERROR_CODE(dfo)); - } else { - DATE_FORMAT_OBJECT(dfo) = udat_open(time_type, date_type, locale, timezone_utf16, timezone_utf16_len, svalue, slength, &INTL_DATA_ERROR_CODE(dfo)); - } - - /* Set the calendar if passed */ - if(!U_FAILURE(INTL_DATA_ERROR_CODE(dfo)) && calendar) { - ucal_obj = ucal_open( timezone_utf16, timezone_utf16_len, locale, calendar, &INTL_DATA_ERROR_CODE(dfo) ); - if(!U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) { - udat_setCalendar( DATE_FORMAT_OBJECT(dfo), ucal_obj ); - } - } - - if(svalue) - { - efree(svalue); - } - if(timezone_utf16) - { - efree(timezone_utf16); - } - - INTL_CTOR_CHECK_STATUS(dfo, "datefmt_create: date formatter creation failed"); - - /* Set the class variables */ - dfo->date_type = date_type; - dfo->time_type = time_type; - dfo->calendar = calendar; - if( timezone_str && timezone_str_len > 0){ - dfo->timezone_id = estrndup( timezone_str, timezone_str_len); - } -} -/* }}} */ - -/* {{{ proto IntlDateFormatter IntlDateFormatter::create(string $locale, long date_type, long time_type[, string $timezone_str, long $calendar, string $pattern] ) - * Create formatter. }}} */ -/* {{{ proto IntlDateFormatter datefmt_create(string $locale, long date_type, long time_type[, string $timezone_str, long $calendar, string $pattern] ) - - * Create formatter. - */ -PHP_FUNCTION( datefmt_create ) -{ - object_init_ex( return_value, IntlDateFormatter_ce_ptr ); - datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); -} -/* }}} */ - -/* {{{ proto void IntlDateFormatter::__construct(string $locale, long date_type, long time_type[, string $timezone_str, long $calendar, string $pattern]) - * IntlDateFormatter object constructor. - */ -PHP_METHOD( IntlDateFormatter, __construct ) -{ - return_value = getThis(); - datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); -} -/* }}} */ - /* {{{ proto int IntlDateFormatter::getErrorCode() * Get formatter's last error code. }}} */ /* {{{ proto int datefmt_get_error_code( IntlDateFormatter $nf ) diff --git a/ext/intl/dateformat/dateformat.h b/ext/intl/dateformat/dateformat.h old mode 100755 new mode 100644 diff --git a/ext/intl/dateformat/dateformat_attr.c b/ext/intl/dateformat/dateformat_attr.c old mode 100755 new mode 100644 index 6131cedc956b5..a32a4860c9384 --- a/ext/intl/dateformat/dateformat_attr.c +++ b/ext/intl/dateformat/dateformat_attr.c @@ -24,39 +24,6 @@ #include #include -#include - -static void internal_set_calendar(IntlDateFormatter_object *dfo, char* timezone_id, int timezone_id_len, int calendar, zval* return_value TSRMLS_DC){ - int timezone_utf16_len = 0; - UChar* timezone_utf16 = NULL; /* timezone_id in UTF-16 */ - char* locale = NULL; - - UCalendar* ucal_obj = NULL; - - /* check for the validity of value of calendar passed */ - intl_error_reset( NULL TSRMLS_CC ); - if( calendar > 1){ - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_set_calendar: calendar value specified is out of valid range", 0 TSRMLS_CC); - RETURN_FALSE; - } - - /* Convert timezone to UTF-16. */ - intl_convert_utf8_to_utf16(&timezone_utf16, &timezone_utf16_len, timezone_id, timezone_id_len, &INTL_DATA_ERROR_CODE(dfo)); - INTL_METHOD_CHECK_STATUS(dfo, "Error converting timezone to UTF-16" ); - - /* Get the locale for the dateformatter */ - locale = (char *)udat_getLocaleByType(DATE_FORMAT_OBJECT(dfo), ULOC_ACTUAL_LOCALE, &INTL_DATA_ERROR_CODE(dfo)); - - /* Set the calendar if passed */ - ucal_obj = ucal_open(timezone_utf16, timezone_utf16_len, locale, calendar, &INTL_DATA_ERROR_CODE(dfo) ); - udat_setCalendar( DATE_FORMAT_OBJECT(dfo), ucal_obj ); - INTL_METHOD_CHECK_STATUS(dfo, "Error setting the calendar."); - - if( timezone_utf16){ - efree(timezone_utf16); - } -} /* {{{ proto unicode IntlDateFormatter::getDateType( ) * Get formatter datetype. }}} */ @@ -110,97 +77,6 @@ PHP_FUNCTION( datefmt_get_timetype ) } /* }}} */ - -/* {{{ proto unicode IntlDateFormatter::getCalendar( ) - * Get formatter calendar. }}} */ -/* {{{ proto string datefmt_get_calendar( IntlDateFormatter $mf ) - * Get formatter calendar. - */ -PHP_FUNCTION( datefmt_get_calendar ) -{ - DATE_FORMAT_METHOD_INIT_VARS; - - /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE ) - { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_get_calendar: unable to parse input params", 0 TSRMLS_CC ); - RETURN_FALSE; - } - - /* Fetch the object. */ - DATE_FORMAT_METHOD_FETCH_OBJECT; - - INTL_METHOD_CHECK_STATUS(dfo, "Error getting formatter calendar." ); - - RETURN_LONG(dfo->calendar); -} -/* }}} */ - -/* {{{ proto unicode IntlDateFormatter::getTimeZoneId( ) - * Get formatter timezone_id. }}} */ -/* {{{ proto string datefmt_get_timezone_id( IntlDateFormatter $mf ) - * Get formatter timezone_id. - */ -PHP_FUNCTION( datefmt_get_timezone_id ) -{ - DATE_FORMAT_METHOD_INIT_VARS; - - /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE ) - { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_get_timezone_id: unable to parse input params", 0 TSRMLS_CC ); - RETURN_FALSE; - } - - /* Fetch the object. */ - DATE_FORMAT_METHOD_FETCH_OBJECT; - - INTL_METHOD_CHECK_STATUS(dfo, "Error getting formatter timezone_id." ); - - if( dfo->timezone_id ){ - RETURN_STRING((char*)dfo->timezone_id, TRUE ); - }else{ - RETURN_NULL(); - } -} - -/* {{{ proto boolean IntlDateFormatter::setTimeZoneId( $timezone_id) - * Set formatter timezone_id. }}} */ -/* {{{ proto boolean datefmt_set_timezone_id( IntlDateFormatter $mf,$timezone_id) - * Set formatter timezone_id. - */ -PHP_FUNCTION( datefmt_set_timezone_id ) -{ - char* timezone_id = NULL; - int timezone_id_len = 0; - - DATE_FORMAT_METHOD_INIT_VARS; - - /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, IntlDateFormatter_ce_ptr,&timezone_id, &timezone_id_len) == FAILURE ) - { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_set_timezone_id: unable to parse input params", 0 TSRMLS_CC ); - RETURN_FALSE; - } - - /* Fetch the object. */ - DATE_FORMAT_METHOD_FETCH_OBJECT; - - /* set the timezone for the calendar */ - internal_set_calendar( dfo, timezone_id, timezone_id_len, dfo->calendar, return_value TSRMLS_CC ); - - /* Set the IntlDateFormatter variable */ - if( dfo->timezone_id ){ - efree(dfo->timezone_id); - } - dfo->timezone_id = estrndup(timezone_id, timezone_id_len); - - RETURN_TRUE; -} - /* {{{ proto string IntlDateFormatter::getPattern( ) * Get formatter pattern. }}} */ /* {{{ proto string datefmt_get_pattern( IntlDateFormatter $mf ) @@ -369,43 +245,3 @@ PHP_FUNCTION( datefmt_set_lenient ) udat_setLenient(DATE_FORMAT_OBJECT(dfo), (UBool)isLenient ); } /* }}} */ - -/* {{{ proto bool IntlDateFormatter::setPattern( int $calendar ) - * Set formatter calendar. }}} */ -/* {{{ proto bool datefmt_set_calendar( IntlDateFormatter $mf, int $calendar ) - * Set formatter calendar. - */ -PHP_FUNCTION( datefmt_set_calendar ) -{ - long calendar = 0; - - DATE_FORMAT_METHOD_INIT_VARS; - - /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", - &object, IntlDateFormatter_ce_ptr, &calendar ) == FAILURE ) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_set_calendar: unable to parse input params", 0 TSRMLS_CC); - RETURN_FALSE; - } - - /* check for the validity of value of calendar passed */ - intl_error_reset( NULL TSRMLS_CC ); - if (calendar > 1) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_set_calendar: calendar value specified is out of valid range", 0 TSRMLS_CC); - RETURN_FALSE; - } - - DATE_FORMAT_METHOD_FETCH_OBJECT; - - internal_set_calendar( dfo, dfo->timezone_id, strlen(dfo->timezone_id), calendar, return_value TSRMLS_CC ); - - /* Set the calendar value in the IntlDateFormatter object */ - dfo->calendar = calendar; - - RETURN_TRUE; -} -/* }}} */ - - diff --git a/ext/intl/dateformat/dateformat_attr.h b/ext/intl/dateformat/dateformat_attr.h old mode 100755 new mode 100644 index bf28824d636a6..6fe82a6e00c22 --- a/ext/intl/dateformat/dateformat_attr.h +++ b/ext/intl/dateformat/dateformat_attr.h @@ -21,11 +21,7 @@ //PHP_FUNCTION( datefmt_get_timezone ); PHP_FUNCTION( datefmt_get_datetype ); PHP_FUNCTION( datefmt_get_timetype ); -PHP_FUNCTION( datefmt_get_calendar ); -PHP_FUNCTION( datefmt_set_calendar ); PHP_FUNCTION( datefmt_get_locale ); -PHP_FUNCTION( datefmt_get_timezone_id ); -PHP_FUNCTION( datefmt_set_timezone_id ); PHP_FUNCTION( datefmt_get_pattern ); PHP_FUNCTION( datefmt_set_pattern ); PHP_FUNCTION( datefmt_is_lenient ); diff --git a/ext/intl/dateformat/dateformat_attrcpp.cpp b/ext/intl/dateformat/dateformat_attrcpp.cpp new file mode 100644 index 0000000000000..b68abec65915a --- /dev/null +++ b/ext/intl/dateformat/dateformat_attrcpp.cpp @@ -0,0 +1,261 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#include "../intl_cppshims.h" + +#include +#include +#include + +extern "C" { +#include "../php_intl.h" +#include "dateformat_class.h" +#include "dateformat_attrcpp.h" +#define USE_TIMEZONE_POINTER 1 +#include "../timezone/timezone_class.h" +#define USE_CALENDAR_POINTER 1 +#include "../calendar/calendar_class.h" +} + +#include "../intl_convertcpp.h" +#include "dateformat_helpers.h" + +static inline DateFormat *fetch_datefmt(IntlDateFormatter_object *dfo) { + return (DateFormat *)dfo->datef_data.udatf; +} + +/* {{{ proto string IntlDateFormatter::getTimeZoneId() + * Get formatter timezone_id. }}} */ +/* {{{ proto string datefmt_get_timezone_id(IntlDateFormatter $mf) + * Get formatter timezone_id. + */ +U_CFUNC PHP_FUNCTION(datefmt_get_timezone_id) +{ + DATE_FORMAT_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", + &object, IntlDateFormatter_ce_ptr ) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_get_timezone_" + "id: unable to parse input params", 0 TSRMLS_CC); + RETURN_FALSE; + } + + DATE_FORMAT_METHOD_FETCH_OBJECT; + + UnicodeString res = UnicodeString(); + fetch_datefmt(dfo)->getTimeZone().getID(res); + intl_charFromString(res, &Z_STRVAL_P(return_value), + &Z_STRLEN_P(return_value), &INTL_DATA_ERROR_CODE(dfo)); + INTL_METHOD_CHECK_STATUS(dfo, "Could not convert time zone id to UTF-8"); + + Z_TYPE_P(return_value) = IS_STRING; +} + +/* {{{ proto IntlTimeZone IntlDateFormatter::getTimeZone() + * Get formatter timezone. }}} */ +/* {{{ proto IntlTimeZone datefmt_get_timezone(IntlDateFormatter $mf) + * Get formatter timezone. + */ +U_CFUNC PHP_FUNCTION(datefmt_get_timezone) +{ + DATE_FORMAT_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", + &object, IntlDateFormatter_ce_ptr ) == FAILURE) { + intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_get_timezone: unable to parse input params", 0 TSRMLS_CC ); + RETURN_FALSE; + } + + DATE_FORMAT_METHOD_FETCH_OBJECT; + + const TimeZone& tz = fetch_datefmt(dfo)->getTimeZone(); + TimeZone *tz_clone = tz.clone(); + if (tz_clone == NULL) { + intl_errors_set(INTL_DATA_ERROR_P(dfo), U_MEMORY_ALLOCATION_ERROR, + "datefmt_get_timezone: Out of memory when cloning time zone", + 0 TSRMLS_CC); + RETURN_FALSE; + } + + object_init_ex(return_value, TimeZone_ce_ptr); + timezone_object_construct(tz_clone, return_value, 1 TSRMLS_CC); +} + +U_CFUNC PHP_FUNCTION(datefmt_set_timezone_id) +{ + php_error_docref0(NULL TSRMLS_CC, E_DEPRECATED, + "Use datefmt_set_timezone() instead, which also accepts a plain " + "time zone identifier and for which this function is now an " + "alias"); + PHP_FN(datefmt_set_timezone)(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +/* {{{ proto boolean IntlDateFormatter::setTimeZone(mixed $timezone) + * Set formatter's timezone. }}} */ +/* {{{ proto boolean datefmt_set_timezone_id(IntlDateFormatter $mf, $timezone_id) + * Set formatter timezone_id. + */ +U_CFUNC PHP_FUNCTION(datefmt_set_timezone) +{ + zval **timezone_zv; + TimeZone *timezone; + + DATE_FORMAT_METHOD_INIT_VARS; + + if ( zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), + "OZ", &object, IntlDateFormatter_ce_ptr, &timezone_zv) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_set_timezone: " + "unable to parse input params", 0 TSRMLS_CC); + RETURN_FALSE; + } + + DATE_FORMAT_METHOD_FETCH_OBJECT; + + timezone = timezone_process_timezone_argument(timezone_zv, + INTL_DATA_ERROR_P(dfo), "datefmt_set_timezone" TSRMLS_CC); + if (timezone == NULL) { + RETURN_FALSE; + } + + fetch_datefmt(dfo)->adoptTimeZone(timezone); +} + +/* {{{ proto int IntlDateFormatter::getCalendar( ) + * Get formatter calendar type. }}} */ +/* {{{ proto int datefmt_get_calendar(IntlDateFormatter $mf) + * Get formatter calendar type. + */ +U_CFUNC PHP_FUNCTION(datefmt_get_calendar) +{ + DATE_FORMAT_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", + &object, IntlDateFormatter_ce_ptr ) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_get_calendar: unable to parse input params", 0 TSRMLS_CC); + RETURN_FALSE; + } + + DATE_FORMAT_METHOD_FETCH_OBJECT; + + if (dfo->calendar == -1) { + /* an IntlCalendar was provided to the constructor */ + RETURN_FALSE; + } + + RETURN_LONG(dfo->calendar); +} +/* }}} */ + +/* {{{ proto IntlCalendar IntlDateFormatter::getCalendarObject() + * Get formatter calendar. }}} */ +/* {{{ proto IntlCalendar datefmt_get_calendar_object(IntlDateFormatter $mf) + * Get formatter calendar. + */ +U_CFUNC PHP_FUNCTION(datefmt_get_calendar_object) +{ + DATE_FORMAT_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", + &object, IntlDateFormatter_ce_ptr ) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_get_calendar_object: unable to parse input params", + 0 TSRMLS_CC); + RETURN_FALSE; + } + + DATE_FORMAT_METHOD_FETCH_OBJECT; + + const Calendar *cal = fetch_datefmt(dfo)->getCalendar(); + if (cal == NULL) { + RETURN_NULL(); + } + + Calendar *cal_clone = cal->clone(); + if (cal_clone == NULL) { + intl_errors_set(INTL_DATA_ERROR_P(dfo), U_MEMORY_ALLOCATION_ERROR, + "datefmt_get_calendar_object: Out of memory when cloning " + "calendar", 0 TSRMLS_CC); + RETURN_FALSE; + } + + calendar_object_create(return_value, cal_clone TSRMLS_CC); +} +/* }}} */ + +/* {{{ proto bool IntlDateFormatter::setCalendar(mixed $calendar) + * Set formatter's calendar. }}} */ +/* {{{ proto bool datefmt_set_calendar(IntlDateFormatter $mf, mixed $calendar) + * Set formatter's calendar. + */ +U_CFUNC PHP_FUNCTION(datefmt_set_calendar) +{ + zval *calendar_zv; + DATE_FORMAT_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oz", + &object, IntlDateFormatter_ce_ptr, &calendar_zv) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_set_calendar: unable to parse input params", 0 TSRMLS_CC); + RETURN_FALSE; + } + + DATE_FORMAT_METHOD_FETCH_OBJECT; + + Calendar *cal; + long cal_type; + bool cal_owned; + Locale locale = Locale::createFromName(dfo->requested_locale); + // getting the actual locale from the DateFormat is not enough + // because we would have lost modifiers such as @calendar. We + // must store the requested locale on object creation + + if (datefmt_process_calendar_arg(calendar_zv, locale, + "datefmt_set_calendar", INTL_DATA_ERROR_P(dfo), cal, cal_type, + cal_owned TSRMLS_CC) == FAILURE) { + RETURN_FALSE; + } + + if (cal_owned) { + /* a non IntlCalendar was specified, we want to keep the timezone */ + TimeZone *old_timezone = fetch_datefmt(dfo)->getTimeZone().clone(); + if (old_timezone == NULL) { + intl_errors_set(INTL_DATA_ERROR_P(dfo), U_MEMORY_ALLOCATION_ERROR, + "datefmt_set_calendar: Out of memory when cloning calendar", + 0 TSRMLS_CC); + delete cal; + RETURN_FALSE; + } + cal->adoptTimeZone(old_timezone); + } else { + cal = cal->clone(); + if (cal == NULL) { + intl_errors_set(INTL_DATA_ERROR_P(dfo), U_MEMORY_ALLOCATION_ERROR, + "datefmt_set_calendar: Out of memory when cloning calendar", + 0 TSRMLS_CC); + RETURN_FALSE; + } + } + + fetch_datefmt(dfo)->adoptCalendar(cal); + + dfo->calendar = cal_type; + + RETURN_TRUE; +} +/* }}} */ + diff --git a/ext/intl/dateformat/dateformat_attrcpp.h b/ext/intl/dateformat/dateformat_attrcpp.h new file mode 100644 index 0000000000000..408232f9400c3 --- /dev/null +++ b/ext/intl/dateformat/dateformat_attrcpp.h @@ -0,0 +1,35 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#ifndef DATEFORMAT_ATTRCPP_H +#define DATEFORMAT_ATTRCPP_H + +PHP_FUNCTION(datefmt_get_timezone_id); + +PHP_FUNCTION(datefmt_set_timezone_id); + +PHP_FUNCTION(datefmt_get_timezone); + +PHP_FUNCTION(datefmt_set_timezone); + +PHP_FUNCTION(datefmt_get_calendar); + +PHP_FUNCTION(datefmt_set_calendar); + +PHP_FUNCTION(datefmt_get_calendar_object); + +#endif /* DATEFORMAT_ATTRCPP_H */ + diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c old mode 100755 new mode 100644 index c66610f23b982..fc4a8b8eb10f4 --- a/ext/intl/dateformat/dateformat_class.c +++ b/ext/intl/dateformat/dateformat_class.c @@ -19,9 +19,11 @@ #include "php_intl.h" #include "dateformat_data.h" #include "dateformat_format.h" +#include "dateformat_format_object.h" #include "dateformat_parse.h" #include "dateformat.h" #include "dateformat_attr.h" +#include "dateformat_attrcpp.h" zend_class_entry *IntlDateFormatter_ce_ptr = NULL; static zend_object_handlers IntlDateFormatter_handlers; @@ -44,12 +46,12 @@ void IntlDateFormatter_object_free( zend_object *object TSRMLS_DC ) zend_object_std_dtor( &dfo->zo TSRMLS_CC ); - dateformat_data_free( &dfo->datef_data TSRMLS_CC ); - - if( dfo->timezone_id ){ - efree(dfo->timezone_id); + if (dfo->requested_locale) { + efree( dfo->requested_locale ); } + dateformat_data_free( &dfo->datef_data TSRMLS_CC ); + efree( dfo ); } /* }}} */ @@ -63,10 +65,11 @@ zend_object_value IntlDateFormatter_object_create(zend_class_entry *ce TSRMLS_DC intern = ecalloc( 1, sizeof(IntlDateFormatter_object) ); dateformat_data_init( &intern->datef_data TSRMLS_CC ); zend_object_std_init( &intern->zo, ce TSRMLS_CC ); - intern->date_type = 0; - intern->time_type = 0; - intern->calendar = 1; /* Gregorian calendar */ - intern->timezone_id = NULL; + object_properties_init(&intern->zo, ce); + intern->date_type = 0; + intern->time_type = 0; + intern->calendar = -1; + intern->requested_locale = NULL; retval.handle = zend_objects_store_put( intern, @@ -119,6 +122,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_intldateformatter_format, 0, 0, 0) ZEND_ARG_INFO(0, array) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_intldateformatter_format_object, 0, 0, 1) + ZEND_ARG_INFO(0, object) + ZEND_ARG_INFO(0, format) + ZEND_ARG_INFO(0, locale) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO(arginfo_intldateformatter_getdatetype, 0) ZEND_END_ARG_INFO() @@ -157,15 +166,19 @@ static zend_function_entry IntlDateFormatter_class_functions[] = { PHP_NAMED_FE( getDateType, ZEND_FN( datefmt_get_datetype ), arginfo_intldateformatter_getdatetype ) PHP_NAMED_FE( getTimeType, ZEND_FN( datefmt_get_timetype ), arginfo_intldateformatter_getdatetype ) PHP_NAMED_FE( getCalendar, ZEND_FN( datefmt_get_calendar ), arginfo_intldateformatter_getdatetype ) + PHP_NAMED_FE( getCalendarObject, ZEND_FN( datefmt_get_calendar_object ), arginfo_intldateformatter_getdatetype ) PHP_NAMED_FE( setCalendar, ZEND_FN( datefmt_set_calendar ), arginfo_intldateformatter_setcalendar ) PHP_NAMED_FE( getTimeZoneId, ZEND_FN( datefmt_get_timezone_id ), arginfo_intldateformatter_getdatetype ) PHP_NAMED_FE( setTimeZoneId, ZEND_FN( datefmt_set_timezone_id ), arginfo_intldateformatter_settimezoneid ) + PHP_NAMED_FE( getTimeZone, ZEND_FN( datefmt_get_timezone ), arginfo_intldateformatter_getdatetype ) + PHP_NAMED_FE( setTimeZone, ZEND_FN( datefmt_set_timezone ), arginfo_intldateformatter_settimezoneid ) PHP_NAMED_FE( setPattern, ZEND_FN( datefmt_set_pattern ), arginfo_intldateformatter_setpattern ) PHP_NAMED_FE( getPattern, ZEND_FN( datefmt_get_pattern ), arginfo_intldateformatter_getdatetype ) PHP_NAMED_FE( getLocale, ZEND_FN( datefmt_get_locale ), arginfo_intldateformatter_getdatetype ) PHP_NAMED_FE( setLenient, ZEND_FN( datefmt_set_lenient ), arginfo_intldateformatter_setlenient ) PHP_NAMED_FE( isLenient, ZEND_FN( datefmt_is_lenient ), arginfo_intldateformatter_getdatetype ) PHP_NAMED_FE( format, ZEND_FN( datefmt_format ), arginfo_intldateformatter_format ) + PHP_ME_MAPPING( formatObject, datefmt_format_object, arginfo_intldateformatter_format_object, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_NAMED_FE( parse, ZEND_FN( datefmt_parse), datefmt_parse_args ) PHP_NAMED_FE( localtime, ZEND_FN( datefmt_localtime ), datefmt_parse_args ) PHP_NAMED_FE( getErrorCode, ZEND_FN( datefmt_get_error_code ), arginfo_intldateformatter_getdatetype ) diff --git a/ext/intl/dateformat/dateformat_class.h b/ext/intl/dateformat/dateformat_class.h old mode 100755 new mode 100644 index 9ad83ee3d63c9..de5cf4a181380 --- a/ext/intl/dateformat/dateformat_class.h +++ b/ext/intl/dateformat/dateformat_class.h @@ -24,12 +24,12 @@ #include "dateformat_data.h" typedef struct { - zend_object zo; - dateformat_data datef_data; - int date_type ; - int time_type ; - int calendar ; - char* timezone_id; + zend_object zo; + dateformat_data datef_data; + int date_type; + int time_type; + int calendar; + char *requested_locale; } IntlDateFormatter_object; void dateformat_register_IntlDateFormatter_class( TSRMLS_D ); diff --git a/ext/intl/dateformat/dateformat_create.cpp b/ext/intl/dateformat/dateformat_create.cpp new file mode 100644 index 0000000000000..7fefbe7449c67 --- /dev/null +++ b/ext/intl/dateformat/dateformat_create.cpp @@ -0,0 +1,193 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Kirti Velankar | + | Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#include "../intl_cppshims.h" + +#include +#include +#include + +extern "C" { +#include +#include + +#include "php_intl.h" +#include "dateformat_create.h" +#include "dateformat_class.h" +#define USE_TIMEZONE_POINTER 1 +#include "../timezone/timezone_class.h" +#include "../intl_convert.h" +} + +#include "dateformat_helpers.h" + +/* {{{ */ +static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS) +{ + zval *object; + + const char *locale_str; + int locale_len = 0; + Locale locale; + long date_type = 0; + long time_type = 0; + zval *calendar_zv = NULL; + Calendar *calendar = NULL; + long calendar_type; + bool calendar_owned; + zval **timezone_zv = NULL; + TimeZone *timezone = NULL; + bool explicit_tz; + char* pattern_str = NULL; + int pattern_str_len = 0; + UChar* svalue = NULL; /* UTF-16 pattern_str */ + int slength = 0; + IntlDateFormatter_object* dfo; + + intl_error_reset(NULL TSRMLS_CC); + object = return_value; + /* Parse parameters. */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sll|Zzs", + &locale_str, &locale_len, &date_type, &time_type, &timezone_zv, + &calendar_zv, &pattern_str, &pattern_str_len) == FAILURE) { + intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_create: " + "unable to parse input parameters", 0 TSRMLS_CC); + zval_dtor(return_value); + RETURN_NULL(); + } + + INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value); + if (locale_len == 0) { + locale_str = intl_locale_get_default(TSRMLS_C); + } + locale = Locale::createFromName(locale_str); + + DATE_FORMAT_METHOD_FETCH_OBJECT; + + if (DATE_FORMAT_OBJECT(dfo) != NULL) { + intl_errors_set(INTL_DATA_ERROR_P(dfo), U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_create: cannot call constructor twice", 0 TSRMLS_CC); + return; + } + + /* process calendar */ + if (datefmt_process_calendar_arg(calendar_zv, locale, "datefmt_create", + INTL_DATA_ERROR_P(dfo), calendar, calendar_type, + calendar_owned TSRMLS_CC) + == FAILURE) { + goto error; + } + + /* process timezone */ + explicit_tz = timezone_zv != NULL && Z_TYPE_PP(timezone_zv) != IS_NULL; + + if (explicit_tz || calendar_owned ) { + //we have an explicit time zone or a non-object calendar + timezone = timezone_process_timezone_argument(timezone_zv, + INTL_DATA_ERROR_P(dfo), "datefmt_create" TSRMLS_CC); + if (timezone == NULL) { + goto error; + } + } + + /* Convert pattern (if specified) to UTF-16. */ + if (pattern_str && pattern_str_len > 0) { + intl_convert_utf8_to_utf16(&svalue, &slength, + pattern_str, pattern_str_len, &INTL_DATA_ERROR_CODE(dfo)); + if (U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) { + /* object construction -> only set global error */ + intl_error_set(NULL, INTL_DATA_ERROR_CODE(dfo), "datefmt_create: " + "error converting pattern to UTF-16", 0 TSRMLS_CC); + goto error; + } + } + + if (pattern_str && pattern_str_len > 0) { + DATE_FORMAT_OBJECT(dfo) = udat_open(UDAT_IGNORE, UDAT_IGNORE, + locale_str, NULL, 0, svalue, slength, + &INTL_DATA_ERROR_CODE(dfo)); + } else { + DATE_FORMAT_OBJECT(dfo) = udat_open((UDateFormatStyle)time_type, + (UDateFormatStyle)date_type, locale_str, NULL, 0, svalue, + slength, &INTL_DATA_ERROR_CODE(dfo)); + } + + if (!U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) { + DateFormat *df = (DateFormat*)DATE_FORMAT_OBJECT(dfo); + if (calendar_owned) { + df->adoptCalendar(calendar); + calendar_owned = false; + } else { + df->setCalendar(*calendar); + } + + if (timezone != NULL) { + df->adoptTimeZone(timezone); + } + } else { + intl_error_set(NULL, INTL_DATA_ERROR_CODE(dfo), "datefmt_create: date " + "formatter creation failed", 0 TSRMLS_CC); + goto error; + } + + /* Set the class variables */ + dfo->date_type = date_type; + dfo->time_type = time_type; + dfo->calendar = calendar_type; + dfo->requested_locale = estrdup(locale_str); + +error: + if (svalue) { + efree(svalue); + } + if (timezone != NULL && DATE_FORMAT_OBJECT(dfo) == NULL) { + delete timezone; + } + if (calendar != NULL && calendar_owned) { + delete calendar; + } + if (U_FAILURE(intl_error_get_code(NULL TSRMLS_CC))) { + /* free_object handles partially constructed instances fine */ + zval_dtor(return_value); + RETVAL_NULL(); + } +} +/* }}} */ + +/* {{{ proto IntlDateFormatter IntlDateFormatter::create(string $locale, long date_type, long time_type[, string $timezone_str, long $calendar, string $pattern] ) + * Create formatter. }}} */ +/* {{{ proto IntlDateFormatter datefmt_create(string $locale, long date_type, long time_type[, string $timezone_str, long $calendar, string $pattern) + * Create formatter. + */ +U_CFUNC PHP_FUNCTION( datefmt_create ) +{ + object_init_ex( return_value, IntlDateFormatter_ce_ptr ); + datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} +/* }}} */ + +/* {{{ proto void IntlDateFormatter::__construct(string $locale, long date_type, long time_type[, string $timezone_str, long $calendar, string $pattern]) + * IntlDateFormatter object constructor. + */ +U_CFUNC PHP_METHOD( IntlDateFormatter, __construct ) +{ + /* return_value param is being changed, therefore we will always return + * NULL here */ + return_value = getThis(); + datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} +/* }}} */ diff --git a/ext/intl/dateformat/dateformat_create.h b/ext/intl/dateformat/dateformat_create.h new file mode 100644 index 0000000000000..47e67c2f45ac0 --- /dev/null +++ b/ext/intl/dateformat/dateformat_create.h @@ -0,0 +1,25 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ +#ifndef DATE_FORMATTER_H +#define DATE_FORMATTER_H + +#include + +PHP_FUNCTION( datefmt_create ); +PHP_METHOD( IntlDateFormatter, __construct ); +void dateformat_register_constants( INIT_FUNC_ARGS ); + +#endif // DATE_FORMATTER_H diff --git a/ext/intl/dateformat/dateformat_data.c b/ext/intl/dateformat/dateformat_data.c old mode 100755 new mode 100644 diff --git a/ext/intl/dateformat/dateformat_data.h b/ext/intl/dateformat/dateformat_data.h old mode 100755 new mode 100644 diff --git a/ext/intl/dateformat/dateformat_format.c b/ext/intl/dateformat/dateformat_format.c old mode 100755 new mode 100644 index 4d03d924c8564..ffae15518b08e --- a/ext/intl/dateformat/dateformat_format.c +++ b/ext/intl/dateformat/dateformat_format.c @@ -21,13 +21,13 @@ #include #include -#include "php_intl.h" -#include "intl_convert.h" +#include "../php_intl.h" +#include "../intl_convert.h" +#include "../common/common_date.h" #include "dateformat.h" #include "dateformat_class.h" #include "dateformat_format.h" #include "dateformat_data.h" -#include "ext/date/php_date.h" /* {{{ * Internal function which calls the udat_format @@ -59,20 +59,38 @@ static void internal_format(IntlDateFormatter_object *dfo, UDate timestamp, zval /* {{{ * Internal function which fetches an element from the passed array for the key_name passed */ -static double internal_get_arr_ele(IntlDateFormatter_object *dfo, HashTable* hash_arr, char* key_name TSRMLS_DC) +static int32_t internal_get_arr_ele(IntlDateFormatter_object *dfo, + HashTable* hash_arr, char* key_name, intl_error *err TSRMLS_DC) { - zval** ele_value = NULL; - UDate result = -1; - - if( zend_hash_find( hash_arr, key_name, strlen(key_name) + 1, (void **)&ele_value ) == SUCCESS ){ - if( Z_TYPE_PP(ele_value)!= IS_LONG ){ - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_format: parameter array does not contain a long element.", 0 TSRMLS_CC ); - }else{ - result = Z_LVAL_PP(ele_value); + zval **ele_value = NULL; + int32_t result = 0; + char *message; + + if (U_FAILURE(err->code)) { + return result; + } + + if (zend_hash_find(hash_arr, key_name, strlen(key_name) + 1, + (void **)&ele_value) == SUCCESS) { + if(Z_TYPE_PP(ele_value) != IS_LONG) { + spprintf(&message, 0, "datefmt_format: parameter array contains " + "a non-integer element for key '%s'", key_name); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); + efree(message); + } else { + if (Z_LVAL_PP(ele_value) > INT32_MAX || + Z_LVAL_PP(ele_value) < INT32_MIN) { + spprintf(&message, 0, "datefmt_format: value %ld is out of " + "bounds for a 32-bit integer in key '%s'", + Z_LVAL_PP(ele_value), key_name); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); + efree(message); + } else { + result = Z_LVAL_PP(ele_value); + } } } - /* printf("\n Inside internal_get_arr_ele key_name= %s, result = %g \n", key_name, result); */ + return result; } /* }}} */ @@ -80,41 +98,51 @@ static double internal_get_arr_ele(IntlDateFormatter_object *dfo, HashTable* has /* {{{ * Internal function which sets UCalendar from the passed array and retrieves timestamp */ -static UDate internal_get_timestamp(IntlDateFormatter_object *dfo, HashTable* hash_arr TSRMLS_DC) +static UDate internal_get_timestamp(IntlDateFormatter_object *dfo, + HashTable *hash_arr TSRMLS_DC) { - long year =0; - long month =0; - long hour =0; - long minute =0; - long second =0; - long wday =0; - long yday =0; - long mday =0; - UBool isInDST = FALSE; - UCalendar *pcal; + int32_t year, + month, + hour, + minute, + second, + mday; + UCalendar *pcal; + UDate result; + intl_error *err = &dfo->datef_data.error; + +#define INTL_GET_ELEM(elem) \ + internal_get_arr_ele(dfo, hash_arr, (elem), err TSRMLS_CC) /* Fetch values from the incoming array */ - year = internal_get_arr_ele( dfo, hash_arr, CALENDAR_YEAR TSRMLS_CC) + 1900; /* tm_year is years since 1900 */ + year = INTL_GET_ELEM(CALENDAR_YEAR) + 1900; /* tm_year is years since 1900 */ /* Month in ICU and PHP starts from January =0 */ - month = internal_get_arr_ele( dfo, hash_arr, CALENDAR_MON TSRMLS_CC); - hour = internal_get_arr_ele( dfo, hash_arr, CALENDAR_HOUR TSRMLS_CC); - minute = internal_get_arr_ele( dfo, hash_arr, CALENDAR_MIN TSRMLS_CC); - second = internal_get_arr_ele( dfo, hash_arr, CALENDAR_SEC TSRMLS_CC); - wday = internal_get_arr_ele( dfo, hash_arr, CALENDAR_WDAY TSRMLS_CC); - yday = internal_get_arr_ele( dfo, hash_arr, CALENDAR_YDAY TSRMLS_CC); - isInDST = internal_get_arr_ele( dfo, hash_arr, CALENDAR_ISDST TSRMLS_CC); + month = INTL_GET_ELEM(CALENDAR_MON); + hour = INTL_GET_ELEM(CALENDAR_HOUR); + minute = INTL_GET_ELEM(CALENDAR_MIN); + second = INTL_GET_ELEM(CALENDAR_SEC); /* For the ucal_setDateTime() function, this is the 'date' value */ - mday = internal_get_arr_ele( dfo, hash_arr, CALENDAR_MDAY TSRMLS_CC); + mday = INTL_GET_ELEM(CALENDAR_MDAY); - pcal = udat_getCalendar(DATE_FORMAT_OBJECT(dfo)); - /* set the incoming values for the calendar */ - ucal_setDateTime( pcal, year, month, mday, hour, minute, second, &INTL_DATA_ERROR_CODE(dfo)); - if( INTL_DATA_ERROR_CODE(dfo) != U_ZERO_ERROR){ +#undef INTL_GET_ELEM + + pcal = ucal_clone(udat_getCalendar(DATE_FORMAT_OBJECT(dfo)), + &INTL_DATA_ERROR_CODE(dfo)); + + if (INTL_DATA_ERROR_CODE(dfo) != U_ZERO_ERROR) { + intl_errors_set(err, INTL_DATA_ERROR_CODE(dfo), "datefmt_format: " + "error cloning calendar", 0 TSRMLS_CC); return 0; } - + + /* set the incoming values for the calendar */ + ucal_setDateTime(pcal, year, month, mday, hour, minute, second, &INTL_DATA_ERROR_CODE(dfo)); + /* actually, ucal_setDateTime cannot fail */ + /* Fetch the timestamp from the UCalendar */ - return ucal_getMillis(pcal, &INTL_DATA_ERROR_CODE(dfo) ); + result = ucal_getMillis(pcal, &INTL_DATA_ERROR_CODE(dfo)); + ucal_close(pcal); + return result; } @@ -124,70 +152,39 @@ static UDate internal_get_timestamp(IntlDateFormatter_object *dfo, HashTable* ha * Format the time value as a string. }}}*/ PHP_FUNCTION(datefmt_format) { - UDate timestamp =0; - UDate p_timestamp =0; - HashTable* hash_arr = NULL; - zval* zarg = NULL; + UDate timestamp = 0; + HashTable *hash_arr = NULL; + zval *zarg = NULL; DATE_FORMAT_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oz", &object, IntlDateFormatter_ce_ptr,&zarg ) == FAILURE ) - { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_format: unable to parse input params", 0 TSRMLS_CC ); + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oz", + &object, IntlDateFormatter_ce_ptr, &zarg) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_format: unable " + "to parse input params", 0 TSRMLS_CC ); RETURN_FALSE; } - /* Fetch the object. */ DATE_FORMAT_METHOD_FETCH_OBJECT; - switch(Z_TYPE_P(zarg) ){ - case IS_LONG: - p_timestamp = Z_LVAL_P(zarg) ; - timestamp = p_timestamp * 1000; - break; - case IS_DOUBLE: - /* timestamp*1000 since ICU expects it in milliseconds */ - p_timestamp = Z_DVAL_P(zarg) ; - timestamp = p_timestamp * 1000; - break; - case IS_ARRAY: - hash_arr = Z_ARRVAL_P(zarg); - if( !hash_arr || zend_hash_num_elements( hash_arr ) == 0 ) - RETURN_FALSE; - - timestamp = internal_get_timestamp(dfo, hash_arr TSRMLS_CC); - INTL_METHOD_CHECK_STATUS( dfo, "datefmt_format: Date formatting failed" ) - break; - case IS_OBJECT: { - zend_class_entry *date_ce = php_date_get_date_ce(); - zval retval; - zval *zfuncname; - if(!instanceof_function(Z_OBJCE_P(zarg), date_ce TSRMLS_CC)) { - intl_errors_set(INTL_DATA_ERROR_P(dfo), U_ILLEGAL_ARGUMENT_ERROR, "datefmt_format: object must be an instance of DateTime", 0 TSRMLS_CC ); - RETURN_FALSE; - } - INIT_ZVAL(retval); - MAKE_STD_ZVAL(zfuncname); - ZVAL_STRING(zfuncname, "getTimestamp", 1); - if(call_user_function(NULL, &zarg, zfuncname, &retval, 0, NULL TSRMLS_CC) != SUCCESS || Z_TYPE(retval) != IS_LONG) { - intl_errors_set(INTL_DATA_ERROR_P(dfo), U_ILLEGAL_ARGUMENT_ERROR, "datefmt_format: cannot get timestamp", 0 TSRMLS_CC ); - zval_ptr_dtor(&zfuncname); - RETURN_FALSE; - } - zval_ptr_dtor(&zfuncname); - p_timestamp = Z_LVAL(retval); - timestamp = p_timestamp*1000; + if (Z_TYPE_P(zarg) == IS_ARRAY) { + hash_arr = Z_ARRVAL_P(zarg); + if (!hash_arr || zend_hash_num_elements(hash_arr) == 0) { + RETURN_FALSE; } - break; - default: - intl_errors_set( INTL_DATA_ERROR_P(dfo), U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_format: takes either an array or an integer timestamp value or a DateTime object", 0 TSRMLS_CC ); + + timestamp = internal_get_timestamp(dfo, hash_arr TSRMLS_CC); + INTL_METHOD_CHECK_STATUS(dfo, "datefmt_format: date formatting failed") + } else { + timestamp = intl_zval_to_millis(zarg, INTL_DATA_ERROR_P(dfo), + "datefmt_format" TSRMLS_CC); + if (U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) { RETURN_FALSE; + } } - - internal_format( dfo, timestamp, return_value TSRMLS_CC); + internal_format( dfo, timestamp, return_value TSRMLS_CC); } /* }}} */ diff --git a/ext/intl/dateformat/dateformat_format.h b/ext/intl/dateformat/dateformat_format.h old mode 100755 new mode 100644 diff --git a/ext/intl/dateformat/dateformat_format_object.cpp b/ext/intl/dateformat/dateformat_format_object.cpp new file mode 100644 index 0000000000000..e8981faa2676f --- /dev/null +++ b/ext/intl/dateformat/dateformat_format_object.cpp @@ -0,0 +1,230 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#include "../intl_cppshims.h" + +#include +#include +#include +#include +#include + +#include "../intl_convertcpp.h" + +extern "C" { +#include "../php_intl.h" +#include "../locale/locale.h" +#define USE_CALENDAR_POINTER 1 +#include "../calendar/calendar_class.h" +#include +#include "../common/common_date.h" +} + +static const DateFormat::EStyle valid_styles[] = { + DateFormat::kNone, + DateFormat::kFull, + DateFormat::kLong, + DateFormat::kMedium, + DateFormat::kShort, + DateFormat::kFullRelative, + DateFormat::kLongRelative, + DateFormat::kMediumRelative, + DateFormat::kShortRelative, +}; + +static bool valid_format(zval **z) { + if (Z_TYPE_PP(z) == IS_LONG) { + long lval = Z_LVAL_PP(z); + for (int i = 0; i < sizeof(valid_styles) / sizeof(*valid_styles); i++) { + if ((long)valid_styles[i] == lval) { + return true; + } + } + } + + return false; +} + +U_CFUNC PHP_FUNCTION(datefmt_format_object) +{ + zval *object, + **format = NULL; + const char *locale_str = NULL; + int locale_len; + bool pattern = false; + UDate date; + TimeZone *timeZone = NULL; + UErrorCode status = U_ZERO_ERROR; + DateFormat *df = NULL; + Calendar *cal = NULL; + DateFormat::EStyle dateStyle = DateFormat::kDefault, + timeStyle = DateFormat::kDefault; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|Zs!", + &object, &format, &locale_str, &locale_len) == FAILURE) { + RETURN_FALSE; + } + + if (!locale_str) { + locale_str = intl_locale_get_default(TSRMLS_C); + } + + if (format == NULL || Z_TYPE_PP(format) == IS_NULL) { + //nothing + } else if (Z_TYPE_PP(format) == IS_ARRAY) { + HashTable *ht = Z_ARRVAL_PP(format); + HashPosition pos = {0}; + zval **z; + if (zend_hash_num_elements(ht) != 2) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_format_object: bad format; if array, it must have " + "two elements", 0 TSRMLS_CC); + RETURN_FALSE; + } + + zend_hash_internal_pointer_reset_ex(ht, &pos); + zend_hash_get_current_data_ex(ht, (void**)&z, &pos); + if (!valid_format(z)) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_format_object: bad format; the date format (first " + "element of the array) is not valid", 0 TSRMLS_CC); + RETURN_FALSE; + } + dateStyle = (DateFormat::EStyle)Z_LVAL_PP(z); + + zend_hash_move_forward_ex(ht, &pos); + zend_hash_get_current_data_ex(ht, (void**)&z, &pos); + if (!valid_format(z)) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_format_object: bad format; the time format (" + "second element of the array) is not valid", 0 TSRMLS_CC); + RETURN_FALSE; + } + timeStyle = (DateFormat::EStyle)Z_LVAL_PP(z); + } else if (Z_TYPE_PP(format) == IS_LONG) { + if (!valid_format(format)) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_format_object: the date/time format type is invalid", + 0 TSRMLS_CC); + RETURN_FALSE; + } + dateStyle = timeStyle = (DateFormat::EStyle)Z_LVAL_PP(format); + } else { + convert_to_string_ex(format); + if (Z_STRLEN_PP(format) == 0) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_format_object: the format is empty", 0 TSRMLS_CC); + RETURN_FALSE; + } + pattern = true; + } + + //there's no support for relative time in ICU yet + timeStyle = (DateFormat::EStyle)(timeStyle & ~DateFormat::kRelative); + + zend_class_entry *instance_ce = Z_OBJCE_P(object); + if (instanceof_function(instance_ce, Calendar_ce_ptr TSRMLS_CC)) { + Calendar *obj_cal = calendar_fetch_native_calendar(object TSRMLS_CC); + if (obj_cal == NULL) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_format_object: bad IntlCalendar instance: " + "not initialized properly", 0 TSRMLS_CC); + RETURN_FALSE; + } + timeZone = obj_cal->getTimeZone().clone(); + date = obj_cal->getTime(status); + if (U_FAILURE(status)) { + intl_error_set(NULL, status, + "datefmt_format_object: error obtaining instant from " + "IntlCalendar", 0 TSRMLS_CC); + RETVAL_FALSE; + goto cleanup; + } + cal = obj_cal->clone(); + } else if (instanceof_function(instance_ce, php_date_get_date_ce() TSRMLS_CC)) { + if (intl_datetime_decompose(object, &date, &timeZone, NULL, + "datefmt_format_object" TSRMLS_CC) == FAILURE) { + RETURN_FALSE; + } + cal = new GregorianCalendar(Locale::createFromName(locale_str), status); + if (U_FAILURE(status)) { + intl_error_set(NULL, status, + "datefmt_format_object: could not create GregorianCalendar", + 0 TSRMLS_CC); + RETVAL_FALSE; + goto cleanup; + } + } else { + intl_error_set(NULL, status, "datefmt_format_object: the passed object " + "must be an instance of either IntlCalendar or DateTime", + 0 TSRMLS_CC); + RETURN_FALSE; + } + + if (pattern) { + df = new SimpleDateFormat( + UnicodeString(Z_STRVAL_PP(format), Z_STRLEN_PP(format), + UnicodeString::kInvariant), + Locale::createFromName(locale_str), + status); + + if (U_FAILURE(status)) { + intl_error_set(NULL, status, + "datefmt_format_object: could not create SimpleDateFormat", + 0 TSRMLS_CC); + RETVAL_FALSE; + goto cleanup; + } + } else { + df = DateFormat::createDateTimeInstance(dateStyle, timeStyle, + Locale::createFromName(locale_str)); + + if (df == NULL) { /* according to ICU sources, this should never happen */ + intl_error_set(NULL, status, + "datefmt_format_object: could not create DateFormat", + 0 TSRMLS_CC); + RETVAL_FALSE; + goto cleanup; + } + } + + //must be in this order (or have the cal adopt the tz) + df->adoptCalendar(cal); + cal = NULL; + df->adoptTimeZone(timeZone); + timeZone = NULL; + + { + UnicodeString result = UnicodeString(); + df->format(date, result); + + Z_TYPE_P(return_value) = IS_STRING; + if (intl_charFromString(result, &Z_STRVAL_P(return_value), + &Z_STRLEN_P(return_value), &status) == FAILURE) { + intl_error_set(NULL, status, + "datefmt_format_object: error converting result to UTF-8", + 0 TSRMLS_CC); + RETVAL_FALSE; + goto cleanup; + } + } + + +cleanup: + delete df; + delete timeZone; + delete cal; +} diff --git a/ext/intl/dateformat/dateformat_format_object.h b/ext/intl/dateformat/dateformat_format_object.h new file mode 100644 index 0000000000000..d80ea87e0f813 --- /dev/null +++ b/ext/intl/dateformat/dateformat_format_object.h @@ -0,0 +1,19 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ + */ + +#include + +PHP_FUNCTION(datefmt_format_object); diff --git a/ext/intl/dateformat/dateformat_helpers.cpp b/ext/intl/dateformat/dateformat_helpers.cpp new file mode 100644 index 0000000000000..74758bbec92b5 --- /dev/null +++ b/ext/intl/dateformat/dateformat_helpers.cpp @@ -0,0 +1,106 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#include "../intl_cppshims.h" + +#include +#include + +#include "dateformat_helpers.h" + +extern "C" { +#include "../php_intl.h" +#include +#define USE_CALENDAR_POINTER 1 +#include "../calendar/calendar_class.h" +} + +int datefmt_process_calendar_arg(zval* calendar_zv, + Locale const& locale, + const char *func_name, + intl_error *err, + Calendar*& cal, + long& cal_int_type, + bool& calendar_owned TSRMLS_DC) +{ + char *msg; + UErrorCode status = UErrorCode(); + + if (calendar_zv == NULL || Z_TYPE_P(calendar_zv) == IS_NULL) { + + // default requested + cal = new GregorianCalendar(locale, status); + calendar_owned = true; + + cal_int_type = UCAL_GREGORIAN; + + } else if (Z_TYPE_P(calendar_zv) == IS_LONG) { + + long v = Z_LVAL_P(calendar_zv); + if (v != (long)UCAL_TRADITIONAL && v != (long)UCAL_GREGORIAN) { + spprintf(&msg, 0, "%s: 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", + func_name); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); + efree(msg); + return FAILURE; + } else if (v == (long)UCAL_TRADITIONAL) { + cal = Calendar::createInstance(locale, status); + } else { //UCAL_GREGORIAN + cal = new GregorianCalendar(locale, status); + } + calendar_owned = true; + + cal_int_type = Z_LVAL_P(calendar_zv); + + } else if (Z_TYPE_P(calendar_zv) == IS_OBJECT && + instanceof_function_ex(Z_OBJCE_P(calendar_zv), + Calendar_ce_ptr, 0 TSRMLS_CC)) { + + cal = calendar_fetch_native_calendar(calendar_zv TSRMLS_CC); + if (cal == NULL) { + spprintf(&msg, 0, "%s: Found unconstructed IntlCalendar object", + func_name); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); + efree(msg); + return FAILURE; + } + calendar_owned = false; + + cal_int_type = -1; + + } else { + spprintf(&msg, 0, "%s: Invalid calendar argument; should be an integer " + "or an IntlCalendar instance", func_name); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); + efree(msg); + return FAILURE; + } + + if (cal == NULL && !U_FAILURE(status)) { + status = U_MEMORY_ALLOCATION_ERROR; + } + if (U_FAILURE(status)) { + spprintf(&msg, 0, "%s: Failure instantiating calendar", func_name); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); + efree(msg); + return FAILURE; + } + + return SUCCESS; +} diff --git a/ext/intl/dateformat/dateformat_helpers.h b/ext/intl/dateformat/dateformat_helpers.h new file mode 100644 index 0000000000000..bded0b7d7811d --- /dev/null +++ b/ext/intl/dateformat/dateformat_helpers.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#ifndef DATEFORMAT_HELPERS_H +#define DATEFORMAT_HELPERS_H + +#ifndef __cplusplus +#error For C++ only +#endif + +#include + +extern "C" { +#include "../php_intl.h" +} + +int datefmt_process_calendar_arg(zval* calendar_zv, + Locale const& locale, + const char *func_name, + intl_error *err, + Calendar*& cal, + long& cal_int_type, + bool& calendar_owned TSRMLS_DC); + +#endif /* DATEFORMAT_HELPERS_H */ + diff --git a/ext/intl/dateformat/dateformat_parse.c b/ext/intl/dateformat/dateformat_parse.c old mode 100755 new mode 100644 diff --git a/ext/intl/dateformat/dateformat_parse.h b/ext/intl/dateformat/dateformat_parse.h old mode 100755 new mode 100644 diff --git a/ext/intl/doc/Tutorial.txt b/ext/intl/doc/Tutorial.txt old mode 100755 new mode 100644 diff --git a/ext/intl/doc/collator_api.php b/ext/intl/doc/collator_api.php old mode 100755 new mode 100644 index 5428783750472..ef7250243bfdd --- a/ext/intl/doc/collator_api.php +++ b/ext/intl/doc/collator_api.php @@ -116,7 +116,7 @@ public function getErrorCode() {} /** * Return error text for the last ICU operation. * - * @return string Description of an error occured in the last + * @return string Description of an error occurred in the last * Collator method call. */ public function getErrorMessage() {} @@ -236,7 +236,7 @@ public function setStrength( $strength ) {} * * @return string Real locale name from which the * collation data comes. If the collator - * was instantiated from rules or an error occured, + * was instantiated from rules or an error occurred, * returns false. */ public function getLocale( $type ) {} @@ -331,7 +331,7 @@ function collator_sort_with_sort_keys( $coll, $arr ) {} * * @return string Real locale name from which the * collation data comes. If the collator - * was instantiated from rules or an error occured, + * was instantiated from rules or an error occurred, * returns false. */ function collator_get_locale( $coll, $type ) {} @@ -391,7 +391,7 @@ function collator_get_error_code( $coll ) {} * * @param Collator $coll Collator object. * - * @return string Description of an error occured in the last + * @return string Description of an error occurred in the last * Collator API function call. */ function collator_get_error_message( $coll ) {} diff --git a/ext/intl/doc/common_api.php b/ext/intl/doc/common_api.php old mode 100755 new mode 100644 index ce2329fe3b817..993dab180b43c --- a/ext/intl/doc/common_api.php +++ b/ext/intl/doc/common_api.php @@ -1,7 +1,7 @@ nf_data TSRMLS_CC ); zend_object_std_init( &intern->zo, ce TSRMLS_CC ); + object_properties_init(&intern->zo, ce); retval.handle = zend_objects_store_put( intern, diff --git a/ext/intl/formatter/formatter_class.h b/ext/intl/formatter/formatter_class.h old mode 100755 new mode 100644 diff --git a/ext/intl/formatter/formatter_data.c b/ext/intl/formatter/formatter_data.c old mode 100755 new mode 100644 diff --git a/ext/intl/formatter/formatter_data.h b/ext/intl/formatter/formatter_data.h old mode 100755 new mode 100644 diff --git a/ext/intl/formatter/formatter_format.c b/ext/intl/formatter/formatter_format.c old mode 100755 new mode 100644 diff --git a/ext/intl/formatter/formatter_format.h b/ext/intl/formatter/formatter_format.h old mode 100755 new mode 100644 diff --git a/ext/intl/formatter/formatter_main.c b/ext/intl/formatter/formatter_main.c old mode 100755 new mode 100644 index 8fa17560b8957..96f1bcf2e3104 --- a/ext/intl/formatter/formatter_main.c +++ b/ext/intl/formatter/formatter_main.c @@ -56,7 +56,7 @@ static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) } if(locale_len == 0) { - locale = INTL_G(default_locale); + locale = intl_locale_get_default(TSRMLS_C); } /* Create an ICU number formatter. */ diff --git a/ext/intl/formatter/formatter_main.h b/ext/intl/formatter/formatter_main.h old mode 100755 new mode 100644 diff --git a/ext/intl/formatter/formatter_parse.c b/ext/intl/formatter/formatter_parse.c old mode 100755 new mode 100644 diff --git a/ext/intl/formatter/formatter_parse.h b/ext/intl/formatter/formatter_parse.h old mode 100755 new mode 100644 diff --git a/ext/intl/grapheme/grapheme.h b/ext/intl/grapheme/grapheme.h old mode 100755 new mode 100644 index c0e697ac1e55f..756ce9173e834 --- a/ext/intl/grapheme/grapheme.h +++ b/ext/intl/grapheme/grapheme.h @@ -19,7 +19,6 @@ #include #include -#include PHP_FUNCTION(grapheme_strlen); PHP_FUNCTION(grapheme_strpos); diff --git a/ext/intl/grapheme/grapheme_string.c b/ext/intl/grapheme/grapheme_string.c old mode 100755 new mode 100644 index 692e2f80b0d63..475bbe4184791 --- a/ext/intl/grapheme/grapheme_string.c +++ b/ext/intl/grapheme/grapheme_string.c @@ -822,6 +822,7 @@ PHP_FUNCTION(grapheme_extract) } else { /* initialize next */ + zval_dtor(next); ZVAL_LONG(next, lstart); } } diff --git a/ext/intl/grapheme/grapheme_util.c b/ext/intl/grapheme/grapheme_util.c old mode 100755 new mode 100644 diff --git a/ext/intl/grapheme/grapheme_util.h b/ext/intl/grapheme/grapheme_util.h old mode 100755 new mode 100644 diff --git a/ext/intl/intl_common.h b/ext/intl/intl_common.h old mode 100755 new mode 100644 diff --git a/ext/intl/intl_convert.c b/ext/intl/intl_convert.c old mode 100755 new mode 100644 index 33f17306253f7..92cdc4cef41c9 --- a/ext/intl/intl_convert.c +++ b/ext/intl/intl_convert.c @@ -67,7 +67,7 @@ void intl_convert_utf8_to_utf16( return; } - /* Bail out if an unexpected error occured. + /* Bail out if an unexpected error occurred. * (U_BUFFER_OVERFLOW_ERROR means that *target buffer is not large enough). * (U_STRING_NOT_TERMINATED_WARNING usually means that the input string is empty). */ @@ -119,7 +119,7 @@ void intl_convert_utf16_to_utf8( *status = U_ZERO_ERROR; u_strToUTF8( NULL, 0, &dst_len, src, src_len, status ); - /* Bail out if an unexpected error occured. + /* Bail out if an unexpected error occurred. * (U_BUFFER_OVERFLOW_ERROR means that *target buffer is not large enough). * (U_STRING_NOT_TERMINATED_WARNING usually means that the input string is empty). */ diff --git a/ext/intl/intl_convert.h b/ext/intl/intl_convert.h old mode 100755 new mode 100644 diff --git a/ext/intl/intl_convertcpp.cpp b/ext/intl/intl_convertcpp.cpp index 8dddc7029303a..f699a3c61c9a4 100644 --- a/ext/intl/intl_convertcpp.cpp +++ b/ext/intl/intl_convertcpp.cpp @@ -16,8 +16,7 @@ /* $Id$ */ -//Fixes the build on old versions of ICU with Windows -#include +#include "intl_cppshims.h" #include "intl_convertcpp.h" #include @@ -48,9 +47,16 @@ int intl_stringFromChar(UnicodeString &ret, char *str, int32_t str_len, UErrorCo } /* }}} */ -/* {{{ intl_charFromString */ +/* {{{ intl_charFromString + * faster than doing intl_convert_utf16_to_utf8(&res, &res_len, + * from.getBuffer(), from.length(), &status), + * but consumes more memory */ int intl_charFromString(const UnicodeString &from, char **res, int *res_len, UErrorCode *status) { + if (from.isBogus()) { + return FAILURE; + } + //the number of UTF-8 code units is not larger than that of UTF-16 code //units * 3 + 1 for the terminator int32_t capacity = from.length() * 3 + 1; diff --git a/ext/intl/intl_cppshims.h b/ext/intl/intl_cppshims.h new file mode 100644 index 0000000000000..2fb70edfd0e20 --- /dev/null +++ b/ext/intl/intl_cppshims.h @@ -0,0 +1,34 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#ifndef INTL_CPPSHIMS_H +#define INTL_CPPSHIMS_H + +#ifndef __cplusplus +#error For inclusion form C++ files only +#endif + +#ifdef _MSC_VER +//This is only required for old versions of ICU only +#include + +#include + +/* avoid redefinition of int8_t, also defined in unicode/pwin32.h */ +#define _MSC_STDINT_H_ 1 +#endif + +#endif \ No newline at end of file diff --git a/ext/intl/intl_data.h b/ext/intl/intl_data.h old mode 100755 new mode 100644 diff --git a/ext/intl/intl_error.c b/ext/intl/intl_error.c old mode 100755 new mode 100644 index 2c7066b0817a1..99b1c6001cd01 --- a/ext/intl/intl_error.c +++ b/ext/intl/intl_error.c @@ -25,6 +25,7 @@ #include "php_intl.h" #include "intl_error.h" +#include "intl_convert.h" ZEND_EXTERN_MODULE_GLOBALS( intl ) @@ -242,7 +243,82 @@ void intl_register_IntlException_class( TSRMLS_D ) default_exception_ce, NULL TSRMLS_CC ); IntlException_ce_ptr->create_object = default_exception_ce->create_object; } -/* }}} */ + +smart_str intl_parse_error_to_string( UParseError* pe ) +{ + smart_str ret = {0}; + char *buf; + int u8len; + UErrorCode status; + int any = 0; + + assert( pe != NULL ); + + smart_str_appends( &ret, "parse error " ); + if( pe->line > 0 ) + { + smart_str_appends( &ret, "on line " ); + smart_str_append_long( &ret, (long ) pe->line ); + any = 1; + } + if( pe->offset >= 0 ) { + if( any ) + smart_str_appends( &ret, ", " ); + else + smart_str_appends( &ret, "at " ); + + smart_str_appends( &ret, "offset " ); + smart_str_append_long( &ret, (long ) pe->offset ); + any = 1; + } + + if (pe->preContext[0] != 0 ) { + if( any ) + smart_str_appends( &ret, ", " ); + + smart_str_appends( &ret, "after \"" ); + intl_convert_utf16_to_utf8( &buf, &u8len, pe->preContext, -1, &status ); + if( U_FAILURE( status ) ) + { + smart_str_appends( &ret, "(could not convert parser error pre-context to UTF-8)" ); + } + else { + smart_str_appendl( &ret, buf, u8len ); + efree( buf ); + } + smart_str_appends( &ret, "\"" ); + any = 1; + } + + if( pe->postContext[0] != 0 ) + { + if( any ) + smart_str_appends( &ret, ", " ); + + smart_str_appends( &ret, "before or at \"" ); + intl_convert_utf16_to_utf8( &buf, &u8len, pe->postContext, -1, &status ); + if( U_FAILURE( status ) ) + { + smart_str_appends( &ret, "(could not convert parser error post-context to UTF-8)" ); + } + else + { + smart_str_appendl( &ret, buf, u8len ); + efree( buf ); + } + smart_str_appends( &ret, "\"" ); + any = 1; + } + + if( !any ) + { + smart_str_free( &ret ); + smart_str_appends( &ret, "no parse error" ); + } + + smart_str_0( &ret ); + return ret; +} /* * Local variables: diff --git a/ext/intl/intl_error.h b/ext/intl/intl_error.h old mode 100755 new mode 100644 index b5000a15de667..4d8eb79327f1e --- a/ext/intl/intl_error.h +++ b/ext/intl/intl_error.h @@ -20,6 +20,8 @@ #define INTL_ERROR_H #include +#include +#include #define INTL_ERROR_CODE(e) (e).code @@ -44,6 +46,9 @@ void intl_errors_set_custom_msg( intl_error* err, char* msg, int copyMsg void intl_errors_set_code( intl_error* err, UErrorCode err_code TSRMLS_DC ); void intl_errors_set( intl_error* err, UErrorCode code, char* msg, int copyMsg TSRMLS_DC ); +// Other error helpers +smart_str intl_parse_error_to_string( UParseError* pe ); + // exported to be called on extension MINIT void intl_register_IntlException_class( TSRMLS_D ); diff --git a/ext/intl/locale/locale.c b/ext/intl/locale/locale.c old mode 100755 new mode 100644 diff --git a/ext/intl/locale/locale.h b/ext/intl/locale/locale.h old mode 100755 new mode 100644 index 0aaab4b5b5151..f3859c7a2a15c --- a/ext/intl/locale/locale.h +++ b/ext/intl/locale/locale.h @@ -22,8 +22,6 @@ #include void locale_register_constants( INIT_FUNC_ARGS ); - -const char *intl_locale_get_default( TSRMLS_D ); #define OPTION_DEFAULT NULL #define LOC_LANG_TAG "language" diff --git a/ext/intl/locale/locale_class.c b/ext/intl/locale/locale_class.c old mode 100755 new mode 100644 diff --git a/ext/intl/locale/locale_class.h b/ext/intl/locale/locale_class.h old mode 100755 new mode 100644 diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c old mode 100755 new mode 100644 index 8cc33cd74c3d4..d1a86d8ee27f4 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -201,14 +201,6 @@ static int getSingletonPos(char* str) } /* }}} */ -const char *intl_locale_get_default( TSRMLS_D ) -{ - if( INTL_G(default_locale) == NULL ) { - return uloc_getDefault(); - } - return INTL_G(default_locale); -} - /* {{{ proto static string Locale::getDefault( ) Get default locale */ /* }}} */ @@ -398,7 +390,7 @@ static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS) } if(loc_name_len == 0) { - loc_name = INTL_G(default_locale); + loc_name = intl_locale_get_default(TSRMLS_C); } /* Call ICU get */ @@ -504,7 +496,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME } if(loc_name_len == 0) { - loc_name = INTL_G(default_locale); + loc_name = intl_locale_get_default(TSRMLS_C); } if( strcmp(tag_name, DISP_NAME) != 0 ){ @@ -526,13 +518,13 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME /* Check if disp_loc_name passed , if not use default locale */ if( !disp_loc_name){ - disp_loc_name = estrdup(INTL_G(default_locale)); + disp_loc_name = estrdup(intl_locale_get_default(TSRMLS_C)); free_loc_name = 1; } /* Get the disp_value for the given locale */ do{ - disp_name = erealloc( disp_name , buflen ); + disp_name = erealloc( disp_name , buflen * sizeof(UChar) ); disp_name_len = buflen; if( strcmp(tag_name , LOC_LANG_TAG)==0 ){ @@ -547,6 +539,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME buflen = uloc_getDisplayName ( mod_loc_name , disp_loc_name , disp_name , disp_name_len , &status); } + /* U_STRING_NOT_TERMINATED_WARNING is admissible here; don't look for it */ if( U_FAILURE( status ) ) { if( status == U_BUFFER_OVERFLOW_ERROR ) @@ -697,7 +690,7 @@ PHP_FUNCTION( locale_get_keywords ) } if(loc_name_len == 0) { - loc_name = INTL_G(default_locale); + loc_name = intl_locale_get_default(TSRMLS_C); } /* Get the keywords */ @@ -1104,7 +1097,7 @@ PHP_FUNCTION(locale_parse) } if(loc_name_len == 0) { - loc_name = INTL_G(default_locale); + loc_name = intl_locale_get_default(TSRMLS_C); } array_init( return_value ); @@ -1152,7 +1145,7 @@ PHP_FUNCTION(locale_get_all_variants) } if(loc_name_len == 0) { - loc_name = INTL_G(default_locale); + loc_name = intl_locale_get_default(TSRMLS_C); } @@ -1258,7 +1251,7 @@ PHP_FUNCTION(locale_filter_matches) } if(loc_range_len == 0) { - loc_range = INTL_G(default_locale); + loc_range = intl_locale_get_default(TSRMLS_C); } if( strcmp(loc_range,"*")==0){ @@ -1544,7 +1537,7 @@ PHP_FUNCTION(locale_lookup) } if(loc_range_len == 0) { - loc_range = INTL_G(default_locale); + loc_range = intl_locale_get_default(TSRMLS_C); } hash_arr = HASH_OF(arr); @@ -1567,11 +1560,11 @@ PHP_FUNCTION(locale_lookup) /* }}} */ /* {{{ proto string Locale::acceptFromHttp(string $http_accept) -* Tries to find out best available locale based on HTTP “Accept-Language” header +* Tries to find out best available locale based on HTTP �Accept-Language� header */ /* }}} */ /* {{{ proto string locale_accept_from_http(string $http_accept) -* Tries to find out best available locale based on HTTP “Accept-Language” header +* Tries to find out best available locale based on HTTP �Accept-Language� header */ PHP_FUNCTION(locale_accept_from_http) { diff --git a/ext/intl/locale/locale_methods.h b/ext/intl/locale/locale_methods.h old mode 100755 new mode 100644 diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c old mode 100755 new mode 100644 index 84f14de1bdc30..45e5c7158b949 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -61,12 +61,14 @@ static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) } if(locale_len == 0) { - locale = INTL_G(default_locale); + locale = intl_locale_get_default(TSRMLS_C); } +#ifdef MSG_FORMAT_QUOTE_APOS if(msgformat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) { INTL_CTOR_CHECK_STATUS(mfo, "msgfmt_create: error converting pattern to quote-friendly format"); } +#endif if ((mfo)->mf_data.orig_format) { msgformat_data_free(&mfo->mf_data TSRMLS_CC); diff --git a/ext/intl/msgformat/msgformat.h b/ext/intl/msgformat/msgformat.h old mode 100755 new mode 100644 diff --git a/ext/intl/msgformat/msgformat_attr.c b/ext/intl/msgformat/msgformat_attr.c old mode 100755 new mode 100644 index cf346651424b0..c333a24ee1d1e --- a/ext/intl/msgformat/msgformat_attr.c +++ b/ext/intl/msgformat/msgformat_attr.c @@ -82,11 +82,13 @@ PHP_FUNCTION( msgfmt_set_pattern ) intl_convert_utf8_to_utf16(&spattern, &spattern_len, value, value_len, &INTL_DATA_ERROR_CODE(mfo)); INTL_METHOD_CHECK_STATUS(mfo, "Error converting pattern to UTF-16" ); +#ifdef MSG_FORMAT_QUOTE_APOS if(msgformat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) { intl_error_set( NULL, U_INVALID_FORMAT_ERROR, "msgfmt_set_pattern: error converting pattern to quote-friendly format", 0 TSRMLS_CC ); RETURN_FALSE; } +#endif /* TODO: add parse error information */ umsg_applyPattern(MSG_FORMAT_OBJECT(mfo), spattern, spattern_len, NULL, &INTL_DATA_ERROR_CODE(mfo)); @@ -100,6 +102,12 @@ PHP_FUNCTION( msgfmt_set_pattern ) } mfo->mf_data.orig_format = estrndup(value, value_len); mfo->mf_data.orig_format_len = value_len; + /* invalidate cached format types */ + if (mfo->mf_data.arg_types) { + zend_hash_destroy(mfo->mf_data.arg_types); + efree(mfo->mf_data.arg_types); + mfo->mf_data.arg_types = NULL; + } RETURN_TRUE; } diff --git a/ext/intl/msgformat/msgformat_attr.h b/ext/intl/msgformat/msgformat_attr.h old mode 100755 new mode 100644 diff --git a/ext/intl/msgformat/msgformat_class.c b/ext/intl/msgformat/msgformat_class.c old mode 100755 new mode 100644 index d0138854eb085..8145a46f175b8 --- a/ext/intl/msgformat/msgformat_class.c +++ b/ext/intl/msgformat/msgformat_class.c @@ -60,6 +60,7 @@ zend_object_value MessageFormatter_object_create(zend_class_entry *ce TSRMLS_DC) intern = ecalloc( 1, sizeof(MessageFormatter_object) ); msgformat_data_init( &intern->mf_data TSRMLS_CC ); zend_object_std_init( &intern->zo, ce TSRMLS_CC ); + object_properties_init(&intern->zo, ce); retval.handle = zend_objects_store_put( intern, diff --git a/ext/intl/msgformat/msgformat_class.h b/ext/intl/msgformat/msgformat_class.h old mode 100755 new mode 100644 index 0afa792ae3c80..b6b8e33226eab --- a/ext/intl/msgformat/msgformat_class.h +++ b/ext/intl/msgformat/msgformat_class.h @@ -19,9 +19,11 @@ #include -#include "intl_common.h" -#include "intl_error.h" -#include "intl_data.h" +#include + +#include "../intl_common.h" +#include "../intl_error.h" +#include "../intl_data.h" #include "msgformat_data.h" typedef struct { @@ -38,4 +40,8 @@ extern zend_class_entry *MessageFormatter_ce_ptr; #define MSG_FORMAT_METHOD_FETCH_OBJECT INTL_METHOD_FETCH_OBJECT(MessageFormatter, mfo) #define MSG_FORMAT_OBJECT(mfo) (mfo)->mf_data.umsgf +#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM < 48 +# define MSG_FORMAT_QUOTE_APOS 1 +#endif + #endif // #ifndef MSG_FORMAT_CLASS_H diff --git a/ext/intl/msgformat/msgformat_data.c b/ext/intl/msgformat/msgformat_data.c old mode 100755 new mode 100644 index 95e81d3ea74fb..5d490544735fa --- a/ext/intl/msgformat/msgformat_data.c +++ b/ext/intl/msgformat/msgformat_data.c @@ -21,6 +21,8 @@ #include #include "msgformat_data.h" +#include "msgformat_class.h" + /* {{{ void msgformat_data_init( msgformat_data* mf_data ) * Initialize internals of msgformat_data. */ @@ -29,8 +31,10 @@ void msgformat_data_init( msgformat_data* mf_data TSRMLS_DC ) if( !mf_data ) return; - mf_data->umsgf = NULL; - mf_data->orig_format = NULL; + mf_data->umsgf = NULL; + mf_data->orig_format = NULL; + mf_data->arg_types = NULL; + mf_data->tz_set = 0; intl_error_reset( &mf_data->error TSRMLS_CC ); } /* }}} */ @@ -38,21 +42,27 @@ void msgformat_data_init( msgformat_data* mf_data TSRMLS_DC ) /* {{{ void msgformat_data_free( msgformat_data* mf_data ) * Clean up memory allocated for msgformat_data */ -void msgformat_data_free( msgformat_data* mf_data TSRMLS_DC ) +void msgformat_data_free(msgformat_data* mf_data TSRMLS_DC) { - if( !mf_data ) + if (!mf_data) return; - if( mf_data->umsgf ) - umsg_close( mf_data->umsgf ); + if (mf_data->umsgf) + umsg_close(mf_data->umsgf); - if(mf_data->orig_format) { + if (mf_data->orig_format) { efree(mf_data->orig_format); mf_data->orig_format = NULL; } + if (mf_data->arg_types) { + zend_hash_destroy(mf_data->arg_types); + efree(mf_data->arg_types); + mf_data->arg_types = NULL; + } + mf_data->umsgf = NULL; - intl_error_reset( &mf_data->error TSRMLS_CC ); + intl_error_reset(&mf_data->error TSRMLS_CC); } /* }}} */ @@ -69,6 +79,7 @@ msgformat_data* msgformat_data_create( TSRMLS_D ) } /* }}} */ +#ifdef MSG_FORMAT_QUOTE_APOS int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *ec) { if(*spattern && *spattern_len && u_strchr(*spattern, (UChar)'\'')) { @@ -86,6 +97,7 @@ int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *e } return SUCCESS; } +#endif /* diff --git a/ext/intl/msgformat/msgformat_data.h b/ext/intl/msgformat/msgformat_data.h old mode 100755 new mode 100644 index 44001753b35a1..51d7687a3a5e4 --- a/ext/intl/msgformat/msgformat_data.h +++ b/ext/intl/msgformat/msgformat_data.h @@ -19,9 +19,9 @@ #include -#include +#include "../intl_error.h" -#include "intl_error.h" +#include typedef struct { // error hangling @@ -31,11 +31,16 @@ typedef struct { UMessageFormat* umsgf; char* orig_format; ulong orig_format_len; + HashTable* arg_types; + int tz_set; /* if we've already the time zone in sub-formats */ } msgformat_data; msgformat_data* msgformat_data_create( TSRMLS_D ); void msgformat_data_init( msgformat_data* mf_data TSRMLS_DC ); void msgformat_data_free( msgformat_data* mf_data TSRMLS_DC ); + +#ifdef MSG_FORMAT_QUOTE_APOS int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *ec); +#endif #endif // MSG_FORMAT_DATA_H diff --git a/ext/intl/msgformat/msgformat_format.c b/ext/intl/msgformat/msgformat_format.c old mode 100755 new mode 100644 index b664c83ec1158..4b81cfe2b454c --- a/ext/intl/msgformat/msgformat_format.c +++ b/ext/intl/msgformat/msgformat_format.c @@ -32,51 +32,34 @@ #endif /* {{{ */ -static void msgfmt_do_format(MessageFormatter_object *mfo, zval *args, zval *return_value TSRMLS_DC) +static void msgfmt_do_format(MessageFormatter_object *mfo, zval *args, zval *return_value TSRMLS_DC) { - zval **fargs; int count; UChar* formatted = NULL; int formatted_len = 0; - HashPosition pos; - int i; + HashTable *args_copy; count = zend_hash_num_elements(Z_ARRVAL_P(args)); - if(count < umsg_format_arg_count(MSG_FORMAT_OBJECT(mfo))) { - /* Not enough aguments for format! */ - intl_error_set( INTL_DATA_ERROR_P(mfo), U_ILLEGAL_ARGUMENT_ERROR, - "msgfmt_format: not enough parameters", 0 TSRMLS_CC ); - RETVAL_FALSE; - return; - } - - fargs = safe_emalloc(count, sizeof(zval *), 0); - - zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(args), &pos); - for(i=0;i +#include "../intl_cppshims.h" -#include +#include #include #include +#include +#include +#include +#include + +#include + +#include "../intl_convertcpp.h" +#include "../common/common_date.h" extern "C" { #include "php_intl.h" @@ -31,8 +39,14 @@ extern "C" { #include "msgformat_format.h" #include "msgformat_helpers.h" #include "intl_convert.h" +#define USE_TIMEZONE_POINTER +#include "../timezone/timezone_class.h" } +#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48 +#define HAS_MESSAGE_PATTERN 1 +#endif + U_NAMESPACE_BEGIN /** * This class isolates our access to private internal methods of @@ -43,96 +57,578 @@ class MessageFormatAdapter { public: static const Formattable::Type* getArgTypeList(const MessageFormat& m, int32_t& count); +#ifdef HAS_MESSAGE_PATTERN + static const MessagePattern getMessagePattern(MessageFormat* m); +#endif }; + const Formattable::Type* MessageFormatAdapter::getArgTypeList(const MessageFormat& m, int32_t& count) { return m.getArgTypeList(count); } + +#ifdef HAS_MESSAGE_PATTERN +const MessagePattern +MessageFormatAdapter::getMessagePattern(MessageFormat* m) { + return m->msgPattern; +} +#endif U_NAMESPACE_END -U_CFUNC int32_t umsg_format_arg_count(UMessageFormat *fmt) +U_CFUNC int32_t umsg_format_arg_count(UMessageFormat *fmt) { int32_t fmt_count = 0; MessageFormatAdapter::getArgTypeList(*(const MessageFormat*)fmt, fmt_count); return fmt_count; } -U_CFUNC void umsg_format_helper(UMessageFormat *fmt, int arg_count, zval **args, UChar **formatted, int *formatted_len, UErrorCode *status TSRMLS_DC) +static HashTable *umsg_get_numeric_types(MessageFormatter_object *mfo, + intl_error& err TSRMLS_DC) { - int fmt_count = 0; - const Formattable::Type* argTypes = - MessageFormatAdapter::getArgTypeList(*(const MessageFormat*)fmt, fmt_count); - Formattable* fargs = new Formattable[fmt_count ? fmt_count : 1]; + HashTable *ret; + int32_t parts_count; - for(int32_t i = 0; i < fmt_count; ++i) { - UChar *stringVal = NULL; - int stringLen = 0; - int64_t tInt64 = 0; + if (U_FAILURE(err.code)) { + return NULL; + } - switch(argTypes[i]) { - case Formattable::kDate: - convert_to_long_ex(&args[i]); - fargs[i].setDate(U_MILLIS_PER_SECOND * (double)Z_LVAL_P(args[i])); - break; + if (mfo->mf_data.arg_types) { + /* already cached */ + return mfo->mf_data.arg_types; + } - case Formattable::kDouble: - convert_to_double_ex(&args[i]); - fargs[i].setDouble(Z_DVAL_P(args[i])); - break; - - case Formattable::kLong: - convert_to_long_ex(&args[i]); - fargs[i].setLong(Z_LVAL_P(args[i])); - break; + const Formattable::Type *types = MessageFormatAdapter::getArgTypeList( + *(MessageFormat*)mfo->mf_data.umsgf, parts_count); + + /* Hash table will store Formattable::Type objects directly, + * so no need for destructor */ + ALLOC_HASHTABLE(ret); + zend_hash_init(ret, parts_count, NULL, NULL, 0); + + for (int i = 0; i < parts_count; i++) { + const Formattable::Type t = types[i]; + if (zend_hash_index_update(ret, (ulong)i, (void*)&t, sizeof(t), NULL) + == FAILURE) { + intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR, + "Write to argument types hash table failed", 0 TSRMLS_CC); + break; + } + } + + if (U_FAILURE(err.code)) { + zend_hash_destroy(ret); + efree(ret); + + return NULL; + } + + mfo->mf_data.arg_types = ret; + + return ret; +} + +#ifdef HAS_MESSAGE_PATTERN +static HashTable *umsg_parse_format(MessageFormatter_object *mfo, + const MessagePattern& mp, + intl_error& err TSRMLS_DC) +{ + HashTable *ret; + int32_t parts_count; + + if (U_FAILURE(err.code)) { + return NULL; + } + + if (!((MessageFormat *)mfo->mf_data.umsgf)->usesNamedArguments()) { + return umsg_get_numeric_types(mfo, err TSRMLS_CC); + } - case Formattable::kInt64: - if(Z_TYPE_P(args[i]) == IS_DOUBLE) { - tInt64 = (int64_t)Z_DVAL_P(args[i]); - } else if(Z_TYPE_P(args[i]) == IS_LONG) { - tInt64 = (int64_t)Z_LVAL_P(args[i]); + if (mfo->mf_data.arg_types) { + /* already cached */ + return mfo->mf_data.arg_types; + } + + /* Hash table will store Formattable::Type objects directly, + * so no need for destructor */ + ALLOC_HASHTABLE(ret); + zend_hash_init(ret, 32, NULL, NULL, 0); + + parts_count = mp.countParts(); + + // See MessageFormat::cacheExplicitFormats() + /* + * Looking through the pattern, go to each arg_start part type. + * The arg-typeof that tells us the argument type (simple, complicated) + * then the next part is either the arg_name or arg number + * and then if it's simple after that there could be a part-type=arg-type + * while substring will tell us number, spellout, etc. + * If the next thing isn't an arg-type then assume string. + */ + /* The last two "parts" can at most be ARG_LIMIT and MSG_LIMIT + * which we need not examine. */ + for (int32_t i = 0; i < parts_count - 2 && U_SUCCESS(err.code); i++) { + MessagePattern::Part p = mp.getPart(i); + + if (p.getType() != UMSGPAT_PART_TYPE_ARG_START) { + continue; + } + + MessagePattern::Part name_part = mp.getPart(++i); /* Getting name, advancing i */ + Formattable::Type type, + *storedType; + + if (name_part.getType() == UMSGPAT_PART_TYPE_ARG_NAME) { + UnicodeString argName = mp.getSubstring(name_part); + if (zend_hash_find(ret, (char*)argName.getBuffer(), argName.length(), + (void**)&storedType) == FAILURE) { + /* not found already; create new entry in HT */ + Formattable::Type bogusType = Formattable::kObject; + if (zend_hash_update(ret, (char*)argName.getBuffer(), argName.length(), + (void*)&bogusType, sizeof(bogusType), (void**)&storedType) == FAILURE) { + intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR, + "Write to argument types hash table failed", 0 TSRMLS_CC); + continue; + } + } + } else if (name_part.getType() == UMSGPAT_PART_TYPE_ARG_NUMBER) { + int32_t argNumber = name_part.getValue(); + if (argNumber < 0) { + intl_errors_set(&err, U_INVALID_FORMAT_ERROR, + "Found part with negative number", 0 TSRMLS_CC); + continue; + } + if (zend_hash_index_find(ret, (ulong)argNumber, (void**)&storedType) + == FAILURE) { + /* not found already; create new entry in HT */ + Formattable::Type bogusType = Formattable::kObject; + if (zend_hash_index_update(ret, (ulong)argNumber, (void*)&bogusType, + sizeof(bogusType), (void**)&storedType) == FAILURE) { + intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR, + "Write to argument types hash table failed", 0 TSRMLS_CC); + continue; + } + } + } + + UMessagePatternArgType argType = p.getArgType(); + /* No type specified, treat it as a string */ + if (argType == UMSGPAT_ARG_TYPE_NONE) { + type = Formattable::kString; + } else { /* Some type was specified, might be simple or complicated */ + if (argType == UMSGPAT_ARG_TYPE_SIMPLE) { + /* For a SIMPLE arg, after the name part, there should be + * an ARG_TYPE part whose string value tells us what to do */ + MessagePattern::Part type_part = mp.getPart(++i); /* Getting type, advancing i */ + if (type_part.getType() == UMSGPAT_PART_TYPE_ARG_TYPE) { + UnicodeString typeString = mp.getSubstring(type_part); + /* This is all based on the rules in the docs for MessageFormat + * @see http://icu-project.org/apiref/icu4c/classMessageFormat.html */ + if (typeString == "number") { + MessagePattern::Part style_part = mp.getPart(i + 1); /* Not advancing i */ + if (style_part.getType() == UMSGPAT_PART_TYPE_ARG_STYLE) { + UnicodeString styleString = mp.getSubstring(style_part); + if (styleString == "integer") { + type = Formattable::kInt64; + } else if (styleString == "currency") { + type = Formattable::kDouble; + } else if (styleString == "percent") { + type = Formattable::kDouble; + } else { /* some style invalid/unknown to us */ + type = Formattable::kDouble; + } + } else { // if missing style, part, make it a double + type = Formattable::kDouble; + } + } else if ((typeString == "date") || (typeString == "time")) { + type = Formattable::kDate; + } else if ((typeString == "spellout") || (typeString == "ordinal") + || (typeString == "duration")) { + type = Formattable::kDouble; + } } else { - SEPARATE_ZVAL_IF_NOT_REF(&args[i]); - convert_scalar_to_number( args[i] TSRMLS_CC ); - tInt64 = (Z_TYPE_P(args[i]) == IS_DOUBLE)?(int64_t)Z_DVAL_P(args[i]):Z_LVAL_P(args[i]); + /* If there's no UMSGPAT_PART_TYPE_ARG_TYPE right after a + * UMSGPAT_ARG_TYPE_SIMPLE argument, then the pattern + * is broken. */ + intl_errors_set(&err, U_PARSE_ERROR, + "Expected UMSGPAT_PART_TYPE_ARG_TYPE part following " + "UMSGPAT_ARG_TYPE_SIMPLE part", 0 TSRMLS_CC); + continue; } - fargs[i].setInt64(tInt64); + } else if (argType == UMSGPAT_ARG_TYPE_PLURAL) { + type = Formattable::kDouble; + } else if (argType == UMSGPAT_ARG_TYPE_CHOICE) { + type = Formattable::kDouble; + } else if (argType == UMSGPAT_ARG_TYPE_SELECT) { + type = Formattable::kString; + } else { + type = Formattable::kString; + } + } /* was type specified? */ + + /* We found a different type for the same arg! */ + if (*storedType != Formattable::kObject && *storedType != type) { + intl_errors_set(&err, U_ARGUMENT_TYPE_MISMATCH, + "Inconsistent types declared for an argument", 0 TSRMLS_CC); + continue; + } + + *storedType = type; + } /* visiting each part */ + + if (U_FAILURE(err.code)) { + zend_hash_destroy(ret); + efree(ret); + + return NULL; + } + + mfo->mf_data.arg_types = ret; + + return ret; +} +#endif + +static HashTable *umsg_get_types(MessageFormatter_object *mfo, + intl_error& err TSRMLS_DC) +{ + MessageFormat *mf = (MessageFormat *)mfo->mf_data.umsgf; + +#ifdef HAS_MESSAGE_PATTERN + const MessagePattern mp = MessageFormatAdapter::getMessagePattern(mf); + + return umsg_parse_format(mfo, mp, err TSRMLS_CC); +#else + if (mf->usesNamedArguments()) { + intl_errors_set(&err, U_UNSUPPORTED_ERROR, + "This extension supports named arguments only on ICU 4.8+", + 0 TSRMLS_CC); + return NULL; + } + return umsg_get_numeric_types(mfo, err TSRMLS_CC); +#endif +} + +static void umsg_set_timezone(MessageFormatter_object *mfo, + intl_error& err TSRMLS_DC) +{ + MessageFormat *mf = (MessageFormat *)mfo->mf_data.umsgf; + TimeZone *used_tz = NULL; + const Format **formats; + int32_t count; + + /* Unfortanely, this cannot change the time zone for arguments that + * appear inside complex formats because ::getFormats() returns NULL + * for all uncached formats, which is the case for complex formats + * unless they were set via one of the ::setFormat() methods */ + + if (mfo->mf_data.tz_set) { + return; /* already done */ + } + + formats = mf->getFormats(count); + + if (formats == NULL) { + intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR, + "Out of memory retrieving subformats", 0 TSRMLS_CC); + } + + for (int i = 0; U_SUCCESS(err.code) && i < count; i++) { + DateFormat* df = dynamic_cast( + const_cast(formats[i])); + if (df == NULL) { + continue; + } + + if (used_tz == NULL) { + zval nullzv = zval_used_for_init, + *zvptr = &nullzv; + used_tz = timezone_process_timezone_argument(&zvptr, &err, + "msgfmt_format" TSRMLS_CC); + if (used_tz == NULL) { + continue; + } + } + + df->setTimeZone(*used_tz); + } + + if (U_SUCCESS(err.code)) { + mfo->mf_data.tz_set = 1; + } +} + +U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, + HashTable *args, + UChar **formatted, + int *formatted_len TSRMLS_DC) +{ + int arg_count = zend_hash_num_elements(args); + std::vector fargs; + std::vector farg_names; + MessageFormat *mf = (MessageFormat *)mfo->mf_data.umsgf; + HashTable *types; + intl_error& err = INTL_DATA_ERROR(mfo); + + if (U_FAILURE(err.code)) { + return; + } + + types = umsg_get_types(mfo, err TSRMLS_CC); + + umsg_set_timezone(mfo, err TSRMLS_CC); + + fargs.resize(arg_count); + farg_names.resize(arg_count); + + int argNum = 0; + HashPosition pos; + zval **elem; + + // Key related variables + int key_type; + char *str_index; + uint str_len; + ulong num_index; + + for (zend_hash_internal_pointer_reset_ex(args, &pos); + U_SUCCESS(err.code) && + (key_type = zend_hash_get_current_key_ex( + args, &str_index, &str_len, &num_index, 0, &pos), + zend_hash_get_current_data_ex(args, (void **)&elem, &pos) + ) == SUCCESS; + zend_hash_move_forward_ex(args, &pos), argNum++) + { + Formattable& formattable = fargs[argNum]; + UnicodeString& key = farg_names[argNum]; + Formattable::Type argType = Formattable::kObject, //unknown + *storedArgType = NULL; + + /* Process key and retrieve type */ + if (key_type == HASH_KEY_IS_LONG) { + /* includes case where index < 0 because it's exposed as unsigned */ + if (num_index > (ulong)INT32_MAX) { + intl_errors_set(&err, U_ILLEGAL_ARGUMENT_ERROR, + "Found negative or too large array key", 0 TSRMLS_CC); + continue; + } + + UChar temp[16]; + int32_t len = u_sprintf(temp, "%u", (uint32_t)num_index); + key.append(temp, len); + + zend_hash_index_find(types, (ulong)num_index, (void**)&storedArgType); + } else { //string; assumed to be in UTF-8 + intl_stringFromChar(key, str_index, str_len-1, &err.code); + + if (U_FAILURE(err.code)) { + char *message; + spprintf(&message, 0, + "Invalid UTF-8 data in argument key: '%s'", str_index); + intl_errors_set(&err, err.code, message, 1 TSRMLS_CC); + efree(message); + continue; + } + + zend_hash_find(types, (char*)key.getBuffer(), key.length(), + (void**)&storedArgType); + } + + if (storedArgType != NULL) { + argType = *storedArgType; + } + + /* Convert zval to formattable according to message format type + * or (as a fallback) the zval type */ + if (argType != Formattable::kObject) { + switch (argType) { + case Formattable::kString: + { + string_arg: + /* This implicitly converts objects + * Note that our vectors will leak if object conversion fails + * and PHP ends up with a fatal error and calls longjmp + * as a result of that. + */ + convert_to_string_ex(elem); + + UnicodeString *text = new UnicodeString(); + intl_stringFromChar(*text, + Z_STRVAL_PP(elem), Z_STRLEN_PP(elem), &err.code); + + if (U_FAILURE(err.code)) { + char *message; + spprintf(&message, 0, "Invalid UTF-8 data in string argument: " + "'%s'", Z_STRVAL_PP(elem)); + intl_errors_set(&err, err.code, message, 1 TSRMLS_CC); + efree(message); + delete text; + continue; + } + formattable.adoptString(text); + break; + } + case Formattable::kDouble: + { + double d; + if (Z_TYPE_PP(elem) == IS_DOUBLE) { + d = Z_DVAL_PP(elem); + } else if (Z_TYPE_PP(elem) == IS_LONG) { + d = (double)Z_LVAL_PP(elem); + } else { + SEPARATE_ZVAL_IF_NOT_REF(elem); + convert_scalar_to_number(*elem TSRMLS_CC); + d = (Z_TYPE_PP(elem) == IS_DOUBLE) + ? Z_DVAL_PP(elem) + : (double)Z_LVAL_PP(elem); + } + formattable.setDouble(d); + break; + } + case Formattable::kLong: + { + int32_t tInt32; +retry_klong: + if (Z_TYPE_PP(elem) == IS_DOUBLE) { + if (Z_DVAL_PP(elem) > (double)INT32_MAX || + Z_DVAL_PP(elem) < (double)INT32_MIN) { + intl_errors_set(&err, U_ILLEGAL_ARGUMENT_ERROR, + "Found PHP float with absolute value too large for " + "32 bit integer argument", 0 TSRMLS_CC); + } else { + tInt32 = (int32_t)Z_DVAL_PP(elem); + } + } else if (Z_TYPE_PP(elem) == IS_LONG) { + if (Z_LVAL_PP(elem) > INT32_MAX || + Z_LVAL_PP(elem) < INT32_MIN) { + intl_errors_set(&err, U_ILLEGAL_ARGUMENT_ERROR, + "Found PHP integer with absolute value too large " + "for 32 bit integer argument", 0 TSRMLS_CC); + } else { + tInt32 = (int32_t)Z_LVAL_PP(elem); + } + } else { + SEPARATE_ZVAL_IF_NOT_REF(elem); + convert_scalar_to_number(*elem TSRMLS_CC); + goto retry_klong; + } + formattable.setLong(tInt32); + break; + } + case Formattable::kInt64: + { + int64_t tInt64; +retry_kint64: + if (Z_TYPE_PP(elem) == IS_DOUBLE) { + if (Z_DVAL_PP(elem) > (double)U_INT64_MAX || + Z_DVAL_PP(elem) < (double)U_INT64_MIN) { + intl_errors_set(&err, U_ILLEGAL_ARGUMENT_ERROR, + "Found PHP float with absolute value too large for " + "64 bit integer argument", 0 TSRMLS_CC); + } else { + tInt64 = (int64_t)Z_DVAL_PP(elem); + } + } else if (Z_TYPE_PP(elem) == IS_LONG) { + /* assume long is not wider than 64 bits */ + tInt64 = (int64_t)Z_LVAL_PP(elem); + } else { + SEPARATE_ZVAL_IF_NOT_REF(elem); + convert_scalar_to_number(*elem TSRMLS_CC); + goto retry_kint64; + } + formattable.setInt64(tInt64); + break; + } + case Formattable::kDate: + { + double dd = intl_zval_to_millis(*elem, &err, "msgfmt_format" TSRMLS_CC); + if (U_FAILURE(err.code)) { + char *message, *key_char; + int key_len; + UErrorCode status = UErrorCode(); + if (intl_charFromString(key, &key_char, &key_len, + &status) == SUCCESS) { + spprintf(&message, 0, "The argument for key '%s' " + "cannot be used as a date or time", key_char); + intl_errors_set(&err, err.code, message, 1 TSRMLS_CC); + efree(key_char); + efree(message); + } + continue; + } + formattable.setDate(dd); + break; + } + default: + intl_errors_set(&err, U_ILLEGAL_ARGUMENT_ERROR, + "Found unsupported argument type", 0 TSRMLS_CC); + break; + } + } else { + /* We couldn't find any information about the argument in the pattern, this + * means it's an extra argument. So convert it to a number if it's a number or + * bool or null and to a string if it's anything else except arrays . */ + switch (Z_TYPE_PP(elem)) { + case IS_DOUBLE: + formattable.setDouble(Z_DVAL_PP(elem)); break; - - case Formattable::kString: - convert_to_string_ex(&args[i]); - intl_convert_utf8_to_utf16(&stringVal, &stringLen, Z_STRVAL_P(args[i]), Z_STRLEN_P(args[i]), status); - if(U_FAILURE(*status)){ - delete[] fargs; - return; + case IS_BOOL: + convert_to_long_ex(elem); + /* Intentional fallthrough */ + case IS_LONG: + formattable.setInt64((int64_t)Z_LVAL_PP(elem)); + break; + case IS_NULL: + formattable.setInt64((int64_t)0); + break; + case IS_STRING: + case IS_OBJECT: + goto string_arg; + default: + { + char *message, *key_char; + int key_len; + UErrorCode status = UErrorCode(); + if (intl_charFromString(key, &key_char, &key_len, + &status) == SUCCESS) { + spprintf(&message, 0, "No strategy to convert the " + "value given for the argument with key '%s' " + "is available", key_char); + intl_errors_set(&err, + U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); + efree(key_char); + efree(message); + } } - fargs[i].setString(stringVal); - efree(stringVal); - break; - - case Formattable::kArray: - case Formattable::kObject: - *status = U_UNSUPPORTED_ERROR; - delete[] fargs; - return; - } + } + } + } // visiting each argument + + if (U_FAILURE(err.code)) { + return; } - UnicodeString resultStr; - FieldPosition fieldPosition(0); - - /* format the message */ - ((const MessageFormat*)fmt)->format(fargs, fmt_count, resultStr, fieldPosition, *status); + UnicodeString resultStr; + FieldPosition fieldPosition(0); - delete[] fargs; + /* format the message */ + mf->format(farg_names.empty() ? NULL : &farg_names[0], + fargs.empty() ? NULL : &fargs[0], arg_count, resultStr, err.code); - if(U_FAILURE(*status)){ - return; - } + if (U_FAILURE(err.code)) { + intl_errors_set(&err, err.code, + "Call to ICU MessageFormat::format() has failed", 0 TSRMLS_CC); + return; + } *formatted_len = resultStr.length(); *formatted = eumalloc(*formatted_len+1); - resultStr.extract(*formatted, *formatted_len+1, *status); + resultStr.extract(*formatted, *formatted_len+1, err.code); + if (U_FAILURE(err.code)) { + intl_errors_set(&err, err.code, + "Error copying format() result", 0 TSRMLS_CC); + return; + } } #define cleanup_zvals() for(int j=i;j>=0;j--) { zval_ptr_dtor((*args)+i); } @@ -157,15 +653,11 @@ U_CFUNC void umsg_parse_helper(UMessageFormat *fmt, int *count, zval ***args, UC int stmp_len; ALLOC_INIT_ZVAL((*args)[i]); - + switch(fargs[i].getType()) { case Formattable::kDate: aDate = ((double)fargs[i].getDate())/U_MILLIS_PER_SECOND; - if(aDate > LONG_MAX || aDate < -LONG_MAX) { - ZVAL_DOUBLE((*args)[i], aDate<0?ceil(aDate):floor(aDate)); - } else { - ZVAL_LONG((*args)[i], (long)aDate); - } + ZVAL_DOUBLE((*args)[i], aDate); break; case Formattable::kDouble: diff --git a/ext/intl/msgformat/msgformat_helpers.h b/ext/intl/msgformat/msgformat_helpers.h old mode 100755 new mode 100644 index 30c7e3930fa01..e6eda087d2e26 --- a/ext/intl/msgformat/msgformat_helpers.h +++ b/ext/intl/msgformat/msgformat_helpers.h @@ -17,9 +17,9 @@ #ifndef MSG_FORMAT_HELPERS_H #define MSG_FORMAT_HELPERS_H -int32_t umsg_format_arg_count(UMessageFormat *fmt); -void umsg_format_helper(UMessageFormat *fmt, int arg_count, zval **args, - UChar **formatted, int *formatted_len, UErrorCode *status TSRMLS_DC); +int32_t umsg_format_arg_count(UMessageFormat *fmt); +void umsg_format_helper(MessageFormatter_object *mfo, HashTable *args, + UChar **formatted, int *formatted_len TSRMLS_DC); void umsg_parse_helper(UMessageFormat *fmt, int *count, zval ***args, UChar *source, int source_len, UErrorCode *status); #endif // MSG_FORMAT_HELPERS_H diff --git a/ext/intl/msgformat/msgformat_parse.c b/ext/intl/msgformat/msgformat_parse.c old mode 100755 new mode 100644 index 8393d4c6e3958..413d3b1f15d89 --- a/ext/intl/msgformat/msgformat_parse.c +++ b/ext/intl/msgformat/msgformat_parse.c @@ -126,14 +126,16 @@ PHP_FUNCTION( msgfmt_parse_message ) } if(slocale_len == 0) { - slocale = INTL_G(default_locale); + slocale = intl_locale_get_default(TSRMLS_C); } +#ifdef MSG_FORMAT_QUOTE_APOS if(msgformat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) { intl_error_set( NULL, U_INVALID_FORMAT_ERROR, "msgfmt_parse_message: error converting pattern to quote-friendly format", 0 TSRMLS_CC ); RETURN_FALSE; } +#endif /* Create an ICU message formatter. */ MSG_FORMAT_OBJECT(mfo) = umsg_open(spattern, spattern_len, slocale, NULL, &INTL_DATA_ERROR_CODE(mfo)); diff --git a/ext/intl/msgformat/msgformat_parse.h b/ext/intl/msgformat/msgformat_parse.h old mode 100755 new mode 100644 diff --git a/ext/intl/normalizer/normalizer.c b/ext/intl/normalizer/normalizer.c old mode 100755 new mode 100644 diff --git a/ext/intl/normalizer/normalizer.h b/ext/intl/normalizer/normalizer.h old mode 100755 new mode 100644 diff --git a/ext/intl/normalizer/normalizer_class.c b/ext/intl/normalizer/normalizer_class.c old mode 100755 new mode 100644 diff --git a/ext/intl/normalizer/normalizer_class.h b/ext/intl/normalizer/normalizer_class.h old mode 100755 new mode 100644 diff --git a/ext/intl/normalizer/normalizer_normalize.c b/ext/intl/normalizer/normalizer_normalize.c old mode 100755 new mode 100644 index 466ab97e12c86..f46285e9d9174 --- a/ext/intl/normalizer/normalizer_normalize.c +++ b/ext/intl/normalizer/normalizer_normalize.c @@ -110,7 +110,7 @@ PHP_FUNCTION( normalizer_normalize ) /* normalize */ size_needed = unorm_normalize( uinput, uinput_len, form, (int32_t) 0 /* options */, uret_buf, uret_len, &status); - /* Bail out if an unexpected error occured. + /* Bail out if an unexpected error occurred. * (U_BUFFER_OVERFLOW_ERROR means that *target buffer is not large enough). * (U_STRING_NOT_TERMINATED_WARNING usually means that the input string is empty). */ @@ -133,7 +133,7 @@ PHP_FUNCTION( normalizer_normalize ) /* try normalize again */ size_needed = unorm_normalize( uinput, uinput_len, form, (int32_t) 0 /* options */, uret_buf, uret_len, &status); - /* Bail out if an unexpected error occured. */ + /* Bail out if an unexpected error occurred. */ if( U_FAILURE(status) ) { /* Set error messages. */ intl_error_set_custom_msg( NULL,"Error normalizing string", 0 TSRMLS_CC ); @@ -234,7 +234,7 @@ PHP_FUNCTION( normalizer_is_normalized ) efree( uinput ); - /* Bail out if an unexpected error occured. */ + /* Bail out if an unexpected error occurred. */ if( U_FAILURE(status) ) { /* Set error messages. */ intl_error_set_custom_msg( NULL,"Error testing if string is the given normalization form.", 0 TSRMLS_CC ); diff --git a/ext/intl/normalizer/normalizer_normalize.h b/ext/intl/normalizer/normalizer_normalize.h old mode 100755 new mode 100644 diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c old mode 100755 new mode 100644 index f160f9dda204a..78da0f5e32b0c --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -41,6 +41,8 @@ #include "formatter/formatter_main.h" #include "formatter/formatter_parse.h" +#include "grapheme/grapheme.h" + #include "msgformat/msgformat.h" #include "msgformat/msgformat_class.h" #include "msgformat/msgformat_attr.h" @@ -58,7 +60,9 @@ #include "dateformat/dateformat.h" #include "dateformat/dateformat_class.h" #include "dateformat/dateformat_attr.h" +#include "dateformat/dateformat_attrcpp.h" #include "dateformat/dateformat_format.h" +#include "dateformat/dateformat_format_object.h" #include "dateformat/dateformat_parse.h" #include "dateformat/dateformat_data.h" @@ -75,6 +79,9 @@ #include "calendar/calendar_methods.h" #include "calendar/gregoriancalendar_methods.h" +#include "breakiterator/breakiterator_class.h" +#include "breakiterator/breakiterator_iterators.h" + #include "idn/idn.h" #if U_ICU_VERSION_MAJOR_NUM > 3 && U_ICU_VERSION_MINOR_NUM >=2 @@ -89,6 +96,7 @@ #include "common/common_enum.h" #include +#include #include #include "php_ini.h" @@ -106,6 +114,14 @@ ZEND_DECLARE_MODULE_GLOBALS( intl ) +const char *intl_locale_get_default( TSRMLS_D ) +{ + if( INTL_G(default_locale) == NULL ) { + return uloc_getDefault(); + } + return INTL_G(default_locale); +} + /* {{{ Arguments info */ ZEND_BEGIN_ARG_INFO_EX(collator_static_0_args, 0, 0, 0) ZEND_END_ARG_INFO() @@ -321,6 +337,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_pattern, 0, 0, 2) ZEND_ARG_INFO(0, pattern) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_timezone, 0, 0, 2) + ZEND_ARG_INFO(0, mf) + ZEND_ARG_INFO(0, timezone) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_calendar, 0, 0, 2) ZEND_ARG_INFO(0, mf) ZEND_ARG_INFO(0, calendar) @@ -331,6 +352,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_format, 0, 0, 0) ZEND_ARG_INFO(0, array) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_format_object, 0, 0, 1) + ZEND_ARG_INFO(0, object) + ZEND_ARG_INFO(0, format) + ZEND_ARG_INFO(0, locale) +ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_create, 0, 0, 3) ZEND_ARG_INFO(0, locale) ZEND_ARG_INFO(0, date_type) @@ -414,6 +442,10 @@ ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_idarg_static, 0, 0, 1 ) ZEND_ARG_INFO( 0, zoneId ) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_from_date_time_zone, 0, 0, 1 ) + ZEND_ARG_OBJ_INFO( 0, dateTimeZone, IntlDateTimeZone, 0 ) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_create_enumeration, 0, 0, 0 ) ZEND_ARG_INFO( 0, countryOrRawOffset ) ZEND_END_ARG_INFO() @@ -516,7 +548,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_set_time_zone, 0, 0, 2 ) ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 ) - ZEND_ARG_OBJ_INFO( 0, timeZone, IntlTimeZone, 1 ) + ZEND_ARG_INFO( 0, timeZone ) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_set, 0, 0, 3 ) @@ -556,6 +588,10 @@ ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_set_lenient, 0, 0, 2 ) ZEND_ARG_INFO( 0, isLenient ) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_from_date_time, 0, 0, 1) + ZEND_ARG_INFO(0, dateTime) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_wall_time_option, 0, 0, 2 ) ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 ) ZEND_ARG_INFO( 0, wallTimeOption ) @@ -667,15 +703,19 @@ zend_function_entry intl_functions[] = { PHP_FE( datefmt_get_datetype, arginfo_msgfmt_get_locale ) PHP_FE( datefmt_get_timetype, arginfo_msgfmt_get_locale ) PHP_FE( datefmt_get_calendar, arginfo_msgfmt_get_locale ) + PHP_FE( datefmt_get_calendar_object, arginfo_msgfmt_get_locale ) PHP_FE( datefmt_set_calendar, arginfo_datefmt_set_calendar ) PHP_FE( datefmt_get_locale, arginfo_msgfmt_get_locale ) PHP_FE( datefmt_get_timezone_id, arginfo_msgfmt_get_locale ) - PHP_FE( datefmt_set_timezone_id, arginfo_msgfmt_get_locale ) + PHP_FE( datefmt_set_timezone_id, arginfo_datefmt_set_timezone ) + PHP_FE( datefmt_get_timezone, arginfo_msgfmt_get_locale ) + PHP_FE( datefmt_set_timezone, arginfo_datefmt_set_timezone ) PHP_FE( datefmt_get_pattern, arginfo_msgfmt_get_locale ) PHP_FE( datefmt_set_pattern, arginfo_datefmt_set_pattern ) PHP_FE( datefmt_is_lenient, arginfo_msgfmt_get_locale ) PHP_FE( datefmt_set_lenient, arginfo_msgfmt_get_locale ) PHP_FE( datefmt_format, arginfo_datefmt_format ) + PHP_FE( datefmt_format_object, arginfo_datefmt_format_object ) PHP_FE( datefmt_parse, datefmt_parse_args ) PHP_FE( datefmt_localtime , datefmt_parse_args ) PHP_FE( datefmt_get_error_code, arginfo_msgfmt_get_error_code ) @@ -715,6 +755,7 @@ zend_function_entry intl_functions[] = { /* TimeZone functions */ PHP_FE( intltz_create_time_zone, arginfo_tz_idarg_static ) + PHP_FE( intltz_from_date_time_zone, arginfo_tz_from_date_time_zone ) PHP_FE( intltz_create_default, arginfo_tz_void ) PHP_FE( intltz_get_id, arginfo_tz_only_tz ) PHP_FE( intltz_get_gmt, arginfo_tz_void ) @@ -738,6 +779,7 @@ zend_function_entry intl_functions[] = { PHP_FE( intltz_has_same_rules, arginfo_tz_has_same_rules ) PHP_FE( intltz_get_display_name, arginfo_tz_get_display_name ) PHP_FE( intltz_get_dst_savings, arginfo_tz_only_tz ) + PHP_FE( intltz_to_date_time_zone, arginfo_tz_only_tz ) PHP_FE( intltz_get_error_code, arginfo_tz_only_tz ) PHP_FE( intltz_get_error_message, arginfo_tz_only_tz ) @@ -785,6 +827,8 @@ zend_function_entry intl_functions[] = { PHP_FE( intlcal_set_first_day_of_week, ainfo_cal_dow ) PHP_FE( intlcal_set_lenient, ainfo_cal_set_lenient ) PHP_FE( intlcal_equals, ainfo_cal_other_cal ) + PHP_FE( intlcal_from_date_time, ainfo_cal_from_date_time ) + PHP_FE( intlcal_to_date_time, ainfo_cal_only_cal ) #if U_ICU_VERSION_MAJOR_NUM >= 49 PHP_FE( intlcal_get_repeated_wall_time_option, ainfo_cal_only_cal ) PHP_FE( intlcal_get_skipped_wall_time_option, ainfo_cal_only_cal ) @@ -809,7 +853,6 @@ zend_function_entry intl_functions[] = { }; /* }}} */ - /* {{{ INI Settings */ PHP_INI_BEGIN() STD_PHP_INI_ENTRY(LOCALE_INI_NAME, NULL, PHP_INI_ALL, OnUpdateStringUnempty, default_locale, zend_intl_globals, intl_globals) @@ -818,7 +861,6 @@ PHP_INI_BEGIN() PHP_INI_END() /* }}} */ - static PHP_GINIT_FUNCTION(intl); /* {{{ intl_module_entry */ @@ -935,25 +977,34 @@ PHP_MINIT_FUNCTION( intl ) /* Register 'IntlIterator' PHP class */ intl_register_IntlIterator_class( TSRMLS_C ); + /* Register 'BreakIterator' class */ + breakiterator_register_BreakIterator_class( TSRMLS_C ); + + /* Register 'IntlPartsIterator' class */ + breakiterator_register_IntlPartsIterator_class( TSRMLS_C ); + /* Global error handling. */ intl_error_init( NULL TSRMLS_CC ); - /* Set the default_locale value */ - if( INTL_G(default_locale) == NULL ) { - INTL_G(default_locale) = pestrdup(uloc_getDefault(), 1) ; - } - return SUCCESS; } /* }}} */ +#define EXPLICIT_CLEANUP_ENV_VAR "INTL_EXPLICIT_CLEANUP" + /* {{{ PHP_MSHUTDOWN_FUNCTION */ PHP_MSHUTDOWN_FUNCTION( intl ) { + const char *cleanup; /* For the default locale php.ini setting */ UNREGISTER_INI_ENTRIES(); + cleanup = getenv(EXPLICIT_CLEANUP_ENV_VAR); + if (cleanup != NULL && !(cleanup[0] == '0' && cleanup[1] == '\0')) { + u_cleanup(); + } + return SUCCESS; } /* }}} */ @@ -962,10 +1013,6 @@ PHP_MSHUTDOWN_FUNCTION( intl ) */ PHP_RINIT_FUNCTION( intl ) { - /* Set the default_locale value */ - if( INTL_G(default_locale) == NULL ) { - INTL_G(default_locale) = pestrdup(uloc_getDefault(), 1) ; - } return SUCCESS; } /* }}} */ diff --git a/ext/intl/php_intl.h b/ext/intl/php_intl.h old mode 100755 new mode 100644 index 38f61ad8ac4d0..7a7112317de1d --- a/ext/intl/php_intl.h +++ b/ext/intl/php_intl.h @@ -22,8 +22,13 @@ #include +/* Even if we're included from C++, don't introduce C++ definitions + * because we were included with extern "C". The effect would be that + * when the headers defined any method, they would do so with C linkage */ +#undef U_SHOW_CPLUSPLUS_API +#define U_SHOW_CPLUSPLUS_API 0 #include "collator/collator_sort.h" -#include "grapheme/grapheme.h" +#include #include "intl_error.h" extern zend_module_entry intl_module_entry; @@ -64,6 +69,8 @@ PHP_RINIT_FUNCTION(intl); PHP_RSHUTDOWN_FUNCTION(intl); PHP_MINFO_FUNCTION(intl); +const char *intl_locale_get_default( TSRMLS_D ); + #define PHP_INTL_VERSION "1.1.0" #endif /* PHP_INTL_H */ diff --git a/ext/intl/resourcebundle/TODO b/ext/intl/resourcebundle/TODO old mode 100755 new mode 100644 diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c index 5471e5b3f6a41..1e2b1eaed6d31 100644 --- a/ext/intl/resourcebundle/resourcebundle_class.c +++ b/ext/intl/resourcebundle/resourcebundle_class.c @@ -63,6 +63,7 @@ static zend_object_value ResourceBundle_object_create( zend_class_entry *ce TSRM rb = ecalloc( 1, sizeof(ResourceBundle_object) ); zend_object_std_init( (zend_object *) rb, ce TSRMLS_CC ); + object_properties_init((zend_object *) rb, ce); intl_error_init( INTL_DATA_ERROR_P(rb) TSRMLS_CC ); rb->me = NULL; @@ -78,20 +79,18 @@ static zend_object_value ResourceBundle_object_create( zend_class_entry *ce TSRM /* {{{ ResourceBundle_ctor */ static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS) { - char * bundlename; - int bundlename_len = 0; - char * locale; - int locale_len = 0; - zend_bool fallback = 1; - - char * pbuf; + const char *bundlename; + int bundlename_len = 0; + const char *locale; + int locale_len = 0; + zend_bool fallback = 1; zval *object = return_value; ResourceBundle_object *rb = (ResourceBundle_object *) zend_object_store_get_object( object TSRMLS_CC); intl_error_reset( NULL TSRMLS_CC ); - if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "ss|b", + if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s!s!|b", &locale, &locale_len, &bundlename, &bundlename_len, &fallback ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -101,6 +100,10 @@ static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS) } INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value); + + if (locale == NULL) { + locale = intl_locale_get_default(TSRMLS_C); + } if (fallback) { rb->me = ures_open(bundlename, locale, &INTL_DATA_ERROR_CODE(rb)); @@ -110,13 +113,18 @@ static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS) INTL_CTOR_CHECK_STATUS(rb, "resourcebundle_ctor: Cannot load libICU resource bundle"); - if (!fallback && (INTL_DATA_ERROR_CODE(rb) == U_USING_FALLBACK_WARNING || INTL_DATA_ERROR_CODE(rb) == U_USING_DEFAULT_WARNING)) { - intl_errors_set_code( NULL, INTL_DATA_ERROR_CODE(rb) TSRMLS_CC ); - spprintf( &pbuf, 0, "resourcebundle_ctor: Cannot load libICU resource '%s' without fallback from %s to %s", - bundlename, locale, ures_getLocaleByType( rb->me, ULOC_ACTUAL_LOCALE, &INTL_DATA_ERROR_CODE(rb)) ); - intl_errors_set_custom_msg( INTL_DATA_ERROR_P(rb), pbuf, 1 TSRMLS_CC ); + if (!fallback && (INTL_DATA_ERROR_CODE(rb) == U_USING_FALLBACK_WARNING || + INTL_DATA_ERROR_CODE(rb) == U_USING_DEFAULT_WARNING)) { + char *pbuf; + intl_errors_set_code(NULL, INTL_DATA_ERROR_CODE(rb) TSRMLS_CC); + spprintf(&pbuf, 0, "resourcebundle_ctor: Cannot load libICU resource " + "'%s' without fallback from %s to %s", + bundlename ? bundlename : "(default data)", locale, + ures_getLocaleByType( + rb->me, ULOC_ACTUAL_LOCALE, &INTL_DATA_ERROR_CODE(rb))); + intl_errors_set_custom_msg(INTL_DATA_ERROR_P(rb), pbuf, 1 TSRMLS_CC); efree(pbuf); - zval_dtor( return_value ); + zval_dtor(return_value); RETURN_NULL(); } } @@ -427,6 +435,8 @@ void resourcebundle_register_class( TSRMLS_D ) ResourceBundle_object_handlers.clone_obj = NULL; /* ICU ResourceBundle has no clone implementation */ ResourceBundle_object_handlers.read_dimension = resourcebundle_array_get; ResourceBundle_object_handlers.count_elements = resourcebundle_array_count; + + zend_class_implements(ResourceBundle_ce_ptr TSRMLS_CC, 1, zend_ce_traversable); } /* }}} */ diff --git a/ext/intl/spoofchecker/spoofchecker.c b/ext/intl/spoofchecker/spoofchecker.c old mode 100755 new mode 100644 diff --git a/ext/intl/spoofchecker/spoofchecker.h b/ext/intl/spoofchecker/spoofchecker.h old mode 100755 new mode 100644 diff --git a/ext/intl/spoofchecker/spoofchecker_class.c b/ext/intl/spoofchecker/spoofchecker_class.c old mode 100755 new mode 100644 index 6c19fbb0f65e5..507a2ca98e5b3 --- a/ext/intl/spoofchecker/spoofchecker_class.c +++ b/ext/intl/spoofchecker/spoofchecker_class.c @@ -61,6 +61,7 @@ zend_object_value Spoofchecker_object_create( intern = ecalloc(1, sizeof(Spoofchecker_object)); intl_error_init(SPOOFCHECKER_ERROR_P(intern) TSRMLS_CC); zend_object_std_init(&intern->zo, ce TSRMLS_CC); + object_properties_init(&intern->zo, ce); retval.handle = zend_objects_store_put( intern, diff --git a/ext/intl/spoofchecker/spoofchecker_class.h b/ext/intl/spoofchecker/spoofchecker_class.h old mode 100755 new mode 100644 diff --git a/ext/intl/spoofchecker/spoofchecker_create.c b/ext/intl/spoofchecker/spoofchecker_create.c old mode 100755 new mode 100644 diff --git a/ext/intl/spoofchecker/spoofchecker_create.h b/ext/intl/spoofchecker/spoofchecker_create.h old mode 100755 new mode 100644 diff --git a/ext/intl/spoofchecker/spoofchecker_main.c b/ext/intl/spoofchecker/spoofchecker_main.c old mode 100755 new mode 100644 diff --git a/ext/intl/spoofchecker/spoofchecker_main.h b/ext/intl/spoofchecker/spoofchecker_main.h old mode 100755 new mode 100644 diff --git a/ext/intl/tests/_files/es-bundle.txt b/ext/intl/tests/_files/es-bundle.txt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/_files/res_index.txt b/ext/intl/tests/_files/res_index.txt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/_files/resourcebundle.txt b/ext/intl/tests/_files/resourcebundle.txt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/_files/resourcebundle/es.res b/ext/intl/tests/_files/resourcebundle/es.res old mode 100755 new mode 100644 diff --git a/ext/intl/tests/_files/resourcebundle/res_index.res b/ext/intl/tests/_files/resourcebundle/res_index.res old mode 100755 new mode 100644 diff --git a/ext/intl/tests/_files/resourcebundle/root.res b/ext/intl/tests/_files/resourcebundle/root.res old mode 100755 new mode 100644 diff --git a/ext/intl/tests/badargs.phpt b/ext/intl/tests/badargs.phpt old mode 100755 new mode 100644 index 9232bbf0c187a..b8f48b371eb3a --- a/ext/intl/tests/badargs.phpt +++ b/ext/intl/tests/badargs.phpt @@ -13,7 +13,10 @@ foreach($funcs as $func) { if($rfunc->getNumberOfRequiredParameters() == 0) { continue; } - $res = $func($arg); + + try { + $res = $func($arg); + } catch (Exception $e) { continue; } if($res != false) { echo "$func: "; var_dump($res); diff --git a/ext/intl/tests/breakiter___construct.phpt b/ext/intl/tests/breakiter___construct.phpt new file mode 100644 index 0000000000000..9ea6a9cf11838 --- /dev/null +++ b/ext/intl/tests/breakiter___construct.phpt @@ -0,0 +1,13 @@ +--TEST-- +IntlBreakIterator::__construct() should not be callable +--SKIPIF-- +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- + += 4.8 only'; ?> +--FILE-- +setText('foobar'); +$bi_clone = clone $bi; +var_dump(get_class($bi), get_class($bi_clone)); +var_dump($bi == $bi_clone); + +--EXPECT-- +string(26) "IntlRuleBasedBreakIterator" +string(26) "IntlRuleBasedBreakIterator" +bool(true) +string(26) "IntlRuleBasedBreakIterator" +string(26) "IntlRuleBasedBreakIterator" +bool(true) diff --git a/ext/intl/tests/breakiter_createCodePointInstance_basic.phpt b/ext/intl/tests/breakiter_createCodePointInstance_basic.phpt new file mode 100644 index 0000000000000..a43e82760ccd7 --- /dev/null +++ b/ext/intl/tests/breakiter_createCodePointInstance_basic.phpt @@ -0,0 +1,43 @@ +--TEST-- +IntlBreakIterator::createCodePointInstance(): basic test +--SKIPIF-- +setText($text); + +print_r(iterator_to_array($codepoint_it)); + +?> +==DONE== +--EXPECT-- +string(26) "IntlCodePointBreakIterator" +Array +( + [0] => 0 + [1] => 3 + [2] => 6 + [3] => 9 + [4] => 12 + [5] => 15 + [6] => 18 + [7] => 21 + [8] => 24 + [9] => 27 + [10] => 30 + [11] => 33 + [12] => 36 + [13] => 39 + [14] => 42 + [15] => 45 +) +==DONE== diff --git a/ext/intl/tests/breakiter_createCodePointInstance_error.phpt b/ext/intl/tests/breakiter_createCodePointInstance_error.phpt new file mode 100644 index 0000000000000..90228e128f6db --- /dev/null +++ b/ext/intl/tests/breakiter_createCodePointInstance_error.phpt @@ -0,0 +1,18 @@ +--TEST-- +IntlBreakIterator::createCodePointInstance(): bad arguments +--SKIPIF-- +current()); +$bi->setText('foo bar trans zoo bee'); + +var_dump($bi->first()); +var_dump($bi->current()); +var_dump($bi->next()); +var_dump($bi->current()); +?> +==DONE== +--EXPECT-- +int(0) +int(0) +int(0) +int(3) +int(3) +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/breakiter_factories_basic.phpt b/ext/intl/tests/breakiter_factories_basic.phpt new file mode 100644 index 0000000000000..333023a25383e --- /dev/null +++ b/ext/intl/tests/breakiter_factories_basic.phpt @@ -0,0 +1,45 @@ +--TEST-- +IntlBreakIterator factories: basic tests +--SKIPIF-- +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- +setText('foo bar trans'); + +var_dump($bi->current()); +var_dump($bi->next()); +var_dump($bi->first()); +var_dump($bi->current()); +--EXPECT-- +int(0) +int(3) +int(0) +int(0) diff --git a/ext/intl/tests/breakiter_first_last_previous_current_error.phpt b/ext/intl/tests/breakiter_first_last_previous_current_error.phpt new file mode 100644 index 0000000000000..9865cdec58fa3 --- /dev/null +++ b/ext/intl/tests/breakiter_first_last_previous_current_error.phpt @@ -0,0 +1,35 @@ +--TEST-- +IntlBreakIterator::first()/last()/previous()/current(): arg errors +--FILE-- +setText("\x80sdfé\x90d888 dfsa9"); + +var_dump($bi->first(1)); +var_dump($bi->last(1)); +var_dump($bi->previous(1)); +var_dump($bi->current(1)); + +--EXPECTF-- + +Warning: IntlBreakIterator::first() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: IntlBreakIterator::first(): breakiter_first: bad arguments in %s on line %d +bool(false) + +Warning: IntlBreakIterator::last() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: IntlBreakIterator::last(): breakiter_last: bad arguments in %s on line %d +bool(false) + +Warning: IntlBreakIterator::previous() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: IntlBreakIterator::previous(): breakiter_previous: bad arguments in %s on line %d +bool(false) + +Warning: IntlBreakIterator::current() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: IntlBreakIterator::current(): breakiter_current: bad arguments in %s on line %d +bool(false) diff --git a/ext/intl/tests/breakiter_following_basic.phpt b/ext/intl/tests/breakiter_following_basic.phpt new file mode 100644 index 0000000000000..967ccafb62103 --- /dev/null +++ b/ext/intl/tests/breakiter_following_basic.phpt @@ -0,0 +1,20 @@ +--TEST-- +IntlBreakIterator::following(): basic test +--FILE-- +setText('foo bar trans zoo bee'); + +var_dump($bi->following(5)); +var_dump($bi->following(50)); +var_dump($bi->following(-1)); +?> +==DONE== +--EXPECT-- +int(7) +int(-1) +int(0) +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt b/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt new file mode 100644 index 0000000000000..a4b60857aba03 --- /dev/null +++ b/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt @@ -0,0 +1,47 @@ +--TEST-- +IntlBreakIterator::following()/preceding()/isBoundary(): arg errors +--FILE-- +setText("\x80sdfé\x90d888 dfsa9"); + +var_dump($bi->following(1, 2)); +var_dump($bi->following(array())); +var_dump($bi->preceding(1, 2)); +var_dump($bi->preceding(array())); +var_dump($bi->isBoundary(1, 2)); +var_dump($bi->isBoundary(array())); + +--EXPECTF-- + +Warning: IntlBreakIterator::following() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: IntlBreakIterator::following(): breakiter_following: bad arguments in %s on line %d +bool(false) + +Warning: IntlBreakIterator::following() expects parameter 1 to be long, array given in %s on line %d + +Warning: IntlBreakIterator::following(): breakiter_following: bad arguments in %s on line %d +bool(false) + +Warning: IntlBreakIterator::preceding() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: IntlBreakIterator::preceding(): breakiter_preceding: bad arguments in %s on line %d +bool(false) + +Warning: IntlBreakIterator::preceding() expects parameter 1 to be long, array given in %s on line %d + +Warning: IntlBreakIterator::preceding(): breakiter_preceding: bad arguments in %s on line %d +bool(false) + +Warning: IntlBreakIterator::isBoundary() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: IntlBreakIterator::isBoundary(): breakiter_is_boundary: bad arguments in %s on line %d +bool(false) + +Warning: IntlBreakIterator::isBoundary() expects parameter 1 to be long, array given in %s on line %d + +Warning: IntlBreakIterator::isBoundary(): breakiter_is_boundary: bad arguments in %s on line %d +bool(false) diff --git a/ext/intl/tests/breakiter_getLocale_basic.phpt b/ext/intl/tests/breakiter_getLocale_basic.phpt new file mode 100644 index 0000000000000..499316c16925c --- /dev/null +++ b/ext/intl/tests/breakiter_getLocale_basic.phpt @@ -0,0 +1,17 @@ +--TEST-- +IntlBreakIterator::getLocale(): basic test +--FILE-- +getLocale(0)); +var_dump($bi->getLocale(1)); +?> +==DONE== +--EXPECT-- +string(4) "root" +string(4) "root" +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/breakiter_getLocale_error.phpt b/ext/intl/tests/breakiter_getLocale_error.phpt new file mode 100644 index 0000000000000..1dec56db080dc --- /dev/null +++ b/ext/intl/tests/breakiter_getLocale_error.phpt @@ -0,0 +1,29 @@ +--TEST-- +IntlBreakIterator::getLocale(): arg errors +--FILE-- +setText("\x80sdfé\x90d888 dfsa9"); + +var_dump($bi->getLocale(1, 2)); +var_dump($bi->getLocale(array())); +var_dump($bi->getLocale()); + +--EXPECTF-- + +Warning: IntlBreakIterator::getLocale() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: IntlBreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d +bool(false) + +Warning: IntlBreakIterator::getLocale() expects parameter 1 to be long, array given in %s on line %d + +Warning: IntlBreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d +bool(false) + +Warning: IntlBreakIterator::getLocale() expects exactly 1 parameter, 0 given in %s on line %d + +Warning: IntlBreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d +bool(false) diff --git a/ext/intl/tests/breakiter_getPartsIterator_basic.phpt b/ext/intl/tests/breakiter_getPartsIterator_basic.phpt new file mode 100644 index 0000000000000..794bab301482d --- /dev/null +++ b/ext/intl/tests/breakiter_getPartsIterator_basic.phpt @@ -0,0 +1,33 @@ +--TEST-- +IntlBreakIterator::getPartsIterator(): basic test +--FILE-- +getPartsIterator(); +var_dump(get_class($pi)); +print_r(iterator_to_array($pi)); + +$bi->setText("foo bar"); +$pi = $bi->getPartsIterator(); +var_dump(get_class($pi->getBreakIterator())); +print_r(iterator_to_array($pi)); +var_dump($pi->getRuleStatus()); +?> +==DONE== +--EXPECT-- +string(17) "IntlPartsIterator" +Array +( +) +string(26) "IntlRuleBasedBreakIterator" +Array +( + [0] => foo + [1] => + [2] => bar +) +int(0) +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/breakiter_getPartsIterator_error.phpt b/ext/intl/tests/breakiter_getPartsIterator_error.phpt new file mode 100644 index 0000000000000..973761803388f --- /dev/null +++ b/ext/intl/tests/breakiter_getPartsIterator_error.phpt @@ -0,0 +1,33 @@ +--TEST-- +IntlBreakIterator::getPartsIterator(): bad args +--SKIPIF-- +getPartsIterator(array())); +var_dump($it->getPartsIterator(1, 2)); +var_dump($it->getPartsIterator(-1)); + +?> +==DONE== +--EXPECTF-- + +Warning: IntlBreakIterator::getPartsIterator() expects parameter 1 to be long, array given in %s on line %d + +Warning: IntlBreakIterator::getPartsIterator(): breakiter_get_parts_iterator: bad arguments in %s on line %d +bool(false) + +Warning: IntlBreakIterator::getPartsIterator() expects at most 1 parameter, 2 given in %s on line %d + +Warning: IntlBreakIterator::getPartsIterator(): breakiter_get_parts_iterator: bad arguments in %s on line %d +bool(false) + +Warning: IntlBreakIterator::getPartsIterator(): breakiter_get_parts_iterator: bad key type in %s on line %d +bool(false) +==DONE== diff --git a/ext/intl/tests/breakiter_getPartsIterator_var1.phpt b/ext/intl/tests/breakiter_getPartsIterator_var1.phpt new file mode 100644 index 0000000000000..7bbd27ea45112 --- /dev/null +++ b/ext/intl/tests/breakiter_getPartsIterator_var1.phpt @@ -0,0 +1,60 @@ +--TEST-- +IntlBreakIterator::getPartsIterator(): argument variations +--SKIPIF-- +setText($text); + +var_dump(iterator_to_array($it->getPartsIterator(IntlPartsIterator::KEY_SEQUENTIAL))); +var_dump(iterator_to_array($it->getPartsIterator(IntlPartsIterator::KEY_LEFT))); +var_dump(iterator_to_array($it->getPartsIterator(IntlPartsIterator::KEY_RIGHT))); + +?> +==DONE== +--EXPECT-- +array(5) { + [0]=> + string(3) "foo" + [1]=> + string(1) " " + [2]=> + string(3) "bar" + [3]=> + string(1) " " + [4]=> + string(3) "tao" +} +array(5) { + [0]=> + string(3) "foo" + [4]=> + string(1) " " + [5]=> + string(3) "bar" + [8]=> + string(1) " " + [9]=> + string(3) "tao" +} +array(5) { + [3]=> + string(3) "foo" + [5]=> + string(1) " " + [8]=> + string(3) "bar" + [9]=> + string(1) " " + [12]=> + string(3) "tao" +} +==DONE== diff --git a/ext/intl/tests/breakiter_getText_basic.phpt b/ext/intl/tests/breakiter_getText_basic.phpt new file mode 100644 index 0000000000000..57f3e32aa3830 --- /dev/null +++ b/ext/intl/tests/breakiter_getText_basic.phpt @@ -0,0 +1,16 @@ +--TEST-- +IntlBreakIterator::getText(): basic test +--SKIPIF-- +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- +getText()); +$bi->setText('foo bar'); +var_dump($bi->getText()); +--EXPECTF-- +NULL +string(7) "foo bar" diff --git a/ext/intl/tests/breakiter_getText_error.phpt b/ext/intl/tests/breakiter_getText_error.phpt new file mode 100644 index 0000000000000..f222002374b3b --- /dev/null +++ b/ext/intl/tests/breakiter_getText_error.phpt @@ -0,0 +1,15 @@ +--TEST-- +IntlBreakIterator::getText(): arg errors +--FILE-- +getText(array())); + +--EXPECTF-- + +Warning: IntlBreakIterator::getText() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: IntlBreakIterator::getText(): breakiter_get_text: bad arguments in %s on line %d +bool(false) diff --git a/ext/intl/tests/breakiter_isBoundary_basic.phpt b/ext/intl/tests/breakiter_isBoundary_basic.phpt new file mode 100644 index 0000000000000..87d8227352090 --- /dev/null +++ b/ext/intl/tests/breakiter_isBoundary_basic.phpt @@ -0,0 +1,24 @@ +--TEST-- +IntlBreakIterator::isBoundary(): basic test +--FILE-- +setText('foo bar trans zoo bee'); + +var_dump($bi->isBoundary(0)); +var_dump($bi->isBoundary(7)); +var_dump($bi->isBoundary(-1)); +var_dump($bi->isBoundary(1)); +var_dump($bi->isBoundary(50)); +?> +==DONE== +--EXPECT-- +bool(true) +bool(true) +bool(false) +bool(false) +bool(false) +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/breakiter_last_basic.phpt b/ext/intl/tests/breakiter_last_basic.phpt new file mode 100644 index 0000000000000..0d3aead232f85 --- /dev/null +++ b/ext/intl/tests/breakiter_last_basic.phpt @@ -0,0 +1,19 @@ +--TEST-- +IntlBreakIterator::last(): basic test +--SKIPIF-- +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- +setText('foo bar trans'); + +var_dump($bi->current()); +var_dump($bi->last()); +var_dump($bi->current()); +--EXPECTF-- +int(0) +int(13) +int(13) diff --git a/ext/intl/tests/breakiter_next_basic.phpt b/ext/intl/tests/breakiter_next_basic.phpt new file mode 100644 index 0000000000000..3d535443b8a28 --- /dev/null +++ b/ext/intl/tests/breakiter_next_basic.phpt @@ -0,0 +1,26 @@ +--TEST-- +IntlBreakIterator::next(): basic test +--FILE-- +setText('foo bar trans zoo bee'); + +var_dump($bi->first()); +var_dump($bi->next()); +var_dump($bi->next(2)); +var_dump($bi->next(-1)); +var_dump($bi->next(0)); +var_dump($bi->next(NULL)); +?> +==DONE== +--EXPECT-- +int(0) +int(3) +int(7) +int(4) +int(4) +int(7) +==DONE== diff --git a/ext/intl/tests/breakiter_next_error.phpt b/ext/intl/tests/breakiter_next_error.phpt new file mode 100644 index 0000000000000..40d8f5813b1e7 --- /dev/null +++ b/ext/intl/tests/breakiter_next_error.phpt @@ -0,0 +1,23 @@ +--TEST-- +IntlBreakIterator::next(): arg errors +--FILE-- +setText("\x80sdfé\x90d888 dfsa9"); + +var_dump($bi->next(1, 2)); +var_dump($bi->next(array())); + +--EXPECTF-- + +Warning: IntlBreakIterator::next() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: IntlBreakIterator::next(): breakiter_next: bad arguments in %s on line %d +bool(false) + +Warning: IntlBreakIterator::next() expects parameter 1 to be long, array given in %s on line %d + +Warning: IntlBreakIterator::next(): breakiter_next: bad arguments in %s on line %d +bool(false) diff --git a/ext/intl/tests/breakiter_preceding_basic.phpt b/ext/intl/tests/breakiter_preceding_basic.phpt new file mode 100644 index 0000000000000..60695209ccd6b --- /dev/null +++ b/ext/intl/tests/breakiter_preceding_basic.phpt @@ -0,0 +1,20 @@ +--TEST-- +IntlBreakIterator::preceding(): basic test +--FILE-- +setText('foo bar trans zoo bee'); + +var_dump($bi->preceding(5)); +var_dump($bi->preceding(50)); +var_dump($bi->preceding(-1)); +?> +==DONE== +--EXPECT-- +int(4) +int(21) +int(0) +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/breakiter_previous_basic.phpt b/ext/intl/tests/breakiter_previous_basic.phpt new file mode 100644 index 0000000000000..6d4f3bce5fecf --- /dev/null +++ b/ext/intl/tests/breakiter_previous_basic.phpt @@ -0,0 +1,18 @@ +--TEST-- +IntlBreakIterator::previous(): basic test +--FILE-- +setText('foo bar trans'); + +var_dump($bi->last()); +var_dump($bi->previous()); +?> +==DONE== +--EXPECT-- +int(13) +int(8) +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/breakiter_setText_basic.phpt b/ext/intl/tests/breakiter_setText_basic.phpt new file mode 100644 index 0000000000000..7b3fa2a6e5e2c --- /dev/null +++ b/ext/intl/tests/breakiter_setText_basic.phpt @@ -0,0 +1,35 @@ +--TEST-- +IntlBreakIterator::setText(): basic test +--SKIPIF-- +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- +setText('foo bar')); +var_dump($bi->getText()); +var_dump($bi->setText(1)); +var_dump($bi->getText()); +var_dump($bi->setText(new A)); +var_dump($bi->getText()); + +/* setText resets the pointer */ +var_dump($bi->next()); +var_dump($bi->setText('foo bar')); +var_dump($bi->current()); +--EXPECT-- +bool(true) +string(7) "foo bar" +bool(true) +string(1) "1" +bool(true) +string(3) "aaa" +int(3) +bool(true) +int(0) diff --git a/ext/intl/tests/breakiter_setText_error.phpt b/ext/intl/tests/breakiter_setText_error.phpt new file mode 100644 index 0000000000000..bfcda8ddaab93 --- /dev/null +++ b/ext/intl/tests/breakiter_setText_error.phpt @@ -0,0 +1,40 @@ +--TEST-- +IntlBreakIterator::setText(): arg errors +--FILE-- +setText()); +var_dump($bi->setText(array())); +var_dump($bi->setText(1,2)); + +class A { +function __destruct() { var_dump('destructed'); throw new Exception('e'); } +function __tostring() { return 'foo'; } +} + +try { +var_dump($bi->setText(new A)); +} catch (Exception $e) { +var_dump($e->getMessage()); +} + +--EXPECTF-- + +Warning: IntlBreakIterator::setText() expects exactly 1 parameter, 0 given in %s on line %d + +Warning: IntlBreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d +bool(false) + +Warning: IntlBreakIterator::setText() expects parameter 1 to be string, array given in %s on line %d + +Warning: IntlBreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d +bool(false) + +Warning: IntlBreakIterator::setText() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: IntlBreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d +bool(false) +string(10) "destructed" +string(1) "e" diff --git a/ext/intl/tests/bug12887.phpt b/ext/intl/tests/bug12887.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/bug14562.phpt b/ext/intl/tests/bug14562.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/bug50590.phpt b/ext/intl/tests/bug50590.phpt index c39c333b23ad7..4784d378773e3 100644 --- a/ext/intl/tests/bug50590.phpt +++ b/ext/intl/tests/bug50590.phpt @@ -1,5 +1,7 @@ --TEST-- Bug #50590 (IntlDateFormatter::parse result is limited to the integer range) +--INI-- +date.timezone=Atlantic/Azores --SKIPIF-- --FILE-- diff --git a/ext/intl/tests/bug58756_MessageFormatter.phpt b/ext/intl/tests/bug58756_MessageFormatter.phpt new file mode 100644 index 0000000000000..bbe96b7045a10 --- /dev/null +++ b/ext/intl/tests/bug58756_MessageFormatter.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #58756: w.r.t MessageFormatter +--SKIPIF-- +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 EDT +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/bug59597_64.phpt b/ext/intl/tests/bug59597_64.phpt index 4b96bf72e9732..eb70995a25529 100644 --- a/ext/intl/tests/bug59597_64.phpt +++ b/ext/intl/tests/bug59597_64.phpt @@ -15,7 +15,6 @@ $value = $formatter->parse('2147483650', \NumberFormatter::TYPE_INT64); var_dump($value); ?> ---EXPECTREGEX-- +--EXPECT-- int(2147483647) int(2147483650) - diff --git a/ext/intl/tests/bug62017.phpt b/ext/intl/tests/bug62017.phpt new file mode 100644 index 0000000000000..50aeae48061a4 --- /dev/null +++ b/ext/intl/tests/bug62017.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #62017: datefmt_create with incorrectly encoded timezone leaks pattern +--SKIPIF-- += 49 only'); +--FILE-- +__construct('en', 1, 1)); +--EXPECTF-- +Warning: IntlDateFormatter::__construct(): datefmt_create: cannot call constructor twice in %s on line %d +NULL diff --git a/ext/intl/tests/bug62082.phpt b/ext/intl/tests/bug62082.phpt new file mode 100644 index 0000000000000..e6ca73e3006d2 --- /dev/null +++ b/ext/intl/tests/bug62082.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #62082: Memory corruption in internal get_icu_disp_value_src_php() +--SKIPIF-- +getTime(), + strtotime('2012-01-01 00:00:00 Europe/Rome') * 1000., + $cal->getTimeZone()->getID(), + $cal->getLocale(1) +); +echo "\n"; + +$cal = IntlCalendar::fromDateTime(new DateTime('2012-01-01 00:00:00 PST'), "pt_PT"); +var_dump( + $cal->getTime(), + strtotime('2012-01-01 00:00:00 PST') * 1000., + $cal->getTimeZone()->getID(), + $cal->getLocale(1) +); + +echo "\n"; + +$cal = intlcal_from_date_time(new DateTime('2012-01-01 00:00:00 +03:40')); +var_dump( + $cal->getTime(), + strtotime('2012-01-01 00:00:00 +03:40') * 1000., + $cal->getTimeZone()->getID() +); + +--EXPECTF-- +float(1325372400000) +float(1325372400000) +string(11) "Europe/Rome" +string(5) "nl_NL" + +float(1325404800000) +float(1325404800000) +string(3) "PST" +string(5) "pt_PT" + +float(1325362800000) +float(1325362800000) +string(%d) "GMT+03%S40" diff --git a/ext/intl/tests/calendar_fromDateTime_error.phpt b/ext/intl/tests/calendar_fromDateTime_error.phpt new file mode 100644 index 0000000000000..2fbf7196f92e6 --- /dev/null +++ b/ext/intl/tests/calendar_fromDateTime_error.phpt @@ -0,0 +1,59 @@ +--TEST-- +IntlCalendar::fromDateTime(): errors +--SKIPIF-- +setTimeZone($gmt, 2)); -var_dump($c->setTimeZone(1)); var_dump($c->setTimeZone()); -var_dump(intlcal_set_time_zone($c, 1)); +var_dump(intlcal_set_time_zone($c, 1, 2)); var_dump(intlcal_set_time_zone(1, $gmt)); + --EXPECT-- error: 2, IntlCalendar::setTimeZone() expects exactly 1 parameter, 2 given error: 2, IntlCalendar::setTimeZone(): intlcal_set_time_zone: bad arguments bool(false) -error: 4096, Argument 1 passed to IntlCalendar::setTimeZone() must be an instance of IntlTimeZone, integer given -error: 2, IntlCalendar::setTimeZone() expects parameter 1 to be IntlTimeZone, integer given -error: 2, IntlCalendar::setTimeZone(): intlcal_set_time_zone: bad arguments -bool(false) error: 2, IntlCalendar::setTimeZone() expects exactly 1 parameter, 0 given error: 2, IntlCalendar::setTimeZone(): intlcal_set_time_zone: bad arguments bool(false) -error: 4096, Argument 2 passed to intlcal_set_time_zone() must be an instance of IntlTimeZone, integer given -error: 2, intlcal_set_time_zone() expects parameter 2 to be IntlTimeZone, integer given +error: 2, intlcal_set_time_zone() expects exactly 2 parameters, 3 given error: 2, intlcal_set_time_zone(): intlcal_set_time_zone: bad arguments bool(false) error: 4096, Argument 1 passed to intlcal_set_time_zone() must be an instance of IntlCalendar, integer given diff --git a/ext/intl/tests/calendar_setTimeZone_error2.phpt b/ext/intl/tests/calendar_setTimeZone_error2.phpt new file mode 100644 index 0000000000000..aa1eaba209e9f --- /dev/null +++ b/ext/intl/tests/calendar_setTimeZone_error2.phpt @@ -0,0 +1,29 @@ +--TEST-- +IntlCalendar::setTimeZone(): valid time zones for DateTime but not ICU +--SKIPIF-- +setTimeZone($pstdate->getTimeZone()); +var_dump($intlcal->getTimeZone()->getID()); + +$pstdate = new DateTime('2012-01-01 00:00:00 +24:00'); +$intlcal->setTimeZone($pstdate->getTimeZone()); +var_dump($intlcal->getTimeZone()->getID()); + +--EXPECTF-- + +Warning: IntlCalendar::setTimeZone(): intlcal_set_time_zone: time zone id 'WEST' extracted from ext/date DateTimeZone not recognized in %s on line %d +string(16) "Europe/Amsterdam" + +Warning: IntlCalendar::setTimeZone(): intlcal_set_time_zone: object has an time zone offset that's too large in %s on line %d +string(16) "Europe/Amsterdam" diff --git a/ext/intl/tests/calendar_setTimeZone_variation2.phpt b/ext/intl/tests/calendar_setTimeZone_variation2.phpt new file mode 100644 index 0000000000000..7f4a7ffa371fa --- /dev/null +++ b/ext/intl/tests/calendar_setTimeZone_variation2.phpt @@ -0,0 +1,30 @@ +--TEST-- +IntlCalendar::setTimeZone(): different ways to specify time zone +--SKIPIF-- +setTimeZone('Europe/Paris'); +var_dump($intlcal->getTimeZone()->getID()); +$intlcal->setTimeZone(new DateTimeZone('Europe/Madrid')); +var_dump($intlcal->getTimeZone()->getID()); + +$pstdate = new DateTime('2012-01-01 00:00:00 PST'); +$intlcal->setTimeZone($pstdate->getTimeZone()); +var_dump($intlcal->getTimeZone()->getID()); + +$offsetdate = new DateTime('2012-01-01 00:00:00 -02:30'); +$intlcal->setTimeZone($offsetdate->getTimeZone()); +var_dump($intlcal->getTimeZone()->getID()); +--EXPECTF-- +string(12) "Europe/Paris" +string(13) "Europe/Madrid" +string(3) "PST" +string(%d) "GMT-02%S30" diff --git a/ext/intl/tests/calendar_toDateTime_basic.phpt b/ext/intl/tests/calendar_toDateTime_basic.phpt new file mode 100644 index 0000000000000..d38487dabf40a --- /dev/null +++ b/ext/intl/tests/calendar_toDateTime_basic.phpt @@ -0,0 +1,23 @@ +--TEST-- +IntlCalendar::toDateTime(): basic test +--SKIPIF-- +toDateTime(); + +var_dump($dt->format("c"), $dt->getTimeZone()->getName()); +?> +==DONE== +--EXPECT-- +string(25) "2012-05-17T17:35:36+01:00" +string(13) "Europe/Lisbon" +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/calendar_toDateTime_error.phpt b/ext/intl/tests/calendar_toDateTime_error.phpt new file mode 100644 index 0000000000000..961a9c86a6a1d --- /dev/null +++ b/ext/intl/tests/calendar_toDateTime_error.phpt @@ -0,0 +1,41 @@ +--TEST-- +IntlCalendar::toDateTime(): bad arguments +--SKIPIF-- +toDateTime(3)); + +var_dump(intlcal_to_date_time($cal, 3)); + +$cal = new IntlGregorianCalendar("Etc/Unknown"); +try { +var_dump($cal->toDateTime()); +} catch (Exception $e) { +var_dump("exception: {$e->getMessage()}"); +} + +var_dump(intlcal_to_date_time(3)); + +--EXPECTF-- + +Warning: IntlCalendar::toDateTime() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: IntlCalendar::toDateTime(): intlcal_to_date_time: bad arguments in %s on line %d +bool(false) + +Warning: intlcal_to_date_time() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: intlcal_to_date_time(): intlcal_to_date_time: bad arguments in %s on line %d +bool(false) + +Warning: IntlCalendar::toDateTime(): intlcal_to_date_time: DateTimeZone constructor threw exception in %s on line %d +string(77) "exception: DateTimeZone::__construct(): Unknown or bad timezone (Etc/Unknown)" + +Catchable fatal error: Argument 1 passed to intlcal_to_date_time() must be an instance of IntlCalendar, integer given in %s on line %d diff --git a/ext/intl/tests/collation_customization.phpt b/ext/intl/tests/collation_customization.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collator_asort.phpt b/ext/intl/tests/collator_asort.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collator_compare.phpt b/ext/intl/tests/collator_compare.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collator_create.phpt b/ext/intl/tests/collator_create.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collator_get_error_code.phpt b/ext/intl/tests/collator_get_error_code.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collator_get_error_message.phpt b/ext/intl/tests/collator_get_error_message.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collator_get_locale.phpt b/ext/intl/tests/collator_get_locale.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collator_get_set_attribute.phpt b/ext/intl/tests/collator_get_set_attribute.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collator_get_set_strength.phpt b/ext/intl/tests/collator_get_set_strength.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collator_get_sort_key.phpt b/ext/intl/tests/collator_get_sort_key.phpt old mode 100755 new mode 100644 index 0fedde0fff2d7..a9c4d71348129 --- a/ext/intl/tests/collator_get_sort_key.phpt +++ b/ext/intl/tests/collator_get_sort_key.phpt @@ -2,8 +2,7 @@ collator_get_sort_key() --SKIPIF-- ---XFAIL-- -Sort keys are not fixed, comparing them to fixed strings doesn't work. += 4.8 only'; ?> --FILE-- --EXPECT-- source: abc -key: %29%2B-%01%07%01%07%00 +key: 27292b01070107 source: abd -key: %29%2B%2F%01%07%01%07%00 +key: 27292d01070107 source: aaa -key: %29%29%29%01%07%01%07%00 -source: %D0%B0%D0%B0 -key: _++%01%06%01%06%00 -source: %D0%B0 -key: _+%01%05%01%05%00 +key: 27272701070107 +source: аа +key: 5c0a0a01060106 +source: а +key: 5c0a01050105 source: z -key: %5B%01%05%01%05%00 -source: -key: %01%01%00 -source: -key: %01%01%00 +key: 5901050105 +source: +key: 0101 +source: +key: 0101 source: 3 -key: %26%80%01%05%01%05%00 +key: 1801050105 source: y -key: Y%01%05%01%05%00 +key: 5701050105 source: i -key: 9%01%05%01%05%00 +key: 3701050105 source: k -key: %3D%01%05%01%05%00 -source: %D0%B0%D0%B1%D0%B3 -key: _+%2C0%01%07%01%07%00 -source: %D0%B0%D0%B1%D0%B2 -key: _+%2C.%01%07%01%07%00 -source: %D0%B6%D0%B6%D0%B6 -key: _LLL%01%07%01%07%00 -source: %D1%8D%D1%8E%D1%8F -key: %60%05%09%0B%01%07%01%07%00 -source: %D0%B0%D0%B1%D0%B3 -key: _+%2C0%01%07%01%07%00 -source: %D0%B0%D0%B1%D0%B2 -key: _+%2C.%01%07%01%07%00 -source: %D0%B6%D0%B6%D0%B6 -key: _LLL%01%07%01%07%00 -source: %D1%8D%D1%8E%D1%8F -key: %60%05%09%0B%01%07%01%07%00 \ No newline at end of file +key: 3b01050105 +source: абг +key: 5c0a161a01070107 +source: абв +key: 5c0a161801070107 +source: жжж +key: 5c3a3a3a01070107 +source: ÑÑŽÑ +key: 5d3b3f4501070107 +source: абг +key: 5c0a161a01070107 +source: абв +key: 5c0a161801070107 +source: жжж +key: 5c3a3a3a01070107 +source: ÑÑŽÑ +key: 5d3b3f4501070107 \ No newline at end of file diff --git a/ext/intl/tests/collator_sort.phpt b/ext/intl/tests/collator_sort.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collator_sort_with_sort_keys.phpt b/ext/intl/tests/collator_sort_with_sort_keys.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/cpbi_clone_equality.phpt b/ext/intl/tests/cpbi_clone_equality.phpt new file mode 100644 index 0000000000000..c62b45274737f --- /dev/null +++ b/ext/intl/tests/cpbi_clone_equality.phpt @@ -0,0 +1,33 @@ +--TEST-- +IntlCodePointBreakIterator: clone and equality +--SKIPIF-- +setText($text); + +$it_clone = clone $it; +var_dump($it == $it_clone); + +$it->setText($text2 ); +var_dump($it == $it_clone); + +$it_clone->setText($text2); +var_dump($it == $it_clone); + +?> +==DONE== +--EXPECT-- +bool(true) +bool(false) +bool(true) +==DONE== diff --git a/ext/intl/tests/cpbi_getLastCodePoint_basic.phpt b/ext/intl/tests/cpbi_getLastCodePoint_basic.phpt new file mode 100644 index 0000000000000..74a07a6292272 --- /dev/null +++ b/ext/intl/tests/cpbi_getLastCodePoint_basic.phpt @@ -0,0 +1,82 @@ +--TEST-- +IntlCodepointBreakIterator::getLastCodePoint(): basic test +--SKIPIF-- +setText($text); + +var_dump($codepoint_it->getLastCodePoint()); +//first() and last() don't read codepoint and set the last code point var to -1 +//The pointer is after the last read codepoint if moving forward and +//before the last read codepoint is moving backwards +$p = $codepoint_it->first(); +while ($p != IntlBreakIterator::DONE) { + $c = $codepoint_it->getLastCodePoint(); + if ($c > 0) + var_dump(sprintf('U+%04X', $codepoint_it->getLastCodePoint())); + else + var_dump($c); + //it's a post-increment operation as to the codepoint, i.e., it gives the codepoint + //starting at the initial position and only then moves the pointer forward + $p = $codepoint_it->next(); +} + +echo "Now backwards\n"; +$p = $codepoint_it->last(); +while ($p != IntlBreakIterator::DONE) { + $c = $codepoint_it->getLastCodePoint(); + if ($c > 0) + var_dump(sprintf('U+%04X', $codepoint_it->getLastCodePoint())); + else + var_dump($c); + $p = $codepoint_it->previous(); +} + + +?> +==DONE== +--EXPECT-- +int(-1) +int(-1) +string(6) "U+0E15" +string(6) "U+0E31" +string(6) "U+0E27" +string(6) "U+0E2D" +string(6) "U+0E22" +string(6) "U+0E48" +string(6) "U+0E32" +string(6) "U+0E07" +string(6) "U+0E02" +string(6) "U+0E49" +string(6) "U+0E2D" +string(6) "U+0E04" +string(6) "U+0E27" +string(6) "U+0E32" +string(6) "U+0E21" +Now backwards +int(-1) +string(6) "U+0E21" +string(6) "U+0E32" +string(6) "U+0E27" +string(6) "U+0E04" +string(6) "U+0E2D" +string(6) "U+0E49" +string(6) "U+0E02" +string(6) "U+0E07" +string(6) "U+0E32" +string(6) "U+0E48" +string(6) "U+0E22" +string(6) "U+0E2D" +string(6) "U+0E27" +string(6) "U+0E31" +string(6) "U+0E15" +==DONE== diff --git a/ext/intl/tests/cpbi_getLastCodePoint_error.phpt b/ext/intl/tests/cpbi_getLastCodePoint_error.phpt new file mode 100644 index 0000000000000..78bd216629b7a --- /dev/null +++ b/ext/intl/tests/cpbi_getLastCodePoint_error.phpt @@ -0,0 +1,19 @@ +--TEST-- +IntlBreakIterator::getLastCodePoint(): bad args +--SKIPIF-- +getLastCodePoint(array())); +--EXPECTF-- + +Warning: IntlCodePointBreakIterator::getLastCodePoint() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: IntlCodePointBreakIterator::getLastCodePoint(): cpbi_get_last_code_point: bad arguments in %s on line %d +bool(false) + diff --git a/ext/intl/tests/cpbi_parts_iterator.phpt b/ext/intl/tests/cpbi_parts_iterator.phpt new file mode 100644 index 0000000000000..4754c12371095 --- /dev/null +++ b/ext/intl/tests/cpbi_parts_iterator.phpt @@ -0,0 +1,40 @@ +--TEST-- +IntlCodepointBreakIterator's part iterator +--SKIPIF-- +getPartsIterator(); +$it->getBreakIterator()->setText($text); + +foreach ($it as $k => $v) { + echo "$k. $v (" . sprintf("U+%04X", $it->getBreakIterator()->getLastCodePoint()) . + ") at {$it->getBreakIterator()->current()}\r\n"; +} + +?> +==DONE== +--EXPECT-- +0. ต (U+0E15) at 3 +1. ั (U+0E31) at 6 +2. ว (U+0E27) at 9 +3. อ (U+0E2D) at 12 +4. ย (U+0E22) at 15 +5. ่ (U+0E48) at 18 +6. า (U+0E32) at 21 +7. ง (U+0E07) at 24 +8. ข (U+0E02) at 27 +9. ้ (U+0E49) at 30 +10. อ (U+0E2D) at 33 +11. ค (U+0E04) at 36 +12. ว (U+0E27) at 39 +13. า (U+0E32) at 42 +14. ม (U+0E21) at 45 +==DONE== diff --git a/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt b/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt new file mode 100644 index 0000000000000..1f682ddb4a00f --- /dev/null +++ b/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt @@ -0,0 +1,28 @@ +--TEST-- +IntlDateFormatter::__construct(): bad timezone or calendar +--FILE-- + +==DONE== +--EXPECTF-- + +Warning: IntlDateFormatter::__construct(): datefmt_create: no such time zone: 'bad timezone' in %s on line %d +NULL + +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 %s on line %d +NULL + +Warning: IntlDateFormatter::__construct(): datefmt_create: Invalid calendar argument; should be an integer or an IntlCalendar instance in %s on line %d +NULL +==DONE== diff --git a/ext/intl/tests/dateformat_calendars.phpt b/ext/intl/tests/dateformat_calendars.phpt new file mode 100644 index 0000000000000..6af02e51c14e6 --- /dev/null +++ b/ext/intl/tests/dateformat_calendars.phpt @@ -0,0 +1,45 @@ +--TEST-- +IntlDateFormatter, calendars and time zone +--INI-- +date.timezone=Atlantic/Azores +--SKIPIF-- +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(44) "Sunday, January 1, 2012 5:12:00 AM GMT+05:12" +string(44) "Sunday, January 1, 2012 5:12:00 AM GMT+05:12" +string(42) "Sunday, Tevet 6, 5772 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 %s on line %d +==DONE== diff --git a/ext/intl/tests/dateformat_create_cal_arg.phpt b/ext/intl/tests/dateformat_create_cal_arg.phpt new file mode 100644 index 0000000000000..8e5f942a6be48 --- /dev/null +++ b/ext/intl/tests/dateformat_create_cal_arg.phpt @@ -0,0 +1,49 @@ +--TEST-- +IntlDateFormatter: several forms of the calendar arg +--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== +--EXPECT-- +domingo, 1 de enero de 2012 00:00:00 GMT +domingo, 8 de Safar de 1433 00:00:00 GMT +domingo, 1 de enero de 2012 01:00:00 Hora estándar de Europa Central +sábado, 31 de diciembre de 2011 d.C. 23:00:00 Hora estándar de las Azores +sábado, 7 de Safar de 1433 AH 23:00:00 Hora estándar de las Azores +domingo, 8 de Safar de 1433 AH 00:00:00 GMT +domingo, 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 old mode 100755 new mode 100644 index e5548196d1031..8664eea319888 --- a/ext/intl/tests/dateformat_format.phpt +++ b/ext/intl/tests/dateformat_format.phpt @@ -5,6 +5,8 @@ datefmt_format_code() --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== + +--EXPECT-- +01/01/2012 00:00:00 +Domingo, 1 de Janeiro de 2012 0:00:00 Hora Padrão da Europa Ocidental +Jan 1, 2012 12:00:00 AM +1/1/12 12:00:00 AM Western European Standard Time +Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon) +Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00 +06/02/1433 00:00:00 +Sunday, Safar 6, 1433 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 new file mode 100644 index 0000000000000..bfc26cb80c9ab --- /dev/null +++ b/ext/intl/tests/dateformat_formatObject_datetime.phpt @@ -0,0 +1,34 @@ +--TEST-- +IntlDateFormatter::formatObject(): DateTime tests +--SKIPIF-- + +==DONE== + +--EXPECT-- +01/01/2012 00:00:00 +Domingo, 1 de Janeiro de 2012 0:00:00 Hora Padrão da Europa Ocidental +Jan 1, 2012 12:00:00 AM +1/1/12 12:00:00 AM Western European Standard Time +Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon) +Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00 +==DONE== + diff --git a/ext/intl/tests/dateformat_formatObject_error.phpt b/ext/intl/tests/dateformat_formatObject_error.phpt new file mode 100644 index 0000000000000..7aaf69e54e644 --- /dev/null +++ b/ext/intl/tests/dateformat_formatObject_error.phpt @@ -0,0 +1,74 @@ +--TEST-- +IntlDateFormatter::formatObject(): error conditions +--SKIPIF-- + +==DONE== + +--EXPECTF-- + +Warning: IntlDateFormatter::formatObject() expects at least 1 parameter, 0 given in %s on line %d +bool(false) + +Warning: IntlDateFormatter::formatObject() expects parameter 1 to be object, integer given in %s on line %d +bool(false) + +Warning: IntlDateFormatter::formatObject(): datefmt_format_object: the passed object must be an instance of either IntlCalendar or DateTime in %s on line %d +bool(false) + +Warning: IntlDateFormatter::formatObject(): datefmt_format_object: bad IntlCalendar instance: not initialized properly in %s on line %d +bool(false) + +Warning: DateTime::getTimestamp(): The DateTime object has not been correctly initialized by its constructor in %s on line %d + +Warning: IntlDateFormatter::formatObject(): datefmt_format_object: error calling ::getTimeStamp() on the object in %s on line %d +bool(false) + +Warning: IntlDateFormatter::formatObject(): datefmt_format_object: the date/time format type is invalid in %s on line %d +bool(false) + +Warning: IntlDateFormatter::formatObject(): datefmt_format_object: bad format; if array, it must have two elements in %s on line %d +bool(false) + +Warning: IntlDateFormatter::formatObject(): datefmt_format_object: bad format; if array, it must have two elements in %s on line %d +bool(false) + +Warning: IntlDateFormatter::formatObject(): datefmt_format_object: bad format; the date format (first element of the array) is not valid in %s on line %d +bool(false) + +Warning: IntlDateFormatter::formatObject(): datefmt_format_object: bad format; the time format (second element of the array) is not valid in %s on line %d +bool(false) + +Warning: IntlDateFormatter::formatObject(): datefmt_format_object: the format is empty in %s on line %d +bool(false) + +Warning: IntlDateFormatter::formatObject() expects parameter 3 to be string, array given in %s on line %d +bool(false) +==DONE== + diff --git a/ext/intl/tests/dateformat_format_parse.phpt b/ext/intl/tests/dateformat_format_parse.phpt old mode 100755 new mode 100644 index bd41d715b9e63..6bd3d8a8ff9ef --- a/ext/intl/tests/dateformat_format_parse.phpt +++ b/ext/intl/tests/dateformat_format_parse.phpt @@ -12,7 +12,7 @@ datefmt_format_code() and datefmt_parse_code() function ut_main() { - $timezone = 'GMT+5'; + $timezone = 'GMT+05:00'; $locale_arr = array ( 'en_US' diff --git a/ext/intl/tests/dateformat_getCalendarObject_error.phpt b/ext/intl/tests/dateformat_getCalendarObject_error.phpt new file mode 100644 index 0000000000000..22f12cb3fd82a --- /dev/null +++ b/ext/intl/tests/dateformat_getCalendarObject_error.phpt @@ -0,0 +1,39 @@ +--TEST-- +IntlDateFormatter::getCalendarObject(): bad args +--FILE-- +getCalendarObject(9)); +var_dump(datefmt_get_calendar_object($df, 9)); +var_dump(datefmt_get_calendar_object($df, 9)); +var_dump(datefmt_get_calendar_object(new stdclass)); + +?> +==DONE== +--EXPECTF-- + +Warning: IntlDateFormatter::getCalendarObject() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: IntlDateFormatter::getCalendarObject(): datefmt_get_calendar_object: unable to parse input params in %s on line %d +bool(false) + +Warning: datefmt_get_calendar_object() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: datefmt_get_calendar_object(): datefmt_get_calendar_object: unable to parse input params in %s on line %d +bool(false) + +Warning: datefmt_get_calendar_object() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: datefmt_get_calendar_object(): datefmt_get_calendar_object: unable to parse input params in %s on line %d +bool(false) + +Warning: datefmt_get_calendar_object() expects parameter 1 to be IntlDateFormatter, object given in %s on line %d + +Warning: datefmt_get_calendar_object(): datefmt_get_calendar_object: unable to parse input params in %s on line %d +bool(false) +==DONE== diff --git a/ext/intl/tests/dateformat_getTimeZone_error.phpt b/ext/intl/tests/dateformat_getTimeZone_error.phpt new file mode 100644 index 0000000000000..c9d49fde4362c --- /dev/null +++ b/ext/intl/tests/dateformat_getTimeZone_error.phpt @@ -0,0 +1,39 @@ +--TEST-- +IntlDateFormatter::getTimeZone(): bad args +--FILE-- +getTimeZone(9)); +var_dump(datefmt_get_timezone($df, 9)); +var_dump(datefmt_get_timezone($df, 9)); +var_dump(datefmt_get_timezone(new stdclass)); + +?> +==DONE== +--EXPECTF-- + +Warning: IntlDateFormatter::getTimeZone() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: IntlDateFormatter::getTimeZone(): datefmt_get_timezone: unable to parse input params in %s on line %d +bool(false) + +Warning: datefmt_get_timezone() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: datefmt_get_timezone(): datefmt_get_timezone: unable to parse input params in %s on line %d +bool(false) + +Warning: datefmt_get_timezone() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: datefmt_get_timezone(): datefmt_get_timezone: unable to parse input params in %s on line %d +bool(false) + +Warning: datefmt_get_timezone() expects parameter 1 to be IntlDateFormatter, object given in %s on line %d + +Warning: datefmt_get_timezone(): datefmt_get_timezone: unable to parse input params in %s on line %d +bool(false) +==DONE== diff --git a/ext/intl/tests/dateformat_get_datetype.phpt b/ext/intl/tests/dateformat_get_datetype.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_get_locale.phpt b/ext/intl/tests/dateformat_get_locale.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_get_set_calendar.phpt b/ext/intl/tests/dateformat_get_set_calendar.phpt old mode 100755 new mode 100644 index bfd4e578e1ca5..e792ea379933c --- a/ext/intl/tests/dateformat_get_set_calendar.phpt +++ b/ext/intl/tests/dateformat_get_set_calendar.phpt @@ -1,60 +1,51 @@ --TEST-- -datefmt_get_calendar_code() datefmt_set_calendar_code() ---SKIPIF-- - +IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject() --FILE-- format($ts), "\n"; +var_dump($df->getCalendar(), +$df->getCalendarObject()->getType(), +$df->getCalendarObject()->getTimeZone()->getId()); +echo "\n"; +} -/* - * Test for the datefmt_get_calendar and datefmt_set_calendar functions - */ - - -function ut_main() -{ - $calendar_arr = array ( - IntlDateFormatter::GREGORIAN, - IntlDateFormatter::TRADITIONAL, - 3 - ); - - $res_str = ''; - - $start_calendar = IntlDateFormatter::GREGORIAN; - $res_str .= "\nCreating IntlDateFormatter with calendar = $start_calendar"; - $fmt = ut_datefmt_create( "de-DE", IntlDateFormatter::SHORT, IntlDateFormatter::SHORT ,'America/Los_Angeles', IntlDateFormatter::GREGORIAN); - $calendar = ut_datefmt_get_calendar( $fmt); - $res_str .= "\nAfter call to get_calendar : calendar= $calendar"; - $res_str .= "\n-------------------"; - - foreach( $calendar_arr as $calendar_entry ) - { - $res_str .= "\nSetting IntlDateFormatter with calendar = $calendar_entry"; - ut_datefmt_set_calendar( $fmt, $calendar_entry); - $calendar = ut_datefmt_get_calendar( $fmt); - $res_str .= "\nAfter call to get_calendar : calendar= $calendar"; - $res_str .= "\n-------------------"; - } - - return $res_str; +$df = new IntlDateFormatter('fr@calendar=islamic', 0, 0, 'Europe/Minsk'); +d($df); -} -include_once( 'ut_common.inc' ); +//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); -// Run the test -ut_run(); ?> +==DONE== --EXPECT-- -Creating IntlDateFormatter with calendar = 1 -After call to get_calendar : calendar= 1 -------------------- -Setting IntlDateFormatter with calendar = 1 -After call to get_calendar : calendar= 1 -------------------- -Setting IntlDateFormatter with calendar = 0 -After call to get_calendar : calendar= 0 -------------------- -Setting IntlDateFormatter with calendar = 3 -After call to get_calendar : calendar= 0 -------------------- \ No newline at end of file +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_pattern.phpt b/ext/intl/tests/dateformat_get_set_pattern.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_get_set_timezone.phpt b/ext/intl/tests/dateformat_get_set_timezone.phpt new file mode 100644 index 0000000000000..50b036e36ec4f --- /dev/null +++ b/ext/intl/tests/dateformat_get_set_timezone.phpt @@ -0,0 +1,58 @@ +--TEST-- +IntlDateFormatter: get/setTimeZone() +--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== +--EXPECT-- +Domingo, 1 de Janeiro de 2012 3:00:00 GMT+03:00 +string(12) "Europe/Minsk" +string(12) "Europe/Minsk" + +Sábado, 31 de Dezembro de 2011 23:00:00 Hora Padrão dos Açores +string(15) "Atlantic/Azores" +string(15) "Atlantic/Azores" + +Domingo, 1 de Janeiro de 2012 1:00:00 Hora Padrão da Europa Central +string(13) "Europe/Madrid" +string(13) "Europe/Madrid" + +Domingo, 1 de Janeiro de 2012 1:00:00 Hora Padrão da Europa Central +string(12) "Europe/Paris" +string(12) "Europe/Paris" + +Domingo, 1 de Janeiro de 2012 1:00:00 Hora Padrão da Europa Central +string(16) "Europe/Amsterdam" +string(16) "Europe/Amsterdam" + +==DONE== diff --git a/ext/intl/tests/dateformat_get_timetype.phpt b/ext/intl/tests/dateformat_get_timetype.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_get_timezone_id.phpt b/ext/intl/tests/dateformat_get_timezone_id.phpt old mode 100755 new mode 100644 index 80cbdbbf0fc1a..a9701c38687ea --- a/ext/intl/tests/dateformat_get_timezone_id.phpt +++ b/ext/intl/tests/dateformat_get_timezone_id.phpt @@ -1,5 +1,8 @@ --TEST-- datefmt_get_timezone_id_code() +--INI-- +date.timezone=Atlantic/Azores +intl.error_level=E_WARNING --SKIPIF-- --FILE-- @@ -14,8 +17,8 @@ function ut_main() { $timezone_id_arr = array ( 'America/New_York', - 'America/Los_Angeles', - 'America/Dallas' + 'US/Pacific', + 'US/Central' ); $res_str = ''; @@ -42,8 +45,8 @@ ut_run(); Creating IntlDateFormatter with timezone_id = America/New_York After call to get_timezone_id : timezone_id= America/New_York -Creating IntlDateFormatter with timezone_id = America/Los_Angeles -After call to get_timezone_id : timezone_id= America/Los_Angeles +Creating IntlDateFormatter with timezone_id = US/Pacific +After call to get_timezone_id : timezone_id= US/Pacific -Creating IntlDateFormatter with timezone_id = America/Dallas -After call to get_timezone_id : timezone_id= America/Dallas +Creating IntlDateFormatter with timezone_id = US/Central +After call to get_timezone_id : timezone_id= US/Central diff --git a/ext/intl/tests/dateformat_is_set_lenient.phpt b/ext/intl/tests/dateformat_is_set_lenient.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_localtime.phpt b/ext/intl/tests/dateformat_localtime.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_parse.phpt b/ext/intl/tests/dateformat_parse.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_parse_localtime_parsepos.phpt b/ext/intl/tests/dateformat_parse_localtime_parsepos.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_parse_timestamp_parsepos.phpt b/ext/intl/tests/dateformat_parse_timestamp_parsepos.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_setTimeZoneID_deprecation.phpt b/ext/intl/tests/dateformat_setTimeZoneID_deprecation.phpt new file mode 100644 index 0000000000000..ccc477d075032 --- /dev/null +++ b/ext/intl/tests/dateformat_setTimeZoneID_deprecation.phpt @@ -0,0 +1,18 @@ +--TEST-- +IntlDateFormatter: setTimeZoneID() deprecation +--FILE-- +setTimeZoneId('Europe/Madrid'); + +?> +==DONE== +--EXPECTF-- + +Deprecated: IntlDateFormatter::setTimeZoneId(): Use datefmt_set_timezone() instead, which also accepts a plain time zone identifier and for which this function is now an alias in %s on line %d +==DONE== diff --git a/ext/intl/tests/dateformat_setTimeZone_error.phpt b/ext/intl/tests/dateformat_setTimeZone_error.phpt new file mode 100644 index 0000000000000..8200197948dc2 --- /dev/null +++ b/ext/intl/tests/dateformat_setTimeZone_error.phpt @@ -0,0 +1,49 @@ +--TEST-- +IntlDateFormatter::setTimeZone() bad args +--FILE-- +setTimeZone()); +var_dump(datefmt_set_timezone()); +var_dump($df->setTimeZone(array())); +var_dump($df->setTimeZone(1, 2)); +var_dump($df->setTimeZone('non existing timezone')); +var_dump(datefmt_set_timezone(new stdclass, 'UTC')); + +?> +==DONE== +--EXPECTF-- + +Warning: IntlDateFormatter::setTimeZone() expects exactly 1 parameter, 0 given in %s on line %d + +Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: unable to parse input params in %s on line %d +bool(false) + +Warning: datefmt_set_timezone() expects exactly 2 parameters, 0 given in %s on line %d + +Warning: datefmt_set_timezone(): datefmt_set_timezone: unable to parse input params in %s on line %d +bool(false) + +Notice: Array to string conversion in %s on line %d + +Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: no such time zone: 'Array' in %s on line %d +bool(false) + +Warning: IntlDateFormatter::setTimeZone() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: unable to parse input params in %s on line %d +bool(false) + +Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: no such time zone: 'non existing timezone' in %s on line %d +bool(false) + +Warning: datefmt_set_timezone() expects parameter 1 to be IntlDateFormatter, object given in %s on line %d + +Warning: datefmt_set_timezone(): datefmt_set_timezone: unable to parse input params in %s on line %d +bool(false) +==DONE== diff --git a/ext/intl/tests/dateformat_set_timezone_id.phpt b/ext/intl/tests/dateformat_set_timezone_id.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_set_timezone_id2.phpt b/ext/intl/tests/dateformat_set_timezone_id2.phpt index 23aacda90aeb2..ce9b89d1fdbbf 100644 --- a/ext/intl/tests/dateformat_set_timezone_id2.phpt +++ b/ext/intl/tests/dateformat_set_timezone_id2.phpt @@ -1,11 +1,16 @@ --TEST-- datefmt_set_timezone_id_code() icu >= 4.8 +--INI-- +date.timezone=Atlantic/Azores --SKIPIF-- --FILE-- ---EXPECT-- -After creation of the dateformatter : timezone_id= America/San_Francisco +--EXPECTF-- + +Warning: IntlDateFormatter::setTimeZoneId(): datefmt_set_timezone: no such time zone: 'CN' in %s on line %d + +Warning: datefmt_set_timezone_id(): datefmt_set_timezone: no such time zone: 'CN' in %s 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 @@ -71,6 +81,6 @@ Formatting timestamp=0 resulted in Wednesday, December 31, 1969 6:00:00 PM Cent Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 7:00:00 PM Central Standard Time ----------- Trying to set timezone_id= CN -After call to set_timezone_id : timezone_id= CN -Formatting timestamp=0 resulted in Thursday, January 1, 1970 12:00:00 AM GMT -Formatting timestamp=3600 resulted in Thursday, January 1, 1970 1:00:00 AM GMT +After call to set_timezone_id : timezone_id= America/Chicago +Formatting timestamp=0 resulted in Wednesday, December 31, 1969 6:00:00 PM Central Standard Time +Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 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 new file mode 100644 index 0000000000000..df3ebd853d604 --- /dev/null +++ b/ext/intl/tests/dateformat_timezone_arg_variations.phpt @@ -0,0 +1,41 @@ +--TEST-- +IntlDateFormatter: several forms of the timezone arg +--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%S 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_fail.phpt b/ext/intl/tests/formatter_fail.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_format.phpt b/ext/intl/tests/formatter_format.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_format_conv.phpt b/ext/intl/tests/formatter_format_conv.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_format_currency.phpt b/ext/intl/tests/formatter_format_currency.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_get_error.phpt b/ext/intl/tests/formatter_get_error.phpt old mode 100755 new mode 100644 index c7b3972709593..acb683e894c13 --- a/ext/intl/tests/formatter_get_error.phpt +++ b/ext/intl/tests/formatter_get_error.phpt @@ -19,7 +19,7 @@ function ut_main() if( $num === false ) return $fmt->getErrorMessage() . " (" . $fmt->getErrorCode() . ")\n"; else - return "Ooops, an error should have occured."; + return "Ooops, an error should have occurred."; } include_once( 'ut_common.inc' ); diff --git a/ext/intl/tests/formatter_get_locale.phpt b/ext/intl/tests/formatter_get_locale.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_get_set_attribute.phpt b/ext/intl/tests/formatter_get_set_attribute.phpt old mode 100755 new mode 100644 index cb5e4157559b6..51c7d3658a362 --- a/ext/intl/tests/formatter_get_set_attribute.phpt +++ b/ext/intl/tests/formatter_get_set_attribute.phpt @@ -1,8 +1,8 @@ --TEST-- -numfmt_get/set_attribute() icu < 4.2 +numfmt_get/set_attribute() --SKIPIF-- - + --FILE-- array( NumberFormatter::ROUNDING_MODE, 1, 12345.123456 ), 'ROUNDING_INCREMENT' => array( NumberFormatter::ROUNDING_INCREMENT, (float)2, 12345.123456 ), 'FORMAT_WIDTH' => array( NumberFormatter::FORMAT_WIDTH, 27, 12345.123456 ), - 'PADDING_POSITION' => array( NumberFormatter::PADDING_POSITION, 21, 12345.123456 ), + 'PADDING_POSITION' => array( NumberFormatter::PADDING_POSITION, 2, 12345.123456 ), 'SECONDARY_GROUPING_SIZE' => array( NumberFormatter::SECONDARY_GROUPING_SIZE, 2, 12345.123456 ), 'SIGNIFICANT_DIGITS_USED' => array( NumberFormatter::SIGNIFICANT_DIGITS_USED, 1, 12345.123456 ), 'MIN_SIGNIFICANT_DIGITS' => array( NumberFormatter::MIN_SIGNIFICANT_DIGITS, 3, 1 ), @@ -159,7 +159,7 @@ Setting attribute: ok New attribute value: 1 ; Format result: '0,012,345.12345' ; Parse result: 12345.12345 Attribute ROUNDING_INCREMENT -Old attribute value: 1.0E-5 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 +Old attribute value: 0 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 Setting attribute: ok New attribute value: 2 ; Format result: '0,012,346.00000' ; Parse result: 12346 @@ -171,7 +171,7 @@ New attribute value: 27 ; Format result: '************0,012,345.12346' ; Parse Attribute PADDING_POSITION Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 Setting attribute: ok -New attribute value: 21 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 +New attribute value: 2 ; Format result: '0,012,345.12346************' ; Parse result: 12345.12346 Attribute SECONDARY_GROUPING_SIZE Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 diff --git a/ext/intl/tests/formatter_get_set_attribute2.phpt b/ext/intl/tests/formatter_get_set_attribute2.phpt deleted file mode 100644 index 7d5fe69dca8bc..0000000000000 --- a/ext/intl/tests/formatter_get_set_attribute2.phpt +++ /dev/null @@ -1,194 +0,0 @@ ---TEST-- -numfmt_get/set_attribute() icu >= 4.8 ---SKIPIF-- - - ---FILE-- - array( attr, value ) - $attributes = array( - 'PARSE_INT_ONLY' => array( NumberFormatter::PARSE_INT_ONLY, 1, 12345.123456 ), - 'GROUPING_USED' => array( NumberFormatter::GROUPING_USED, 0, 12345.123456 ), - 'DECIMAL_ALWAYS_SHOWN' => array( NumberFormatter::DECIMAL_ALWAYS_SHOWN, 1, 12345 ), - 'MAX_INTEGER_DIGITS' => array( NumberFormatter::MAX_INTEGER_DIGITS, 2, 12345.123456 ), - 'MIN_INTEGER_DIGITS' => array( NumberFormatter::MIN_INTEGER_DIGITS, 20, 12345.123456 ), - 'INTEGER_DIGITS' => array( NumberFormatter::INTEGER_DIGITS, 7, 12345.123456 ), - 'MAX_FRACTION_DIGITS' => array( NumberFormatter::MAX_FRACTION_DIGITS, 2, 12345.123456 ), - 'MIN_FRACTION_DIGITS' => array( NumberFormatter::MIN_FRACTION_DIGITS, 20, 12345.123456 ), - 'FRACTION_DIGITS' => array( NumberFormatter::FRACTION_DIGITS, 5, 12345.123456 ), - 'MULTIPLIER' => array( NumberFormatter::MULTIPLIER, 2, 12345.123456 ), - 'GROUPING_SIZE' => array( NumberFormatter::GROUPING_SIZE, 2, 12345.123456 ), - 'ROUNDING_MODE' => array( NumberFormatter::ROUNDING_MODE, 1, 12345.123456 ), - 'ROUNDING_INCREMENT' => array( NumberFormatter::ROUNDING_INCREMENT, (float)2, 12345.123456 ), - 'FORMAT_WIDTH' => array( NumberFormatter::FORMAT_WIDTH, 27, 12345.123456 ), - 'PADDING_POSITION' => array( NumberFormatter::PADDING_POSITION, 21, 12345.123456 ), - 'SECONDARY_GROUPING_SIZE' => array( NumberFormatter::SECONDARY_GROUPING_SIZE, 2, 12345.123456 ), - 'SIGNIFICANT_DIGITS_USED' => array( NumberFormatter::SIGNIFICANT_DIGITS_USED, 1, 12345.123456 ), - 'MIN_SIGNIFICANT_DIGITS' => array( NumberFormatter::MIN_SIGNIFICANT_DIGITS, 3, 1 ), - 'MAX_SIGNIFICANT_DIGITS' => array( NumberFormatter::MAX_SIGNIFICANT_DIGITS, 4, 12345.123456 ), - // 'LENIENT_PARSE' => array( NumberFormatter::LENIENT_PARSE, 2, 12345.123456 ) - ); - - $res_str = ''; - - $fmt = ut_nfmt_create( "en_US", NumberFormatter::DECIMAL ); - - foreach( $attributes as $attr_name => $args ) - { - list( $attr, $new_val, $number ) = $args; - $res_str .= "\nAttribute $attr_name\n"; - - // Get original value of the attribute. - $orig_val = ut_nfmt_get_attribute( $fmt, $attr ); - - // Format the number using the original attribute value. - $rc = ut_nfmt_format( $fmt, $number ); - - $ps = ut_nfmt_parse( $fmt, $rc ); - - $res_str .= sprintf( "Old attribute value: %s ; Format result: %s ; Parse result: %s\n", - dump( $orig_val ), - dump( $rc ), - dump( $ps ) ); - - // Set new attribute value. - $rc = ut_nfmt_set_attribute( $fmt, $attr, $new_val ); - if( $rc ) - $res_str .= "Setting attribute: ok\n"; - else - $res_str .= sprintf( "Setting attribute failed: %s\n", ut_nfmt_get_error_message( $fmt ) ); - - // Format the number using the new value. - $rc = ut_nfmt_format( $fmt, $number ); - - // Get current value of the attribute and check if it equals $new_val. - $attr_val_check = ut_nfmt_get_attribute( $fmt, $attr ); - if( $attr_val_check !== $new_val ) - $res_str .= "ERROR: New $attr_name attribute value has not been set correctly.\n"; - - $ps = ut_nfmt_parse( $fmt, $rc ); - - $res_str .= sprintf( "New attribute value: %s ; Format result: %s ; Parse result: %s\n", - dump( $new_val ), - dump( $rc ), - dump( $ps ) ); - - - // Restore original attribute of the value - if( $attr != NumberFormatter::INTEGER_DIGITS && $attr != NumberFormatter::FRACTION_DIGITS - && $attr != NumberFormatter::FORMAT_WIDTH && $attr != NumberFormatter::SIGNIFICANT_DIGITS_USED ) - ut_nfmt_set_attribute( $fmt, $attr, $orig_val ); - } - - return $res_str; -} - -include_once( 'ut_common.inc' ); - -// Run the test -ut_run(); - -?> ---EXPECT-- -Attribute PARSE_INT_ONLY -Old attribute value: 0 ; Format result: '12,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 1 ; Format result: '12,345.123' ; Parse result: 12345 - -Attribute GROUPING_USED -Old attribute value: 1 ; Format result: '12,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 0 ; Format result: '12345.123' ; Parse result: 12345.123 - -Attribute DECIMAL_ALWAYS_SHOWN -Old attribute value: 0 ; Format result: '12,345' ; Parse result: 12345 -Setting attribute: ok -New attribute value: 1 ; Format result: '12,345.' ; Parse result: 12345 - -Attribute MAX_INTEGER_DIGITS -Old attribute value: 309 ; Format result: '12,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 2 ; Format result: '45.123' ; Parse result: 45.123 - -Attribute MIN_INTEGER_DIGITS -Old attribute value: 1 ; Format result: '12,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 20 ; Format result: '00,000,000,000,000,012,345.123' ; Parse result: 12345.123 - -Attribute INTEGER_DIGITS -Old attribute value: 1 ; Format result: '12,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 7 ; Format result: '0,012,345.123' ; Parse result: 12345.123 - -Attribute MAX_FRACTION_DIGITS -Old attribute value: 3 ; Format result: '0,012,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 2 ; Format result: '0,012,345.12' ; Parse result: 12345.12 - -Attribute MIN_FRACTION_DIGITS -Old attribute value: 0 ; Format result: '0,012,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 20 ; Format result: '0,012,345.12345600000000000000' ; Parse result: 12345.123456 - -Attribute FRACTION_DIGITS -Old attribute value: 0 ; Format result: '0,012,345.123456' ; Parse result: 12345.123456 -Setting attribute: ok -New attribute value: 5 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 - -Attribute MULTIPLIER -Old attribute value: 1 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 2 ; Format result: '0,024,690.24691' ; Parse result: 12345.123455 - -Attribute GROUPING_SIZE -Old attribute value: 3 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 2 ; Format result: '0,01,23,45.12346' ; Parse result: 12345.12346 - -Attribute ROUNDING_MODE -Old attribute value: 4 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 1 ; Format result: '0,012,345.12345' ; Parse result: 12345.12345 - -Attribute ROUNDING_INCREMENT -Old attribute value: 0 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 2 ; Format result: '0,012,346.00000' ; Parse result: 12346 - -Attribute FORMAT_WIDTH -Old attribute value: 0 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 27 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 - -Attribute PADDING_POSITION -Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 21 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 - -Attribute SECONDARY_GROUPING_SIZE -Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 2 ; Format result: '************00,12,345.12346' ; Parse result: 12345.12346 - -Attribute SIGNIFICANT_DIGITS_USED -Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 1 ; Format result: '*******************12,345.1' ; Parse result: 12345.1 - -Attribute MIN_SIGNIFICANT_DIGITS -Old attribute value: 1 ; Format result: '**************************1' ; Parse result: 1 -Setting attribute: ok -New attribute value: 3 ; Format result: '***********************1.00' ; Parse result: 1 - -Attribute MAX_SIGNIFICANT_DIGITS -Old attribute value: 6 ; Format result: '*******************12,345.1' ; Parse result: 12345.1 -Setting attribute: ok -New attribute value: 4 ; Format result: '*********************12,350' ; Parse result: 12350 diff --git a/ext/intl/tests/formatter_get_set_pattern.phpt b/ext/intl/tests/formatter_get_set_pattern.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_get_set_symbol.phpt b/ext/intl/tests/formatter_get_set_symbol.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_get_set_text_attribute.phpt b/ext/intl/tests/formatter_get_set_text_attribute.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_parse.phpt b/ext/intl/tests/formatter_parse.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_parse_currency.phpt b/ext/intl/tests/formatter_parse_currency.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/grapheme.phpt b/ext/intl/tests/grapheme.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/idn.phpt b/ext/intl/tests/idn.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/intl_error_name.phpt b/ext/intl/tests/intl_error_name.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/intl_get_error_code.phpt b/ext/intl/tests/intl_get_error_code.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/intl_get_error_message.phpt b/ext/intl/tests/intl_get_error_message.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/intl_is_failure.phpt b/ext/intl/tests/intl_is_failure.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_accept.phpt b/ext/intl/tests/locale_accept.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_compose_locale.phpt b/ext/intl/tests/locale_compose_locale.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_filter_matches.phpt b/ext/intl/tests/locale_filter_matches.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_all_variants.phpt b/ext/intl/tests/locale_get_all_variants.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_default.phpt b/ext/intl/tests/locale_get_default.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_display_language.phpt b/ext/intl/tests/locale_get_display_language.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_display_name.phpt b/ext/intl/tests/locale_get_display_name.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_display_region.phpt b/ext/intl/tests/locale_get_display_region.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_display_script.phpt b/ext/intl/tests/locale_get_display_script.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_display_script2.phpt b/ext/intl/tests/locale_get_display_script2.phpt index 92652bde906d1..2b9e037b788c4 100644 --- a/ext/intl/tests/locale_get_display_script2.phpt +++ b/ext/intl/tests/locale_get_display_script2.phpt @@ -1,8 +1,8 @@ --TEST-- -locale_get_display_script() icu >= 4.8 +locale_get_display_script() icu = 4.8 --SKIPIF-- - += 0) print 'skip'; ?> --FILE-- = 49 +--SKIPIF-- + + +--FILE-- + +--EXPECT-- +locale='uk-ua_CALIFORNIA@currency=;currency=GRN' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='root' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='uk@currency=EURO' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='Hindi' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='de' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='fr' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='ja' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='i-enochian' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='zh-Hant' +disp_locale=en : display_script=Traditional Han +disp_locale=fr : display_script=chinois traditionnel +disp_locale=de : display_script=Traditionelles Chinesisch +----------------- +locale='zh-Hans' +disp_locale=en : display_script=Simplified Han +disp_locale=fr : display_script=chinois simplifié +disp_locale=de : display_script=Vereinfachtes Chinesisch +----------------- +locale='sr-Cyrl' +disp_locale=en : display_script=Cyrillic +disp_locale=fr : display_script=cyrillique +disp_locale=de : display_script=Kyrillisch +----------------- +locale='sr-Latn' +disp_locale=en : display_script=Latin +disp_locale=fr : display_script=latin +disp_locale=de : display_script=Lateinisch +----------------- +locale='zh-Hans-CN' +disp_locale=en : display_script=Simplified Han +disp_locale=fr : display_script=chinois simplifié +disp_locale=de : display_script=Vereinfachtes Chinesisch +----------------- +locale='sr-Latn-CS' +disp_locale=en : display_script=Latin +disp_locale=fr : display_script=latin +disp_locale=de : display_script=Lateinisch +----------------- +locale='sl-rozaj' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='sl-nedis' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='de-CH-1901' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='sl-IT-nedis' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='sl-Latn-IT-nedis' +disp_locale=en : display_script=Latin +disp_locale=fr : display_script=latin +disp_locale=de : display_script=Lateinisch +----------------- +locale='de-DE' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='en-US' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='es-419' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='de-CH-x-phonebk' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='az-Arab-x-AZE-derbend' +disp_locale=en : display_script=Arabic +disp_locale=fr : display_script=arabe +disp_locale=de : display_script=Arabisch +----------------- +locale='zh-min' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='zh-min-nan-Hant-CN' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='x-whatever' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='qaa-Qaaa-QM-x-southern' +disp_locale=en : display_script=Qaaa +disp_locale=fr : display_script=Qaaa +disp_locale=de : display_script=Qaaa +----------------- +locale='sr-Latn-QM' +disp_locale=en : display_script=Latin +disp_locale=fr : display_script=latin +disp_locale=de : display_script=Lateinisch +----------------- +locale='sr-Qaaa-CS' +disp_locale=en : display_script=Qaaa +disp_locale=fr : display_script=Qaaa +disp_locale=de : display_script=Qaaa +----------------- +locale='en-US-u-islamCal' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='zh-CN-a-myExt-x-private' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='en-a-myExt-b-another' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='de-419-DE' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='a-DE' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='ar-a-aaa-b-bbb-a-ccc' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- diff --git a/ext/intl/tests/locale_get_display_variant.phpt b/ext/intl/tests/locale_get_display_variant.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_keywords.phpt b/ext/intl/tests/locale_get_keywords.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_primary_language.phpt b/ext/intl/tests/locale_get_primary_language.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_region.phpt b/ext/intl/tests/locale_get_region.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_script.phpt b/ext/intl/tests/locale_get_script.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_lookup.phpt b/ext/intl/tests/locale_lookup.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_parse_locale.phpt b/ext/intl/tests/locale_parse_locale.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_set_default.phpt b/ext/intl/tests/locale_set_default.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/msgfmt_fail.phpt b/ext/intl/tests/msgfmt_fail.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/msgfmt_format.phpt b/ext/intl/tests/msgfmt_format.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/msgfmt_format_datetime.phpt b/ext/intl/tests/msgfmt_format_datetime.phpt new file mode 100644 index 0000000000000..07e7d68f144cd --- /dev/null +++ b/ext/intl/tests/msgfmt_format_datetime.phpt @@ -0,0 +1,28 @@ +--TEST-- +MessageFormatter::format(): DateTime accepted to format dates and times +--INI-- +date.timezone=Atlantic/Azores +--SKIPIF-- +format(array($dt))); + +?> +==DONE== +--EXPECTF-- +string(%s) "May %d, 2012 %d:%d:42 %s" +==DONE== diff --git a/ext/intl/tests/msgfmt_format_error1.phpt b/ext/intl/tests/msgfmt_format_error1.phpt new file mode 100644 index 0000000000000..684b05970a462 --- /dev/null +++ b/ext/intl/tests/msgfmt_format_error1.phpt @@ -0,0 +1,19 @@ +--TEST-- +MessageFormatter::format() insufficient numeric arguments +--SKIPIF-- +format(array(7))); + +--EXPECTF-- +string(5) "7 {1}" diff --git a/ext/intl/tests/msgfmt_format_error2.phpt b/ext/intl/tests/msgfmt_format_error2.phpt new file mode 100644 index 0000000000000..85d1b1c83d3df --- /dev/null +++ b/ext/intl/tests/msgfmt_format_error2.phpt @@ -0,0 +1,23 @@ +--TEST-- +MessageFormatter::format() inconsistent types in named argument +--SKIPIF-- +format(array(7))); + +--EXPECTF-- + +Warning: MessageFormatter::format(): Inconsistent types declared for an argument in %s on line %d +bool(false) diff --git a/ext/intl/tests/msgfmt_format_error3.phpt b/ext/intl/tests/msgfmt_format_error3.phpt new file mode 100644 index 0000000000000..6dfbee3c908ce --- /dev/null +++ b/ext/intl/tests/msgfmt_format_error3.phpt @@ -0,0 +1,23 @@ +--TEST-- +MessageFormatter::format() given negative arg key +--SKIPIF-- +format(array("foo" => 7, -1 => "bar"))); + +--EXPECTF-- + +Warning: MessageFormatter::format(): Found negative or too large array key in %s on line %d +bool(false) diff --git a/ext/intl/tests/msgfmt_format_error4.phpt b/ext/intl/tests/msgfmt_format_error4.phpt new file mode 100644 index 0000000000000..3b92b48b8b037 --- /dev/null +++ b/ext/intl/tests/msgfmt_format_error4.phpt @@ -0,0 +1,28 @@ +--TEST-- +MessageFormatter::format() invalid UTF-8 for arg key or value +--SKIPIF-- +format(array("foo" => 7, "\x80" => "bar"))); + +var_dump($mf->format(array("foo" => "\x80"))); + +--EXPECTF-- + +Warning: MessageFormatter::format(): Invalid UTF-8 data in argument key: '€' in %s on line %d +bool(false) + +Warning: MessageFormatter::format(): Invalid UTF-8 data in string argument: '€' in %s on line %d +bool(false) diff --git a/ext/intl/tests/msgfmt_format_error5.phpt b/ext/intl/tests/msgfmt_format_error5.phpt new file mode 100644 index 0000000000000..ebbd4550e8f46 --- /dev/null +++ b/ext/intl/tests/msgfmt_format_error5.phpt @@ -0,0 +1,26 @@ +--TEST-- +MessageFormatter::format() invalid date/time argument +--INI-- +date.timezone=Atlantic/Azores +--SKIPIF-- +format(array("foo" => new stdclass()))); + +--EXPECTF-- +Warning: MessageFormatter::format(): msgfmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted) in %s on line %d + +Warning: MessageFormatter::format(): The argument for key 'foo' cannot be used as a date or time in %s on line %d +bool(false) diff --git a/ext/intl/tests/msgfmt_format_error6.phpt b/ext/intl/tests/msgfmt_format_error6.phpt new file mode 100644 index 0000000000000..b07d2ab774843 --- /dev/null +++ b/ext/intl/tests/msgfmt_format_error6.phpt @@ -0,0 +1,23 @@ +--TEST-- +MessageFormatter::format() invalid type for key not in pattern +--SKIPIF-- +format(array("foo" => 'bar', 7 => fopen('php://memory', 'r+')))); + +--EXPECTF-- + +Warning: MessageFormatter::format(): No strategy to convert the value given for the argument with key '7' is available in %s on line %d +bool(false) diff --git a/ext/intl/tests/msgfmt_format_intlcalendar.phpt b/ext/intl/tests/msgfmt_format_intlcalendar.phpt new file mode 100644 index 0000000000000..6ae78a91400c0 --- /dev/null +++ b/ext/intl/tests/msgfmt_format_intlcalendar.phpt @@ -0,0 +1,30 @@ +--TEST-- +MessageFormat accepts IntlCalendar args +--SKIPIF-- +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 p.m. WEST +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/msgfmt_format_mixed_params.phpt b/ext/intl/tests/msgfmt_format_mixed_params.phpt new file mode 100644 index 0000000000000..93412f49e22a1 --- /dev/null +++ b/ext/intl/tests/msgfmt_format_mixed_params.phpt @@ -0,0 +1,25 @@ +--TEST-- +MessageFormatter::format(): mixed named and numeric parameters +--SKIPIF-- +format(array(2.3, "foo" => 1.3))); +var_dump($mf->format(array("foo" => 1.3, 0 => 2.3))); + +?> +==DONE== +--EXPECT-- +string(10) "2.3 -- 1st" +string(10) "2.3 -- 1st" +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/msgfmt_format_simple_types_numeric_strings.phpt b/ext/intl/tests/msgfmt_format_simple_types_numeric_strings.phpt new file mode 100644 index 0000000000000..299ae483a49b4 --- /dev/null +++ b/ext/intl/tests/msgfmt_format_simple_types_numeric_strings.phpt @@ -0,0 +1,58 @@ +--TEST-- +MessageFormatter::format(): simple types handling with numeric strings +--INI-- +date.timezone=Atlantic/Azores +--SKIPIF-- +format(array( +'a' => $ex, +'b' => $ex, +'c' => $ex, +'d' => $ex, +'e' => $ex, +'f' => " 1336317965.5", +'g' => " 1336317965.5", +'h' => $ex, +'i' => $ex, +'j' => $ex, +))); + +?> +==DONE== +--EXPECTF-- +string(%d) " + none 1336317965.5 str + number 1,336,317,965.5 + number integer 1,336,317,965 + number currency $1,336,317,965.50 + number percent 133,631,796,550% + date May %d, 2012 + time %d:%d:05 PM + spellout one billion three hundred thirty-six million three hundred seventeen thousand nine hundred sixty-five point five + ordinal 1,336,317,966th + duration 371,199:26:06 + " +==DONE== diff --git a/ext/intl/tests/msgfmt_format_subpatterns.phpt b/ext/intl/tests/msgfmt_format_subpatterns.phpt new file mode 100644 index 0000000000000..9f11e3e255443 --- /dev/null +++ b/ext/intl/tests/msgfmt_format_subpatterns.phpt @@ -0,0 +1,75 @@ +--TEST-- +msgfmt_format() with subpatterns +--SKIPIF-- + +--EXPECT-- +'Alice does not give a party.' +'Alice does not give a party.' +'Alice invites Bob to his party.' +'Alice invites Bob to his party.' +'Alice invites Bob and one other person to their party.' +'Alice invites Bob and one other person to their party.' +'Alice invites Bob as one of the 26 people invited to her party.' +'Alice invites Bob as one of the 26 people invited to her party.' diff --git a/ext/intl/tests/msgfmt_format_subpatterns_named.phpt b/ext/intl/tests/msgfmt_format_subpatterns_named.phpt new file mode 100644 index 0000000000000..f6af02561bc99 --- /dev/null +++ b/ext/intl/tests/msgfmt_format_subpatterns_named.phpt @@ -0,0 +1,75 @@ +--TEST-- +msgfmt_format() with named subpatterns +--SKIPIF-- + 'female', 'num_guests' => 0, 'host' => 'Alice', 'guest' => 'Bob'), + array('gender_of_host' => 'male', 'num_guests' => 1, 'host' => 'Alice', 'guest' => 'Bob'), + array('gender_of_host' => 'none', 'num_guests' => 2, 'host' => 'Alice', 'guest' => 'Bob'), + array('gender_of_host' => 'female', 'num_guests' => 27, 'host' => 'Alice', 'guest' => 'Bob'), +); + +$str_res = ''; + + $fmt = ut_msgfmt_create( 'en_US', $pattern ); + if(!$fmt) { + $str_res .= dump(intl_get_error_message())."\n"; + return $str_res; + } + foreach ($args as $arg) { + $str_res .= dump( ut_msgfmt_format($fmt, $arg) ). "\n"; + $str_res .= dump( ut_msgfmt_format_message('en_US', $pattern, $arg) ) . "\n"; + } + return $str_res; +} + +include_once( 'ut_common.inc' ); + +// Run the test +ut_run(); + +?> +--EXPECT-- +'Alice does not give a party.' +'Alice does not give a party.' +'Alice invites Bob to his party.' +'Alice invites Bob to his party.' +'Alice invites Bob and one other person to their party.' +'Alice invites Bob and one other person to their party.' +'Alice invites Bob as one of the 26 people invited to her party.' +'Alice invites Bob as one of the 26 people invited to her party.' diff --git a/ext/intl/tests/msgfmt_get_error.phpt b/ext/intl/tests/msgfmt_get_error.phpt deleted file mode 100755 index 015c50d465952..0000000000000 --- a/ext/intl/tests/msgfmt_get_error.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -msgmfmt_get_error_message/code() ---SKIPIF-- - ---FILE-- -getErrorMessage() . " (" . $fmt->getErrorCode() . ")\n"; - else - return "Ooops, an error should have occured."; -} - -include_once( 'ut_common.inc' ); - -// Run the test -ut_run(); -?> ---EXPECT-- -msgfmt_format: not enough parameters: U_ILLEGAL_ARGUMENT_ERROR (1) diff --git a/ext/intl/tests/msgfmt_get_locale.phpt b/ext/intl/tests/msgfmt_get_locale.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/msgfmt_get_set_pattern.phpt b/ext/intl/tests/msgfmt_get_set_pattern.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/msgfmt_millisecond_dates.phpt b/ext/intl/tests/msgfmt_millisecond_dates.phpt new file mode 100644 index 0000000000000..7dd051426b272 --- /dev/null +++ b/ext/intl/tests/msgfmt_millisecond_dates.phpt @@ -0,0 +1,29 @@ +--TEST-- +MessageFrormatter parses and formats dates with millisecond precision +--SKIPIF-- +format(array(1336310569.123))); + +$p = 'On 2012-05-06 AD at 15:22:49.123 GMT+02:00 something odd happened'; +var_dump($mf->parse($p)); + +?> +==DONE== +--EXPECTF-- +string(%d) "On 2012-05-0%d AD at %d:%d:49.123 %s something odd happened" +array(1) { + [0]=> + float(1336310569.123) +} +==DONE== diff --git a/ext/intl/tests/msgfmt_parse.phpt b/ext/intl/tests/msgfmt_parse.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/msgfmt_setPattern_cache.phpt b/ext/intl/tests/msgfmt_setPattern_cache.phpt new file mode 100644 index 0000000000000..35ec463c2a7a7 --- /dev/null +++ b/ext/intl/tests/msgfmt_setPattern_cache.phpt @@ -0,0 +1,26 @@ +--TEST-- +MessageFormatter::setPattern() invalidates arg types cache +--SKIPIF-- +format(array(1.3, 1.3))); +var_dump($mf->format(array(1.3, 1.3))); +$mf->setPattern("{0,ordinal} -- {1,number}"); +var_dump($mf->format(array(1.3, 1.3))); + +?> +==DONE== +--EXPECT-- +string(10) "1.3 -- 1st" +string(10) "1.3 -- 1st" +string(10) "1st -- 1.3" +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/normalizer_normalize.phpt b/ext/intl/tests/normalizer_normalize.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/rbbiter___construct_basic.phpt b/ext/intl/tests/rbbiter___construct_basic.phpt new file mode 100644 index 0000000000000..2b14d826e378e --- /dev/null +++ b/ext/intl/tests/rbbiter___construct_basic.phpt @@ -0,0 +1,27 @@ +--TEST-- +IntlRuleBasedBreakIterator::__construct: basic test +--FILE-- + +==DONE== +--EXPECT-- +string(26) "IntlRuleBasedBreakIterator" +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/rbbiter_getBinaryRules_basic.phpt b/ext/intl/tests/rbbiter_getBinaryRules_basic.phpt new file mode 100644 index 0000000000000..dce0714d4dd4f --- /dev/null +++ b/ext/intl/tests/rbbiter_getBinaryRules_basic.phpt @@ -0,0 +1,39 @@ +--TEST-- +IntlRuleBasedBreakIterator::getBinaryRules(): basic test +--SKIPIF-- + += 4.8 only'; ?> +--FILE-- +setText('sdfkjsdf88á.... ,;');; + +$br = $rbbi->getBinaryRules(); + +$rbbi2 = new IntlRuleBasedBreakIterator($br, true); + +var_dump($rbbi->getRules(), $rbbi2->getRules()); +var_dump($rbbi->getRules() == $rbbi2->getRules()); +?> +==DONE== +--EXPECT-- +string(128) "$LN = [[:letter:] [:number:]];$S = [.;,:];!!forward;$LN+ {1};$S+ {42};!!reverse;$LN+ {1};$S+ {42};!!safe_forward;!!safe_reverse;" +string(128) "$LN = [[:letter:] [:number:]];$S = [.;,:];!!forward;$LN+ {1};$S+ {42};!!reverse;$LN+ {1};$S+ {42};!!safe_forward;!!safe_reverse;" +bool(true) +==DONE== diff --git a/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt b/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt new file mode 100644 index 0000000000000..a4f3352f9a28e --- /dev/null +++ b/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt @@ -0,0 +1,55 @@ +--TEST-- +IntlRuleBasedBreakIterator::getRuleStatusVec(): basic test +--FILE-- +setText('sdfkjsdf88á.... ,;');; + +do { + var_dump($rbbi->current(), $rbbi->getRuleStatusVec()); +} while ($rbbi->next() != IntlBreakIterator::DONE); + +?> +==DONE== +--EXPECT-- +int(0) +array(1) { + [0]=> + int(0) +} +int(12) +array(2) { + [0]=> + int(1) + [1]=> + int(4) +} +int(16) +array(1) { + [0]=> + int(42) +} +int(19) +array(1) { + [0]=> + int(4) +} +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt b/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt new file mode 100644 index 0000000000000..6199fdee7c271 --- /dev/null +++ b/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt @@ -0,0 +1,42 @@ +--TEST-- +IntlRuleBasedBreakIterator::getRuleStatus(): basic test +--FILE-- +setText('sdfkjsdf88á.... ,;'); + +do { + echo "pos : {$rbbi->current()}\n", + "rule status: {$rbbi->getRuleStatus()}\n"; +} while ($rbbi->next() != IntlBreakIterator::DONE); + +?> +==DONE== +--EXPECT-- +pos : 0 +rule status: 0 +pos : 12 +rule status: 1 +pos : 16 +rule status: 42 +pos : 17 +rule status: 0 +pos : 19 +rule status: 42 +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/rbbiter_getRules_basic.phpt b/ext/intl/tests/rbbiter_getRules_basic.phpt new file mode 100644 index 0000000000000..e115e9b9e2aec --- /dev/null +++ b/ext/intl/tests/rbbiter_getRules_basic.phpt @@ -0,0 +1,28 @@ +--TEST-- +IntlRuleBasedBreakIterator::getRules(): basic test +--FILE-- +getRules()); + +?> +==DONE== +--EXPECT-- +string(128) "$LN = [[:letter:] [:number:]];$S = [.;,:];!!forward;$LN+ {1};$S+ {42};!!reverse;$LN+ {1};$S+ {42};!!safe_forward;!!safe_reverse;" +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/regression_sort_and_cow.phpt b/ext/intl/tests/regression_sort_and_cow.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/regression_sort_eq.phpt b/ext/intl/tests/regression_sort_eq.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/regression_sortwsk_and_cow.phpt b/ext/intl/tests/regression_sortwsk_and_cow.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/regression_sortwsk_eq.phpt b/ext/intl/tests/regression_sortwsk_eq.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/resourcebundle.build b/ext/intl/tests/resourcebundle.build old mode 100755 new mode 100644 diff --git a/ext/intl/tests/resourcebundle_locales.phpt b/ext/intl/tests/resourcebundle_locales.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/resourcebundle_null_mandatory_args.phpt b/ext/intl/tests/resourcebundle_null_mandatory_args.phpt new file mode 100644 index 0000000000000..17fab6d630a5e --- /dev/null +++ b/ext/intl/tests/resourcebundle_null_mandatory_args.phpt @@ -0,0 +1,28 @@ +--TEST-- +ResourceBundle constructor bundle accepts NULL for first two arguments +--INI-- +date.timezone=Atlantic/Azores +--SKIPIF-- += 4.8 only'); +--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(12) "H:mm:ss zzzz" +==DONE== diff --git a/ext/intl/tests/resourcebundle_traversable.phpt b/ext/intl/tests/resourcebundle_traversable.phpt new file mode 100644 index 0000000000000..1e6af7b909ac7 --- /dev/null +++ b/ext/intl/tests/resourcebundle_traversable.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #55610: ResourceBundle does not implement Traversable +--SKIPIF-- + +--FILE-- +get('testarray'))); +?> +--EXPECTF-- +bool(true) +array(3) { + [0]=> + string(8) "cadena 1" + [1]=> + string(8) "cadena 2" + [2]=> + string(8) "cadena 3" +} diff --git a/ext/intl/tests/spoofchecker_001.phpt b/ext/intl/tests/spoofchecker_001.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/spoofchecker_002.phpt b/ext/intl/tests/spoofchecker_002.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/spoofchecker_003.phpt b/ext/intl/tests/spoofchecker_003.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/spoofchecker_004.phpt b/ext/intl/tests/spoofchecker_004.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/symfony_format_type_int32_intl1.phpt b/ext/intl/tests/symfony_format_type_int32_intl1.phpt new file mode 100644 index 0000000000000..2867b35690b9f --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int32_intl1.phpt @@ -0,0 +1,49 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #1 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + int(1) + [2]=> + string(1) "1" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int32_intl2.phpt b/ext/intl/tests/symfony_format_type_int32_intl2.phpt new file mode 100644 index 0000000000000..6a65a0a809241 --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int32_intl2.phpt @@ -0,0 +1,33 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #2 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(1.1) + [2]=> + string(1) "1" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int32_intl3.phpt b/ext/intl/tests/symfony_format_type_int32_intl3.phpt new file mode 100644 index 0000000000000..5e657db419b9d --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int32_intl3.phpt @@ -0,0 +1,32 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #3 +--SKIPIF-- + +--FILE-- +format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt32Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(4) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(2147483648) + [2]=> + string(14) "-2,147,483,648" + [3]=> + string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range." +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int32_intl4.phpt b/ext/intl/tests/symfony_format_type_int32_intl4.phpt new file mode 100644 index 0000000000000..54043d92e921b --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int32_intl4.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #4 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + int(1) + [2]=> + string(7) "SFD1.00" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int32_intl5.phpt b/ext/intl/tests/symfony_format_type_int32_intl5.phpt new file mode 100644 index 0000000000000..d5f78d7119bcf --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int32_intl5.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #5 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(1.1) + [2]=> + string(7) "SFD1.00" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int32_intl6.phpt b/ext/intl/tests/symfony_format_type_int32_intl6.phpt new file mode 100644 index 0000000000000..fa708799d1310 --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int32_intl6.phpt @@ -0,0 +1,32 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #6 +--SKIPIF-- + +--FILE-- +format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt32Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(4) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(2147483648) + [2]=> + string(21) "(SFD2,147,483,648.00)" + [3]=> + string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range." +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int32_intl7.phpt b/ext/intl/tests/symfony_format_type_int32_intl7.phpt new file mode 100644 index 0000000000000..5bbe4266770a0 --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int32_intl7.phpt @@ -0,0 +1,32 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #7 +--SKIPIF-- + +--FILE-- +format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt32Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(4) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(-2147483649) + [2]=> + string(19) "SFD2,147,483,647.00" + [3]=> + string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range." +} +== didn't crash == diff --git a/ext/intl/tests/timezone_fromDateTimeZone_basic.phpt b/ext/intl/tests/timezone_fromDateTimeZone_basic.phpt new file mode 100644 index 0000000000000..10e2621ae4a21 --- /dev/null +++ b/ext/intl/tests/timezone_fromDateTimeZone_basic.phpt @@ -0,0 +1,41 @@ +--TEST-- +IntlTimeZone::fromDateTimeZone(): basic test +--SKIPIF-- +getID(), $tz->getRawOffset()); + + +$dt = new DateTime('2012-01-01 00:00:00 CET'); +$dtz = $dt->getTimeZone(); +/* this is different from new DateTimeZone('CET'), + * which gives a Europe/Berlin timezone */ +var_dump($dtz->getName()); +$tz = IntlTimeZone::fromDateTimeZone($dtz); +var_dump($tz->getID(), $tz->getRawOffset()); + + +$dt = new DateTime('2012-01-01 00:00:00 +0340'); +$dtz = $dt->getTimeZone(); +/* I don't think this timezone can be generated without a DateTime object */ +var_dump($dtz->getName()); +$tz = IntlTimeZone::fromDateTimeZone($dtz); +var_dump($tz->getID(), $tz->getRawOffset() /* (3*60+40)*60000 */); + +--EXPECTF-- +string(16) "Europe/Amsterdam" +int(3600000) +string(3) "CET" +string(3) "CET" +int(3600000) +string(6) "+03:40" +string(%d) "GMT+03%s0" +int(13200000) diff --git a/ext/intl/tests/timezone_fromDateTimeZone_error.phpt b/ext/intl/tests/timezone_fromDateTimeZone_error.phpt new file mode 100644 index 0000000000000..031882277e6d3 --- /dev/null +++ b/ext/intl/tests/timezone_fromDateTimeZone_error.phpt @@ -0,0 +1,50 @@ +--TEST-- +IntlTimeZone::fromDateTimeZone(): argument errors +--INI-- +date.timezone=Atlantic/Azores +--SKIPIF-- +getTimeZone())); + +var_dump(intltz_from_date_time_zone()); + +--EXPECTF-- + +Warning: IntlTimeZone::fromDateTimeZone() expects exactly 1 parameter, 0 given in %s on line %d + +Warning: IntlTimeZone::fromDateTimeZone(): intltz_from_date_time_zone: bad arguments in %s on line %d +NULL + +Warning: IntlTimeZone::fromDateTimeZone() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: IntlTimeZone::fromDateTimeZone(): intltz_from_date_time_zone: bad arguments in %s on line %d +NULL + +Warning: IntlTimeZone::fromDateTimeZone() expects parameter 1 to be DateTimeZone, string given in %s on line %d + +Warning: IntlTimeZone::fromDateTimeZone(): intltz_from_date_time_zone: bad arguments in %s on line %d +NULL + +Warning: IntlTimeZone::fromDateTimeZone() expects parameter 1 to be DateTimeZone, object given in %s on line %d + +Warning: IntlTimeZone::fromDateTimeZone(): intltz_from_date_time_zone: bad arguments in %s on line %d +NULL + +Warning: IntlTimeZone::fromDateTimeZone(): intltz_from_date_time_zone: time zone id 'WEST' extracted from ext/date DateTimeZone not recognized in %s on line %d +NULL + +Warning: intltz_from_date_time_zone() expects exactly 1 parameter, 0 given in %s on line %d + +Warning: intltz_from_date_time_zone(): intltz_from_date_time_zone: bad arguments in %s on line %d +NULL diff --git a/ext/intl/tests/timezone_toDateTimeZone_basic.phpt b/ext/intl/tests/timezone_toDateTimeZone_basic.phpt new file mode 100644 index 0000000000000..d22aa689dc9f8 --- /dev/null +++ b/ext/intl/tests/timezone_toDateTimeZone_basic.phpt @@ -0,0 +1,38 @@ +--TEST-- +IntlTimeZone::toDateTimeZone(): basic test +--SKIPIF-- +getID(), $tz->getRawOffset()); + if (!$proc) + $dtz = $tz->toDateTimeZone(); + else + $dtz = intltz_to_date_time_zone($tz); + var_dump($dtz->getName(), $dtz->getOffset(new DateTime('2012-01-01 00:00:00'))); +} + +do_test(IntlTimeZone::createTimeZone('CET')); +do_test(IntlTimeZone::createTimeZone('Europe/Amsterdam')); +do_test(IntlTimeZone::createTimeZone('GMT+0405'), true); + +--EXPECTF-- +string(3) "CET" +int(3600000) +string(13) "Europe/Berlin" +int(3600) +string(16) "Europe/Amsterdam" +int(3600000) +string(16) "Europe/Amsterdam" +int(3600) +string(%s) "GMT+04%s5" +int(14700000) +string(6) "+04:05" +int(14700) diff --git a/ext/intl/tests/timezone_toDateTimeZone_error.phpt b/ext/intl/tests/timezone_toDateTimeZone_error.phpt new file mode 100644 index 0000000000000..e48d7aca92135 --- /dev/null +++ b/ext/intl/tests/timezone_toDateTimeZone_error.phpt @@ -0,0 +1,38 @@ +--TEST-- +IntlTimeZone::toDateTimeZone(): errors +--SKIPIF-- +toDateTimeZone('')); +try { + var_dump($tz->toDateTimeZone()); +} catch (Exception $e) { + var_dump($e->getMessage()); +} + +var_dump(intltz_to_date_time_zone()); +var_dump(intltz_to_date_time_zone(1)); + +--EXPECTF-- + +Warning: IntlTimeZone::toDateTimeZone() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: IntlTimeZone::toDateTimeZone(): intltz_to_date_time_zone: bad arguments in %s on line %d +bool(false) + +Warning: IntlTimeZone::toDateTimeZone(): intltz_to_date_time_zone: DateTimeZone constructor threw exception in %s on line %d +string(66) "DateTimeZone::__construct(): Unknown or bad timezone (Etc/Unknown)" + +Warning: intltz_to_date_time_zone() expects exactly 1 parameter, 0 given in %s on line %d + +Warning: intltz_to_date_time_zone(): intltz_to_date_time_zone: bad arguments in %s on line %d +bool(false) + +Catchable fatal error: Argument 1 passed to intltz_to_date_time_zone() must be an instance of IntlTimeZone, integer given in %s on line %d diff --git a/ext/intl/tests/ut_common.inc b/ext/intl/tests/ut_common.inc old mode 100755 new mode 100644 diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp index ad9e6fd8397c4..27cf41a4cf4e9 100644 --- a/ext/intl/timezone/timezone_class.cpp +++ b/ext/intl/timezone/timezone_class.cpp @@ -19,18 +19,21 @@ #include "config.h" #endif +#include "../intl_cppshims.h" + #include #include #include "../intl_convertcpp.h" +#include "../common/common_date.h" + extern "C" { #include "../intl_convert.h" #define USE_TIMEZONE_POINTER 1 #include "timezone_class.h" #include "timezone_methods.h" #include -/* avoid redefinition of int8_t, already defined in unicode/pwin32.h */ -#define _MSC_STDINT_H_ 1 +#include #include } @@ -53,10 +56,82 @@ U_CFUNC void timezone_object_construct(const TimeZone *zone, zval *object, int o } /* }}} */ +/* {{{ timezone_convert_to_datetimezone + * Convert from TimeZone to DateTimeZone object */ +U_CFUNC zval *timezone_convert_to_datetimezone(const TimeZone *timeZone, + intl_error *outside_error, + const char *func TSRMLS_DC) +{ + zval *ret = NULL; + UnicodeString id; + char *message = NULL; + php_timezone_obj *tzobj; + zval arg = zval_used_for_init; + + timeZone->getID(id); + if (id.isBogus()) { + spprintf(&message, 0, "%s: could not obtain TimeZone id", func); + intl_errors_set(outside_error, U_ILLEGAL_ARGUMENT_ERROR, + message, 1 TSRMLS_CC); + goto error; + } + + MAKE_STD_ZVAL(ret); + object_init_ex(ret, php_date_get_timezone_ce()); + tzobj = (php_timezone_obj *)zend_objects_get_address(ret TSRMLS_CC); + + if (id.compare(0, 3, UnicodeString("GMT", sizeof("GMT")-1, US_INV)) == 0) { + /* The DateTimeZone constructor doesn't support offset time zones, + * so we must mess with DateTimeZone structure ourselves */ + tzobj->initialized = 1; + tzobj->type = TIMELIB_ZONETYPE_OFFSET; + //convert offset from milliseconds to minutes + tzobj->tzi.utc_offset = -1 * timeZone->getRawOffset() / (60 * 1000); + } else { + /* Call the constructor! */ + Z_TYPE(arg) = IS_STRING; + if (intl_charFromString(id, &Z_STRVAL(arg), &Z_STRLEN(arg), + &INTL_ERROR_CODE(*outside_error)) == FAILURE) { + spprintf(&message, 0, "%s: could not convert id to UTF-8", func); + intl_errors_set(outside_error, INTL_ERROR_CODE(*outside_error), + message, 1 TSRMLS_CC); + goto error; + } + zend_call_method_with_1_params(&ret, NULL, NULL, "__construct", + NULL, &arg); + if (EG(exception)) { + spprintf(&message, 0, + "%s: DateTimeZone constructor threw exception", func); + intl_errors_set(outside_error, U_ILLEGAL_ARGUMENT_ERROR, + message, 1 TSRMLS_CC); + zend_object_store_ctor_failed(ret TSRMLS_CC); + goto error; + } + } + + if (0) { +error: + if (ret) { + zval_ptr_dtor(&ret); + } + ret = NULL; + } + + if (message) { + efree(message); + } + if (Z_TYPE(arg) == IS_STRING) { + zval_dtor(&arg); + } + return ret; +} +/* }}} */ + /* {{{ timezone_process_timezone_argument - * TimeZone argument processor for constructor like functions (sets the global - * error). */ -TimeZone *timezone_process_timezone_argument(zval **zv_timezone, const char *func TSRMLS_DC) + * TimeZone argument processor. outside_error may be NULL (for static functions/constructors) */ +U_CFUNC TimeZone *timezone_process_timezone_argument(zval **zv_timezone, + intl_error *outside_error, + const char *func TSRMLS_DC) { zval local_zv_tz = zval_used_for_init, *local_zv_tz_p = &local_zv_tz; @@ -77,7 +152,7 @@ TimeZone *timezone_process_timezone_argument(zval **zv_timezone, const char *fun spprintf(&message, 0, "%s: passed IntlTimeZone is not " "properly constructed", func); if (message) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); + intl_errors_set(outside_error, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); efree(message); } return NULL; @@ -86,22 +161,30 @@ TimeZone *timezone_process_timezone_argument(zval **zv_timezone, const char *fun if (timeZone == NULL) { spprintf(&message, 0, "%s: could not clone TimeZone", func); if (message) { - intl_error_set(NULL, U_MEMORY_ALLOCATION_ERROR, message, 1 TSRMLS_CC); + intl_errors_set(outside_error, U_MEMORY_ALLOCATION_ERROR, message, 1 TSRMLS_CC); efree(message); } return NULL; } + } else if (Z_TYPE_PP(zv_timezone) == IS_OBJECT && + instanceof_function(Z_OBJCE_PP(zv_timezone), php_date_get_timezone_ce() TSRMLS_CC)) { + + php_timezone_obj *tzobj = (php_timezone_obj *)zend_objects_get_address( + *zv_timezone TSRMLS_CC); + + return timezone_convert_datetimezone(tzobj->type, tzobj, 0, + outside_error, func TSRMLS_CC); } else { UnicodeString id, gottenId; - UErrorCode status = U_ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* outside_error may be NULL */ convert_to_string_ex(zv_timezone); if (intl_stringFromChar(id, Z_STRVAL_PP(zv_timezone), Z_STRLEN_PP(zv_timezone), &status) == FAILURE) { spprintf(&message, 0, "%s: Time zone identifier given is not a " "valid UTF-8 string", func); if (message) { - intl_error_set(NULL, status, message, 1 TSRMLS_CC); + intl_errors_set(outside_error, status, message, 1 TSRMLS_CC); efree(message); } return NULL; @@ -110,7 +193,7 @@ TimeZone *timezone_process_timezone_argument(zval **zv_timezone, const char *fun if (timeZone == NULL) { spprintf(&message, 0, "%s: could not create time zone", func); if (message) { - intl_error_set(NULL, U_MEMORY_ALLOCATION_ERROR, message, 1 TSRMLS_CC); + intl_errors_set(outside_error, U_MEMORY_ALLOCATION_ERROR, message, 1 TSRMLS_CC); efree(message); } return NULL; @@ -119,7 +202,7 @@ TimeZone *timezone_process_timezone_argument(zval **zv_timezone, const char *fun spprintf(&message, 0, "%s: no such time zone: '%s'", func, Z_STRVAL_PP(zv_timezone)); if (message) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); + intl_errors_set(outside_error, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); efree(message); } delete timeZone; @@ -241,8 +324,6 @@ static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp TSRMLS_DC) add_assoc_long_ex(&zv, "currentOffset", sizeof("currentOffset"), (long)(rawOffset + dstOffset)); - *is_temp = 1; - return Z_ARRVAL(zv); } /* }}} */ @@ -318,6 +399,10 @@ ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_idarg, 0, 0, 1) ZEND_ARG_INFO(0, zoneId) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_fromDateTimeZone, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, otherTimeZone, IntlTimeZone, 0) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_createEnumeration, 0, 0, 0) ZEND_ARG_INFO(0, countryOrRawOffset) ZEND_END_ARG_INFO() @@ -368,7 +453,9 @@ ZEND_END_ARG_INFO() * Every 'IntlTimeZone' class method has an entry in this table */ static zend_function_entry TimeZone_class_functions[] = { + PHP_ME(IntlTimeZone, __construct, ainfo_tz_void, ZEND_ACC_PRIVATE) PHP_ME_MAPPING(createTimeZone, intltz_create_time_zone, ainfo_tz_idarg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + PHP_ME_MAPPING(fromDateTimeZone, intltz_from_date_time_zone, ainfo_tz_idarg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME_MAPPING(createDefault, intltz_create_default, ainfo_tz_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME_MAPPING(getGMT, intltz_get_gmt, ainfo_tz_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) #if U_ICU_VERSION_MAJOR_NUM >= 49 @@ -393,6 +480,7 @@ static zend_function_entry TimeZone_class_functions[] = { PHP_ME_MAPPING(hasSameRules, intltz_has_same_rules, ainfo_tz_hasSameRules, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getDisplayName, intltz_get_display_name, ainfo_tz_getDisplayName, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getDSTSavings, intltz_get_dst_savings, ainfo_tz_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(toDateTimeZone, intltz_to_date_time_zone, ainfo_tz_void, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getErrorCode, intltz_get_error_code, ainfo_tz_void, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getErrorMessage, intltz_get_error_message, ainfo_tz_void, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/intl/timezone/timezone_class.h b/ext/intl/timezone/timezone_class.h index 89d694621f9bb..a638f6dbf49ef 100644 --- a/ext/intl/timezone/timezone_class.h +++ b/ext/intl/timezone/timezone_class.h @@ -59,7 +59,8 @@ typedef struct { RETURN_FALSE; \ } -TimeZone *timezone_process_timezone_argument(zval **zv_timezone, const char *func TSRMLS_DC); +zval *timezone_convert_to_datetimezone(const TimeZone *timeZone, intl_error *outside_error, const char *func TSRMLS_DC); +TimeZone *timezone_process_timezone_argument(zval **zv_timezone, intl_error *error, const char *func TSRMLS_DC); void timezone_object_construct(const TimeZone *zone, zval *object, int owned TSRMLS_DC); diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp index eaa6b46e3940b..9ca6b44c896d7 100644 --- a/ext/intl/timezone/timezone_methods.cpp +++ b/ext/intl/timezone/timezone_methods.cpp @@ -18,19 +18,32 @@ #include "config.h" #endif +#include "../intl_cppshims.h" + #include #include #include #include "intl_convertcpp.h" + +#include "../common/common_date.h" + extern "C" { +#include "../php_intl.h" #define USE_TIMEZONE_POINTER 1 #include "timezone_class.h" #include "intl_convert.h" -#include "../locale/locale.h" #include +#include } #include "common/common_enum.h" +U_CFUNC PHP_METHOD(IntlTimeZone, __construct) +{ + zend_throw_exception( NULL, + "An object of this type cannot be created with the new operator", + 0 TSRMLS_CC ); +} + U_CFUNC PHP_FUNCTION(intltz_create_time_zone) { char *str_id; @@ -57,6 +70,37 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone) timezone_object_construct(tz, return_value, 1 TSRMLS_CC); } +U_CFUNC PHP_FUNCTION(intltz_from_date_time_zone) +{ + zval *zv_timezone; + TimeZone *tz; + php_timezone_obj *tzobj; + intl_error_reset(NULL TSRMLS_CC); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", + &zv_timezone, php_date_get_timezone_ce()) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "intltz_from_date_time_zone: bad arguments", 0 TSRMLS_CC); + RETURN_NULL(); + } + + tzobj = (php_timezone_obj *)zend_objects_get_address(zv_timezone TSRMLS_CC); + if (!tzobj->initialized) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "intltz_from_date_time_zone: DateTimeZone object is unconstructed", + 0 TSRMLS_CC); + RETURN_NULL(); + } + + tz = timezone_convert_datetimezone(tzobj->type, tzobj, FALSE, NULL, + "intltz_from_date_time_zone" TSRMLS_CC); + if (tz == NULL) { + RETURN_NULL(); + } + + timezone_object_construct(tz, return_value, 1 TSRMLS_CC); +} + U_CFUNC PHP_FUNCTION(intltz_create_default) { intl_error_reset(NULL TSRMLS_CC); @@ -549,6 +593,29 @@ U_CFUNC PHP_FUNCTION(intltz_get_dst_savings) RETURN_LONG((long)to->utimezone->getDSTSavings()); } +U_CFUNC PHP_FUNCTION(intltz_to_date_time_zone) +{ + TIMEZONE_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), + "O", &object, TimeZone_ce_ptr) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "intltz_to_date_time_zone: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + TIMEZONE_METHOD_FETCH_OBJECT; + + zval *ret = timezone_convert_to_datetimezone(to->utimezone, + &TIMEZONE_ERROR(to), "intltz_to_date_time_zone" TSRMLS_CC); + + if (ret) { + RETURN_ZVAL(ret, 1, 1); + } else { + RETURN_FALSE; + } +} + U_CFUNC PHP_FUNCTION(intltz_get_error_code) { TIMEZONE_METHOD_INIT_VARS diff --git a/ext/intl/timezone/timezone_methods.h b/ext/intl/timezone/timezone_methods.h index 207caa3cb065c..28c39f4fd703b 100644 --- a/ext/intl/timezone/timezone_methods.h +++ b/ext/intl/timezone/timezone_methods.h @@ -19,8 +19,12 @@ #include +PHP_METHOD(IntlTimeZone, __construct); + PHP_FUNCTION(intltz_create_time_zone); +PHP_FUNCTION(intltz_from_date_time_zone); + PHP_FUNCTION(intltz_create_default); PHP_FUNCTION(intltz_get_id); @@ -55,6 +59,8 @@ PHP_FUNCTION(intltz_get_display_name); PHP_FUNCTION(intltz_get_dst_savings); +PHP_FUNCTION(intltz_to_date_time_zone); + PHP_FUNCTION(intltz_get_error_code); PHP_FUNCTION(intltz_get_error_message); diff --git a/ext/intl/transliterator/transliterator.c b/ext/intl/transliterator/transliterator.c index 75c9eaabdaa50..8ee49e1e51bbd 100644 --- a/ext/intl/transliterator/transliterator.c +++ b/ext/intl/transliterator/transliterator.c @@ -49,85 +49,6 @@ void transliterator_register_constants( INIT_FUNC_ARGS ) } /* }}} */ -/* {{{ transliterator_parse_error_to_string - * Transforms parse errors in strings. - */ -smart_str transliterator_parse_error_to_string( UParseError* pe ) -{ - smart_str ret = {0}; - char *buf; - int u8len; - UErrorCode status; - int any = 0; - - assert( pe != NULL ); - - smart_str_appends( &ret, "parse error " ); - if( pe->line > 0 ) - { - smart_str_appends( &ret, "on line " ); - smart_str_append_long( &ret, (long ) pe->line ); - any = 1; - } - if( pe->offset >= 0 ) { - if( any ) - smart_str_appends( &ret, ", " ); - else - smart_str_appends( &ret, "at " ); - - smart_str_appends( &ret, "offset " ); - smart_str_append_long( &ret, (long ) pe->offset ); - any = 1; - } - - if (pe->preContext[0] != 0 ) { - if( any ) - smart_str_appends( &ret, ", " ); - - smart_str_appends( &ret, "after \"" ); - intl_convert_utf16_to_utf8( &buf, &u8len, pe->preContext, -1, &status ); - if( U_FAILURE( status ) ) - { - smart_str_appends( &ret, "(could not convert parser error pre-context to UTF-8)" ); - } - else { - smart_str_appendl( &ret, buf, u8len ); - efree( buf ); - } - smart_str_appends( &ret, "\"" ); - any = 1; - } - - if( pe->postContext[0] != 0 ) - { - if( any ) - smart_str_appends( &ret, ", " ); - - smart_str_appends( &ret, "before or at \"" ); - intl_convert_utf16_to_utf8( &buf, &u8len, pe->postContext, -1, &status ); - if( U_FAILURE( status ) ) - { - smart_str_appends( &ret, "(could not convert parser error post-context to UTF-8)" ); - } - else - { - smart_str_appendl( &ret, buf, u8len ); - efree( buf ); - } - smart_str_appends( &ret, "\"" ); - any = 1; - } - - if( !any ) - { - smart_str_free( &ret ); - smart_str_appends( &ret, "no parse error" ); - } - - smart_str_0( &ret ); - return ret; -} - /* * Local variables: * tab-width: 4 diff --git a/ext/intl/transliterator/transliterator_methods.c b/ext/intl/transliterator/transliterator_methods.c index d0cfb9790d957..1aa39c54b980a 100644 --- a/ext/intl/transliterator/transliterator_methods.c +++ b/ext/intl/transliterator/transliterator_methods.c @@ -183,7 +183,7 @@ PHP_FUNCTION( transliterator_create_from_rules ) { char *msg = NULL; smart_str parse_error_str; - parse_error_str = transliterator_parse_error_to_string( &parse_error ); + parse_error_str = intl_parse_error_to_string( &parse_error ); spprintf( &msg, 0, "transliterator_create_from_rules: unable to " "create ICU transliterator from rules (%s)", parse_error_str.c ); smart_str_free( &parse_error_str ); diff --git a/ext/json/JSON_parser.h b/ext/json/JSON_parser.h index 541664b8c6f65..8671765b4d983 100644 --- a/ext/json/JSON_parser.h +++ b/ext/json/JSON_parser.h @@ -25,7 +25,10 @@ enum error_codes { PHP_JSON_ERROR_STATE_MISMATCH, PHP_JSON_ERROR_CTRL_CHAR, PHP_JSON_ERROR_SYNTAX, - PHP_JSON_ERROR_UTF8 + PHP_JSON_ERROR_UTF8, + PHP_JSON_ERROR_RECURSION, + PHP_JSON_ERROR_INF_OR_NAN, + PHP_JSON_ERROR_UNSUPPORTED_TYPE }; extern JSON_parser new_JSON_parser(int depth); diff --git a/ext/json/json.c b/ext/json/json.c index 557fbc3e0c8d6..e4bb8a5d4be24 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -35,6 +35,7 @@ static PHP_MINFO_FUNCTION(json); static PHP_FUNCTION(json_encode); static PHP_FUNCTION(json_decode); static PHP_FUNCTION(json_last_error); +static PHP_FUNCTION(json_last_error_msg); static const char digits[] = "0123456789abcdef"; @@ -46,6 +47,7 @@ ZEND_DECLARE_MODULE_GLOBALS(json) ZEND_BEGIN_ARG_INFO_EX(arginfo_json_encode, 0, 0, 1) ZEND_ARG_INFO(0, value) ZEND_ARG_INFO(0, options) + ZEND_ARG_INFO(0, depth) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_json_decode, 0, 0, 1) @@ -57,6 +59,9 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_json_last_error, 0) ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_json_last_error_msg, 0) +ZEND_END_ARG_INFO() /* }}} */ /* {{{ json_functions[] */ @@ -64,6 +69,7 @@ static const zend_function_entry json_functions[] = { PHP_FE(json_encode, arginfo_json_encode) PHP_FE(json_decode, arginfo_json_decode) PHP_FE(json_last_error, arginfo_json_last_error) + PHP_FE(json_last_error_msg, arginfo_json_last_error_msg) PHP_FE_END }; /* }}} */ @@ -96,6 +102,7 @@ static PHP_MINIT_FUNCTION(json) REGISTER_LONG_CONSTANT("JSON_UNESCAPED_SLASHES", PHP_JSON_UNESCAPED_SLASHES, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_PRETTY_PRINT", PHP_JSON_PRETTY_PRINT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_UNESCAPED_UNICODE", PHP_JSON_UNESCAPED_UNICODE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_PARTIAL_OUTPUT_ON_ERROR", PHP_JSON_PARTIAL_OUTPUT_ON_ERROR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_ERROR_NONE", PHP_JSON_ERROR_NONE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_ERROR_DEPTH", PHP_JSON_ERROR_DEPTH, CONST_CS | CONST_PERSISTENT); @@ -103,6 +110,9 @@ static PHP_MINIT_FUNCTION(json) REGISTER_LONG_CONSTANT("JSON_ERROR_CTRL_CHAR", PHP_JSON_ERROR_CTRL_CHAR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_ERROR_SYNTAX", PHP_JSON_ERROR_SYNTAX, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_ERROR_UTF8", PHP_JSON_ERROR_UTF8, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_ERROR_RECURSION", PHP_JSON_ERROR_RECURSION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_ERROR_INF_OR_NAN", PHP_JSON_ERROR_INF_OR_NAN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_ERROR_UNSUPPORTED_TYPE", PHP_JSON_ERROR_UNSUPPORTED_TYPE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_OBJECT_AS_ARRAY", PHP_JSON_OBJECT_AS_ARRAY, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_BIGINT_AS_STRING", PHP_JSON_BIGINT_AS_STRING, CONST_CS | CONST_PERSISTENT); @@ -117,6 +127,7 @@ static PHP_GINIT_FUNCTION(json) { json_globals->encoder_depth = 0; json_globals->error_code = 0; + json_globals->encode_max_depth = 0; } /* }}} */ @@ -231,7 +242,7 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC) } if (myht && myht->nApplyCount > 1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected"); + JSON_G(error_code) = PHP_JSON_ERROR_RECURSION; smart_str_appendl(buf, "null", 4); return; } @@ -302,7 +313,7 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC) smart_str_appendc(buf, ':'); json_pretty_print_char(buf, options, ' ' TSRMLS_CC); - + php_json_encode(buf, *data, options TSRMLS_CC); } else { if (need_comma) { @@ -320,7 +331,7 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC) smart_str_appendc(buf, ':'); json_pretty_print_char(buf, options, ' ' TSRMLS_CC); - + php_json_encode(buf, *data, options TSRMLS_CC); } } @@ -331,7 +342,10 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC) } } } - + + if (JSON_G(encoder_depth) > JSON_G(encode_max_depth)) { + JSON_G(error_code) = PHP_JSON_ERROR_DEPTH; + } --JSON_G(encoder_depth); json_pretty_print_char(buf, options, '\n' TSRMLS_CC); json_pretty_print_indent(buf, options TSRMLS_CC); @@ -351,6 +365,7 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR int pos = 0, ulen = 0; unsigned short us; unsigned short *utf16; + size_t newlen; if (len == 0) { smart_str_appendl(buf, "\"\"", 2); @@ -372,15 +387,15 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR smart_str_appendl(buf, tmp, l); efree(tmp); } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "double %.9g does not conform to the JSON spec, encoded as 0", d); + JSON_G(error_code) = PHP_JSON_ERROR_INF_OR_NAN; smart_str_appendc(buf, '0'); } } return; } - + } - + utf16 = (options & PHP_JSON_UNESCAPED_UNICODE) ? NULL : (unsigned short *) safe_emalloc(len, sizeof(unsigned short), 0); ulen = utf8_to_utf16(utf16, s, len); if (ulen <= 0) { @@ -389,9 +404,6 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR } if (ulen < 0) { JSON_G(error_code) = PHP_JSON_ERROR_UTF8; - if (!PG(display_errors)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid UTF-8 sequence in argument"); - } smart_str_appendl(buf, "null", 4); } else { smart_str_appendl(buf, "\"\"", 2); @@ -402,6 +414,8 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR len = ulen; } + /* pre-allocate for string length plus 2 quotes */ + smart_str_alloc(buf, len+2, 0); smart_str_appendc(buf, '"'); while (pos < len) @@ -514,15 +528,15 @@ static void json_encode_serializable_object(smart_str *buf, zval *val, int optio zend_class_entry *ce = Z_OBJCE_P(val); zval *retval = NULL, fname; HashTable* myht; - + if (Z_TYPE_P(val) == IS_ARRAY) { myht = HASH_OF(val); } else { myht = Z_OBJPROP_P(val); - } - + } + if (myht && myht->nApplyCount > 1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected"); + JSON_G(error_code) = PHP_JSON_ERROR_RECURSION; smart_str_appendl(buf, "null", 4); return; } @@ -533,7 +547,7 @@ static void json_encode_serializable_object(smart_str *buf, zval *val, int optio zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Failed calling %s::jsonSerialize()", ce->name); smart_str_appendl(buf, "null", sizeof("null") - 1); return; - } + } if (EG(exception)) { /* Error already raised */ @@ -586,7 +600,7 @@ PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_ smart_str_appendl(buf, d, len); efree(d); } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "double %.9g does not conform to the JSON spec, encoded as 0", dbl); + JSON_G(error_code) = PHP_JSON_ERROR_INF_OR_NAN; smart_str_appendc(buf, '0'); } } @@ -607,7 +621,7 @@ PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_ break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "type is unsupported, encoded as null"); + JSON_G(error_code) = PHP_JSON_ERROR_UNSUPPORTED_TYPE; smart_str_appendl(buf, "null", 4); break; } @@ -686,23 +700,30 @@ PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len, /* }}} */ -/* {{{ proto string json_encode(mixed data [, int options]) +/* {{{ proto string json_encode(mixed data [, int options[, int depth]]) Returns the JSON representation of a value */ static PHP_FUNCTION(json_encode) { zval *parameter; smart_str buf = {0}; long options = 0; + long depth = JSON_PARSER_DEFAULT_DEPTH; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", ¶meter, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ll", ¶meter, &options, &depth) == FAILURE) { return; } JSON_G(error_code) = PHP_JSON_ERROR_NONE; + JSON_G(encode_max_depth) = depth; + php_json_encode(&buf, parameter, options TSRMLS_CC); - ZVAL_STRINGL(return_value, buf.c, buf.len, 1); + if (JSON_G(error_code) != PHP_JSON_ERROR_NONE && !(options & PHP_JSON_PARTIAL_OUTPUT_ON_ERROR)) { + ZVAL_FALSE(return_value); + } else { + ZVAL_STRINGL(return_value, buf.c, buf.len, 1); + } smart_str_free(&buf); } @@ -740,7 +761,7 @@ static PHP_FUNCTION(json_decode) /* }}} */ /* {{{ proto int json_last_error() - Returns the error code of the last json_decode(). */ + Returns the error code of the last json_encode() or json_decode() call. */ static PHP_FUNCTION(json_last_error) { if (zend_parse_parameters_none() == FAILURE) { @@ -751,6 +772,40 @@ static PHP_FUNCTION(json_last_error) } /* }}} */ +/* {{{ proto string json_last_error_msg() + Returns the error string of the last json_encode() or json_decode() call. */ +static PHP_FUNCTION(json_last_error_msg) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + switch(JSON_G(error_code)) { + case PHP_JSON_ERROR_NONE: + RETURN_STRING("No error", 1); + case PHP_JSON_ERROR_DEPTH: + RETURN_STRING("Maximum stack depth exceeded", 1); + case PHP_JSON_ERROR_STATE_MISMATCH: + RETURN_STRING("State mismatch (invalid or malformed JSON)", 1); + case PHP_JSON_ERROR_CTRL_CHAR: + RETURN_STRING("Control character error, possibly incorrectly encoded", 1); + case PHP_JSON_ERROR_SYNTAX: + RETURN_STRING("Syntax error", 1); + case PHP_JSON_ERROR_UTF8: + RETURN_STRING("Malformed UTF-8 characters, possibly incorrectly encoded", 1); + case PHP_JSON_ERROR_RECURSION: + RETURN_STRING("Recursion detected", 1); + case PHP_JSON_ERROR_INF_OR_NAN: + RETURN_STRING("Inf and NaN cannot be JSON encoded", 1); + case PHP_JSON_ERROR_UNSUPPORTED_TYPE: + RETURN_STRING("Type is not supported", 1); + default: + RETURN_STRING("Unknown error", 1); + } + +} +/* }}} */ + /* * Local variables: * tab-width: 4 diff --git a/ext/json/php_json.h b/ext/json/php_json.h index ef3e4b5a79964..2b3cf5868ad4f 100644 --- a/ext/json/php_json.h +++ b/ext/json/php_json.h @@ -40,6 +40,7 @@ extern zend_module_entry json_module_entry; ZEND_BEGIN_MODULE_GLOBALS(json) int encoder_depth; int error_code; + int encode_max_depth; ZEND_END_MODULE_GLOBALS(json) #ifdef ZTS @@ -63,6 +64,7 @@ extern zend_class_entry *php_json_serializable_ce; #define PHP_JSON_UNESCAPED_SLASHES (1<<6) #define PHP_JSON_PRETTY_PRINT (1<<7) #define PHP_JSON_UNESCAPED_UNICODE (1<<8) +#define PHP_JSON_PARTIAL_OUTPUT_ON_ERROR (1<<9) /* Internal flags */ #define PHP_JSON_OUTPUT_ARRAY 0 diff --git a/ext/json/tests/003.phpt b/ext/json/tests/003.phpt index 3b52fb0884172..4ce5b0fde9d0c 100644 --- a/ext/json/tests/003.phpt +++ b/ext/json/tests/003.phpt @@ -9,10 +9,16 @@ $a = array(); $a[] = &$a; var_dump($a); + +echo "\n"; + var_dump(json_encode($a)); +var_dump(json_last_error(), json_last_error_msg()); -/* Break circular data structure to prevent memory leaks */ -unset($a[0]); +echo "\n"; + +var_dump(json_encode($a, JSON_PARTIAL_OUTPUT_ON_ERROR)); +var_dump(json_last_error(), json_last_error_msg()); echo "Done\n"; ?> @@ -25,6 +31,11 @@ array(1) { } } -Warning: json_encode(): recursion detected in %s on line %d +bool(false) +int(6) +string(%d) "Recursion detected" + string(8) "[[null]]" +int(6) +string(%d) "Recursion detected" Done diff --git a/ext/json/tests/004.phpt b/ext/json/tests/004.phpt index 1d282f9a96115..70ef3ffd1b80f 100644 --- a/ext/json/tests/004.phpt +++ b/ext/json/tests/004.phpt @@ -9,7 +9,16 @@ $a = new stdclass; $a->prop = $a; var_dump($a); + +echo "\n"; + var_dump(json_encode($a)); +var_dump(json_last_error(), json_last_error_msg()); + +echo "\n"; + +var_dump(json_encode($a, JSON_PARTIAL_OUTPUT_ON_ERROR)); +var_dump(json_last_error(), json_last_error_msg()); echo "Done\n"; ?> @@ -19,6 +28,11 @@ object(stdClass)#%d (1) { *RECURSION* } -Warning: json_encode(): recursion detected in %s on line %d +bool(false) +int(6) +string(%d) "Recursion detected" + string(22) "{"prop":{"prop":null}}" +int(6) +string(%d) "Recursion detected" Done diff --git a/ext/json/tests/007.phpt b/ext/json/tests/007.phpt index 9ee190a24cdc9..7557ac9ed7497 100644 --- a/ext/json/tests/007.phpt +++ b/ext/json/tests/007.phpt @@ -5,15 +5,15 @@ json_last_error() tests --FILE-- --EXPECTF-- string(5) ""abc"" -string(4) "null" +bool(false) string(4) "null" string(17) "[null,null,"abc"]" Done - diff --git a/ext/json/tests/bug53946.phpt b/ext/json/tests/bug53946.phpt index 079906fa33b71..111438ddc48ab 100644 --- a/ext/json/tests/bug53946.phpt +++ b/ext/json/tests/bug53946.phpt @@ -12,9 +12,5 @@ var_dump(json_encode("ab\xE0", JSON_UNESCAPED_UNICODE)); --EXPECTF-- string(156) ""latin 1234 -\/ russian \u043c\u0430\u043c\u0430 \u043c\u044b\u043b\u0430 \u0440\u0430\u043c\u0443 specialchars \u0002 \b \n U+1D11E >\ud834\udd1e<"" string(100) ""latin 1234 -\/ russian мама мыла раму specialchars \u0002 \b \n U+1D11E >ð„ž<"" - -Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d bool(false) - -Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d bool(false) diff --git a/ext/json/tests/bug54058.phpt b/ext/json/tests/bug54058.phpt index 3b1136bdd95e7..df1b3130f8422 100644 --- a/ext/json/tests/bug54058.phpt +++ b/ext/json/tests/bug54058.phpt @@ -8,28 +8,33 @@ Bug #54058 (json_last_error() invalid UTF-8 produces wrong error) $bad_utf8 = quoted_printable_decode('=B0'); json_encode($bad_utf8); -var_dump(json_last_error()); +var_dump(json_last_error(), json_last_error_msg()); $a = new stdclass; $a->foo = quoted_printable_decode('=B0'); json_encode($a); -var_dump(json_last_error()); +var_dump(json_last_error(), json_last_error_msg()); $b = new stdclass; $b->foo = $bad_utf8; $b->bar = 1; json_encode($b); -var_dump(json_last_error()); +var_dump(json_last_error(), json_last_error_msg()); $c = array( 'foo' => $bad_utf8, 'bar' => 1 ); json_encode($c); -var_dump(json_last_error()); +var_dump(json_last_error(), json_last_error_msg()); + ?> --EXPECTF-- int(5) +string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" int(5) +string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" int(5) +string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" int(5) +string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" diff --git a/ext/json/tests/bug61537.phpt b/ext/json/tests/bug61537.phpt new file mode 100644 index 0000000000000..80ed051c9a6d5 --- /dev/null +++ b/ext/json/tests/bug61537.phpt @@ -0,0 +1,39 @@ +--TEST-- +Bug #61537 (json_encode() incorrectly truncates/discards information) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +bool(false) +int(5) +string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" +string(4) "null" +int(5) +string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" + +bool(false) +int(5) +string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" +string(4) "null" +int(5) +string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" diff --git a/ext/json/tests/bug61978.phpt b/ext/json/tests/bug61978.phpt index 2c732979ef496..c34b03f8f7351 100644 --- a/ext/json/tests/bug61978.phpt +++ b/ext/json/tests/bug61978.phpt @@ -29,19 +29,15 @@ class JsonTest2 implements JsonSerializable { $obj1 = new JsonTest1(); -var_dump(json_encode($obj1)); +var_dump(json_encode($obj1, JSON_PARTIAL_OUTPUT_ON_ERROR)); -echo "\n==\n"; +echo "==\n"; $obj2 = new JsonTest2(); -var_dump(json_encode($obj2)); +var_dump(json_encode($obj2, JSON_PARTIAL_OUTPUT_ON_ERROR)); ?> --EXPECTF-- -Warning: json_encode(): recursion detected in %s on line %d string(44) "{"test":"123","me":{"test":"123","me":null}}" - == - -Warning: json_encode(): recursion detected in %s on line %d string(44) "{"test":"123","me":{"test":"123","me":null}}" diff --git a/ext/json/tests/bug62369.phpt b/ext/json/tests/bug62369.phpt new file mode 100644 index 0000000000000..a5efd802c5ee6 --- /dev/null +++ b/ext/json/tests/bug62369.phpt @@ -0,0 +1,34 @@ +--TEST-- +FR #62369 (Segfault on json_encode(deeply_nested_array) +--SKIPIF-- + +--FILE-- + +--FILE-- + +--EXPECTF-- +float(INF) +bool(false) +int(7) +string(34) "Inf and NaN cannot be JSON encoded" +string(1) "0" +int(7) +string(34) "Inf and NaN cannot be JSON encoded" + +float(NAN) +bool(false) +int(7) +string(34) "Inf and NaN cannot be JSON encoded" +string(1) "0" +int(7) +string(34) "Inf and NaN cannot be JSON encoded" diff --git a/ext/json/tests/json_encode_basic.phpt b/ext/json/tests/json_encode_basic.phpt index 152e24444c008..fc348eed8112c 100644 --- a/ext/json/tests/json_encode_basic.phpt +++ b/ext/json/tests/json_encode_basic.phpt @@ -150,9 +150,7 @@ string(4) "null" -- Iteration 25 -- string(4) "null" -- Iteration 26 -- - -Warning: json_encode(): type is unsupported, encoded as null in %s on line %d -string(4) "null" +bool(false) -- Iteration 27 -- string(82) "{"MyInt":99,"MyFloat":123.45,"MyBool":true,"MyNull":null,"MyString":"Hello World"}" -===Done=== \ No newline at end of file +===Done=== diff --git a/ext/json/tests/json_encode_error.phpt b/ext/json/tests/json_encode_error.phpt index d130dd960c5b7..547c8bef17bf5 100644 --- a/ext/json/tests/json_encode_error.phpt +++ b/ext/json/tests/json_encode_error.phpt @@ -34,7 +34,5 @@ Warning: json_encode() expects at least 1 parameter, 0 given in %s on line %d NULL -- Testing json_encode() function with more than expected no. of arguments -- - -Warning: json_encode() expects at most 2 parameters, 3 given in %s on line %d -NULL +string(5) ""abc"" ===Done=== diff --git a/ext/json/tests/pass001.1.phpt b/ext/json/tests/pass001.1.phpt index 7e15a7622ac61..a51f885780d74 100644 --- a/ext/json/tests/pass001.1.phpt +++ b/ext/json/tests/pass001.1.phpt @@ -90,10 +90,10 @@ $arr = json_decode($test, true); var_dump($arr); echo "ENCODE: FROM OBJECT\n"; -$obj_enc = json_encode($obj); +$obj_enc = json_encode($obj, JSON_PARTIAL_OUTPUT_ON_ERROR); echo $obj_enc . "\n"; echo "ENCODE: FROM ARRAY\n"; -$arr_enc = json_encode($arr); +$arr_enc = json_encode($arr, JSON_PARTIAL_OUTPUT_ON_ERROR); echo $arr_enc . "\n"; echo "DECODE AGAIN: AS OBJECT\n"; diff --git a/ext/json/tests/pass001.phpt b/ext/json/tests/pass001.phpt index 43be11e2b0fcf..1fd05fcdd8705 100644 --- a/ext/json/tests/pass001.phpt +++ b/ext/json/tests/pass001.phpt @@ -79,10 +79,10 @@ $arr = json_decode($test, true); var_dump($arr); echo "ENCODE: FROM OBJECT\n"; -$obj_enc = json_encode($obj); +$obj_enc = json_encode($obj, JSON_PARTIAL_OUTPUT_ON_ERROR); echo $obj_enc . "\n"; echo "ENCODE: FROM ARRAY\n"; -$arr_enc = json_encode($arr); +$arr_enc = json_encode($arr, JSON_PARTIAL_OUTPUT_ON_ERROR); echo $arr_enc . "\n"; echo "DECODE AGAIN: AS OBJECT\n"; diff --git a/ext/json/tests/unsupported_type_error.phpt b/ext/json/tests/unsupported_type_error.phpt new file mode 100644 index 0000000000000..45a167a5ac0b1 --- /dev/null +++ b/ext/json/tests/unsupported_type_error.phpt @@ -0,0 +1,26 @@ +--TEST-- +An error is thrown when an unsupported type is encoded +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +resource(5) of type (stream) +bool(false) +int(8) +string(21) "Type is not supported" +string(4) "null" +int(8) +string(21) "Type is not supported" diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index e42d845f902ef..a39c875b2c788 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -677,9 +677,18 @@ static xmlParserInputPtr _php_libxml_external_entity_loader(const char *URL, static xmlParserInputPtr _php_libxml_pre_ext_ent_loader(const char *URL, const char *ID, xmlParserCtxtPtr context) { + TSRMLS_FETCH(); + /* Check whether we're running in a PHP context, since the entity loader - * we've defined is an application level (true global) setting */ - if (xmlGenericError == php_libxml_error_handler) { + * we've defined is an application level (true global) setting. + * If we are, we also want to check whether we've finished activating + * the modules (RINIT phase). Using our external entity loader during a + * RINIT should not be problem per se (though during MINIT it is, because + * we don't even have a resource list by then), but then whether one + * extension would be using the custom external entity loader or not + * could depend on extension loading order + * (if _php_libxml_per_request_initialization */ + if (xmlGenericError == php_libxml_error_handler && PG(modules_activated)) { return _php_libxml_external_entity_loader(URL, ID, context); } else { return _php_libxml_default_entity_loader(URL, ID, context); diff --git a/ext/libxml/tests/bug61367-read.phpt b/ext/libxml/tests/bug61367-read.phpt index 3deecfc50fcdb..94da3d8481917 100644 --- a/ext/libxml/tests/bug61367-read.phpt +++ b/ext/libxml/tests/bug61367-read.phpt @@ -4,11 +4,12 @@ Bug #61367: open_basedir bypass in libxml RSHUTDOWN: read test --INI-- open_basedir=. -; Suppress spurious "Trying to get property of non-object" notices error_reporting=E_ALL & ~E_NOTICE --FILE-- --INI-- open_basedir=. -; Suppress spurious "Trying to get property of non-object" notices -error_reporting=E_ALL & ~E_NOTICE --FILE-- stmt) { if (mysqli_stmt_close(stmt->stmt, TRUE)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error occured while closing statement"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error occurred while closing statement"); return; } } diff --git a/ext/mysqli/tests/bug62046.phpt b/ext/mysqli/tests/bug62046.phpt new file mode 100644 index 0000000000000..31a7328b701e2 --- /dev/null +++ b/ext/mysqli/tests/bug62046.phpt @@ -0,0 +1,40 @@ +--TEST-- +Bug #62046 mysqli@mysqlnd can't iterate over stored sets after call to mysqli_stmt_reset() +--SKIPIF-- + +--FILE-- +prepare('SELECT 42'))) { + printf("[002] Prepare failed, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + if (FALSE === $stmt->execute()) { + printf("[003] Execute failed, [%d] %s\n", $stmt->errorno, $stmt->error); + } + if (FALSE === $stmt->store_result()) { + printf("[004] store_result failed, [%d] %s\n", $stmt->errorno, $stmt->error); + } + $one = NULL; + if (FALSE === $stmt->bind_result($one)) { + printf("[005] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error); + } + if (FALSE === $stmt->reset()) { + printf("[006] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error); + } + while ($stmt->fetch()) { + var_dump($one); + } + $stmt->close(); + $link->close(); + echo "done!"; +?> +--EXPECT-- +int(42) +done! \ No newline at end of file diff --git a/ext/mysqli/tests/mysqli_options_openbasedir.phpt b/ext/mysqli/tests/mysqli_options_openbasedir.phpt index 500baf3781335..4c13ec1ef013f 100644 --- a/ext/mysqli/tests/mysqli_options_openbasedir.phpt +++ b/ext/mysqli/tests/mysqli_options_openbasedir.phpt @@ -6,7 +6,6 @@ require_once('skipif.inc'); require_once('skipifemb.inc'); require_once('skipifconnectfailure.inc'); ?> ---INI-- --FILE-- m->send_close(conn TSRMLS_CC); DBG_ERR("Server is gone"); ret = FAIL; - } else if (ok_packet != PROT_LAST) { + } + PACKET_FREE(cmd_packet); + DBG_RETURN(ret); +} +/* }}} */ + + +/* {{{ mysqlnd_conn_data::simple_command */ +static enum_func_status +MYSQLND_METHOD(mysqlnd_conn_data, simple_command)(MYSQLND_CONN_DATA * conn, enum php_mysqlnd_server_command command, + const zend_uchar * const arg, size_t arg_len, enum mysqlnd_packet_type ok_packet, zend_bool silent, + zend_bool ignore_upsert_status TSRMLS_DC) +{ + enum_func_status ret; + DBG_ENTER("mysqlnd_conn_data::simple_command"); + + ret = conn->m->simple_command_send_request(conn, command, arg, arg_len, silent, ignore_upsert_status TSRMLS_CC); + if (PASS == ret && ok_packet != PROT_LAST) { ret = conn->m->simple_command_handle_response(conn, ok_packet, silent, command, ignore_upsert_status TSRMLS_CC); } - PACKET_FREE(cmd_packet); DBG_INF(ret == PASS ? "PASS":"FAIL"); DBG_RETURN(ret); } @@ -453,6 +469,7 @@ mysqlnd_switch_to_ssl_if_needed( DBG_INF("Switching to SSL"); if (!PACKET_WRITE(auth_packet, conn)) { CONN_SET_STATE(conn, CONN_QUIT_SENT); + conn->m->send_close(conn TSRMLS_CC); SET_CLIENT_ERROR(*conn->error_info, CR_SERVER_GONE_ERROR, UNKNOWN_SQLSTATE, mysqlnd_server_gone); goto end; } @@ -472,132 +489,150 @@ mysqlnd_switch_to_ssl_if_needed( /* }}} */ -/* {{{ mysqlnd_connect_run_authentication */ +/* {{{ mysqlnd_conn_data::fetch_auth_plugin_by_name */ +static struct st_mysqlnd_authentication_plugin * +MYSQLND_METHOD(mysqlnd_conn_data, fetch_auth_plugin_by_name)(const char * const requested_protocol TSRMLS_DC) +{ + struct st_mysqlnd_authentication_plugin * auth_plugin; + char * plugin_name = NULL; + DBG_ENTER("mysqlnd_conn_data::fetch_auth_plugin_by_name"); + + mnd_sprintf(&plugin_name, 0, "auth_plugin_%s", requested_protocol); + DBG_INF_FMT("looking for %s auth plugin", plugin_name); + auth_plugin = mysqlnd_plugin_find(plugin_name); + mnd_sprintf_free(plugin_name); + + DBG_RETURN(auth_plugin); +} +/* }}} */ + + +/* {{{ mysqlnd_run_authentication */ static enum_func_status -mysqlnd_connect_run_authentication( +mysqlnd_run_authentication( MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd, + const size_t passwd_len, const char * const db, - size_t db_len, - size_t passwd_len, - const MYSQLND_PACKET_GREET * const greet_packet, + const size_t db_len, + const zend_uchar * const auth_plugin_data, + const size_t auth_plugin_data_len, + const char * const auth_protocol, + unsigned int charset_no, const MYSQLND_OPTIONS * const options, - unsigned long mysql_flags + unsigned long mysql_flags, + zend_bool silent, + zend_bool is_change_user TSRMLS_DC) { enum_func_status ret = FAIL; - DBG_ENTER("mysqlnd_connect_run_authentication"); + zend_bool first_call = TRUE; - ret = mysqlnd_switch_to_ssl_if_needed(conn, greet_packet, options, mysql_flags TSRMLS_CC); - if (PASS == ret) { - zend_bool first_call = TRUE; + char * switch_to_auth_protocol = NULL; + size_t switch_to_auth_protocol_len = 0; + char * requested_protocol = NULL; + zend_uchar * plugin_data; + size_t plugin_data_len; - char * switch_to_auth_protocol = NULL; - size_t switch_to_auth_protocol_len = 0; - char * requested_protocol = NULL; - zend_uchar * plugin_data; - size_t plugin_data_len; + DBG_ENTER("mysqlnd_run_authentication"); - plugin_data_len = greet_packet->auth_plugin_data_len; - plugin_data = mnd_emalloc(plugin_data_len + 1); - if (!plugin_data) { - ret = FAIL; - goto end; - } - memcpy(plugin_data, greet_packet->auth_plugin_data, plugin_data_len); - plugin_data[plugin_data_len] = '\0'; + plugin_data_len = auth_plugin_data_len; + plugin_data = mnd_emalloc(plugin_data_len + 1); + if (!plugin_data) { + goto end; + } + memcpy(plugin_data, auth_plugin_data, plugin_data_len); + plugin_data[plugin_data_len] = '\0'; - requested_protocol = mnd_pestrdup(greet_packet->auth_protocol? greet_packet->auth_protocol: "mysql_native_password", FALSE); - if (!requested_protocol) { - ret = FAIL; + requested_protocol = mnd_pestrdup(auth_protocol? auth_protocol : MYSQLND_DEFAULT_AUTH_PROTOCOL, FALSE); + if (!requested_protocol) { + goto end; + } + + do { + struct st_mysqlnd_authentication_plugin * auth_plugin = conn->m->fetch_auth_plugin_by_name(requested_protocol TSRMLS_CC); + + 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"); goto end; } + DBG_INF("plugin found"); - do { - struct st_mysqlnd_authentication_plugin * auth_plugin; - { - char * plugin_name = NULL; - - mnd_sprintf(&plugin_name, 0, "auth_plugin_%s", requested_protocol); + { + zend_uchar * switch_to_auth_protocol_data = NULL; + size_t switch_to_auth_protocol_data_len = 0; + zend_uchar * scrambled_data = NULL; + size_t scrambled_data_len = 0; - DBG_INF_FMT("looking for %s auth plugin", plugin_name); - auth_plugin = mysqlnd_plugin_find(plugin_name); - mnd_sprintf_free(plugin_name); + switch_to_auth_protocol = NULL; + switch_to_auth_protocol_len = 0; - 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"); - break; - } + if (conn->auth_plugin_data) { + mnd_pefree(conn->auth_plugin_data, conn->persistent); + conn->auth_plugin_data = NULL; } - DBG_INF("plugin found"); - - { - zend_uchar * switch_to_auth_protocol_data = NULL; - size_t switch_to_auth_protocol_data_len = 0; - zend_uchar * scrambled_data = NULL; - size_t scrambled_data_len = 0; - - switch_to_auth_protocol = NULL; - switch_to_auth_protocol_len = 0; - - if (conn->auth_plugin_data) { - mnd_pefree(conn->auth_plugin_data, conn->persistent); - conn->auth_plugin_data = NULL; - } - conn->auth_plugin_data_len = plugin_data_len; - conn->auth_plugin_data = mnd_pemalloc(conn->auth_plugin_data_len, conn->persistent); - if (!conn->auth_plugin_data) { - SET_OOM_ERROR(*conn->error_info); - goto end; - } - memcpy(conn->auth_plugin_data, plugin_data, plugin_data_len); - - DBG_INF_FMT("salt=[%*s]", plugin_data_len - 1, plugin_data); - /* The data should be allocated with malloc() */ - scrambled_data = - auth_plugin->methods.get_auth_data(NULL, &scrambled_data_len, conn, user, passwd, passwd_len, - plugin_data, plugin_data_len, options, mysql_flags TSRMLS_CC); + conn->auth_plugin_data_len = plugin_data_len; + conn->auth_plugin_data = mnd_pemalloc(conn->auth_plugin_data_len, conn->persistent); + if (!conn->auth_plugin_data) { + SET_OOM_ERROR(*conn->error_info); + goto end; + } + memcpy(conn->auth_plugin_data, plugin_data, plugin_data_len); + DBG_INF_FMT("salt=[%*.s]", plugin_data_len - 1, plugin_data); + /* The data should be allocated with malloc() */ + scrambled_data = + auth_plugin->methods.get_auth_data(NULL, &scrambled_data_len, conn, user, passwd, passwd_len, + plugin_data, plugin_data_len, options, mysql_flags TSRMLS_CC); + if (FALSE == is_change_user) { ret = mysqlnd_auth_handshake(conn, user, passwd, passwd_len, db, db_len, options, mysql_flags, - greet_packet->charset_no, + charset_no, first_call, requested_protocol, scrambled_data, scrambled_data_len, &switch_to_auth_protocol, &switch_to_auth_protocol_len, &switch_to_auth_protocol_data, &switch_to_auth_protocol_data_len TSRMLS_CC); - first_call = FALSE; - free(scrambled_data); + } else { + ret = mysqlnd_auth_change_user(conn, user, strlen(user), passwd, passwd_len, db, db_len, silent, + first_call, + requested_protocol, + scrambled_data, scrambled_data_len, + &switch_to_auth_protocol, &switch_to_auth_protocol_len, + &switch_to_auth_protocol_data, &switch_to_auth_protocol_data_len + TSRMLS_CC); + } + first_call = FALSE; + free(scrambled_data); - DBG_INF_FMT("switch_to_auth_protocol=%s", switch_to_auth_protocol? switch_to_auth_protocol:"n/a"); - if (requested_protocol && switch_to_auth_protocol) { - mnd_efree(requested_protocol); - requested_protocol = switch_to_auth_protocol; - } + DBG_INF_FMT("switch_to_auth_protocol=%s", switch_to_auth_protocol? switch_to_auth_protocol:"n/a"); + if (requested_protocol && switch_to_auth_protocol) { + mnd_efree(requested_protocol); + requested_protocol = switch_to_auth_protocol; + } - if (plugin_data) { - mnd_efree(plugin_data); - } - plugin_data_len = switch_to_auth_protocol_data_len; - plugin_data = switch_to_auth_protocol_data; + if (plugin_data) { + mnd_efree(plugin_data); } - DBG_INF_FMT("conn->error_info->error_no = %d", conn->error_info->error_no); - } while (ret == FAIL && conn->error_info->error_no == 0 && switch_to_auth_protocol != NULL); - if (plugin_data) { - mnd_efree(plugin_data); + plugin_data_len = switch_to_auth_protocol_data_len; + plugin_data = switch_to_auth_protocol_data; } + DBG_INF_FMT("conn->error_info->error_no = %d", conn->error_info->error_no); + } while (ret == FAIL && conn->error_info->error_no == 0 && switch_to_auth_protocol != NULL); + if (plugin_data) { + mnd_efree(plugin_data); + } - if (ret == PASS) { - DBG_INF_FMT("saving requested_protocol=%s", requested_protocol); - conn->m->set_client_option(conn, MYSQLND_OPT_AUTH_PROTOCOL, requested_protocol TSRMLS_CC); - } + if (ret == PASS) { + DBG_INF_FMT("saving requested_protocol=%s", requested_protocol); + conn->m->set_client_option(conn, MYSQLND_OPT_AUTH_PROTOCOL, requested_protocol TSRMLS_CC); + } - if (requested_protocol) { - mnd_efree(requested_protocol); - } + if (requested_protocol) { + mnd_efree(requested_protocol); } end: DBG_RETURN(ret); @@ -605,6 +640,183 @@ mysqlnd_connect_run_authentication( /* }}} */ +/* {{{ mysqlnd_connect_run_authentication */ +static enum_func_status +mysqlnd_connect_run_authentication( + MYSQLND_CONN_DATA * conn, + const char * const user, + const char * const passwd, + const char * const db, + size_t db_len, + size_t passwd_len, + const MYSQLND_PACKET_GREET * const greet_packet, + const MYSQLND_OPTIONS * const options, + unsigned long mysql_flags + TSRMLS_DC) +{ + enum_func_status ret = FAIL; + DBG_ENTER("mysqlnd_connect_run_authentication"); + + ret = mysqlnd_switch_to_ssl_if_needed(conn, greet_packet, options, mysql_flags TSRMLS_CC); + if (PASS == ret) { + ret = mysqlnd_run_authentication(conn, user, passwd, passwd_len, db, db_len, + greet_packet->auth_plugin_data, greet_packet->auth_plugin_data_len, greet_packet->auth_protocol, + greet_packet->charset_no, options, mysql_flags, FALSE /*silent*/, FALSE/*is_change*/ TSRMLS_CC); + } + DBG_RETURN(ret); +} +/* }}} */ + + +/* {{{ mysqlnd_conn_data::execute_init_commands */ +static enum_func_status +MYSQLND_METHOD(mysqlnd_conn_data, execute_init_commands)(MYSQLND_CONN_DATA * conn TSRMLS_DC) +{ + enum_func_status ret = PASS; + + DBG_ENTER("mysqlnd_conn_data::execute_init_commands"); + if (conn->options->init_commands) { + unsigned int current_command = 0; + for (; current_command < conn->options->num_commands; ++current_command) { + const char * const command = conn->options->init_commands[current_command]; + if (command) { + MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_INIT_COMMAND_EXECUTED_COUNT); + if (PASS != conn->m->query(conn, command, strlen(command) TSRMLS_CC)) { + MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_INIT_COMMAND_FAILED_COUNT); + ret = FAIL; + break; + } + if (conn->last_query_type == QUERY_SELECT) { + MYSQLND_RES * result = conn->m->use_result(conn TSRMLS_CC); + if (result) { + result->m.free_result(result, TRUE TSRMLS_CC); + } + } + } + } + } + DBG_RETURN(ret); +} +/* }}} */ + + +/* {{{ mysqlnd_conn_data::get_updated_connect_flags */ +static unsigned int +MYSQLND_METHOD(mysqlnd_conn_data, get_updated_connect_flags)(MYSQLND_CONN_DATA * conn, unsigned int mysql_flags TSRMLS_DC) +{ + MYSQLND_NET * net = conn->net; + + DBG_ENTER("mysqlnd_conn_data::get_updated_connect_flags"); + /* we allow load data local infile by default */ + mysql_flags |= MYSQLND_CAPABILITIES; + + if (PG(open_basedir) && strlen(PG(open_basedir))) { + mysql_flags ^= CLIENT_LOCAL_FILES; + } + +#ifndef MYSQLND_COMPRESSION_ENABLED + if (mysql_flags & CLIENT_COMPRESS) { + mysql_flags &= ~CLIENT_COMPRESS; + } +#else + if (net && net->data->options.flags & MYSQLND_NET_FLAG_USE_COMPRESSION) { + mysql_flags |= CLIENT_COMPRESS; + } +#endif +#ifndef MYSQLND_SSL_SUPPORTED + if (mysql_flags & CLIENT_SSL) { + mysql_flags &= ~CLIENT_SSL; + } +#else + if (net && (net->data->options.ssl_key || net->data->options.ssl_cert || + net->data->options.ssl_ca || net->data->options.ssl_capath || net->data->options.ssl_cipher)) + { + mysql_flags |= CLIENT_SSL; + } +#endif + + DBG_RETURN(mysql_flags); +} +/* }}} */ + + +/* {{{ mysqlnd_conn_data::connect_handshake */ +static enum_func_status +MYSQLND_METHOD(mysqlnd_conn_data, connect_handshake)(MYSQLND_CONN_DATA * conn, + const char * const host, const char * const user, + const char * const passwd, const unsigned int passwd_len, + const char * const db, const unsigned int db_len, + const unsigned int mysql_flags TSRMLS_DC) +{ + MYSQLND_PACKET_GREET * greet_packet; + MYSQLND_NET * net = conn->net; + + DBG_ENTER("mysqlnd_conn_data::connect_handshake"); + + greet_packet = conn->protocol->m.get_greet_packet(conn->protocol, FALSE TSRMLS_CC); + if (!greet_packet) { + SET_OOM_ERROR(*conn->error_info); + DBG_RETURN(FAIL); /* OOM */ + } + + if (FAIL == net->data->m.connect_ex(conn->net, conn->scheme, conn->scheme_len, conn->persistent, + conn->stats, conn->error_info TSRMLS_CC)) + { + goto err; + } + + DBG_INF_FMT("stream=%p", net->data->m.get_stream(net TSRMLS_CC)); + + if (FAIL == PACKET_READ(greet_packet, conn)) { + DBG_ERR("Error while reading greeting packet"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while reading greeting packet. PID=%d", getpid()); + goto err; + } else if (greet_packet->error_no) { + DBG_ERR_FMT("errorno=%u error=%s", greet_packet->error_no, greet_packet->error); + SET_CLIENT_ERROR(*conn->error_info, greet_packet->error_no, greet_packet->sqlstate, greet_packet->error); + goto err; + } else if (greet_packet->pre41) { + DBG_ERR_FMT("Connecting to 3.22, 3.23 & 4.0 is not supported. Server is %-.32s", greet_packet->server_version); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Connecting to 3.22, 3.23 & 4.0 " + " is not supported. Server is %-.32s", greet_packet->server_version); + SET_CLIENT_ERROR(*conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, + "Connecting to 3.22, 3.23 & 4.0 servers is not supported"); + goto err; + } + + conn->thread_id = greet_packet->thread_id; + conn->protocol_version = greet_packet->protocol_version; + conn->server_version = mnd_pestrdup(greet_packet->server_version, conn->persistent); + + conn->greet_charset = mysqlnd_find_charset_nr(greet_packet->charset_no); + if (!conn->greet_charset) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, + "Server sent charset (%d) unknown to the client. Please, report to the developers", greet_packet->charset_no); + SET_CLIENT_ERROR(*conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, + "Server sent charset unknown to the client. Please, report to the developers"); + goto err; + } + + if (FAIL == mysqlnd_connect_run_authentication(conn, user, passwd, db, db_len, (size_t) passwd_len, + greet_packet, conn->options, mysql_flags TSRMLS_CC)) + { + goto err; + } + conn->client_flag = mysql_flags; + conn->server_capabilities = greet_packet->server_capabilities; + conn->upsert_status->warning_count = 0; + conn->upsert_status->server_status = greet_packet->server_status; + conn->upsert_status->affected_rows = 0; + + PACKET_FREE(greet_packet); + DBG_RETURN(PASS); +err: + PACKET_FREE(greet_packet); + DBG_RETURN(FAIL); +} +/* }}} */ + + /* {{{ mysqlnd_conn_data::connect */ static enum_func_status MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn, @@ -625,8 +837,6 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn, zend_bool local_tx_started = FALSE; MYSQLND_NET * net = conn->net; - MYSQLND_PACKET_GREET * greet_packet = NULL; - DBG_ENTER("mysqlnd_conn_data::connect"); if (PASS != conn->m->local_tx_start(conn, this_func TSRMLS_CC)) { @@ -686,6 +896,8 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn, DBG_INF_FMT("no db given, using empty string"); db = ""; db_len = 0; + } else { + mysql_flags |= CLIENT_CONNECT_WITH_DB; } host_len = strlen(host); @@ -729,77 +941,9 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn, } } - greet_packet = conn->protocol->m.get_greet_packet(conn->protocol, FALSE TSRMLS_CC); - if (!greet_packet) { - SET_OOM_ERROR(*conn->error_info); - goto err; /* OOM */ - } + mysql_flags = conn->m->get_updated_connect_flags(conn, mysql_flags TSRMLS_CC); - if (FAIL == net->data->m.connect_ex(conn->net, conn->scheme, conn->scheme_len, conn->persistent, - conn->stats, conn->error_info TSRMLS_CC)) - { - goto err; - } - - DBG_INF_FMT("stream=%p", net->data->m.get_stream(net TSRMLS_CC)); - - if (FAIL == PACKET_READ(greet_packet, conn)) { - DBG_ERR("Error while reading greeting packet"); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while reading greeting packet. PID=%d", getpid()); - goto err; - } else if (greet_packet->error_no) { - DBG_ERR_FMT("errorno=%u error=%s", greet_packet->error_no, greet_packet->error); - SET_CLIENT_ERROR(*conn->error_info, greet_packet->error_no, greet_packet->sqlstate, greet_packet->error); - goto err; - } else if (greet_packet->pre41) { - DBG_ERR_FMT("Connecting to 3.22, 3.23 & 4.0 is not supported. Server is %-.32s", greet_packet->server_version); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Connecting to 3.22, 3.23 & 4.0 " - " is not supported. Server is %-.32s", greet_packet->server_version); - SET_CLIENT_ERROR(*conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, - "Connecting to 3.22, 3.23 & 4.0 servers is not supported"); - goto err; - } - - conn->thread_id = greet_packet->thread_id; - conn->protocol_version = greet_packet->protocol_version; - conn->server_version = mnd_pestrdup(greet_packet->server_version, conn->persistent); - - conn->greet_charset = mysqlnd_find_charset_nr(greet_packet->charset_no); - /* we allow load data local infile by default */ - mysql_flags |= MYSQLND_CAPABILITIES; - - if (db) { - mysql_flags |= CLIENT_CONNECT_WITH_DB; - } - - if (PG(open_basedir) && strlen(PG(open_basedir))) { - mysql_flags ^= CLIENT_LOCAL_FILES; - } - -#ifndef MYSQLND_COMPRESSION_ENABLED - if (mysql_flags & CLIENT_COMPRESS) { - mysql_flags &= ~CLIENT_COMPRESS; - } -#else - if (net->data->options.flags & MYSQLND_NET_FLAG_USE_COMPRESSION) { - mysql_flags |= CLIENT_COMPRESS; - } -#endif -#ifndef MYSQLND_SSL_SUPPORTED - if (mysql_flags & CLIENT_SSL) { - mysql_flags &= ~CLIENT_SSL; - } -#else - if (net->data->options.ssl_key || net->data->options.ssl_cert || - net->data->options.ssl_ca || net->data->options.ssl_capath || net->data->options.ssl_cipher) - { - mysql_flags |= CLIENT_SSL; - } -#endif - - if (FAIL == mysqlnd_connect_run_authentication(conn, user, passwd, db, db_len, (size_t) passwd_len, - greet_packet, conn->options, mysql_flags TSRMLS_CC)) - { + if (FAIL == conn->m->connect_handshake(conn, host, user, passwd, passwd_len, db, db_len, mysql_flags TSRMLS_CC)) { goto err; } @@ -876,13 +1020,8 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn, } conn->unix_socket_len = strlen(conn->unix_socket); } - conn->client_flag = mysql_flags; conn->max_packet_size = MYSQLND_ASSEMBLED_PACKET_MAX_SIZE; /* todo: check if charset is available */ - conn->server_capabilities = greet_packet->server_capabilities; - conn->upsert_status->warning_count = 0; - conn->upsert_status->server_status = greet_packet->server_status; - conn->upsert_status->affected_rows = 0; SET_EMPTY_ERROR(*conn->error_info); @@ -895,27 +1034,10 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn, DBG_INF("unicode set"); } #endif - if (conn->options->init_commands) { - unsigned int current_command = 0; - for (; current_command < conn->options->num_commands; ++current_command) { - const char * const command = conn->options->init_commands[current_command]; - if (command) { - MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_INIT_COMMAND_EXECUTED_COUNT); - if (PASS != conn->m->query(conn, command, strlen(command) TSRMLS_CC)) { - MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_INIT_COMMAND_FAILED_COUNT); - goto err; - } - if (conn->last_query_type == QUERY_SELECT) { - MYSQLND_RES * result = conn->m->use_result(conn TSRMLS_CC); - if (result) { - result->m.free_result(result, TRUE TSRMLS_CC); - } - } - } - } + if (FAIL == conn->m->execute_init_commands(conn TSRMLS_CC)) { + goto err; } - MYSQLND_INC_CONN_STATISTIC_W_VALUE2(conn->stats, STAT_CONNECT_SUCCESS, 1, STAT_OPENED_CONNECTIONS, 1); if (reconnect) { MYSQLND_INC_GLOBAL_STATISTIC(STAT_RECONNECT); @@ -926,13 +1048,10 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn, DBG_INF_FMT("connection_id=%llu", conn->thread_id); - PACKET_FREE(greet_packet); - conn->m->local_tx_end(conn, this_func, PASS TSRMLS_CC); DBG_RETURN(PASS); } err: - PACKET_FREE(greet_packet); DBG_ERR_FMT("[%u] %.128s (trying to connect via %s)", conn->error_info->error_no, conn->error_info->error, conn->scheme); if (!conn->error_info->error_no) { @@ -1622,6 +1741,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, kill)(MYSQLND_CONN_DATA * conn, unsigned int p SET_ERROR_AFF_ROWS(conn); } else if (PASS == (ret = conn->m->simple_command(conn, COM_PROCESS_KILL, buff, 4, PROT_LAST, FALSE, TRUE TSRMLS_CC))) { CONN_SET_STATE(conn, CONN_QUIT_SENT); + conn->m->send_close(conn TSRMLS_CC); } conn->m->local_tx_end(conn, this_func, ret TSRMLS_CC); @@ -1736,8 +1856,9 @@ MYSQLND_METHOD(mysqlnd_conn_data, send_close)(MYSQLND_CONN_DATA * const conn TSR DBG_INF("Connection clean, sending COM_QUIT"); if (net_stream) { ret = conn->m->simple_command(conn, COM_QUIT, NULL, 0, PROT_LAST, TRUE, TRUE TSRMLS_CC); + net->data->m.close_stream(net, conn->stats, conn->error_info TSRMLS_CC); } - /* Do nothing */ + CONN_SET_STATE(conn, CONN_QUIT_SENT); break; case CONN_SENDING_LOAD_DATA: /* @@ -1753,6 +1874,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, send_close)(MYSQLND_CONN_DATA * const conn TSR Do nothing, the connection will be brutally closed and the server will catch it and free close from its side. */ + /* Fall-through */ case CONN_ALLOCED: /* Allocated but not connected or there was failure when trying @@ -1760,15 +1882,13 @@ MYSQLND_METHOD(mysqlnd_conn_data, send_close)(MYSQLND_CONN_DATA * const conn TSR Fall-through */ + CONN_SET_STATE(conn, CONN_QUIT_SENT); + net->data->m.close_stream(net, conn->stats, conn->error_info TSRMLS_CC); + /* Fall-through */ case CONN_QUIT_SENT: /* The user has killed its own connection */ break; } - /* - We hold one reference, and every other object which needs the - connection does increase it by 1. - */ - CONN_SET_STATE(conn, CONN_QUIT_SENT); DBG_RETURN(ret); } @@ -2008,6 +2128,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, next_result)(MYSQLND_CONN_DATA * const conn TS DBG_ERR_FMT("Serious error. %s::%u", __FILE__, __LINE__); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Serious error. PID=%d", getpid()); CONN_SET_STATE(conn, CONN_QUIT_SENT); + conn->m->send_close(conn TSRMLS_CC); } else { DBG_INF_FMT("Error from the server : (%u) %s", conn->error_info->error_no, conn->error_info->error); } @@ -2087,13 +2208,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, change_user)(MYSQLND_CONN_DATA * const conn, TSRMLS_DC) { size_t this_func = STRUCT_OFFSET(struct st_mysqlnd_conn_data_methods, change_user); - /* - User could be max 16 * 3 (utf8), pass is 20 usually, db is up to 64*3 - Stack space is not that expensive, so use a bit more to be protected against - buffer overflows. - */ enum_func_status ret = FAIL; - zend_bool local_tx_started = FALSE; DBG_ENTER("mysqlnd_conn_data::change_user"); DBG_INF_FMT("conn=%llu user=%s passwd=%s db=%s silent=%u", @@ -2102,7 +2217,6 @@ MYSQLND_METHOD(mysqlnd_conn_data, change_user)(MYSQLND_CONN_DATA * const conn, if (PASS != conn->m->local_tx_start(conn, this_func TSRMLS_CC)) { goto end; } - local_tx_started = TRUE; SET_EMPTY_ERROR(*conn->error_info); SET_ERROR_AFF_ROWS(conn); @@ -2115,122 +2229,20 @@ MYSQLND_METHOD(mysqlnd_conn_data, change_user)(MYSQLND_CONN_DATA * const conn, } if (!db) { db = ""; - } - - { - zend_bool first_call = TRUE; - char * switch_to_auth_protocol = NULL; - size_t switch_to_auth_protocol_len = 0; - char * requested_protocol = NULL; - zend_uchar * plugin_data; - size_t plugin_data_len; - - plugin_data_len = conn->auth_plugin_data_len; - plugin_data = mnd_emalloc(plugin_data_len); - if (!plugin_data) { - ret = FAIL; - goto end; - } - memcpy(plugin_data, conn->auth_plugin_data, plugin_data_len); - - requested_protocol = mnd_pestrdup(conn->options->auth_protocol? conn->options->auth_protocol:"mysql_native_password", FALSE); - if (!requested_protocol) { - ret = FAIL; - goto end; - } - - do { - struct st_mysqlnd_authentication_plugin * auth_plugin; - { - char * plugin_name = NULL; - - mnd_sprintf(&plugin_name, 0, "auth_plugin_%s", requested_protocol); - - DBG_INF_FMT("looking for %s auth plugin", plugin_name); - auth_plugin = mysqlnd_plugin_find(plugin_name); - mnd_sprintf_free(plugin_name); - - 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"); - break; - } - } - DBG_INF("plugin found"); - - { - zend_uchar * switch_to_auth_protocol_data = NULL; - size_t switch_to_auth_protocol_data_len = 0; - zend_uchar * scrambled_data = NULL; - size_t scrambled_data_len = 0; - - switch_to_auth_protocol = NULL; - switch_to_auth_protocol_len = 0; - - if (conn->auth_plugin_data) { - mnd_pefree(conn->auth_plugin_data, conn->persistent); - conn->auth_plugin_data = NULL; - } - conn->auth_plugin_data_len = plugin_data_len; - conn->auth_plugin_data = mnd_pemalloc(conn->auth_plugin_data_len, conn->persistent); - if (!conn->auth_plugin_data) { - SET_OOM_ERROR(*conn->error_info); - ret = FAIL; - goto end; - } - memcpy(conn->auth_plugin_data, plugin_data, plugin_data_len); - - DBG_INF_FMT("salt=[%*s]", plugin_data_len - 1, plugin_data); - - /* The data should be allocated with malloc() */ - scrambled_data = - auth_plugin->methods.get_auth_data(NULL, &scrambled_data_len, conn, user, passwd, passwd_len, - plugin_data, plugin_data_len, 0, conn->server_capabilities TSRMLS_CC); + } - ret = mysqlnd_auth_change_user(conn, user, strlen(user), passwd, passwd_len, db, strlen(db), silent, - first_call, - requested_protocol, - scrambled_data, scrambled_data_len, - &switch_to_auth_protocol, &switch_to_auth_protocol_len, - &switch_to_auth_protocol_data, &switch_to_auth_protocol_data_len - TSRMLS_CC); - - first_call = FALSE; - free(scrambled_data); + /* XXX: passwords that have \0 inside work during auth, but in this case won't work with change user */ + ret = mysqlnd_run_authentication(conn, user, passwd, strlen(passwd), db, strlen(db), + conn->auth_plugin_data, conn->auth_plugin_data_len, conn->options->auth_protocol, + 0 /*charset not used*/, conn->options, conn->server_capabilities, silent, TRUE/*is_change*/ TSRMLS_CC); - DBG_INF_FMT("switch_to_auth_protocol=%s", switch_to_auth_protocol? switch_to_auth_protocol:"n/a"); - if (requested_protocol) { - mnd_efree(requested_protocol); - } - requested_protocol = switch_to_auth_protocol; - - if (plugin_data) { - mnd_efree(plugin_data); - } - plugin_data_len = switch_to_auth_protocol_data_len; - plugin_data = switch_to_auth_protocol_data; - } - DBG_INF_FMT("conn->error_info->error_no = %d", conn->error_info->error_no); - } while (ret == FAIL && conn->error_info->error_no == 0 && switch_to_auth_protocol != NULL); - if (plugin_data) { - mnd_efree(plugin_data); - } - if (ret == PASS) { - conn->m->set_client_option(conn, MYSQLND_OPT_AUTH_PROTOCOL, requested_protocol TSRMLS_CC); - } - if (requested_protocol) { - mnd_efree(requested_protocol); - } - } /* Here we should close all statements. Unbuffered queries should not be a problem as we won't allow sending COM_CHANGE_USER. */ + conn->m->local_tx_end(conn, this_func, ret TSRMLS_CC); end: - if (TRUE == local_tx_started) { - conn->m->local_tx_end(conn, this_func, ret TSRMLS_CC); - } DBG_INF(ret == PASS? "PASS":"FAIL"); DBG_RETURN(ret); } @@ -2646,7 +2658,12 @@ MYSQLND_CLASS_METHODS_START(mysqlnd_conn_data) MYSQLND_METHOD(mysqlnd_conn_data, tx_commit), MYSQLND_METHOD(mysqlnd_conn_data, tx_rollback), MYSQLND_METHOD(mysqlnd_conn_data, local_tx_start), - MYSQLND_METHOD(mysqlnd_conn_data, local_tx_end) + MYSQLND_METHOD(mysqlnd_conn_data, local_tx_end), + MYSQLND_METHOD(mysqlnd_conn_data, execute_init_commands), + MYSQLND_METHOD(mysqlnd_conn_data, get_updated_connect_flags), + MYSQLND_METHOD(mysqlnd_conn_data, connect_handshake), + MYSQLND_METHOD(mysqlnd_conn_data, simple_command_send_request), + MYSQLND_METHOD(mysqlnd_conn_data, fetch_auth_plugin_by_name) MYSQLND_CLASS_METHODS_END; diff --git a/ext/mysqlnd/mysqlnd.h b/ext/mysqlnd/mysqlnd.h index 33338cfc80a1c..30d425780236e 100644 --- a/ext/mysqlnd/mysqlnd.h +++ b/ext/mysqlnd/mysqlnd.h @@ -262,8 +262,10 @@ PHPAPI void _mysqlnd_get_client_stats(zval *return_value TSRMLS_DC ZEND_FILE_L ZEND_BEGIN_MODULE_GLOBALS(mysqlnd) zend_bool collect_statistics; zend_bool collect_memory_statistics; - char* debug; /* The actual string */ - MYSQLND_DEBUG *dbg; /* The DBG object */ + char * debug; /* The actual string */ + char * trace_alloc_settings; /* The actual string */ + MYSQLND_DEBUG * dbg; /* The DBG object for standard tracing */ + MYSQLND_DEBUG * trace_alloc; /* The DBG object for allocation tracing */ long net_cmd_buffer_size; long net_read_buffer_size; long log_mask; diff --git a/ext/mysqlnd/mysqlnd_alloc.c b/ext/mysqlnd/mysqlnd_alloc.c index 06e979a6e1273..e681d338568a9 100644 --- a/ext/mysqlnd/mysqlnd_alloc.c +++ b/ext/mysqlnd/mysqlnd_alloc.c @@ -65,8 +65,8 @@ const char * mysqlnd_debug_std_no_trace_funcs[] = #if ZEND_DEBUG #else -#define __zend_filename "/unknown/unknown" -#define __zend_lineno 0 +#define __zend_orig_filename "/unknown/unknown" +#define __zend_orig_lineno 0 #endif #define REAL_SIZE(s) (collect_memory_statistics? (s) + sizeof(size_t) : (s)) @@ -81,15 +81,17 @@ void * _mysqlnd_emalloc(size_t size MYSQLND_MEM_D) #if PHP_DEBUG long * threshold = &MYSQLND_G(debug_emalloc_fail_threshold); #endif - DBG_ENTER(mysqlnd_emalloc_name); + char * fn = NULL; + TRACE_ALLOC_ENTER(mysqlnd_emalloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); #if PHP_DEBUG /* -1 is also "true" */ if (*threshold) { #endif - ret = emalloc(REAL_SIZE(size)); + ret = _emalloc(REAL_SIZE(size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); #if PHP_DEBUG --*threshold; } else if (*threshold == 0) { @@ -97,13 +99,13 @@ void * _mysqlnd_emalloc(size_t size MYSQLND_MEM_D) } #endif - DBG_INF_FMT("size=%lu ptr=%p", size, ret); + TRACE_ALLOC_INF_FMT("size=%lu ptr=%p", size, ret); if (ret && collect_memory_statistics) { *(size_t *) ret = size; MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_EMALLOC_COUNT, 1, STAT_MEM_EMALLOC_AMOUNT, size); } - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ @@ -116,14 +118,16 @@ void * _mysqlnd_pemalloc(size_t size, zend_bool persistent MYSQLND_MEM_D) #if PHP_DEBUG long * threshold = persistent? &MYSQLND_G(debug_malloc_fail_threshold):&MYSQLND_G(debug_emalloc_fail_threshold); #endif - DBG_ENTER(mysqlnd_pemalloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); + char * fn = NULL; + TRACE_ALLOC_ENTER(mysqlnd_pemalloc_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d persistent=%u", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno, persistent); #if PHP_DEBUG /* -1 is also "true" */ if (*threshold) { #endif - ret = pemalloc(REAL_SIZE(size), persistent); + ret = (persistent) ? __zend_malloc(REAL_SIZE(size)) : _emalloc(REAL_SIZE(size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); #if PHP_DEBUG --*threshold; } else if (*threshold == 0) { @@ -131,7 +135,7 @@ void * _mysqlnd_pemalloc(size_t size, zend_bool persistent MYSQLND_MEM_D) } #endif - DBG_INF_FMT("size=%lu ptr=%p persistent=%u", size, ret, persistent); + TRACE_ALLOC_INF_FMT("size=%lu ptr=%p persistent=%u", size, ret, persistent); if (ret && collect_memory_statistics) { enum mysqlnd_collected_stats s1 = persistent? STAT_MEM_MALLOC_COUNT:STAT_MEM_EMALLOC_COUNT; @@ -140,7 +144,7 @@ void * _mysqlnd_pemalloc(size_t size, zend_bool persistent MYSQLND_MEM_D) MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(s1, 1, s2, size); } - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ @@ -153,15 +157,17 @@ void * _mysqlnd_ecalloc(unsigned int nmemb, size_t size MYSQLND_MEM_D) #if PHP_DEBUG long * threshold = &MYSQLND_G(debug_ecalloc_fail_threshold); #endif - DBG_ENTER(mysqlnd_ecalloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); - DBG_INF_FMT("before: %lu", zend_memory_usage(FALSE TSRMLS_CC)); + char * fn = NULL; + TRACE_ALLOC_ENTER(mysqlnd_ecalloc_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("before: %lu", zend_memory_usage(FALSE TSRMLS_CC)); #if PHP_DEBUG /* -1 is also "true" */ if (*threshold) { #endif - ret = ecalloc(nmemb, REAL_SIZE(size)); + ret = _ecalloc(nmemb, REAL_SIZE(size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); #if PHP_DEBUG --*threshold; } else if (*threshold == 0) { @@ -169,13 +175,13 @@ void * _mysqlnd_ecalloc(unsigned int nmemb, size_t size MYSQLND_MEM_D) } #endif - DBG_INF_FMT("after : %lu", zend_memory_usage(FALSE TSRMLS_CC)); - DBG_INF_FMT("size=%lu ptr=%p", size, ret); + TRACE_ALLOC_INF_FMT("after : %lu", zend_memory_usage(FALSE TSRMLS_CC)); + TRACE_ALLOC_INF_FMT("size=%lu ptr=%p", size, ret); if (ret && collect_memory_statistics) { *(size_t *) ret = size; MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_ECALLOC_COUNT, 1, STAT_MEM_ECALLOC_AMOUNT, size); } - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ @@ -188,14 +194,16 @@ void * _mysqlnd_pecalloc(unsigned int nmemb, size_t size, zend_bool persistent M #if PHP_DEBUG long * threshold = persistent? &MYSQLND_G(debug_calloc_fail_threshold):&MYSQLND_G(debug_ecalloc_fail_threshold); #endif - DBG_ENTER(mysqlnd_pecalloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); + char * fn = NULL; + TRACE_ALLOC_ENTER(mysqlnd_pecalloc_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d persistent=%u", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno, persistent); #if PHP_DEBUG /* -1 is also "true" */ if (*threshold) { #endif - ret = pecalloc(nmemb, REAL_SIZE(size), persistent); + ret = (persistent) ? __zend_calloc(nmemb, REAL_SIZE(size)) : _ecalloc(nmemb, REAL_SIZE(size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); #if PHP_DEBUG --*threshold; } else if (*threshold == 0) { @@ -203,7 +211,7 @@ void * _mysqlnd_pecalloc(unsigned int nmemb, size_t size, zend_bool persistent M } #endif - DBG_INF_FMT("size=%lu ptr=%p", size, ret); + TRACE_ALLOC_INF_FMT("size=%lu ptr=%p", size, ret); if (ret && collect_memory_statistics) { enum mysqlnd_collected_stats s1 = persistent? STAT_MEM_CALLOC_COUNT:STAT_MEM_ECALLOC_COUNT; @@ -212,7 +220,7 @@ void * _mysqlnd_pecalloc(unsigned int nmemb, size_t size, zend_bool persistent M MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(s1, 1, s2, size); } - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ @@ -226,15 +234,17 @@ void * _mysqlnd_erealloc(void *ptr, size_t new_size MYSQLND_MEM_D) #if PHP_DEBUG long * threshold = &MYSQLND_G(debug_erealloc_fail_threshold); #endif - DBG_ENTER(mysqlnd_erealloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); - DBG_INF_FMT("ptr=%p old_size=%lu, new_size=%lu", ptr, old_size, new_size); + char * fn = NULL; + TRACE_ALLOC_ENTER(mysqlnd_erealloc_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("ptr=%p old_size=%lu, new_size=%lu", ptr, old_size, new_size); #if PHP_DEBUG /* -1 is also "true" */ if (*threshold) { #endif - ret = erealloc(REAL_PTR(ptr), REAL_SIZE(new_size)); + ret = _erealloc(REAL_PTR(ptr), REAL_SIZE(new_size), 0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); #if PHP_DEBUG --*threshold; } else if (*threshold == 0) { @@ -242,12 +252,12 @@ void * _mysqlnd_erealloc(void *ptr, size_t new_size MYSQLND_MEM_D) } #endif - DBG_INF_FMT("new_ptr=%p", (char*)ret); + TRACE_ALLOC_INF_FMT("new_ptr=%p", (char*)ret); if (ret && collect_memory_statistics) { *(size_t *) ret = new_size; MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_EREALLOC_COUNT, 1, STAT_MEM_EREALLOC_AMOUNT, new_size); } - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ @@ -261,9 +271,11 @@ void * _mysqlnd_perealloc(void *ptr, size_t new_size, zend_bool persistent MYSQL #if PHP_DEBUG long * threshold = persistent? &MYSQLND_G(debug_realloc_fail_threshold):&MYSQLND_G(debug_erealloc_fail_threshold); #endif - DBG_ENTER(mysqlnd_perealloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); - DBG_INF_FMT("ptr=%p old_size=%lu new_size=%lu persistent=%u", ptr, old_size, new_size, persistent); + char * fn = NULL; + TRACE_ALLOC_ENTER(mysqlnd_perealloc_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("ptr=%p old_size=%lu new_size=%lu persistent=%u", ptr, old_size, new_size, persistent); #if PHP_DEBUG /* -1 is also "true" */ @@ -277,7 +289,7 @@ void * _mysqlnd_perealloc(void *ptr, size_t new_size, zend_bool persistent MYSQL } #endif - DBG_INF_FMT("new_ptr=%p", (char*)ret); + TRACE_ALLOC_INF_FMT("new_ptr=%p", (char*)ret); if (ret && collect_memory_statistics) { enum mysqlnd_collected_stats s1 = persistent? STAT_MEM_REALLOC_COUNT:STAT_MEM_EREALLOC_COUNT; @@ -285,7 +297,7 @@ void * _mysqlnd_perealloc(void *ptr, size_t new_size, zend_bool persistent MYSQL *(size_t *) ret = new_size; MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(s1, 1, s2, new_size); } - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ @@ -295,22 +307,24 @@ void _mysqlnd_efree(void *ptr MYSQLND_MEM_D) { size_t free_amount = 0; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); - DBG_ENTER(mysqlnd_efree_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); - DBG_INF_FMT("ptr=%p", ptr); + char * fn = NULL; + TRACE_ALLOC_ENTER(mysqlnd_efree_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("ptr=%p", ptr); if (ptr) { if (collect_memory_statistics) { free_amount = *(size_t *)(((char*)ptr) - sizeof(size_t)); - DBG_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount); + TRACE_ALLOC_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount); } - efree(REAL_PTR(ptr)); + _efree(REAL_PTR(ptr) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); } if (collect_memory_statistics) { MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_EFREE_COUNT, 1, STAT_MEM_EFREE_AMOUNT, free_amount); } - DBG_VOID_RETURN; + TRACE_ALLOC_VOID_RETURN; } /* }}} */ @@ -320,24 +334,27 @@ void _mysqlnd_pefree(void *ptr, zend_bool persistent MYSQLND_MEM_D) { size_t free_amount = 0; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); - DBG_ENTER(mysqlnd_pefree_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); - DBG_INF_FMT("ptr=%p persistent=%u", ptr, persistent); + char * fn = NULL; + TRACE_ALLOC_ENTER(mysqlnd_pefree_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("ptr=%p persistent=%u", ptr, persistent); if (ptr) { if (collect_memory_statistics) { free_amount = *(size_t *)(((char*)ptr) - sizeof(size_t)); - DBG_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount); + TRACE_ALLOC_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount); } - pefree(REAL_PTR(ptr), persistent); + (persistent) ? free(REAL_PTR(ptr)) : _efree(REAL_PTR(ptr) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); } if (collect_memory_statistics) { MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(persistent? STAT_MEM_FREE_COUNT:STAT_MEM_EFREE_COUNT, 1, persistent? STAT_MEM_FREE_AMOUNT:STAT_MEM_EFREE_AMOUNT, free_amount); } - DBG_VOID_RETURN; + TRACE_ALLOC_VOID_RETURN; } +/* }}} */ /* {{{ _mysqlnd_malloc */ @@ -348,8 +365,10 @@ void * _mysqlnd_malloc(size_t size MYSQLND_MEM_D) #if PHP_DEBUG long * threshold = &MYSQLND_G(debug_malloc_fail_threshold); #endif - DBG_ENTER(mysqlnd_malloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); + char * fn = NULL; + TRACE_ALLOC_ENTER(mysqlnd_malloc_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); #if PHP_DEBUG /* -1 is also "true" */ @@ -363,12 +382,12 @@ void * _mysqlnd_malloc(size_t size MYSQLND_MEM_D) } #endif - DBG_INF_FMT("size=%lu ptr=%p", size, ret); + TRACE_ALLOC_INF_FMT("size=%lu ptr=%p", size, ret); if (ret && collect_memory_statistics) { *(size_t *) ret = size; MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_MALLOC_COUNT, 1, STAT_MEM_MALLOC_AMOUNT, size); } - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ @@ -381,8 +400,10 @@ void * _mysqlnd_calloc(unsigned int nmemb, size_t size MYSQLND_MEM_D) #if PHP_DEBUG long * threshold = &MYSQLND_G(debug_calloc_fail_threshold); #endif - DBG_ENTER(mysqlnd_calloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); + char * fn = NULL; + TRACE_ALLOC_ENTER(mysqlnd_calloc_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); #if PHP_DEBUG /* -1 is also "true" */ @@ -396,12 +417,12 @@ void * _mysqlnd_calloc(unsigned int nmemb, size_t size MYSQLND_MEM_D) } #endif - DBG_INF_FMT("size=%lu ptr=%p", size, ret); + TRACE_ALLOC_INF_FMT("size=%lu ptr=%p", size, ret); if (ret && collect_memory_statistics) { *(size_t *) ret = size; MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_CALLOC_COUNT, 1, STAT_MEM_CALLOC_AMOUNT, size); } - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ @@ -414,10 +435,12 @@ void * _mysqlnd_realloc(void *ptr, size_t new_size MYSQLND_MEM_D) #if PHP_DEBUG long * threshold = &MYSQLND_G(debug_realloc_fail_threshold); #endif - DBG_ENTER(mysqlnd_realloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); - DBG_INF_FMT("ptr=%p new_size=%lu ", new_size, ptr); - DBG_INF_FMT("before: %lu", zend_memory_usage(TRUE TSRMLS_CC)); + char * fn = NULL; + TRACE_ALLOC_ENTER(mysqlnd_realloc_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("ptr=%p new_size=%lu ", new_size, ptr); + TRACE_ALLOC_INF_FMT("before: %lu", zend_memory_usage(TRUE TSRMLS_CC)); #if PHP_DEBUG /* -1 is also "true" */ @@ -431,13 +454,13 @@ void * _mysqlnd_realloc(void *ptr, size_t new_size MYSQLND_MEM_D) } #endif - DBG_INF_FMT("new_ptr=%p", (char*)ret); + TRACE_ALLOC_INF_FMT("new_ptr=%p", (char*)ret); if (ret && collect_memory_statistics) { *(size_t *) ret = new_size; MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_REALLOC_COUNT, 1, STAT_MEM_REALLOC_AMOUNT, new_size); } - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ @@ -447,14 +470,16 @@ void _mysqlnd_free(void *ptr MYSQLND_MEM_D) { size_t free_amount = 0; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); - DBG_ENTER(mysqlnd_free_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); - DBG_INF_FMT("ptr=%p", ptr); + char * fn = NULL; + TRACE_ALLOC_ENTER(mysqlnd_free_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("ptr=%p", ptr); if (ptr) { if (collect_memory_statistics) { free_amount = *(size_t *)(((char*)ptr) - sizeof(size_t)); - DBG_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount); + TRACE_ALLOC_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount); } free(REAL_PTR(ptr)); } @@ -462,7 +487,7 @@ void _mysqlnd_free(void *ptr MYSQLND_MEM_D) if (collect_memory_statistics) { MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_FREE_COUNT, 1, STAT_MEM_FREE_AMOUNT, free_amount); } - DBG_VOID_RETURN; + TRACE_ALLOC_VOID_RETURN; } /* }}} */ @@ -476,11 +501,13 @@ char * _mysqlnd_pestrndup(const char * const ptr, size_t length, zend_bool persi { char * ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); - DBG_ENTER(mysqlnd_pestrndup_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); - DBG_INF_FMT("ptr=%p", ptr); + char * fn = NULL; + TRACE_ALLOC_ENTER(mysqlnd_pestrndup_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("ptr=%p", ptr); - ret = pemalloc(REAL_SIZE(length) + 1, persistent); + ret = (persistent) ? __zend_malloc(REAL_SIZE(length + 1)) : _emalloc(REAL_SIZE(length + 1) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); { size_t l = length; char * p = (char *) ptr; @@ -496,7 +523,7 @@ char * _mysqlnd_pestrndup(const char * const ptr, size_t length, zend_bool persi MYSQLND_INC_GLOBAL_STATISTIC(persistent? STAT_MEM_STRNDUP_COUNT : STAT_MEM_ESTRNDUP_COUNT); } - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ @@ -508,14 +535,16 @@ char * _mysqlnd_pestrdup(const char * const ptr, zend_bool persistent MYSQLND_ME smart_str tmp_str = {0, 0, 0}; const char * p = ptr; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); - DBG_ENTER(mysqlnd_pestrdup_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); - DBG_INF_FMT("ptr=%p", ptr); + char * fn = NULL; + TRACE_ALLOC_ENTER(mysqlnd_pestrdup_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("ptr=%p", ptr); do { smart_str_appendc(&tmp_str, *p); } while (*p++); - ret = pemalloc(tmp_str.len + sizeof(size_t), persistent); + ret = (persistent) ? __zend_malloc(tmp_str.len + sizeof(size_t)) : _emalloc(REAL_SIZE(tmp_str.len + sizeof(size_t)) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); memcpy(FAKE_PTR(ret), tmp_str.c, tmp_str.len); if (ret && collect_memory_statistics) { @@ -524,7 +553,7 @@ char * _mysqlnd_pestrdup(const char * const ptr, zend_bool persistent MYSQLND_ME } smart_str_free(&tmp_str); - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ @@ -549,7 +578,7 @@ PHPAPI void _mysqlnd_sprintf_free(char * p) } /* }}} */ - +/* {{{ _mysqlnd_vsprintf */ PHPAPI int _mysqlnd_vsprintf(char ** pbuf, size_t max_len, const char * format, va_list ap) { return vspprintf(pbuf, max_len, format, ap); diff --git a/ext/mysqlnd/mysqlnd_alloc.h b/ext/mysqlnd/mysqlnd_alloc.h index 673d4f6daedec..8d0e3bfacc5e9 100644 --- a/ext/mysqlnd/mysqlnd_alloc.h +++ b/ext/mysqlnd/mysqlnd_alloc.h @@ -26,8 +26,8 @@ extern const char * mysqlnd_debug_std_no_trace_funcs[]; -#define MYSQLND_MEM_D TSRMLS_DC ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC -#define MYSQLND_MEM_C TSRMLS_CC ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC +#define MYSQLND_MEM_D TSRMLS_DC ZEND_FILE_LINE_ORIG_DC +#define MYSQLND_MEM_C TSRMLS_CC ZEND_FILE_LINE_CC struct st_mysqlnd_allocator_methods { diff --git a/ext/mysqlnd/mysqlnd_charset.c b/ext/mysqlnd/mysqlnd_charset.c index a1b401bb5956b..25b9877078349 100644 --- a/ext/mysqlnd/mysqlnd_charset.c +++ b/ext/mysqlnd/mysqlnd_charset.c @@ -450,20 +450,27 @@ const MYSQLND_CHARSET mysqlnd_charsets[] = { 6, "hp8", "hp8_english_ci", 1, 1, "", NULL, NULL}, { 7, "koi8r", "koi8r_general_ci", 1, 1, "", NULL, NULL}, { 8, "latin1", "latin1_swedish_ci", 1, 1, "", NULL, NULL}, + { 5, "latin1", "latin1_german_ci", 1, 1, "", NULL, NULL}, /* should be after 0x9 because swedish_ci is the default collation */ { 9, "latin2", "latin2_general_ci", 1, 1, "", NULL, NULL}, + { 2, "latin2", "latin2_czech_cs", 1, 1, "", NULL, NULL}, /* should be after 0x9 because general_ci is the default collation */ { 10, "swe7", "swe7_swedish_ci", 1, 1, "", NULL, NULL}, { 11, "ascii", "ascii_general_ci", 1, 1, "", NULL, NULL}, { 12, "ujis", "ujis_japanese_ci", 1, 3, "", mysqlnd_mbcharlen_ujis, check_mb_ujis}, { 13, "sjis", "sjis_japanese_ci", 1, 2, "", mysqlnd_mbcharlen_sjis, check_mb_sjis}, { 16, "hebrew", "hebrew_general_ci", 1, 1, "", NULL, NULL}, + { 17, "filename", "filename", 1, 5, "", NULL, NULL}, { 18, "tis620", "tis620_thai_ci", 1, 1, "", NULL, NULL}, { 19, "euckr", "euckr_korean_ci", 1, 2, "", mysqlnd_mbcharlen_euckr, check_mb_euckr}, + { 21, "latin2", "latin2_hungarian_ci", 1, 1, "", NULL, NULL}, + { 27, "latin2", "latin2_croatian_ci", 1, 1, "", NULL, NULL}, { 22, "koi8u", "koi8u_general_ci", 1, 1, "", NULL, NULL}, { 24, "gb2312", "gb2312_chinese_ci", 1, 2, "", mysqlnd_mbcharlen_gb2312, check_mb_gb2312}, { 25, "greek", "greek_general_ci", 1, 1, "", NULL, NULL}, { 26, "cp1250", "cp1250_general_ci", 1, 1, "", NULL, NULL}, { 28, "gbk", "gbk_chinese_ci", 1, 2, "", mysqlnd_mbcharlen_gbk, check_mb_gbk}, { 30, "latin5", "latin5_turkish_ci", 1, 1, "", NULL, NULL}, + { 31, "latin1", "latin1_german2_ci", 1, 1, "", NULL, NULL}, + { 15, "latin1", "latin1_danish_ci", 1, 1, "", NULL, NULL}, { 32, "armscii8", "armscii8_general_ci", 1, 1, "", NULL, NULL}, { 33, UTF8_MB3, UTF8_MB3"_general_ci", 1, 3, "UTF-8 Unicode", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 35, "ucs2", "ucs2_general_ci", 2, 2, "UCS-2 Unicode", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, @@ -473,22 +480,11 @@ const MYSQLND_CHARSET mysqlnd_charsets[] = { 39, "macroman", "macroman_general_ci", 1, 1, "", NULL, NULL}, { 40, "cp852", "cp852_general_ci", 1, 1, "", NULL, NULL}, { 41, "latin7", "latin7_general_ci", 1, 1, "", NULL, NULL}, - { 51, "cp1251", "cp1251_general_ci", 1, 1, "", NULL, NULL}, + { 20, "latin7", "latin7_estonian_cs", 1, 1, "", NULL, NULL}, { 57, "cp1256", "cp1256_general_ci", 1, 1, "", NULL, NULL}, { 59, "cp1257", "cp1257_general_ci", 1, 1, "", NULL, NULL}, { 63, "binary", "binary", 1, 1, "", NULL, NULL}, - { 92, "geostd8", "geostd8_general_ci", 1, 1, "", NULL, NULL}, - { 95, "cp932", "cp932_japanese_ci", 1, 2, "", mysqlnd_mbcharlen_cp932, check_mb_cp932}, { 97, "eucjpms", "eucjpms_japanese_ci", 1, 3, "", mysqlnd_mbcharlen_eucjpms, check_mb_eucjpms}, - { 2, "latin2", "latin2_czech_cs", 1, 1, "", NULL, NULL}, - { 5, "latin1", "latin1_german_ci", 1, 1, "", NULL, NULL}, - { 14, "cp1251", "cp1251_bulgarian_ci", 1, 1, "", NULL, NULL}, - { 15, "latin1", "latin1_danish_ci", 1, 1, "", NULL, NULL}, - { 17, "filename", "filename", 1, 5, "", NULL, NULL}, - { 20, "latin7", "latin7_estonian_cs", 1, 1, "", NULL, NULL}, - { 21, "latin2", "latin2_hungarian_ci", 1, 1, "", NULL, NULL}, - { 23, "cp1251", "cp1251_ukrainian_ci", 1, 1, "", NULL, NULL}, - { 27, "latin2", "latin2_croatian_ci", 1, 1, "", NULL, NULL}, { 29, "cp1257", "cp1257_lithunian_ci", 1, 1, "", NULL, NULL}, { 31, "latin1", "latin1_german2_ci", 1, 1, "", NULL, NULL}, { 34, "cp1250", "cp1250_czech_cs", 1, 1, "", NULL, NULL}, @@ -500,6 +496,9 @@ const MYSQLND_CHARSET mysqlnd_charsets[] = { 47, "latin1", "latin1_bin", 1, 1, "", NULL, NULL}, { 48, "latin1", "latin1_general_ci", 1, 1, "", NULL, NULL}, { 49, "latin1", "latin1_general_cs", 1, 1, "", NULL, NULL}, + { 51, "cp1251", "cp1251_general_ci", 1, 1, "", NULL, NULL}, + { 14, "cp1251", "cp1251_bulgarian_ci", 1, 1, "", NULL, NULL}, + { 23, "cp1251", "cp1251_ukrainian_ci", 1, 1, "", NULL, NULL}, { 50, "cp1251", "cp1251_bin", 1, 1, "", NULL, NULL}, { 52, "cp1251", "cp1251_general_cs", 1, 1, "", NULL, NULL}, { 53, "macroman", "macroman_bin", 1, 1, "", NULL, NULL}, @@ -509,8 +508,8 @@ const MYSQLND_CHARSET mysqlnd_charsets[] = #ifdef USED_TO_BE_SO_BEFORE_MYSQL_5_5 { 60, "armascii8", "armascii8_bin", 1, 1, "", NULL, NULL}, #endif - { 60, "utf32", "utf32_general_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, - { 61, "utf32", "utf32_bin", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*55*/{ 60, "utf32", "utf32_general_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*55*/{ 61, "utf32", "utf32_bin", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, { 65, "ascii", "ascii_bin", 1, 1, "", NULL, NULL}, { 66, "cp1250", "cp1250_bin", 1, 1, "", NULL, NULL}, { 67, "cp1256", "cp1256_bin", 1, 1, "", NULL, NULL}, @@ -528,7 +527,6 @@ const MYSQLND_CHARSET mysqlnd_charsets[] = { 80, "cp850", "cp850_bin", 1, 1, "", NULL, NULL}, { 81, "cp852", "cp852_bin", 1, 1, "", NULL, NULL}, { 82, "swe7", "swe7_bin", 1, 1, "", NULL, NULL}, - { 93, "geostd8", "geostd8_bin", 1, 1, "", NULL, NULL}, { 83, UTF8_MB3, UTF8_MB3"_bin", 1, 3, "UTF-8 Unicode", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 84, "big5", "big5_bin", 1, 2, "", mysqlnd_mbcharlen_big5, check_mb_big5}, { 85, "euckr", "euckr_bin", 1, 2, "", mysqlnd_mbcharlen_euckr, check_mb_euckr}, @@ -538,10 +536,14 @@ const MYSQLND_CHARSET mysqlnd_charsets[] = { 89, "tis620", "tis620_bin", 1, 1, "", NULL, NULL}, { 90, "ucs2", "ucs2_bin", 2, 2, "UCS-2 Unicode", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, { 91, "ujis", "ujis_bin", 1, 3, "", mysqlnd_mbcharlen_ujis, check_mb_ujis}, + { 92, "geostd8", "geostd8_general_ci", 1, 1, "", NULL, NULL}, + { 93, "geostd8", "geostd8_bin", 1, 1, "", NULL, NULL}, { 94, "latin1", "latin1_spanish_ci", 1, 1, "", NULL, NULL}, + { 95, "cp932", "cp932_japanese_ci", 1, 2, "", mysqlnd_mbcharlen_cp932, check_mb_cp932}, { 96, "cp932", "cp932_bin", 1, 2, "", mysqlnd_mbcharlen_cp932, check_mb_cp932}, - { 99, "cp1250", "cp1250_polish_ci", 1, 1, "", NULL, NULL}, + { 97, "eucjpms", "eucjpms_japanese_ci", 1, 3, "", mysqlnd_mbcharlen_eucjpms, check_mb_eucjpms}, { 98, "eucjpms", "eucjpms_bin", 1, 3, "", mysqlnd_mbcharlen_eucjpms, check_mb_eucjpms}, + { 99, "cp1250", "cp1250_polish_ci", 1, 1, "", NULL, NULL}, { 128, "ucs2", "ucs2_unicode_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, { 129, "ucs2", "ucs2_icelandic_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, { 130, "ucs2", "ucs2_latvian_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, @@ -562,7 +564,35 @@ const MYSQLND_CHARSET mysqlnd_charsets[] = { 145, "ucs2", "ucs2_esperanto_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, { 146, "ucs2", "ucs2_hungarian_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, { 147, "ucs2", "ucs2_sinhala_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 149, "ucs2", "ucs2_croatian_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, /* MDB */ + { 148, "ucs2", "ucs2_german2_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 149, "ucs2", "ucs2_croatian_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 150, "ucs2", "ucs2_unicode_520_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 151, "ucs2", "ucs2_vietnamese_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + +/*56*/{160, "utf32", "utf32_unicode_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{161, "utf32", "utf32_icelandic_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{162, "utf32", "utf32_latvian_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{163, "utf32", "utf32_romanian_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{164, "utf32", "utf32_slovenian_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{165, "utf32", "utf32_polish_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{166, "utf32", "utf32_estonian_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{167, "utf32", "utf32_spanish_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{168, "utf32", "utf32_swedish_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{169, "utf32", "utf32_turkish_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{170, "utf32", "utf32_czech_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{171, "utf32", "utf32_danish_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{172, "utf32", "utf32_lithuanian_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{173, "utf32", "utf32_slovak_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{174, "utf32", "utf32_spanish2_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{175, "utf32", "utf32_roman_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{176, "utf32", "utf32_persian_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{177, "utf32", "utf32_esperanto_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{178, "utf32", "utf32_hungarian_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{179, "utf32", "utf32_sinhala_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{180, "utf32", "utf32_german2_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{181, "utf32", "utf32_croatian_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{182, "utf32", "utf32_unicode_520_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{183, "utf32", "utf32_vietnamese_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, { 192, UTF8_MB3, UTF8_MB3"_general_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 193, UTF8_MB3, UTF8_MB3"_icelandic_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, @@ -571,7 +601,7 @@ const MYSQLND_CHARSET mysqlnd_charsets[] = { 196, UTF8_MB3, UTF8_MB3"_slovenian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 197, UTF8_MB3, UTF8_MB3"_polish_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 198, UTF8_MB3, UTF8_MB3"_estonian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 119, UTF8_MB3, UTF8_MB3"_spanish_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 199, UTF8_MB3, UTF8_MB3"_spanish_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 200, UTF8_MB3, UTF8_MB3"_swedish_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 201, UTF8_MB3, UTF8_MB3"_turkish_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 202, UTF8_MB3, UTF8_MB3"_czech_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, @@ -584,7 +614,10 @@ const MYSQLND_CHARSET mysqlnd_charsets[] = { 209, UTF8_MB3, UTF8_MB3"_esperanto_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 210, UTF8_MB3, UTF8_MB3"_hungarian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 211, UTF8_MB3, UTF8_MB3"_sinhala_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 213, UTF8_MB3, UTF8_MB3"_croatian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, /*MDB*/ + { 211, UTF8_MB3, UTF8_MB3"_german2_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 213, UTF8_MB3, UTF8_MB3"_croatian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 214, UTF8_MB3, UTF8_MB3"_unicode_520_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 215, UTF8_MB3, UTF8_MB3"_vietnamese_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 224, UTF8_MB4, UTF8_MB4"_unicode_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, { 225, UTF8_MB4, UTF8_MB4"_icelandic_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, @@ -606,6 +639,10 @@ const MYSQLND_CHARSET mysqlnd_charsets[] = { 241, UTF8_MB4, UTF8_MB4"_esperanto_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, { 242, UTF8_MB4, UTF8_MB4"_hungarian_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, { 243, UTF8_MB4, UTF8_MB4"_sinhala_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 244, UTF8_MB4, UTF8_MB4"_german2_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 245, UTF8_MB4, UTF8_MB4"_croatian_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 246, UTF8_MB4, UTF8_MB4"_unicode_520_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 247, UTF8_MB4, UTF8_MB4"_vietnamese_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, { 254, UTF8_MB3, UTF8_MB3"_general_cs", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, { 0, NULL, NULL, 0, 0, NULL, NULL, NULL} diff --git a/ext/mysqlnd/mysqlnd_debug.c b/ext/mysqlnd/mysqlnd_debug.c index 5c77b42459b65..5ed2f8373169e 100644 --- a/ext/mysqlnd/mysqlnd_debug.c +++ b/ext/mysqlnd/mysqlnd_debug.c @@ -516,9 +516,11 @@ enum mysqlnd_debug_parser_state static void MYSQLND_METHOD(mysqlnd_debug, set_mode)(MYSQLND_DEBUG * self, const char * const mode) { - unsigned int mode_len = strlen(mode), i; + unsigned int mode_len, i; enum mysqlnd_debug_parser_state state = PARSER_WAIT_MODIFIER; + mode_len = mode? strlen(mode) : 0; + self->flags = 0; self->nest_level_limit = 0; if (self->file_name && self->file_name != mysqlnd_debug_default_trace_file) { @@ -745,21 +747,26 @@ mysqlnd_debug_init(const char * skip_functions[] TSRMLS_DC) PHPAPI void _mysqlnd_debug(const char * mode TSRMLS_DC) { #if PHP_DEBUG - MYSQLND_DEBUG *dbg = MYSQLND_G(dbg); + MYSQLND_DEBUG * dbg = MYSQLND_G(dbg); if (!dbg) { - MYSQLND_G(dbg) = dbg = mysqlnd_debug_init(mysqlnd_debug_std_no_trace_funcs TSRMLS_CC); - if (!dbg) { - return; + struct st_mysqlnd_plugin_trace_log * trace_log_plugin = mysqlnd_plugin_find("debug_trace"); + if (trace_log_plugin) { + dbg = trace_log_plugin->methods.trace_instance_init(mysqlnd_debug_std_no_trace_funcs TSRMLS_CC); + if (!dbg) { + return; + } + MYSQLND_G(dbg) = dbg; } } - - dbg->m->close(dbg); - dbg->m->set_mode(dbg, mode); - while (zend_stack_count(&dbg->call_stack)) { - zend_stack_del_top(&dbg->call_stack); - } - while (zend_stack_count(&dbg->call_time_stack)) { - zend_stack_del_top(&dbg->call_time_stack); + if (dbg) { + dbg->m->close(dbg); + dbg->m->set_mode(dbg, mode); + while (zend_stack_count(&dbg->call_stack)) { + zend_stack_del_top(&dbg->call_stack); + } + while (zend_stack_count(&dbg->call_time_stack)) { + zend_stack_del_top(&dbg->call_time_stack); + } } #endif } diff --git a/ext/mysqlnd/mysqlnd_debug.h b/ext/mysqlnd/mysqlnd_debug.h index 3372e739aa9ce..272cdb20e5ca5 100644 --- a/ext/mysqlnd/mysqlnd_debug.h +++ b/ext/mysqlnd/mysqlnd_debug.h @@ -101,43 +101,63 @@ PHPAPI char * mysqlnd_get_backtrace(uint max_levels, size_t * length TSRMLS_DC); #define DBG_INF_FMT_EX(dbg_obj, ...) do { if (dbg_skip_trace == FALSE) (dbg_obj)->m->log_va((dbg_obj), __LINE__, __FILE__, -1, "info : ", __VA_ARGS__); } while (0) #define DBG_ERR_FMT_EX(dbg_obj, ...) do { if (dbg_skip_trace == FALSE) (dbg_obj)->m->log_va((dbg_obj), __LINE__, __FILE__, -1, "error: ", __VA_ARGS__); } while (0) -#define DBG_BLOCK_ENTER_EX(dbg_obj, block_name) \ +#define DBG_BLOCK_ENTER_EX(dbg_obj, block_name) DBG_BLOCK_ENTER_EX2((dbg_obj), NULL, (block_name)) +#define DBG_BLOCK_LEAVE_EX(dbg_obj) DBG_BLOCK_LEAVE_EX2((dbg_obj)) + +#define DBG_BLOCK_ENTER_EX2(dbg_obj1, dbg_obj2, block_name) \ { \ - DBG_ENTER_EX(dbg_obj, (block_name)); + DBG_ENTER_EX2((dbg_obj1), (db_obj2), (block_name)); -#define DBG_BLOCK_LEAVE_EX(dbg_obj) \ - DBG_LEAVE_EX((dbg_obj), ;) \ +#define DBG_BLOCK_LEAVE_EX2(dbg_obj1, dbg_obj2) \ + DBG_LEAVE_EX2((dbg_obj1), (dbg_obj2), ;) \ } \ -#define DBG_ENTER_EX(dbg_obj, func_name) \ +#define DBG_ENTER_EX(dbg_obj, func_name) DBG_ENTER_EX2((dbg_obj), (MYSQLND_DEBUG *) NULL, (func_name)) +#define DBG_LEAVE_EX(dbg_obj, leave) DBG_LEAVE_EX2((dbg_obj), (MYSQLND_DEBUG *) NULL, leave) + +#define DBG_ENTER_EX2(dbg_obj1, dbg_obj2, func_name) \ struct timeval __dbg_prof_tp = {0}; \ uint64_t __dbg_prof_start = 0; /* initialization is needed */ \ zend_bool dbg_skip_trace = TRUE; \ - if ((dbg_obj)) { \ - dbg_skip_trace = !(dbg_obj)->m->func_enter((dbg_obj), __LINE__, __FILE__, func_name, strlen(func_name)); \ + if ((dbg_obj1)) { \ + dbg_skip_trace = !(dbg_obj1)->m->func_enter((dbg_obj1), __LINE__, __FILE__, func_name, strlen(func_name)); \ + } \ + if ((dbg_obj2)) { \ + dbg_skip_trace = !(dbg_obj2)->m->func_enter((dbg_obj2), __LINE__, __FILE__, func_name, strlen(func_name)); \ } \ + if (dbg_skip_trace); /* shut compiler's mouth */\ do { \ - if ((dbg_obj) && (dbg_obj)->flags & MYSQLND_DEBUG_PROFILE_CALLS) { \ + if (((dbg_obj1) && (dbg_obj1)->flags & MYSQLND_DEBUG_PROFILE_CALLS) || \ + ((dbg_obj2) && (dbg_obj2)->flags & MYSQLND_DEBUG_PROFILE_CALLS)) \ + { \ DBG_PROFILE_START_TIME(); \ } \ } while (0); -#define DBG_LEAVE_EX(dbg_obj, leave) \ +#define DBG_LEAVE_EX2(dbg_obj1, dbg_obj2, leave) \ do {\ - if ((dbg_obj)) { \ - uint64_t this_call_duration = 0; \ - if ((dbg_obj)->flags & MYSQLND_DEBUG_PROFILE_CALLS) { \ - DBG_PROFILE_END_TIME(this_call_duration); \ - } \ - (dbg_obj)->m->func_leave((dbg_obj), __LINE__, __FILE__, this_call_duration); \ + uint64_t this_call_duration = 0; \ + if (((dbg_obj1) && (dbg_obj1)->flags & MYSQLND_DEBUG_PROFILE_CALLS) || \ + ((dbg_obj2) && (dbg_obj2)->flags & MYSQLND_DEBUG_PROFILE_CALLS)) \ + { \ + DBG_PROFILE_END_TIME(this_call_duration); \ + } \ + if ((dbg_obj1)) { \ + (dbg_obj1)->m->func_leave((dbg_obj1), __LINE__, __FILE__, this_call_duration); \ + } \ + if ((dbg_obj2)) { \ + (dbg_obj2)->m->func_leave((dbg_obj2), __LINE__, __FILE__, this_call_duration); \ } \ leave \ } while (0); -#define DBG_RETURN_EX(dbg_obj, value) DBG_LEAVE_EX(dbg_obj, return (value);) -#define DBG_VOID_RETURN_EX(dbg_obj) DBG_LEAVE_EX(dbg_obj, return;) +#define DBG_RETURN_EX(dbg_obj, value) DBG_LEAVE_EX((dbg_obj), return (value);) +#define DBG_VOID_RETURN_EX(dbg_obj) DBG_LEAVE_EX((dbg_obj), return;) + +#define DBG_RETURN_EX2(dbg_obj1, dbg_obj2, value) DBG_LEAVE_EX2((dbg_obj1), (dbg_obj2), return (value);) +#define DBG_VOID_RETURN_EX2(dbg_obj1, dbg_obj2) DBG_LEAVE_EX2((dbg_obj1), (dbg_obj2), return;) @@ -167,6 +187,18 @@ static inline void DBG_ENTER_EX(MYSQLND_DEBUG * dbg_obj, const char * const func #define DBG_VOID_RETURN DBG_VOID_RETURN_EX(MYSQLND_G(dbg)) #define DBG_BLOCK_LEAVE DBG_BLOCK_LEAVE_EX(MYSQLND_G(dbg)) + +#define TRACE_ALLOC_INF(msg) DBG_INF_EX(MYSQLND_G(trace_alloc), (msg)) +#define TRACE_ALLOC_ERR(msg) DBG_ERR_EX(MYSQLND_G(trace_alloc), (msg)) +#define TRACE_ALLOC_INF_FMT(...) DBG_INF_FMT_EX(MYSQLND_G(trace_alloc), __VA_ARGS__) +#define TRACE_ALLOC_ERR_FMT(...) DBG_ERR_FMT_EX(MYSQLND_G(trace_alloc), __VA_ARGS__) + +#define TRACE_ALLOC_ENTER(func_name) DBG_ENTER_EX2(MYSQLND_G(dbg), MYSQLND_G(trace_alloc), (func_name)) +#define TRACE_ALLOC_BLOCK_ENTER(bname) DBG_BLOCK_ENTER_EX2(MYSQLND_G(dbg), MYSQLND_G(trace_alloc), (bname)) +#define TRACE_ALLOC_RETURN(value) DBG_RETURN_EX2(MYSQLND_G(dbg), MYSQLND_G(trace_alloc), (value)) +#define TRACE_ALLOC_VOID_RETURN DBG_VOID_RETURN_EX2(MYSQLND_G(dbg), MYSQLND_G(trace_alloc)) +#define TRACE_ALLOC_BLOCK_LEAVE DBG_BLOCK_LEAVE_EX2(MYSQLND_G(dbg), MYSQLND_G(trace_alloc)) + #elif MYSQLND_DBG_ENABLED == 0 static inline void DBG_INF(const char * const msg) {} @@ -175,10 +207,21 @@ static inline void DBG_INF_FMT(const char * const format, ...) {} static inline void DBG_ERR_FMT(const char * const format, ...) {} static inline void DBG_ENTER(const char * const func_name) {} #define DBG_BLOCK_ENTER(bname) { -#define DBG_RETURN(value) return (value) -#define DBG_VOID_RETURN return +#define DBG_RETURN(value) return (value) +#define DBG_VOID_RETURN return #define DBG_BLOCK_LEAVE } + +static inline void TRACE_ALLOC_INF(const char * const msg) {} +static inline void TRACE_ALLOC_ERR(const char * const msg) {} +static inline void TRACE_ALLOC_INF_FMT(const char * const format, ...) {} +static inline void TRACE_ALLOC_ERR_FMT(const char * const format, ...) {} +static inline void TRACE_ALLOC_ENTER(const char * const func_name) {} +#define TRACE_ALLOC_BLOCK_ENTER(bname) { +#define TRACE_ALLOC_RETURN(value) return (value) +#define TRACE_ALLOC_VOID_RETURN return +#define TRACE_ALLOC_BLOCK_LEAVE } + #endif #endif /* MYSQLND_DEBUG_H */ diff --git a/ext/mysqlnd/mysqlnd_enum_n_def.h b/ext/mysqlnd/mysqlnd_enum_n_def.h index b0fe88648ef41..c8daa0c79bf58 100644 --- a/ext/mysqlnd/mysqlnd_enum_n_def.h +++ b/ext/mysqlnd/mysqlnd_enum_n_def.h @@ -37,6 +37,8 @@ #define MYSQLND_ASSEMBLED_PACKET_MAX_SIZE 3UL*1024UL*1024UL*1024UL +#define MYSQLND_DEFAULT_AUTH_PROTOCOL "mysql_native_password" + #define MYSQLND_ERRMSG_SIZE 512 #define MYSQLND_SQLSTATE_LENGTH 5 #define MYSQLND_SQLSTATE_NULL "00000" diff --git a/ext/mysqlnd/mysqlnd_loaddata.c b/ext/mysqlnd/mysqlnd_loaddata.c index 61cf235988bb9..4655481af951e 100644 --- a/ext/mysqlnd/mysqlnd_loaddata.c +++ b/ext/mysqlnd/mysqlnd_loaddata.c @@ -188,7 +188,7 @@ mysqlnd_handle_local_infile(MYSQLND_CONN_DATA * conn, const char * filename, zen char tmp_buf[sizeof(conn->error_info->error)]; int tmp_error_no; *is_warning = TRUE; - /* error occured */ + /* error occurred */ tmp_error_no = infile.local_infile_error(info, tmp_buf, sizeof(tmp_buf) TSRMLS_CC); SET_CLIENT_ERROR(*conn->error_info, tmp_error_no, UNKNOWN_SQLSTATE, tmp_buf); /* write empty packet to server */ @@ -211,7 +211,7 @@ mysqlnd_handle_local_infile(MYSQLND_CONN_DATA * conn, const char * filename, zen goto infile_error; } - /* error during read occured */ + /* error during read occurred */ if (bufsize < 0) { char tmp_buf[sizeof(conn->error_info->error)]; int tmp_error_no; diff --git a/ext/mysqlnd/mysqlnd_net.c b/ext/mysqlnd/mysqlnd_net.c index a641a41d2f9ee..7458f76528db6 100644 --- a/ext/mysqlnd/mysqlnd_net.c +++ b/ext/mysqlnd/mysqlnd_net.c @@ -239,17 +239,19 @@ MYSQLND_METHOD(mysqlnd_net, post_connect_set_opt)(MYSQLND_NET * const net, { php_stream * net_stream = net->data->m.get_stream(net TSRMLS_CC); DBG_ENTER("mysqlnd_net::post_connect_set_opt"); - if (net->data->options.timeout_read) { - struct timeval tv; - DBG_INF_FMT("setting %u as PHP_STREAM_OPTION_READ_TIMEOUT", net->data->options.timeout_read); - tv.tv_sec = net->data->options.timeout_read; - tv.tv_usec = 0; - php_stream_set_option(net_stream, PHP_STREAM_OPTION_READ_TIMEOUT, 0, &tv); - } + if (net_stream) { + if (net->data->options.timeout_read) { + struct timeval tv; + DBG_INF_FMT("setting %u as PHP_STREAM_OPTION_READ_TIMEOUT", net->data->options.timeout_read); + tv.tv_sec = net->data->options.timeout_read; + tv.tv_usec = 0; + php_stream_set_option(net_stream, PHP_STREAM_OPTION_READ_TIMEOUT, 0, &tv); + } - if (!memcmp(scheme, "tcp://", sizeof("tcp://") - 1)) { - /* TCP -> Set TCP_NODELAY */ - mysqlnd_set_sock_no_delay(net_stream TSRMLS_CC); + if (!memcmp(scheme, "tcp://", sizeof("tcp://") - 1)) { + /* TCP -> Set TCP_NODELAY */ + mysqlnd_set_sock_no_delay(net_stream TSRMLS_CC); + } } DBG_VOID_RETURN; @@ -1051,6 +1053,7 @@ static php_stream * MYSQLND_METHOD(mysqlnd_net, get_stream)(const MYSQLND_NET * const net TSRMLS_DC) { DBG_ENTER("mysqlnd_net::get_stream"); + DBG_INF_FMT("%p", net? net->data->stream:NULL); DBG_RETURN(net? net->data->stream:NULL); } /* }}} */ diff --git a/ext/mysqlnd/mysqlnd_ps.c b/ext/mysqlnd/mysqlnd_ps.c index 90e685654ba49..1b48ba1d7b23c 100644 --- a/ext/mysqlnd/mysqlnd_ps.c +++ b/ext/mysqlnd/mysqlnd_ps.c @@ -636,6 +636,8 @@ MYSQLND_METHOD(mysqlnd_stmt, execute)(MYSQLND_STMT * const s TSRMLS_DC) have it again. */ stmt->result->m.free_result_buffers(stmt->result TSRMLS_CC); + + stmt->state = MYSQLND_STMT_PREPARED; } else if (stmt->state < MYSQLND_STMT_PREPARED) { /* Only initted - error */ SET_CLIENT_ERROR(*conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, @@ -1221,8 +1223,6 @@ MYSQLND_METHOD(mysqlnd_stmt, reset)(MYSQLND_STMT * const s TSRMLS_DC) COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info); } *stmt->upsert_status = *conn->upsert_status; - - stmt->state = MYSQLND_STMT_PREPARED; } DBG_INF(ret == PASS? "PASS":"FAIL"); DBG_RETURN(ret); @@ -1261,8 +1261,6 @@ MYSQLND_METHOD(mysqlnd_stmt, flush)(MYSQLND_STMT * const s TSRMLS_DC) stmt->result->m.skip_result(stmt->result TSRMLS_CC); } } while (mysqlnd_stmt_more_results(s) && mysqlnd_stmt_next_result(s) == PASS); - - stmt->state = MYSQLND_STMT_PREPARED; } DBG_INF(ret == PASS? "PASS":"FAIL"); DBG_RETURN(ret); diff --git a/ext/mysqlnd/mysqlnd_structs.h b/ext/mysqlnd/mysqlnd_structs.h index b355a0d5f6286..856ebd2ead9aa 100644 --- a/ext/mysqlnd/mysqlnd_structs.h +++ b/ext/mysqlnd/mysqlnd_structs.h @@ -473,7 +473,11 @@ typedef enum_func_status (*func_mysqlnd_conn_data__tx_rollback)(MYSQLND_CONN_DAT typedef enum_func_status (*func_mysqlnd_conn_data__local_tx_start)(MYSQLND_CONN_DATA * conn, size_t this_func TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_conn_data__local_tx_end)(MYSQLND_CONN_DATA * conn, size_t this_func, enum_func_status status TSRMLS_DC); - +typedef enum_func_status (*func_mysqlnd_conn_data__execute_init_commands)(MYSQLND_CONN_DATA * conn TSRMLS_DC); +typedef unsigned int (*func_mysqlnd_conn_data__get_updated_connect_flags)(MYSQLND_CONN_DATA * conn, unsigned int mysql_flags TSRMLS_DC); +typedef enum_func_status (*func_mysqlnd_conn_data__connect_handshake)(MYSQLND_CONN_DATA * conn, const char * const host, const char * const user, const char * const passwd, const unsigned int passwd_len, const char * const db, const unsigned int db_len, const unsigned int mysql_flags TSRMLS_DC); +typedef enum_func_status (*func_mysqlnd_conn_data__simple_command_send_request)(MYSQLND_CONN_DATA * conn, enum php_mysqlnd_server_command command, const zend_uchar * const arg, size_t arg_len, zend_bool silent, zend_bool ignore_upsert_status TSRMLS_DC); +typedef struct st_mysqlnd_authentication_plugin * (*func_mysqlnd_conn_data__fetch_auth_plugin_by_name)(const char * const requested_protocol TSRMLS_DC); struct st_mysqlnd_conn_data_methods { @@ -553,6 +557,12 @@ struct st_mysqlnd_conn_data_methods func_mysqlnd_conn_data__local_tx_start local_tx_start; func_mysqlnd_conn_data__local_tx_end local_tx_end; + + func_mysqlnd_conn_data__execute_init_commands execute_init_commands; + func_mysqlnd_conn_data__get_updated_connect_flags get_updated_connect_flags; + func_mysqlnd_conn_data__connect_handshake connect_handshake; + func_mysqlnd_conn_data__simple_command_send_request simple_command_send_request; + func_mysqlnd_conn_data__fetch_auth_plugin_by_name fetch_auth_plugin_by_name; }; diff --git a/ext/mysqlnd/php_mysqlnd.c b/ext/mysqlnd/php_mysqlnd.c index 20fcc5e7adb8d..0a8fd609086c2 100644 --- a/ext/mysqlnd/php_mysqlnd.c +++ b/ext/mysqlnd/php_mysqlnd.c @@ -221,6 +221,8 @@ static PHP_GINIT_FUNCTION(mysqlnd) mysqlnd_globals->collect_memory_statistics = FALSE; mysqlnd_globals->debug = NULL; /* The actual string */ mysqlnd_globals->dbg = NULL; /* The DBG object*/ + mysqlnd_globals->trace_alloc_settings = NULL; + mysqlnd_globals->trace_alloc = NULL; mysqlnd_globals->net_cmd_buffer_size = MYSQLND_NET_CMD_BUFFER_MIN_SIZE; mysqlnd_globals->net_read_buffer_size = 32768; mysqlnd_globals->net_read_timeout = 31536000; @@ -253,6 +255,7 @@ PHP_INI_BEGIN() STD_PHP_INI_BOOLEAN("mysqlnd.collect_statistics", "1", PHP_INI_ALL, OnUpdateBool, collect_statistics, zend_mysqlnd_globals, mysqlnd_globals) STD_PHP_INI_BOOLEAN("mysqlnd.collect_memory_statistics", "0", PHP_INI_SYSTEM, OnUpdateBool, collect_memory_statistics, zend_mysqlnd_globals, mysqlnd_globals) STD_PHP_INI_ENTRY("mysqlnd.debug", NULL, PHP_INI_SYSTEM, OnUpdateString, debug, zend_mysqlnd_globals, mysqlnd_globals) + STD_PHP_INI_ENTRY("mysqlnd.trace_alloc", NULL, PHP_INI_SYSTEM, OnUpdateString, trace_alloc_settings, zend_mysqlnd_globals, mysqlnd_globals) STD_PHP_INI_ENTRY("mysqlnd.net_cmd_buffer_size", MYSQLND_NET_CMD_BUFFER_MIN_SIZE_STR, PHP_INI_ALL, OnUpdateNetCmdBufferSize, net_cmd_buffer_size, zend_mysqlnd_globals, mysqlnd_globals) STD_PHP_INI_ENTRY("mysqlnd.net_read_buffer_size", "32768",PHP_INI_ALL, OnUpdateLong, net_read_buffer_size, zend_mysqlnd_globals, mysqlnd_globals) STD_PHP_INI_ENTRY("mysqlnd.net_read_timeout", "31536000", PHP_INI_SYSTEM, OnUpdateLong, net_read_timeout, zend_mysqlnd_globals, mysqlnd_globals) @@ -306,11 +309,14 @@ static PHP_RINIT_FUNCTION(mysqlnd) MYSQLND_G(dbg) = NULL; if (trace_log_plugin) { MYSQLND_DEBUG * dbg = trace_log_plugin->methods.trace_instance_init(mysqlnd_debug_std_no_trace_funcs TSRMLS_CC); - if (!dbg) { + MYSQLND_DEBUG * trace_alloc = trace_log_plugin->methods.trace_instance_init(NULL TSRMLS_CC); + if (!dbg || !trace_alloc) { return FAILURE; } dbg->m->set_mode(dbg, MYSQLND_G(debug)); + trace_alloc->m->set_mode(trace_alloc, MYSQLND_G(trace_alloc_settings)); MYSQLND_G(dbg) = dbg; + MYSQLND_G(trace_alloc) = trace_alloc; } } return SUCCESS; @@ -324,13 +330,19 @@ static PHP_RINIT_FUNCTION(mysqlnd) */ static PHP_RSHUTDOWN_FUNCTION(mysqlnd) { - MYSQLND_DEBUG *dbg = MYSQLND_G(dbg); + MYSQLND_DEBUG * dbg = MYSQLND_G(dbg); + MYSQLND_DEBUG * trace_alloc = MYSQLND_G(trace_alloc); DBG_ENTER("RSHUTDOWN"); if (dbg) { dbg->m->close(dbg); dbg->m->free_handle(dbg); MYSQLND_G(dbg) = NULL; } + if (trace_alloc) { + trace_alloc->m->close(trace_alloc); + trace_alloc->m->free_handle(trace_alloc); + MYSQLND_G(trace_alloc) = NULL; + } return SUCCESS; } /* }}} */ diff --git a/ext/oci8/tests/pecl_bug10194.phpt b/ext/oci8/tests/pecl_bug10194.phpt index 9947e15dbcf8e..3c1c7887c2fbc 100644 --- a/ext/oci8/tests/pecl_bug10194.phpt +++ b/ext/oci8/tests/pecl_bug10194.phpt @@ -5,6 +5,9 @@ PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside $target_dbs = array('oracledb' => 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'); +if (getenv("USE_ZEND_ALLOC") === "0") { + die("skip Zend MM disabled"); +} ?> --INI-- memory_limit=10M diff --git a/ext/oci8/tests/pecl_bug10194_blob_64.phpt b/ext/oci8/tests/pecl_bug10194_blob_64.phpt index 45788a41b430d..e1a4cc034e2d3 100644 --- a/ext/oci8/tests/pecl_bug10194_blob_64.phpt +++ b/ext/oci8/tests/pecl_bug10194_blob_64.phpt @@ -6,6 +6,9 @@ $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on t require(dirname(__FILE__).'/skipif.inc'); if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request'); if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only"); +if (getenv("USE_ZEND_ALLOC") === "0") { + die("skip Zend MM disabled"); +} ?> --INI-- memory_limit=6M diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index e98d863be91ec..52d46b2fd0f77 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -387,7 +387,7 @@ const zend_function_entry odbc_functions[] = { }; /* }}} */ -ZEND_DECLARE_MODULE_GLOBALS(odbc); +ZEND_DECLARE_MODULE_GLOBALS(odbc) static PHP_GINIT_FUNCTION(odbc); /* {{{ odbc_module_entry diff --git a/ext/openssl/CREDITS b/ext/openssl/CREDITS index c2f50d63089ef..b685ce13e5cbf 100644 --- a/ext/openssl/CREDITS +++ b/ext/openssl/CREDITS @@ -1,2 +1,2 @@ OpenSSL -Stig Venaas, Wez Furlong, Sascha Kettler +Stig Venaas, Wez Furlong, Sascha Kettler, Scott MacVicar diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index a48ab20d6a797..938e0e1f75157 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -238,6 +238,16 @@ ZEND_BEGIN_ARG_INFO(arginfo_openssl_pkey_get_details, 0) ZEND_ARG_INFO(0, key) ZEND_END_ARG_INFO() +#if OPENSSL_VERSION_NUMBER >= 0x10000000L +ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pbkdf2, 0, 0, 4) + ZEND_ARG_INFO(0, password) + ZEND_ARG_INFO(0, salt) + ZEND_ARG_INFO(0, key_length) + ZEND_ARG_INFO(0, iterations) + ZEND_ARG_INFO(0, digest_algorithm) +ZEND_END_ARG_INFO() +#endif + ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs7_verify, 0, 0, 2) ZEND_ARG_INFO(0, filename) ZEND_ARG_INFO(0, flags) @@ -424,6 +434,10 @@ const zend_function_entry openssl_functions[] = { PHP_FE(openssl_seal, arginfo_openssl_seal) PHP_FE(openssl_open, arginfo_openssl_open) +#if OPENSSL_VERSION_NUMBER >= 0x10000000L + PHP_FE(openssl_pbkdf2, arginfo_openssl_pbkdf2) +#endif + /* for S/MIME handling */ PHP_FE(openssl_pkcs7_verify, arginfo_openssl_pkcs7_verify) PHP_FE(openssl_pkcs7_decrypt, arginfo_openssl_pkcs7_decrypt) @@ -3313,6 +3327,57 @@ PHP_FUNCTION(openssl_pkey_get_details) /* }}} */ +#if OPENSSL_VERSION_NUMBER >= 0x10000000L + +/* {{{ proto string openssl_pbkdf2(string password, string salt, long key_length, long iterations [, string digest_method = "sha1"]) + Generates a PKCS5 v2 PBKDF2 string, defaults to sha1 */ +PHP_FUNCTION(openssl_pbkdf2) +{ + long key_length = 0, iterations = 0; + char *password; int password_len; + char *salt; int salt_len; + char *method; int method_len = 0; + unsigned char *out_buffer; + + const EVP_MD *digest; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssll|s", + &password, &password_len, + &salt, &salt_len, + &key_length, &iterations, + &method, &method_len) == FAILURE) { + return; + } + + if (key_length <= 0) { + RETURN_FALSE; + } + + if (method_len) { + digest = EVP_get_digestbyname(method); + } else { + digest = EVP_sha1(); + } + + if (!digest) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown signature algorithm"); + RETURN_FALSE; + } + + out_buffer = emalloc(key_length + 1); + out_buffer[key_length] = '\0'; + + if (PKCS5_PBKDF2_HMAC(password, password_len, (unsigned char *)salt, salt_len, iterations, digest, key_length, out_buffer) == 1) { + RETVAL_STRINGL((char *)out_buffer, key_length, 0); + } else { + efree(out_buffer); + RETURN_FALSE; + } +} +/* }}} */ + +#endif + /* {{{ PKCS7 S/MIME functions */ /* {{{ proto bool openssl_pkcs7_verify(string filename, long flags [, string signerscerts [, array cainfo [, string extracerts [, string content]]]]) diff --git a/ext/openssl/php_openssl.h b/ext/openssl/php_openssl.h index fc118dba1ebb8..2de211a64cfbc 100644 --- a/ext/openssl/php_openssl.h +++ b/ext/openssl/php_openssl.h @@ -52,6 +52,8 @@ PHP_FUNCTION(openssl_private_decrypt); PHP_FUNCTION(openssl_public_encrypt); PHP_FUNCTION(openssl_public_decrypt); +PHP_FUNCTION(openssl_pbkdf2); + PHP_FUNCTION(openssl_pkcs7_verify); PHP_FUNCTION(openssl_pkcs7_decrypt); PHP_FUNCTION(openssl_pkcs7_sign); diff --git a/ext/openssl/tests/openssl_pbkdf2.phpt b/ext/openssl/tests/openssl_pbkdf2.phpt new file mode 100644 index 0000000000000..3ec4dce23636c --- /dev/null +++ b/ext/openssl/tests/openssl_pbkdf2.phpt @@ -0,0 +1,26 @@ +--TEST-- +openssl_pbkdf2() tests +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(40) "0c60c80f961f0e71f3a9b524af6012062fe037a6" +string(40) "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957" +string(40) "4b007901b765489abead49d926f721d065a429c1" +string(50) "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038" +string(32) "56fa6aa75548099dcc37d7f03425e0c3" diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index ecb51c1f5e898..108119a0bffdb 100755 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -816,7 +816,7 @@ PHP_FUNCTION(pcntl_exec) if (execve(path, argv, envp) == -1) { PCNTL_G(last_error) = errno; - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error has occured: (errno %d) %s", errno, strerror(errno)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error has occurred: (errno %d) %s", errno, strerror(errno)); } /* Cleanup */ @@ -826,7 +826,7 @@ PHP_FUNCTION(pcntl_exec) if (execv(path, argv) == -1) { PCNTL_G(last_error) = errno; - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error has occured: (errno %d) %s", errno, strerror(errno)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error has occurred: (errno %d) %s", errno, strerror(errno)); } } @@ -1127,7 +1127,7 @@ PHP_FUNCTION(pcntl_getpriority) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error %d: Invalid identifier flag", errno); break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown error %d has occured", errno); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown error %d has occurred", errno); break; } RETURN_FALSE; @@ -1167,7 +1167,7 @@ PHP_FUNCTION(pcntl_setpriority) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error %d: Only a super user may attempt to increase the process priority", errno); break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown error %d has occured", errno); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown error %d has occurred", errno); break; } RETURN_FALSE; diff --git a/ext/pcntl/tests/pcntl_exec_3.phpt b/ext/pcntl/tests/pcntl_exec_3.phpt index d27c1c9962805..5349381d92b89 100644 --- a/ext/pcntl/tests/pcntl_exec_3.phpt +++ b/ext/pcntl/tests/pcntl_exec_3.phpt @@ -13,5 +13,5 @@ unlink($file); Warning: pcntl_exec() expects at least 1 parameter, 0 given %s NULL -Warning: pcntl_exec(): Error has occured: (errno %d) %s +Warning: pcntl_exec(): Error has occurred: (errno %d) %s bool(false) diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index b4f383c94f015..acdc0dd90d616 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -700,7 +700,7 @@ static PHP_METHOD(PDO, inTransaction) RETURN_BOOL(dbh->in_txn); } - RETURN_LONG(dbh->methods->in_transaction(dbh TSRMLS_CC)); + RETURN_BOOL(dbh->methods->in_transaction(dbh TSRMLS_CC)); } /* }}} */ diff --git a/ext/pdo/tests/pdo_test.inc b/ext/pdo/tests/pdo_test.inc index f2e076793a755..443c8dd8222eb 100644 --- a/ext/pdo/tests/pdo_test.inc +++ b/ext/pdo/tests/pdo_test.inc @@ -66,13 +66,19 @@ class PDOTest { } static function test_factory($file) { - $data = file_get_contents($file); - $data = preg_replace('/^.*--REDIRECTTEST--/s', '', $data); - $config = eval($data); + $config = self::get_config($file); foreach ($config['ENV'] as $k => $v) { putenv("$k=$v"); } return self::factory(); } + + static function get_config($file) { + $data = file_get_contents($file); + $data = preg_replace('/^.*--REDIRECTTEST--/s', '', $data); + $config = eval($data); + + return $config; + } } ?> diff --git a/ext/pdo_firebird/tests/bug_47415.phpt b/ext/pdo_firebird/tests/bug_47415.phpt index cedc2c45b25ed..12cd782f267e5 100644 --- a/ext/pdo_firebird/tests/bug_47415.phpt +++ b/ext/pdo_firebird/tests/bug_47415.phpt @@ -2,6 +2,7 @@ Bug #47415 PDO_Firebird segfaults when passing lowercased column name to bindColumn() --SKIPIF-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --INI-- ibase.timestampformat=%Y-%m-%d %H:%M:%S --FILE-- diff --git a/ext/pdo_firebird/tests/rowCount.phpt b/ext/pdo_firebird/tests/rowCount.phpt index 3d7f71c83b6e6..1a009508e0006 100644 --- a/ext/pdo_firebird/tests/rowCount.phpt +++ b/ext/pdo_firebird/tests/rowCount.phpt @@ -2,6 +2,7 @@ PDO_Firebird: rowCount --SKIPIF-- + --FILE-- server); if (row_count == (my_ulonglong)-1) { - /* we either have a query that returned a result set or an error occured + /* we either have a query that returned a result set or an error occurred lets see if we have access to a result set */ if (!H->buffered) { S->result = mysql_use_result(H->server); diff --git a/ext/pdo_mysql/pdo_mysql.c b/ext/pdo_mysql/pdo_mysql.c index 5118406e9e319..ea69c3c11b1d2 100755 --- a/ext/pdo_mysql/pdo_mysql.c +++ b/ext/pdo_mysql/pdo_mysql.c @@ -35,7 +35,7 @@ ZEND_GET_MODULE(pdo_mysql) #endif -ZEND_DECLARE_MODULE_GLOBALS(pdo_mysql); +ZEND_DECLARE_MODULE_GLOBALS(pdo_mysql) /* The default socket location is sometimes defined by configure. diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c index 4e039d2a740b6..e700ef8c3ce1a 100755 --- a/ext/pdo_odbc/odbc_stmt.c +++ b/ext/pdo_odbc/odbc_stmt.c @@ -633,58 +633,49 @@ static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned l } if (rc == SQL_SUCCESS_WITH_INFO) { - /* promote up to a bigger buffer */ - - if (C->fetched_len != SQL_NO_TOTAL) { - /* use size suggested by the driver, if it knows it */ - buf = emalloc(C->fetched_len + 1); - memcpy(buf, C->data, C->fetched_len); - buf[C->fetched_len] = 0; - used = C->fetched_len; - } else { - buf = estrndup(C->data, 256); - used = 255; /* not 256; the driver NUL terminated the buffer */ - } - + /* this is a 'long column' + + read the column in 255 byte blocks until the end of the column is reached, reassembling those blocks + in order into the output buffer + + this loop has to work whether or not SQLGetData() provides the total column length. + calling SQLDescribeCol() or other, specifically to get the column length, then doing a single read + for that size would be slower except maybe for extremely long columns.*/ + char *buf2; + + buf2 = emalloc(256); + buf = estrndup(C->data, 256); + used = 255; /* not 256; the driver NUL terminated the buffer */ + do { C->fetched_len = 0; - rc = SQLGetData(S->stmt, colno+1, SQL_C_CHAR, - buf + used, alloced - used, - &C->fetched_len); - - if (rc == SQL_NO_DATA) { - /* we got the lot */ - break; - } else if (rc != SQL_SUCCESS) { - pdo_odbc_stmt_error("SQLGetData"); - if (rc != SQL_SUCCESS_WITH_INFO) { - break; - } - } - - if (C->fetched_len == SQL_NO_TOTAL) { - used += alloced - used; + /* read block. 256 bytes => 255 bytes are actually read, the last 1 is NULL */ + rc = SQLGetData(S->stmt, colno+1, SQL_C_CHAR, buf2, 256, &C->fetched_len); + + /* resize output buffer and reassemble block */ + if (rc==SQL_SUCCESS_WITH_INFO) { + /* point 5, in section "Retrieving Data with SQLGetData" in http://msdn.microsoft.com/en-us/library/windows/desktop/ms715441(v=vs.85).aspx + states that if SQL_SUCCESS_WITH_INFO, fetched_len will be > 255 (greater than buf2's size) + (if a driver fails to follow that and wrote less than 255 bytes to buf2, this will AV or read garbage into buf) */ + buf = erealloc(buf, used + 255+1); + memcpy(buf + used, buf2, 255); + used = used + 255; + } else if (rc==SQL_SUCCESS) { + buf = erealloc(buf, used + C->fetched_len+1); + memcpy(buf + used, buf2, C->fetched_len); + used = used + C->fetched_len; } else { - used += C->fetched_len; - } - - if (rc == SQL_SUCCESS) { - /* this was the final fetch */ + /* includes SQL_NO_DATA */ break; } - - /* we need to fetch another chunk; resize the - * buffer */ - alloced *= 2; - buf = erealloc(buf, alloced); + } while (1); - - /* size down */ - if (used < alloced - 1024) { - alloced = used+1; - buf = erealloc(buf, used+1); - } + + efree(buf2); + + /* NULL terminate the buffer once, when finished, for use with the rest of PHP */ buf[used] = '\0'; + *ptr = buf; *caller_frees = 1; *len = used; diff --git a/ext/pdo_odbc/tests/common.phpt b/ext/pdo_odbc/tests/common.phpt index f64da1a438e86..276f2b78e3d43 100644 --- a/ext/pdo_odbc/tests/common.phpt +++ b/ext/pdo_odbc/tests/common.phpt @@ -2,17 +2,40 @@ ODBC --SKIPIF-- +if (!extension_loaded('pdo_odbc')) print 'skip'; +if (substr(PHP_OS, 0, 3) == 'WIN' && + false === getenv('PDOTEST_DSN') && + false === getenv('PDO_ODBC_TEST_DSN') && + !extension_loaded('com_dotnet')) { + die('skip - either PDOTEST_DSN or com_dotnet extension is needed to setup the connection'); +} --REDIRECTTEST-- # magic auto-configuration $config = array( - 'TESTS' => 'ext/pdo/tests' + 'TESTS' => 'ext/pdo/tests', + 'ENV' => array() ); - -if (false !== getenv('PDO_ODBC_TEST_DSN')) { - # user set them from their shell +// try loading PDO driver using ENV vars and if none given, and on Windows, try using MS Access +// and if not, skip the test +// +// try to use common PDO env vars, instead of PDO_ODBC specific +if (false !== getenv('PDOTEST_DSN')) { + // user should have to set PDOTEST_DSN so that: + // 1. test is skipped if user doesn't want to test it, even if they have MS Access installed + // 2. it detects if ODBC driver is not installed - to avoid test bug + // 3. it detects if ODBC driver is installed - so test will be run + // 4. so a specific ODBC driver can be tested - if system has multiple ODBC drivers + + $config['ENV']['PDOTEST_DSN'] = getenv('PDOTEST_DSN'); + $config['ENV']['PDOTEST_USER'] = getenv('PDOTEST_USER'); + $config['ENV']['PDOTEST_PASS'] = getenv('PDOTEST_PASS'); + if (false !== getenv('PDOTEST_ATTR')) { + $config['ENV']['PDOTEST_ATTR'] = getenv('PDOTEST_ATTR'); + } +} else if (false !== getenv('PDO_ODBC_TEST_DSN')) { + // user set these from their shell instead $config['ENV']['PDOTEST_DSN'] = getenv('PDO_ODBC_TEST_DSN'); $config['ENV']['PDOTEST_USER'] = getenv('PDO_ODBC_TEST_USER'); $config['ENV']['PDOTEST_PASS'] = getenv('PDO_ODBC_TEST_PASS'); @@ -20,10 +43,13 @@ if (false !== getenv('PDO_ODBC_TEST_DSN')) { $config['ENV']['PDOTEST_ATTR'] = getenv('PDO_ODBC_TEST_ATTR'); } } elseif (preg_match('/^WIN/i', PHP_OS)) { - # on windows, try to create a temporary MS access database + // on Windows and user didn't set PDOTEST_DSN, try this as a fallback: + // check if MS Access DB is installed, and if yes, try using it. create a temporary MS access database. + // $path = realpath(dirname(__FILE__)) . '\pdo_odbc.mdb'; if (!file_exists($path)) { try { + // try to create database $adox = new COM('ADOX.Catalog'); $adox->Create('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' . $path); $adox = null; @@ -32,9 +58,12 @@ if (false !== getenv('PDO_ODBC_TEST_DSN')) { } } if (file_exists($path)) { + // database was created and written to file system $config['ENV']['PDOTEST_DSN'] = "odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=$path;Uid=Admin"; - } -} + } // else: $config['ENV']['PDOTEST_DSN'] not set +} // else: $config['ENV']['PDOTEST_DSN'] not set +// test will be skipped. see SKIPIF section of long_columns.phpt + # other magic autodetection here, eg: for DB2 by inspecting env /* $USER = 'db2inst1'; diff --git a/ext/pdo_odbc/tests/long_columns.phpt b/ext/pdo_odbc/tests/long_columns.phpt index 65ec2f96e90d6..e3430ded47d6b 100644 --- a/ext/pdo_odbc/tests/long_columns.phpt +++ b/ext/pdo_odbc/tests/long_columns.phpt @@ -3,9 +3,44 @@ PDO ODBC "long" columns --SKIPIF-- --FILE-- " ex: SET PDOTEST_DSN=odbc:accdb12 +// -note: on Windows, " is included in environment variable +// +// easy way to compile: +// configure --disable-all --enable-cli --enable-zts --enable-pdo --with-pdo-odbc --enable-debug +// configure --disable-all --eanble-cli --enable-pdo --with-pdo-odbc=unixODBC,/usr,/usr --with-unixODBC=/usr --enable-debug +// + require 'ext/pdo/tests/pdo_test.inc'; $db = PDOTest::test_factory('ext/pdo_odbc/tests/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); @@ -20,27 +55,86 @@ if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data CL $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); -$sizes = array(32, 64, 128, 253, 254, 255, 256, 257, 258, 512, 1024, 2048, 3998, 3999, 4000); +// the driver reads columns in blocks of 255 bytes and then reassembles those blocks into a single buffer. +// test sizes around 255 to make sure that the reassembly works (and that the column is split into 255 byte blocks by the database) +// also, test sizes below 255 to make sure that they work - and are not treated as a long column (should be read in a single read) +$sizes = array(32, 53, 64, 79, 128, 253, 254, 255, 256, 257, 258, 1022, 1023, 1024, 1025, 1026, 510, 511, 512, 513, 514, 1278, 1279, 1280, 1281, 1282, 2046, 2047, 2048, 2049, 2050, 1534, 1535, 1536, 1537, 1538, 3070, 3071, 3072, 3073, 3074, 3998, 3999, 4000); -$db->beginTransaction(); -$insert = $db->prepare('INSERT INTO TEST VALUES (?, ?)'); +function alpha_repeat($len) { + // use the alphabet instead of 'i' characters to make sure the blocks don't overlap when they are reassembled + $out = ""; + while (strlen($out) < $len) { + $out .= "abcdefghijklmnopqrstuvwxyz"; + } + return substr($out, 0, $len); +} + +// don't use Prepared Statements. that fails on MS SQL server (works with Access, MyODBC), which is a separate failure, feature/code-path from what +// this test does - nice to be able to test using MS SQL server foreach ($sizes as $num) { - $insert->execute(array($num, str_repeat('i', $num))); + $text = alpha_repeat($num); + $db->exec("INSERT INTO TEST VALUES($num, '$text')"); } -$insert = null; -$db->commit(); +// verify data foreach ($db->query('SELECT id, data from TEST') as $row) { - $expect = str_repeat('i', $row[0]); + $expect = alpha_repeat($row[0]); if (strcmp($expect, $row[1])) { echo "Failed on size $row[id]:\n"; printf("Expected %d bytes, got %d\n", strlen($expect), strlen($row['data'])); - echo bin2hex($expect) . "\n"; - echo bin2hex($row['data']) . "\n"; + echo ($expect) . "\n"; + echo ($row['data']) . "\n"; + } else { + echo "Passed on size $row[id]\n"; } } echo "Finished\n"; --EXPECT-- +Passed on size 32 +Passed on size 53 +Passed on size 64 +Passed on size 79 +Passed on size 128 +Passed on size 253 +Passed on size 254 +Passed on size 255 +Passed on size 256 +Passed on size 257 +Passed on size 258 +Passed on size 1022 +Passed on size 1023 +Passed on size 1024 +Passed on size 1025 +Passed on size 1026 +Passed on size 510 +Passed on size 511 +Passed on size 512 +Passed on size 513 +Passed on size 514 +Passed on size 1278 +Passed on size 1279 +Passed on size 1280 +Passed on size 1281 +Passed on size 1282 +Passed on size 2046 +Passed on size 2047 +Passed on size 2048 +Passed on size 2049 +Passed on size 2050 +Passed on size 1534 +Passed on size 1535 +Passed on size 1536 +Passed on size 1537 +Passed on size 1538 +Passed on size 3070 +Passed on size 3071 +Passed on size 3072 +Passed on size 3073 +Passed on size 3074 +Passed on size 3998 +Passed on size 3999 +Passed on size 4000 Finished + diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index f81cf9b1edb97..480c728d1546b 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -760,7 +760,7 @@ static struct pdo_dbh_methods sqlite_methods = { static char *make_filename_safe(const char *filename TSRMLS_DC) { - if (*filename && strncmp(filename, ":memory:", sizeof(":memory:")-1)) { + if (*filename && memcmp(filename, ":memory:", sizeof(":memory:"))) { char *fullpath = expand_filepath(filename, NULL TSRMLS_CC); if (!fullpath) { diff --git a/ext/phar/cgidebug b/ext/phar/cgidebug deleted file mode 100755 index 1907581900e27..0000000000000 --- a/ext/phar/cgidebug +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -export SCRIPT_NAME=/front.phar.php -export PATH_INFO=/index.php -export SCRIPT_FILENAME=/home/cellog/workspace/php5/ext/phar/tests/front.phar.php -export PATH_TRANSLATED=/home/cellog/workspace/php5/ext/phar/tests/front.phar.php -export REDIRECT_STATUS=1 -export REQUEST_METHOD=GET -export REQUEST_URI=/front.phar.php/index.php -cd /home/cellog/workspace/php5 -ddd sapi/cgi/php-cgi & -cd /home/cellog/workspace/php5/ext/phar diff --git a/ext/phar/package.php b/ext/phar/package.php deleted file mode 100644 index 181c7c45ffd9f..0000000000000 --- a/ext/phar/package.php +++ /dev/null @@ -1,139 +0,0 @@ -compress()/decompress(). - * phar.extract_list and Phar::getExtractList() are removed - -Major feature functionality release - * phar.cache_list allows web-based phar applications to run at equal or faster than - their on-disk equivalent [Greg] - * new default stub allows running of phar-based phars without phar extension [Greg/Steph] - * add support for tar-based and zip-based phar archives [Greg] - * add support for OpenSSL-based true signatures [Greg] - * add support for signatures to tar-based phar archives [Greg] - * add Phar::isFileFormat() [Greg] - * add Phar::convertToExecutable(), Phar::convertToData() [Greg] - * add Phar::compress() [Greg] - * rename Phar::compressAllFiles() to compressFiles(), uncompressAllFiles() to - decompressFiles() [Greg] - * conversion to compressed or to other file formats automatically copies the archive - to a new extension (i.e. ".phar" to ".phar.tar" or ".tar" to ".tar.gz") [Steph] - * add Phar::webPhar() for running a web-based application unmodified - directly from a phar archive [Greg] - * file functions (fopen-based and stat-based) can be instructed to only look for - relative paths within a phar via Phar::interceptFileFuncs() - * add PharData class to allow manipulation/creation of non-executable tar and zip archives. [Steph] - non-executable tar/zip manipulation is allowed even when phar.readonly=1 [Greg] - * paths with . and .. work (phar://blah.phar/a/../b.php => phar://blah.phar/b.php) [Greg] - * add support for mkdir()/rmdir() and support for empty directories to phar file format [Greg] - * add option to compress the entire phar file for phar/tar file format [Greg] - * implement Phar::isCompressed() returning 0, Phar::GZ or Phar::BZ2 [Greg] - * implement Phar::copy(string $from, string $to) [Greg] - * implement Phar::running(), returns path or URL to currently executed phar - * implement Phar::buildFromIterator(Iterator $it[, string $base_directory]) [Greg] - * implement Phar::buildFromDirectory(string $base_directory[, string $regex]) [Steph] - * implement Phar::mount() for mounting external paths or files to locations inside a phar [Greg] - * add Phar::delete() [Greg] - * implement Phar::unlinkArchive() [Greg] - -Security addition - * aliases are validated so that they contain no directory separators as intended - * on conversion to other formats, user-supplied aliases are validated - -Changes since 2.0.0RC2: - fixed PHP Bug #49021: phar tar signature algorithm reports as Unknown (0) in - getSignature() call - fixed PHP Bug #49020: phar misinterprets ustar long filename standard - fixed PHP Bug #49018: phar tar stores long filenames with prefix/name reversed - fixed PHP Bug #48791: open office files always reported as corrupted - fixed PHP Bug #48783: make install will fail saying phar file exists - fixed PHP Bug #48740: PHAR install fails when INSTALL_ROOT is not the final install location - fixed PHP Bug #48681: openssl signature verification for tar archives broken - fixed PHP Bug #48377: error message unclear on converting phar with existing file - fixed isset() on sub-directories (isset("blah") if file "blah/foo.php" exists) - - make phar work in PHP 6 -Changes since 2.0.0RC1: - security vulnerability in handling of long tar filenames fixed - fixed PECL Bug #14646: phar error message unclear with php stream wrappers - fixed PECL Bug #16338: php_stream_copy_to_stream{,_ex}() - fixed PHP Bug #48257: PharData throws an exception with non-phar tar - fixed PHP Bug #47085: rename() returns true even if the file in PHAR does not exist - fixed PHP Bug #46032: PharData::__construct() - wrong memory read - fixed PHP Bug #46060: Phar::addEmptyDir() breaks - fixed PHP Bug #45907: undefined reference to \'PHP_SHA512Init\' - fixed PHP Bug #45726: PHP_Archive / Archive.php missing -Changes since 2.0.0a2: many bugfixes, removal of phar.extract_list, compression API refactored, - conversion API refactored -Changes since 2.0.0b1: addition of phar.cache_list, many performance improvements and bugfixes - implement OpenSSL asynchronous true package signing - add support for package signing to tar-based archives - require PHP 5.2.1+ -'; - -if (!class_exists("Phar") && !extension_loaded("Phar")) { - die("Extension phar not present"); -} -error_reporting(E_ALL & ~E_DEPRECATED); - -require_once 'PEAR/PackageFileManager2.php'; - -PEAR::setErrorHandling(PEAR_ERROR_DIE); - -$options = array( - 'filelistgenerator' => 'svn', - 'changelogoldtonew' => false, - 'simpleoutput' => true, - 'baseinstalldir' => '/', - 'packagedirectory' => dirname(__FILE__), - 'packagefile' => 'package.xml', - 'clearcontents' => true, - 'ignore' => array('package*.php', 'package*.xml'), - 'dir_roles' => array( - 'docs' => 'doc', - 'examples' => 'doc', - 'tests' => 'test', - 'phar' => 'src', - ), - 'exceptions' => array( - 'CREDITS' => 'doc', - 'EXPERIMENTAL' => 'doc', - 'LICENSE' => 'doc', - 'Makefile.frag' => 'src', - 'phar_path_check.re' => 'src', - 'TODO' => 'doc', - 'phar.phar' => 'script', - ), -); - -$package = PEAR_PackageFileManager2::importOptions(dirname(__FILE__) . '/package.xml', $options); - -$package->clearDeps(); -$package->setPhpDep('5.2.1'); -$package->setPearInstallerDep('1.4.3'); -$package->addPackageDepWithChannel('optional', 'bz2', 'pecl.php.net', false, false, false, false, 'bz2'); -// all this false business sets the tag that allows us to have hash built -// in statically -$package->addPackageDepWithChannel('optional', 'hash', 'pecl.php.net', false, false, false, false, 'hash'); -$package->addExtensionDep('optional', 'spl'); -$package->addExtensionDep('optional', 'zlib'); -$package->setPackageType('extsrc'); -$package->addRelease(); -$package->setReleaseVersion(phpversion('phar')); -$package->setAPIVersion(Phar::apiVersion()); -$package->setReleaseStability('stable'); -$package->setAPIStability('stable'); -$package->setNotes("\n$notes\n"); -//$package->addGlobalReplacement('package-info', '@package_version@', 'version'); -$package->generateContents(); - -if (isset($_GET['make']) || (isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')) { - $package->writePackageFile(); -} else { - $package->debugPackageFile(); -} - -?> diff --git a/ext/phar/package.xml b/ext/phar/package.xml index 45bdb9edcbb58..4a9798e252ce7 100644 --- a/ext/phar/package.xml +++ b/ext/phar/package.xml @@ -941,7 +941,6 @@ Changes since 2.0.0b1: addition of phar.cache_list, many performance improvement - diff --git a/ext/phar/phar/pharcommand.inc b/ext/phar/phar/pharcommand.inc index 9e968694c3f62..cb343675b557b 100755 --- a/ext/phar/phar/pharcommand.inc +++ b/ext/phar/phar/pharcommand.inc @@ -91,7 +91,7 @@ class PharCommand extends CLICommand 'h' => array( 'typ' => 'select', 'val' => NULL, - 'inf' => ' Selects the hash algorithmn.', + 'inf' => ' Selects the hash algorithm.', 'select' => array('md5' => 'MD5','sha1' => 'SHA1') ), 'i' => array( @@ -107,7 +107,7 @@ class PharCommand extends CLICommand 'l' => array( 'typ' => 'int', 'val' => 0, - 'inf' => ' Number of preceeding subdirectories to strip from file entries', + 'inf' => ' Number of preceding subdirectories to strip from file entries', ), 'm' => array( 'typ' => 'any', @@ -461,7 +461,7 @@ class PharCommand extends CLICommand 'typ' => 'any', 'val' => NULL, 'required' => 1, - 'inf' => ' Any number of input files and directories. If -i is in use then ONLY files and matching thegiven regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.', + 'inf' => ' Any number of input files and directories. If -i is in use then ONLY files and matching the given regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.', ); return $args; @@ -981,7 +981,7 @@ class PharCommand extends CLICommand 'type' => 'any', 'val' => NULL, 'required' => 1, - 'inf' => ' Any number of input files and directories. If -i is in use then ONLY files and matching thegiven regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.', + 'inf' => ' Any number of input files and directories. If -i is in use then ONLY files and matching the given regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.', ); return $args; } diff --git a/ext/phar/tar.c b/ext/phar/tar.c index 9d1e5bcb1d2f0..917734c992a6e 100644 --- a/ext/phar/tar.c +++ b/ext/phar/tar.c @@ -38,7 +38,7 @@ static php_uint32 phar_tar_number(char *buf, int len) /* {{{ */ /* }}} */ /* adapted from format_octal() in libarchive - * + * * Copyright (c) 2003-2009 Tim Kientzle * All rights reserved. * @@ -161,7 +161,7 @@ static int phar_tar_process_metadata(phar_entry_info *entry, php_stream *fp TSRM size_t save = php_stream_tell(fp), read; phar_entry_info *mentry; - metadata = (char *) emalloc(entry->uncompressed_filesize + 1); + metadata = (char *) safe_emalloc(1, entry->uncompressed_filesize, 1); read = php_stream_read(fp, metadata, entry->uncompressed_filesize); if (read != entry->uncompressed_filesize) { @@ -337,6 +337,16 @@ int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, last_was_longlink = 1; /* support the ././@LongLink system for storing long filenames */ entry.filename_len = entry.uncompressed_filesize; + + /* Check for overflow - bug 61065 */ + if (entry.filename_len == UINT_MAX) { + if (error) { + spprintf(error, 4096, "phar error: \"%s\" is a corrupted tar file (invalid entry size)", fname); + } + php_stream_close(fp); + phar_destroy_phar_data(myphar TSRMLS_CC); + return FAILURE; + } entry.filename = pemalloc(entry.filename_len+1, myphar->is_persistent); read = php_stream_read(fp, entry.filename, entry.filename_len); @@ -367,7 +377,7 @@ int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, } read = php_stream_read(fp, buf, sizeof(buf)); - + if (read != sizeof(buf)) { efree(entry.filename); if (error) { diff --git a/ext/phar/tests/fatal_error_webphar.phpt b/ext/phar/tests/fatal_error_webphar.phpt index 3153c344e0c41..dd6e0961a9f43 100644 --- a/ext/phar/tests/fatal_error_webphar.phpt +++ b/ext/phar/tests/fatal_error_webphar.phpt @@ -15,4 +15,4 @@ Content-type: text/html; charset=UTF-8 --EXPECTF-- string(9) "\Web\View" -Parse error: syntax error, unexpected %s, expecting %s in phar:///%sfatal_error_webphar.php/Web/View.php on line 380 +Parse error: syntax error, unexpected %s, expecting %s in phar://%r([A-Za-z]:)?%r/%sfatal_error_webphar.php/Web/View.php on line 380 diff --git a/ext/posix/tests/posix_getegid_basic.phpt b/ext/posix/tests/posix_getegid_basic.phpt new file mode 100644 index 0000000000000..d0016f497f897 --- /dev/null +++ b/ext/posix/tests/posix_getegid_basic.phpt @@ -0,0 +1,15 @@ +--TEST-- +Test function posix_getegid() by calling it with its expected arguments +--CREDITS-- +Michelangelo van Dam dragonbe@gmail.com +#PHPTestFest Dutch PHP Conference 2012 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +int(%d) diff --git a/ext/posix/tests/posix_setgid_error.phpt b/ext/posix/tests/posix_setgid_error.phpt index 247435d94895f..83d727c58a8b7 100644 --- a/ext/posix/tests/posix_setgid_error.phpt +++ b/ext/posix/tests/posix_setgid_error.phpt @@ -1,6 +1,5 @@ --TEST-- Test function posix_setgid() by calling it more than or less than its expected arguments. ---CREDITS-- --SKIPIF-- ptr == NULL) { + if (EG(exception) && Z_OBJCE_P(EG(exception)) == reflection_exception_ptr) { + return NULL; + } + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Internal error: Failed to retrieve the reflection object"); + } + + param = intern->ptr; + if (param->fptr->type != ZEND_USER_FUNCTION) { + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Cannot determine default value for internal functions"); + return NULL; + } + + return param; +} +/* }}} */ + +/* {{{ _reflection_param_get_default_precv */ +static zend_op *_reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAMETERS, parameter_reference *param) +{ + zend_op *precv; + + if (param == NULL) { + return NULL; + } + + precv = _get_recv_op((zend_op_array*)param->fptr, param->offset); + if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2_type == IS_UNUSED) { + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Internal error: Failed to retrieve the default value"); + return NULL; + } + + return precv; +} +/* }}} */ + /* {{{ Preventing __clone from being called */ ZEND_METHOD(reflection, __clone) { @@ -2520,9 +2563,7 @@ ZEND_METHOD(reflection_parameter, isDefaultValueAvailable) { RETURN_FALSE; } - if (param->offset < param->required) { - RETURN_FALSE; - } + precv = _get_recv_op((zend_op_array*)param->fptr, param->offset); if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2_type == IS_UNUSED) { RETURN_FALSE; @@ -2535,39 +2576,81 @@ ZEND_METHOD(reflection_parameter, isDefaultValueAvailable) Returns the default value of this parameter or throws an exception */ ZEND_METHOD(reflection_parameter, getDefaultValue) { - reflection_object *intern; parameter_reference *param; zend_op *precv; if (zend_parse_parameters_none() == FAILURE) { return; } - GET_REFLECTION_OBJECT_PTR(param); - if (param->fptr->type != ZEND_USER_FUNCTION) - { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Cannot determine default value for internal functions"); - return; - } - if (param->offset < param->required) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Parameter is not optional"); + param = _reflection_param_get_default_param(INTERNAL_FUNCTION_PARAM_PASSTHRU); + if (!param) { return; } - precv = _get_recv_op((zend_op_array*)param->fptr, param->offset); - if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2_type == IS_UNUSED) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Internal error"); + + precv = _reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAM_PASSTHRU, param); + if (!precv) { return; } *return_value = *precv->op2.zv; INIT_PZVAL(return_value); - if (Z_TYPE_P(return_value) != IS_CONSTANT && Z_TYPE_P(return_value) != IS_CONSTANT_ARRAY) { + if ((Z_TYPE_P(return_value) & IS_CONSTANT_TYPE_MASK) != IS_CONSTANT + && (Z_TYPE_P(return_value) & IS_CONSTANT_TYPE_MASK) != IS_CONSTANT_ARRAY) { zval_copy_ctor(return_value); } zval_update_constant_ex(&return_value, (void*)0, param->fptr->common.scope TSRMLS_CC); } /* }}} */ +/* {{{ proto public bool ReflectionParameter::isDefaultValueConstant() + Returns whether the default value of this parameter is constant */ +ZEND_METHOD(reflection_parameter, isDefaultValueConstant) +{ + zend_op *precv; + parameter_reference *param; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + param = _reflection_param_get_default_param(INTERNAL_FUNCTION_PARAM_PASSTHRU); + if (!param) { + RETURN_FALSE; + } + + precv = _reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAM_PASSTHRU, param); + if (precv && (Z_TYPE_P(precv->op2.zv) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { + RETURN_TRUE; + } + + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto public mixed ReflectionParameter::getDefaultValueConstantName() + Returns the default value's constant name if default value is constant or null */ +ZEND_METHOD(reflection_parameter, getDefaultValueConstantName) +{ + zend_op *precv; + parameter_reference *param; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + param = _reflection_param_get_default_param(INTERNAL_FUNCTION_PARAM_PASSTHRU); + if (!param) { + return; + } + + precv = _reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAM_PASSTHRU, param); + if (precv && (Z_TYPE_P(precv->op2.zv) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { + RETURN_STRINGL(Z_STRVAL_P(precv->op2.zv), Z_STRLEN_P(precv->op2.zv), 1); + } +} +/* }}} */ + /* {{{ 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) @@ -2922,6 +3005,14 @@ ZEND_METHOD(reflection_method, invokeArgs) fcc.calling_scope = obj_ce; fcc.called_scope = intern->ce; fcc.object_ptr = object; + + /* + * Copy the zend_function when calling via handler (e.g. Closure::__invoke()) + */ + if (mptr->type == ZEND_INTERNAL_FUNCTION && + (mptr->internal_function.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0) { + fcc.function_handler = _copy_function(mptr TSRMLS_CC); + } result = zend_call_function(&fci, &fcc TSRMLS_CC); @@ -5903,6 +5994,8 @@ static const zend_function_entry reflection_parameter_functions[] = { ZEND_ME(reflection_parameter, isOptional, arginfo_reflection__void, 0) ZEND_ME(reflection_parameter, isDefaultValueAvailable, arginfo_reflection__void, 0) 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) PHP_FE_END }; diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt new file mode 100644 index 0000000000000..cdd00d26248f0 --- /dev/null +++ b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt @@ -0,0 +1,52 @@ +--TEST-- +ReflectionParameter::isDefaultValueConstant() && getDefaultValueConstantName() +--FILE-- +getParameters() as $param) { + if($param->getName() == 'test1') { + var_dump($param->isDefaultValueConstant()); + } + if($param->getName() == 'test2') { + var_dump($param->isDefaultValueConstant()); + } + if($param->isDefaultValueAvailable() && $param->isDefaultValueConstant()) { + var_dump($param->getDefaultValueConstantName()); + } +} + +class Foo2 { + const bar = 'Foo2::bar'; +} + +class Foo { + const bar = 'Foo::bar'; + + public function baz($param1 = self::bar, $param2=Foo2::bar, $param3=CONST_TEST_1) { + } +} + +$method = new ReflectionMethod('Foo', 'baz'); +$params = $method->getParameters(); + +foreach ($params as $param) { + if ($param->isDefaultValueConstant()) { + var_dump($param->getDefaultValueConstantName()); + } +} +?> +==DONE== +--EXPECT-- +bool(false) +bool(true) +string(12) "CONST_TEST_1" +string(9) "self::bar" +string(9) "Foo2::bar" +string(12) "CONST_TEST_1" +==DONE== diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt new file mode 100644 index 0000000000000..1ee9e93735aa0 --- /dev/null +++ b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt @@ -0,0 +1,30 @@ +--TEST-- +ReflectionParameter::isDefaultValueConstant() && getDefaultValueConstantName() for namespace +--FILE-- +getParameters() as $param) { + if($param->isDefaultValueAvailable() && $param->isDefaultValueConstant()) { + echo $param->getDefaultValueConstantName() . "\n"; + } + } + echo "==DONE=="; +} +?> +--EXPECT-- +ReflectionTestNamespace\TestClass::TEST_CONST_2 +ReflectionTestNamespace\CONST_TEST_1 +==DONE== diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt new file mode 100644 index 0000000000000..a2c2d245829ab --- /dev/null +++ b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt @@ -0,0 +1,23 @@ +--TEST-- +ReflectionParameter::getDefaultValueConstant() should raise exception on non optional parameter +--FILE-- +getParameters() as $param) { + try { + echo $param->getDefaultValueConstantName() . "\n"; + } + catch(ReflectionException $e) { + echo $e->getMessage() . "\n"; + } +} +?> +--EXPECT-- +Internal error: Failed to retrieve the default value +CONST_TEST_1 diff --git a/ext/reflection/tests/bug47254.phpt b/ext/reflection/tests/bug47254.phpt index 4bcce1bb72787..83593a4ff27ce 100644 --- a/ext/reflection/tests/bug47254.phpt +++ b/ext/reflection/tests/bug47254.phpt @@ -23,7 +23,6 @@ $m = $R->getMethods(); print_r($m); ?> ---CLEAN-- --EXPECT-- Array ( diff --git a/ext/reflection/tests/bug62384.phpt b/ext/reflection/tests/bug62384.phpt new file mode 100644 index 0000000000000..90a871fa2a733 --- /dev/null +++ b/ext/reflection/tests/bug62384.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #62384 (Attempting to invoke a Closure more than once causes segfaul) +--FILE-- +getMethod('__invoke'); + +$arguments1 = array('hello'); +$arguments2 = array('world'); + +var_dump($reflection_method->invokeArgs($closure1, $arguments1)); +var_dump($reflection_method->invokeArgs($closure2, $arguments2)); + +?> +--EXPECT-- +string(5) "hello" +string(5) "world" diff --git a/ext/reflection/tests/bug62715.phpt b/ext/reflection/tests/bug62715.phpt new file mode 100644 index 0000000000000..feb67f614be47 --- /dev/null +++ b/ext/reflection/tests/bug62715.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong result) +--FILE-- +getParameters() as $p) { + var_dump($p->isDefaultValueAvailable()); +} + +foreach ($r->getParameters() as $p) { + if ($p->isDefaultValueAvailable()) { + var_dump($p->getDefaultValue()); + } +} +?> +--EXPECT-- +bool(true) +bool(true) +bool(false) +NULL +int(0) diff --git a/ext/session/session.c b/ext/session/session.c index 7a8199d810600..0c08d496816cf 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -59,7 +59,7 @@ #include "mod_mm.h" #endif -PHPAPI ZEND_DECLARE_MODULE_GLOBALS(ps); +PHPAPI ZEND_DECLARE_MODULE_GLOBALS(ps) static int php_session_rfc1867_callback(unsigned int event, void *event_data, void **extra TSRMLS_DC); static int (*php_session_rfc1867_orig_callback)(unsigned int event, void *event_data, void **extra TSRMLS_DC); diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 455280fc74f9f..5514f0fc89719 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -1417,7 +1417,11 @@ SXE_METHOD(asXML) xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, ((xmlDocPtr) sxe->document->ptr)->encoding); xmlOutputBufferFlush(outbuf); +#ifdef LIBXML2_NEW_BUFFER + RETVAL_STRINGL((char *)xmlOutputBufferGetContent(outbuf), xmlOutputBufferGetSize(outbuf), 1); +#else RETVAL_STRINGL((char *)outbuf->buffer->content, outbuf->buffer->use, 1); +#endif xmlOutputBufferClose(outbuf); } } else { @@ -1513,22 +1517,28 @@ static void sxe_add_registered_namespaces(php_sxe_object *sxe, xmlNodePtr node, } /* }}} */ -/* {{{ proto string SimpleXMLElement::getDocNamespaces([bool recursive]) +/* {{{ proto string SimpleXMLElement::getDocNamespaces([bool recursive [, bool from_root]) Return all namespaces registered with document */ SXE_METHOD(getDocNamespaces) { - zend_bool recursive = 0; + zend_bool recursive = 0, from_root = 1; php_sxe_object *sxe; + xmlNodePtr node; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &recursive) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|bb", &recursive, &from_root) == FAILURE) { return; } array_init(return_value); sxe = php_sxe_fetch_object(getThis() TSRMLS_CC); + if(from_root){ + node = xmlDocGetRootElement((xmlDocPtr)sxe->document->ptr); + }else{ + GET_NODE(sxe, node); + } - sxe_add_registered_namespaces(sxe, xmlDocGetRootElement((xmlDocPtr)sxe->document->ptr), recursive, return_value TSRMLS_CC); + sxe_add_registered_namespaces(sxe, node, recursive, return_value TSRMLS_CC); } /* }}} */ @@ -2518,6 +2528,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_getnamespaces, 0, 0, 0) ZEND_ARG_INFO(0, recursve) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_getdocnamespaces, 0, 0, 0) + ZEND_ARG_INFO(0, recursve) + ZEND_ARG_INFO(0, from_root) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_children, 0, 0, 0) ZEND_ARG_INFO(0, ns) ZEND_ARG_INFO(0, is_prefix) @@ -2586,7 +2601,7 @@ static const zend_function_entry sxe_functions[] = { /* {{{ */ SXE_ME(attributes, arginfo_simplexmlelement_children, ZEND_ACC_PUBLIC) SXE_ME(children, arginfo_simplexmlelement_children, ZEND_ACC_PUBLIC) SXE_ME(getNamespaces, arginfo_simplexmlelement_getnamespaces, ZEND_ACC_PUBLIC) - SXE_ME(getDocNamespaces, arginfo_simplexmlelement_getnamespaces, ZEND_ACC_PUBLIC) + SXE_ME(getDocNamespaces, arginfo_simplexmlelement_getdocnamespaces, ZEND_ACC_PUBLIC) SXE_ME(getName, arginfo_simplexmlelement__void, ZEND_ACC_PUBLIC) SXE_ME(addChild, arginfo_simplexmlelement_addchild, ZEND_ACC_PUBLIC) SXE_ME(addAttribute, arginfo_simplexmlelement_addchild, ZEND_ACC_PUBLIC) diff --git a/ext/simplexml/tests/bug48601.phpt b/ext/simplexml/tests/bug48601.phpt index 24bf2bf8a5f55..0b81facf491e0 100644 --- a/ext/simplexml/tests/bug48601.phpt +++ b/ext/simplexml/tests/bug48601.phpt @@ -10,7 +10,7 @@ $sxe = simplexml_load_string('1'); $nodes = $sxe->xpath("/root/node2/@test"); if (! is_array($nodes)) { - echo "An error occured\n"; + echo "An error occurred\n"; } else { echo "Result Count: " . count($nodes) . "\n"; } diff --git a/ext/simplexml/tests/feature55218.phpt b/ext/simplexml/tests/feature55218.phpt new file mode 100644 index 0000000000000..25ea534376839 --- /dev/null +++ b/ext/simplexml/tests/feature55218.phpt @@ -0,0 +1,117 @@ +--TEST-- +Bug #55218 getDocNamespaces from current element and not root +--SKIPIF-- + +--FILE-- + + + + John Doe + + Susie Q. Public + + jdslkfjsldk jskdfjsmlkjfkldjkjflskj kljfslkjf sldk + +'); + +echo "getDocNamespaces\n"; +echo "\nBackwards Compatibility:\n"; +echo "recursion:\n"; + +var_dump ( $x->getDocNamespaces(true) ) ; +var_dump( $x->person[0]->getDocNamespaces(true) ); +var_dump( $x->person[1]->getDocNamespaces(true) ); + +echo "\nnon recursive:\n"; + +var_dump( $x->getDocNamespaces(false) ); +var_dump( $x->person[0]->getDocNamespaces(false) ); +var_dump( $x->person[1]->getDocNamespaces(false) ); + +echo "\n\nUsing new 'from_root' bool set to false:\n"; +echo "recursion:\n"; + +var_dump ( $x->getDocNamespaces(true, false) ) ; +var_dump( $x->person[0]->getDocNamespaces(true, false) ); +var_dump( $x->person[1]->getDocNamespaces(true, false) ); + +echo "\nnon recursive:\n"; + +var_dump( $x->getDocNamespaces(false, false) ); +var_dump( $x->person[0]->getDocNamespaces(false, false) ); +var_dump( $x->person[1]->getDocNamespaces(false, false) ); + +?> +===DONE=== +--EXPECTF-- +getDocNamespaces + +Backwards Compatibility: +recursion: +array(2) { + ["p"]=> + string(20) "http://example.org/p" + ["t"]=> + string(20) "http://example.org/t" +} +array(2) { + ["p"]=> + string(20) "http://example.org/p" + ["t"]=> + string(20) "http://example.org/t" +} +array(2) { + ["p"]=> + string(20) "http://example.org/p" + ["t"]=> + string(20) "http://example.org/t" +} + +non recursive: +array(1) { + ["p"]=> + string(20) "http://example.org/p" +} +array(1) { + ["p"]=> + string(20) "http://example.org/p" +} +array(1) { + ["p"]=> + string(20) "http://example.org/p" +} + + +Using new 'from_root' bool set to false: +recursion: +array(2) { + ["p"]=> + string(20) "http://example.org/p" + ["t"]=> + string(20) "http://example.org/t" +} +array(1) { + ["t"]=> + string(20) "http://example.org/t" +} +array(0) { +} + +non recursive: +array(1) { + ["p"]=> + string(20) "http://example.org/p" +} +array(1) { + ["t"]=> + string(20) "http://example.org/t" +} +array(0) { +} +===DONE=== \ No newline at end of file diff --git a/ext/soap/tests/bugs/bug47273.phpt b/ext/soap/tests/bugs/bug47273.phpt index 174948f59f988..1cfb0f3cd96a3 100644 --- a/ext/soap/tests/bugs/bug47273.phpt +++ b/ext/soap/tests/bugs/bug47273.phpt @@ -2,9 +2,6 @@ Bug #47273 (Encoding bug in SoapServer->fault) --SKIPIF-- ---INI-- -unicode.script_encoding=ISO-8859-1 -unicode.output_encoding=ISO-8859-1 --FILE-- --INI-- precision=14 ---POST-- +--GZIP_POST-- ---GZIP_POST-- -1 --FILE-- --INI-- precision=14 ---POST-- +--DEFLATE_POST-- ---DEFLATE_POST-- -1 --FILE-- +#include +#include + ], [struct sockaddr_storage sa_store; sa_store.ss_family = AF_INET6;], + ac_cv_ss_family=yes, ac_cv_ss_family=no) + ]) + + if test "$ac_cv_ss_family" = yes; then + AC_DEFINE(HAVE_SA_SS_FAMILY,1,[Whether you have sockaddr_storage.ss_family]) + fi PHP_NEW_EXTENSION([sockets], [sockets.c multicast.c], [$ext_shared]) PHP_INSTALL_HEADERS([ext/sockets/], [php_sockets.h]) diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 46d9f8e1b82bf..0d1714257dbc7 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -77,6 +77,9 @@ # define IS_INVALID_SOCKET(a) (a->bsd_socket < 0) # define set_errno(a) (errno = a) # include "php_sockets.h" +# if defined(_AIX) && !defined(HAVE_SA_SS_FAMILY) +# define ss_family __ss_family +# endif # if HAVE_IF_NAMETOINDEX # include # endif diff --git a/ext/sockets/tests/socket_import_stream-4-win.phpt b/ext/sockets/tests/socket_import_stream-4-win.phpt new file mode 100644 index 0000000000000..e2fc523ce587d --- /dev/null +++ b/ext/sockets/tests/socket_import_stream-4-win.phpt @@ -0,0 +1,106 @@ +--TEST-- +socket_import_stream: effects of closing +--SKIPIF-- +pos && (object->ar_flags & SPL_ARRAY_IS_REF) && spl_hash_verify_pos_ex(object, ht TSRMLS_CC) == FAILURE) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%sArray was modified outside object and internal position is no longer valid", msg_prefix); + return FAILURE; + } + + return SUCCESS; +} /* }}} */ + +/* {{{ spl_array_object_verify_pos */ +static inline int spl_array_object_verify_pos(spl_array_object *object, HashTable *ht TSRMLS_DC) +{ + return spl_array_object_verify_pos_ex(object, ht, "" TSRMLS_CC); +} /* }}} */ + /* {{{ proto bool ArrayObject::offsetExists(mixed $index) proto bool ArrayIterator::offsetExists(mixed $index) Returns whether the requested $index exists. */ @@ -963,17 +985,11 @@ static int spl_array_it_valid(zend_object_iterator *iter TSRMLS_DC) /* {{{ */ if (object->ar_flags & SPL_ARRAY_OVERLOADED_VALID) { return zend_user_it_valid(iter TSRMLS_CC); } else { - if (!aht) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "ArrayIterator::valid(): Array was modified outside object and is no longer an array"); - return FAILURE; - } - - if (object->pos && (object->ar_flags & SPL_ARRAY_IS_REF) && spl_hash_verify_pos_ex(object, aht TSRMLS_CC) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "ArrayIterator::valid(): Array was modified outside object and internal position is no longer valid"); + if (spl_array_object_verify_pos_ex(object, aht, "ArrayIterator::valid(): " TSRMLS_CC) == FAILURE) { return FAILURE; - } else { - return zend_hash_has_more_elements_ex(aht, &object->pos); } + + return zend_hash_has_more_elements_ex(aht, &object->pos); } } /* }}} */ @@ -1003,13 +1019,7 @@ static int spl_array_it_get_current_key(zend_object_iterator *iter, char **str_k if (object->ar_flags & SPL_ARRAY_OVERLOADED_KEY) { return zend_user_it_get_current_key(iter, str_key, str_key_len, int_key TSRMLS_CC); } else { - if (!aht) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "ArrayIterator::current(): Array was modified outside object and is no longer an array"); - return HASH_KEY_NON_EXISTANT; - } - - if ((object->ar_flags & SPL_ARRAY_IS_REF) && spl_hash_verify_pos_ex(object, aht TSRMLS_CC) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "ArrayIterator::current(): Array was modified outside object and internal position is no longer valid"); + if (spl_array_object_verify_pos_ex(object, aht, "ArrayIterator::current(): " TSRMLS_CC) == FAILURE) { return HASH_KEY_NON_EXISTANT; } @@ -1494,13 +1504,7 @@ SPL_METHOD(Array, current) return; } - if (!aht) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array"); - return; - } - - if ((intern->ar_flags & SPL_ARRAY_IS_REF) && spl_hash_verify_pos_ex(intern, aht TSRMLS_CC) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and internal position is no longer valid"); + if (spl_array_object_verify_pos(intern, aht TSRMLS_CC) == FAILURE) { return; } @@ -1530,13 +1534,7 @@ void spl_array_iterator_key(zval *object, zval *return_value TSRMLS_DC) /* {{{ * ulong num_key; HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); - if (!aht) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array"); - return; - } - - if ((intern->ar_flags & SPL_ARRAY_IS_REF) && spl_hash_verify_pos_ex(intern, aht TSRMLS_CC) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and internal position is no longer valid"); + if (spl_array_object_verify_pos(intern, aht TSRMLS_CC) == FAILURE) { return; } @@ -1564,13 +1562,12 @@ SPL_METHOD(Array, next) if (zend_parse_parameters_none() == FAILURE) { return; } - - if (!aht) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array"); + + if (spl_array_object_verify_pos(intern, aht TSRMLS_CC) == FAILURE) { return; } - spl_array_next_ex(intern, aht TSRMLS_CC); + spl_array_next_no_verify(intern, aht TSRMLS_CC); } /* }}} */ @@ -1585,14 +1582,8 @@ SPL_METHOD(Array, valid) if (zend_parse_parameters_none() == FAILURE) { return; } - - if (!aht) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array"); - return; - } - if (intern->pos && (intern->ar_flags & SPL_ARRAY_IS_REF) && spl_hash_verify_pos_ex(intern, aht TSRMLS_CC) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and internal position is no longer valid"); + if (spl_array_object_verify_pos(intern, aht TSRMLS_CC) == FAILURE) { RETURN_FALSE; } else { RETURN_BOOL(zend_hash_has_more_elements_ex(aht, &intern->pos) == SUCCESS); @@ -1611,14 +1602,8 @@ SPL_METHOD(Array, hasChildren) if (zend_parse_parameters_none() == FAILURE) { return; } - - if (!aht) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array"); - RETURN_FALSE; - } - if ((intern->ar_flags & SPL_ARRAY_IS_REF) && spl_hash_verify_pos_ex(intern, aht TSRMLS_CC) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and internal position is no longer valid"); + if (spl_array_object_verify_pos(intern, aht TSRMLS_CC) == FAILURE) { RETURN_FALSE; } @@ -1642,13 +1627,7 @@ SPL_METHOD(Array, getChildren) return; } - if (!aht) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array"); - return; - } - - if ((intern->ar_flags & SPL_ARRAY_IS_REF) && spl_hash_verify_pos_ex(intern, aht TSRMLS_CC) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and internal position is no longer valid"); + if (spl_array_object_verify_pos(intern, aht TSRMLS_CC) == FAILURE) { return; } @@ -1943,6 +1922,7 @@ PHP_MINIT_FUNCTION(spl_array) REGISTER_SPL_IMPLEMENTS(ArrayObject, Aggregate); REGISTER_SPL_IMPLEMENTS(ArrayObject, ArrayAccess); REGISTER_SPL_IMPLEMENTS(ArrayObject, Serializable); + REGISTER_SPL_IMPLEMENTS(ArrayObject, Countable); memcpy(&spl_handler_ArrayObject, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); spl_handler_ArrayObject.clone_obj = spl_array_object_clone; @@ -1967,6 +1947,7 @@ PHP_MINIT_FUNCTION(spl_array) REGISTER_SPL_IMPLEMENTS(ArrayIterator, ArrayAccess); REGISTER_SPL_IMPLEMENTS(ArrayIterator, SeekableIterator); REGISTER_SPL_IMPLEMENTS(ArrayIterator, Serializable); + REGISTER_SPL_IMPLEMENTS(ArrayIterator, Countable); memcpy(&spl_handler_ArrayIterator, &spl_handler_ArrayObject, sizeof(zend_object_handlers)); spl_ce_ArrayIterator->get_iterator = spl_array_get_iterator; @@ -1974,9 +1955,6 @@ PHP_MINIT_FUNCTION(spl_array) REGISTER_SPL_IMPLEMENTS(RecursiveArrayIterator, RecursiveIterator); spl_ce_RecursiveArrayIterator->get_iterator = spl_array_get_iterator; - REGISTER_SPL_IMPLEMENTS(ArrayObject, Countable); - REGISTER_SPL_IMPLEMENTS(ArrayIterator, Countable); - REGISTER_SPL_CLASS_CONST_LONG(ArrayObject, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST); REGISTER_SPL_CLASS_CONST_LONG(ArrayObject, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS); diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index dbae3e2a093ac..0fcbd317e3577 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -1432,6 +1432,7 @@ SPL_METHOD(FilesystemIterator, __construct) SPL_METHOD(FilesystemIterator, rewind) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + int skip_dots = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_SKIPDOTS); if (zend_parse_parameters_none() == FAILURE) { return; @@ -1443,7 +1444,7 @@ SPL_METHOD(FilesystemIterator, rewind) } do { spl_filesystem_dir_read(intern TSRMLS_CC); - } while (spl_filesystem_is_dot(intern->u.dir.entry.d_name)); + } while (skip_dots && spl_filesystem_is_dot(intern->u.dir.entry.d_name)); } /* }}} */ diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index 42cb856e9a830..c6decd0ad53f2 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -953,7 +953,7 @@ static int spl_heap_it_get_current_key(zend_object_iterator *iter, char **str_ke { spl_heap_it *iterator = (spl_heap_it *)iter; - *int_key = (ulong) iterator->object->heap->count; + *int_key = (ulong) iterator->object->heap->count - 1; return HASH_KEY_IS_LONG; } /* }}} */ diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 4be82b21e100d..1a1c586a3b1c8 100755 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -1289,6 +1289,8 @@ static union _zend_function *spl_dual_it_get_method(zval **object_ptr, char *met *object_ptr = intern->inner.zobject; function_handler = Z_OBJ_HT_P(*object_ptr)->get_method(object_ptr, method, method_len, key TSRMLS_CC); } + } else { + *object_ptr = intern->inner.zobject; } } return function_handler; diff --git a/ext/spl/tests/SplFileObject_current_basic.phpt b/ext/spl/tests/SplFileObject_current_basic.phpt new file mode 100644 index 0000000000000..d3f4802a53896 --- /dev/null +++ b/ext/spl/tests/SplFileObject_current_basic.phpt @@ -0,0 +1,18 @@ +--TEST-- +SPL: SplFileObject::current basic +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +current(); + +?> +--EXPECT-- + +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(2); + +echo $s->current('foo'); +?> +--EXPECTF-- +Warning: SplFileObject::current() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplFileObject_current_variation001.phpt b/ext/spl/tests/SplFileObject_current_variation001.phpt new file mode 100644 index 0000000000000..0cc588a7f0478 --- /dev/null +++ b/ext/spl/tests/SplFileObject_current_variation001.phpt @@ -0,0 +1,21 @@ +--TEST-- +SPL: SplFileObject::current variation +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(2); + +echo $s->current(); +echo $s->current(); +?> +--EXPECT-- +//line 3 +//line 3 diff --git a/ext/spl/tests/SplFileObject_getchildren_basic.phpt b/ext/spl/tests/SplFileObject_getchildren_basic.phpt new file mode 100644 index 0000000000000..065e8eae45a25 --- /dev/null +++ b/ext/spl/tests/SplFileObject_getchildren_basic.phpt @@ -0,0 +1,12 @@ +--TEST-- +SPL: SplFileObject::getchildren basic +--CREDITS-- +Erwin Poeze +--FILE-- +getChildren()); + +?> +--EXPECT-- +NULL diff --git a/ext/spl/tests/SplFileObject_getchildren_error001.phpt b/ext/spl/tests/SplFileObject_getchildren_error001.phpt new file mode 100644 index 0000000000000..9c17a8297745e --- /dev/null +++ b/ext/spl/tests/SplFileObject_getchildren_error001.phpt @@ -0,0 +1,12 @@ +--TEST-- +SPL: SplFileObject::getchildren error 001 +--CREDITS-- +Erwin Poeze +--FILE-- +getChildren('string'); + +?> +--EXPECTF-- +Warning: SplFileObject::getChildren() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplFileObject_getflags_basic.phpt b/ext/spl/tests/SplFileObject_getflags_basic.phpt new file mode 100644 index 0000000000000..5addadf38046e --- /dev/null +++ b/ext/spl/tests/SplFileObject_getflags_basic.phpt @@ -0,0 +1,22 @@ +--TEST-- +SPL: SplFileObject::getFlags basic +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--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 new file mode 100644 index 0000000000000..1602f88885e11 --- /dev/null +++ b/ext/spl/tests/SplFileObject_getflags_error001.phpt @@ -0,0 +1,26 @@ +--TEST-- +SPL: SplFileObject::getFlags error 001 +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +setFlags(SplFileObject::READ_CSV); + +$fo->setFlags(SplFileObject::DROP_NEW_LINE); + +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 new file mode 100644 index 0000000000000..e2c8255f44960 --- /dev/null +++ b/ext/spl/tests/SplFileObject_getflags_error002.phpt @@ -0,0 +1,21 @@ +--TEST-- +SPL: SplFileObject::getFlags error 001 +--CREDITS-- +Erwin Poeze +--FILE-- +setFlags(SplFileObject::READ_CSV); + +$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_getflags_variation001.phpt b/ext/spl/tests/SplFileObject_getflags_variation001.phpt new file mode 100644 index 0000000000000..640de03511d62 --- /dev/null +++ b/ext/spl/tests/SplFileObject_getflags_variation001.phpt @@ -0,0 +1,29 @@ +--TEST-- +SPL: SplFileObject::getFlags +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +setFlags(SplFileObject::DROP_NEW_LINE); +var_dump($fo->getFlags()); + +$fo->setFlags(SplFileObject::READ_AHEAD); +var_dump($fo->getFlags()); + +$fo->setFlags(SplFileObject::SKIP_EMPTY); +var_dump($fo->getFlags()); + +$fo->setFlags(SplFileObject::READ_CSV); +var_dump($fo->getFlags()); + +?> +--EXPECT-- +int(1) +int(2) +int(4) +int(8) diff --git a/ext/spl/tests/SplFileObject_haschildren_basic.phpt b/ext/spl/tests/SplFileObject_haschildren_basic.phpt new file mode 100644 index 0000000000000..1ce00bfd42b13 --- /dev/null +++ b/ext/spl/tests/SplFileObject_haschildren_basic.phpt @@ -0,0 +1,12 @@ +--TEST-- +SPL: SplFileObject::haschildren basic +--CREDITS-- +Erwin Poeze +--FILE-- +hasChildren()); + +?> +--EXPECT-- +bool(false) diff --git a/ext/spl/tests/SplFileObject_haschildren_error001.phpt b/ext/spl/tests/SplFileObject_haschildren_error001.phpt new file mode 100644 index 0000000000000..0c4e1de3b7764 --- /dev/null +++ b/ext/spl/tests/SplFileObject_haschildren_error001.phpt @@ -0,0 +1,12 @@ +--TEST-- +SPL: SplFileObject::haschildren error 001 +--CREDITS-- +Erwin Poeze +--FILE-- +hasChildren('string'); + +?> +--EXPECTF-- +Warning: SplFileObject::hasChildren() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplFileObject_key_basic.phpt b/ext/spl/tests/SplFileObject_key_basic.phpt new file mode 100644 index 0000000000000..4081d314eaf04 --- /dev/null +++ b/ext/spl/tests/SplFileObject_key_basic.phpt @@ -0,0 +1,19 @@ +--TEST-- +SPL: SplFileObject::key basic +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(3); +echo $s->key(); +?> +--EXPECT-- +3 diff --git a/ext/spl/tests/SplFileObject_key_error001.phpt b/ext/spl/tests/SplFileObject_key_error001.phpt new file mode 100644 index 0000000000000..b0834f00290ae --- /dev/null +++ b/ext/spl/tests/SplFileObject_key_error001.phpt @@ -0,0 +1,22 @@ +--TEST-- +SPL: SplFileObject::key error +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(12); +$s->next(); +var_dump($s->key()); +var_dump($s->valid()); +?> +--EXPECT-- +int(13) +bool(false) diff --git a/ext/spl/tests/SplFileObject_key_error002.phpt b/ext/spl/tests/SplFileObject_key_error002.phpt new file mode 100644 index 0000000000000..8fc9b7fef0a58 --- /dev/null +++ b/ext/spl/tests/SplFileObject_key_error002.phpt @@ -0,0 +1,22 @@ +--TEST-- +SPL: SplFileObject::key error +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(120); +$s->next(); +var_dump($s->key()); +var_dump($s->valid()); +?> +--EXPECT-- +int(13) +bool(false) diff --git a/ext/spl/tests/SplFileObject_key_error003.phpt b/ext/spl/tests/SplFileObject_key_error003.phpt new file mode 100644 index 0000000000000..7568cf55f4e40 --- /dev/null +++ b/ext/spl/tests/SplFileObject_key_error003.phpt @@ -0,0 +1,15 @@ +--TEST-- +SPL: SplFileObject::key error +--CREDITS-- +Erwin Poeze +--FILE-- +key(3); +?> +--EXPECTF-- +Warning: SplFileObject::key() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplFileObject_next_basic.phpt b/ext/spl/tests/SplFileObject_next_basic.phpt new file mode 100644 index 0000000000000..59dc7ab58d67a --- /dev/null +++ b/ext/spl/tests/SplFileObject_next_basic.phpt @@ -0,0 +1,22 @@ +--TEST-- +SPL: SplFileObject::next basic +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +current(); +$s->next(); + +echo $s->current(); + +?> +--EXPECT-- + +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(13); +echo $s->current(); + +$s->next(); +echo $s->current(); +var_dump($s->valid()); +?> +--EXPECT-- +?> +bool(false) diff --git a/ext/spl/tests/SplFileObject_next_variation002.phpt b/ext/spl/tests/SplFileObject_next_variation002.phpt new file mode 100644 index 0000000000000..d48ff8c22371c --- /dev/null +++ b/ext/spl/tests/SplFileObject_next_variation002.phpt @@ -0,0 +1,30 @@ +--TEST-- +SPL: SplFileObject::next variation 002, read ahead +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(2); +echo $s->current(); +$s->next(); +echo $s->current(); + +$s->setFlags(SplFileObject::READ_AHEAD); + +$s->seek(2); +echo $s->current(); +$s->next(); +echo $s->current(); +?> +--EXPECT-- +//line 3 +//line 4 +//line 3 +//line 4 diff --git a/ext/spl/tests/SplFileObject_rewind_basic.phpt b/ext/spl/tests/SplFileObject_rewind_basic.phpt new file mode 100644 index 0000000000000..331c587e4a24b --- /dev/null +++ b/ext/spl/tests/SplFileObject_rewind_basic.phpt @@ -0,0 +1,21 @@ +--TEST-- +SPL: SplFileObject::rewind basic +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(3); + +$s->rewind(); +echo $s->current(); +?> +--EXPECT-- + +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +rewind( "invalid" ); + +?> +--EXPECTF-- +Warning: SplFileObject::rewind() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplFileObject_rewind_variation001.phpt b/ext/spl/tests/SplFileObject_rewind_variation001.phpt new file mode 100644 index 0000000000000..d835c443de178 --- /dev/null +++ b/ext/spl/tests/SplFileObject_rewind_variation001.phpt @@ -0,0 +1,28 @@ +--TEST-- +SPL: SplFileObject::rewind variation 001 +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(15); +echo $s->current(); +$s->next(); +echo $s->current(); +var_dump($s->valid()); +$s->rewind(); +var_dump($s->valid()); +echo $s->current(); +?> +--EXPECT-- +?> +bool(false) +bool(true) + +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(2); +echo $s->current(); +?> +--EXPECT-- +//line 3 diff --git a/ext/spl/tests/SplFileObject_seek_error002.phpt b/ext/spl/tests/SplFileObject_seek_error002.phpt new file mode 100644 index 0000000000000..057c8d3251aeb --- /dev/null +++ b/ext/spl/tests/SplFileObject_seek_error002.phpt @@ -0,0 +1,18 @@ +--TEST-- +SPL: SplFileObject::seek error 001 +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(20); +echo $s->current(); +?> +--EXPECT-- diff --git a/ext/spl/tests/SplFileObject_setCsvControl_basic.phpt b/ext/spl/tests/SplFileObject_setCsvControl_basic.phpt new file mode 100644 index 0000000000000..b2630606e8eab --- /dev/null +++ b/ext/spl/tests/SplFileObject_setCsvControl_basic.phpt @@ -0,0 +1,30 @@ +--TEST-- +SPL: SplFileObject::setCsvControl basic +--CREDITS-- +Erwin Poeze +--FILE-- +setFlags(SplFileObject::READ_CSV); +$s->setCsvControl('|', '\'', '/'); +foreach ($s as $row) { + list($fruit, $quantity) = $row; + echo "$fruit : $quantity\n"; +} +?> +--CLEAN-- + +--EXPECT-- +groene appelen : 10 +gele bananen : 20 +rode kersen : 30 + diff --git a/ext/spl/tests/SplFileObject_setCsvControl_error001.phpt b/ext/spl/tests/SplFileObject_setCsvControl_error001.phpt new file mode 100644 index 0000000000000..f582a4a894943 --- /dev/null +++ b/ext/spl/tests/SplFileObject_setCsvControl_error001.phpt @@ -0,0 +1,24 @@ +--TEST-- +SPL: SplFileObject::setCsvControl error 001 +--CREDITS-- +Erwin Poeze +--FILE-- +setFlags(SplFileObject::READ_CSV); +$s->setCsvControl('||'); +?> +--CLEAN-- + +--EXPECTF-- +Warning: SplFileObject::setCsvControl(): delimiter must be a character in %s on line %d + diff --git a/ext/spl/tests/SplFileObject_setCsvControl_error002.phpt b/ext/spl/tests/SplFileObject_setCsvControl_error002.phpt new file mode 100644 index 0000000000000..bcfd9c4dd6155 --- /dev/null +++ b/ext/spl/tests/SplFileObject_setCsvControl_error002.phpt @@ -0,0 +1,24 @@ +--TEST-- +SPL: SplFileObject::setCsvControl error 002 +--CREDITS-- +Erwin Poeze +--FILE-- +setFlags(SplFileObject::READ_CSV); +$s->setCsvControl('|', 'two'); +?> +--CLEAN-- + +--EXPECTF-- +Warning: SplFileObject::setCsvControl(): enclosure must be a character in %s on line %d + diff --git a/ext/spl/tests/SplFileObject_setCsvControl_error003.phpt b/ext/spl/tests/SplFileObject_setCsvControl_error003.phpt new file mode 100644 index 0000000000000..8b1f54d5a42b1 --- /dev/null +++ b/ext/spl/tests/SplFileObject_setCsvControl_error003.phpt @@ -0,0 +1,26 @@ +--TEST-- +SPL: SplFileObject::setCsvControl error 003 +--CREDITS-- +Erwin Poeze +--INI-- +include_path=. +--FILE-- +setFlags(SplFileObject::READ_CSV); +$s->setCsvControl('|', '\'', 'three'); +?> +--CLEAN-- + +--EXPECTF-- +Warning: SplFileObject::setCsvControl(): escape must be a character in %s on line %d + diff --git a/ext/spl/tests/SplFileObject_setCsvControl_variation001.phpt b/ext/spl/tests/SplFileObject_setCsvControl_variation001.phpt new file mode 100644 index 0000000000000..7aaf8a3fe6217 --- /dev/null +++ b/ext/spl/tests/SplFileObject_setCsvControl_variation001.phpt @@ -0,0 +1,30 @@ +--TEST-- +SPL: SplFileObject::setCsvControl variation 001 +--CREDITS-- +Erwin Poeze +--FILE-- +setFlags(SplFileObject::READ_CSV); +$s->setCsvControl(); +foreach ($s as $row) { + list($fruit, $quantity) = $row; + echo "$fruit : $quantity\n"; +} +?> +--CLEAN-- + +--EXPECT-- +groene appelen : 10 +gele bananen : 20 +rode kersen : 30 + diff --git a/ext/spl/tests/bug52238.phpt b/ext/spl/tests/bug52238.phpt index 85410bdf1e7ad..10da0b5fd935f 100644 --- a/ext/spl/tests/bug52238.phpt +++ b/ext/spl/tests/bug52238.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #52238 - Crash when an Exception occured in iterator_to_array +Bug #52238 - Crash when an Exception occurred in iterator_to_array --FILE-- getIterator(); + +/* testing empty array, should no notice at all */ +$ai->next(); +var_dump($ai->key()); +var_dump($ai->current()); + +/* testing array changing */ +$ao2 = new ArrayObject(array(1 => 1, 2, 3, 4, 5)); +$ai2 = $ao2->getIterator(); + +$ao2->offsetUnset($ai2->key()); +$ai2->next(); + +/* now point to 2 */ +$ao2->offsetUnset($ai2->key()); +var_dump($ai2->key()); + +/* now point to 3 */ +$ao2->offsetUnset($ai2->key()); +var_dump($ai2->current()); + +$ai2->next(); +var_dump($ai2->key()); +var_dump($ai2->current()); + +/* should be at the end and no notice */ +$ai2->next(); +var_dump($ai2->key()); +var_dump($ai2->current()); + +$ai2->rewind(); +$ai2->next(); +$ai2->next(); +/* should reached the end */ +var_dump($ai2->next()); +var_dump($ai2->key()); + +/* testing RecursiveArrayIterator */ +$ao3 = new ArrayObject(array(), NULL, 'RecursiveArrayIterator'); +$ai3 = $ao3->getIterator(); + +var_dump($ai3->getChildren()); + +$ao4 = new ArrayObject(array(1, 2), NULL, 'RecursiveArrayIterator'); +$ai4 = $ao4->getIterator(); + +$ai4->next(); +$ai4->next(); +$ai4->next(); +var_dump($ai4->hasChildren()); + +$ai4->rewind(); +$ao4->offsetUnset($ai4->key()); +var_dump($ai4->hasChildren()); + +$ao4->offsetUnset($ai4->key()); +var_dump($ai4->getChildren()); +?> +==DONE== + +--EXPECTF-- +NULL +NULL + +Notice: ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sbug61527.php on line %d + +Notice: ArrayIterator::key(): Array was modified outside object and internal position is no longer valid in %sbug61527.php on line %d +NULL + +Notice: ArrayIterator::current(): Array was modified outside object and internal position is no longer valid in %sbug61527.php on line %d +NULL +int(5) +int(5) +NULL +NULL +NULL +NULL +NULL +bool(false) + +Notice: RecursiveArrayIterator::hasChildren(): Array was modified outside object and internal position is no longer valid in %sbug61527.php on line %d +bool(false) + +Notice: RecursiveArrayIterator::getChildren(): Array was modified outside object and internal position is no longer valid in %sbug61527.php on line %d +NULL +==DONE== diff --git a/ext/spl/tests/bug61697.phpt b/ext/spl/tests/bug61697.phpt new file mode 100644 index 0000000000000..d95caef978595 --- /dev/null +++ b/ext/spl/tests/bug61697.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #61697 (spl_autoload_functions returns lambda functions incorrectly) +--XFAIL-- +Bug #61697 not fixed yet +--FILE-- + +--EXPECTF-- +Array +( +) diff --git a/ext/spl/tests/bug62073.phpt b/ext/spl/tests/bug62073.phpt new file mode 100644 index 0000000000000..3bd355317f6d6 --- /dev/null +++ b/ext/spl/tests/bug62073.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #62073 (different ways of iterating over an SplMaxHeap result in different keys) +--FILE-- +insert(42); +foreach ($heap as $key => $value) { + var_dump($key); + var_dump($value); + break; +} + +$heap = new SplMaxHeap(); +$heap->insert(42); +var_dump($heap->key()); +var_dump($heap->current()); +?> +--EXPECT-- +int(0) +int(42) +int(0) +int(42) diff --git a/ext/spl/tests/bug62262.phpt b/ext/spl/tests/bug62262.phpt new file mode 100644 index 0000000000000..0e006ec2c252f --- /dev/null +++ b/ext/spl/tests/bug62262.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #62262: RecursiveArrayIterator does not implement Countable +--FILE-- + +--EXPECT-- +bool(true) diff --git a/ext/spl/tests/bug62328.phpt b/ext/spl/tests/bug62328.phpt new file mode 100644 index 0000000000000..33a8aeee953f4 --- /dev/null +++ b/ext/spl/tests/bug62328.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #62328 (cast_object takes precedence over __toString) +--CREDITS-- +leight at gmail dot com +--FILE-- +__toString() . PHP_EOL; + +?> +--EXPECT-- +__toString +__toString diff --git a/ext/spl/tests/bug62433.phpt b/ext/spl/tests/bug62433.phpt new file mode 100644 index 0000000000000..bfb3568bacb1a --- /dev/null +++ b/ext/spl/tests/bug62433.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #62433 Inconsistent behavior of RecursiveDirectoryIterator to dot files (. and ..) +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +bool(false) +bool(false) diff --git a/ext/spl/tests/bug62616.phpt b/ext/spl/tests/bug62616.phpt new file mode 100644 index 0000000000000..4e4be94491e71 --- /dev/null +++ b/ext/spl/tests/bug62616.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #62616 (ArrayIterator::count() from IteratorIterator instance gives Segmentation fault) +--FILE-- +count()); + +$ii = new IteratorIterator($ai); + +var_dump($ii->count()); +?> +--EXPECTF-- +int(2) +int(2) diff --git a/ext/spl/tests/fileobject_getmaxlinelen_error001.phpt b/ext/spl/tests/fileobject_getmaxlinelen_error001.phpt new file mode 100644 index 0000000000000..3c0c9eebd52ca --- /dev/null +++ b/ext/spl/tests/fileobject_getmaxlinelen_error001.phpt @@ -0,0 +1,14 @@ +--TEST-- +SPL: SplFileObject::getMaxLineLen error 001 +--CREDITS-- +Erwin Poeze +--INI-- +include_path=. +--FILE-- +getMaxLineLen('string'); + +?> +--EXPECTF-- +Warning: SplFileObject::getMaxLineLen() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/fileobject_setmaxlinelen_error001.phpt b/ext/spl/tests/fileobject_setmaxlinelen_error001.phpt new file mode 100644 index 0000000000000..6bfdfdcf50994 --- /dev/null +++ b/ext/spl/tests/fileobject_setmaxlinelen_error001.phpt @@ -0,0 +1,17 @@ +--TEST-- +SPL: SplFileObject::setMaxLineLen error 001() +--CREDITS-- +Erwin Poeze +--FILE-- +setMaxLineLen(-1); +} +catch (DomainException $e) { + echo 'DomainException thrown'; +} + +?> +--EXPECT-- +DomainException thrown diff --git a/ext/spl/tests/fileobject_setmaxlinelen_error002.phpt b/ext/spl/tests/fileobject_setmaxlinelen_error002.phpt new file mode 100644 index 0000000000000..dad59fca5ff01 --- /dev/null +++ b/ext/spl/tests/fileobject_setmaxlinelen_error002.phpt @@ -0,0 +1,12 @@ +--TEST-- +SPL: SplFileObject::setMaxLineLen error 002 +--CREDITS-- +Erwin Poeze +--FILE-- +setMaxLineLen(); + +?> +--EXPECTF-- +Warning: SplFileObject::setMaxLineLen() expects exactly 1 parameter, 0 given in %s on line %d diff --git a/ext/spl/tests/fileobject_setmaxlinelen_error003.phpt b/ext/spl/tests/fileobject_setmaxlinelen_error003.phpt new file mode 100644 index 0000000000000..8dc50d5fc746d --- /dev/null +++ b/ext/spl/tests/fileobject_setmaxlinelen_error003.phpt @@ -0,0 +1,12 @@ +--TEST-- +SPL: SplFileObject::setMaxLineLen error 003 +--CREDITS-- +Erwin Poeze +--FILE-- +setMaxLineLen('string'); + +?> +--EXPECTF-- +Warning: SplFileObject::setMaxLineLen() expects parameter 1 to be long, string given in %s on line %d diff --git a/ext/spl/tests/heap_005.phpt b/ext/spl/tests/heap_005.phpt index 73daaf454af5d..1291cda770659 100644 --- a/ext/spl/tests/heap_005.phpt +++ b/ext/spl/tests/heap_005.phpt @@ -18,104 +18,104 @@ foreach ($h as $k => $o) { ===DONE=== --EXPECTF-- -100 => 1 -99 => 2 -98 => 3 -97 => 4 -96 => 5 -95 => 6 -94 => 7 -93 => 8 -92 => 9 -91 => 10 -90 => 11 -89 => 12 -88 => 13 -87 => 14 -86 => 15 -85 => 16 -84 => 17 -83 => 18 -82 => 19 -81 => 20 -80 => 21 -79 => 22 -78 => 23 -77 => 24 -76 => 25 -75 => 26 -74 => 27 -73 => 28 -72 => 29 -71 => 30 -70 => 31 -69 => 32 -68 => 33 -67 => 34 -66 => 35 -65 => 36 -64 => 37 -63 => 38 -62 => 39 -61 => 40 -60 => 41 -59 => 42 -58 => 43 -57 => 44 -56 => 45 -55 => 46 -54 => 47 -53 => 48 -52 => 49 -51 => 50 -50 => 51 -49 => 52 -48 => 53 -47 => 54 -46 => 55 -45 => 56 -44 => 57 -43 => 58 -42 => 59 -41 => 60 -40 => 61 -39 => 62 -38 => 63 -37 => 64 -36 => 65 -35 => 66 -34 => 67 -33 => 68 -32 => 69 -31 => 70 -30 => 71 -29 => 72 -28 => 73 -27 => 74 -26 => 75 -25 => 76 -24 => 77 -23 => 78 -22 => 79 -21 => 80 -20 => 81 -19 => 82 -18 => 83 -17 => 84 -16 => 85 -15 => 86 -14 => 87 -13 => 88 -12 => 89 -11 => 90 -10 => 91 -9 => 92 -8 => 93 -7 => 94 -6 => 95 -5 => 96 -4 => 97 -3 => 98 -2 => 99 -1 => 100 +99 => 1 +98 => 2 +97 => 3 +96 => 4 +95 => 5 +94 => 6 +93 => 7 +92 => 8 +91 => 9 +90 => 10 +89 => 11 +88 => 12 +87 => 13 +86 => 14 +85 => 15 +84 => 16 +83 => 17 +82 => 18 +81 => 19 +80 => 20 +79 => 21 +78 => 22 +77 => 23 +76 => 24 +75 => 25 +74 => 26 +73 => 27 +72 => 28 +71 => 29 +70 => 30 +69 => 31 +68 => 32 +67 => 33 +66 => 34 +65 => 35 +64 => 36 +63 => 37 +62 => 38 +61 => 39 +60 => 40 +59 => 41 +58 => 42 +57 => 43 +56 => 44 +55 => 45 +54 => 46 +53 => 47 +52 => 48 +51 => 49 +50 => 50 +49 => 51 +48 => 52 +47 => 53 +46 => 54 +45 => 55 +44 => 56 +43 => 57 +42 => 58 +41 => 59 +40 => 60 +39 => 61 +38 => 62 +37 => 63 +36 => 64 +35 => 65 +34 => 66 +33 => 67 +32 => 68 +31 => 69 +30 => 70 +29 => 71 +28 => 72 +27 => 73 +26 => 74 +25 => 75 +24 => 76 +23 => 77 +22 => 78 +21 => 79 +20 => 80 +19 => 81 +18 => 82 +17 => 83 +16 => 84 +15 => 85 +14 => 86 +13 => 87 +12 => 88 +11 => 89 +10 => 90 +9 => 91 +8 => 92 +7 => 93 +6 => 94 +5 => 95 +4 => 96 +3 => 97 +2 => 98 +1 => 99 +0 => 100 ===DONE=== diff --git a/ext/spl/tests/heap_006.phpt b/ext/spl/tests/heap_006.phpt index 4422727d04ad9..3218bdfb16ed8 100644 --- a/ext/spl/tests/heap_006.phpt +++ b/ext/spl/tests/heap_006.phpt @@ -18,104 +18,104 @@ foreach ($h as $k => $o) { ===DONE=== --EXPECTF-- -100 => 100 -99 => 99 -98 => 98 -97 => 97 -96 => 96 -95 => 95 -94 => 94 -93 => 93 -92 => 92 -91 => 91 -90 => 90 -89 => 89 -88 => 88 -87 => 87 -86 => 86 -85 => 85 -84 => 84 -83 => 83 -82 => 82 -81 => 81 -80 => 80 -79 => 79 -78 => 78 -77 => 77 -76 => 76 -75 => 75 -74 => 74 -73 => 73 -72 => 72 -71 => 71 -70 => 70 -69 => 69 -68 => 68 -67 => 67 -66 => 66 -65 => 65 -64 => 64 -63 => 63 -62 => 62 -61 => 61 -60 => 60 -59 => 59 -58 => 58 -57 => 57 -56 => 56 -55 => 55 -54 => 54 -53 => 53 -52 => 52 -51 => 51 -50 => 50 -49 => 49 -48 => 48 -47 => 47 -46 => 46 -45 => 45 -44 => 44 -43 => 43 -42 => 42 -41 => 41 -40 => 40 -39 => 39 -38 => 38 -37 => 37 -36 => 36 -35 => 35 -34 => 34 -33 => 33 -32 => 32 -31 => 31 -30 => 30 -29 => 29 -28 => 28 -27 => 27 -26 => 26 -25 => 25 -24 => 24 -23 => 23 -22 => 22 -21 => 21 -20 => 20 -19 => 19 -18 => 18 -17 => 17 -16 => 16 -15 => 15 -14 => 14 -13 => 13 -12 => 12 -11 => 11 -10 => 10 -9 => 9 -8 => 8 -7 => 7 -6 => 6 -5 => 5 -4 => 4 -3 => 3 -2 => 2 -1 => 1 +99 => 100 +98 => 99 +97 => 98 +96 => 97 +95 => 96 +94 => 95 +93 => 94 +92 => 93 +91 => 92 +90 => 91 +89 => 90 +88 => 89 +87 => 88 +86 => 87 +85 => 86 +84 => 85 +83 => 84 +82 => 83 +81 => 82 +80 => 81 +79 => 80 +78 => 79 +77 => 78 +76 => 77 +75 => 76 +74 => 75 +73 => 74 +72 => 73 +71 => 72 +70 => 71 +69 => 70 +68 => 69 +67 => 68 +66 => 67 +65 => 66 +64 => 65 +63 => 64 +62 => 63 +61 => 62 +60 => 61 +59 => 60 +58 => 59 +57 => 58 +56 => 57 +55 => 56 +54 => 55 +53 => 54 +52 => 53 +51 => 52 +50 => 51 +49 => 50 +48 => 49 +47 => 48 +46 => 47 +45 => 46 +44 => 45 +43 => 44 +42 => 43 +41 => 42 +40 => 41 +39 => 40 +38 => 39 +37 => 38 +36 => 37 +35 => 36 +34 => 35 +33 => 34 +32 => 33 +31 => 32 +30 => 31 +29 => 30 +28 => 29 +27 => 28 +26 => 27 +25 => 26 +24 => 25 +23 => 24 +22 => 23 +21 => 22 +20 => 21 +19 => 20 +18 => 19 +17 => 18 +16 => 17 +15 => 16 +14 => 15 +13 => 14 +12 => 13 +11 => 12 +10 => 11 +9 => 10 +8 => 9 +7 => 8 +6 => 7 +5 => 6 +4 => 5 +3 => 4 +2 => 3 +1 => 2 +0 => 1 ===DONE=== diff --git a/ext/spl/tests/pqueue_001.phpt b/ext/spl/tests/pqueue_001.phpt index 9c299808f2477..de164e549a422 100644 --- a/ext/spl/tests/pqueue_001.phpt +++ b/ext/spl/tests/pqueue_001.phpt @@ -63,34 +63,34 @@ foreach ($pq3 as $k=>$v) { --EXPECTF-- Exception: Can't extract from an empty heap -3=>b -2=>a -1=>c +2=>b +1=>a +0=>c EXTR_BOTH -3=>Array +2=>Array ( [data] => b [priority] => 2 ) -2=>Array +1=>Array ( [data] => a [priority] => 1 ) -1=>Array +0=>Array ( [data] => c [priority] => 0 ) EXTR_DATA -3=>b -2=>a -1=>c +2=>b +1=>a +0=>c EXTR_PRIORITY -3=>2 -2=>1 -1=>0 +2=>2 +1=>1 +0=>0 ===DONE=== diff --git a/ext/sqlite3/libsqlite/sqlite3.c b/ext/sqlite3/libsqlite/sqlite3.c index 523eb20ac2292..f3c06d49b1b00 100644 --- a/ext/sqlite3/libsqlite/sqlite3.c +++ b/ext/sqlite3/libsqlite/sqlite3.c @@ -23307,7 +23307,7 @@ static int os2OpenSharedMemory( os2File *fd, int szRegion ) { sqlite3_mutex_leave(pNode->mutex); } else { - /* Error occured. Free our link object. */ + /* Error occurred. Free our link object. */ sqlite3_free(pLink); } @@ -28994,7 +28994,7 @@ static int fillInUnixFile( unixEnterMutex(); rc = findInodeInfo(pNew, &pNew->pInode); if( rc!=SQLITE_OK ){ - /* If an error occured in findInodeInfo(), close the file descriptor + /* If an error occurred in findInodeInfo(), close the file descriptor ** immediately, before releasing the mutex. findInodeInfo() may fail ** in two scenarios: ** @@ -32173,7 +32173,7 @@ static int seekWinFile(winFile *pFile, sqlite3_int64 iOffset){ ** containing the lower 32-bits of the new file-offset. Or, if it fails, ** it returns INVALID_SET_FILE_POINTER. However according to MSDN, ** INVALID_SET_FILE_POINTER may also be a valid new offset. So to determine - ** whether an error has actually occured, it is also necessary to call + ** whether an error has actually occurred, it is also necessary to call ** GetLastError(). */ dwRet = SetFilePointer(pFile->h, lowerBits, &upperBits, FILE_BEGIN); @@ -32273,7 +32273,7 @@ static int winWrite( int amt, /* Number of bytes to write */ sqlite3_int64 offset /* Offset into the file to begin writing at */ ){ - int rc; /* True if error has occured, else false */ + int rc; /* True if error has occurred, else false */ winFile *pFile = (winFile*)id; /* File handle */ assert( amt>0 ); @@ -37068,7 +37068,7 @@ int sqlite3PagerTrace=1; /* True to enable tracing */ ** * A write transaction is active. ** * An EXCLUSIVE or greater lock is held on the database file. ** * All writing and syncing of journal and database data has finished. -** If no error occured, all that remains is to finalize the journal to +** If no error occurred, all that remains is to finalize the journal to ** commit the transaction. If an error did occur, the caller will need ** to rollback the transaction. ** @@ -54279,7 +54279,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( insertCell(pPage, idx, newCell, szNew, 0, 0, &rc); assert( rc!=SQLITE_OK || pPage->nCell>0 || pPage->nOverflow>0 ); - /* If no error has occured and pPage has an overflow cell, call balance() + /* If no error has occurred and pPage has an overflow cell, call balance() ** to redistribute the cells within the tree. Since balance() may move ** the cursor, zero the BtCursor.info.nSize and BtCursor.validNKey ** variables. @@ -57935,7 +57935,7 @@ SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){ } sqlite3DbFree(v->db, sIter.apSub); - /* Return true if hasAbort==mayAbort. Or if a malloc failure occured. + /* Return true if hasAbort==mayAbort. Or if a malloc failure occurred. ** If malloc failed, then the while() loop above may not have iterated ** through all opcodes and hasAbort may be set incorrectly. Return ** true for this case to prevent the assert() in the callers frame @@ -59562,7 +59562,7 @@ SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *p, int eOp){ /* If p->iStatement is greater than zero, then this Vdbe opened a ** statement transaction that should be closed here. The only exception - ** is that an IO error may have occured, causing an emergency rollback. + ** is that an IO error may have occurred, causing an emergency rollback. ** In this case (db->nStatement==0), and there is nothing to do. */ if( db->nStatement && p->iStatement ){ @@ -59697,7 +59697,7 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){ ** ** Even if the statement is read-only, it is important to perform ** a statement or transaction rollback operation. If the error - ** occured while writing to the journal, sub-journal or database + ** occurred while writing to the journal, sub-journal or database ** file as part of an effort to free up cache space (see function ** pagerStress() in pager.c), the rollback is required to restore ** the pager to a consistent state. @@ -61245,7 +61245,7 @@ static int sqlite3Step(Vdbe *p){ assert( p->rc!=SQLITE_ROW && p->rc!=SQLITE_DONE ); if( p->isPrepareV2 && rc!=SQLITE_ROW && rc!=SQLITE_DONE ){ /* If this statement was prepared using sqlite3_prepare_v2(), and an - ** error has occured, then return the error code in p->rc to the + ** error has occurred, then return the error code in p->rc to the ** caller. Set the error code in the database handle to the same value. */ rc = db->errCode = p->rc; @@ -113286,7 +113286,7 @@ static int fts3CursorSeek(sqlite3_context *pContext, Fts3Cursor *pCsr){ }else{ int rc = sqlite3_reset(pCsr->pStmt); if( rc==SQLITE_OK ){ - /* If no row was found and no error has occured, then the %_content + /* If no row was found and no error has occurred, then the %_content ** table is missing a row that is present in the full-text index. ** The data structures are corrupt. */ diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index a420d5d7086ee..0bb8616d96f03 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -114,7 +114,10 @@ PHP_METHOD(sqlite3, open) zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Already initialised DB Object", 0 TSRMLS_CC); } - if (strncmp(filename, ":memory:", 8) != 0) { + if (strlen(filename) != filename_len) { + return; + } + if (memcmp(filename, ":memory:", sizeof(":memory:")) != 0) { if (!(fullpath = expand_filepath(filename, NULL TSRMLS_CC))) { zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Unable to expand filepath", 0 TSRMLS_CC); return; @@ -1094,7 +1097,7 @@ static int php_sqlite3_stream_close(php_stream *stream, int close_handle TSRMLS_ php_stream_sqlite3_data *sqlite3_stream = (php_stream_sqlite3_data *) stream->abstract; if (sqlite3_blob_close(sqlite3_stream->blob) != SQLITE_OK) { - /* Error occured, but it still closed */ + /* Error occurred, but it still closed */ } efree(sqlite3_stream); @@ -1959,7 +1962,7 @@ static int php_sqlite3_authorizer(void *autharg, int access_type, const char *ar switch (access_type) { case SQLITE_ATTACH: { - if (strncmp(arg3, ":memory:", sizeof(":memory:")-1) && *arg3) { + if (memcmp(arg3, ":memory:", sizeof(":memory:")) && *arg3) { TSRMLS_FETCH(); #if PHP_API_VERSION < 20100412 diff --git a/ext/standard/base64.c b/ext/standard/base64.c index 9e9c36250cc3a..d78cb244c5e22 100644 --- a/ext/standard/base64.c +++ b/ext/standard/base64.c @@ -59,14 +59,14 @@ PHPAPI unsigned char *php_base64_encode(const unsigned char *str, int length, in unsigned char *p; unsigned char *result; - if ((length + 2) < 0 || ((length + 2) / 3) >= (1 << (sizeof(int) * 8 - 2))) { + if (length < 0) { if (ret_length != NULL) { *ret_length = 0; } return NULL; } - result = (unsigned char *)safe_emalloc(((length + 2) / 3) * 4, sizeof(char), 1); + result = (unsigned char *) safe_emalloc((length + 2) / 3, 4 * sizeof(char), 1); p = result; while (length > 2) { /* keep going until we have less than 24 bits */ diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 528e4f65b96e6..a2d236c9df703 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1550,18 +1550,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_phpcredits, 0, 0, 0) ZEND_ARG_INFO(0, flag) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_php_logo_guid, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_php_real_logo_guid, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_php_egg_logo_guid, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_zend_logo_guid, 0) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO(arginfo_php_sapi_name, 0) ZEND_END_ARG_INFO() @@ -2522,6 +2510,10 @@ ZEND_BEGIN_ARG_INFO(arginfo_strval, 0) ZEND_ARG_INFO(0, var) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO(arginfo_boolval, 0) + ZEND_ARG_INFO(0, var) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO(arginfo_is_null, 0) ZEND_ARG_INFO(0, var) ZEND_END_ARG_INFO() @@ -2719,10 +2711,6 @@ const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FE(phpinfo, arginfo_phpinfo) PHP_FE(phpversion, arginfo_phpversion) PHP_FE(phpcredits, arginfo_phpcredits) - PHP_FE(php_logo_guid, arginfo_php_logo_guid) - PHP_FE(php_real_logo_guid, arginfo_php_real_logo_guid) - PHP_FE(php_egg_logo_guid, arginfo_php_egg_logo_guid) - PHP_FE(zend_logo_guid, arginfo_zend_logo_guid) PHP_FE(php_sapi_name, arginfo_php_sapi_name) PHP_FE(php_uname, arginfo_php_uname) PHP_FE(php_ini_scanned_files, arginfo_php_ini_scanned_files) @@ -3045,6 +3033,7 @@ const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FE(floatval, arginfo_floatval) PHP_FALIAS(doubleval, floatval, arginfo_floatval) PHP_FE(strval, arginfo_strval) + PHP_FE(boolval, arginfo_boolval) PHP_FE(gettype, arginfo_gettype) PHP_FE(settype, arginfo_settype) PHP_FE(is_null, arginfo_is_null) @@ -3754,8 +3743,6 @@ PHP_RINIT_FUNCTION(basic) /* {{{ */ /* Default to global filters only */ FG(stream_filters) = NULL; - FG(wrapper_errors) = NULL; - return SUCCESS; } /* }}} */ @@ -3868,7 +3855,7 @@ PHP_NAMED_FUNCTION(php_inet_ntop) } if (!inet_ntop(af, address, buffer, sizeof(buffer))) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "An unknown error occured"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "An unknown error occurred"); RETURN_FALSE; } @@ -5080,8 +5067,11 @@ void php_free_shutdown_functions(TSRMLS_D) /* {{{ */ zend_hash_destroy(BG(user_shutdown_function_names)); FREE_HASHTABLE(BG(user_shutdown_function_names)); BG(user_shutdown_function_names) = NULL; - } - zend_end_try(); + } zend_catch { + /* maybe shutdown method call exit, we just ignore it */ + FREE_HASHTABLE(BG(user_shutdown_function_names)); + BG(user_shutdown_function_names) = NULL; + } zend_end_try(); } /* }}} */ diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index de6d18094ec8e..ae5e90cf9b709 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -43,7 +43,7 @@ ZEND_BEGIN_MODULE_GLOBALS(browscap) browser_data activation_bdata; ZEND_END_MODULE_GLOBALS(browscap) -ZEND_DECLARE_MODULE_GLOBALS(browscap); +ZEND_DECLARE_MODULE_GLOBALS(browscap) #ifdef ZTS #define BROWSCAP_G(v) TSRMG(browscap_globals_id, zend_browscap_globals *, v) diff --git a/ext/standard/credits.c b/ext/standard/credits.c index e87cdcad8be99..0f5d6d735119f 100644 --- a/ext/standard/credits.c +++ b/ext/standard/credits.c @@ -27,10 +27,6 @@ PHPAPI void php_print_credits(int flag TSRMLS_DC) /* {{{ */ { - if (!sapi_module.phpinfo_as_text && flag & PHP_CREDITS_FULLPAGE) { - php_print_info_htmlhead(TSRMLS_C); - } - if (!sapi_module.phpinfo_as_text) { PUTS("

PHP Credits

\n"); } else { @@ -123,10 +119,6 @@ PHPAPI void php_print_credits(int flag TSRMLS_DC) /* {{{ */ CREDIT_LINE("Windows Infrastructure", "Alex Schoenmaker"); php_info_print_table_end(); } - - if (!sapi_module.phpinfo_as_text && flag & PHP_CREDITS_FULLPAGE) { - PUTS("\n"); - } } /* }}} */ diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index 9a1fcf1f6946c..27a8d82d0e435 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -199,7 +199,7 @@ PHP_FUNCTION(crypt) char *output; int needed = (sizeof(sha512_salt_prefix) - 1 + sizeof(sha512_rounds_prefix) + 9 + 1 - + strlen(salt) + 1 + 43 + 1); + + salt_in_len + 1 + 86 + 1); output = emalloc(needed); salt[salt_in_len] = '\0'; @@ -214,7 +214,7 @@ PHP_FUNCTION(crypt) RETVAL_STRING(output, 1); } - memset(output, 0, PHP_MAX_SALT_LEN + 1); + memset(output, 0, needed); efree(output); } else if (salt[0]=='$' && salt[1]=='5' && salt[2]=='$') { const char sha256_salt_prefix[] = "$5$"; @@ -222,7 +222,7 @@ PHP_FUNCTION(crypt) char *output; int needed = (sizeof(sha256_salt_prefix) - 1 + sizeof(sha256_rounds_prefix) + 9 + 1 - + strlen(salt) + 1 + 43 + 1); + + salt_in_len + 1 + 43 + 1); output = emalloc(needed); salt[salt_in_len] = '\0'; @@ -237,7 +237,7 @@ PHP_FUNCTION(crypt) RETVAL_STRING(output, 1); } - memset(output, 0, PHP_MAX_SALT_LEN + 1); + memset(output, 0, needed); efree(output); } else if ( salt[0] == '$' && diff --git a/ext/standard/crypt_freesec.c b/ext/standard/crypt_freesec.c index 49c397cca1a96..0a5c3ba5fa793 100644 --- a/ext/standard/crypt_freesec.c +++ b/ext/standard/crypt_freesec.c @@ -629,7 +629,8 @@ _crypt_extended_r(const char *key, const char *setting, */ q = (u_char *) keybuf; while (q - (u_char *) keybuf < sizeof(keybuf)) { - if ((*q++ = *key << 1)) + *q++ = *key << 1; + if (*key) key++; } if (des_setkey((u_char *) keybuf, data)) diff --git a/ext/standard/file.c b/ext/standard/file.c index 8bc556653f94b..5dc91b44b332d 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -161,6 +161,7 @@ static void file_globals_ctor(php_file_globals *file_globals_p TSRMLS_DC) FG(pclose_ret) = 0; FG(user_stream_current_filename) = NULL; FG(def_chunk_size) = PHP_SOCK_CHUNK_SIZE; + FG(wrapper_errors) = NULL; } static void file_globals_dtor(php_file_globals *file_globals_p TSRMLS_DC) diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index 142ca9bdcf73a..4e5f768381a5a 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -803,7 +803,7 @@ PHP_FUNCTION(touch) PHPAPI void php_clear_stat_cache(zend_bool clear_realpath_cache, const char *filename, int filename_len TSRMLS_DC) { /* always clear CurrentStatFile and CurrentLStatFile even if filename is not NULL - * as it may contains outdated data (e.g. "nlink" for a directory when deleting a file + * as it may contain outdated data (e.g. "nlink" for a directory when deleting a file * in this directory, as shown by lstat_stat_variation9.phpt) */ if (BG(CurrentStatFile)) { efree(BG(CurrentStatFile)); diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c index 0ca2f04cf7dd5..f6d3750e2b0c7 100644 --- a/ext/standard/incomplete_class.c +++ b/ext/standard/incomplete_class.c @@ -109,6 +109,8 @@ static zend_object_value php_create_incomplete_object(zend_class_entry *class_ty value = zend_objects_new(&object, class_type TSRMLS_CC); value.handlers = &php_incomplete_object_handlers; + object_properties_init(object, class_type); + return value; } diff --git a/ext/standard/info.c b/ext/standard/info.c index 07e152874a354..089f515d95b9b 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -92,14 +92,6 @@ static int php_info_printf(const char *fmt, ...) /* {{{ */ } /* }}} */ -static void php_info_print_request_uri(TSRMLS_D) /* {{{ */ -{ - if (SG(request_info).request_uri) { - php_info_print_html_esc(SG(request_info).request_uri, strlen(SG(request_info).request_uri)); - } -} -/* }}} */ - static int php_info_print(const char *str) /* {{{ */ { TSRMLS_FETCH(); @@ -660,7 +652,6 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) { char **env, *tmp1, *tmp2; char *php_uname; - int expose_php = INI_INT("expose_php"); if (!sapi_module.phpinfo_as_text) { php_print_info_htmlhead(TSRMLS_C); @@ -671,7 +662,6 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) if (flag & PHP_INFO_GENERAL) { char *zend_version = get_zend_version(); char temp_api[10]; - char *logo_guid; php_uname = php_get_uname('a'); @@ -679,14 +669,19 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) php_info_print_box_start(1); } - if (expose_php && !sapi_module.phpinfo_as_text) { - php_info_print("\"PHP"); + if (!sapi_module.phpinfo_as_text) { + time_t the_time; + struct tm *ta, tmbuf; + + the_time = time(NULL); + ta = php_localtime_r(&the_time, &tmbuf); + + php_info_print("tm_mon==3) && (ta->tm_mday==1)) { + php_info_print(PHP_EGG_LOGO_DATA_URI "\" alt=\"PHP logo\" />"); + } else { + php_info_print(PHP_LOGO_DATA_URI "\" alt=\"PHP logo\" />"); + } } if (!sapi_module.phpinfo_as_text) { @@ -787,10 +782,9 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) /* Zend Engine */ php_info_print_box_start(0); - if (expose_php && !sapi_module.phpinfo_as_text) { + if (!sapi_module.phpinfo_as_text) { php_info_print("\"Zend\n"); + php_info_print(ZEND_LOGO_DATA_URI "\" alt=\"Zend logo\" />\n"); } php_info_print("This program makes use of the Zend Scripting Language Engine:"); php_info_print(!sapi_module.phpinfo_as_text?"
":"\n"); @@ -803,15 +797,6 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) efree(php_uname); } - if ((flag & PHP_INFO_CREDITS) && expose_php && !sapi_module.phpinfo_as_text) { - php_info_print_hr(); - php_info_print("

"); - php_info_print("PHP Credits"); - php_info_print("

\n"); - } - zend_ini_sort_entries(TSRMLS_C); if (flag & PHP_INFO_CONFIGURATION) { @@ -893,6 +878,12 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) php_info_print_table_end(); } + + if ((flag & PHP_INFO_CREDITS) && !sapi_module.phpinfo_as_text) { + php_info_print_hr(); + php_print_credits(PHP_CREDITS_ALL TSRMLS_CC); + } + if (flag & PHP_INFO_LICENSE) { if (!sapi_module.phpinfo_as_text) { SECTION("PHP License"); @@ -926,6 +917,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) php_info_print("questions about PHP licensing, please contact license@php.net.\n"); } } + if (!sapi_module.phpinfo_as_text) { php_info_print(""); } @@ -1191,77 +1183,6 @@ PHP_FUNCTION(phpcredits) } /* }}} */ -/* {{{ php_logo_guid - */ -PHPAPI char *php_logo_guid(void) -{ - char *logo_guid; - - time_t the_time; - struct tm *ta, tmbuf; - - the_time = time(NULL); - ta = php_localtime_r(&the_time, &tmbuf); - - if (ta && (ta->tm_mon==3) && (ta->tm_mday==1)) { - logo_guid = PHP_EGG_LOGO_GUID; - } else { - logo_guid = PHP_LOGO_GUID; - } - - return estrdup(logo_guid); - -} -/* }}} */ - -/* {{{ proto string php_logo_guid(void) - Return the special ID used to request the PHP logo in phpinfo screens*/ -PHP_FUNCTION(php_logo_guid) -{ - if (zend_parse_parameters_none() == FAILURE) { - return; - } - - RETURN_STRING(php_logo_guid(), 0); -} -/* }}} */ - -/* {{{ proto string php_real_logo_guid(void) - Return the special ID used to request the PHP logo in phpinfo screens*/ -PHP_FUNCTION(php_real_logo_guid) -{ - if (zend_parse_parameters_none() == FAILURE) { - return; - } - - RETURN_STRINGL(PHP_LOGO_GUID, sizeof(PHP_LOGO_GUID)-1, 1); -} -/* }}} */ - -/* {{{ proto string php_egg_logo_guid(void) - Return the special ID used to request the PHP logo in phpinfo screens*/ -PHP_FUNCTION(php_egg_logo_guid) -{ - if (zend_parse_parameters_none() == FAILURE) { - return; - } - - RETURN_STRINGL(PHP_EGG_LOGO_GUID, sizeof(PHP_EGG_LOGO_GUID)-1, 1); -} -/* }}} */ - -/* {{{ proto string zend_logo_guid(void) - Return the special ID used to request the Zend logo in phpinfo screens*/ -PHP_FUNCTION(zend_logo_guid) -{ - if (zend_parse_parameters_none() == FAILURE) { - return; - } - - RETURN_STRINGL(ZEND_LOGO_GUID, sizeof(ZEND_LOGO_GUID)-1, 1); -} -/* }}} */ - /* {{{ proto string php_sapi_name(void) Return the current SAPI module name */ PHP_FUNCTION(php_sapi_name) diff --git a/ext/standard/info.h b/ext/standard/info.h index fadde75eb6a89..98185936649c8 100644 --- a/ext/standard/info.h +++ b/ext/standard/info.h @@ -50,19 +50,14 @@ #endif /* HAVE_CREDITS_DEFS */ -#define PHP_LOGO_GUID "PHPE9568F34-D428-11d2-A769-00AA001ACF42" -#define PHP_EGG_LOGO_GUID "PHPE9568F36-D428-11d2-A769-00AA001ACF42" -#define ZEND_LOGO_GUID "PHPE9568F35-D428-11d2-A769-00AA001ACF42" -#define PHP_CREDITS_GUID "PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000" +#define PHP_LOGO_DATA_URI "data:image/gif;base64,R0lGODlheABDAOZqAH+CuDk3RyglKszN4qGky9PV57K01ENCWIOGuYKDs1JScpCSwsLE3qqs0ExLY1tcg93e7Ds4PG5xpWptnWFjjXV5sXt+teXm8JmcxoyNwbm62Wtrkk5Oa3F0qXp6o4iLvXJ0o3RzmI6QwVpbfuLj73t9raSl0G1wonJ2rJWWyLu92XR4roWIu5KVw9jZ6pKSxGRmkmtun6WozpSWxS4rL1NRaLO012xqjFxbdoqNv2ZolmhqmpyfyDEuOa6w05yczVVWeJ6hypaZxYGCr2dplz89ULy+2l5giZiZyIyOv4mKuldYfLa319XX6CIeIGxvns7Q5L/A3Hd7tHZ4p19efZmZzG5vmHN3riIeH////5COj1lWV8fGx+7u9dXU1fb2+oKAgayqq3Ryc/Hw8Z6cnePi40tISbm4uWdkZYmJtgD/AEdGX9/g7ZuczGlrnG9zp4yMuri52bi615qbzKeqz9vc65qcyWZkhGhniaeo0m5woIuLucbH4MfJ4WlsnJeYyyH5BAEAAGoALAAAAAB4AEMAAAf/gGqCg4SFhoeIiYqLjI2Oj5CRkpOUlZaXlm0/bXOYnp+gP3l5Nj4acUwaGkwGPj4NMgRBPBhCLQtJIjkfGTkiLymgwqENGgx9TQVQUAN9fAxRUSpyrK90sbNCMy26HwgAFhYVVyglFgkZwcPrjCZxfC5sbBAQdS7JA9QysyIf/iwAEQgEQLDgN4LhpKxA8UbCCT87nkwZkoSdRTVBbAxgQ+KCRxIk8jUQskCKyZMoU6pceXJcBwkTduiAQeEIBStDRFzEFIQJFI4eL7gwQqcFy6NIk6K88iYGjCNHHoxYcsSDzp2Qfmh0AYEjBCMEWCgdSzbplRM6HiwBokDBiCkz/7AuMqGhQBMXdQoYSFK2r1+kHWAsUcCBgwM8CeQayhNlAJQCA3zk+LtyAYbLmDF8oJz0DQUFDtasUeBBsZo8Rvj0GcBkBueVH7JwmU2bS5fXSt0sWXPggIMQO91FYcCgAQLcKzFwwcK8uZnbyJN22F2kyJrSw374kGNEBQ8L0VeqINO8uZgC4ZVeeXAgQAAOcECZMMBEDgEA6VcWEFOeORkV+Sn1hgLu9XAHJnPQ4YMBMhwXoEpdmNEfFlwQ8KBSMazRQw8H7FHJDzI00EBJF6YEQBYTYpHFZiUm9UAAGwInSRsE7ONgiycpN6EZX+ColB9F0EADFZHYEQQBM4CH1P8HmTXZJItHqRDGhGJc0CSJLDHp5Jb4jYWCAzQIUMMjSGAQBJRHffBFFmy26eabWXRRQANdolQAGBOSAWebFwxg4UkL7Ckom10M0IBSQAgggAONzCAEBmIpRcByKVZqBhhcfAEgSl1sUWmKNGyhRRldkGjAlJ9OuAUYXnRxKFIjCOAEo4psI8SNSY2X6qdbeAFBlyfu+ikYY2AgxQB4CqtqGQMkNYITTuCQSAoitIBmUhDwp2yKYUBgEgZebJsiGrdd4Km45dHgRbNIrQEtdoX84ctkZX0hIbr9eQGglPjm2wCK/TZHQxl/HhWAEwIsYEg/9JIVW8DlbdHjnRAzp8X/BeFWjIUY0B3VgaxjEpICAh/UOdakO8I5xhnaTugFAZ1OyMWbY3CBRopaZIFqxHCWcca5E5aBJUsKQJsGId7gOpau/YnhLUoLNNAFeRNqwQDA/a2IEgYNfBFB1VloUTW7gBrwRbL9hWGAUjTMOsgfACCgZFnZ5rmpiVl83XQWGZfH40oQAN1czoIzd8baKn0wBs53H7UEtAqrIYIFJpNlr8wFpxS4qjpT+XRKMfd3RhY0BG3sSqGXp0XjLHUA7Q2CsJBQXw9POMa1J23eHxpZoN3cfyoFG3QZE9KQxVGpD846S0W4rUY4c5OFcn8R9MjS5f0RjrlK4BafxRmqXnAU/9blAa8UB070IEgFlDFdHhqfp1R72uQ3d7tK/Pa3Rdhjs4QB8dtTCgWgJYgVUKZu2VueSQwAvqD1rTnV04/vmAOGLBQOC4djCQOo1p/7CZCAKbgC+/yCvfJUiCXJY04EOre7+J0khVgIA+lMtxIAeG1C5CLLAJ0gCBQYsC/C6yDujkWp7PWuassLYnm8AMB0HU8/HCxPGBS4kh0KogMoGCFZdES9J6LkAwXwQun6Q4MxfOGCJ0xJ9yb0vfBxDwJinFD1KncUK6phIVpcWhSZQy4V+FEFEOjCGLQwRtENoH7M8SBK8sczsWWvC38EZBfK4EiZUXEl6FPf8zpwhb7sR/9VWghlKMVwrxSJ4QsEeKAKvWinCWKhghcUlSi1QMphia8szaPVB97Qgb5ESGNo+MICToVDF5rEXBOSYSEDdsqhSed1gkiBBN7wQ6UosV/NPJYrrbYSRGKBiRoDgzD78jgnRO55EujlWNbYLxqcYZxSQGZ/uPCqramSOW0MWATOcAFnss15gnjBCSTQSaUwUlxmIMMYBlCnGXbQn8TUH//wZQYZMoCOSSmaE45GiCGc4A1joZj+ZjlLMnBhDIVCU6BIGkpWnkQFXGDp6C4oBpaG0qQoZcAQpQMyQ6TgBCdQJ1JgyIUL0IMeBfgjAfxpEkAe9aiZA9QAnkqPQy6TOV7/MOpRk+pHAux0LAdL2CGSEIMToAAp10wkU30khQU0sTxZwChy3OUEeBkiAWUtaHLuuUK2sqQBDYxYx/JTTmkpogR5ZclB+WhMv0qBAZVsDhjQE6By0moRiDWrBKvGAMeqRHdSvCRlNHpZRpRgAjHoQB6lQNR6etYkeXPZ6aLTgQNAq7SNSABqJaDFtGJhDGv10QIWx0a5+oUIPYCWYSOhhCdMQLNS+N8Wpktd3r3WntSlLhgG+xoFyEoAMprEC0DghxjwFgAFoCo9EHddKaBXvRBwLWWIcDAnRICjlkiAG1D7htW2168nsK1yQfGCKfgBtar9r19RwAFZOaEI+AWF/xL04IYD91fBJTrBGhzcg/CygwUUPrAEzorh8BzhAIoSQA9gpxgWgGAHbnBDDKhZYsr4gQMBCJMAAsBi0wgiCSUgwg5gPAEa1zgpEyBQD4QkJrv6eBApSIAedEAEIbshqP7F8BuOgOMNLbkIeHjBkxfxAinr4Mxn3sFHSXzdHRxBAe2B0YYOcAMPjfkRL0DAFIgAgz77mQh++KhQ8zMBIjwANNVxj6JxEAI735kSIhjCnilA6UpT+gh9rnCg38BpTkvg058GKlCJcGm2iKY3B6hOEQJwABxsIDGPFkYKPlACEFgBKlB5gK53PZUlrAUIbGkLYQpjmNCcujdFUAAVbjgwBDHHWjEpUAICPOCBDWwgLb4GdrDbQmzDcIAKIxiBFaxQgmY/+9yLEEEaEHAVdLv73fCOd7wDAQA7AA==" +#define PHP_EGG_LOGO_DATA_URI "data:image/gif;base64,R0lGODlheABDAOf/ABIZISAeIhwhLA8jRwYlVSUoLyIpNSkoKwkvbR4tRBUwVDMuNysxOx87Yg89gDo3RTI5SgBCkDg6PDY7RyBCcTxBQz9BVD9ETxxPkQ9SoktIYkROVkpNWDJSeilVhkxObEZTZQVevgBfxVZQZRxcn1BUYFNTc1FXWRZht1ZYVQBm0ghlzBhksVVafyNlqSpkn1hcZwBr2EVfhABs0lRdcF5adRJpyWBcaVlgYl5dh15efh5q0gdw3iFsxhBy2Rtxxhhx0Ttsn2BkigB45SxwtDFwq0dslGNoc1pqfRtz6GRmkypzwFZuiQl772psaWlpiiF25Ax94zB10BB+3iV44BR96yN71TJ5vit7zih73GluoDt6tk53nix66QOG+nBwl0l7r3F2cjOAzSKB9guI9SKC8HF1lW90pm93jTCC3SaE6zWC12F8knR6fHV5gzaC5SmH6ESC3y6H9kGGyiqJ8UuDzXx5oWV9v1aA0nl6qWmAnXl6tHJ8tV6AyVGGuS6K/EyHwyKO/D6J5T+K2SGQ9zqL3ziN9jaP6jmP8WaHwYGCsHqIkC6U/C2V9naFv0GS50mS2IGFuYeHnEWU4iyZ/16P2ISIr1iSz4mLiF2SxV+TvImLlmiSsnqPrIeLvzmc/kOa9Uaa74aNtHWRyXiSvk+a6YyNvIGQwo6OsImTnFib3lKd5l2d2kKi/WSd0k2h9zeo/1Gi8ZSUw5GVyn+czE2m/46bsY2ZyHugwUmr/12n8GCn6pieoGWn5Hekzpueq26n25yby1ms/ICk25ejrlGy/56iymav+V2y+2yv7Wex9KaopWG2/1e5/5Wu2H216265/HW3/qus0aavxWe+/66wvYy33YC4+Hi7+bO0uHPB/aq3wa6112vF/4e/9pfA27u31YDF/XnK/5PG77y/25TI/MDBxYbN/qvH7LfH2qPP+47V/57T/cPN2abT9c3M5Jna/77S7LrU57HV+KLg/7zd+tbb3dbb6a7l/sbh99Hi+Lrp++Pm7+Hx/P3//P///yH5BAEKAP8ALAAAAAB4AEMAAAj+AP8JHEiwoMGDCBMqXMiwocOHECNKnEixosWLFoNpDIaxo8ePwaRJ4yaNHDhw5EySFCnNmEtjt2TJMmXKk01PpmbN+sgTZEly7+7de0eUaMqj4FaKfBlzps1IkfZI3cMnzx5Fnnb23MrQGLig/PgJHTvUZEtjNZ9CXcu2bVSpfPicOaOlrpY8ikxx3fvPGLd3YQOHfUdOWkw+jkaNEjVtquPHkCNLnVtXieUcSr7k5YvRK2DB9wrLctSnUi9dxYpRo6atEy/JsGM7pqskh+0WLXLY0csZYrC/QsOGNubplrNkxWq1Wp6rObNu53y5kU2dupbaLUxob5FHVu+Fxsj+kb3HzdTUc/TonWtWrLnqXMWaiQvnC031+7LPKMn+4YOGJ4p8Z1BJRA0ljSeQ1XMOPOt00wx7xYhDjWrinDNOEFzQwgd+HEamnwkahGiCHQL+QyBR4MgSWzjw0CNOM+4xKN868FhjhB/PqIMON844c8spp6zlSSSexIXYUx06pkULGlhggQZfcObVUdK8FRs70NCzDnvNUeNgN+vQ4w4XfvSizDHIQAMNM8LooosyaWqDDTbhhOPNnc9g88www/RIHH5nMOmkBiT2FNJRxuBXjzAMTghLK/IVAyY843TgAhaHIKIpIXDQgUgjhwjySCijllLKKrqssssuqaqaTDL+e57CYQ4WPPDAB7x15BdKxlgp2zi9JBPLOetQkwsssBTTYDPwwMMOBSRYgQghdMhRxrVl0AHHG9xuO0UWghRSyCOlTCJuIZNAoq4qwMh63xkm2LrAExiFNFKV96GzyyOICPNIOfRQs9wnucCjTTf07OMOBREAQQcZZXhRxcTYUmExFVFEkUUWaXTscRqhlDuIGGJA0ssoHGqhwQILWJCrRPZKo+J9z5xpCBnUNtrKJwTjc4426bHTQQQzVHFtFU00AUUXEw8BxRBUDBHFtnAIksYUVpOLzDGpTjLIIJA40mEOD7AcJczGtORrbJ48E8orn8jhhRyv4AMPMrBQAkv+M14ijI/QRHeBLdJdMA3F0jzwAIUPb2iKCBwbTwHHI6PqEoub6c6xYcoWHHCADhEF49LM1UWyCyigEMIIIYY0EY56xeycCzO5NAP0PoDPEDG2XSR9eBeHQ8GDD3CUk4862AgD+cZZwAHHIY/EEssqkGjeIR8aeD7CQ6L/eZ8jlWg6hxVkQFxFi8bunOze4tCDzzgNOFB0E9c2UcUYSRd++BA++JCFPm5wwjLKcQjnZcEHQJjcuB6BKl2oQmwdMoHnNNAQWdyiV/iJRB2yoAY1vOEFVbBWFegBD3HkYjmtaI+X4PG++PmgfnKIobXKEDWnDWF4abgHBwzgBG/AQXL+kANCGg6RBitYAQtrgMQqVgFBDrXgAAGgoEJkcou1xeYWdZjCFKKghiqQQAr4o0N61hG7T+gtF+IQBz7wYQ0FEG0M12IEz0DBM001QlNU8EEa2nEBA7QBG5ATxLeAgMRChGINP0jkD7AghkQ08T4tCEAAapCQWZhCFgi6zyjWIAhr2MIFQ5DaD4bQBUS4Dx7NeJQZYQGdfdDjGQOIQAzo14h5yCMf+ahHPfIhj3ZsQx7QgMMg2jEBAbQBecd4xSOIuIZmkguJWFDkJWiRJA1IslAFmQVOMkmdSFxiDYfQhz/8gYQodMFpwAsFPlzZjJ0xohVoPMc+4OEKAkSACnL+IMQxsnGBC3DgnyXgwAYusIFslGMV1SjmAU6AAzfwIh3YCMUkelEKcj0CXWuI5hzmYA0ryuYBATiAdwqSlvvwQRVYyMI8xumPVKTBaEgrwzHWCI/YMeKdxdBG+9jBBQJkoAqBQAQ2NlECGJSABjCgwVEDygBzeGMTEyiAAUrQTwYUIAzeCIUtiPGNZ+jCVI9Iww/EcAlX+OIWHDoDFLdHkFkQyaORuURKB5GCaoxTD4gog7WaMAZvjJE9rUjWg9JTKQKggAyMaEQ53FDUauAyl/r4RQkY0AZ+HOECASBGNX7BWAEAYBGlYAJBcRAGTGBiG8oQK1kzwQpSbK46JpD+5MuGBFfI3AELQKBCEAxQgHbYwwWNKB+22JEeF7WHldQIEzy8kQAEZOETO5sHDU5Qgm08QxiNgEMhzFGCAlTgHiWYgATycad52KKYJ3gGCATAgA1woJ8GwEQpevCDQQACEHMwqzPuA0Up/sOttX0MH3oAhBn4wAPTOAANNpEFMuyVfuxoETy6cSxJSXgdroglHGbXCnnQwA1HSIcyJhaFQqSjuwzYBgcYcIRywCENkPhFAQBwAmJ+Nh7TIAYaeAsMIPRADHPwwxKuAAhXkOIUpJNMJAMwUvMEeCoDtsEKVjADEhQgAAIggRrIUIXCNYEM7KARPNIHC3Gs48zhkIH+YUEhDIGlgwM3cIMtjlEFKrzhEe1Y8QIka4BFxEINgngGGjy7iGp4Fhe64Fo8DAAATkyhB1iYQxBcsAQiXGELW8iENcwjmTNIkl7/ePJUPLEEKatABTsAAgUSgAE43OxavVMDO85h5mZANxfJPbM3GoCANLyiGMyAxDQ4AINNWEMYhEDEIdTxiwsU4AhouIAAqoEINWTBGRAAAAC2MWgGJEOZj7hEAgDAhTSgAAtXeIELWMBuEpCACJl2RqIiY4EoCsSkgOjBCmIQgx34GwiF4CAhhHutRqwjjetABnRhQawzZ2IAGXiFMNqjilT8MxvooAYzoMGObBxhAgywBxL++oiODmahE4xmQDuyvQFtvCIUhfCDZzlxiB8sYQ5bIAG7WeBuF5CgCGDwAy6SLJUPBGAB967OKbBggx3wIAYq4PcOfBAFOljdwVXwAjPCcY5uSCgXyulGs8rRAQLUgRlsyoU30MCBEpjjHubYBjGcQGwIpOIeMJjABp5BBzVYAQmePcI0ZkwMbQgjFpDoxKHhIIYrXKEIL3gBEdTtbgz8HNOcgIwSJCmQ18LGE3MAwgpUwIMh8LvfPqBCsgcOMTLQ6WDnmBB75lOODDsgFhpnRivmAYK2X4AGE7hA8IvqhnhUY8Vt8IYa6FAHC2h7G0gAwAbkMQ49pYMGAJAAKwT+MYgrECEIHog8vOHt7hcUYQuZf8zmA/Df6owCC1OOOg/KUIWnx2AIjYCbIT5BBkNwHRoVcg7MkFPUcA7eUHZigAy0Iwy5IA8QAGdHAGJHAAMw4AbbMA+PIAkcMAG8UA5UoAaJwGgXkA7ZJgG8cIK8AAOYlQrmMgiWFgQyAAZbQAQu4AKRB35BEARbgAvqx3n/EBeyUQdSIAKoFgM+MARkoAZPFwWH8AqtMC37Bw3noCZmdg51Uid+AHG6gAwMWAu5sA0TcAMlwA+5VA/zEA/qcAyIUArtQAzEcA/XQAVwgAsW0Ge2IAEAwADvBVAX0AbPUAhgA29GgAZ2wARgAHn+JPACYLAhlsAFXOAr6ycQZ+B5kDEKPzADoxcDw/OBZaAGqfcKyAAKzNEKwhAOycMiB5cM4QAMCuAAk6ANtOOF0PALxOYG/XAMn9B3VmcI1vYK0VAO0QAKQwAH4xAP98APSMBb9rANqbAIbpAK1gU9I+MCWyADViEVXAAGL+ABMiAKsBGJP0iJjnEKYtB0UcdvPEAFj1MGQ6AGsRAO0KANasIMyKAM2nAMUpgMu6AKl0ABCPADCrgzlNAKi1UCJbAJ/SAMhlAG+1M+VJAtjUAIVMADnggEVkAKHCAAOOANwrAL3lAOyhAKhyAujQdvLeAYkZAJWwAGRgAGcGV0SPf+D3twBrBBCz+wbzvQb5rYjocACogQCsKgDcmgDXUiDtCADLrQC7twCYDgARRAAAhgA8sBC59wU69QDzTQdsSQD7kgQkNQBWRAB1FTOFUwAxTpAzbQA53AAABADNAACj8EB8o2koUwB5dABGBwkpDhB2DABeIoFfUmRZ4wF5FhCnNgAyIweudYenCgBqUQC6FwDMpwCZcQDuIgj/QoBhjgAAiAABGAAoeAQq1ACYxACbnQD8SQCr/AD+wACnJgOF0gB0l4Q1BABTuAhFQABGswaAXwDcIACm8ABEAgOWmALqswB98nBJEBhJ32aQIxC3MhjqfwAzbgA5mYOFDzBnD+AIqxIAzQoApqgg0AGA7FgJRr0ANWIIrKwTNVeVOtcA7lwA7qUA6toFdlADwhlIRwIDw8MAO46QOq4EvtgA1PSAVU9i1TAIjdRwQyQJMdsmQjJZOE+RiJgJgr4G85eYRcBAehoAxvogtzIJnHsHU/U570CAqUMJDtGQgsGghyEAipwQgLKTiFwwP0Y3VUUAVQwG/0wz9AEAq6IAwF6gMxMAPDmQZYMDLw9gFJsgf91VZa4KCOIQYhMGX+dkOpJwiv0ITSswu9sAXKoAxrwnVT2Aq0U5Us6gVj4AV/4AVuOgayWQZKMzFQwJD2Uwaf0nemN0sMOQPVyYSgoAZRMAT+MzADWWBESep9QWACSRJbAfAy/6AIUeoYjrAEISACiTkDVAAFHVQ1QJoqqpAJXHAJpRCPxGKFDLgzaKqmY7Cmc+OirZo099llWVcGhNAIPlkFQ5CTE8MDK2ADUfAKjaAGX9mffmoDRyQGRFAEMpAkahUAbAWlkyoVpmCpU9ZviVMFzgMKoTA9quAHIAABMgAJukAnVmh4yqGqjOCmavoHbeqmMeQFhuAFSUM/clAFt5o6N6QCsUkGUGCkbNYKXMY/MxACBktfiiql+AFSInUQplAXm3MLV2ChM8BvnKpsoCA9q8AKIBB8MNAJvYCU0BAOsEg7N0WagcCmf7CmcqP+pl4AMU3AA0nQBHNDBqCAq4SgBjwKMTxgA3Bws2QQCOwIBDZgsCGAAijAAkSgBNV0TQkhqVowFXOgb5m4A3KIOofQravgCv2EBlFxCqzwJtigDfIopGj6B4HgroHACHLQpoaAPxGTOE0gm4QgiohQBToLBS/bBf0JBy5KCOzoA/SFAkeLtCwQBEmyZJSkEHlQF1LhCjeZiUaoBoggCC9WCKWgCRNgBo7BB6OwC8rAdfLoTmzrru46BmjLqknjBUkws0GLq69QbVRQNLLZBLs6BNlSBVNjBT2AtL7LAi7AtE4kSf7FuHWRB7TAdIrJb4VKdVlwCLqgCRcQGZ+rU/D+eEJoOgaBsKauCqdkUK/1ijOgkAtwmUcvVD4xW3p0ADxRAASYerRLkAEZcLgRRLwP0bhaUK02UKinJzwW8wbQK72SMQracK4Tdyw8Q7ot6qJyUK9dVgafAAqxCwdRcIQvS69OYzQ8oAJWWqg2sAQukAFXcI3VcQb1Zm8QIamKMLGYuJMTmXocmgycML2S8QxXCA0a1x7tWQvIgAyyA13r6gVlkITQlSkV/JDcGzx1+nSh5KOEdAUukAj4oQQLIEmLGxGm8AWQ0AP7u2+lJ4eI8AqSKcCScQrnYIXUIAxww6JoGwitADe31go3VZVPyK2QY2CqI1zAMwR0QH+h9IH+U1CckxBk3ghbUHQAZzMRwcAKkXuhBna1r/AmmUDDNUyy2oAMuVCVbfsHhCAHhvAHMbS2awu7W3oIUmADWYAIrdAImlwGjdAIgWAIA2d1zyNRG8uD1KEEIBUAEgCpEjEOa4CJ+5Z6VysM9QgMG/CXUvEM2kANOCwMtcAIaXtT0iw3oMyilEAwuRAKoVBEaTC+ckzNN5VPrEctcNAIo7IKyYDLsKEFJzxJHjEIUubFX6nKbaIMwEADlgAbySMMbCIM0tyiN+WibhrL7vnGsaAMkDAIsXAMwgCUzQE30izN5UMHyQYqDJQMvgAbfPABUBQALvMRqmAFhXqbH6jKDo3+DL2ABJIgGXygDasskC1qCIbwogu8ttCVQuWpDZegCvdYCkRZtlXpYMJl0VGgbJfTC8DwGKjAByrz0QuQyB6RDGlQqM2rBuf8CpezC5xwBPy8xmRwzS4a0HLzou7phWhXjy/ACspQCshAlOGgxmgaCLOJt3J4CKai1L5CK55zAPPCFX/opzPgb1RXy6WwC5oAA9z0GL0Qzg7WtgtsCGlr0+8kDJYdJx6wBazQCw7NDNpQC+tJCSwqm4aAMbU8CaowCuahBR/wAH39AKC2F5NAtBc6dVQXBYJwKq4AA5bwl6uQOgHNrnJQzaBs1gMZ0bmgDcrQAAPgAZcgppg5MIb+cFMQcy1yuAZ9cAd7oAXxsgB9PQLYxBeQUGAVW7H9EwVTcNjAUAJfYBdS6gmlgAhBG7RuSgij3bY2nc21wIC58ArQoAsNoAAYAAbQIJ7Q0B7qKt9VkAXYLRc50Nos490W8ARa8R2qQJ3XqpPEk9DJgARmYBkgXheTeAd9sAZxoAbWPDdqet9yBE8nlAv/TQEUcAWqMLbNDM2fQDl4kN3bnQMmUCtlwzIT7su9AbnzvLw+MAXKgA3JwAZu4FZ5AOJSrgQifgYk3gd4YOLc4jgRLJqX45R2yQp8MgqOsCHX4eNNAuS28gA18AVEXiLleKmJqQIGlgXlus4wQBCmoAjAUT7lII4ZVO7eczHohG4X13EZ2hEiTrLotWIBbR4gJaIQl0C4mBp/SV4KSQkMOIAQ2pQHefAFthHqop4DuIEb2nHq2tEf/REirM7oJqADAFLhkc4QlI6pdH6kupAMu+0QlhQJdmAHX/AF2JEdqJ7qqq4BH6ADuBHseCHrs/4QkEu4iJlqFrkGk8AKrrABPEETkfDmz94RgEC4IWCkVpAG4eKlmiAB377uFeEKS4ACNvADQpQG5LILwMAE7J7vAhEQADs=" +#define ZEND_LOGO_DATA_URI "data:image/gif;base64,R0lGODlhcQBIANUAAA0NDgEDBgIFCS5EXhUdJwUPGgQKER0rOgABAgkZKiZpqxhDbQ0kOwobLQkZKSNgnSBXjh1PghpGchQ2Vx1NfAoaKiJYjQoYJgsaKQECAzdQaS0/UTE1OQUPGAkaKh5ViiFclRpJdQocLSBZjh5UhhpIcw8qQxc+YwwgMwcVIQkaKQgXIwcZJTM6PwIEBRkaGjEyMv9mAP///8zMzMfHx7+/v6urq5KSknNzc1VVVTw8PDc3NyYmJgcHBwMDAwAAACwAAAAAcQBIAAAG/8CZcEgsGo/IpHJ5/DGf0KiU+Ks6p9Kr0KrFer9GbReM7IrJ6O95Zt262durUy5uD8/rtL58h7vlf3+AcHlsdoR7iU12eIhzbXVVfpOTgGOKiWNrkpKUhZ99iJijl4d5kFSdXKmdb6OvsFOXsbS1oba4ubq7vL1DNjg6ODW+xVg3OTw/AisCOMbQSsA6AD8FDAsjIwwv0d5DNcnLIhMU2uclPzbf3jwC2Ofx585MwTfssD8n8vwjKDpLcggo8OMZPkw8GPSTN6HKCxg5hhHJ8WOCv4IHFeEwsDAeiQULJjBYUQXGM4oWtTU0mDGNjR/mOi48gcJKynMrW+oBcFNmP/8SJnri/JFDJ5kaL0T4XLqwYVGjWGy8MFCCqVWGRKFKsQGgAImrYIc+1bqEq9ewaEc0vEc2CdKzacOmY9vWxjoiMAx81Sajr9+/MhaE2Iu2hAAexPraJUbGxo3HkB/f/XKjCgBhwH5kOwcYsAoU5dKSMIBYSN8cOSZvxRGjtevXOnREZDwFhogSE1AYqKIwXl8VBlKoUNHXgAEUJwhfJVGgtGkZsek+Afa6uvUY0bFUjEdhgnJtIUwwmLDAb4cU3tM2pz2jb/YnN67Lr/4eSuWYPkmEGDyiL4MODITgm1+CkdBZgSh00xkMOkiHRHzWxSahDvNJyN4SG6HV1wSfJcf/GWAMdObfCQv8IOILDUoj34QTrhgbS0zAgEJYfqGgQnp8yXACA8N9NkFfHQRX4wl+6cADDH2h6KBdz7jIYosRShjFdmD5B6CAH/JIHkgh9JUCeuXJAOBpPDTYF4MO4mDCAU5KmMMNxNDAWpSx2QdTlTJwiNxeIhbYnwzDZeMlcTLAAAOc7qVIxAsVsrjkdRNCkeFVNd5ImIgqmCDgbyoICiihZd5gQ189KDoDDTcYcN1lE+JAgxE2QCrlEzLi+V+Af+4XpnHCafpnoL8SWugNOwD5gqg4oMbDCtahkAGD9RUBIX2xjbUElUyJ6BcDJoQJ2AldfuppoCJe0IEOB5hw/wIEKFRQnQgesJrDhUTI+iJ8d2arbXGdjhDub6BxOm6nJvzVwMEMSCDBAw+AwIAHr3kgQgdl5vAqEjXYq4NqSeAgAFjd2djjyL7qJ9JwDCQXnq/+mqBpCQXsWIEHKVPwQcMgOOyAaw4k0EAKGCmhsbVKVLbCBFUtte+GC+ylH5df6cffCFIbKAMJJ5A4GARcdz2BA2CH3YAIDABA7y8aO1g0NeOEttDSgLJMowwuh9D13VwDFTbYCZjQMEBIDO3FNACY0NFvwY3M72ZoLWCACRTgLfnXYTPwAQgKmFAUDjjQ1SbHtfXWz29gggSSSHKHRcIKJkAAguR4R/C1CJFD8P+AAiykABoCQrQJoxc4FHC4uPLod+DUfxI4mF8O/AhYgXj/JdjNEUSgwAMY1ECDxjpcDEZl330IrDzapvyViCn7FUD5yXXdWcqXg3D7CdPCNqHaWNSA7YDPIw+kkH1BTo3OA6QA9UUAIvhfCoZEAgj0ZUdhA03tRvAAEvhuDzpQCj8wJTcvgamAVgqYDIQTpgIkcIQfFFOAHCgDBjTPdFvj2gPaRDQy4CBf5JMBr4bTQeINinTe+U0BCiYDBzSgL2BbAAtT4IA+xbBrIODe2cDwghltEIVb8p8PPyWwPxlAAERsgAeQ6AAlklFEDtAUFKNIp9iADlXJQs2bbuA9Jdz/ED/i69eHwgUsTvkFPVb7QQUk0BcPNLGIZWRhEsPFqzTazXUzbKOphBCrNnaujkUwS/jgFqItkqszCKDdGRFpRlJa7VuDiaQliVBJ7t0LVl0JX/K0ZYAuCuyUfrEGBUaZREUmEgL/KiJoIqBKagljCPUz5pN+N4MaxLIj4RmZNINSN/BUE2s86gsADBABEJSgbit7ZDjzFgKRgC1lEJgPdiw2g2Ta70lvOkINeACXhTzNdPgUDAX24zR+asN4MjiSAS73AX5WjZxPhMA9Q/ABdbYGVY1aJuiGsBFZxqUjhhFGDlwgP4aN4HWwC2nXLOjQiLJIInbUy0Wt4pQa2IUH/ydQwARmKr8RiDSkJW3T/TCJMXpadKX/ZEBWKEqAFgDgBjCYgAJAetO75VSZjuKpEuYpgKQBlR8lYqZdhsCBhTG1qSR96pMkREcvUNWq/CBPXOixBA5QIGdN5dpTsTPWBkk1CmftR0N+YACkhUUEgJOGD0jwVa7l7LCvy2ld33TXKeQ1HiuxQQ5eUIUVoEBdS5kAAJ7gghM84G45Y9jtSgCCCHjAA2PzwGHqOqF4KuKxagkaJTmngxcIzycU+AH+iFADFCwVtCAgTwRQEIALQEAEIlBBB15QJtbKZrdpqAEMqhrbGiIThx0pgHWJgAMJ/NawDxhADzj3DBioSwQGAIfADpyLUloIpCbbHQJPlsIAGCxhBxa4HcM6at865qCcRFlsWXORA5MwIYMyWQADBBBfIdzgBRpAwVtvpzkjhCM1lHQMZKb4DY/xozsiEMAPeNDeJNDAMT/YwAkkwICJcpgsL9mMgglyGRxMlAmiAoCN2zIFeoZ4xK6NLo+nYIMX3XjISNZKEAAAOw==" BEGIN_EXTERN_C() PHP_FUNCTION(phpversion); PHP_FUNCTION(phpinfo); PHP_FUNCTION(phpcredits); -PHP_FUNCTION(php_logo_guid); -PHP_FUNCTION(php_real_logo_guid); -PHP_FUNCTION(zend_logo_guid); -PHP_FUNCTION(php_egg_logo_guid); PHP_FUNCTION(php_sapi_name); PHP_FUNCTION(php_uname); PHP_FUNCTION(php_ini_scanned_files); @@ -83,7 +78,6 @@ PHPAPI void php_info_print_box_start(int bg); PHPAPI void php_info_print_box_end(void); PHPAPI void php_info_print_hr(void); PHPAPI void php_info_print_module(zend_module_entry *module TSRMLS_DC); -PHPAPI char *php_logo_guid(void); PHPAPI char *php_get_uname(char mode); void register_phpinfo_constants(INIT_FUNC_ARGS); diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 36568c508e4b0..364f7fc3999ab 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -39,6 +39,7 @@ #endif #endif +#include "php_syslog.h" #include "php_mail.h" #include "php_ini.h" #include "php_string.h" @@ -189,6 +190,37 @@ PHP_FUNCTION(mail) } /* }}} */ + +void php_mail_log_crlf_to_spaces(char *message) { + /* Find all instances of carriage returns or line feeds and + * replace them with spaces. Thus, a log line is always one line + * long + */ + char *p = message; + while ((p = strpbrk(p, "\r\n"))) { + *p = ' '; + } +} + +void php_mail_log_to_syslog(char *message) { + /* Write 'message' to syslog. */ +#ifdef HAVE_SYSLOG_H + php_syslog(LOG_NOTICE, "%s", message); +#endif +} + + +void php_mail_log_to_file(char *filename, char *message, size_t message_size TSRMLS_DC) { + /* Write 'message' to the given file. */ + uint flags = IGNORE_URL_WIN | REPORT_ERRORS | STREAM_DISABLE_OPEN_BASEDIR; + php_stream *stream = php_stream_open_wrapper(filename, "a", flags, NULL); + if (stream) { + php_stream_write(stream, message, message_size); + php_stream_close(stream); + } +} + + /* {{{ php_mail */ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char *extra_cmd TSRMLS_DC) @@ -216,19 +248,22 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char if (mail_log && *mail_log) { char *tmp; int l = spprintf(&tmp, 0, "mail() on [%s:%d]: To: %s -- Headers: %s\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C), to, hdr ? hdr : ""); - php_stream *stream = php_stream_open_wrapper(mail_log, "a", IGNORE_URL_WIN | REPORT_ERRORS | STREAM_DISABLE_OPEN_BASEDIR, NULL); - if (hdr) { /* find all \r\n instances and replace them with spaces, so a log line is always one line long */ - char *p = tmp; - while ((p = strpbrk(p, "\r\n"))) { - *p = ' '; - } - tmp[l - 1] = '\n'; + if (hdr) { + php_mail_log_crlf_to_spaces(tmp); } - if (stream) { - php_stream_write(stream, tmp, l); - php_stream_close(stream); + + if (!strcmp(mail_log, "syslog")) { + /* Drop the final space when logging to syslog. */ + tmp[l - 1] = 0; + php_mail_log_to_syslog(tmp); + } + else { + /* Convert the final space to a newline when logging to file. */ + tmp[l - 1] = '\n'; + php_mail_log_to_file(mail_log, tmp, l TSRMLS_CC); } + efree(tmp); } if (PG(mail_x_header)) { diff --git a/ext/standard/math.c b/ext/standard/math.c index 302fbdae488f1..6e934a3857a7c 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -37,7 +37,7 @@ static inline int php_intlog10abs(double value) { int result; value = fabs(value); - if (value < 1e-8 || value > 1e23) { + if (value < 1e-8 || value > 1e22) { result = (int)floor(log10(value)); } else { static const double values[] = { @@ -46,7 +46,7 @@ static inline int php_intlog10abs(double value) { 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22}; /* Do a binary search with 5 steps */ - result = 16; + result = 15; if (value < values[result]) { result -= 8; } else { @@ -1097,7 +1097,9 @@ PHPAPI char *_php_math_number_format(double d, int dec, char dec_point, char tho return _php_math_number_format_ex(d, dec, &dec_point, 1, &thousand_sep, 1); } -PHPAPI char *_php_math_number_format_ex(double d, int dec, char *dec_point, size_t dec_point_len, char *thousand_sep, size_t thousand_sep_len) +static char *_php_math_number_format_ex_len(double d, int dec, char *dec_point, + size_t dec_point_len, char *thousand_sep, size_t thousand_sep_len, + int *result_len) { char *tmpbuf = NULL, *resbuf; char *s, *t; /* source, target */ @@ -1118,6 +1120,10 @@ PHPAPI char *_php_math_number_format_ex(double d, int dec, char *dec_point, size tmplen = spprintf(&tmpbuf, 0, "%.*F", dec, d); if (tmpbuf == NULL || !isdigit((int)tmpbuf[0])) { + if (result_len) { + *result_len = tmplen; + } + return tmpbuf; } @@ -1205,8 +1211,19 @@ PHPAPI char *_php_math_number_format_ex(double d, int dec, char *dec_point, size efree(tmpbuf); + if (result_len) { + *result_len = reslen; + } + return resbuf; } + +PHPAPI char *_php_math_number_format_ex(double d, int dec, char *dec_point, + size_t dec_point_len, char *thousand_sep, size_t thousand_sep_len) +{ + return _php_math_number_format_ex_len(d, dec, dec_point, dec_point_len, + thousand_sep, thousand_sep_len, NULL); +} /* }}} */ /* {{{ proto string number_format(float number [, int num_decimal_places [, string dec_seperator, string thousands_seperator]]) @@ -1241,7 +1258,10 @@ PHP_FUNCTION(number_format) thousand_sep_len = 1; } - RETURN_STRING(_php_math_number_format_ex(num, dec, dec_point, dec_point_len, thousand_sep, thousand_sep_len), 0); + Z_TYPE_P(return_value) = IS_STRING; + Z_STRVAL_P(return_value) = _php_math_number_format_ex_len(num, dec, + dec_point, dec_point_len, thousand_sep, thousand_sep_len, + &Z_STRLEN_P(return_value)); break; default: WRONG_PARAM_COUNT; diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c index a831dd1c161fa..b51aaa219f23d 100644 --- a/ext/standard/php_fopen_wrapper.c +++ b/ext/standard/php_fopen_wrapper.c @@ -263,6 +263,20 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, char *path, ch long fildes_ori; int dtablesize; + if (strcmp(sapi_module.name, "cli")) { + if (options & REPORT_ERRORS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Direct access to file descriptors is only available from command-line PHP"); + } + return NULL; + } + + 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; + } + start = &path[3]; fildes_ori = strtol(start, &end, 10); if (end == start || *end != '\0') { diff --git a/ext/standard/php_type.h b/ext/standard/php_type.h index 1927deded8d52..12e916b886ae3 100644 --- a/ext/standard/php_type.h +++ b/ext/standard/php_type.h @@ -24,6 +24,7 @@ PHP_FUNCTION(intval); PHP_FUNCTION(floatval); PHP_FUNCTION(strval); +PHP_FUNCTION(boolval); PHP_FUNCTION(gettype); PHP_FUNCTION(settype); PHP_FUNCTION(is_null); diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 4dd52ed28b659..5ff91994a7071 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -56,7 +56,7 @@ /* This symbol is defined in ext/standard/config.m4. * Essentially, it is set if you HAVE_FORK || PHP_WIN32 - * Otherplatforms may modify that configure check and add suitable #ifdefs + * Other platforms may modify that configure check and add suitable #ifdefs * around the alternate code. * */ #ifdef PHP_CAN_SUPPORT_PROC_OPEN diff --git a/ext/standard/string.c b/ext/standard/string.c index 5c33232f7d7ca..6cc7659edd860 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -131,8 +131,8 @@ static char *php_bin2hex(const unsigned char *old, const size_t oldlen, size_t * register unsigned char *result = NULL; size_t i, j; - result = (unsigned char *) safe_emalloc(oldlen * 2, sizeof(char), 1); - + result = (unsigned char *) safe_emalloc(oldlen, 2 * sizeof(char), 1); + for (i = j = 0; i < oldlen; i++) { result[j++] = hexconvtab[old[i] >> 4]; result[j++] = hexconvtab[old[i] & 15]; @@ -4029,13 +4029,12 @@ PHP_FUNCTION(nl2br) RETURN_STRINGL(str, str_len, 1); } - if (is_xhtml) { - new_length = str_len + repl_cnt * (sizeof("
") - 1); - } else { - new_length = str_len + repl_cnt * (sizeof("
") - 1); - } + { + size_t repl_len = is_xhtml ? (sizeof("
") - 1) : (sizeof("
") - 1); - tmp = target = emalloc(new_length + 1); + new_length = str_len + repl_cnt * repl_len; + tmp = target = safe_emalloc(repl_cnt, repl_len, str_len + 1); + } while (str < end) { switch (*str) { @@ -5377,7 +5376,7 @@ PHP_FUNCTION(substr_compare) if (!cs) { RETURN_LONG(zend_binary_strncmp(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len)); } else { - RETURN_LONG(zend_binary_strncasecmp(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len)); + RETURN_LONG(zend_binary_strncasecmp_l(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len)); } } /* }}} */ diff --git a/ext/standard/tests/array/compact.phpt b/ext/standard/tests/array/compact.phpt index 4b4bfbb7321e0..02df44ebd88c8 100644 --- a/ext/standard/tests/array/compact.phpt +++ b/ext/standard/tests/array/compact.phpt @@ -1,8 +1,5 @@ --TEST-- compact() ---INI-- -unicode.script_encoding=UTF-8 -unicode.output_encoding=UTF-8 --FILE-- ---INI-- -unicode.script_encoding=ISO8859-1 -unicode.output_encoding=ISO8859-1 --FILE-- - %s(%d) + %s(%f) ["is_dir"]=> bool(true) ["realpath"]=> diff --git a/ext/standard/tests/file/rename_variation13-win32.phpt b/ext/standard/tests/file/rename_variation13-win32.phpt index dc44b358f6076..a5030761a5086 100644 Binary files a/ext/standard/tests/file/rename_variation13-win32.phpt and b/ext/standard/tests/file/rename_variation13-win32.phpt differ diff --git a/ext/standard/tests/file/tempnam_variation7-win32.phpt b/ext/standard/tests/file/tempnam_variation7-win32.phpt index 1f0d97acfe11f..0c8caca95c555 100644 --- a/ext/standard/tests/file/tempnam_variation7-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation7-win32.phpt @@ -93,13 +93,13 @@ File created in => temp dir Warning: tempnam() expects parameter 1 to be a valid path, string given in %stempnam_variation7-win32.php on line %d -- File is not created -- -Warning: unlink(): Invalid argument in %s on line %d +Warning: unlink(): %r(Invalid argument|No such file or directory)%r in %s on line %d -- Iteration 7 -- Warning: tempnam() expects parameter 1 to be a valid path, array given in %s on line %d -- File is not created -- -Warning: unlink(): Invalid argument in %s on line %d +Warning: unlink(): %r(Invalid argument|No such file or directory)%r in %s on line %d -- Iteration 8 -- File name is => %s%et%s File permissions are => 100666 diff --git a/ext/standard/tests/file/umask_basic.phpt b/ext/standard/tests/file/umask_basic.phpt index 7a2eb762db13f..761df972533ea 100644 --- a/ext/standard/tests/file/umask_basic.phpt +++ b/ext/standard/tests/file/umask_basic.phpt @@ -20,7 +20,7 @@ for($mask = 0000; $mask <= 0777; $mask++) { var_dump( umask() ); echo "\n"; if ($mask != umask()) { - die('An error occured while changing back the umask'); + die('An error occurred while changing back the umask'); } } diff --git a/ext/standard/tests/file/windows_links/bug48746.phpt b/ext/standard/tests/file/windows_links/bug48746.phpt index 55465aea8615b..5978e7f7f1c29 100644 --- a/ext/standard/tests/file/windows_links/bug48746.phpt +++ b/ext/standard/tests/file/windows_links/bug48746.phpt @@ -1,7 +1,7 @@ --TEST-- Bug#48746 - Junction not working properly ---CREDIT-- +--CREDITS-- Venkat Raman Don (don.raman@microsoft.com) --SKIPIF-- diff --git a/ext/standard/tests/file/windows_links/bug48746_1.phpt b/ext/standard/tests/file/windows_links/bug48746_1.phpt index 5d8e685e1b830..a4277a47a1d14 100644 --- a/ext/standard/tests/file/windows_links/bug48746_1.phpt +++ b/ext/standard/tests/file/windows_links/bug48746_1.phpt @@ -1,7 +1,7 @@ --TEST-- Bug#48746 - Junction not working properly ---CREDIT-- +--CREDITS-- Venkat Raman Don (don.raman@microsoft.com) --SKIPIF-- diff --git a/ext/standard/tests/file/windows_links/bug48746_2.phpt b/ext/standard/tests/file/windows_links/bug48746_2.phpt index 56924a59bc46e..509610f8a40aa 100644 --- a/ext/standard/tests/file/windows_links/bug48746_2.phpt +++ b/ext/standard/tests/file/windows_links/bug48746_2.phpt @@ -1,7 +1,7 @@ --TEST-- Bug#48746 - Junction not working properly ---CREDIT-- +--CREDITS-- Venkat Raman Don (don.raman@microsoft.com) --SKIPIF-- diff --git a/ext/standard/tests/file/windows_links/bug48746_3.phpt b/ext/standard/tests/file/windows_links/bug48746_3.phpt index b88ab76ef3d9a..98e81787b80bb 100644 --- a/ext/standard/tests/file/windows_links/bug48746_3.phpt +++ b/ext/standard/tests/file/windows_links/bug48746_3.phpt @@ -1,7 +1,7 @@ --TEST-- Bug#48746 - Junction not working properly ---CREDIT-- +--CREDITS-- Venkat Raman Don (don.raman@microsoft.com) --SKIPIF-- diff --git a/ext/standard/tests/general_functions/boolval.phpt b/ext/standard/tests/general_functions/boolval.phpt new file mode 100644 index 0000000000000..9d0eac4ebd09c --- /dev/null +++ b/ext/standard/tests/general_functions/boolval.phpt @@ -0,0 +1,29 @@ +--TEST-- +Testing boolval() +--FILE-- + +--EXPECTF-- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) diff --git a/ext/standard/tests/general_functions/bug27678.phpt b/ext/standard/tests/general_functions/bug27678.phpt index 5db5890a1ce5b..6f95509e14efe 100644 --- a/ext/standard/tests/general_functions/bug27678.phpt +++ b/ext/standard/tests/general_functions/bug27678.phpt @@ -6,9 +6,11 @@ Bug #27678 (number_format() crashes with large numbers) number_format(1e80, 0, '', ' '); number_format(1e300, 0, '', ' '); number_format(1e320, 0, '', ' '); -number_format(1e1000, 0, '', ' '); +$num = number_format(1e1000, 0, '', ' '); +var_dump(strlen($num) == 3); // $num == 'inf' echo "Done\n"; ?> --EXPECT-- +bool(true) Done diff --git a/ext/standard/tests/general_functions/debug_zval_dump_o.phpt b/ext/standard/tests/general_functions/debug_zval_dump_o.phpt index dd4b5142a1253..78f0f03003a99 100644 --- a/ext/standard/tests/general_functions/debug_zval_dump_o.phpt +++ b/ext/standard/tests/general_functions/debug_zval_dump_o.phpt @@ -1,5 +1,7 @@ --TEST-- Test debug_zval_dump() function : working on objects +--SKIPIF-- + -===DONE=== ---EXPECTF-- -*** Testing uniqid() : basic functionality *** - -uniqid() without a prefix -string(13) "%s" -string(23) "%s.%s" -string(13) "%s" - - -uniqid() with a prefix -string(18) "99999%s" -string(28) "99999%s.%s" -string(18) "99999%s" - -string(18) "999994%s" -string(28) "999994%s.%s" -string(18) "999994%s" - -string(17) "1050%s" -string(27) "1050%s.%s" -string(17) "1050%s" - -string(13) "%s" -string(23) "%s.%s" -string(13) "%s" - -string(14) "1%s" -string(24) "1%s.%s" -string(14) "1%s" - -string(13) "%s" -string(23) "%s.%s" -string(13) "%s" - -===DONE=== - \ No newline at end of file +--TEST-- +Test uniqid() function : basic functionality +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing uniqid() : basic functionality *** + +uniqid() without a prefix +string(13) "%s" +string(23) "%s.%s" +string(13) "%s" + + +uniqid() with a prefix +string(18) "99999%s" +string(28) "99999%s.%s" +string(18) "99999%s" + +string(18) "99999%s" +string(28) "99999%s.%s" +string(18) "99999%s" + +string(17) "1050%s" +string(27) "1050%s.%s" +string(17) "1050%s" + +string(13) "%s" +string(23) "%s.%s" +string(13) "%s" + +string(14) "1%s" +string(24) "1%s.%s" +string(14) "1%s" + +string(13) "%s" +string(23) "%s.%s" +string(13) "%s" + +===DONE=== diff --git a/ext/standard/tests/general_functions/var_export_error2.phpt b/ext/standard/tests/general_functions/var_export_error2.phpt index 2b306696a692b..a6403e610dea9 100644 --- a/ext/standard/tests/general_functions/var_export_error2.phpt +++ b/ext/standard/tests/general_functions/var_export_error2.phpt @@ -15,4 +15,5 @@ var_export($obj, true); ===DONE=== --EXPECTF-- -Fatal error: Nesting level too deep - recursive dependency? in %s on line 9 \ No newline at end of file +Warning: var_export does not handle circular references in %s on line 9 +===DONE=== diff --git a/ext/standard/tests/general_functions/var_export_error3.phpt b/ext/standard/tests/general_functions/var_export_error3.phpt index 03ed496aca5f8..c862691e9117b 100644 --- a/ext/standard/tests/general_functions/var_export_error3.phpt +++ b/ext/standard/tests/general_functions/var_export_error3.phpt @@ -15,4 +15,5 @@ var_export($a, true); ===DONE=== --EXPECTF-- -Fatal error: Nesting level too deep - recursive dependency? in %s on line 9 \ No newline at end of file +Warning: var_export does not handle circular references in %s on line 9 +===DONE=== diff --git a/ext/standard/tests/mail/mail_skipif.inc b/ext/standard/tests/mail/mail_skipif.inc index 2f4fbf3d6f3f3..006594021d28e 100644 --- a/ext/standard/tests/mail/mail_skipif.inc +++ b/ext/standard/tests/mail/mail_skipif.inc @@ -1,5 +1,15 @@ 10, 'usec' => 10)); + // imap uses tcp port 143 + socket_connect($socket, "localhost", 143) or die ("skip can't socket to mail server"); +} // Change these to make tests run successfully $mailbox = '{localhost}'; diff --git a/ext/standard/tests/math/bug62112.phpt b/ext/standard/tests/math/bug62112.phpt new file mode 100644 index 0000000000000..01de35a9c558e Binary files /dev/null and b/ext/standard/tests/math/bug62112.phpt differ diff --git a/ext/standard/tests/php_logo_guid.phpt b/ext/standard/tests/php_logo_guid.phpt deleted file mode 100644 index c644b2893bb89..0000000000000 --- a/ext/standard/tests/php_logo_guid.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -Check the output of the php_logo_guid() function ---CREDITS-- -Sebastian Schürmann -sschuermann@chip.de -Testfest 2009 Munich ---FILE-- - ---EXPECT-- -PHPE9568F34-D428-11d2-A769-00AA001ACF42 - diff --git a/ext/standard/tests/php_real_logo_guid.phpt b/ext/standard/tests/php_real_logo_guid.phpt deleted file mode 100644 index a9fa7d35d51a8..0000000000000 --- a/ext/standard/tests/php_real_logo_guid.phpt +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Testing the undocumented function php_real_logo_guid() ---CREDITS-- -Sebastian Schürmann -sschuermann@chip.de -Testfest 2009 Munich ---FILE-- - ---EXPECT-- -PHPE9568F34-D428-11d2-A769-00AA001ACF42 diff --git a/ext/standard/tests/serialize/bug62373.phpt b/ext/standard/tests/serialize/bug62373.phpt new file mode 100644 index 0000000000000..666c33ebdbcc9 --- /dev/null +++ b/ext/standard/tests/serialize/bug62373.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #62373 (serialize() generates wrong reference to the object) +--FILE-- + +--EXPECT-- +OK diff --git a/ext/standard/tests/streams/bug40459.phpt b/ext/standard/tests/streams/bug40459.phpt new file mode 100644 index 0000000000000..8ee4363ed93bb --- /dev/null +++ b/ext/standard/tests/streams/bug40459.phpt @@ -0,0 +1,103 @@ +--TEST-- +bug 40459 - Test whether the constructor of the user-space stream wrapper is called when stream functions are called +--FILE-- +constructorCalled = true; + } + + function stream_open($path, $mode, $options, &$opened_path) + { + echo $this->constructorCalled ? 'yes' : 'no'; + return true; + } + + function url_stat($url, $flags) + { + echo $this->constructorCalled ? 'yes' : 'no'; + return array(); + } + + function unlink($url) + { + echo $this->constructorCalled ? 'yes' : 'no'; + } + + function rename($from, $to) + { + echo $this->constructorCalled ? 'yes' : 'no'; + } + + function mkdir($dir, $mode, $options) + { + echo $this->constructorCalled ? 'yes' : 'no'; + } + + function rmdir($dir, $options) + { + echo $this->constructorCalled ? 'yes' : 'no'; + } + + function dir_opendir($url, $options) + { + echo $this->constructorCalled ? 'yes' : 'no'; + return TRUE; + } + function stream_metadata() + { + echo $this->constructorCalled ? 'yes' : 'no'; + return TRUE; + } +} + +stream_wrapper_register('test', 'testwrapper', STREAM_IS_URL); + +echo 'stream_open: '; +fopen('test://test', 'r'); +echo "\n"; + +echo 'url_stat: '; +stat('test://test'); +echo "\n"; + +echo 'dir_opendir: '; +opendir('test://test'); +echo "\n"; + +echo 'rmdir: '; +rmdir('test://test'); +echo "\n"; + +echo 'mkdir: '; +mkdir('test://test'); +echo "\n"; + +echo 'rename: '; +rename('test://test', 'test://test2'); +echo "\n"; + +echo 'unlink: '; +unlink('test://test'); +echo "\n"; + +echo 'touch: '; +touch('test://test', time()); +echo "\n"; + + + +?> +==DONE== +--EXPECT-- +stream_open: yes +url_stat: yes +dir_opendir: yes +rmdir: yes +mkdir: yes +rename: yes +unlink: yes +touch: yes +==DONE== diff --git a/ext/standard/tests/streams/bug61115-1.phpt b/ext/standard/tests/streams/bug61115-1.phpt index 89374e7353772..99e2f7929ca09 100644 --- a/ext/standard/tests/streams/bug61115-1.phpt +++ b/ext/standard/tests/streams/bug61115-1.phpt @@ -1,5 +1,11 @@ --TEST-- Bug #61115: Stream related segfault on fatal error in php_stream_context_del_link - variation 1 +--SKIPIF-- + --FILE-- 0x80 +--SKIPIF-- + +--FILE-- + ---COMMENT-- +--DESCRIPTION-- As of PHP 5.4, htmlentities() no longer makes replacements with numerical entities. Hence, for this input there's no substitution. --FILE-- diff --git a/ext/standard/tests/strings/http_build_query_variation1.phpt b/ext/standard/tests/strings/http_build_query_variation1.phpt new file mode 100644 index 0000000000000..56d81c9fdddcb --- /dev/null +++ b/ext/standard/tests/strings/http_build_query_variation1.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test http_build_query() function: usage variations - first arguments as object +--CREDITS-- +Adam Gegotek +--FILE-- +name = 'homepage'; +$obj->page = 1; +$obj->sort = 'desc,name'; + +echo http_build_query($obj) . PHP_EOL; +echo http_build_query(new UrlBuilder()); +?> +--EXPECTF-- +name=homepage&page=1&sort=desc%2Cname +name=homepage&page=1 diff --git a/ext/standard/tests/strings/http_build_query_variation2.phpt b/ext/standard/tests/strings/http_build_query_variation2.phpt new file mode 100644 index 0000000000000..ca1d8f459a198 --- /dev/null +++ b/ext/standard/tests/strings/http_build_query_variation2.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test http_build_query() function: usage variations - first arguments as multidimensional array and second argument present/not present +--CREDITS-- +Adam Gegotek +--FILE-- + 13, + "9" => array( + 1 => "val1", + 3 => "val2", + "string" => "string" + ), + "name" => "homepage", + "page" => 10, + "sort" => array( + "desc", + "admin" => array( + "admin1", + "admin2" => array( + "who" => "admin2", + 2 => "test" + ) + ) + ) +); + +echo http_build_query($mDimensional) . PHP_EOL; +echo http_build_query($mDimensional, 'prefix_'); +?> +--EXPECTF-- +0=20&5=13&9%5B1%5D=val1&9%5B3%5D=val2&9%5Bstring%5D=string&name=homepage&page=10&sort%5B0%5D=desc&sort%5Badmin%5D%5B0%5D=admin1&sort%5Badmin%5D%5Badmin2%5D%5Bwho%5D=admin2&sort%5Badmin%5D%5Badmin2%5D%5B2%5D=test +prefix_0=20&prefix_5=13&prefix_9%5B1%5D=val1&prefix_9%5B3%5D=val2&prefix_9%5Bstring%5D=string&name=homepage&page=10&sort%5B0%5D=desc&sort%5Badmin%5D%5B0%5D=admin1&sort%5Badmin%5D%5Badmin2%5D%5Bwho%5D=admin2&sort%5Badmin%5D%5Badmin2%5D%5B2%5D=test diff --git a/ext/standard/tests/strings/http_build_query_variation3.phpt b/ext/standard/tests/strings/http_build_query_variation3.phpt new file mode 100644 index 0000000000000..107120e084705 --- /dev/null +++ b/ext/standard/tests/strings/http_build_query_variation3.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test http_build_query() function: usage variations - testing four parameter added in PHP 5.4.0 +--CREDITS-- +Adam Gegotek +--SKIPIF-- + +--FILE-- + "main page", + "sort" => "desc,admin", + "equation" => "10 + 10 - 5" +); + +echo http_build_query($oDimensional, '', ini_get('arg_separator.output'), PHP_QUERY_RFC1738) . PHP_EOL; +echo http_build_query($oDimensional, '', ini_get('arg_separator.output'), PHP_QUERY_RFC3986); +?> +--EXPECTF-- +name=main+page&sort=desc%2Cadmin&equation=10+%2B+10+-+5 +name=main%20page&sort=desc%2Cadmin&equation=10%20%2B%2010%20-%205 diff --git a/ext/standard/tests/zend_logo_guid.phpt b/ext/standard/tests/zend_logo_guid.phpt deleted file mode 100644 index d26ed45e9e33f..0000000000000 --- a/ext/standard/tests/zend_logo_guid.phpt +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Checking the zend_logo_guid() functio ---CREDITS-- -Sebastian Schürmann -sschuermann@chip.de -Testfest 2009 Munich ---FILE-- - ---EXPECT-- -PHPE9568F35-D428-11d2-A769-00AA001ACF42 diff --git a/ext/standard/type.c b/ext/standard/type.c index 543fdeac1034f..f53107eb7aa7e 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -176,6 +176,20 @@ PHP_FUNCTION(floatval) } /* }}} */ +/* {{{ proto bool boolval(mixed var) + Get the boolean value of a variable */ +PHP_FUNCTION(boolval) +{ + zval **val; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &val) == FAILURE) { + return; + } + + RETURN_BOOL(zend_is_true(*val)); +} +/* }}} */ + /* {{{ proto string strval(mixed var) Get the string value of a variable */ PHP_FUNCTION(strval) diff --git a/ext/standard/var.c b/ext/standard/var.c index c6126e95fadb5..494fb583c7544 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -453,6 +453,11 @@ PHPAPI void php_var_export_ex(zval **struc, int level, smart_str *buf TSRMLS_DC) break; case IS_ARRAY: myht = Z_ARRVAL_PP(struc); + if(myht && myht->nApplyCount > 0){ + smart_str_appendl(buf, "NULL", 4); + zend_error(E_WARNING, "var_export does not handle circular references"); + return; + } if (level > 1) { smart_str_appendc(buf, '\n'); buffer_append_spaces(buf, level - 1); @@ -469,6 +474,11 @@ PHPAPI void php_var_export_ex(zval **struc, int level, smart_str *buf TSRMLS_DC) case IS_OBJECT: myht = Z_OBJPROP_PP(struc); + if(myht && myht->nApplyCount > 0){ + smart_str_appendl(buf, "NULL", 4); + zend_error(E_WARNING, "var_export does not handle circular references"); + return; + } if (level > 1) { smart_str_appendc(buf, '\n'); buffer_append_spaces(buf, level - 1); @@ -541,12 +551,9 @@ static inline int php_add_var_hash(HashTable *var_hash, zval *var, void *var_old /* 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 and the class entry since 5.0. */ + * 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, - (((size_t)Z_OBJCE_P(var) << 5) - | ((size_t)Z_OBJCE_P(var) >> (sizeof(long) * 8 - 5))) - + (long) Z_OBJ_HANDLE_P(var)); + p = smart_str_print_long(id + sizeof(id) - 1, (long) Z_OBJ_HANDLE_P(var)); *(--p) = 'O'; len = id + sizeof(id) - 1 - p; } else { diff --git a/ext/tidy/examples/cleanhtml.php b/ext/tidy/examples/cleanhtml.php index 9a6713dc55f0a..2644210cbf3aa 100644 --- a/ext/tidy/examples/cleanhtml.php +++ b/ext/tidy/examples/cleanhtml.php @@ -26,7 +26,7 @@ if(tidy_warning_count() || tidy_error_count()) { - echo "\n\nThe following errors or warnings occured:\n"; + echo "\n\nThe following errors or warnings occurred:\n"; echo tidy_get_error_buffer(); echo "\n"; } diff --git a/ext/tidy/examples/cleanhtml5.php b/ext/tidy/examples/cleanhtml5.php index 4dfd7643e133c..2ce683acadda5 100644 --- a/ext/tidy/examples/cleanhtml5.php +++ b/ext/tidy/examples/cleanhtml5.php @@ -25,7 +25,7 @@ if(!empty($tidy->errorBuffer)) { - echo "\n\nThe following errors or warnings occured:\n"; + echo "\n\nThe following errors or warnings occurred:\n"; echo "{$tidy->errorBuffer}\n"; } diff --git a/ext/tidy/tests/004.phpt b/ext/tidy/tests/004.phpt index 7ca17c6d95f3e..d13c37dcd8e38 100644 --- a/ext/tidy/tests/004.phpt +++ b/ext/tidy/tests/004.phpt @@ -6,7 +6,7 @@ tidy_diagnose() '); var_dump(tidy_diagnose($a)); -echo tidy_get_error_buffer($a); +echo str_replace("\r", "", tidy_get_error_buffer($a)); $html = <<< HTML diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index 5ac1a69196b2f..72d8f5db662ca 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -1238,7 +1238,7 @@ static PHP_FUNCTION(tidy_parse_string) /* }}} */ /* {{{ proto string tidy_get_error_buffer() - Return warnings and errors which occured parsing the specified document*/ + Return warnings and errors which occurred parsing the specified document*/ static PHP_FUNCTION(tidy_get_error_buffer) { TIDY_FETCH_OBJECT; diff --git a/ext/wddx/tests/bug48562.phpt b/ext/wddx/tests/bug48562.phpt index ebd2004e0a201..ee9f271d9163f 100644 --- a/ext/wddx/tests/bug48562.phpt +++ b/ext/wddx/tests/bug48562.phpt @@ -16,6 +16,12 @@ $a['x'] = &$a; var_dump(wddx_serialize_vars($a)); +// replace $a - the recursion detection seems to be causing $a to be not an array here, maybe its internally a pointer +// replacing $a with a new array() allows this test to still check for 2 things +// 1. recursion detection in &$a; +// 2. recursion detection in adding $a to itself and then serializing $a +// the one thing the test won't check is using $a as an array after doing &$a; which isn't really a wddx problem. +$a = array(); $a['x'] = 'foo'; $a['x'] = $a; diff --git a/ext/xml/tests/bug62328.phpt b/ext/xml/tests/bug62328.phpt new file mode 100644 index 0000000000000..e4c3c59d37e48 --- /dev/null +++ b/ext/xml/tests/bug62328.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #62328 (implementing __toString and a cast to string fails) +--SKIPIF-- + +--FILE-- +'); + +var_dump((string) $xml); +var_dump($xml->__toString()); +--EXPECT-- +string(15) "stringification" +string(15) "stringification" diff --git a/ext/xmlrpc/tests/bug61264.phpt b/ext/xmlrpc/tests/bug61264.phpt index b1da27f252016..24e4b2749c89b 100644 --- a/ext/xmlrpc/tests/bug61264.phpt +++ b/ext/xmlrpc/tests/bug61264.phpt @@ -1,5 +1,7 @@ --TEST-- Bug #61264: xmlrpc_parse_method_descriptions leaks temporary variable +--SKIPIF-- + --FILE-- type == IS_OBJECT && instanceof_function( Z_OBJCE_P(retval), dom_node_class_entry TSRMLS_CC)) { diff --git a/ext/zip/config.m4 b/ext/zip/config.m4 index d5c24ce9cf407..85f9119f5aac1 100644 --- a/ext/zip/config.m4 +++ b/ext/zip/config.m4 @@ -89,7 +89,14 @@ yes 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_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 $PHP_ZIP_SOURCES, $ext_shared) diff --git a/ext/zip/config.w32 b/ext/zip/config.w32 index e60a983b3a89d..fa0a5180df5ce 100644 --- a/ext/zip/config.w32 +++ b/ext/zip/config.w32 @@ -27,7 +27,14 @@ if (PHP_ZIP != "no") { 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"); + 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"); AC_DEFINE('HAVE_ZIP', 1); } else { diff --git a/ext/zip/lib/zip.h b/ext/zip/lib/zip.h index 14a57bc5829bc..f11c9aba7f99c 100644 --- a/ext/zip/lib/zip.h +++ b/ext/zip/lib/zip.h @@ -3,7 +3,7 @@ /* zip.h -- exported declarations. - Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2011 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -52,6 +52,8 @@ BEGIN_EXTERN_C() +#include "zipconf.h" + #include #include #include @@ -71,10 +73,19 @@ BEGIN_EXTERN_C() #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) */ /* archive global flags flags */ #define ZIP_AFL_TORRENT 1 /* torrent zipped */ +#define ZIP_AFL_RDONLY 2 /* read only -- cannot be cleared */ + + +/* flags for compression and encryption sources */ + +#define ZIP_CODEC_ENCODE 1 /* compress/encrypt */ + /* libzip error codes */ @@ -102,7 +113,10 @@ BEGIN_EXTERN_C() #define ZIP_ER_INCONS 21 /* N Zip archive inconsistent */ #define ZIP_ER_REMOVE 22 /* S Can't remove file */ #define ZIP_ER_DELETED 23 /* N Entry has been deleted */ - +#define ZIP_ER_ENCRNOTSUPP 24 /* N Encryption method not supported */ +#define ZIP_ER_RDONLY 25 /* N Read-only archive */ +#define ZIP_ER_NOPASSWD 26 /* N No password provided */ +#define ZIP_ER_WRONGPASSWD 27 /* N Wrong password provided */ /* type of system error value */ @@ -162,69 +176,99 @@ enum zip_source_cmd { ZIP_SOURCE_FREE /* cleanup and free resources */ }; -typedef ssize_t (*zip_source_callback)(void *state, void *data, - size_t len, enum zip_source_cmd 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 struct zip_stat { + zip_uint64_t valid; /* which fields have valid values */ const char *name; /* name of the file */ - int index; /* index within archive */ - unsigned int crc; /* crc of file data */ + zip_uint64_t index; /* index within archive */ + zip_uint64_t size; /* size of file (uncompressed) */ + zip_uint64_t comp_size; /* size of file (compressed) */ time_t mtime; /* modification time */ - off_t size; /* size of file (uncompressed) */ - off_t comp_size; /* size of file (compressed) */ - unsigned short comp_method; /* compression method used */ - unsigned short encryption_method; /* encryption method used */ + zip_uint32_t crc; /* crc of file data */ + zip_uint16_t comp_method; /* compression method used */ + zip_uint16_t encryption_method; /* encryption method used */ + zip_uint32_t flags; /* reserved for future use */ }; struct zip; struct zip_file; struct zip_source; +typedef zip_int64_t (*zip_source_callback)(void *, void *, zip_uint64_t, + enum zip_source_cmd); + -ZIP_EXTERN(int) zip_add(struct zip *, const char *, struct zip_source *); -ZIP_EXTERN(int) zip_add_dir(struct zip *, const char *); +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 *, int); +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 *, size_t, int, 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_index(struct zip *, int, int); -ZIP_EXTERN(ssize_t) zip_fread(struct zip_file *, void *, size_t); +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 *, int, int *, int); -ZIP_EXTERN(const char *)zip_get_name(struct zip *, int, int); -ZIP_EXTERN(int) zip_get_num_files(struct zip *); +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 *, int, const char *); -ZIP_EXTERN(int) zip_replace(struct zip *, int, struct zip_source *); +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_file_comment(struct zip *, int, const char *, int); -ZIP_EXTERN(struct zip_source *)zip_source_buffer(struct zip *, const void *, - off_t, int); -ZIP_EXTERN(struct zip_source *)zip_source_file(struct zip *, const char *, - off_t, off_t); -ZIP_EXTERN(struct zip_source *)zip_source_filep(struct zip *, FILE *, - off_t, off_t); +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 *, - int, int, off_t, off_t); + 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 *, int, 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 *, int); +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 *); diff --git a/ext/zip/lib/zip_add.c b/ext/zip/lib/zip_add.c index 85d5997911b94..6067abbac491f 100644 --- a/ext/zip/lib/zip_add.c +++ b/ext/zip/lib/zip_add.c @@ -37,13 +37,20 @@ -ZIP_EXTERN(int) +/* + 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_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, -1, name, source); + + return _zip_replace(za, ZIP_UINT64_MAX, name, source); } diff --git a/ext/zip/lib/zip_add_dir.c b/ext/zip/lib/zip_add_dir.c index 9b23425194298..0a9d7f4863011 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-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -40,13 +40,21 @@ -ZIP_EXTERN(int) +/* NOTE: Signed due to -1 on error. See zip_add.c for more details. */ + +ZIP_EXTERN(zip_int64_t) zip_add_dir(struct zip *za, const char *name) { - int len, ret; + 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; diff --git a/ext/zip/lib/zip_close.c b/ext/zip/lib/zip_close.c index 0796f27462bbf..362f92d749cc9 100644 --- a/ext/zip/lib/zip_close.c +++ b/ext/zip/lib/zip_close.c @@ -1,6 +1,6 @@ /* zip_close.c -- close zip archive and update changes - Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2011 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,28 @@ +#include "zipint.h" + #include #include #include #include +#ifdef HAVE_UNISTD_H +#include +#endif #include #include - -#include "zipint.h" +#ifdef PHP_WIN32 +#include +#include +#endif static int add_data(struct zip *, struct zip_source *, struct zip_dirent *, FILE *); -static int add_data_comp(zip_source_callback, void *, struct zip_stat *, - FILE *, struct zip_error *); -static int add_data_uncomp(struct zip *, zip_source_callback, void *, - struct zip_stat *, FILE *); -static void ch_set_error(struct zip_error *, zip_source_callback, void *); static int copy_data(FILE *, off_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 _zip_changed(struct zip *, int *); static char *_zip_create_temp_output(struct zip *, FILE **); static int _zip_torrentzip_cmp(const void *, const void *); @@ -72,7 +74,9 @@ zip_close(struct zip *za) int i, j, error; char *temp; FILE *out; +#ifndef PHP_WIN32 mode_t mask; +#endif struct zip_cdir *cd; struct zip_dirent de; struct filelist *filelist; @@ -99,7 +103,7 @@ zip_close(struct zip *za) } _zip_free(za); return 0; - } + } if ((filelist=(struct filelist *)malloc(sizeof(filelist[0])*survivors)) == NULL) @@ -126,11 +130,11 @@ zip_close(struct zip *za) 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); + if (_zip_cdir_set_comment(cd, za) == -1) { + _zip_cdir_free(cd); free(filelist); - return -1; - } + return -1; + } } if ((temp=_zip_create_temp_output(za, &out)) == NULL) { @@ -198,8 +202,7 @@ zip_close(struct zip *za) error = 1; break; } - memcpy(cd->entry+j, za->cdir->entry+i, sizeof(cd->entry[j])); - + 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; @@ -220,6 +223,22 @@ zip_close(struct zip *za) cd->entry[j].filename_len = de.filename_len; } + 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) == 0 && za->entry[i].ch_comment_len != -1) { /* as the rest of cd entries, its malloc/free is done by za */ @@ -234,16 +253,22 @@ zip_close(struct zip *za) zs = NULL; if (!ZIP_ENTRY_DATA_CHANGED(za->entry+i)) { - if ((zs=zip_source_zip(za, za, i, ZIP_FL_RECOMPRESS, 0, -1)) == NULL) { - error = 1; - break; - } + if ((zs=zip_source_zip(za, za, i, ZIP_FL_RECOMPRESS, 0, -1)) + == NULL) { + error = 1; + break; + } } if (add_data(za, zs ? zs : za->entry[i].source, &de, out) < 0) { error = 1; + if (zs) + zip_source_free(zs); break; } + 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; @@ -291,27 +316,27 @@ zip_close(struct zip *za) free(temp); return -1; } - - if (za->zp) { - fclose(za->zp); - za->zp = NULL; - reopen_on_error = 1; + + if (za->zp) { + fclose(za->zp); + za->zp = NULL; + reopen_on_error = 1; } if (_zip_rename(temp, za->zn) != 0) { - _zip_error_set(&za->error, ZIP_ER_RENAME, errno); - remove(temp); - free(temp); - if (reopen_on_error) { - /* ignore errors, since we're already in an error case */ - za->zp = fopen(za->zn, "rb"); - } - return -1; + _zip_error_set(&za->error, ZIP_ER_RENAME, errno); + remove(temp); + free(temp); + if (reopen_on_error) { + /* ignore errors, since we're already in an error case */ + za->zp = fopen(za->zn, "rb"); } + return -1; + } +#ifndef PHP_WIN32 mask = umask(0); umask(mask); chmod(za->zn, 0666&~mask); - if (za->ch_comment) - free(za->ch_comment); +#endif _zip_free(za); free(temp); @@ -322,23 +347,17 @@ zip_close(struct zip *za) static int -add_data(struct zip *za, struct zip_source *zs, struct zip_dirent *de, FILE *ft) +add_data(struct zip *za, struct zip_source *src, struct zip_dirent *de, + FILE *ft) { - off_t offstart, offend; - zip_source_callback cb; - void *ud; + off_t offstart, offdata, offend; struct zip_stat st; - - cb = zs->f; - ud = zs->ud; - - if (cb(ud, &st, sizeof(st), ZIP_SOURCE_STAT) < (ssize_t)sizeof(st)) { - ch_set_error(&za->error, cb, ud); - return -1; - } - - if (cb(ud, NULL, 0, ZIP_SOURCE_OPEN) < 0) { - ch_set_error(&za->error, cb, ud); + struct zip_source *s2; + zip_compression_implementation comp_impl; + int ret; + + if (zip_source_stat(src, &st) < 0) { + _zip_error_set_from_source(&za->error, src); return -1; } @@ -347,19 +366,49 @@ add_data(struct zip *za, struct zip_source *zs, struct zip_dirent *de, FILE *ft) if (_zip_dirent_write(de, ft, 1, &za->error) < 0) return -1; - if (st.comp_method != ZIP_CM_STORE) { - if (add_data_comp(cb, ud, &st, ft, &za->error) < 0) - return -1; + if ((s2=zip_source_crc(za, src, 0)) == NULL) { + zip_source_pop(s2); + return -1; } - else { - if (add_data_uncomp(za, cb, ud, &st, ft) < 0) + + /* 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 ((s2=comp_impl(za, s2, ZIP_CM_DEFLATE, ZIP_CODEC_ENCODE)) + == NULL) { + /* XXX: set error? */ + zip_source_pop(s2); return -1; + } + } + else + s2 = src; + + offdata = ftello(ft); + + ret = copy_source(za, s2, ft); + + if (zip_source_stat(s2, &st) < 0) + ret = -1; + + while (s2 != src) { + if ((s2=zip_source_pop(s2)) == NULL) { + /* XXX: set erorr */ + ret = -1; + break; + } } - if (cb(ud, NULL, 0, ZIP_SOURCE_CLOSE) < 0) { - ch_set_error(&za->error, cb, ud); + if (ret < 0) return -1; - } offend = ftello(ft); @@ -368,19 +417,18 @@ add_data(struct zip *za, struct zip_source *zs, struct zip_dirent *de, FILE *ft) return -1; } - de->last_mod = st.mtime; de->comp_method = st.comp_method; de->crc = st.crc; de->uncomp_size = st.size; - de->comp_size = st.comp_size; + de->comp_size = 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) return -1; - + if (fseeko(ft, offend, SEEK_SET) < 0) { _zip_error_set(&za->error, ZIP_ER_SEEK, errno); return -1; @@ -391,133 +439,6 @@ add_data(struct zip *za, struct zip_source *zs, struct zip_dirent *de, FILE *ft) -static int -add_data_comp(zip_source_callback cb, void *ud, struct zip_stat *st,FILE *ft, - struct zip_error *error) -{ - char buf[BUFSIZE]; - ssize_t n; - - st->comp_size = 0; - while ((n=cb(ud, buf, sizeof(buf), ZIP_SOURCE_READ)) > 0) { - if (fwrite(buf, 1, n, ft) != (size_t)n) { - _zip_error_set(error, ZIP_ER_WRITE, errno); - return -1; - } - - st->comp_size += n; - } - if (n < 0) { - ch_set_error(error, cb, ud); - return -1; - } - - return 0; -} - - - -static int -add_data_uncomp(struct zip *za, zip_source_callback cb, void *ud, - struct zip_stat *st, FILE *ft) -{ - char b1[BUFSIZE], b2[BUFSIZE]; - int end, flush, ret; - ssize_t n; - size_t n2; - z_stream zstr; - int mem_level; - - st->comp_method = ZIP_CM_DEFLATE; - st->comp_size = st->size = 0; - st->crc = crc32(0, NULL, 0); - - zstr.zalloc = Z_NULL; - zstr.zfree = Z_NULL; - zstr.opaque = NULL; - zstr.avail_in = 0; - zstr.avail_out = 0; - - if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) - mem_level = TORRENT_MEM_LEVEL; - else - mem_level = MAX_MEM_LEVEL; - - /* -MAX_WBITS: undocumented feature of zlib to _not_ write a zlib header */ - deflateInit2(&zstr, Z_BEST_COMPRESSION, Z_DEFLATED, -MAX_WBITS, mem_level, - Z_DEFAULT_STRATEGY); - - zstr.next_out = (Bytef *)b2; - zstr.avail_out = sizeof(b2); - zstr.next_in = NULL; - zstr.avail_in = 0; - - flush = 0; - end = 0; - while (!end) { - if (zstr.avail_in == 0 && !flush) { - if ((n=cb(ud, b1, sizeof(b1), ZIP_SOURCE_READ)) < 0) { - ch_set_error(&za->error, cb, ud); - deflateEnd(&zstr); - return -1; - } - if (n > 0) { - zstr.avail_in = n; - zstr.next_in = (Bytef *)b1; - st->size += n; - st->crc = crc32(st->crc, (Bytef *)b1, n); - } - else - flush = Z_FINISH; - } - - ret = deflate(&zstr, flush); - if (ret != Z_OK && ret != Z_STREAM_END) { - _zip_error_set(&za->error, ZIP_ER_ZLIB, ret); - return -1; - } - - if (zstr.avail_out != sizeof(b2)) { - n2 = sizeof(b2) - zstr.avail_out; - - if (fwrite(b2, 1, n2, ft) != n2) { - _zip_error_set(&za->error, ZIP_ER_WRITE, errno); - return -1; - } - - zstr.next_out = (Bytef *)b2; - zstr.avail_out = sizeof(b2); - st->comp_size += n2; - } - - if (ret == Z_STREAM_END) { - deflateEnd(&zstr); - end = 1; - } - } - - return 0; -} - - - -static void -ch_set_error(struct zip_error *error, zip_source_callback cb, void *ud) -{ - int e[2]; - - if ((cb(ud, e, sizeof(e), ZIP_SOURCE_ERROR)) < (ssize_t)sizeof(e)) { - error->zip_err = ZIP_ER_INTERNAL; - error->sys_err = 0; - } - else { - error->zip_err = e[0]; - error->sys_err = e[1]; - } -} - - - static int copy_data(FILE *fs, off_t len, FILE *ft, struct zip_error *error) { @@ -551,6 +472,40 @@ copy_data(FILE *fs, off_t len, FILE *ft, struct zip_error *error) +static int +copy_source(struct zip *za, struct zip_source *src, FILE *ft) +{ + char buf[BUFSIZE]; + zip_int64_t n; + int ret; + + if (zip_source_open(src) < 0) { + _zip_error_set_from_source(&za->error, src); + return -1; + } + + ret = 0; + while ((n=zip_source_read(src, buf, sizeof(buf))) > 0) { + if (fwrite(buf, 1, n, ft) != (size_t)n) { + _zip_error_set(&za->error, ZIP_ER_WRITE, errno); + ret = -1; + break; + } + } + + if (n < 0) { + if (ret == 0) + _zip_error_set_from_source(&za->error, src); + ret = -1; + } + + zip_source_close(src); + + return ret; +} + + + static int write_cdir(struct zip *za, struct zip_cdir *cd, FILE *out) { @@ -613,7 +568,7 @@ _zip_cdir_set_comment(struct zip_cdir *dest, struct zip *src) -static int +int _zip_changed(struct zip *za, int *survivorsp) { int changed, i, survivors; @@ -626,13 +581,15 @@ _zip_changed(struct zip *za, int *survivorsp) 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)) changed = 1; if (za->entry[i].state != ZIP_ST_DELETED) survivors++; } - *survivorsp = survivors; + if (survivorsp) + *survivorsp = survivors; return changed; } @@ -668,6 +625,10 @@ _zip_create_temp_output(struct zip *za, FILE **outp) return NULL; } #ifdef PHP_WIN32 + /* + According to Pierre Joye, Windows in some environments per + default creates text files, so force binary mode. + */ _setmode(_fileno(tfp), _O_BINARY ); #endif diff --git a/ext/zip/lib/zip_delete.c b/ext/zip/lib/zip_delete.c index 4591ff7f86a0f..131d444124c4b 100644 --- a/ext/zip/lib/zip_delete.c +++ b/ext/zip/lib/zip_delete.c @@ -1,6 +1,6 @@ /* zip_delete.c -- delete file from zip archive - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -38,13 +38,18 @@ ZIP_EXTERN(int) -zip_delete(struct zip *za, int idx) +zip_delete(struct zip *za, zip_uint64_t idx) { - if (idx < 0 || idx >= za->nentry) { + 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; + } + /* allow duplicate file names, because the file will * be removed directly afterwards */ if (_zip_unchange(za, idx, 1) != 0) diff --git a/ext/zip/lib/zip_dirent.c b/ext/zip/lib/zip_dirent.c index 59f8ab0af9c6c..b5b9d273be4ba 100644 --- a/ext/zip/lib/zip_dirent.c +++ b/ext/zip/lib/zip_dirent.c @@ -45,7 +45,6 @@ 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_u2d_time(time_t, unsigned short *, unsigned short *); static void _zip_write2(unsigned short, FILE *); static void _zip_write4(unsigned int, FILE *); @@ -213,13 +212,13 @@ _zip_dirent_init(struct zip_dirent *de) int _zip_dirent_read(struct zip_dirent *zde, FILE *fp, - unsigned char **bufp, unsigned int *leftp, int local, + unsigned char **bufp, zip_uint32_t *leftp, int local, struct zip_error *error) { unsigned char buf[CDENTRYSIZE]; unsigned char *cur; unsigned short dostime, dosdate; - unsigned int size; + zip_uint32_t size; if (local) size = LENTRYSIZE; @@ -473,8 +472,10 @@ _zip_dirent_write(struct zip_dirent *zde, FILE *fp, int localp, static time_t _zip_d2u_time(int dtime, int ddate) { - struct tm tm = {0}; + struct tm tm; + memset(&tm, 0, sizeof(tm)); + /* let mktime decide if DST is in effect */ tm.tm_isdst = -1; @@ -598,7 +599,7 @@ _zip_write4(unsigned int i, FILE *fp) -static void +void _zip_u2d_time(time_t time, unsigned short *dtime, unsigned short *ddate) { struct tm *tm; diff --git a/ext/zip/lib/zip_entry_free.c b/ext/zip/lib/zip_entry_free.c index c50c9434bdd93..e8a77707f0bfa 100644 --- a/ext/zip/lib/zip_entry_free.c +++ b/ext/zip/lib/zip_entry_free.c @@ -44,6 +44,9 @@ _zip_entry_free(struct zip_entry *ze) { 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; diff --git a/ext/zip/lib/zip_entry_new.c b/ext/zip/lib/zip_entry_new.c index 7059b1b060749..ad5d59975a927 100644 --- a/ext/zip/lib/zip_entry_new.c +++ b/ext/zip/lib/zip_entry_new.c @@ -1,6 +1,6 @@ /* zip_entry_new.c -- create and init struct zip_entry - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -46,20 +46,21 @@ _zip_entry_new(struct zip *za) if (!za) { ze = (struct zip_entry *)malloc(sizeof(struct zip_entry)); if (!ze) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); return NULL; } } else { - if (za->nentry >= za->nentry_alloc-1) { + if (za->nentry+1 >= za->nentry_alloc) { + struct zip_entry *rentries; za->nentry_alloc += 16; - za->entry = (struct zip_entry *)realloc(za->entry, - sizeof(struct zip_entry) - * za->nentry_alloc); - if (!za->entry) { + 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; } @@ -67,6 +68,8 @@ _zip_entry_new(struct zip *za) ze->state = ZIP_ST_UNCHANGED; 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; diff --git a/ext/zip/lib/zip_err_str.c b/ext/zip/lib/zip_err_str.c index 3fcdf1738a863..8fb60036e078e 100644 --- a/ext/zip/lib/zip_err_str.c +++ b/ext/zip/lib/zip_err_str.c @@ -32,6 +32,10 @@ const char * const _zip_err_str[] = { "Zip archive inconsistent", "Can't remove file", "Entry has been deleted", + "Encryption method not supported", + "Read-only archive", + "No password provided", + "Wrong password provided", }; const int _zip_nerr_str = sizeof(_zip_err_str)/sizeof(_zip_err_str[0]); @@ -65,4 +69,8 @@ const int _zip_err_type[] = { N, S, N, + N, + N, + N, + N, }; diff --git a/ext/zip/lib/zip_error.c b/ext/zip/lib/zip_error.c index aab70794566c0..b8d907abf4d9a 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-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -99,3 +99,14 @@ _zip_error_set(struct zip_error *err, int ze, int se) err->sys_err = se; } } + + + +void +_zip_error_set_from_source(struct zip_error *err, struct zip_source *src) +{ + int ze, se; + + zip_source_error(src, &ze, &se); + _zip_error_set(err, ze, se); +} diff --git a/ext/zip/lib/zip_error_to_str.c b/ext/zip/lib/zip_error_to_str.c index 4dea4d667a5ee..bafe74335a049 100644 --- a/ext/zip/lib/zip_error_to_str.c +++ b/ext/zip/lib/zip_error_to_str.c @@ -1,6 +1,6 @@ /* zip_error_to_str.c -- get string representation of zip error code - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -43,7 +43,7 @@ ZIP_EXTERN(int) -zip_error_to_str(char *buf, size_t len, int ze, int se) +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_fclose.c b/ext/zip/lib/zip_fclose.c index 8f062d9d090f7..eb55ddbcea455 100644 --- a/ext/zip/lib/zip_fclose.c +++ b/ext/zip/lib/zip_fclose.c @@ -44,28 +44,20 @@ zip_fclose(struct zip_file *zf) { int i, ret; - if (zf->zstr) - inflateEnd(zf->zstr); - free(zf->buffer); - free(zf->zstr); - 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; - } - } + 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; } + } ret = 0; if (zf->error.zip_err) ret = zf->error.zip_err; - else if ((zf->flags & ZIP_ZF_CRC) && (zf->flags & ZIP_ZF_EOF)) { - /* if EOF, compare CRC */ - if (zf->crc_orig != zf->crc) - ret = ZIP_ER_CRC; - } free(zf); return ret; diff --git a/ext/zip/lib/zip_fdopen.c b/ext/zip/lib/zip_fdopen.c new file mode 100644 index 0000000000000..df70f27561ace --- /dev/null +++ b/ext/zip/lib/zip_fdopen.c @@ -0,0 +1,62 @@ +/* + zip_fdopen.c -- open read-only archive from file descriptor + Copyright (C) 2009-2010 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(struct zip *) +zip_fdopen(int fd_orig, int flags, int *zep) +{ + int fd; + FILE *fp; + + /* We dup() here to avoid messing with the passed in fd. + We could not restore it to the original state in case of error. */ + + if ((fd=dup(fd_orig)) < 0) { + *zep = ZIP_ER_OPEN; + return NULL; + } + + if ((fp=fdopen(fd, "rb")) == NULL) { + close(fd); + *zep = ZIP_ER_OPEN; + return NULL; + } + + close(fd_orig); + return _zip_open(NULL, fp, flags, ZIP_AFL_RDONLY, zep); +} diff --git a/ext/zip/lib/zip_filerange_crc.c b/ext/zip/lib/zip_filerange_crc.c index c6890987b16df..4d1ad566929f8 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-2009 Dieter Baron and Thomas Klausner + Copyright (C) 2008 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at diff --git a/ext/zip/lib/zip_fopen.c b/ext/zip/lib/zip_fopen.c index b4b76049f4430..f62adbbf92692 100644 --- a/ext/zip/lib/zip_fopen.c +++ b/ext/zip/lib/zip_fopen.c @@ -1,6 +1,6 @@ /* zip_fopen.c -- open file in zip archive for reading - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -45,5 +45,5 @@ zip_fopen(struct zip *za, const char *fname, int flags) if ((idx=zip_name_locate(za, fname, flags)) < 0) return NULL; - return zip_fopen_index(za, idx, flags); + return zip_fopen_index_encrypted(za, idx, flags, za->default_password); } diff --git a/ext/zip/lib/zip_fopen_encrypted.c b/ext/zip/lib/zip_fopen_encrypted.c new file mode 100644 index 0000000000000..8aba0625672bc --- /dev/null +++ b/ext/zip/lib/zip_fopen_encrypted.c @@ -0,0 +1,50 @@ +/* + zip_fopen_encrypted.c -- open file for reading with password + Copyright (C) 1999-2009 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(struct zip_file *) +zip_fopen_encrypted(struct zip *za, const char *fname, int flags, + const char *password) +{ + int idx; + + if ((idx=zip_name_locate(za, fname, flags)) < 0) + return NULL; + + return zip_fopen_index_encrypted(za, idx, flags, password); +} diff --git a/ext/zip/lib/zip_fopen_index.c b/ext/zip/lib/zip_fopen_index.c index 1e7e4198970aa..b60fd33e8f53e 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-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -39,178 +39,10 @@ #include "zipint.h" -static struct zip_file *_zip_file_new(struct zip *za); - ZIP_EXTERN(struct zip_file *) -zip_fopen_index(struct zip *za, int fileno, int flags) +zip_fopen_index(struct zip *za, zip_uint64_t fileno, int flags) { - int len, ret; - int zfflags; - struct zip_file *zf; - - if ((fileno < 0) || (fileno >= za->nentry)) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return NULL; - } - - if ((flags & ZIP_FL_UNCHANGED) == 0 - && ZIP_ENTRY_DATA_CHANGED(za->entry+fileno)) { - _zip_error_set(&za->error, ZIP_ER_CHANGED, 0); - return NULL; - } - - if (fileno >= za->cdir->nentry) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return NULL; - } - - zfflags = 0; - switch (za->cdir->entry[fileno].comp_method) { - case ZIP_CM_STORE: - zfflags |= ZIP_ZF_CRC; - break; - - case ZIP_CM_DEFLATE: - if ((flags & ZIP_FL_COMPRESSED) == 0) - zfflags |= ZIP_ZF_CRC | ZIP_ZF_DECOMP; - break; - default: - if ((flags & ZIP_FL_COMPRESSED) == 0) { - _zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0); - return NULL; - } - break; - } - - zf = _zip_file_new(za); - - zf->flags = zfflags; - /* zf->name = za->cdir->entry[fileno].filename; */ - zf->method = za->cdir->entry[fileno].comp_method; - zf->bytes_left = za->cdir->entry[fileno].uncomp_size; - zf->cbytes_left = za->cdir->entry[fileno].comp_size; - zf->crc_orig = za->cdir->entry[fileno].crc; - - if ((zf->fpos=_zip_file_get_offset(za, fileno)) == 0) { - zip_fclose(zf); - return NULL; - } - - if ((zf->flags & ZIP_ZF_DECOMP) == 0) - zf->bytes_left = zf->cbytes_left; - else { - if ((zf->buffer=(char *)malloc(BUFSIZE)) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - zip_fclose(zf); - return NULL; - } - - len = _zip_file_fillbuf(zf->buffer, BUFSIZE, zf); - if (len <= 0) { - _zip_error_copy(&za->error, &zf->error); - zip_fclose(zf); - return NULL; - } - - if ((zf->zstr = (z_stream *)malloc(sizeof(z_stream))) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - zip_fclose(zf); - return NULL; - } - zf->zstr->zalloc = Z_NULL; - zf->zstr->zfree = Z_NULL; - zf->zstr->opaque = NULL; - zf->zstr->next_in = (Bytef *)zf->buffer; - zf->zstr->avail_in = len; - - /* negative value to tell zlib that there is no header */ - if ((ret=inflateInit2(zf->zstr, -MAX_WBITS)) != Z_OK) { - _zip_error_set(&za->error, ZIP_ER_ZLIB, ret); - zip_fclose(zf); - return NULL; - } - } - - return zf; -} - - - -int -_zip_file_fillbuf(void *buf, size_t buflen, struct zip_file *zf) -{ - int i, j; - - if (zf->error.zip_err != ZIP_ER_OK) - return -1; - - if ((zf->flags & ZIP_ZF_EOF) || zf->cbytes_left <= 0 || buflen <= 0) - return 0; - - if (fseeko(zf->za->zp, zf->fpos, SEEK_SET) < 0) { - _zip_error_set(&zf->error, ZIP_ER_SEEK, errno); - return -1; - } - if (buflen < zf->cbytes_left) - i = buflen; - else - i = zf->cbytes_left; - - j = fread(buf, 1, i, zf->za->zp); - if (j == 0) { - _zip_error_set(&zf->error, ZIP_ER_EOF, 0); - j = -1; - } - else if (j < 0) - _zip_error_set(&zf->error, ZIP_ER_READ, errno); - else { - zf->fpos += j; - zf->cbytes_left -= j; - } - - return j; -} - - - -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) { - n = za->nfile_alloc + 10; - file = (struct zip_file **)realloc(za->file, - n*sizeof(struct zip_file *)); - if (file == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - free(zf); - return NULL; - } - za->nfile_alloc = n; - za->file = file; - } - - za->file[za->nfile++] = zf; - - zf->za = za; - _zip_error_init(&zf->error); - zf->flags = 0; - zf->crc = crc32(0L, Z_NULL, 0); - zf->crc_orig = 0; - zf->method = -1; - zf->bytes_left = zf->cbytes_left = 0; - zf->fpos = 0; - zf->buffer = NULL; - zf->zstr = NULL; - - return zf; + return zip_fopen_index_encrypted(za, fileno, flags, za->default_password); } diff --git a/ext/zip/lib/zip_fopen_index_encrypted.c b/ext/zip/lib/zip_fopen_index_encrypted.c new file mode 100644 index 0000000000000..988a78fe03f9a --- /dev/null +++ b/ext/zip/lib/zip_fopen_index_encrypted.c @@ -0,0 +1,191 @@ +/* + zip_fopen_index_encrypted.c -- open file for reading by index w/ password + Copyright (C) 1999-2009 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 + +#include "zipint.h" + +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, + 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; + } + + if ((flags & ZIP_FL_UNCHANGED) == 0 + && ZIP_ENTRY_DATA_CHANGED(za->entry+fileno)) { + _zip_error_set(&za->error, ZIP_ER_CHANGED, 0); + 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); + zip_source_free(src); + return NULL; + } + + zf = _zip_file_new(za); + + zf->src = src; + + return zf; +} + + + +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) { + n = za->nfile_alloc + 10; + file = (struct zip_file **)realloc(za->file, + n*sizeof(struct zip_file *)); + if (file == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + free(zf); + return NULL; + } + za->nfile_alloc = n; + za->file = file; + } + + za->file[za->nfile++] = zf; + + zf->za = za; + _zip_error_init(&zf->error); + zf->eof = 0; + zf->src = NULL; + + return zf; +} diff --git a/ext/zip/lib/zip_fread.c b/ext/zip/lib/zip_fread.c index 00a6bdc4e05ad..a6c0851b0aaac 100644 --- a/ext/zip/lib/zip_fread.c +++ b/ext/zip/lib/zip_fread.c @@ -1,6 +1,6 @@ /* zip_fread.c -- read from file - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -37,12 +37,10 @@ -ZIP_EXTERN(ssize_t) -zip_fread(struct zip_file *zf, void *outbuf, size_t toread) +ZIP_EXTERN(zip_int64_t) +zip_fread(struct zip_file *zf, void *outbuf, zip_uint64_t toread) { - int ret; - size_t out_before, len; - int i; + zip_int64_t n; if (!zf) return -1; @@ -50,81 +48,18 @@ zip_fread(struct zip_file *zf, void *outbuf, size_t toread) if (zf->error.zip_err != 0) return -1; - if ((zf->flags & ZIP_ZF_EOF) || (toread == 0)) - return 0; + if (toread > ZIP_INT64_MAX) { + _zip_error_set(&zf->error, ZIP_ER_INVAL, 0); + return -1; + } - if (zf->bytes_left == 0) { - zf->flags |= ZIP_ZF_EOF; - if (zf->flags & ZIP_ZF_CRC) { - if (zf->crc != zf->crc_orig) { - _zip_error_set(&zf->error, ZIP_ER_CRC, 0); - return -1; - } - } + if ((zf->eof) || (toread == 0)) return 0; - } - if ((zf->flags & ZIP_ZF_DECOMP) == 0) { - ret = _zip_file_fillbuf(outbuf, toread, zf); - if (ret > 0) { - if (zf->flags & ZIP_ZF_CRC) - zf->crc = crc32(zf->crc, (Bytef *)outbuf, ret); - zf->bytes_left -= ret; - } - return ret; + if ((n=zip_source_read(zf->src, outbuf, toread)) < 0) { + _zip_error_set_from_source(&zf->error, zf->src); + return -1; } - - zf->zstr->next_out = (Bytef *)outbuf; - zf->zstr->avail_out = toread; - out_before = zf->zstr->total_out; - - /* endless loop until something has been accomplished */ - for (;;) { - ret = inflate(zf->zstr, Z_SYNC_FLUSH); - switch (ret) { - case Z_STREAM_END: - if (zf->zstr->total_out == out_before) { - if (zf->crc != zf->crc_orig) { - _zip_error_set(&zf->error, ZIP_ER_CRC, 0); - return -1; - } - else - return 0; - } - - /* fallthrough */ - - case Z_OK: - len = zf->zstr->total_out - out_before; - if (len >= zf->bytes_left || len >= toread) { - if (zf->flags & ZIP_ZF_CRC) - zf->crc = crc32(zf->crc, (Bytef *)outbuf, len); - zf->bytes_left -= len; - return len; - } - break; - - case Z_BUF_ERROR: - if (zf->zstr->avail_in == 0) { - i = _zip_file_fillbuf(zf->buffer, BUFSIZE, zf); - if (i == 0) { - _zip_error_set(&zf->error, ZIP_ER_INCONS, 0); - return -1; - } - else if (i < 0) - return -1; - zf->zstr->next_in = (Bytef *)zf->buffer; - zf->zstr->avail_in = i; - continue; - } - /* fallthrough */ - case Z_NEED_DICT: - case Z_DATA_ERROR: - case Z_STREAM_ERROR: - case Z_MEM_ERROR: - _zip_error_set(&zf->error, ZIP_ER_ZLIB, ret); - return -1; - } - } + return n; } diff --git a/ext/zip/lib/zip_free.c b/ext/zip/lib/zip_free.c index 76c3a9673ff53..9932c14fec9a2 100644 --- a/ext/zip/lib/zip_free.c +++ b/ext/zip/lib/zip_free.c @@ -57,7 +57,9 @@ _zip_free(struct zip *za) if (za->zp) fclose(za->zp); + free(za->default_password); _zip_cdir_free(za->cdir); + free(za->ch_comment); if (za->entry) { for (i=0; inentry; i++) { diff --git a/ext/zip/lib/zip_get_archive_comment.c b/ext/zip/lib/zip_get_archive_comment.c index ed1324fd5b9c0..fe97e6e8c18a1 100644 --- a/ext/zip/lib/zip_get_archive_comment.c +++ b/ext/zip/lib/zip_get_archive_comment.c @@ -42,11 +42,11 @@ zip_get_archive_comment(struct zip *za, int *lenp, int 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; - } + if (za->cdir) { + if (lenp != NULL) + *lenp = za->cdir->comment_len; + return za->cdir->comment; + } else { if (lenp != NULL) *lenp = -1; diff --git a/ext/zip/lib/zip_get_archive_flag.c b/ext/zip/lib/zip_get_archive_flag.c index a595c51f59942..2d46aa39ffbb4 100644 --- a/ext/zip/lib/zip_get_archive_flag.c +++ b/ext/zip/lib/zip_get_archive_flag.c @@ -1,6 +1,6 @@ /* zip_get_archive_flag.c -- get archive global flag - Copyright (C) 2008-2009 Dieter Baron and Thomas Klausner + Copyright (C) 2008 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at diff --git a/ext/zip/lib/zip_get_compression_implementation.c b/ext/zip/lib/zip_get_compression_implementation.c new file mode 100644 index 0000000000000..197cd49635d41 --- /dev/null +++ b/ext/zip/lib/zip_get_compression_implementation.c @@ -0,0 +1,46 @@ +/* + zip_get_compression_implementation.c -- get compression implementation + Copyright (C) 2009 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(zip_compression_implementation) +zip_get_compression_implementation(zip_uint16_t cm) +{ + if (cm == ZIP_CM_DEFLATE) + 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 new file mode 100644 index 0000000000000..783d538d3f6ff --- /dev/null +++ b/ext/zip/lib/zip_get_encryption_implementation.c @@ -0,0 +1,46 @@ +/* + zip_get_encryption_implementation.c -- get encryption implementation + Copyright (C) 2009 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(zip_encryption_implementation) +zip_get_encryption_implementation(zip_uint16_t em) +{ + if (em == ZIP_EM_TRAD_PKWARE) + return zip_source_pkware; + return NULL; +} diff --git a/ext/zip/lib/zip_get_file_comment.c b/ext/zip/lib/zip_get_file_comment.c index 57dd9028bc138..43c1520e1d438 100644 --- a/ext/zip/lib/zip_get_file_comment.c +++ b/ext/zip/lib/zip_get_file_comment.c @@ -38,9 +38,9 @@ ZIP_EXTERN(const char *) -zip_get_file_comment(struct zip *za, int idx, int *lenp, int flags) +zip_get_file_comment(struct zip *za, zip_uint64_t idx, int *lenp, int flags) { - if (idx < 0 || idx >= za->nentry) { + if (idx >= za->nentry) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return NULL; } diff --git a/ext/zip/lib/zip_get_file_extra.c b/ext/zip/lib/zip_get_file_extra.c new file mode 100644 index 0000000000000..a27edd8ee9452 --- /dev/null +++ b/ext/zip/lib/zip_get_file_extra.c @@ -0,0 +1,58 @@ +/* + zip_get_file_extra.c -- get file extra field + Copyright (C) 2006-2010 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(const char *) +zip_get_file_extra(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; + } + + 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; +} diff --git a/ext/zip/lib/zip_get_name.c b/ext/zip/lib/zip_get_name.c index b58d972058897..945e24e1501d5 100644 --- a/ext/zip/lib/zip_get_name.c +++ b/ext/zip/lib/zip_get_name.c @@ -38,7 +38,7 @@ ZIP_EXTERN(const char *) -zip_get_name(struct zip *za, int idx, int flags) +zip_get_name(struct zip *za, zip_uint64_t idx, int flags) { return _zip_get_name(za, idx, flags, &za->error); } @@ -46,9 +46,10 @@ zip_get_name(struct zip *za, int idx, int flags) const char * -_zip_get_name(struct zip *za, int idx, int flags, struct zip_error *error) +_zip_get_name(struct zip *za, zip_uint64_t idx, int flags, + struct zip_error *error) { - if (idx < 0 || idx >= za->nentry) { + if (idx >= za->nentry) { _zip_error_set(error, ZIP_ER_INVAL, 0); return NULL; } diff --git a/ext/zip/lib/zip_get_num_entries.c b/ext/zip/lib/zip_get_num_entries.c new file mode 100644 index 0000000000000..dd392e909592e --- /dev/null +++ b/ext/zip/lib/zip_get_num_entries.c @@ -0,0 +1,52 @@ +/* + zip_get_num_entries.c -- get number of entries in archive + Copyright (C) 1999-2011 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(zip_uint64_t) +zip_get_num_entries(struct zip *za, int flags) +{ + if (za == NULL) + return -1; + + if (flags & ZIP_FL_UNCHANGED) { + if (za->cdir == NULL) + return 0; + return za->cdir->nentry; + } + return za->nentry; +} diff --git a/ext/zip/lib/zip_name_locate.c b/ext/zip/lib/zip_name_locate.c index 96c4f937e0540..8cdd2c4d7ea0b 100644 --- a/ext/zip/lib/zip_name_locate.c +++ b/ext/zip/lib/zip_name_locate.c @@ -1,6 +1,6 @@ /* zip_name_locate.c -- get index by name - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2011 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 @@ -55,13 +55,17 @@ _zip_name_locate(struct zip *za, const char *fname, int flags, const char *fn, *p; int i, n; + if (za == NULL) + return -1; + if (fname == NULL) { _zip_error_set(error, ZIP_ER_INVAL, 0); return -1; } - if((flags & ZIP_FL_UNCHANGED) && !za->cdir) { - 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; @@ -76,7 +80,7 @@ _zip_name_locate(struct zip *za, const char *fname, int flags, /* newly added (partially filled) entry */ if (fn == NULL) continue; - + if (flags & ZIP_FL_NODIR) { p = strrchr(fn, '/'); if (p) diff --git a/ext/zip/lib/zip_new.c b/ext/zip/lib/zip_new.c index 3e8ccee644bc2..7ce1237cdbabd 100644 --- a/ext/zip/lib/zip_new.c +++ b/ext/zip/lib/zip_new.c @@ -65,6 +65,7 @@ _zip_new(struct zip_error *error) za->nfile = za->nfile_alloc = 0; za->file = NULL; za->flags = za->ch_flags = 0; + za->default_password = NULL; return za; } diff --git a/ext/zip/lib/zip_open.c b/ext/zip/lib/zip_open.c index 31e12f4fc5f4e..2f56881b0a9d2 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 - Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner + zip_open.c -- open zip archive by name + Copyright (C) 1999-2011 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -52,7 +52,7 @@ 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 *, unsigned char *, unsigned char *, +static struct zip_cdir *_zip_readcdir(FILE *, off_t, unsigned char *, unsigned char *, int, int, struct zip_error *); @@ -61,10 +61,6 @@ ZIP_EXTERN(struct zip *) zip_open(const char *fn, int flags, int *zep) { FILE *fp; - struct zip *za; - struct zip_cdir *cdir; - int i; - off_t len; if (flags & ZIP_OVERWRITE) { return _zip_allocate_new(fn, zep); @@ -75,10 +71,8 @@ zip_open(const char *fn, int flags, int *zep) if (!(flags & ZIP_OVERWRITE)) { return NULL; } - case 0: return _zip_allocate_new(fn, zep); - default: break; } @@ -88,7 +82,23 @@ zip_open(const char *fn, int flags, int *zep) return NULL; } - fseeko(fp, 0, SEEK_END); + return _zip_open(fn, fp, flags, 0, zep); +} + + + +struct zip * +_zip_open(const char *fn, FILE *fp, int flags, int aflags, int *zep) +{ + struct zip *za; + struct zip_cdir *cdir; + int i; + off_t len; + + if (fseeko(fp, 0, SEEK_END) < 0) { + *zep = ZIP_ER_SEEK; + return NULL; + } len = ftello(fp); /* treat empty files as empty archives */ @@ -156,13 +166,13 @@ set_error(int *zep, struct zip_error *err, int ze) entries, or NULL if unsuccessful. */ static struct zip_cdir * -_zip_readcdir(FILE *fp, unsigned char *buf, unsigned char *eocd, int buflen, +_zip_readcdir(FILE *fp, off_t buf_offset, unsigned char *buf, unsigned char *eocd, int buflen, int flags, struct zip_error *error) { struct zip_cdir *cd; unsigned char *cdp, **bufp; int i, comlen, nentry; - unsigned int left; + zip_uint32_t left; comlen = buf + buflen - eocd - EOCDLEN; if (comlen < 0) { @@ -196,14 +206,24 @@ _zip_readcdir(FILE *fp, unsigned char *buf, unsigned char *eocd, int buflen, cd->comment = NULL; cd->comment_len = _zip_read2(&cdp); + if (((zip_uint64_t)cd->offset)+cd->size > buf_offset + (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); - free(cd); + cd->nentry = 0; + _zip_cdir_free(cd); return NULL; } if ((flags & ZIP_CHECKCONS) && comlen != cd->comment_len) { _zip_error_set(error, ZIP_ER_INCONS, 0); - free(cd); + cd->nentry = 0; + _zip_cdir_free(cd); return NULL; } @@ -211,14 +231,15 @@ _zip_readcdir(FILE *fp, unsigned char *buf, unsigned char *eocd, int buflen, if ((cd->comment=(char *)_zip_memdup(eocd+EOCDLEN, cd->comment_len, error)) == NULL) { - free(cd); + cd->nentry = 0; + _zip_cdir_free(cd); return NULL; } } - if (cd->size < (unsigned int)(eocd-buf)) { + if (cd->offset >= buf_offset) { /* if buffer already read in, use it */ - cdp = eocd - cd->size; + cdp = buf + (cd->offset - buf_offset); bufp = &cdp; } else { @@ -234,20 +255,15 @@ _zip_readcdir(FILE *fp, unsigned char *buf, unsigned char *eocd, int buflen, _zip_error_set(error, ZIP_ER_SEEK, errno); else _zip_error_set(error, ZIP_ER_NOZIP, 0); - free(cd); + cd->nentry = 0; + _zip_cdir_free(cd); return NULL; } } left = cd->size; i=0; - do { - if (i == cd->nentry && left > 0) { - /* Infozip extension for more than 64k entries: - nentries wraps around, size indicates correct EOCD */ - _zip_cdir_grow(cd, cd->nentry+0x10000, error); - } - + while (inentry && left > 0) { if ((_zip_dirent_read(cd->entry+i, fp, bufp, &left, 0, error)) < 0) { cd->nentry = i; _zip_cdir_free(cd); @@ -255,7 +271,18 @@ _zip_readcdir(FILE *fp, unsigned char *buf, unsigned char *eocd, int buflen, } i++; - } while (inentry); + 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; return cd; } @@ -336,17 +363,17 @@ _zip_check_torrentzip(struct zip *za) if (za->cdir->comment_len != TORRENT_SIG_LEN+8 || strncmp(za->cdir->comment, TORRENT_SIG, TORRENT_SIG_LEN) != 0) return; - + memcpy(buf, za->cdir->comment+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) - return; + return; if (crc_got == crc_should) za->flags |= ZIP_AFL_TORRENT; @@ -434,12 +461,16 @@ _zip_allocate_new(const char *fn, int *zep) set_error(zep, &error, 0); return NULL; } - - za->zn = strdup(fn); - if (!za->zn) { - _zip_free(za); - set_error(zep, NULL, ZIP_ER_MEMORY); - return NULL; + + if (fn == NULL) + za->zn = NULL; + else { + za->zn = strdup(fn); + if (!za->zn) { + _zip_free(za); + set_error(zep, NULL, ZIP_ER_MEMORY); + return NULL; + } } return za; } @@ -481,6 +512,7 @@ _zip_find_central_dir(FILE *fp, 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; struct zip_error zerr; @@ -490,7 +522,8 @@ _zip_find_central_dir(FILE *fp, int flags, int *zep, off_t len) set_error(zep, NULL, ZIP_ER_SEEK); return NULL; } - + buf_offset = ftello(fp); + /* 64k is too much for stack */ if ((buf=(unsigned char *)malloc(CDBUFSIZE)) == NULL) { set_error(zep, NULL, ZIP_ER_MEMORY); @@ -516,7 +549,7 @@ _zip_find_central_dir(FILE *fp, int flags, int *zep, off_t len) /* found match -- check, if good */ /* to avoid finding the same match all over again */ match++; - if ((cdirnew=_zip_readcdir(fp, buf, match-1, buflen, flags, + if ((cdirnew=_zip_readcdir(fp, buf_offset, buf, match-1, buflen, flags, &zerr)) == NULL) continue; diff --git a/ext/zip/lib/zip_rename.c b/ext/zip/lib/zip_rename.c index e40ab27674f61..6b5a0359172da 100644 --- a/ext/zip/lib/zip_rename.c +++ b/ext/zip/lib/zip_rename.c @@ -40,16 +40,21 @@ ZIP_EXTERN(int) -zip_rename(struct zip *za, int idx, const char *name) +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 || idx < 0 || name[0] == '\0') { + 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; diff --git a/ext/zip/lib/zip_replace.c b/ext/zip/lib/zip_replace.c index ae69a86f632f1..6dc3dd5ab508f 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-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -38,9 +38,9 @@ ZIP_EXTERN(int) -zip_replace(struct zip *za, int idx, struct zip_source *source) +zip_replace(struct zip *za, zip_uint64_t idx, struct zip_source *source) { - if (idx < 0 || idx >= za->nentry || source == NULL) { + if (idx >= za->nentry || source == NULL) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } @@ -54,11 +54,18 @@ zip_replace(struct zip *za, int idx, struct zip_source *source) -int -_zip_replace(struct zip *za, int idx, const char *name, +/* 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 (idx == -1) { + 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; diff --git a/ext/zip/lib/zip_set_archive_comment.c b/ext/zip/lib/zip_set_archive_comment.c index c4bd070ddcde3..3cd069c7577c9 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-2007 Dieter Baron and Thomas Klausner + Copyright (C) 2006-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -50,6 +50,11 @@ zip_set_archive_comment(struct zip *za, const char *comment, int len) return -1; } + if (ZIP_IS_RDONLY(za)) { + _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + if (len > 0) { if ((tmpcom=(char *)_zip_memdup(comment, len, &za->error)) == NULL) return -1; diff --git a/ext/zip/lib/zip_set_archive_flag.c b/ext/zip/lib/zip_set_archive_flag.c index 20316e4614aa9..07bcfbe304d85 100644 --- a/ext/zip/lib/zip_set_archive_flag.c +++ b/ext/zip/lib/zip_set_archive_flag.c @@ -40,10 +40,30 @@ ZIP_EXTERN(int) zip_set_archive_flag(struct zip *za, int flag, int value) { + unsigned int new_flags; + if (value) - za->ch_flags |= flag; + new_flags = za->ch_flags | flag; else - za->ch_flags &= ~flag; + new_flags = za->ch_flags & ~flag; + + if (new_flags == za->ch_flags) + return 0; + + if (ZIP_IS_RDONLY(za)) { + _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + if ((flag & ZIP_AFL_RDONLY) && value + && (za->ch_flags & ZIP_AFL_RDONLY) == 0) { + if (_zip_changed(za, NULL)) { + _zip_error_set(&za->error, ZIP_ER_CHANGED, 0); + return -1; + } + } + + za->ch_flags = new_flags; return 0; } diff --git a/ext/zip/lib/zip_set_default_password.c b/ext/zip/lib/zip_set_default_password.c new file mode 100644 index 0000000000000..c274d1100bb3a --- /dev/null +++ b/ext/zip/lib/zip_set_default_password.c @@ -0,0 +1,62 @@ +/* + zip_set_default_password.c -- set default password for decryption + Copyright (C) 2009 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_EXTERN(int) +zip_set_default_password(struct zip *za, const char *passwd) +{ + if (za == NULL) + return -1; + + if (za->default_password) + free(za->default_password); + + if (passwd) { + if ((za->default_password=strdup(passwd)) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + } + else + za->default_password = NULL; + + return 0; +} diff --git a/ext/zip/lib/zip_set_file_comment.c b/ext/zip/lib/zip_set_file_comment.c index 3d5dd6b5e3e68..5e63dc2730ad4 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-2007 Dieter Baron and Thomas Klausner + Copyright (C) 2006-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -40,17 +40,23 @@ ZIP_EXTERN(int) -zip_set_file_comment(struct zip *za, int idx, const char *comment, int len) +zip_set_file_comment(struct zip *za, zip_uint64_t idx, + const char *comment, int len) { char *tmpcom; - if (idx < 0 || idx >= za->nentry + 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) { if ((tmpcom=(char *)_zip_memdup(comment, len, &za->error)) == NULL) return -1; diff --git a/ext/zip/lib/zip_set_file_extra.c b/ext/zip/lib/zip_set_file_extra.c new file mode 100644 index 0000000000000..db829e2e0a842 --- /dev/null +++ b/ext/zip/lib/zip_set_file_extra.c @@ -0,0 +1,72 @@ +/* + zip_set_file_extra.c -- set extra field for file in archive + Copyright (C) 2006-2010 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_set_file_extra(struct zip *za, zip_uint64_t idx, + const char *extra, int len) +{ + char *tmpext; + + if (idx >= za->nentry + || len < 0 || len > MAXEXTLEN + || (len > 0 && extra == 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) { + if ((tmpext=(char *)_zip_memdup(extra, len, &za->error)) == NULL) + return -1; + } + else + tmpext = NULL; + + free(za->entry[idx].ch_extra); + za->entry[idx].ch_extra = tmpext; + za->entry[idx].ch_extra_len = len; + + return 0; +} diff --git a/ext/zip/lib/zip_set_name.c b/ext/zip/lib/zip_set_name.c index 5c7da3d7c51ff..2a90601bfec35 100644 --- a/ext/zip/lib/zip_set_name.c +++ b/ext/zip/lib/zip_set_name.c @@ -41,12 +41,12 @@ int -_zip_set_name(struct zip *za, int idx, const char *name) +_zip_set_name(struct zip *za, zip_uint64_t idx, const char *name) { char *s; - int i; + zip_int64_t i; - if (idx < 0 || idx >= za->nentry || name == NULL) { + if (idx >= za->nentry || name == NULL) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } diff --git a/ext/zip/lib/zip_source_buffer.c b/ext/zip/lib/zip_source_buffer.c index 867d3dfa3ed69..8c9154ce3c5ba 100644 --- a/ext/zip/lib/zip_source_buffer.c +++ b/ext/zip/lib/zip_source_buffer.c @@ -1,6 +1,6 @@ /* zip_source_buffer.c -- create zip data source from buffer - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -44,13 +44,12 @@ struct read_data { int freep; }; -static ssize_t read_data(void *state, void *data, size_t len, - enum zip_source_cmd cmd); +static zip_int64_t read_data(void *, void *, zip_uint64_t, enum zip_source_cmd); ZIP_EXTERN(struct zip_source *) -zip_source_buffer(struct zip *za, const void *data, off_t len, int freep) +zip_source_buffer(struct zip *za, const void *data, zip_uint64_t len, int freep) { struct read_data *f; struct zip_source *zs; @@ -58,7 +57,7 @@ zip_source_buffer(struct zip *za, const void *data, off_t len, int freep) if (za == NULL) return NULL; - if (len < 0 || (data == NULL && len > 0)) { + if (data == NULL && len > 0) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return NULL; } @@ -83,12 +82,12 @@ zip_source_buffer(struct zip *za, const void *data, off_t len, int freep) -static ssize_t -read_data(void *state, void *data, size_t len, enum zip_source_cmd cmd) +static zip_int64_t +read_data(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) { struct read_data *z; char *buf; - size_t n; + zip_uint64_t n; z = (struct read_data *)state; buf = (char *)data; @@ -99,6 +98,8 @@ read_data(void *state, void *data, size_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; if (n > len) n = len; @@ -125,6 +126,11 @@ read_data(void *state, void *data, size_t len, enum zip_source_cmd cmd) zip_stat_init(st); st->mtime = z->mtime; st->size = z->end - z->data; + st->comp_size = st->size; + st->comp_method = ZIP_CM_STORE; + st->encryption_method = ZIP_EM_NONE; + st->valid = ZIP_STAT_MTIME|ZIP_STAT_SIZE|ZIP_STAT_COMP_SIZE + |ZIP_STAT_COMP_METHOD|ZIP_STAT_ENCRYPTION_METHOD; return sizeof(*st); } diff --git a/ext/zip/lib/zip_source_close.c b/ext/zip/lib/zip_source_close.c new file mode 100644 index 0000000000000..a3bf7e5e1d9bd --- /dev/null +++ b/ext/zip/lib/zip_source_close.c @@ -0,0 +1,54 @@ +/* + zip_source_close.c -- close zip_source (stop reading) + Copyright (C) 2009 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(void) +zip_source_close(struct zip_source *src) +{ + if (!src->is_open) + return; + + if (src->src == NULL) + (void)src->cb.f(src->ud, NULL, 0, ZIP_SOURCE_CLOSE); + else { + (void)src->cb.l(src->src, src->ud, NULL, 0, ZIP_SOURCE_CLOSE); + zip_source_close(src->src); + } + + src->is_open = 0; +} diff --git a/ext/zip/lib/zip_source_crc.c b/ext/zip/lib/zip_source_crc.c new file mode 100644 index 0000000000000..7fd78f56970cf --- /dev/null +++ b/ext/zip/lib/zip_source_crc.c @@ -0,0 +1,159 @@ +/* + zip_source_crc.c -- pass-through source that calculates CRC32 and size + Copyright (C) 2009 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 crc { + int eof; + int validate; + int e[2]; + zip_uint64_t size; + zip_uint32_t crc; +}; + +static zip_int64_t crc_read(struct zip_source *, void *, void * + , zip_uint64_t, enum zip_source_cmd); + + + +ZIP_EXTERN(struct zip_source *) +zip_source_crc(struct zip *za, struct zip_source *src, int validate) +{ + struct crc *ctx; + + if (src == NULL) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((ctx=(struct crc *)malloc(sizeof(*ctx))) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return NULL; + } + + ctx->validate = validate; + + return zip_source_layered(za, src, crc_read, ctx); +} + + + +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; + zip_int64_t n; + + ctx = (struct crc *)_ctx; + + switch (cmd) { + case ZIP_SOURCE_OPEN: + ctx->eof = 0; + ctx->crc = crc32(0, NULL, 0); + ctx->size = 0; + + return 0; + + case ZIP_SOURCE_READ: + if (ctx->eof || len == 0) + return 0; + + if ((n=zip_source_read(src, data, len)) < 0) + return ZIP_SOURCE_ERR_LOWER; + + if (n == 0) { + ctx->eof = 1; + if (ctx->validate) { + struct zip_stat st; + + if (zip_source_stat(src, &st) < 0) + return ZIP_SOURCE_ERR_LOWER; + + if ((st.valid & ZIP_STAT_CRC) && st.crc != ctx->crc) { + ctx->e[0] = ZIP_ER_CRC; + ctx->e[1] = 0; + + return -1; + } + if ((st.valid & ZIP_STAT_SIZE) && st.size != ctx->size) { + ctx->e[0] = ZIP_ER_INCONS; + ctx->e[1] = 0; + + return -1; + } + } + } + else { + ctx->size += n; + ctx->crc = crc32(ctx->crc, data, n); + } + return n; + + case ZIP_SOURCE_CLOSE: + return 0; + + case ZIP_SOURCE_STAT: + { + struct zip_stat *st; + + st = (struct zip_stat *)data; + + if (ctx->eof) { + /* XXX: Set comp_size, comp_method, encryption_method? + After all, this only works for uncompressed data. */ + st->size = ctx->size; + st->crc = ctx->crc; + st->valid |= ZIP_STAT_SIZE|ZIP_STAT_CRC; + } + } + 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_deflate.c b/ext/zip/lib/zip_source_deflate.c new file mode 100644 index 0000000000000..5d9c5e67bb605 --- /dev/null +++ b/ext/zip/lib/zip_source_deflate.c @@ -0,0 +1,394 @@ +/* + zip_source_deflate.c -- deflate (de)compressoin routines + Copyright (C) 2009 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 deflate { + int e[2]; + + int eof; + int mem_level; + zip_uint64_t size; + char buffer[BUFSIZE]; + z_stream zstr; +}; + +static zip_int64_t compress_read(struct zip_source *, struct deflate *, + void *, zip_uint64_t); +static zip_int64_t decompress_read(struct zip_source *, struct deflate *, + void *, zip_uint64_t); +static zip_int64_t deflate_compress(struct zip_source *, void *, void *, + zip_uint64_t, enum zip_source_cmd); +static zip_int64_t deflate_decompress(struct zip_source *, void *, void *, + zip_uint64_t, enum zip_source_cmd); +static void deflate_free(struct deflate *); + + + +ZIP_EXTERN(struct zip_source *) +zip_source_deflate(struct zip *za, struct zip_source *src, + zip_uint16_t cm, int flags) +{ + struct deflate *ctx; + struct zip_source *s2; + + if (src == NULL || cm != ZIP_CM_DEFLATE) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((ctx=(struct deflate *)malloc(sizeof(*ctx))) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return NULL; + } + + ctx->e[0] = ctx->e[1] = 0; + ctx->eof = 0; + if (flags & ZIP_CODEC_ENCODE) { + if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) + ctx->mem_level = TORRENT_MEM_LEVEL; + else + ctx->mem_level = MAX_MEM_LEVEL; + } + + if ((s2=zip_source_layered(za, src, + ((flags & ZIP_CODEC_ENCODE) + ? deflate_compress : deflate_decompress), + ctx)) == NULL) { + deflate_free(ctx); + return NULL; + } + + return s2; +} + + + +static zip_int64_t +compress_read(struct zip_source *src, struct deflate *ctx, + void *data, zip_uint64_t len) +{ + int end, ret; + zip_int64_t n; + + if (ctx->e[0] != 0) + return -1; + + if (len == 0) + return 0; + + ctx->zstr.next_out = (Bytef *)data; + ctx->zstr.avail_out = len; + + end = 0; + while (!end) { + ret = deflate(&ctx->zstr, ctx->eof ? Z_FINISH : 0); + + switch (ret) { + case Z_OK: + case Z_STREAM_END: + /* all ok */ + + if (ctx->zstr.avail_out == 0 + || (ctx->eof && ctx->zstr.avail_in == 0)) + end = 1; + break; + + case Z_BUF_ERROR: + if (ctx->zstr.avail_in == 0) { + if (ctx->eof) { + end = 1; + break; + } + + if ((n=zip_source_read(src, ctx->buffer, + sizeof(ctx->buffer))) < 0) { + zip_source_error(src, ctx->e, ctx->e+1); + end = 1; + break; + } + else if (n == 0) { + ctx->eof = 1; + ctx->size = ctx->zstr.total_in; + /* XXX: check against stat of src? */ + } + else { + ctx->zstr.next_in = (Bytef *)ctx->buffer; + ctx->zstr.avail_in = n; + } + continue; + } + /* fallthrough */ + case Z_NEED_DICT: + case Z_DATA_ERROR: + case Z_STREAM_ERROR: + case Z_MEM_ERROR: + ctx->e[0] = ZIP_ER_ZLIB; + ctx->e[1] = ret; + + end = 1; + break; + } + } + + if (ctx->zstr.avail_out < len) + return len - ctx->zstr.avail_out; + + return (ctx->e[0] == 0) ? 0 : -1; +} + + + +static zip_int64_t +decompress_read(struct zip_source *src, struct deflate *ctx, + void *data, zip_uint64_t len) +{ + int end, ret; + zip_int64_t n; + + if (ctx->e[0] != 0) + return -1; + + if (len == 0) + return 0; + + ctx->zstr.next_out = (Bytef *)data; + ctx->zstr.avail_out = len; + + end = 0; + while (!end && ctx->zstr.avail_out) { + ret = inflate(&ctx->zstr, Z_SYNC_FLUSH); + + switch (ret) { + case Z_OK: + break; + + case Z_STREAM_END: + ctx->eof = 1; + end = 1; + break; + + case Z_BUF_ERROR: + if (ctx->zstr.avail_in == 0) { + if (ctx->eof) { + end = 1; + break; + } + + if ((n=zip_source_read(src, ctx->buffer, + sizeof(ctx->buffer))) < 0) { + zip_source_error(src, ctx->e, ctx->e+1); + end = 1; + break; + } + else if (n == 0) + ctx->eof = 1; + else { + ctx->zstr.next_in = (Bytef *)ctx->buffer; + ctx->zstr.avail_in = n; + } + continue; + } + /* fallthrough */ + case Z_NEED_DICT: + case Z_DATA_ERROR: + case Z_STREAM_ERROR: + case Z_MEM_ERROR: + ctx->e[0] = ZIP_ER_ZLIB; + ctx->e[1] = ret; + end = 1; + break; + } + } + + if (ctx->zstr.avail_out < len) + return len - ctx->zstr.avail_out; + + return (ctx->e[0] == 0) ? 0 : -1; +} + + + +static zip_int64_t +deflate_compress(struct zip_source *src, void *ud, void *data, + zip_uint64_t len, enum zip_source_cmd cmd) +{ + struct deflate *ctx; + int ret; + + ctx = (struct deflate *)ud; + + switch (cmd) { + case ZIP_SOURCE_OPEN: + ctx->zstr.zalloc = Z_NULL; + ctx->zstr.zfree = Z_NULL; + ctx->zstr.opaque = NULL; + ctx->zstr.avail_in = 0; + ctx->zstr.next_in = NULL; + ctx->zstr.avail_out = 0; + ctx->zstr.next_out = NULL; + + /* negative value to tell zlib not to write a header */ + if ((ret=deflateInit2(&ctx->zstr, Z_BEST_COMPRESSION, Z_DEFLATED, + -MAX_WBITS, ctx->mem_level, + Z_DEFAULT_STRATEGY)) != Z_OK) { + ctx->e[0] = ZIP_ER_ZLIB; + ctx->e[1] = ret; + return -1; + } + + return 0; + + case ZIP_SOURCE_READ: + return compress_read(src, ctx, data, len); + + case ZIP_SOURCE_CLOSE: + deflateEnd(&ctx->zstr); + return 0; + + case ZIP_SOURCE_STAT: + { + struct zip_stat *st; + + st = (struct zip_stat *)data; + + st->comp_method = ZIP_CM_DEFLATE; + st->valid |= ZIP_STAT_COMP_METHOD; + if (ctx->eof) { + st->comp_size = ctx->size; + st->valid |= ZIP_STAT_COMP_SIZE; + } + else + st->valid &= ~ZIP_STAT_COMP_SIZE; + } + return 0; + + case ZIP_SOURCE_ERROR: + memcpy(data, ctx->e, sizeof(int)*2); + return sizeof(int)*2; + + case ZIP_SOURCE_FREE: + deflate_free(ctx); + return 0; + + default: + ctx->e[0] = ZIP_ER_INVAL; + ctx->e[1] = 0; + return -1; + } +} + + + +static zip_int64_t +deflate_decompress(struct zip_source *src, void *ud, void *data, + zip_uint64_t len, enum zip_source_cmd cmd) +{ + struct deflate *ctx; + zip_int64_t n; + int ret; + + ctx = (struct deflate *)ud; + + switch (cmd) { + case ZIP_SOURCE_OPEN: + if ((n=zip_source_read(src, ctx->buffer, sizeof(ctx->buffer))) < 0) + return ZIP_SOURCE_ERR_LOWER; + + ctx->zstr.zalloc = Z_NULL; + ctx->zstr.zfree = Z_NULL; + ctx->zstr.opaque = NULL; + ctx->zstr.next_in = (Bytef *)ctx->buffer; + ctx->zstr.avail_in = n; + + /* negative value to tell zlib that there is no header */ + if ((ret=inflateInit2(&ctx->zstr, -MAX_WBITS)) != Z_OK) { + ctx->e[0] = ZIP_ER_ZLIB; + ctx->e[1] = ret; + + return -1; + } + return 0; + + case ZIP_SOURCE_READ: + return decompress_read(src, ctx, data, len); + + case ZIP_SOURCE_CLOSE: + inflateEnd(&ctx->zstr); + return 0; + + case ZIP_SOURCE_STAT: + { + struct zip_stat *st; + + st = (struct zip_stat *)data; + + st->comp_method = ZIP_CM_STORE; + if (st->comp_size > 0 && st->size > 0) + st->comp_size = st->size; + } + return 0; + + case ZIP_SOURCE_ERROR: + if (len < sizeof(int)*2) + return -1; + + memcpy(data, ctx->e, sizeof(int)*2); + return sizeof(int)*2; + + case ZIP_SOURCE_FREE: + /* XXX: inflateEnd if close was not called */ + free(ctx); + return 0; + + default: + ctx->e[0] = ZIP_ER_INVAL; + ctx->e[1] = 0; + return -1; + } + +} + + + +static void +deflate_free(struct deflate *ctx) +{ + /* XXX: deflateEnd if close was not called */ + free(ctx); +} diff --git a/ext/zip/lib/zip_source_error.c b/ext/zip/lib/zip_source_error.c new file mode 100644 index 0000000000000..ffb4652d33621 --- /dev/null +++ b/ext/zip/lib/zip_source_error.c @@ -0,0 +1,87 @@ +/* + zip_source_error.c -- get last error from zip_source + Copyright (C) 2009 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(void) +zip_source_error(struct zip_source *src, int *ze, int *se) +{ + int e[2]; + + if (src->src == NULL) { + } + 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; + break; + + case ZIP_LES_INVAL: + e[0] = ZIP_ER_INVAL; + e[1] = 0; + break; + + case ZIP_LES_LOWER: + zip_source_error(src->src, ze, se); + return; + + case ZIP_LES_UPPER: + if (src->cb.l(src->src, src->ud, e, sizeof(e), + ZIP_SOURCE_ERROR) < 0) { + e[0] = ZIP_ER_INTERNAL; + e[1] = 0; + } + break; + + default: + e[0] = ZIP_ER_INTERNAL; + e[1] = 0; + } + } + + if (ze) + *ze = e[0]; + if (se) + *se = e[1]; +} diff --git a/ext/zip/lib/zip_source_file.c b/ext/zip/lib/zip_source_file.c index ab6466dcbd94b..681cc2f3ea643 100644 --- a/ext/zip/lib/zip_source_file.c +++ b/ext/zip/lib/zip_source_file.c @@ -41,15 +41,16 @@ ZIP_EXTERN(struct zip_source *) -zip_source_file(struct zip *za, const char *fname, off_t start, off_t len) +zip_source_file(struct zip *za, const char *fname, zip_uint64_t start, + zip_int64_t len) { if (za == NULL) return NULL; - if (fname == NULL || start < 0 || len < -1) { + if (fname == NULL || len < -1) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return NULL; } - return _zip_source_file_or_p(za, fname, NULL, start, len); + return _zip_source_file_or_p(za, fname, NULL, start, len, 1, NULL); } diff --git a/ext/zip/lib/zip_source_filep.c b/ext/zip/lib/zip_source_filep.c index 2a06a9f028eab..4d896a4c01bfc 100644 --- a/ext/zip/lib/zip_source_filep.c +++ b/ext/zip/lib/zip_source_filep.c @@ -44,19 +44,23 @@ struct read_file { char *fname; /* name of file to copy from */ FILE *f; /* file to copy from */ - off_t off; /* start offset of */ - off_t len; /* lengt of data to copy */ - off_t remain; /* bytes remaining to be copied */ + int closep; /* close f */ + struct zip_stat st; /* stat information passed in */ + + zip_uint64_t off; /* start offset of */ + zip_int64_t len; /* length of data to copy */ + zip_int64_t remain; /* bytes remaining to be copied */ int e[2]; /* error codes */ }; -static ssize_t read_file(void *state, void *data, size_t len, +static zip_int64_t read_file(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd); ZIP_EXTERN(struct zip_source *) -zip_source_filep(struct zip *za, FILE *file, off_t start, off_t len) +zip_source_filep(struct zip *za, FILE *file, zip_uint64_t start, + zip_int64_t len) { if (za == NULL) return NULL; @@ -66,14 +70,15 @@ zip_source_filep(struct zip *za, FILE *file, off_t start, off_t len) return NULL; } - return _zip_source_file_or_p(za, NULL, file, start, len); + return _zip_source_file_or_p(za, NULL, file, start, len, 1, NULL); } struct zip_source * _zip_source_file_or_p(struct zip *za, const char *fname, FILE *file, - off_t start, off_t len) + zip_uint64_t start, zip_int64_t len, int closep, + const struct zip_stat *st) { struct read_file *f; struct zip_source *zs; @@ -99,7 +104,12 @@ _zip_source_file_or_p(struct zip *za, const char *fname, FILE *file, f->f = file; f->off = start; f->len = (len ? len : -1); - + f->closep = f->fname ? 1 : closep; + if (st) + memcpy(&f->st, st, sizeof(f->st)); + else + zip_stat_init(&f->st); + if ((zs=zip_source_function(za, read_file, f)) == NULL) { free(f); return NULL; @@ -110,8 +120,8 @@ _zip_source_file_or_p(struct zip *za, const char *fname, FILE *file, -static ssize_t -read_file(void *state, void *data, size_t len, enum zip_source_cmd cmd) +static zip_int64_t +read_file(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) { struct read_file *z; char *buf; @@ -130,20 +140,33 @@ read_file(void *state, void *data, size_t len, enum zip_source_cmd cmd) } } - if (fseeko(z->f, z->off, SEEK_SET) < 0) { - z->e[0] = ZIP_ER_SEEK; - z->e[1] = errno; - return -1; + if (z->closep) { + if (fseeko(z->f, (off_t)z->off, SEEK_SET) < 0) { + z->e[0] = ZIP_ER_SEEK; + z->e[1] = errno; + return -1; + } } z->remain = z->len; return 0; case ZIP_SOURCE_READ: + /* XXX: return INVAL if len > size_t max */ if (z->remain != -1) n = len > z->remain ? 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) { + 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; @@ -164,34 +187,42 @@ read_file(void *state, void *data, size_t len, enum zip_source_cmd cmd) case ZIP_SOURCE_STAT: { - struct zip_stat *st; - struct stat fst; - int err; - - if (len < sizeof(*st)) + if (len < sizeof(z->st)) return -1; - if (z->f) - err = fstat(fileno(z->f), &fst); - else - err = stat(z->fname, &fst); - - if (err != 0) { - z->e[0] = ZIP_ER_READ; /* best match */ - z->e[1] = errno; - return -1; + if (z->st.valid != 0) + memcpy(data, &z->st, sizeof(z->st)); + else { + struct zip_stat *st; + struct stat fst; + int err; + + if (z->f) + err = fstat(fileno(z->f), &fst); + else + err = stat(z->fname, &fst); + + if (err != 0) { + z->e[0] = ZIP_ER_READ; /* best match */ + z->e[1] = errno; + return -1; + } + + st = (struct zip_stat *)data; + + zip_stat_init(st); + st->mtime = fst.st_mtime; + st->valid |= ZIP_STAT_MTIME; + if (z->len != -1) { + st->size = z->len; + st->valid |= ZIP_STAT_SIZE; + } + else if ((fst.st_mode&S_IFMT) == S_IFREG) { + st->size = fst.st_size; + st->valid |= ZIP_STAT_SIZE; + } } - - st = (struct zip_stat *)data; - - zip_stat_init(st); - st->mtime = fst.st_mtime; - if (z->len != -1) - st->size = z->len; - else if ((fst.st_mode&S_IFMT) == S_IFREG) - st->size = fst.st_size; - - return sizeof(*st); + return sizeof(z->st); } case ZIP_SOURCE_ERROR: @@ -203,8 +234,8 @@ read_file(void *state, void *data, size_t len, enum zip_source_cmd cmd) case ZIP_SOURCE_FREE: free(z->fname); - if (z->f) - fclose(z->f); + if (z->closep && z->f) + fclose(z->f); free(z); return 0; diff --git a/ext/zip/lib/zip_source_free.c b/ext/zip/lib/zip_source_free.c index 293e7f7e114cd..f71c71ed6c577 100644 --- a/ext/zip/lib/zip_source_free.c +++ b/ext/zip/lib/zip_source_free.c @@ -1,6 +1,6 @@ /* zip_source_free.c -- free zip data source - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -40,12 +40,20 @@ ZIP_EXTERN(void) -zip_source_free(struct zip_source *source) +zip_source_free(struct zip_source *src) { - if (source == NULL) + if (src == NULL) return; - (void)source->f(source->ud, NULL, 0, ZIP_SOURCE_FREE); + if (src->is_open) + zip_source_close(src); - free(source); + if (src->src == NULL) + (void)src->cb.f(src->ud, NULL, 0, ZIP_SOURCE_FREE); + else { + (void)src->cb.l(src->src, src->ud, NULL, 0, ZIP_SOURCE_FREE); + zip_source_free(src->src); + } + + free(src); } diff --git a/ext/zip/lib/zip_source_function.c b/ext/zip/lib/zip_source_function.c index fe3e82aa5ba29..984b107f7baa6 100644 --- a/ext/zip/lib/zip_source_function.c +++ b/ext/zip/lib/zip_source_function.c @@ -1,6 +1,6 @@ /* zip_source_function.c -- create zip data source from callback function - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -47,13 +47,32 @@ zip_source_function(struct zip *za, zip_source_callback zcb, void *ud) if (za == NULL) return NULL; - if ((zs=(struct zip_source *)malloc(sizeof(*zs))) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + if ((zs=_zip_source_new(za)) == NULL) return NULL; - } - zs->f = zcb; + zs->cb.f = zcb; zs->ud = ud; return zs; } + + + +struct zip_source * +_zip_source_new(struct zip *za) +{ + struct zip_source *src; + + if ((src=(struct zip_source *)malloc(sizeof(*src))) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return NULL; + } + + src->src = NULL; + src->cb.f = NULL; + src->ud = NULL; + src->error_source = ZIP_LES_NONE; + src->is_open = 0; + + return src; +} diff --git a/ext/zip/lib/zip_source_layered.c b/ext/zip/lib/zip_source_layered.c new file mode 100644 index 0000000000000..86ed420407071 --- /dev/null +++ b/ext/zip/lib/zip_source_layered.c @@ -0,0 +1,59 @@ +/* + zip_source_layered.c -- create layered source + Copyright (C) 2009 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(struct zip_source *) +zip_source_layered(struct zip *za, struct zip_source *src, + zip_source_layered_callback cb, void *ud) +{ + struct zip_source *zs; + + if (za == NULL) + return NULL; + + if ((zs=_zip_source_new(za)) == NULL) + return NULL; + + zs->src = src; + zs->cb.l = cb; + zs->ud = ud; + + return zs; +} diff --git a/ext/zip/lib/zip_source_open.c b/ext/zip/lib/zip_source_open.c new file mode 100644 index 0000000000000..2c768f7f3a4e5 --- /dev/null +++ b/ext/zip/lib/zip_source_open.c @@ -0,0 +1,76 @@ +/* + zip_source_open.c -- open zip_source (prepare for reading) + Copyright (C) 2009 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_source_open(struct zip_source *src) +{ + zip_int64_t ret; + + if (src->is_open) { + src->error_source = ZIP_LES_INVAL; + return -1; + } + + if (src->src == NULL) { + if (src->cb.f(src->ud, NULL, 0, ZIP_SOURCE_OPEN) < 0) + return -1; + } + else { + if (zip_source_open(src->src) < 0) { + src->error_source = ZIP_LES_LOWER; + return -1; + } + + ret = src->cb.l(src->src, src->ud, NULL, 0, ZIP_SOURCE_OPEN); + + if (ret < 0) { + (void)zip_source_close(src->src); + + if (ret == ZIP_SOURCE_ERR_LOWER) + src->error_source = ZIP_LES_LOWER; + else + src->error_source = ZIP_LES_UPPER; + return -1; + } + } + + src->is_open = 1; + + return 0; +} diff --git a/ext/zip/lib/zip_source_pkware.c b/ext/zip/lib/zip_source_pkware.c new file mode 100644 index 0000000000000..83b5cc5ad5b22 --- /dev/null +++ b/ext/zip/lib/zip_source_pkware.c @@ -0,0 +1,241 @@ +/* + zip_source_pkware.c -- Traditional PKWARE de/encryption routines + Copyright (C) 2009 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 trad_pkware { + int e[2]; + + zip_uint32_t key[3]; +}; + +#define HEADERLEN 12 +#define KEY0 305419896 +#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 *, + const zip_uint8_t *, zip_uint64_t, int); +static int decrypt_header(struct zip_source *, struct trad_pkware *); +static zip_int64_t pkware_decrypt(struct zip_source *, void *, void *, + zip_uint64_t, enum zip_source_cmd); +static void pkware_free(struct trad_pkware *); + + + +ZIP_EXTERN(struct zip_source *) +zip_source_pkware(struct zip *za, struct zip_source *src, + zip_uint16_t em, int flags, const char *password) +{ + struct trad_pkware *ctx; + struct zip_source *s2; + + if (password == NULL || src == NULL || em != ZIP_EM_TRAD_PKWARE) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + if (flags & ZIP_CODEC_ENCODE) { + _zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0); + 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; + } + + ctx->e[0] = ctx->e[1] = 0; + + ctx->key[0] = KEY0; + ctx->key[1] = KEY1; + ctx->key[2] = KEY2; + decrypt(ctx, NULL, (const zip_uint8_t *)password, strlen(password), 1); + + if ((s2=zip_source_layered(za, src, pkware_decrypt, ctx)) == NULL) { + pkware_free(ctx); + return NULL; + } + + return s2; +} + + + +static void +decrypt(struct trad_pkware *ctx, zip_uint8_t *out, const zip_uint8_t *in, + zip_uint64_t len, int update_only) +{ + zip_uint16_t tmp; + zip_uint64_t i; + Bytef b; + + for (i=0; ikey[2] | 2; + tmp = (tmp * (tmp ^ 1)) >> 8; + b ^= tmp; + } + + /* store cleartext */ + if (out) + out[i] = b; + + /* update keys */ + ctx->key[0] = CRC32(ctx->key[0], b); + 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); + } +} + + + +static int +decrypt_header(struct zip_source *src, struct trad_pkware *ctx) +{ + zip_uint8_t header[HEADERLEN]; + struct zip_stat st; + zip_int64_t n; + unsigned short dostime, dosdate; + + if ((n=zip_source_read(src, header, HEADERLEN)) < 0) { + zip_source_error(src, ctx->e, ctx->e+1); + return -1; + } + + if (n != HEADERLEN) { + ctx->e[0] = ZIP_ER_EOF; + ctx->e[1] = 0; + return -1; + } + + decrypt(ctx, header, header, HEADERLEN, 0); + + if (zip_source_stat(src, &st) < 0) { + /* stat failed, skip password validation */ + return 0; + } + + _zip_u2d_time(st.mtime, &dostime, &dosdate); + + if (header[HEADERLEN-1] != st.crc>>24 + && header[HEADERLEN-1] != dostime>>8) { + ctx->e[0] = ZIP_ER_WRONGPASSWD; + ctx->e[1] = 0; + return -1; + } + + return 0; +} + + + +static zip_int64_t +pkware_decrypt(struct zip_source *src, void *ud, void *data, + zip_uint64_t len, enum zip_source_cmd cmd) +{ + struct trad_pkware *ctx; + zip_int64_t n; + + ctx = (struct trad_pkware *)ud; + + switch (cmd) { + case ZIP_SOURCE_OPEN: + if (decrypt_header(src, ctx) < 0) + return -1; + return 0; + + case ZIP_SOURCE_READ: + 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, + 0); + return n; + + case ZIP_SOURCE_CLOSE: + return 0; + + case ZIP_SOURCE_STAT: + { + struct zip_stat *st; + + st = (struct zip_stat *)data; + + st->encryption_method = ZIP_EM_NONE; + st->valid |= ZIP_STAT_ENCRYPTION_METHOD; + /* XXX: deduce HEADERLEN from size for uncompressed */ + if (st->valid & ZIP_STAT_COMP_SIZE) + st->comp_size -= HEADERLEN; + } + return 0; + + case ZIP_SOURCE_ERROR: + memcpy(data, ctx->e, sizeof(int)*2); + return sizeof(int)*2; + + case ZIP_SOURCE_FREE: + pkware_free(ctx); + return 0; + + default: + ctx->e[0] = ZIP_ER_INVAL; + ctx->e[1] = 0; + return -1; + } +} + + + +static void +pkware_free(struct trad_pkware *ctx) +{ + free(ctx); +} diff --git a/ext/zip/lib/zip_source_pop.c b/ext/zip/lib/zip_source_pop.c new file mode 100644 index 0000000000000..406093869b962 --- /dev/null +++ b/ext/zip/lib/zip_source_pop.c @@ -0,0 +1,63 @@ +/* + zip_source_pop.c -- pop top layer from zip data source + Copyright (C) 2009 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(struct zip_source *) +zip_source_pop(struct zip_source *src) +{ + struct zip_source *lower; + + if (src == NULL) + return NULL; + + lower = src->src; + + if (lower == NULL) + zip_source_free(src); + else { + if (src->is_open) + (void)src->cb.l(src, src->ud, NULL, 0, ZIP_SOURCE_CLOSE); + (void)src->cb.l(src, src->ud, NULL, 0, ZIP_SOURCE_FREE); + + free(src); + } + + return lower; +} diff --git a/ext/zip/lib/zip_source_read.c b/ext/zip/lib/zip_source_read.c new file mode 100644 index 0000000000000..7246f9ccb5367 --- /dev/null +++ b/ext/zip/lib/zip_source_read.c @@ -0,0 +1,64 @@ +/* + zip_source_read.c -- read data from zip_source + Copyright (C) 2009 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(zip_int64_t) +zip_source_read(struct zip_source *src, void *data, zip_uint64_t len) +{ + zip_int64_t ret; + + if (!src->is_open || len > ZIP_INT64_MAX || (len > 0 && data == NULL)) { + src->error_source = ZIP_LES_INVAL; + return -1; + } + + if (src->src == NULL) + return src->cb.f(src->ud, data, len, ZIP_SOURCE_READ); + + ret = src->cb.l(src->src, src->ud, data, len, ZIP_SOURCE_READ); + + if (ret < 0) { + if (ret == ZIP_SOURCE_ERR_LOWER) + src->error_source = ZIP_LES_LOWER; + else + src->error_source = ZIP_LES_UPPER; + return -1; + } + + return ret; +} diff --git a/ext/zip/lib/zip_source_stat.c b/ext/zip/lib/zip_source_stat.c new file mode 100644 index 0000000000000..662779eb6cfba --- /dev/null +++ b/ext/zip/lib/zip_source_stat.c @@ -0,0 +1,72 @@ +/* + zip_source_stat.c -- get meta information from zip_source + Copyright (C) 2009 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_source_stat(struct zip_source *src, struct zip_stat *st) +{ + zip_int64_t ret; + + if (st == NULL) { + src->error_source = ZIP_LES_INVAL; + return -1; + } + + if (src->src == NULL) { + if (src->cb.f(src->ud, st, sizeof(*st), ZIP_SOURCE_STAT) < 0) + return -1; + return 0; + } + + if (zip_source_stat(src->src, st) < 0) { + src->error_source = ZIP_LES_LOWER; + return -1; + } + + ret = src->cb.l(src->src, src->ud, st, sizeof(*st), ZIP_SOURCE_STAT); + + if (ret < 0) { + if (ret == ZIP_SOURCE_ERR_LOWER) + src->error_source = ZIP_LES_LOWER; + else + src->error_source = ZIP_LES_UPPER; + return -1; + } + + return 0; +} diff --git a/ext/zip/lib/zip_source_zip.c b/ext/zip/lib/zip_source_zip.c index 58119dd39f34c..228803c717f6a 100644 --- a/ext/zip/lib/zip_source_zip.c +++ b/ext/zip/lib/zip_source_zip.c @@ -1,6 +1,6 @@ /* zip_source_zip.c -- create data source from zip file - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -41,17 +41,18 @@ struct read_zip { struct zip_file *zf; struct zip_stat st; - off_t off, len; + zip_uint64_t off; + zip_int64_t len; }; -static ssize_t read_zip(void *st, void *data, size_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_source_zip(struct zip *za, struct zip *srcza, int srcidx, int flags, - off_t start, off_t len) +zip_source_zip(struct zip *za, struct zip *srcza, zip_uint64_t srcidx, + int flags, zip_uint64_t start, zip_int64_t len) { struct zip_error error; struct zip_source *zs; @@ -62,7 +63,7 @@ zip_source_zip(struct zip *za, struct zip *srcza, int srcidx, int flags, if (za == NULL) return NULL; - if (srcza == NULL || start < 0 || len < -1 || srcidx < 0 || srcidx >= srcza->nentry) { + if (srcza == NULL || len < -1 || srcidx < 0 || srcidx >= srcza->nentry) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return NULL; } @@ -115,12 +116,13 @@ zip_source_zip(struct zip *za, struct zip *srcza, int srcidx, int flags, -static ssize_t -read_zip(void *state, void *data, size_t len, enum zip_source_cmd cmd) +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, n; + int i; + zip_uint64_t n; z = (struct read_zip *)state; buf = (char *)data; diff --git a/ext/zip/lib/zip_stat_index.c b/ext/zip/lib/zip_stat_index.c index 26425206ca332..8faa8cc394972 100644 --- a/ext/zip/lib/zip_stat_index.c +++ b/ext/zip/lib/zip_stat_index.c @@ -1,6 +1,6 @@ /* zip_stat_index.c -- get information about file by index - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -38,11 +38,12 @@ ZIP_EXTERN(int) -zip_stat_index(struct zip *za, int index, int flags, struct zip_stat *st) +zip_stat_index(struct zip *za, zip_uint64_t index, int flags, + struct zip_stat *st) { const char *name; - if (index < 0 || index >= za->nentry) { + if (index >= za->nentry) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } @@ -53,8 +54,7 @@ zip_stat_index(struct zip *za, int index, int flags, struct zip_stat *st) if ((flags & ZIP_FL_UNCHANGED) == 0 && ZIP_ENTRY_DATA_CHANGED(za->entry+index)) { - if (za->entry[index].source->f(za->entry[index].source->ud, - st, sizeof(*st), ZIP_SOURCE_STAT) < 0) { + if (zip_source_stat(za->entry[index].source, st) < 0) { _zip_error_set(&za->error, ZIP_ER_CHANGED, 0); return -1; } @@ -64,7 +64,9 @@ zip_stat_index(struct zip *za, int index, int flags, struct zip_stat *st) _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; @@ -80,11 +82,13 @@ zip_stat_index(struct zip *za, int index, int flags, struct zip_stat *st) } else st->encryption_method = ZIP_EM_NONE; - /* st->bitflags = za->cdir->entry[index].bitflags; */ + st->valid = ZIP_STAT_CRC|ZIP_STAT_SIZE|ZIP_STAT_MTIME + |ZIP_STAT_COMP_SIZE|ZIP_STAT_COMP_METHOD|ZIP_STAT_ENCRYPTION_METHOD; } st->index = index; st->name = name; + st->valid |= ZIP_STAT_INDEX|ZIP_STAT_NAME; return 0; } diff --git a/ext/zip/lib/zip_stat_init.c b/ext/zip/lib/zip_stat_init.c index cb451dc3bcaad..74e1ffd0b0dce 100644 --- a/ext/zip/lib/zip_stat_init.c +++ b/ext/zip/lib/zip_stat_init.c @@ -1,6 +1,6 @@ /* zip_stat_init.c -- initialize struct zip_stat. - Copyright (C) 2006-2007 Dieter Baron and Thomas Klausner + Copyright (C) 2006-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -40,12 +40,13 @@ ZIP_EXTERN(void) zip_stat_init(struct zip_stat *st) { + st->valid = 0; st->name = NULL; - st->index = -1; + st->index = ZIP_UINT64_MAX; st->crc = 0; st->mtime = (time_t)-1; - st->size = -1; - st->comp_size = -1; + st->size = 0; + st->comp_size = 0; st->comp_method = ZIP_CM_STORE; st->encryption_method = ZIP_EM_NONE; } diff --git a/ext/zip/lib/zip_unchange.c b/ext/zip/lib/zip_unchange.c index 7366c9cc7164e..550e8b99031f2 100644 --- a/ext/zip/lib/zip_unchange.c +++ b/ext/zip/lib/zip_unchange.c @@ -40,7 +40,7 @@ ZIP_EXTERN(int) -zip_unchange(struct zip *za, int idx) +zip_unchange(struct zip *za, zip_uint64_t idx) { return _zip_unchange(za, idx, 0); } @@ -48,11 +48,11 @@ zip_unchange(struct zip *za, int idx) int -_zip_unchange(struct zip *za, int idx, int allow_duplicates) +_zip_unchange(struct zip *za, zip_uint64_t idx, int allow_duplicates) { int i; - if (idx < 0 || idx >= za->nentry) { + if (idx >= za->nentry) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } @@ -72,6 +72,9 @@ _zip_unchange(struct zip *za, int idx, int allow_duplicates) 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; diff --git a/ext/zip/lib/zip_unchange_archive.c b/ext/zip/lib/zip_unchange_archive.c index fe30a5ad2c16b..ca2b67854435a 100644 --- a/ext/zip/lib/zip_unchange_archive.c +++ b/ext/zip/lib/zip_unchange_archive.c @@ -1,6 +1,6 @@ /* zip_unchange_archive.c -- undo global changes to ZIP archive - Copyright (C) 2006-2009 Dieter Baron and Thomas Klausner + Copyright (C) 2006-2008 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at diff --git a/ext/zip/lib/zip_unchange_data.c b/ext/zip/lib/zip_unchange_data.c index 6fe89f4fb2b78..7dd93b768a87a 100644 --- a/ext/zip/lib/zip_unchange_data.c +++ b/ext/zip/lib/zip_unchange_data.c @@ -43,8 +43,7 @@ void _zip_unchange_data(struct zip_entry *ze) { if (ze->source) { - (void)ze->source->f(ze->source->ud, NULL, 0, ZIP_SOURCE_FREE); - free(ze->source); + zip_source_free(ze->source); ze->source = NULL; } diff --git a/ext/zip/lib/zipconf.h b/ext/zip/lib/zipconf.h new file mode 100644 index 0000000000000..2b4340c861c51 --- /dev/null +++ b/ext/zip/lib/zipconf.h @@ -0,0 +1,51 @@ +#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 + +#ifdef PHP_WIN32 +#include +#else +#include +#endif + +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 */ diff --git a/ext/zip/lib/zipint.h b/ext/zip/lib/zipint.h index d72ed144d422d..ea21dddcd4257 100644 --- a/ext/zip/lib/zipint.h +++ b/ext/zip/lib/zipint.h @@ -3,7 +3,7 @@ /* zipint.h -- internal declarations. - Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2011 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -38,12 +38,37 @@ #include "zip.h" +#ifndef HAVE_FSEEKO +#define fseeko(s, o, w) (fseek((s), (long int)(o), (w))) +#endif + +#ifndef HAVE_FTELLO +#define ftello(s) ((long)ftell((s))) +#endif + +#ifndef PHP_WIN32 +#ifndef HAVE_MKSTEMP +int _zip_mkstemp(char *); +#define mkstemp _zip_mkstemp +#endif +#endif + #ifdef PHP_WIN32 #include #include #define _zip_rename(s, t) \ (!MoveFileExA((s), (t), \ MOVEFILE_COPY_ALLOWED|MOVEFILE_REPLACE_EXISTING)) + +/* for dup(), close(), etc. */ +#include + +#if !defined(HAVE_OPEN) +#if defined(HAVE__OPEN) +#define open(a, b, c) _open((a), (b)) +#endif +#endif + #else #define _zip_rename rename #endif @@ -52,12 +77,6 @@ # define strcmpi strcasecmp #endif -#ifndef HAVE_FSEEKO -#define fseeko(s, o, w) (fseek((s), (long int)(o), (w))) -#endif -#ifndef HAVE_FTELLO -#define ftello(s) ((long)ftell((s))) -#endif @@ -73,22 +92,77 @@ #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 BUFSIZE 8192 +/* This section contains API that won't materialize like this. It's + placed in the internal section, pending cleanup. */ + +typedef struct zip_source *(*zip_compression_implementation)(struct zip *, + struct zip_source *, + zip_uint16_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); + + + + +/* 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. */ + +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 *); + + +/* 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 *); + + + /* 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 }; -/* constants for struct zip_file's member flags */ +/* error source for layered sources */ -#define ZIP_ZF_EOF 1 /* EOF reached */ -#define ZIP_ZF_DECOMP 2 /* decompress data */ -#define ZIP_ZF_CRC 4 /* compute and compare CRC */ +enum zip_les { ZIP_LES_NONE, ZIP_LES_UPPER, ZIP_LES_LOWER, ZIP_LES_INVAL }; /* directory entry: general purpose bit flags */ @@ -114,12 +188,14 @@ struct zip { 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 */ - int nentry; /* number of entries */ - int nentry_alloc; /* number of entries allocated */ + 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 */ @@ -131,18 +207,8 @@ struct zip { struct zip_file { struct zip *za; /* zip archive containing this file */ struct zip_error error; /* error information */ - int flags; /* -1: eof, >0: error */ - - int method; /* compression method */ - off_t fpos; /* position within zip file (fread/fwrite) */ - unsigned long bytes_left; /* number of bytes left to read */ - unsigned long cbytes_left; /* number of bytes of compressed data left */ - - unsigned long crc; /* CRC so far */ - unsigned long crc_orig; /* CRC recorded in archive */ - - char *buffer; - z_stream *zstr; + int eof; + struct zip_source *src; /* data source */ }; /* zip archive directory entry (central or local) */ @@ -183,8 +249,14 @@ struct zip_cdir { struct zip_source { - zip_source_callback f; + struct zip_source *src; + union { + zip_source_callback f; + zip_source_layered_callback l; + } cb; void *ud; + enum zip_les error_source; + int is_open; }; /* entry in zip archive directory */ @@ -193,6 +265,8 @@ struct zip_entry { enum zip_state state; struct zip_source *source; char *ch_filename; + char *ch_extra; + int ch_extra_len; char *ch_comment; int ch_comment_len; }; @@ -209,6 +283,8 @@ extern const int _zip_err_type[]; ((x)->state == ZIP_ST_REPLACED \ || (x)->state == ZIP_ST_ADDED) +#define ZIP_IS_RDONLY(za) ((za)->ch_flags & ZIP_AFL_RDONLY) + int _zip_cdir_compute_crc(struct zip *, uLong *); @@ -220,7 +296,7 @@ int _zip_cdir_write(struct zip_cdir *, FILE *, struct zip_error *); void _zip_dirent_finalize(struct zip_dirent *); void _zip_dirent_init(struct zip_dirent *); int _zip_dirent_read(struct zip_dirent *, FILE *, unsigned char **, - unsigned int *, int, struct zip_error *); + zip_uint32_t *, int, struct zip_error *); void _zip_dirent_torrent_normalize(struct zip_dirent *); int _zip_dirent_write(struct zip_dirent *, FILE *, int, struct zip_error *); @@ -234,6 +310,7 @@ void _zip_error_fini(struct zip_error *); void _zip_error_get(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 *); int _zip_file_fillbuf(void *, size_t, struct zip_file *); @@ -241,20 +318,27 @@ unsigned int _zip_file_get_offset(struct zip *, int); 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_source *_zip_source_file_or_p(struct zip *, const char *, FILE *, - off_t, off_t); + 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 *, int, int, struct zip_error *); +const char *_zip_get_name(struct zip *, zip_uint64_t, int, 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 *); struct zip *_zip_new(struct zip_error *); unsigned short _zip_read2(unsigned char **); unsigned int _zip_read4(unsigned char **); -int _zip_replace(struct zip *, int, const char *, struct zip_source *); -int _zip_set_name(struct zip *, int, const char *); -int _zip_unchange(struct zip *, int, int); +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 *); +int _zip_unchange(struct zip *, zip_uint64_t, int); void _zip_unchange_data(struct zip_entry *); #endif /* zipint.h */ diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 55386558b65b4..74f868b5c3320 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -1152,7 +1152,13 @@ static void php_zip_free_entry(zend_rsrc_list_entry *rsrc TSRMLS_DC) if (zr_rsrc) { if (zr_rsrc->zf) { - zip_fclose(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); + } zr_rsrc->zf = NULL; } efree(zr_rsrc); @@ -1321,9 +1327,8 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_open) } /* }}} */ -/* {{{ proto void zip_entry_close(resource zip_ent) +/* {{{ proto bool zip_entry_close(resource zip_ent) Close a zip entry */ -/* another dummy function to fit in the old api*/ static PHP_NAMED_FUNCTION(zif_zip_entry_close) { zval * zip_entry; @@ -1334,8 +1339,8 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_close) } ZEND_FETCH_RESOURCE(zr_rsrc, zip_read_rsrc *, &zip_entry, -1, le_zip_entry_name, le_zip_entry); - /* we got a zip_entry resource, be happy */ - RETURN_TRUE; + + RETURN_BOOL(SUCCESS == zend_list_delete(Z_LVAL_P(zip_entry))); } /* }}} */ @@ -2863,7 +2868,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, "Libzip version", "0.9.0"); + 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 a321d90b04578..f848ade8bc54e 100644 --- a/ext/zip/php_zip.h +++ b/ext/zip/php_zip.h @@ -30,7 +30,7 @@ extern zend_module_entry zip_module_entry; #include "lib/zip.h" -#define PHP_ZIP_VERSION_STRING "1.9.1" +#define PHP_ZIP_VERSION_STRING "1.11.0" #if ((PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 2) || PHP_MAJOR_VERSION >= 6) # define PHP_ZIP_USE_OO 1 diff --git a/ext/zip/tests/pecl12414.phpt b/ext/zip/tests/pecl12414.phpt index ab11d21a637c6..61546386ab7ee 100644 --- a/ext/zip/tests/pecl12414.phpt +++ b/ext/zip/tests/pecl12414.phpt @@ -35,5 +35,4 @@ if ($res === TRUE) { ?> --DONE-- --EXPECTF-- -ZIP contents size: %d -zip_readfile recorded data does not match unpacked size: %specl12414.zip : MYLOGOV2.GFX +zip_readfile could not read from %specl12414.zip : MYLOGOV2.GFX diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h index 3d8c90cbf5034..e895e0e48264b 100644 --- a/ext/zlib/php_zlib.h +++ b/ext/zlib/php_zlib.h @@ -54,6 +54,8 @@ ZEND_BEGIN_MODULE_GLOBALS(zlib) long output_compression_level; char *output_handler; php_zlib_context *ob_gzhandler; + long output_compression_default; + zend_bool handler_registered; ZEND_END_MODULE_GLOBALS(zlib); php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); diff --git a/ext/zlib/tests/bug55544.phpt b/ext/zlib/tests/bug55544.phpt new file mode 100644 index 0000000000000..ca4214a46fbb1 Binary files /dev/null and b/ext/zlib/tests/bug55544.phpt differ diff --git a/ext/zlib/tests/bug_52944.phpt b/ext/zlib/tests/bug_52944.phpt index 850371190e07b..c090fe6f5c887 100644 --- a/ext/zlib/tests/bug_52944.phpt +++ b/ext/zlib/tests/bug_52944.phpt @@ -2,6 +2,11 @@ Bug #52944 (segfault with zlib filter and corrupted data) --SKIPIF-- += 1.2.7 on windows'); +} --INI-- allow_url_fopen=1 --FILE-- diff --git a/ext/zlib/tests/func.inc b/ext/zlib/tests/func.inc new file mode 100644 index 0000000000000..0a422cab780f1 --- /dev/null +++ b/ext/zlib/tests/func.inc @@ -0,0 +1,17 @@ + (\d+\.\d+\.\d+),s', $info, $match)) { + $version = $match[1]; + } + + return $version; +} + diff --git a/ext/zlib/tests/gzgetc_basic.phpt b/ext/zlib/tests/gzgetc_basic.phpt index ca2e38c0ecf3e..5c814e0d1a5d4 100644 --- a/ext/zlib/tests/gzgetc_basic.phpt +++ b/ext/zlib/tests/gzgetc_basic.phpt @@ -1,10 +1,14 @@ --TEST-- -Test function gzgetc() by calling it with its expected arguments +Test function gzgetc() by calling it with its expected arguments zlib 1.2.5 --SKIPIF-- 0) { + die('skip - only for zlib <= 1.2.5'); +} ?> --FILE-- = 1.2.7'); +} +?> +--FILE-- + +===DONE=== +--EXPECT-- +When you're taught through feelings +Destiny flying high above +all I know is that you can realize it +Destiny who cares +as it turns around +and I know that it descends down on me + +characters counted=176 +===DONE=== diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 283ac5a166c30..7ff2b30c4c4e7 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -13,7 +13,7 @@ | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Rasmus Lerdorf | - | Stefan R�hrich | + | Stefan Röhrich | | Zeev Suraski | | Jade Nicoletti | | Michael Wallner | @@ -263,6 +263,8 @@ static php_output_handler *php_zlib_output_handler_init(const char *handler_name ZLIBG(output_compression) = chunk_size ? chunk_size : PHP_OUTPUT_HANDLER_DEFAULT_SIZE; } + ZLIBG(handler_registered) = 1; + if ((h = php_output_handler_create_internal(handler_name, handler_name_len, php_zlib_output_handler, chunk_size, flags TSRMLS_CC))) { php_output_handler_set_context(h, php_zlib_output_handler_context_init(TSRMLS_C), php_zlib_output_handler_context_dtor TSRMLS_CC); } @@ -284,7 +286,8 @@ static void php_zlib_output_compression_start(TSRMLS_D) ZLIBG(output_compression) = PHP_OUTPUT_HANDLER_DEFAULT_SIZE; /* break omitted intentionally */ default: - if ( (h = php_zlib_output_handler_init(ZEND_STRL(PHP_ZLIB_OUTPUT_HANDLER_NAME), ZLIBG(output_compression), PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC)) && + if ( php_zlib_output_encoding(TSRMLS_C) && + (h = php_zlib_output_handler_init(ZEND_STRL(PHP_ZLIB_OUTPUT_HANDLER_NAME), ZLIBG(output_compression), PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC)) && (SUCCESS == php_output_handler_start(h TSRMLS_CC))) { if (ZLIBG(output_handler) && *ZLIBG(output_handler)) { MAKE_STD_ZVAL(zoh); @@ -689,6 +692,7 @@ PHP_ZLIB_ENCODE_FUNC(zlib_encode, 0); /* {{{ proto binary zlib_decode(binary data[, int max_decoded_len]) Uncompress any raw/gzip/zlib encoded data */ PHP_ZLIB_DECODE_FUNC(zlib_decode, PHP_ZLIB_ENCODING_ANY); +/* }}} */ /* NOTE: The naming of these userland functions was quite unlucky */ /* {{{ proto binary gzdeflate(binary data[, int level = -1[, int encoding = ZLIB_ENCODING_RAW]) @@ -700,18 +704,22 @@ PHP_ZLIB_ENCODE_FUNC(gzdeflate, PHP_ZLIB_ENCODING_RAW); Encode data with the gzip encoding */ PHP_ZLIB_ENCODE_FUNC(gzencode, PHP_ZLIB_ENCODING_GZIP); /* }}} */ + /* {{{ proto binary gzcompress(binary data[, int level = -1[, int encoding = ZLIB_ENCODING_DEFLATE]) Encode data with the zlib encoding */ PHP_ZLIB_ENCODE_FUNC(gzcompress, PHP_ZLIB_ENCODING_DEFLATE); /* }}} */ + /* {{{ proto binary gzinflate(binary data[, int max_decoded_len]) Decode raw deflate encoded data */ PHP_ZLIB_DECODE_FUNC(gzinflate, PHP_ZLIB_ENCODING_RAW); /* }}} */ + /* {{{ proto binary gzdecode(binary data[, int max_decoded_len]) Decode gzip encoded data */ PHP_ZLIB_DECODE_FUNC(gzdecode, PHP_ZLIB_ENCODING_GZIP); /* }}} */ + /* {{{ proto binary gzuncompress(binary data[, int max_decoded_len]) Decode zlib encoded data */ PHP_ZLIB_DECODE_FUNC(gzuncompress, PHP_ZLIB_ENCODING_DEFLATE); @@ -889,6 +897,7 @@ static PHP_INI_MH(OnUpdate_zlib_output_compression) status = OnUpdateLong(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + ZLIBG(output_compression) = ZLIBG(output_compression_default); if (stage == PHP_INI_STAGE_RUNTIME && int_value) { if (!php_output_handler_started(ZEND_STRL(PHP_ZLIB_OUTPUT_HANDLER_NAME) TSRMLS_CC)) { php_zlib_output_compression_start(TSRMLS_C); @@ -913,7 +922,7 @@ static PHP_INI_MH(OnUpdate_zlib_output_handler) /* {{{ INI */ PHP_INI_BEGIN() - STD_PHP_INI_BOOLEAN("zlib.output_compression", "0", PHP_INI_ALL, OnUpdate_zlib_output_compression, output_compression, zend_zlib_globals, zlib_globals) + STD_PHP_INI_BOOLEAN("zlib.output_compression", "0", PHP_INI_ALL, OnUpdate_zlib_output_compression, output_compression_default, zend_zlib_globals, zlib_globals) STD_PHP_INI_ENTRY("zlib.output_compression_level", "-1", PHP_INI_ALL, OnUpdateLong, output_compression_level, zend_zlib_globals, zlib_globals) STD_PHP_INI_ENTRY("zlib.output_handler", "", PHP_INI_ALL, OnUpdate_zlib_output_handler, output_handler, zend_zlib_globals, zlib_globals) PHP_INI_END() @@ -957,21 +966,24 @@ static PHP_MSHUTDOWN_FUNCTION(zlib) static PHP_RINIT_FUNCTION(zlib) { ZLIBG(compression_coding) = 0; - - php_zlib_output_compression_start(TSRMLS_C); + if (!ZLIBG(handler_registered)) { + ZLIBG(output_compression) = ZLIBG(output_compression_default); + php_zlib_output_compression_start(TSRMLS_C); + } return SUCCESS; } /* }}} */ +/* {{{ PHP_RSHUTDOWN_FUNCTION */ static PHP_RSHUTDOWN_FUNCTION(zlib) { - ZLIBG(output_compression) = 0; - php_zlib_cleanup_ob_gzhandler_mess(TSRMLS_C); + ZLIBG(handler_registered) = 0; return SUCCESS; } +/* }}} */ /* {{{ PHP_MINFO_FUNCTION */ static PHP_MINFO_FUNCTION(zlib) @@ -992,6 +1004,7 @@ static PHP_MINFO_FUNCTION(zlib) static ZEND_MODULE_GLOBALS_CTOR_D(zlib) { zlib_globals->ob_gzhandler = NULL; + zlib_globals->handler_registered = 0; } /* }}} */ diff --git a/main/logos.h b/main/logos.h deleted file mode 100644 index 3b65cbbcf32c5..0000000000000 --- a/main/logos.h +++ /dev/null @@ -1,1080 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2012 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: | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#define CONTEXT_TYPE_IMAGE_GIF "Content-Type: image/gif" - -static const unsigned char zend_logo[] = { - 71, 73, 70, 56, 57, 97, 113, 0, 72, 0, - 213, 0, 0, 13, 13, 14, 1, 3, 6, 2, - 5, 9, 46, 68, 94, 21, 29, 39, 5, 15, - 26, 4, 10, 17, 29, 43, 58, 0, 1, 2, - 9, 25, 42, 38, 105, 171, 24, 67, 109, 13, - 36, 59, 10, 27, 45, 9, 25, 41, 35, 96, - 157, 32, 87, 142, 29, 79, 130, 26, 70, 114, - 20, 54, 87, 29, 77, 124, 10, 26, 42, 34, - 88, 141, 10, 24, 38, 11, 26, 41, 1, 2, - 3, 55, 80, 105, 45, 63, 81, 49, 53, 57, - 5, 15, 24, 9, 26, 42, 30, 85, 138, 33, - 92, 149, 26, 73, 117, 10, 28, 45, 32, 89, - 142, 30, 84, 134, 26, 72, 115, 15, 42, 67, - 23, 62, 99, 12, 32, 51, 7, 21, 33, 9, - 26, 41, 8, 23, 35, 7, 25, 37, 51, 58, - 63, 2, 4, 5, 25, 26, 26, 49, 50, 50, - 255, 102, 0, 255, 255, 255, 204, 204, 204, 199, - 199, 199, 191, 191, 191, 171, 171, 171, 146, 146, - 146, 115, 115, 115, 85, 85, 85, 60, 60, 60, - 55, 55, 55, 38, 38, 38, 7, 7, 7, 3, - 3, 3, 0, 0, 0, 44, 0, 0, 0, 0, - 113, 0, 72, 0, 0, 6, 255, 192, 153, 112, - 72, 44, 26, 143, 200, 164, 114, 121, 252, 49, - 159, 208, 168, 148, 248, 171, 58, 167, 210, 171, - 208, 170, 197, 122, 191, 70, 109, 23, 140, 236, - 138, 201, 232, 239, 121, 102, 221, 186, 217, 219, - 171, 83, 46, 110, 15, 207, 235, 180, 190, 124, - 135, 187, 229, 127, 127, 128, 112, 121, 108, 118, - 132, 123, 137, 77, 118, 120, 136, 115, 109, 117, - 85, 126, 147, 147, 128, 99, 138, 137, 99, 107, - 146, 146, 148, 133, 159, 125, 136, 152, 163, 151, - 135, 121, 144, 84, 157, 92, 169, 157, 111, 163, - 175, 176, 83, 151, 177, 180, 181, 161, 182, 184, - 185, 186, 187, 188, 189, 67, 54, 56, 58, 56, - 53, 190, 197, 88, 55, 57, 60, 63, 2, 43, - 2, 56, 198, 208, 74, 192, 58, 0, 63, 5, - 12, 11, 35, 35, 12, 47, 209, 222, 67, 53, - 201, 203, 34, 19, 20, 218, 231, 37, 63, 54, - 223, 222, 60, 2, 216, 231, 241, 231, 206, 76, - 193, 55, 236, 176, 63, 39, 242, 252, 35, 40, - 58, 75, 114, 8, 40, 240, 227, 25, 62, 76, - 60, 24, 244, 147, 55, 161, 202, 11, 24, 57, - 134, 17, 201, 241, 99, 130, 191, 130, 7, 21, - 225, 48, 176, 48, 30, 137, 5, 11, 38, 48, - 88, 81, 5, 198, 51, 138, 22, 181, 53, 52, - 152, 49, 141, 141, 31, 230, 58, 46, 60, 129, - 194, 74, 202, 115, 43, 91, 234, 1, 112, 83, - 102, 63, 255, 18, 38, 122, 226, 252, 145, 67, - 39, 153, 26, 47, 68, 248, 92, 186, 176, 97, - 81, 163, 88, 108, 188, 48, 80, 130, 169, 85, - 134, 68, 161, 74, 177, 1, 160, 0, 137, 171, - 96, 135, 62, 213, 186, 132, 171, 215, 176, 104, - 71, 52, 188, 71, 54, 9, 210, 179, 105, 195, - 166, 99, 219, 214, 198, 58, 34, 48, 12, 124, - 213, 38, 163, 175, 223, 191, 50, 22, 132, 216, - 139, 182, 132, 0, 30, 196, 250, 218, 37, 70, - 198, 198, 141, 199, 144, 31, 223, 253, 114, 163, - 10, 0, 97, 192, 126, 100, 59, 7, 24, 176, - 10, 20, 229, 210, 146, 48, 128, 88, 72, 223, - 28, 57, 38, 111, 197, 17, 163, 181, 235, 215, - 58, 116, 68, 100, 60, 5, 134, 136, 18, 19, - 80, 24, 168, 162, 48, 94, 95, 21, 6, 82, - 168, 80, 209, 215, 128, 1, 20, 39, 8, 95, - 37, 81, 160, 180, 105, 25, 177, 233, 62, 1, - 246, 186, 186, 245, 24, 209, 177, 84, 140, 71, - 97, 130, 114, 109, 33, 76, 48, 152, 176, 192, - 111, 135, 20, 222, 211, 54, 167, 61, 163, 111, - 246, 39, 55, 174, 203, 175, 254, 30, 74, 229, - 152, 62, 73, 132, 24, 60, 162, 47, 131, 14, - 12, 132, 224, 155, 95, 130, 145, 208, 89, 129, - 40, 116, 211, 25, 12, 58, 72, 135, 68, 124, - 214, 197, 38, 161, 14, 243, 73, 200, 222, 18, - 27, 161, 213, 215, 4, 159, 37, 199, 255, 25, - 96, 12, 116, 230, 223, 9, 11, 252, 32, 226, - 11, 13, 74, 35, 223, 132, 19, 174, 24, 27, - 75, 76, 192, 128, 66, 88, 126, 161, 160, 66, - 122, 124, 201, 112, 2, 3, 195, 125, 54, 65, - 95, 29, 4, 87, 227, 9, 126, 233, 192, 3, - 12, 125, 161, 232, 160, 93, 207, 184, 200, 98, - 139, 17, 74, 24, 197, 118, 96, 249, 7, 160, - 128, 31, 242, 72, 30, 72, 33, 244, 149, 2, - 122, 229, 201, 0, 224, 105, 60, 52, 216, 23, - 131, 14, 226, 96, 194, 1, 78, 74, 152, 195, - 13, 196, 208, 192, 90, 148, 177, 217, 7, 83, - 149, 50, 112, 136, 220, 94, 34, 22, 216, 159, - 12, 195, 101, 227, 37, 113, 50, 192, 0, 3, - 156, 238, 165, 72, 196, 11, 21, 178, 184, 228, - 117, 19, 66, 145, 225, 85, 53, 222, 72, 152, - 136, 42, 152, 32, 224, 111, 42, 8, 10, 40, - 161, 101, 222, 96, 67, 95, 61, 40, 58, 3, - 13, 55, 24, 112, 221, 101, 19, 226, 64, 131, - 17, 54, 64, 42, 229, 19, 50, 226, 249, 95, - 128, 127, 238, 23, 166, 113, 194, 105, 250, 103, - 160, 191, 18, 90, 232, 13, 59, 0, 249, 130, - 168, 56, 160, 198, 195, 10, 214, 161, 144, 1, - 131, 245, 21, 1, 33, 125, 177, 141, 181, 4, - 149, 76, 137, 232, 23, 3, 38, 132, 9, 216, - 9, 93, 126, 234, 105, 160, 34, 94, 208, 129, - 14, 7, 152, 112, 255, 2, 4, 40, 84, 80, - 157, 8, 30, 176, 154, 195, 133, 68, 200, 250, - 34, 124, 119, 102, 171, 109, 113, 157, 142, 16, - 238, 111, 160, 113, 58, 110, 167, 38, 252, 213, - 192, 193, 12, 72, 32, 193, 3, 15, 128, 192, - 128, 7, 175, 121, 32, 66, 7, 101, 230, 240, - 42, 18, 53, 216, 171, 131, 106, 73, 224, 32, - 0, 88, 221, 217, 216, 227, 200, 190, 234, 39, - 210, 112, 12, 36, 23, 158, 175, 254, 154, 160, - 105, 9, 5, 236, 88, 129, 7, 41, 83, 240, - 65, 195, 32, 56, 236, 128, 107, 14, 36, 208, - 64, 10, 24, 41, 161, 177, 181, 74, 84, 182, - 194, 4, 85, 45, 181, 239, 134, 11, 236, 165, - 31, 151, 95, 233, 199, 223, 8, 82, 27, 40, - 3, 9, 39, 144, 56, 24, 4, 92, 119, 61, - 129, 3, 96, 135, 221, 128, 8, 12, 0, 64, - 239, 47, 26, 59, 88, 52, 53, 227, 132, 182, - 208, 210, 128, 178, 76, 163, 12, 46, 135, 208, - 245, 221, 92, 3, 21, 54, 216, 9, 152, 208, - 48, 64, 72, 12, 237, 197, 52, 0, 152, 208, - 209, 111, 193, 141, 204, 239, 102, 104, 45, 96, - 128, 9, 20, 224, 45, 249, 215, 97, 51, 240, - 1, 8, 10, 152, 80, 20, 14, 56, 208, 213, - 38, 199, 181, 245, 214, 207, 111, 96, 130, 4, - 146, 72, 114, 135, 69, 194, 10, 38, 64, 0, - 130, 228, 120, 71, 240, 181, 8, 145, 67, 240, - 255, 128, 2, 44, 164, 0, 26, 2, 66, 180, - 9, 163, 23, 56, 20, 112, 184, 184, 242, 232, - 119, 224, 212, 127, 18, 56, 152, 95, 14, 252, - 8, 88, 129, 120, 255, 37, 216, 205, 17, 68, - 160, 192, 3, 24, 212, 64, 131, 198, 58, 92, - 12, 70, 101, 223, 125, 8, 172, 60, 218, 166, - 252, 149, 136, 41, 251, 21, 64, 249, 201, 117, - 221, 89, 202, 151, 131, 112, 251, 9, 211, 194, - 54, 161, 218, 88, 212, 128, 237, 128, 207, 35, - 15, 164, 144, 125, 65, 78, 141, 206, 3, 164, - 0, 245, 69, 0, 34, 248, 95, 10, 134, 68, - 2, 8, 244, 101, 71, 97, 3, 77, 237, 70, - 240, 0, 18, 248, 110, 15, 58, 80, 10, 63, - 48, 37, 55, 47, 129, 169, 128, 86, 10, 152, - 12, 132, 19, 166, 2, 36, 112, 132, 31, 20, - 83, 128, 28, 40, 3, 6, 52, 207, 116, 91, - 227, 218, 3, 218, 68, 52, 50, 224, 32, 95, - 228, 147, 1, 175, 134, 211, 65, 226, 13, 138, - 116, 222, 249, 77, 1, 10, 38, 3, 7, 52, - 160, 47, 96, 91, 0, 11, 83, 224, 128, 62, - 197, 176, 107, 32, 224, 222, 217, 192, 240, 130, - 25, 109, 16, 133, 91, 242, 159, 15, 63, 37, - 176, 63, 25, 64, 0, 68, 108, 128, 7, 144, - 232, 0, 37, 146, 81, 68, 14, 208, 20, 20, - 163, 72, 167, 216, 128, 14, 85, 201, 66, 205, - 155, 110, 224, 61, 37, 220, 255, 16, 63, 226, - 235, 215, 135, 194, 5, 44, 78, 249, 5, 61, - 86, 251, 65, 5, 36, 208, 23, 15, 52, 177, - 136, 101, 100, 97, 18, 195, 197, 171, 52, 218, - 205, 117, 51, 108, 163, 169, 132, 16, 171, 54, - 118, 174, 142, 69, 48, 75, 248, 224, 22, 162, - 45, 146, 171, 51, 8, 160, 221, 25, 17, 105, - 70, 82, 90, 237, 91, 131, 137, 164, 37, 137, - 80, 73, 238, 221, 11, 86, 93, 9, 95, 242, - 180, 101, 128, 46, 10, 236, 148, 126, 177, 6, - 5, 70, 153, 68, 69, 38, 18, 2, 255, 42, - 34, 104, 34, 160, 74, 106, 9, 99, 8, 245, - 51, 230, 147, 126, 55, 131, 26, 196, 178, 35, - 225, 25, 153, 52, 131, 82, 55, 240, 84, 19, - 107, 60, 234, 11, 0, 12, 16, 1, 16, 148, - 160, 110, 43, 123, 100, 56, 243, 22, 2, 145, - 128, 45, 101, 16, 152, 15, 118, 44, 54, 131, - 100, 218, 239, 73, 111, 58, 66, 13, 120, 0, - 151, 133, 60, 205, 116, 248, 20, 12, 5, 246, - 227, 52, 126, 106, 195, 120, 50, 56, 146, 1, - 46, 247, 1, 126, 86, 141, 156, 79, 132, 192, - 61, 67, 240, 1, 117, 182, 6, 85, 141, 90, - 38, 232, 134, 176, 17, 89, 198, 165, 35, 134, - 17, 70, 14, 92, 32, 63, 134, 141, 224, 117, - 176, 11, 105, 215, 44, 232, 208, 136, 178, 72, - 34, 118, 212, 203, 69, 173, 226, 148, 26, 216, - 133, 7, 255, 39, 80, 192, 4, 102, 42, 191, - 17, 136, 52, 164, 37, 109, 211, 253, 48, 137, - 49, 122, 90, 116, 165, 255, 100, 64, 86, 40, - 74, 128, 22, 0, 224, 6, 48, 152, 128, 2, - 64, 122, 211, 187, 229, 84, 153, 142, 226, 169, - 18, 230, 41, 128, 164, 1, 149, 31, 37, 98, - 166, 93, 134, 192, 129, 133, 49, 181, 169, 36, - 125, 234, 147, 36, 68, 71, 47, 80, 213, 170, - 252, 32, 79, 92, 232, 177, 4, 14, 80, 32, - 103, 77, 229, 218, 83, 177, 51, 214, 6, 73, - 53, 10, 103, 237, 71, 67, 126, 96, 0, 164, - 133, 69, 4, 128, 147, 134, 15, 72, 240, 85, - 174, 229, 236, 176, 175, 203, 105, 93, 223, 116, - 215, 41, 228, 53, 30, 43, 177, 65, 14, 94, - 80, 133, 21, 160, 64, 93, 75, 153, 0, 0, - 158, 224, 130, 19, 60, 224, 110, 57, 99, 216, - 237, 74, 0, 130, 8, 120, 192, 3, 99, 243, - 192, 97, 234, 58, 161, 120, 42, 226, 177, 106, - 9, 26, 37, 57, 167, 131, 23, 8, 207, 39, - 20, 248, 1, 254, 136, 80, 3, 20, 44, 21, - 180, 32, 32, 79, 4, 80, 16, 128, 11, 64, - 64, 4, 34, 80, 65, 7, 94, 80, 38, 214, - 202, 102, 183, 105, 168, 1, 12, 170, 26, 219, - 26, 34, 19, 135, 29, 41, 128, 117, 137, 128, - 3, 9, 252, 214, 176, 15, 24, 64, 15, 56, - 247, 12, 24, 168, 75, 4, 6, 0, 135, 192, - 14, 156, 139, 82, 90, 8, 164, 38, 219, 29, - 2, 79, 150, 194, 0, 24, 44, 97, 7, 22, - 184, 29, 195, 58, 106, 223, 58, 230, 160, 156, - 68, 89, 108, 89, 115, 145, 3, 147, 48, 33, - 131, 50, 89, 0, 3, 4, 16, 95, 33, 220, - 224, 5, 26, 64, 193, 91, 111, 167, 57, 35, - 132, 35, 53, 148, 116, 12, 100, 166, 248, 13, - 143, 241, 163, 59, 34, 16, 192, 15, 120, 208, - 222, 36, 208, 192, 49, 63, 216, 192, 9, 36, - 192, 128, 137, 114, 152, 44, 47, 217, 140, 130, - 9, 114, 25, 28, 76, 148, 9, 162, 2, 128, - 141, 219, 50, 5, 122, 134, 120, 196, 174, 141, - 46, 143, 167, 96, 131, 23, 221, 120, 200, 72, - 214, 74, 16, 0, 0, 59 }; - -static const unsigned char php_logo[] = { - 71, 73, 70, 56, 57, 97, 120, 0, 67, 0, - 230, 106, 0, 127, 130, 184, 57, 55, 71, 40, - 37, 42, 204, 205, 226, 161, 164, 203, 211, 213, - 231, 178, 180, 212, 67, 66, 88, 131, 134, 185, - 130, 131, 179, 82, 82, 114, 144, 146, 194, 194, - 196, 222, 170, 172, 208, 76, 75, 99, 91, 92, - 131, 221, 222, 236, 59, 56, 60, 110, 113, 165, - 106, 109, 157, 97, 99, 141, 117, 121, 177, 123, - 126, 181, 229, 230, 240, 153, 156, 198, 140, 141, - 193, 185, 186, 217, 107, 107, 146, 78, 78, 107, - 113, 116, 169, 122, 122, 163, 136, 139, 189, 114, - 116, 163, 116, 115, 152, 142, 144, 193, 90, 91, - 126, 226, 227, 239, 123, 125, 173, 164, 165, 208, - 109, 112, 162, 114, 118, 172, 149, 150, 200, 187, - 189, 217, 116, 120, 174, 133, 136, 187, 146, 149, - 195, 216, 217, 234, 146, 146, 196, 100, 102, 146, - 107, 110, 159, 165, 168, 206, 148, 150, 197, 46, - 43, 47, 83, 81, 104, 179, 180, 215, 108, 106, - 140, 92, 91, 118, 138, 141, 191, 102, 104, 150, - 104, 106, 154, 156, 159, 200, 49, 46, 57, 174, - 176, 211, 156, 156, 205, 85, 86, 120, 158, 161, - 202, 150, 153, 197, 129, 130, 175, 103, 105, 151, - 63, 61, 80, 188, 190, 218, 94, 96, 137, 152, - 153, 200, 140, 142, 191, 137, 138, 186, 87, 88, - 124, 182, 183, 215, 213, 215, 232, 34, 30, 32, - 108, 111, 158, 206, 208, 228, 191, 192, 220, 119, - 123, 180, 118, 120, 167, 95, 94, 125, 153, 153, - 204, 110, 111, 152, 115, 119, 174, 34, 30, 31, - 255, 255, 255, 144, 142, 143, 89, 86, 87, 199, - 198, 199, 238, 238, 245, 213, 212, 213, 246, 246, - 250, 130, 128, 129, 172, 170, 171, 116, 114, 115, - 241, 240, 241, 158, 156, 157, 227, 226, 227, 75, - 72, 73, 185, 184, 185, 103, 100, 101, 137, 137, - 182, 0, 255, 0, 71, 70, 95, 223, 224, 237, - 155, 156, 204, 105, 107, 156, 111, 115, 167, 140, - 140, 186, 184, 185, 217, 184, 186, 215, 154, 155, - 204, 167, 170, 207, 219, 220, 235, 154, 156, 201, - 102, 100, 132, 104, 103, 137, 167, 168, 210, 110, - 112, 160, 139, 139, 185, 198, 199, 224, 199, 201, - 225, 105, 108, 156, 151, 152, 203, 33, 249, 4, - 1, 0, 0, 106, 0, 44, 0, 0, 0, 0, - 120, 0, 67, 0, 0, 7, 255, 128, 106, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, - 151, 150, 109, 63, 109, 115, 152, 158, 159, 160, - 63, 121, 121, 54, 62, 26, 113, 76, 26, 26, - 76, 6, 62, 62, 13, 50, 4, 65, 60, 24, - 66, 45, 11, 73, 34, 57, 31, 25, 57, 34, - 47, 41, 160, 194, 161, 13, 26, 12, 125, 77, - 5, 80, 80, 3, 125, 124, 12, 81, 81, 42, - 114, 172, 175, 116, 177, 179, 66, 51, 45, 186, - 31, 8, 0, 22, 22, 21, 87, 40, 37, 22, - 9, 25, 193, 195, 235, 140, 38, 113, 124, 46, - 108, 108, 16, 16, 117, 46, 201, 3, 212, 50, - 179, 34, 31, 254, 44, 0, 17, 8, 4, 64, - 176, 224, 55, 130, 225, 164, 172, 64, 241, 70, - 194, 9, 63, 59, 158, 76, 25, 146, 132, 157, - 69, 53, 65, 108, 12, 96, 67, 226, 130, 71, - 18, 36, 242, 53, 16, 178, 64, 138, 201, 147, - 40, 83, 170, 92, 121, 114, 92, 7, 9, 19, - 118, 232, 128, 65, 225, 8, 5, 43, 67, 68, - 92, 196, 20, 132, 9, 20, 142, 30, 47, 184, - 48, 66, 167, 5, 203, 163, 72, 147, 162, 188, - 242, 38, 6, 140, 35, 71, 30, 140, 88, 114, - 196, 131, 206, 157, 144, 126, 104, 116, 1, 129, - 35, 4, 35, 4, 88, 40, 29, 75, 54, 233, - 149, 19, 58, 30, 44, 1, 162, 64, 193, 136, - 41, 51, 255, 176, 46, 50, 161, 161, 64, 19, - 23, 117, 10, 24, 72, 82, 182, 175, 95, 164, - 29, 96, 44, 81, 192, 129, 131, 3, 60, 9, - 228, 26, 202, 19, 101, 0, 148, 2, 3, 124, - 228, 248, 187, 114, 1, 134, 203, 152, 49, 124, - 160, 156, 244, 13, 5, 5, 14, 214, 172, 81, - 224, 65, 177, 154, 60, 70, 248, 244, 25, 192, - 100, 6, 231, 149, 31, 178, 112, 153, 77, 155, - 75, 151, 215, 74, 221, 44, 89, 115, 224, 128, - 131, 16, 59, 221, 69, 97, 192, 160, 1, 2, - 220, 43, 49, 112, 193, 194, 188, 185, 153, 219, - 200, 147, 118, 216, 93, 164, 200, 154, 210, 195, - 126, 248, 144, 99, 68, 5, 15, 11, 209, 87, - 170, 32, 211, 188, 185, 152, 2, 225, 149, 94, - 121, 112, 32, 64, 0, 14, 112, 64, 153, 48, - 192, 68, 14, 1, 0, 233, 87, 22, 16, 83, - 158, 57, 25, 21, 249, 41, 245, 134, 2, 238, - 245, 112, 7, 38, 115, 208, 225, 131, 1, 50, - 28, 23, 160, 74, 93, 152, 209, 31, 22, 92, - 16, 240, 160, 82, 49, 172, 209, 67, 15, 7, - 236, 81, 201, 15, 50, 52, 208, 64, 73, 23, - 166, 4, 64, 22, 19, 98, 145, 197, 102, 37, - 38, 245, 64, 0, 27, 2, 39, 73, 27, 4, - 236, 227, 96, 139, 39, 41, 55, 161, 25, 95, - 224, 168, 148, 31, 69, 208, 64, 3, 21, 145, - 216, 17, 4, 1, 51, 128, 135, 212, 255, 7, - 153, 53, 217, 36, 139, 71, 169, 16, 198, 132, - 98, 92, 208, 36, 137, 44, 49, 233, 228, 150, - 248, 141, 133, 130, 3, 52, 8, 80, 195, 35, - 72, 96, 16, 4, 148, 71, 125, 240, 69, 22, - 108, 182, 233, 230, 155, 89, 116, 81, 64, 3, - 93, 162, 84, 0, 24, 19, 146, 1, 103, 155, - 23, 12, 96, 225, 73, 11, 236, 41, 40, 155, - 93, 12, 208, 128, 82, 64, 8, 32, 128, 3, - 141, 204, 32, 4, 6, 98, 41, 69, 192, 114, - 41, 86, 106, 6, 24, 92, 124, 1, 32, 74, - 93, 108, 81, 105, 138, 52, 108, 161, 69, 25, - 93, 144, 104, 192, 148, 159, 78, 184, 5, 24, - 94, 116, 113, 40, 82, 35, 8, 224, 4, 163, - 138, 108, 35, 196, 141, 73, 141, 151, 234, 167, - 91, 120, 1, 65, 151, 39, 238, 250, 41, 24, - 99, 96, 32, 197, 0, 120, 10, 171, 106, 25, - 3, 36, 53, 130, 19, 78, 224, 144, 72, 10, - 34, 180, 128, 102, 82, 16, 240, 167, 108, 138, - 97, 64, 96, 18, 6, 94, 108, 155, 34, 26, - 183, 93, 224, 169, 184, 229, 209, 224, 69, 179, - 72, 173, 1, 45, 118, 133, 252, 225, 203, 100, - 101, 125, 33, 33, 186, 253, 121, 1, 160, 148, - 248, 230, 219, 0, 138, 253, 54, 71, 67, 25, - 127, 30, 21, 128, 19, 2, 44, 96, 72, 63, - 244, 146, 21, 91, 192, 229, 109, 209, 227, 157, - 16, 51, 167, 197, 255, 5, 225, 86, 140, 133, - 24, 208, 29, 213, 129, 172, 99, 18, 146, 2, - 2, 31, 212, 57, 214, 164, 59, 194, 57, 198, - 25, 218, 78, 232, 5, 1, 157, 78, 200, 197, - 155, 99, 112, 129, 70, 138, 90, 100, 129, 106, - 196, 112, 150, 113, 198, 185, 19, 150, 129, 37, - 75, 10, 64, 155, 6, 33, 222, 224, 58, 150, - 174, 253, 137, 225, 45, 74, 11, 52, 208, 5, - 121, 19, 106, 193, 0, 192, 253, 173, 136, 18, - 6, 13, 124, 17, 65, 213, 89, 104, 81, 53, - 187, 128, 26, 240, 69, 178, 253, 133, 97, 128, - 82, 52, 204, 58, 200, 31, 0, 32, 160, 100, - 89, 217, 230, 185, 169, 137, 89, 124, 221, 116, - 22, 25, 151, 199, 227, 74, 16, 0, 221, 92, - 206, 130, 51, 119, 198, 218, 42, 125, 48, 6, - 206, 119, 31, 181, 4, 180, 10, 171, 33, 130, - 5, 38, 147, 101, 175, 204, 5, 167, 20, 184, - 170, 58, 83, 249, 116, 74, 49, 247, 119, 70, - 22, 52, 4, 109, 236, 74, 161, 151, 167, 69, - 227, 44, 117, 0, 237, 13, 130, 176, 144, 80, - 95, 15, 79, 56, 198, 181, 39, 109, 222, 31, - 26, 89, 160, 221, 220, 127, 42, 5, 27, 116, - 25, 19, 210, 144, 197, 81, 169, 15, 206, 58, - 75, 69, 184, 173, 70, 56, 115, 147, 133, 114, - 127, 17, 244, 200, 210, 229, 253, 17, 142, 185, - 74, 224, 22, 159, 197, 25, 170, 94, 112, 20, - 255, 214, 229, 1, 175, 20, 7, 78, 244, 32, - 72, 5, 148, 49, 93, 30, 26, 159, 167, 84, - 123, 218, 228, 55, 119, 187, 74, 252, 246, 183, - 69, 216, 99, 179, 132, 1, 241, 219, 83, 10, - 5, 160, 37, 136, 21, 80, 166, 110, 217, 91, - 158, 73, 12, 0, 190, 160, 245, 173, 57, 213, - 211, 143, 239, 152, 3, 134, 44, 20, 14, 11, - 135, 99, 9, 3, 168, 214, 159, 251, 9, 144, - 128, 41, 184, 2, 251, 252, 130, 189, 242, 84, - 136, 37, 201, 99, 78, 4, 58, 183, 187, 248, - 157, 36, 133, 88, 8, 3, 233, 76, 183, 18, - 0, 120, 109, 66, 228, 34, 203, 0, 157, 32, - 8, 20, 24, 176, 47, 194, 235, 32, 238, 142, - 69, 169, 236, 245, 174, 106, 203, 11, 98, 121, - 188, 0, 192, 116, 29, 79, 63, 28, 44, 79, - 24, 20, 184, 146, 29, 10, 162, 3, 40, 24, - 33, 89, 116, 68, 189, 39, 162, 228, 3, 5, - 240, 66, 233, 250, 67, 131, 49, 124, 225, 130, - 39, 76, 73, 247, 38, 244, 189, 240, 113, 15, - 2, 98, 156, 80, 245, 42, 119, 20, 43, 170, - 97, 33, 90, 92, 90, 20, 153, 67, 46, 21, - 248, 81, 5, 16, 232, 194, 24, 180, 48, 70, - 209, 13, 160, 126, 204, 241, 32, 74, 242, 199, - 51, 177, 101, 175, 11, 127, 4, 100, 23, 202, - 224, 72, 153, 81, 113, 37, 232, 83, 223, 243, - 58, 112, 133, 190, 236, 71, 255, 85, 90, 8, - 101, 40, 197, 112, 175, 20, 137, 225, 11, 4, - 120, 160, 10, 189, 104, 167, 9, 98, 161, 130, - 23, 20, 149, 40, 181, 64, 202, 97, 137, 175, - 44, 205, 163, 213, 7, 222, 208, 129, 190, 68, - 72, 99, 104, 248, 194, 2, 78, 133, 67, 23, - 154, 196, 92, 19, 146, 97, 33, 3, 118, 202, - 161, 73, 231, 117, 130, 72, 129, 4, 222, 240, - 67, 165, 40, 177, 95, 205, 60, 150, 43, 173, - 182, 18, 68, 98, 129, 137, 26, 3, 131, 48, - 251, 242, 56, 39, 68, 238, 121, 18, 232, 229, - 88, 214, 216, 47, 26, 156, 97, 156, 82, 64, - 102, 127, 184, 240, 170, 173, 169, 146, 57, 109, - 12, 88, 4, 206, 112, 1, 103, 178, 205, 121, - 130, 120, 193, 9, 36, 208, 73, 165, 48, 82, - 92, 102, 32, 195, 24, 6, 80, 167, 25, 118, - 208, 159, 196, 212, 31, 255, 240, 101, 6, 25, - 50, 128, 142, 73, 41, 154, 19, 142, 70, 136, - 33, 156, 224, 13, 99, 161, 152, 254, 102, 57, - 75, 50, 112, 97, 12, 133, 66, 83, 160, 72, - 26, 74, 86, 158, 68, 5, 92, 96, 233, 232, - 46, 40, 6, 150, 134, 210, 164, 40, 101, 192, - 16, 165, 3, 50, 67, 164, 224, 4, 39, 80, - 39, 82, 96, 200, 133, 11, 208, 131, 30, 5, - 248, 35, 1, 252, 105, 18, 64, 30, 245, 168, - 153, 3, 212, 0, 158, 74, 143, 67, 46, 147, - 57, 94, 255, 48, 234, 81, 147, 234, 71, 2, - 236, 116, 44, 7, 75, 216, 33, 146, 16, 131, - 19, 160, 0, 41, 215, 76, 36, 83, 125, 36, - 133, 5, 52, 177, 60, 89, 192, 40, 114, 220, - 229, 4, 120, 25, 34, 1, 101, 45, 104, 114, - 238, 185, 66, 182, 178, 164, 1, 13, 140, 88, - 199, 242, 83, 78, 105, 41, 162, 4, 121, 101, - 201, 65, 249, 104, 76, 191, 74, 129, 1, 149, - 108, 14, 24, 208, 19, 160, 114, 210, 106, 17, - 136, 53, 171, 4, 171, 198, 0, 199, 170, 68, - 119, 82, 188, 36, 101, 52, 122, 89, 70, 148, - 96, 2, 49, 232, 64, 30, 165, 64, 212, 122, - 122, 214, 36, 121, 115, 217, 233, 162, 211, 129, - 3, 64, 171, 180, 141, 72, 0, 106, 37, 160, - 197, 180, 98, 97, 12, 107, 245, 209, 2, 22, - 199, 70, 185, 250, 133, 8, 61, 128, 150, 97, - 35, 161, 132, 39, 76, 64, 179, 82, 248, 223, - 22, 166, 75, 93, 222, 189, 214, 158, 212, 165, - 46, 24, 6, 251, 26, 5, 200, 74, 0, 50, - 154, 196, 11, 64, 224, 135, 24, 240, 22, 0, - 5, 160, 42, 61, 16, 119, 93, 41, 160, 87, - 189, 16, 112, 45, 101, 136, 112, 48, 39, 68, - 128, 163, 150, 72, 128, 27, 80, 251, 134, 213, - 182, 215, 175, 39, 176, 173, 114, 65, 241, 130, - 41, 248, 1, 181, 170, 253, 175, 95, 81, 192, - 1, 89, 57, 161, 8, 248, 5, 133, 255, 18, - 244, 224, 134, 3, 247, 87, 193, 37, 58, 193, - 26, 28, 220, 131, 240, 178, 131, 5, 20, 62, - 176, 4, 206, 138, 225, 240, 28, 225, 0, 138, - 18, 64, 15, 96, 167, 24, 22, 128, 96, 7, - 110, 112, 67, 12, 168, 89, 98, 202, 248, 129, - 3, 1, 8, 147, 0, 2, 192, 98, 211, 8, - 34, 9, 37, 32, 194, 14, 96, 60, 1, 26, - 215, 56, 41, 19, 32, 80, 15, 132, 36, 38, - 187, 250, 120, 16, 41, 72, 128, 30, 116, 64, - 4, 33, 187, 33, 168, 254, 197, 240, 27, 142, - 128, 227, 13, 45, 185, 8, 120, 120, 193, 147, - 23, 241, 2, 41, 235, 224, 204, 103, 222, 193, - 71, 73, 124, 221, 29, 28, 65, 1, 237, 129, - 209, 134, 14, 112, 3, 15, 141, 249, 17, 47, - 64, 192, 20, 136, 0, 131, 62, 251, 153, 8, - 126, 248, 168, 80, 243, 51, 1, 34, 60, 0, - 52, 213, 113, 143, 162, 113, 16, 2, 59, 223, - 153, 18, 34, 24, 194, 158, 41, 64, 233, 74, - 83, 250, 8, 125, 174, 112, 160, 223, 192, 105, - 78, 75, 224, 211, 159, 6, 42, 80, 137, 112, - 105, 182, 136, 166, 55, 7, 168, 78, 17, 2, - 112, 0, 28, 108, 32, 49, 143, 22, 70, 10, - 62, 80, 2, 16, 88, 1, 42, 80, 121, 128, - 174, 119, 61, 149, 37, 172, 5, 8, 108, 105, - 11, 97, 10, 99, 152, 208, 156, 186, 55, 69, - 80, 0, 21, 110, 56, 48, 4, 49, 199, 90, - 49, 41, 80, 2, 2, 60, 224, 129, 13, 108, - 32, 45, 190, 6, 118, 176, 219, 66, 108, 195, - 112, 128, 10, 35, 24, 129, 21, 172, 80, 130, - 102, 63, 251, 220, 139, 16, 65, 26, 16, 112, - 21, 116, 187, 251, 221, 240, 142, 119, 188, 3, - 1, 0, 59, 0 }; - -static const unsigned char php_egg_logo[] = { - 71, 73, 70, 56, 57, 97, 120, 0, 67, 0, - 231, 255, 0, 18, 25, 33, 32, 30, 34, 28, - 33, 44, 15, 35, 71, 6, 37, 85, 37, 40, - 47, 34, 41, 53, 41, 40, 43, 9, 47, 109, - 30, 45, 68, 21, 48, 84, 51, 46, 55, 43, - 49, 59, 31, 59, 98, 15, 61, 128, 58, 55, - 69, 50, 57, 74, 0, 66, 144, 56, 58, 60, - 54, 59, 71, 32, 66, 113, 60, 65, 67, 63, - 65, 84, 63, 68, 79, 28, 79, 145, 15, 82, - 162, 75, 72, 98, 68, 78, 86, 74, 77, 88, - 50, 82, 122, 41, 85, 134, 76, 78, 108, 70, - 83, 101, 5, 94, 190, 0, 95, 197, 86, 80, - 101, 28, 92, 159, 80, 84, 96, 83, 83, 115, - 81, 87, 89, 22, 97, 183, 86, 88, 85, 0, - 102, 210, 8, 101, 204, 24, 100, 177, 85, 90, - 127, 35, 101, 169, 42, 100, 159, 88, 92, 103, - 0, 107, 216, 69, 95, 132, 0, 108, 210, 84, - 93, 112, 94, 90, 117, 18, 105, 201, 96, 92, - 105, 89, 96, 98, 94, 93, 135, 94, 94, 126, - 30, 106, 210, 7, 112, 222, 33, 108, 198, 16, - 114, 217, 27, 113, 198, 24, 113, 209, 59, 108, - 159, 96, 100, 138, 0, 120, 229, 44, 112, 180, - 49, 112, 171, 71, 108, 148, 99, 104, 115, 90, - 106, 125, 27, 115, 232, 100, 102, 147, 42, 115, - 192, 86, 110, 137, 9, 123, 239, 106, 108, 105, - 105, 105, 138, 33, 118, 228, 12, 125, 227, 48, - 117, 208, 16, 126, 222, 37, 120, 224, 20, 125, - 235, 35, 123, 213, 50, 121, 190, 43, 123, 206, - 40, 123, 220, 105, 110, 160, 59, 122, 182, 78, - 119, 158, 44, 122, 233, 3, 134, 250, 112, 112, - 151, 73, 123, 175, 113, 118, 114, 51, 128, 205, - 34, 129, 246, 11, 136, 245, 34, 130, 240, 113, - 117, 149, 111, 116, 166, 111, 119, 141, 48, 130, - 221, 38, 132, 235, 53, 130, 215, 97, 124, 146, - 116, 122, 124, 117, 121, 131, 54, 130, 229, 41, - 135, 232, 68, 130, 223, 46, 135, 246, 65, 134, - 202, 42, 137, 241, 75, 131, 205, 124, 121, 161, - 101, 125, 191, 86, 128, 210, 121, 122, 169, 105, - 128, 157, 121, 122, 180, 114, 124, 181, 94, 128, - 201, 81, 134, 185, 46, 138, 252, 76, 135, 195, - 34, 142, 252, 62, 137, 229, 63, 138, 217, 33, - 144, 247, 58, 139, 223, 56, 141, 246, 54, 143, - 234, 57, 143, 241, 102, 135, 193, 129, 130, 176, - 122, 136, 144, 46, 148, 252, 45, 149, 246, 118, - 133, 191, 65, 146, 231, 73, 146, 216, 129, 133, - 185, 135, 135, 156, 69, 148, 226, 44, 153, 255, - 94, 143, 216, 132, 136, 175, 88, 146, 207, 137, - 139, 136, 93, 146, 197, 95, 147, 188, 137, 139, - 150, 104, 146, 178, 122, 143, 172, 135, 139, 191, - 57, 156, 254, 67, 154, 245, 70, 154, 239, 134, - 141, 180, 117, 145, 201, 120, 146, 190, 79, 154, - 233, 140, 141, 188, 129, 144, 194, 142, 142, 176, - 137, 147, 156, 88, 155, 222, 82, 157, 230, 93, - 157, 218, 66, 162, 253, 100, 157, 210, 77, 161, - 247, 55, 168, 255, 81, 162, 241, 148, 148, 195, - 145, 149, 202, 127, 156, 204, 77, 166, 255, 142, - 155, 177, 141, 153, 200, 123, 160, 193, 73, 171, - 255, 93, 167, 240, 96, 167, 234, 152, 158, 160, - 101, 167, 228, 119, 164, 206, 155, 158, 171, 110, - 167, 219, 156, 155, 203, 89, 172, 252, 128, 164, - 219, 151, 163, 174, 81, 178, 255, 158, 162, 202, - 102, 175, 249, 93, 178, 251, 108, 175, 237, 103, - 177, 244, 166, 168, 165, 97, 182, 255, 87, 185, - 255, 149, 174, 216, 125, 181, 235, 110, 185, 252, - 117, 183, 254, 171, 172, 209, 166, 175, 197, 103, - 190, 255, 174, 176, 189, 140, 183, 221, 128, 184, - 248, 120, 187, 249, 179, 180, 184, 115, 193, 253, - 170, 183, 193, 174, 181, 215, 107, 197, 255, 135, - 191, 246, 151, 192, 219, 187, 183, 213, 128, 197, - 253, 121, 202, 255, 147, 198, 239, 188, 191, 219, - 148, 200, 252, 192, 193, 197, 134, 205, 254, 171, - 199, 236, 183, 199, 218, 163, 207, 251, 142, 213, - 255, 158, 211, 253, 195, 205, 217, 166, 211, 245, - 205, 204, 228, 153, 218, 255, 190, 210, 236, 186, - 212, 231, 177, 213, 248, 162, 224, 255, 188, 221, - 250, 214, 219, 221, 214, 219, 233, 174, 229, 254, - 198, 225, 247, 209, 226, 248, 186, 233, 251, 227, - 230, 239, 225, 241, 252, 253, 255, 252, 255, 255, - 255, 33, 249, 4, 1, 10, 0, 255, 0, 44, - 0, 0, 0, 0, 120, 0, 67, 0, 0, 8, - 254, 0, 255, 9, 28, 72, 176, 160, 193, 131, - 8, 19, 42, 92, 200, 176, 161, 195, 135, 16, - 35, 74, 156, 72, 177, 162, 197, 139, 22, 131, - 105, 12, 134, 177, 163, 199, 143, 193, 164, 73, - 227, 38, 141, 28, 56, 112, 228, 76, 146, 20, - 41, 205, 152, 75, 99, 183, 100, 201, 50, 101, - 202, 147, 77, 79, 166, 102, 205, 250, 200, 19, - 100, 73, 114, 239, 238, 221, 123, 71, 148, 104, - 202, 163, 224, 86, 138, 124, 25, 115, 166, 205, - 72, 145, 246, 72, 221, 195, 39, 207, 30, 69, - 158, 118, 246, 220, 202, 208, 24, 184, 160, 252, - 248, 9, 29, 59, 212, 100, 75, 99, 53, 159, - 66, 93, 203, 182, 109, 84, 169, 124, 248, 156, - 57, 163, 165, 174, 150, 60, 138, 76, 113, 221, - 251, 207, 24, 183, 119, 97, 3, 135, 125, 71, - 78, 90, 76, 62, 142, 70, 141, 18, 53, 109, - 170, 227, 199, 144, 35, 75, 157, 91, 87, 137, - 229, 28, 74, 190, 228, 229, 139, 209, 43, 96, - 193, 247, 10, 203, 114, 212, 167, 82, 47, 93, - 197, 138, 81, 163, 166, 173, 19, 47, 201, 176, - 99, 59, 166, 171, 36, 135, 237, 22, 45, 114, - 216, 209, 203, 25, 98, 176, 191, 66, 195, 134, - 54, 230, 233, 150, 179, 100, 197, 106, 181, 90, - 158, 171, 57, 179, 110, 231, 124, 185, 145, 77, - 157, 186, 150, 218, 45, 76, 104, 111, 145, 71, - 86, 239, 133, 198, 200, 254, 145, 189, 199, 205, - 212, 212, 115, 244, 232, 157, 107, 86, 172, 185, - 234, 92, 197, 154, 137, 11, 231, 11, 77, 245, - 251, 178, 207, 40, 201, 254, 225, 131, 134, 39, - 138, 124, 103, 80, 73, 68, 13, 37, 141, 39, - 144, 213, 115, 14, 60, 235, 116, 211, 12, 123, - 197, 136, 67, 141, 106, 226, 156, 51, 78, 16, - 92, 208, 194, 7, 126, 28, 70, 166, 159, 9, - 26, 132, 104, 130, 29, 2, 254, 67, 32, 81, - 224, 200, 18, 91, 56, 240, 208, 35, 78, 51, - 238, 49, 40, 223, 58, 240, 88, 99, 132, 31, - 207, 168, 131, 14, 55, 206, 56, 115, 203, 41, - 167, 172, 229, 73, 36, 158, 196, 133, 216, 83, - 29, 58, 166, 69, 11, 26, 88, 96, 129, 6, - 95, 112, 230, 213, 81, 210, 188, 21, 27, 59, - 208, 208, 179, 14, 123, 205, 81, 227, 96, 55, - 235, 208, 227, 14, 23, 126, 244, 162, 204, 49, - 200, 64, 3, 13, 51, 194, 232, 162, 139, 50, - 105, 106, 131, 13, 54, 225, 132, 227, 205, 157, - 207, 96, 243, 204, 48, 195, 244, 72, 28, 126, - 103, 48, 233, 164, 6, 36, 246, 20, 210, 81, - 198, 224, 87, 143, 48, 12, 78, 8, 75, 43, - 242, 21, 3, 38, 60, 227, 116, 224, 2, 22, - 135, 32, 162, 41, 33, 112, 208, 129, 72, 35, - 135, 8, 242, 72, 40, 163, 150, 82, 202, 42, - 186, 172, 178, 203, 46, 169, 170, 154, 76, 50, - 254, 123, 158, 194, 97, 14, 22, 60, 240, 192, - 7, 188, 117, 228, 23, 74, 198, 88, 41, 219, - 56, 189, 36, 19, 203, 57, 235, 80, 147, 11, - 44, 176, 20, 211, 96, 51, 240, 192, 195, 14, - 5, 36, 88, 129, 8, 33, 116, 200, 81, 198, - 181, 101, 208, 1, 199, 27, 220, 110, 59, 69, - 22, 130, 20, 82, 200, 35, 165, 76, 34, 110, - 33, 147, 64, 162, 174, 42, 192, 200, 122, 223, - 25, 38, 216, 186, 192, 19, 24, 133, 52, 82, - 149, 247, 161, 179, 203, 35, 136, 8, 243, 72, - 57, 244, 80, 179, 220, 39, 185, 192, 163, 77, - 55, 244, 236, 227, 14, 5, 17, 0, 65, 7, - 25, 101, 120, 81, 197, 196, 216, 82, 97, 49, - 21, 81, 68, 145, 69, 22, 105, 116, 236, 113, - 26, 161, 148, 59, 136, 24, 98, 64, 210, 203, - 40, 28, 106, 161, 193, 2, 11, 88, 144, 171, - 68, 246, 74, 163, 226, 125, 207, 156, 105, 8, - 25, 212, 54, 218, 202, 39, 4, 227, 115, 142, - 54, 233, 177, 211, 65, 4, 51, 84, 113, 109, - 21, 77, 52, 1, 69, 23, 19, 15, 1, 197, - 16, 84, 12, 17, 197, 182, 112, 8, 146, 198, - 20, 86, 147, 139, 204, 49, 169, 78, 50, 200, - 32, 144, 56, 210, 97, 14, 15, 176, 28, 37, - 204, 198, 180, 228, 107, 108, 158, 60, 19, 202, - 43, 159, 200, 225, 133, 28, 175, 224, 3, 15, - 50, 176, 80, 2, 75, 254, 51, 94, 34, 140, - 143, 208, 68, 119, 129, 45, 210, 93, 48, 13, - 197, 210, 60, 240, 0, 133, 15, 111, 104, 138, - 8, 28, 27, 79, 1, 199, 35, 163, 234, 18, - 139, 155, 233, 206, 177, 97, 202, 22, 28, 112, - 128, 14, 17, 5, 227, 210, 204, 213, 69, 178, - 11, 40, 160, 16, 194, 8, 33, 134, 52, 17, - 142, 122, 197, 236, 156, 11, 51, 185, 52, 3, - 244, 62, 128, 207, 16, 49, 182, 93, 36, 125, - 120, 23, 135, 67, 193, 131, 15, 112, 148, 147, - 143, 58, 216, 8, 3, 249, 198, 89, 192, 1, - 199, 33, 143, 196, 18, 203, 42, 144, 104, 222, - 33, 31, 26, 120, 62, 194, 67, 162, 255, 121, - 159, 35, 149, 104, 58, 135, 21, 100, 64, 92, - 69, 139, 198, 238, 156, 236, 222, 226, 208, 131, - 207, 56, 13, 56, 80, 116, 19, 215, 54, 81, - 197, 24, 73, 23, 126, 248, 16, 62, 248, 144, - 133, 62, 110, 112, 194, 50, 202, 113, 8, 231, - 101, 193, 7, 64, 152, 220, 184, 30, 129, 42, - 93, 168, 66, 108, 29, 50, 129, 231, 52, 208, - 16, 89, 220, 162, 87, 248, 137, 68, 29, 178, - 160, 6, 53, 188, 225, 5, 85, 176, 86, 21, - 232, 1, 15, 113, 228, 98, 57, 173, 104, 143, - 151, 224, 241, 190, 248, 249, 160, 126, 114, 136, - 161, 181, 202, 16, 53, 167, 13, 97, 120, 105, - 184, 7, 7, 12, 224, 4, 111, 192, 65, 114, - 254, 144, 3, 66, 26, 14, 145, 6, 43, 88, - 1, 11, 107, 128, 196, 42, 86, 1, 65, 14, - 181, 224, 0, 1, 160, 160, 66, 100, 114, 139, - 181, 197, 230, 22, 117, 152, 194, 20, 162, 160, - 134, 42, 144, 64, 10, 248, 163, 67, 122, 214, - 17, 187, 79, 232, 45, 23, 226, 16, 7, 62, - 240, 97, 13, 5, 16, 109, 12, 215, 98, 4, - 207, 64, 193, 51, 77, 53, 66, 83, 84, 240, - 65, 26, 218, 113, 1, 3, 180, 1, 27, 144, - 19, 196, 183, 128, 128, 196, 66, 132, 98, 13, - 63, 72, 228, 15, 176, 32, 134, 68, 52, 241, - 62, 45, 8, 64, 0, 106, 144, 144, 89, 152, - 66, 22, 8, 186, 207, 40, 214, 32, 8, 107, - 216, 194, 5, 67, 144, 218, 15, 134, 208, 5, - 68, 184, 15, 30, 205, 120, 148, 25, 97, 1, - 157, 125, 208, 227, 25, 3, 136, 64, 12, 232, - 215, 136, 121, 200, 35, 31, 249, 168, 71, 61, - 242, 33, 143, 118, 108, 67, 30, 208, 128, 195, - 32, 218, 49, 1, 1, 180, 1, 121, 199, 120, - 197, 35, 136, 184, 134, 102, 146, 11, 137, 88, - 80, 228, 37, 104, 145, 36, 13, 72, 178, 80, - 5, 153, 5, 78, 50, 73, 157, 72, 92, 98, - 13, 135, 208, 135, 63, 252, 129, 132, 40, 116, - 193, 105, 192, 11, 5, 62, 92, 217, 140, 157, - 49, 162, 21, 104, 60, 199, 62, 224, 225, 10, - 2, 68, 128, 10, 114, 254, 32, 196, 49, 178, - 113, 129, 11, 112, 224, 159, 37, 224, 192, 6, - 46, 176, 129, 108, 148, 99, 21, 213, 40, 230, - 1, 78, 128, 3, 55, 240, 34, 29, 216, 8, - 197, 36, 122, 81, 10, 114, 61, 2, 93, 107, - 136, 230, 28, 230, 96, 13, 43, 202, 230, 1, - 1, 56, 128, 119, 10, 146, 150, 251, 240, 65, - 21, 88, 200, 194, 60, 198, 233, 143, 84, 164, - 193, 104, 72, 43, 195, 49, 214, 8, 143, 216, - 49, 226, 157, 197, 208, 70, 251, 216, 193, 5, - 2, 100, 160, 10, 129, 64, 4, 54, 54, 81, - 2, 24, 148, 128, 6, 48, 160, 193, 81, 3, - 202, 0, 115, 120, 99, 19, 19, 40, 128, 1, - 74, 208, 79, 6, 20, 32, 12, 222, 8, 133, - 45, 136, 241, 141, 103, 232, 194, 84, 143, 72, - 195, 15, 196, 112, 9, 87, 248, 226, 22, 28, - 58, 3, 20, 183, 71, 144, 89, 16, 201, 163, - 145, 185, 68, 74, 7, 145, 130, 106, 140, 83, - 15, 136, 40, 131, 181, 154, 48, 6, 111, 140, - 145, 61, 173, 72, 214, 131, 210, 83, 41, 2, - 160, 128, 12, 140, 104, 68, 57, 220, 80, 212, - 106, 224, 50, 151, 250, 248, 69, 9, 24, 208, - 6, 126, 28, 225, 2, 1, 32, 70, 53, 126, - 193, 88, 1, 0, 96, 17, 165, 96, 2, 65, - 113, 16, 6, 76, 96, 98, 27, 202, 16, 43, - 89, 51, 193, 10, 82, 108, 174, 58, 38, 144, - 254, 228, 203, 134, 4, 87, 200, 220, 1, 11, - 64, 160, 66, 16, 12, 80, 128, 118, 216, 195, - 5, 141, 40, 31, 182, 216, 145, 30, 23, 181, - 135, 149, 212, 8, 19, 60, 188, 145, 0, 4, - 100, 225, 19, 59, 155, 7, 13, 78, 80, 130, - 109, 60, 67, 24, 141, 128, 67, 33, 204, 81, - 130, 2, 84, 224, 30, 37, 152, 128, 4, 242, - 113, 167, 121, 216, 162, 152, 39, 120, 6, 8, - 4, 192, 128, 13, 112, 160, 159, 6, 192, 68, - 41, 122, 240, 131, 65, 0, 2, 16, 115, 48, - 171, 51, 238, 3, 69, 41, 254, 195, 173, 181, - 125, 12, 31, 122, 0, 132, 25, 248, 192, 3, - 211, 56, 0, 13, 54, 145, 5, 50, 236, 149, - 126, 236, 104, 17, 60, 186, 113, 44, 73, 73, - 120, 29, 174, 136, 37, 28, 102, 215, 10, 121, - 208, 192, 13, 71, 72, 135, 50, 38, 22, 133, - 66, 164, 163, 187, 12, 216, 6, 7, 24, 112, - 132, 114, 192, 33, 13, 144, 248, 69, 1, 0, - 112, 2, 98, 126, 54, 30, 211, 32, 6, 26, - 120, 11, 12, 32, 244, 64, 12, 115, 240, 195, - 18, 174, 0, 8, 87, 144, 226, 20, 164, 147, - 76, 36, 3, 48, 82, 243, 4, 120, 42, 3, - 182, 193, 10, 86, 48, 3, 18, 20, 32, 0, - 2, 32, 129, 26, 200, 80, 133, 194, 53, 129, - 12, 236, 160, 17, 60, 210, 7, 11, 113, 172, - 227, 204, 225, 144, 129, 254, 97, 65, 33, 12, - 129, 165, 131, 3, 55, 112, 131, 45, 142, 81, - 5, 42, 188, 225, 17, 237, 88, 241, 2, 36, - 107, 128, 69, 196, 66, 13, 130, 120, 6, 26, - 60, 187, 136, 106, 120, 22, 23, 186, 224, 90, - 60, 12, 0, 0, 78, 76, 161, 7, 88, 152, - 67, 16, 92, 176, 4, 34, 92, 97, 11, 91, - 200, 132, 53, 204, 35, 153, 51, 72, 146, 94, - 255, 120, 242, 84, 60, 177, 4, 41, 171, 64, - 5, 59, 0, 2, 5, 18, 128, 1, 56, 220, - 236, 90, 189, 83, 3, 59, 206, 97, 230, 102, - 64, 55, 23, 201, 61, 179, 55, 26, 128, 128, - 52, 188, 162, 24, 204, 128, 196, 52, 56, 0, - 131, 77, 88, 67, 24, 132, 64, 196, 33, 212, - 241, 139, 11, 20, 224, 8, 104, 184, 128, 0, - 170, 129, 8, 53, 100, 193, 25, 16, 0, 0, - 0, 182, 49, 104, 6, 36, 67, 153, 143, 184, - 68, 2, 0, 192, 133, 52, 160, 0, 11, 87, - 120, 129, 11, 88, 192, 110, 18, 144, 128, 8, - 153, 118, 70, 162, 34, 99, 129, 40, 10, 196, - 164, 128, 232, 193, 10, 98, 16, 131, 29, 248, - 27, 8, 133, 224, 32, 33, 132, 123, 173, 70, - 172, 35, 141, 235, 64, 6, 116, 97, 65, 172, - 51, 103, 98, 0, 25, 120, 133, 48, 218, 163, - 138, 84, 252, 51, 27, 232, 160, 6, 51, 160, - 193, 142, 108, 28, 97, 2, 12, 176, 7, 18, - 254, 250, 136, 142, 14, 102, 161, 19, 140, 102, - 64, 59, 178, 189, 1, 109, 188, 34, 20, 133, - 240, 131, 103, 57, 113, 136, 31, 44, 97, 14, - 91, 32, 1, 187, 89, 224, 110, 23, 144, 160, - 8, 96, 240, 3, 46, 146, 44, 149, 15, 4, - 96, 1, 247, 174, 206, 41, 176, 96, 131, 29, - 240, 32, 6, 42, 224, 247, 14, 124, 16, 5, - 58, 88, 221, 193, 85, 240, 2, 51, 194, 113, - 142, 110, 72, 40, 23, 202, 233, 70, 179, 202, - 209, 1, 2, 212, 129, 25, 108, 202, 133, 55, - 208, 192, 129, 18, 152, 227, 30, 230, 216, 6, - 49, 156, 64, 108, 8, 164, 226, 30, 48, 152, - 192, 6, 158, 65, 7, 53, 88, 1, 9, 158, - 61, 194, 52, 102, 76, 12, 109, 8, 35, 22, - 144, 232, 196, 161, 225, 32, 134, 43, 92, 161, - 8, 47, 120, 1, 17, 212, 237, 110, 12, 252, - 28, 211, 156, 128, 140, 18, 36, 41, 144, 215, - 194, 198, 19, 115, 0, 194, 10, 84, 192, 131, - 33, 240, 187, 223, 62, 160, 66, 178, 7, 14, - 49, 50, 208, 233, 96, 231, 152, 16, 123, 230, - 83, 142, 12, 59, 32, 22, 26, 103, 70, 43, - 230, 1, 130, 182, 95, 128, 6, 19, 184, 64, - 240, 139, 234, 134, 120, 84, 99, 197, 109, 240, - 134, 26, 232, 80, 7, 11, 104, 123, 27, 72, - 0, 192, 6, 228, 49, 14, 61, 165, 131, 6, - 0, 144, 0, 43, 4, 254, 49, 136, 43, 16, - 33, 8, 30, 136, 60, 188, 225, 237, 238, 23, - 20, 97, 11, 153, 127, 204, 230, 3, 240, 223, - 234, 140, 2, 11, 83, 142, 58, 15, 202, 80, - 133, 167, 199, 96, 8, 141, 128, 155, 33, 62, - 65, 6, 67, 112, 29, 26, 21, 114, 14, 204, - 144, 83, 212, 112, 14, 222, 80, 118, 98, 128, - 12, 180, 35, 12, 185, 32, 15, 16, 0, 103, - 71, 0, 98, 71, 0, 3, 48, 224, 6, 219, - 48, 15, 143, 32, 9, 28, 48, 1, 188, 80, - 14, 84, 160, 6, 137, 192, 104, 23, 144, 14, - 217, 38, 1, 188, 112, 130, 188, 0, 3, 152, - 149, 10, 230, 50, 8, 150, 22, 4, 50, 0, - 6, 91, 64, 4, 46, 224, 2, 145, 7, 126, - 65, 16, 4, 91, 128, 11, 234, 199, 121, 255, - 16, 23, 178, 81, 7, 82, 32, 2, 168, 22, - 3, 62, 48, 4, 100, 160, 6, 79, 23, 5, - 135, 240, 10, 173, 48, 45, 251, 7, 13, 231, - 160, 38, 102, 118, 14, 117, 82, 39, 126, 0, - 113, 186, 128, 12, 12, 88, 11, 185, 176, 13, - 19, 112, 3, 37, 192, 15, 185, 84, 15, 243, - 16, 15, 234, 112, 12, 136, 80, 10, 237, 64, - 12, 196, 112, 15, 215, 64, 5, 112, 128, 11, - 22, 208, 103, 182, 32, 1, 0, 192, 0, 239, - 5, 80, 23, 208, 6, 207, 80, 8, 96, 3, - 111, 70, 128, 6, 118, 192, 4, 96, 0, 121, - 254, 36, 240, 2, 96, 176, 33, 150, 192, 5, - 92, 224, 43, 235, 39, 16, 103, 224, 121, 144, - 49, 10, 63, 48, 3, 163, 23, 3, 195, 243, - 129, 101, 160, 6, 169, 247, 10, 200, 0, 10, - 204, 209, 10, 194, 16, 14, 201, 195, 34, 7, - 151, 12, 225, 0, 12, 10, 224, 0, 147, 160, - 13, 180, 227, 133, 208, 240, 11, 196, 230, 6, - 253, 112, 12, 159, 208, 119, 86, 103, 8, 214, - 246, 10, 209, 80, 14, 209, 0, 10, 67, 0, - 7, 227, 16, 15, 247, 192, 15, 72, 192, 91, - 246, 176, 13, 169, 176, 8, 110, 144, 10, 214, - 5, 61, 35, 227, 2, 91, 32, 3, 86, 33, - 21, 92, 0, 6, 47, 224, 1, 50, 32, 10, - 176, 17, 137, 63, 72, 137, 142, 113, 10, 98, - 208, 116, 81, 199, 111, 60, 64, 5, 143, 83, - 6, 67, 160, 6, 177, 16, 14, 208, 160, 13, - 106, 194, 12, 200, 160, 12, 218, 112, 12, 82, - 152, 12, 187, 160, 10, 151, 64, 1, 8, 240, - 3, 10, 184, 51, 148, 208, 10, 139, 85, 2, - 37, 176, 9, 253, 32, 12, 134, 80, 6, 251, - 83, 62, 84, 144, 45, 141, 64, 8, 84, 192, - 3, 158, 8, 4, 86, 64, 10, 28, 32, 0, - 56, 224, 13, 194, 176, 11, 222, 80, 14, 202, - 16, 10, 135, 32, 46, 141, 7, 111, 45, 224, - 24, 145, 144, 9, 91, 0, 6, 70, 0, 6, - 112, 101, 116, 72, 247, 254, 15, 123, 112, 6, - 176, 65, 11, 63, 176, 111, 59, 208, 111, 154, - 216, 142, 135, 0, 10, 136, 16, 10, 194, 160, - 13, 201, 160, 13, 117, 34, 14, 208, 128, 12, - 186, 208, 11, 187, 112, 9, 128, 224, 1, 20, - 64, 0, 8, 96, 3, 203, 1, 11, 159, 112, - 83, 175, 80, 15, 52, 208, 118, 196, 144, 15, - 185, 32, 66, 67, 80, 5, 100, 64, 7, 81, - 83, 56, 85, 48, 3, 20, 233, 3, 54, 208, - 3, 157, 192, 0, 0, 64, 12, 208, 0, 10, - 63, 4, 7, 202, 54, 146, 133, 48, 7, 151, - 64, 4, 96, 112, 146, 144, 225, 7, 96, 192, - 5, 226, 40, 21, 245, 38, 69, 158, 48, 23, - 145, 97, 10, 115, 96, 3, 34, 48, 122, 231, - 88, 122, 112, 160, 6, 165, 16, 11, 161, 112, - 12, 202, 112, 9, 151, 16, 14, 226, 32, 143, - 244, 40, 6, 24, 224, 0, 8, 128, 0, 17, - 128, 2, 135, 128, 66, 173, 64, 9, 140, 64, - 9, 185, 208, 15, 196, 144, 10, 191, 192, 15, - 236, 0, 10, 114, 96, 56, 93, 32, 7, 73, - 120, 67, 80, 64, 5, 59, 128, 132, 84, 0, - 4, 107, 48, 104, 5, 240, 13, 194, 0, 10, - 111, 0, 4, 64, 32, 57, 105, 128, 46, 171, - 48, 7, 223, 39, 4, 145, 1, 132, 157, 246, - 105, 2, 49, 11, 115, 33, 142, 167, 240, 3, - 54, 224, 3, 153, 152, 56, 80, 243, 6, 112, - 254, 0, 138, 177, 32, 12, 208, 160, 10, 106, - 130, 13, 0, 24, 14, 197, 128, 148, 107, 208, - 3, 86, 32, 138, 202, 193, 51, 85, 121, 83, - 173, 112, 14, 229, 192, 14, 234, 80, 14, 173, - 160, 87, 101, 0, 60, 33, 148, 132, 112, 32, - 60, 60, 48, 3, 184, 233, 3, 170, 224, 75, - 237, 128, 13, 79, 72, 5, 84, 246, 45, 83, - 0, 136, 221, 71, 4, 50, 64, 147, 29, 178, - 100, 35, 37, 147, 132, 249, 24, 137, 128, 152, - 43, 224, 111, 57, 121, 132, 92, 4, 7, 161, - 160, 12, 111, 162, 11, 115, 32, 153, 199, 176, - 117, 63, 83, 158, 244, 8, 10, 148, 48, 144, - 237, 25, 8, 44, 26, 8, 114, 16, 8, 169, - 193, 8, 11, 41, 56, 133, 195, 3, 244, 99, - 117, 84, 80, 5, 80, 192, 111, 244, 195, 63, - 64, 16, 10, 186, 32, 12, 5, 234, 3, 49, - 48, 3, 195, 153, 6, 88, 48, 50, 240, 246, - 1, 73, 178, 7, 253, 213, 86, 90, 224, 160, - 142, 33, 6, 33, 48, 101, 254, 118, 67, 169, - 39, 8, 175, 208, 132, 210, 179, 11, 189, 176, - 5, 202, 160, 12, 107, 194, 117, 83, 216, 10, - 180, 83, 149, 44, 234, 5, 99, 224, 5, 127, - 224, 5, 110, 58, 6, 178, 89, 6, 74, 51, - 49, 80, 192, 144, 246, 83, 6, 159, 210, 119, - 166, 55, 75, 12, 57, 3, 213, 201, 132, 160, - 160, 6, 81, 48, 4, 254, 51, 48, 3, 89, - 96, 68, 73, 234, 125, 65, 96, 2, 73, 18, - 91, 1, 240, 50, 255, 160, 8, 81, 234, 24, - 142, 176, 4, 33, 32, 2, 137, 57, 3, 84, - 0, 5, 29, 84, 53, 64, 154, 42, 170, 144, - 9, 92, 112, 9, 165, 16, 143, 196, 98, 133, - 12, 184, 51, 104, 170, 166, 99, 176, 166, 115, - 227, 162, 173, 154, 52, 247, 217, 101, 89, 87, - 6, 132, 208, 8, 62, 89, 5, 67, 144, 147, - 19, 195, 3, 43, 96, 3, 81, 240, 10, 141, - 160, 6, 95, 217, 159, 126, 106, 3, 71, 36, - 6, 68, 80, 4, 50, 144, 36, 106, 21, 0, - 108, 5, 165, 147, 42, 21, 166, 96, 169, 83, - 214, 111, 137, 83, 5, 206, 3, 10, 161, 48, - 61, 170, 224, 7, 32, 0, 1, 50, 0, 9, - 186, 64, 39, 86, 104, 120, 202, 161, 170, 140, - 224, 166, 106, 250, 7, 109, 234, 166, 49, 228, - 5, 134, 224, 5, 73, 67, 63, 114, 80, 5, - 183, 154, 58, 55, 164, 2, 177, 73, 6, 80, - 96, 164, 108, 214, 10, 92, 198, 63, 51, 16, - 2, 6, 75, 95, 138, 42, 165, 248, 1, 82, - 34, 117, 16, 166, 80, 23, 155, 115, 11, 87, - 96, 161, 51, 192, 111, 156, 170, 108, 160, 32, - 61, 171, 192, 10, 32, 16, 124, 48, 208, 9, - 189, 128, 148, 208, 16, 14, 176, 72, 59, 55, - 69, 154, 129, 192, 166, 127, 176, 166, 114, 163, - 254, 166, 94, 0, 49, 77, 192, 3, 73, 208, - 4, 115, 67, 6, 160, 128, 171, 132, 160, 6, - 60, 10, 49, 60, 96, 3, 112, 112, 179, 100, - 16, 8, 236, 8, 4, 54, 96, 176, 33, 128, - 2, 40, 192, 2, 68, 160, 4, 213, 116, 77, - 9, 33, 169, 90, 48, 21, 115, 160, 111, 153, - 184, 3, 114, 136, 58, 135, 208, 173, 171, 224, - 10, 253, 132, 6, 81, 113, 10, 172, 240, 38, - 216, 160, 13, 242, 40, 164, 104, 250, 7, 129, - 224, 174, 129, 192, 8, 114, 208, 166, 134, 128, - 63, 17, 147, 56, 77, 32, 155, 132, 32, 138, - 136, 80, 5, 58, 11, 5, 47, 219, 5, 253, - 9, 7, 46, 74, 8, 236, 232, 3, 244, 133, - 2, 71, 139, 180, 44, 16, 4, 73, 178, 100, - 148, 164, 16, 121, 80, 23, 82, 225, 10, 55, - 153, 137, 70, 168, 6, 136, 32, 8, 47, 86, - 8, 165, 160, 9, 19, 96, 6, 142, 193, 7, - 163, 176, 11, 202, 192, 117, 242, 232, 78, 108, - 235, 174, 238, 58, 6, 104, 203, 170, 73, 227, - 5, 73, 48, 179, 65, 139, 171, 175, 80, 109, - 84, 80, 52, 178, 217, 4, 187, 58, 4, 217, - 82, 5, 83, 99, 5, 61, 128, 180, 190, 203, - 2, 46, 192, 180, 78, 36, 73, 254, 197, 184, - 117, 145, 7, 180, 192, 116, 138, 201, 111, 133, - 74, 117, 89, 112, 8, 186, 160, 9, 23, 16, - 25, 159, 171, 83, 240, 254, 120, 66, 104, 58, - 6, 129, 176, 166, 174, 10, 167, 100, 80, 175, - 245, 138, 51, 160, 144, 11, 112, 153, 71, 47, - 84, 62, 49, 91, 122, 116, 0, 60, 81, 0, - 4, 152, 122, 180, 75, 144, 1, 25, 112, 184, - 17, 68, 188, 15, 209, 184, 90, 80, 173, 54, - 80, 168, 167, 39, 60, 22, 243, 6, 208, 43, - 189, 146, 49, 10, 218, 112, 174, 19, 119, 44, - 60, 67, 186, 45, 234, 162, 114, 80, 175, 93, - 86, 6, 159, 0, 10, 177, 11, 7, 81, 112, - 132, 47, 75, 175, 78, 99, 52, 60, 160, 2, - 86, 90, 168, 54, 176, 4, 46, 144, 1, 87, - 112, 141, 213, 113, 6, 245, 102, 111, 16, 33, - 169, 138, 48, 177, 152, 184, 147, 19, 153, 122, - 28, 154, 12, 156, 48, 189, 146, 241, 12, 87, - 8, 13, 26, 215, 30, 237, 89, 11, 200, 128, - 12, 178, 3, 93, 235, 234, 5, 101, 144, 132, - 208, 149, 41, 21, 252, 144, 220, 27, 60, 117, - 250, 116, 161, 228, 163, 132, 116, 5, 46, 144, - 8, 248, 161, 4, 11, 32, 73, 139, 27, 17, - 166, 240, 5, 144, 208, 3, 251, 187, 111, 165, - 39, 135, 136, 240, 10, 146, 41, 192, 146, 113, - 10, 231, 96, 133, 212, 32, 12, 112, 195, 162, - 104, 27, 8, 173, 0, 55, 183, 214, 10, 55, - 85, 149, 79, 200, 173, 144, 99, 96, 170, 35, - 92, 192, 51, 4, 116, 64, 127, 161, 244, 129, - 254, 83, 80, 156, 147, 16, 100, 222, 8, 91, - 80, 116, 0, 103, 51, 17, 193, 192, 10, 145, - 123, 161, 6, 118, 181, 175, 240, 38, 153, 64, - 195, 53, 76, 178, 218, 128, 12, 185, 80, 149, - 109, 251, 7, 132, 32, 7, 134, 240, 7, 49, - 180, 182, 107, 11, 187, 91, 122, 8, 82, 96, - 3, 89, 128, 8, 173, 208, 8, 154, 92, 6, - 141, 208, 8, 129, 96, 8, 3, 103, 117, 207, - 35, 81, 27, 203, 131, 212, 161, 4, 32, 21, - 0, 18, 0, 169, 18, 49, 14, 107, 128, 137, - 251, 150, 122, 87, 43, 12, 245, 8, 12, 27, - 240, 151, 82, 241, 12, 218, 64, 13, 56, 44, - 12, 181, 192, 8, 105, 123, 83, 210, 44, 55, - 160, 204, 162, 148, 64, 48, 185, 16, 10, 161, - 80, 68, 105, 48, 190, 114, 76, 205, 55, 149, - 79, 172, 71, 45, 112, 208, 8, 163, 178, 10, - 201, 128, 203, 176, 161, 5, 39, 60, 73, 30, - 49, 8, 82, 230, 197, 95, 169, 202, 109, 162, - 12, 192, 64, 3, 150, 0, 27, 201, 35, 12, - 108, 34, 12, 210, 220, 162, 55, 229, 162, 110, - 26, 203, 238, 249, 198, 177, 160, 12, 144, 48, - 8, 177, 112, 12, 194, 0, 148, 205, 1, 55, - 210, 44, 205, 229, 67, 7, 201, 6, 42, 12, - 148, 12, 190, 0, 27, 124, 240, 1, 80, 20, - 0, 46, 243, 17, 170, 96, 5, 133, 122, 155, - 31, 168, 202, 14, 141, 254, 12, 189, 128, 4, - 146, 32, 25, 124, 160, 13, 171, 44, 144, 45, - 106, 8, 134, 240, 162, 11, 188, 182, 208, 149, - 66, 229, 169, 13, 151, 160, 10, 247, 88, 10, - 68, 89, 182, 85, 233, 96, 194, 101, 209, 81, - 160, 108, 151, 211, 11, 192, 240, 24, 168, 192, - 7, 42, 243, 209, 11, 144, 200, 30, 145, 12, - 105, 80, 168, 205, 171, 6, 231, 252, 10, 151, - 179, 11, 156, 112, 4, 252, 188, 198, 100, 112, - 205, 46, 26, 208, 114, 243, 162, 238, 233, 133, - 104, 87, 143, 47, 192, 10, 202, 80, 10, 200, - 64, 148, 225, 160, 198, 104, 26, 8, 179, 137, - 183, 114, 120, 8, 166, 162, 212, 190, 66, 43, - 158, 115, 0, 243, 194, 21, 127, 232, 167, 51, - 224, 111, 84, 87, 203, 165, 176, 11, 154, 0, - 3, 220, 244, 24, 189, 16, 206, 14, 214, 182, - 11, 108, 8, 105, 107, 211, 239, 36, 12, 150, - 29, 39, 30, 176, 5, 172, 208, 11, 14, 205, - 12, 218, 80, 11, 235, 73, 9, 44, 42, 155, - 134, 128, 49, 181, 60, 9, 170, 48, 10, 230, - 161, 5, 31, 240, 0, 125, 253, 0, 160, 182, - 23, 147, 64, 180, 23, 58, 117, 84, 23, 5, - 130, 112, 42, 174, 0, 3, 150, 240, 151, 171, - 144, 58, 1, 205, 174, 114, 80, 205, 160, 108, - 214, 3, 25, 209, 185, 160, 13, 202, 208, 0, - 3, 224, 1, 151, 32, 166, 152, 57, 48, 134, - 254, 112, 83, 16, 115, 45, 114, 184, 6, 125, - 112, 7, 123, 160, 5, 241, 178, 0, 125, 61, - 2, 216, 196, 23, 144, 80, 96, 21, 91, 177, - 253, 19, 5, 83, 112, 216, 192, 80, 2, 95, - 96, 23, 82, 234, 9, 165, 128, 8, 65, 27, - 180, 110, 74, 8, 163, 221, 182, 54, 157, 205, - 181, 192, 128, 185, 240, 10, 208, 160, 11, 13, - 160, 0, 24, 0, 6, 208, 32, 158, 208, 208, - 30, 234, 42, 223, 85, 144, 5, 216, 45, 23, - 57, 208, 218, 44, 227, 221, 22, 240, 4, 90, - 241, 29, 170, 64, 157, 215, 170, 147, 196, 147, - 208, 201, 128, 4, 102, 96, 25, 32, 94, 23, - 147, 120, 7, 125, 176, 6, 113, 160, 6, 214, - 60, 55, 106, 122, 223, 114, 4, 79, 39, 148, - 11, 255, 77, 1, 20, 112, 5, 170, 48, 182, - 205, 12, 205, 159, 64, 57, 120, 144, 221, 219, - 157, 3, 38, 80, 43, 101, 195, 50, 19, 238, - 203, 189, 1, 185, 243, 188, 188, 62, 48, 5, - 202, 128, 13, 201, 192, 6, 110, 224, 86, 121, - 0, 226, 82, 174, 4, 34, 126, 6, 36, 222, - 7, 120, 96, 226, 220, 226, 56, 17, 44, 154, - 151, 227, 148, 118, 201, 10, 124, 50, 10, 142, - 176, 33, 215, 225, 227, 77, 2, 228, 182, 242, - 0, 53, 240, 5, 68, 94, 34, 229, 120, 169, - 137, 169, 2, 6, 150, 5, 229, 186, 206, 48, - 64, 16, 166, 160, 8, 192, 81, 62, 229, 32, - 142, 25, 84, 238, 222, 115, 49, 232, 132, 110, - 23, 215, 113, 25, 218, 17, 34, 78, 178, 232, - 181, 98, 1, 109, 30, 32, 37, 162, 16, 151, - 64, 184, 152, 26, 127, 73, 94, 10, 73, 9, - 12, 56, 128, 16, 218, 148, 7, 121, 240, 5, - 182, 17, 234, 162, 158, 3, 184, 129, 27, 218, - 113, 234, 218, 209, 31, 253, 17, 34, 172, 206, - 232, 38, 160, 3, 0, 82, 225, 145, 206, 16, - 148, 142, 169, 116, 126, 164, 186, 144, 12, 187, - 237, 16, 150, 20, 9, 118, 96, 7, 95, 240, - 5, 216, 145, 29, 168, 158, 234, 170, 174, 1, - 31, 160, 3, 184, 17, 236, 120, 33, 235, 179, - 254, 16, 144, 75, 184, 136, 153, 106, 22, 185, - 6, 147, 192, 10, 174, 176, 1, 60, 65, 19, - 145, 240, 230, 207, 222, 17, 128, 64, 184, 33, - 96, 164, 86, 144, 6, 225, 226, 165, 154, 32, - 1, 223, 190, 238, 21, 225, 10, 75, 128, 2, - 54, 240, 3, 66, 148, 6, 228, 178, 11, 192, - 192, 4, 236, 158, 239, 2, 17, 16, 0, 59}; - diff --git a/main/main.c b/main/main.c index feb1e9fe2f577..5eb9947fe7a5c 100644 --- a/main/main.c +++ b/main/main.c @@ -86,7 +86,6 @@ #include "php_content_types.h" #include "php_ticks.h" -#include "php_logos.h" #include "php_streams.h" #include "php_open_temporary_file.h" @@ -1080,7 +1079,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ PG(display_errors) == PHP_DISPLAY_ERRORS_STDERR ) { #ifdef PHP_WIN32 - fprintf(stderr, "%s: %s in %s on line%d\n", error_type_str, buffer, error_filename, error_lineno); + fprintf(stderr, "%s: %s in %s on line %d\n", error_type_str, buffer, error_filename, error_lineno); fflush(stderr); #else fprintf(stderr, "%s: %s in %s on line %d\n", error_type_str, buffer, error_filename, error_lineno); @@ -2157,14 +2156,6 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod return FAILURE; } - /* initialize registry for images to be used in phpinfo() - (this uses configuration parameters from php.ini) - */ - if (php_init_info_logos() == FAILURE) { - php_printf("PHP: Unable to initialize info phpinfo logos.\n"); - return FAILURE; - } - zuv.html_errors = 1; zuv.import_use_extension = ".php"; php_startup_auto_globals(TSRMLS_C); @@ -2348,7 +2339,6 @@ void php_module_shutdown(TSRMLS_D) /* Destroys filter & transport registries too */ php_shutdown_stream_wrappers(module_number TSRMLS_CC); - php_shutdown_info_logos(); UNREGISTER_INI_ENTRIES(); /* close down the ini config */ @@ -2396,10 +2386,6 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) int retval = 0; EG(exit_status) = 0; - if (php_handle_special_queries(TSRMLS_C)) { - zend_file_handle_dtor(primary_file TSRMLS_CC); - return 0; - } #ifndef HAVE_BROKEN_GETCWD # define OLD_CWD_SIZE 4096 old_cwd = do_alloca(OLD_CWD_SIZE, use_heap); diff --git a/main/output.c b/main/output.c index bf0c775e700e3..1c39b3fd21dcd 100644 --- a/main/output.c +++ b/main/output.c @@ -1025,6 +1025,7 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl case PHP_OUTPUT_HANDLER_SUCCESS: /* no more buffered data */ handler->buffer.used = 0; + handler->flags |= PHP_OUTPUT_HANDLER_PROCESSED; break; } diff --git a/main/php_logos.c b/main/php_logos.c deleted file mode 100644 index 3689f71e9533f..0000000000000 --- a/main/php_logos.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2012 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: Hartmut Holzgraefe | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "php.h" -#include "logos.h" -#include "php_logos.h" -#include "ext/standard/info.h" -#include "SAPI.h" - -typedef struct _php_info_logo { - const char *mimetype; - int mimelen; - const unsigned char *data; - int size; -} php_info_logo; - -static HashTable phpinfo_logo_hash; - -PHPAPI int php_register_info_logo(char *logo_string, const char *mimetype, const unsigned char *data, int size) -{ - php_info_logo info_logo; - - info_logo.mimetype = mimetype; - info_logo.mimelen = strlen(mimetype); - info_logo.data = data; - info_logo.size = size; - - return zend_hash_add(&phpinfo_logo_hash, logo_string, strlen(logo_string), &info_logo, sizeof(php_info_logo), NULL); -} - -PHPAPI int php_unregister_info_logo(char *logo_string) -{ - return zend_hash_del(&phpinfo_logo_hash, logo_string, strlen(logo_string)); -} - -int php_init_info_logos(void) -{ - if(zend_hash_init(&phpinfo_logo_hash, 0, NULL, NULL, 1)==FAILURE) - return FAILURE; - - php_register_info_logo(PHP_LOGO_GUID , "image/gif", php_logo , sizeof(php_logo)); - php_register_info_logo(PHP_EGG_LOGO_GUID, "image/gif", php_egg_logo, sizeof(php_egg_logo)); - php_register_info_logo(ZEND_LOGO_GUID , "image/gif", zend_logo , sizeof(zend_logo)); - - return SUCCESS; -} - -int php_shutdown_info_logos(void) -{ - zend_hash_destroy(&phpinfo_logo_hash); - return SUCCESS; -} - -#define CONTENT_TYPE_HEADER "Content-Type: " -int php_info_logos(const char *logo_string TSRMLS_DC) -{ - php_info_logo *logo_image; - char *content_header; - int len; - - if(FAILURE==zend_hash_find(&phpinfo_logo_hash, (char *) logo_string, strlen(logo_string), (void **)&logo_image)) - return 0; - - len = sizeof(CONTENT_TYPE_HEADER) - 1 + logo_image->mimelen; - content_header = emalloc(len + 1); - memcpy(content_header, CONTENT_TYPE_HEADER, sizeof(CONTENT_TYPE_HEADER) - 1); - memcpy(content_header + sizeof(CONTENT_TYPE_HEADER) - 1 , logo_image->mimetype, logo_image->mimelen); - content_header[len] = '\0'; - sapi_add_header(content_header, len, 0); - - PHPWRITE((char*)logo_image->data, logo_image->size); - return 1; -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/main/php_logos.h b/main/php_logos.h deleted file mode 100644 index b9e1144c03123..0000000000000 --- a/main/php_logos.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2012 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: | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - - -#ifndef _PHP_LOGOS_H -#define _PHP_LOGOS_H - -BEGIN_EXTERN_C() -PHPAPI int php_register_info_logo(char *logo_string, const char *mimetype, const unsigned char *data, int size); -PHPAPI int php_unregister_info_logo(char *logo_string); -END_EXTERN_C() - -int php_init_info_logos(void); -int php_shutdown_info_logos(void); -int php_info_logos(const char *logo_string TSRMLS_DC); - -#endif /* _PHP_LOGOS_H */ diff --git a/main/php_output.h b/main/php_output.h index e4ab0f920af99..d050a141a1881 100644 --- a/main/php_output.h +++ b/main/php_output.h @@ -45,6 +45,7 @@ /* handler status flags */ #define PHP_OUTPUT_HANDLER_STARTED 0x1000 #define PHP_OUTPUT_HANDLER_DISABLED 0x2000 +#define PHP_OUTPUT_HANDLER_PROCESSED 0x4000 /* handler op return values */ typedef enum _php_output_handler_status_t { @@ -82,7 +83,7 @@ typedef enum _php_output_handler_hook_t { } php_output_handler_hook_t; #define PHP_OUTPUT_HANDLER_INITBUF_SIZE(s) \ -( (s) ? \ +( ((s) > 1) ? \ (s) + PHP_OUTPUT_HANDLER_ALIGNTO_SIZE - ((s) % (PHP_OUTPUT_HANDLER_ALIGNTO_SIZE)) : \ PHP_OUTPUT_HANDLER_DEFAULT_SIZE \ ) diff --git a/main/php_variables.c b/main/php_variables.c index 427966170c8f3..9952bd80bc8d6 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -27,7 +27,6 @@ #include "php_globals.h" #include "php_content_types.h" #include "SAPI.h" -#include "php_logos.h" #include "zend_globals.h" /* for systems that need to override reading of environment variables */ @@ -532,22 +531,6 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) } /* }}} */ -/* {{{ php_handle_special_queries - */ -PHPAPI int php_handle_special_queries(TSRMLS_D) -{ - if (PG(expose_php) && SG(request_info).query_string && SG(request_info).query_string[0] == '=') { - if (php_info_logos(SG(request_info).query_string + 1 TSRMLS_CC)) { - return 1; - } else if (!strcmp(SG(request_info).query_string + 1, PHP_CREDITS_GUID)) { - php_print_credits(PHP_CREDITS_ALL TSRMLS_CC); - return 1; - } - } - return 0; -} -/* }}} */ - /* {{{ php_register_server_variables */ static inline void php_register_server_variables(TSRMLS_D) diff --git a/main/snprintf.c b/main/snprintf.c index cd038d018cc1c..bda110d339240 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -94,7 +94,7 @@ static char * __cvt(double value, int ndigit, int *decpt, int *sign, int fmode, *decpt = 0; c = *p; zend_freedtoa(p); - return(c == 'I' ? "INF" : "NAN"); + return strdup((c == 'I' ? "INF" : "NAN")); } /* Make a local copy and adjust rve to be in terms of s */ if (pad && fmode) { diff --git a/main/streams/streams.c b/main/streams/streams.c index 3f868b2bd71ee..81bf59446f5dc 100755 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -2263,8 +2263,8 @@ PHPAPI int _php_stream_scandir(char *dirname, char **namelist[], int flags, php_ php_stream *stream; php_stream_dirent sdp; char **vector = NULL; - int vector_size = 0; - int nfiles = 0; + unsigned int vector_size = 0; + unsigned int nfiles = 0; if (!namelist) { return FAILURE; @@ -2280,14 +2280,24 @@ PHPAPI int _php_stream_scandir(char *dirname, char **namelist[], int flags, php_ if (vector_size == 0) { vector_size = 10; } else { + if(vector_size*2 < vector_size) { + /* overflow */ + efree(vector); + return FAILURE; + } vector_size *= 2; } - vector = (char **) erealloc(vector, vector_size * sizeof(char *)); + vector = (char **) safe_erealloc(vector, vector_size, sizeof(char *), 0); } vector[nfiles] = estrdup(sdp.d_name); nfiles++; + if(vector_size < 10 || nfiles == 0) { + /* overflow */ + efree(vector); + return FAILURE; + } } php_stream_closedir(stream); diff --git a/main/streams/userspace.c b/main/streams/userspace.c index 96a5195ed324d..3b277160d6a42 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -281,43 +281,22 @@ typedef struct _php_userstream_data php_userstream_data_t; }}} **/ -static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, char *filename, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) +static zval *user_stream_create_object(struct php_user_stream_wrapper *uwrap, php_stream_context *context TSRMLS_DC) { - struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; - php_userstream_data_t *us; - zval *zfilename, *zmode, *zopened, *zoptions, *zretval = NULL, *zfuncname; - zval **args[4]; - int call_result; - php_stream *stream = NULL; - zend_bool old_in_user_include; - - /* Try to catch bad usage without preventing flexibility */ - if (FG(user_stream_current_filename) != NULL && strcmp(filename, FG(user_stream_current_filename)) == 0) { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "infinite recursion prevented"); - return NULL; - } - FG(user_stream_current_filename) = filename; + zval *object; + /* create an instance of our class */ + ALLOC_ZVAL(object); + object_init_ex(object, uwrap->ce); + Z_SET_REFCOUNT_P(object, 1); + Z_SET_ISREF_P(object); - /* if the user stream was registered as local and we are in include context, - we add allow_url_include restrictions to allow_url_fopen ones */ - /* we need only is_url == 0 here since if is_url == 1 and remote wrappers - were restricted we wouldn't get here */ - old_in_user_include = PG(in_user_include); - if(uwrap->wrapper.is_url == 0 && - (options & STREAM_OPEN_FOR_INCLUDE) && - !PG(allow_url_include)) { - PG(in_user_include) = 1; + if (context) { + add_property_resource(object, "context", context->rsrc_id); + zend_list_addref(context->rsrc_id); + } else { + add_property_null(object, "context"); } - us = emalloc(sizeof(*us)); - us->wrapper = uwrap; - - /* create an instance of our class */ - ALLOC_ZVAL(us->object); - object_init_ex(us->object, uwrap->ce); - Z_SET_REFCOUNT_P(us->object, 1); - Z_SET_ISREF_P(us->object); - if (uwrap->ce->constructor) { zend_fcall_info fci; zend_fcall_info_cache fcc; @@ -327,7 +306,7 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, char *filena fci.function_table = &uwrap->ce->function_table; fci.function_name = NULL; fci.symbol_table = NULL; - fci.object_ptr = us->object; + fci.object_ptr = object; fci.retval_ptr_ptr = &retval_ptr; fci.param_count = 0; fci.params = NULL; @@ -336,16 +315,13 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, char *filena fcc.initialized = 1; fcc.function_handler = uwrap->ce->constructor; fcc.calling_scope = EG(scope); - fcc.called_scope = Z_OBJCE_P(us->object); - fcc.object_ptr = us->object; + fcc.called_scope = Z_OBJCE_P(object); + fcc.object_ptr = object; if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute %s::%s()", uwrap->ce->name, uwrap->ce->constructor->common.function_name); - zval_dtor(us->object); - FREE_ZVAL(us->object); - efree(us); - FG(user_stream_current_filename) = NULL; - PG(in_user_include) = old_in_user_include; + zval_dtor(object); + FREE_ZVAL(object); return NULL; } else { if (retval_ptr) { @@ -353,12 +329,46 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, char *filena } } } + return object; +} - if (context) { - add_property_resource(us->object, "context", context->rsrc_id); - zend_list_addref(context->rsrc_id); - } else { - add_property_null(us->object, "context"); +static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, char *filename, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) +{ + struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; + php_userstream_data_t *us; + zval *zfilename, *zmode, *zopened, *zoptions, *zretval = NULL, *zfuncname; + zval **args[4]; + int call_result; + php_stream *stream = NULL; + zend_bool old_in_user_include; + + /* Try to catch bad usage without preventing flexibility */ + if (FG(user_stream_current_filename) != NULL && strcmp(filename, FG(user_stream_current_filename)) == 0) { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "infinite recursion prevented"); + return NULL; + } + FG(user_stream_current_filename) = filename; + + /* if the user stream was registered as local and we are in include context, + we add allow_url_include restrictions to allow_url_fopen ones */ + /* we need only is_url == 0 here since if is_url == 1 and remote wrappers + were restricted we wouldn't get here */ + old_in_user_include = PG(in_user_include); + if(uwrap->wrapper.is_url == 0 && + (options & STREAM_OPEN_FOR_INCLUDE) && + !PG(allow_url_include)) { + PG(in_user_include) = 1; + } + + us = emalloc(sizeof(*us)); + us->wrapper = uwrap; + + us->object = user_stream_create_object(uwrap, context TSRMLS_CC); + if(us->object == NULL) { + FG(user_stream_current_filename) = NULL; + PG(in_user_include) = old_in_user_include; + efree(us); + return NULL; } /* call it's stream_open method - set up params first */ @@ -447,17 +457,11 @@ static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, char *filen us = emalloc(sizeof(*us)); us->wrapper = uwrap; - /* create an instance of our class */ - ALLOC_ZVAL(us->object); - object_init_ex(us->object, uwrap->ce); - Z_SET_REFCOUNT_P(us->object, 1); - Z_SET_ISREF_P(us->object); - - if (context) { - add_property_resource(us->object, "context", context->rsrc_id); - zend_list_addref(context->rsrc_id); - } else { - add_property_null(us->object, "context"); + us->object = user_stream_create_object(uwrap, context TSRMLS_CC); + if(us == NULL) { + FG(user_stream_current_filename) = NULL; + efree(us); + return NULL; } /* call it's dir_open method - set up params first */ @@ -1157,16 +1161,9 @@ static int user_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int optio int ret = 0; /* create an instance of our class */ - ALLOC_ZVAL(object); - object_init_ex(object, uwrap->ce); - Z_SET_REFCOUNT_P(object, 1); - Z_SET_ISREF_P(object); - - if (context) { - add_property_resource(object, "context", context->rsrc_id); - zend_list_addref(context->rsrc_id); - } else { - add_property_null(object, "context"); + object = user_stream_create_object(uwrap, context TSRMLS_CC); + if(object == NULL) { + return ret; } /* call the unlink method */ @@ -1211,16 +1208,9 @@ static int user_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char int ret = 0; /* create an instance of our class */ - ALLOC_ZVAL(object); - object_init_ex(object, uwrap->ce); - Z_SET_REFCOUNT_P(object, 1); - Z_SET_ISREF_P(object); - - if (context) { - add_property_resource(object, "context", context->rsrc_id); - zend_list_addref(context->rsrc_id); - } else { - add_property_null(object, "context"); + object = user_stream_create_object(uwrap, context TSRMLS_CC); + if(object == NULL) { + return ret; } /* call the rename method */ @@ -1270,16 +1260,9 @@ static int user_wrapper_mkdir(php_stream_wrapper *wrapper, char *url, int mode, int ret = 0; /* create an instance of our class */ - ALLOC_ZVAL(object); - object_init_ex(object, uwrap->ce); - Z_SET_REFCOUNT_P(object, 1); - Z_SET_ISREF_P(object); - - if (context) { - add_property_resource(object, "context", context->rsrc_id); - zend_list_addref(context->rsrc_id); - } else { - add_property_null(object, "context"); + object = user_stream_create_object(uwrap, context TSRMLS_CC); + if(object == NULL) { + return ret; } /* call the mkdir method */ @@ -1335,16 +1318,9 @@ static int user_wrapper_rmdir(php_stream_wrapper *wrapper, char *url, int option int ret = 0; /* create an instance of our class */ - ALLOC_ZVAL(object); - object_init_ex(object, uwrap->ce); - Z_SET_REFCOUNT_P(object, 1); - Z_SET_ISREF_P(object); - - if (context) { - add_property_resource(object, "context", context->rsrc_id); - zend_list_addref(context->rsrc_id); - } else { - add_property_null(object, "context"); + object = user_stream_create_object(uwrap, context TSRMLS_CC); + if(object == NULL) { + return ret; } /* call the rmdir method */ @@ -1420,16 +1396,10 @@ static int user_wrapper_metadata(php_stream_wrapper *wrapper, char *url, int opt } /* create an instance of our class */ - ALLOC_ZVAL(object); - object_init_ex(object, uwrap->ce); - Z_SET_REFCOUNT_P(object, 1); - Z_SET_ISREF_P(object); - - if (context) { - add_property_resource(object, "context", context->rsrc_id); - zend_list_addref(context->rsrc_id); - } else { - add_property_null(object, "context"); + object = user_stream_create_object(uwrap, context TSRMLS_CC); + if(object == NULL) { + zval_ptr_dtor(&zvalue); + return ret; } /* call the mkdir method */ @@ -1484,16 +1454,9 @@ static int user_wrapper_stat_url(php_stream_wrapper *wrapper, char *url, int fla int ret = -1; /* create an instance of our class */ - ALLOC_ZVAL(object); - object_init_ex(object, uwrap->ce); - Z_SET_REFCOUNT_P(object, 1); - Z_SET_ISREF_P(object); - - if (context) { - add_property_resource(object, "context", context->rsrc_id); - zend_list_addref(context->rsrc_id); - } else { - add_property_null(object, "context"); + object = user_stream_create_object(uwrap, context TSRMLS_CC); + if(object == NULL) { + return ret; } /* call it's stat_url method - set up params first */ diff --git a/makedist b/makedist index 4d704cf7c8694..bfc8fcc44a239 100755 --- a/makedist +++ b/makedist @@ -69,9 +69,6 @@ echo "" cd $DIR || exit 5 -# The full ChangeLog is available separately from lxr.php.net -rm -f ChangeLog* - # hide away our own versions of libtool-generated files for i in $LT_TARGETS; do if test -f "$i"; then diff --git a/php.ini-development b/php.ini-development index b7110749dee3f..a97cd0f9dad94 100644 --- a/php.ini-development +++ b/php.ini-development @@ -751,7 +751,7 @@ enable_dl = Off ; will look for to know it is OK to continue execution. Setting this variable MAY ; cause security issues, KNOW WHAT YOU ARE DOING FIRST. ; http://php.net/cgi.redirect-status-env -;cgi.redirect_status_env = ; +;cgi.redirect_status_env = ; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's ; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok @@ -768,7 +768,7 @@ enable_dl = Off ; does not currently support this feature (03/17/2002) ; Set to 1 if running under IIS. Default is zero. ; http://php.net/fastcgi.impersonate -;fastcgi.impersonate = 1; +;fastcgi.impersonate = 1 ; Disable logging through FastCGI connection. PHP's default behavior is to enable ; this feature. @@ -1020,6 +1020,8 @@ mail.add_x_header = On ; The path to a log file that will log all mail() calls. Log entries include ; the full path of the script, line number, To address and headers. ;mail.log = +; Log mail to syslog (Event Log on NT, not valid in Windows 95). +;mail.log = syslog [SQL] ; http://php.net/sql.safe-mode diff --git a/php.ini-production b/php.ini-production index ea29607bc74a1..dce8fc970ccff 100644 --- a/php.ini-production +++ b/php.ini-production @@ -751,7 +751,7 @@ enable_dl = Off ; will look for to know it is OK to continue execution. Setting this variable MAY ; cause security issues, KNOW WHAT YOU ARE DOING FIRST. ; http://php.net/cgi.redirect-status-env -;cgi.redirect_status_env = ; +;cgi.redirect_status_env = ; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's ; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok @@ -768,7 +768,7 @@ enable_dl = Off ; does not currently support this feature (03/17/2002) ; Set to 1 if running under IIS. Default is zero. ; http://php.net/fastcgi.impersonate -;fastcgi.impersonate = 1; +;fastcgi.impersonate = 1 ; Disable logging through FastCGI connection. PHP's default behavior is to enable ; this feature. @@ -1020,6 +1020,8 @@ mail.add_x_header = On ; The path to a log file that will log all mail() calls. Log entries include ; the full path of the script, line number, To address and headers. ;mail.log = +; Log mail to syslog (Event Log on NT, not valid in Windows 95). +;mail.log = syslog [SQL] ; http://php.net/sql.safe-mode diff --git a/run-tests.php b/run-tests.php index cc193e56bc041..86527e12ae5eb 100755 --- a/run-tests.php +++ b/run-tests.php @@ -1,4 +1,4 @@ -#!/usr/bin/php +#!/usr/bin/env php /dev/null'); - if ($just_save_results || !mail_qa_team($failed_tests_data, $compression, $status)) { + if ($just_save_results || !mail_qa_team($failed_tests_data, $compression, $status) && !TRAVIS_CI) { file_put_contents($output_file, $failed_tests_data); if (!$just_save_results) { @@ -435,7 +435,7 @@ function save_or_mail_results() } echo "Please send " . $output_file . " to " . PHP_QA_EMAIL . " manually, thank you.\n"; - } else { + } elseif (!getenv('NO_INTERACTION') && !TRAVIS_CI) { fwrite($fp, "\nThank you for helping to make PHP better.\n"); fclose($fp); } @@ -1315,7 +1315,7 @@ function run_test($php, $file, $env) $tested = trim($section_text['TEST']); /* For GET/POST/PUT tests, check if cgi sapi is available and if it is, use it. */ - if (!empty($section_text['GET']) || !empty($section_text['POST']) || !empty($section_text['POST_RAW']) || !empty($section_text['PUT']) || !empty($section_text['COOKIE']) || !empty($section_text['EXPECTHEADERS'])) { + if (!empty($section_text['GET']) || !empty($section_text['POST']) || !empty($section_text['GZIP_POST']) || !empty($section_text['DEFLATE_POST']) || !empty($section_text['POST_RAW']) || !empty($section_text['PUT']) || !empty($section_text['COOKIE']) || !empty($section_text['EXPECTHEADERS'])) { if (isset($php_cgi)) { $old_php = $php; $php = $php_cgi . ' -C '; @@ -1481,8 +1481,10 @@ function run_test($php, $file, $env) if ($leak_check) { $env['USE_ZEND_ALLOC'] = '0'; + $env['ZEND_DONT_UNLOAD_MODULES'] = 1; } else { $env['USE_ZEND_ALLOC'] = '1'; + $env['ZEND_DONT_UNLOAD_MODULES'] = 0; } junit_start_timer($shortname); @@ -1700,15 +1702,6 @@ function run_test($php, $file, $env) } else if (array_key_exists('POST', $section_text) && !empty($section_text['POST'])) { $post = trim($section_text['POST']); - - if (array_key_exists('GZIP_POST', $section_text) && function_exists('gzencode')) { - $post = gzencode($post, 9, FORCE_GZIP); - $env['HTTP_CONTENT_ENCODING'] = 'gzip'; - } else if (array_key_exists('DEFLATE_POST', $section_text) && function_exists('gzcompress')) { - $post = gzcompress($post, 9); - $env['HTTP_CONTENT_ENCODING'] = 'deflate'; - } - save_text($tmp_post, $post); $content_length = strlen($post); @@ -1718,6 +1711,35 @@ function run_test($php, $file, $env) $cmd = "$php $pass_options $ini_settings -f \"$test_file\" 2>&1 < \"$tmp_post\""; + } else if (array_key_exists('GZIP_POST', $section_text) && !empty($section_text['GZIP_POST'])) { + + $post = trim($section_text['GZIP_POST']); + $post = gzencode($post, 9, FORCE_GZIP); + $env['HTTP_CONTENT_ENCODING'] = 'gzip'; + + save_text($tmp_post, $post); + $content_length = strlen($post); + + $env['REQUEST_METHOD'] = 'POST'; + $env['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'; + $env['CONTENT_LENGTH'] = $content_length; + + $cmd = "$php $pass_options $ini_settings -f \"$test_file\" 2>&1 < \"$tmp_post\""; + + } else if (array_key_exists('DEFLATE_POST', $section_text) && !empty($section_text['DEFLATE_POST'])) { + $post = trim($section_text['DEFLATE_POST']); + $post = gzcompress($post, 9); + $env['HTTP_CONTENT_ENCODING'] = 'deflate'; + save_text($tmp_post, $post); + $content_length = strlen($post); + + $env['REQUEST_METHOD'] = 'POST'; + $env['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'; + $env['CONTENT_LENGTH'] = $content_length; + + $cmd = "$php $pass_options $ini_settings -f \"$test_file\" 2>&1 < \"$tmp_post\""; + + } else { $env['REQUEST_METHOD'] = 'GET'; @@ -1729,6 +1751,7 @@ function run_test($php, $file, $env) if ($leak_check) { $env['USE_ZEND_ALLOC'] = '0'; + $env['ZEND_DONT_UNLOAD_MODULES'] = 1; if ($valgrind_version >= 330) { /* valgrind 3.3.0+ doesn't have --log-file-exactly option */ @@ -1739,6 +1762,7 @@ function run_test($php, $file, $env) } else { $env['USE_ZEND_ALLOC'] = '1'; + $env['ZEND_DONT_UNLOAD_MODULES'] = 0; } if ($DETAILED) echo " @@ -2072,8 +2096,10 @@ function run_test($php, $file, $env) if (isset($old_php)) { $php = $old_php; } + + $diff = empty($diff) ? '' : "', $diff) . "\n]]>"; - junit_mark_test_as($restype, str_replace($cwd . '/', '', $tested_file), $tested, null, $info, "', $diff) . "\n]]>"); + junit_mark_test_as($restype, str_replace($cwd . '/', '', $tested_file), $tested, null, $info, $diff); return $restype[0] . 'ED'; } @@ -2649,12 +2675,15 @@ function junit_mark_test_as($type, $file_name, $test_name, $time = null, $messag $time = null !== $time ? $time : junit_get_timer($file_name); junit_suite_record($suite, 'execution_time', $time); + $escaped_details = htmlspecialchars($details, ENT_QUOTES, 'UTF-8'); + $escaped_test_name = basename($file_name) . ' - ' . htmlspecialchars($test_name, ENT_QUOTES); $JUNIT['files'][$file_name]['xml'] = "\n"; if (is_array($type)) { $output_type = $type[0] . 'ED'; - $type = reset(array_intersect(array('XFAIL', 'FAIL'), $type)); + $temp = array_intersect(array('XFAIL', 'FAIL'), $type); + $type = reset($temp); } else { $output_type = $type . 'ED'; } @@ -2669,10 +2698,10 @@ function junit_mark_test_as($type, $file_name, $test_name, $time = null, $messag $JUNIT['files'][$file_name]['xml'] .= "$message\n"; } elseif('FAIL' == $type) { junit_suite_record($suite, 'test_fail'); - $JUNIT['files'][$file_name]['xml'] .= "$details\n"; + $JUNIT['files'][$file_name]['xml'] .= "$escaped_details\n"; } else { junit_suite_record($suite, 'test_error'); - $JUNIT['files'][$file_name]['xml'] .= "$details\n"; + $JUNIT['files'][$file_name]['xml'] .= "$escaped_details\n"; } $JUNIT['files'][$file_name]['xml'] .= "\n"; diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c index e8116f9eba05d..0b51cfbe62f39 100644 --- a/sapi/apache2filter/sapi_apache2.c +++ b/sapi/apache2filter/sapi_apache2.c @@ -311,7 +311,7 @@ php_apache_disable_caching(ap_filter_t *f) static double php_apache_sapi_get_request_time(TSRMLS_D) { php_struct *ctx = SG(server_context); - return apr_time_as_msec(ctx->r->request_time); + return ((double) apr_time_as_msec(ctx->r->request_time)) / 1000.0; } extern zend_module_entry php_apache_module; diff --git a/sapi/cgi/tests/apache_request_headers.phpt b/sapi/cgi/tests/apache_request_headers.phpt index 2c82d57b2e425..881b6bb171c84 100644 --- a/sapi/cgi/tests/apache_request_headers.phpt +++ b/sapi/cgi/tests/apache_request_headers.phpt @@ -1,5 +1,7 @@ --TEST-- apache_request_headers() stack overflow. +--INI-- +default_charset="UTF-8" --SKIPIF-- --EXPECTF-- X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/%s Array ( diff --git a/sapi/cli/config.m4 b/sapi/cli/config.m4 index 77fc5e9551ce5..cdfa1f7daff2a 100644 --- a/sapi/cli/config.m4 +++ b/sapi/cli/config.m4 @@ -44,5 +44,7 @@ if test "$PHP_CLI" != "no"; then PHP_SUBST(BUILD_CLI) PHP_OUTPUT(sapi/cli/php.1) + + PHP_INSTALL_HEADERS([sapi/cli/cli.h]) fi AC_MSG_RESULT($PHP_CLI) diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 205b9db3feb9c..f9bf3ee60bd8e 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -1167,12 +1167,15 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ } zend_end_try(); out: - if (exit_status == 0) { - exit_status = EG(exit_status); - } if (request_started) { php_request_shutdown((void *) 0); } + if (translated_path) { + free(translated_path); + } + if (exit_status == 0) { + exit_status = EG(exit_status); + } return exit_status; err: sapi_deactivate(TSRMLS_C); diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 87ab7b48f4975..89262e863df22 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -1618,7 +1618,11 @@ static int php_cli_server_client_read_request(php_cli_server_client *client, cha client->parser.data = client; nbytes_consumed = php_http_parser_execute(&client->parser, &settings, buf, nbytes_read); if (nbytes_consumed != nbytes_read) { - *errstr = estrdup("Malformed HTTP request"); + if (buf[0] & 0x80 /* SSLv2 */ || buf[0] == 0x16 /* SSLv3/TLSv1 */) { + *errstr = estrdup("Unsupported SSL request"); + } else { + *errstr = estrdup("Malformed HTTP request"); + } return -1; } if (client->current_header_name) { @@ -1826,6 +1830,9 @@ static int php_cli_server_send_error_page(php_cli_server *server, php_cli_server return SUCCESS; fail: + if (errstr) { + pefree(errstr, 1); + } efree(escaped_request_uri); return FAILURE; } /* }}} */ @@ -1941,40 +1948,38 @@ static int php_cli_server_request_shutdown(php_cli_server *server, php_cli_serve static int php_cli_server_dispatch_router(php_cli_server *server, php_cli_server_client *client TSRMLS_DC) /* {{{ */ { int decline = 0; - if (!php_handle_special_queries(TSRMLS_C)) { - zend_file_handle zfd; - char *old_cwd; - - ALLOCA_FLAG(use_heap) - old_cwd = do_alloca(MAXPATHLEN, use_heap); - old_cwd[0] = '\0'; - php_ignore_value(VCWD_GETCWD(old_cwd, MAXPATHLEN - 1)); - - zfd.type = ZEND_HANDLE_FILENAME; - zfd.filename = server->router; - zfd.handle.fp = NULL; - zfd.free_filename = 0; - zfd.opened_path = NULL; - - zend_try { - zval *retval = NULL; - if (SUCCESS == zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, &retval, 1, &zfd)) { - if (retval) { - decline = Z_TYPE_P(retval) == IS_BOOL && !Z_LVAL_P(retval); - zval_ptr_dtor(&retval); - } - } else { - decline = 1; + zend_file_handle zfd; + char *old_cwd; + + ALLOCA_FLAG(use_heap) + old_cwd = do_alloca(MAXPATHLEN, use_heap); + old_cwd[0] = '\0'; + php_ignore_value(VCWD_GETCWD(old_cwd, MAXPATHLEN - 1)); + + zfd.type = ZEND_HANDLE_FILENAME; + zfd.filename = server->router; + zfd.handle.fp = NULL; + zfd.free_filename = 0; + zfd.opened_path = NULL; + + zend_try { + zval *retval = NULL; + if (SUCCESS == zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, &retval, 1, &zfd)) { + if (retval) { + decline = Z_TYPE_P(retval) == IS_BOOL && !Z_LVAL_P(retval); + zval_ptr_dtor(&retval); } - } zend_end_try(); - - if (old_cwd[0] != '\0') { - php_ignore_value(VCWD_CHDIR(old_cwd)); + } else { + decline = 1; } + } zend_end_try(); - free_alloca(old_cwd, use_heap); + if (old_cwd[0] != '\0') { + php_ignore_value(VCWD_CHDIR(old_cwd)); } + free_alloca(old_cwd, use_heap); + return decline; } /* }}} */ @@ -2400,7 +2405,7 @@ int do_cli_server(int argc, char **argv TSRMLS_DC) /* {{{ */ php_localtime_r(&tv.tv_sec, &tm); php_asctime_r(&tm, buf); printf("PHP %s Development Server started at %s" - "Listening on %s\n" + "Listening on http://%s\n" "Document root is %s\n" "Press Ctrl-C to quit.\n", PHP_VERSION, buf, server_bind_address, document_root); diff --git a/sapi/cli/tests/bug61546.phpt b/sapi/cli/tests/bug61546.phpt index 2cd690f65c89e..071edb7224425 100644 --- a/sapi/cli/tests/bug61546.phpt +++ b/sapi/cli/tests/bug61546.phpt @@ -2,13 +2,22 @@ Bug #61546 (functions related to current script failed when chdir() in cli sapi) --FILE-- ---FILE-- - ---EXPECTF-- -okey diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 index 89628100b4f15..ad46717acdb1e 100644 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@ -16,6 +16,7 @@ AC_DEFUN([AC_FPM_STDLIBS], AC_CHECK_HEADERS([errno.h fcntl.h stdio.h stdlib.h unistd.h sys/uio.h]) AC_CHECK_HEADERS([sys/select.h sys/socket.h sys/time.h]) AC_CHECK_HEADERS([arpa/inet.h netinet/in.h]) + AC_CHECK_HEADERS([sysexits.h]) ]) AC_DEFUN([AC_FPM_PRCTL], @@ -192,6 +193,8 @@ AC_DEFUN([AC_FPM_TRACE], have_ptrace=no have_broken_ptrace=yes AC_MSG_RESULT([no]) + ], [ + AC_MSG_RESULT([skipped (cross compiling)]) ]) fi @@ -264,6 +267,8 @@ AC_DEFUN([AC_FPM_TRACE], ], [ proc_mem_file="" AC_MSG_RESULT([no]) + ], [ + AC_MSG_RESULT([skipped (cross compiling)]) ]) fi diff --git a/sapi/fpm/fpm/fastcgi.c b/sapi/fpm/fpm/fastcgi.c index 212b6ff1db522..e2e208aa7fd3b 100644 --- a/sapi/fpm/fpm/fastcgi.c +++ b/sapi/fpm/fpm/fastcgi.c @@ -399,7 +399,7 @@ static inline int fcgi_param_get_eff_len( unsigned char *p, unsigned char *end, { int ret = 1; int zero_found = 0; - *eff_len = 0; + *eff_len = 0; for (; p != end; ++p) { if (*p == '\0') { zero_found = 1; @@ -427,7 +427,7 @@ static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *e char *tmp = buf; size_t buf_size = sizeof(buf); int name_len, val_len; - uint eff_name_len, eff_val_len; + uint eff_name_len; char *s; int ret = 1; size_t bytes_consumed; @@ -453,8 +453,12 @@ static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *e ret = 0; break; } - if (!fcgi_param_get_eff_len(p, p+name_len, &eff_name_len) || - !fcgi_param_get_eff_len(p+name_len, p+name_len+val_len, &eff_val_len)) { + + /* + * get the effective length of the name in case it's not a valid string + * don't do this on the value because it can be binary data + */ + if (!fcgi_param_get_eff_len(p, p+name_len, &eff_name_len)){ /* Malicious request */ ret = 0; break; @@ -473,7 +477,7 @@ static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *e } memcpy(tmp, p, eff_name_len); tmp[eff_name_len] = 0; - s = estrndup((char*)p + name_len, eff_val_len); + s = estrndup((char*)p + name_len, val_len); if (s == NULL) { ret = 0; break; diff --git a/sapi/fpm/fpm/fpm.c b/sapi/fpm/fpm/fpm.c index 96aabbfc49959..dab415d123156 100644 --- a/sapi/fpm/fpm/fpm.c +++ b/sapi/fpm/fpm/fpm.c @@ -37,10 +37,12 @@ struct fpm_globals_s fpm_globals = { .max_requests = 0, .is_child = 0, .test_successful = 0, - .heartbeat = 0 + .heartbeat = 0, + .run_as_root = 0, + .send_config_signal = 0, }; -int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf) /* {{{ */ +int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root) /* {{{ */ { fpm_globals.argc = argc; fpm_globals.argv = argv; @@ -49,6 +51,7 @@ int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int t } fpm_globals.prefix = prefix; fpm_globals.pid = pid; + fpm_globals.run_as_root = run_as_root; if (0 > fpm_php_init_main() || 0 > fpm_stdio_init_main() || @@ -64,7 +67,7 @@ int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int t 0 > fpm_event_init_main()) { if (fpm_globals.test_successful) { - exit(0); + exit(FPM_EXIT_OK); } else { zlog(ZLOG_ERROR, "FPM initialization failed"); return -1; diff --git a/sapi/fpm/fpm/fpm.h b/sapi/fpm/fpm/fpm.h index bfeac4d67d8d4..7a2903d07d3e6 100644 --- a/sapi/fpm/fpm/fpm.h +++ b/sapi/fpm/fpm/fpm.h @@ -7,8 +7,37 @@ #include +#ifdef HAVE_SYSEXITS_H +#include +#endif + +#ifdef EX_OK +#define FPM_EXIT_OK EX_OK +#else +#define FPM_EXIT_OK 0 +#endif + +#ifdef EX_USAGE +#define FPM_EXIT_USAGE EX_USAGE +#else +#define FPM_EXIT_USAGE 64 +#endif + +#ifdef EX_SOFTWARE +#define FPM_EXIT_SOFTWARE EX_SOFTWARE +#else +#define FPM_EXIT_SOFTWARE 70 +#endif + +#ifdef EX_CONFIG +#define FPM_EXIT_CONFIG EX_CONFIG +#else +#define FPM_EXIT_CONFIG 78 +#endif + + int fpm_run(int *max_requests); -int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf); +int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root); struct fpm_globals_s { pid_t parent_pid; @@ -25,6 +54,8 @@ struct fpm_globals_s { int is_child; int test_successful; int heartbeat; + int run_as_root; + int send_config_signal; }; extern struct fpm_globals_s fpm_globals; diff --git a/sapi/fpm/fpm/fpm_children.c b/sapi/fpm/fpm/fpm_children.c index 35058b0ea10ca..84a9474332215 100644 --- a/sapi/fpm/fpm/fpm_children.c +++ b/sapi/fpm/fpm/fpm_children.c @@ -156,7 +156,7 @@ static void fpm_child_init(struct fpm_worker_pool_s *wp) /* {{{ */ 0 > fpm_php_init_child(wp)) { zlog(ZLOG_ERROR, "[pool %s] child failed to initialize", wp->config->name); - exit(255); + exit(FPM_EXIT_SOFTWARE); } } /* }}} */ @@ -198,7 +198,7 @@ void fpm_children_bury() /* {{{ */ restart_child = 0; } - if (WEXITSTATUS(status) != 0) { + if (WEXITSTATUS(status) != FPM_EXIT_OK) { severity = ZLOG_WARNING; } diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 304076d35eb94..dfe6792c058b7 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -53,7 +53,9 @@ static int fpm_conf_load_ini_file(char *filename TSRMLS_DC); static char *fpm_conf_set_integer(zval *value, void **config, intptr_t offset); +#if 0 /* not used for now */ static char *fpm_conf_set_long(zval *value, void **config, intptr_t offset); +#endif static char *fpm_conf_set_time(zval *value, void **config, intptr_t offset); static char *fpm_conf_set_boolean(zval *value, void **config, intptr_t offset); static char *fpm_conf_set_string(zval *value, void **config, intptr_t offset); @@ -70,6 +72,7 @@ struct fpm_global_config_s fpm_global_config = { .syslog_facility = -1, #endif .process_max = 0, + .process_priority = 64, /* 64 means unset */ }; static struct fpm_worker_pool_s *current_wp = NULL; static int ini_recursion = 0; @@ -92,6 +95,7 @@ static struct ini_value_parser_s ini_fpm_global_options[] = { { "emergency_restart_interval", &fpm_conf_set_time, GO(emergency_restart_interval) }, { "process_control_timeout", &fpm_conf_set_time, GO(process_control_timeout) }, { "process.max", &fpm_conf_set_integer, GO(process_max) }, + { "process.priority", &fpm_conf_set_integer, GO(process_priority) }, { "daemonize", &fpm_conf_set_boolean, GO(daemonize) }, { "rlimit_files", &fpm_conf_set_integer, GO(rlimit_files) }, { "rlimit_core", &fpm_conf_set_rlimit_core, GO(rlimit_core) }, @@ -112,6 +116,7 @@ static struct ini_value_parser_s ini_fpm_pool_options[] = { { "listen.group", &fpm_conf_set_string, WPO(listen_group) }, { "listen.mode", &fpm_conf_set_string, WPO(listen_mode) }, { "listen.allowed_clients", &fpm_conf_set_string, WPO(listen_allowed_clients) }, + { "process.priority", &fpm_conf_set_integer, WPO(process_priority) }, { "pm", &fpm_conf_set_pm, WPO(pm) }, { "pm.max_children", &fpm_conf_set_integer, WPO(pm_max_children) }, { "pm.start_servers", &fpm_conf_set_integer, WPO(pm_start_servers) }, @@ -239,6 +244,7 @@ static char *fpm_conf_set_integer(zval *value, void **config, intptr_t offset) / } /* }}} */ +#if 0 /* not used for now */ static char *fpm_conf_set_long(zval *value, void **config, intptr_t offset) /* {{{ */ { char *val = Z_STRVAL_P(value); @@ -254,6 +260,7 @@ static char *fpm_conf_set_long(zval *value, void **config, intptr_t offset) /* { return NULL; } /* }}} */ +#endif static char *fpm_conf_set_time(zval *value, void **config, intptr_t offset) /* {{{ */ { @@ -577,6 +584,7 @@ static void *fpm_worker_pool_config_alloc() /* {{{ */ memset(wp->config, 0, sizeof(struct fpm_worker_pool_config_s)); wp->config->listen_backlog = FPM_BACKLOG_DEFAULT; wp->config->pm_process_idle_timeout = 10; /* 10s by default */ + wp->config->process_priority = 64; /* 64 means unset */ if (!fpm_worker_all_pools) { fpm_worker_all_pools = wp; @@ -704,7 +712,7 @@ static int fpm_evaluate_full_path(char **path, struct fpm_worker_pool_s *wp, cha static int fpm_conf_process_all_pools() /* {{{ */ { - struct fpm_worker_pool_s *wp; + struct fpm_worker_pool_s *wp, *wp2; if (!fpm_worker_all_pools) { zlog(ZLOG_ERROR, "No pool defined. at least one pool section must be specified in config file"); @@ -723,8 +731,8 @@ static int fpm_conf_process_all_pools() /* {{{ */ } } - /* user */ - if (!wp->config->user) { + /* alert if user is not set only if we are not root*/ + if (!wp->config->user && !geteuid()) { zlog(ZLOG_ALERT, "[pool %s] user has not been defined", wp->config->name); return -1; } @@ -741,6 +749,11 @@ static int fpm_conf_process_all_pools() /* {{{ */ return -1; } + if (wp->config->process_priority != 64 && (wp->config->process_priority < -19 || wp->config->process_priority > 20)) { + zlog(ZLOG_ERROR, "[pool %s] process.priority must be included into [-19,20]", wp->config->name); + return -1; + } + /* pm */ if (wp->config->pm != PM_STYLE_STATIC && wp->config->pm != PM_STYLE_DYNAMIC && wp->config->pm != PM_STYLE_ONDEMAND) { zlog(ZLOG_ALERT, "[pool %s] the process manager is missing (static, dynamic or ondemand)", wp->config->name); @@ -1044,6 +1057,20 @@ static int fpm_conf_process_all_pools() /* {{{ */ } } } + + /* ensure 2 pools do not use the same listening address */ + for (wp = fpm_worker_all_pools; wp; wp = wp->next) { + for (wp2 = fpm_worker_all_pools; wp2; wp2 = wp2->next) { + if (wp == wp2) { + continue; + } + + if (wp->config->listen_address && *wp->config->listen_address && wp2->config->listen_address && *wp2->config->listen_address && !strcmp(wp->config->listen_address, wp2->config->listen_address)) { + zlog(ZLOG_ERROR, "[pool %s] unable to set listen address as it's already used in another pool '%s'", wp2->config->name, wp->config->name); + return -1; + } + } + } return 0; } /* }}} */ @@ -1103,6 +1130,11 @@ static int fpm_conf_post_process(TSRMLS_D) /* {{{ */ return -1; } + if (fpm_global_config.process_priority != 64 && (fpm_global_config.process_priority < -19 || fpm_global_config.process_priority > 20)) { + zlog(ZLOG_ERROR, "process.priority must be included into [-19,20]"); + return -1; + } + if (!fpm_global_config.error_log) { fpm_global_config.error_log = strdup("log/php-fpm.log"); } @@ -1485,6 +1517,11 @@ static void fpm_conf_dump() /* {{{ */ zlog(ZLOG_NOTICE, "\temergency_restart_threshold = %d", fpm_global_config.emergency_restart_threshold); zlog(ZLOG_NOTICE, "\tprocess_control_timeout = %ds", fpm_global_config.process_control_timeout); zlog(ZLOG_NOTICE, "\tprocess.max = %d", fpm_global_config.process_max); + if (fpm_global_config.process_priority == 64) { + zlog(ZLOG_NOTICE, "\tprocess.priority = undefined"); + } else { + zlog(ZLOG_NOTICE, "\tprocess.priority = %d", fpm_global_config.process_priority); + } zlog(ZLOG_NOTICE, "\tdaemonize = %s", BOOL2STR(fpm_global_config.daemonize)); zlog(ZLOG_NOTICE, "\trlimit_files = %d", fpm_global_config.rlimit_files); zlog(ZLOG_NOTICE, "\trlimit_core = %d", fpm_global_config.rlimit_core); @@ -1504,6 +1541,11 @@ static void fpm_conf_dump() /* {{{ */ zlog(ZLOG_NOTICE, "\tlisten.group = %s", STR2STR(wp->config->listen_group)); zlog(ZLOG_NOTICE, "\tlisten.mode = %s", STR2STR(wp->config->listen_mode)); zlog(ZLOG_NOTICE, "\tlisten.allowed_clients = %s", STR2STR(wp->config->listen_allowed_clients)); + if (wp->config->process_priority == 64) { + zlog(ZLOG_NOTICE, "\tprocess.priority = undefined"); + } else { + zlog(ZLOG_NOTICE, "\tprocess.priority = %d", wp->config->process_priority); + } zlog(ZLOG_NOTICE, "\tpm = %s", PM2STR(wp->config->pm)); zlog(ZLOG_NOTICE, "\tpm.max_children = %d", wp->config->pm_max_children); zlog(ZLOG_NOTICE, "\tpm.start_servers = %d", wp->config->pm_start_servers); diff --git a/sapi/fpm/fpm/fpm_conf.h b/sapi/fpm/fpm/fpm_conf.h index 9fbd5064c06bc..f780f038915d9 100644 --- a/sapi/fpm/fpm/fpm_conf.h +++ b/sapi/fpm/fpm/fpm_conf.h @@ -35,6 +35,7 @@ struct fpm_global_config_s { int emergency_restart_interval; int process_control_timeout; int process_max; + int process_priority; int daemonize; int rlimit_files; int rlimit_core; @@ -57,6 +58,7 @@ struct fpm_worker_pool_config_s { char *listen_group; char *listen_mode; char *listen_allowed_clients; + int process_priority; int pm; int pm_max_children; int pm_start_servers; diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 14dccbd145374..83b461b793307 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -154,6 +154,7 @@ static const opt_struct OPTIONS[] = { {'t', 0, "test"}, {'p', 1, "prefix"}, {'g', 1, "pid"}, + {'R', 0, "allow-to-run-as-root"}, {'-', 0, NULL} /* end of args */ }; @@ -646,12 +647,38 @@ static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC) } } -static void sapi_cgi_log_message(char *message TSRMLS_DC) +/* {{{ sapi_cgi_log_fastcgi + * + * Ignore level, we want to send all messages through fastcgi + */ +void sapi_cgi_log_fastcgi(int level, char *message, size_t len) { - if (CGIG(fcgi_logging)) { - zlog(ZLOG_NOTICE, "PHP message: %s", message); + TSRMLS_FETCH(); + + fcgi_request *request = (fcgi_request*) SG(server_context); + + /* ensure we want: + * - to log (fastcgi.logging in php.ini) + * - we are currently dealing with a request + * - the message is not empty + */ + if (CGIG(fcgi_logging) && request && message && len > 0) { + char *buf = malloc(len + 2); + memcpy(buf, message, len); + memcpy(buf + len, "\n", sizeof("\n")); + fcgi_write(request, FCGI_STDERR, buf, len+1); + free(buf); } } +/* }}} */ + +/* {{{ sapi_cgi_log_message + */ +static void sapi_cgi_log_message(char *message) +{ + zlog(ZLOG_NOTICE, "PHP message: %s", message); +} +/* }}} */ /* {{{ php_cgi_ini_activate_user_config */ @@ -900,7 +927,9 @@ static void php_cgi_usage(char *argv0) " Specify the PID file location.\n" " -y, --fpm-config \n" " Specify alternative path to FastCGI process manager config file.\n" - " -t, --test Test FPM configuration and exit\n", + " -t, --test Test FPM configuration and exit\n" + " -R, --allow-to-run-as-root\n" + " Allow pool to run as root (disabled by default)\n", prog, PHP_PREFIX); } /* }}} */ @@ -1499,7 +1528,7 @@ static zend_module_entry cgi_module_entry = { */ int main(int argc, char *argv[]) { - int exit_status = SUCCESS; + int exit_status = FPM_EXIT_OK; int cgi = 0, c, use_extended_info = 0; zend_file_handle file_handle; @@ -1522,6 +1551,7 @@ int main(int argc, char *argv[]) char *fpm_pid = NULL; int test_conf = 0; int php_information = 0; + int php_allow_to_run_as_root = 0; #ifdef HAVE_SIGNAL_H #if defined(SIGPIPE) && defined(SIG_IGN) @@ -1629,13 +1659,17 @@ int main(int argc, char *argv[]) php_output_end_all(TSRMLS_C); php_output_deactivate(TSRMLS_C); fcgi_shutdown(); - exit_status = 0; + exit_status = FPM_EXIT_OK; goto out; case 'i': /* php info & quit */ php_information = 1; break; + case 'R': /* allow to run as root */ + php_allow_to_run_as_root = 1; + break; + default: case 'h': case '?': @@ -1646,7 +1680,7 @@ int main(int argc, char *argv[]) php_output_end_all(TSRMLS_C); php_output_deactivate(TSRMLS_C); fcgi_shutdown(); - exit_status = 0; + exit_status = (c == 'h') ? FPM_EXIT_OK : FPM_EXIT_USAGE; goto out; case 'v': /* show php version & quit */ @@ -1654,7 +1688,7 @@ int main(int argc, char *argv[]) if (php_request_startup(TSRMLS_C) == FAILURE) { SG(server_context) = NULL; php_module_shutdown(TSRMLS_C); - return FAILURE; + return FPM_EXIT_SOFTWARE; } SG(headers_sent) = 1; SG(request_info).no_headers = 1; @@ -1666,7 +1700,7 @@ int main(int argc, char *argv[]) #endif php_request_shutdown((void *) 0); fcgi_shutdown(); - exit_status = 0; + exit_status = FPM_EXIT_OK; goto out; } } @@ -1677,14 +1711,14 @@ int main(int argc, char *argv[]) if (php_request_startup(TSRMLS_C) == FAILURE) { SG(server_context) = NULL; php_module_shutdown(TSRMLS_C); - return FAILURE; + return FPM_EXIT_SOFTWARE; } SG(headers_sent) = 1; SG(request_info).no_headers = 1; php_print_info(0xFFFFFFFF TSRMLS_CC); php_request_shutdown((void *) 0); fcgi_shutdown(); - exit_status = 0; + exit_status = FPM_EXIT_OK; goto out; } @@ -1697,7 +1731,7 @@ int main(int argc, char *argv[]) php_output_end_all(TSRMLS_C); php_output_deactivate(TSRMLS_C); fcgi_shutdown(); - exit_status = 0; + exit_status = FPM_EXIT_USAGE; goto out; } @@ -1716,7 +1750,7 @@ int main(int argc, char *argv[]) #ifdef ZTS tsrm_shutdown(); #endif - return FAILURE; + return FPM_EXIT_SOFTWARE; } if (use_extended_info) { @@ -1759,19 +1793,31 @@ consult the installation file that came with this distribution, or visit \n\ */ tsrm_shutdown(); #endif - return FAILURE; + return FPM_EXIT_SOFTWARE; } } - if (0 > fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, fpm_pid, test_conf)) { - return FAILURE; + if (0 > fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, fpm_pid, test_conf, php_allow_to_run_as_root)) { + + if (fpm_globals.send_config_signal) { + zlog(ZLOG_DEBUG, "Sending SIGUSR2 (error) to parent %d", getppid()); + kill(getppid(), SIGUSR2); + } + return FPM_EXIT_CONFIG; } + if (fpm_globals.send_config_signal) { + zlog(ZLOG_DEBUG, "Sending SIGUSR1 (OK) to parent %d", getppid()); + kill(getppid(), SIGUSR1); + } fpm_is_running = 1; fcgi_fd = fpm_run(&max_requests); parent = 0; + /* onced forked tell zlog to also send messages through sapi_cgi_log_fastcgi() */ + zlog_set_external_logger(sapi_cgi_log_fastcgi); + /* make php call us to get _ENV vars */ php_php_import_environment_variables = php_import_environment_variables; php_import_environment_variables = cgi_php_import_environment_variables; @@ -1795,7 +1841,7 @@ consult the installation file that came with this distribution, or visit \n\ fcgi_finish_request(&request, 1); SG(server_context) = NULL; php_module_shutdown(TSRMLS_C); - return FAILURE; + return FPM_EXIT_SOFTWARE; } /* check if request_method has been sent. @@ -1883,17 +1929,9 @@ consult the installation file that came with this distribution, or visit \n\ php_request_shutdown((void *) 0); - if (exit_status == 0) { - exit_status = EG(exit_status); - } - requests++; if (max_requests && (requests == max_requests)) { fcgi_finish_request(&request, 1); - if (max_requests != 1) { - /* no need to return exit_status of the last request */ - exit_status = 0; - } break; } /* end of fastcgi loop */ @@ -1907,7 +1945,7 @@ consult the installation file that came with this distribution, or visit \n\ free(cgi_sapi_module.ini_entries); } } zend_catch { - exit_status = 255; + exit_status = FPM_EXIT_SOFTWARE; } zend_end_try(); out: diff --git a/sapi/fpm/fpm/fpm_php.c b/sapi/fpm/fpm/fpm_php.c index 840eec73efbae..cd4d3aef3a330 100644 --- a/sapi/fpm/fpm/fpm_php.c +++ b/sapi/fpm/fpm/fpm_php.c @@ -257,3 +257,41 @@ int fpm_php_limit_extensions(char *path) /* {{{ */ return 1; /* extension not found: not allowed */ } /* }}} */ + +char* fpm_php_get_string_from_table(char *table, char *key TSRMLS_DC) /* {{{ */ +{ + zval **data, **tmp; + char *string_key; + uint string_len; + ulong num_key; + if (!table || !key) { + return NULL; + } + + /* inspired from ext/standard/info.c */ + + zend_is_auto_global(table, strlen(table) TSRMLS_CC); + + /* find the table and ensure it's an array */ + if (zend_hash_find(&EG(symbol_table), table, strlen(table) + 1, (void **) &data) == SUCCESS && Z_TYPE_PP(data) == IS_ARRAY) { + + /* reset the internal pointer */ + zend_hash_internal_pointer_reset(Z_ARRVAL_PP(data)); + + /* parse the array to look for our key */ + while (zend_hash_get_current_data(Z_ARRVAL_PP(data), (void **) &tmp) == SUCCESS) { + /* ensure the key is a string */ + if (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), &string_key, &string_len, &num_key, 0, NULL) == HASH_KEY_IS_STRING) { + /* compare to our key */ + if (!strncmp(string_key, key, string_len)) { + return Z_STRVAL_PP(tmp); + } + } + zend_hash_move_forward(Z_ARRVAL_PP(data)); + } + } + + return NULL; +} +/* }}} */ + diff --git a/sapi/fpm/fpm/fpm_php.h b/sapi/fpm/fpm/fpm_php.h index a2c7ed318a092..d6054737d67a9 100644 --- a/sapi/fpm/fpm/fpm_php.h +++ b/sapi/fpm/fpm/fpm_php.h @@ -44,6 +44,7 @@ void fpm_php_soft_quit(); int fpm_php_init_main(); int fpm_php_apply_defines_ex(struct key_value_s *kv, int mode); int fpm_php_limit_extensions(char *path); +char* fpm_php_get_string_from_table(char *table, char *key TSRMLS_DC); #endif diff --git a/sapi/fpm/fpm/fpm_process_ctl.c b/sapi/fpm/fpm/fpm_process_ctl.c index e698eb0ca2a84..7840d17f8b9c5 100644 --- a/sapi/fpm/fpm/fpm_process_ctl.c +++ b/sapi/fpm/fpm/fpm_process_ctl.c @@ -71,7 +71,7 @@ static void fpm_pctl_exit() /* {{{ */ fpm_conf_unlink_pid(); fpm_cleanups_run(FPM_CLEANUP_PARENT_EXIT_MAIN); - exit(0); + exit(FPM_EXIT_OK); } /* }}} */ @@ -100,7 +100,7 @@ static void fpm_pctl_exec() /* {{{ */ fpm_cleanups_run(FPM_CLEANUP_PARENT_EXEC); execvp(saved_argv[0], saved_argv); zlog(ZLOG_SYSERROR, "failed to reload: execvp() failed"); - exit(1); + exit(FPM_EXIT_SOFTWARE); } /* }}} */ diff --git a/sapi/fpm/fpm/fpm_signals.c b/sapi/fpm/fpm/fpm_signals.c index 8993a860ae87d..656269f1a3610 100644 --- a/sapi/fpm/fpm/fpm_signals.c +++ b/sapi/fpm/fpm/fpm_signals.c @@ -249,3 +249,15 @@ int fpm_signals_get_fd() /* {{{ */ } /* }}} */ +void fpm_signals_sighandler_exit_ok(pid_t pid) /* {{{ */ +{ + exit(FPM_EXIT_OK); +} +/* }}} */ + +void fpm_signals_sighandler_exit_config(pid_t pid) /* {{{ */ +{ + exit(FPM_EXIT_CONFIG); +} +/* }}} */ + diff --git a/sapi/fpm/fpm/fpm_signals.h b/sapi/fpm/fpm/fpm_signals.h index eb80faecfdb54..13484cbac281f 100644 --- a/sapi/fpm/fpm/fpm_signals.h +++ b/sapi/fpm/fpm/fpm_signals.h @@ -11,6 +11,9 @@ int fpm_signals_init_main(); int fpm_signals_init_child(); int fpm_signals_get_fd(); +void fpm_signals_sighandler_exit_ok(pid_t pid); +void fpm_signals_sighandler_exit_config(pid_t pid); + extern const char *fpm_signal_names[NSIG + 1]; #endif diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c index cb4897e9b408b..f56b9cfbd1493 100644 --- a/sapi/fpm/fpm/fpm_sockets.c +++ b/sapi/fpm/fpm/fpm_sockets.c @@ -179,6 +179,10 @@ static int fpm_sockets_new_listening_socket(struct fpm_worker_pool_s *wp, struct setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &flags, sizeof(flags)); if (wp->listen_address_domain == FPM_AF_UNIX) { + if (fpm_socket_unix_test_connect((struct sockaddr_un *)sa, socklen) == 0) { + zlog(ZLOG_ERROR, "An another FPM instance seems to already listen on %s", ((struct sockaddr_un *) sa)->sun_path); + return -1; + } unlink( ((struct sockaddr_un *) sa)->sun_path); saved_umask = umask(0777 ^ wp->socket_mode); } @@ -450,3 +454,24 @@ int fpm_socket_get_listening_queue(int sock, unsigned *cur_lq, unsigned *max_lq) } #endif + +int fpm_socket_unix_test_connect(struct sockaddr_un *sock, size_t socklen) /* {{{ */ +{ + int fd; + + if (!sock || sock->sun_family != AF_UNIX) { + return -1; + } + + if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { + return -1; + } + + if (connect(fd, (struct sockaddr *)sock, socklen) == -1) { + return -1; + } + + close(fd); + return 0; +} +/* }}} */ diff --git a/sapi/fpm/fpm/fpm_sockets.h b/sapi/fpm/fpm/fpm_sockets.h index 447fbff4b245b..499ba6baf89bb 100644 --- a/sapi/fpm/fpm/fpm_sockets.h +++ b/sapi/fpm/fpm/fpm_sockets.h @@ -5,6 +5,9 @@ #ifndef FPM_MISC_H #define FPM_MISC_H 1 +#include +#include +#include #include #include @@ -22,6 +25,7 @@ enum fpm_address_domain fpm_sockets_domain_from_address(char *addr); int fpm_sockets_init_main(); int fpm_socket_get_listening_queue(int sock, unsigned *cur_lq, unsigned *max_lq); +int fpm_socket_unix_test_connect(struct sockaddr_un *sun, size_t socklen); static inline int fd_set_blocked(int fd, int blocked) /* {{{ */ diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c index 83de76d5abd80..5f2c852c7d787 100644 --- a/sapi/fpm/fpm/fpm_status.c +++ b/sapi/fpm/fpm/fpm_status.c @@ -14,6 +14,7 @@ #include "zlog.h" #include "fpm_atomic.h" #include "fpm_conf.h" +#include "fpm_php.h" #include static char *fpm_status_uri = NULL; @@ -125,13 +126,13 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ } /* full status ? */ - full = SG(request_info).request_uri && strstr(SG(request_info).query_string, "full"); + full = (fpm_php_get_string_from_table("_GET", "full" TSRMLS_CC) != NULL); short_syntax = short_post = NULL; full_separator = full_pre = full_syntax = full_post = NULL; encode = 0; /* HTML */ - if (SG(request_info).query_string && strstr(SG(request_info).query_string, "html")) { + if (fpm_php_get_string_from_table("_GET", "html" TSRMLS_CC)) { sapi_add_header_ex(ZEND_STRL("Content-Type: text/html"), 1, 1 TSRMLS_CC); time_format = "%d/%b/%Y:%H:%M:%S %z"; encode = 1; @@ -205,7 +206,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ } /* XML */ - } else if (SG(request_info).request_uri && strstr(SG(request_info).query_string, "xml")) { + } else if (fpm_php_get_string_from_table("_GET", "xml" TSRMLS_CC)) { sapi_add_header_ex(ZEND_STRL("Content-Type: text/xml"), 1, 1 TSRMLS_CC); time_format = "%s"; encode = 1; @@ -256,7 +257,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ } /* JSON */ - } else if (SG(request_info).request_uri && strstr(SG(request_info).query_string, "json")) { + } else if (fpm_php_get_string_from_table("_GET", "json" TSRMLS_CC)) { sapi_add_header_ex(ZEND_STRL("Content-Type: application/json"), 1, 1 TSRMLS_CC); time_format = "%s"; diff --git a/sapi/fpm/fpm/fpm_unix.c b/sapi/fpm/fpm/fpm_unix.c index 17d0b8125cc54..5c5e37c3a4f46 100644 --- a/sapi/fpm/fpm/fpm_unix.c +++ b/sapi/fpm/fpm/fpm_unix.c @@ -23,6 +23,7 @@ #include "fpm_clock.h" #include "fpm_stdio.h" #include "fpm_unix.h" +#include "fpm_signals.h" #include "zlog.h" size_t fpm_pagesize; @@ -112,12 +113,12 @@ static int fpm_unix_conf_wp(struct fpm_worker_pool_s *wp) /* {{{ */ } } -#ifndef I_REALLY_WANT_ROOT_PHP - if (wp->set_uid == 0 || wp->set_gid == 0) { - zlog(ZLOG_ERROR, "[pool %s] please specify user and group other than root", wp->config->name); - return -1; + if (!fpm_globals.run_as_root) { + if (wp->set_uid == 0 || wp->set_gid == 0) { + zlog(ZLOG_ERROR, "[pool %s] please specify user and group other than root", wp->config->name); + return -1; + } } -#endif } else { /* not root */ if (wp->config->user && *wp->config->user) { zlog(ZLOG_WARNING, "[pool %s] 'user' directive is ignored when FPM is not running as root", wp->config->name); @@ -128,6 +129,9 @@ static int fpm_unix_conf_wp(struct fpm_worker_pool_s *wp) /* {{{ */ if (wp->config->chroot && *wp->config->chroot) { zlog(ZLOG_WARNING, "[pool %s] 'chroot' directive is ignored when FPM is not running as root", wp->config->name); } + if (wp->config->process_priority != 64) { + zlog(ZLOG_WARNING, "[pool %s] 'process.priority' directive is ignored when FPM is not running as root", wp->config->name); + } /* set up HOME and USER anyway */ pwd = getpwuid(getuid()); @@ -183,6 +187,14 @@ int fpm_unix_init_child(struct fpm_worker_pool_s *wp) /* {{{ */ } if (is_root) { + + if (wp->config->process_priority != 64) { + if (setpriority(PRIO_PROCESS, 0, wp->config->process_priority) < 0) { + zlog(ZLOG_SYSERROR, "[pool %s] Unable to set priority for this new process", wp->config->name); + return -1; + } + } + if (wp->set_gid) { if (0 > setgid(wp->set_gid)) { zlog(ZLOG_SYSERROR, "[pool %s] failed to setgid(%d)", wp->config->name, wp->set_gid); @@ -217,6 +229,7 @@ int fpm_unix_init_child(struct fpm_worker_pool_s *wp) /* {{{ */ int fpm_unix_init_main() /* {{{ */ { struct fpm_worker_pool_s *wp; + int is_root = !geteuid(); if (fpm_global_config.rlimit_files) { struct rlimit r; @@ -242,23 +255,92 @@ int fpm_unix_init_main() /* {{{ */ fpm_pagesize = getpagesize(); if (fpm_global_config.daemonize) { - switch (fork()) { - case -1 : + /* + * If daemonize, the calling process will die soon + * and the master process continues to initialize itself. + * + * The parent process has then to wait for the master + * process to initialize to return a consistent exit + * value. For this pupose, the master process will + * send USR1 if everything went well and USR2 + * otherwise. + */ + + struct sigaction act; + struct sigaction oldact_usr1; + struct sigaction oldact_usr2; + struct timeval tv; + + /* + * set sigaction for USR1 before fork + * save old sigaction to restore it after + * fork in the child process (the master process) + */ + memset(&act, 0, sizeof(act)); + memset(&act, 0, sizeof(oldact_usr1)); + act.sa_handler = fpm_signals_sighandler_exit_ok; + sigfillset(&act.sa_mask); + sigaction(SIGUSR1, &act, &oldact_usr1); + + /* + * set sigaction for USR2 before fork + * save old sigaction to restore it after + * fork in the child process (the master process) + */ + memset(&act, 0, sizeof(act)); + memset(&act, 0, sizeof(oldact_usr2)); + act.sa_handler = fpm_signals_sighandler_exit_config; + sigfillset(&act.sa_mask); + sigaction(SIGUSR2, &act, &oldact_usr2); + + /* then fork */ + pid_t pid = fork(); + switch (pid) { + + case -1 : /* error */ zlog(ZLOG_SYSERROR, "failed to daemonize"); return -1; - case 0 : + + case 0 : /* children */ + /* restore USR1 and USR2 sigaction */ + sigaction(SIGUSR1, &oldact_usr1, NULL); + sigaction(SIGUSR2, &oldact_usr2, NULL); + fpm_globals.send_config_signal = 1; break; - default : + + default : /* parent */ fpm_cleanups_run(FPM_CLEANUP_PARENT_EXIT); - exit(0); + + /* + * wait for 10s before exiting with error + * the child is supposed to send USR1 or USR2 to tell the parent + * how it goes for it + */ + tv.tv_sec = 10; + tv.tv_usec = 0; + zlog(ZLOG_DEBUG, "The calling process is waiting for the master process to ping"); + select(0, NULL, NULL, NULL, &tv); + exit(FPM_EXIT_SOFTWARE); } } + /* continue as a child */ setsid(); if (0 > fpm_clock_init()) { return -1; } + if (fpm_global_config.process_priority != 64) { + if (is_root) { + if (setpriority(PRIO_PROCESS, 0, fpm_global_config.process_priority) < 0) { + zlog(ZLOG_SYSERROR, "Unable to set priority for the master process"); + return -1; + } + } else { + zlog(ZLOG_WARNING, "'process.priority' directive is ignored when FPM is not running as root"); + } + } + fpm_globals.parent_pid = getpid(); for (wp = fpm_worker_all_pools; wp; wp = wp->next) { if (0 > fpm_unix_conf_wp(wp)) { diff --git a/sapi/fpm/fpm/zlog.c b/sapi/fpm/fpm/zlog.c index b127ec16f67a0..80db9d8374025 100644 --- a/sapi/fpm/fpm/zlog.c +++ b/sapi/fpm/fpm/zlog.c @@ -22,6 +22,7 @@ static int zlog_fd = -1; static int zlog_level = ZLOG_NOTICE; static int launched = 0; +static void (*external_logger)(int, char *, size_t) = NULL; static const char *level_names[] = { [ZLOG_DEBUG] = "DEBUG", @@ -41,6 +42,12 @@ const int syslog_priorities[] = { }; #endif +void zlog_set_external_logger(void (*logger)(int, char *, size_t)) /* {{{ */ +{ + external_logger = logger; +} +/* }}} */ + const char *zlog_get_level_name(int log_level) /* {{{ */ { if (log_level < 0) { @@ -101,6 +108,19 @@ void zlog_ex(const char *function, int line, int flags, const char *fmt, ...) /* int truncated = 0; int saved_errno; + if (external_logger) { + va_start(args, fmt); + len = vsnprintf(buf, buf_size, fmt, args); + va_end(args); + if (len >= buf_size) { + memcpy(buf + buf_size - sizeof("..."), "...", sizeof("...") - 1); + len = buf_size - 1; + } + external_logger(flags & ZLOG_LEVEL_MASK, buf, len); + len = 0; + memset(buf, '\0', buf_size); + } + if ((flags & ZLOG_LEVEL_MASK) < zlog_level) { return; } diff --git a/sapi/fpm/fpm/zlog.h b/sapi/fpm/fpm/zlog.h index e6a5c019a8840..1945922da5ed6 100644 --- a/sapi/fpm/fpm/zlog.h +++ b/sapi/fpm/fpm/zlog.h @@ -9,6 +9,7 @@ struct timeval; +void zlog_set_external_logger(void (*logger)(int, char *, size_t)); int zlog_set_fd(int new_fd); int zlog_set_level(int new_value); const char *zlog_get_level_name(int log_level); diff --git a/sapi/fpm/php-fpm.conf.in b/sapi/fpm/php-fpm.conf.in index 2dad9d7f5972a..a63dec7098607 100644 --- a/sapi/fpm/php-fpm.conf.in +++ b/sapi/fpm/php-fpm.conf.in @@ -76,6 +76,14 @@ ; Default Value: 0 ; process.max = 128 +; Specify the nice(2) priority to apply to the master process (only if set) +; The value can vary from -19 (highest priority) to 20 (lower priority) +; Note: - It will only work if the FPM master process is launched as root +; - The pool process will inherit the master process priority +; unless it specified otherwise +; Default Value: no set +; process.priority = -19 + ; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. ; Default Value: yes ;daemonize = yes @@ -163,6 +171,14 @@ listen = 127.0.0.1:9000 ; Default Value: any ;listen.allowed_clients = 127.0.0.1 +; Specify the nice(2) priority to apply to the pool processes (only if set) +; The value can vary from -19 (highest priority) to 20 (lower priority) +; Note: - It will only work if the FPM master process is launched as root +; - The pool processes will inherit the master process priority +; unless it specified otherwise +; Default Value: no set +; priority = -19 + ; Choose how the process manager will control the number of child processes. ; Possible Values: ; static - a fixed number (pm.max_children) of child processes; diff --git a/tests/basic/php_egg_logo_guid.phpt b/tests/basic/php_egg_logo_guid.phpt deleted file mode 100644 index b3c5d7bdfd2e4..0000000000000 --- a/tests/basic/php_egg_logo_guid.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -Testing php_egg_logo_guid() function ---FILE-- - ---EXPECT-- -PHPE9568F36-D428-11d2-A769-00AA001ACF42 - ---CREDITS-- -Jason Easter -PHPUG Würzburg -Testfest 2009 2009-06-20 \ No newline at end of file diff --git a/tests/basic/php_logo_guid.phpt b/tests/basic/php_logo_guid.phpt deleted file mode 100644 index b5724a96abe10..0000000000000 --- a/tests/basic/php_logo_guid.phpt +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -Testing php_logo_guid() function ---FILE-- - ---EXPECT-- -PHPE9568F34-D428-11d2-A769-00AA001ACF42 ---CREDITS-- -Testfest 2009 2009-06-20 \ No newline at end of file diff --git a/tests/basic/php_real_logo_guid.phpt b/tests/basic/php_real_logo_guid.phpt deleted file mode 100644 index 2b9003a35066f..0000000000000 --- a/tests/basic/php_real_logo_guid.phpt +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Testing php_real_logo_guid() function ---FILE-- - ---EXPECT-- -PHPE9568F34-D428-11d2-A769-00AA001ACF42 ---CREDITS-- -Jason Easter -PHPUG Würzburg -Testfest 2009 2009-06-20 \ No newline at end of file diff --git a/tests/basic/zend_logo_guid.phpt b/tests/basic/zend_logo_guid.phpt deleted file mode 100644 index 23ca0165ae64a..0000000000000 --- a/tests/basic/zend_logo_guid.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -Testing zend_logo_guid() function ---FILE-- - ---EXPECT-- -PHPE9568F35-D428-11d2-A769-00AA001ACF42 - ---CREDITS-- -Jason Easter -PHPUG Würzburg -Testfest 2009 2009-06-20 \ No newline at end of file diff --git a/tests/lang/bug45392.phpt b/tests/lang/bug45392.phpt index ae84cd9d1dd9a..78876c7c8033d 100644 --- a/tests/lang/bug45392.phpt +++ b/tests/lang/bug45392.phpt @@ -2,6 +2,11 @@ Bug #45392 (ob_start()/ob_end_clean() and memory_limit) --INI-- display_errors=stderr +--SKIPIF-- + d [type] => 1 - [flags] => 4209 + [flags] => 20593 [level] => 4 [chunk_size] => %d [buffer_size] => 16384 @@ -95,7 +95,7 @@ Array ( [name] => d [type] => 1 - [flags] => 4209 + [flags] => 20593 [level] => 4 [chunk_size] => %d [buffer_size] => 16384 diff --git a/travis/compile.sh b/travis/compile.sh new file mode 100755 index 0000000000000..a0fc167a15bf7 --- /dev/null +++ b/travis/compile.sh @@ -0,0 +1,39 @@ +#!/bin/bash +./buildconf +./configure \ +--with-pdo-mysql \ +--with-mysql \ +--with-mysqli \ +--with-pgsql \ +--with-pdo-pgsql \ +--with-pdo-sqlite \ +--enable-intl \ +--without-pear \ +--with-gd \ +--with-jpeg-dir=/usr \ +--with-png-dir=/usr \ +--enable-exif \ +--enable-zip \ +--with-zlib \ +--with-zlib-dir=/usr \ +--with-mcrypt=/usr \ +--enable-soap \ +--enable-xmlreader \ +--with-xsl \ +--with-curl=/usr \ +--with-tidy \ +--with-xmlrpc \ +--enable-sysvsem \ +--enable-sysvshm \ +--enable-shmop \ +--enable-pcntl \ +--with-readline \ +--enable-mbstring \ +--with-curl \ +--with-gettext \ +--enable-sockets \ +--with-bz2 \ +--enable-bcmath \ +--enable-fastcgi \ +--with-mime-magic +make \ No newline at end of file diff --git a/travis/ext/curl/setup.sh b/travis/ext/curl/setup.sh new file mode 100755 index 0000000000000..74dad16eb35ba --- /dev/null +++ b/travis/ext/curl/setup.sh @@ -0,0 +1,5 @@ +#!/bin/bash +export PHP_CURL_HTTP_REMOTE_SERVER="http://localhost" +cd ./ext/curl/tests/responder +sudo php -S localhost:80 & +cd - \ No newline at end of file diff --git a/travis/ext/mysql/setup.sh b/travis/ext/mysql/setup.sh new file mode 100755 index 0000000000000..994fad13766d8 --- /dev/null +++ b/travis/ext/mysql/setup.sh @@ -0,0 +1,2 @@ +#!/bin/bash +mysql -u root -e "CREATE DATABASE IF NOT EXISTS test" diff --git a/travis/ext/mysqli/setup.sh b/travis/ext/mysqli/setup.sh new file mode 100755 index 0000000000000..994fad13766d8 --- /dev/null +++ b/travis/ext/mysqli/setup.sh @@ -0,0 +1,2 @@ +#!/bin/bash +mysql -u root -e "CREATE DATABASE IF NOT EXISTS test" diff --git a/travis/ext/pdo_mysql/setup.sh b/travis/ext/pdo_mysql/setup.sh new file mode 100755 index 0000000000000..994fad13766d8 --- /dev/null +++ b/travis/ext/pdo_mysql/setup.sh @@ -0,0 +1,2 @@ +#!/bin/bash +mysql -u root -e "CREATE DATABASE IF NOT EXISTS test" diff --git a/travis/ext/pdo_pgsql/setup.sh b/travis/ext/pdo_pgsql/setup.sh new file mode 100755 index 0000000000000..6f16f72cc2581 --- /dev/null +++ b/travis/ext/pdo_pgsql/setup.sh @@ -0,0 +1,2 @@ +#!/bin/bash +export PDO_PGSQL_TEST_DSN='pgsql:host=localhost port=5432 dbname=test user=postgres password=' \ No newline at end of file diff --git a/travis/ext/pgsql/setup.sh b/travis/ext/pgsql/setup.sh new file mode 100755 index 0000000000000..32b39a40443e4 --- /dev/null +++ b/travis/ext/pgsql/setup.sh @@ -0,0 +1,4 @@ +#!/bin/bash +echo ' +' >> "./ext/pgsql/tests/config.inc" +psql -c 'create database test;' -U postgres \ No newline at end of file diff --git a/win32/build/config.w32 b/win32/build/config.w32 index fae3cc66c302c..daf019435057d 100644 --- a/win32/build/config.w32 +++ b/win32/build/config.w32 @@ -368,7 +368,7 @@ if (VCVERS == 1200) { ADD_SOURCES("main", "main.c snprintf.c spprintf.c getopt.c fopen_wrappers.c \ php_scandir.c php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \ strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c network.c \ - php_open_temporary_file.c php_logos.c output.c internal_functions.c php_sprintf.c"); + php_open_temporary_file.c output.c internal_functions.c php_sprintf.c"); ADD_SOURCES("win32", "inet.c fnmatch.c sockets.c"); // Newer versions have it diff --git a/win32/build/mkdist.php b/win32/build/mkdist.php index 17f7cd020ef47..5ed9bdc81a098 100644 --- a/win32/build/mkdist.php +++ b/win32/build/mkdist.php @@ -401,7 +401,7 @@ function copy_test_dir($directory, $dest) while (FALSE !== ($file = readdir($directory_list))) { $full_path = $directory . '/' . $file; if($file != '.' && $file != '..' && $file != '.svn' && is_dir($full_path)) { - if ($file == 'tests') { + if ($file == 'tests' || $file == 'examples') { if (!is_dir($dest . '/' . $full_path)) { mkdir($dest . '/' . $full_path , 0775, true); } diff --git a/win32/php5dll.dsp b/win32/php5dll.dsp index 2216d7dfe6e0a..cc56f538af1c9 100644 --- a/win32/php5dll.dsp +++ b/win32/php5dll.dsp @@ -164,10 +164,6 @@ SOURCE=..\main\php_ini.c # End Source File # Begin Source File -SOURCE=..\main\php_logos.c -# End Source File -# Begin Source File - SOURCE=..\main\php_open_temporary_file.c # End Source File # Begin Source File @@ -288,10 +284,6 @@ SOURCE=..\main\php_ini.h # End Source File # Begin Source File -SOURCE=..\main\php_logos.h -# End Source File -# Begin Source File - SOURCE=..\main\php_open_temporary_file.h # End Source File # Begin Source File diff --git a/win32/php5dllts.dsp b/win32/php5dllts.dsp index a8e93ec5e778c..3755ea79f9696 100644 --- a/win32/php5dllts.dsp +++ b/win32/php5dllts.dsp @@ -201,10 +201,6 @@ SOURCE=..\main\php_ini.c # End Source File # Begin Source File -SOURCE=..\main\php_logos.c -# End Source File -# Begin Source File - SOURCE=..\main\php_open_temporary_file.c # End Source File # Begin Source File @@ -317,10 +313,6 @@ SOURCE=..\main\php_ini.h # End Source File # Begin Source File -SOURCE=..\main\php_logos.h -# End Source File -# Begin Source File - SOURCE=..\main\php_main.h # End Source File # Begin Source File diff --git a/win32/registry.c b/win32/registry.c index 35b411f4ce511..45e842b455fa4 100644 --- a/win32/registry.c +++ b/win32/registry.c @@ -77,11 +77,16 @@ static int LoadDirectory(HashTable *directories, HKEY key, char *path, int path_ value_len = max_value+1; if (RegEnumValue(key, i, name, &name_len, NULL, &type, value, &value_len) == ERROR_SUCCESS) { if ((type == REG_SZ) || (type == REG_EXPAND_SZ)) { + ht = (HashTable*)malloc(sizeof(HashTable)); if (!ht) { - ht = (HashTable*)malloc(sizeof(HashTable)); - zend_hash_init(ht, 0, NULL, ZVAL_INTERNAL_PTR_DTOR, 1); + return ret; } + zend_hash_init(ht, 0, NULL, ZVAL_INTERNAL_PTR_DTOR, 1); + data = (zval*)malloc(sizeof(zval)); + if (!data) { + return ret; + } INIT_PZVAL(data); Z_STRVAL_P(data) = zend_strndup(value, value_len-1); Z_STRLEN_P(data) = value_len-1; @@ -174,6 +179,9 @@ void UpdateIniFromRegistry(char *path TSRMLS_DC) if (!PW32G(registry_directories)) { PW32G(registry_directories) = (HashTable*)malloc(sizeof(HashTable)); + if (!PW32G(registry_directories)) { + return; + } zend_hash_init(PW32G(registry_directories), 0, NULL, delete_internal_hashtable, 1); if (!OpenPhpRegistryKey("\\Per Directory Values", &PW32G(registry_key))) { PW32G(registry_key) = NULL; diff --git a/win32/time.c b/win32/time.c index a376fd61be0a0..391a8a81e99d1 100644 --- a/win32/time.c +++ b/win32/time.c @@ -1,4 +1,3 @@ - /***************************************************************************** * * * DH_TIME.C * @@ -35,12 +34,21 @@ int getfilesystemtime(struct timeval *time_Info) { -FILETIME ft; -__int64 ff; + FILETIME ft; + __int64 ff; + ULARGE_INTEGER convFromft; GetSystemTimeAsFileTime(&ft); /* 100 ns blocks since 01-Jan-1641 */ - /* resolution seems to be 0.01 sec */ - ff = *(__int64*)(&ft); + /* resolution seems to be 0.01 sec */ + /* + * Do not cast a pointer to a FILETIME structure to either a + * ULARGE_INTEGER* or __int64* value because it can cause alignment faults on 64-bit Windows. + * via http://technet.microsoft.com/en-us/library/ms724284(v=vs.85).aspx + */ + convFromft.HighPart = ft.dwHighDateTime; + convFromft.LowPart = ft.dwLowDateTime; + ff = convFromft.QuadPart; + time_Info->tv_sec = (int)(ff/(__int64)10000000-(__int64)11644473600); time_Info->tv_usec = (int)(ff % 10000000)/10; return 0;