summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Ferrara <ircmaxell@gmail.com>2012-09-04 10:29:22 -0400
committerAnthony Ferrara <ircmaxell@gmail.com>2012-09-04 10:29:22 -0400
commit824f1f45818096eff0e022ba2a1cbc2071343c9a (patch)
tree821b106513b7835d8e7fad8960446167142028f9
parente05413ca594ff10fd93d40429cb598c2e109edf4 (diff)
parent4b206126aca2ad9181abe65d70367680a4bc4c03 (diff)
downloadphp-git-824f1f45818096eff0e022ba2a1cbc2071343c9a.tar.gz
Merge remote branch 'upstream/master' into hash_password
* upstream/master: (393 commits) forked two tests for windows Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice) Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice). Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice). Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice) Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice) Bug #49510: Boolean validation fails with FILTER_NULL_ON_FAILURE with empty string or false Implemented ReflectionFunction::isGenerator() Allow null as a default value for length in mb_substr() and mb_strcut() Allow null as a default value for length in mb_substr() and mb_strcut() folder Initializing optional argument description in assert() Initializing optional argument description in assert() Fix test failed due to new Token T_YIELD fix NEWS Fix leak when yielding array as key Drop obsolete test Remove extra blank in notice message, should act as same as vm Fixed bug #62987 (Assigning to ArrayObject[null][something] overrides all undefined variables) assert() user message ...
-rw-r--r--.gitattributes1
-rw-r--r--INSTALL202
-rw-r--r--NEWS28
-rwxr-xr-xUPGRADING23
-rw-r--r--UPGRADING.INTERNALS29
-rw-r--r--Zend/Makefile.am3
-rw-r--r--Zend/Zend.dsp4
-rw-r--r--Zend/ZendTS.dsp4
-rw-r--r--Zend/acinclude.m42
-rw-r--r--Zend/tests/bug18556.phpt37
-rw-r--r--Zend/tests/bug55509.phpt6
-rwxr-xr-xZend/tests/bug61761.phpt3
-rw-r--r--Zend/tests/bug62358.phpt32
-rw-r--r--Zend/tests/bug62653.phpt33
-rw-r--r--Zend/tests/bug62680.phpt11
-rw-r--r--Zend/tests/bug62763.phpt23
-rw-r--r--Zend/tests/bug62892.phpt21
-rw-r--r--Zend/tests/bug62907.phpt24
-rw-r--r--Zend/tests/bug62956.phpt20
-rw-r--r--Zend/tests/catch_finally_001.phpt32
-rw-r--r--Zend/tests/catch_finally_002.phpt21
-rw-r--r--Zend/tests/catch_finally_003.phpt40
-rw-r--r--Zend/tests/catch_finally_004.phpt41
-rw-r--r--Zend/tests/catch_finally_005.phpt21
-rw-r--r--Zend/tests/catch_finally_006.phpt28
-rw-r--r--Zend/tests/errmsg_043.phpt12
-rw-r--r--Zend/tests/foreach_list_001.phpt43
-rw-r--r--Zend/tests/foreach_list_002.phpt26
-rw-r--r--Zend/tests/foreach_list_003.phpt13
-rw-r--r--Zend/tests/foreach_list_004.phpt13
-rw-r--r--Zend/tests/foreach_temp_array_expr_with_refs.phpt18
-rw-r--r--Zend/tests/generators/auto_incrementing_keys.phpt22
-rw-r--r--Zend/tests/generators/backtrace.phpt27
-rw-r--r--Zend/tests/generators/clone.phpt32
-rw-r--r--Zend/tests/generators/clone_with_foreach.phpt33
-rw-r--r--Zend/tests/generators/clone_with_stack.phpt18
-rw-r--r--Zend/tests/generators/clone_with_symbol_table.phpt27
-rw-r--r--Zend/tests/generators/clone_with_this.phpt24
-rw-r--r--Zend/tests/generators/dynamic_call.phpt19
-rw-r--r--Zend/tests/generators/errors/generator_cannot_return_before_yield_error.phpt13
-rw-r--r--Zend/tests/generators/errors/generator_cannot_return_error.phpt13
-rw-r--r--Zend/tests/generators/errors/generator_extend_error.phpt10
-rw-r--r--Zend/tests/generators/errors/generator_instantiate_error.phpt10
-rw-r--r--Zend/tests/generators/errors/non_ref_generator_iterated_by_ref_error.phpt18
-rw-r--r--Zend/tests/generators/errors/resume_running_generator_error.phpt17
-rw-r--r--Zend/tests/generators/errors/serialize_unserialize_error.phpt46
-rw-r--r--Zend/tests/generators/errors/yield_const_by_ref_error.phpt16
-rw-r--r--Zend/tests/generators/errors/yield_in_force_closed_finally_error.phpt29
-rw-r--r--Zend/tests/generators/errors/yield_non_ref_function_call_by_ref_error.phpt20
-rw-r--r--Zend/tests/generators/errors/yield_outside_function_error.phpt10
-rw-r--r--Zend/tests/generators/fibonacci.phpt36
-rw-r--r--Zend/tests/generators/finally_ran_on_close.phpt25
-rw-r--r--Zend/tests/generators/finally_uninterrupted.phpt28
-rw-r--r--Zend/tests/generators/finally_with_return.phpt33
-rw-r--r--Zend/tests/generators/func_get_args.phpt21
-rw-r--r--Zend/tests/generators/generator_closure.phpt20
-rw-r--r--Zend/tests/generators/generator_closure_with_this.phpt20
-rw-r--r--Zend/tests/generators/generator_in_multipleiterator.phpt37
-rw-r--r--Zend/tests/generators/generator_method.phpt29
-rw-r--r--Zend/tests/generators/generator_method_by_ref.phpt44
-rw-r--r--Zend/tests/generators/generator_returns_generator.phpt18
-rw-r--r--Zend/tests/generators/generator_rewind.phpt62
-rw-r--r--Zend/tests/generators/generator_send.phpt22
-rw-r--r--Zend/tests/generators/generator_static_method.phpt29
-rw-r--r--Zend/tests/generators/generator_throwing_during_function_call.phpt32
-rw-r--r--Zend/tests/generators/generator_throwing_exception.phpt28
-rw-r--r--Zend/tests/generators/generator_throwing_in_foreach.phpt20
-rw-r--r--Zend/tests/generators/generator_with_keys.phpt26
-rw-r--r--Zend/tests/generators/no_foreach_var_leaks.phpt19
-rw-r--r--Zend/tests/generators/send_after_close.phpt14
-rw-r--r--Zend/tests/generators/send_returns_current.phpt20
-rw-r--r--Zend/tests/generators/unused_return_value.phpt13
-rw-r--r--Zend/tests/generators/xrange.phpt23
-rw-r--r--Zend/tests/generators/yield_array_key.phpt18
-rw-r--r--Zend/tests/generators/yield_array_offset_by_ref.phpt26
-rw-r--r--Zend/tests/generators/yield_by_reference.phpt42
-rw-r--r--Zend/tests/generators/yield_during_function_call.phpt15
-rw-r--r--Zend/tests/generators/yield_during_method_call.phpt35
-rw-r--r--Zend/tests/generators/yield_in_finally.phpt29
-rw-r--r--Zend/tests/generators/yield_in_parenthesis.phpt23
-rw-r--r--Zend/tests/generators/yield_ref_function_call_by_reference.phpt24
-rw-r--r--Zend/tests/generators/yield_without_value.phpt27
-rw-r--r--Zend/tests/try_catch_finally_001.phpt36
-rw-r--r--Zend/tests/try_catch_finally_002.phpt42
-rw-r--r--Zend/tests/try_catch_finally_003.phpt38
-rw-r--r--Zend/tests/try_catch_finally_004.phpt30
-rw-r--r--Zend/tests/try_catch_finally_005.phpt52
-rw-r--r--Zend/tests/try_catch_finally_006.phpt39
-rw-r--r--Zend/tests/try_catch_finally_007.phpt46
-rw-r--r--Zend/tests/try_finally_001.phpt22
-rw-r--r--Zend/tests/try_finally_002.phpt23
-rw-r--r--Zend/tests/try_finally_003.phpt27
-rw-r--r--Zend/tests/try_finally_004.phpt14
-rw-r--r--Zend/tests/try_finally_005.phpt17
-rw-r--r--Zend/tests/try_finally_006.phpt26
-rw-r--r--Zend/tests/try_finally_007.phpt22
-rw-r--r--Zend/tests/try_finally_008.phpt21
-rw-r--r--Zend/tests/try_finally_009.phpt23
-rw-r--r--Zend/zend.c21
-rw-r--r--Zend/zend.h10
-rw-r--r--Zend/zend_API.c20
-rw-r--r--Zend/zend_API.h5
-rw-r--r--Zend/zend_closures.c2
-rw-r--r--Zend/zend_compile.c181
-rw-r--r--Zend/zend_compile.h17
-rw-r--r--Zend/zend_default_classes.c2
-rw-r--r--Zend/zend_exceptions.c4
-rw-r--r--Zend/zend_execute.c45
-rw-r--r--Zend/zend_execute.h6
-rw-r--r--Zend/zend_execute_API.c9
-rw-r--r--Zend/zend_generators.c838
-rw-r--r--Zend/zend_generators.h73
-rw-r--r--Zend/zend_globals.h4
-rw-r--r--Zend/zend_highlight.c2
-rw-r--r--Zend/zend_language_parser.y141
-rw-r--r--Zend/zend_language_scanner.c5351
-rw-r--r--Zend/zend_language_scanner.h5
-rw-r--r--Zend/zend_language_scanner.l82
-rw-r--r--Zend/zend_language_scanner_defs.h2
-rw-r--r--Zend/zend_opcode.c52
-rw-r--r--Zend/zend_operators.c95
-rw-r--r--Zend/zend_operators.h1
-rw-r--r--Zend/zend_ptr_stack.h5
-rw-r--r--Zend/zend_stream.c2
-rw-r--r--Zend/zend_string.h2
-rw-r--r--Zend/zend_vm_def.h1017
-rw-r--r--Zend/zend_vm_execute.h4782
-rw-r--r--Zend/zend_vm_execute.skl91
-rw-r--r--Zend/zend_vm_gen.php23
-rw-r--r--Zend/zend_vm_opcodes.h3
-rw-r--r--acinclude.m46
-rw-r--r--configure.in4
-rw-r--r--ext/calendar/calendar.c23
-rw-r--r--ext/calendar/jewish.c64
-rw-r--r--ext/calendar/sdncal.h3
-rw-r--r--ext/calendar/tests/bug54254.phpt59
-rw-r--r--ext/calendar/tests/cal_info.phpt8
-rw-r--r--ext/calendar/tests/jdmonthname.phpt8
-rw-r--r--ext/calendar/tests/jdtojewish.phpt8
-rw-r--r--ext/curl/interface.c54
-rw-r--r--ext/curl/tests/bug62839.phpt18
-rw-r--r--ext/curl/tests/curl_basic_022.phpt8
-rw-r--r--ext/curl/tests/curl_escape.phptbin553 -> 688 bytes
-rw-r--r--ext/date/lib/tm2unixtime.c75
-rw-r--r--ext/date/php_date.c16
-rw-r--r--ext/date/tests/bug61642.phpt62
-rw-r--r--ext/date/tests/bug62852.phpt15
-rw-r--r--ext/dom/documenttype.c4
-rw-r--r--ext/dom/element.c4
-rw-r--r--ext/dom/node.c8
-rw-r--r--ext/dom/xpath.c7
-rwxr-xr-xext/enchant/enchant.c3
-rwxr-xr-xext/exif/tests/bug60150.phpt2
-rw-r--r--ext/fileinfo/fileinfo.c2
-rw-r--r--ext/fileinfo/libmagic.patch386
-rw-r--r--ext/fileinfo/libmagic/apprentice.c27
-rw-r--r--ext/fileinfo/tests/bug61964.phpt69
-rw-r--r--ext/fileinfo/tests/finfo_open_error-win32.phpt8
-rw-r--r--ext/filter/filter_private.h6
-rw-r--r--ext/filter/logical_filters.c7
-rw-r--r--ext/filter/tests/bug49510.phpt36
-rw-r--r--ext/gmp/tests/022-win32.phpt90
-rw-r--r--ext/gmp/tests/022.phpt3
-rw-r--r--ext/gmp/tests/gmp_nextprime-win32.phpt45
-rw-r--r--ext/gmp/tests/gmp_nextprime.phpt3
-rw-r--r--ext/hash/hash.c210
-rw-r--r--ext/hash/php_hash.h1
-rw-r--r--ext/hash/tests/hash_pbkdf2_basic.phpt37
-rw-r--r--ext/hash/tests/hash_pbkdf2_error.phpt78
-rw-r--r--[-rwxr-xr-x]ext/intl/CREDITS0
-rw-r--r--[-rwxr-xr-x]ext/intl/TODO0
-rw-r--r--ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp6
-rw-r--r--ext/intl/calendar/calendar_methods.cpp3
-rw-r--r--[-rwxr-xr-x]ext/intl/collator/collator.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/collator/collator.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/collator/collator_attr.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/collator/collator_attr.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/collator/collator_class.c1
-rw-r--r--[-rwxr-xr-x]ext/intl/collator/collator_class.h9
-rw-r--r--[-rwxr-xr-x]ext/intl/collator/collator_compare.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/collator/collator_compare.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/collator/collator_convert.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/collator/collator_convert.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/collator/collator_create.c4
-rw-r--r--[-rwxr-xr-x]ext/intl/collator/collator_create.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/collator/collator_error.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/collator/collator_error.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/collator/collator_is_numeric.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/collator/collator_is_numeric.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/collator/collator_locale.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/collator/collator_locale.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/collator/collator_sort.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/collator/collator_sort.h0
-rw-r--r--ext/intl/common/common_date.cpp250
-rw-r--r--ext/intl/common/common_date.h40
-rw-r--r--[-rwxr-xr-x]ext/intl/common/common_error.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/common/common_error.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/config.m42
-rw-r--r--[-rwxr-xr-x]ext/intl/config.w322
-rw-r--r--[-rwxr-xr-x]ext/intl/dateformat/dateformat.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/dateformat/dateformat.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/dateformat/dateformat_attr.c5
-rw-r--r--[-rwxr-xr-x]ext/intl/dateformat/dateformat_attr.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/dateformat/dateformat_class.c32
-rw-r--r--[-rwxr-xr-x]ext/intl/dateformat/dateformat_class.h10
-rw-r--r--ext/intl/dateformat/dateformat_create.cpp6
-rw-r--r--[-rwxr-xr-x]ext/intl/dateformat/dateformat_data.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/dateformat/dateformat_data.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/dateformat/dateformat_format.c181
-rw-r--r--[-rwxr-xr-x]ext/intl/dateformat/dateformat_format.h0
-rw-r--r--ext/intl/dateformat/dateformat_format_object.cpp230
-rw-r--r--ext/intl/dateformat/dateformat_format_object.h19
-rw-r--r--[-rwxr-xr-x]ext/intl/dateformat/dateformat_parse.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/dateformat/dateformat_parse.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/doc/Tutorial.txt0
-rw-r--r--[-rwxr-xr-x]ext/intl/doc/collator_api.php0
-rw-r--r--[-rwxr-xr-x]ext/intl/doc/common_api.php0
-rw-r--r--[-rwxr-xr-x]ext/intl/doc/datefmt_api.php0
-rw-r--r--[-rwxr-xr-x]ext/intl/doc/formatter_api.php0
-rw-r--r--[-rwxr-xr-x]ext/intl/doc/grapheme_api.php0
-rw-r--r--[-rwxr-xr-x]ext/intl/doc/locale_api.php0
-rw-r--r--[-rwxr-xr-x]ext/intl/doc/msgfmt_api.php0
-rw-r--r--[-rwxr-xr-x]ext/intl/doc/normalizer_api.php0
-rw-r--r--[-rwxr-xr-x]ext/intl/formatter/formatter.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/formatter/formatter.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/formatter/formatter_attr.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/formatter/formatter_attr.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/formatter/formatter_class.c26
-rw-r--r--[-rwxr-xr-x]ext/intl/formatter/formatter_class.h15
-rw-r--r--[-rwxr-xr-x]ext/intl/formatter/formatter_data.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/formatter/formatter_data.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/formatter/formatter_format.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/formatter/formatter_format.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/formatter/formatter_main.c4
-rw-r--r--[-rwxr-xr-x]ext/intl/formatter/formatter_main.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/formatter/formatter_parse.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/formatter/formatter_parse.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/grapheme/grapheme.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/grapheme/grapheme_string.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/grapheme/grapheme_util.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/grapheme/grapheme_util.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/intl_common.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/intl_convert.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/intl_convert.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/intl_data.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/intl_error.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/intl_error.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/locale/locale.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/locale/locale.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/locale/locale_class.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/locale/locale_class.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/locale/locale_methods.c16
-rw-r--r--[-rwxr-xr-x]ext/intl/locale/locale_methods.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/msgformat/msgformat.c4
-rw-r--r--[-rwxr-xr-x]ext/intl/msgformat/msgformat.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/msgformat/msgformat_attr.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/msgformat/msgformat_attr.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/msgformat/msgformat_class.c25
-rw-r--r--[-rwxr-xr-x]ext/intl/msgformat/msgformat_class.h10
-rw-r--r--[-rwxr-xr-x]ext/intl/msgformat/msgformat_data.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/msgformat/msgformat_data.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/msgformat/msgformat_format.c2
-rw-r--r--[-rwxr-xr-x]ext/intl/msgformat/msgformat_format.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/msgformat/msgformat_helpers.cpp76
-rw-r--r--[-rwxr-xr-x]ext/intl/msgformat/msgformat_helpers.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/msgformat/msgformat_parse.c2
-rw-r--r--[-rwxr-xr-x]ext/intl/msgformat/msgformat_parse.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/normalizer/normalizer.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/normalizer/normalizer.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/normalizer/normalizer_class.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/normalizer/normalizer_class.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/normalizer/normalizer_normalize.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/normalizer/normalizer_normalize.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/php_intl.c33
-rw-r--r--[-rwxr-xr-x]ext/intl/php_intl.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/resourcebundle/TODO0
-rw-r--r--ext/intl/resourcebundle/resourcebundle_class.c10
-rw-r--r--ext/intl/resourcebundle/resourcebundle_class.h11
-rw-r--r--[-rwxr-xr-x]ext/intl/spoofchecker/spoofchecker.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/spoofchecker/spoofchecker.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/spoofchecker/spoofchecker_class.c3
-rw-r--r--[-rwxr-xr-x]ext/intl/spoofchecker/spoofchecker_class.h12
-rw-r--r--[-rwxr-xr-x]ext/intl/spoofchecker/spoofchecker_create.c2
-rw-r--r--[-rwxr-xr-x]ext/intl/spoofchecker/spoofchecker_create.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/spoofchecker/spoofchecker_main.c0
-rw-r--r--[-rwxr-xr-x]ext/intl/spoofchecker/spoofchecker_main.h0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/_files/es-bundle.txt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/_files/res_index.txt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/_files/resourcebundle.txt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/_files/resourcebundle/es.resbin384 -> 384 bytes
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/_files/resourcebundle/res_index.resbin128 -> 128 bytes
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/_files/resourcebundle/root.resbin388 -> 388 bytes
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/badargs.phpt0
-rw-r--r--ext/intl/tests/breakiter___construct.phpt1
-rw-r--r--ext/intl/tests/breakiter_clone_basic.phpt4
-rw-r--r--ext/intl/tests/breakiter_current_basic.phpt4
-rw-r--r--ext/intl/tests/breakiter_factories_basic.phpt1
-rw-r--r--ext/intl/tests/breakiter_factories_error.phpt4
-rw-r--r--ext/intl/tests/breakiter_first_basic.phpt1
-rw-r--r--ext/intl/tests/breakiter_first_last_previous_current_error.phpt4
-rw-r--r--ext/intl/tests/breakiter_following_basic.phpt4
-rw-r--r--ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt4
-rw-r--r--ext/intl/tests/breakiter_getLocale_basic.phpt4
-rw-r--r--ext/intl/tests/breakiter_getLocale_error.phpt4
-rw-r--r--ext/intl/tests/breakiter_getPartsIterator_basic.phpt4
-rw-r--r--ext/intl/tests/breakiter_getText_basic.phpt1
-rw-r--r--ext/intl/tests/breakiter_getText_error.phpt4
-rw-r--r--ext/intl/tests/breakiter_isBoundary_basic.phpt4
-rw-r--r--ext/intl/tests/breakiter_last_basic.phpt1
-rw-r--r--ext/intl/tests/breakiter_next_basic.phpt4
-rw-r--r--ext/intl/tests/breakiter_next_error.phpt4
-rw-r--r--ext/intl/tests/breakiter_preceding_basic.phpt4
-rw-r--r--ext/intl/tests/breakiter_previous_basic.phpt4
-rw-r--r--ext/intl/tests/breakiter_setText_basic.phpt1
-rw-r--r--ext/intl/tests/breakiter_setText_error.phpt4
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/bug12887.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/bug14562.phpt0
-rw-r--r--ext/intl/tests/bug59597_64.phpt1
-rw-r--r--ext/intl/tests/bug62070.phpt2
-rw-r--r--ext/intl/tests/bug62915-2.phpt33
-rw-r--r--ext/intl/tests/bug62915.phpt24
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/collation_customization.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/collator_asort.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/collator_compare.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/collator_create.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/collator_get_error_code.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/collator_get_error_message.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/collator_get_locale.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/collator_get_set_attribute.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/collator_get_set_strength.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/collator_get_sort_key.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/collator_sort.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/collator_sort_with_sort_keys.phpt0
-rw-r--r--ext/intl/tests/dateformat___construct_bad_tz_cal.phpt4
-rw-r--r--ext/intl/tests/dateformat_clone_bad_obj.phpt20
-rw-r--r--ext/intl/tests/dateformat_create_cal_arg.phpt20
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/dateformat_format.phpt10
-rw-r--r--ext/intl/tests/dateformat_formatObject_calendar.phpt41
-rw-r--r--ext/intl/tests/dateformat_formatObject_datetime.phpt34
-rw-r--r--ext/intl/tests/dateformat_formatObject_error.phpt74
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/dateformat_format_parse.phpt0
-rw-r--r--ext/intl/tests/dateformat_getCalendarObject_error.phpt4
-rw-r--r--ext/intl/tests/dateformat_getTimeZone_error.phpt4
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/dateformat_get_datetype.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/dateformat_get_locale.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/dateformat_get_set_calendar.phpt4
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/dateformat_get_set_pattern.phpt0
-rw-r--r--ext/intl/tests/dateformat_get_set_timezone.phpt14
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/dateformat_get_timetype.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/dateformat_get_timezone_id.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/dateformat_is_set_lenient.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/dateformat_localtime.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/dateformat_parse.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/dateformat_parse_localtime_parsepos.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/dateformat_parse_timestamp_parsepos.phpt0
-rw-r--r--ext/intl/tests/dateformat_setTimeZoneID_deprecation.phpt4
-rw-r--r--ext/intl/tests/dateformat_setTimeZone_error.phpt4
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/dateformat_set_timezone_id.phpt0
-rw-r--r--ext/intl/tests/dateformat_timezone_arg_variations.phpt4
-rw-r--r--ext/intl/tests/formatter_clone_bad_obj.phpt20
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/formatter_fail.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/formatter_format.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/formatter_format_conv.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/formatter_format_currency.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/formatter_get_error.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/formatter_get_locale.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/formatter_get_set_attribute.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/formatter_get_set_pattern.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/formatter_get_set_symbol.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/formatter_get_set_text_attribute.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/formatter_parse.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/formatter_parse_currency.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/grapheme.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/idn.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/intl_error_name.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/intl_get_error_code.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/intl_get_error_message.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/intl_is_failure.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/locale_accept.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/locale_compose_locale.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/locale_filter_matches.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/locale_get_all_variants.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/locale_get_default.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/locale_get_display_language.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/locale_get_display_name.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/locale_get_display_region.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/locale_get_display_script.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/locale_get_display_variant.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/locale_get_keywords.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/locale_get_primary_language.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/locale_get_region.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/locale_get_script.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/locale_lookup.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/locale_parse_locale.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/locale_set_default.phpt0
-rw-r--r--ext/intl/tests/msgfmt_clone_bad_obj.phpt20
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/msgfmt_fail.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/msgfmt_format.phpt0
-rw-r--r--ext/intl/tests/msgfmt_format_error5.phpt1
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/msgfmt_get_locale.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/msgfmt_get_set_pattern.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/msgfmt_parse.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/normalizer_normalize.phpt0
-rw-r--r--ext/intl/tests/rbbiter___construct_basic.phpt4
-rw-r--r--ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt4
-rw-r--r--ext/intl/tests/rbbiter_getRuleStatus_basic.phpt4
-rw-r--r--ext/intl/tests/rbbiter_getRules_basic.phpt4
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/regression_sort_and_cow.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/regression_sort_eq.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/regression_sortwsk_and_cow.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/regression_sortwsk_eq.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/resourcebundle.build0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/resourcebundle_locales.phpt0
-rw-r--r--ext/intl/tests/resourcebundle_null_mandatory_args.phpt4
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/spoofchecker_001.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/spoofchecker_002.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/spoofchecker_003.phpt0
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/spoofchecker_004.phpt0
-rw-r--r--ext/intl/tests/symfony_format_type_double_intl1.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_double_intl2.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_double_intl3.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_double_intl4.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_int32_intl1.phpt49
-rw-r--r--ext/intl/tests/symfony_format_type_int32_intl2.phpt33
-rw-r--r--ext/intl/tests/symfony_format_type_int32_intl3.phpt32
-rw-r--r--ext/intl/tests/symfony_format_type_int32_intl4.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_int32_intl5.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_int32_intl6.phpt32
-rw-r--r--ext/intl/tests/symfony_format_type_int32_intl7.phpt32
-rw-r--r--ext/intl/tests/symfony_format_type_int64_intl1.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_int64_intl2.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_int64_intl3.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_int64_intl4.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_int64_intl5.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_int64_intl6.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_int64_intl7.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_int64_intl8.phpt30
-rw-r--r--[-rwxr-xr-x]ext/intl/tests/ut_common.inc0
-rw-r--r--ext/intl/timezone/timezone_class.cpp77
-rw-r--r--ext/intl/timezone/timezone_class.h1
-rw-r--r--ext/intl/timezone/timezone_methods.cpp3
-rw-r--r--ext/intl/transliterator/transliterator_class.c2
-rw-r--r--ext/json/json.c12
-rw-r--r--ext/json/php_json.h1
-rw-r--r--ext/json/tests/bug62369.phpt34
-rw-r--r--ext/json/tests/json_encode_error.phpt4
-rw-r--r--ext/json/tests/pass001.1_64bit.phpt4
-rw-r--r--ext/mbstring/mbstring.c16
-rw-r--r--ext/mbstring/tests/mb_str_functions_opt-parameter.phpt30
-rw-r--r--ext/mcrypt/mcrypt.c8
-rw-r--r--ext/mcrypt/tests/mcrypt_cbc.phpt6
-rw-r--r--ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt14
-rw-r--r--ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt14
-rw-r--r--ext/mcrypt/tests/mcrypt_cbc_error.phpt4
-rw-r--r--ext/mcrypt/tests/mcrypt_cbc_variation1.phpt26
-rw-r--r--ext/mcrypt/tests/mcrypt_cbc_variation2.phpt27
-rw-r--r--ext/mcrypt/tests/mcrypt_cbc_variation3.phpt27
-rw-r--r--ext/mcrypt/tests/mcrypt_cbc_variation4.phpt28
-rw-r--r--ext/mcrypt/tests/mcrypt_cbc_variation5.phpt26
-rw-r--r--ext/mcrypt/tests/mcrypt_cfb.phpt (renamed from ext/mcrypt/tests/mcrypt_cbf.phpt)12
-rw-r--r--ext/mcrypt/tests/mcrypt_create_iv.phpt8
-rw-r--r--ext/mcrypt/tests/mcrypt_ecb.phpt6
-rw-r--r--ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt4
-rw-r--r--ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt2
-rw-r--r--ext/mcrypt/tests/mcrypt_ecb_error.phpt2
-rw-r--r--ext/mcrypt/tests/mcrypt_ecb_variation1.phpt4
-rw-r--r--ext/mcrypt/tests/mcrypt_ecb_variation2.phpt4
-rw-r--r--ext/mcrypt/tests/mcrypt_ecb_variation3.phpt4
-rw-r--r--ext/mcrypt/tests/mcrypt_ecb_variation4.phpt4
-rw-r--r--ext/mcrypt/tests/mcrypt_ecb_variation5.phpt4
-rw-r--r--ext/mcrypt/tests/mcrypt_ofb.phpt10
-rw-r--r--ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt20
-rw-r--r--ext/mysql/tests/mysql_query_load_data_openbasedir.phpt1
-rw-r--r--ext/mysqli/mysqli_nonapi.c5
-rw-r--r--ext/mysqli/tests/bug62885.phpt26
-rw-r--r--ext/mysqli/tests/connect.inc93
-rw-r--r--ext/mysqli/tests/mysqli_fetch_field.phpt22
-rw-r--r--ext/mysqli/tests/mysqli_fetch_field_oo.phpt21
-rw-r--r--ext/mysqli/tests/mysqli_fetch_fields.phpt20
-rw-r--r--ext/mysqli/tests/mysqli_field_seek.phpt22
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt21
-rw-r--r--ext/mysqlnd/mysqlnd.c17
-rw-r--r--ext/mysqlnd/mysqlnd_alloc.c54
-rw-r--r--ext/mysqlnd/mysqlnd_debug.c4
-rw-r--r--ext/mysqlnd/mysqlnd_debug.h2
-rw-r--r--ext/oci8/tests/bind_char_2_11gR1.phpt2
-rw-r--r--ext/oci8/tests/bind_char_3_11gR1.phpt2
-rw-r--r--ext/oci8/tests/bind_char_4_11gR1.phpt2
-rw-r--r--ext/oci8/tests/details.inc53
-rw-r--r--ext/oci8/tests/pecl_bug10194.phpt3
-rw-r--r--ext/oci8/tests/pecl_bug10194_blob.phpt3
-rw-r--r--ext/oci8/tests/pecl_bug10194_blob_64.phpt3
-rw-r--r--ext/oci8/tests/xmltype_01.phpt1
-rw-r--r--ext/pcre/php_pcre.c32
-rw-r--r--ext/pcre/tests/null_bytes.phpt42
-rwxr-xr-xext/pdo/pdo_dbh.c2
-rw-r--r--ext/pdo/tests/bug_43130.phpt1
-rw-r--r--ext/pdo/tests/pdo_test.inc12
-rw-r--r--ext/pdo_firebird/tests/bug_47415.phpt1
-rw-r--r--ext/pdo_firebird/tests/bug_48877.phpt1
-rw-r--r--ext/pdo_firebird/tests/bug_53280.phpt1
-rw-r--r--ext/pdo_firebird/tests/connect.phpt1
-rw-r--r--ext/pdo_firebird/tests/ddl.phpt1
-rw-r--r--ext/pdo_firebird/tests/execute.phpt1
-rw-r--r--ext/pdo_firebird/tests/rowCount.phpt1
-rwxr-xr-xext/pdo_odbc/odbc_stmt.c81
-rw-r--r--ext/pdo_odbc/tests/common.phpt45
-rw-r--r--ext/pdo_odbc/tests/long_columns.phpt112
-rw-r--r--ext/phar/phar.c5
-rwxr-xr-xext/phar/phar/pharcommand.inc8
-rw-r--r--ext/phar/phar_object.c137
-rw-r--r--ext/phar/stream.c13
-rw-r--r--ext/phar/tar.c5
-rw-r--r--ext/phar/util.c2
-rw-r--r--ext/phar/zip.c16
-rw-r--r--ext/reflection/php_reflection.c129
-rw-r--r--ext/reflection/tests/ReflectionFunction_isGenerator_basic.phpt52
-rw-r--r--ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt52
-rw-r--r--ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt30
-rw-r--r--ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt23
-rw-r--r--ext/reflection/tests/bug62715.phpt24
-rw-r--r--ext/session/mod_user.c17
-rw-r--r--ext/session/tests/bug60634_error_5.phpt2
-rw-r--r--ext/simplexml/simplexml.c4
-rw-r--r--ext/soap/php_encoding.c7
-rw-r--r--ext/soap/tests/bugs/bug50997.phpt16
-rw-r--r--ext/soap/tests/bugs/bug50997.wsdl54
-rwxr-xr-xext/spl/spl_array.c215
-rwxr-xr-xext/spl/spl_directory.c1
-rw-r--r--ext/spl/spl_fixedarray.c12
-rwxr-xr-xext/spl/spl_iterators.c4
-rw-r--r--ext/spl/tests/SplFileObject_current_basic.phpt18
-rw-r--r--ext/spl/tests/SplFileObject_current_error001.phpt19
-rw-r--r--ext/spl/tests/SplFileObject_current_variation001.phpt21
-rw-r--r--ext/spl/tests/SplFileObject_getchildren_basic.phpt12
-rw-r--r--ext/spl/tests/SplFileObject_getchildren_error001.phpt12
-rw-r--r--ext/spl/tests/SplFileObject_getflags_basic.phpt22
-rw-r--r--ext/spl/tests/SplFileObject_getflags_error001.phpt26
-rw-r--r--ext/spl/tests/SplFileObject_getflags_error002.phpt21
-rw-r--r--ext/spl/tests/SplFileObject_getflags_variation001.phpt29
-rw-r--r--ext/spl/tests/SplFileObject_haschildren_basic.phpt12
-rw-r--r--ext/spl/tests/SplFileObject_haschildren_error001.phpt12
-rw-r--r--ext/spl/tests/SplFileObject_key_basic.phpt19
-rw-r--r--ext/spl/tests/SplFileObject_key_error001.phpt22
-rw-r--r--ext/spl/tests/SplFileObject_key_error002.phpt22
-rw-r--r--ext/spl/tests/SplFileObject_key_error003.phpt15
-rw-r--r--ext/spl/tests/SplFileObject_next_basic.phpt22
-rw-r--r--ext/spl/tests/SplFileObject_next_variation001.phpt24
-rw-r--r--ext/spl/tests/SplFileObject_next_variation002.phpt30
-rw-r--r--ext/spl/tests/SplFileObject_rewind_basic.phpt21
-rw-r--r--ext/spl/tests/SplFileObject_rewind_error001.phpt18
-rw-r--r--ext/spl/tests/SplFileObject_rewind_variation001.phpt28
-rw-r--r--ext/spl/tests/SplFileObject_seek_basic.phpt19
-rw-r--r--ext/spl/tests/SplFileObject_seek_error002.phpt18
-rw-r--r--ext/spl/tests/SplFileObject_setCsvControl_basic.phpt30
-rw-r--r--ext/spl/tests/SplFileObject_setCsvControl_error001.phpt24
-rw-r--r--ext/spl/tests/SplFileObject_setCsvControl_error002.phpt24
-rw-r--r--ext/spl/tests/SplFileObject_setCsvControl_error003.phpt26
-rw-r--r--ext/spl/tests/SplFileObject_setCsvControl_variation001.phpt30
-rw-r--r--ext/spl/tests/arrayObject___construct_basic2.phpt4
-rw-r--r--ext/spl/tests/arrayObject___construct_basic3.phpt4
-rw-r--r--ext/spl/tests/arrayObject___construct_basic4.phpt10
-rw-r--r--ext/spl/tests/arrayObject___construct_basic5.phpt10
-rw-r--r--ext/spl/tests/arrayObject_asort_basic1.phpt20
-rw-r--r--ext/spl/tests/arrayObject_ksort_basic1.phpt26
-rw-r--r--ext/spl/tests/arrayObject_magicMethods1.phpt4
-rw-r--r--ext/spl/tests/arrayObject_magicMethods3.phpt4
-rw-r--r--ext/spl/tests/arrayObject_magicMethods4.phpt4
-rw-r--r--ext/spl/tests/arrayObject_magicMethods6.phpt4
-rw-r--r--ext/spl/tests/arrayObject_setFlags_basic1.phpt4
-rwxr-xr-xext/spl/tests/array_001.phpt8
-rwxr-xr-xext/spl/tests/array_010.phpt8
-rw-r--r--ext/spl/tests/bug45622.phpt2
-rw-r--r--ext/spl/tests/bug45622b.phpt4
-rw-r--r--ext/spl/tests/bug54323.phpt2
-rw-r--r--ext/spl/tests/bug61527.phpt92
-rw-r--r--ext/spl/tests/bug61697.phpt26
-rw-r--r--ext/spl/tests/bug62328.phpt24
-rw-r--r--ext/spl/tests/bug62616.phpt15
-rw-r--r--ext/spl/tests/bug62904.phpt19
-rw-r--r--ext/spl/tests/bug62978.phpt50
-rw-r--r--ext/spl/tests/fileobject_getmaxlinelen_error001.phpt14
-rw-r--r--ext/spl/tests/fileobject_setmaxlinelen_error001.phpt17
-rw-r--r--ext/spl/tests/fileobject_setmaxlinelen_error002.phpt12
-rw-r--r--ext/spl/tests/fileobject_setmaxlinelen_error003.phpt12
-rwxr-xr-xext/spl/tests/iterator_044.phpt16
-rw-r--r--ext/standard/assert.c48
-rw-r--r--ext/standard/basic_functions.c25
-rw-r--r--ext/standard/file.c1
-rw-r--r--ext/standard/incomplete_class.c2
-rw-r--r--ext/standard/info.c123
-rw-r--r--ext/standard/info.h12
-rw-r--r--ext/standard/mail.c55
-rw-r--r--ext/standard/math.c4
-rw-r--r--ext/standard/pack.c1
-rw-r--r--ext/standard/quot_print.c7
-rw-r--r--ext/standard/string.c3
-rw-r--r--ext/standard/tests/assert/assert04.phpt5
-rw-r--r--ext/standard/tests/assert/assert_basic6.phpt26
-rw-r--r--ext/standard/tests/assert/assert_error1.phpt11
-rw-r--r--ext/standard/tests/assert/assert_error2.phpt30
-rw-r--r--ext/standard/tests/assert/assert_error3.phpt21
-rw-r--r--ext/standard/tests/assert/assert_error4.phpt21
-rw-r--r--ext/standard/tests/file/realpath_cache.phpt2
-rw-r--r--ext/standard/tests/general_functions/bug27678.phpt4
-rw-r--r--ext/standard/tests/general_functions/debug_zval_dump_o.phpt2
-rw-r--r--ext/standard/tests/general_functions/uniqid_basic.phpt145
-rw-r--r--ext/standard/tests/general_functions/var_export_error2.phpt3
-rw-r--r--ext/standard/tests/general_functions/var_export_error3.phpt3
-rw-r--r--ext/standard/tests/php_ini_loaded_file.phpt4
-rw-r--r--ext/standard/tests/php_logo_guid.phpt13
-rw-r--r--ext/standard/tests/php_real_logo_guid.phpt12
-rw-r--r--ext/standard/tests/serialize/bug62836_1.phpt34
-rw-r--r--ext/standard/tests/serialize/bug62836_2.phpt37
-rw-r--r--ext/standard/tests/streams/bug40459.phpt103
-rw-r--r--ext/standard/tests/streams/bug61115-1.phpt6
-rw-r--r--ext/standard/tests/strings/bug62462.phpt17
-rw-r--r--ext/standard/tests/strings/http_build_query_variation1.phpt30
-rw-r--r--ext/standard/tests/strings/http_build_query_variation2.phpt39
-rw-r--r--ext/standard/tests/strings/http_build_query_variation3.phpt27
-rw-r--r--ext/standard/tests/strings/quoted_printable_encode_002.phptbin7290 -> 7292 bytes
-rw-r--r--ext/standard/tests/strings/str_pad_variation5.phpt3
-rw-r--r--ext/standard/tests/url/parse_url_relative_scheme.phpt11
-rw-r--r--ext/standard/tests/zend_logo_guid.phpt12
-rw-r--r--ext/standard/url.c10
-rw-r--r--ext/standard/url_scanner_ex.c2
-rw-r--r--ext/standard/var.c10
-rw-r--r--ext/standard/var_unserializer.c6
-rw-r--r--ext/tokenizer/tests/bug60097.phpt121
-rw-r--r--ext/tokenizer/tests/token_get_all_variation11.phpt4
-rw-r--r--ext/tokenizer/tests/token_get_all_variation13.phpt2
-rw-r--r--ext/tokenizer/tests/token_get_all_variation17.phpt2
-rw-r--r--ext/tokenizer/tests/token_get_all_variation4.phpt4
-rw-r--r--ext/tokenizer/tests/token_get_all_variation5.phpt22
-rw-r--r--ext/tokenizer/tests/token_get_all_variation6.phpt4
-rw-r--r--ext/tokenizer/tests/token_get_all_variation8.phpt2
-rw-r--r--ext/tokenizer/tokenizer.c5
-rw-r--r--ext/tokenizer/tokenizer_data.c6
-rw-r--r--ext/xml/tests/bug62328.phpt21
-rw-r--r--ext/xmlrpc/tests/bug61264.phpt2
-rw-r--r--ext/zip/tests/bug51353.phpt54
-rw-r--r--ext/zlib/php_zlib.h2
-rw-r--r--ext/zlib/tests/bug55544-win.phptbin0 -> 427 bytes
-rw-r--r--ext/zlib/tests/bug55544.phptbin0 -> 430 bytes
-rw-r--r--ext/zlib/tests/bug_52944-win.phpt161
-rw-r--r--ext/zlib/tests/bug_52944.phpt4
-rw-r--r--ext/zlib/zlib.c22
-rw-r--r--main/logos.h1080
-rw-r--r--main/main.c14
-rw-r--r--main/php_logos.c99
-rw-r--r--main/php_logos.h34
-rw-r--r--main/php_variables.c17
-rw-r--r--main/snprintf.c2
-rw-r--r--main/streams/userspace.c197
-rw-r--r--php.ini-development2
-rw-r--r--php.ini-production2
-rwxr-xr-xrun-tests.php4
-rw-r--r--sapi/cgi/tests/apache_request_headers.phpt6
-rw-r--r--sapi/cli/config.m42
-rw-r--r--sapi/cli/php_cli.c6
-rw-r--r--sapi/cli/php_cli_server.c64
-rw-r--r--sapi/cli/php_http_parser.h5
-rw-r--r--sapi/cli/tests/php_cli_server.inc2
-rw-r--r--sapi/cli/tests/php_cli_server_011.phpt41
-rw-r--r--sapi/fpm/fpm/fpm_php_trace.c2
-rw-r--r--sapi/fpm/fpm/fpm_process_ctl.c8
-rw-r--r--sapi/fpm/fpm/fpm_request.c4
-rw-r--r--sapi/fpm/fpm/fpm_scoreboard.c5
-rw-r--r--sapi/fpm/fpm/fpm_scoreboard.h3
-rw-r--r--sapi/fpm/fpm/fpm_sockets.c8
-rw-r--r--sapi/fpm/fpm/fpm_status.c13
-rw-r--r--tests/basic/php_egg_logo_guid.phpt13
-rw-r--r--tests/basic/php_logo_guid.phpt10
-rw-r--r--tests/basic/php_real_logo_guid.phpt12
-rw-r--r--tests/basic/zend_logo_guid.phpt13
-rw-r--r--tests/lang/bug45392.phpt5
-rw-r--r--tests/lang/compare_objects_basic2.phpt8
-rw-r--r--tests/lang/foreachLoop.007.phpt11
-rw-r--r--tests/lang/foreachLoop.008.phpt10
-rwxr-xr-xtravis/compile.sh8
-rw-r--r--win32/build/config.w324
-rw-r--r--win32/build/libs_version.txt2
-rw-r--r--win32/php5dll.dsp8
-rw-r--r--win32/php5dllts.dsp8
-rw-r--r--win32/registry.c9
685 files changed, 18308 insertions, 6794 deletions
diff --git a/.gitattributes b/.gitattributes
index 1f4a7195b7..9ed6e5f4b9 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/INSTALL b/INSTALL
index b493f3c29b..c0cbe5f2c1 100644
--- a/INSTALL
+++ b/INSTALL
@@ -24,6 +24,7 @@ Installing PHP
+ Installing a PHP extension on Windows
+ Compiling shared PECL extensions with the pecl command
+ Compiling shared PECL extensions with phpize
+ + php-config
+ Compiling PECL extensions statically into PHP
* Problems?
+ Read the FAQ
@@ -83,7 +84,7 @@ General Installation Considerations
With PHP you can also write desktop GUI applications using the PHP-GTK
extension. This is a completely different approach than writing web
pages, as you do not output any HTML, but manage windows and objects
- within them. For more information about PHP-GTK, please » visit the
+ within them. For more information about PHP-GTK, please » visit the
site dedicated to this extension. PHP-GTK is not included in the
official PHP distribution.
@@ -92,9 +93,9 @@ General Installation Considerations
will also find information on the command line executable in the
following sections.
- PHP source code and binary distributions for Windows can be found at »
- http://www.php.net/downloads.php. We recommend you to choose a » mirror
- nearest to you for downloading the distributions.
+ PHP source code and binary distributions for Windows can be found at
+ » http://www.php.net/downloads.php. We recommend you to choose a
+ » mirror nearest to you for downloading the distributions.
__________________________________________________________________
__________________________________________________________________
@@ -140,9 +141,9 @@ Table of Contents
* A web server
* Any module specific components (such as GD, PDF libs, etc.)
- When building directly from SVN sources or after custom modifications
+ When building directly from Git sources or after custom modifications
you might also need:
- * autoconf: 2.13
+ * autoconf: 2.13+ (for PHP < 5.4.0), 2.59+ (for PHP >= 5.4.0)
* automake: 1.4+
* libtool: 1.4.x+ (except 1.4.2)
* re2c: Version 0.13.4 or newer
@@ -375,12 +376,12 @@ Apache 2.x on Unix systems
For information on why, read the related FAQ entry on using Apache2
with a threaded MPM
- The » Apache Documentation is the most authoritative source of
+ The » Apache Documentation is the most authoritative source of
information on the Apache 2.x server. More information about
installation options for Apache may be found there.
- The most recent version of Apache HTTP Server may be obtained from »
- Apache download site, and a fitting PHP version from the above
+ The most recent version of Apache HTTP Server may be obtained from
+ » Apache download site, and a fitting PHP version from the above
mentioned places. This quick guide covers only the basics to get
started with Apache 2.x and PHP. For more information read the » Apache
Documentation. The version numbers have been omitted here, to ensure
@@ -498,7 +499,7 @@ service httpd restart
This should not be undertaken without being aware of the consequences
of this decision, and having at least a fair understanding of the
- implications. The Apache documentation regarding » MPM-Modules
+ implications. The Apache documentation regarding » MPM-Modules
discusses MPMs in a great deal more detail.
Note:
@@ -520,7 +521,7 @@ Lighttpd 1.4 on Unix systems
This section contains notes and hints specific to Lighttpd 1.4 installs
of PHP on Unix systems.
- Please use the » Lighttpd trac to learn how to install Lighttpd
+ Please use the » Lighttpd trac to learn how to install Lighttpd
properly before continuing.
Fastcgi is the preferred SAPI to connect PHP and Lighttpd. Fastcgi is
@@ -627,15 +628,15 @@ Sun, iPlanet and Netscape servers on Sun Solaris
current web servers read the note about subrequests.
You can find more information about setting up PHP for the Netscape
- Enterprise Server (NES) here: »
- http://benoit.noss.free.fr/php/install-php4.html
+ Enterprise Server (NES) here:
+ » http://benoit.noss.free.fr/php/install-php4.html
To build PHP with Sun JSWS/Sun ONE WS/iPlanet/Netscape web servers,
enter the proper install directory for the --with-nsapi=[DIR] option.
The default directory is usually /opt/netscape/suitespot/. Please also
read /php-xxx-version/sapi/nsapi/nsapi-readme.txt.
- 1. Install the following packages from » http://www.sunfreeware.com/
+ 1. Install the following packages from » http://www.sunfreeware.com/
or another download site:
+ autoconf-2.13
+ automake-1.4
@@ -837,7 +838,7 @@ Testing
Using Variables
Some server supplied environment variables are not defined in the
- current » CGI/1.1 specification. Only the following variables are
+ current » CGI/1.1 specification. Only the following variables are
defined there: AUTH_TYPE, CONTENT_LENGTH, CONTENT_TYPE,
GATEWAY_INTERFACE, PATH_INFO, PATH_TRANSLATED, QUERY_STRING,
REMOTE_ADDR, REMOTE_HOST, REMOTE_IDENT, REMOTE_USER, REQUEST_METHOD,
@@ -855,20 +856,20 @@ HP-UX specific installation notes
There are two main options for installing PHP on HP-UX systems. Either
compile it, or install a pre-compiled binary.
- Official pre-compiled packages are located here: »
- http://software.hp.com/
+ Official pre-compiled packages are located here:
+ » http://software.hp.com/
Until this manual section is rewritten, the documentation about
compiling PHP (and related extensions) on HP-UX systems has been
- removed. For now, consider reading the following external resource: »
- Building Apache and PHP on HP-UX 11.11
+ removed. For now, consider reading the following external resource:
+ » Building Apache and PHP on HP-UX 11.11
__________________________________________________________________
__________________________________________________________________
OpenBSD installation notes
- This section contains notes and hints specific to installing PHP on »
- OpenBSD 3.6.
+ This section contains notes and hints specific to installing PHP on
+ » OpenBSD 3.6.
Using Binary Packages
@@ -900,12 +901,12 @@ Using Binary Packages
(install the PEAR libraries)
# pkg_add php4-pear-4.3.8.tgz
- Read the » packages(7) manual page for more information about binary
+ Read the » packages(7) manual page for more information about binary
packages on OpenBSD.
Using Ports
- You can also compile up PHP from source using the » ports tree.
+ You can also compile up PHP from source using the » ports tree.
However, this is only recommended for users familiar with OpenBSD. The
PHP 4 port is split into two sub-directories: core and extensions. The
extensions directory generates sub-packages for all of the supported
@@ -926,7 +927,7 @@ Common Problems
automatically installs into the correct chroot directories, so no
special modification is needed there. More information on the
OpenBSD Apache is available in the » OpenBSD FAQ.
- * The OpenBSD 3.6 package for the » gd extension requires XFree86 to
+ * The OpenBSD 3.6 package for the » gd extension requires XFree86 to
be installed. If you do not wish to use some of the font features
that require X11, install the php4-gd-4.3.8-no_x11.tgz package
instead.
@@ -951,18 +952,26 @@ Required software
Solaris installs often lack C compilers and their related tools. Read
this FAQ for information on why using GNU versions for some of these
- tools is necessary. The required software is as follows:
+ tools is necessary.
+
+ For unpacking the PHP distribution you need
+ * tar
+ * gzip or
+ * bzip2
+
+ For compiling PHP you need
* gcc (recommended, other C compilers may work)
* make
- * flex
+ * GNU sed
+
+ For building extra extensions or hacking the code of PHP you might also
+ need
+ * flex (up to PHP 5.2)
+ * re2c
* bison
* m4
* autoconf
* automake
- * perl
- * gzip
- * tar
- * GNU sed
In addition, you will need to install (and possibly compile) any
additional software specific to your configuration, such as Oracle or
@@ -971,14 +980,16 @@ Required software
Using Packages
You can simplify the Solaris install process by using pkgadd to install
- most of your needed components.
+ most of your needed components. The Image Packaging System (IPS) for
+ Solaris 11 Express also contains most of the required components for
+ installation using the pkg command.
__________________________________________________________________
__________________________________________________________________
Debian GNU/Linux installation notes
- This section contains notes and hints specific to installing PHP on »
- Debian GNU/Linux.
+ This section contains notes and hints specific to installing PHP on
+ » Debian GNU/Linux.
Warning
Unofficial builds from third-parties are not supported here. Any bugs
@@ -1205,6 +1216,7 @@ Table of Contents
* Installing a PHP extension on Windows
* Compiling shared PECL extensions with the pecl command
* Compiling shared PECL extensions with phpize
+ * php-config
* Compiling PECL extensions statically into PHP
__________________________________________________________________
@@ -1227,8 +1239,8 @@ Introduction to PECL Installations
To this php.ini file, or through the use of the dl() function.
When building PHP modules, it's important to have known-good versions
- of the required tools (autoconf, automake, libtool, etc.) See the »
- Anonymous SVN Instructions for details on the required tools, and
+ of the required tools (autoconf, automake, libtool, etc.) See the
+ » Anonymous Git Instructions for details on the required tools, and
required versions.
__________________________________________________________________
__________________________________________________________________
@@ -1247,7 +1259,7 @@ Downloading PECL extensions
the PECL web site are available for download and installation using
the » pecl command. Specific revisions may also be specified.
* SVN Most PECL extensions also reside in SVN. A web-based view may
- be seen at » http://svn.php.net/viewvc/pecl/. To download straight
+ be seen at » http://svn.php.net/viewvc/pecl/. To download straight
from SVN, the following sequence of commands may be used:
$ svn checkout http://svn.php.net/repository/pecl/extname/trunk
extname
@@ -1279,7 +1291,7 @@ Where to find an extension?
PHP extensions are usually called "php_*.dll" (where the star
represents the name of the extension) and they are located under the
- "PHP\ext" ("PHP\extensions" in PHP4) folder.
+ "PHP\ext" ("PHP\extensions" in PHP 4) folder.
PHP ships with the extensions most useful to the majority of
developers. They are called "core" extensions.
@@ -1365,7 +1377,7 @@ Resolving problems
Compiling shared PECL extensions with the pecl command
- PECL makes it easy to create shared PHP extensions. Using the » pecl
+ PECL makes it easy to create shared PHP extensions. Using the » pecl
command, do the following:
$ pecl install extname
@@ -1424,6 +1436,51 @@ $ make
__________________________________________________________________
__________________________________________________________________
+php-config
+
+ php-config is a simple shell script for obtaining information about the
+ installed PHP configuration.
+
+ When compiling extensions, if you have multiple PHP versions installed,
+ you may specify for which installation you'd like to build by using the
+ --with-php-config option during configuration, specifying the path of
+ the respective php-config script.
+
+ The list of command line options provided by the php-config script can
+ be queried anytime by running php-config with the -h switch:
+Usage: /usr/local/bin/php-config [OPTION]
+Options:
+ --prefix [...]
+ --includes [...]
+ --ldflags [...]
+ --libs [...]
+ --extension-dir [...]
+ --include-dir [...]
+ --php-binary [...]
+ --php-sapis [...]
+ --configure-options [...]
+ --version [...]
+ --vernum [...]
+
+ CAPTION: Command line options
+
+ Option Description
+ --prefix Directory prefix where PHP is installed, e.g. /usr/local
+ --includes List of -I options with all include files
+ --ldflags LD Flags which PHP was compiled with
+ --libs Extra libraries which PHP was compiled with
+ --extension-dir Directory where extensions are searched by default
+ --include-dir Directory prefix where header files are installed by
+ default
+ --php-binary Full path to php CLI or CGI binary
+ --php-sapis Show all SAPI modules available
+ --configure-options Configure options to recreate configuration of
+ current PHP installation
+ --version PHP version
+ --vernum PHP version as integer
+ __________________________________________________________________
+ __________________________________________________________________
+
Compiling PECL extensions statically into PHP
You might find that you need to build a PECL extension statically into
@@ -1485,11 +1542,11 @@ Other problems
If you are still stuck, someone on the PHP installation mailing list
may be able to help you. You should check out the archive first, in
case someone already answered someone else who had the same problem as
- you. The archives are available from the support page on »
- http://www.php.net/support.php. To subscribe to the PHP installation
- mailing list, send an empty mail to »
- php-install-subscribe@lists.php.net. The mailing list address is »
- php-install@lists.php.net.
+ you. The archives are available from the support page on
+ » http://www.php.net/support.php. To subscribe to the PHP installation
+ mailing list, send an empty mail to
+ » php-install-subscribe@lists.php.net. The mailing list address is
+ » php-install@lists.php.net.
If you want to get help on the mailing list, please try to be precise
and give the necessary details about your environment (which operating
@@ -1504,11 +1561,11 @@ Bug reports
If you think you have found a bug in PHP, please report it. The PHP
developers probably don't know about it, and unless you report it,
chances are it won't be fixed. You can report bugs using the
- bug-tracking system at » http://bugs.php.net/. Please do not send bug
+ bug-tracking system at » http://bugs.php.net/. Please do not send bug
reports in mailing list or personal letters. The bug system is also
suitable to submit feature requests.
- Read the » How to report a bug document before submitting any bug
+ Read the » How to report a bug document before submitting any bug
reports!
__________________________________________________________________
__________________________________________________________________
@@ -1528,14 +1585,14 @@ The configuration file
The configuration file (php.ini) is read when PHP starts up. For the
server module versions of PHP, this happens only once when the web
- server is started. For the CGI and CLI version, it happens on every
+ server is started. For the CGI and CLI versions, it happens on every
invocation.
- php.ini is searched in these locations (in order):
+ php.ini is searched for in these locations (in order):
* SAPI module specific location (PHPIniDir directive in Apache 2, -c
command line option in CGI and CLI, php_ini parameter in NSAPI,
PHP_INI_PATH environment variable in THTTPD)
- * The PHPRC environment variable. Before PHP 5.2.0 this was checked
+ * The PHPRC environment variable. Before PHP 5.2.0, this was checked
after the registry key mentioned below.
* As of PHP 5.2.0, the location of the php.ini file can be set for
different versions of PHP. The following registry keys are examined
@@ -1543,33 +1600,33 @@ The configuration file
[HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y] and
[HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x], where x, y and z mean the PHP
major, minor and release versions. If there is a value for
- IniFilePath in these keys, then the first one found will be used as
- the location of the php.ini (Windows only).
+ IniFilePath in any of these keys, the first one found will be used
+ as the location of the php.ini (Windows only).
* [HKEY_LOCAL_MACHINE\SOFTWARE\PHP], value of IniFilePath (Windows
only).
- * Current working directory (except CLI)
+ * Current working directory (except CLI).
* The web server's directory (for SAPI modules), or directory of PHP
- (otherwise in Windows)
+ (otherwise in Windows).
* Windows directory (C:\windows or C:\winnt) (for Windows), or
- --with-config-file-path compile time option
+ --with-config-file-path compile time option.
- If php-SAPI.ini exists (where SAPI is used SAPI, so the filename is
- e.g. php-cli.ini or php-apache.ini), it's used instead of php.ini. SAPI
- name can be determined by php_sapi_name().
+ If php-SAPI.ini exists (where SAPI is the SAPI in use, so, for example,
+ php-cli.ini or php-apache.ini), it is used instead of php.ini. The SAPI
+ name can be determined with php_sapi_name().
Note:
- The Apache web server changes the directory to root at startup
+ The Apache web server changes the directory to root at startup,
causing PHP to attempt to read php.ini from the root filesystem if
it exists.
- The php.ini directives handled by extensions are documented
- respectively on the pages of the extensions themselves. The list of the
- core directives is available in the appendix. Probably not all PHP
- directives are documented in the manual though. For a complete list of
+ The php.ini directives handled by extensions are documented on the
+ respective pages of the extensions themselves. A list of the core
+ directives is available in the appendix. Not all PHP directives are
+ necessarily documented in this manual: for a complete list of
directives available in your PHP version, please read your well
- commented php.ini file. Alternatively, you may find the » the latest
- php.ini from SVN helpful too.
+ commented php.ini file. Alternatively, you may find » the latest
+ php.ini from Git helpful too.
Example #1 php.ini example
; any text on a line after an unquoted semicolon (;) is ignored
@@ -1635,12 +1692,13 @@ Where a configuration setting may be set
CAPTION: Definition of PHP_INI_* modes
- Mode Value Meaning
- PHP_INI_USER 1 Entry can be set in user scripts (like with ini_set())
- or in the Windows registry
- PHP_INI_PERDIR 6 Entry can be set in php.ini, .htaccess or httpd.conf
- PHP_INI_SYSTEM 4 Entry can be set in php.ini or httpd.conf
- PHP_INI_ALL 7 Entry can be set anywhere
+ Mode Meaning
+ PHP_INI_USER Entry can be set in user scripts (like with ini_set()) or
+ in the Windows registry. Since PHP 5.3, entry can be set in .user.ini
+ PHP_INI_PERDIR Entry can be set in php.ini, .htaccess, httpd.conf or
+ .user.ini (since PHP 5.3)
+ PHP_INI_SYSTEM Entry can be set in php.ini or httpd.conf
+ PHP_INI_ALL Entry can be set anywhere
__________________________________________________________________
__________________________________________________________________
@@ -1788,13 +1846,9 @@ Installation
each request to play in, further weaknesses are introduced into
PHP's system.
- If you feel you have to use a threaded MPM, look at a FastCGI
+ If you want to use a threaded MPM, look at a FastCGI
configuration where PHP is running in its own memory space.
- And finally, this warning against using a threaded MPM is not as
- strong for Windows systems because most libraries on that
- platform tend to be threadsafe.
-
Unix/Windows: Where should my php.ini file be located?
By default on Unix it should be in /usr/local/lib which is
<install-path>/lib. Most people will want to change this at
diff --git a/NEWS b/NEWS
index e76c564c34..1ee977974a 100644
--- a/NEWS
+++ b/NEWS
@@ -3,23 +3,29 @@ PHP NEWS
?? ??? 201?, PHP 5.5.0
- General improvements:
+ . Support list in foreach (https://wiki.php.net/rfc/foreachlist). (Laruence)
+ . 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:
- . Fixed bug #62443 (Crypt SHA256/512 Segfaults With Malformed
- Salt). (Anthony Ferrara)
. 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)
. Implemented FR #60738 (Allow 'set_error_handler' to handle NULL).
(Laruence, Nikita Popov)
+ . Added optional second argument for assert() to specify custom message. Patch
+ by Lonny Kapelushnik (lonny@lonnylot.com). (Lars)
- cURL:
. Added support for CURLOPT_FTP_RESPONSE_TIMEOUT, CURLOPT_APPEND,
@@ -41,9 +47,20 @@ 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)
+
+- MCrypt
+ . mcrypt_ecb(), mcrypt_cbc(), mcrypt_cfb() and mcrypt_ofb() now throw
+ E_DEPRECATED. (GoogleGuy)
+
- MySQLi
. Dropped support for LOAD DATA LOCAL INFILE handlers when using libmysql.
Known for stability problems. (Andrey)
@@ -55,6 +72,9 @@ PHP NEWS
- pgsql
. Added pg_escape_literal() and pg_escape_identifier() (Yasuo)
+- Tokenizer:
+ . Fixed bug #60097 (token_get_all fails to lex nested heredoc). (Nikita Popov)
+
- Zip:
. Upgraded libzip to 0.10.1 (Anatoliy)
diff --git a/UPGRADING b/UPGRADING
index 77fe97257d..ba556357ed 100755
--- a/UPGRADING
+++ b/UPGRADING
@@ -21,11 +21,20 @@ 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 list in foreach. (Laruence)
+ (wiki.php.net/rfc/foreachlist)
+- 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
@@ -89,6 +98,13 @@ PHP X.Y UPGRADE NOTES
- 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.
+- mcrypt_ecb(), mcrypt_cbc(), mcrypt_cfb() and mcrypt_ofb() now throw
+ E_DEPRECATED. Their use was already previously discouraged in the docs,
+ but that predated the existence of E_DEPRECATED.
+- php_logo_guid(), php_egg_logo_guid(), php_real_logo_guid() and
+ zend_logo_guid() have been removed
========================================
5. New Functions
@@ -97,7 +113,11 @@ PHP X.Y UPGRADE NOTES
- Core:
- boolval()
+- Hash:
+ - hash_pbkdf2()
+
- Intl:
+ - datefmt_format_object()
- datefmt_get_calendar_object()
- datefmt_get_timezone()
- datefmt_set_timezone()
@@ -173,6 +193,7 @@ PHP X.Y UPGRADE NOTES
- intltz_get_error_code()
- intltz_get_error_message()
+ - IntlDateFormatter::formatObject()
- IntlDateFormatter::getCalendarObject()
- IntlDateFormatter::getTimeZone()
- IntlDateFormatter::setTimeZone()
@@ -219,3 +240,5 @@ PHP X.Y UPGRADE NOTES
========================================
11. Other Changes
========================================
+
+- Logo GUIDs will no longer work
diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS
index 015c752ad0..90c7a4394f 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/Makefile.am b/Zend/Makefile.am
index 5ec4590fef..e5757fac56 100644
--- a/Zend/Makefile.am
+++ b/Zend/Makefile.am
@@ -17,7 +17,8 @@ libZend_la_SOURCES=\
zend_objects_API.c zend_ts_hash.c zend_stream.c \
zend_default_classes.c \
zend_iterators.c zend_interfaces.c zend_exceptions.c \
- zend_strtod.c zend_closures.c zend_float.c zend_string.c zend_signal.c
+ zend_strtod.c zend_closures.c zend_float.c zend_string.c zend_signal.c \
+ zend_generators.c
libZend_la_LDFLAGS =
libZend_la_LIBADD = @ZEND_EXTRA_LIBS@
diff --git a/Zend/Zend.dsp b/Zend/Zend.dsp
index ebe01978c4..23ebd4532b 100644
--- a/Zend/Zend.dsp
+++ b/Zend/Zend.dsp
@@ -159,6 +159,10 @@ SOURCE=.\zend_float.c
# End Source File
# Begin Source File
+SOURCE=.\zend_generators.c
+# End Source File
+# Begin Source File
+
SOURCE=.\zend_hash.c
# End Source File
# Begin Source File
diff --git a/Zend/ZendTS.dsp b/Zend/ZendTS.dsp
index 3494cd4e17..3be2c58bed 100644
--- a/Zend/ZendTS.dsp
+++ b/Zend/ZendTS.dsp
@@ -185,6 +185,10 @@ SOURCE=.\zend_extensions.c
# End Source File
# Begin Source File
+SOURCE=.\zend_generators.c
+# End Source File
+# Begin Source File
+
SOURCE=.\zend_hash.c
# End Source File
# Begin Source File
diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4
index 97d5d647bb..a7358fa85d 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 0000000000..036abb2ada
--- /dev/null
+++ b/Zend/tests/bug18556.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #18556 (Setting locale to 'tr_TR' lowercases class names)
+--FILE--
+<?php
+$g_lang = 'tr_TR';
+putenv("LANG=$g_lang");
+setlocale(LC_ALL, $g_lang);
+
+class InfoBlob {
+ var $foo;
+ function InfoBlob() {
+ $this->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/bug55509.phpt b/Zend/tests/bug55509.phpt
index b78fceb0da..5268789df6 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/bug61761.phpt b/Zend/tests/bug61761.phpt
index 631f566eaa..24c69ae792 100755
--- a/Zend/tests/bug61761.phpt
+++ b/Zend/tests/bug61761.phpt
@@ -14,5 +14,6 @@ class B extends A
}
?>
+==DONE==
--EXPECTF--
-Strict Standards: Declaration of B::test() should be compatible with A::test($a) in %sbug61761.php on line %d
+==DONE==
diff --git a/Zend/tests/bug62358.phpt b/Zend/tests/bug62358.phpt
new file mode 100644
index 0000000000..35d8b483d9
--- /dev/null
+++ b/Zend/tests/bug62358.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Bug #62358 (Segfault when using traits a lot)
+--SKIPIF--
+<?php
+if (getenv("USE_ZEND_ALLOC") !== "0") {
+ die("skip Need Zend MM enabled");
+}
+?>
+--FILE--
+<?php
+
+trait T {
+ public function foo() {
+ echo "from T";
+ }
+}
+
+interface I {
+ public function foo();
+}
+
+abstract class A implements I{
+ use T;
+}
+
+class B extends A {
+ public function foo($var) {
+ }
+}
+?>
+--EXPECTF--
+Strict Standards: Declaration of B::foo() should be compatible with A::foo() in %sbug62358.php on line %d
diff --git a/Zend/tests/bug62653.phpt b/Zend/tests/bug62653.phpt
new file mode 100644
index 0000000000..96299f16ea
--- /dev/null
+++ b/Zend/tests/bug62653.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Bug #62653: unset($array[$float]) causes a crash
+--FILE--
+<?php
+$array = array("5"=>"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 0000000000..e2a2366e7a
--- /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--
+<?php
+$array = array("");
+var_dump(isset($array[0]["a"]["b"]));
+var_dump(isset($array[0]["a"]["b"]["c"]));
+?>
+--EXPECT--
+bool(false)
+bool(false)
diff --git a/Zend/tests/bug62763.phpt b/Zend/tests/bug62763.phpt
new file mode 100644
index 0000000000..50c27bdf35
--- /dev/null
+++ b/Zend/tests/bug62763.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #62763 (register_shutdown_function and extending class)
+--FILE--
+<?php
+class test1 {
+ public function __construct() {
+ register_shutdown_function(array($this, 'shutdown'));
+ }
+ public function shutdown() {
+ exit(__METHOD__);
+ }
+}
+
+class test2 extends test1 {
+ public function __destruct() {
+ exit (__METHOD__);
+ }
+}
+new test1;
+new test2;
+?>
+--EXPECT--
+test1::shutdowntest2::__destruct
diff --git a/Zend/tests/bug62892.phpt b/Zend/tests/bug62892.phpt
new file mode 100644
index 0000000000..e6b0e60ff3
--- /dev/null
+++ b/Zend/tests/bug62892.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #62892 (ReflectionClass::getTraitAliases crashes on importing trait methods as private)
+--FILE--
+<?php
+
+trait myTrait {
+ public function run() {}
+}
+
+class myClass {
+ use myTrait {
+ MyTrait::run as private;
+ }
+}
+$class = new \ReflectionClass('myClass');
+var_dump($class->getTraitAliases());
+
+?>
+--EXPECTF--
+array(0) {
+}
diff --git a/Zend/tests/bug62907.phpt b/Zend/tests/bug62907.phpt
new file mode 100644
index 0000000000..c519a54295
--- /dev/null
+++ b/Zend/tests/bug62907.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #62907 (Double free when use traits)
+--XFAIL--
+bug is not fixed yet
+--FILE--
+<?php
+function __autoload($name) {
+ if ($name == "B") {
+ eval ("abstract class B extends A { }");
+ } else if ($name == "A") {
+ eval ("abstract class A { use T { T::__construct as __asconstruct; }}");
+ } else if ($name == "T") {
+ eval ("trait T { public function __construct() { } }");
+ }
+ return TRUE;
+}
+
+class C extends B {
+ public function __construct() {
+ }
+}
+echo "okey";
+--EXPECT--
+okey
diff --git a/Zend/tests/bug62956.phpt b/Zend/tests/bug62956.phpt
new file mode 100644
index 0000000000..c8694d5bea
--- /dev/null
+++ b/Zend/tests/bug62956.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #62956: "incompatible" signatures for private methods should not cause E_STRICT
+--FILE--
+<?php
+class Base
+{
+ private function test()
+ {}
+}
+
+class Extension extends Base
+{
+ private function test($arg)
+ {}
+}
+
+?>
+==DONE==
+--EXPECT--
+==DONE==
diff --git a/Zend/tests/catch_finally_001.phpt b/Zend/tests/catch_finally_001.phpt
new file mode 100644
index 0000000000..0c3f597a0a
--- /dev/null
+++ b/Zend/tests/catch_finally_001.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Try catch finally (basic test)
+--FILE--
+<?php
+function foo ($throw = FALSE) {
+ try {
+ echo "try\n";
+ if ($throw) {
+ throw new Exception("ex");
+ }
+ } catch (Exception $e) {
+ echo "catch\n";
+ } finally {
+ echo "finally\n";
+ }
+
+ echo "end\n";
+}
+
+foo();
+echo "\n";
+foo(true);
+?>
+--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 0000000000..c54477ff8c
--- /dev/null
+++ b/Zend/tests/catch_finally_002.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Try catch finally (basic test with return)
+--FILE--
+<?php
+function foo () {
+ try {
+ echo "try\n";
+ return 1;
+ } catch (Exception $e) {
+ } finally {
+ echo "finally\n";
+ }
+ return 2;
+}
+
+var_dump(foo());
+?>
+--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 0000000000..24e468d335
--- /dev/null
+++ b/Zend/tests/catch_finally_003.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Try catch finally (with multi-returns)
+--FILE--
+<?php
+function dummy($msg) {
+ var_dump($msg);
+}
+
+function foo ($a) {
+ try {
+ dummy("try");
+ return $a;
+ } catch (Exception $e) {
+ throw $e;
+ } finally {
+ dummy("finally");
+ return "finally";
+ }
+ return "end";
+}
+
+function &bar($a) {
+ try {
+ echo "try\n";
+ throw new Exception("ex");
+ } catch (Exception $e) {
+ } finally {
+ return $a;
+ }
+ return ($c = "end");
+}
+var_dump(foo("para"));
+var_dump(bar("para"));
+?>
+--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 0000000000..a2c22beab1
--- /dev/null
+++ b/Zend/tests/catch_finally_004.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Try catch finally (nesting try-catch-finally)
+--FILE--
+<?php
+
+function throw_exception($msg) {
+ throw new Exception($msg);
+}
+
+function foo (&$ex) {
+ try {
+ echo "1";
+ try {
+ echo "2";
+ throw_exception("try");
+ } catch (Exception $e) {
+ echo "3";
+ throw_exception("catch");
+ } finally {
+ echo "4";
+ throw_exception("finally");
+ }
+ } catch (Exception $e) {
+ $ex = $e;
+ echo "3";
+ } finally {
+ echo "2";
+ }
+ return 1;
+}
+
+var_dump(foo($ex));
+
+do {
+ var_dump($ex->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 0000000000..c2fd55df27
--- /dev/null
+++ b/Zend/tests/catch_finally_005.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Try catch finally (with multi-returns and exception)
+--FILE--
+<?php
+function foo ($a) {
+ try {
+ throw new Exception("ex");
+ } catch (PdoException $e) {
+ die("error");
+ } catch (Exception $e) {
+ return 2;
+ } finally {
+ return 3;
+ }
+ return 1;
+}
+
+var_dump(foo("para"));
+?>
+--EXPECTF--
+int(3)
diff --git a/Zend/tests/catch_finally_006.phpt b/Zend/tests/catch_finally_006.phpt
new file mode 100644
index 0000000000..9759eab37e
--- /dev/null
+++ b/Zend/tests/catch_finally_006.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Try catch finally (re-throw exception in catch block)
+--FILE--
+<?php
+function foo ($a) {
+ try {
+ throw new Exception("ex");
+ } catch (Exception $e) {
+ var_dump($a);
+ throw $e;
+ } finally {
+ var_dump("finally");
+ return "return";
+ }
+ return 1;
+}
+
+try {
+ var_dump(foo("para"));
+} catch (Exception $e) {
+ "caught exception" . PHP_EOL;
+ var_dump($e->getMessage());
+}
+?>
+--EXPECT--
+string(4) "para"
+string(7) "finally"
+string(2) "ex"
diff --git a/Zend/tests/errmsg_043.phpt b/Zend/tests/errmsg_043.phpt
deleted file mode 100644
index 3de8bc2062..0000000000
--- a/Zend/tests/errmsg_043.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-errmsg: cannot create references to temp array
---FILE--
-<?php
-
-foreach (array(1,2,3) as $k=>&$v) {
-}
-
-echo "Done\n";
-?>
---EXPECTF--
-Fatal error: Cannot create references to elements of a temporary array expression in %s on line %d
diff --git a/Zend/tests/foreach_list_001.phpt b/Zend/tests/foreach_list_001.phpt
new file mode 100644
index 0000000000..a318f1aad9
--- /dev/null
+++ b/Zend/tests/foreach_list_001.phpt
@@ -0,0 +1,43 @@
+--TEST--
+foreach with list syntax
+--FILE--
+<?php
+
+foreach(array(array(1,2), array(3,4)) as list($a, $b)) {
+ var_dump($a . $b);
+}
+
+$array = array(
+ array('a', 'b'),
+ array('c', 'd'),
+);
+
+foreach ($array as list($a, $b)) {
+ var_dump($a . $b);
+}
+
+
+$multi = array(
+ array(array(1,2), array(3,4)),
+ array(array(5,6), array(7,8)),
+);
+
+foreach ($multi as list(list($a, $b), list($c, $d))) {
+ var_dump($a . $b . $c . $d);
+}
+
+foreach ($multi as $key => list(list($a, $b), list($c, $d))) {
+ var_dump($key . $a . $b . $c . $d);
+}
+
+
+?>
+--EXPECT--
+string(2) "12"
+string(2) "34"
+string(2) "ab"
+string(2) "cd"
+string(4) "1234"
+string(4) "5678"
+string(5) "01234"
+string(5) "15678"
diff --git a/Zend/tests/foreach_list_002.phpt b/Zend/tests/foreach_list_002.phpt
new file mode 100644
index 0000000000..251870ba09
--- /dev/null
+++ b/Zend/tests/foreach_list_002.phpt
@@ -0,0 +1,26 @@
+--TEST--
+foreach with freak lists
+--FILE--
+<?php
+
+foreach (array(array(1,2), array(3,4)) as list($a, )) {
+ var_dump($a);
+}
+
+$array = [['a', 'b'], 'c', 'd'];
+
+foreach($array as list(list(), $a)) {
+ var_dump($a);
+}
+
+?>
+--EXPECTF--
+int(1)
+int(3)
+string(1) "b"
+
+Notice: Uninitialized string offset: 1 in %sforeach_list_002.php on line %d
+string(0) ""
+
+Notice: Uninitialized string offset: 1 in %sforeach_list_002.php on line %d
+string(0) ""
diff --git a/Zend/tests/foreach_list_003.phpt b/Zend/tests/foreach_list_003.phpt
new file mode 100644
index 0000000000..8674ecd754
--- /dev/null
+++ b/Zend/tests/foreach_list_003.phpt
@@ -0,0 +1,13 @@
+--TEST--
+foreach with list key
+--FILE--
+<?php
+
+$array = [['a', 'b'], 'c', 'd'];
+
+foreach($array as list($key) => list(list(), $a)) {
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use list as key element in %sforeach_list_003.php on line %d
diff --git a/Zend/tests/foreach_list_004.phpt b/Zend/tests/foreach_list_004.phpt
new file mode 100644
index 0000000000..fd48e8a1f3
--- /dev/null
+++ b/Zend/tests/foreach_list_004.phpt
@@ -0,0 +1,13 @@
+--TEST--
+foreach with empty list
+--FILE--
+<?php
+
+$array = [['a', 'b'], 'c', 'd'];
+
+foreach($array as $key => list()) {
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use empty list in %sforeach_list_004.php on line %d
diff --git a/Zend/tests/foreach_temp_array_expr_with_refs.phpt b/Zend/tests/foreach_temp_array_expr_with_refs.phpt
new file mode 100644
index 0000000000..8978b7b011
--- /dev/null
+++ b/Zend/tests/foreach_temp_array_expr_with_refs.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Temporary array expressions can be iterated by reference
+--FILE--
+<?php
+
+$a = 'a';
+$b = 'b';
+
+foreach ([&$a, &$b] as &$value) {
+ $value .= '-foo';
+}
+
+var_dump($a, $b);
+
+?>
+--EXPECT--
+string(5) "a-foo"
+string(5) "b-foo"
diff --git a/Zend/tests/generators/auto_incrementing_keys.phpt b/Zend/tests/generators/auto_incrementing_keys.phpt
new file mode 100644
index 0000000000..acfb2f2ce0
--- /dev/null
+++ b/Zend/tests/generators/auto_incrementing_keys.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Generator keys are auto-incrementing by default
+--FILE--
+<?php
+
+function gen() {
+ yield 'foo';
+ yield 'bar';
+ yield 5 => 'rab';
+ yield 'oof';
+}
+
+foreach (gen() as $k => $v) {
+ echo $k, ' => ', $v, "\n";
+}
+
+?>
+--EXPECT--
+0 => foo
+1 => bar
+5 => rab
+6 => oof
diff --git a/Zend/tests/generators/backtrace.phpt b/Zend/tests/generators/backtrace.phpt
new file mode 100644
index 0000000000..5fed1d467e
--- /dev/null
+++ b/Zend/tests/generators/backtrace.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Printing the stack trace in a generator
+--FILE--
+<?php
+
+function f1() {
+ debug_print_backtrace();
+}
+
+function f2($arg1, $arg2) {
+ f1();
+ yield; // force generator
+}
+
+function f3($gen) {
+ $gen->rewind(); // trigger run
+}
+
+$gen = f2('foo', 'bar');
+f3($gen);
+
+?>
+--EXPECTF--
+#0 f1() called at [%s:%d]
+#1 f2(foo, bar)
+#2 Generator->rewind() called at [%s:%d]
+#3 f3(Generator Object ()) called at [%s:%d]
diff --git a/Zend/tests/generators/clone.phpt b/Zend/tests/generators/clone.phpt
new file mode 100644
index 0000000000..36811dfe6e
--- /dev/null
+++ b/Zend/tests/generators/clone.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Generators can be cloned
+--FILE--
+<?php
+
+function firstN($end) {
+ for ($i = 0; $i < $end; ++$i) {
+ yield $i;
+ }
+}
+
+$g1 = firstN(5);
+var_dump($g1->current());
+$g1->next();
+
+$g2 = clone $g1;
+var_dump($g2->current());
+$g2->next();
+
+var_dump($g2->current());
+var_dump($g1->current());
+
+$g1->next();
+var_dump($g1->current());
+
+?>
+--EXPECT--
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
diff --git a/Zend/tests/generators/clone_with_foreach.phpt b/Zend/tests/generators/clone_with_foreach.phpt
new file mode 100644
index 0000000000..b05ed07312
--- /dev/null
+++ b/Zend/tests/generators/clone_with_foreach.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Cloning a generator with a foreach loop properly adds a ref for the loop var
+--FILE--
+<?php
+
+function gen() {
+ foreach ([1, 2, 3] as $i) {
+ yield $i;
+ }
+}
+
+$g1 = gen();
+var_dump($g1->current());
+
+$g2 = clone $g1;
+var_dump($g2->current());
+
+$g1->next();
+$g2->next();
+var_dump($g1->current());
+var_dump($g2->current());
+
+unset($g1);
+$g2->next();
+var_dump($g2->current());
+
+?>
+--EXPECT--
+int(1)
+int(1)
+int(2)
+int(2)
+int(3)
diff --git a/Zend/tests/generators/clone_with_stack.phpt b/Zend/tests/generators/clone_with_stack.phpt
new file mode 100644
index 0000000000..5a8e6d842c
--- /dev/null
+++ b/Zend/tests/generators/clone_with_stack.phpt
@@ -0,0 +1,18 @@
+--TEST--
+A generator with an active stack can be cloned
+--FILE--
+<?php
+
+function gen() {
+ var_dump(str_repeat("x", yield));
+}
+
+$g1 = gen();
+$g1->rewind();
+$g2 = clone $g1;
+unset($g1);
+$g2->send(10);
+
+?>
+--EXPECT--
+string(10) "xxxxxxxxxx"
diff --git a/Zend/tests/generators/clone_with_symbol_table.phpt b/Zend/tests/generators/clone_with_symbol_table.phpt
new file mode 100644
index 0000000000..e1fefebd8f
--- /dev/null
+++ b/Zend/tests/generators/clone_with_symbol_table.phpt
@@ -0,0 +1,27 @@
+--TEST--
+A generator using a symbol table can be cloned
+--FILE--
+<?php
+
+function gen() {
+ // force compiled variable for $foo
+ $foo = 'foo';
+
+ // force symbol table
+ extract(['foo' => 'bar']);
+
+ // interrupt
+ yield;
+
+ var_dump($foo);
+}
+
+$g1 = gen();
+$g1->rewind();
+$g2 = clone $g1;
+unset($g1);
+$g2->next();
+
+?>
+--EXPECT--
+string(3) "bar"
diff --git a/Zend/tests/generators/clone_with_this.phpt b/Zend/tests/generators/clone_with_this.phpt
new file mode 100644
index 0000000000..b242d851eb
--- /dev/null
+++ b/Zend/tests/generators/clone_with_this.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Cloning a generator method (with $this)
+--FILE--
+<?php
+
+class Test {
+ protected $foo;
+
+ public function gen() {
+ $this->foo = 'bar';
+ yield; // interrupt
+ var_dump($this->foo);
+ }
+}
+
+$g1 = (new Test)->gen();
+$g1->rewind(); // goto yield
+$g2 = clone $g1;
+unset($g1);
+$g2->next();
+
+?>
+--EXPECT--
+string(3) "bar"
diff --git a/Zend/tests/generators/dynamic_call.phpt b/Zend/tests/generators/dynamic_call.phpt
new file mode 100644
index 0000000000..d564540952
--- /dev/null
+++ b/Zend/tests/generators/dynamic_call.phpt
@@ -0,0 +1,19 @@
+--TEST--
+It's possible to invoke a generator dynamically
+--FILE--
+<?php
+
+function gen($foo, $bar) {
+ yield $foo;
+ yield $bar;
+}
+
+$gen = call_user_func('gen', 'bar', 'foo');
+foreach ($gen as $value) {
+ var_dump($value);
+}
+
+?>
+--EXPECT--
+string(3) "bar"
+string(3) "foo"
diff --git a/Zend/tests/generators/errors/generator_cannot_return_before_yield_error.phpt b/Zend/tests/generators/errors/generator_cannot_return_before_yield_error.phpt
new file mode 100644
index 0000000000..ad618d20ba
--- /dev/null
+++ b/Zend/tests/generators/errors/generator_cannot_return_before_yield_error.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Generators cannot return values (even before yield)
+--FILE--
+<?php
+
+function gen() {
+ return $foo;
+ yield;
+}
+
+?>
+--EXPECTF--
+Fatal error: Generators cannot return values using "return" in %s on line 4
diff --git a/Zend/tests/generators/errors/generator_cannot_return_error.phpt b/Zend/tests/generators/errors/generator_cannot_return_error.phpt
new file mode 100644
index 0000000000..51149062a7
--- /dev/null
+++ b/Zend/tests/generators/errors/generator_cannot_return_error.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Generators cannot return values
+--FILE--
+<?php
+
+function gen() {
+ yield;
+ return $abc;
+}
+
+?>
+--EXPECTF--
+Fatal error: Generators cannot return values using "return" in %s on line 5
diff --git a/Zend/tests/generators/errors/generator_extend_error.phpt b/Zend/tests/generators/errors/generator_extend_error.phpt
new file mode 100644
index 0000000000..550f16ae03
--- /dev/null
+++ b/Zend/tests/generators/errors/generator_extend_error.phpt
@@ -0,0 +1,10 @@
+--TEST--
+The Generator class cannot be extended
+--FILE--
+<?php
+
+class ExtendedGenerator extends Generator { }
+
+?>
+--EXPECTF--
+Fatal error: Class ExtendedGenerator may not inherit from final class (Generator) in %s on line %d
diff --git a/Zend/tests/generators/errors/generator_instantiate_error.phpt b/Zend/tests/generators/errors/generator_instantiate_error.phpt
new file mode 100644
index 0000000000..f8941c087a
--- /dev/null
+++ b/Zend/tests/generators/errors/generator_instantiate_error.phpt
@@ -0,0 +1,10 @@
+--TEST--
+It's not possible to directly instantiate the Generator class
+--FILE--
+<?php
+
+new Generator;
+
+?>
+--EXPECTF--
+Catchable fatal error: The "Generator" class is reserved for internal use and cannot be manually instantiated in %s on line %d
diff --git a/Zend/tests/generators/errors/non_ref_generator_iterated_by_ref_error.phpt b/Zend/tests/generators/errors/non_ref_generator_iterated_by_ref_error.phpt
new file mode 100644
index 0000000000..de5b22f6ba
--- /dev/null
+++ b/Zend/tests/generators/errors/non_ref_generator_iterated_by_ref_error.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Non-ref generators cannot be iterated by-ref
+--FILE--
+<?php
+
+function gen() { yield; }
+
+$gen = gen();
+foreach ($gen as &$value) { }
+
+?>
+--EXPECTF--
+Fatal error: Uncaught exception 'Exception' with message 'You can only iterate a generator by-reference if it declared that it yields by-reference' in %s:%d
+Stack trace:
+#0 %s(%d): unknown()
+#1 {main}
+ thrown in %s on line %d
+
diff --git a/Zend/tests/generators/errors/resume_running_generator_error.phpt b/Zend/tests/generators/errors/resume_running_generator_error.phpt
new file mode 100644
index 0000000000..567d72f3f9
--- /dev/null
+++ b/Zend/tests/generators/errors/resume_running_generator_error.phpt
@@ -0,0 +1,17 @@
+--TEST--
+It is not possible to resume an already running generator
+--FILE--
+<?php
+
+function gen() {
+ $gen = yield;
+ $gen->next();
+}
+
+$gen = gen();
+$gen->send($gen);
+$gen->next();
+
+?>
+--EXPECTF--
+Fatal error: Cannot resume an already running generator in %s on line %d
diff --git a/Zend/tests/generators/errors/serialize_unserialize_error.phpt b/Zend/tests/generators/errors/serialize_unserialize_error.phpt
new file mode 100644
index 0000000000..a8470b0a63
--- /dev/null
+++ b/Zend/tests/generators/errors/serialize_unserialize_error.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Generators can't be serialized or unserialized
+--FILE--
+<?php
+
+function gen() { yield; }
+
+$gen = gen();
+
+try {
+ serialize($gen);
+} catch (Exception $e) {
+ echo $e, "\n\n";
+}
+
+try {
+ var_dump(unserialize('O:9:"Generator":0:{}'));
+} catch (Exception $e) {
+ echo $e, "\n\n";
+}
+
+try {
+ var_dump(unserialize('C:9:"Generator":0:{}'));
+} catch (Exception $e) {
+ echo $e;
+}
+
+?>
+--EXPECTF--
+exception 'Exception' with message 'Serialization of 'Generator' is not allowed' in %s:%d
+Stack trace:
+#0 %s(%d): serialize(Object(Generator))
+#1 {main}
+
+exception 'Exception' with message 'Unserialization of 'Generator' is not allowed' in %s:%d
+Stack trace:
+#0 [internal function]: Generator->__wakeup()
+#1 %s(%d): unserialize('O:9:"Generator"...')
+#2 {main}
+
+
+Notice: unserialize(): Error at offset 19 of 20 bytes in %s on line %d
+exception 'Exception' with message 'Unserialization of 'Generator' is not allowed' in %s:%d
+Stack trace:
+#0 %s(%d): unserialize('C:9:"Generator"...')
+#1 {main}
diff --git a/Zend/tests/generators/errors/yield_const_by_ref_error.phpt b/Zend/tests/generators/errors/yield_const_by_ref_error.phpt
new file mode 100644
index 0000000000..e79f83e24a
--- /dev/null
+++ b/Zend/tests/generators/errors/yield_const_by_ref_error.phpt
@@ -0,0 +1,16 @@
+--TEST--
+A notice is thrown when yielding a constant value by reference
+--FILE--
+<?php
+
+function &gen() {
+ yield "foo";
+}
+
+$gen = gen();
+var_dump($gen->current());
+
+?>
+--EXPECTF--
+Notice: Only variable references should be yielded by reference in %s on line %d
+string(3) "foo"
diff --git a/Zend/tests/generators/errors/yield_in_force_closed_finally_error.phpt b/Zend/tests/generators/errors/yield_in_force_closed_finally_error.phpt
new file mode 100644
index 0000000000..aada676a68
--- /dev/null
+++ b/Zend/tests/generators/errors/yield_in_force_closed_finally_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+yield cannot be used in a finally block when the generator is force-closed
+--FILE--
+<?php
+
+function gen() {
+ try {
+ echo "before yield\n";
+ yield;
+ echo "after yield\n";
+ } finally {
+ echo "before yield in finally\n";
+ yield;
+ echo "after yield in finally\n";
+ }
+
+ echo "after finally\n";
+}
+
+$gen = gen();
+$gen->rewind();
+unset($gen);
+
+?>
+--EXPECTF--
+before yield
+before yield in finally
+
+Fatal error: Cannot yield from finally in a force-closed generator in %s on line %d
diff --git a/Zend/tests/generators/errors/yield_non_ref_function_call_by_ref_error.phpt b/Zend/tests/generators/errors/yield_non_ref_function_call_by_ref_error.phpt
new file mode 100644
index 0000000000..4b8563331c
--- /dev/null
+++ b/Zend/tests/generators/errors/yield_non_ref_function_call_by_ref_error.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Yielding the result of a non-ref function call throw a notice
+--FILE--
+<?php
+
+function foo() {
+ return "bar";
+}
+
+function &gen() {
+ yield foo();
+}
+
+$gen = gen();
+var_dump($gen->current());
+
+?>
+--EXPECTF--
+Notice: Only variable references should be yielded by reference in %s on line %d
+string(3) "bar"
diff --git a/Zend/tests/generators/errors/yield_outside_function_error.phpt b/Zend/tests/generators/errors/yield_outside_function_error.phpt
new file mode 100644
index 0000000000..f999c1c03b
--- /dev/null
+++ b/Zend/tests/generators/errors/yield_outside_function_error.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Yield cannot be used outside of functions
+--FILE--
+<?php
+
+yield "Test";
+
+?>
+--EXPECTF--
+Fatal error: The "yield" expression can only be used inside a function in %s on line %d
diff --git a/Zend/tests/generators/fibonacci.phpt b/Zend/tests/generators/fibonacci.phpt
new file mode 100644
index 0000000000..35b31352ff
--- /dev/null
+++ b/Zend/tests/generators/fibonacci.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Creating an infinite fibonacci list using a generator
+--FILE--
+<?php
+
+function fib() {
+ list($a, $b) = [1, 1];
+ while (true) {
+ yield $b;
+ list($a, $b) = [$b, $a + $b];
+ }
+}
+
+foreach (fib() as $n) {
+ if ($n > 1000) break;
+
+ var_dump($n);
+}
+
+?>
+--EXPECT--
+int(1)
+int(2)
+int(3)
+int(5)
+int(8)
+int(13)
+int(21)
+int(34)
+int(55)
+int(89)
+int(144)
+int(233)
+int(377)
+int(610)
+int(987)
diff --git a/Zend/tests/generators/finally_ran_on_close.phpt b/Zend/tests/generators/finally_ran_on_close.phpt
new file mode 100644
index 0000000000..44a84fae5c
--- /dev/null
+++ b/Zend/tests/generators/finally_ran_on_close.phpt
@@ -0,0 +1,25 @@
+--TEST--
+finally is run even if a generator is closed mid-execution
+--FILE--
+<?php
+
+function gen() {
+ try {
+ echo "before yield\n";
+ yield;
+ echo "after yield\n";
+ } finally {
+ echo "finally run\n";
+ }
+
+ echo "code after finally\n";
+}
+
+$gen = gen();
+$gen->rewind();
+unset($gen);
+
+?>
+--EXPECT--
+before yield
+finally run
diff --git a/Zend/tests/generators/finally_uninterrupted.phpt b/Zend/tests/generators/finally_uninterrupted.phpt
new file mode 100644
index 0000000000..64c94382aa
--- /dev/null
+++ b/Zend/tests/generators/finally_uninterrupted.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Use of finally in generator without interrupt
+--FILE--
+<?php
+
+function gen() {
+ try {
+ throw new Exception;
+ } finally {
+ echo "finally run\n";
+ }
+
+ yield; // force generator
+}
+
+$gen = gen();
+$gen->rewind(); // force run
+
+?>
+--EXPECTF--
+finally run
+
+Fatal error: Uncaught exception 'Exception' in %s:%d
+Stack trace:
+#0 [internal function]: gen()
+#1 %s(%d): Generator->rewind()
+#2 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/generators/finally_with_return.phpt b/Zend/tests/generators/finally_with_return.phpt
new file mode 100644
index 0000000000..b26a49f32f
--- /dev/null
+++ b/Zend/tests/generators/finally_with_return.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Use of finally in generator with return
+--FILE--
+<?php
+
+function gen() {
+ try {
+ try {
+ echo "before return\n";
+ return;
+ echo "after return\n";
+ } finally {
+ echo "before return in inner finally\n";
+ return;
+ echo "after return in inner finally\n";
+ }
+ } finally {
+ echo "outer finally run\n";
+ }
+
+ echo "code after finally\n";
+
+ yield; // force generator
+}
+
+$gen = gen();
+$gen->rewind(); // force run
+
+?>
+--EXPECTF--
+before return
+before return in inner finally
+outer finally run
diff --git a/Zend/tests/generators/func_get_args.phpt b/Zend/tests/generators/func_get_args.phpt
new file mode 100644
index 0000000000..f8d3fa7c14
--- /dev/null
+++ b/Zend/tests/generators/func_get_args.phpt
@@ -0,0 +1,21 @@
+--TEST--
+func_get_args() can be used inside generator functions
+--FILE--
+<?php
+
+function gen() {
+ var_dump(func_get_args());
+ yield; // trigger generator
+}
+
+$gen = gen("foo", "bar");
+$gen->rewind();
+
+?>
+--EXPECT--
+array(2) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ string(3) "bar"
+}
diff --git a/Zend/tests/generators/generator_closure.phpt b/Zend/tests/generators/generator_closure.phpt
new file mode 100644
index 0000000000..bf80066015
--- /dev/null
+++ b/Zend/tests/generators/generator_closure.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Closures can be generators
+--FILE--
+<?php
+
+$genFactory = function() {
+ yield 1;
+ yield 2;
+ yield 3;
+};
+
+foreach ($genFactory() as $value) {
+ var_dump($value);
+}
+
+?>
+--EXPECT--
+int(1)
+int(2)
+int(3)
diff --git a/Zend/tests/generators/generator_closure_with_this.phpt b/Zend/tests/generators/generator_closure_with_this.phpt
new file mode 100644
index 0000000000..d5a4861e80
--- /dev/null
+++ b/Zend/tests/generators/generator_closure_with_this.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Non-static closures can be generators
+--FILE--
+<?php
+
+class Test {
+ public function getGenFactory() {
+ return function() {
+ yield $this;
+ };
+ }
+}
+
+$genFactory = (new Test)->getGenFactory();
+var_dump($genFactory()->current());
+
+?>
+--EXPECT--
+object(Test)#1 (0) {
+}
diff --git a/Zend/tests/generators/generator_in_multipleiterator.phpt b/Zend/tests/generators/generator_in_multipleiterator.phpt
new file mode 100644
index 0000000000..611dbc9652
--- /dev/null
+++ b/Zend/tests/generators/generator_in_multipleiterator.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Generators work properly in MultipleIterator
+--FILE--
+<?php
+
+function gen1() {
+ yield 'a';
+ yield 'aa';
+}
+
+function gen2() {
+ yield 'b';
+ yield 'bb';
+}
+
+$it = new MultipleIterator;
+$it->attachIterator(gen1());
+$it->attachIterator(gen2());
+
+foreach ($it as $values) {
+ var_dump($values);
+}
+
+?>
+--EXPECT--
+array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+}
+array(2) {
+ [0]=>
+ string(2) "aa"
+ [1]=>
+ string(2) "bb"
+}
diff --git a/Zend/tests/generators/generator_method.phpt b/Zend/tests/generators/generator_method.phpt
new file mode 100644
index 0000000000..b8196c171e
--- /dev/null
+++ b/Zend/tests/generators/generator_method.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Methods can be generators
+--FILE--
+<?php
+
+class Test implements IteratorAggregate {
+ protected $data;
+
+ public function __construct(array $data) {
+ $this->data = $data;
+ }
+
+ public function getIterator() {
+ foreach ($this->data as $value) {
+ yield $value;
+ }
+ }
+}
+
+$test = new Test(['foo', 'bar', 'baz']);
+foreach ($test as $value) {
+ var_dump($value);
+}
+
+?>
+--EXPECT--
+string(3) "foo"
+string(3) "bar"
+string(3) "baz"
diff --git a/Zend/tests/generators/generator_method_by_ref.phpt b/Zend/tests/generators/generator_method_by_ref.phpt
new file mode 100644
index 0000000000..cfe52fe67f
--- /dev/null
+++ b/Zend/tests/generators/generator_method_by_ref.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Generator methods can yield by reference
+--FILE--
+<?php
+
+class Test implements IteratorAggregate {
+ protected $data;
+
+ public function __construct(array $data) {
+ $this->data = $data;
+ }
+
+ public function getData() {
+ return $this->data;
+ }
+
+ public function &getIterator() {
+ foreach ($this->data as $key => &$value) {
+ yield $key => $value;
+ }
+ }
+}
+
+$test = new Test([1, 2, 3, 4, 5]);
+foreach ($test as &$value) {
+ $value *= -1;
+}
+
+var_dump($test->getData());
+
+?>
+--EXPECT--
+array(5) {
+ [0]=>
+ int(-1)
+ [1]=>
+ int(-2)
+ [2]=>
+ int(-3)
+ [3]=>
+ int(-4)
+ [4]=>
+ &int(-5)
+}
diff --git a/Zend/tests/generators/generator_returns_generator.phpt b/Zend/tests/generators/generator_returns_generator.phpt
new file mode 100644
index 0000000000..ad332a3be9
--- /dev/null
+++ b/Zend/tests/generators/generator_returns_generator.phpt
@@ -0,0 +1,18 @@
+--TEST--
+A generator function returns a Generator object
+--FILE--
+<?php
+
+function gen() {
+ // execution is suspended here, so the following never gets run:
+ echo "Foo";
+ // trigger a generator
+ yield;
+}
+
+$generator = gen();
+var_dump($generator instanceof Generator);
+
+?>
+--EXPECT--
+bool(true)
diff --git a/Zend/tests/generators/generator_rewind.phpt b/Zend/tests/generators/generator_rewind.phpt
new file mode 100644
index 0000000000..c4b5bbbdf4
--- /dev/null
+++ b/Zend/tests/generators/generator_rewind.phpt
@@ -0,0 +1,62 @@
+--TEST--
+A generator can only be rewinded before or at the first yield
+--FILE--
+<?php
+
+function gen() {
+ echo "before yield\n";
+ yield;
+ echo "after yield\n";
+ yield;
+}
+
+$gen = gen();
+$gen->rewind();
+$gen->rewind();
+$gen->next();
+
+try {
+ $gen->rewind();
+} catch (Exception $e) {
+ echo "\n", $e, "\n\n";
+}
+
+function &gen2() {
+ $foo = 'bar';
+ yield $foo;
+ yield $foo;
+}
+
+$gen = gen2();
+foreach ($gen as $v) { }
+try {
+ foreach ($gen as $v) { }
+} catch (Exception $e) {
+ echo $e, "\n\n";
+}
+
+function gen3() {
+ echo "in generator\n";
+
+ if (false) yield;
+}
+
+$gen = gen3();
+$gen->rewind();
+
+?>
+--EXPECTF--
+before yield
+after yield
+
+exception 'Exception' with message 'Cannot rewind a generator that was already run' in %s:%d
+Stack trace:
+#0 %s(%d): Generator->rewind()
+#1 {main}
+
+exception 'Exception' with message 'Cannot traverse an already closed generator' in %s:%d
+Stack trace:
+#0 %s(%d): unknown()
+#1 {main}
+
+in generator
diff --git a/Zend/tests/generators/generator_send.phpt b/Zend/tests/generators/generator_send.phpt
new file mode 100644
index 0000000000..074d815389
--- /dev/null
+++ b/Zend/tests/generators/generator_send.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Values can be sent back to the generator
+--FILE--
+<?php
+
+function gen() {
+ var_dump(yield "yield foo");
+ var_dump(yield "yield bar");
+}
+
+$gen = gen();
+var_dump($gen->current());
+$gen->send("send bar");
+var_dump($gen->current());
+$gen->send("send foo");
+
+?>
+--EXPECT--
+string(9) "yield foo"
+string(8) "send bar"
+string(9) "yield bar"
+string(8) "send foo"
diff --git a/Zend/tests/generators/generator_static_method.phpt b/Zend/tests/generators/generator_static_method.phpt
new file mode 100644
index 0000000000..cd9b450a76
--- /dev/null
+++ b/Zend/tests/generators/generator_static_method.phpt
@@ -0,0 +1,29 @@
+--TEST--
+A static method can be a generator
+--FILE--
+<?php
+
+class Test {
+ public static function gen() {
+ var_dump(get_class());
+ var_dump(get_called_class());
+ yield 1;
+ yield 2;
+ yield 3;
+ }
+}
+
+class ExtendedTest extends Test {
+}
+
+foreach (ExtendedTest::gen() as $i) {
+ var_dump($i);
+}
+
+?>
+--EXPECT--
+string(4) "Test"
+string(12) "ExtendedTest"
+int(1)
+int(2)
+int(3)
diff --git a/Zend/tests/generators/generator_throwing_during_function_call.phpt b/Zend/tests/generators/generator_throwing_during_function_call.phpt
new file mode 100644
index 0000000000..bd0d2448b7
--- /dev/null
+++ b/Zend/tests/generators/generator_throwing_during_function_call.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Stack is cleaned up properly when an exception is thrown during a function call
+--FILE--
+<?php
+
+function throwException() {
+ throw new Exception('test');
+}
+
+function gen() {
+ yield 'foo';
+ strlen("foo", "bar", throwException());
+ yield 'bar';
+}
+
+$gen = gen();
+
+var_dump($gen->current());
+
+try {
+ $gen->next();
+} catch (Exception $e) {
+ echo 'Caught exception with message "', $e->getMessage(), '"', "\n";
+}
+
+var_dump($gen->current());
+
+?>
+--EXPECT--
+string(3) "foo"
+Caught exception with message "test"
+NULL
diff --git a/Zend/tests/generators/generator_throwing_exception.phpt b/Zend/tests/generators/generator_throwing_exception.phpt
new file mode 100644
index 0000000000..f537c3fc77
--- /dev/null
+++ b/Zend/tests/generators/generator_throwing_exception.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Generators can throw exceptions
+--FILE--
+<?php
+
+function gen() {
+ yield 'foo';
+ throw new Exception('test');
+ yield 'bar';
+}
+
+$gen = gen();
+
+var_dump($gen->current());
+
+try {
+ $gen->next();
+} catch (Exception $e) {
+ echo 'Caught exception with message "', $e->getMessage(), '"', "\n";
+}
+
+var_dump($gen->current());
+
+?>
+--EXPECT--
+string(3) "foo"
+Caught exception with message "test"
+NULL
diff --git a/Zend/tests/generators/generator_throwing_in_foreach.phpt b/Zend/tests/generators/generator_throwing_in_foreach.phpt
new file mode 100644
index 0000000000..dbf20c2ca1
--- /dev/null
+++ b/Zend/tests/generators/generator_throwing_in_foreach.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Exceptions throwing by generators during foreach iteration are properly handled
+--FILE--
+<?php
+
+function gen() {
+ throw new Exception("foo");
+ yield; // force generator
+}
+
+foreach (gen() as $value) { }
+
+?>
+--EXPECTF--
+Fatal error: Uncaught exception 'Exception' with message 'foo' in %s:%d
+Stack trace:
+#0 %s(%d): gen()
+#1 {main}
+ thrown in %s on line %d
+
diff --git a/Zend/tests/generators/generator_with_keys.phpt b/Zend/tests/generators/generator_with_keys.phpt
new file mode 100644
index 0000000000..efb377679e
--- /dev/null
+++ b/Zend/tests/generators/generator_with_keys.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Generators can also yield keys
+--FILE--
+<?php
+
+function reverse(array $array) {
+ end($array);
+ while (null !== $key = key($array)) {
+ yield $key => current($array);
+ prev($array);
+ }
+}
+
+$array = [
+ 'foo' => 'bar',
+ 'bar' => 'foo',
+];
+
+foreach (reverse($array) as $key => $value) {
+ echo $key, ' => ', $value, "\n";
+}
+
+?>
+--EXPECT--
+bar => foo
+foo => bar
diff --git a/Zend/tests/generators/no_foreach_var_leaks.phpt b/Zend/tests/generators/no_foreach_var_leaks.phpt
new file mode 100644
index 0000000000..62743895eb
--- /dev/null
+++ b/Zend/tests/generators/no_foreach_var_leaks.phpt
@@ -0,0 +1,19 @@
+--TEST--
+foreach() (and other) variables aren't leaked on premature close
+--FILE--
+<?php
+
+function gen(array $array) {
+ foreach ($array as $value) {
+ yield $value;
+ }
+}
+
+$gen = gen(['Foo', 'Bar']);
+var_dump($gen->current());
+
+// generator is closed here, without running SWITCH_FREE
+
+?>
+--EXPECT--
+string(3) "Foo"
diff --git a/Zend/tests/generators/send_after_close.phpt b/Zend/tests/generators/send_after_close.phpt
new file mode 100644
index 0000000000..806baf8cee
--- /dev/null
+++ b/Zend/tests/generators/send_after_close.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Calls to send() after close should do nothing
+--FILE--
+<?php
+
+function gen() { var_dump(yield); }
+
+$gen = gen();
+$gen->send('foo');
+$gen->send('bar');
+
+?>
+--EXPECT--
+string(3) "foo"
diff --git a/Zend/tests/generators/send_returns_current.phpt b/Zend/tests/generators/send_returns_current.phpt
new file mode 100644
index 0000000000..27ba74bc1b
--- /dev/null
+++ b/Zend/tests/generators/send_returns_current.phpt
@@ -0,0 +1,20 @@
+--TEST--
+$generator->send() returns the yielded value
+--FILE--
+<?php
+
+function reverseEchoGenerator() {
+ $data = yield;
+ while (true) {
+ $data = (yield strrev($data));
+ }
+}
+
+$gen = reverseEchoGenerator();
+var_dump($gen->send('foo'));
+var_dump($gen->send('bar'));
+
+?>
+--EXPECT--
+string(3) "oof"
+string(3) "rab"
diff --git a/Zend/tests/generators/unused_return_value.phpt b/Zend/tests/generators/unused_return_value.phpt
new file mode 100644
index 0000000000..ddce64542c
--- /dev/null
+++ b/Zend/tests/generators/unused_return_value.phpt
@@ -0,0 +1,13 @@
+--TEST--
+There shouldn't be any leaks when the genertor's return value isn't used
+--FILE--
+<?php
+
+function gen($foo) { yield; }
+
+gen('foo'); // return value not used
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/generators/xrange.phpt b/Zend/tests/generators/xrange.phpt
new file mode 100644
index 0000000000..4d8b60fa90
--- /dev/null
+++ b/Zend/tests/generators/xrange.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Simple generator xrange() test
+--FILE--
+<?php
+
+function xrange($start, $end, $step = 1) {
+ for ($i = $start; $i <= $end; $i += $step) {
+ yield $i;
+ }
+}
+
+foreach (xrange(10, 20, 2) as $i) {
+ var_dump($i);
+}
+
+?>
+--EXPECT--
+int(10)
+int(12)
+int(14)
+int(16)
+int(18)
+int(20)
diff --git a/Zend/tests/generators/yield_array_key.phpt b/Zend/tests/generators/yield_array_key.phpt
new file mode 100644
index 0000000000..5afba00de8
--- /dev/null
+++ b/Zend/tests/generators/yield_array_key.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Array keys can be yielded from generators
+--FILE--
+<?php
+
+function gen() {
+ yield [] => 1;
+}
+
+$gen = gen();
+var_dump($gen->key());
+var_dump($gen->current());
+
+?>
+--EXPECT--
+array(0) {
+}
+int(1)
diff --git a/Zend/tests/generators/yield_array_offset_by_ref.phpt b/Zend/tests/generators/yield_array_offset_by_ref.phpt
new file mode 100644
index 0000000000..544108e64d
--- /dev/null
+++ b/Zend/tests/generators/yield_array_offset_by_ref.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Array offsets can be yielded by reference
+--FILE--
+<?php
+
+function &gen(array &$array) {
+ yield $array[0];
+}
+
+$array = [1, 2, 3];
+$gen = gen($array);
+foreach ($gen as &$val) {
+ $val *= -1;
+}
+var_dump($array);
+
+?>
+--EXPECT--
+array(3) {
+ [0]=>
+ &int(-1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
diff --git a/Zend/tests/generators/yield_by_reference.phpt b/Zend/tests/generators/yield_by_reference.phpt
new file mode 100644
index 0000000000..dba0791c0d
--- /dev/null
+++ b/Zend/tests/generators/yield_by_reference.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Generators can yield by-reference
+--FILE--
+<?php
+
+function &iter(array &$array) {
+ foreach ($array as $key => &$value) {
+ yield $key => $value;
+ }
+}
+
+$array = [1, 2, 3];
+$iter = iter($array);
+foreach ($iter as &$value) {
+ $value *= -1;
+}
+var_dump($array);
+
+$array = [1, 2, 3];
+foreach (iter($array) as &$value) {
+ $value *= -1;
+}
+var_dump($array);
+
+?>
+--EXPECT--
+array(3) {
+ [0]=>
+ int(-1)
+ [1]=>
+ int(-2)
+ [2]=>
+ &int(-3)
+}
+array(3) {
+ [0]=>
+ int(-1)
+ [1]=>
+ int(-2)
+ [2]=>
+ &int(-3)
+}
diff --git a/Zend/tests/generators/yield_during_function_call.phpt b/Zend/tests/generators/yield_during_function_call.phpt
new file mode 100644
index 0000000000..21071f9fb4
--- /dev/null
+++ b/Zend/tests/generators/yield_during_function_call.phpt
@@ -0,0 +1,15 @@
+--TEST--
+"yield" can occur during a function call
+--FILE--
+<?php
+
+function gen() {
+ var_dump(str_repeat("x", yield));
+}
+
+$gen = gen();
+$gen->send(10);
+
+?>
+--EXPECT--
+string(10) "xxxxxxxxxx"
diff --git a/Zend/tests/generators/yield_during_method_call.phpt b/Zend/tests/generators/yield_during_method_call.phpt
new file mode 100644
index 0000000000..5fbe84fff5
--- /dev/null
+++ b/Zend/tests/generators/yield_during_method_call.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Yield can be used during a method call
+--FILE--
+<?php
+
+class A {
+ public function b($c) {
+ echo $c, "\n";
+ }
+}
+
+function gen() {
+ $a = new A;
+ $a->b(yield);
+}
+
+$gen = gen();
+$gen->send('foo');
+
+// test resource cleanup
+$gen = gen();
+$gen->rewind();
+unset($gen);
+
+// test cloning
+$g1 = gen();
+$g1->rewind();
+$g2 = clone $g1;
+unset($g1);
+$g2->send('bar');
+
+?>
+--EXPECT--
+foo
+bar
diff --git a/Zend/tests/generators/yield_in_finally.phpt b/Zend/tests/generators/yield_in_finally.phpt
new file mode 100644
index 0000000000..805484ad1d
--- /dev/null
+++ b/Zend/tests/generators/yield_in_finally.phpt
@@ -0,0 +1,29 @@
+--TEST--
+yield can be used in finally (apart from forced closes)
+--FILE--
+<?php
+
+function gen() {
+ try {
+ echo "before return\n";
+ return;
+ echo "after return\n";
+ } finally {
+ echo "before yield\n";
+ yield "yielded value";
+ echo "after yield\n";
+ }
+
+ echo "after finally\n";
+}
+
+$gen = gen();
+var_dump($gen->current());
+$gen->next();
+
+?>
+--EXPECTF--
+before return
+before yield
+string(%d) "yielded value"
+after yield
diff --git a/Zend/tests/generators/yield_in_parenthesis.phpt b/Zend/tests/generators/yield_in_parenthesis.phpt
new file mode 100644
index 0000000000..4a603f4cc1
--- /dev/null
+++ b/Zend/tests/generators/yield_in_parenthesis.phpt
@@ -0,0 +1,23 @@
+--TEST--
+No additional parenthesis are required around yield if they are already present
+--FILE--
+<?php
+
+function gen() {
+ if (yield $foo); elseif (yield $foo);
+ if (yield $foo): elseif (yield $foo): endif;
+ while (yield $foo);
+ do {} while (yield $foo);
+ switch (yield $foo) {}
+ (yield $foo);
+ die(yield $foo);
+ func(yield $foo);
+ $foo->func(yield $foo);
+ new Foo(yield $foo);
+}
+
+echo "Done";
+
+?>
+--EXPECT--
+Done
diff --git a/Zend/tests/generators/yield_ref_function_call_by_reference.phpt b/Zend/tests/generators/yield_ref_function_call_by_reference.phpt
new file mode 100644
index 0000000000..e371affd92
--- /dev/null
+++ b/Zend/tests/generators/yield_ref_function_call_by_reference.phpt
@@ -0,0 +1,24 @@
+--TEST--
+The result of a by-ref function call can be yielded just fine
+--FILE--
+<?php
+
+function &nop(&$var) {
+ return $var;
+}
+
+function &gen(&$var) {
+ yield nop($var);
+}
+
+$var = "foo";
+$gen = gen($var);
+foreach ($gen as &$varRef) {
+ $varRef = "bar";
+}
+
+var_dump($var);
+
+?>
+--EXPECT--
+string(3) "bar"
diff --git a/Zend/tests/generators/yield_without_value.phpt b/Zend/tests/generators/yield_without_value.phpt
new file mode 100644
index 0000000000..510c755bd3
--- /dev/null
+++ b/Zend/tests/generators/yield_without_value.phpt
@@ -0,0 +1,27 @@
+--TEST--
+yield can be used without a value
+--FILE--
+<?php
+
+function recv() {
+ while (true) {
+ var_dump(yield);
+ }
+}
+
+$reciever = recv();
+var_dump($reciever->current());
+$reciever->send(1);
+var_dump($reciever->current());
+$reciever->send(2);
+var_dump($reciever->current());
+$reciever->send(3);
+
+?>
+--EXPECT--
+NULL
+int(1)
+NULL
+int(2)
+NULL
+int(3)
diff --git a/Zend/tests/try_catch_finally_001.phpt b/Zend/tests/try_catch_finally_001.phpt
new file mode 100644
index 0000000000..3d478f461a
--- /dev/null
+++ b/Zend/tests/try_catch_finally_001.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Try catch finally
+--FILE--
+<?php
+
+class AE extends Exception {};
+class BE extends Exception {};
+
+function foo () {
+ try {
+ try {
+ try {
+ throw new Exception("try");
+ } catch (AE $e) {
+ echo "0";
+ die("error");
+ } finally {
+ echo "1";
+ }
+ } finally {
+ echo "2";
+ }
+ } catch (BE $e) {
+ die("error");
+ } catch (Exception $e) {
+ echo "3";
+ } finally {
+ echo "4";
+ }
+ return 1;
+}
+
+var_dump(foo());
+?>
+--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 0000000000..79efcb3de8
--- /dev/null
+++ b/Zend/tests/try_catch_finally_002.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Try catch finally catch(multi catch blocks)
+--FILE--
+<?php
+
+class AE extends Exception {};
+class BE extends Exception {};
+
+function foo () {
+ try {
+ try {
+ try {
+ try {
+ echo "1";
+ throw new Exception("try");
+ } catch (AE $e) {
+ die("error");
+ } finally {
+ echo "2";
+ }
+ } finally {
+ echo "3";
+ }
+ } catch (BE $e) {
+ die("error");
+ } finally {
+ echo "4";
+ }
+ } catch (Exception $e) {
+ echo "5";
+ } catch (AE $e) {
+ die("error");
+ } finally {
+ echo "6";
+ }
+ return 7;
+}
+
+var_dump(foo());
+?>
+--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 0000000000..784063b749
--- /dev/null
+++ b/Zend/tests/try_catch_finally_003.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Try catch finally (multi catch blocks with return)
+--FILE--
+<?php
+
+class AE extends Exception {};
+class BE extends Exception {};
+
+function foo () {
+ try {
+ try {
+ try {
+ throw new Exception("try");
+ } catch (AE $e) {
+ die("error");
+ } finally {
+ echo "1";
+ return 1;
+ }
+ } finally {
+ echo "2";
+ return 2;
+ }
+ } catch (BE $e) {
+ die("error");
+ } catch (Exception $e) {
+ echo "3";
+ } finally {
+ echo "4";
+ return 4;
+ }
+ return 5;
+}
+
+var_dump(foo());
+?>
+--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 0000000000..eb8d0966a1
--- /dev/null
+++ b/Zend/tests/try_catch_finally_004.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Try catch finally (re-throw exception in catch block)
+--CREDITS--
+adoy
+--FILE--
+<?php
+function dummy($msg) {
+ var_dump($msg);
+}
+try {
+ try {
+ var_dump("try");
+ return;
+ } catch (Exception $e) {
+ dummy("catch");
+ throw $e;
+ } finally {
+ dummy("finally");
+ }
+} catch (Exception $e) {
+ dummy("catch2");
+} finally {
+ dummy("finally2");
+}
+var_dump("end");
+?>
+--EXPECTF--
+string(3) "try"
+string(7) "finally"
+string(8) "finally2"
diff --git a/Zend/tests/try_catch_finally_005.phpt b/Zend/tests/try_catch_finally_005.phpt
new file mode 100644
index 0000000000..dafeb6bbe0
--- /dev/null
+++ b/Zend/tests/try_catch_finally_005.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Try catch finally (break / cont in try block)
+--CREDITS--
+adoy
+--FILE--
+<?php
+for ($i = 0; $i < 100 ; $i ++) {
+ try {
+ break;
+ } finally {
+ var_dump("break");
+ }
+}
+
+
+for ($i = 0; $i < 2; $i ++) {
+ try {
+ continue;
+ } finally {
+ var_dump("continue1");
+ }
+}
+
+for ($i = 0; $i < 3; $i ++) {
+ try {
+ try {
+ continue;
+ } finally {
+ var_dump("continue2");
+ if ($i == 1) {
+ throw new Exception("continue exception");
+ }
+ }
+ } catch (Exception $e) {
+ var_dump("cactched");
+ } finally {
+ var_dump("finally");
+ }
+}
+
+?>
+--EXPECTF--
+string(5) "break"
+string(9) "continue1"
+string(9) "continue1"
+string(9) "continue2"
+string(7) "finally"
+string(9) "continue2"
+string(8) "cactched"
+string(7) "finally"
+string(9) "continue2"
+string(7) "finally"
diff --git a/Zend/tests/try_catch_finally_006.phpt b/Zend/tests/try_catch_finally_006.phpt
new file mode 100644
index 0000000000..dab6af6a58
--- /dev/null
+++ b/Zend/tests/try_catch_finally_006.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Try catch finally (goto in try/catch block)
+--CREDITS--
+adoy
+--FILE--
+<?php
+function foo($ex = NULL) {
+ try {
+ try {
+ goto label;
+ } finally {
+ var_dump("finally1");
+ if ($ex) throw $ex;
+ }
+ } catch (Exception $e) {
+ var_dump("catched");
+ if ($ex) return "return1";
+ } finally {
+ var_dump("finally2");
+ }
+
+label:
+ var_dump("label");
+ return "return2";
+}
+
+var_dump(foo());
+var_dump(foo(new Exception()));
+
+?>
+--EXPECTF--
+string(8) "finally1"
+string(8) "finally2"
+string(5) "label"
+string(7) "return2"
+string(8) "finally1"
+string(7) "catched"
+string(8) "finally2"
+string(7) "return1"
diff --git a/Zend/tests/try_catch_finally_007.phpt b/Zend/tests/try_catch_finally_007.phpt
new file mode 100644
index 0000000000..ad33c68131
--- /dev/null
+++ b/Zend/tests/try_catch_finally_007.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Try catch finally (goto in try/catch block)
+--CREDITS--
+adoy
+--FILE--
+<?php
+function foo($ret = FALSE) {
+ try {
+ try {
+ do {
+ goto label;
+ } while(0);
+ foreach (array() as $val) {
+ continue;
+ }
+ } finally {
+ var_dump("finally1");
+ throw new Exception("exception");
+ }
+ } catch (Exception $e) {
+ goto local;
+local:
+ var_dump("catched");
+ if ($ret) return "return";
+ } finally {
+ var_dump("finally2");
+ }
+
+label:
+ var_dump("label");
+}
+
+var_dump(foo());
+var_dump(foo(true));
+
+?>
+--EXPECTF--
+string(8) "finally1"
+string(7) "catched"
+string(8) "finally2"
+string(5) "label"
+NULL
+string(8) "finally1"
+string(7) "catched"
+string(8) "finally2"
+string(6) "return"
diff --git a/Zend/tests/try_finally_001.phpt b/Zend/tests/try_finally_001.phpt
new file mode 100644
index 0000000000..0f740872c2
--- /dev/null
+++ b/Zend/tests/try_finally_001.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Try finally (basic test)
+--FILE--
+<?php
+function foo ($a) {
+ try {
+ throw new Exception("ex");
+ } finally {
+ var_dump($a);
+ }
+}
+
+foo("finally");
+?>
+--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 0000000000..99a34f62fb
--- /dev/null
+++ b/Zend/tests/try_finally_002.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Try finally (re-throw exception in finally block)
+--FILE--
+<?php
+function foo () {
+ try {
+ throw new Exception("try");
+ } finally {
+ throw new Exception("finally");
+ }
+}
+
+try {
+ foo();
+} catch (Exception $e) {
+ do {
+ var_dump($e->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 0000000000..c1294911bd
--- /dev/null
+++ b/Zend/tests/try_finally_003.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Try finally (call sequence test)
+--FILE--
+<?php
+function foo () {
+ try {
+ echo "1";
+ try {
+ echo "2";
+ throw new Exception("ex");
+ } finally {
+ echo "3";
+ }
+ } finally {
+ echo "4";
+ }
+}
+
+foo();
+?>
+--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/tests/try_finally_004.phpt b/Zend/tests/try_finally_004.phpt
new file mode 100644
index 0000000000..08930a40c5
--- /dev/null
+++ b/Zend/tests/try_finally_004.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Try finally (without catch/finally block)
+--FILE--
+<?php
+function foo () {
+ try {
+ echo "3";
+ }
+}
+
+foo();
+?>
+--EXPECTF--
+Fatal error: Cannot use try without catch or finally in %stry_finally_004.php on line %d
diff --git a/Zend/tests/try_finally_005.phpt b/Zend/tests/try_finally_005.phpt
new file mode 100644
index 0000000000..8664d6b1bf
--- /dev/null
+++ b/Zend/tests/try_finally_005.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Try finally (with long goto)
+--FILE--
+<?php
+function foo () {
+ try {
+ } finally {
+ goto label;
+ }
+label:
+ return 1;
+}
+
+foo();
+?>
+--EXPECTF--
+Fatal error: jump out of a finally block is disallowed in %stry_finally_005.php on line %d
diff --git a/Zend/tests/try_finally_006.phpt b/Zend/tests/try_finally_006.phpt
new file mode 100644
index 0000000000..f53e6b5bc1
--- /dev/null
+++ b/Zend/tests/try_finally_006.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Try finally (with near goto)
+--FILE--
+<?php
+function foo () {
+ $jmp = 1;
+ try {
+ } finally {
+previous:
+ if ($jmp) {
+ goto label;
+ echo "dummy";
+label:
+ echo "label\n";
+ $jmp = 0;
+ goto previous;
+ }
+ echo "okey";
+ }
+}
+
+foo();
+?>
+--EXPECTF--
+label
+okey
diff --git a/Zend/tests/try_finally_007.phpt b/Zend/tests/try_finally_007.phpt
new file mode 100644
index 0000000000..634937495c
--- /dev/null
+++ b/Zend/tests/try_finally_007.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Try finally (with goto previous label)
+--FILE--
+<?php
+function foo () {
+ try {
+label:
+ echo "label";
+ try {
+ } finally {
+ goto label;
+ echo "dummy";
+ }
+ } catch (Exception $e) {
+ } finally {
+ }
+}
+
+foo();
+?>
+--EXPECTF--
+Fatal error: jump out of a finally block is disallowed in %stry_finally_007.php on line %d
diff --git a/Zend/tests/try_finally_008.phpt b/Zend/tests/try_finally_008.phpt
new file mode 100644
index 0000000000..cee37aedab
--- /dev/null
+++ b/Zend/tests/try_finally_008.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Try finally (with break in do...while)
+--FILE--
+<?php
+function foo () {
+ do {
+ try {
+ try {
+ } finally {
+ break;
+ }
+ } catch (Exception $e) {
+ } finally {
+ }
+ } while (0);
+}
+
+foo();
+?>
+--EXPECTF--
+Fatal error: jump out of a finally block is disallowed in %stry_finally_008.php on line %d
diff --git a/Zend/tests/try_finally_009.phpt b/Zend/tests/try_finally_009.phpt
new file mode 100644
index 0000000000..b29930a75e
--- /dev/null
+++ b/Zend/tests/try_finally_009.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Try finally (with for continue)
+--FILE--
+<?php
+function foo () {
+ for($i = 0; $i < 5; $i++) {
+ do {
+ try {
+ try {
+ } finally {
+ }
+ } catch (Exception $e) {
+ } finally {
+ continue;
+ }
+ } while (0);
+ }
+}
+
+foo();
+?>
+--EXPECTF--
+Fatal error: jump out of a finally block is disallowed in %stry_finally_009.php on line %d
diff --git a/Zend/zend.c b/Zend/zend.c
index 37a1a27c7d..09338e7f83 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 39bf5be512..d2a4ef6957 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -22,7 +22,7 @@
#ifndef ZEND_H
#define ZEND_H
-#define ZEND_VERSION "2.4.0"
+#define ZEND_VERSION "2.5.0-dev"
#define ZEND_ENGINE_2
@@ -276,10 +276,10 @@ static const char long_min_digits[] = "9223372036854775808";
#define MAX_LENGTH_OF_DOUBLE 32
-#undef SUCCESS
-#undef FAILURE
-#define SUCCESS 0
-#define FAILURE -1 /* this MUST stay a negative number, or it may affect functions! */
+typedef enum {
+ SUCCESS = 0,
+ FAILURE = -1, /* this MUST stay a negative number, or it may affect functions! */
+} ZEND_RESULT_CODE;
#include "zend_hash.h"
#include "zend_ts_hash.h"
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 98a33e5445..a231415547 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -2531,6 +2531,9 @@ ZEND_API int zend_disable_function(char *function_name, uint function_name_lengt
}
/* }}} */
+#ifdef ZEND_WIN32
+#pragma optimize("", off)
+#endif
static zend_object_value display_disabled_class(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
zend_object_value retval;
@@ -2539,6 +2542,9 @@ static zend_object_value display_disabled_class(zend_class_entry *class_type TSR
zend_error(E_WARNING, "%s() has been disabled for security reasons", class_type->name);
return retval;
}
+#ifdef ZEND_WIN32
+#pragma optimize("", on)
+#endif
/* }}} */
static const zend_function_entry disabled_class_new[] = {
@@ -2547,16 +2553,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 +2635,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;
@@ -2653,11 +2657,9 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
/* Skip leading \ */
if (Z_STRVAL_P(callable)[0] == '\\') {
mlen = Z_STRLEN_P(callable) - 1;
- mname = Z_STRVAL_P(callable) + 1;
lmname = zend_str_tolower_dup(Z_STRVAL_P(callable) + 1, mlen);
} else {
mlen = Z_STRLEN_P(callable);
- mname = Z_STRVAL_P(callable);
lmname = zend_str_tolower_dup(Z_STRVAL_P(callable), mlen);
}
/* Check if function with given name exists.
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index f54db7f2e8..d7fbc3c3af 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_closures.c b/Zend/zend_closures.c
index 6f2ded3753..c7527b4ff9 100644
--- a/Zend/zend_closures.c
+++ b/Zend/zend_closures.c
@@ -78,7 +78,7 @@ ZEND_METHOD(Closure, __invoke) /* {{{ */
/* {{{ proto Closure Closure::bind(Closure $old, object $to [, mixed $scope = "static" ] )
Create a closure from another one and bind to another object and scope */
-ZEND_METHOD(Closure, bind) /* {{{ */
+ZEND_METHOD(Closure, bind)
{
zval *newthis, *zclosure, *scope_arg = NULL;
zend_closure *closure;
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index f8b8941e79..8c10a809af 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -1722,7 +1722,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
}
{
- /* Push a seperator to the switch and foreach stacks */
+ /* Push a seperator to the switch stack */
zend_switch_entry switch_entry;
switch_entry.cond.op_type = IS_UNUSED;
@@ -1730,16 +1730,16 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
switch_entry.control_var = 0;
zend_stack_push(&CG(switch_cond_stack), (void *) &switch_entry, sizeof(switch_entry));
+ }
- {
- /* Foreach stack separator */
- zend_op dummy_opline;
+ {
+ /* Push a separator to the foreach stack */
+ zend_op dummy_opline;
- dummy_opline.result_type = IS_UNUSED;
- dummy_opline.op1_type = IS_UNUSED;
+ dummy_opline.result_type = IS_UNUSED;
+ dummy_opline.op1_type = IS_UNUSED;
- zend_stack_push(&CG(foreach_copy_stack), (void *) &dummy_opline, sizeof(zend_op));
- }
+ zend_stack_push(&CG(foreach_copy_stack), (void *) &dummy_opline, sizeof(zend_op));
}
if (CG(doc_comment)) {
@@ -2611,9 +2611,12 @@ void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC) /* {{{ */
{
zend_op *opline;
int start_op_number, end_op_number;
+ zend_bool returns_reference = (CG(active_op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;
+
+ /* The error for use of return inside a generator is thrown in pass_two. */
if (do_end_vparse) {
- if ((CG(active_op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) && !zend_is_function_or_method_call(expr)) {
+ if (returns_reference && !zend_is_function_or_method_call(expr)) {
zend_do_end_variable_parse(expr, BP_VAR_W, 0 TSRMLS_CC);
} else {
zend_do_end_variable_parse(expr, BP_VAR_R, 0 TSRMLS_CC);
@@ -2638,7 +2641,7 @@ void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC) /* {{{ */
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = (CG(active_op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) ? ZEND_RETURN_BY_REF : ZEND_RETURN;
+ opline->opcode = returns_reference ? ZEND_RETURN_BY_REF : ZEND_RETURN;
if (expr) {
SET_NODE(opline->op1, expr);
@@ -2655,12 +2658,58 @@ void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC) /* {{{ */
}
/* }}} */
+void zend_do_yield(znode *result, znode *value, const znode *key, zend_bool is_variable TSRMLS_DC) /* {{{ */
+{
+ zend_op *opline;
+
+ if (!CG(active_op_array)->function_name) {
+ zend_error(E_COMPILE_ERROR, "The \"yield\" expression can only be used inside a function");
+ }
+
+ CG(active_op_array)->fn_flags |= ZEND_ACC_GENERATOR;
+
+ if (is_variable) {
+ if ((CG(active_op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) && !zend_is_function_or_method_call(value)) {
+ zend_do_end_variable_parse(value, BP_VAR_W, 0 TSRMLS_CC);
+ } else {
+ zend_do_end_variable_parse(value, BP_VAR_R, 0 TSRMLS_CC);
+ }
+ }
+
+ opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+
+ opline->opcode = ZEND_YIELD;
+
+ if (value) {
+ SET_NODE(opline->op1, value);
+
+ if (is_variable && zend_is_function_or_method_call(value)) {
+ opline->extended_value = ZEND_RETURNS_FUNCTION;
+ }
+ } else {
+ SET_UNUSED(opline->op1);
+ }
+
+ if (key) {
+ SET_NODE(opline->op2, key);
+ } else {
+ SET_UNUSED(opline->op2);
+ }
+
+ opline->result_type = IS_VAR;
+ opline->result.var = get_temporary_variable(CG(active_op_array));
+ GET_NODE(result, opline->result);
+}
+/* }}} */
+
static int zend_add_try_element(zend_uint try_op TSRMLS_DC) /* {{{ */
{
int try_catch_offset = CG(active_op_array)->last_try_catch++;
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;
+ CG(active_op_array)->try_catch_array[try_catch_offset].finally_end = 0;
return try_catch_offset;
}
/* }}} */
@@ -2677,7 +2726,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);
@@ -2694,7 +2743,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));
}
/* }}} */
@@ -2720,7 +2769,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;
@@ -2748,11 +2801,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);
@@ -2766,7 +2819,35 @@ 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) /* {{{ */
+{
+ 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) {
+ zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].finally_op = finally_token->u.op.opline_num;
+ CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].finally_end = get_next_op_number(CG(active_op_array));
+ CG(active_op_array)->has_finally_block = 1;
+
+ 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;
+ }
}
/* }}} */
@@ -2935,6 +3016,11 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c
return 1;
}
+ /* If both methods are private do not enforce a signature */
+ if ((fe->common.fn_flags & ZEND_ACC_PRIVATE) && (proto->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ return 1;
+ }
+
/* check number of arguments */
if (proto->common.required_num_args < fe->common.required_num_args
|| proto->common.num_args > fe->common.num_args) {
@@ -3801,9 +3887,12 @@ static int zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int
if (prototype) {
do_inheritance_check_on_method(fn, prototype TSRMLS_CC);
}
+
/* one more thing: make sure we properly implement an abstract method */
if (existing_fn && existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
+ prototype = fn->common.prototype;
do_inheritance_check_on_method(fn, existing_fn TSRMLS_CC);
+ fn->common.prototype = prototype;
}
/* delete inherited fn if the function to be added is not abstract */
@@ -3831,9 +3920,9 @@ static int zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int
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 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);
-
+
zend_function_dtor(fn);
} else {
zend_function_dtor(fn);
@@ -4025,9 +4114,9 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /*
/** And, ensure that the referenced method is resolvable, too. */
lcname = zend_str_tolower_dup(cur_method_ref->method_name,
- cur_method_ref->mname_len);
+ cur_method_ref->mname_len);
method_exists = zend_hash_exists(&cur_method_ref->ce->function_table,
- lcname, cur_method_ref->mname_len + 1);
+ lcname, cur_method_ref->mname_len + 1);
efree(lcname);
if (!method_exists) {
@@ -5009,11 +5098,11 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name
opline->op2_type = IS_CONST;
if (doing_inheritance) {
- /* Make sure a trait does not try to extend a class */
- if ((new_class_entry->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
- zend_error(E_COMPILE_ERROR, "A trait (%s) cannot extend a class. Traits can only be composed from other traits with the 'use' keyword. Error", new_class_entry->name);
- }
-
+ /* Make sure a trait does not try to extend a class */
+ if ((new_class_entry->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
+ zend_error(E_COMPILE_ERROR, "A trait (%s) cannot extend a class. Traits can only be composed from other traits with the 'use' keyword. Error", new_class_entry->name);
+ }
+
opline->extended_value = parent_class_name->u.op.var;
opline->opcode = ZEND_DECLARE_INHERITED_CLASS;
} else {
@@ -6246,15 +6335,18 @@ void zend_do_foreach_cont(znode *foreach_token, const znode *open_brackets_token
opline->extended_value |= ZEND_FE_FETCH_WITH_KEY;
}
- if ((key->op_type != IS_UNUSED) && (key->EA & ZEND_PARSED_REFERENCE_VARIABLE)) {
- zend_error(E_COMPILE_ERROR, "Key element cannot be a reference");
+ if ((key->op_type != IS_UNUSED)) {
+ if (key->EA & ZEND_PARSED_REFERENCE_VARIABLE) {
+ zend_error(E_COMPILE_ERROR, "Key element cannot be a reference");
+ }
+ if (key->EA & ZEND_PARSED_LIST_EXPR) {
+ zend_error(E_COMPILE_ERROR, "Cannot use list as key element");
+ }
}
if (value->EA & ZEND_PARSED_REFERENCE_VARIABLE) {
assign_by_ref = 1;
- if (!(opline-1)->extended_value) {
- zend_error(E_COMPILE_ERROR, "Cannot create references to elements of a temporary array expression");
- }
+
/* Mark extended_value for assign-by-reference */
opline->extended_value |= ZEND_FE_FETCH_BYREF;
CG(active_op_array)->opcodes[foreach_token->u.op.opline_num].extended_value |= ZEND_FE_RESET_REFERENCE;
@@ -6283,13 +6375,21 @@ void zend_do_foreach_cont(znode *foreach_token, const znode *open_brackets_token
GET_NODE(&value_node, opline->result);
- if (assign_by_ref) {
- zend_do_end_variable_parse(value, BP_VAR_W, 0 TSRMLS_CC);
- /* Mark FE_FETCH as IS_VAR as it holds the data directly as a value */
- zend_do_assign_ref(NULL, value, &value_node TSRMLS_CC);
- } else {
- zend_do_assign(&dummy, value, &value_node TSRMLS_CC);
+ if (value->EA & ZEND_PARSED_LIST_EXPR) {
+ if (!CG(list_llist).head) {
+ zend_error(E_COMPILE_ERROR, "Cannot use empty list");
+ }
+ zend_do_list_end(&dummy, &value_node TSRMLS_CC);
zend_do_free(&dummy TSRMLS_CC);
+ } else {
+ if (assign_by_ref) {
+ zend_do_end_variable_parse(value, BP_VAR_W, 0 TSRMLS_CC);
+ /* Mark FE_FETCH as IS_VAR as it holds the data directly as a value */
+ zend_do_assign_ref(NULL, value, &value_node TSRMLS_CC);
+ } else {
+ zend_do_assign(&dummy, value, &value_node TSRMLS_CC);
+ zend_do_free(&dummy TSRMLS_CC);
+ }
}
if (key->op_type != IS_UNUSED) {
@@ -6718,9 +6818,6 @@ again:
case T_OPEN_TAG_WITH_ECHO:
retval = T_ECHO;
break;
- case T_END_HEREDOC:
- efree(Z_STRVAL(zendlval->u.constant));
- break;
}
INIT_PZVAL(&zendlval->u.constant);
@@ -6967,9 +7064,9 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{
lcname = zend_str_tolower_dup(Z_STRVAL_P(name), Z_STRLEN_P(name));
if (((Z_STRLEN_P(name) == sizeof("self")-1) &&
- !memcmp(lcname, "self", sizeof("self")-1)) ||
- ((Z_STRLEN_P(name) == sizeof("parent")-1) &&
- !memcmp(lcname, "parent", sizeof("parent")-1))) {
+ !memcmp(lcname, "self", sizeof("self")-1)) ||
+ ((Z_STRLEN_P(name) == sizeof("parent")-1) &&
+ !memcmp(lcname, "parent", sizeof("parent")-1))) {
zend_error(E_COMPILE_ERROR, "Cannot use %s as %s because '%s' is a special class name", Z_STRVAL_P(ns), Z_STRVAL_P(name), Z_STRVAL_P(name));
}
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index f164122785..cc860ebc12 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -80,7 +80,7 @@ typedef union _znode_op {
zend_op *jmp_addr;
zval *zv;
zend_literal *literal;
- void *ptr; /* Used for passing pointers from the compile to execution phase, currently used for traits */
+ void *ptr; /* Used for passing pointers from the compile to execution phase, currently used for traits */
} znode_op;
typedef struct _znode { /* used only during compilation */
@@ -132,6 +132,8 @@ typedef struct _zend_label {
typedef struct _zend_try_catch_element {
zend_uint try_op;
zend_uint catch_op; /* ketchup! */
+ zend_uint finally_op;
+ zend_uint finally_end;
} zend_try_catch_element;
#if SIZEOF_LONG == 8
@@ -194,6 +196,7 @@ typedef struct _zend_try_catch_element {
#define ZEND_ACC_CLOSURE 0x100000
+#define ZEND_ACC_GENERATOR 0x800000
/* function flag for internal user call handlers __call, __callstatic */
#define ZEND_ACC_CALL_VIA_HANDLER 0x200000
@@ -279,6 +282,7 @@ struct _zend_op_array {
zend_try_catch_element *try_catch_array;
int last_try_catch;
+ zend_bool has_finally_block;
/* static variables support */
HashTable *static_variables;
@@ -381,6 +385,8 @@ struct _zend_execute_data {
zend_class_entry *current_called_scope;
zval *current_this;
zval *current_object;
+ zend_uint leaving;
+ zend_uint leaving_dest;
};
#define EX(element) execute_data.element
@@ -489,6 +495,7 @@ void zend_do_build_full_name(znode *result, znode *prefix, znode *name, int is_c
int zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC);
void zend_do_end_function_call(znode *function_name, znode *result, const znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC);
void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC);
+void zend_do_yield(znode *result, znode *value, const znode *key, zend_bool is_variable TSRMLS_DC);
void zend_do_handle_exception(TSRMLS_D);
void zend_do_begin_lambda_function_declaration(znode *result, znode *function_token, int return_reference, int is_static TSRMLS_DC);
@@ -496,7 +503,10 @@ 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_bind_catch(znode *try_token, znode *catch_token TSRMLS_DC);
+void zend_do_end_catch(znode *catch_token TSRMLS_DC);
+void zend_do_finally(znode *finally_token TSRMLS_DC);
+void zend_do_end_finally(znode *try_token, znode* catch_token, znode *finally_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);
@@ -662,7 +672,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);
@@ -718,6 +728,7 @@ int zend_add_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC);
#define ZEND_PARSED_VARIABLE (1<<4)
#define ZEND_PARSED_REFERENCE_VARIABLE (1<<5)
#define ZEND_PARSED_NEW (1<<6)
+#define ZEND_PARSED_LIST_EXPR (1<<7)
/* unset types */
diff --git a/Zend/zend_default_classes.c b/Zend/zend_default_classes.c
index 73a765811e..bcc43ea7db 100644
--- a/Zend/zend_default_classes.c
+++ b/Zend/zend_default_classes.c
@@ -25,6 +25,7 @@
#include "zend_interfaces.h"
#include "zend_exceptions.h"
#include "zend_closures.h"
+#include "zend_generators.h"
ZEND_API void zend_register_default_classes(TSRMLS_D)
@@ -33,6 +34,7 @@ ZEND_API void zend_register_default_classes(TSRMLS_D)
zend_register_default_exception(TSRMLS_C);
zend_register_iterator_wrapper(TSRMLS_C);
zend_register_closure_ce(TSRMLS_C);
+ zend_register_generator_ce(TSRMLS_C);
}
/*
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index 7bb7792a4c..787e66bfe9 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 fbc73258c7..149b91233c 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -35,6 +35,7 @@
#include "zend_exceptions.h"
#include "zend_interfaces.h"
#include "zend_closures.h"
+#include "zend_generators.h"
#include "zend_vm.h"
#include "zend_dtrace.h"
@@ -1536,6 +1537,50 @@ ZEND_API zval **zend_get_zval_ptr_ptr(int op_type, const znode_op *node, const t
return get_zval_ptr_ptr(op_type, node, Ts, should_free, type);
}
+void zend_clean_and_cache_symbol_table(HashTable *symbol_table TSRMLS_DC) /* {{{ */
+{
+ if (EG(symtable_cache_ptr) >= EG(symtable_cache_limit)) {
+ zend_hash_destroy(symbol_table);
+ FREE_HASHTABLE(symbol_table);
+ } else {
+ /* clean before putting into the cache, since clean
+ could call dtors, which could use cached hash */
+ zend_hash_clean(symbol_table);
+ *(++EG(symtable_cache_ptr)) = symbol_table;
+ }
+}
+/* }}} */
+
+void zend_free_compiled_variables(zval ***CVs, int num) /* {{{ */
+{
+ int i;
+ for (i = 0; i < num; ++i) {
+ if (CVs[i]) {
+ zval_ptr_dtor(CVs[i]);
+ }
+ }
+}
+/* }}} */
+
+void** zend_copy_arguments(void **arguments_end) /* {{{ */
+{
+ int arguments_count = (int) (zend_uintptr_t) *arguments_end;
+ size_t arguments_size = (arguments_count + 1) * sizeof(void **);
+ void **arguments_start = arguments_end - arguments_count;
+ void **copied_arguments_start = emalloc(arguments_size);
+ void **copied_arguments_end = copied_arguments_start + arguments_count;
+ int i;
+
+ memcpy(copied_arguments_start, arguments_start, arguments_size);
+
+ for (i = 0; i < arguments_count; i++) {
+ Z_ADDREF_P((zval *) arguments_start[i]);
+ }
+
+ return copied_arguments_end;
+}
+/* }}} */
+
/*
* Local variables:
* tab-width: 4
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index 7d427388bd..4cfc52b6a3 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -55,7 +55,9 @@ ZEND_API extern void (*zend_execute_internal)(zend_execute_data *execute_data_pt
void init_executor(TSRMLS_D);
void shutdown_executor(TSRMLS_D);
void shutdown_destructors(TSRMLS_D);
+zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array *op_array, zend_bool nested TSRMLS_DC);
ZEND_API void execute(zend_op_array *op_array TSRMLS_DC);
+ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC);
ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC);
ZEND_API int zend_is_true(zval *op);
#define safe_free_zval_ptr(p) safe_free_zval_ptr_rel(p ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
@@ -431,6 +433,10 @@ ZEND_API zval **zend_get_zval_ptr_ptr(int op_type, const znode_op *node, const t
ZEND_API int zend_do_fcall(ZEND_OPCODE_HANDLER_ARGS);
+void zend_clean_and_cache_symbol_table(HashTable *symbol_table TSRMLS_DC);
+void zend_free_compiled_variables(zval ***CVs, int num);
+void **zend_copy_arguments(void **arguments_end);
+
#define CACHED_PTR(num) \
EG(active_op_array)->run_time_cache[(num)]
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 1deee2a86c..fb0c18b27c 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -31,6 +31,7 @@
#include "zend_extensions.h"
#include "zend_exceptions.h"
#include "zend_closures.h"
+#include "zend_generators.h"
#include "zend_vm.h"
#include "zend_float.h"
#ifdef HAVE_SYS_TIME_H
@@ -955,7 +956,13 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
EG(return_value_ptr_ptr) = fci->retval_ptr_ptr;
EG(active_op_array) = (zend_op_array *) EX(function_state).function;
original_opline_ptr = EG(opline_ptr);
- zend_execute(EG(active_op_array) TSRMLS_CC);
+
+ if (EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) {
+ *fci->retval_ptr_ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC);
+ } else {
+ zend_execute(EG(active_op_array) TSRMLS_CC);
+ }
+
if (!fci->symbol_table && EG(active_symbol_table)) {
if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) {
zend_hash_destroy(EG(active_symbol_table));
diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c
new file mode 100644
index 0000000000..c22d745bc3
--- /dev/null
+++ b/Zend/zend_generators.c
@@ -0,0 +1,838 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend Engine |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 2.00 of the Zend license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.zend.com/license/2_00.txt. |
+ | If you did not receive a copy of the Zend license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@zend.com so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Nikita Popov <nikic@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#include "zend.h"
+#include "zend_API.h"
+#include "zend_interfaces.h"
+#include "zend_exceptions.h"
+#include "zend_generators.h"
+
+ZEND_API zend_class_entry *zend_ce_generator;
+static zend_object_handlers zend_generator_handlers;
+
+void zend_generator_close(zend_generator *generator, zend_bool finished_execution TSRMLS_DC) /* {{{ */
+{
+ if (generator->execute_data) {
+ zend_execute_data *execute_data = generator->execute_data;
+ zend_op_array *op_array = execute_data->op_array;
+
+ if (!finished_execution) {
+ if (op_array->has_finally_block) {
+ /* -1 required because we want the last run opcode, not the
+ * next to-be-run one. */
+ zend_uint op_num = execute_data->opline - op_array->opcodes - 1;
+ zend_uint finally_op_num = 0;
+
+ /* Find next finally block */
+ int i;
+ for (i = 0; i < op_array->last_try_catch; i++) {
+ zend_try_catch_element *try_catch = &op_array->try_catch_array[i];
+
+ if (op_num < try_catch->try_op) {
+ break;
+ }
+
+ if (op_num < try_catch->finally_op) {
+ finally_op_num = try_catch->finally_op;
+ }
+ }
+
+ /* If a finally block was found we jump directly to it and
+ * resume the generator. Furthermore we abort this close call
+ * because the generator will already be closed somewhere in
+ * the resume. */
+ if (finally_op_num) {
+ execute_data->opline = &op_array->opcodes[finally_op_num];
+ execute_data->leaving = ZEND_RETURN;
+ generator->flags |= ZEND_GENERATOR_FORCED_CLOSE;
+ zend_generator_resume(generator TSRMLS_CC);
+ return;
+ }
+ }
+ }
+
+ if (!execute_data->symbol_table) {
+ zend_free_compiled_variables(execute_data->CVs, op_array->last_var);
+ } else {
+ zend_clean_and_cache_symbol_table(execute_data->symbol_table TSRMLS_CC);
+ }
+
+ if (execute_data->current_this) {
+ zval_ptr_dtor(&execute_data->current_this);
+ }
+
+ if (execute_data->object) {
+ zval_ptr_dtor(&execute_data->object);
+ }
+
+ /* If the generator is closed before it can finish execution (reach
+ * a return statement) we have to free loop variables manually, as
+ * we don't know whether the SWITCH_FREE / FREE opcodes have run */
+ if (!finished_execution) {
+ /* -1 required because we want the last run opcode, not the
+ * next to-be-run one. */
+ zend_uint op_num = execute_data->opline - op_array->opcodes - 1;
+
+ int i;
+ for (i = 0; i < op_array->last_brk_cont; ++i) {
+ zend_brk_cont_element *brk_cont = op_array->brk_cont_array + i;
+
+ if (brk_cont->start < 0) {
+ continue;
+ } else if (brk_cont->start > op_num) {
+ break;
+ } else if (brk_cont->brk > op_num) {
+ zend_op *brk_opline = op_array->opcodes + brk_cont->brk;
+
+ switch (brk_opline->opcode) {
+ case ZEND_SWITCH_FREE:
+ {
+ temp_variable *var = (temp_variable *) ((char *) execute_data->Ts + brk_opline->op1.var);
+ zval_ptr_dtor(&var->var.ptr);
+ }
+ break;
+ case ZEND_FREE:
+ {
+ temp_variable *var = (temp_variable *) ((char *) execute_data->Ts + brk_opline->op1.var);
+ zval_dtor(&var->tmp_var);
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ /* Clear any backed up stack arguments */
+ if (generator->backed_up_stack) {
+ zval **zvals = (zval **) generator->backed_up_stack;
+ size_t zval_num = generator->backed_up_stack_size / sizeof(zval *);
+ int i;
+
+ for (i = 0; i < zval_num; i++) {
+ zval_ptr_dtor(&zvals[i]);
+ }
+
+ efree(generator->backed_up_stack);
+ }
+
+ /* We have added an additional stack frame in prev_execute_data, so we
+ * have to free it. It also contains the arguments passed to the
+ * generator (for func_get_args) so those have to be freed too. */
+ {
+ zend_execute_data *prev_execute_data = execute_data->prev_execute_data;
+ void **arguments = prev_execute_data->function_state.arguments;
+
+ if (arguments) {
+ int arguments_count = (int) (zend_uintptr_t) *arguments;
+ zval **arguments_start = (zval **) (arguments - arguments_count);
+ int i;
+
+ for (i = 0; i < arguments_count; ++i) {
+ zval_ptr_dtor(arguments_start + i);
+ }
+
+ efree(arguments_start);
+ }
+
+ efree(prev_execute_data);
+ }
+
+ efree(execute_data);
+ generator->execute_data = NULL;
+ }
+
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ generator->value = NULL;
+ }
+
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ generator->key = NULL;
+ }
+}
+/* }}} */
+
+static void zend_generator_free_storage(zend_generator *generator TSRMLS_DC) /* {{{ */
+{
+ zend_generator_close(generator, 0 TSRMLS_CC);
+
+ zend_object_std_dtor(&generator->std TSRMLS_CC);
+ efree(generator);
+}
+/* }}} */
+
+static void zend_generator_clone_storage(zend_generator *orig, zend_generator **clone_ptr) /* {{{ */
+{
+ zend_generator *clone = emalloc(sizeof(zend_generator));
+ memcpy(clone, orig, sizeof(zend_generator));
+
+ if (orig->execute_data) {
+ /* Create a few shorter aliases to the old execution data */
+ zend_execute_data *execute_data = orig->execute_data;
+ zend_op_array *op_array = execute_data->op_array;
+ HashTable *symbol_table = execute_data->symbol_table;
+
+ /* Alloc separate execution context, as well as separate sections for
+ * compiled variables and temporary variables */
+ size_t execute_data_size = ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data));
+ size_t CVs_size = ZEND_MM_ALIGNED_SIZE(sizeof(zval **) * op_array->last_var * (symbol_table ? 1 : 2));
+ size_t Ts_size = ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T;
+ size_t total_size = execute_data_size + CVs_size + Ts_size;
+
+ clone->execute_data = emalloc(total_size);
+
+ /* Copy the zend_execute_data struct */
+ memcpy(clone->execute_data, execute_data, execute_data_size);
+
+ /* Set the pointers to the memory segments for the compiled and
+ * temporary variables (which are located after the execute_data) */
+ clone->execute_data->CVs = (zval ***) ((char *) clone->execute_data + execute_data_size);
+ clone->execute_data->Ts = (temp_variable *) ((char *) clone->execute_data->CVs + CVs_size);
+
+ /* Zero out the compiled variables section */
+ memset(clone->execute_data->CVs, 0, sizeof(zval **) * op_array->last_var);
+
+ if (!symbol_table) {
+ int i;
+
+ /* Copy compiled variables */
+ for (i = 0; i < op_array->last_var; i++) {
+ if (execute_data->CVs[i]) {
+ clone->execute_data->CVs[i] = (zval **) clone->execute_data->CVs + op_array->last_var + i;
+ *clone->execute_data->CVs[i] = (zval *) orig->execute_data->CVs[op_array->last_var + i];
+ Z_ADDREF_PP(clone->execute_data->CVs[i]);
+ }
+ }
+ } else {
+ /* Copy symbol table */
+ ALLOC_HASHTABLE(clone->execute_data->symbol_table);
+ zend_hash_init(clone->execute_data->symbol_table, zend_hash_num_elements(symbol_table), NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_copy(clone->execute_data->symbol_table, symbol_table, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
+
+ /* Update zval** pointers for compiled variables */
+ {
+ int i;
+ for (i = 0; i < op_array->last_var; i++) {
+ if (zend_hash_quick_find(clone->execute_data->symbol_table, op_array->vars[i].name, op_array->vars[i].name_len + 1, op_array->vars[i].hash_value, (void **) &clone->execute_data->CVs[i]) == FAILURE) {
+ clone->execute_data->CVs[i] = NULL;
+ }
+ }
+ }
+ }
+
+ /* Copy the temporary variables */
+ memcpy(clone->execute_data->Ts, orig->execute_data->Ts, Ts_size);
+
+ /* Add references to loop variables */
+ {
+ zend_uint op_num = execute_data->opline - op_array->opcodes;
+
+ int i;
+ for (i = 0; i < op_array->last_brk_cont; ++i) {
+ zend_brk_cont_element *brk_cont = op_array->brk_cont_array + i;
+
+ if (brk_cont->start < 0) {
+ continue;
+ } else if (brk_cont->start > op_num) {
+ break;
+ } else if (brk_cont->brk > op_num) {
+ zend_op *brk_opline = op_array->opcodes + brk_cont->brk;
+
+ if (brk_opline->opcode == ZEND_SWITCH_FREE) {
+ temp_variable *var = (temp_variable *) ((char *) execute_data->Ts + brk_opline->op1.var);
+
+ Z_ADDREF_P(var->var.ptr);
+ }
+ }
+ }
+ }
+
+ if (orig->backed_up_stack) {
+ /* Copy backed up stack */
+ clone->backed_up_stack = emalloc(orig->backed_up_stack_size);
+ memcpy(clone->backed_up_stack, orig->backed_up_stack, orig->backed_up_stack_size);
+
+ /* Add refs to stack variables */
+ {
+ zval **zvals = (zval **) orig->backed_up_stack;
+ size_t zval_num = orig->backed_up_stack_size / sizeof(zval *);
+ int i;
+
+ for (i = 0; i < zval_num; i++) {
+ Z_ADDREF_P(zvals[i]);
+ }
+ }
+ }
+
+ /* Update the send_target to use the temporary variable with the same
+ * offset as the original generator, but in our temporary variable
+ * memory segment. */
+ if (orig->send_target) {
+ size_t offset = (char *) orig->send_target - (char *) execute_data->Ts;
+ clone->send_target = (temp_variable *) (
+ (char *) clone->execute_data->Ts + offset
+ );
+ Z_ADDREF_P(clone->send_target->var.ptr);
+ }
+
+ if (execute_data->current_this) {
+ Z_ADDREF_P(execute_data->current_this);
+ }
+
+ if (execute_data->object) {
+ Z_ADDREF_P(execute_data->object);
+ }
+
+ /* Prev execute data contains an additional stack frame (for proper
+ * backtraces) which has to be copied. */
+ clone->execute_data->prev_execute_data = emalloc(sizeof(zend_execute_data));
+ memcpy(clone->execute_data->prev_execute_data, execute_data->prev_execute_data, sizeof(zend_execute_data));
+
+ /* It also contains the arguments passed to the generator, which also
+ * have to be copied */
+ if (execute_data->prev_execute_data->function_state.arguments) {
+ clone->execute_data->prev_execute_data->function_state.arguments
+ = zend_copy_arguments(execute_data->prev_execute_data->function_state.arguments);
+ }
+ }
+
+ /* The value and key are known not to be references, so simply add refs */
+ if (orig->value) {
+ Z_ADDREF_P(orig->value);
+ }
+
+ if (orig->key) {
+ Z_ADDREF_P(orig->key);
+ }
+
+ *clone_ptr = clone;
+}
+/* }}} */
+
+static zend_object_value zend_generator_create(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
+{
+ zend_generator *generator;
+ zend_object_value object;
+
+ generator = emalloc(sizeof(zend_generator));
+ memset(generator, 0, sizeof(zend_generator));
+
+ /* The key will be incremented on first use, so it'll start at 0 */
+ generator->largest_used_integer_key = -1;
+
+ zend_object_std_init(&generator->std, class_type TSRMLS_CC);
+
+ object.handle = zend_objects_store_put(generator, NULL,
+ (zend_objects_free_object_storage_t) zend_generator_free_storage,
+ (zend_objects_store_clone_t) zend_generator_clone_storage
+ TSRMLS_CC
+ );
+ object.handlers = &zend_generator_handlers;
+
+ return object;
+}
+/* }}} */
+
+/* Requires globals EG(scope), EG(current_scope), EG(This),
+ * EG(active_symbol_table) and EG(current_execute_data). */
+zval *zend_generator_create_zval(zend_op_array *op_array TSRMLS_DC) /* {{{ */
+{
+ zval *return_value;
+ zend_generator *generator;
+
+ /* Create new execution context. We have to back up and restore
+ * EG(current_execute_data) and EG(opline_ptr) here because the function
+ * modifies it. */
+ zend_execute_data *current_execute_data = EG(current_execute_data);
+ zend_op **opline_ptr = EG(opline_ptr);
+ zend_execute_data *execute_data = zend_create_execute_data_from_op_array(op_array, 0 TSRMLS_CC);
+ EG(current_execute_data) = current_execute_data;
+ EG(opline_ptr) = opline_ptr;
+
+ ALLOC_INIT_ZVAL(return_value);
+ object_init_ex(return_value, zend_ce_generator);
+
+ if (EG(This)) {
+ Z_ADDREF_P(EG(This));
+ }
+
+ /* Back up executor globals. */
+ execute_data->current_scope = EG(scope);
+ execute_data->current_called_scope = EG(called_scope);
+ execute_data->symbol_table = EG(active_symbol_table);
+ execute_data->current_this = EG(This);
+
+ /* Save execution context in generator object. */
+ generator = (zend_generator *) zend_object_store_get_object(return_value TSRMLS_CC);
+ generator->execute_data = execute_data;
+
+ /* We have to add another stack frame so the generator function shows
+ * up in backtraces and func_get_all() can access the function
+ * arguments. */
+ execute_data->prev_execute_data = emalloc(sizeof(zend_execute_data));
+ memset(execute_data->prev_execute_data, 0, sizeof(zend_execute_data));
+ execute_data->prev_execute_data->function_state.function = (zend_function *) op_array;
+ if (EG(current_execute_data)) {
+ execute_data->prev_execute_data->function_state.arguments = zend_copy_arguments(EG(current_execute_data)->function_state.arguments);
+ } else {
+ execute_data->prev_execute_data->function_state.arguments = NULL;
+ }
+
+ return return_value;
+}
+/* }}} */
+
+static zend_function *zend_generator_get_constructor(zval *object TSRMLS_DC) /* {{{ */
+{
+ zend_error(E_RECOVERABLE_ERROR, "The \"Generator\" class is reserved for internal use and cannot be manually instantiated");
+
+ return NULL;
+}
+/* }}} */
+
+void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{ */
+{
+ /* The generator is already closed, thus can't resume */
+ if (!generator->execute_data) {
+ return;
+ }
+
+ if (generator->flags & ZEND_GENERATOR_CURRENTLY_RUNNING) {
+ zend_error(E_ERROR, "Cannot resume an already running generator");
+ }
+
+ /* Drop the AT_FIRST_YIELD flag */
+ generator->flags &= ~ZEND_GENERATOR_AT_FIRST_YIELD;
+
+ {
+ /* Backup executor globals */
+ zval **original_return_value_ptr_ptr = EG(return_value_ptr_ptr);
+ zend_execute_data *original_execute_data = EG(current_execute_data);
+ zend_op **original_opline_ptr = EG(opline_ptr);
+ zend_op_array *original_active_op_array = EG(active_op_array);
+ HashTable *original_active_symbol_table = EG(active_symbol_table);
+ zval *original_This = EG(This);
+ zend_class_entry *original_scope = EG(scope);
+ zend_class_entry *original_called_scope = EG(called_scope);
+
+ /* Remember the current stack position so we can back up pushed args */
+ generator->original_stack_top = zend_vm_stack_top(TSRMLS_C);
+
+ /* If there is a backed up stack copy it to the VM stack */
+ if (generator->backed_up_stack) {
+ void *stack = zend_vm_stack_alloc(generator->backed_up_stack_size TSRMLS_CC);
+ memcpy(stack, generator->backed_up_stack, generator->backed_up_stack_size);
+ efree(generator->backed_up_stack);
+ generator->backed_up_stack = NULL;
+ }
+
+ /* We (mis)use the return_value_ptr_ptr to provide the generator object
+ * to the executor, so YIELD will be able to set the yielded value */
+ EG(return_value_ptr_ptr) = (zval **) generator;
+
+ /* Set executor globals */
+ EG(current_execute_data) = generator->execute_data;
+ EG(opline_ptr) = &generator->execute_data->opline;
+ EG(active_op_array) = generator->execute_data->op_array;
+ EG(active_symbol_table) = generator->execute_data->symbol_table;
+ EG(This) = generator->execute_data->current_this;
+ EG(scope) = generator->execute_data->current_scope;
+ EG(called_scope) = generator->execute_data->current_called_scope;
+
+ /* We want the backtrace to look as if the generator function was
+ * called from whatever method we are current running (e.g. next()).
+ * The first prev_execute_data contains an additional stack frame,
+ * which makes the generator function show up in the backtrace and
+ * makes the arguments available to func_get_args(). So we have to
+ * set the prev_execute_data of that prev_execute_data :) */
+ generator->execute_data->prev_execute_data->prev_execute_data = original_execute_data;
+
+ /* Resume execution */
+ generator->flags |= ZEND_GENERATOR_CURRENTLY_RUNNING;
+ execute_ex(generator->execute_data TSRMLS_CC);
+ generator->flags &= ~ZEND_GENERATOR_CURRENTLY_RUNNING;
+
+ /* Restore executor globals */
+ EG(return_value_ptr_ptr) = original_return_value_ptr_ptr;
+ EG(current_execute_data) = original_execute_data;
+ EG(opline_ptr) = original_opline_ptr;
+ EG(active_op_array) = original_active_op_array;
+ EG(active_symbol_table) = original_active_symbol_table;
+ EG(This) = original_This;
+ EG(scope) = original_scope;
+ EG(called_scope) = original_called_scope;
+
+ /* The stack top before and after the execution differ, i.e. there are
+ * arguments pushed to the stack. */
+ if (generator->original_stack_top != zend_vm_stack_top(TSRMLS_C)) {
+ generator->backed_up_stack_size = (zend_vm_stack_top(TSRMLS_C) - generator->original_stack_top) * sizeof(void *);
+ generator->backed_up_stack = emalloc(generator->backed_up_stack_size);
+ memcpy(generator->backed_up_stack, generator->original_stack_top, generator->backed_up_stack_size);
+ zend_vm_stack_free(generator->original_stack_top TSRMLS_CC);
+ }
+
+ /* If an exception was thrown in the generator we have to internally
+ * rethrow it in the parent scope. */
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ zend_throw_exception_internal(NULL TSRMLS_CC);
+ }
+ }
+}
+/* }}} */
+
+static void zend_generator_ensure_initialized(zend_generator *generator TSRMLS_DC) /* {{{ */
+{
+ if (generator->execute_data && !generator->value) {
+ zend_generator_resume(generator TSRMLS_CC);
+ generator->flags |= ZEND_GENERATOR_AT_FIRST_YIELD;
+ }
+}
+/* }}} */
+
+static void zend_generator_rewind(zend_generator *generator TSRMLS_DC) /* {{{ */
+{
+ zend_generator_ensure_initialized(generator TSRMLS_CC);
+
+ if (!(generator->flags & ZEND_GENERATOR_AT_FIRST_YIELD)) {
+ zend_throw_exception(NULL, "Cannot rewind a generator that was already run", 0 TSRMLS_CC);
+ }
+}
+/* }}} */
+
+/* {{{ proto void Generator::rewind()
+ * Rewind the generator */
+ZEND_METHOD(Generator, rewind)
+{
+ zend_generator *generator;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ zend_generator_rewind(generator TSRMLS_CC);
+}
+/* }}} */
+
+/* {{{ proto bool Generator::valid()
+ * Check whether the generator is valid */
+ZEND_METHOD(Generator, valid)
+{
+ zend_generator *generator;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ zend_generator_ensure_initialized(generator TSRMLS_CC);
+
+ RETURN_BOOL(generator->value != NULL);
+}
+/* }}} */
+
+/* {{{ proto mixed Generator::current()
+ * Get the current value */
+ZEND_METHOD(Generator, current)
+{
+ zend_generator *generator;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ zend_generator_ensure_initialized(generator TSRMLS_CC);
+
+ if (generator->value) {
+ RETURN_ZVAL(generator->value, 1, 0);
+ }
+}
+/* }}} */
+
+/* {{{ proto mixed Generator::key()
+ * Get the current key */
+ZEND_METHOD(Generator, key)
+{
+ zend_generator *generator;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ zend_generator_ensure_initialized(generator TSRMLS_CC);
+
+ if (generator->key) {
+ RETURN_ZVAL(generator->key, 1, 0);
+ }
+}
+/* }}} */
+
+/* {{{ proto void Generator::next()
+ * Advances the generator */
+ZEND_METHOD(Generator, next)
+{
+ zend_generator *generator;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ zend_generator_ensure_initialized(generator TSRMLS_CC);
+
+ zend_generator_resume(generator TSRMLS_CC);
+}
+/* }}} */
+
+/* {{{ proto mixed Generator::send()
+ * Sends a value to the generator */
+ZEND_METHOD(Generator, send)
+{
+ zval *value;
+ zend_generator *generator;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &value) == FAILURE) {
+ return;
+ }
+
+ generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ zend_generator_ensure_initialized(generator TSRMLS_CC);
+
+ /* The generator is already closed, thus can't send anything */
+ if (!generator->execute_data) {
+ return;
+ }
+
+ /* The sent value was initialized to NULL, so dtor that */
+ zval_ptr_dtor(&generator->send_target->var.ptr);
+
+ /* Set new sent value */
+ Z_ADDREF_P(value);
+ generator->send_target->var.ptr = value;
+ generator->send_target->var.ptr_ptr = &value;
+
+ zend_generator_resume(generator TSRMLS_CC);
+
+ if (generator->value) {
+ RETURN_ZVAL(generator->value, 1, 0);
+ }
+}
+/* }}} */
+
+/* {{{ proto void Generator::__wakeup()
+ * Throws an Exception as generators can't be serialized */
+ZEND_METHOD(Generator, __wakeup)
+{
+ /* Just specifying the zend_class_unserialize_deny handler is not enough,
+ * because it is only invoked for C unserialization. For O the error has
+ * to be thrown in __wakeup. */
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ zend_throw_exception(NULL, "Unserialization of 'Generator' is not allowed", 0 TSRMLS_CC);
+}
+/* }}} */
+
+/* get_iterator implementation */
+
+typedef struct _zend_generator_iterator {
+ zend_object_iterator intern;
+
+ /* The generator object zval has to be stored, because the iterator is
+ * holding a ref to it, which has to be dtored. */
+ zval *object;
+} zend_generator_iterator;
+
+static void zend_generator_iterator_dtor(zend_object_iterator *iterator TSRMLS_DC) /* {{{ */
+{
+ zval *object = ((zend_generator_iterator *) iterator)->object;
+
+ zval_ptr_dtor(&object);
+
+ efree(iterator);
+}
+/* }}} */
+
+static int zend_generator_iterator_valid(zend_object_iterator *iterator TSRMLS_DC) /* {{{ */
+{
+ zend_generator *generator = (zend_generator *) iterator->data;
+
+ zend_generator_ensure_initialized(generator TSRMLS_CC);
+
+ return generator->value != NULL ? SUCCESS : FAILURE;
+}
+/* }}} */
+
+static void zend_generator_iterator_get_data(zend_object_iterator *iterator, zval ***data TSRMLS_DC) /* {{{ */
+{
+ zend_generator *generator = (zend_generator *) iterator->data;
+
+ zend_generator_ensure_initialized(generator TSRMLS_CC);
+
+ if (generator->value) {
+ *data = &generator->value;
+ } else {
+ *data = NULL;
+ }
+}
+/* }}} */
+
+static int zend_generator_iterator_get_key(zend_object_iterator *iterator, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) /* {{{ */
+{
+ zend_generator *generator = (zend_generator *) iterator->data;
+
+ zend_generator_ensure_initialized(generator TSRMLS_CC);
+
+ if (!generator->key) {
+ return HASH_KEY_NON_EXISTANT;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG) {
+ *int_key = Z_LVAL_P(generator->key);
+ return HASH_KEY_IS_LONG;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_STRING) {
+ *str_key = estrndup(Z_STRVAL_P(generator->key), Z_STRLEN_P(generator->key));
+ *str_key_len = Z_STRLEN_P(generator->key) + 1;
+ return HASH_KEY_IS_STRING;
+ }
+
+ /* Waiting for Etienne's patch to allow arbitrary zval keys. Until then
+ * error out on non-int and non-string keys. */
+ zend_error_noreturn(E_ERROR, "Currently only int and string keys can be yielded");
+}
+/* }}} */
+
+static void zend_generator_iterator_move_forward(zend_object_iterator *iterator TSRMLS_DC) /* {{{ */
+{
+ zend_generator *generator = (zend_generator *) iterator->data;
+
+ zend_generator_ensure_initialized(generator TSRMLS_CC);
+
+ zend_generator_resume(generator TSRMLS_CC);
+}
+/* }}} */
+
+static void zend_generator_iterator_rewind(zend_object_iterator *iterator TSRMLS_DC) /* {{{ */
+{
+ zend_generator *generator = (zend_generator *) iterator->data;
+
+ zend_generator_rewind(generator TSRMLS_CC);
+}
+/* }}} */
+
+static zend_object_iterator_funcs zend_generator_iterator_functions = {
+ zend_generator_iterator_dtor,
+ zend_generator_iterator_valid,
+ zend_generator_iterator_get_data,
+ zend_generator_iterator_get_key,
+ zend_generator_iterator_move_forward,
+ zend_generator_iterator_rewind
+};
+
+zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC) /* {{{ */
+{
+ zend_generator_iterator *iterator;
+ zend_generator *generator;
+
+ generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC);
+
+ if (!generator->execute_data) {
+ zend_throw_exception(NULL, "Cannot traverse an already closed generator", 0 TSRMLS_CC);
+ return NULL;
+ }
+
+ if (by_ref && !(generator->execute_data->op_array->fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
+ zend_throw_exception(NULL, "You can only iterate a generator by-reference if it declared that it yields by-reference", 0 TSRMLS_CC);
+ return NULL;
+ }
+
+ iterator = emalloc(sizeof(zend_generator_iterator));
+ iterator->intern.funcs = &zend_generator_iterator_functions;
+ iterator->intern.data = (void *) generator;
+
+ /* We have to keep a reference to the generator object zval around,
+ * otherwise the generator may be destroyed during iteration. */
+ Z_ADDREF_P(object);
+ iterator->object = object;
+
+ return (zend_object_iterator *) iterator;
+}
+/* }}} */
+
+ZEND_BEGIN_ARG_INFO(arginfo_generator_void, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_generator_send, 0, 0, 1)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+static const zend_function_entry generator_functions[] = {
+ ZEND_ME(Generator, rewind, arginfo_generator_void, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, valid, arginfo_generator_void, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, current, arginfo_generator_void, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, key, arginfo_generator_void, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, next, arginfo_generator_void, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, send, arginfo_generator_send, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, __wakeup, arginfo_generator_void, ZEND_ACC_PUBLIC)
+ ZEND_FE_END
+};
+
+void zend_register_generator_ce(TSRMLS_D) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_CLASS_ENTRY(ce, "Generator", generator_functions);
+ zend_ce_generator = zend_register_internal_class(&ce TSRMLS_CC);
+ zend_ce_generator->ce_flags |= ZEND_ACC_FINAL_CLASS;
+ zend_ce_generator->create_object = zend_generator_create;
+ zend_ce_generator->serialize = zend_class_serialize_deny;
+ zend_ce_generator->unserialize = zend_class_unserialize_deny;
+
+ /* get_iterator has to be assigned *after* implementing the inferface */
+ zend_class_implements(zend_ce_generator TSRMLS_CC, 1, zend_ce_iterator);
+ zend_ce_generator->get_iterator = zend_generator_get_iterator;
+ zend_ce_generator->iterator_funcs.funcs = &zend_generator_iterator_functions;
+
+ memcpy(&zend_generator_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ zend_generator_handlers.get_constructor = zend_generator_get_constructor;
+ zend_generator_handlers.clone_obj = zend_objects_store_clone_obj;
+}
+/* }}} */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * indent-tabs-mode: t
+ * End:
+ */
diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h
new file mode 100644
index 0000000000..e47b7ad885
--- /dev/null
+++ b/Zend/zend_generators.h
@@ -0,0 +1,73 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend Engine |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 2.00 of the Zend license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.zend.com/license/2_00.txt. |
+ | If you did not receive a copy of the Zend license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@zend.com so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Nikita Popov <nikic@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#ifndef ZEND_GENERATORS_H
+#define ZEND_GENERATORS_H
+
+BEGIN_EXTERN_C()
+extern ZEND_API zend_class_entry *zend_ce_generator;
+END_EXTERN_C()
+
+typedef struct _zend_generator {
+ zend_object std;
+
+ /* The suspended execution context. */
+ zend_execute_data *execute_data;
+
+ /* If the execution is suspended during a function call there may be
+ * arguments pushed to the stack, so it has to be backed up. */
+ void *backed_up_stack;
+ size_t backed_up_stack_size;
+
+ /* The original stack top before resuming the generator. This is required
+ * for proper cleanup during exception handling. */
+ void **original_stack_top;
+
+ /* Current value */
+ zval *value;
+ /* Current key */
+ zval *key;
+ /* Variable to put sent value into */
+ temp_variable *send_target;
+ /* Largest used integer key for auto-incrementing keys */
+ long largest_used_integer_key;
+
+ /* ZEND_GENERATOR_* flags */
+ zend_uchar flags;
+} zend_generator;
+
+static const zend_uchar ZEND_GENERATOR_CURRENTLY_RUNNING = 0x1;
+static const zend_uchar ZEND_GENERATOR_FORCED_CLOSE = 0x2;
+static const zend_uchar ZEND_GENERATOR_AT_FIRST_YIELD = 0x4;
+
+void zend_register_generator_ce(TSRMLS_D);
+zval *zend_generator_create_zval(zend_op_array *op_array TSRMLS_DC);
+void zend_generator_close(zend_generator *generator, zend_bool finished_execution TSRMLS_DC);
+void zend_generator_resume(zend_generator *generator TSRMLS_DC);
+
+#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * indent-tabs-mode: t
+ * End:
+ */
diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h
index dbbcf972a4..e5aba0df67 100644
--- a/Zend/zend_globals.h
+++ b/Zend/zend_globals.h
@@ -89,9 +89,6 @@ struct _zend_compiler_globals {
int zend_lineno;
- char *heredoc;
- int heredoc_len;
-
zend_op_array *active_op_array;
HashTable *function_table; /* function symbol table */
@@ -297,6 +294,7 @@ struct _zend_php_scanner_globals {
unsigned char *yy_limit;
int yy_state;
zend_stack state_stack;
+ zend_ptr_stack heredoc_label_stack;
/* original (unfiltered) script */
unsigned char *script_org;
diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c
index e9fd850e6b..938e1c612b 100644
--- a/Zend/zend_highlight.c
+++ b/Zend/zend_highlight.c
@@ -153,8 +153,6 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
efree(token.value.str.val);
break;
}
- } else if (token_type == T_END_HEREDOC) {
- efree(token.value.str.val);
}
token.type = 0;
}
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index e397fe138b..c1514c5d78 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -68,6 +68,8 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
%token T_LOGICAL_AND "and (T_LOGICAL_AND)"
%right T_PRINT
%token T_PRINT "print (T_PRINT)"
+%right T_YIELD
+%token T_YIELD "yield (T_YIELD)"
%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL
%token T_PLUS_EQUAL "+= (T_PLUS_EQUAL)"
%token T_MINUS_EQUAL "-= (T_MINUS_EQUAL)"
@@ -160,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)"
@@ -276,10 +279,10 @@ statement:
unticked_statement:
'{' inner_statement_list '}'
- | T_IF '(' expr ')' { zend_do_if_cond(&$3, &$4 TSRMLS_CC); } statement { zend_do_if_after_statement(&$4, 1 TSRMLS_CC); } elseif_list else_single { zend_do_if_end(TSRMLS_C); }
- | T_IF '(' expr ')' ':' { zend_do_if_cond(&$3, &$4 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$4, 1 TSRMLS_CC); } new_elseif_list new_else_single T_ENDIF ';' { zend_do_if_end(TSRMLS_C); }
- | T_WHILE '(' { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); } expr ')' { zend_do_while_cond(&$4, &$5 TSRMLS_CC); } while_statement { zend_do_while_end(&$1, &$5 TSRMLS_CC); }
- | T_DO { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); zend_do_do_while_begin(TSRMLS_C); } statement T_WHILE '(' { $5.u.op.opline_num = get_next_op_number(CG(active_op_array)); } expr ')' ';' { zend_do_do_while_end(&$1, &$5, &$7 TSRMLS_CC); }
+ | T_IF parenthesis_expr { zend_do_if_cond(&$2, &$1 TSRMLS_CC); } statement { zend_do_if_after_statement(&$1, 1 TSRMLS_CC); } elseif_list else_single { zend_do_if_end(TSRMLS_C); }
+ | T_IF parenthesis_expr ':' { zend_do_if_cond(&$2, &$1 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$1, 1 TSRMLS_CC); } new_elseif_list new_else_single T_ENDIF ';' { zend_do_if_end(TSRMLS_C); }
+ | T_WHILE { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); } parenthesis_expr { zend_do_while_cond(&$3, &$$ TSRMLS_CC); } while_statement { zend_do_while_end(&$1, &$4 TSRMLS_CC); }
+ | T_DO { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); zend_do_do_while_begin(TSRMLS_C); } statement T_WHILE { $4.u.op.opline_num = get_next_op_number(CG(active_op_array)); } parenthesis_expr ';' { zend_do_do_while_end(&$1, &$4, &$6 TSRMLS_CC); }
| T_FOR
'('
for_expr
@@ -289,7 +292,7 @@ unticked_statement:
for_expr
')' { zend_do_free(&$9 TSRMLS_CC); zend_do_for_before_statement(&$4, &$7 TSRMLS_CC); }
for_statement { zend_do_for_end(&$7 TSRMLS_CC); }
- | T_SWITCH '(' expr ')' { zend_do_switch_cond(&$3 TSRMLS_CC); } switch_case_list { zend_do_switch_end(&$6 TSRMLS_CC); }
+ | T_SWITCH parenthesis_expr { zend_do_switch_cond(&$2 TSRMLS_CC); } switch_case_list { zend_do_switch_end(&$4 TSRMLS_CC); }
| T_BREAK ';' { zend_do_brk_cont(ZEND_BRK, NULL TSRMLS_CC); }
| T_BREAK expr ';' { zend_do_brk_cont(ZEND_BRK, &$2 TSRMLS_CC); }
| T_CONTINUE ';' { zend_do_brk_cont(ZEND_CONT, NULL TSRMLS_CC); }
@@ -297,6 +300,7 @@ unticked_statement:
| T_RETURN ';' { zend_do_return(NULL, 0 TSRMLS_CC); }
| T_RETURN expr_without_variable ';' { zend_do_return(&$2, 0 TSRMLS_CC); }
| T_RETURN variable ';' { zend_do_return(&$2, 1 TSRMLS_CC); }
+ | yield_expr ';' { $$ = $1; }
| T_GLOBAL global_var_list ';'
| T_STATIC static_var_list ';'
| T_ECHO echo_expr_list ';'
@@ -309,20 +313,29 @@ unticked_statement:
foreach_statement { zend_do_foreach_end(&$1, &$4 TSRMLS_CC); }
| T_FOREACH '(' expr_without_variable T_AS
{ zend_do_foreach_begin(&$1, &$2, &$3, &$4, 0 TSRMLS_CC); }
- variable foreach_optional_arg ')' { zend_check_writable_variable(&$6); zend_do_foreach_cont(&$1, &$2, &$4, &$6, &$7 TSRMLS_CC); }
+ foreach_variable foreach_optional_arg ')' { zend_do_foreach_cont(&$1, &$2, &$4, &$6, &$7 TSRMLS_CC); }
foreach_statement { zend_do_foreach_end(&$1, &$4 TSRMLS_CC); }
| 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; }
@@ -334,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
@@ -357,7 +368,6 @@ class_declaration_statement:
unticked_class_declaration_statement { DO_TICKS(); }
;
-
is_reference:
/* empty */ { $$.op_type = ZEND_RETURN_VAL; }
| '&' { $$.op_type = ZEND_RETURN_REF; }
@@ -366,7 +376,8 @@ is_reference:
unticked_function_declaration_statement:
function is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$3, 0, $2.op_type, NULL TSRMLS_CC); }
- '(' parameter_list ')' '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); }
+ '(' parameter_list ')'
+ '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); }
;
unticked_class_declaration_statement:
@@ -421,10 +432,10 @@ foreach_optional_arg:
| T_DOUBLE_ARROW foreach_variable { $$ = $2; }
;
-
foreach_variable:
variable { zend_check_writable_variable(&$1); $$ = $1; }
| '&' variable { zend_check_writable_variable(&$2); $$ = $2; $$.EA |= ZEND_PARSED_REFERENCE_VARIABLE; }
+ | T_LIST '(' { zend_do_list_init(TSRMLS_C); } assignment_list ')' { $$ = $1; $$.EA = ZEND_PARSED_LIST_EXPR; }
;
for_statement:
@@ -481,13 +492,13 @@ while_statement:
elseif_list:
/* empty */
- | elseif_list T_ELSEIF '(' expr ')' { zend_do_if_cond(&$4, &$5 TSRMLS_CC); } statement { zend_do_if_after_statement(&$5, 0 TSRMLS_CC); }
+ | elseif_list T_ELSEIF parenthesis_expr { zend_do_if_cond(&$3, &$2 TSRMLS_CC); } statement { zend_do_if_after_statement(&$2, 0 TSRMLS_CC); }
;
new_elseif_list:
/* empty */
- | new_elseif_list T_ELSEIF '(' expr ')' ':' { zend_do_if_cond(&$4, &$5 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$5, 0 TSRMLS_CC); }
+ | new_elseif_list T_ELSEIF parenthesis_expr ':' { zend_do_if_cond(&$3, &$2 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$2, 0 TSRMLS_CC); }
;
@@ -530,8 +541,9 @@ optional_class_type:
function_call_parameter_list:
- non_empty_function_call_parameter_list { $$ = $1; }
- | /* empty */ { Z_LVAL($$.u.constant) = 0; }
+ '(' ')' { Z_LVAL($$.u.constant) = 0; }
+ | '(' non_empty_function_call_parameter_list ')' { $$ = $2; }
+ | '(' yield_expr ')' { Z_LVAL($$.u.constant) = 1; zend_do_pass_param(&$2, ZEND_SEND_VAL, Z_LVAL($$.u.constant) TSRMLS_CC); }
;
@@ -576,8 +588,9 @@ class_statement:
variable_modifiers { CG(access_type) = Z_LVAL($1.u.constant); } class_variable_declaration ';'
| class_constant_declaration ';'
| trait_use_statement
- | method_modifiers function is_reference T_STRING { zend_do_begin_function_declaration(&$2, &$4, 1, $3.op_type, &$1 TSRMLS_CC); } '('
- parameter_list ')' method_body { zend_do_abstract_method(&$4, &$1, &$9 TSRMLS_CC); zend_do_end_function_declaration(&$2 TSRMLS_CC); }
+ | method_modifiers function is_reference T_STRING { zend_do_begin_function_declaration(&$2, &$4, 1, $3.op_type, &$1 TSRMLS_CC); }
+ '(' parameter_list ')'
+ method_body { zend_do_abstract_method(&$4, &$1, &$9 TSRMLS_CC); zend_do_end_function_declaration(&$2 TSRMLS_CC); }
;
trait_use_statement:
@@ -770,7 +783,7 @@ expr_without_variable:
| expr '>' expr { zend_do_binary_op(ZEND_IS_SMALLER, &$$, &$3, &$1 TSRMLS_CC); }
| expr T_IS_GREATER_OR_EQUAL expr { zend_do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$3, &$1 TSRMLS_CC); }
| expr T_INSTANCEOF class_name_reference { zend_do_instanceof(&$$, &$1, &$3, 0 TSRMLS_CC); }
- | '(' expr ')' { $$ = $2; }
+ | parenthesis_expr { $$ = $1; }
| new_expr { $$ = $1; }
| '(' new_expr ')' { $$ = $2; } instance_call { $$ = $5; }
| expr '?' { zend_do_begin_qm_op(&$1, &$2 TSRMLS_CC); }
@@ -793,16 +806,26 @@ expr_without_variable:
| combined_scalar { $$ = $1; }
| '`' backticks_expr '`' { zend_do_shell_exec(&$$, &$2 TSRMLS_CC); }
| T_PRINT expr { zend_do_print(&$$, &$2 TSRMLS_CC); }
- | function is_reference '(' { zend_do_begin_lambda_function_declaration(&$$, &$1, $2.op_type, 0 TSRMLS_CC); }
- parameter_list ')' lexical_vars '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); $$ = $4; }
- | T_STATIC function is_reference '(' { zend_do_begin_lambda_function_declaration(&$$, &$2, $3.op_type, 1 TSRMLS_CC); }
- parameter_list ')' lexical_vars '{' inner_statement_list '}' { zend_do_end_function_declaration(&$2 TSRMLS_CC); $$ = $5; }
+ | T_YIELD { zend_do_yield(&$$, NULL, NULL, 0 TSRMLS_CC); }
+ | function is_reference { zend_do_begin_lambda_function_declaration(&$$, &$1, $2.op_type, 0 TSRMLS_CC); }
+ '(' parameter_list ')' lexical_vars
+ '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); $$ = $3; }
+ | T_STATIC function is_reference { zend_do_begin_lambda_function_declaration(&$$, &$2, $3.op_type, 1 TSRMLS_CC); }
+ '(' parameter_list ')' lexical_vars
+ '{' inner_statement_list '}' { zend_do_end_function_declaration(&$2 TSRMLS_CC); $$ = $4; }
+;
+
+yield_expr:
+ T_YIELD expr_without_variable { zend_do_yield(&$$, &$2, NULL, 0 TSRMLS_CC); }
+ | T_YIELD variable { zend_do_yield(&$$, &$2, NULL, 1 TSRMLS_CC); }
+ | T_YIELD expr T_DOUBLE_ARROW expr_without_variable { zend_do_yield(&$$, &$4, &$2, 0 TSRMLS_CC); }
+ | T_YIELD expr T_DOUBLE_ARROW variable { zend_do_yield(&$$, &$4, &$2, 1 TSRMLS_CC); }
;
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; }
@@ -825,30 +848,22 @@ lexical_var_list:
;
function_call:
- namespace_name '(' { $2.u.op.opline_num = zend_do_begin_function_call(&$1, 1 TSRMLS_CC); }
- function_call_parameter_list
- ')' { zend_do_end_function_call(&$1, &$$, &$4, 0, $2.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
- | T_NAMESPACE T_NS_SEPARATOR namespace_name '(' { $1.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$1.u.constant); zend_do_build_namespace_name(&$1, &$1, &$3 TSRMLS_CC); $4.u.op.opline_num = zend_do_begin_function_call(&$1, 0 TSRMLS_CC); }
- function_call_parameter_list
- ')' { zend_do_end_function_call(&$1, &$$, &$6, 0, $4.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
- | T_NS_SEPARATOR namespace_name '(' { $3.u.op.opline_num = zend_do_begin_function_call(&$2, 0 TSRMLS_CC); }
- function_call_parameter_list
- ')' { zend_do_end_function_call(&$2, &$$, &$5, 0, $3.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
- | class_name T_PAAMAYIM_NEKUDOTAYIM variable_name '(' { $4.u.op.opline_num = zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
- function_call_parameter_list
- ')' { zend_do_end_function_call($4.u.op.opline_num?NULL:&$3, &$$, &$6, $4.u.op.opline_num, $4.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
- | class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
- function_call_parameter_list
- ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
- | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_name '(' { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
- function_call_parameter_list
- ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
- | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
- function_call_parameter_list
- ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
- | variable_without_objects '(' { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&$1, 0 TSRMLS_CC); }
- function_call_parameter_list ')'
- { zend_do_end_function_call(&$1, &$$, &$4, 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
+ namespace_name { $$.u.op.opline_num = zend_do_begin_function_call(&$1, 1 TSRMLS_CC); }
+ function_call_parameter_list { zend_do_end_function_call(&$1, &$$, &$3, 0, $2.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
+ | T_NAMESPACE T_NS_SEPARATOR namespace_name { $1.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$1.u.constant); zend_do_build_namespace_name(&$1, &$1, &$3 TSRMLS_CC); $$.u.op.opline_num = zend_do_begin_function_call(&$1, 0 TSRMLS_CC); }
+ function_call_parameter_list { zend_do_end_function_call(&$1, &$$, &$5, 0, $4.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
+ | T_NS_SEPARATOR namespace_name { $$.u.op.opline_num = zend_do_begin_function_call(&$2, 0 TSRMLS_CC); }
+ function_call_parameter_list { zend_do_end_function_call(&$2, &$$, &$4, 0, $3.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
+ | class_name T_PAAMAYIM_NEKUDOTAYIM variable_name { $$.u.op.opline_num = zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
+ function_call_parameter_list { zend_do_end_function_call($4.u.op.opline_num?NULL:&$3, &$$, &$5, $4.u.op.opline_num, $4.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
+ | class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
+ function_call_parameter_list { zend_do_end_function_call(NULL, &$$, &$5, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
+ | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_name { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
+ function_call_parameter_list { zend_do_end_function_call(NULL, &$$, &$5, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
+ | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
+ function_call_parameter_list { zend_do_end_function_call(NULL, &$$, &$5, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
+ | variable_without_objects { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&$1, 0 TSRMLS_CC); }
+ function_call_parameter_list { zend_do_end_function_call(&$1, &$$, &$3, 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
;
class_name:
@@ -893,7 +908,7 @@ dynamic_class_name_variable_property:
exit_expr:
/* empty */ { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; }
| '(' ')' { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; }
- | '(' expr ')' { $$ = $2; }
+ | parenthesis_expr { $$ = $1; }
;
backticks_expr:
@@ -904,8 +919,8 @@ backticks_expr:
ctor_arguments:
- /* empty */ { Z_LVAL($$.u.constant)=0; }
- | '(' function_call_parameter_list ')' { $$ = $2; }
+ /* empty */ { Z_LVAL($$.u.constant) = 0; }
+ | function_call_parameter_list { $$ = $1; }
;
@@ -920,8 +935,8 @@ common_scalar:
| T_METHOD_C { $$ = $1; }
| T_FUNC_C { $$ = $1; }
| T_NS_C { $$ = $1; }
- | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC { $$ = $2; CG(heredoc) = Z_STRVAL($1.u.constant); CG(heredoc_len) = Z_STRLEN($1.u.constant); }
- | T_START_HEREDOC T_END_HEREDOC { ZVAL_EMPTY_STRING(&$$.u.constant); INIT_PZVAL(&$$.u.constant); $$.op_type = IS_CONST; CG(heredoc) = Z_STRVAL($1.u.constant); CG(heredoc_len) = Z_STRLEN($1.u.constant); }
+ | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC { $$ = $2; }
+ | T_START_HEREDOC T_END_HEREDOC { ZVAL_EMPTY_STRING(&$$.u.constant); INIT_PZVAL(&$$.u.constant); $$.op_type = IS_CONST; }
;
@@ -950,7 +965,7 @@ scalar:
| T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT, 0 TSRMLS_CC); }
| common_scalar { $$ = $1; }
| '"' encaps_list '"' { $$ = $2; }
- | T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; CG(heredoc) = Z_STRVAL($1.u.constant); CG(heredoc_len) = Z_STRLEN($1.u.constant); }
+ | T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; }
| T_CLASS_C { if (Z_TYPE($1.u.constant) == IS_CONSTANT) {zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT, 1 TSRMLS_CC);} else {$$ = $1;} }
;
@@ -977,6 +992,11 @@ expr:
| expr_without_variable { $$ = $1; }
;
+parenthesis_expr:
+ '(' expr ')' { $$ = $2; }
+ | '(' yield_expr ')' { $$ = $2; }
+;
+
r_variable:
variable { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); $$ = $1; }
@@ -1016,9 +1036,8 @@ array_method_dereference:
;
method:
- '(' { zend_do_pop_object(&$1 TSRMLS_CC); zend_do_begin_method_call(&$1 TSRMLS_CC); }
- function_call_parameter_list ')'
- { zend_do_end_function_call(&$1, &$$, &$3, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
+ { zend_do_pop_object(&$$ TSRMLS_CC); zend_do_begin_method_call(&$$ TSRMLS_CC); }
+ function_call_parameter_list { zend_do_end_function_call(&$1, &$$, &$2, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
;
method_or_not:
diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c
index 0bfbac9975..07ccb5d751 100644
--- a/Zend/zend_language_scanner.c
+++ b/Zend/zend_language_scanner.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Mon Apr 30 15:56:25 2012 */
+/* Generated by re2c 0.13.5 on Mon Aug 20 13:34:50 2012 */
#line 1 "Zend/zend_language_scanner.l"
/*
+----------------------------------------------------------------------+
@@ -180,22 +180,23 @@ static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC)
void startup_scanner(TSRMLS_D)
{
CG(parse_error) = 0;
- CG(heredoc) = NULL;
- CG(heredoc_len) = 0;
CG(doc_comment) = NULL;
CG(doc_comment_len) = 0;
zend_stack_init(&SCNG(state_stack));
+ zend_ptr_stack_init(&SCNG(heredoc_label_stack));
+}
+
+static void heredoc_label_dtor(zend_heredoc_label *heredoc_label) {
+ efree(heredoc_label->label);
}
void shutdown_scanner(TSRMLS_D)
{
- if (CG(heredoc)) {
- efree(CG(heredoc));
- CG(heredoc_len)=0;
- }
CG(parse_error) = 0;
- zend_stack_destroy(&SCNG(state_stack));
RESET_DOC_COMMENT();
+ zend_stack_destroy(&SCNG(state_stack));
+ zend_ptr_stack_clean(&SCNG(heredoc_label_stack), (void (*)(void *)) &heredoc_label_dtor, 1);
+ zend_ptr_stack_destroy(&SCNG(heredoc_label_stack));
}
ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
@@ -210,6 +211,9 @@ ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
lex_state->state_stack = SCNG(state_stack);
zend_stack_init(&SCNG(state_stack));
+ lex_state->heredoc_label_stack = SCNG(heredoc_label_stack);
+ zend_ptr_stack_init(&SCNG(heredoc_label_stack));
+
lex_state->in = SCNG(yy_in);
lex_state->yy_state = YYSTATE;
lex_state->filename = zend_get_compiled_filename(TSRMLS_C);
@@ -236,6 +240,10 @@ ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
zend_stack_destroy(&SCNG(state_stack));
SCNG(state_stack) = lex_state->state_stack;
+ zend_ptr_stack_clean(&SCNG(heredoc_label_stack), (void (*)(void *)) &heredoc_label_dtor, 1);
+ zend_ptr_stack_destroy(&SCNG(heredoc_label_stack));
+ SCNG(heredoc_label_stack) = lex_state->heredoc_label_stack;
+
SCNG(yy_in) = lex_state->in;
YYSETCONDITION(lex_state->yy_state);
CG(zend_lineno) = lex_state->lineno;
@@ -252,12 +260,6 @@ ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
SCNG(input_filter) = lex_state->input_filter;
SCNG(output_filter) = lex_state->output_filter;
SCNG(script_encoding) = lex_state->script_encoding;
-
- if (CG(heredoc)) {
- efree(CG(heredoc));
- CG(heredoc) = NULL;
- CG(heredoc_len) = 0;
- }
}
ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC)
@@ -998,7 +1000,7 @@ restart:
yymore_restart:
-#line 1002 "Zend/zend_language_scanner.c"
+#line 1004 "Zend/zend_language_scanner.c"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -1097,7 +1099,7 @@ yyc_INITIAL:
yy3:
YYDEBUG(3, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1791 "Zend/zend_language_scanner.l"
+#line 1801 "Zend/zend_language_scanner.l"
{
if (YYCURSOR > YYLIMIT) {
return 0;
@@ -1157,7 +1159,7 @@ inline_html:
HANDLE_NEWLINES(yytext, yyleng);
return T_INLINE_HTML;
}
-#line 1161 "Zend/zend_language_scanner.c"
+#line 1163 "Zend/zend_language_scanner.c"
yy4:
YYDEBUG(4, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1175,7 +1177,7 @@ yy5:
yy6:
YYDEBUG(6, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1779 "Zend/zend_language_scanner.l"
+#line 1789 "Zend/zend_language_scanner.l"
{
if (CG(short_tags)) {
zendlval->value.str.val = yytext; /* no copying - intentional */
@@ -1187,14 +1189,14 @@ yy6:
goto inline_char_handler;
}
}
-#line 1191 "Zend/zend_language_scanner.c"
+#line 1193 "Zend/zend_language_scanner.c"
yy7:
YYDEBUG(7, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) == '=') goto yy43;
YYDEBUG(8, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1756 "Zend/zend_language_scanner.l"
+#line 1766 "Zend/zend_language_scanner.l"
{
if (CG(asp_tags)) {
zendlval->value.str.val = yytext; /* no copying - intentional */
@@ -1206,7 +1208,7 @@ yy7:
goto inline_char_handler;
}
}
-#line 1210 "Zend/zend_language_scanner.c"
+#line 1212 "Zend/zend_language_scanner.c"
yy9:
YYDEBUG(9, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1392,7 +1394,7 @@ yy35:
++YYCURSOR;
YYDEBUG(38, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1716 "Zend/zend_language_scanner.l"
+#line 1726 "Zend/zend_language_scanner.l"
{
YYCTYPE *bracket = (YYCTYPE*)zend_memrchr(yytext, '<', yyleng - (sizeof("script language=php>") - 1));
@@ -1409,7 +1411,7 @@ yy35:
BEGIN(ST_IN_SCRIPTING);
return T_OPEN_TAG;
}
-#line 1413 "Zend/zend_language_scanner.c"
+#line 1415 "Zend/zend_language_scanner.c"
yy39:
YYDEBUG(39, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1436,7 +1438,7 @@ yy43:
++YYCURSOR;
YYDEBUG(44, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1734 "Zend/zend_language_scanner.l"
+#line 1744 "Zend/zend_language_scanner.l"
{
if (CG(asp_tags)) {
zendlval->value.str.val = yytext; /* no copying - intentional */
@@ -1448,13 +1450,13 @@ yy43:
goto inline_char_handler;
}
}
-#line 1452 "Zend/zend_language_scanner.c"
+#line 1454 "Zend/zend_language_scanner.c"
yy45:
YYDEBUG(45, *YYCURSOR);
++YYCURSOR;
YYDEBUG(46, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1747 "Zend/zend_language_scanner.l"
+#line 1757 "Zend/zend_language_scanner.l"
{
zendlval->value.str.val = yytext; /* no copying - intentional */
zendlval->value.str.len = yyleng;
@@ -1462,7 +1464,7 @@ yy45:
BEGIN(ST_IN_SCRIPTING);
return T_OPEN_TAG_WITH_ECHO;
}
-#line 1466 "Zend/zend_language_scanner.c"
+#line 1468 "Zend/zend_language_scanner.c"
yy47:
YYDEBUG(47, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1489,7 +1491,7 @@ yy50:
yy51:
YYDEBUG(51, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1769 "Zend/zend_language_scanner.l"
+#line 1779 "Zend/zend_language_scanner.l"
{
zendlval->value.str.val = yytext; /* no copying - intentional */
zendlval->value.str.len = yyleng;
@@ -1498,7 +1500,7 @@ yy51:
BEGIN(ST_IN_SCRIPTING);
return T_OPEN_TAG;
}
-#line 1502 "Zend/zend_language_scanner.c"
+#line 1504 "Zend/zend_language_scanner.c"
yy52:
YYDEBUG(52, *YYCURSOR);
++YYCURSOR;
@@ -1569,7 +1571,7 @@ yyc_ST_BACKQUOTE:
yy56:
YYDEBUG(56, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2242 "Zend/zend_language_scanner.l"
+#line 2252 "Zend/zend_language_scanner.l"
{
if (YYCURSOR > YYLIMIT) {
return 0;
@@ -1610,7 +1612,7 @@ yy56:
zend_scan_escape_string(zendlval, yytext, yyleng, '`' TSRMLS_CC);
return T_ENCAPSED_AND_WHITESPACE;
}
-#line 1614 "Zend/zend_language_scanner.c"
+#line 1616 "Zend/zend_language_scanner.c"
yy57:
YYDEBUG(57, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1621,12 +1623,12 @@ yy58:
++YYCURSOR;
YYDEBUG(59, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2186 "Zend/zend_language_scanner.l"
+#line 2196 "Zend/zend_language_scanner.l"
{
BEGIN(ST_IN_SCRIPTING);
return '`';
}
-#line 1630 "Zend/zend_language_scanner.c"
+#line 1632 "Zend/zend_language_scanner.c"
yy60:
YYDEBUG(60, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1636,14 +1638,14 @@ yy61:
++YYCURSOR;
YYDEBUG(62, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2173 "Zend/zend_language_scanner.l"
+#line 2183 "Zend/zend_language_scanner.l"
{
zendlval->value.lval = (long) '{';
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
yyless(1);
return T_CURLY_OPEN;
}
-#line 1647 "Zend/zend_language_scanner.c"
+#line 1649 "Zend/zend_language_scanner.c"
yy63:
YYDEBUG(63, *YYCURSOR);
yyaccept = 0;
@@ -1659,24 +1661,24 @@ yy63:
yy65:
YYDEBUG(65, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1873 "Zend/zend_language_scanner.l"
+#line 1883 "Zend/zend_language_scanner.l"
{
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 1669 "Zend/zend_language_scanner.c"
+#line 1671 "Zend/zend_language_scanner.c"
yy66:
YYDEBUG(66, *YYCURSOR);
++YYCURSOR;
YYDEBUG(67, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1449 "Zend/zend_language_scanner.l"
+#line 1459 "Zend/zend_language_scanner.l"
{
yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC);
return T_DOLLAR_OPEN_CURLY_BRACES;
}
-#line 1680 "Zend/zend_language_scanner.c"
+#line 1682 "Zend/zend_language_scanner.c"
yy68:
YYDEBUG(68, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1690,7 +1692,7 @@ yy70:
++YYCURSOR;
YYDEBUG(71, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1865 "Zend/zend_language_scanner.l"
+#line 1875 "Zend/zend_language_scanner.l"
{
yyless(yyleng - 1);
yy_push_state(ST_VAR_OFFSET TSRMLS_CC);
@@ -1698,7 +1700,7 @@ yy70:
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 1702 "Zend/zend_language_scanner.c"
+#line 1704 "Zend/zend_language_scanner.c"
yy72:
YYDEBUG(72, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1716,7 +1718,7 @@ yy73:
++YYCURSOR;
YYDEBUG(74, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1855 "Zend/zend_language_scanner.l"
+#line 1865 "Zend/zend_language_scanner.l"
{
yyless(yyleng - 3);
yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC);
@@ -1724,7 +1726,7 @@ yy73:
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 1728 "Zend/zend_language_scanner.c"
+#line 1730 "Zend/zend_language_scanner.c"
}
/* *********************************** */
yyc_ST_DOUBLE_QUOTES:
@@ -1792,7 +1794,7 @@ yy77:
yy78:
YYDEBUG(78, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2192 "Zend/zend_language_scanner.l"
+#line 2202 "Zend/zend_language_scanner.l"
{
if (GET_DOUBLE_QUOTES_SCANNED_LENGTH()) {
YYCURSOR += GET_DOUBLE_QUOTES_SCANNED_LENGTH() - 1;
@@ -1841,7 +1843,7 @@ double_quotes_scan_done:
zend_scan_escape_string(zendlval, yytext, yyleng, '"' TSRMLS_CC);
return T_ENCAPSED_AND_WHITESPACE;
}
-#line 1845 "Zend/zend_language_scanner.c"
+#line 1847 "Zend/zend_language_scanner.c"
yy79:
YYDEBUG(79, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1852,12 +1854,12 @@ yy80:
++YYCURSOR;
YYDEBUG(81, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2181 "Zend/zend_language_scanner.l"
+#line 2191 "Zend/zend_language_scanner.l"
{
BEGIN(ST_IN_SCRIPTING);
return '"';
}
-#line 1861 "Zend/zend_language_scanner.c"
+#line 1863 "Zend/zend_language_scanner.c"
yy82:
YYDEBUG(82, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1867,14 +1869,14 @@ yy83:
++YYCURSOR;
YYDEBUG(84, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2173 "Zend/zend_language_scanner.l"
+#line 2183 "Zend/zend_language_scanner.l"
{
zendlval->value.lval = (long) '{';
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
yyless(1);
return T_CURLY_OPEN;
}
-#line 1878 "Zend/zend_language_scanner.c"
+#line 1880 "Zend/zend_language_scanner.c"
yy85:
YYDEBUG(85, *YYCURSOR);
yyaccept = 0;
@@ -1890,24 +1892,24 @@ yy85:
yy87:
YYDEBUG(87, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1873 "Zend/zend_language_scanner.l"
+#line 1883 "Zend/zend_language_scanner.l"
{
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 1900 "Zend/zend_language_scanner.c"
+#line 1902 "Zend/zend_language_scanner.c"
yy88:
YYDEBUG(88, *YYCURSOR);
++YYCURSOR;
YYDEBUG(89, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1449 "Zend/zend_language_scanner.l"
+#line 1459 "Zend/zend_language_scanner.l"
{
yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC);
return T_DOLLAR_OPEN_CURLY_BRACES;
}
-#line 1911 "Zend/zend_language_scanner.c"
+#line 1913 "Zend/zend_language_scanner.c"
yy90:
YYDEBUG(90, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1921,7 +1923,7 @@ yy92:
++YYCURSOR;
YYDEBUG(93, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1865 "Zend/zend_language_scanner.l"
+#line 1875 "Zend/zend_language_scanner.l"
{
yyless(yyleng - 1);
yy_push_state(ST_VAR_OFFSET TSRMLS_CC);
@@ -1929,7 +1931,7 @@ yy92:
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 1933 "Zend/zend_language_scanner.c"
+#line 1935 "Zend/zend_language_scanner.c"
yy94:
YYDEBUG(94, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1947,7 +1949,7 @@ yy95:
++YYCURSOR;
YYDEBUG(96, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1855 "Zend/zend_language_scanner.l"
+#line 1865 "Zend/zend_language_scanner.l"
{
yyless(yyleng - 3);
yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC);
@@ -1955,7 +1957,7 @@ yy95:
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 1959 "Zend/zend_language_scanner.c"
+#line 1961 "Zend/zend_language_scanner.c"
}
/* *********************************** */
yyc_ST_END_HEREDOC:
@@ -1966,19 +1968,20 @@ yyc_ST_END_HEREDOC:
++YYCURSOR;
YYDEBUG(100, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2160 "Zend/zend_language_scanner.l"
+#line 2169 "Zend/zend_language_scanner.l"
{
- YYCURSOR += CG(heredoc_len) - 1;
- yyleng = CG(heredoc_len);
+ zend_heredoc_label *heredoc_label = zend_ptr_stack_pop(&SCNG(heredoc_label_stack));
+
+ YYCURSOR += heredoc_label->length - 1;
+ yyleng = heredoc_label->length;
+
+ heredoc_label_dtor(heredoc_label);
+ efree(heredoc_label);
- Z_STRVAL_P(zendlval) = CG(heredoc);
- Z_STRLEN_P(zendlval) = CG(heredoc_len);
- CG(heredoc) = NULL;
- CG(heredoc_len) = 0;
BEGIN(ST_IN_SCRIPTING);
return T_END_HEREDOC;
}
-#line 1982 "Zend/zend_language_scanner.c"
+#line 1985 "Zend/zend_language_scanner.c"
/* *********************************** */
yyc_ST_HEREDOC:
{
@@ -2040,10 +2043,12 @@ yy103:
yy104:
YYDEBUG(104, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2284 "Zend/zend_language_scanner.l"
+#line 2294 "Zend/zend_language_scanner.l"
{
int newline = 0;
+ zend_heredoc_label *heredoc_label = zend_ptr_stack_top(&SCNG(heredoc_label_stack));
+
if (YYCURSOR > YYLIMIT) {
return 0;
}
@@ -2059,8 +2064,8 @@ yy104:
/* fall through */
case '\n':
/* Check for ending label on the next line */
- if (IS_LABEL_START(*YYCURSOR) && CG(heredoc_len) < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, CG(heredoc), CG(heredoc_len))) {
- YYCTYPE *end = YYCURSOR + CG(heredoc_len);
+ if (IS_LABEL_START(*YYCURSOR) && heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, heredoc_label->label, heredoc_label->length)) {
+ YYCTYPE *end = YYCURSOR + heredoc_label->length;
if (*end == ';') {
end++;
@@ -2111,7 +2116,7 @@ heredoc_scan_done:
zend_scan_escape_string(zendlval, yytext, yyleng - newline, 0 TSRMLS_CC);
return T_ENCAPSED_AND_WHITESPACE;
}
-#line 2115 "Zend/zend_language_scanner.c"
+#line 2120 "Zend/zend_language_scanner.c"
yy105:
YYDEBUG(105, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2126,14 +2131,14 @@ yy107:
++YYCURSOR;
YYDEBUG(108, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2173 "Zend/zend_language_scanner.l"
+#line 2183 "Zend/zend_language_scanner.l"
{
zendlval->value.lval = (long) '{';
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
yyless(1);
return T_CURLY_OPEN;
}
-#line 2137 "Zend/zend_language_scanner.c"
+#line 2142 "Zend/zend_language_scanner.c"
yy109:
YYDEBUG(109, *YYCURSOR);
yyaccept = 0;
@@ -2149,24 +2154,24 @@ yy109:
yy111:
YYDEBUG(111, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1873 "Zend/zend_language_scanner.l"
+#line 1883 "Zend/zend_language_scanner.l"
{
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 2159 "Zend/zend_language_scanner.c"
+#line 2164 "Zend/zend_language_scanner.c"
yy112:
YYDEBUG(112, *YYCURSOR);
++YYCURSOR;
YYDEBUG(113, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1449 "Zend/zend_language_scanner.l"
+#line 1459 "Zend/zend_language_scanner.l"
{
yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC);
return T_DOLLAR_OPEN_CURLY_BRACES;
}
-#line 2170 "Zend/zend_language_scanner.c"
+#line 2175 "Zend/zend_language_scanner.c"
yy114:
YYDEBUG(114, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2180,7 +2185,7 @@ yy116:
++YYCURSOR;
YYDEBUG(117, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1865 "Zend/zend_language_scanner.l"
+#line 1875 "Zend/zend_language_scanner.l"
{
yyless(yyleng - 1);
yy_push_state(ST_VAR_OFFSET TSRMLS_CC);
@@ -2188,7 +2193,7 @@ yy116:
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 2192 "Zend/zend_language_scanner.c"
+#line 2197 "Zend/zend_language_scanner.c"
yy118:
YYDEBUG(118, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2206,7 +2211,7 @@ yy119:
++YYCURSOR;
YYDEBUG(120, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1855 "Zend/zend_language_scanner.l"
+#line 1865 "Zend/zend_language_scanner.l"
{
yyless(yyleng - 3);
yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC);
@@ -2214,7 +2219,7 @@ yy119:
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 2218 "Zend/zend_language_scanner.c"
+#line 2223 "Zend/zend_language_scanner.c"
}
/* *********************************** */
yyc_ST_IN_SCRIPTING:
@@ -2286,32 +2291,32 @@ yyc_ST_IN_SCRIPTING:
case 0x1C:
case 0x1D:
case 0x1E:
- case 0x1F: goto yy183;
+ case 0x1F: goto yy184;
case '\t':
case '\n':
case '\r':
- case ' ': goto yy139;
- case '!': goto yy152;
- case '"': goto yy179;
- case '#': goto yy175;
- case '$': goto yy164;
- case '%': goto yy158;
- case '&': goto yy159;
- case '\'': goto yy177;
- case '(': goto yy146;
+ case ' ': goto yy140;
+ case '!': goto yy153;
+ case '"': goto yy180;
+ case '#': goto yy176;
+ case '$': goto yy165;
+ case '%': goto yy159;
+ case '&': goto yy160;
+ case '\'': goto yy178;
+ case '(': goto yy147;
case ')':
case ',':
case ';':
case '@':
case '[':
case ']':
- case '~': goto yy165;
- case '*': goto yy155;
- case '+': goto yy151;
- case '-': goto yy137;
- case '.': goto yy157;
- case '/': goto yy156;
- case '0': goto yy171;
+ case '~': goto yy166;
+ case '*': goto yy156;
+ case '+': goto yy152;
+ case '-': goto yy138;
+ case '.': goto yy158;
+ case '/': goto yy157;
+ case '0': goto yy172;
case '1':
case '2':
case '3':
@@ -2320,16 +2325,16 @@ yyc_ST_IN_SCRIPTING:
case '6':
case '7':
case '8':
- case '9': goto yy173;
- case ':': goto yy141;
- case '<': goto yy153;
- case '=': goto yy149;
- case '>': goto yy154;
- case '?': goto yy166;
+ case '9': goto yy174;
+ case ':': goto yy142;
+ case '<': goto yy154;
+ case '=': goto yy150;
+ case '>': goto yy155;
+ case '?': goto yy167;
case 'A':
- case 'a': goto yy132;
+ case 'a': goto yy133;
case 'B':
- case 'b': goto yy134;
+ case 'b': goto yy135;
case 'C':
case 'c': goto yy127;
case 'D':
@@ -2339,39 +2344,41 @@ yyc_ST_IN_SCRIPTING:
case 'F':
case 'f': goto yy126;
case 'G':
- case 'g': goto yy135;
+ case 'g': goto yy136;
case 'I':
- case 'i': goto yy130;
+ case 'i': goto yy131;
case 'L':
- case 'l': goto yy150;
+ case 'l': goto yy151;
case 'N':
- case 'n': goto yy144;
+ case 'n': goto yy145;
case 'O':
- case 'o': goto yy162;
+ case 'o': goto yy163;
case 'P':
- case 'p': goto yy136;
+ case 'p': goto yy137;
case 'R':
case 'r': goto yy128;
case 'S':
- case 's': goto yy133;
+ case 's': goto yy134;
case 'T':
- case 't': goto yy129;
+ case 't': goto yy130;
case 'U':
- case 'u': goto yy147;
+ case 'u': goto yy148;
case 'V':
- case 'v': goto yy145;
+ case 'v': goto yy146;
case 'W':
- case 'w': goto yy131;
+ case 'w': goto yy132;
case 'X':
- case 'x': goto yy163;
- case '\\': goto yy142;
- case '^': goto yy161;
- case '_': goto yy148;
- case '`': goto yy181;
- case '{': goto yy167;
- case '|': goto yy160;
- case '}': goto yy169;
- default: goto yy174;
+ case 'x': goto yy164;
+ case 'Y':
+ case 'y': goto yy129;
+ case '\\': goto yy143;
+ case '^': goto yy162;
+ case '_': goto yy149;
+ case '`': goto yy182;
+ case '{': goto yy168;
+ case '|': goto yy161;
+ case '}': goto yy170;
+ default: goto yy175;
}
yy123:
YYDEBUG(123, *YYCURSOR);
@@ -2379,49 +2386,49 @@ yy123:
YYDEBUG(-1, yych);
switch ((yych = *YYCURSOR)) {
case 'C':
- case 'c': goto yy726;
+ case 'c': goto yy735;
case 'L':
- case 'l': goto yy727;
+ case 'l': goto yy736;
case 'M':
- case 'm': goto yy728;
+ case 'm': goto yy737;
case 'N':
- case 'n': goto yy729;
+ case 'n': goto yy738;
case 'V':
- case 'v': goto yy730;
+ case 'v': goto yy739;
case 'X':
- case 'x': goto yy731;
- default: goto yy186;
+ case 'x': goto yy740;
+ default: goto yy187;
}
yy124:
YYDEBUG(124, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1896 "Zend/zend_language_scanner.l"
+#line 1906 "Zend/zend_language_scanner.l"
{
zend_copy_value(zendlval, yytext, yyleng);
zendlval->type = IS_STRING;
return T_STRING;
}
-#line 2405 "Zend/zend_language_scanner.c"
+#line 2412 "Zend/zend_language_scanner.c"
yy125:
YYDEBUG(125, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'O') {
if (yych <= 'H') {
- if (yych == 'E') goto yy708;
- goto yy186;
+ if (yych == 'E') goto yy717;
+ goto yy187;
} else {
- if (yych <= 'I') goto yy709;
- if (yych <= 'N') goto yy186;
- goto yy710;
+ if (yych <= 'I') goto yy718;
+ if (yych <= 'N') goto yy187;
+ goto yy719;
}
} else {
if (yych <= 'h') {
- if (yych == 'e') goto yy708;
- goto yy186;
+ if (yych == 'e') goto yy717;
+ goto yy187;
} else {
- if (yych <= 'i') goto yy709;
- if (yych == 'o') goto yy710;
- goto yy186;
+ if (yych <= 'i') goto yy718;
+ if (yych == 'o') goto yy719;
+ goto yy187;
}
}
yy126:
@@ -2429,21 +2436,21 @@ yy126:
yych = *++YYCURSOR;
if (yych <= 'U') {
if (yych <= 'N') {
- if (yych == 'I') goto yy687;
- goto yy186;
+ if (yych == 'I') goto yy693;
+ goto yy187;
} else {
- if (yych <= 'O') goto yy688;
- if (yych <= 'T') goto yy186;
- goto yy689;
+ if (yych <= 'O') goto yy694;
+ if (yych <= 'T') goto yy187;
+ goto yy695;
}
} else {
if (yych <= 'n') {
- if (yych == 'i') goto yy687;
- goto yy186;
+ if (yych == 'i') goto yy693;
+ goto yy187;
} else {
- if (yych <= 'o') goto yy688;
- if (yych == 'u') goto yy689;
- goto yy186;
+ if (yych <= 'o') goto yy694;
+ if (yych == 'u') goto yy695;
+ goto yy187;
}
}
yy127:
@@ -2451,196 +2458,202 @@ yy127:
yych = *++YYCURSOR;
if (yych <= 'O') {
if (yych <= 'K') {
- if (yych == 'A') goto yy652;
- goto yy186;
+ if (yych == 'A') goto yy658;
+ goto yy187;
} else {
- if (yych <= 'L') goto yy653;
- if (yych <= 'N') goto yy186;
- goto yy654;
+ if (yych <= 'L') goto yy659;
+ if (yych <= 'N') goto yy187;
+ goto yy660;
}
} else {
if (yych <= 'k') {
- if (yych == 'a') goto yy652;
- goto yy186;
+ if (yych == 'a') goto yy658;
+ goto yy187;
} else {
- if (yych <= 'l') goto yy653;
- if (yych == 'o') goto yy654;
- goto yy186;
+ if (yych <= 'l') goto yy659;
+ if (yych == 'o') goto yy660;
+ goto yy187;
}
}
yy128:
YYDEBUG(128, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy634;
- if (yych == 'e') goto yy634;
- goto yy186;
+ if (yych == 'E') goto yy640;
+ if (yych == 'e') goto yy640;
+ goto yy187;
yy129:
YYDEBUG(129, *YYCURSOR);
yych = *++YYCURSOR;
+ if (yych == 'I') goto yy635;
+ if (yych == 'i') goto yy635;
+ goto yy187;
+yy130:
+ YYDEBUG(130, *YYCURSOR);
+ yych = *++YYCURSOR;
if (yych <= 'R') {
- if (yych == 'H') goto yy622;
- if (yych <= 'Q') goto yy186;
- goto yy623;
+ if (yych == 'H') goto yy623;
+ if (yych <= 'Q') goto yy187;
+ goto yy624;
} else {
if (yych <= 'h') {
- if (yych <= 'g') goto yy186;
- goto yy622;
+ if (yych <= 'g') goto yy187;
+ goto yy623;
} else {
- if (yych == 'r') goto yy623;
- goto yy186;
+ if (yych == 'r') goto yy624;
+ goto yy187;
}
}
-yy130:
- YYDEBUG(130, *YYCURSOR);
+yy131:
+ YYDEBUG(131, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'S') {
if (yych <= 'L') {
- if (yych == 'F') goto yy569;
- goto yy186;
+ if (yych == 'F') goto yy570;
+ goto yy187;
} else {
- if (yych <= 'M') goto yy571;
- if (yych <= 'N') goto yy572;
- if (yych <= 'R') goto yy186;
- goto yy573;
+ if (yych <= 'M') goto yy572;
+ if (yych <= 'N') goto yy573;
+ if (yych <= 'R') goto yy187;
+ goto yy574;
}
} else {
if (yych <= 'm') {
- if (yych == 'f') goto yy569;
- if (yych <= 'l') goto yy186;
- goto yy571;
+ if (yych == 'f') goto yy570;
+ if (yych <= 'l') goto yy187;
+ goto yy572;
} else {
- if (yych <= 'n') goto yy572;
- if (yych == 's') goto yy573;
- goto yy186;
+ if (yych <= 'n') goto yy573;
+ if (yych == 's') goto yy574;
+ goto yy187;
}
}
-yy131:
- YYDEBUG(131, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'H') goto yy564;
- if (yych == 'h') goto yy564;
- goto yy186;
yy132:
YYDEBUG(132, *YYCURSOR);
yych = *++YYCURSOR;
+ if (yych == 'H') goto yy565;
+ if (yych == 'h') goto yy565;
+ goto yy187;
+yy133:
+ YYDEBUG(133, *YYCURSOR);
+ yych = *++YYCURSOR;
if (yych <= 'S') {
if (yych <= 'M') {
- if (yych == 'B') goto yy546;
- goto yy186;
+ if (yych == 'B') goto yy547;
+ goto yy187;
} else {
- if (yych <= 'N') goto yy547;
- if (yych <= 'Q') goto yy186;
- if (yych <= 'R') goto yy548;
- goto yy549;
+ if (yych <= 'N') goto yy548;
+ if (yych <= 'Q') goto yy187;
+ if (yych <= 'R') goto yy549;
+ goto yy550;
}
} else {
if (yych <= 'n') {
- if (yych == 'b') goto yy546;
- if (yych <= 'm') goto yy186;
- goto yy547;
+ if (yych == 'b') goto yy547;
+ if (yych <= 'm') goto yy187;
+ goto yy548;
} else {
- if (yych <= 'q') goto yy186;
- if (yych <= 'r') goto yy548;
- if (yych <= 's') goto yy549;
- goto yy186;
+ if (yych <= 'q') goto yy187;
+ if (yych <= 'r') goto yy549;
+ if (yych <= 's') goto yy550;
+ goto yy187;
}
}
-yy133:
- YYDEBUG(133, *YYCURSOR);
+yy134:
+ YYDEBUG(134, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'W') {
- if (yych == 'T') goto yy534;
- if (yych <= 'V') goto yy186;
- goto yy535;
+ if (yych == 'T') goto yy535;
+ if (yych <= 'V') goto yy187;
+ goto yy536;
} else {
if (yych <= 't') {
- if (yych <= 's') goto yy186;
- goto yy534;
+ if (yych <= 's') goto yy187;
+ goto yy535;
} else {
- if (yych == 'w') goto yy535;
- goto yy186;
+ if (yych == 'w') goto yy536;
+ goto yy187;
}
}
-yy134:
- YYDEBUG(134, *YYCURSOR);
+yy135:
+ YYDEBUG(135, *YYCURSOR);
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= ';') {
if (yych <= '"') {
- if (yych <= '!') goto yy186;
- goto yy526;
+ if (yych <= '!') goto yy187;
+ goto yy527;
} else {
- if (yych == '\'') goto yy527;
- goto yy186;
+ if (yych == '\'') goto yy528;
+ goto yy187;
}
} else {
if (yych <= 'R') {
- if (yych <= '<') goto yy525;
- if (yych <= 'Q') goto yy186;
- goto yy528;
+ if (yych <= '<') goto yy526;
+ if (yych <= 'Q') goto yy187;
+ goto yy529;
} else {
- if (yych == 'r') goto yy528;
- goto yy186;
+ if (yych == 'r') goto yy529;
+ goto yy187;
}
}
-yy135:
- YYDEBUG(135, *YYCURSOR);
+yy136:
+ YYDEBUG(136, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'O') {
- if (yych == 'L') goto yy515;
- if (yych <= 'N') goto yy186;
- goto yy516;
+ if (yych == 'L') goto yy516;
+ if (yych <= 'N') goto yy187;
+ goto yy517;
} else {
if (yych <= 'l') {
- if (yych <= 'k') goto yy186;
- goto yy515;
+ if (yych <= 'k') goto yy187;
+ goto yy516;
} else {
- if (yych == 'o') goto yy516;
- goto yy186;
+ if (yych == 'o') goto yy517;
+ goto yy187;
}
}
-yy136:
- YYDEBUG(136, *YYCURSOR);
+yy137:
+ YYDEBUG(137, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'U') {
- if (yych == 'R') goto yy491;
- if (yych <= 'T') goto yy186;
- goto yy492;
+ if (yych == 'R') goto yy492;
+ if (yych <= 'T') goto yy187;
+ goto yy493;
} else {
if (yych <= 'r') {
- if (yych <= 'q') goto yy186;
- goto yy491;
+ if (yych <= 'q') goto yy187;
+ goto yy492;
} else {
- if (yych == 'u') goto yy492;
- goto yy186;
+ if (yych == 'u') goto yy493;
+ goto yy187;
}
}
-yy137:
- YYDEBUG(137, *YYCURSOR);
+yy138:
+ YYDEBUG(138, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) <= '<') {
- if (yych == '-') goto yy487;
+ if (yych == '-') goto yy488;
} else {
- if (yych <= '=') goto yy485;
- if (yych <= '>') goto yy489;
+ if (yych <= '=') goto yy486;
+ if (yych <= '>') goto yy490;
}
-yy138:
- YYDEBUG(138, *YYCURSOR);
+yy139:
+ YYDEBUG(139, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1438 "Zend/zend_language_scanner.l"
+#line 1448 "Zend/zend_language_scanner.l"
{
return yytext[0];
}
-#line 2635 "Zend/zend_language_scanner.c"
-yy139:
- YYDEBUG(139, *YYCURSOR);
- ++YYCURSOR;
- yych = *YYCURSOR;
- goto yy484;
+#line 2648 "Zend/zend_language_scanner.c"
yy140:
YYDEBUG(140, *YYCURSOR);
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+ goto yy485;
+yy141:
+ YYDEBUG(141, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1169 "Zend/zend_language_scanner.l"
+#line 1179 "Zend/zend_language_scanner.l"
{
zendlval->value.str.val = yytext; /* no copying - intentional */
zendlval->value.str.len = yyleng;
@@ -2648,261 +2661,261 @@ yy140:
HANDLE_NEWLINES(yytext, yyleng);
return T_WHITESPACE;
}
-#line 2652 "Zend/zend_language_scanner.c"
-yy141:
- YYDEBUG(141, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == ':') goto yy481;
- goto yy138;
+#line 2665 "Zend/zend_language_scanner.c"
yy142:
YYDEBUG(142, *YYCURSOR);
- ++YYCURSOR;
+ yych = *++YYCURSOR;
+ if (yych == ':') goto yy482;
+ goto yy139;
+yy143:
YYDEBUG(143, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(144, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1198 "Zend/zend_language_scanner.l"
+#line 1208 "Zend/zend_language_scanner.l"
{
return T_NS_SEPARATOR;
}
-#line 2667 "Zend/zend_language_scanner.c"
-yy144:
- YYDEBUG(144, *YYCURSOR);
+#line 2680 "Zend/zend_language_scanner.c"
+yy145:
+ YYDEBUG(145, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'E') {
- if (yych == 'A') goto yy469;
- if (yych <= 'D') goto yy186;
- goto yy470;
+ if (yych == 'A') goto yy470;
+ if (yych <= 'D') goto yy187;
+ goto yy471;
} else {
if (yych <= 'a') {
- if (yych <= '`') goto yy186;
- goto yy469;
+ if (yych <= '`') goto yy187;
+ goto yy470;
} else {
- if (yych == 'e') goto yy470;
- goto yy186;
+ if (yych == 'e') goto yy471;
+ goto yy187;
}
}
-yy145:
- YYDEBUG(145, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'A') goto yy466;
- if (yych == 'a') goto yy466;
- goto yy186;
yy146:
YYDEBUG(146, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'A') goto yy467;
+ if (yych == 'a') goto yy467;
+ goto yy187;
+yy147:
+ YYDEBUG(147, *YYCURSOR);
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= 'S') {
if (yych <= 'D') {
if (yych <= ' ') {
- if (yych == '\t') goto yy391;
- if (yych <= 0x1F) goto yy138;
- goto yy391;
+ if (yych == '\t') goto yy392;
+ if (yych <= 0x1F) goto yy139;
+ goto yy392;
} else {
- if (yych <= '@') goto yy138;
- if (yych == 'C') goto yy138;
- goto yy391;
+ if (yych <= '@') goto yy139;
+ if (yych == 'C') goto yy139;
+ goto yy392;
}
} else {
if (yych <= 'I') {
- if (yych == 'F') goto yy391;
- if (yych <= 'H') goto yy138;
- goto yy391;
+ if (yych == 'F') goto yy392;
+ if (yych <= 'H') goto yy139;
+ goto yy392;
} else {
- if (yych == 'O') goto yy391;
- if (yych <= 'Q') goto yy138;
- goto yy391;
+ if (yych == 'O') goto yy392;
+ if (yych <= 'Q') goto yy139;
+ goto yy392;
}
}
} else {
if (yych <= 'f') {
if (yych <= 'b') {
- if (yych == 'U') goto yy391;
- if (yych <= '`') goto yy138;
- goto yy391;
+ if (yych == 'U') goto yy392;
+ if (yych <= '`') goto yy139;
+ goto yy392;
} else {
- if (yych == 'd') goto yy391;
- if (yych <= 'e') goto yy138;
- goto yy391;
+ if (yych == 'd') goto yy392;
+ if (yych <= 'e') goto yy139;
+ goto yy392;
}
} else {
if (yych <= 'o') {
- if (yych == 'i') goto yy391;
- if (yych <= 'n') goto yy138;
- goto yy391;
+ if (yych == 'i') goto yy392;
+ if (yych <= 'n') goto yy139;
+ goto yy392;
} else {
if (yych <= 's') {
- if (yych <= 'q') goto yy138;
- goto yy391;
+ if (yych <= 'q') goto yy139;
+ goto yy392;
} else {
- if (yych == 'u') goto yy391;
- goto yy138;
+ if (yych == 'u') goto yy392;
+ goto yy139;
}
}
}
}
-yy147:
- YYDEBUG(147, *YYCURSOR);
+yy148:
+ YYDEBUG(148, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'S') {
- if (yych == 'N') goto yy382;
- if (yych <= 'R') goto yy186;
- goto yy383;
+ if (yych == 'N') goto yy383;
+ if (yych <= 'R') goto yy187;
+ goto yy384;
} else {
if (yych <= 'n') {
- if (yych <= 'm') goto yy186;
- goto yy382;
+ if (yych <= 'm') goto yy187;
+ goto yy383;
} else {
- if (yych == 's') goto yy383;
- goto yy186;
+ if (yych == 's') goto yy384;
+ goto yy187;
}
}
-yy148:
- YYDEBUG(148, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == '_') goto yy300;
- goto yy186;
yy149:
YYDEBUG(149, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych <= '<') goto yy138;
- if (yych <= '=') goto yy294;
- if (yych <= '>') goto yy296;
- goto yy138;
+ if (yych == '_') goto yy301;
+ goto yy187;
yy150:
YYDEBUG(150, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy290;
- if (yych == 'i') goto yy290;
- goto yy186;
+ if (yych <= '<') goto yy139;
+ if (yych <= '=') goto yy295;
+ if (yych <= '>') goto yy297;
+ goto yy139;
yy151:
YYDEBUG(151, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '+') goto yy288;
- if (yych == '=') goto yy286;
- goto yy138;
+ if (yych == 'I') goto yy291;
+ if (yych == 'i') goto yy291;
+ goto yy187;
yy152:
YYDEBUG(152, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '=') goto yy283;
- goto yy138;
+ if (yych == '+') goto yy289;
+ if (yych == '=') goto yy287;
+ goto yy139;
yy153:
YYDEBUG(153, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == '=') goto yy284;
+ goto yy139;
+yy154:
+ YYDEBUG(154, *YYCURSOR);
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= ';') {
- if (yych == '/') goto yy255;
- goto yy138;
+ if (yych == '/') goto yy256;
+ goto yy139;
} else {
- if (yych <= '<') goto yy253;
- if (yych <= '=') goto yy256;
- if (yych <= '>') goto yy258;
- goto yy138;
+ if (yych <= '<') goto yy254;
+ if (yych <= '=') goto yy257;
+ if (yych <= '>') goto yy259;
+ goto yy139;
}
-yy154:
- YYDEBUG(154, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych <= '<') goto yy138;
- if (yych <= '=') goto yy249;
- if (yych <= '>') goto yy247;
- goto yy138;
yy155:
YYDEBUG(155, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '=') goto yy245;
- goto yy138;
+ if (yych <= '<') goto yy139;
+ if (yych <= '=') goto yy250;
+ if (yych <= '>') goto yy248;
+ goto yy139;
yy156:
YYDEBUG(156, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych <= '.') {
- if (yych == '*') goto yy237;
- goto yy138;
- } else {
- if (yych <= '/') goto yy239;
- if (yych == '=') goto yy240;
- goto yy138;
- }
+ if (yych == '=') goto yy246;
+ goto yy139;
yy157:
YYDEBUG(157, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych <= '/') goto yy138;
- if (yych <= '9') goto yy233;
- if (yych == '=') goto yy235;
- goto yy138;
+ if (yych <= '.') {
+ if (yych == '*') goto yy238;
+ goto yy139;
+ } else {
+ if (yych <= '/') goto yy240;
+ if (yych == '=') goto yy241;
+ goto yy139;
+ }
yy158:
YYDEBUG(158, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych <= '<') goto yy138;
- if (yych <= '=') goto yy229;
- if (yych <= '>') goto yy227;
- goto yy138;
+ if (yych <= '/') goto yy139;
+ if (yych <= '9') goto yy234;
+ if (yych == '=') goto yy236;
+ goto yy139;
yy159:
YYDEBUG(159, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '&') goto yy223;
- if (yych == '=') goto yy225;
- goto yy138;
+ if (yych <= '<') goto yy139;
+ if (yych <= '=') goto yy230;
+ if (yych <= '>') goto yy228;
+ goto yy139;
yy160:
YYDEBUG(160, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '=') goto yy221;
- if (yych == '|') goto yy219;
- goto yy138;
+ if (yych == '&') goto yy224;
+ if (yych == '=') goto yy226;
+ goto yy139;
yy161:
YYDEBUG(161, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '=') goto yy217;
- goto yy138;
+ if (yych == '=') goto yy222;
+ if (yych == '|') goto yy220;
+ goto yy139;
yy162:
YYDEBUG(162, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy215;
- if (yych == 'r') goto yy215;
- goto yy186;
+ if (yych == '=') goto yy218;
+ goto yy139;
yy163:
YYDEBUG(163, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy212;
- if (yych == 'o') goto yy212;
- goto yy186;
+ if (yych == 'R') goto yy216;
+ if (yych == 'r') goto yy216;
+ goto yy187;
yy164:
YYDEBUG(164, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych <= '_') {
- if (yych <= '@') goto yy138;
- if (yych <= 'Z') goto yy209;
- if (yych <= '^') goto yy138;
- goto yy209;
- } else {
- if (yych <= '`') goto yy138;
- if (yych <= 'z') goto yy209;
- if (yych <= '~') goto yy138;
- goto yy209;
- }
+ if (yych == 'O') goto yy213;
+ if (yych == 'o') goto yy213;
+ goto yy187;
yy165:
YYDEBUG(165, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy138;
+ if (yych <= '_') {
+ if (yych <= '@') goto yy139;
+ if (yych <= 'Z') goto yy210;
+ if (yych <= '^') goto yy139;
+ goto yy210;
+ } else {
+ if (yych <= '`') goto yy139;
+ if (yych <= 'z') goto yy210;
+ if (yych <= '~') goto yy139;
+ goto yy210;
+ }
yy166:
YYDEBUG(166, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '>') goto yy205;
- goto yy138;
+ goto yy139;
yy167:
YYDEBUG(167, *YYCURSOR);
- ++YYCURSOR;
+ yych = *++YYCURSOR;
+ if (yych == '>') goto yy206;
+ goto yy139;
+yy168:
YYDEBUG(168, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(169, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1443 "Zend/zend_language_scanner.l"
+#line 1453 "Zend/zend_language_scanner.l"
{
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
return '{';
}
-#line 2900 "Zend/zend_language_scanner.c"
-yy169:
- YYDEBUG(169, *YYCURSOR);
- ++YYCURSOR;
+#line 2913 "Zend/zend_language_scanner.c"
+yy170:
YYDEBUG(170, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(171, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1455 "Zend/zend_language_scanner.l"
+#line 1465 "Zend/zend_language_scanner.l"
{
RESET_DOC_COMMENT();
if (!zend_stack_is_empty(&SCNG(state_stack))) {
@@ -2910,35 +2923,35 @@ yy169:
}
return '}';
}
-#line 2914 "Zend/zend_language_scanner.c"
-yy171:
- YYDEBUG(171, *YYCURSOR);
+#line 2927 "Zend/zend_language_scanner.c"
+yy172:
+ YYDEBUG(172, *YYCURSOR);
yyaccept = 2;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= 'E') {
if (yych <= '9') {
- if (yych == '.') goto yy187;
- if (yych >= '0') goto yy190;
+ if (yych == '.') goto yy188;
+ if (yych >= '0') goto yy191;
} else {
- if (yych == 'B') goto yy198;
- if (yych >= 'E') goto yy192;
+ if (yych == 'B') goto yy199;
+ if (yych >= 'E') goto yy193;
}
} else {
if (yych <= 'b') {
- if (yych == 'X') goto yy197;
- if (yych >= 'b') goto yy198;
+ if (yych == 'X') goto yy198;
+ if (yych >= 'b') goto yy199;
} else {
if (yych <= 'e') {
- if (yych >= 'e') goto yy192;
+ if (yych >= 'e') goto yy193;
} else {
- if (yych == 'x') goto yy197;
+ if (yych == 'x') goto yy198;
}
}
}
-yy172:
- YYDEBUG(172, *YYCURSOR);
+yy173:
+ YYDEBUG(173, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1506 "Zend/zend_language_scanner.l"
+#line 1516 "Zend/zend_language_scanner.l"
{
if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */
zendlval->value.lval = strtol(yytext, NULL, 0);
@@ -2959,35 +2972,35 @@ yy172:
zendlval->type = IS_LONG;
return T_LNUMBER;
}
-#line 2963 "Zend/zend_language_scanner.c"
-yy173:
- YYDEBUG(173, *YYCURSOR);
+#line 2976 "Zend/zend_language_scanner.c"
+yy174:
+ YYDEBUG(174, *YYCURSOR);
yyaccept = 2;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '9') {
- if (yych == '.') goto yy187;
- if (yych <= '/') goto yy172;
- goto yy190;
+ if (yych == '.') goto yy188;
+ if (yych <= '/') goto yy173;
+ goto yy191;
} else {
if (yych <= 'E') {
- if (yych <= 'D') goto yy172;
- goto yy192;
+ if (yych <= 'D') goto yy173;
+ goto yy193;
} else {
- if (yych == 'e') goto yy192;
- goto yy172;
+ if (yych == 'e') goto yy193;
+ goto yy173;
}
}
-yy174:
- YYDEBUG(174, *YYCURSOR);
- yych = *++YYCURSOR;
- goto yy186;
yy175:
YYDEBUG(175, *YYCURSOR);
- ++YYCURSOR;
+ yych = *++YYCURSOR;
+ goto yy187;
yy176:
YYDEBUG(176, *YYCURSOR);
+ ++YYCURSOR;
+yy177:
+ YYDEBUG(177, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1903 "Zend/zend_language_scanner.l"
+#line 1913 "Zend/zend_language_scanner.l"
{
while (YYCURSOR < YYLIMIT) {
switch (*YYCURSOR++) {
@@ -3021,14 +3034,14 @@ yy176:
return T_COMMENT;
}
-#line 3025 "Zend/zend_language_scanner.c"
-yy177:
- YYDEBUG(177, *YYCURSOR);
- ++YYCURSOR;
+#line 3038 "Zend/zend_language_scanner.c"
yy178:
YYDEBUG(178, *YYCURSOR);
+ ++YYCURSOR;
+yy179:
+ YYDEBUG(179, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1994 "Zend/zend_language_scanner.l"
+#line 2004 "Zend/zend_language_scanner.l"
{
register char *s, *t;
char *end;
@@ -3096,14 +3109,14 @@ yy178:
}
return T_CONSTANT_ENCAPSED_STRING;
}
-#line 3100 "Zend/zend_language_scanner.c"
-yy179:
- YYDEBUG(179, *YYCURSOR);
- ++YYCURSOR;
+#line 3113 "Zend/zend_language_scanner.c"
yy180:
YYDEBUG(180, *YYCURSOR);
+ ++YYCURSOR;
+yy181:
+ YYDEBUG(181, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2063 "Zend/zend_language_scanner.l"
+#line 2073 "Zend/zend_language_scanner.l"
{
int bprefix = (yytext[0] != '"') ? 1 : 0;
@@ -3144,24 +3157,24 @@ yy180:
BEGIN(ST_DOUBLE_QUOTES);
return '"';
}
-#line 3148 "Zend/zend_language_scanner.c"
-yy181:
- YYDEBUG(181, *YYCURSOR);
- ++YYCURSOR;
+#line 3161 "Zend/zend_language_scanner.c"
+yy182:
YYDEBUG(182, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(183, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2154 "Zend/zend_language_scanner.l"
+#line 2163 "Zend/zend_language_scanner.l"
{
BEGIN(ST_BACKQUOTE);
return '`';
}
-#line 3159 "Zend/zend_language_scanner.c"
-yy183:
- YYDEBUG(183, *YYCURSOR);
- ++YYCURSOR;
+#line 3172 "Zend/zend_language_scanner.c"
+yy184:
YYDEBUG(184, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(185, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2412 "Zend/zend_language_scanner.l"
+#line 2426 "Zend/zend_language_scanner.l"
{
if (YYCURSOR > YYLIMIT) {
return 0;
@@ -3170,132 +3183,132 @@ yy183:
zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE);
goto restart;
}
-#line 3174 "Zend/zend_language_scanner.c"
-yy185:
- YYDEBUG(185, *YYCURSOR);
+#line 3187 "Zend/zend_language_scanner.c"
+yy186:
+ YYDEBUG(186, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy186:
- YYDEBUG(186, *YYCURSOR);
+yy187:
+ YYDEBUG(187, *YYCURSOR);
if (yybm[0+yych] & 4) {
- goto yy185;
+ goto yy186;
}
goto yy124;
-yy187:
- YYDEBUG(187, *YYCURSOR);
+yy188:
+ YYDEBUG(188, *YYCURSOR);
yyaccept = 3;
YYMARKER = ++YYCURSOR;
YYFILL(3);
yych = *YYCURSOR;
- YYDEBUG(188, *YYCURSOR);
+ YYDEBUG(189, *YYCURSOR);
if (yybm[0+yych] & 8) {
- goto yy187;
+ goto yy188;
}
- if (yych == 'E') goto yy192;
- if (yych == 'e') goto yy192;
-yy189:
- YYDEBUG(189, *YYCURSOR);
+ if (yych == 'E') goto yy193;
+ if (yych == 'e') goto yy193;
+yy190:
+ YYDEBUG(190, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1571 "Zend/zend_language_scanner.l"
+#line 1581 "Zend/zend_language_scanner.l"
{
zendlval->value.dval = zend_strtod(yytext, NULL);
zendlval->type = IS_DOUBLE;
return T_DNUMBER;
}
-#line 3207 "Zend/zend_language_scanner.c"
-yy190:
- YYDEBUG(190, *YYCURSOR);
+#line 3220 "Zend/zend_language_scanner.c"
+yy191:
+ YYDEBUG(191, *YYCURSOR);
yyaccept = 2;
YYMARKER = ++YYCURSOR;
YYFILL(3);
yych = *YYCURSOR;
- YYDEBUG(191, *YYCURSOR);
+ YYDEBUG(192, *YYCURSOR);
if (yych <= '9') {
- if (yych == '.') goto yy187;
- if (yych <= '/') goto yy172;
- goto yy190;
+ if (yych == '.') goto yy188;
+ if (yych <= '/') goto yy173;
+ goto yy191;
} else {
if (yych <= 'E') {
- if (yych <= 'D') goto yy172;
+ if (yych <= 'D') goto yy173;
} else {
- if (yych != 'e') goto yy172;
+ if (yych != 'e') goto yy173;
}
}
-yy192:
- YYDEBUG(192, *YYCURSOR);
+yy193:
+ YYDEBUG(193, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= ',') {
- if (yych == '+') goto yy194;
+ if (yych == '+') goto yy195;
} else {
- if (yych <= '-') goto yy194;
- if (yych <= '/') goto yy193;
- if (yych <= '9') goto yy195;
+ if (yych <= '-') goto yy195;
+ if (yych <= '/') goto yy194;
+ if (yych <= '9') goto yy196;
}
-yy193:
- YYDEBUG(193, *YYCURSOR);
+yy194:
+ YYDEBUG(194, *YYCURSOR);
YYCURSOR = YYMARKER;
if (yyaccept <= 2) {
if (yyaccept <= 1) {
if (yyaccept <= 0) {
goto yy124;
} else {
- goto yy138;
+ goto yy139;
}
} else {
- goto yy172;
+ goto yy173;
}
} else {
if (yyaccept <= 4) {
if (yyaccept <= 3) {
- goto yy189;
+ goto yy190;
} else {
- goto yy238;
+ goto yy239;
}
} else {
- goto yy254;
+ goto yy255;
}
}
-yy194:
- YYDEBUG(194, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych <= '/') goto yy193;
- if (yych >= ':') goto yy193;
yy195:
YYDEBUG(195, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych <= '/') goto yy194;
+ if (yych >= ':') goto yy194;
+yy196:
+ YYDEBUG(196, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(196, *YYCURSOR);
- if (yych <= '/') goto yy189;
- if (yych <= '9') goto yy195;
- goto yy189;
-yy197:
YYDEBUG(197, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yybm[0+yych] & 32) {
- goto yy202;
- }
- goto yy193;
+ if (yych <= '/') goto yy190;
+ if (yych <= '9') goto yy196;
+ goto yy190;
yy198:
YYDEBUG(198, *YYCURSOR);
yych = *++YYCURSOR;
- if (yybm[0+yych] & 16) {
- goto yy199;
+ if (yybm[0+yych] & 32) {
+ goto yy203;
}
- goto yy193;
+ goto yy194;
yy199:
YYDEBUG(199, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yybm[0+yych] & 16) {
+ goto yy200;
+ }
+ goto yy194;
+yy200:
+ YYDEBUG(200, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(200, *YYCURSOR);
+ YYDEBUG(201, *YYCURSOR);
if (yybm[0+yych] & 16) {
- goto yy199;
+ goto yy200;
}
- YYDEBUG(201, *YYCURSOR);
+ YYDEBUG(202, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1481 "Zend/zend_language_scanner.l"
+#line 1491 "Zend/zend_language_scanner.l"
{
char *bin = yytext + 2; /* Skip "0b" */
int len = yyleng - 2;
@@ -3320,19 +3333,19 @@ yy199:
return T_DNUMBER;
}
}
-#line 3324 "Zend/zend_language_scanner.c"
-yy202:
- YYDEBUG(202, *YYCURSOR);
+#line 3337 "Zend/zend_language_scanner.c"
+yy203:
+ YYDEBUG(203, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(203, *YYCURSOR);
+ YYDEBUG(204, *YYCURSOR);
if (yybm[0+yych] & 32) {
- goto yy202;
+ goto yy203;
}
- YYDEBUG(204, *YYCURSOR);
+ YYDEBUG(205, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1527 "Zend/zend_language_scanner.l"
+#line 1537 "Zend/zend_language_scanner.l"
{
char *hex = yytext + 2; /* Skip "0x" */
int len = yyleng - 2;
@@ -3357,16 +3370,16 @@ yy202:
return T_DNUMBER;
}
}
-#line 3361 "Zend/zend_language_scanner.c"
-yy205:
- YYDEBUG(205, *YYCURSOR);
- ++YYCURSOR;
- if ((yych = *YYCURSOR) == '\n') goto yy207;
- if (yych == '\r') goto yy208;
+#line 3374 "Zend/zend_language_scanner.c"
yy206:
YYDEBUG(206, *YYCURSOR);
+ ++YYCURSOR;
+ if ((yych = *YYCURSOR) == '\n') goto yy208;
+ if (yych == '\r') goto yy209;
+yy207:
+ YYDEBUG(207, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1971 "Zend/zend_language_scanner.l"
+#line 1981 "Zend/zend_language_scanner.l"
{
zendlval->value.str.val = yytext; /* no copying - intentional */
zendlval->value.str.len = yyleng;
@@ -3374,137 +3387,137 @@ yy206:
BEGIN(INITIAL);
return T_CLOSE_TAG; /* implicit ';' at php-end tag */
}
-#line 3378 "Zend/zend_language_scanner.c"
-yy207:
- YYDEBUG(207, *YYCURSOR);
- yych = *++YYCURSOR;
- goto yy206;
+#line 3391 "Zend/zend_language_scanner.c"
yy208:
YYDEBUG(208, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '\n') goto yy207;
- goto yy206;
+ goto yy207;
yy209:
YYDEBUG(209, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == '\n') goto yy208;
+ goto yy207;
+yy210:
+ YYDEBUG(210, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(210, *YYCURSOR);
+ YYDEBUG(211, *YYCURSOR);
if (yych <= '^') {
if (yych <= '9') {
- if (yych >= '0') goto yy209;
+ if (yych >= '0') goto yy210;
} else {
- if (yych <= '@') goto yy211;
- if (yych <= 'Z') goto yy209;
+ if (yych <= '@') goto yy212;
+ if (yych <= 'Z') goto yy210;
}
} else {
if (yych <= '`') {
- if (yych <= '_') goto yy209;
+ if (yych <= '_') goto yy210;
} else {
- if (yych <= 'z') goto yy209;
- if (yych >= 0x7F) goto yy209;
+ if (yych <= 'z') goto yy210;
+ if (yych >= 0x7F) goto yy210;
}
}
-yy211:
- YYDEBUG(211, *YYCURSOR);
+yy212:
+ YYDEBUG(212, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1873 "Zend/zend_language_scanner.l"
+#line 1883 "Zend/zend_language_scanner.l"
{
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 3418 "Zend/zend_language_scanner.c"
-yy212:
- YYDEBUG(212, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'R') goto yy213;
- if (yych != 'r') goto yy186;
+#line 3431 "Zend/zend_language_scanner.c"
yy213:
YYDEBUG(213, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'R') goto yy214;
+ if (yych != 'r') goto yy187;
+yy214:
+ YYDEBUG(214, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(214, *YYCURSOR);
+ YYDEBUG(215, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1426 "Zend/zend_language_scanner.l"
+#line 1436 "Zend/zend_language_scanner.l"
{
return T_LOGICAL_XOR;
}
-#line 3436 "Zend/zend_language_scanner.c"
-yy215:
- YYDEBUG(215, *YYCURSOR);
+#line 3449 "Zend/zend_language_scanner.c"
+yy216:
+ YYDEBUG(216, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(216, *YYCURSOR);
+ YYDEBUG(217, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1418 "Zend/zend_language_scanner.l"
+#line 1428 "Zend/zend_language_scanner.l"
{
return T_LOGICAL_OR;
}
-#line 3449 "Zend/zend_language_scanner.c"
-yy217:
- YYDEBUG(217, *YYCURSOR);
- ++YYCURSOR;
+#line 3462 "Zend/zend_language_scanner.c"
+yy218:
YYDEBUG(218, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(219, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1406 "Zend/zend_language_scanner.l"
+#line 1416 "Zend/zend_language_scanner.l"
{
return T_XOR_EQUAL;
}
-#line 3459 "Zend/zend_language_scanner.c"
-yy219:
- YYDEBUG(219, *YYCURSOR);
- ++YYCURSOR;
+#line 3472 "Zend/zend_language_scanner.c"
+yy220:
YYDEBUG(220, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(221, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1410 "Zend/zend_language_scanner.l"
+#line 1420 "Zend/zend_language_scanner.l"
{
return T_BOOLEAN_OR;
}
-#line 3469 "Zend/zend_language_scanner.c"
-yy221:
- YYDEBUG(221, *YYCURSOR);
- ++YYCURSOR;
+#line 3482 "Zend/zend_language_scanner.c"
+yy222:
YYDEBUG(222, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(223, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1402 "Zend/zend_language_scanner.l"
+#line 1412 "Zend/zend_language_scanner.l"
{
return T_OR_EQUAL;
}
-#line 3479 "Zend/zend_language_scanner.c"
-yy223:
- YYDEBUG(223, *YYCURSOR);
- ++YYCURSOR;
+#line 3492 "Zend/zend_language_scanner.c"
+yy224:
YYDEBUG(224, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(225, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1414 "Zend/zend_language_scanner.l"
+#line 1424 "Zend/zend_language_scanner.l"
{
return T_BOOLEAN_AND;
}
-#line 3489 "Zend/zend_language_scanner.c"
-yy225:
- YYDEBUG(225, *YYCURSOR);
- ++YYCURSOR;
+#line 3502 "Zend/zend_language_scanner.c"
+yy226:
YYDEBUG(226, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(227, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1398 "Zend/zend_language_scanner.l"
+#line 1408 "Zend/zend_language_scanner.l"
{
return T_AND_EQUAL;
}
-#line 3499 "Zend/zend_language_scanner.c"
-yy227:
- YYDEBUG(227, *YYCURSOR);
- ++YYCURSOR;
- if ((yych = *YYCURSOR) == '\n') goto yy231;
- if (yych == '\r') goto yy232;
+#line 3512 "Zend/zend_language_scanner.c"
yy228:
YYDEBUG(228, *YYCURSOR);
+ ++YYCURSOR;
+ if ((yych = *YYCURSOR) == '\n') goto yy232;
+ if (yych == '\r') goto yy233;
+yy229:
+ YYDEBUG(229, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1980 "Zend/zend_language_scanner.l"
+#line 1990 "Zend/zend_language_scanner.l"
{
if (CG(asp_tags)) {
BEGIN(INITIAL);
@@ -3517,61 +3530,61 @@ yy228:
return yytext[0];
}
}
-#line 3521 "Zend/zend_language_scanner.c"
-yy229:
- YYDEBUG(229, *YYCURSOR);
- ++YYCURSOR;
+#line 3534 "Zend/zend_language_scanner.c"
+yy230:
YYDEBUG(230, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(231, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1386 "Zend/zend_language_scanner.l"
+#line 1396 "Zend/zend_language_scanner.l"
{
return T_MOD_EQUAL;
}
-#line 3531 "Zend/zend_language_scanner.c"
-yy231:
- YYDEBUG(231, *YYCURSOR);
- yych = *++YYCURSOR;
- goto yy228;
+#line 3544 "Zend/zend_language_scanner.c"
yy232:
YYDEBUG(232, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '\n') goto yy231;
- goto yy228;
+ goto yy229;
yy233:
YYDEBUG(233, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == '\n') goto yy232;
+ goto yy229;
+yy234:
+ YYDEBUG(234, *YYCURSOR);
yyaccept = 3;
YYMARKER = ++YYCURSOR;
YYFILL(3);
yych = *YYCURSOR;
- YYDEBUG(234, *YYCURSOR);
+ YYDEBUG(235, *YYCURSOR);
if (yych <= 'D') {
- if (yych <= '/') goto yy189;
- if (yych <= '9') goto yy233;
- goto yy189;
+ if (yych <= '/') goto yy190;
+ if (yych <= '9') goto yy234;
+ goto yy190;
} else {
- if (yych <= 'E') goto yy192;
- if (yych == 'e') goto yy192;
- goto yy189;
+ if (yych <= 'E') goto yy193;
+ if (yych == 'e') goto yy193;
+ goto yy190;
}
-yy235:
- YYDEBUG(235, *YYCURSOR);
- ++YYCURSOR;
+yy236:
YYDEBUG(236, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(237, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1382 "Zend/zend_language_scanner.l"
+#line 1392 "Zend/zend_language_scanner.l"
{
return T_CONCAT_EQUAL;
}
-#line 3566 "Zend/zend_language_scanner.c"
-yy237:
- YYDEBUG(237, *YYCURSOR);
- yyaccept = 4;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych == '*') goto yy242;
+#line 3579 "Zend/zend_language_scanner.c"
yy238:
YYDEBUG(238, *YYCURSOR);
+ yyaccept = 4;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych == '*') goto yy243;
+yy239:
+ YYDEBUG(239, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1937 "Zend/zend_language_scanner.l"
+#line 1947 "Zend/zend_language_scanner.l"
{
int doc_com;
@@ -3605,316 +3618,313 @@ yy238:
return T_COMMENT;
}
-#line 3609 "Zend/zend_language_scanner.c"
-yy239:
- YYDEBUG(239, *YYCURSOR);
- yych = *++YYCURSOR;
- goto yy176;
+#line 3622 "Zend/zend_language_scanner.c"
yy240:
YYDEBUG(240, *YYCURSOR);
- ++YYCURSOR;
+ yych = *++YYCURSOR;
+ goto yy177;
+yy241:
YYDEBUG(241, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(242, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1378 "Zend/zend_language_scanner.l"
+#line 1388 "Zend/zend_language_scanner.l"
{
return T_DIV_EQUAL;
}
-#line 3623 "Zend/zend_language_scanner.c"
-yy242:
- YYDEBUG(242, *YYCURSOR);
+#line 3636 "Zend/zend_language_scanner.c"
+yy243:
+ YYDEBUG(243, *YYCURSOR);
yych = *++YYCURSOR;
if (yybm[0+yych] & 64) {
- goto yy243;
+ goto yy244;
}
- goto yy193;
-yy243:
- YYDEBUG(243, *YYCURSOR);
+ goto yy194;
+yy244:
+ YYDEBUG(244, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(244, *YYCURSOR);
+ YYDEBUG(245, *YYCURSOR);
if (yybm[0+yych] & 64) {
- goto yy243;
+ goto yy244;
}
- goto yy238;
-yy245:
- YYDEBUG(245, *YYCURSOR);
- ++YYCURSOR;
+ goto yy239;
+yy246:
YYDEBUG(246, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(247, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1374 "Zend/zend_language_scanner.l"
+#line 1384 "Zend/zend_language_scanner.l"
{
return T_MUL_EQUAL;
}
-#line 3650 "Zend/zend_language_scanner.c"
-yy247:
- YYDEBUG(247, *YYCURSOR);
- ++YYCURSOR;
- if ((yych = *YYCURSOR) == '=') goto yy251;
+#line 3663 "Zend/zend_language_scanner.c"
+yy248:
YYDEBUG(248, *YYCURSOR);
+ ++YYCURSOR;
+ if ((yych = *YYCURSOR) == '=') goto yy252;
+ YYDEBUG(249, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1434 "Zend/zend_language_scanner.l"
+#line 1444 "Zend/zend_language_scanner.l"
{
return T_SR;
}
-#line 3661 "Zend/zend_language_scanner.c"
-yy249:
- YYDEBUG(249, *YYCURSOR);
- ++YYCURSOR;
+#line 3674 "Zend/zend_language_scanner.c"
+yy250:
YYDEBUG(250, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(251, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1362 "Zend/zend_language_scanner.l"
+#line 1372 "Zend/zend_language_scanner.l"
{
return T_IS_GREATER_OR_EQUAL;
}
-#line 3671 "Zend/zend_language_scanner.c"
-yy251:
- YYDEBUG(251, *YYCURSOR);
- ++YYCURSOR;
+#line 3684 "Zend/zend_language_scanner.c"
+yy252:
YYDEBUG(252, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(253, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1394 "Zend/zend_language_scanner.l"
+#line 1404 "Zend/zend_language_scanner.l"
{
return T_SR_EQUAL;
}
-#line 3681 "Zend/zend_language_scanner.c"
-yy253:
- YYDEBUG(253, *YYCURSOR);
- yyaccept = 5;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= ';') goto yy254;
- if (yych <= '<') goto yy269;
- if (yych <= '=') goto yy267;
+#line 3694 "Zend/zend_language_scanner.c"
yy254:
YYDEBUG(254, *YYCURSOR);
+ yyaccept = 5;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= ';') goto yy255;
+ if (yych <= '<') goto yy270;
+ if (yych <= '=') goto yy268;
+yy255:
+ YYDEBUG(255, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1430 "Zend/zend_language_scanner.l"
+#line 1440 "Zend/zend_language_scanner.l"
{
return T_SL;
}
-#line 3696 "Zend/zend_language_scanner.c"
-yy255:
- YYDEBUG(255, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'S') goto yy260;
- if (yych == 's') goto yy260;
- goto yy193;
+#line 3709 "Zend/zend_language_scanner.c"
yy256:
YYDEBUG(256, *YYCURSOR);
- ++YYCURSOR;
+ yych = *++YYCURSOR;
+ if (yych == 'S') goto yy261;
+ if (yych == 's') goto yy261;
+ goto yy194;
+yy257:
YYDEBUG(257, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(258, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1358 "Zend/zend_language_scanner.l"
+#line 1368 "Zend/zend_language_scanner.l"
{
return T_IS_SMALLER_OR_EQUAL;
}
-#line 3712 "Zend/zend_language_scanner.c"
-yy258:
- YYDEBUG(258, *YYCURSOR);
- ++YYCURSOR;
+#line 3725 "Zend/zend_language_scanner.c"
yy259:
YYDEBUG(259, *YYCURSOR);
+ ++YYCURSOR;
+yy260:
+ YYDEBUG(260, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1354 "Zend/zend_language_scanner.l"
+#line 1364 "Zend/zend_language_scanner.l"
{
return T_IS_NOT_EQUAL;
}
-#line 3723 "Zend/zend_language_scanner.c"
-yy260:
- YYDEBUG(260, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'C') goto yy261;
- if (yych != 'c') goto yy193;
+#line 3736 "Zend/zend_language_scanner.c"
yy261:
YYDEBUG(261, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy262;
- if (yych != 'r') goto yy193;
+ if (yych == 'C') goto yy262;
+ if (yych != 'c') goto yy194;
yy262:
YYDEBUG(262, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy263;
- if (yych != 'i') goto yy193;
+ if (yych == 'R') goto yy263;
+ if (yych != 'r') goto yy194;
yy263:
YYDEBUG(263, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'P') goto yy264;
- if (yych != 'p') goto yy193;
+ if (yych == 'I') goto yy264;
+ if (yych != 'i') goto yy194;
yy264:
YYDEBUG(264, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy265;
- if (yych != 't') goto yy193;
+ if (yych == 'P') goto yy265;
+ if (yych != 'p') goto yy194;
yy265:
YYDEBUG(265, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'T') goto yy266;
+ if (yych != 't') goto yy194;
+yy266:
+ YYDEBUG(266, *YYCURSOR);
++YYCURSOR;
YYFILL(3);
yych = *YYCURSOR;
- YYDEBUG(266, *YYCURSOR);
+ YYDEBUG(267, *YYCURSOR);
if (yych <= '\r') {
- if (yych <= 0x08) goto yy193;
- if (yych <= '\n') goto yy265;
- if (yych <= '\f') goto yy193;
- goto yy265;
+ if (yych <= 0x08) goto yy194;
+ if (yych <= '\n') goto yy266;
+ if (yych <= '\f') goto yy194;
+ goto yy266;
} else {
if (yych <= ' ') {
- if (yych <= 0x1F) goto yy193;
- goto yy265;
+ if (yych <= 0x1F) goto yy194;
+ goto yy266;
} else {
- if (yych == '>') goto yy205;
- goto yy193;
+ if (yych == '>') goto yy206;
+ goto yy194;
}
}
-yy267:
- YYDEBUG(267, *YYCURSOR);
- ++YYCURSOR;
+yy268:
YYDEBUG(268, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(269, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1390 "Zend/zend_language_scanner.l"
+#line 1400 "Zend/zend_language_scanner.l"
{
return T_SL_EQUAL;
}
-#line 3778 "Zend/zend_language_scanner.c"
-yy269:
- YYDEBUG(269, *YYCURSOR);
+#line 3791 "Zend/zend_language_scanner.c"
+yy270:
+ YYDEBUG(270, *YYCURSOR);
++YYCURSOR;
YYFILL(2);
yych = *YYCURSOR;
- YYDEBUG(270, *YYCURSOR);
+ YYDEBUG(271, *YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy269;
+ goto yy270;
}
if (yych <= 'Z') {
if (yych <= '&') {
- if (yych == '"') goto yy274;
- goto yy193;
+ if (yych == '"') goto yy275;
+ goto yy194;
} else {
- if (yych <= '\'') goto yy273;
- if (yych <= '@') goto yy193;
+ if (yych <= '\'') goto yy274;
+ if (yych <= '@') goto yy194;
}
} else {
if (yych <= '`') {
- if (yych != '_') goto yy193;
+ if (yych != '_') goto yy194;
} else {
- if (yych <= 'z') goto yy271;
- if (yych <= '~') goto yy193;
+ if (yych <= 'z') goto yy272;
+ if (yych <= '~') goto yy194;
}
}
-yy271:
- YYDEBUG(271, *YYCURSOR);
+yy272:
+ YYDEBUG(272, *YYCURSOR);
++YYCURSOR;
YYFILL(2);
yych = *YYCURSOR;
- YYDEBUG(272, *YYCURSOR);
+ YYDEBUG(273, *YYCURSOR);
if (yych <= '@') {
if (yych <= '\f') {
- if (yych == '\n') goto yy278;
- goto yy193;
+ if (yych == '\n') goto yy279;
+ goto yy194;
} else {
- if (yych <= '\r') goto yy280;
- if (yych <= '/') goto yy193;
- if (yych <= '9') goto yy271;
- goto yy193;
+ if (yych <= '\r') goto yy281;
+ if (yych <= '/') goto yy194;
+ if (yych <= '9') goto yy272;
+ goto yy194;
}
} else {
if (yych <= '_') {
- if (yych <= 'Z') goto yy271;
- if (yych <= '^') goto yy193;
- goto yy271;
+ if (yych <= 'Z') goto yy272;
+ if (yych <= '^') goto yy194;
+ goto yy272;
} else {
- if (yych <= '`') goto yy193;
- if (yych <= 'z') goto yy271;
- if (yych <= '~') goto yy193;
- goto yy271;
+ if (yych <= '`') goto yy194;
+ if (yych <= 'z') goto yy272;
+ if (yych <= '~') goto yy194;
+ goto yy272;
}
}
-yy273:
- YYDEBUG(273, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == '\'') goto yy193;
- if (yych <= '/') goto yy282;
- if (yych <= '9') goto yy193;
- goto yy282;
yy274:
YYDEBUG(274, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '"') goto yy193;
- if (yych <= '/') goto yy276;
- if (yych <= '9') goto yy193;
- goto yy276;
+ if (yych == '\'') goto yy194;
+ if (yych <= '/') goto yy283;
+ if (yych <= '9') goto yy194;
+ goto yy283;
yy275:
YYDEBUG(275, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == '"') goto yy194;
+ if (yych <= '/') goto yy277;
+ if (yych <= '9') goto yy194;
+ goto yy277;
+yy276:
+ YYDEBUG(276, *YYCURSOR);
++YYCURSOR;
YYFILL(3);
yych = *YYCURSOR;
-yy276:
- YYDEBUG(276, *YYCURSOR);
+yy277:
+ YYDEBUG(277, *YYCURSOR);
if (yych <= 'Z') {
if (yych <= '/') {
- if (yych != '"') goto yy193;
+ if (yych != '"') goto yy194;
} else {
- if (yych <= '9') goto yy275;
- if (yych <= '@') goto yy193;
- goto yy275;
+ if (yych <= '9') goto yy276;
+ if (yych <= '@') goto yy194;
+ goto yy276;
}
} else {
if (yych <= '`') {
- if (yych == '_') goto yy275;
- goto yy193;
+ if (yych == '_') goto yy276;
+ goto yy194;
} else {
- if (yych <= 'z') goto yy275;
- if (yych <= '~') goto yy193;
- goto yy275;
+ if (yych <= 'z') goto yy276;
+ if (yych <= '~') goto yy194;
+ goto yy276;
}
}
-yy277:
- YYDEBUG(277, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == '\n') goto yy278;
- if (yych == '\r') goto yy280;
- goto yy193;
yy278:
YYDEBUG(278, *YYCURSOR);
- ++YYCURSOR;
+ yych = *++YYCURSOR;
+ if (yych == '\n') goto yy279;
+ if (yych == '\r') goto yy281;
+ goto yy194;
yy279:
YYDEBUG(279, *YYCURSOR);
+ ++YYCURSOR;
+yy280:
+ YYDEBUG(280, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2105 "Zend/zend_language_scanner.l"
+#line 2115 "Zend/zend_language_scanner.l"
{
char *s;
int bprefix = (yytext[0] != '<') ? 1 : 0;
-
- /* save old heredoc label */
- Z_STRVAL_P(zendlval) = CG(heredoc);
- Z_STRLEN_P(zendlval) = CG(heredoc_len);
+ zend_heredoc_label *heredoc_label = emalloc(sizeof(zend_heredoc_label));
CG(zend_lineno)++;
- CG(heredoc_len) = yyleng-bprefix-3-1-(yytext[yyleng-2]=='\r'?1:0);
+ heredoc_label->length = yyleng-bprefix-3-1-(yytext[yyleng-2]=='\r'?1:0);
s = yytext+bprefix+3;
while ((*s == ' ') || (*s == '\t')) {
s++;
- CG(heredoc_len)--;
+ heredoc_label->length--;
}
if (*s == '\'') {
s++;
- CG(heredoc_len) -= 2;
+ heredoc_label->length -= 2;
BEGIN(ST_NOWDOC);
} else {
if (*s == '"') {
s++;
- CG(heredoc_len) -= 2;
+ heredoc_label->length -= 2;
}
BEGIN(ST_HEREDOC);
}
- CG(heredoc) = estrndup(s, CG(heredoc_len));
+ heredoc_label->label = estrndup(s, heredoc_label->length);
/* Check for ending label on the next line */
- if (CG(heredoc_len) < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, s, CG(heredoc_len))) {
- YYCTYPE *end = YYCURSOR + CG(heredoc_len);
+ if (heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, s, heredoc_label->length)) {
+ YYCTYPE *end = YYCURSOR + heredoc_label->length;
if (*end == ';') {
end++;
@@ -3925,257 +3935,259 @@ yy279:
}
}
+ zend_ptr_stack_push(&SCNG(heredoc_label_stack), (void *) heredoc_label);
+
return T_START_HEREDOC;
}
-#line 3931 "Zend/zend_language_scanner.c"
-yy280:
- YYDEBUG(280, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == '\n') goto yy278;
- goto yy279;
+#line 3943 "Zend/zend_language_scanner.c"
yy281:
YYDEBUG(281, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == '\n') goto yy279;
+ goto yy280;
+yy282:
+ YYDEBUG(282, *YYCURSOR);
++YYCURSOR;
YYFILL(3);
yych = *YYCURSOR;
-yy282:
- YYDEBUG(282, *YYCURSOR);
+yy283:
+ YYDEBUG(283, *YYCURSOR);
if (yych <= 'Z') {
if (yych <= '/') {
- if (yych == '\'') goto yy277;
- goto yy193;
+ if (yych == '\'') goto yy278;
+ goto yy194;
} else {
- if (yych <= '9') goto yy281;
- if (yych <= '@') goto yy193;
- goto yy281;
+ if (yych <= '9') goto yy282;
+ if (yych <= '@') goto yy194;
+ goto yy282;
}
} else {
if (yych <= '`') {
- if (yych == '_') goto yy281;
- goto yy193;
+ if (yych == '_') goto yy282;
+ goto yy194;
} else {
- if (yych <= 'z') goto yy281;
- if (yych <= '~') goto yy193;
- goto yy281;
+ if (yych <= 'z') goto yy282;
+ if (yych <= '~') goto yy194;
+ goto yy282;
}
}
-yy283:
- YYDEBUG(283, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych != '=') goto yy259;
+yy284:
YYDEBUG(284, *YYCURSOR);
- ++YYCURSOR;
+ yych = *++YYCURSOR;
+ if (yych != '=') goto yy260;
YYDEBUG(285, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(286, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1346 "Zend/zend_language_scanner.l"
+#line 1356 "Zend/zend_language_scanner.l"
{
return T_IS_NOT_IDENTICAL;
}
-#line 3975 "Zend/zend_language_scanner.c"
-yy286:
- YYDEBUG(286, *YYCURSOR);
- ++YYCURSOR;
+#line 3987 "Zend/zend_language_scanner.c"
+yy287:
YYDEBUG(287, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(288, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1366 "Zend/zend_language_scanner.l"
+#line 1376 "Zend/zend_language_scanner.l"
{
return T_PLUS_EQUAL;
}
-#line 3985 "Zend/zend_language_scanner.c"
-yy288:
- YYDEBUG(288, *YYCURSOR);
- ++YYCURSOR;
+#line 3997 "Zend/zend_language_scanner.c"
+yy289:
YYDEBUG(289, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(290, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1334 "Zend/zend_language_scanner.l"
+#line 1344 "Zend/zend_language_scanner.l"
{
return T_INC;
}
-#line 3995 "Zend/zend_language_scanner.c"
-yy290:
- YYDEBUG(290, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'S') goto yy291;
- if (yych != 's') goto yy186;
+#line 4007 "Zend/zend_language_scanner.c"
yy291:
YYDEBUG(291, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy292;
- if (yych != 't') goto yy186;
+ if (yych == 'S') goto yy292;
+ if (yych != 's') goto yy187;
yy292:
YYDEBUG(292, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'T') goto yy293;
+ if (yych != 't') goto yy187;
+yy293:
+ YYDEBUG(293, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(293, *YYCURSOR);
+ YYDEBUG(294, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1322 "Zend/zend_language_scanner.l"
+#line 1332 "Zend/zend_language_scanner.l"
{
return T_LIST;
}
-#line 4018 "Zend/zend_language_scanner.c"
-yy294:
- YYDEBUG(294, *YYCURSOR);
- ++YYCURSOR;
- if ((yych = *YYCURSOR) == '=') goto yy298;
+#line 4030 "Zend/zend_language_scanner.c"
+yy295:
YYDEBUG(295, *YYCURSOR);
+ ++YYCURSOR;
+ if ((yych = *YYCURSOR) == '=') goto yy299;
+ YYDEBUG(296, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1350 "Zend/zend_language_scanner.l"
+#line 1360 "Zend/zend_language_scanner.l"
{
return T_IS_EQUAL;
}
-#line 4029 "Zend/zend_language_scanner.c"
-yy296:
- YYDEBUG(296, *YYCURSOR);
- ++YYCURSOR;
+#line 4041 "Zend/zend_language_scanner.c"
+yy297:
YYDEBUG(297, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(298, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1318 "Zend/zend_language_scanner.l"
+#line 1328 "Zend/zend_language_scanner.l"
{
return T_DOUBLE_ARROW;
}
-#line 4039 "Zend/zend_language_scanner.c"
-yy298:
- YYDEBUG(298, *YYCURSOR);
- ++YYCURSOR;
+#line 4051 "Zend/zend_language_scanner.c"
+yy299:
YYDEBUG(299, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(300, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1342 "Zend/zend_language_scanner.l"
+#line 1352 "Zend/zend_language_scanner.l"
{
return T_IS_IDENTICAL;
}
-#line 4049 "Zend/zend_language_scanner.c"
-yy300:
- YYDEBUG(300, *YYCURSOR);
+#line 4061 "Zend/zend_language_scanner.c"
+yy301:
+ YYDEBUG(301, *YYCURSOR);
yych = *++YYCURSOR;
YYDEBUG(-1, yych);
switch (yych) {
case 'C':
- case 'c': goto yy302;
+ case 'c': goto yy303;
case 'D':
- case 'd': goto yy307;
+ case 'd': goto yy308;
case 'F':
- case 'f': goto yy304;
+ case 'f': goto yy305;
case 'H':
- case 'h': goto yy301;
+ case 'h': goto yy302;
case 'L':
- case 'l': goto yy306;
+ case 'l': goto yy307;
case 'M':
- case 'm': goto yy305;
+ case 'm': goto yy306;
case 'N':
- case 'n': goto yy308;
+ case 'n': goto yy309;
case 'T':
- case 't': goto yy303;
- default: goto yy186;
+ case 't': goto yy304;
+ default: goto yy187;
}
-yy301:
- YYDEBUG(301, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'A') goto yy369;
- if (yych == 'a') goto yy369;
- goto yy186;
yy302:
YYDEBUG(302, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy362;
- if (yych == 'l') goto yy362;
- goto yy186;
+ if (yych == 'A') goto yy370;
+ if (yych == 'a') goto yy370;
+ goto yy187;
yy303:
YYDEBUG(303, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy355;
- if (yych == 'r') goto yy355;
- goto yy186;
+ if (yych == 'L') goto yy363;
+ if (yych == 'l') goto yy363;
+ goto yy187;
yy304:
YYDEBUG(304, *YYCURSOR);
yych = *++YYCURSOR;
+ if (yych == 'R') goto yy356;
+ if (yych == 'r') goto yy356;
+ goto yy187;
+yy305:
+ YYDEBUG(305, *YYCURSOR);
+ yych = *++YYCURSOR;
if (yych <= 'U') {
- if (yych == 'I') goto yy339;
- if (yych <= 'T') goto yy186;
- goto yy340;
+ if (yych == 'I') goto yy340;
+ if (yych <= 'T') goto yy187;
+ goto yy341;
} else {
if (yych <= 'i') {
- if (yych <= 'h') goto yy186;
- goto yy339;
+ if (yych <= 'h') goto yy187;
+ goto yy340;
} else {
- if (yych == 'u') goto yy340;
- goto yy186;
+ if (yych == 'u') goto yy341;
+ goto yy187;
}
}
-yy305:
- YYDEBUG(305, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'E') goto yy331;
- if (yych == 'e') goto yy331;
- goto yy186;
yy306:
YYDEBUG(306, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy325;
- if (yych == 'i') goto yy325;
- goto yy186;
+ if (yych == 'E') goto yy332;
+ if (yych == 'e') goto yy332;
+ goto yy187;
yy307:
YYDEBUG(307, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy320;
- if (yych == 'i') goto yy320;
- goto yy186;
+ if (yych == 'I') goto yy326;
+ if (yych == 'i') goto yy326;
+ goto yy187;
yy308:
YYDEBUG(308, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy309;
- if (yych != 'a') goto yy186;
+ if (yych == 'I') goto yy321;
+ if (yych == 'i') goto yy321;
+ goto yy187;
yy309:
YYDEBUG(309, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'M') goto yy310;
- if (yych != 'm') goto yy186;
+ if (yych == 'A') goto yy310;
+ if (yych != 'a') goto yy187;
yy310:
YYDEBUG(310, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy311;
- if (yych != 'e') goto yy186;
+ if (yych == 'M') goto yy311;
+ if (yych != 'm') goto yy187;
yy311:
YYDEBUG(311, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy312;
- if (yych != 's') goto yy186;
+ if (yych == 'E') goto yy312;
+ if (yych != 'e') goto yy187;
yy312:
YYDEBUG(312, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'P') goto yy313;
- if (yych != 'p') goto yy186;
+ if (yych == 'S') goto yy313;
+ if (yych != 's') goto yy187;
yy313:
YYDEBUG(313, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy314;
- if (yych != 'a') goto yy186;
+ if (yych == 'P') goto yy314;
+ if (yych != 'p') goto yy187;
yy314:
YYDEBUG(314, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy315;
- if (yych != 'c') goto yy186;
+ if (yych == 'A') goto yy315;
+ if (yych != 'a') goto yy187;
yy315:
YYDEBUG(315, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy316;
- if (yych != 'e') goto yy186;
+ if (yych == 'C') goto yy316;
+ if (yych != 'c') goto yy187;
yy316:
YYDEBUG(316, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy186;
+ if (yych == 'E') goto yy317;
+ if (yych != 'e') goto yy187;
+yy317:
YYDEBUG(317, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy186;
+ if (yych != '_') goto yy187;
YYDEBUG(318, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych != '_') goto yy187;
+ YYDEBUG(319, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(319, *YYCURSOR);
+ YYDEBUG(320, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1706 "Zend/zend_language_scanner.l"
+#line 1716 "Zend/zend_language_scanner.l"
{
if (CG(current_namespace)) {
*zendlval = *CG(current_namespace);
@@ -4185,27 +4197,27 @@ yy316:
}
return T_NS_C;
}
-#line 4189 "Zend/zend_language_scanner.c"
-yy320:
- YYDEBUG(320, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'R') goto yy321;
- if (yych != 'r') goto yy186;
+#line 4201 "Zend/zend_language_scanner.c"
yy321:
YYDEBUG(321, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy186;
+ if (yych == 'R') goto yy322;
+ if (yych != 'r') goto yy187;
+yy322:
YYDEBUG(322, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy186;
+ if (yych != '_') goto yy187;
YYDEBUG(323, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych != '_') goto yy187;
+ YYDEBUG(324, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(324, *YYCURSOR);
+ YYDEBUG(325, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1679 "Zend/zend_language_scanner.l"
+#line 1689 "Zend/zend_language_scanner.l"
{
char *filename = zend_get_compiled_filename(TSRMLS_C);
const size_t filename_len = strlen(filename);
@@ -4232,73 +4244,73 @@ yy321:
zendlval->type = IS_STRING;
return T_DIR;
}
-#line 4236 "Zend/zend_language_scanner.c"
-yy325:
- YYDEBUG(325, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'N') goto yy326;
- if (yych != 'n') goto yy186;
+#line 4248 "Zend/zend_language_scanner.c"
yy326:
YYDEBUG(326, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy327;
- if (yych != 'e') goto yy186;
+ if (yych == 'N') goto yy327;
+ if (yych != 'n') goto yy187;
yy327:
YYDEBUG(327, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy186;
+ if (yych == 'E') goto yy328;
+ if (yych != 'e') goto yy187;
+yy328:
YYDEBUG(328, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy186;
+ if (yych != '_') goto yy187;
YYDEBUG(329, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych != '_') goto yy187;
+ YYDEBUG(330, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(330, *YYCURSOR);
+ YYDEBUG(331, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1661 "Zend/zend_language_scanner.l"
+#line 1671 "Zend/zend_language_scanner.l"
{
zendlval->value.lval = CG(zend_lineno);
zendlval->type = IS_LONG;
return T_LINE;
}
-#line 4267 "Zend/zend_language_scanner.c"
-yy331:
- YYDEBUG(331, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'T') goto yy332;
- if (yych != 't') goto yy186;
+#line 4279 "Zend/zend_language_scanner.c"
yy332:
YYDEBUG(332, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'H') goto yy333;
- if (yych != 'h') goto yy186;
+ if (yych == 'T') goto yy333;
+ if (yych != 't') goto yy187;
yy333:
YYDEBUG(333, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy334;
- if (yych != 'o') goto yy186;
+ if (yych == 'H') goto yy334;
+ if (yych != 'h') goto yy187;
yy334:
YYDEBUG(334, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'D') goto yy335;
- if (yych != 'd') goto yy186;
+ if (yych == 'O') goto yy335;
+ if (yych != 'o') goto yy187;
yy335:
YYDEBUG(335, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy186;
+ if (yych == 'D') goto yy336;
+ if (yych != 'd') goto yy187;
+yy336:
YYDEBUG(336, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy186;
+ if (yych != '_') goto yy187;
YYDEBUG(337, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych != '_') goto yy187;
+ YYDEBUG(338, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(338, *YYCURSOR);
+ YYDEBUG(339, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1640 "Zend/zend_language_scanner.l"
+#line 1650 "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;
@@ -4319,58 +4331,58 @@ yy335:
zendlval->type = IS_STRING;
return T_METHOD_C;
}
-#line 4323 "Zend/zend_language_scanner.c"
-yy339:
- YYDEBUG(339, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'L') goto yy350;
- if (yych == 'l') goto yy350;
- goto yy186;
+#line 4335 "Zend/zend_language_scanner.c"
yy340:
YYDEBUG(340, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy341;
- if (yych != 'n') goto yy186;
+ if (yych == 'L') goto yy351;
+ if (yych == 'l') goto yy351;
+ goto yy187;
yy341:
YYDEBUG(341, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy342;
- if (yych != 'c') goto yy186;
+ if (yych == 'N') goto yy342;
+ if (yych != 'n') goto yy187;
yy342:
YYDEBUG(342, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy343;
- if (yych != 't') goto yy186;
+ if (yych == 'C') goto yy343;
+ if (yych != 'c') goto yy187;
yy343:
YYDEBUG(343, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy344;
- if (yych != 'i') goto yy186;
+ if (yych == 'T') goto yy344;
+ if (yych != 't') goto yy187;
yy344:
YYDEBUG(344, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy345;
- if (yych != 'o') goto yy186;
+ if (yych == 'I') goto yy345;
+ if (yych != 'i') goto yy187;
yy345:
YYDEBUG(345, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy346;
- if (yych != 'n') goto yy186;
+ if (yych == 'O') goto yy346;
+ if (yych != 'o') goto yy187;
yy346:
YYDEBUG(346, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy186;
+ if (yych == 'N') goto yy347;
+ if (yych != 'n') goto yy187;
+yy347:
YYDEBUG(347, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy186;
+ if (yych != '_') goto yy187;
YYDEBUG(348, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych != '_') goto yy187;
+ YYDEBUG(349, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(349, *YYCURSOR);
+ YYDEBUG(350, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1624 "Zend/zend_language_scanner.l"
+#line 1634 "Zend/zend_language_scanner.l"
{
const char *func_name = NULL;
@@ -4386,27 +4398,27 @@ yy346:
zendlval->type = IS_STRING;
return T_FUNC_C;
}
-#line 4390 "Zend/zend_language_scanner.c"
-yy350:
- YYDEBUG(350, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'E') goto yy351;
- if (yych != 'e') goto yy186;
+#line 4402 "Zend/zend_language_scanner.c"
yy351:
YYDEBUG(351, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy186;
+ if (yych == 'E') goto yy352;
+ if (yych != 'e') goto yy187;
+yy352:
YYDEBUG(352, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy186;
+ if (yych != '_') goto yy187;
YYDEBUG(353, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych != '_') goto yy187;
+ YYDEBUG(354, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(354, *YYCURSOR);
+ YYDEBUG(355, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1667 "Zend/zend_language_scanner.l"
+#line 1677 "Zend/zend_language_scanner.l"
{
char *filename = zend_get_compiled_filename(TSRMLS_C);
@@ -4418,37 +4430,37 @@ yy351:
zendlval->type = IS_STRING;
return T_FILE;
}
-#line 4422 "Zend/zend_language_scanner.c"
-yy355:
- YYDEBUG(355, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'A') goto yy356;
- if (yych != 'a') goto yy186;
+#line 4434 "Zend/zend_language_scanner.c"
yy356:
YYDEBUG(356, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy357;
- if (yych != 'i') goto yy186;
+ if (yych == 'A') goto yy357;
+ if (yych != 'a') goto yy187;
yy357:
YYDEBUG(357, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy358;
- if (yych != 't') goto yy186;
+ if (yych == 'I') goto yy358;
+ if (yych != 'i') goto yy187;
yy358:
YYDEBUG(358, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy186;
+ if (yych == 'T') goto yy359;
+ if (yych != 't') goto yy187;
+yy359:
YYDEBUG(359, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy186;
+ if (yych != '_') goto yy187;
YYDEBUG(360, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych != '_') goto yy187;
+ YYDEBUG(361, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(361, *YYCURSOR);
+ YYDEBUG(362, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1604 "Zend/zend_language_scanner.l"
+#line 1614 "Zend/zend_language_scanner.l"
{
const char *trait_name = NULL;
@@ -4468,37 +4480,37 @@ yy358:
return T_TRAIT_C;
}
-#line 4472 "Zend/zend_language_scanner.c"
-yy362:
- YYDEBUG(362, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'A') goto yy363;
- if (yych != 'a') goto yy186;
+#line 4484 "Zend/zend_language_scanner.c"
yy363:
YYDEBUG(363, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy364;
- if (yych != 's') goto yy186;
+ if (yych == 'A') goto yy364;
+ if (yych != 'a') goto yy187;
yy364:
YYDEBUG(364, *YYCURSOR);
yych = *++YYCURSOR;
if (yych == 'S') goto yy365;
- if (yych != 's') goto yy186;
+ if (yych != 's') goto yy187;
yy365:
YYDEBUG(365, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy186;
+ if (yych == 'S') goto yy366;
+ if (yych != 's') goto yy187;
+yy366:
YYDEBUG(366, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy186;
+ if (yych != '_') goto yy187;
YYDEBUG(367, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych != '_') goto yy187;
+ YYDEBUG(368, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(368, *YYCURSOR);
+ YYDEBUG(369, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1577 "Zend/zend_language_scanner.l"
+#line 1587 "Zend/zend_language_scanner.l"
{
const char *class_name = NULL;
@@ -4525,2648 +4537,2709 @@ yy365:
}
return T_CLASS_C;
}
-#line 4529 "Zend/zend_language_scanner.c"
-yy369:
- YYDEBUG(369, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'L') goto yy370;
- if (yych != 'l') goto yy186;
+#line 4541 "Zend/zend_language_scanner.c"
yy370:
YYDEBUG(370, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy371;
- if (yych != 't') goto yy186;
+ if (yych == 'L') goto yy371;
+ if (yych != 'l') goto yy187;
yy371:
YYDEBUG(371, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy186;
+ if (yych == 'T') goto yy372;
+ if (yych != 't') goto yy187;
+yy372:
YYDEBUG(372, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy373;
- if (yych != 'c') goto yy186;
-yy373:
+ if (yych != '_') goto yy187;
YYDEBUG(373, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy374;
- if (yych != 'o') goto yy186;
+ if (yych == 'C') goto yy374;
+ if (yych != 'c') goto yy187;
yy374:
YYDEBUG(374, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'M') goto yy375;
- if (yych != 'm') goto yy186;
+ if (yych == 'O') goto yy375;
+ if (yych != 'o') goto yy187;
yy375:
YYDEBUG(375, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'P') goto yy376;
- if (yych != 'p') goto yy186;
+ if (yych == 'M') goto yy376;
+ if (yych != 'm') goto yy187;
yy376:
YYDEBUG(376, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy377;
- if (yych != 'i') goto yy186;
+ if (yych == 'P') goto yy377;
+ if (yych != 'p') goto yy187;
yy377:
YYDEBUG(377, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy378;
- if (yych != 'l') goto yy186;
+ if (yych == 'I') goto yy378;
+ if (yych != 'i') goto yy187;
yy378:
YYDEBUG(378, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy379;
- if (yych != 'e') goto yy186;
+ if (yych == 'L') goto yy379;
+ if (yych != 'l') goto yy187;
yy379:
YYDEBUG(379, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy380;
- if (yych != 'r') goto yy186;
+ if (yych == 'E') goto yy380;
+ if (yych != 'e') goto yy187;
yy380:
YYDEBUG(380, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'R') goto yy381;
+ if (yych != 'r') goto yy187;
+yy381:
+ YYDEBUG(381, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(381, *YYCURSOR);
+ YYDEBUG(382, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1286 "Zend/zend_language_scanner.l"
+#line 1296 "Zend/zend_language_scanner.l"
{
return T_HALT_COMPILER;
}
-#line 4595 "Zend/zend_language_scanner.c"
-yy382:
- YYDEBUG(382, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'S') goto yy386;
- if (yych == 's') goto yy386;
- goto yy186;
+#line 4607 "Zend/zend_language_scanner.c"
yy383:
YYDEBUG(383, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy384;
- if (yych != 'e') goto yy186;
+ if (yych == 'S') goto yy387;
+ if (yych == 's') goto yy387;
+ goto yy187;
yy384:
YYDEBUG(384, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'E') goto yy385;
+ if (yych != 'e') goto yy187;
+yy385:
+ YYDEBUG(385, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(385, *YYCURSOR);
+ YYDEBUG(386, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1266 "Zend/zend_language_scanner.l"
+#line 1276 "Zend/zend_language_scanner.l"
{
return T_USE;
}
-#line 4619 "Zend/zend_language_scanner.c"
-yy386:
- YYDEBUG(386, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'E') goto yy387;
- if (yych != 'e') goto yy186;
+#line 4631 "Zend/zend_language_scanner.c"
yy387:
YYDEBUG(387, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy388;
- if (yych != 't') goto yy186;
+ if (yych == 'E') goto yy388;
+ if (yych != 'e') goto yy187;
yy388:
YYDEBUG(388, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'T') goto yy389;
+ if (yych != 't') goto yy187;
+yy389:
+ YYDEBUG(389, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(389, *YYCURSOR);
+ YYDEBUG(390, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1314 "Zend/zend_language_scanner.l"
+#line 1324 "Zend/zend_language_scanner.l"
{
return T_UNSET;
}
-#line 4642 "Zend/zend_language_scanner.c"
-yy390:
- YYDEBUG(390, *YYCURSOR);
+#line 4654 "Zend/zend_language_scanner.c"
+yy391:
+ YYDEBUG(391, *YYCURSOR);
++YYCURSOR;
YYFILL(7);
yych = *YYCURSOR;
-yy391:
- YYDEBUG(391, *YYCURSOR);
+yy392:
+ YYDEBUG(392, *YYCURSOR);
if (yych <= 'S') {
if (yych <= 'D') {
if (yych <= ' ') {
- if (yych == '\t') goto yy390;
- if (yych <= 0x1F) goto yy193;
- goto yy390;
+ if (yych == '\t') goto yy391;
+ if (yych <= 0x1F) goto yy194;
+ goto yy391;
} else {
if (yych <= 'A') {
- if (yych <= '@') goto yy193;
- goto yy395;
+ if (yych <= '@') goto yy194;
+ goto yy396;
} else {
- if (yych <= 'B') goto yy393;
- if (yych <= 'C') goto yy193;
- goto yy398;
+ if (yych <= 'B') goto yy394;
+ if (yych <= 'C') goto yy194;
+ goto yy399;
}
}
} else {
if (yych <= 'I') {
- if (yych == 'F') goto yy399;
- if (yych <= 'H') goto yy193;
- goto yy400;
+ if (yych == 'F') goto yy400;
+ if (yych <= 'H') goto yy194;
+ goto yy401;
} else {
if (yych <= 'O') {
- if (yych <= 'N') goto yy193;
- goto yy394;
+ if (yych <= 'N') goto yy194;
+ goto yy395;
} else {
- if (yych <= 'Q') goto yy193;
- if (yych <= 'R') goto yy397;
- goto yy396;
+ if (yych <= 'Q') goto yy194;
+ if (yych <= 'R') goto yy398;
+ goto yy397;
}
}
}
} else {
if (yych <= 'f') {
if (yych <= 'a') {
- if (yych == 'U') goto yy392;
- if (yych <= '`') goto yy193;
- goto yy395;
+ if (yych == 'U') goto yy393;
+ if (yych <= '`') goto yy194;
+ goto yy396;
} else {
if (yych <= 'c') {
- if (yych <= 'b') goto yy393;
- goto yy193;
+ if (yych <= 'b') goto yy394;
+ goto yy194;
} else {
- if (yych <= 'd') goto yy398;
- if (yych <= 'e') goto yy193;
- goto yy399;
+ if (yych <= 'd') goto yy399;
+ if (yych <= 'e') goto yy194;
+ goto yy400;
}
}
} else {
if (yych <= 'q') {
if (yych <= 'i') {
- if (yych <= 'h') goto yy193;
- goto yy400;
+ if (yych <= 'h') goto yy194;
+ goto yy401;
} else {
- if (yych == 'o') goto yy394;
- goto yy193;
+ if (yych == 'o') goto yy395;
+ goto yy194;
}
} else {
if (yych <= 's') {
- if (yych <= 'r') goto yy397;
- goto yy396;
+ if (yych <= 'r') goto yy398;
+ goto yy397;
} else {
- if (yych != 'u') goto yy193;
+ if (yych != 'u') goto yy194;
}
}
}
}
-yy392:
- YYDEBUG(392, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'N') goto yy459;
- if (yych == 'n') goto yy459;
- goto yy193;
yy393:
YYDEBUG(393, *YYCURSOR);
yych = *++YYCURSOR;
+ if (yych == 'N') goto yy460;
+ if (yych == 'n') goto yy460;
+ goto yy194;
+yy394:
+ YYDEBUG(394, *YYCURSOR);
+ yych = *++YYCURSOR;
if (yych <= 'O') {
- if (yych == 'I') goto yy446;
- if (yych <= 'N') goto yy193;
- goto yy447;
+ if (yych == 'I') goto yy447;
+ if (yych <= 'N') goto yy194;
+ goto yy448;
} else {
if (yych <= 'i') {
- if (yych <= 'h') goto yy193;
- goto yy446;
+ if (yych <= 'h') goto yy194;
+ goto yy447;
} else {
- if (yych == 'o') goto yy447;
- goto yy193;
+ if (yych == 'o') goto yy448;
+ goto yy194;
}
}
-yy394:
- YYDEBUG(394, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'B') goto yy438;
- if (yych == 'b') goto yy438;
- goto yy193;
yy395:
YYDEBUG(395, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy431;
- if (yych == 'r') goto yy431;
- goto yy193;
+ if (yych == 'B') goto yy439;
+ if (yych == 'b') goto yy439;
+ goto yy194;
yy396:
YYDEBUG(396, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy423;
- if (yych == 't') goto yy423;
- goto yy193;
+ if (yych == 'R') goto yy432;
+ if (yych == 'r') goto yy432;
+ goto yy194;
yy397:
YYDEBUG(397, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy421;
- if (yych == 'e') goto yy421;
- goto yy193;
+ if (yych == 'T') goto yy424;
+ if (yych == 't') goto yy424;
+ goto yy194;
yy398:
YYDEBUG(398, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy417;
- if (yych == 'o') goto yy417;
- goto yy193;
+ if (yych == 'E') goto yy422;
+ if (yych == 'e') goto yy422;
+ goto yy194;
yy399:
YYDEBUG(399, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy410;
- if (yych == 'l') goto yy410;
- goto yy193;
+ if (yych == 'O') goto yy418;
+ if (yych == 'o') goto yy418;
+ goto yy194;
yy400:
YYDEBUG(400, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy401;
- if (yych != 'n') goto yy193;
+ if (yych == 'L') goto yy411;
+ if (yych == 'l') goto yy411;
+ goto yy194;
yy401:
YYDEBUG(401, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy402;
- if (yych != 't') goto yy193;
+ if (yych == 'N') goto yy402;
+ if (yych != 'n') goto yy194;
yy402:
YYDEBUG(402, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy403;
- if (yych != 'e') goto yy405;
+ if (yych == 'T') goto yy403;
+ if (yych != 't') goto yy194;
yy403:
YYDEBUG(403, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'G') goto yy408;
- if (yych == 'g') goto yy408;
- goto yy193;
+ if (yych == 'E') goto yy404;
+ if (yych != 'e') goto yy406;
yy404:
YYDEBUG(404, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'G') goto yy409;
+ if (yych == 'g') goto yy409;
+ goto yy194;
+yy405:
+ YYDEBUG(405, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy405:
- YYDEBUG(405, *YYCURSOR);
+yy406:
+ YYDEBUG(406, *YYCURSOR);
if (yych <= 0x1F) {
- if (yych == '\t') goto yy404;
- goto yy193;
+ if (yych == '\t') goto yy405;
+ goto yy194;
} else {
- if (yych <= ' ') goto yy404;
- if (yych != ')') goto yy193;
+ if (yych <= ' ') goto yy405;
+ if (yych != ')') goto yy194;
}
- YYDEBUG(406, *YYCURSOR);
- ++YYCURSOR;
YYDEBUG(407, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(408, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1214 "Zend/zend_language_scanner.l"
+#line 1224 "Zend/zend_language_scanner.l"
{
return T_INT_CAST;
}
-#line 4818 "Zend/zend_language_scanner.c"
-yy408:
- YYDEBUG(408, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'E') goto yy409;
- if (yych != 'e') goto yy193;
+#line 4830 "Zend/zend_language_scanner.c"
yy409:
YYDEBUG(409, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy404;
- if (yych == 'r') goto yy404;
- goto yy193;
+ if (yych == 'E') goto yy410;
+ if (yych != 'e') goto yy194;
yy410:
YYDEBUG(410, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy411;
- if (yych != 'o') goto yy193;
+ if (yych == 'R') goto yy405;
+ if (yych == 'r') goto yy405;
+ goto yy194;
yy411:
YYDEBUG(411, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy412;
- if (yych != 'a') goto yy193;
+ if (yych == 'O') goto yy412;
+ if (yych != 'o') goto yy194;
yy412:
YYDEBUG(412, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy413;
- if (yych != 't') goto yy193;
+ if (yych == 'A') goto yy413;
+ if (yych != 'a') goto yy194;
yy413:
YYDEBUG(413, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'T') goto yy414;
+ if (yych != 't') goto yy194;
+yy414:
+ YYDEBUG(414, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(414, *YYCURSOR);
+ YYDEBUG(415, *YYCURSOR);
if (yych <= 0x1F) {
- if (yych == '\t') goto yy413;
- goto yy193;
+ if (yych == '\t') goto yy414;
+ goto yy194;
} else {
- if (yych <= ' ') goto yy413;
- if (yych != ')') goto yy193;
+ if (yych <= ' ') goto yy414;
+ if (yych != ')') goto yy194;
}
- YYDEBUG(415, *YYCURSOR);
- ++YYCURSOR;
YYDEBUG(416, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(417, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1218 "Zend/zend_language_scanner.l"
+#line 1228 "Zend/zend_language_scanner.l"
{
return T_DOUBLE_CAST;
}
-#line 4866 "Zend/zend_language_scanner.c"
-yy417:
- YYDEBUG(417, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'U') goto yy418;
- if (yych != 'u') goto yy193;
+#line 4878 "Zend/zend_language_scanner.c"
yy418:
YYDEBUG(418, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'B') goto yy419;
- if (yych != 'b') goto yy193;
+ if (yych == 'U') goto yy419;
+ if (yych != 'u') goto yy194;
yy419:
YYDEBUG(419, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy420;
- if (yych != 'l') goto yy193;
+ if (yych == 'B') goto yy420;
+ if (yych != 'b') goto yy194;
yy420:
YYDEBUG(420, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy413;
- if (yych == 'e') goto yy413;
- goto yy193;
+ if (yych == 'L') goto yy421;
+ if (yych != 'l') goto yy194;
yy421:
YYDEBUG(421, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy422;
- if (yych != 'a') goto yy193;
+ if (yych == 'E') goto yy414;
+ if (yych == 'e') goto yy414;
+ goto yy194;
yy422:
YYDEBUG(422, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy413;
- if (yych == 'l') goto yy413;
- goto yy193;
+ if (yych == 'A') goto yy423;
+ if (yych != 'a') goto yy194;
yy423:
YYDEBUG(423, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy424;
- if (yych != 'r') goto yy193;
+ if (yych == 'L') goto yy414;
+ if (yych == 'l') goto yy414;
+ goto yy194;
yy424:
YYDEBUG(424, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy425;
- if (yych != 'i') goto yy193;
+ if (yych == 'R') goto yy425;
+ if (yych != 'r') goto yy194;
yy425:
YYDEBUG(425, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy426;
- if (yych != 'n') goto yy193;
+ if (yych == 'I') goto yy426;
+ if (yych != 'i') goto yy194;
yy426:
YYDEBUG(426, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'G') goto yy427;
- if (yych != 'g') goto yy193;
+ if (yych == 'N') goto yy427;
+ if (yych != 'n') goto yy194;
yy427:
YYDEBUG(427, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'G') goto yy428;
+ if (yych != 'g') goto yy194;
+yy428:
+ YYDEBUG(428, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(428, *YYCURSOR);
+ YYDEBUG(429, *YYCURSOR);
if (yych <= 0x1F) {
- if (yych == '\t') goto yy427;
- goto yy193;
+ if (yych == '\t') goto yy428;
+ goto yy194;
} else {
- if (yych <= ' ') goto yy427;
- if (yych != ')') goto yy193;
+ if (yych <= ' ') goto yy428;
+ if (yych != ')') goto yy194;
}
- YYDEBUG(429, *YYCURSOR);
- ++YYCURSOR;
YYDEBUG(430, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(431, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1222 "Zend/zend_language_scanner.l"
+#line 1232 "Zend/zend_language_scanner.l"
{
return T_STRING_CAST;
}
-#line 4940 "Zend/zend_language_scanner.c"
-yy431:
- YYDEBUG(431, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'R') goto yy432;
- if (yych != 'r') goto yy193;
+#line 4952 "Zend/zend_language_scanner.c"
yy432:
YYDEBUG(432, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy433;
- if (yych != 'a') goto yy193;
+ if (yych == 'R') goto yy433;
+ if (yych != 'r') goto yy194;
yy433:
YYDEBUG(433, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'Y') goto yy434;
- if (yych != 'y') goto yy193;
+ if (yych == 'A') goto yy434;
+ if (yych != 'a') goto yy194;
yy434:
YYDEBUG(434, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'Y') goto yy435;
+ if (yych != 'y') goto yy194;
+yy435:
+ YYDEBUG(435, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(435, *YYCURSOR);
+ YYDEBUG(436, *YYCURSOR);
if (yych <= 0x1F) {
- if (yych == '\t') goto yy434;
- goto yy193;
+ if (yych == '\t') goto yy435;
+ goto yy194;
} else {
- if (yych <= ' ') goto yy434;
- if (yych != ')') goto yy193;
+ if (yych <= ' ') goto yy435;
+ if (yych != ')') goto yy194;
}
- YYDEBUG(436, *YYCURSOR);
- ++YYCURSOR;
YYDEBUG(437, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(438, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1226 "Zend/zend_language_scanner.l"
+#line 1236 "Zend/zend_language_scanner.l"
{
return T_ARRAY_CAST;
}
-#line 4977 "Zend/zend_language_scanner.c"
-yy438:
- YYDEBUG(438, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'J') goto yy439;
- if (yych != 'j') goto yy193;
+#line 4989 "Zend/zend_language_scanner.c"
yy439:
YYDEBUG(439, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy440;
- if (yych != 'e') goto yy193;
+ if (yych == 'J') goto yy440;
+ if (yych != 'j') goto yy194;
yy440:
YYDEBUG(440, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy441;
- if (yych != 'c') goto yy193;
+ if (yych == 'E') goto yy441;
+ if (yych != 'e') goto yy194;
yy441:
YYDEBUG(441, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy442;
- if (yych != 't') goto yy193;
+ if (yych == 'C') goto yy442;
+ if (yych != 'c') goto yy194;
yy442:
YYDEBUG(442, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'T') goto yy443;
+ if (yych != 't') goto yy194;
+yy443:
+ YYDEBUG(443, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(443, *YYCURSOR);
+ YYDEBUG(444, *YYCURSOR);
if (yych <= 0x1F) {
- if (yych == '\t') goto yy442;
- goto yy193;
+ if (yych == '\t') goto yy443;
+ goto yy194;
} else {
- if (yych <= ' ') goto yy442;
- if (yych != ')') goto yy193;
+ if (yych <= ' ') goto yy443;
+ if (yych != ')') goto yy194;
}
- YYDEBUG(444, *YYCURSOR);
- ++YYCURSOR;
YYDEBUG(445, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(446, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1230 "Zend/zend_language_scanner.l"
+#line 1240 "Zend/zend_language_scanner.l"
{
return T_OBJECT_CAST;
}
-#line 5019 "Zend/zend_language_scanner.c"
-yy446:
- YYDEBUG(446, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'N') goto yy456;
- if (yych == 'n') goto yy456;
- goto yy193;
+#line 5031 "Zend/zend_language_scanner.c"
yy447:
YYDEBUG(447, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy448;
- if (yych != 'o') goto yy193;
+ if (yych == 'N') goto yy457;
+ if (yych == 'n') goto yy457;
+ goto yy194;
yy448:
YYDEBUG(448, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy449;
- if (yych != 'l') goto yy193;
+ if (yych == 'O') goto yy449;
+ if (yych != 'o') goto yy194;
yy449:
YYDEBUG(449, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy454;
- if (yych == 'e') goto yy454;
- goto yy451;
+ if (yych == 'L') goto yy450;
+ if (yych != 'l') goto yy194;
yy450:
YYDEBUG(450, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'E') goto yy455;
+ if (yych == 'e') goto yy455;
+ goto yy452;
+yy451:
+ YYDEBUG(451, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy451:
- YYDEBUG(451, *YYCURSOR);
+yy452:
+ YYDEBUG(452, *YYCURSOR);
if (yych <= 0x1F) {
- if (yych == '\t') goto yy450;
- goto yy193;
+ if (yych == '\t') goto yy451;
+ goto yy194;
} else {
- if (yych <= ' ') goto yy450;
- if (yych != ')') goto yy193;
+ if (yych <= ' ') goto yy451;
+ if (yych != ')') goto yy194;
}
- YYDEBUG(452, *YYCURSOR);
- ++YYCURSOR;
YYDEBUG(453, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(454, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1234 "Zend/zend_language_scanner.l"
+#line 1244 "Zend/zend_language_scanner.l"
{
return T_BOOL_CAST;
}
-#line 5064 "Zend/zend_language_scanner.c"
-yy454:
- YYDEBUG(454, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'A') goto yy455;
- if (yych != 'a') goto yy193;
+#line 5076 "Zend/zend_language_scanner.c"
yy455:
YYDEBUG(455, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy450;
- if (yych == 'n') goto yy450;
- goto yy193;
+ if (yych == 'A') goto yy456;
+ if (yych != 'a') goto yy194;
yy456:
YYDEBUG(456, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy457;
- if (yych != 'a') goto yy193;
+ if (yych == 'N') goto yy451;
+ if (yych == 'n') goto yy451;
+ goto yy194;
yy457:
YYDEBUG(457, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy458;
- if (yych != 'r') goto yy193;
+ if (yych == 'A') goto yy458;
+ if (yych != 'a') goto yy194;
yy458:
YYDEBUG(458, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'Y') goto yy427;
- if (yych == 'y') goto yy427;
- goto yy193;
+ if (yych == 'R') goto yy459;
+ if (yych != 'r') goto yy194;
yy459:
YYDEBUG(459, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy460;
- if (yych != 's') goto yy193;
+ if (yych == 'Y') goto yy428;
+ if (yych == 'y') goto yy428;
+ goto yy194;
yy460:
YYDEBUG(460, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy461;
- if (yych != 'e') goto yy193;
+ if (yych == 'S') goto yy461;
+ if (yych != 's') goto yy194;
yy461:
YYDEBUG(461, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy462;
- if (yych != 't') goto yy193;
+ if (yych == 'E') goto yy462;
+ if (yych != 'e') goto yy194;
yy462:
YYDEBUG(462, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'T') goto yy463;
+ if (yych != 't') goto yy194;
+yy463:
+ YYDEBUG(463, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(463, *YYCURSOR);
+ YYDEBUG(464, *YYCURSOR);
if (yych <= 0x1F) {
- if (yych == '\t') goto yy462;
- goto yy193;
+ if (yych == '\t') goto yy463;
+ goto yy194;
} else {
- if (yych <= ' ') goto yy462;
- if (yych != ')') goto yy193;
+ if (yych <= ' ') goto yy463;
+ if (yych != ')') goto yy194;
}
- YYDEBUG(464, *YYCURSOR);
- ++YYCURSOR;
YYDEBUG(465, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(466, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1238 "Zend/zend_language_scanner.l"
+#line 1248 "Zend/zend_language_scanner.l"
{
return T_UNSET_CAST;
}
-#line 5128 "Zend/zend_language_scanner.c"
-yy466:
- YYDEBUG(466, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'R') goto yy467;
- if (yych != 'r') goto yy186;
+#line 5140 "Zend/zend_language_scanner.c"
yy467:
YYDEBUG(467, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'R') goto yy468;
+ if (yych != 'r') goto yy187;
+yy468:
+ YYDEBUG(468, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(468, *YYCURSOR);
+ YYDEBUG(469, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1210 "Zend/zend_language_scanner.l"
+#line 1220 "Zend/zend_language_scanner.l"
{
return T_VAR;
}
-#line 5146 "Zend/zend_language_scanner.c"
-yy469:
- YYDEBUG(469, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'M') goto yy473;
- if (yych == 'm') goto yy473;
- goto yy186;
+#line 5158 "Zend/zend_language_scanner.c"
yy470:
YYDEBUG(470, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'W') goto yy471;
- if (yych != 'w') goto yy186;
+ if (yych == 'M') goto yy474;
+ if (yych == 'm') goto yy474;
+ goto yy187;
yy471:
YYDEBUG(471, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'W') goto yy472;
+ if (yych != 'w') goto yy187;
+yy472:
+ YYDEBUG(472, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(472, *YYCURSOR);
+ YYDEBUG(473, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1202 "Zend/zend_language_scanner.l"
+#line 1212 "Zend/zend_language_scanner.l"
{
return T_NEW;
}
-#line 5170 "Zend/zend_language_scanner.c"
-yy473:
- YYDEBUG(473, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'E') goto yy474;
- if (yych != 'e') goto yy186;
+#line 5182 "Zend/zend_language_scanner.c"
yy474:
YYDEBUG(474, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy475;
- if (yych != 's') goto yy186;
+ if (yych == 'E') goto yy475;
+ if (yych != 'e') goto yy187;
yy475:
YYDEBUG(475, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'P') goto yy476;
- if (yych != 'p') goto yy186;
+ if (yych == 'S') goto yy476;
+ if (yych != 's') goto yy187;
yy476:
YYDEBUG(476, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy477;
- if (yych != 'a') goto yy186;
+ if (yych == 'P') goto yy477;
+ if (yych != 'p') goto yy187;
yy477:
YYDEBUG(477, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy478;
- if (yych != 'c') goto yy186;
+ if (yych == 'A') goto yy478;
+ if (yych != 'a') goto yy187;
yy478:
YYDEBUG(478, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy479;
- if (yych != 'e') goto yy186;
+ if (yych == 'C') goto yy479;
+ if (yych != 'c') goto yy187;
yy479:
YYDEBUG(479, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'E') goto yy480;
+ if (yych != 'e') goto yy187;
+yy480:
+ YYDEBUG(480, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(480, *YYCURSOR);
+ YYDEBUG(481, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1262 "Zend/zend_language_scanner.l"
+#line 1272 "Zend/zend_language_scanner.l"
{
return T_NAMESPACE;
}
-#line 5213 "Zend/zend_language_scanner.c"
-yy481:
- YYDEBUG(481, *YYCURSOR);
- ++YYCURSOR;
+#line 5225 "Zend/zend_language_scanner.c"
+yy482:
YYDEBUG(482, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(483, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1194 "Zend/zend_language_scanner.l"
+#line 1204 "Zend/zend_language_scanner.l"
{
return T_PAAMAYIM_NEKUDOTAYIM;
}
-#line 5223 "Zend/zend_language_scanner.c"
-yy483:
- YYDEBUG(483, *YYCURSOR);
+#line 5235 "Zend/zend_language_scanner.c"
+yy484:
+ YYDEBUG(484, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy484:
- YYDEBUG(484, *YYCURSOR);
+yy485:
+ YYDEBUG(485, *YYCURSOR);
if (yych <= '\f') {
- if (yych <= 0x08) goto yy140;
- if (yych <= '\n') goto yy483;
- goto yy140;
+ if (yych <= 0x08) goto yy141;
+ if (yych <= '\n') goto yy484;
+ goto yy141;
} else {
- if (yych <= '\r') goto yy483;
- if (yych == ' ') goto yy483;
- goto yy140;
+ if (yych <= '\r') goto yy484;
+ if (yych == ' ') goto yy484;
+ goto yy141;
}
-yy485:
- YYDEBUG(485, *YYCURSOR);
- ++YYCURSOR;
+yy486:
YYDEBUG(486, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(487, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1370 "Zend/zend_language_scanner.l"
+#line 1380 "Zend/zend_language_scanner.l"
{
return T_MINUS_EQUAL;
}
-#line 5249 "Zend/zend_language_scanner.c"
-yy487:
- YYDEBUG(487, *YYCURSOR);
- ++YYCURSOR;
+#line 5261 "Zend/zend_language_scanner.c"
+yy488:
YYDEBUG(488, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(489, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1338 "Zend/zend_language_scanner.l"
+#line 1348 "Zend/zend_language_scanner.l"
{
return T_DEC;
}
-#line 5259 "Zend/zend_language_scanner.c"
-yy489:
- YYDEBUG(489, *YYCURSOR);
- ++YYCURSOR;
+#line 5271 "Zend/zend_language_scanner.c"
+yy490:
YYDEBUG(490, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(491, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1164 "Zend/zend_language_scanner.l"
+#line 1174 "Zend/zend_language_scanner.l"
{
yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC);
return T_OBJECT_OPERATOR;
}
-#line 5270 "Zend/zend_language_scanner.c"
-yy491:
- YYDEBUG(491, *YYCURSOR);
+#line 5282 "Zend/zend_language_scanner.c"
+yy492:
+ YYDEBUG(492, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'O') {
- if (yych == 'I') goto yy498;
- if (yych <= 'N') goto yy186;
- goto yy499;
+ if (yych == 'I') goto yy499;
+ if (yych <= 'N') goto yy187;
+ goto yy500;
} else {
if (yych <= 'i') {
- if (yych <= 'h') goto yy186;
- goto yy498;
+ if (yych <= 'h') goto yy187;
+ goto yy499;
} else {
- if (yych == 'o') goto yy499;
- goto yy186;
+ if (yych == 'o') goto yy500;
+ goto yy187;
}
}
-yy492:
- YYDEBUG(492, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'B') goto yy493;
- if (yych != 'b') goto yy186;
yy493:
YYDEBUG(493, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy494;
- if (yych != 'l') goto yy186;
+ if (yych == 'B') goto yy494;
+ if (yych != 'b') goto yy187;
yy494:
YYDEBUG(494, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy495;
- if (yych != 'i') goto yy186;
+ if (yych == 'L') goto yy495;
+ if (yych != 'l') goto yy187;
yy495:
YYDEBUG(495, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy496;
- if (yych != 'c') goto yy186;
+ if (yych == 'I') goto yy496;
+ if (yych != 'i') goto yy187;
yy496:
YYDEBUG(496, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'C') goto yy497;
+ if (yych != 'c') goto yy187;
+yy497:
+ YYDEBUG(497, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(497, *YYCURSOR);
+ YYDEBUG(498, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1310 "Zend/zend_language_scanner.l"
+#line 1320 "Zend/zend_language_scanner.l"
{
return T_PUBLIC;
}
-#line 5319 "Zend/zend_language_scanner.c"
-yy498:
- YYDEBUG(498, *YYCURSOR);
+#line 5331 "Zend/zend_language_scanner.c"
+yy499:
+ YYDEBUG(499, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'V') {
- if (yych == 'N') goto yy507;
- if (yych <= 'U') goto yy186;
- goto yy508;
+ if (yych == 'N') goto yy508;
+ if (yych <= 'U') goto yy187;
+ goto yy509;
} else {
if (yych <= 'n') {
- if (yych <= 'm') goto yy186;
- goto yy507;
+ if (yych <= 'm') goto yy187;
+ goto yy508;
} else {
- if (yych == 'v') goto yy508;
- goto yy186;
+ if (yych == 'v') goto yy509;
+ goto yy187;
}
}
-yy499:
- YYDEBUG(499, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'T') goto yy500;
- if (yych != 't') goto yy186;
yy500:
YYDEBUG(500, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy501;
- if (yych != 'e') goto yy186;
+ if (yych == 'T') goto yy501;
+ if (yych != 't') goto yy187;
yy501:
YYDEBUG(501, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy502;
- if (yych != 'c') goto yy186;
+ if (yych == 'E') goto yy502;
+ if (yych != 'e') goto yy187;
yy502:
YYDEBUG(502, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy503;
- if (yych != 't') goto yy186;
+ if (yych == 'C') goto yy503;
+ if (yych != 'c') goto yy187;
yy503:
YYDEBUG(503, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy504;
- if (yych != 'e') goto yy186;
+ if (yych == 'T') goto yy504;
+ if (yych != 't') goto yy187;
yy504:
YYDEBUG(504, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'D') goto yy505;
- if (yych != 'd') goto yy186;
+ if (yych == 'E') goto yy505;
+ if (yych != 'e') goto yy187;
yy505:
YYDEBUG(505, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'D') goto yy506;
+ if (yych != 'd') goto yy187;
+yy506:
+ YYDEBUG(506, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(506, *YYCURSOR);
+ YYDEBUG(507, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1306 "Zend/zend_language_scanner.l"
+#line 1316 "Zend/zend_language_scanner.l"
{
return T_PROTECTED;
}
-#line 5378 "Zend/zend_language_scanner.c"
-yy507:
- YYDEBUG(507, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'T') goto yy513;
- if (yych == 't') goto yy513;
- goto yy186;
+#line 5390 "Zend/zend_language_scanner.c"
yy508:
YYDEBUG(508, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy509;
- if (yych != 'a') goto yy186;
+ if (yych == 'T') goto yy514;
+ if (yych == 't') goto yy514;
+ goto yy187;
yy509:
YYDEBUG(509, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy510;
- if (yych != 't') goto yy186;
+ if (yych == 'A') goto yy510;
+ if (yych != 'a') goto yy187;
yy510:
YYDEBUG(510, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy511;
- if (yych != 'e') goto yy186;
+ if (yych == 'T') goto yy511;
+ if (yych != 't') goto yy187;
yy511:
YYDEBUG(511, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'E') goto yy512;
+ if (yych != 'e') goto yy187;
+yy512:
+ YYDEBUG(512, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(512, *YYCURSOR);
+ YYDEBUG(513, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1302 "Zend/zend_language_scanner.l"
+#line 1312 "Zend/zend_language_scanner.l"
{
return T_PRIVATE;
}
-#line 5412 "Zend/zend_language_scanner.c"
-yy513:
- YYDEBUG(513, *YYCURSOR);
+#line 5424 "Zend/zend_language_scanner.c"
+yy514:
+ YYDEBUG(514, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(514, *YYCURSOR);
+ YYDEBUG(515, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1140 "Zend/zend_language_scanner.l"
+#line 1150 "Zend/zend_language_scanner.l"
{
return T_PRINT;
}
-#line 5425 "Zend/zend_language_scanner.c"
-yy515:
- YYDEBUG(515, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'O') goto yy520;
- if (yych == 'o') goto yy520;
- goto yy186;
+#line 5437 "Zend/zend_language_scanner.c"
yy516:
YYDEBUG(516, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy517;
- if (yych != 't') goto yy186;
+ if (yych == 'O') goto yy521;
+ if (yych == 'o') goto yy521;
+ goto yy187;
yy517:
YYDEBUG(517, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy518;
- if (yych != 'o') goto yy186;
+ if (yych == 'T') goto yy518;
+ if (yych != 't') goto yy187;
yy518:
YYDEBUG(518, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'O') goto yy519;
+ if (yych != 'o') goto yy187;
+yy519:
+ YYDEBUG(519, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(519, *YYCURSOR);
+ YYDEBUG(520, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1132 "Zend/zend_language_scanner.l"
+#line 1142 "Zend/zend_language_scanner.l"
{
return T_GOTO;
}
-#line 5454 "Zend/zend_language_scanner.c"
-yy520:
- YYDEBUG(520, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'B') goto yy521;
- if (yych != 'b') goto yy186;
+#line 5466 "Zend/zend_language_scanner.c"
yy521:
YYDEBUG(521, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy522;
- if (yych != 'a') goto yy186;
+ if (yych == 'B') goto yy522;
+ if (yych != 'b') goto yy187;
yy522:
YYDEBUG(522, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy523;
- if (yych != 'l') goto yy186;
+ if (yych == 'A') goto yy523;
+ if (yych != 'a') goto yy187;
yy523:
YYDEBUG(523, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'L') goto yy524;
+ if (yych != 'l') goto yy187;
+yy524:
+ YYDEBUG(524, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(524, *YYCURSOR);
+ YYDEBUG(525, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1274 "Zend/zend_language_scanner.l"
+#line 1284 "Zend/zend_language_scanner.l"
{
return T_GLOBAL;
}
-#line 5482 "Zend/zend_language_scanner.c"
-yy525:
- YYDEBUG(525, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == '<') goto yy533;
- goto yy193;
+#line 5494 "Zend/zend_language_scanner.c"
yy526:
YYDEBUG(526, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy180;
+ if (yych == '<') goto yy534;
+ goto yy194;
yy527:
YYDEBUG(527, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy178;
+ goto yy181;
yy528:
YYDEBUG(528, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy529;
- if (yych != 'e') goto yy186;
+ goto yy179;
yy529:
YYDEBUG(529, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy530;
- if (yych != 'a') goto yy186;
+ if (yych == 'E') goto yy530;
+ if (yych != 'e') goto yy187;
yy530:
YYDEBUG(530, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'K') goto yy531;
- if (yych != 'k') goto yy186;
+ if (yych == 'A') goto yy531;
+ if (yych != 'a') goto yy187;
yy531:
YYDEBUG(531, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'K') goto yy532;
+ if (yych != 'k') goto yy187;
+yy532:
+ YYDEBUG(532, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(532, *YYCURSOR);
+ YYDEBUG(533, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1124 "Zend/zend_language_scanner.l"
+#line 1134 "Zend/zend_language_scanner.l"
{
return T_BREAK;
}
-#line 5523 "Zend/zend_language_scanner.c"
-yy533:
- YYDEBUG(533, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == '<') goto yy269;
- goto yy193;
+#line 5535 "Zend/zend_language_scanner.c"
yy534:
YYDEBUG(534, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy541;
- if (yych == 'a') goto yy541;
- goto yy186;
+ if (yych == '<') goto yy270;
+ goto yy194;
yy535:
YYDEBUG(535, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy536;
- if (yych != 'i') goto yy186;
+ if (yych == 'A') goto yy542;
+ if (yych == 'a') goto yy542;
+ goto yy187;
yy536:
YYDEBUG(536, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy537;
- if (yych != 't') goto yy186;
+ if (yych == 'I') goto yy537;
+ if (yych != 'i') goto yy187;
yy537:
YYDEBUG(537, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy538;
- if (yych != 'c') goto yy186;
+ if (yych == 'T') goto yy538;
+ if (yych != 't') goto yy187;
yy538:
YYDEBUG(538, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'H') goto yy539;
- if (yych != 'h') goto yy186;
+ if (yych == 'C') goto yy539;
+ if (yych != 'c') goto yy187;
yy539:
YYDEBUG(539, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'H') goto yy540;
+ if (yych != 'h') goto yy187;
+yy540:
+ YYDEBUG(540, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(540, *YYCURSOR);
+ YYDEBUG(541, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1108 "Zend/zend_language_scanner.l"
+#line 1118 "Zend/zend_language_scanner.l"
{
return T_SWITCH;
}
-#line 5567 "Zend/zend_language_scanner.c"
-yy541:
- YYDEBUG(541, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'T') goto yy542;
- if (yych != 't') goto yy186;
+#line 5579 "Zend/zend_language_scanner.c"
yy542:
YYDEBUG(542, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy543;
- if (yych != 'i') goto yy186;
+ if (yych == 'T') goto yy543;
+ if (yych != 't') goto yy187;
yy543:
YYDEBUG(543, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy544;
- if (yych != 'c') goto yy186;
+ if (yych == 'I') goto yy544;
+ if (yych != 'i') goto yy187;
yy544:
YYDEBUG(544, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'C') goto yy545;
+ if (yych != 'c') goto yy187;
+yy545:
+ YYDEBUG(545, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(545, *YYCURSOR);
+ YYDEBUG(546, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1290 "Zend/zend_language_scanner.l"
+#line 1300 "Zend/zend_language_scanner.l"
{
return T_STATIC;
}
-#line 5595 "Zend/zend_language_scanner.c"
-yy546:
- YYDEBUG(546, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'S') goto yy557;
- if (yych == 's') goto yy557;
- goto yy186;
+#line 5607 "Zend/zend_language_scanner.c"
yy547:
YYDEBUG(547, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'D') goto yy555;
- if (yych == 'd') goto yy555;
- goto yy186;
+ if (yych == 'S') goto yy558;
+ if (yych == 's') goto yy558;
+ goto yy187;
yy548:
YYDEBUG(548, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy551;
- if (yych == 'r') goto yy551;
- goto yy186;
+ if (yych == 'D') goto yy556;
+ if (yych == 'd') goto yy556;
+ goto yy187;
yy549:
YYDEBUG(549, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'R') goto yy552;
+ if (yych == 'r') goto yy552;
+ goto yy187;
+yy550:
+ YYDEBUG(550, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(550, *YYCURSOR);
+ YYDEBUG(551, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1104 "Zend/zend_language_scanner.l"
+#line 1114 "Zend/zend_language_scanner.l"
{
return T_AS;
}
-#line 5626 "Zend/zend_language_scanner.c"
-yy551:
- YYDEBUG(551, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'A') goto yy552;
- if (yych != 'a') goto yy186;
+#line 5638 "Zend/zend_language_scanner.c"
yy552:
YYDEBUG(552, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'Y') goto yy553;
- if (yych != 'y') goto yy186;
+ if (yych == 'A') goto yy553;
+ if (yych != 'a') goto yy187;
yy553:
YYDEBUG(553, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'Y') goto yy554;
+ if (yych != 'y') goto yy187;
+yy554:
+ YYDEBUG(554, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(554, *YYCURSOR);
+ YYDEBUG(555, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1326 "Zend/zend_language_scanner.l"
+#line 1336 "Zend/zend_language_scanner.l"
{
return T_ARRAY;
}
-#line 5649 "Zend/zend_language_scanner.c"
-yy555:
- YYDEBUG(555, *YYCURSOR);
+#line 5661 "Zend/zend_language_scanner.c"
+yy556:
+ YYDEBUG(556, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(556, *YYCURSOR);
+ YYDEBUG(557, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1422 "Zend/zend_language_scanner.l"
+#line 1432 "Zend/zend_language_scanner.l"
{
return T_LOGICAL_AND;
}
-#line 5662 "Zend/zend_language_scanner.c"
-yy557:
- YYDEBUG(557, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'T') goto yy558;
- if (yych != 't') goto yy186;
+#line 5674 "Zend/zend_language_scanner.c"
yy558:
YYDEBUG(558, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy559;
- if (yych != 'r') goto yy186;
+ if (yych == 'T') goto yy559;
+ if (yych != 't') goto yy187;
yy559:
YYDEBUG(559, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy560;
- if (yych != 'a') goto yy186;
+ if (yych == 'R') goto yy560;
+ if (yych != 'r') goto yy187;
yy560:
YYDEBUG(560, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy561;
- if (yych != 'c') goto yy186;
+ if (yych == 'A') goto yy561;
+ if (yych != 'a') goto yy187;
yy561:
YYDEBUG(561, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy562;
- if (yych != 't') goto yy186;
+ if (yych == 'C') goto yy562;
+ if (yych != 'c') goto yy187;
yy562:
YYDEBUG(562, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'T') goto yy563;
+ if (yych != 't') goto yy187;
+yy563:
+ YYDEBUG(563, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(563, *YYCURSOR);
+ YYDEBUG(564, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1294 "Zend/zend_language_scanner.l"
+#line 1304 "Zend/zend_language_scanner.l"
{
return T_ABSTRACT;
}
-#line 5700 "Zend/zend_language_scanner.c"
-yy564:
- YYDEBUG(564, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'I') goto yy565;
- if (yych != 'i') goto yy186;
+#line 5712 "Zend/zend_language_scanner.c"
yy565:
YYDEBUG(565, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy566;
- if (yych != 'l') goto yy186;
+ if (yych == 'I') goto yy566;
+ if (yych != 'i') goto yy187;
yy566:
YYDEBUG(566, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy567;
- if (yych != 'e') goto yy186;
+ if (yych == 'L') goto yy567;
+ if (yych != 'l') goto yy187;
yy567:
YYDEBUG(567, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'E') goto yy568;
+ if (yych != 'e') goto yy187;
+yy568:
+ YYDEBUG(568, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(568, *YYCURSOR);
+ YYDEBUG(569, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1064 "Zend/zend_language_scanner.l"
+#line 1074 "Zend/zend_language_scanner.l"
{
return T_WHILE;
}
-#line 5728 "Zend/zend_language_scanner.c"
-yy569:
- YYDEBUG(569, *YYCURSOR);
+#line 5740 "Zend/zend_language_scanner.c"
+yy570:
+ YYDEBUG(570, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(570, *YYCURSOR);
+ YYDEBUG(571, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1048 "Zend/zend_language_scanner.l"
+#line 1058 "Zend/zend_language_scanner.l"
{
return T_IF;
}
-#line 5741 "Zend/zend_language_scanner.c"
-yy571:
- YYDEBUG(571, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'P') goto yy613;
- if (yych == 'p') goto yy613;
- goto yy186;
+#line 5753 "Zend/zend_language_scanner.c"
yy572:
YYDEBUG(572, *YYCURSOR);
yych = *++YYCURSOR;
+ if (yych == 'P') goto yy614;
+ if (yych == 'p') goto yy614;
+ goto yy187;
+yy573:
+ YYDEBUG(573, *YYCURSOR);
+ yych = *++YYCURSOR;
if (yych <= 'T') {
if (yych <= 'C') {
- if (yych <= 'B') goto yy186;
- goto yy580;
+ if (yych <= 'B') goto yy187;
+ goto yy581;
} else {
- if (yych <= 'R') goto yy186;
- if (yych <= 'S') goto yy578;
- goto yy579;
+ if (yych <= 'R') goto yy187;
+ if (yych <= 'S') goto yy579;
+ goto yy580;
}
} else {
if (yych <= 'r') {
- if (yych == 'c') goto yy580;
- goto yy186;
+ if (yych == 'c') goto yy581;
+ goto yy187;
} else {
- if (yych <= 's') goto yy578;
- if (yych <= 't') goto yy579;
- goto yy186;
+ if (yych <= 's') goto yy579;
+ if (yych <= 't') goto yy580;
+ goto yy187;
}
}
-yy573:
- YYDEBUG(573, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'S') goto yy574;
- if (yych != 's') goto yy186;
yy574:
YYDEBUG(574, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy575;
- if (yych != 'e') goto yy186;
+ if (yych == 'S') goto yy575;
+ if (yych != 's') goto yy187;
yy575:
YYDEBUG(575, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy576;
- if (yych != 't') goto yy186;
+ if (yych == 'E') goto yy576;
+ if (yych != 'e') goto yy187;
yy576:
YYDEBUG(576, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'T') goto yy577;
+ if (yych != 't') goto yy187;
+yy577:
+ YYDEBUG(577, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(577, *YYCURSOR);
+ YYDEBUG(578, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1278 "Zend/zend_language_scanner.l"
+#line 1288 "Zend/zend_language_scanner.l"
{
return T_ISSET;
}
-#line 5797 "Zend/zend_language_scanner.c"
-yy578:
- YYDEBUG(578, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'T') goto yy599;
- if (yych == 't') goto yy599;
- goto yy186;
+#line 5809 "Zend/zend_language_scanner.c"
yy579:
YYDEBUG(579, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy592;
- if (yych == 'e') goto yy592;
- goto yy186;
+ if (yych == 'T') goto yy600;
+ if (yych == 't') goto yy600;
+ goto yy187;
yy580:
YYDEBUG(580, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy581;
- if (yych != 'l') goto yy186;
+ if (yych == 'E') goto yy593;
+ if (yych == 'e') goto yy593;
+ goto yy187;
yy581:
YYDEBUG(581, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'U') goto yy582;
- if (yych != 'u') goto yy186;
+ if (yych == 'L') goto yy582;
+ if (yych != 'l') goto yy187;
yy582:
YYDEBUG(582, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'D') goto yy583;
- if (yych != 'd') goto yy186;
+ if (yych == 'U') goto yy583;
+ if (yych != 'u') goto yy187;
yy583:
YYDEBUG(583, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy584;
- if (yych != 'e') goto yy186;
+ if (yych == 'D') goto yy584;
+ if (yych != 'd') goto yy187;
yy584:
YYDEBUG(584, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'E') goto yy585;
+ if (yych != 'e') goto yy187;
+yy585:
+ YYDEBUG(585, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) <= '^') {
if (yych <= '9') {
- if (yych >= '0') goto yy185;
+ if (yych >= '0') goto yy186;
} else {
- if (yych <= '@') goto yy585;
- if (yych <= 'Z') goto yy185;
+ if (yych <= '@') goto yy586;
+ if (yych <= 'Z') goto yy186;
}
} else {
if (yych <= '`') {
- if (yych <= '_') goto yy586;
+ if (yych <= '_') goto yy587;
} else {
- if (yych <= 'z') goto yy185;
- if (yych >= 0x7F) goto yy185;
+ if (yych <= 'z') goto yy186;
+ if (yych >= 0x7F) goto yy186;
}
}
-yy585:
- YYDEBUG(585, *YYCURSOR);
+yy586:
+ YYDEBUG(586, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1246 "Zend/zend_language_scanner.l"
+#line 1256 "Zend/zend_language_scanner.l"
{
return T_INCLUDE;
}
-#line 5855 "Zend/zend_language_scanner.c"
-yy586:
- YYDEBUG(586, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'O') goto yy587;
- if (yych != 'o') goto yy186;
+#line 5867 "Zend/zend_language_scanner.c"
yy587:
YYDEBUG(587, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy588;
- if (yych != 'n') goto yy186;
+ if (yych == 'O') goto yy588;
+ if (yych != 'o') goto yy187;
yy588:
YYDEBUG(588, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy589;
- if (yych != 'c') goto yy186;
+ if (yych == 'N') goto yy589;
+ if (yych != 'n') goto yy187;
yy589:
YYDEBUG(589, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy590;
- if (yych != 'e') goto yy186;
+ if (yych == 'C') goto yy590;
+ if (yych != 'c') goto yy187;
yy590:
YYDEBUG(590, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'E') goto yy591;
+ if (yych != 'e') goto yy187;
+yy591:
+ YYDEBUG(591, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(591, *YYCURSOR);
+ YYDEBUG(592, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1250 "Zend/zend_language_scanner.l"
+#line 1260 "Zend/zend_language_scanner.l"
{
return T_INCLUDE_ONCE;
}
-#line 5888 "Zend/zend_language_scanner.c"
-yy592:
- YYDEBUG(592, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'R') goto yy593;
- if (yych != 'r') goto yy186;
+#line 5900 "Zend/zend_language_scanner.c"
yy593:
YYDEBUG(593, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'F') goto yy594;
- if (yych != 'f') goto yy186;
+ if (yych == 'R') goto yy594;
+ if (yych != 'r') goto yy187;
yy594:
YYDEBUG(594, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy595;
- if (yych != 'a') goto yy186;
+ if (yych == 'F') goto yy595;
+ if (yych != 'f') goto yy187;
yy595:
YYDEBUG(595, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy596;
- if (yych != 'c') goto yy186;
+ if (yych == 'A') goto yy596;
+ if (yych != 'a') goto yy187;
yy596:
YYDEBUG(596, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy597;
- if (yych != 'e') goto yy186;
+ if (yych == 'C') goto yy597;
+ if (yych != 'c') goto yy187;
yy597:
YYDEBUG(597, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'E') goto yy598;
+ if (yych != 'e') goto yy187;
+yy598:
+ YYDEBUG(598, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(598, *YYCURSOR);
+ YYDEBUG(599, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1148 "Zend/zend_language_scanner.l"
+#line 1158 "Zend/zend_language_scanner.l"
{
return T_INTERFACE;
}
-#line 5926 "Zend/zend_language_scanner.c"
-yy599:
- YYDEBUG(599, *YYCURSOR);
+#line 5938 "Zend/zend_language_scanner.c"
+yy600:
+ YYDEBUG(600, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'E') {
- if (yych == 'A') goto yy600;
- if (yych <= 'D') goto yy186;
- goto yy601;
+ if (yych == 'A') goto yy601;
+ if (yych <= 'D') goto yy187;
+ goto yy602;
} else {
if (yych <= 'a') {
- if (yych <= '`') goto yy186;
+ if (yych <= '`') goto yy187;
} else {
- if (yych == 'e') goto yy601;
- goto yy186;
+ if (yych == 'e') goto yy602;
+ goto yy187;
}
}
-yy600:
- YYDEBUG(600, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'N') goto yy607;
- if (yych == 'n') goto yy607;
- goto yy186;
yy601:
YYDEBUG(601, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy602;
- if (yych != 'a') goto yy186;
+ if (yych == 'N') goto yy608;
+ if (yych == 'n') goto yy608;
+ goto yy187;
yy602:
YYDEBUG(602, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'D') goto yy603;
- if (yych != 'd') goto yy186;
+ if (yych == 'A') goto yy603;
+ if (yych != 'a') goto yy187;
yy603:
YYDEBUG(603, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy604;
- if (yych != 'o') goto yy186;
+ if (yych == 'D') goto yy604;
+ if (yych != 'd') goto yy187;
yy604:
YYDEBUG(604, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'F') goto yy605;
- if (yych != 'f') goto yy186;
+ if (yych == 'O') goto yy605;
+ if (yych != 'o') goto yy187;
yy605:
YYDEBUG(605, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'F') goto yy606;
+ if (yych != 'f') goto yy187;
+yy606:
+ YYDEBUG(606, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(606, *YYCURSOR);
+ YYDEBUG(607, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1270 "Zend/zend_language_scanner.l"
+#line 1280 "Zend/zend_language_scanner.l"
{
return T_INSTEADOF;
}
-#line 5980 "Zend/zend_language_scanner.c"
-yy607:
- YYDEBUG(607, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'C') goto yy608;
- if (yych != 'c') goto yy186;
+#line 5992 "Zend/zend_language_scanner.c"
yy608:
YYDEBUG(608, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy609;
- if (yych != 'e') goto yy186;
+ if (yych == 'C') goto yy609;
+ if (yych != 'c') goto yy187;
yy609:
YYDEBUG(609, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy610;
- if (yych != 'o') goto yy186;
+ if (yych == 'E') goto yy610;
+ if (yych != 'e') goto yy187;
yy610:
YYDEBUG(610, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'F') goto yy611;
- if (yych != 'f') goto yy186;
+ if (yych == 'O') goto yy611;
+ if (yych != 'o') goto yy187;
yy611:
YYDEBUG(611, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'F') goto yy612;
+ if (yych != 'f') goto yy187;
+yy612:
+ YYDEBUG(612, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(612, *YYCURSOR);
+ YYDEBUG(613, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1100 "Zend/zend_language_scanner.l"
+#line 1110 "Zend/zend_language_scanner.l"
{
return T_INSTANCEOF;
}
-#line 6013 "Zend/zend_language_scanner.c"
-yy613:
- YYDEBUG(613, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'L') goto yy614;
- if (yych != 'l') goto yy186;
+#line 6025 "Zend/zend_language_scanner.c"
yy614:
YYDEBUG(614, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy615;
- if (yych != 'e') goto yy186;
+ if (yych == 'L') goto yy615;
+ if (yych != 'l') goto yy187;
yy615:
YYDEBUG(615, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'M') goto yy616;
- if (yych != 'm') goto yy186;
+ if (yych == 'E') goto yy616;
+ if (yych != 'e') goto yy187;
yy616:
YYDEBUG(616, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy617;
- if (yych != 'e') goto yy186;
+ if (yych == 'M') goto yy617;
+ if (yych != 'm') goto yy187;
yy617:
YYDEBUG(617, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy618;
- if (yych != 'n') goto yy186;
+ if (yych == 'E') goto yy618;
+ if (yych != 'e') goto yy187;
yy618:
YYDEBUG(618, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy619;
- if (yych != 't') goto yy186;
+ if (yych == 'N') goto yy619;
+ if (yych != 'n') goto yy187;
yy619:
YYDEBUG(619, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy620;
- if (yych != 's') goto yy186;
+ if (yych == 'T') goto yy620;
+ if (yych != 't') goto yy187;
yy620:
YYDEBUG(620, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'S') goto yy621;
+ if (yych != 's') goto yy187;
+yy621:
+ YYDEBUG(621, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(621, *YYCURSOR);
+ YYDEBUG(622, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1160 "Zend/zend_language_scanner.l"
+#line 1170 "Zend/zend_language_scanner.l"
{
return T_IMPLEMENTS;
}
-#line 6061 "Zend/zend_language_scanner.c"
-yy622:
- YYDEBUG(622, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'R') goto yy630;
- if (yych == 'r') goto yy630;
- goto yy186;
+#line 6073 "Zend/zend_language_scanner.c"
yy623:
YYDEBUG(623, *YYCURSOR);
yych = *++YYCURSOR;
+ if (yych == 'R') goto yy631;
+ if (yych == 'r') goto yy631;
+ goto yy187;
+yy624:
+ YYDEBUG(624, *YYCURSOR);
+ yych = *++YYCURSOR;
if (yych <= 'Y') {
- if (yych == 'A') goto yy626;
- if (yych <= 'X') goto yy186;
+ if (yych == 'A') goto yy627;
+ if (yych <= 'X') goto yy187;
} else {
if (yych <= 'a') {
- if (yych <= '`') goto yy186;
- goto yy626;
+ if (yych <= '`') goto yy187;
+ goto yy627;
} else {
- if (yych != 'y') goto yy186;
+ if (yych != 'y') goto yy187;
}
}
- YYDEBUG(624, *YYCURSOR);
+ YYDEBUG(625, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(625, *YYCURSOR);
+ YYDEBUG(626, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1036 "Zend/zend_language_scanner.l"
+#line 1042 "Zend/zend_language_scanner.l"
{
return T_TRY;
}
-#line 6093 "Zend/zend_language_scanner.c"
-yy626:
- YYDEBUG(626, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'I') goto yy627;
- if (yych != 'i') goto yy186;
+#line 6105 "Zend/zend_language_scanner.c"
yy627:
YYDEBUG(627, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy628;
- if (yych != 't') goto yy186;
+ if (yych == 'I') goto yy628;
+ if (yych != 'i') goto yy187;
yy628:
YYDEBUG(628, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'T') goto yy629;
+ if (yych != 't') goto yy187;
+yy629:
+ YYDEBUG(629, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(629, *YYCURSOR);
+ YYDEBUG(630, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1152 "Zend/zend_language_scanner.l"
+#line 1162 "Zend/zend_language_scanner.l"
{
return T_TRAIT;
}
-#line 6116 "Zend/zend_language_scanner.c"
-yy630:
- YYDEBUG(630, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'O') goto yy631;
- if (yych != 'o') goto yy186;
+#line 6128 "Zend/zend_language_scanner.c"
yy631:
YYDEBUG(631, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'W') goto yy632;
- if (yych != 'w') goto yy186;
+ if (yych == 'O') goto yy632;
+ if (yych != 'o') goto yy187;
yy632:
YYDEBUG(632, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'W') goto yy633;
+ if (yych != 'w') goto yy187;
+yy633:
+ YYDEBUG(633, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(633, *YYCURSOR);
+ YYDEBUG(634, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1044 "Zend/zend_language_scanner.l"
+#line 1054 "Zend/zend_language_scanner.l"
{
return T_THROW;
}
-#line 6139 "Zend/zend_language_scanner.c"
-yy634:
- YYDEBUG(634, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych <= 'T') {
- if (yych == 'Q') goto yy636;
- if (yych <= 'S') goto yy186;
- } else {
- if (yych <= 'q') {
- if (yych <= 'p') goto yy186;
- goto yy636;
- } else {
- if (yych != 't') goto yy186;
- }
- }
+#line 6151 "Zend/zend_language_scanner.c"
+yy635:
YYDEBUG(635, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'U') goto yy648;
- if (yych == 'u') goto yy648;
- goto yy186;
+ if (yych == 'E') goto yy636;
+ if (yych != 'e') goto yy187;
yy636:
YYDEBUG(636, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'U') goto yy637;
- if (yych != 'u') goto yy186;
+ if (yych == 'L') goto yy637;
+ if (yych != 'l') goto yy187;
yy637:
YYDEBUG(637, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy638;
- if (yych != 'i') goto yy186;
+ if (yych == 'D') goto yy638;
+ if (yych != 'd') goto yy187;
yy638:
YYDEBUG(638, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'R') goto yy639;
- if (yych != 'r') goto yy186;
-yy639:
+ ++YYCURSOR;
+ if (yybm[0+(yych = *YYCURSOR)] & 4) {
+ goto yy186;
+ }
YYDEBUG(639, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'E') goto yy640;
- if (yych != 'e') goto yy186;
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 1038 "Zend/zend_language_scanner.l"
+ {
+ return T_YIELD;
+}
+#line 6179 "Zend/zend_language_scanner.c"
yy640:
YYDEBUG(640, *YYCURSOR);
- ++YYCURSOR;
- if ((yych = *YYCURSOR) <= '^') {
- if (yych <= '9') {
- if (yych >= '0') goto yy185;
- } else {
- if (yych <= '@') goto yy641;
- if (yych <= 'Z') goto yy185;
- }
+ yych = *++YYCURSOR;
+ if (yych <= 'T') {
+ if (yych == 'Q') goto yy642;
+ if (yych <= 'S') goto yy187;
} else {
- if (yych <= '`') {
- if (yych <= '_') goto yy642;
+ if (yych <= 'q') {
+ if (yych <= 'p') goto yy187;
+ goto yy642;
} else {
- if (yych <= 'z') goto yy185;
- if (yych >= 0x7F) goto yy185;
+ if (yych != 't') goto yy187;
}
}
-yy641:
YYDEBUG(641, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 1254 "Zend/zend_language_scanner.l"
- {
- return T_REQUIRE;
-}
-#line 6204 "Zend/zend_language_scanner.c"
+ yych = *++YYCURSOR;
+ if (yych == 'U') goto yy654;
+ if (yych == 'u') goto yy654;
+ goto yy187;
yy642:
YYDEBUG(642, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy643;
- if (yych != 'o') goto yy186;
+ if (yych == 'U') goto yy643;
+ if (yych != 'u') goto yy187;
yy643:
YYDEBUG(643, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy644;
- if (yych != 'n') goto yy186;
+ if (yych == 'I') goto yy644;
+ if (yych != 'i') goto yy187;
yy644:
YYDEBUG(644, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy645;
- if (yych != 'c') goto yy186;
+ if (yych == 'R') goto yy645;
+ if (yych != 'r') goto yy187;
yy645:
YYDEBUG(645, *YYCURSOR);
yych = *++YYCURSOR;
if (yych == 'E') goto yy646;
- if (yych != 'e') goto yy186;
+ if (yych != 'e') goto yy187;
yy646:
YYDEBUG(646, *YYCURSOR);
++YYCURSOR;
- if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ if ((yych = *YYCURSOR) <= '^') {
+ if (yych <= '9') {
+ if (yych >= '0') goto yy186;
+ } else {
+ if (yych <= '@') goto yy647;
+ if (yych <= 'Z') goto yy186;
+ }
+ } else {
+ if (yych <= '`') {
+ if (yych <= '_') goto yy648;
+ } else {
+ if (yych <= 'z') goto yy186;
+ if (yych >= 0x7F) goto yy186;
+ }
}
+yy647:
YYDEBUG(647, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1258 "Zend/zend_language_scanner.l"
+#line 1264 "Zend/zend_language_scanner.l"
{
- return T_REQUIRE_ONCE;
+ return T_REQUIRE;
}
-#line 6237 "Zend/zend_language_scanner.c"
+#line 6244 "Zend/zend_language_scanner.c"
yy648:
YYDEBUG(648, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy649;
- if (yych != 'r') goto yy186;
+ if (yych == 'O') goto yy649;
+ if (yych != 'o') goto yy187;
yy649:
YYDEBUG(649, *YYCURSOR);
yych = *++YYCURSOR;
if (yych == 'N') goto yy650;
- if (yych != 'n') goto yy186;
+ if (yych != 'n') goto yy187;
yy650:
YYDEBUG(650, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'C') goto yy651;
+ if (yych != 'c') goto yy187;
+yy651:
+ YYDEBUG(651, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'E') goto yy652;
+ if (yych != 'e') goto yy187;
+yy652:
+ YYDEBUG(652, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(651, *YYCURSOR);
+ YYDEBUG(653, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1032 "Zend/zend_language_scanner.l"
+#line 1268 "Zend/zend_language_scanner.l"
+ {
+ return T_REQUIRE_ONCE;
+}
+#line 6277 "Zend/zend_language_scanner.c"
+yy654:
+ YYDEBUG(654, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'R') goto yy655;
+ if (yych != 'r') goto yy187;
+yy655:
+ YYDEBUG(655, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'N') goto yy656;
+ if (yych != 'n') goto yy187;
+yy656:
+ YYDEBUG(656, *YYCURSOR);
+ ++YYCURSOR;
+ if (yybm[0+(yych = *YYCURSOR)] & 4) {
+ goto yy186;
+ }
+ YYDEBUG(657, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 1034 "Zend/zend_language_scanner.l"
{
return T_RETURN;
}
-#line 6260 "Zend/zend_language_scanner.c"
-yy652:
- YYDEBUG(652, *YYCURSOR);
+#line 6300 "Zend/zend_language_scanner.c"
+yy658:
+ YYDEBUG(658, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'T') {
if (yych <= 'L') {
- if (yych <= 'K') goto yy186;
- goto yy675;
+ if (yych <= 'K') goto yy187;
+ goto yy681;
} else {
- if (yych <= 'R') goto yy186;
- if (yych <= 'S') goto yy674;
- goto yy673;
+ if (yych <= 'R') goto yy187;
+ if (yych <= 'S') goto yy680;
+ goto yy679;
}
} else {
if (yych <= 'r') {
- if (yych == 'l') goto yy675;
- goto yy186;
+ if (yych == 'l') goto yy681;
+ goto yy187;
} else {
- if (yych <= 's') goto yy674;
- if (yych <= 't') goto yy673;
- goto yy186;
+ if (yych <= 's') goto yy680;
+ if (yych <= 't') goto yy679;
+ goto yy187;
}
}
-yy653:
- YYDEBUG(653, *YYCURSOR);
+yy659:
+ YYDEBUG(659, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'O') {
- if (yych == 'A') goto yy665;
- if (yych <= 'N') goto yy186;
- goto yy666;
+ if (yych == 'A') goto yy671;
+ if (yych <= 'N') goto yy187;
+ goto yy672;
} else {
if (yych <= 'a') {
- if (yych <= '`') goto yy186;
- goto yy665;
+ if (yych <= '`') goto yy187;
+ goto yy671;
} else {
- if (yych == 'o') goto yy666;
- goto yy186;
+ if (yych == 'o') goto yy672;
+ goto yy187;
}
}
-yy654:
- YYDEBUG(654, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'N') goto yy655;
- if (yych != 'n') goto yy186;
-yy655:
- YYDEBUG(655, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych <= 'T') {
- if (yych <= 'R') goto yy186;
- if (yych >= 'T') goto yy657;
- } else {
- if (yych <= 'r') goto yy186;
- if (yych <= 's') goto yy656;
- if (yych <= 't') goto yy657;
- goto yy186;
- }
-yy656:
- YYDEBUG(656, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'T') goto yy663;
- if (yych == 't') goto yy663;
- goto yy186;
-yy657:
- YYDEBUG(657, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'I') goto yy658;
- if (yych != 'i') goto yy186;
-yy658:
- YYDEBUG(658, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'N') goto yy659;
- if (yych != 'n') goto yy186;
-yy659:
- YYDEBUG(659, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'U') goto yy660;
- if (yych != 'u') goto yy186;
yy660:
YYDEBUG(660, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy661;
- if (yych != 'e') goto yy186;
+ if (yych == 'N') goto yy661;
+ if (yych != 'n') goto yy187;
yy661:
YYDEBUG(661, *YYCURSOR);
- ++YYCURSOR;
- if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ yych = *++YYCURSOR;
+ if (yych <= 'T') {
+ if (yych <= 'R') goto yy187;
+ if (yych >= 'T') goto yy663;
+ } else {
+ if (yych <= 'r') goto yy187;
+ if (yych <= 's') goto yy662;
+ if (yych <= 't') goto yy663;
+ goto yy187;
}
+yy662:
YYDEBUG(662, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 1128 "Zend/zend_language_scanner.l"
- {
- return T_CONTINUE;
-}
-#line 6354 "Zend/zend_language_scanner.c"
+ yych = *++YYCURSOR;
+ if (yych == 'T') goto yy669;
+ if (yych == 't') goto yy669;
+ goto yy187;
yy663:
YYDEBUG(663, *YYCURSOR);
- ++YYCURSOR;
- if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
- }
+ yych = *++YYCURSOR;
+ if (yych == 'I') goto yy664;
+ if (yych != 'i') goto yy187;
+yy664:
YYDEBUG(664, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 1028 "Zend/zend_language_scanner.l"
- {
- return T_CONST;
-}
-#line 6367 "Zend/zend_language_scanner.c"
+ yych = *++YYCURSOR;
+ if (yych == 'N') goto yy665;
+ if (yych != 'n') goto yy187;
yy665:
YYDEBUG(665, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy670;
- if (yych == 's') goto yy670;
- goto yy186;
+ if (yych == 'U') goto yy666;
+ if (yych != 'u') goto yy187;
yy666:
YYDEBUG(666, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy667;
- if (yych != 'n') goto yy186;
+ if (yych == 'E') goto yy667;
+ if (yych != 'e') goto yy187;
yy667:
YYDEBUG(667, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'E') goto yy668;
- if (yych != 'e') goto yy186;
-yy668:
- YYDEBUG(668, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(669, *YYCURSOR);
+ YYDEBUG(668, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1206 "Zend/zend_language_scanner.l"
+#line 1138 "Zend/zend_language_scanner.l"
{
- return T_CLONE;
+ return T_CONTINUE;
}
-#line 6396 "Zend/zend_language_scanner.c"
-yy670:
- YYDEBUG(670, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'S') goto yy671;
- if (yych != 's') goto yy186;
-yy671:
- YYDEBUG(671, *YYCURSOR);
+#line 6394 "Zend/zend_language_scanner.c"
+yy669:
+ YYDEBUG(669, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(672, *YYCURSOR);
+ YYDEBUG(670, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1144 "Zend/zend_language_scanner.l"
+#line 1030 "Zend/zend_language_scanner.l"
{
- return T_CLASS;
+ return T_CONST;
}
-#line 6414 "Zend/zend_language_scanner.c"
+#line 6407 "Zend/zend_language_scanner.c"
+yy671:
+ YYDEBUG(671, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'S') goto yy676;
+ if (yych == 's') goto yy676;
+ goto yy187;
+yy672:
+ YYDEBUG(672, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'N') goto yy673;
+ if (yych != 'n') goto yy187;
yy673:
YYDEBUG(673, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy684;
- if (yych == 'c') goto yy684;
- goto yy186;
+ if (yych == 'E') goto yy674;
+ if (yych != 'e') goto yy187;
yy674:
YYDEBUG(674, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'E') goto yy682;
- if (yych == 'e') goto yy682;
- goto yy186;
-yy675:
+ ++YYCURSOR;
+ if (yybm[0+(yych = *YYCURSOR)] & 4) {
+ goto yy186;
+ }
YYDEBUG(675, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'L') goto yy676;
- if (yych != 'l') goto yy186;
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 1216 "Zend/zend_language_scanner.l"
+ {
+ return T_CLONE;
+}
+#line 6436 "Zend/zend_language_scanner.c"
yy676:
YYDEBUG(676, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy677;
- if (yych != 'a') goto yy186;
+ if (yych == 'S') goto yy677;
+ if (yych != 's') goto yy187;
yy677:
YYDEBUG(677, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'B') goto yy678;
- if (yych != 'b') goto yy186;
-yy678:
+ ++YYCURSOR;
+ if (yybm[0+(yych = *YYCURSOR)] & 4) {
+ goto yy186;
+ }
YYDEBUG(678, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'L') goto yy679;
- if (yych != 'l') goto yy186;
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 1154 "Zend/zend_language_scanner.l"
+ {
+ return T_CLASS;
+}
+#line 6454 "Zend/zend_language_scanner.c"
yy679:
YYDEBUG(679, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy680;
- if (yych != 'e') goto yy186;
+ if (yych == 'C') goto yy690;
+ if (yych == 'c') goto yy690;
+ goto yy187;
yy680:
YYDEBUG(680, *YYCURSOR);
- ++YYCURSOR;
- if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
- }
+ yych = *++YYCURSOR;
+ if (yych == 'E') goto yy688;
+ if (yych == 'e') goto yy688;
+ goto yy187;
+yy681:
YYDEBUG(681, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 1330 "Zend/zend_language_scanner.l"
- {
- return T_CALLABLE;
-}
-#line 6464 "Zend/zend_language_scanner.c"
+ yych = *++YYCURSOR;
+ if (yych == 'L') goto yy682;
+ if (yych != 'l') goto yy187;
yy682:
YYDEBUG(682, *YYCURSOR);
- ++YYCURSOR;
- if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
- }
+ yych = *++YYCURSOR;
+ if (yych == 'A') goto yy683;
+ if (yych != 'a') goto yy187;
+yy683:
YYDEBUG(683, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 1116 "Zend/zend_language_scanner.l"
- {
- return T_CASE;
-}
-#line 6477 "Zend/zend_language_scanner.c"
+ yych = *++YYCURSOR;
+ if (yych == 'B') goto yy684;
+ if (yych != 'b') goto yy187;
yy684:
YYDEBUG(684, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'H') goto yy685;
- if (yych != 'h') goto yy186;
+ if (yych == 'L') goto yy685;
+ if (yych != 'l') goto yy187;
yy685:
YYDEBUG(685, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'E') goto yy686;
+ if (yych != 'e') goto yy187;
+yy686:
+ YYDEBUG(686, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(686, *YYCURSOR);
+ YYDEBUG(687, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1040 "Zend/zend_language_scanner.l"
+#line 1340 "Zend/zend_language_scanner.l"
{
- return T_CATCH;
+ return T_CALLABLE;
}
-#line 6495 "Zend/zend_language_scanner.c"
-yy687:
- YYDEBUG(687, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'N') goto yy704;
- if (yych == 'n') goto yy704;
- goto yy186;
+#line 6504 "Zend/zend_language_scanner.c"
yy688:
YYDEBUG(688, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'R') goto yy697;
- if (yych == 'r') goto yy697;
- goto yy186;
-yy689:
+ ++YYCURSOR;
+ if (yybm[0+(yych = *YYCURSOR)] & 4) {
+ goto yy186;
+ }
YYDEBUG(689, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'N') goto yy690;
- if (yych != 'n') goto yy186;
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 1126 "Zend/zend_language_scanner.l"
+ {
+ return T_CASE;
+}
+#line 6517 "Zend/zend_language_scanner.c"
yy690:
YYDEBUG(690, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy691;
- if (yych != 'c') goto yy186;
+ if (yych == 'H') goto yy691;
+ if (yych != 'h') goto yy187;
yy691:
YYDEBUG(691, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'T') goto yy692;
- if (yych != 't') goto yy186;
-yy692:
+ ++YYCURSOR;
+ if (yybm[0+(yych = *YYCURSOR)] & 4) {
+ goto yy186;
+ }
YYDEBUG(692, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'I') goto yy693;
- if (yych != 'i') goto yy186;
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 1046 "Zend/zend_language_scanner.l"
+ {
+ return T_CATCH;
+}
+#line 6535 "Zend/zend_language_scanner.c"
yy693:
YYDEBUG(693, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy694;
- if (yych != 'o') goto yy186;
+ if (yych == 'N') goto yy710;
+ if (yych == 'n') goto yy710;
+ goto yy187;
yy694:
YYDEBUG(694, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy695;
- if (yych != 'n') goto yy186;
+ if (yych == 'R') goto yy703;
+ if (yych == 'r') goto yy703;
+ goto yy187;
yy695:
YYDEBUG(695, *YYCURSOR);
- ++YYCURSOR;
- if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
- }
+ yych = *++YYCURSOR;
+ if (yych == 'N') goto yy696;
+ if (yych != 'n') goto yy187;
+yy696:
YYDEBUG(696, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 1024 "Zend/zend_language_scanner.l"
- {
- return T_FUNCTION;
-}
-#line 6550 "Zend/zend_language_scanner.c"
+ yych = *++YYCURSOR;
+ if (yych == 'C') goto yy697;
+ if (yych != 'c') goto yy187;
yy697:
YYDEBUG(697, *YYCURSOR);
- ++YYCURSOR;
- if ((yych = *YYCURSOR) <= '^') {
- if (yych <= '@') {
- if (yych <= '/') goto yy698;
- if (yych <= '9') goto yy185;
- } else {
- if (yych == 'E') goto yy699;
- if (yych <= 'Z') goto yy185;
- }
- } else {
- if (yych <= 'd') {
- if (yych != '`') goto yy185;
- } else {
- if (yych <= 'e') goto yy699;
- if (yych <= 'z') goto yy185;
- if (yych >= 0x7F) goto yy185;
- }
- }
+ yych = *++YYCURSOR;
+ if (yych == 'T') goto yy698;
+ if (yych != 't') goto yy187;
yy698:
YYDEBUG(698, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 1076 "Zend/zend_language_scanner.l"
- {
- return T_FOR;
-}
-#line 6578 "Zend/zend_language_scanner.c"
+ yych = *++YYCURSOR;
+ if (yych == 'I') goto yy699;
+ if (yych != 'i') goto yy187;
yy699:
YYDEBUG(699, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy700;
- if (yych != 'a') goto yy186;
+ if (yych == 'O') goto yy700;
+ if (yych != 'o') goto yy187;
yy700:
YYDEBUG(700, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy701;
- if (yych != 'c') goto yy186;
+ if (yych == 'N') goto yy701;
+ if (yych != 'n') goto yy187;
yy701:
YYDEBUG(701, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'H') goto yy702;
- if (yych != 'h') goto yy186;
-yy702:
- YYDEBUG(702, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(703, *YYCURSOR);
+ YYDEBUG(702, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1084 "Zend/zend_language_scanner.l"
+#line 1026 "Zend/zend_language_scanner.l"
{
- return T_FOREACH;
+ return T_FUNCTION;
}
-#line 6606 "Zend/zend_language_scanner.c"
+#line 6590 "Zend/zend_language_scanner.c"
+yy703:
+ YYDEBUG(703, *YYCURSOR);
+ ++YYCURSOR;
+ if ((yych = *YYCURSOR) <= '^') {
+ if (yych <= '@') {
+ if (yych <= '/') goto yy704;
+ if (yych <= '9') goto yy186;
+ } else {
+ if (yych == 'E') goto yy705;
+ if (yych <= 'Z') goto yy186;
+ }
+ } else {
+ if (yych <= 'd') {
+ if (yych != '`') goto yy186;
+ } else {
+ if (yych <= 'e') goto yy705;
+ if (yych <= 'z') goto yy186;
+ if (yych >= 0x7F) goto yy186;
+ }
+ }
yy704:
YYDEBUG(704, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'A') goto yy705;
- if (yych != 'a') goto yy186;
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 1086 "Zend/zend_language_scanner.l"
+ {
+ return T_FOR;
+}
+#line 6618 "Zend/zend_language_scanner.c"
yy705:
YYDEBUG(705, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy706;
- if (yych != 'l') goto yy186;
+ if (yych == 'A') goto yy706;
+ if (yych != 'a') goto yy187;
yy706:
YYDEBUG(706, *YYCURSOR);
- ++YYCURSOR;
- if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
- }
+ yych = *++YYCURSOR;
+ if (yych == 'C') goto yy707;
+ if (yych != 'c') goto yy187;
+yy707:
YYDEBUG(707, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 1298 "Zend/zend_language_scanner.l"
- {
- return T_FINAL;
-}
-#line 6629 "Zend/zend_language_scanner.c"
+ yych = *++YYCURSOR;
+ if (yych == 'H') goto yy708;
+ if (yych != 'h') goto yy187;
yy708:
YYDEBUG(708, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych <= 'F') {
- if (yych == 'C') goto yy714;
- if (yych <= 'E') goto yy186;
- goto yy715;
- } else {
- if (yych <= 'c') {
- if (yych <= 'b') goto yy186;
- goto yy714;
- } else {
- if (yych == 'f') goto yy715;
- goto yy186;
- }
- }
-yy709:
- YYDEBUG(709, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'E') goto yy712;
- if (yych == 'e') goto yy712;
- goto yy186;
-yy710:
- YYDEBUG(710, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(711, *YYCURSOR);
+ YYDEBUG(709, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1072 "Zend/zend_language_scanner.l"
+#line 1094 "Zend/zend_language_scanner.l"
{
- return T_DO;
+ return T_FOREACH;
}
-#line 6664 "Zend/zend_language_scanner.c"
+#line 6646 "Zend/zend_language_scanner.c"
+yy710:
+ YYDEBUG(710, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'A') goto yy711;
+ if (yych != 'a') goto yy187;
+yy711:
+ YYDEBUG(711, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'L') goto yy712;
+ if (yych != 'l') goto yy187;
yy712:
YYDEBUG(712, *YYCURSOR);
++YYCURSOR;
- if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ 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 1020 "Zend/zend_language_scanner.l"
+#line 1308 "Zend/zend_language_scanner.l"
{
- return T_EXIT;
+ return T_FINAL;
}
-#line 6677 "Zend/zend_language_scanner.c"
+#line 6684 "Zend/zend_language_scanner.c"
yy714:
YYDEBUG(714, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy721;
- if (yych == 'l') goto yy721;
- goto yy186;
+ if (yych == 'Y') goto yy715;
+ if (yych != 'y') goto yy187;
yy715:
YYDEBUG(715, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'A') goto yy716;
- if (yych != 'a') goto yy186;
-yy716:
+ ++YYCURSOR;
+ if (yybm[0+(yych = *YYCURSOR)] & 4) {
+ goto yy186;
+ }
YYDEBUG(716, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'U') goto yy717;
- if (yych != 'u') goto yy186;
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 1050 "Zend/zend_language_scanner.l"
+ {
+ return T_FINALLY;
+}
+#line 6702 "Zend/zend_language_scanner.c"
yy717:
YYDEBUG(717, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy718;
- if (yych != 'l') goto yy186;
+ if (yych <= 'F') {
+ if (yych == 'C') goto yy723;
+ if (yych <= 'E') goto yy187;
+ goto yy724;
+ } else {
+ if (yych <= 'c') {
+ if (yych <= 'b') goto yy187;
+ goto yy723;
+ } else {
+ if (yych == 'f') goto yy724;
+ goto yy187;
+ }
+ }
yy718:
YYDEBUG(718, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy719;
- if (yych != 't') goto yy186;
+ if (yych == 'E') goto yy721;
+ if (yych == 'e') goto yy721;
+ goto yy187;
yy719:
YYDEBUG(719, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
YYDEBUG(720, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1120 "Zend/zend_language_scanner.l"
+#line 1082 "Zend/zend_language_scanner.l"
{
- return T_DEFAULT;
+ return T_DO;
}
-#line 6716 "Zend/zend_language_scanner.c"
+#line 6737 "Zend/zend_language_scanner.c"
yy721:
YYDEBUG(721, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'A') goto yy722;
- if (yych != 'a') goto yy186;
-yy722:
+ ++YYCURSOR;
+ if (yybm[0+(yych = *YYCURSOR)] & 4) {
+ goto yy186;
+ }
YYDEBUG(722, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'R') goto yy723;
- if (yych != 'r') goto yy186;
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 1022 "Zend/zend_language_scanner.l"
+ {
+ return T_EXIT;
+}
+#line 6750 "Zend/zend_language_scanner.c"
yy723:
YYDEBUG(723, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy724;
- if (yych != 'e') goto yy186;
+ if (yych == 'L') goto yy730;
+ if (yych == 'l') goto yy730;
+ goto yy187;
yy724:
YYDEBUG(724, *YYCURSOR);
- ++YYCURSOR;
- if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
- }
+ yych = *++YYCURSOR;
+ if (yych == 'A') goto yy725;
+ if (yych != 'a') goto yy187;
+yy725:
YYDEBUG(725, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 1092 "Zend/zend_language_scanner.l"
- {
- return T_DECLARE;
-}
-#line 6744 "Zend/zend_language_scanner.c"
+ yych = *++YYCURSOR;
+ if (yych == 'U') goto yy726;
+ if (yych != 'u') goto yy187;
yy726:
YYDEBUG(726, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'H') goto yy788;
- if (yych == 'h') goto yy788;
- goto yy186;
+ if (yych == 'L') goto yy727;
+ if (yych != 'l') goto yy187;
yy727:
YYDEBUG(727, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy782;
- if (yych == 's') goto yy782;
- goto yy186;
+ if (yych == 'T') goto yy728;
+ if (yych != 't') goto yy187;
yy728:
YYDEBUG(728, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'P') goto yy778;
- if (yych == 'p') goto yy778;
- goto yy186;
-yy729:
+ ++YYCURSOR;
+ if (yybm[0+(yych = *YYCURSOR)] & 4) {
+ goto yy186;
+ }
YYDEBUG(729, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'D') goto yy744;
- if (yych == 'd') goto yy744;
- goto yy186;
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 1130 "Zend/zend_language_scanner.l"
+ {
+ return T_DEFAULT;
+}
+#line 6789 "Zend/zend_language_scanner.c"
yy730:
YYDEBUG(730, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy741;
- if (yych == 'a') goto yy741;
- goto yy186;
+ if (yych == 'A') goto yy731;
+ if (yych != 'a') goto yy187;
yy731:
YYDEBUG(731, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych <= 'T') {
- if (yych == 'I') goto yy732;
- if (yych <= 'S') goto yy186;
- goto yy733;
- } else {
- if (yych <= 'i') {
- if (yych <= 'h') goto yy186;
- } else {
- if (yych == 't') goto yy733;
- goto yy186;
- }
- }
+ if (yych == 'R') goto yy732;
+ if (yych != 'r') goto yy187;
yy732:
YYDEBUG(732, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy739;
- if (yych == 't') goto yy739;
- goto yy186;
+ if (yych == 'E') goto yy733;
+ if (yych != 'e') goto yy187;
yy733:
YYDEBUG(733, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'E') goto yy734;
- if (yych != 'e') goto yy186;
-yy734:
+ ++YYCURSOR;
+ if (yybm[0+(yych = *YYCURSOR)] & 4) {
+ goto yy186;
+ }
YYDEBUG(734, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'N') goto yy735;
- if (yych != 'n') goto yy186;
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 1102 "Zend/zend_language_scanner.l"
+ {
+ return T_DECLARE;
+}
+#line 6817 "Zend/zend_language_scanner.c"
yy735:
YYDEBUG(735, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'D') goto yy736;
- if (yych != 'd') goto yy186;
+ if (yych == 'H') goto yy797;
+ if (yych == 'h') goto yy797;
+ goto yy187;
yy736:
YYDEBUG(736, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy737;
- if (yych != 's') goto yy186;
+ if (yych == 'S') goto yy791;
+ if (yych == 's') goto yy791;
+ goto yy187;
yy737:
YYDEBUG(737, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'P') goto yy787;
+ if (yych == 'p') goto yy787;
+ goto yy187;
+yy738:
+ YYDEBUG(738, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'D') goto yy753;
+ if (yych == 'd') goto yy753;
+ goto yy187;
+yy739:
+ YYDEBUG(739, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'A') goto yy750;
+ if (yych == 'a') goto yy750;
+ goto yy187;
+yy740:
+ YYDEBUG(740, *YYCURSOR);
+ yych = *++YYCURSOR;
+ 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 == 'T') goto yy748;
+ if (yych == 't') goto yy748;
+ goto yy187;
+yy742:
+ YYDEBUG(742, *YYCURSOR);
+ yych = *++YYCURSOR;
+ 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 yy185;
+ goto yy186;
}
- YYDEBUG(738, *YYCURSOR);
+ YYDEBUG(747, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1156 "Zend/zend_language_scanner.l"
+#line 1166 "Zend/zend_language_scanner.l"
{
return T_EXTENDS;
}
-#line 6828 "Zend/zend_language_scanner.c"
-yy739:
- YYDEBUG(739, *YYCURSOR);
+#line 6901 "Zend/zend_language_scanner.c"
+yy748:
+ YYDEBUG(748, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(740, *YYCURSOR);
+ YYDEBUG(749, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1016 "Zend/zend_language_scanner.l"
+#line 1018 "Zend/zend_language_scanner.l"
{
return T_EXIT;
}
-#line 6841 "Zend/zend_language_scanner.c"
-yy741:
- YYDEBUG(741, *YYCURSOR);
+#line 6914 "Zend/zend_language_scanner.c"
+yy750:
+ YYDEBUG(750, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy742;
- if (yych != 'l') goto yy186;
-yy742:
- YYDEBUG(742, *YYCURSOR);
+ if (yych == 'L') goto yy751;
+ if (yych != 'l') goto yy187;
+yy751:
+ YYDEBUG(751, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(743, *YYCURSOR);
+ YYDEBUG(752, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1242 "Zend/zend_language_scanner.l"
+#line 1252 "Zend/zend_language_scanner.l"
{
return T_EVAL;
}
-#line 6859 "Zend/zend_language_scanner.c"
-yy744:
- YYDEBUG(744, *YYCURSOR);
+#line 6932 "Zend/zend_language_scanner.c"
+yy753:
+ YYDEBUG(753, *YYCURSOR);
yych = *++YYCURSOR;
YYDEBUG(-1, yych);
switch (yych) {
case 'D':
- case 'd': goto yy745;
+ case 'd': goto yy754;
case 'F':
- case 'f': goto yy746;
+ case 'f': goto yy755;
case 'I':
- case 'i': goto yy747;
+ case 'i': goto yy756;
case 'S':
- case 's': goto yy748;
+ case 's': goto yy757;
case 'W':
- case 'w': goto yy749;
- default: goto yy186;
+ case 'w': goto yy758;
+ default: goto yy187;
}
-yy745:
- YYDEBUG(745, *YYCURSOR);
+yy754:
+ YYDEBUG(754, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy771;
- if (yych == 'e') goto yy771;
- goto yy186;
-yy746:
- YYDEBUG(746, *YYCURSOR);
+ if (yych == 'E') goto yy780;
+ if (yych == 'e') goto yy780;
+ goto yy187;
+yy755:
+ YYDEBUG(755, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy763;
- if (yych == 'o') goto yy763;
- goto yy186;
-yy747:
- YYDEBUG(747, *YYCURSOR);
+ if (yych == 'O') goto yy772;
+ if (yych == 'o') goto yy772;
+ goto yy187;
+yy756:
+ YYDEBUG(756, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'F') goto yy761;
- if (yych == 'f') goto yy761;
- goto yy186;
-yy748:
- YYDEBUG(748, *YYCURSOR);
+ if (yych == 'F') goto yy770;
+ if (yych == 'f') goto yy770;
+ goto yy187;
+yy757:
+ YYDEBUG(757, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'W') goto yy755;
- if (yych == 'w') goto yy755;
- goto yy186;
-yy749:
- YYDEBUG(749, *YYCURSOR);
+ if (yych == 'W') goto yy764;
+ if (yych == 'w') goto yy764;
+ goto yy187;
+yy758:
+ YYDEBUG(758, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'H') goto yy750;
- if (yych != 'h') goto yy186;
-yy750:
- YYDEBUG(750, *YYCURSOR);
+ if (yych == 'H') goto yy759;
+ if (yych != 'h') goto yy187;
+yy759:
+ YYDEBUG(759, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy751;
- if (yych != 'i') goto yy186;
-yy751:
- YYDEBUG(751, *YYCURSOR);
+ if (yych == 'I') goto yy760;
+ if (yych != 'i') goto yy187;
+yy760:
+ YYDEBUG(760, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy752;
- if (yych != 'l') goto yy186;
-yy752:
- YYDEBUG(752, *YYCURSOR);
+ if (yych == 'L') goto yy761;
+ if (yych != 'l') goto yy187;
+yy761:
+ YYDEBUG(761, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy753;
- if (yych != 'e') goto yy186;
-yy753:
- YYDEBUG(753, *YYCURSOR);
+ if (yych == 'E') goto yy762;
+ if (yych != 'e') goto yy187;
+yy762:
+ YYDEBUG(762, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(754, *YYCURSOR);
+ YYDEBUG(763, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1068 "Zend/zend_language_scanner.l"
+#line 1078 "Zend/zend_language_scanner.l"
{
return T_ENDWHILE;
}
-#line 6933 "Zend/zend_language_scanner.c"
-yy755:
- YYDEBUG(755, *YYCURSOR);
+#line 7006 "Zend/zend_language_scanner.c"
+yy764:
+ YYDEBUG(764, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy756;
- if (yych != 'i') goto yy186;
-yy756:
- YYDEBUG(756, *YYCURSOR);
+ if (yych == 'I') goto yy765;
+ if (yych != 'i') goto yy187;
+yy765:
+ YYDEBUG(765, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy757;
- if (yych != 't') goto yy186;
-yy757:
- YYDEBUG(757, *YYCURSOR);
+ if (yych == 'T') goto yy766;
+ if (yych != 't') goto yy187;
+yy766:
+ YYDEBUG(766, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy758;
- if (yych != 'c') goto yy186;
-yy758:
- YYDEBUG(758, *YYCURSOR);
+ if (yych == 'C') goto yy767;
+ if (yych != 'c') goto yy187;
+yy767:
+ YYDEBUG(767, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'H') goto yy759;
- if (yych != 'h') goto yy186;
-yy759:
- YYDEBUG(759, *YYCURSOR);
+ if (yych == 'H') goto yy768;
+ if (yych != 'h') goto yy187;
+yy768:
+ YYDEBUG(768, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(760, *YYCURSOR);
+ YYDEBUG(769, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1112 "Zend/zend_language_scanner.l"
+#line 1122 "Zend/zend_language_scanner.l"
{
return T_ENDSWITCH;
}
-#line 6966 "Zend/zend_language_scanner.c"
-yy761:
- YYDEBUG(761, *YYCURSOR);
+#line 7039 "Zend/zend_language_scanner.c"
+yy770:
+ YYDEBUG(770, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(762, *YYCURSOR);
+ YYDEBUG(771, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1056 "Zend/zend_language_scanner.l"
+#line 1066 "Zend/zend_language_scanner.l"
{
return T_ENDIF;
}
-#line 6979 "Zend/zend_language_scanner.c"
-yy763:
- YYDEBUG(763, *YYCURSOR);
+#line 7052 "Zend/zend_language_scanner.c"
+yy772:
+ YYDEBUG(772, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy764;
- if (yych != 'r') goto yy186;
-yy764:
- YYDEBUG(764, *YYCURSOR);
+ if (yych == 'R') goto yy773;
+ if (yych != 'r') goto yy187;
+yy773:
+ YYDEBUG(773, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) <= '^') {
if (yych <= '@') {
- if (yych <= '/') goto yy765;
- if (yych <= '9') goto yy185;
+ if (yych <= '/') goto yy774;
+ if (yych <= '9') goto yy186;
} else {
- if (yych == 'E') goto yy766;
- if (yych <= 'Z') goto yy185;
+ if (yych == 'E') goto yy775;
+ if (yych <= 'Z') goto yy186;
}
} else {
if (yych <= 'd') {
- if (yych != '`') goto yy185;
+ if (yych != '`') goto yy186;
} else {
- if (yych <= 'e') goto yy766;
- if (yych <= 'z') goto yy185;
- if (yych >= 0x7F) goto yy185;
+ if (yych <= 'e') goto yy775;
+ if (yych <= 'z') goto yy186;
+ if (yych >= 0x7F) goto yy186;
}
}
-yy765:
- YYDEBUG(765, *YYCURSOR);
+yy774:
+ YYDEBUG(774, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1080 "Zend/zend_language_scanner.l"
+#line 1090 "Zend/zend_language_scanner.l"
{
return T_ENDFOR;
}
-#line 7012 "Zend/zend_language_scanner.c"
-yy766:
- YYDEBUG(766, *YYCURSOR);
+#line 7085 "Zend/zend_language_scanner.c"
+yy775:
+ YYDEBUG(775, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy767;
- if (yych != 'a') goto yy186;
-yy767:
- YYDEBUG(767, *YYCURSOR);
+ if (yych == 'A') goto yy776;
+ if (yych != 'a') goto yy187;
+yy776:
+ YYDEBUG(776, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy768;
- if (yych != 'c') goto yy186;
-yy768:
- YYDEBUG(768, *YYCURSOR);
+ if (yych == 'C') goto yy777;
+ if (yych != 'c') goto yy187;
+yy777:
+ YYDEBUG(777, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'H') goto yy769;
- if (yych != 'h') goto yy186;
-yy769:
- YYDEBUG(769, *YYCURSOR);
+ if (yych == 'H') goto yy778;
+ if (yych != 'h') goto yy187;
+yy778:
+ YYDEBUG(778, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(770, *YYCURSOR);
+ YYDEBUG(779, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1088 "Zend/zend_language_scanner.l"
+#line 1098 "Zend/zend_language_scanner.l"
{
return T_ENDFOREACH;
}
-#line 7040 "Zend/zend_language_scanner.c"
-yy771:
- YYDEBUG(771, *YYCURSOR);
+#line 7113 "Zend/zend_language_scanner.c"
+yy780:
+ YYDEBUG(780, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy772;
- if (yych != 'c') goto yy186;
-yy772:
- YYDEBUG(772, *YYCURSOR);
+ if (yych == 'C') goto yy781;
+ if (yych != 'c') goto yy187;
+yy781:
+ YYDEBUG(781, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy773;
- if (yych != 'l') goto yy186;
-yy773:
- YYDEBUG(773, *YYCURSOR);
+ if (yych == 'L') goto yy782;
+ if (yych != 'l') goto yy187;
+yy782:
+ YYDEBUG(782, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy774;
- if (yych != 'a') goto yy186;
-yy774:
- YYDEBUG(774, *YYCURSOR);
+ if (yych == 'A') goto yy783;
+ if (yych != 'a') goto yy187;
+yy783:
+ YYDEBUG(783, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy775;
- if (yych != 'r') goto yy186;
-yy775:
- YYDEBUG(775, *YYCURSOR);
+ if (yych == 'R') goto yy784;
+ if (yych != 'r') goto yy187;
+yy784:
+ YYDEBUG(784, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy776;
- if (yych != 'e') goto yy186;
-yy776:
- YYDEBUG(776, *YYCURSOR);
+ if (yych == 'E') goto yy785;
+ if (yych != 'e') goto yy187;
+yy785:
+ YYDEBUG(785, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(777, *YYCURSOR);
+ YYDEBUG(786, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1096 "Zend/zend_language_scanner.l"
+#line 1106 "Zend/zend_language_scanner.l"
{
return T_ENDDECLARE;
}
-#line 7078 "Zend/zend_language_scanner.c"
-yy778:
- YYDEBUG(778, *YYCURSOR);
+#line 7151 "Zend/zend_language_scanner.c"
+yy787:
+ YYDEBUG(787, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy779;
- if (yych != 't') goto yy186;
-yy779:
- YYDEBUG(779, *YYCURSOR);
+ if (yych == 'T') goto yy788;
+ if (yych != 't') goto yy187;
+yy788:
+ YYDEBUG(788, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'Y') goto yy780;
- if (yych != 'y') goto yy186;
-yy780:
- YYDEBUG(780, *YYCURSOR);
+ if (yych == 'Y') goto yy789;
+ if (yych != 'y') goto yy187;
+yy789:
+ YYDEBUG(789, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(781, *YYCURSOR);
+ YYDEBUG(790, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1282 "Zend/zend_language_scanner.l"
+#line 1292 "Zend/zend_language_scanner.l"
{
return T_EMPTY;
}
-#line 7101 "Zend/zend_language_scanner.c"
-yy782:
- YYDEBUG(782, *YYCURSOR);
+#line 7174 "Zend/zend_language_scanner.c"
+yy791:
+ YYDEBUG(791, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy783;
- if (yych != 'e') goto yy186;
-yy783:
- YYDEBUG(783, *YYCURSOR);
+ if (yych == 'E') goto yy792;
+ if (yych != 'e') goto yy187;
+yy792:
+ YYDEBUG(792, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) <= '^') {
if (yych <= '@') {
- if (yych <= '/') goto yy784;
- if (yych <= '9') goto yy185;
+ if (yych <= '/') goto yy793;
+ if (yych <= '9') goto yy186;
} else {
- if (yych == 'I') goto yy785;
- if (yych <= 'Z') goto yy185;
+ if (yych == 'I') goto yy794;
+ if (yych <= 'Z') goto yy186;
}
} else {
if (yych <= 'h') {
- if (yych != '`') goto yy185;
+ if (yych != '`') goto yy186;
} else {
- if (yych <= 'i') goto yy785;
- if (yych <= 'z') goto yy185;
- if (yych >= 0x7F) goto yy185;
+ if (yych <= 'i') goto yy794;
+ if (yych <= 'z') goto yy186;
+ if (yych >= 0x7F) goto yy186;
}
}
-yy784:
- YYDEBUG(784, *YYCURSOR);
+yy793:
+ YYDEBUG(793, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1060 "Zend/zend_language_scanner.l"
+#line 1070 "Zend/zend_language_scanner.l"
{
return T_ELSE;
}
-#line 7134 "Zend/zend_language_scanner.c"
-yy785:
- YYDEBUG(785, *YYCURSOR);
+#line 7207 "Zend/zend_language_scanner.c"
+yy794:
+ YYDEBUG(794, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'F') goto yy786;
- if (yych != 'f') goto yy186;
-yy786:
- YYDEBUG(786, *YYCURSOR);
+ if (yych == 'F') goto yy795;
+ if (yych != 'f') goto yy187;
+yy795:
+ YYDEBUG(795, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(787, *YYCURSOR);
+ YYDEBUG(796, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1052 "Zend/zend_language_scanner.l"
+#line 1062 "Zend/zend_language_scanner.l"
{
return T_ELSEIF;
}
-#line 7152 "Zend/zend_language_scanner.c"
-yy788:
- YYDEBUG(788, *YYCURSOR);
+#line 7225 "Zend/zend_language_scanner.c"
+yy797:
+ YYDEBUG(797, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy789;
- if (yych != 'o') goto yy186;
-yy789:
- YYDEBUG(789, *YYCURSOR);
+ if (yych == 'O') goto yy798;
+ if (yych != 'o') goto yy187;
+yy798:
+ YYDEBUG(798, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy185;
+ goto yy186;
}
- YYDEBUG(790, *YYCURSOR);
+ YYDEBUG(799, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1136 "Zend/zend_language_scanner.l"
+#line 1146 "Zend/zend_language_scanner.l"
{
return T_ECHO;
}
-#line 7170 "Zend/zend_language_scanner.c"
+#line 7243 "Zend/zend_language_scanner.c"
}
/* *********************************** */
yyc_ST_LOOKING_FOR_PROPERTY:
@@ -7205,41 +7278,41 @@ yyc_ST_LOOKING_FOR_PROPERTY:
64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64,
};
- YYDEBUG(791, *YYCURSOR);
+ YYDEBUG(800, *YYCURSOR);
YYFILL(2);
yych = *YYCURSOR;
if (yych <= '-') {
if (yych <= '\r') {
- if (yych <= 0x08) goto yy799;
- if (yych <= '\n') goto yy793;
- if (yych <= '\f') goto yy799;
+ if (yych <= 0x08) goto yy808;
+ if (yych <= '\n') goto yy802;
+ if (yych <= '\f') goto yy808;
} else {
- if (yych == ' ') goto yy793;
- if (yych <= ',') goto yy799;
- goto yy795;
+ if (yych == ' ') goto yy802;
+ if (yych <= ',') goto yy808;
+ goto yy804;
}
} else {
if (yych <= '_') {
- if (yych <= '@') goto yy799;
- if (yych <= 'Z') goto yy797;
- if (yych <= '^') goto yy799;
- goto yy797;
+ if (yych <= '@') goto yy808;
+ if (yych <= 'Z') goto yy806;
+ if (yych <= '^') goto yy808;
+ goto yy806;
} else {
- if (yych <= '`') goto yy799;
- if (yych <= 'z') goto yy797;
- if (yych <= '~') goto yy799;
- goto yy797;
+ if (yych <= '`') goto yy808;
+ if (yych <= 'z') goto yy806;
+ if (yych <= '~') goto yy808;
+ goto yy806;
}
}
-yy793:
- YYDEBUG(793, *YYCURSOR);
+yy802:
+ YYDEBUG(802, *YYCURSOR);
++YYCURSOR;
yych = *YYCURSOR;
- goto yy805;
-yy794:
- YYDEBUG(794, *YYCURSOR);
+ goto yy814;
+yy803:
+ YYDEBUG(803, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1169 "Zend/zend_language_scanner.l"
+#line 1179 "Zend/zend_language_scanner.l"
{
zendlval->value.str.val = yytext; /* no copying - intentional */
zendlval->value.str.len = yyleng;
@@ -7247,73 +7320,73 @@ yy794:
HANDLE_NEWLINES(yytext, yyleng);
return T_WHITESPACE;
}
-#line 7251 "Zend/zend_language_scanner.c"
-yy795:
- YYDEBUG(795, *YYCURSOR);
+#line 7324 "Zend/zend_language_scanner.c"
+yy804:
+ YYDEBUG(804, *YYCURSOR);
++YYCURSOR;
- if ((yych = *YYCURSOR) == '>') goto yy802;
-yy796:
- YYDEBUG(796, *YYCURSOR);
+ if ((yych = *YYCURSOR) == '>') goto yy811;
+yy805:
+ YYDEBUG(805, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1188 "Zend/zend_language_scanner.l"
+#line 1198 "Zend/zend_language_scanner.l"
{
yyless(0);
yy_pop_state(TSRMLS_C);
goto restart;
}
-#line 7265 "Zend/zend_language_scanner.c"
-yy797:
- YYDEBUG(797, *YYCURSOR);
+#line 7338 "Zend/zend_language_scanner.c"
+yy806:
+ YYDEBUG(806, *YYCURSOR);
++YYCURSOR;
yych = *YYCURSOR;
- goto yy801;
-yy798:
- YYDEBUG(798, *YYCURSOR);
+ goto yy810;
+yy807:
+ YYDEBUG(807, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1181 "Zend/zend_language_scanner.l"
+#line 1191 "Zend/zend_language_scanner.l"
{
yy_pop_state(TSRMLS_C);
zend_copy_value(zendlval, yytext, yyleng);
zendlval->type = IS_STRING;
return T_STRING;
}
-#line 7281 "Zend/zend_language_scanner.c"
-yy799:
- YYDEBUG(799, *YYCURSOR);
+#line 7354 "Zend/zend_language_scanner.c"
+yy808:
+ YYDEBUG(808, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy796;
-yy800:
- YYDEBUG(800, *YYCURSOR);
+ goto yy805;
+yy809:
+ YYDEBUG(809, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy801:
- YYDEBUG(801, *YYCURSOR);
+yy810:
+ YYDEBUG(810, *YYCURSOR);
if (yybm[0+yych] & 64) {
- goto yy800;
+ goto yy809;
}
- goto yy798;
-yy802:
- YYDEBUG(802, *YYCURSOR);
+ goto yy807;
+yy811:
+ YYDEBUG(811, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(803, *YYCURSOR);
+ YYDEBUG(812, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1177 "Zend/zend_language_scanner.l"
+#line 1187 "Zend/zend_language_scanner.l"
{
return T_OBJECT_OPERATOR;
}
-#line 7306 "Zend/zend_language_scanner.c"
-yy804:
- YYDEBUG(804, *YYCURSOR);
+#line 7379 "Zend/zend_language_scanner.c"
+yy813:
+ YYDEBUG(813, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy805:
- YYDEBUG(805, *YYCURSOR);
+yy814:
+ YYDEBUG(814, *YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy804;
+ goto yy813;
}
- goto yy794;
+ goto yy803;
}
/* *********************************** */
yyc_ST_LOOKING_FOR_VARNAME:
@@ -7352,74 +7425,74 @@ yyc_ST_LOOKING_FOR_VARNAME:
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
};
- YYDEBUG(806, *YYCURSOR);
+ YYDEBUG(815, *YYCURSOR);
YYFILL(2);
yych = *YYCURSOR;
if (yych <= '_') {
- if (yych <= '@') goto yy810;
- if (yych <= 'Z') goto yy808;
- if (yych <= '^') goto yy810;
+ if (yych <= '@') goto yy819;
+ if (yych <= 'Z') goto yy817;
+ if (yych <= '^') goto yy819;
} else {
- if (yych <= '`') goto yy810;
- if (yych <= 'z') goto yy808;
- if (yych <= '~') goto yy810;
+ if (yych <= '`') goto yy819;
+ if (yych <= 'z') goto yy817;
+ if (yych <= '~') goto yy819;
}
-yy808:
- YYDEBUG(808, *YYCURSOR);
+yy817:
+ YYDEBUG(817, *YYCURSOR);
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '_') {
if (yych <= '@') {
- if (yych <= '/') goto yy809;
- if (yych <= '9') goto yy812;
+ if (yych <= '/') goto yy818;
+ if (yych <= '9') goto yy821;
} else {
- if (yych <= '[') goto yy812;
- if (yych >= '_') goto yy812;
+ if (yych <= '[') goto yy821;
+ if (yych >= '_') goto yy821;
}
} else {
if (yych <= '|') {
- if (yych <= '`') goto yy809;
- if (yych <= 'z') goto yy812;
+ if (yych <= '`') goto yy818;
+ if (yych <= 'z') goto yy821;
} else {
- if (yych != '~') goto yy812;
+ if (yych != '~') goto yy821;
}
}
-yy809:
- YYDEBUG(809, *YYCURSOR);
+yy818:
+ YYDEBUG(818, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1474 "Zend/zend_language_scanner.l"
+#line 1484 "Zend/zend_language_scanner.l"
{
yyless(0);
yy_pop_state(TSRMLS_C);
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
goto restart;
}
-#line 7398 "Zend/zend_language_scanner.c"
-yy810:
- YYDEBUG(810, *YYCURSOR);
+#line 7471 "Zend/zend_language_scanner.c"
+yy819:
+ YYDEBUG(819, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy809;
-yy811:
- YYDEBUG(811, *YYCURSOR);
+ goto yy818;
+yy820:
+ YYDEBUG(820, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy812:
- YYDEBUG(812, *YYCURSOR);
+yy821:
+ YYDEBUG(821, *YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy811;
+ goto yy820;
}
- if (yych == '[') goto yy814;
- if (yych == '}') goto yy814;
- YYDEBUG(813, *YYCURSOR);
+ if (yych == '[') goto yy823;
+ if (yych == '}') goto yy823;
+ YYDEBUG(822, *YYCURSOR);
YYCURSOR = YYMARKER;
- goto yy809;
-yy814:
- YYDEBUG(814, *YYCURSOR);
+ goto yy818;
+yy823:
+ YYDEBUG(823, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(815, *YYCURSOR);
+ YYDEBUG(824, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1464 "Zend/zend_language_scanner.l"
+#line 1474 "Zend/zend_language_scanner.l"
{
yyless(yyleng - 1);
zend_copy_value(zendlval, yytext, yyleng);
@@ -7428,21 +7501,23 @@ yy814:
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
return T_STRING_VARNAME;
}
-#line 7432 "Zend/zend_language_scanner.c"
+#line 7505 "Zend/zend_language_scanner.c"
}
/* *********************************** */
yyc_ST_NOWDOC:
- YYDEBUG(816, *YYCURSOR);
+ YYDEBUG(825, *YYCURSOR);
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(818, *YYCURSOR);
+ YYDEBUG(827, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(819, *YYCURSOR);
+ YYDEBUG(828, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2356 "Zend/zend_language_scanner.l"
+#line 2368 "Zend/zend_language_scanner.l"
{
int newline = 0;
+ zend_heredoc_label *heredoc_label = zend_ptr_stack_top(&SCNG(heredoc_label_stack));
+
if (YYCURSOR > YYLIMIT) {
return 0;
}
@@ -7458,8 +7533,8 @@ yyc_ST_NOWDOC:
/* fall through */
case '\n':
/* Check for ending label on the next line */
- if (IS_LABEL_START(*YYCURSOR) && CG(heredoc_len) < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, CG(heredoc), CG(heredoc_len))) {
- YYCTYPE *end = YYCURSOR + CG(heredoc_len);
+ if (IS_LABEL_START(*YYCURSOR) && heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, heredoc_label->label, heredoc_label->length)) {
+ YYCTYPE *end = YYCURSOR + heredoc_label->length;
if (*end == ';') {
end++;
@@ -7494,7 +7569,7 @@ nowdoc_scan_done:
HANDLE_NEWLINES(yytext, yyleng - newline);
return T_ENCAPSED_AND_WHITESPACE;
}
-#line 7498 "Zend/zend_language_scanner.c"
+#line 7573 "Zend/zend_language_scanner.c"
/* *********************************** */
yyc_ST_VAR_OFFSET:
{
@@ -7532,76 +7607,76 @@ yyc_ST_VAR_OFFSET:
16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16,
};
- YYDEBUG(820, *YYCURSOR);
+ YYDEBUG(829, *YYCURSOR);
YYFILL(3);
yych = *YYCURSOR;
if (yych <= '/') {
if (yych <= ' ') {
if (yych <= '\f') {
- if (yych <= 0x08) goto yy834;
- if (yych <= '\n') goto yy830;
- goto yy834;
+ if (yych <= 0x08) goto yy843;
+ if (yych <= '\n') goto yy839;
+ goto yy843;
} else {
- if (yych <= '\r') goto yy830;
- if (yych <= 0x1F) goto yy834;
- goto yy830;
+ if (yych <= '\r') goto yy839;
+ if (yych <= 0x1F) goto yy843;
+ goto yy839;
}
} else {
if (yych <= '$') {
- if (yych <= '"') goto yy829;
- if (yych <= '#') goto yy830;
- goto yy825;
+ if (yych <= '"') goto yy838;
+ if (yych <= '#') goto yy839;
+ goto yy834;
} else {
- if (yych == '\'') goto yy830;
- goto yy829;
+ if (yych == '\'') goto yy839;
+ goto yy838;
}
}
} else {
if (yych <= '\\') {
if (yych <= '@') {
- if (yych <= '0') goto yy822;
- if (yych <= '9') goto yy824;
- goto yy829;
+ if (yych <= '0') goto yy831;
+ if (yych <= '9') goto yy833;
+ goto yy838;
} else {
- if (yych <= 'Z') goto yy832;
- if (yych <= '[') goto yy829;
- goto yy830;
+ if (yych <= 'Z') goto yy841;
+ if (yych <= '[') goto yy838;
+ goto yy839;
}
} else {
if (yych <= '_') {
- if (yych <= ']') goto yy827;
- if (yych <= '^') goto yy829;
- goto yy832;
+ if (yych <= ']') goto yy836;
+ if (yych <= '^') goto yy838;
+ goto yy841;
} else {
- if (yych <= '`') goto yy829;
- if (yych <= 'z') goto yy832;
- if (yych <= '~') goto yy829;
- goto yy832;
+ if (yych <= '`') goto yy838;
+ if (yych <= 'z') goto yy841;
+ if (yych <= '~') goto yy838;
+ goto yy841;
}
}
}
-yy822:
- YYDEBUG(822, *YYCURSOR);
+yy831:
+ YYDEBUG(831, *YYCURSOR);
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= 'W') {
if (yych <= '9') {
- if (yych >= '0') goto yy846;
+ if (yych >= '0') goto yy855;
} else {
- if (yych == 'B') goto yy843;
+ if (yych == 'B') goto yy852;
}
} else {
if (yych <= 'b') {
- if (yych <= 'X') goto yy845;
- if (yych >= 'b') goto yy843;
+ if (yych <= 'X') goto yy854;
+ if (yych >= 'b') goto yy852;
} else {
- if (yych == 'x') goto yy845;
+ if (yych == 'x') goto yy854;
}
}
-yy823:
- YYDEBUG(823, *YYCURSOR);
+yy832:
+ YYDEBUG(832, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1552 "Zend/zend_language_scanner.l"
+#line 1562 "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);
@@ -7613,81 +7688,81 @@ yy823:
}
return T_NUM_STRING;
}
-#line 7617 "Zend/zend_language_scanner.c"
-yy824:
- YYDEBUG(824, *YYCURSOR);
+#line 7692 "Zend/zend_language_scanner.c"
+yy833:
+ YYDEBUG(833, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy842;
-yy825:
- YYDEBUG(825, *YYCURSOR);
+ goto yy851;
+yy834:
+ YYDEBUG(834, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) <= '_') {
- if (yych <= '@') goto yy826;
- if (yych <= 'Z') goto yy838;
- if (yych >= '_') goto yy838;
+ if (yych <= '@') goto yy835;
+ if (yych <= 'Z') goto yy847;
+ if (yych >= '_') goto yy847;
} else {
- if (yych <= '`') goto yy826;
- if (yych <= 'z') goto yy838;
- if (yych >= 0x7F) goto yy838;
+ if (yych <= '`') goto yy835;
+ if (yych <= 'z') goto yy847;
+ if (yych >= 0x7F) goto yy847;
}
-yy826:
- YYDEBUG(826, *YYCURSOR);
+yy835:
+ YYDEBUG(835, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1884 "Zend/zend_language_scanner.l"
+#line 1894 "Zend/zend_language_scanner.l"
{
/* Only '[' can be valid, but returning other tokens will allow a more explicit parse error */
return yytext[0];
}
-#line 7642 "Zend/zend_language_scanner.c"
-yy827:
- YYDEBUG(827, *YYCURSOR);
+#line 7717 "Zend/zend_language_scanner.c"
+yy836:
+ YYDEBUG(836, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(828, *YYCURSOR);
+ YYDEBUG(837, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1879 "Zend/zend_language_scanner.l"
+#line 1889 "Zend/zend_language_scanner.l"
{
yy_pop_state(TSRMLS_C);
return ']';
}
-#line 7653 "Zend/zend_language_scanner.c"
-yy829:
- YYDEBUG(829, *YYCURSOR);
+#line 7728 "Zend/zend_language_scanner.c"
+yy838:
+ YYDEBUG(838, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy826;
-yy830:
- YYDEBUG(830, *YYCURSOR);
+ goto yy835;
+yy839:
+ YYDEBUG(839, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(831, *YYCURSOR);
+ YYDEBUG(840, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1889 "Zend/zend_language_scanner.l"
+#line 1899 "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 7670 "Zend/zend_language_scanner.c"
-yy832:
- YYDEBUG(832, *YYCURSOR);
+#line 7745 "Zend/zend_language_scanner.c"
+yy841:
+ YYDEBUG(841, *YYCURSOR);
++YYCURSOR;
yych = *YYCURSOR;
- goto yy837;
-yy833:
- YYDEBUG(833, *YYCURSOR);
+ goto yy846;
+yy842:
+ YYDEBUG(842, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1896 "Zend/zend_language_scanner.l"
+#line 1906 "Zend/zend_language_scanner.l"
{
zend_copy_value(zendlval, yytext, yyleng);
zendlval->type = IS_STRING;
return T_STRING;
}
-#line 7685 "Zend/zend_language_scanner.c"
-yy834:
- YYDEBUG(834, *YYCURSOR);
+#line 7760 "Zend/zend_language_scanner.c"
+yy843:
+ YYDEBUG(843, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(835, *YYCURSOR);
+ YYDEBUG(844, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2412 "Zend/zend_language_scanner.l"
+#line 2426 "Zend/zend_language_scanner.l"
{
if (YYCURSOR > YYLIMIT) {
return 0;
@@ -7696,118 +7771,118 @@ yy834:
zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE);
goto restart;
}
-#line 7700 "Zend/zend_language_scanner.c"
-yy836:
- YYDEBUG(836, *YYCURSOR);
+#line 7775 "Zend/zend_language_scanner.c"
+yy845:
+ YYDEBUG(845, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy837:
- YYDEBUG(837, *YYCURSOR);
+yy846:
+ YYDEBUG(846, *YYCURSOR);
if (yybm[0+yych] & 16) {
- goto yy836;
+ goto yy845;
}
- goto yy833;
-yy838:
- YYDEBUG(838, *YYCURSOR);
+ goto yy842;
+yy847:
+ YYDEBUG(847, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(839, *YYCURSOR);
+ YYDEBUG(848, *YYCURSOR);
if (yych <= '^') {
if (yych <= '9') {
- if (yych >= '0') goto yy838;
+ if (yych >= '0') goto yy847;
} else {
- if (yych <= '@') goto yy840;
- if (yych <= 'Z') goto yy838;
+ if (yych <= '@') goto yy849;
+ if (yych <= 'Z') goto yy847;
}
} else {
if (yych <= '`') {
- if (yych <= '_') goto yy838;
+ if (yych <= '_') goto yy847;
} else {
- if (yych <= 'z') goto yy838;
- if (yych >= 0x7F) goto yy838;
+ if (yych <= 'z') goto yy847;
+ if (yych >= 0x7F) goto yy847;
}
}
-yy840:
- YYDEBUG(840, *YYCURSOR);
+yy849:
+ YYDEBUG(849, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1873 "Zend/zend_language_scanner.l"
+#line 1883 "Zend/zend_language_scanner.l"
{
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 7742 "Zend/zend_language_scanner.c"
-yy841:
- YYDEBUG(841, *YYCURSOR);
+#line 7817 "Zend/zend_language_scanner.c"
+yy850:
+ YYDEBUG(850, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy842:
- YYDEBUG(842, *YYCURSOR);
+yy851:
+ YYDEBUG(851, *YYCURSOR);
if (yybm[0+yych] & 32) {
- goto yy841;
+ goto yy850;
}
- goto yy823;
-yy843:
- YYDEBUG(843, *YYCURSOR);
+ goto yy832;
+yy852:
+ YYDEBUG(852, *YYCURSOR);
yych = *++YYCURSOR;
if (yybm[0+yych] & 128) {
- goto yy851;
+ goto yy860;
}
-yy844:
- YYDEBUG(844, *YYCURSOR);
+yy853:
+ YYDEBUG(853, *YYCURSOR);
YYCURSOR = YYMARKER;
- goto yy823;
-yy845:
- YYDEBUG(845, *YYCURSOR);
+ goto yy832;
+yy854:
+ YYDEBUG(854, *YYCURSOR);
yych = *++YYCURSOR;
if (yybm[0+yych] & 64) {
- goto yy849;
+ goto yy858;
}
- goto yy844;
-yy846:
- YYDEBUG(846, *YYCURSOR);
+ goto yy853;
+yy855:
+ YYDEBUG(855, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(847, *YYCURSOR);
- if (yych <= '/') goto yy848;
- if (yych <= '9') goto yy846;
-yy848:
- YYDEBUG(848, *YYCURSOR);
+ YYDEBUG(856, *YYCURSOR);
+ if (yych <= '/') goto yy857;
+ if (yych <= '9') goto yy855;
+yy857:
+ YYDEBUG(857, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1564 "Zend/zend_language_scanner.l"
+#line 1574 "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 7789 "Zend/zend_language_scanner.c"
-yy849:
- YYDEBUG(849, *YYCURSOR);
+#line 7864 "Zend/zend_language_scanner.c"
+yy858:
+ YYDEBUG(858, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(850, *YYCURSOR);
+ YYDEBUG(859, *YYCURSOR);
if (yybm[0+yych] & 64) {
- goto yy849;
+ goto yy858;
}
- goto yy848;
-yy851:
- YYDEBUG(851, *YYCURSOR);
+ goto yy857;
+yy860:
+ YYDEBUG(860, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(852, *YYCURSOR);
+ YYDEBUG(861, *YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy851;
+ goto yy860;
}
- goto yy848;
+ goto yy857;
}
}
-#line 2421 "Zend/zend_language_scanner.l"
+#line 2435 "Zend/zend_language_scanner.l"
}
diff --git a/Zend/zend_language_scanner.h b/Zend/zend_language_scanner.h
index a1a84b3bc9..c1a2313b2d 100644
--- a/Zend/zend_language_scanner.h
+++ b/Zend/zend_language_scanner.h
@@ -31,6 +31,7 @@ typedef struct _zend_lex_state {
unsigned char *yy_limit;
int yy_state;
zend_stack state_stack;
+ zend_ptr_stack heredoc_label_stack;
zend_file_handle *in;
uint lineno;
@@ -50,6 +51,10 @@ typedef struct _zend_lex_state {
const zend_encoding *script_encoding;
} zend_lex_state;
+typedef struct _zend_heredoc_label {
+ char *label;
+ int length;
+} zend_heredoc_label;
BEGIN_EXTERN_C()
int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2);
diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l
index c73f39aedb..dbf43977fb 100644
--- a/Zend/zend_language_scanner.l
+++ b/Zend/zend_language_scanner.l
@@ -178,22 +178,23 @@ static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC)
void startup_scanner(TSRMLS_D)
{
CG(parse_error) = 0;
- CG(heredoc) = NULL;
- CG(heredoc_len) = 0;
CG(doc_comment) = NULL;
CG(doc_comment_len) = 0;
zend_stack_init(&SCNG(state_stack));
+ zend_ptr_stack_init(&SCNG(heredoc_label_stack));
+}
+
+static void heredoc_label_dtor(zend_heredoc_label *heredoc_label) {
+ efree(heredoc_label->label);
}
void shutdown_scanner(TSRMLS_D)
{
- if (CG(heredoc)) {
- efree(CG(heredoc));
- CG(heredoc_len)=0;
- }
CG(parse_error) = 0;
- zend_stack_destroy(&SCNG(state_stack));
RESET_DOC_COMMENT();
+ zend_stack_destroy(&SCNG(state_stack));
+ zend_ptr_stack_clean(&SCNG(heredoc_label_stack), (void (*)(void *)) &heredoc_label_dtor, 1);
+ zend_ptr_stack_destroy(&SCNG(heredoc_label_stack));
}
ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
@@ -208,6 +209,9 @@ ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
lex_state->state_stack = SCNG(state_stack);
zend_stack_init(&SCNG(state_stack));
+ lex_state->heredoc_label_stack = SCNG(heredoc_label_stack);
+ zend_ptr_stack_init(&SCNG(heredoc_label_stack));
+
lex_state->in = SCNG(yy_in);
lex_state->yy_state = YYSTATE;
lex_state->filename = zend_get_compiled_filename(TSRMLS_C);
@@ -234,6 +238,10 @@ ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
zend_stack_destroy(&SCNG(state_stack));
SCNG(state_stack) = lex_state->state_stack;
+ zend_ptr_stack_clean(&SCNG(heredoc_label_stack), (void (*)(void *)) &heredoc_label_dtor, 1);
+ zend_ptr_stack_destroy(&SCNG(heredoc_label_stack));
+ SCNG(heredoc_label_stack) = lex_state->heredoc_label_stack;
+
SCNG(yy_in) = lex_state->in;
YYSETCONDITION(lex_state->yy_state);
CG(zend_lineno) = lex_state->lineno;
@@ -250,12 +258,6 @@ ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
SCNG(input_filter) = lex_state->input_filter;
SCNG(output_filter) = lex_state->output_filter;
SCNG(script_encoding) = lex_state->script_encoding;
-
- if (CG(heredoc)) {
- efree(CG(heredoc));
- CG(heredoc) = NULL;
- CG(heredoc_len) = 0;
- }
}
ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC)
@@ -1033,6 +1035,10 @@ NEWLINE ("\r"|"\n"|"\r\n")
return T_RETURN;
}
+<ST_IN_SCRIPTING>"yield" {
+ return T_YIELD;
+}
+
<ST_IN_SCRIPTING>"try" {
return T_TRY;
}
@@ -1041,6 +1047,10 @@ NEWLINE ("\r"|"\n"|"\r\n")
return T_CATCH;
}
+<ST_IN_SCRIPTING>"finally" {
+ return T_FINALLY;
+}
+
<ST_IN_SCRIPTING>"throw" {
return T_THROW;
}
@@ -2105,38 +2115,35 @@ inline_html:
<ST_IN_SCRIPTING>b?"<<<"{TABS_AND_SPACES}({LABEL}|([']{LABEL}['])|(["]{LABEL}["])){NEWLINE} {
char *s;
int bprefix = (yytext[0] != '<') ? 1 : 0;
-
- /* save old heredoc label */
- Z_STRVAL_P(zendlval) = CG(heredoc);
- Z_STRLEN_P(zendlval) = CG(heredoc_len);
+ zend_heredoc_label *heredoc_label = emalloc(sizeof(zend_heredoc_label));
CG(zend_lineno)++;
- CG(heredoc_len) = yyleng-bprefix-3-1-(yytext[yyleng-2]=='\r'?1:0);
+ heredoc_label->length = yyleng-bprefix-3-1-(yytext[yyleng-2]=='\r'?1:0);
s = yytext+bprefix+3;
while ((*s == ' ') || (*s == '\t')) {
s++;
- CG(heredoc_len)--;
+ heredoc_label->length--;
}
if (*s == '\'') {
s++;
- CG(heredoc_len) -= 2;
+ heredoc_label->length -= 2;
BEGIN(ST_NOWDOC);
} else {
if (*s == '"') {
s++;
- CG(heredoc_len) -= 2;
+ heredoc_label->length -= 2;
}
BEGIN(ST_HEREDOC);
}
- CG(heredoc) = estrndup(s, CG(heredoc_len));
+ heredoc_label->label = estrndup(s, heredoc_label->length);
/* Check for ending label on the next line */
- if (CG(heredoc_len) < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, s, CG(heredoc_len))) {
- YYCTYPE *end = YYCURSOR + CG(heredoc_len);
+ if (heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, s, heredoc_label->length)) {
+ YYCTYPE *end = YYCURSOR + heredoc_label->length;
if (*end == ';') {
end++;
@@ -2147,6 +2154,8 @@ inline_html:
}
}
+ zend_ptr_stack_push(&SCNG(heredoc_label_stack), (void *) heredoc_label);
+
return T_START_HEREDOC;
}
@@ -2158,13 +2167,14 @@ inline_html:
<ST_END_HEREDOC>{ANY_CHAR} {
- YYCURSOR += CG(heredoc_len) - 1;
- yyleng = CG(heredoc_len);
+ zend_heredoc_label *heredoc_label = zend_ptr_stack_pop(&SCNG(heredoc_label_stack));
+
+ YYCURSOR += heredoc_label->length - 1;
+ yyleng = heredoc_label->length;
+
+ heredoc_label_dtor(heredoc_label);
+ efree(heredoc_label);
- Z_STRVAL_P(zendlval) = CG(heredoc);
- Z_STRLEN_P(zendlval) = CG(heredoc_len);
- CG(heredoc) = NULL;
- CG(heredoc_len) = 0;
BEGIN(ST_IN_SCRIPTING);
return T_END_HEREDOC;
}
@@ -2284,6 +2294,8 @@ double_quotes_scan_done:
<ST_HEREDOC>{ANY_CHAR} {
int newline = 0;
+ zend_heredoc_label *heredoc_label = zend_ptr_stack_top(&SCNG(heredoc_label_stack));
+
if (YYCURSOR > YYLIMIT) {
return 0;
}
@@ -2299,8 +2311,8 @@ double_quotes_scan_done:
/* fall through */
case '\n':
/* Check for ending label on the next line */
- if (IS_LABEL_START(*YYCURSOR) && CG(heredoc_len) < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, CG(heredoc), CG(heredoc_len))) {
- YYCTYPE *end = YYCURSOR + CG(heredoc_len);
+ if (IS_LABEL_START(*YYCURSOR) && heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, heredoc_label->label, heredoc_label->length)) {
+ YYCTYPE *end = YYCURSOR + heredoc_label->length;
if (*end == ';') {
end++;
@@ -2356,6 +2368,8 @@ heredoc_scan_done:
<ST_NOWDOC>{ANY_CHAR} {
int newline = 0;
+ zend_heredoc_label *heredoc_label = zend_ptr_stack_top(&SCNG(heredoc_label_stack));
+
if (YYCURSOR > YYLIMIT) {
return 0;
}
@@ -2371,8 +2385,8 @@ heredoc_scan_done:
/* fall through */
case '\n':
/* Check for ending label on the next line */
- if (IS_LABEL_START(*YYCURSOR) && CG(heredoc_len) < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, CG(heredoc), CG(heredoc_len))) {
- YYCTYPE *end = YYCURSOR + CG(heredoc_len);
+ if (IS_LABEL_START(*YYCURSOR) && heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, heredoc_label->label, heredoc_label->length)) {
+ YYCTYPE *end = YYCURSOR + heredoc_label->length;
if (*end == ';') {
end++;
diff --git a/Zend/zend_language_scanner_defs.h b/Zend/zend_language_scanner_defs.h
index 5ef78a9faf..47df7e92de 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 Mon Apr 30 15:56:25 2012 */
+/* Generated by re2c 0.13.5 on Mon Aug 20 13:34:50 2012 */
#line 3 "Zend/zend_language_scanner_defs.h"
enum YYCONDTYPE {
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index 19fd71e763..5c4b20fd34 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -87,6 +87,7 @@ void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_siz
op_array->static_variables = NULL;
op_array->last_try_catch = 0;
+ op_array->has_finally_block = 0;
op_array->this_var = -1;
@@ -485,6 +486,24 @@ static void zend_extension_op_array_handler(zend_extension *extension, zend_op_a
}
}
+static void zend_check_finally_breakout(zend_op_array *op_array, zend_op *opline, zend_uint dst_num TSRMLS_DC) {
+ zend_uint i, op_num = opline - op_array->opcodes;
+ for (i=0; i < op_array->last_try_catch; i++) {
+ if (op_array->try_catch_array[i].try_op > op_num) {
+ break;
+ }
+ if ((op_num >= op_array->try_catch_array[i].finally_op
+ && op_num < op_array->try_catch_array[i].finally_end)
+ && (dst_num >= op_array->try_catch_array[i].finally_end
+ || dst_num < op_array->try_catch_array[i].finally_op)) {
+ CG(in_compilation) = 1;
+ CG(active_op_array) = op_array;
+ CG(zend_lineno) = opline->lineno;
+ zend_error(E_COMPILE_ERROR, "jump out of a finally block is disallowed");
+ }
+ }
+}
+
ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
{
zend_op *opline, *end;
@@ -528,8 +547,30 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
}
/* break omitted intentionally */
case ZEND_JMP:
+ if (op_array->last_try_catch) {
+ zend_check_finally_breakout(op_array, opline, opline->op1.opline_num TSRMLS_CC);
+ }
opline->op1.jmp_addr = &op_array->opcodes[opline->op1.opline_num];
break;
+ case ZEND_BRK:
+ case ZEND_CONT:
+ if (op_array->last_try_catch) {
+ int nest_levels, array_offset;
+ zend_brk_cont_element *jmp_to;
+
+ nest_levels = Z_LVAL_P(opline->op2.zv);
+ array_offset = opline->op1.opline_num;
+ do {
+ jmp_to = &op_array->brk_cont_array[array_offset];
+ if (nest_levels > 1) {
+ array_offset = jmp_to->parent;
+ }
+ } while (--nest_levels > 0);
+ if (op_array->last_try_catch) {
+ zend_check_finally_breakout(op_array, opline, jmp_to->brk TSRMLS_CC);
+ }
+ }
+ break;
case ZEND_JMPZ:
case ZEND_JMPNZ:
case ZEND_JMPZ_EX:
@@ -538,6 +579,17 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
case ZEND_JMP_SET_VAR:
opline->op2.jmp_addr = &op_array->opcodes[opline->op2.opline_num];
break;
+ case ZEND_RETURN:
+ case ZEND_RETURN_BY_REF:
+ if (op_array->fn_flags & ZEND_ACC_GENERATOR) {
+ if (opline->op1_type != IS_CONST || Z_TYPE_P(opline->op1.zv) != IS_NULL) {
+ CG(zend_lineno) = opline->lineno;
+ zend_error(E_COMPILE_ERROR, "Generators cannot return values using \"return\"");
+ }
+
+ opline->opcode = ZEND_GENERATOR_RETURN;
+ }
+ break;
}
ZEND_VM_SET_OPCODE_HANDLER(opline);
opline++;
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index f9686251fe..cf3a908ade 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;
@@ -1519,6 +1556,9 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {
ret = compare_function(result, op1, op_free TSRMLS_CC);
zend_free_obj_get_result(op_free TSRMLS_CC);
return ret;
+ } else if (Z_TYPE_P(op1) == IS_OBJECT) {
+ ZVAL_LONG(result, 1);
+ return SUCCESS;
}
}
if (!converted) {
@@ -1908,7 +1948,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';
@@ -1928,7 +1968,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++;
}
}
@@ -1977,6 +2017,49 @@ ZEND_API int zend_binary_strcasecmp(const char *s1, uint len1, const char *s2, u
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++);
c2 = zend_tolower((int)*(unsigned char *)s2++);
if (c1 != c2) {
@@ -1988,7 +2071,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;
@@ -2023,13 +2106,13 @@ 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));
}
/* }}} */
@@ -2064,7 +2147,7 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) /* {{{ */
} else if (ret2!=IS_DOUBLE) {
if (oflow1) {
ZVAL_LONG(result, oflow1);
- return;
+ return;
}
dval2 = (double) lval2;
} else if (dval1 == dval2 && !zend_finite(dval1)) {
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h
index d28140e9e5..08a6b19bd4 100644
--- a/Zend/zend_operators.h
+++ b/Zend/zend_operators.h
@@ -340,6 +340,7 @@ ZEND_API int zend_binary_strcmp(const char *s1, uint len1, const char *s2, uint
ZEND_API int zend_binary_strncmp(const char *s1, uint len1, const char *s2, uint len2, uint length);
ZEND_API int zend_binary_strcasecmp(const char *s1, uint len1, const char *s2, uint len2);
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);
ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2);
ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC);
diff --git a/Zend/zend_ptr_stack.h b/Zend/zend_ptr_stack.h
index cc062de872..9f6fc13161 100644
--- a/Zend/zend_ptr_stack.h
+++ b/Zend/zend_ptr_stack.h
@@ -111,6 +111,11 @@ static zend_always_inline void *zend_ptr_stack_pop(zend_ptr_stack *stack)
return *(--stack->top_element);
}
+static inline void *zend_ptr_stack_top(zend_ptr_stack *stack)
+{
+ return stack->elements[stack->top - 1];
+}
+
#endif /* ZEND_PTR_STACK_H */
/*
diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c
index 27df9537af..30cc3a5ba4 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 a61d2fb30d..0a4738466d 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 bc1591f582..f683ff2972 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -1187,18 +1187,18 @@ ZEND_VM_HANDLER(81, ZEND_FETCH_DIM_R, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
EX_T(opline->op1.var).var.ptr_ptr) {
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
-
- if (OP1_TYPE == IS_TMP_VAR || OP1_TYPE == IS_CONST) {
- zval *container = GET_OP1_ZVAL_PTR(BP_VAR_R);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
- FREE_OP2();
- FREE_OP1();
- } else {
- container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
- FREE_OP2();
- FREE_OP1_VAR_PTR();
- }
+
+ if (OP1_TYPE == IS_TMP_VAR || OP1_TYPE == IS_CONST) {
+ zval *container = GET_OP1_ZVAL_PTR(BP_VAR_R);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
+ FREE_OP2();
+ FREE_OP1();
+ } else {
+ container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
+ FREE_OP2();
+ FREE_OP1_VAR_PTR();
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -1840,6 +1840,392 @@ ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV)
ZEND_VM_NEXT_OPCODE();
}
+ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
+{
+ zend_bool nested;
+ zend_op_array *op_array = EX(op_array);
+
+ /* Generators go throw a different cleanup process */
+ if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) {
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ /* Close the generator to free up resources */
+ zend_generator_close(generator, 1 TSRMLS_CC);
+
+ /* Pass execution back to handling code */
+ ZEND_VM_RETURN();
+ }
+
+ EG(current_execute_data) = EX(prev_execute_data);
+ EG(opline_ptr) = NULL;
+ if (!EG(active_symbol_table)) {
+ zend_free_compiled_variables(EX_CVs(), op_array->last_var);
+ }
+
+ if ((op_array->fn_flags & ZEND_ACC_CLOSURE) && op_array->prototype) {
+ zval_ptr_dtor((zval**)&op_array->prototype);
+ }
+
+ nested = EX(nested);
+
+ /* For generators the execute_data is stored on the heap, for everything
+ * else it is stored on the VM stack. */
+ if (op_array->fn_flags & ZEND_ACC_GENERATOR) {
+ efree(execute_data);
+ } else {
+ zend_vm_stack_free(execute_data TSRMLS_CC);
+ }
+
+ if (nested) {
+ execute_data = EG(current_execute_data);
+ }
+ if (nested) {
+ USE_OPLINE
+
+ LOAD_REGS();
+ LOAD_OPLINE();
+ if (UNEXPECTED(opline->opcode == ZEND_INCLUDE_OR_EVAL)) {
+
+ EX(function_state).function = (zend_function *) EX(op_array);
+ EX(function_state).arguments = NULL;
+ EX(object) = EX(current_object);
+
+ EG(opline_ptr) = &EX(opline);
+ EG(active_op_array) = EX(op_array);
+ EG(return_value_ptr_ptr) = EX(original_return_value);
+ destroy_op_array(op_array TSRMLS_CC);
+ efree(op_array);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ zend_throw_exception_internal(NULL TSRMLS_CC);
+ HANDLE_EXCEPTION_LEAVE();
+ } else if (RETURN_VALUE_USED(opline)) {
+ if (!EX_T(opline->result.var).var.ptr) { /* there was no return statement */
+ zval *retval;
+
+ ALLOC_ZVAL(retval);
+ ZVAL_BOOL(retval, 1);
+ INIT_PZVAL(retval);
+ EX_T(opline->result.var).var.ptr = retval;
+ }
+ }
+
+ ZEND_VM_INC_OPCODE();
+ ZEND_VM_LEAVE();
+ } else {
+ EG(opline_ptr) = &EX(opline);
+ EG(active_op_array) = EX(op_array);
+ EG(return_value_ptr_ptr) = EX(original_return_value);
+ if (EG(active_symbol_table)) {
+ zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC);
+ }
+ EG(active_symbol_table) = EX(symbol_table);
+
+ EX(function_state).function = (zend_function *) EX(op_array);
+ EX(function_state).arguments = NULL;
+
+ if (EG(This)) {
+ if (UNEXPECTED(EG(exception) != NULL) && IS_CTOR_CALL(EX(called_scope))) {
+ if (IS_CTOR_USED(EX(called_scope))) {
+ Z_DELREF_P(EG(This));
+ }
+ if (Z_REFCOUNT_P(EG(This)) == 1) {
+ zend_object_store_ctor_failed(EG(This) TSRMLS_CC);
+ }
+ }
+ zval_ptr_dtor(&EG(This));
+ }
+ EG(This) = EX(current_this);
+ EG(scope) = EX(current_scope);
+ EG(called_scope) = EX(current_called_scope);
+
+ EX(object) = EX(current_object);
+ EX(called_scope) = DECODE_CTOR(EX(called_scope));
+
+ zend_vm_stack_clear_multiple(TSRMLS_C);
+
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ zend_throw_exception_internal(NULL TSRMLS_CC);
+ if (RETURN_VALUE_USED(opline) && EX_T(opline->result.var).var.ptr) {
+ zval_ptr_dtor(&EX_T(opline->result.var).var.ptr);
+ }
+ HANDLE_EXCEPTION_LEAVE();
+ }
+
+ ZEND_VM_INC_OPCODE();
+ ZEND_VM_LEAVE();
+ }
+ }
+ ZEND_VM_RETURN();
+}
+
+ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
+{
+ USE_OPLINE
+ zend_bool should_change_scope = 0;
+ zend_function *fbc = EX(function_state).function;
+
+ SAVE_OPLINE();
+ if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) {
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) {
+ zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", fbc->common.scope->name, fbc->common.function_name);
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE(); /* Never reached */
+ }
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) {
+ zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated",
+ fbc->common.scope ? fbc->common.scope->name : "",
+ fbc->common.scope ? "::" : "",
+ fbc->common.function_name);
+ }
+ }
+ if (fbc->common.scope &&
+ !(fbc->common.fn_flags & ZEND_ACC_STATIC) &&
+ !EX(object)) {
+
+ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ /* FIXME: output identifiers properly */
+ zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically", fbc->common.scope->name, fbc->common.function_name);
+ } else {
+ /* FIXME: output identifiers properly */
+ /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
+ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically", fbc->common.scope->name, fbc->common.function_name);
+ }
+ }
+
+ if (fbc->type == ZEND_USER_FUNCTION || fbc->common.scope) {
+ should_change_scope = 1;
+ EX(current_this) = EG(This);
+ EX(current_scope) = EG(scope);
+ EX(current_called_scope) = EG(called_scope);
+ EG(This) = EX(object);
+ EG(scope) = (fbc->type == ZEND_USER_FUNCTION || !EX(object)) ? fbc->common.scope : NULL;
+ EG(called_scope) = EX(called_scope);
+ }
+
+ zend_arg_types_stack_3_pop(&EG(arg_types_stack), &EX(called_scope), &EX(current_object), &EX(fbc));
+ EX(function_state).arguments = zend_vm_stack_push_args(opline->extended_value TSRMLS_CC);
+ LOAD_OPLINE();
+
+ if (fbc->type == ZEND_INTERNAL_FUNCTION) {
+ temp_variable *ret = &EX_T(opline->result.var);
+
+ MAKE_STD_ZVAL(ret->var.ptr);
+ ZVAL_NULL(ret->var.ptr);
+ ret->var.ptr_ptr = &ret->var.ptr;
+ ret->var.fcall_returned_reference = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;
+
+ if (fbc->common.arg_info) {
+ zend_uint i=0;
+ zval **p = (zval**)EX(function_state).arguments;
+ ulong arg_count = opline->extended_value;
+
+ while (arg_count>0) {
+ zend_verify_arg_type(fbc, ++i, *(p-arg_count), 0 TSRMLS_CC);
+ arg_count--;
+ }
+ }
+
+ if (!zend_execute_internal) {
+ /* saves one function call if zend_execute_internal is not used */
+ fbc->internal_function.handler(opline->extended_value, ret->var.ptr, (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) ? &ret->var.ptr : NULL, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC);
+ } else {
+ zend_execute_internal(EXECUTE_DATA, RETURN_VALUE_USED(opline) TSRMLS_CC);
+ }
+
+ if (!RETURN_VALUE_USED(opline)) {
+ zval_ptr_dtor(&ret->var.ptr);
+ }
+ } else if (fbc->type == ZEND_USER_FUNCTION) {
+ EX(original_return_value) = EG(return_value_ptr_ptr);
+ EG(active_symbol_table) = NULL;
+ EG(active_op_array) = &fbc->op_array;
+ EG(return_value_ptr_ptr) = NULL;
+ if (RETURN_VALUE_USED(opline)) {
+ temp_variable *ret = &EX_T(opline->result.var);
+
+ ret->var.ptr = NULL;
+ EG(return_value_ptr_ptr) = &ret->var.ptr;
+ ret->var.ptr_ptr = &ret->var.ptr;
+ ret->var.fcall_returned_reference = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;
+ }
+
+ if (EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) {
+ if (RETURN_VALUE_USED(opline)) {
+ EX_T(opline->result.var).var.ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC);
+ }
+ } else if (EXPECTED(zend_execute == execute)) {
+ if (EXPECTED(EG(exception) == NULL)) {
+ ZEND_VM_ENTER();
+ }
+ } else {
+ zend_execute(EG(active_op_array) TSRMLS_CC);
+ }
+
+ EG(opline_ptr) = &EX(opline);
+ EG(active_op_array) = EX(op_array);
+ EG(return_value_ptr_ptr) = EX(original_return_value);
+ if (EG(active_symbol_table)) {
+ zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC);
+ }
+ EG(active_symbol_table) = EX(symbol_table);
+ } else { /* ZEND_OVERLOADED_FUNCTION */
+ MAKE_STD_ZVAL(EX_T(opline->result.var).var.ptr);
+ ZVAL_NULL(EX_T(opline->result.var).var.ptr);
+
+ /* Not sure what should be done here if it's a static method */
+ if (EXPECTED(EX(object) != NULL)) {
+ Z_OBJ_HT_P(EX(object))->call_method(fbc->common.function_name, opline->extended_value, EX_T(opline->result.var).var.ptr, &EX_T(opline->result.var).var.ptr, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC);
+ } else {
+ zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object");
+ }
+
+ if (fbc->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) {
+ efree((char*)fbc->common.function_name);
+ }
+ efree(fbc);
+
+ if (!RETURN_VALUE_USED(opline)) {
+ zval_ptr_dtor(&EX_T(opline->result.var).var.ptr);
+ } else {
+ Z_UNSET_ISREF_P(EX_T(opline->result.var).var.ptr);
+ Z_SET_REFCOUNT_P(EX_T(opline->result.var).var.ptr, 1);
+ EX_T(opline->result.var).var.fcall_returned_reference = 0;
+ EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ }
+ }
+
+ EX(function_state).function = (zend_function *) EX(op_array);
+ EX(function_state).arguments = NULL;
+
+ if (should_change_scope) {
+ if (EG(This)) {
+ if (UNEXPECTED(EG(exception) != NULL) && IS_CTOR_CALL(EX(called_scope))) {
+ if (IS_CTOR_USED(EX(called_scope))) {
+ Z_DELREF_P(EG(This));
+ }
+ if (Z_REFCOUNT_P(EG(This)) == 1) {
+ zend_object_store_ctor_failed(EG(This) TSRMLS_CC);
+ }
+ }
+ zval_ptr_dtor(&EG(This));
+ }
+ EG(This) = EX(current_this);
+ EG(scope) = EX(current_scope);
+ EG(called_scope) = EX(current_called_scope);
+ }
+
+ EX(object) = EX(current_object);
+ EX(called_scope) = DECODE_CTOR(EX(called_scope));
+
+ zend_vm_stack_clear_multiple(TSRMLS_C);
+
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ zend_throw_exception_internal(NULL TSRMLS_CC);
+ if (RETURN_VALUE_USED(opline) && EX_T(opline->result.var).var.ptr) {
+ zval_ptr_dtor(&EX_T(opline->result.var).var.ptr);
+ }
+ HANDLE_EXCEPTION();
+ }
+
+ ZEND_VM_NEXT_OPCODE();
+}
+
+ZEND_VM_HELPER_EX(zend_finally_handler_leaving, ANY, ANY, int type)
+{
+ USE_OPLINE
+ zend_uint i, op_num = opline - EX(op_array)->opcodes;
+ zend_uint catch_op_num = 0, finally_op_num = 0;
+
+ SAVE_OPLINE();
+
+ switch (type) {
+ case ZEND_THROW:
+ case ZEND_RETURN:
+ case ZEND_RETURN_BY_REF:
+ case ZEND_LEAVE:
+ {
+ if (EG(prev_exception) || (type == ZEND_LEAVE && EG(exception))) {
+ for (i=0; i<EX(op_array)->last_try_catch; i++) {
+ if (EX(op_array)->try_catch_array[i].try_op > op_num) {
+ break;
+ }
+ if (op_num < EX(op_array)->try_catch_array[i].finally_op) {
+ finally_op_num = EX(op_array)->try_catch_array[i].finally_op;
+ }
+ if (op_num < EX(op_array)->try_catch_array[i].catch_op) {
+ catch_op_num = EX(op_array)->try_catch_array[i].catch_op;
+ }
+ }
+ } else {
+ for (i=0; i<EX(op_array)->last_try_catch; i++) {
+ if (EX(op_array)->try_catch_array[i].try_op > op_num) {
+ break;
+ }
+ if (op_num < EX(op_array)->try_catch_array[i].finally_op) {
+ finally_op_num = EX(op_array)->try_catch_array[i].finally_op;
+ }
+ }
+ }
+
+ if (catch_op_num && finally_op_num) {
+ /* EG(exception) || EG(prev_exception) */
+ if (catch_op_num > finally_op_num) {
+ zend_exception_save(TSRMLS_C);
+ EX(leaving) = ZEND_THROW;
+ ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
+ } else {
+ EX(leaving) = 0;
+ ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
+ }
+ } else if (catch_op_num) {
+ EX(leaving) = 0;
+ ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
+ } else if (finally_op_num) {
+ zend_exception_save(TSRMLS_C);
+ if (type != ZEND_LEAVE) {
+ EX(leaving) = type;
+ }
+ ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
+ } else if (EX(leaving) && type != ZEND_LEAVE) {
+ /* leave it to ZEND_LEAVE */
+ EX(leaving) = type;
+ ZEND_VM_NEXT_OPCODE();
+ } else {
+ ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
+ }
+ }
+ break;
+ case ZEND_JMP:
+ case ZEND_BRK:
+ case ZEND_CONT:
+ case ZEND_GOTO:
+ {
+ /* these can not occurred in exception context */
+ for (i=0; i<EG(active_op_array)->last_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
+ && (EX(leaving_dest) < EG(active_op_array)->try_catch_array[i].try_op
+ || EX(leaving_dest) >= EG(active_op_array)->try_catch_array[i].finally_end)) {
+ finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op;
+ }
+ }
+
+ if (finally_op_num) {
+ EX(leaving) = type;
+ ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
+ } else {
+ EX(leaving) = 0;
+ ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[EX(leaving_dest)]);
+ }
+ }
+ break;
+ }
+ ZEND_VM_CONTINUE();
+}
+
ZEND_VM_HANDLER(42, ZEND_JMP, ANY, ANY)
{
USE_OPLINE
@@ -1847,8 +2233,12 @@ ZEND_VM_HANDLER(42, ZEND_JMP, ANY, ANY)
#if DEBUG_ZEND>=2
printf("Jumping to %d\n", opline->op1.opline_num);
#endif
- ZEND_VM_SET_OPCODE(opline->op1.jmp_addr);
- ZEND_VM_CONTINUE(); /* CHECK_ME */
+ if (EXPECTED(!EX(op_array)->has_finally_block)) {
+ ZEND_VM_SET_OPCODE(opline->op1.jmp_addr);
+ ZEND_VM_CONTINUE(); /* CHECK_ME */
+ }
+ EX(leaving_dest) = opline->op1.jmp_addr - EX(op_array)->opcodes;
+ ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_JMP);
}
ZEND_VM_HANDLER(43, ZEND_JMPZ, CONST|TMP|VAR|CV, ANY)
@@ -2133,7 +2523,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();
@@ -2506,299 +2898,6 @@ ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST)
ZEND_VM_NEXT_OPCODE();
}
-ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
-{
- zend_bool nested;
- zend_op_array *op_array = EX(op_array);
-
- EG(current_execute_data) = EX(prev_execute_data);
- EG(opline_ptr) = NULL;
- if (!EG(active_symbol_table)) {
- zval ***cv = EX_CVs();
- zval ***end = cv + op_array->last_var;
- while (cv != end) {
- if (*cv) {
- zval_ptr_dtor(*cv);
- }
- cv++;
- }
- }
-
- if ((op_array->fn_flags & ZEND_ACC_CLOSURE) && op_array->prototype) {
- zval_ptr_dtor((zval**)&op_array->prototype);
- }
-
- nested = EX(nested);
-
- zend_vm_stack_free(execute_data TSRMLS_CC);
-
- if (nested) {
- execute_data = EG(current_execute_data);
- }
- if (nested) {
- USE_OPLINE
-
- LOAD_REGS();
- LOAD_OPLINE();
- if (UNEXPECTED(opline->opcode == ZEND_INCLUDE_OR_EVAL)) {
-
- EX(function_state).function = (zend_function *) EX(op_array);
- EX(function_state).arguments = NULL;
- EX(object) = EX(current_object);
-
- EG(opline_ptr) = &EX(opline);
- EG(active_op_array) = EX(op_array);
- EG(return_value_ptr_ptr) = EX(original_return_value);
- destroy_op_array(op_array TSRMLS_CC);
- efree(op_array);
- if (UNEXPECTED(EG(exception) != NULL)) {
- zend_throw_exception_internal(NULL TSRMLS_CC);
- HANDLE_EXCEPTION_LEAVE();
- } else if (RETURN_VALUE_USED(opline)) {
- if (!EX_T(opline->result.var).var.ptr) { /* there was no return statement */
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_BOOL(retval, 1);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
- }
- }
-
- ZEND_VM_INC_OPCODE();
- ZEND_VM_LEAVE();
- } else {
-
- EG(opline_ptr) = &EX(opline);
- EG(active_op_array) = EX(op_array);
- EG(return_value_ptr_ptr) = EX(original_return_value);
- if (EG(active_symbol_table)) {
- if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) {
- zend_hash_destroy(EG(active_symbol_table));
- FREE_HASHTABLE(EG(active_symbol_table));
- } else {
- /* clean before putting into the cache, since clean
- could call dtors, which could use cached hash */
- zend_hash_clean(EG(active_symbol_table));
- *(++EG(symtable_cache_ptr)) = EG(active_symbol_table);
- }
- }
- EG(active_symbol_table) = EX(symbol_table);
-
- EX(function_state).function = (zend_function *) EX(op_array);
- EX(function_state).arguments = NULL;
-
- if (EG(This)) {
- if (UNEXPECTED(EG(exception) != NULL) && IS_CTOR_CALL(EX(called_scope))) {
- if (IS_CTOR_USED(EX(called_scope))) {
- Z_DELREF_P(EG(This));
- }
- if (Z_REFCOUNT_P(EG(This)) == 1) {
- zend_object_store_ctor_failed(EG(This) TSRMLS_CC);
- }
- }
- zval_ptr_dtor(&EG(This));
- }
- EG(This) = EX(current_this);
- EG(scope) = EX(current_scope);
- EG(called_scope) = EX(current_called_scope);
-
- EX(object) = EX(current_object);
- EX(called_scope) = DECODE_CTOR(EX(called_scope));
-
- zend_vm_stack_clear_multiple(TSRMLS_C);
-
- if (UNEXPECTED(EG(exception) != NULL)) {
- zend_throw_exception_internal(NULL TSRMLS_CC);
- if (RETURN_VALUE_USED(opline) && EX_T(opline->result.var).var.ptr) {
- zval_ptr_dtor(&EX_T(opline->result.var).var.ptr);
- }
- HANDLE_EXCEPTION_LEAVE();
- }
-
- ZEND_VM_INC_OPCODE();
- ZEND_VM_LEAVE();
- }
- }
- ZEND_VM_RETURN();
-}
-
-ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
-{
- USE_OPLINE
- zend_bool should_change_scope = 0;
- zend_function *fbc = EX(function_state).function;
-
- SAVE_OPLINE();
- if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) {
- if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) {
- zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", fbc->common.scope->name, fbc->common.function_name);
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE(); /* Never reached */
- }
- if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) {
- zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated",
- fbc->common.scope ? fbc->common.scope->name : "",
- fbc->common.scope ? "::" : "",
- fbc->common.function_name);
- }
- }
- if (fbc->common.scope &&
- !(fbc->common.fn_flags & ZEND_ACC_STATIC) &&
- !EX(object)) {
-
- if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- /* FIXME: output identifiers properly */
- zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically", fbc->common.scope->name, fbc->common.function_name);
- } else {
- /* FIXME: output identifiers properly */
- /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically", fbc->common.scope->name, fbc->common.function_name);
- }
- }
-
- if (fbc->type == ZEND_USER_FUNCTION || fbc->common.scope) {
- should_change_scope = 1;
- EX(current_this) = EG(This);
- EX(current_scope) = EG(scope);
- EX(current_called_scope) = EG(called_scope);
- EG(This) = EX(object);
- EG(scope) = (fbc->type == ZEND_USER_FUNCTION || !EX(object)) ? fbc->common.scope : NULL;
- EG(called_scope) = EX(called_scope);
- }
-
- zend_arg_types_stack_3_pop(&EG(arg_types_stack), &EX(called_scope), &EX(current_object), &EX(fbc));
- EX(function_state).arguments = zend_vm_stack_push_args(opline->extended_value TSRMLS_CC);
- LOAD_OPLINE();
-
- if (fbc->type == ZEND_INTERNAL_FUNCTION) {
- temp_variable *ret = &EX_T(opline->result.var);
-
- MAKE_STD_ZVAL(ret->var.ptr);
- ZVAL_NULL(ret->var.ptr);
- ret->var.ptr_ptr = &ret->var.ptr;
- ret->var.fcall_returned_reference = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;
-
- if (fbc->common.arg_info) {
- zend_uint i=0;
- zval **p = (zval**)EX(function_state).arguments;
- ulong arg_count = opline->extended_value;
-
- while (arg_count>0) {
- zend_verify_arg_type(fbc, ++i, *(p-arg_count), 0 TSRMLS_CC);
- arg_count--;
- }
- }
-
- if (!zend_execute_internal) {
- /* saves one function call if zend_execute_internal is not used */
- fbc->internal_function.handler(opline->extended_value, ret->var.ptr, (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) ? &ret->var.ptr : NULL, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC);
- } else {
- zend_execute_internal(EXECUTE_DATA, RETURN_VALUE_USED(opline) TSRMLS_CC);
- }
-
- if (!RETURN_VALUE_USED(opline)) {
- zval_ptr_dtor(&ret->var.ptr);
- }
- } else if (fbc->type == ZEND_USER_FUNCTION) {
- EX(original_return_value) = EG(return_value_ptr_ptr);
- EG(active_symbol_table) = NULL;
- EG(active_op_array) = &fbc->op_array;
- EG(return_value_ptr_ptr) = NULL;
- if (RETURN_VALUE_USED(opline)) {
- temp_variable *ret = &EX_T(opline->result.var);
-
- ret->var.ptr = NULL;
- EG(return_value_ptr_ptr) = &ret->var.ptr;
- ret->var.ptr_ptr = &ret->var.ptr;
- ret->var.fcall_returned_reference = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;
- }
-
- if (EXPECTED(zend_execute == execute)) {
- if (EXPECTED(EG(exception) == NULL)) {
- ZEND_VM_ENTER();
- }
- } else {
- zend_execute(EG(active_op_array) TSRMLS_CC);
- }
-
- EG(opline_ptr) = &EX(opline);
- EG(active_op_array) = EX(op_array);
- EG(return_value_ptr_ptr) = EX(original_return_value);
- if (EG(active_symbol_table)) {
- if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) {
- zend_hash_destroy(EG(active_symbol_table));
- FREE_HASHTABLE(EG(active_symbol_table));
- } else {
- /* clean before putting into the cache, since clean
- could call dtors, which could use cached hash */
- zend_hash_clean(EG(active_symbol_table));
- *(++EG(symtable_cache_ptr)) = EG(active_symbol_table);
- }
- }
- EG(active_symbol_table) = EX(symbol_table);
- } else { /* ZEND_OVERLOADED_FUNCTION */
- MAKE_STD_ZVAL(EX_T(opline->result.var).var.ptr);
- ZVAL_NULL(EX_T(opline->result.var).var.ptr);
-
- /* Not sure what should be done here if it's a static method */
- if (EXPECTED(EX(object) != NULL)) {
- Z_OBJ_HT_P(EX(object))->call_method(fbc->common.function_name, opline->extended_value, EX_T(opline->result.var).var.ptr, &EX_T(opline->result.var).var.ptr, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC);
- } else {
- zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object");
- }
-
- if (fbc->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) {
- efree((char*)fbc->common.function_name);
- }
- efree(fbc);
-
- if (!RETURN_VALUE_USED(opline)) {
- zval_ptr_dtor(&EX_T(opline->result.var).var.ptr);
- } else {
- Z_UNSET_ISREF_P(EX_T(opline->result.var).var.ptr);
- Z_SET_REFCOUNT_P(EX_T(opline->result.var).var.ptr, 1);
- EX_T(opline->result.var).var.fcall_returned_reference = 0;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
- }
- }
-
- EX(function_state).function = (zend_function *) EX(op_array);
- EX(function_state).arguments = NULL;
-
- if (should_change_scope) {
- if (EG(This)) {
- if (UNEXPECTED(EG(exception) != NULL) && IS_CTOR_CALL(EX(called_scope))) {
- if (IS_CTOR_USED(EX(called_scope))) {
- Z_DELREF_P(EG(This));
- }
- if (Z_REFCOUNT_P(EG(This)) == 1) {
- zend_object_store_ctor_failed(EG(This) TSRMLS_CC);
- }
- }
- zval_ptr_dtor(&EG(This));
- }
- EG(This) = EX(current_this);
- EG(scope) = EX(current_scope);
- EG(called_scope) = EX(current_called_scope);
- }
-
- EX(object) = EX(current_object);
- EX(called_scope) = DECODE_CTOR(EX(called_scope));
-
- zend_vm_stack_clear_multiple(TSRMLS_C);
-
- if (UNEXPECTED(EG(exception) != NULL)) {
- zend_throw_exception_internal(NULL TSRMLS_CC);
- if (RETURN_VALUE_USED(opline) && EX_T(opline->result.var).var.ptr) {
- zval_ptr_dtor(&EX_T(opline->result.var).var.ptr);
- }
- HANDLE_EXCEPTION();
- }
-
- ZEND_VM_NEXT_OPCODE();
-}
-
ZEND_VM_HANDLER(61, ZEND_DO_FCALL_BY_NAME, ANY, ANY)
{
EX(function_state).function = EX(fbc);
@@ -2842,6 +2941,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;
@@ -2863,12 +2965,20 @@ 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 (EXPECTED(!EX(op_array)->has_finally_block)) {
+ ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
+ }
+ ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_RETURN);
}
ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
@@ -2881,6 +2991,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");
@@ -2936,6 +3050,18 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
} while (0);
FREE_OP1_IF_VAR();
+
+ if (EXPECTED(!EX(op_array)->has_finally_block)) {
+ ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
+ }
+ ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_RETURN_BY_REF);
+}
+
+ZEND_VM_HANDLER(161, ZEND_GENERATOR_RETURN, ANY, ANY)
+{
+ if (EX(op_array)->has_finally_block) {
+ ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_RETURN);
+ }
ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
}
@@ -3280,7 +3406,11 @@ ZEND_VM_HANDLER(50, ZEND_BRK, ANY, CONST)
el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num,
EX(op_array), EX_Ts() TSRMLS_CC);
FREE_OP2();
- ZEND_VM_JMP(EX(op_array)->opcodes + el->brk);
+ if (EXPECTED(!EX(op_array)->has_finally_block)) {
+ ZEND_VM_JMP(EX(op_array)->opcodes + el->brk);
+ }
+ EX(leaving_dest) = el->brk;
+ ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_BRK);
}
ZEND_VM_HANDLER(51, ZEND_CONT, ANY, CONST)
@@ -3292,7 +3422,11 @@ ZEND_VM_HANDLER(51, ZEND_CONT, ANY, CONST)
el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num,
EX(op_array), EX_Ts() TSRMLS_CC);
FREE_OP2();
- ZEND_VM_JMP(EX(op_array)->opcodes + el->cont);
+ if (EXPECTED(!EX(op_array)->has_finally_block)) {
+ ZEND_VM_JMP(EX(op_array)->opcodes + el->cont);
+ }
+ EX(leaving_dest) = el->cont;
+ ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_CONT);
}
ZEND_VM_HANDLER(100, ZEND_GOTO, ANY, CONST)
@@ -3319,7 +3453,11 @@ ZEND_VM_HANDLER(100, ZEND_GOTO, ANY, CONST)
}
break;
}
- ZEND_VM_JMP(opline->op1.jmp_addr);
+ if (EXPECTED(!EX(op_array)->has_finally_block)) {
+ ZEND_VM_JMP(opline->op1.jmp_addr);
+ }
+ EX(leaving_dest) = opline->op1.jmp_addr - EX(op_array)->opcodes;
+ ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_GOTO);
}
ZEND_VM_HANDLER(48, ZEND_CASE, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
@@ -3717,7 +3855,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
zend_op_array *new_op_array=NULL;
zend_free_op free_op1;
zval *inc_filename;
- zval *tmp_inc_filename = NULL;
+ zval *tmp_inc_filename = NULL;
zend_bool failure_retval=0;
SAVE_OPLINE();
@@ -3956,7 +4094,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:
@@ -4996,13 +5135,28 @@ 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;
- zval restored_error_reporting;
-
- void **stack_frame = (void**)(((char*)EX_Ts()) +
- (ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * EX(op_array)->T));
+ 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
+ * arguments that have to be dtor'ed) starts */
+ if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) {
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ /* For generators the next stack frame is conveniently stored in the
+ * generator object. */
+ stack_frame = generator->original_stack_top;
+ } else {
+ /* In all other cases the next stack frame starts after the temporary
+ * variables section of the current execution context */
+ stack_frame = (void **) ((char *) EX_Ts() +
+ ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * EX(op_array)->T);
+ }
+ /* If the exception was thrown during a function call there might be
+ * arguments pushed to the stack that have to be dtor'ed. */
while (zend_vm_stack_top(TSRMLS_C) != stack_frame) {
zval *stack_zval_p = zend_vm_stack_pop(TSRMLS_C);
zval_ptr_dtor(&stack_zval_p);
@@ -5012,9 +5166,14 @@ 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;
}
}
@@ -5064,6 +5223,8 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
/* restore previous error_reporting value */
if (!EG(error_reporting) && EX(old_error_reporting) != NULL && Z_LVAL_P(EX(old_error_reporting)) != 0) {
+ zval restored_error_reporting;
+
Z_TYPE(restored_error_reporting) = IS_LONG;
Z_LVAL(restored_error_reporting) = Z_LVAL_P(EX(old_error_reporting));
convert_to_string(&restored_error_reporting);
@@ -5072,12 +5233,29 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
}
EX(old_error_reporting) = NULL;
- if (!catched) {
- ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
- } else {
+ 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) = ZEND_THROW;
+ 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();
- }
+ ZEND_VM_CONTINUE();
+ } else if (finally) {
+ zend_exception_save(TSRMLS_C);
+ EX(leaving) = ZEND_THROW;
+ ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
+ ZEND_VM_CONTINUE();
+ } else {
+ ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
+ }
}
ZEND_VM_HANDLER(146, ZEND_VERIFY_ABSTRACT_CLASS, ANY, ANY)
@@ -5182,8 +5360,8 @@ ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED)
SAVE_OPLINE();
var_ptr = EX_T(opline->op1.var).var.ptr;
if (Z_TYPE_P(var_ptr) != IS_OBJECT &&
- !PZVAL_IS_REF(var_ptr) &&
- Z_REFCOUNT_P(var_ptr) > 1) {
+ !PZVAL_IS_REF(var_ptr) &&
+ Z_REFCOUNT_P(var_ptr) > 1) {
Z_DELREF_P(var_ptr);
ALLOC_ZVAL(new_zv);
@@ -5195,4 +5373,185 @@ ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED)
ZEND_VM_NEXT_OPCODE();
}
+ZEND_VM_HANDLER(159, ZEND_LEAVE, ANY, ANY)
+{
+ zend_exception_restore(TSRMLS_C);
+ if (!EX(leaving)) {
+ ZEND_VM_NEXT_OPCODE();
+ } else {
+ zend_uint leaving = EX(leaving);
+ switch (leaving) {
+ case ZEND_RETURN:
+ case ZEND_RETURN_BY_REF:
+ case ZEND_THROW:
+ leaving = ZEND_LEAVE;
+ case ZEND_JMP:
+ case ZEND_BRK:
+ case ZEND_CONT:
+ case ZEND_GOTO:
+ ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, leaving);
+ break;
+ }
+ }
+
+ ZEND_VM_CONTINUE();
+}
+
+ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSED)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (OP1_TYPE != IS_UNUSED) {
+ zend_free_op free_op1;
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (OP1_TYPE == IS_CONST || OP1_TYPE == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = GET_OP1_ZVAL_PTR(BP_VAR_R);
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!IS_OP1_TMP_FREE()) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
+
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (OP1_TYPE == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ FREE_OP1_IF_VAR();
+ }
+ } else {
+ zval *value = GET_OP1_ZVAL_PTR(BP_VAR_R);
+
+ /* Consts, temporary variables and references need copying */
+ if (OP1_TYPE == IS_CONST || OP1_TYPE == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!IS_OP1_TMP_FREE()) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ FREE_OP1_IF_VAR();
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (OP2_TYPE != IS_UNUSED) {
+ zend_free_op free_op2;
+ zval *key = GET_OP2_ZVAL_PTR(BP_VAR_R);
+
+ /* Consts, temporary variables and references need copying */
+ if (OP2_TYPE == IS_CONST || OP2_TYPE == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!IS_OP2_TMP_FREE()) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ FREE_OP2_IF_VAR();
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
ZEND_VM_EXPORT_HELPER(zend_do_fcall, zend_do_fcall_common_helper)
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index e575f96928..f8a8905040 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -339,30 +339,43 @@ static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, zend_op* o
#define EX_Ts() EX(Ts)
-ZEND_API void execute(zend_op_array *op_array TSRMLS_DC)
-{
- DCL_OPLINE
+zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array *op_array, zend_bool nested TSRMLS_DC) {
zend_execute_data *execute_data;
- zend_bool nested = 0;
- zend_bool original_in_execution = EG(in_execution);
-
- if (EG(exception)) {
- return;
+ /*
+ * When allocating the execute_data, memory for compiled variables and
+ * temporary variables is also allocated after the actual zend_execute_data
+ * struct. op_array->last_var specifies the number of compiled variables and
+ * op_array->T is the number of temporary variables. If there is no symbol
+ * table, then twice as much memory is allocated for compiled variables.
+ * In that case the first half contains zval**s and the second half the
+ * actual zval*s (which would otherwise be in the symbol table).
+ */
+ size_t execute_data_size = ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data));
+ size_t CVs_size = ZEND_MM_ALIGNED_SIZE(sizeof(zval **) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2));
+ size_t Ts_size = ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T;
+ size_t total_size = execute_data_size + CVs_size + Ts_size;
+
+ /*
+ * Normally the execute_data is allocated on the VM stack (because it does
+ * not actually do any allocation and thus is faster). For generators
+ * though this behavior would be suboptimal, because the (rather large)
+ * structure would have to be copied back and forth every time execution is
+ * suspended or resumed. That's why for generators the execution context
+ * is allocated using emalloc, thus allowing to save and restore it simply
+ * by replacing a pointer.
+ */
+ if (op_array->fn_flags & ZEND_ACC_GENERATOR) {
+ execute_data = emalloc(total_size);
+ } else {
+ execute_data = zend_vm_stack_alloc(total_size TSRMLS_CC);
}
- EG(in_execution) = 1;
+ EX(CVs) = (zval ***) ((char *) execute_data + execute_data_size);
+ memset(EX(CVs), 0, sizeof(zval **) * op_array->last_var);
-zend_vm_enter:
- /* Initialize execute_data */
- execute_data = (zend_execute_data *)zend_vm_stack_alloc(
- ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data)) +
- ZEND_MM_ALIGNED_SIZE(sizeof(zval**) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2)) +
- ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T TSRMLS_CC);
+ EX(Ts) = (temp_variable *) ((char *) EX(CVs) + CVs_size);
- EX(CVs) = (zval***)((char*)execute_data + ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data)));
- memset(EX(CVs), 0, sizeof(zval**) * op_array->last_var);
- EX(Ts) = (temp_variable *)(((char*)EX(CVs)) + ZEND_MM_ALIGNED_SIZE(sizeof(zval**) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2)));
EX(fbc) = NULL;
EX(called_scope) = NULL;
EX(object) = NULL;
@@ -372,9 +385,7 @@ zend_vm_enter:
EX(prev_execute_data) = EG(current_execute_data);
EG(current_execute_data) = execute_data;
EX(nested) = nested;
- nested = 1;
-
- LOAD_REGS();
+ 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*));
@@ -383,10 +394,10 @@ zend_vm_enter:
if (op_array->this_var != -1 && EG(This)) {
Z_ADDREF_P(EG(This)); /* For $this pointer */
if (!EG(active_symbol_table)) {
- EX_CV(op_array->this_var) = (zval**)EX_CVs() + (op_array->last_var + op_array->this_var);
- *EX_CV(op_array->this_var) = EG(This);
+ EX(CVs)[op_array->this_var] = (zval **) EX(CVs) + op_array->last_var + op_array->this_var;
+ *EX(CVs)[op_array->this_var] = EG(This);
} else {
- if (zend_hash_add(EG(active_symbol_table), "this", sizeof("this"), &EG(This), sizeof(zval *), (void**)&EX_CV(op_array->this_var))==FAILURE) {
+ if (zend_hash_add(EG(active_symbol_table), "this", sizeof("this"), &EG(This), sizeof(zval *), (void **) &EX(CVs)[op_array->this_var])==FAILURE) {
Z_DELREF_P(EG(This));
}
}
@@ -394,11 +405,30 @@ zend_vm_enter:
EX(opline) = UNEXPECTED((op_array->fn_flags & ZEND_ACC_INTERACTIVE) != 0) && EG(start_op) ? EG(start_op) : op_array->opcodes;
EG(opline_ptr) = &EX(opline);
- LOAD_OPLINE();
EX(function_state).function = (zend_function *) op_array;
EX(function_state).arguments = NULL;
+ return execute_data;
+}
+
+ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC)
+{
+ DCL_OPLINE
+ zend_bool original_in_execution;
+
+
+
+ if (EG(exception)) {
+ return;
+ }
+
+ original_in_execution = EG(in_execution);
+ EG(in_execution) = 1;
+
+ LOAD_REGS();
+ LOAD_OPLINE();
+
while (1) {
int ret;
#ifdef ZEND_WIN32
@@ -413,10 +443,11 @@ zend_vm_enter:
EG(in_execution) = original_in_execution;
return;
case 2:
- op_array = EG(active_op_array);
- goto zend_vm_enter;
+ execute_data = zend_create_execute_data_from_op_array(EG(active_op_array), 1 TSRMLS_CC);
+ break;
case 3:
execute_data = EG(current_execute_data);
+ break;
default:
break;
}
@@ -426,31 +457,11 @@ zend_vm_enter:
zend_error_noreturn(E_ERROR, "Arrived at end of main loop which shouldn't happen");
}
-static int ZEND_FASTCALL ZEND_JMP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
-
-#if DEBUG_ZEND>=2
- printf("Jumping to %d\n", opline->op1.opline_num);
-#endif
- ZEND_VM_SET_OPCODE(opline->op1.jmp_addr);
- ZEND_VM_CONTINUE(); /* CHECK_ME */
-}
-
-static int ZEND_FASTCALL ZEND_INIT_STRING_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+ZEND_API void execute(zend_op_array *op_array TSRMLS_DC)
{
- USE_OPLINE
- zval *tmp = &EX_T(opline->result.var).tmp_var;
+ zend_execute_data *execute_data = zend_create_execute_data_from_op_array(op_array, 0 TSRMLS_CC);
- SAVE_OPLINE();
- tmp->value.str.val = emalloc(1);
- tmp->value.str.val[0] = 0;
- tmp->value.str.len = 0;
- Z_SET_REFCOUNT_P(tmp, 1);
- tmp->type = IS_STRING;
- Z_UNSET_ISREF_P(tmp);
- /*CHECK_EXCEPTION();*/
- ZEND_VM_NEXT_OPCODE();
+ execute_ex(execute_data TSRMLS_CC);
}
static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
@@ -458,17 +469,22 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
zend_bool nested;
zend_op_array *op_array = EX(op_array);
+ /* Generators go throw a different cleanup process */
+ if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) {
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ /* Close the generator to free up resources */
+ zend_generator_close(generator, 1 TSRMLS_CC);
+
+ /* Pass execution back to handling code */
+ ZEND_VM_RETURN();
+ }
+
EG(current_execute_data) = EX(prev_execute_data);
EG(opline_ptr) = NULL;
if (!EG(active_symbol_table)) {
- zval ***cv = EX_CVs();
- zval ***end = cv + op_array->last_var;
- while (cv != end) {
- if (*cv) {
- zval_ptr_dtor(*cv);
- }
- cv++;
- }
+ zend_free_compiled_variables(EX_CVs(), op_array->last_var);
}
if ((op_array->fn_flags & ZEND_ACC_CLOSURE) && op_array->prototype) {
@@ -477,7 +493,13 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
nested = EX(nested);
- zend_vm_stack_free(execute_data TSRMLS_CC);
+ /* For generators the execute_data is stored on the heap, for everything
+ * else it is stored on the VM stack. */
+ if (op_array->fn_flags & ZEND_ACC_GENERATOR) {
+ efree(execute_data);
+ } else {
+ zend_vm_stack_free(execute_data TSRMLS_CC);
+ }
if (nested) {
execute_data = EG(current_execute_data);
@@ -515,20 +537,11 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
ZEND_VM_INC_OPCODE();
ZEND_VM_LEAVE();
} else {
-
EG(opline_ptr) = &EX(opline);
EG(active_op_array) = EX(op_array);
EG(return_value_ptr_ptr) = EX(original_return_value);
if (EG(active_symbol_table)) {
- if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) {
- zend_hash_destroy(EG(active_symbol_table));
- FREE_HASHTABLE(EG(active_symbol_table));
- } else {
- /* clean before putting into the cache, since clean
- could call dtors, which could use cached hash */
- zend_hash_clean(EG(active_symbol_table));
- *(++EG(symtable_cache_ptr)) = EG(active_symbol_table);
- }
+ zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC);
}
EG(active_symbol_table) = EX(symbol_table);
@@ -661,7 +674,11 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
ret->var.fcall_returned_reference = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;
}
- if (EXPECTED(zend_execute == execute)) {
+ if (EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) {
+ if (RETURN_VALUE_USED(opline)) {
+ EX_T(opline->result.var).var.ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC);
+ }
+ } else if (EXPECTED(zend_execute == execute)) {
if (EXPECTED(EG(exception) == NULL)) {
ZEND_VM_ENTER();
}
@@ -673,22 +690,14 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
EG(active_op_array) = EX(op_array);
EG(return_value_ptr_ptr) = EX(original_return_value);
if (EG(active_symbol_table)) {
- if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) {
- zend_hash_destroy(EG(active_symbol_table));
- FREE_HASHTABLE(EG(active_symbol_table));
- } else {
- /* clean before putting into the cache, since clean
- could call dtors, which could use cached hash */
- zend_hash_clean(EG(active_symbol_table));
- *(++EG(symtable_cache_ptr)) = EG(active_symbol_table);
- }
+ zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC);
}
EG(active_symbol_table) = EX(symbol_table);
} else { /* ZEND_OVERLOADED_FUNCTION */
MAKE_STD_ZVAL(EX_T(opline->result.var).var.ptr);
ZVAL_NULL(EX_T(opline->result.var).var.ptr);
- /* Not sure what should be done here if it's a static method */
+ /* Not sure what should be done here if it's a static method */
if (EXPECTED(EX(object) != NULL)) {
Z_OBJ_HT_P(EX(object))->call_method(fbc->common.function_name, opline->extended_value, EX_T(opline->result.var).var.ptr, &EX_T(opline->result.var).var.ptr, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC);
} else {
@@ -746,12 +755,146 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
ZEND_VM_NEXT_OPCODE();
}
+static int ZEND_FASTCALL zend_finally_handler_leaving_SPEC(int type, ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_uint i, op_num = opline - EX(op_array)->opcodes;
+ zend_uint catch_op_num = 0, finally_op_num = 0;
+
+ SAVE_OPLINE();
+
+ switch (type) {
+ case ZEND_THROW:
+ case ZEND_RETURN:
+ case ZEND_RETURN_BY_REF:
+ case ZEND_LEAVE:
+ {
+ if (EG(prev_exception) || (type == ZEND_LEAVE && EG(exception))) {
+ for (i=0; i<EX(op_array)->last_try_catch; i++) {
+ if (EX(op_array)->try_catch_array[i].try_op > op_num) {
+ break;
+ }
+ if (op_num < EX(op_array)->try_catch_array[i].finally_op) {
+ finally_op_num = EX(op_array)->try_catch_array[i].finally_op;
+ }
+ if (op_num < EX(op_array)->try_catch_array[i].catch_op) {
+ catch_op_num = EX(op_array)->try_catch_array[i].catch_op;
+ }
+ }
+ } else {
+ for (i=0; i<EX(op_array)->last_try_catch; i++) {
+ if (EX(op_array)->try_catch_array[i].try_op > op_num) {
+ break;
+ }
+ if (op_num < EX(op_array)->try_catch_array[i].finally_op) {
+ finally_op_num = EX(op_array)->try_catch_array[i].finally_op;
+ }
+ }
+ }
+
+ if (catch_op_num && finally_op_num) {
+ /* EG(exception) || EG(prev_exception) */
+ if (catch_op_num > finally_op_num) {
+ zend_exception_save(TSRMLS_C);
+ EX(leaving) = ZEND_THROW;
+ ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
+ } else {
+ EX(leaving) = 0;
+ ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
+ }
+ } else if (catch_op_num) {
+ EX(leaving) = 0;
+ ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
+ } else if (finally_op_num) {
+ zend_exception_save(TSRMLS_C);
+ if (type != ZEND_LEAVE) {
+ EX(leaving) = type;
+ }
+ ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
+ } else if (EX(leaving) && type != ZEND_LEAVE) {
+ /* leave it to ZEND_LEAVE */
+ EX(leaving) = type;
+ ZEND_VM_NEXT_OPCODE();
+ } else {
+ return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
+ }
+ break;
+ case ZEND_JMP:
+ case ZEND_BRK:
+ case ZEND_CONT:
+ case ZEND_GOTO:
+ {
+ /* these can not occurred in exception context */
+ for (i=0; i<EG(active_op_array)->last_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
+ && (EX(leaving_dest) < EG(active_op_array)->try_catch_array[i].try_op
+ || EX(leaving_dest) >= EG(active_op_array)->try_catch_array[i].finally_end)) {
+ finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op;
+ }
+ }
+
+ if (finally_op_num) {
+ EX(leaving) = type;
+ ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
+ } else {
+ EX(leaving) = 0;
+ ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[EX(leaving_dest)]);
+ }
+ }
+ break;
+ }
+ ZEND_VM_CONTINUE();
+}
+
+static int ZEND_FASTCALL ZEND_JMP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+#if DEBUG_ZEND>=2
+ printf("Jumping to %d\n", opline->op1.opline_num);
+#endif
+ if (EXPECTED(!EX(op_array)->has_finally_block)) {
+ ZEND_VM_SET_OPCODE(opline->op1.jmp_addr);
+ ZEND_VM_CONTINUE(); /* CHECK_ME */
+ }
+ EX(leaving_dest) = opline->op1.jmp_addr - EX(op_array)->opcodes;
+ return zend_finally_handler_leaving_SPEC(ZEND_JMP, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+}
+
+static int ZEND_FASTCALL ZEND_INIT_STRING_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *tmp = &EX_T(opline->result.var).tmp_var;
+
+ SAVE_OPLINE();
+ tmp->value.str.val = emalloc(1);
+ tmp->value.str.val[0] = 0;
+ tmp->value.str.len = 0;
+ Z_SET_REFCOUNT_P(tmp, 1);
+ tmp->type = IS_STRING;
+ Z_UNSET_ISREF_P(tmp);
+ /*CHECK_EXCEPTION();*/
+ ZEND_VM_NEXT_OPCODE();
+}
+
static int ZEND_FASTCALL ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
EX(function_state).function = EX(fbc);
return zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
+static int ZEND_FASTCALL ZEND_GENERATOR_RETURN_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ if (EX(op_array)->has_finally_block) {
+ return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
+ return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+}
+
static int ZEND_FASTCALL ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -1033,13 +1176,28 @@ 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;
- zval restored_error_reporting;
+ zend_uint catch_op_num = 0, finally_op_num = 0;
+ int catched = 0, finally = 0;
+ void **stack_frame;
- void **stack_frame = (void**)(((char*)EX_Ts()) +
- (ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * EX(op_array)->T));
+ /* Figure out where the next stack frame (which maybe contains pushed
+ * arguments that have to be dtor'ed) starts */
+ if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) {
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ /* For generators the next stack frame is conveniently stored in the
+ * generator object. */
+ stack_frame = generator->original_stack_top;
+ } else {
+ /* In all other cases the next stack frame starts after the temporary
+ * variables section of the current execution context */
+ stack_frame = (void **) ((char *) EX_Ts() +
+ ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * EX(op_array)->T);
+ }
+ /* If the exception was thrown during a function call there might be
+ * arguments pushed to the stack that have to be dtor'ed. */
while (zend_vm_stack_top(TSRMLS_C) != stack_frame) {
zval *stack_zval_p = zend_vm_stack_pop(TSRMLS_C);
zval_ptr_dtor(&stack_zval_p);
@@ -1049,9 +1207,14 @@ 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;
}
}
@@ -1101,6 +1264,8 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER
/* restore previous error_reporting value */
if (!EG(error_reporting) && EX(old_error_reporting) != NULL && Z_LVAL_P(EX(old_error_reporting)) != 0) {
+ zval restored_error_reporting;
+
Z_TYPE(restored_error_reporting) = IS_LONG;
Z_LVAL(restored_error_reporting) = Z_LVAL_P(EX(old_error_reporting));
convert_to_string(&restored_error_reporting);
@@ -1109,12 +1274,29 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER
}
EX(old_error_reporting) = NULL;
- if (!catched) {
- return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- } else {
+ 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) = ZEND_THROW;
+ 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();
- }
+ ZEND_VM_CONTINUE();
+ } else if (finally) {
+ zend_exception_save(TSRMLS_C);
+ EX(leaving) = ZEND_THROW;
+ 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);
+ }
}
static int ZEND_FASTCALL ZEND_VERIFY_ABSTRACT_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -1152,12 +1334,38 @@ 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)
+{
+ zend_exception_restore(TSRMLS_C);
+ if (!EX(leaving)) {
+ ZEND_VM_NEXT_OPCODE();
+ } else {
+ zend_uint leaving = EX(leaving);
+ switch (leaving) {
+ case ZEND_RETURN:
+ case ZEND_RETURN_BY_REF:
+ case ZEND_THROW:
+ leaving = ZEND_LEAVE;
+ case ZEND_JMP:
+ case ZEND_BRK:
+ case ZEND_CONT:
+ case ZEND_GOTO:
+ return zend_finally_handler_leaving_SPEC(leaving, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ break;
+ }
+ }
+
+ ZEND_VM_CONTINUE();
+}
+
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();
@@ -1384,7 +1592,11 @@ static int ZEND_FASTCALL ZEND_BRK_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num,
EX(op_array), EX_Ts() TSRMLS_CC);
- ZEND_VM_JMP(EX(op_array)->opcodes + el->brk);
+ if (EXPECTED(!EX(op_array)->has_finally_block)) {
+ ZEND_VM_JMP(EX(op_array)->opcodes + el->brk);
+ }
+ EX(leaving_dest) = el->brk;
+ return zend_finally_handler_leaving_SPEC(ZEND_BRK, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
static int ZEND_FASTCALL ZEND_CONT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -1396,7 +1608,11 @@ static int ZEND_FASTCALL ZEND_CONT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num,
EX(op_array), EX_Ts() TSRMLS_CC);
- ZEND_VM_JMP(EX(op_array)->opcodes + el->cont);
+ if (EXPECTED(!EX(op_array)->has_finally_block)) {
+ ZEND_VM_JMP(EX(op_array)->opcodes + el->cont);
+ }
+ EX(leaving_dest) = el->cont;
+ return zend_finally_handler_leaving_SPEC(ZEND_CONT, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
static int ZEND_FASTCALL ZEND_GOTO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -1423,7 +1639,11 @@ static int ZEND_FASTCALL ZEND_GOTO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
break;
}
- ZEND_VM_JMP(opline->op1.jmp_addr);
+ if (EXPECTED(!EX(op_array)->has_finally_block)) {
+ ZEND_VM_JMP(opline->op1.jmp_addr);
+ }
+ EX(leaving_dest) = opline->op1.jmp_addr - EX(op_array)->opcodes;
+ return zend_finally_handler_leaving_SPEC(ZEND_GOTO, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
static int ZEND_FASTCALL ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -1458,7 +1678,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();
@@ -1622,7 +1844,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();
@@ -1786,7 +2010,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();
@@ -1820,7 +2046,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();
@@ -2233,6 +2461,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;
@@ -2254,12 +2485,19 @@ 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 (EXPECTED(!EX(op_array)->has_finally_block)) {
+ return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
+ return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -2272,6 +2510,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");
@@ -2326,7 +2568,10 @@ 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 (EXPECTED(!EX(op_array)->has_finally_block)) {
+ return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
+ return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
static int ZEND_FASTCALL ZEND_THROW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -2526,7 +2771,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA
zend_op_array *new_op_array=NULL;
zval *inc_filename;
- zval *tmp_inc_filename = NULL;
+ zval *tmp_inc_filename = NULL;
zend_bool failure_retval=0;
SAVE_OPLINE();
@@ -3388,17 +3633,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
- if (IS_CONST == IS_TMP_VAR || IS_CONST == IS_CONST) {
- zval *container = opline->op1.zv;
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
+ if (IS_CONST == IS_TMP_VAR || IS_CONST == IS_CONST) {
+ zval *container = opline->op1.zv;
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
- } else {
- container = NULL;
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
+ } else {
+ container = NULL;
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
- }
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -3954,6 +4199,160 @@ static int ZEND_FASTCALL ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER(ZEND_OPCOD
ZEND_VM_NEXT_OPCODE();
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_CONST != IS_UNUSED) {
+
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = opline->op1.zv;
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = NULL;
+
+ if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_CONST == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ }
+ } else {
+ zval *value = opline->op1.zv;
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_CONST != IS_UNUSED) {
+
+ zval *key = opline->op2.zv;
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -4244,17 +4643,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HA
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
- if (IS_CONST == IS_TMP_VAR || IS_CONST == IS_CONST) {
- zval *container = opline->op1.zv;
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
- zval_dtor(free_op2.var);
+ if (IS_CONST == IS_TMP_VAR || IS_CONST == IS_CONST) {
+ zval *container = opline->op1.zv;
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
+ zval_dtor(free_op2.var);
- } else {
- container = NULL;
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
- zval_dtor(free_op2.var);
+ } else {
+ container = NULL;
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
+ zval_dtor(free_op2.var);
- }
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -4494,6 +4893,160 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HAN
}
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_CONST != IS_UNUSED) {
+
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = opline->op1.zv;
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = NULL;
+
+ if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_CONST == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ }
+ } else {
+ zval *value = opline->op1.zv;
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_TMP_VAR != IS_UNUSED) {
+ zend_free_op free_op2;
+ zval *key = _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!1) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -4948,17 +5501,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HA
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
- if (IS_CONST == IS_TMP_VAR || IS_CONST == IS_CONST) {
- zval *container = opline->op1.zv;
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
- if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ if (IS_CONST == IS_TMP_VAR || IS_CONST == IS_CONST) {
+ zval *container = opline->op1.zv;
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
- } else {
- container = NULL;
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
- if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ } else {
+ container = NULL;
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
- }
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -5359,6 +5912,161 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPC
ZEND_VM_NEXT_OPCODE();
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_CONST != IS_UNUSED) {
+
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = opline->op1.zv;
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = NULL;
+
+ if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_CONST == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ }
+ } else {
+ zval *value = opline->op1.zv;
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_VAR != IS_UNUSED) {
+ zend_free_op free_op2;
+ zval *key = _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int type, ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -5918,6 +6626,160 @@ static int ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_UNUSED_HANDLER
ZEND_VM_NEXT_OPCODE();
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_CONST != IS_UNUSED) {
+
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = opline->op1.zv;
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = NULL;
+
+ if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_CONST == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ }
+ } else {
+ zval *value = opline->op1.zv;
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_UNUSED != IS_UNUSED) {
+
+ zval *key = NULL;
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -6208,17 +7070,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HAN
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
- if (IS_CONST == IS_TMP_VAR || IS_CONST == IS_CONST) {
- zval *container = opline->op1.zv;
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
+ if (IS_CONST == IS_TMP_VAR || IS_CONST == IS_CONST) {
+ zval *container = opline->op1.zv;
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
- } else {
- container = NULL;
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
+ } else {
+ container = NULL;
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
- }
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -6517,6 +7379,160 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HAND
}
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_CONST != IS_UNUSED) {
+
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = opline->op1.zv;
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = NULL;
+
+ if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_CONST == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ }
+ } else {
+ zval *value = opline->op1.zv;
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_CV != IS_UNUSED) {
+
+ zval *key = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -6766,6 +7782,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;
@@ -6787,12 +7806,19 @@ 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 (EXPECTED(!EX(op_array)->has_finally_block)) {
+ return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
+ return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -6805,6 +7831,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");
@@ -6859,7 +7889,10 @@ 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 (EXPECTED(!EX(op_array)->has_finally_block)) {
+ return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
+ return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
static int ZEND_FASTCALL ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7060,7 +8093,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND
zend_op_array *new_op_array=NULL;
zend_free_op free_op1;
zval *inc_filename;
- zval *tmp_inc_filename = NULL;
+ zval *tmp_inc_filename = NULL;
zend_bool failure_retval=0;
SAVE_OPLINE();
@@ -7974,17 +9007,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HA
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
- if (IS_TMP_VAR == IS_TMP_VAR || IS_TMP_VAR == IS_CONST) {
- zval *container = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
+ if (IS_TMP_VAR == IS_TMP_VAR || IS_TMP_VAR == IS_CONST) {
+ zval *container = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
- zval_dtor(free_op1.var);
- } else {
- container = NULL;
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
+ zval_dtor(free_op1.var);
+ } else {
+ container = NULL;
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
- }
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -8408,6 +9441,160 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC
ZEND_VM_NEXT_OPCODE();
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_TMP_VAR != IS_UNUSED) {
+ zend_free_op free_op1;
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!1) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = NULL;
+
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_TMP_VAR == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ }
+ } else {
+ zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!1) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_CONST != IS_UNUSED) {
+
+ zval *key = opline->op2.zv;
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -8698,17 +9885,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HAND
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
- if (IS_TMP_VAR == IS_TMP_VAR || IS_TMP_VAR == IS_CONST) {
- zval *container = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
- zval_dtor(free_op2.var);
- zval_dtor(free_op1.var);
- } else {
- container = NULL;
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
- zval_dtor(free_op2.var);
+ if (IS_TMP_VAR == IS_TMP_VAR || IS_TMP_VAR == IS_CONST) {
+ zval *container = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
+ zval_dtor(free_op2.var);
+ zval_dtor(free_op1.var);
+ } else {
+ container = NULL;
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
+ zval_dtor(free_op2.var);
- }
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -8948,6 +10135,160 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDL
}
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_TMP_VAR != IS_UNUSED) {
+ zend_free_op free_op1;
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!1) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = NULL;
+
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_TMP_VAR == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ }
+ } else {
+ zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!1) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_TMP_VAR != IS_UNUSED) {
+ zend_free_op free_op2;
+ zval *key = _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!1) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -9402,17 +10743,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HAND
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
- if (IS_TMP_VAR == IS_TMP_VAR || IS_TMP_VAR == IS_CONST) {
- zval *container = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
- if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
- zval_dtor(free_op1.var);
- } else {
- container = NULL;
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
- if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ if (IS_TMP_VAR == IS_TMP_VAR || IS_TMP_VAR == IS_CONST) {
+ zval *container = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ zval_dtor(free_op1.var);
+ } else {
+ container = NULL;
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
- }
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9813,6 +11154,161 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD
ZEND_VM_NEXT_OPCODE();
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_TMP_VAR != IS_UNUSED) {
+ zend_free_op free_op1;
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!1) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = NULL;
+
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_TMP_VAR == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ }
+ } else {
+ zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!1) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_VAR != IS_UNUSED) {
+ zend_free_op free_op2;
+ zval *key = _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type, ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -10238,6 +11734,160 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP
ZEND_VM_NEXT_OPCODE();
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_TMP_VAR != IS_UNUSED) {
+ zend_free_op free_op1;
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!1) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = NULL;
+
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_TMP_VAR == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ }
+ } else {
+ zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!1) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_UNUSED != IS_UNUSED) {
+
+ zval *key = NULL;
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -10528,17 +12178,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDL
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
- if (IS_TMP_VAR == IS_TMP_VAR || IS_TMP_VAR == IS_CONST) {
- zval *container = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
+ if (IS_TMP_VAR == IS_TMP_VAR || IS_TMP_VAR == IS_CONST) {
+ zval *container = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
- zval_dtor(free_op1.var);
- } else {
- container = NULL;
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
+ zval_dtor(free_op1.var);
+ } else {
+ container = NULL;
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
- }
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10775,6 +12425,160 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLE
}
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_TMP_VAR != IS_UNUSED) {
+ zend_free_op free_op1;
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!1) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = NULL;
+
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_TMP_VAR == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ }
+ } else {
+ zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!1) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_CV != IS_UNUSED) {
+
+ zval *key = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -11204,6 +13008,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;
@@ -11225,12 +13032,20 @@ 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 (EXPECTED(!EX(op_array)->has_finally_block)) {
+ return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
+ return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -11243,6 +13058,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");
@@ -11298,7 +13117,11 @@ 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 (EXPECTED(!EX(op_array)->has_finally_block)) {
+ return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
+ return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
static int ZEND_FASTCALL ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -11608,7 +13431,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
zend_op_array *new_op_array=NULL;
zend_free_op free_op1;
zval *inc_filename;
- zval *tmp_inc_filename = NULL;
+ zval *tmp_inc_filename = NULL;
zend_bool failure_retval=0;
SAVE_OPLINE();
@@ -13099,17 +14922,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HA
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
- if (IS_VAR == IS_TMP_VAR || IS_VAR == IS_CONST) {
- zval *container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
+ if (IS_VAR == IS_TMP_VAR || IS_VAR == IS_CONST) {
+ zval *container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
- if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
- } else {
- container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
+ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+ } else {
+ container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
- if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
- }
+ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -14166,7 +15989,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:
@@ -14522,6 +16346,162 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_CONST_HANDLER(ZEN
return zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_VAR != IS_UNUSED) {
+ zend_free_op free_op1;
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+
+ if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_VAR == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+ }
+ } else {
+ zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_CONST != IS_UNUSED) {
+
+ zval *key = opline->op2.zv;
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -15275,17 +17255,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAND
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
- if (IS_VAR == IS_TMP_VAR || IS_VAR == IS_CONST) {
- zval *container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
- } else {
- container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
- }
+ if (IS_VAR == IS_TMP_VAR || IS_VAR == IS_CONST) {
+ zval *container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
+ zval_dtor(free_op2.var);
+ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+ } else {
+ container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
+ zval_dtor(free_op2.var);
+ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16177,7 +18157,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:
@@ -16448,6 +18429,162 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_
return zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_VAR != IS_UNUSED) {
+ zend_free_op free_op1;
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+
+ if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_VAR == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+ }
+ } else {
+ zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_TMP_VAR != IS_UNUSED) {
+ zend_free_op free_op2;
+ zval *key = _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!1) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -17365,17 +19502,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAND
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
- if (IS_VAR == IS_TMP_VAR || IS_VAR == IS_CONST) {
- zval *container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
- if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
- if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
- } else {
- container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
- if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
- if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
- }
+ if (IS_VAR == IS_TMP_VAR || IS_VAR == IS_CONST) {
+ zval *container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+ } else {
+ container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -18398,7 +20535,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:
@@ -18754,6 +20892,163 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_
return zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_VAR != IS_UNUSED) {
+ zend_free_op free_op1;
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+
+ if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_VAR == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+ }
+ } else {
+ zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_VAR != IS_UNUSED) {
+ zend_free_op free_op2;
+ zval *key = _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -19725,8 +22020,8 @@ static int ZEND_FASTCALL ZEND_SEPARATE_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
var_ptr = EX_T(opline->op1.var).var.ptr;
if (Z_TYPE_P(var_ptr) != IS_OBJECT &&
- !PZVAL_IS_REF(var_ptr) &&
- Z_REFCOUNT_P(var_ptr) > 1) {
+ !PZVAL_IS_REF(var_ptr) &&
+ Z_REFCOUNT_P(var_ptr) > 1) {
Z_DELREF_P(var_ptr);
ALLOC_ZVAL(new_zv);
@@ -19738,6 +22033,162 @@ static int ZEND_FASTCALL ZEND_SEPARATE_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAND
ZEND_VM_NEXT_OPCODE();
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_VAR != IS_UNUSED) {
+ zend_free_op free_op1;
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+
+ if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_VAR == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+ }
+ } else {
+ zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_UNUSED != IS_UNUSED) {
+
+ zval *key = NULL;
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -20490,17 +22941,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDL
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
- if (IS_VAR == IS_TMP_VAR || IS_VAR == IS_CONST) {
- zval *container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
+ if (IS_VAR == IS_TMP_VAR || IS_VAR == IS_CONST) {
+ zval *container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
- if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
- } else {
- container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
+ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+ } else {
+ container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
- if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
- }
+ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -21442,7 +23893,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:
@@ -21713,6 +24165,162 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_CV_HANDLER(ZEND_O
return zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_VAR != IS_UNUSED) {
+ zend_free_op free_op1;
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+
+ if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_VAR == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+ }
+ } else {
+ zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_CV != IS_UNUSED) {
+
+ zval *key = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -22780,7 +25388,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:
@@ -23047,6 +25656,160 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_CONST_HANDLER(
return zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_UNUSED != IS_UNUSED) {
+
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = NULL;
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = NULL;
+
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_UNUSED == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ }
+ } else {
+ zval *value = NULL;
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_CONST != IS_UNUSED) {
+
+ zval *key = opline->op2.zv;
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -23938,7 +26701,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:
@@ -24205,6 +26969,160 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_TMP_HANDLER(ZE
return zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_UNUSED != IS_UNUSED) {
+
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = NULL;
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = NULL;
+
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_UNUSED == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ }
+ } else {
+ zval *value = NULL;
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_TMP_VAR != IS_UNUSED) {
+ zend_free_op free_op2;
+ zval *key = _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!1) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -25096,7 +28014,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:
@@ -25363,6 +28282,161 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_VAR_HANDLER(ZE
return zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_UNUSED != IS_UNUSED) {
+
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = NULL;
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = NULL;
+
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_UNUSED == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ }
+ } else {
+ zval *value = NULL;
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_VAR != IS_UNUSED) {
+ zend_free_op free_op2;
+ zval *key = _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -25632,6 +28706,160 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE
}
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_UNUSED != IS_UNUSED) {
+
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = NULL;
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = NULL;
+
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_UNUSED == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ }
+ } else {
+ zval *value = NULL;
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_UNUSED != IS_UNUSED) {
+
+ zval *key = NULL;
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -26520,7 +29748,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:
@@ -26787,6 +30016,160 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_CV_HANDLER(ZEN
return zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_UNUSED != IS_UNUSED) {
+
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = NULL;
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = NULL;
+
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_UNUSED == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ }
+ } else {
+ zval *value = NULL;
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_CV != IS_UNUSED) {
+
+ zval *key = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -27197,6 +30580,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;
@@ -27218,12 +30604,19 @@ 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 (EXPECTED(!EX(op_array)->has_finally_block)) {
+ return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
+ return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -27236,6 +30629,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");
@@ -27290,7 +30687,10 @@ 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 (EXPECTED(!EX(op_array)->has_finally_block)) {
+ return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
+ return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
static int ZEND_FASTCALL ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -27588,7 +30988,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
zend_op_array *new_op_array=NULL;
zval *inc_filename;
- zval *tmp_inc_filename = NULL;
+ zval *tmp_inc_filename = NULL;
zend_bool failure_retval=0;
SAVE_OPLINE();
@@ -28932,17 +32332,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAN
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
- if (IS_CV == IS_TMP_VAR || IS_CV == IS_CONST) {
- zval *container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
+ if (IS_CV == IS_TMP_VAR || IS_CV == IS_CONST) {
+ zval *container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
- } else {
- container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
+ } else {
+ container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
- }
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -29783,7 +33183,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:
@@ -30135,6 +33536,160 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_CONST_HANDLER(ZEND
return zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_CV != IS_UNUSED) {
+
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->op1.var TSRMLS_CC);
+
+ if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_CV == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ }
+ } else {
+ zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_CONST != IS_UNUSED) {
+
+ zval *key = opline->op2.zv;
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -30887,17 +34442,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDL
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
- if (IS_CV == IS_TMP_VAR || IS_CV == IS_CONST) {
- zval *container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
- zval_dtor(free_op2.var);
+ if (IS_CV == IS_TMP_VAR || IS_CV == IS_CONST) {
+ zval *container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
+ zval_dtor(free_op2.var);
- } else {
- container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
- zval_dtor(free_op2.var);
+ } else {
+ container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
+ zval_dtor(free_op2.var);
- }
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -31665,7 +35220,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:
@@ -31932,6 +35488,160 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_TMP_HANDLER(ZEND_O
return zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_CV != IS_UNUSED) {
+
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->op1.var TSRMLS_CC);
+
+ if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_CV == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ }
+ } else {
+ zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_TMP_VAR != IS_UNUSED) {
+ zend_free_op free_op2;
+ zval *key = _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!1) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -32848,17 +36558,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDL
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
- if (IS_CV == IS_TMP_VAR || IS_CV == IS_CONST) {
- zval *container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
- if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ if (IS_CV == IS_TMP_VAR || IS_CV == IS_CONST) {
+ zval *container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
- } else {
- container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
- if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ } else {
+ container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
- }
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -33756,7 +37466,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:
@@ -34108,6 +37819,161 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_VAR_HANDLER(ZEND_O
return zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_CV != IS_UNUSED) {
+
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->op1.var TSRMLS_CC);
+
+ if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_CV == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ }
+ } else {
+ zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_VAR != IS_UNUSED) {
+ zend_free_op free_op2;
+ zval *key = _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -34953,6 +38819,160 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPC
ZEND_VM_NEXT_OPCODE();
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_CV != IS_UNUSED) {
+
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->op1.var TSRMLS_CC);
+
+ if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_CV == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ }
+ } else {
+ zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_UNUSED != IS_UNUSED) {
+
+ zval *key = NULL;
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -35704,17 +39724,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLE
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
- if (IS_CV == IS_TMP_VAR || IS_CV == IS_CONST) {
- zval *container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
+ if (IS_CV == IS_TMP_VAR || IS_CV == IS_CONST) {
+ zval *container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
- } else {
- container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
+ } else {
+ container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
+ zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
- }
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -36531,7 +40551,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:
@@ -36798,6 +40819,160 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_CV_HANDLER(ZEND_OP
return zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
+static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ /* The generator object is stored in return_value_ptr_ptr */
+ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+
+ if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
+ zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
+ }
+
+ /* Destroy the previously yielded value */
+ if (generator->value) {
+ zval_ptr_dtor(&generator->value);
+ }
+
+ /* Destroy the previously yielded key */
+ if (generator->key) {
+ zval_ptr_dtor(&generator->key);
+ }
+
+ /* Set the new yielded value */
+ if (IS_CV != IS_UNUSED) {
+
+
+ if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Constants and temporary variables aren't yieldable by reference,
+ * but we still allow them with a notice. */
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) {
+ zval *value, *copy;
+
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ zval **value_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->op1.var TSRMLS_CC);
+
+ if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
+ }
+
+ /* If a function call result is yielded and the function did
+ * not return by reference we throw a notice. */
+ if (IS_CV == IS_VAR && !Z_ISREF_PP(value_ptr)
+ && !(opline->extended_value == ZEND_RETURNS_FUNCTION
+ && EX_T(opline->op1.var).var.fcall_returned_reference)
+ && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
+ zend_error(E_NOTICE, "Only variable references should be yielded by reference");
+
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ } else {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_PP(value_ptr);
+ generator->value = *value_ptr;
+ }
+
+ }
+ } else {
+ zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR
+ || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, value);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->value = copy;
+ } else {
+ Z_ADDREF_P(value);
+ generator->value = value;
+ }
+
+ }
+ } else {
+ /* If no value was specified yield null */
+ Z_ADDREF(EG(uninitialized_zval));
+ generator->value = &EG(uninitialized_zval);
+ }
+
+ /* Set the new yielded key */
+ if (IS_CV != IS_UNUSED) {
+
+ zval *key = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC);
+
+ /* Consts, temporary variables and references need copying */
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR
+ || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ ) {
+ zval *copy;
+
+ ALLOC_ZVAL(copy);
+ INIT_PZVAL_COPY(copy, key);
+
+ /* Temporary variables don't need ctor copying */
+ if (!0) {
+ zval_copy_ctor(copy);
+ }
+
+ generator->key = copy;
+ } else {
+ Z_ADDREF_P(key);
+ generator->key = key;
+ }
+
+ if (Z_TYPE_P(generator->key) == IS_LONG
+ && Z_LVAL_P(generator->key) > generator->largest_used_integer_key
+ ) {
+ generator->largest_used_integer_key = Z_LVAL_P(generator->key);
+ }
+
+ } else {
+ /* If no key was specified we use auto-increment keys */
+ generator->largest_used_integer_key++;
+
+ ALLOC_INIT_ZVAL(generator->key);
+ ZVAL_LONG(generator->key, generator->largest_used_integer_key);
+ }
+
+ /* If a value is sent it should go into the result var */
+ generator->send_target = &EX_T(opline->result.var);
+
+ /* Initialize the sent value to NULL */
+ Z_ADDREF(EG(uninitialized_zval));
+ AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval));
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static int ZEND_FASTCALL ZEND_NULL_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_error_noreturn(E_ERROR, "Invalid opcode %d/%d/%d.", OPLINE->opcode, OPLINE->op1_type, OPLINE->op2_type);
@@ -40782,6 +44957,81 @@ 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,
+ ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER,
+ ZEND_YIELD_SPEC_CONST_CV_HANDLER,
+ ZEND_YIELD_SPEC_TMP_CONST_HANDLER,
+ ZEND_YIELD_SPEC_TMP_TMP_HANDLER,
+ ZEND_YIELD_SPEC_TMP_VAR_HANDLER,
+ ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER,
+ ZEND_YIELD_SPEC_TMP_CV_HANDLER,
+ ZEND_YIELD_SPEC_VAR_CONST_HANDLER,
+ ZEND_YIELD_SPEC_VAR_TMP_HANDLER,
+ ZEND_YIELD_SPEC_VAR_VAR_HANDLER,
+ ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER,
+ ZEND_YIELD_SPEC_VAR_CV_HANDLER,
+ ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER,
+ ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER,
+ ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER,
+ ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER,
+ ZEND_YIELD_SPEC_UNUSED_CV_HANDLER,
+ ZEND_YIELD_SPEC_CV_CONST_HANDLER,
+ ZEND_YIELD_SPEC_CV_TMP_HANDLER,
+ ZEND_YIELD_SPEC_CV_VAR_HANDLER,
+ ZEND_YIELD_SPEC_CV_UNUSED_HANDLER,
+ ZEND_YIELD_SPEC_CV_CV_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
+ ZEND_GENERATOR_RETURN_SPEC_HANDLER,
ZEND_NULL_HANDLER
};
zend_opcode_handlers = (opcode_handler_t*)labels;
diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl
index 426f689795..58e5631c95 100644
--- a/Zend/zend_vm_execute.skl
+++ b/Zend/zend_vm_execute.skl
@@ -1,31 +1,42 @@
{%DEFINES%}
-ZEND_API void {%EXECUTOR_NAME%}(zend_op_array *op_array TSRMLS_DC)
-{
- DCL_OPLINE
+zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array *op_array, zend_bool nested TSRMLS_DC) {
zend_execute_data *execute_data;
- zend_bool nested = 0;
- zend_bool original_in_execution = EG(in_execution);
- {%HELPER_VARS%}
- {%INTERNAL_LABELS%}
-
- if (EG(exception)) {
- return;
+ /*
+ * When allocating the execute_data, memory for compiled variables and
+ * temporary variables is also allocated after the actual zend_execute_data
+ * struct. op_array->last_var specifies the number of compiled variables and
+ * op_array->T is the number of temporary variables. If there is no symbol
+ * table, then twice as much memory is allocated for compiled variables.
+ * In that case the first half contains zval**s and the second half the
+ * actual zval*s (which would otherwise be in the symbol table).
+ */
+ size_t execute_data_size = ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data));
+ size_t CVs_size = ZEND_MM_ALIGNED_SIZE(sizeof(zval **) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2));
+ size_t Ts_size = ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T;
+ size_t total_size = execute_data_size + CVs_size + Ts_size;
+
+ /*
+ * Normally the execute_data is allocated on the VM stack (because it does
+ * not actually do any allocation and thus is faster). For generators
+ * though this behavior would be suboptimal, because the (rather large)
+ * structure would have to be copied back and forth every time execution is
+ * suspended or resumed. That's why for generators the execution context
+ * is allocated using emalloc, thus allowing to save and restore it simply
+ * by replacing a pointer.
+ */
+ if (op_array->fn_flags & ZEND_ACC_GENERATOR) {
+ execute_data = emalloc(total_size);
+ } else {
+ execute_data = zend_vm_stack_alloc(total_size TSRMLS_CC);
}
- EG(in_execution) = 1;
+ EX(CVs) = (zval ***) ((char *) execute_data + execute_data_size);
+ memset(EX(CVs), 0, sizeof(zval **) * op_array->last_var);
-zend_vm_enter:
- /* Initialize execute_data */
- execute_data = (zend_execute_data *)zend_vm_stack_alloc(
- ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data)) +
- ZEND_MM_ALIGNED_SIZE(sizeof(zval**) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2)) +
- ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T TSRMLS_CC);
+ EX(Ts) = (temp_variable *) ((char *) EX(CVs) + CVs_size);
- EX(CVs) = (zval***)((char*)execute_data + ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data)));
- memset(EX(CVs), 0, sizeof(zval**) * op_array->last_var);
- EX(Ts) = (temp_variable *)(((char*)EX(CVs)) + ZEND_MM_ALIGNED_SIZE(sizeof(zval**) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2)));
EX(fbc) = NULL;
EX(called_scope) = NULL;
EX(object) = NULL;
@@ -35,9 +46,7 @@ zend_vm_enter:
EX(prev_execute_data) = EG(current_execute_data);
EG(current_execute_data) = execute_data;
EX(nested) = nested;
- nested = 1;
-
- LOAD_REGS();
+ 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*));
@@ -46,10 +55,10 @@ zend_vm_enter:
if (op_array->this_var != -1 && EG(This)) {
Z_ADDREF_P(EG(This)); /* For $this pointer */
if (!EG(active_symbol_table)) {
- EX_CV(op_array->this_var) = (zval**)EX_CVs() + (op_array->last_var + op_array->this_var);
- *EX_CV(op_array->this_var) = EG(This);
+ EX(CVs)[op_array->this_var] = (zval **) EX(CVs) + op_array->last_var + op_array->this_var;
+ *EX(CVs)[op_array->this_var] = EG(This);
} else {
- if (zend_hash_add(EG(active_symbol_table), "this", sizeof("this"), &EG(This), sizeof(zval *), (void**)&EX_CV(op_array->this_var))==FAILURE) {
+ if (zend_hash_add(EG(active_symbol_table), "this", sizeof("this"), &EG(This), sizeof(zval *), (void **) &EX(CVs)[op_array->this_var])==FAILURE) {
Z_DELREF_P(EG(This));
}
}
@@ -57,11 +66,32 @@ zend_vm_enter:
EX(opline) = UNEXPECTED((op_array->fn_flags & ZEND_ACC_INTERACTIVE) != 0) && EG(start_op) ? EG(start_op) : op_array->opcodes;
EG(opline_ptr) = &EX(opline);
- LOAD_OPLINE();
EX(function_state).function = (zend_function *) op_array;
EX(function_state).arguments = NULL;
+ return execute_data;
+}
+
+ZEND_API void {%EXECUTOR_NAME%}_ex(zend_execute_data *execute_data TSRMLS_DC)
+{
+ DCL_OPLINE
+ zend_bool original_in_execution;
+
+ {%HELPER_VARS%}
+
+ {%INTERNAL_LABELS%}
+
+ if (EG(exception)) {
+ return;
+ }
+
+ original_in_execution = EG(in_execution);
+ EG(in_execution) = 1;
+
+ LOAD_REGS();
+ LOAD_OPLINE();
+
while (1) {
{%ZEND_VM_CONTINUE_LABEL%}
#ifdef ZEND_WIN32
@@ -78,6 +108,13 @@ zend_vm_enter:
zend_error_noreturn(E_ERROR, "Arrived at end of main loop which shouldn't happen");
}
+ZEND_API void {%EXECUTOR_NAME%}(zend_op_array *op_array TSRMLS_DC)
+{
+ zend_execute_data *execute_data = zend_create_execute_data_from_op_array(op_array, 0 TSRMLS_CC);
+
+ {%EXECUTOR_NAME%}_ex(execute_data TSRMLS_CC);
+}
+
{%EXTERNAL_EXECUTOR%}
void {%INITIALIZER_NAME%}(void)
diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php
index 3163000e47..ee2b0b2f2d 100644
--- a/Zend/zend_vm_gen.php
+++ b/Zend/zend_vm_gen.php
@@ -856,7 +856,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name,
out($f,"#define LOAD_REGS() do {Ts = EX(Ts); CVs = EX(CVs);} while (0)\n");
out($f,"#define ZEND_VM_CONTINUE() goto zend_vm_continue\n");
out($f,"#define ZEND_VM_RETURN() EG(in_execution) = original_in_execution; return\n");
- out($f,"#define ZEND_VM_ENTER() op_array = EG(active_op_array); goto zend_vm_enter\n");
+ out($f,"#define ZEND_VM_ENTER() execute_data = zend_create_execute_data_from_op_array(EG(active_op_array), 1 TSRMLS_CC); LOAD_REGS(); LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
out($f,"#define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n");
out($f,"#define ZEND_VM_DISPATCH(opcode, opline) dispatch_handler = zend_vm_get_opcode_handler(opcode, opline); goto zend_vm_dispatch;\n\n");
out($f,"#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC\n");
@@ -892,7 +892,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name,
out($f,"#define LOAD_REGS() do {Ts = EX(Ts); CVs = EX(CVs);} while (0)\n");
out($f,"#define ZEND_VM_CONTINUE() goto *(void**)(OPLINE->handler)\n");
out($f,"#define ZEND_VM_RETURN() EG(in_execution) = original_in_execution; return\n");
- out($f,"#define ZEND_VM_ENTER() op_array = EG(active_op_array); goto zend_vm_enter\n");
+ out($f,"#define ZEND_VM_ENTER() execute_data = zend_create_execute_data_from_op_array(EG(active_op_array), 1 TSRMLS_CC); LOAD_REGS(); LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
out($f,"#define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n");
out($f,"#define ZEND_VM_DISPATCH(opcode, opline) goto *(void**)(zend_vm_get_opcode_handler(opcode, opline));\n\n");
out($f,"#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC\n");
@@ -932,7 +932,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name,
// Emit array of labels of opcode handlers and code for
// zend_opcode_handlers initialization
$prolog = $m[1];
- out($f,$prolog."if (op_array == NULL) {\n");
+ out($f,$prolog."if (execute_data == NULL) {\n");
out($f,$prolog."\tstatic const opcode_handler_t labels[] = {\n");
gen_labels($f, $spec, $kind, $prolog."\t\t");
out($f,$prolog."\t};\n");
@@ -976,10 +976,11 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name,
$m[1]."\t\tEG(in_execution) = original_in_execution;\n".
$m[1]."\t\treturn;\n".
$m[1]."\tcase 2:\n" .
- $m[1]."\t\top_array = EG(active_op_array);\n".
- $m[1]."\t\tgoto zend_vm_enter;\n".
+ $m[1]."\t\texecute_data = zend_create_execute_data_from_op_array(EG(active_op_array), 1 TSRMLS_CC);\n".
+ $m[1]."\t\tbreak;\n" .
$m[1]."\tcase 3:\n" .
$m[1]."\t\texecute_data = EG(current_execute_data);\n".
+ $m[1]."\t\tbreak;\n" .
$m[1]."\tdefault:\n".
$m[1]."\t\tbreak;\n".
$m[1]."}".$m[3]."\n");
@@ -1006,9 +1007,9 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name,
$prolog = $m[1];
if ($kind == ZEND_VM_KIND_GOTO) {
// Labels are defined in the executor itself, so we call it
- // with op_array NULL and it sets zend_opcode_handlers array
+ // with execute_data NULL and it sets zend_opcode_handlers array
out($f,$prolog."TSRMLS_FETCH();\n");
- out($f,$prolog."zend_execute(NULL TSRMLS_CC);\n");
+ out($f,$prolog.$executor_name."_ex(NULL TSRMLS_CC);\n");
} else {
if ($old) {
// Reserving space for user-defined opcodes
@@ -1182,7 +1183,7 @@ function gen_vm($def, $skel) {
// Generate opcode #defines (zend_vm_opcodes.h)
$code_len = strlen((string)$max_opcode);
- $f = fopen("zend_vm_opcodes.h", "w+") or die("ERROR: Cannot create zend_vm_opcodes.h\n");
+ $f = fopen(__DIR__ . "/zend_vm_opcodes.h", "w+") or die("ERROR: Cannot create zend_vm_opcodes.h\n");
// Insert header
out($f, $GLOBALS['header_text']);
@@ -1196,8 +1197,8 @@ function gen_vm($def, $skel) {
echo "zend_vm_opcodes.h generated successfully.\n";
// Generate zend_vm_execute.h
- $f = fopen("zend_vm_execute.h", "w+") or die("ERROR: Cannot create zend_vm_execute.h\n");
- $executor_file = realpath("zend_vm_execute.h");
+ $f = fopen(__DIR__ . "/zend_vm_execute.h", "w+") or die("ERROR: Cannot create zend_vm_execute.h\n");
+ $executor_file = realpath(__DIR__ . "/zend_vm_execute.h");
// Insert header
out($f, $GLOBALS['header_text']);
@@ -1440,6 +1441,6 @@ if (!defined("ZEND_VM_LINES")) {
define("ZEND_VM_LINES", 0);
}
-gen_vm("zend_vm_def.h", "zend_vm_execute.skl");
+gen_vm(__DIR__ . "/zend_vm_def.h", __DIR__ . "/zend_vm_execute.skl");
?>
diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h
index 680778c2a2..7f94349954 100644
--- a/Zend/zend_vm_opcodes.h
+++ b/Zend/zend_vm_opcodes.h
@@ -159,3 +159,6 @@
#define ZEND_SEPARATE 156
#define ZEND_QM_ASSIGN_VAR 157
#define ZEND_JMP_SET_VAR 158
+#define ZEND_LEAVE 159
+#define ZEND_YIELD 160
+#define ZEND_GENERATOR_RETURN 161
diff --git a/acinclude.m4 b/acinclude.m4
index adb9599ce4..ad4f7474b3 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -2226,7 +2226,7 @@ AC_DEFUN([PHP_SETUP_ICU],[
AC_MSG_RESULT([$icu_install_prefix])
dnl Check ICU version
- AC_MSG_CHECKING([for ICU 3.4 or greater])
+ AC_MSG_CHECKING([for ICU 4.0 or greater])
icu_version_full=`$ICU_CONFIG --version`
ac_IFS=$IFS
IFS="."
@@ -2235,8 +2235,8 @@ AC_DEFUN([PHP_SETUP_ICU],[
icu_version=`expr [$]1 \* 1000 + [$]2`
AC_MSG_RESULT([found $icu_version_full])
- if test "$icu_version" -lt "3004"; then
- AC_MSG_ERROR([ICU version 3.4 or later is required])
+ if test "$icu_version" -lt "4000"; then
+ AC_MSG_ERROR([ICU version 4.0 or later is required])
fi
ICU_VERSION=$icu_version
diff --git a/configure.in b/configure.in
index 96febdd900..704801ec32 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 \
@@ -1472,7 +1472,7 @@ PHP_ADD_SOURCES(Zend, \
zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \
zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c zend_stream.c \
zend_iterators.c zend_interfaces.c zend_exceptions.c zend_strtod.c zend_gc.c \
- zend_closures.c zend_float.c zend_string.c zend_signal.c)
+ zend_closures.c zend_float.c zend_string.c zend_signal.c zend_generators.c)
if test -r "$abs_srcdir/Zend/zend_objects.c"; then
PHP_ADD_SOURCES(Zend, zend_objects.c zend_object_handlers.c zend_objects_API.c zend_default_classes.c)
diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c
index 7926fad671..5947aabc98 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 f4dc7c35ae..9e5b0beced 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 81328d1369..c0463c80d4 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 0000000000..df9362320c
--- /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--
+<?php include 'skipif.inc'; ?>
+--FILE--
+<?php
+var_dump(cal_days_in_month(CAL_JEWISH, 1, 5771));
+var_dump(cal_days_in_month(CAL_JEWISH, 2, 5771));
+var_dump(cal_days_in_month(CAL_JEWISH, 3, 5771));
+var_dump(cal_days_in_month(CAL_JEWISH, 4, 5771));
+var_dump(cal_days_in_month(CAL_JEWISH, 5, 5771));
+var_dump(cal_days_in_month(CAL_JEWISH, 6, 5771));
+var_dump(cal_days_in_month(CAL_JEWISH, 7, 5771));
+var_dump(cal_days_in_month(CAL_JEWISH, 8, 5771));
+var_dump(cal_days_in_month(CAL_JEWISH, 9, 5771));
+var_dump(cal_days_in_month(CAL_JEWISH, 10, 5771));
+var_dump(cal_days_in_month(CAL_JEWISH, 11, 5771));
+var_dump(cal_days_in_month(CAL_JEWISH, 12, 5771));
+var_dump(cal_days_in_month(CAL_JEWISH, 13, 5771));
+var_dump(cal_days_in_month(CAL_JEWISH, 1, 5772));
+var_dump(cal_days_in_month(CAL_JEWISH, 2, 5772));
+var_dump(cal_days_in_month(CAL_JEWISH, 3, 5772));
+var_dump(cal_days_in_month(CAL_JEWISH, 4, 5772));
+var_dump(cal_days_in_month(CAL_JEWISH, 5, 5772));
+var_dump(cal_days_in_month(CAL_JEWISH, 6, 5772));
+var_dump(cal_days_in_month(CAL_JEWISH, 7, 5772));
+var_dump(cal_days_in_month(CAL_JEWISH, 8, 5772));
+var_dump(cal_days_in_month(CAL_JEWISH, 9, 5772));
+var_dump(cal_days_in_month(CAL_JEWISH, 10, 5772));
+var_dump(cal_days_in_month(CAL_JEWISH, 11, 5772));
+var_dump(cal_days_in_month(CAL_JEWISH, 12, 5772));
+var_dump(cal_days_in_month(CAL_JEWISH, 13, 5772));
+--EXPECT--
+int(30)
+int(30)
+int(30)
+int(29)
+int(30)
+int(30)
+int(29)
+int(30)
+int(29)
+int(30)
+int(29)
+int(30)
+int(29)
+int(30)
+int(29)
+int(30)
+int(29)
+int(30)
+int(0)
+int(29)
+int(30)
+int(29)
+int(30)
+int(29)
+int(30)
+int(29)
diff --git a/ext/calendar/tests/cal_info.phpt b/ext/calendar/tests/cal_info.phpt
index 2e3e612925..7edb4ce67c 100644
--- a/ext/calendar/tests/cal_info.phpt
+++ b/ext/calendar/tests/cal_info.phpt
@@ -100,8 +100,8 @@ Array
[3] => 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 d05d3c595e..07ed1161b1 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 484b95749c..bc0ecbdd88 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/curl/interface.c b/ext/curl/interface.c
index 0deae0f227..523bc1c6a0 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -638,7 +638,6 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLOPT_QUOTE);
REGISTER_CURL_CONSTANT(CURLOPT_RANDOM_FILE);
REGISTER_CURL_CONSTANT(CURLOPT_RANGE);
- REGISTER_CURL_CONSTANT(CURLOPT_READDATA);
REGISTER_CURL_CONSTANT(CURLOPT_READFUNCTION);
REGISTER_CURL_CONSTANT(CURLOPT_REFERER);
REGISTER_CURL_CONSTANT(CURLOPT_RESUME_FROM);
@@ -681,6 +680,7 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLE_ABORTED_BY_CALLBACK);
REGISTER_CURL_CONSTANT(CURLE_BAD_CALLING_ORDER);
REGISTER_CURL_CONSTANT(CURLE_BAD_CONTENT_ENCODING);
+ REGISTER_CURL_CONSTANT(CURLE_BAD_DOWNLOAD_RESUME);
REGISTER_CURL_CONSTANT(CURLE_BAD_FUNCTION_ARGUMENT);
REGISTER_CURL_CONSTANT(CURLE_BAD_PASSWORD_ENTERED);
REGISTER_CURL_CONSTANT(CURLE_COULDNT_CONNECT);
@@ -713,12 +713,14 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLE_HTTP_PORT_FAILED);
REGISTER_CURL_CONSTANT(CURLE_HTTP_POST_ERROR);
REGISTER_CURL_CONSTANT(CURLE_HTTP_RANGE_ERROR);
+ REGISTER_CURL_CONSTANT(CURLE_HTTP_RETURNED_ERROR);
REGISTER_CURL_CONSTANT(CURLE_LDAP_CANNOT_BIND);
REGISTER_CURL_CONSTANT(CURLE_LDAP_SEARCH_FAILED);
REGISTER_CURL_CONSTANT(CURLE_LIBRARY_NOT_FOUND);
REGISTER_CURL_CONSTANT(CURLE_MALFORMAT_USER);
REGISTER_CURL_CONSTANT(CURLE_OBSOLETE);
REGISTER_CURL_CONSTANT(CURLE_OK);
+ REGISTER_CURL_CONSTANT(CURLE_OPERATION_TIMEDOUT);
REGISTER_CURL_CONSTANT(CURLE_OPERATION_TIMEOUTED);
REGISTER_CURL_CONSTANT(CURLE_OUT_OF_MEMORY);
REGISTER_CURL_CONSTANT(CURLE_PARTIAL_FILE);
@@ -751,6 +753,7 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLINFO_HEADER_OUT);
REGISTER_CURL_CONSTANT(CURLINFO_HEADER_SIZE);
REGISTER_CURL_CONSTANT(CURLINFO_HTTP_CODE);
+ REGISTER_CURL_CONSTANT(CURLINFO_LASTONE);
REGISTER_CURL_CONSTANT(CURLINFO_NAMELOOKUP_TIME);
REGISTER_CURL_CONSTANT(CURLINFO_PRETRANSFER_TIME);
REGISTER_CURL_CONSTANT(CURLINFO_PRIVATE);
@@ -783,6 +786,7 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLPROXY_SOCKS5);
/* Curl Share constants */
+ REGISTER_CURL_CONSTANT(CURLSHOPT_NONE);
REGISTER_CURL_CONSTANT(CURLSHOPT_SHARE);
REGISTER_CURL_CONSTANT(CURLSHOPT_UNSHARE);
@@ -811,6 +815,7 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURL_TIMECOND_IFMODSINCE);
REGISTER_CURL_CONSTANT(CURL_TIMECOND_IFUNMODSINCE);
REGISTER_CURL_CONSTANT(CURL_TIMECOND_LASTMOD);
+ REGISTER_CURL_CONSTANT(CURL_TIMECOND_NONE);
/* Curl version constants */
REGISTER_CURL_CONSTANT(CURL_VERSION_IPV6);
@@ -925,7 +930,11 @@ PHP_MINIT_FUNCTION(curl)
#endif
#if LIBCURL_VERSION_NUM >= 0x071001 /* Available since 7.16.1 */
+ REGISTER_CURL_CONSTANT(CURLE_SSH);
REGISTER_CURL_CONSTANT(CURLOPT_FTP_SSL_CCC);
+ REGISTER_CURL_CONSTANT(CURLOPT_SSH_AUTH_TYPES);
+ REGISTER_CURL_CONSTANT(CURLOPT_SSH_PRIVATE_KEYFILE);
+ REGISTER_CURL_CONSTANT(CURLOPT_SSH_PUBLIC_KEYFILE);
REGISTER_CURL_CONSTANT(CURLFTPSSL_CCC_ACTIVE);
REGISTER_CURL_CONSTANT(CURLFTPSSL_CCC_NONE);
REGISTER_CURL_CONSTANT(CURLFTPSSL_CCC_PASSIVE);
@@ -940,13 +949,13 @@ PHP_MINIT_FUNCTION(curl)
#if LIBCURL_VERSION_NUM >= 0x071004 /* Available since 7.16.4 */
REGISTER_CURL_CONSTANT(CURLOPT_KRBLEVEL);
+ REGISTER_CURL_CONSTANT(CURLOPT_NEW_DIRECTORY_PERMS);
+ REGISTER_CURL_CONSTANT(CURLOPT_NEW_FILE_PERMS);
#endif
#if LIBCURL_VERSION_NUM >= 0x071100 /* Available since 7.17.0 */
REGISTER_CURL_CONSTANT(CURLOPT_APPEND);
REGISTER_CURL_CONSTANT(CURLOPT_DIRLISTONLY);
- REGISTER_CURL_CONSTANT(CURLOPT_NEW_DIRECTORY_PERMS);
- REGISTER_CURL_CONSTANT(CURLOPT_NEW_FILE_PERMS);
REGISTER_CURL_CONSTANT(CURLOPT_USE_SSL);
/* Curl SSL Constants */
REGISTER_CURL_CONSTANT(CURLUSESSL_ALL);
@@ -955,6 +964,10 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLUSESSL_TRY);
#endif
+#if LIBCURL_VERSION_NUM >= 0x071101 /* Available since 7.17.1 */
+ REGISTER_CURL_CONSTANT(CURLOPT_SSH_HOST_PUBLIC_KEY_MD5);
+#endif
+
#if LIBCURL_VERSION_NUM >= 0x071200 /* Available since 7.18.0 */
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_TRANSFER_MODE);
#endif
@@ -964,7 +977,6 @@ PHP_MINIT_FUNCTION(curl)
#endif
#if LIBCURL_VERSION_NUM >= 0x071300 /* Available since 7.19.0 */
- REGISTER_CURL_CONSTANT(CURLE_SSH);
REGISTER_CURL_CONSTANT(CURLINFO_APPCONNECT_TIME);
REGISTER_CURL_CONSTANT(CURLINFO_PRIMARY_IP);
@@ -972,10 +984,6 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLOPT_CRLFILE);
REGISTER_CURL_CONSTANT(CURLOPT_ISSUERCERT);
REGISTER_CURL_CONSTANT(CURLOPT_KEYPASSWD);
- REGISTER_CURL_CONSTANT(CURLOPT_SSH_AUTH_TYPES);
- REGISTER_CURL_CONSTANT(CURLOPT_SSH_HOST_PUBLIC_KEY_MD5);
- REGISTER_CURL_CONSTANT(CURLOPT_SSH_PRIVATE_KEYFILE);
- REGISTER_CURL_CONSTANT(CURLOPT_SSH_PUBLIC_KEYFILE);
REGISTER_CURL_CONSTANT(CURLSSH_AUTH_ANY);
REGISTER_CURL_CONSTANT(CURLSSH_AUTH_DEFAULT);
@@ -1737,7 +1745,7 @@ static void alloc_curl_handle(php_curl **ch)
}
/* }}} */
-#if LIBCURL_VERSION_NUM > 0x071301
+#if LIBCURL_VERSION_NUM >= 0x071301 /* Available since 7.19.1 */
/* {{{ split_certinfo
*/
static void split_certinfo(char *string, zval *hash)
@@ -1920,9 +1928,9 @@ PHP_FUNCTION(curl_copy_handle)
dupch->uses = 0;
ch->uses++;
if (ch->handlers->write->stream) {
- Z_ADDREF_P(dupch->handlers->write->stream);
- dupch->handlers->write->stream = ch->handlers->write->stream;
+ Z_ADDREF_P(ch->handlers->write->stream);
}
+ dupch->handlers->write->stream = ch->handlers->write->stream;
dupch->handlers->write->method = ch->handlers->write->method;
if (ch->handlers->read->stream) {
Z_ADDREF_P(ch->handlers->read->stream);
@@ -2085,6 +2093,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
#endif
#if LIBCURL_VERSION_NUM >= 0x071001 /* Available since 7.16.1 */
case CURLOPT_FTP_SSL_CCC:
+ case CURLOPT_SSH_AUTH_TYPES:
#endif
#if LIBCURL_VERSION_NUM >= 0x071002 /* Available since 7.16.2 */
case CURLOPT_CONNECTTIMEOUT_MS:
@@ -2092,6 +2101,10 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
case CURLOPT_HTTP_TRANSFER_DECODING:
case CURLOPT_TIMEOUT_MS:
#endif
+#if LIBCURL_VERSION_NUM >= 0x071004 /* Available since 7.16.4 */
+ case CURLOPT_NEW_DIRECTORY_PERMS:
+ case CURLOPT_NEW_FILE_PERMS:
+#endif
#if LIBCURL_VERSION_NUM >= 0x071100 /* Available since 7.17.0 */
case CURLOPT_USE_SSL:
#elif LIBCURL_VERSION_NUM >= 0x070b00 /* Available since 7.11.0 */
@@ -2100,8 +2113,6 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
#if LIBCURL_VERSION_NUM >= 0x071100 /* Available since 7.17.0 */
case CURLOPT_APPEND:
case CURLOPT_DIRLISTONLY:
- case CURLOPT_NEW_DIRECTORY_PERMS:
- case CURLOPT_NEW_FILE_PERMS:
#else
case CURLOPT_FTPAPPEND:
case CURLOPT_FTPLISTONLY:
@@ -2111,7 +2122,6 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
#endif
#if LIBCURL_VERSION_NUM >= 0x071300 /* Available since 7.19.0 */
case CURLOPT_ADDRESS_SCOPE:
- case CURLOPT_SSH_AUTH_TYPES:
#endif
#if LIBCURL_VERSION_NUM > 0x071301 /* Available since 7.19.1 */
case CURLOPT_CERTINFO:
@@ -2187,7 +2197,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
#else
case CURLOPT_KRB4LEVEL:
#endif
-#if LIBCURL_VERSION_NUM >= 0x071300 /* Available since 7.19.0 */
+#if LIBCURL_VERSION_NUM >= 0x071101 /* Available since 7.17.1 */
case CURLOPT_SSH_HOST_PUBLIC_KEY_MD5:
#endif
#if LIBCURL_VERSION_NUM >= 0x071301 /* Available since 7.19.1 */
@@ -2631,11 +2641,13 @@ string_copy:
#if LIBCURL_VERSION_NUM >= 0x070b00 /* Available since 7.11.0 */
case CURLOPT_NETRC_FILE:
#endif
+#if LIBCURL_VERSION_NUM >= 0x071001 /* Available since 7.16.1 */
+ case CURLOPT_SSH_PRIVATE_KEYFILE:
+ case CURLOPT_SSH_PUBLIC_KEYFILE:
+#endif
#if LIBCURL_VERSION_NUM >= 0x071300 /* Available since 7.19.0 */
case CURLOPT_CRLFILE:
case CURLOPT_ISSUERCERT:
- case CURLOPT_SSH_PRIVATE_KEYFILE:
- case CURLOPT_SSH_PUBLIC_KEYFILE:
#endif
#if LIBCURL_VERSION_NUM >= 0x071306 /* Available since 7.19.6 */
case CURLOPT_SSH_KNOWNHOSTS:
@@ -2679,7 +2691,7 @@ string_copy:
case CURLOPT_SHARE:
{
php_curlsh *sh = NULL;
- ZEND_FETCH_RESOURCE(sh, php_curlsh *, zvalue, -1, le_curl_share_handle_name, le_curl_share_handle);
+ ZEND_FETCH_RESOURCE_NO_RETURN(sh, php_curlsh *, zvalue, -1, le_curl_share_handle_name, le_curl_share_handle);
if (sh) {
curl_easy_setopt(ch->cp, CURLOPT_SHARE, sh->share);
}
@@ -3203,7 +3215,7 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
#if LIBCURL_VERSION_NUM >= 0x070c01 /* 7.12.1 */
/* {{{ _php_curl_reset_handlers()
Reset all handlers of a given php_curl */
-static _php_curl_reset_handlers(php_curl *ch)
+static void _php_curl_reset_handlers(php_curl *ch)
{
if (ch->handlers->write->stream) {
Z_DELREF_P(ch->handlers->write->stream);
@@ -3294,7 +3306,7 @@ PHP_FUNCTION(curl_escape)
ZEND_FETCH_RESOURCE(ch, php_curl *, &zid, -1, le_curl_name, le_curl);
- if (res = curl_easy_escape(ch->cp, str, str_len)) {
+ if ((res = curl_easy_escape(ch->cp, str, str_len))) {
RETVAL_STRING(res, 1);
free(res);
} else {
@@ -3318,7 +3330,7 @@ PHP_FUNCTION(curl_unescape)
ZEND_FETCH_RESOURCE(ch, php_curl *, &zid, -1, le_curl_name, le_curl);
- if (out = curl_easy_unescape(ch->cp, str, str_len, &out_len)) {
+ if ((out = curl_easy_unescape(ch->cp, str, str_len, &out_len))) {
RETVAL_STRINGL(out, out_len, 1);
free(out);
} else {
diff --git a/ext/curl/tests/bug62839.phpt b/ext/curl/tests/bug62839.phpt
new file mode 100644
index 0000000000..39e6fc9cbe
--- /dev/null
+++ b/ext/curl/tests/bug62839.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #62839 (curl_copy_handle segfault with CURLOPT_FILE)
+--SKIPIF--
+<?php if (!extension_loaded("curl")) print "skip";
+?>
+--FILE--
+<?php
+$curl = curl_init();
+
+$fd = fopen('/tmp/test', 'wb');
+curl_setopt($curl, CURLOPT_FILE, $fd);
+
+curl_copy_handle($curl);
+
+echo 'DONE!';
+?>
+--EXPECTF--
+DONE!
diff --git a/ext/curl/tests/curl_basic_022.phpt b/ext/curl/tests/curl_basic_022.phpt
index 6a611af590..d4277a3f89 100644
--- a/ext/curl/tests/curl_basic_022.phpt
+++ b/ext/curl/tests/curl_basic_022.phpt
@@ -11,15 +11,15 @@ if ($curl_version['version_number'] < 0x070e01) {
<?php
$ch = curl_init();
-curl_setopt($ch, CURLOPT_COOKIELIST, 'Set-Cookie: C1=v1; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.php.net');
-curl_setopt($ch, CURLOPT_COOKIELIST, 'Set-Cookie: C2=v2; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.php.net');
+curl_setopt($ch, CURLOPT_COOKIELIST, 'Set-Cookie: C1=v1; expires=Thu, 31-Dec-2037 23:59:59 GMT; path=/; domain=.php.net');
+curl_setopt($ch, CURLOPT_COOKIELIST, 'Set-Cookie: C2=v2; expires=Thu, 31-Dec-2037 23:59:59 GMT; path=/; domain=.php.net');
var_dump(curl_getinfo($ch, CURLINFO_COOKIELIST));
?>
--EXPECT--
array(2) {
[0]=>
- string(38) ".php.net TRUE / FALSE 2147368447 C1 v1"
+ string(38) ".php.net TRUE / FALSE 2145916799 C1 v1"
[1]=>
- string(38) ".php.net TRUE / FALSE 2147368447 C2 v2"
+ string(38) ".php.net TRUE / FALSE 2145916799 C2 v2"
}
diff --git a/ext/curl/tests/curl_escape.phpt b/ext/curl/tests/curl_escape.phpt
index 7c90fb9888..e759144c8a 100644
--- a/ext/curl/tests/curl_escape.phpt
+++ b/ext/curl/tests/curl_escape.phpt
Binary files differ
diff --git a/ext/date/lib/tm2unixtime.c b/ext/date/lib/tm2unixtime.c
index c4830bbef0..9055fee203 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 13e7b753d3..7c4e7820bb 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -2467,6 +2467,9 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat
if (zend_hash_find(myht, "timezone_type", 14, (void**) &z_timezone_type) == SUCCESS) {
convert_to_long(*z_timezone_type);
if (zend_hash_find(myht, "timezone", 9, (void**) &z_timezone) == SUCCESS) {
+ zend_error_handling error_handling;
+
+ zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
convert_to_string(*z_timezone);
switch (Z_LVAL_PP(z_timezone_type)) {
@@ -2474,9 +2477,9 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat
case TIMELIB_ZONETYPE_ABBR: {
char *tmp = emalloc(Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2);
snprintf(tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2, "%s %s", Z_STRVAL_PP(z_date), Z_STRVAL_PP(z_timezone));
- php_date_initialize(*dateobj, tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC);
+ php_date_initialize(*dateobj, tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 1 TSRMLS_CC);
efree(tmp);
- return 1;
+ break;
}
case TIMELIB_ZONETYPE_ID:
@@ -2490,10 +2493,15 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat
tzobj->tzi.tz = tzi;
tzobj->initialized = 1;
- php_date_initialize(*dateobj, Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 0 TSRMLS_CC);
+ php_date_initialize(*dateobj, Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 1 TSRMLS_CC);
zval_ptr_dtor(&tmp_obj);
- return 1;
+ break;
+ default:
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
+ return 0;
}
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
+ return 1;
}
}
}
diff --git a/ext/date/tests/bug61642.phpt b/ext/date/tests/bug61642.phpt
new file mode 100644
index 0000000000..d03a814d88
--- /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--
+<?php
+// ±5 and ±10 (and any non-zero multiple of 5) is broken, but everything else
+// should already work correctly.
+$weekdays = range(-11, 11);
+$dates = array('2012-03-29', '2012-03-30', '2012-03-31', '2012-04-01', '2012-04-02', '2012-04-03', '2012-04-04', '2012-04-05');
+
+$header = array();
+
+foreach ($dates as $startdate) {
+ $date = new DateTime($startdate);
+
+ $header[] = $date->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/bug62852.phpt b/ext/date/tests/bug62852.phpt
new file mode 100644
index 0000000000..6426a80fb8
--- /dev/null
+++ b/ext/date/tests/bug62852.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #62852 (Unserialize invalid DateTime causes crash)
+--INI--
+date.timezone=GMT
+--FILE--
+<?php
+try {
+ $datetime = unserialize('O:8:"DateTime":3:{s:4:"date";s:20:"10007-06-07 03:51:49";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}');
+ var_dump($datetime);
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+?>
+--EXPECTF--
+string(%d) "DateTime::__wakeup(): Failed to parse time string (%s) at position 12 (0): Double time specification"
diff --git a/ext/dom/documenttype.c b/ext/dom/documenttype.c
index d61ba796ab..eee3b5f887 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/element.c b/ext/dom/element.c
index c6a1902129..02fded9f1a 100644
--- a/ext/dom/element.c
+++ b/ext/dom/element.c
@@ -832,7 +832,7 @@ PHP_FUNCTION(dom_element_set_attribute_ns)
}
if (errorcode == 0 && is_xmlns == 0) {
- attr = xmlSetNsProp(elemp, nsptr, (xmlChar *)localname, (xmlChar *)value);
+ xmlSetNsProp(elemp, nsptr, (xmlChar *)localname, (xmlChar *)value);
}
} else {
name_valid = xmlValidateName((xmlChar *) localname, 0);
@@ -844,7 +844,7 @@ PHP_FUNCTION(dom_element_set_attribute_ns)
if (attr != NULL && attr->type != XML_ATTRIBUTE_DECL) {
node_list_unlink(attr->children TSRMLS_CC);
}
- attr = xmlSetProp(elemp, (xmlChar *)localname, (xmlChar *)value);
+ xmlSetProp(elemp, (xmlChar *)localname, (xmlChar *)value);
}
}
}
diff --git a/ext/dom/node.c b/ext/dom/node.c
index 4e58421e4a..4dbce4d790 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/xpath.c b/ext/dom/xpath.c
index 70e7aff690..342854654e 100644
--- a/ext/dom/xpath.c
+++ b/ext/dom/xpath.c
@@ -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/enchant/enchant.c b/ext/enchant/enchant.c
index 2d784ebbef..357f3cb034 100755
--- a/ext/enchant/enchant.c
+++ b/ext/enchant/enchant.c
@@ -730,6 +730,7 @@ PHP_FUNCTION(enchant_dict_quick_check)
if (sugg) {
zval_dtor(sugg);
+ array_init(sugg);
}
PHP_ENCHANT_GET_DICT;
@@ -743,8 +744,6 @@ PHP_FUNCTION(enchant_dict_quick_check)
RETURN_FALSE;
}
- array_init(sugg);
-
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg_st);
memcpy(&n_sugg, &n_sugg_st, sizeof(n_sugg));
if (suggs && n_sugg) {
diff --git a/ext/exif/tests/bug60150.phpt b/ext/exif/tests/bug60150.phpt
index 63cf0a9daf..be01998fd8 100755
--- a/ext/exif/tests/bug60150.phpt
+++ b/ext/exif/tests/bug60150.phpt
@@ -12,7 +12,7 @@ var_dump(exif_read_data($infile));
?>
===DONE===
--EXPECTF--
-Warning: exif_read_data(bug60150.jpg): Process tag(x9003=DateTimeOri): Illegal pointer offset(x%x + x%x = x%x > x%x) in %s on line %d
+Warning: exif_read_data(bug60150.jpg): Process tag(x9003=DateTimeOri): Illegal pointer offset(%s) in %s on line %d
Warning: exif_read_data(bug60150.jpg): Error reading from file: got=x%x(=%d) != itemlen-%d=x%x(=%d) in %s on line %d
diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c
index 757ba04ac1..e5e52f0995 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 48a02360b0..30364fb978 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-05-29 14:40:41.710960045 +0200
-+++ libmagic/apprentice.c 2012-04-22 18:57:16.215980866 +0200
+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-05-29 14:40:41.710960045 +0200
-+++ libmagic/ascmagic.c 2012-04-22 18:57:16.215980866 +0200
+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-05-29 14:40:41.710960045 +0200
-+++ libmagic/cdf.c 2012-04-22 18:57:16.219978162 +0200
+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 <err.h>
#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-05-29 14:40:41.710960045 +0200
-+++ libmagic/cdf.h 2012-04-22 18:57:16.219978162 +0200
+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-05-29 14:40:41.710960045 +0200
-+++ libmagic/cdf_time.c 2012-04-22 18:57:16.219978162 +0200
+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-05-29 14:40:41.710960045 +0200
-+++ libmagic/compress.c 2012-04-22 18:57:16.219978162 +0200
+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-05-29 14:40:41.710960045 +0200
-+++ libmagic/file.h 2012-04-22 18:57:16.219978162 +0200
+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-05-29 14:40:41.710960045 +0200
-+++ libmagic/fsmagic.c 2012-04-22 18:57:16.219978162 +0200
+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-05-29 14:40:41.710960045 +0200
-+++ libmagic/funcs.c 2012-04-22 18:57:16.219978162 +0200
+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 <wctype.h>
@@ -1872,9 +1916,10 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
+ return rep_cnt;
}
+
-diff -u libmagic.orig/magic.c libmagic/magic.c
---- libmagic.orig/magic.c 2012-05-29 14:40:41.710960045 +0200
-+++ libmagic/magic.c 2012-04-22 18:57:16.219978162 +0200
+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.
*/
@@ -2250,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-05-29 14:40:41.710960045 +0200
-+++ libmagic/magic.h 2012-04-22 18:57:16.219978162 +0200
+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);
@@ -2269,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-05-29 14:40:41.710960045 +0200
-+++ libmagic/print.c 2012-05-29 14:34:03.770376387 +0200
+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]))
@@ -2464,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-05-29 14:40:41.710960045 +0200
-+++ libmagic/readcdf.c 2012-04-22 18:57:16.219978162 +0200
+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
@@ -2512,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-05-29 14:40:41.710960045 +0200
-+++ libmagic/readelf.c 2012-04-22 18:57:16.219978162 +0200
+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,
@@ -2669,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-05-29 14:40:41.710960045 +0200
-+++ libmagic/softmagic.c 2012-05-29 14:34:31.900417647 +0200
+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 <stdlib.h>
#include <time.h>
diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c
index 4a54849e07..98bde27a2d 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/tests/bug61964.phpt b/ext/fileinfo/tests/bug61964.phpt
new file mode 100644
index 0000000000..99c8fd2ae3
--- /dev/null
+++ b/ext/fileinfo/tests/bug61964.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Bug #61964 (finfo_open with directory cause invalid free)
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+
+$magic_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'magic';
+
+$ret = @finfo_open(FILEINFO_NONE, $magic_file . ".non-exits");
+var_dump($ret);
+
+$dir = __DIR__ . "/test-folder";
+@mkdir($dir);
+
+$magic_file_copy = $dir . "/magic.copy";
+$magic_file_copy2 = $magic_file_copy . "2";
+copy($magic_file, $magic_file_copy);
+copy($magic_file, $magic_file_copy2);
+
+$ret = finfo_open(FILEINFO_NONE, $dir);
+var_dump($ret);
+
+$ret = @finfo_open(FILEINFO_NONE, $dir);
+var_dump($ret);
+
+$ret = @finfo_open(FILEINFO_NONE, $dir. "/non-exits-dir");
+var_dump($ret);
+
+// write some test files to test folder
+file_put_contents($dir . "/test1.txt", "string\n> 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_open_error-win32.phpt b/ext/fileinfo/tests/finfo_open_error-win32.phpt
index e168b7f7d4..0260ca5708 100644
--- a/ext/fileinfo/tests/finfo_open_error-win32.phpt
+++ b/ext/fileinfo/tests/finfo_open_error-win32.phpt
@@ -43,13 +43,7 @@ bool(false)
Warning: finfo_open() expects at most 2 parameters, 3 given in %sfinfo_open_error-win32.php on line %d
bool(false)
-
-Warning: finfo_open(%smagic): failed to open stream: No such file or directory in %sfinfo_open_error-win32.php on line %d
-
-Warning: finfo_open(%smagic): 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 '%smagic'. 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)
diff --git a/ext/filter/filter_private.h b/ext/filter/filter_private.h
index daa688b4ac..2ec2f62fae 100644
--- a/ext/filter/filter_private.h
+++ b/ext/filter/filter_private.h
@@ -99,12 +99,14 @@
} \
return; \
-#define PHP_FILTER_TRIM_DEFAULT(p, len) { \
+#define PHP_FILTER_TRIM_DEFAULT(p, len) PHP_FILTER_TRIM_DEFAULT_EX(p, len, 1);
+
+#define PHP_FILTER_TRIM_DEFAULT_EX(p, len, return_if_empty) { \
while ((len > 0) && (*p == ' ' || *p == '\t' || *p == '\r' || *p == '\v' || *p == '\n')) { \
p++; \
len--; \
} \
- if (len < 1) { \
+ if (len < 1 && return_if_empty) { \
RETURN_VALIDATION_FAILED \
} \
while (p[len-1] == ' ' || p[len-1] == '\t' || p[len-1] == '\r' || p[len-1] == '\v' || p[len-1] == '\n') { \
diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c
index 5c3811ab25..4de6b83e00 100644
--- a/ext/filter/logical_filters.c
+++ b/ext/filter/logical_filters.c
@@ -235,12 +235,15 @@ void php_filter_boolean(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
int len = Z_STRLEN_P(value);
int ret;
- PHP_FILTER_TRIM_DEFAULT(str, len);
+ PHP_FILTER_TRIM_DEFAULT_EX(str, len, 0);
/* returns true for "1", "true", "on" and "yes"
* returns false for "0", "false", "off", "no", and ""
* null otherwise. */
switch (len) {
+ case 0:
+ ret = 0;
+ break;
case 1:
if (*str == '1') {
ret = 1;
@@ -286,7 +289,7 @@ void php_filter_boolean(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
ret = -1;
}
- if (ret == -1) {
+ if (ret == -1) {
RETURN_VALIDATION_FAILED
} else {
zval_dtor(value);
diff --git a/ext/filter/tests/bug49510.phpt b/ext/filter/tests/bug49510.phpt
new file mode 100644
index 0000000000..3f365cc431
--- /dev/null
+++ b/ext/filter/tests/bug49510.phpt
@@ -0,0 +1,36 @@
+--TEST--
+#49510 boolean validation fails with FILTER_NULL_ON_FAILURE
+--FILE--
+<?php
+var_dump(filter_var(false, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+var_dump(filter_var(0, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+var_dump(filter_var("0", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+var_dump(filter_var("off", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+var_dump(filter_var("", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+var_dump(filter_var("false", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+var_dump(filter_var("no", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+
+var_dump(filter_var(true, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+var_dump(filter_var(1, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+var_dump(filter_var("1", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+var_dump(filter_var("on", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+var_dump(filter_var("yes", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+
+var_dump(filter_var("invalid", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+?>
+==DONE==
+--EXPECT--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+NULL
+==DONE==
diff --git a/ext/gmp/tests/022-win32.phpt b/ext/gmp/tests/022-win32.phpt
deleted file mode 100644
index 7abb0e82bd..0000000000
--- a/ext/gmp/tests/022-win32.phpt
+++ /dev/null
@@ -1,90 +0,0 @@
---TEST--
-gmp_gcdext() basic tests
---SKIPIF--
-<?php if (!extension_loaded("gmp")) print "skip";
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {
- die('skip windows only test');
-}
-?>
---FILE--
-<?php
-
-$n = gmp_init("34293864345");
-$n1 = gmp_init("23434293864345");
-
-$a = array(
- array(123,45),
- array(4341,9734),
- array(23487,333),
- array(-234234,-123123),
- array(-100,-2234),
- array(345,"34587345"),
- array(345,"0"),
- array("345556456",345873),
- array("34545345556456","323432445873"),
- array($n, $n1),
- );
-
-foreach ($a as $val) {
- $r = gmp_gcdext($val[0],$val[1]);
- var_dump(gmp_strval($r['g']));
- var_dump(gmp_strval($r['s']));
- var_dump(gmp_strval($r['t']));
-}
-
-var_dump(gmp_gcdext($val[0],array()));
-var_dump(gmp_gcdext(array(),array()));
-var_dump(gmp_gcdext(array(),array(),1));
-var_dump(gmp_gcdext(array()));
-var_dump(gmp_gcdext());
-
-echo "Done\n";
-?>
---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 f699e8283d..469aa3013d 100644
--- a/ext/gmp/tests/022.phpt
+++ b/ext/gmp/tests/022.phpt
@@ -2,9 +2,6 @@
gmp_gcdext() basic tests
--SKIPIF--
<?php if (!extension_loaded("gmp")) print "skip";
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. only for Non Windows Systems');
-}
?>
--FILE--
<?php
diff --git a/ext/gmp/tests/gmp_nextprime-win32.phpt b/ext/gmp/tests/gmp_nextprime-win32.phpt
deleted file mode 100644
index e725315a13..0000000000
--- a/ext/gmp/tests/gmp_nextprime-win32.phpt
+++ /dev/null
@@ -1,45 +0,0 @@
---TEST--
-gmp_nextprime()
---SKIPIF--
-<?php if (!extension_loaded("gmp")) print "skip";
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {
- die('skip windows only test');
-}
-?>
---FILE--
-<?php
-
-$n = gmp_nextprime(-1);
-var_dump(gmp_strval($n));
-$n = gmp_nextprime(0);
-var_dump(gmp_strval($n));
-$n = gmp_nextprime(-1000);
-var_dump(gmp_strval($n));
-$n = gmp_nextprime(1000);
-var_dump(gmp_strval($n));
-$n = gmp_nextprime(100000);
-var_dump(gmp_strval($n));
-$n = gmp_nextprime(array());
-var_dump(gmp_strval($n));
-$n = gmp_nextprime("");
-var_dump(gmp_strval($n));
-$n = gmp_nextprime(new stdclass());
-var_dump(gmp_strval($n));
-
-echo "Done\n";
-?>
---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 623ccbed07..5683c8c31f 100644
--- a/ext/gmp/tests/gmp_nextprime.phpt
+++ b/ext/gmp/tests/gmp_nextprime.phpt
@@ -2,9 +2,6 @@
gmp_nextprime()
--SKIPIF--
<?php if (!extension_loaded("gmp")) print "skip";
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. only for Non Windows Systems');
-}
?>
--FILE--
<?php
diff --git a/ext/hash/hash.c b/ext/hash/hash.c
index 895d64da33..957575d472 100644
--- a/ext/hash/hash.c
+++ b/ext/hash/hash.c
@@ -23,6 +23,7 @@
#include "config.h"
#endif
+#include <math.h>
#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 87050cb8e5..7bc72a2bcb 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 0000000000..fdccc4b6ea
--- /dev/null
+++ b/ext/hash/tests/hash_pbkdf2_basic.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test hash_pbkdf2() function : basic functionality
+--SKIPIF--
+<?php extension_loaded('hash') or die('skip: hash extension not loaded.'); ?>
+--FILE--
+<?php
+
+/* Prototype : string hash_hmac ( string $algo , string $data , string $key [, bool $raw_output ] )
+ * Description: Generate a keyed hash value using the HMAC method
+ * Source code: ext/hash/hash.c
+ * Alias to functions:
+*/
+
+echo "*** Testing hash_pbkdf2() : basic functionality ***\n";
+
+echo "sha1: " . hash_pbkdf2('sha1', 'password', 'salt', 1, 20)."\n";
+echo "sha1(raw): " . bin2hex(hash_pbkdf2('sha1', 'password', 'salt', 1, 20, TRUE))."\n";
+echo "sha1(rounds): " . hash_pbkdf2('sha1', 'passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 4096, 25)."\n";
+echo "sha1(rounds)(raw): " . bin2hex(hash_pbkdf2('sha1', 'passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 4096, 25, TRUE))."\n";
+echo "sha256: " . hash_pbkdf2('sha256', 'password', 'salt', 1, 20)."\n";
+echo "sha256(raw): " . bin2hex(hash_pbkdf2('sha256', 'password', 'salt', 1, 20, TRUE))."\n";
+echo "sha256(rounds): " . hash_pbkdf2('sha256', 'passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 4096, 40)."\n";
+echo "sha256(rounds)(raw): " . bin2hex(hash_pbkdf2('sha256', 'passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 4096, 40, TRUE))."\n";
+
+?>
+===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 0000000000..fd70cca581
--- /dev/null
+++ b/ext/hash/tests/hash_pbkdf2_error.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test hash_pbkdf2() function : error functionality
+--SKIPIF--
+<?php extension_loaded('hash') or die('skip: hash extension not loaded.'); ?>
+--FILE--
+<?php
+
+/* {{{ 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 hexbits by default */
+
+echo "*** Testing hash_pbkdf2() : error conditions ***\n";
+
+$password = 'password';
+$salt = 'salt';
+
+echo "\n-- Testing hash_pbkdf2() function with less than expected no. of arguments --\n";
+var_dump(@hash_pbkdf2());
+echo $php_errormsg . "\n";
+var_dump(@hash_pbkdf2('crc32'));
+echo $php_errormsg . "\n";
+var_dump(@hash_pbkdf2('crc32', $password));
+echo $php_errormsg . "\n";
+var_dump(@hash_pbkdf2('crc32', $password, $salt));
+echo $php_errormsg . "\n";
+
+echo "\n-- Testing hash_pbkdf2() function with more than expected no. of arguments --\n";
+var_dump(@hash_pbkdf2('crc32', $password, $salt, 10, 10, true, 'extra arg'));
+echo $php_errormsg . "\n";
+
+echo "\n-- Testing hash_pbkdf2() function with invalid hash algorithm --\n";
+var_dump(@hash_pbkdf2('foo', $password, $salt, 1));
+echo $php_errormsg . "\n";
+
+echo "\n-- Testing hash_pbkdf2() function with invalid iterations --\n";
+var_dump(@hash_pbkdf2('md5', $password, $salt, 0));
+echo $php_errormsg . "\n";
+var_dump(@hash_pbkdf2('md5', $password, $salt, -1));
+echo $php_errormsg . "\n";
+
+echo "\n-- Testing hash_pbkdf2() function with invalid length --\n";
+var_dump(@hash_pbkdf2('md5', $password, $salt, 1, -1));
+echo $php_errormsg . "\n\n";
+
+?>
+===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/intl/CREDITS b/ext/intl/CREDITS
index 0e7fd55dc1..0e7fd55dc1 100755..100644
--- a/ext/intl/CREDITS
+++ b/ext/intl/CREDITS
diff --git a/ext/intl/TODO b/ext/intl/TODO
index 6fd1b27814..6fd1b27814 100755..100644
--- a/ext/intl/TODO
+++ b/ext/intl/TODO
diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
index f2a39ba022..454e5249fd 100644
--- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
+++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
@@ -29,7 +29,7 @@ static inline RuleBasedBreakIterator *fetch_rbbi(BreakIterator_object *bio) {
return (RuleBasedBreakIterator*)bio->biter;
}
-static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
+static void _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
{
zval *object = getThis();
char *rules;
@@ -70,6 +70,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
smart_str_free(&parse_error_str);
intl_error_set_custom_msg(NULL, msg, 1 TSRMLS_CC);
efree(msg);
+ delete rbbi;
RETURN_NULL();
}
} else { // compiled
@@ -78,6 +79,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
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
@@ -96,7 +98,7 @@ U_CFUNC PHP_METHOD(IntlRuleBasedBreakIterator, __construct)
return_value = getThis();
//changes this to IS_NULL (without first destroying) if there's an error
- _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+ _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);
diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp
index 539b11a1f7..f2758fdcc8 100644
--- a/ext/intl/calendar/calendar_methods.cpp
+++ b/ext/intl/calendar/calendar_methods.cpp
@@ -23,7 +23,10 @@
#include <unicode/locid.h>
#include <unicode/calendar.h>
#include <unicode/ustring.h>
+
#include "../intl_convertcpp.h"
+#include "../common/common_date.h"
+
extern "C" {
#include "../php_intl.h"
#define USE_TIMEZONE_POINTER 1
diff --git a/ext/intl/collator/collator.c b/ext/intl/collator/collator.c
index 047a738028..047a738028 100755..100644
--- a/ext/intl/collator/collator.c
+++ b/ext/intl/collator/collator.c
diff --git a/ext/intl/collator/collator.h b/ext/intl/collator/collator.h
index 96e7aa097b..96e7aa097b 100755..100644
--- a/ext/intl/collator/collator.h
+++ b/ext/intl/collator/collator.h
diff --git a/ext/intl/collator/collator_attr.c b/ext/intl/collator/collator_attr.c
index 684e72cc58..684e72cc58 100755..100644
--- a/ext/intl/collator/collator_attr.c
+++ b/ext/intl/collator/collator_attr.c
diff --git a/ext/intl/collator/collator_attr.h b/ext/intl/collator/collator_attr.h
index 85636cc486..85636cc486 100755..100644
--- a/ext/intl/collator/collator_attr.h
+++ b/ext/intl/collator/collator_attr.h
diff --git a/ext/intl/collator/collator_class.c b/ext/intl/collator/collator_class.c
index de744dcefe..d1fa10ef2c 100755..100644
--- 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
index 835abd66c8..7a56dfce50 100755..100644
--- a/ext/intl/collator/collator_class.h
+++ b/ext/intl/collator/collator_class.h
@@ -20,8 +20,9 @@
#include <php.h>
-#include "intl_common.h"
-#include "intl_error.h"
+#include "../intl_common.h"
+#include "../intl_error.h"
+#include "../intl_data.h"
#include <unicode/ucol.h>
@@ -54,9 +55,7 @@ extern zend_class_entry *Collator_ce_ptr;
Collator_object* co = NULL; \
intl_error_reset( NULL TSRMLS_CC ); \
-#define COLLATOR_METHOD_FETCH_OBJECT \
- co = (Collator_object *) zend_object_store_get_object( object TSRMLS_CC ); \
- intl_error_reset( COLLATOR_ERROR_P( co ) TSRMLS_CC ); \
+#define COLLATOR_METHOD_FETCH_OBJECT INTL_METHOD_FETCH_OBJECT(Collator, co)
// Macro to check return value of a ucol_* function call.
#define COLLATOR_CHECK_STATUS( co, msg ) \
diff --git a/ext/intl/collator/collator_compare.c b/ext/intl/collator/collator_compare.c
index 4384558ac6..4384558ac6 100755..100644
--- a/ext/intl/collator/collator_compare.c
+++ b/ext/intl/collator/collator_compare.c
diff --git a/ext/intl/collator/collator_compare.h b/ext/intl/collator/collator_compare.h
index 4e38b79309..4e38b79309 100755..100644
--- a/ext/intl/collator/collator_compare.h
+++ b/ext/intl/collator/collator_compare.h
diff --git a/ext/intl/collator/collator_convert.c b/ext/intl/collator/collator_convert.c
index e989d4c65a..e989d4c65a 100755..100644
--- a/ext/intl/collator/collator_convert.c
+++ b/ext/intl/collator/collator_convert.c
diff --git a/ext/intl/collator/collator_convert.h b/ext/intl/collator/collator_convert.h
index 8322ea998b..8322ea998b 100755..100644
--- a/ext/intl/collator/collator_convert.h
+++ b/ext/intl/collator/collator_convert.h
diff --git a/ext/intl/collator/collator_create.c b/ext/intl/collator/collator_create.c
index 0f0cc193e4..b2a8c7f6ba 100755..100644
--- a/ext/intl/collator/collator_create.c
+++ b/ext/intl/collator/collator_create.c
@@ -45,10 +45,10 @@ static void collator_ctor(INTERNAL_FUNCTION_PARAMETERS)
}
INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value);
- co = (Collator_object *) zend_object_store_get_object( object TSRMLS_CC );
+ COLLATOR_METHOD_FETCH_OBJECT;
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
index b740e82d68..b740e82d68 100755..100644
--- a/ext/intl/collator/collator_create.h
+++ b/ext/intl/collator/collator_create.h
diff --git a/ext/intl/collator/collator_error.c b/ext/intl/collator/collator_error.c
index c4e41250a2..c4e41250a2 100755..100644
--- a/ext/intl/collator/collator_error.c
+++ b/ext/intl/collator/collator_error.c
diff --git a/ext/intl/collator/collator_error.h b/ext/intl/collator/collator_error.h
index b2f44ea2a3..b2f44ea2a3 100755..100644
--- a/ext/intl/collator/collator_error.h
+++ b/ext/intl/collator/collator_error.h
diff --git a/ext/intl/collator/collator_is_numeric.c b/ext/intl/collator/collator_is_numeric.c
index a8abfac12b..a8abfac12b 100755..100644
--- a/ext/intl/collator/collator_is_numeric.c
+++ b/ext/intl/collator/collator_is_numeric.c
diff --git a/ext/intl/collator/collator_is_numeric.h b/ext/intl/collator/collator_is_numeric.h
index 585d58917a..585d58917a 100755..100644
--- a/ext/intl/collator/collator_is_numeric.h
+++ b/ext/intl/collator/collator_is_numeric.h
diff --git a/ext/intl/collator/collator_locale.c b/ext/intl/collator/collator_locale.c
index b30b021ee8..b30b021ee8 100755..100644
--- a/ext/intl/collator/collator_locale.c
+++ b/ext/intl/collator/collator_locale.c
diff --git a/ext/intl/collator/collator_locale.h b/ext/intl/collator/collator_locale.h
index bda90cd3b9..bda90cd3b9 100755..100644
--- a/ext/intl/collator/collator_locale.h
+++ b/ext/intl/collator/collator_locale.h
diff --git a/ext/intl/collator/collator_sort.c b/ext/intl/collator/collator_sort.c
index 04a24f013e..04a24f013e 100755..100644
--- a/ext/intl/collator/collator_sort.c
+++ b/ext/intl/collator/collator_sort.c
diff --git a/ext/intl/collator/collator_sort.h b/ext/intl/collator/collator_sort.h
index a990cdf089..a990cdf089 100755..100644
--- a/ext/intl/collator/collator_sort.h
+++ b/ext/intl/collator/collator_sort.h
diff --git a/ext/intl/common/common_date.cpp b/ext/intl/common/common_date.cpp
new file mode 100644
index 0000000000..ee998818d9
--- /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 <cataphract@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#include "../intl_cppshims.h"
+
+#include <unicode/calendar.h>
+
+extern "C" {
+#include "../php_intl.h"
+#define USE_CALENDAR_POINTER 1
+#include "../calendar/calendar_class.h"
+#include <ext/date/php_date.h>
+}
+
+#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 0000000000..d2396cbf5a
--- /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 <cataphract@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#ifndef COMMON_DATE_H
+#define COMMON_DATE_H
+
+#include <unicode/umachine.h>
+
+U_CDECL_BEGIN
+#include <php.h>
+#include "../intl_error.h"
+U_CDECL_END
+
+#ifdef __cplusplus
+
+#include <unicode/timezone.h>
+
+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_error.c b/ext/intl/common/common_error.c
index a0ee7c145f..a0ee7c145f 100755..100644
--- a/ext/intl/common/common_error.c
+++ b/ext/intl/common/common_error.c
diff --git a/ext/intl/common/common_error.h b/ext/intl/common/common_error.h
index 8716222124..8716222124 100755..100644
--- a/ext/intl/common/common_error.h
+++ b/ext/intl/common/common_error.h
diff --git a/ext/intl/config.m4 b/ext/intl/config.m4
index d7eacbc0b4..7c95c130f2 100755..100644
--- 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,6 +52,7 @@ 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 \
diff --git a/ext/intl/config.w32 b/ext/intl/config.w32
index a223505f8c..a49918794c 100755..100644
--- 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,6 +62,7 @@ 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 \
diff --git a/ext/intl/dateformat/dateformat.c b/ext/intl/dateformat/dateformat.c
index fb83eeef05..fb83eeef05 100755..100644
--- a/ext/intl/dateformat/dateformat.c
+++ b/ext/intl/dateformat/dateformat.c
diff --git a/ext/intl/dateformat/dateformat.h b/ext/intl/dateformat/dateformat.h
index f11918b79f..f11918b79f 100755..100644
--- a/ext/intl/dateformat/dateformat.h
+++ b/ext/intl/dateformat/dateformat.h
diff --git a/ext/intl/dateformat/dateformat_attr.c b/ext/intl/dateformat/dateformat_attr.c
index a32a4860c9..bf6b544667 100755..100644
--- a/ext/intl/dateformat/dateformat_attr.c
+++ b/ext/intl/dateformat/dateformat_attr.c
@@ -17,8 +17,9 @@
#include "config.h"
#endif
-#include "php_intl.h"
-#include "intl_convert.h"
+#include "../php_intl.h"
+#include "dateformat_class.h"
+#include "../intl_convert.h"
#include "dateformat_class.h"
#include "dateformat_attr.h"
diff --git a/ext/intl/dateformat/dateformat_attr.h b/ext/intl/dateformat/dateformat_attr.h
index 6fe82a6e00..6fe82a6e00 100755..100644
--- a/ext/intl/dateformat/dateformat_attr.h
+++ b/ext/intl/dateformat/dateformat_attr.h
diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c
index fda67f1b70..211c87f59f 100755..100644
--- a/ext/intl/dateformat/dateformat_class.c
+++ b/ext/intl/dateformat/dateformat_class.c
@@ -19,11 +19,14 @@
#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"
+#include <zend_exceptions.h>
+
zend_class_entry *IntlDateFormatter_ce_ptr = NULL;
static zend_object_handlers IntlDateFormatter_handlers;
@@ -64,6 +67,7 @@ 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 );
+ object_properties_init(&intern->zo, ce);
intern->date_type = 0;
intern->time_type = 0;
intern->calendar = -1;
@@ -88,18 +92,23 @@ zend_object_value IntlDateFormatter_object_clone(zval *object TSRMLS_DC)
zend_object_handle handle = Z_OBJ_HANDLE_P(object);
IntlDateFormatter_object *dfo, *new_dfo;
- DATE_FORMAT_METHOD_FETCH_OBJECT;
- new_obj_val = IntlDateFormatter_ce_ptr->create_object(IntlDateFormatter_ce_ptr TSRMLS_CC);
+ DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK;
+
+ new_obj_val = IntlDateFormatter_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC);
new_dfo = (IntlDateFormatter_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC);
/* clone standard parts */
zend_objects_clone_members(&new_dfo->zo, new_obj_val, &dfo->zo, handle TSRMLS_CC);
/* clone formatter object */
- DATE_FORMAT_OBJECT(new_dfo) = udat_clone(DATE_FORMAT_OBJECT(dfo), &INTL_DATA_ERROR_CODE(new_dfo));
- if(U_FAILURE(INTL_DATA_ERROR_CODE(new_dfo))) {
- /* set up error in case error handler is interested */
- intl_error_set( NULL, INTL_DATA_ERROR_CODE(new_dfo), "Failed to clone IntlDateFormatter object", 0 TSRMLS_CC );
- IntlDateFormatter_object_dtor(new_dfo, new_obj_val.handle TSRMLS_CC); /* free new object */
- zend_error(E_ERROR, "Failed to clone IntlDateFormatter object");
+ if (dfo->datef_data.udatf != NULL) {
+ DATE_FORMAT_OBJECT(new_dfo) = udat_clone(DATE_FORMAT_OBJECT(dfo), &INTL_DATA_ERROR_CODE(dfo));
+ if (U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) {
+ /* set up error in case error handler is interested */
+ intl_errors_set(INTL_DATA_ERROR_P(dfo), INTL_DATA_ERROR_CODE(dfo),
+ "Failed to clone IntlDateFormatter object", 0 TSRMLS_CC );
+ zend_throw_exception(NULL, "Failed to clone IntlDateFormatter object", 0 TSRMLS_CC);
+ }
+ } else {
+ zend_throw_exception(NULL, "Cannot clone unconstructed IntlDateFormatter", 0 TSRMLS_CC);
}
return new_obj_val;
}
@@ -120,6 +129,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()
@@ -170,6 +185,7 @@ static zend_function_entry IntlDateFormatter_class_functions[] = {
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
index de5cf4a181..b4304660e2 100755..100644
--- a/ext/intl/dateformat/dateformat_class.h
+++ b/ext/intl/dateformat/dateformat_class.h
@@ -38,7 +38,15 @@ extern zend_class_entry *IntlDateFormatter_ce_ptr;
/* Auxiliary macros */
#define DATE_FORMAT_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(IntlDateFormatter, dfo)
-#define DATE_FORMAT_METHOD_FETCH_OBJECT INTL_METHOD_FETCH_OBJECT(IntlDateFormatter, dfo)
+#define DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(IntlDateFormatter, dfo)
+#define DATE_FORMAT_METHOD_FETCH_OBJECT \
+ DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; \
+ if (dfo->datef_data.udatf == NULL) \
+ { \
+ intl_errors_set(&dfo->datef_data.error, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed IntlDateFormatter", 0 TSRMLS_CC); \
+ RETURN_FALSE; \
+ }
+
#define DATE_FORMAT_OBJECT(dfo) (dfo)->datef_data.udatf
#endif // #ifndef DATE_FORMAT_CLASS_H
diff --git a/ext/intl/dateformat/dateformat_create.cpp b/ext/intl/dateformat/dateformat_create.cpp
index fef93e93d9..a2899f7974 100644
--- a/ext/intl/dateformat/dateformat_create.cpp
+++ b/ext/intl/dateformat/dateformat_create.cpp
@@ -40,7 +40,7 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
{
zval *object;
- char *locale_str;
+ const char *locale_str;
int locale_len = 0;
Locale locale;
long date_type = 0;
@@ -72,11 +72,11 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value);
if (locale_len == 0) {
- locale_str = INTL_G(default_locale);
+ locale_str = intl_locale_get_default(TSRMLS_C);
}
locale = Locale::createFromName(locale_str);
- DATE_FORMAT_METHOD_FETCH_OBJECT;
+ DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK;
if (DATE_FORMAT_OBJECT(dfo) != NULL) {
intl_errors_set(INTL_DATA_ERROR_P(dfo), U_ILLEGAL_ARGUMENT_ERROR,
diff --git a/ext/intl/dateformat/dateformat_data.c b/ext/intl/dateformat/dateformat_data.c
index 33451e1c51..33451e1c51 100755..100644
--- a/ext/intl/dateformat/dateformat_data.c
+++ b/ext/intl/dateformat/dateformat_data.c
diff --git a/ext/intl/dateformat/dateformat_data.h b/ext/intl/dateformat/dateformat_data.h
index cde9e363c9..cde9e363c9 100755..100644
--- a/ext/intl/dateformat/dateformat_data.h
+++ b/ext/intl/dateformat/dateformat_data.h
diff --git a/ext/intl/dateformat/dateformat_format.c b/ext/intl/dateformat/dateformat_format.c
index 82f825f140..ffae15518b 100755..100644
--- a/ext/intl/dateformat/dateformat_format.c
+++ b/ext/intl/dateformat/dateformat_format.c
@@ -21,15 +21,13 @@
#include <unicode/ustring.h>
#include <unicode/ucal.h>
-#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"
-/* avoid redefinition of int8_t, already defined in unicode/pwin32.h */
-#define _MSC_STDINT_H_ 1
-#include "ext/date/php_date.h"
/* {{{
* Internal function which calls the udat_format
@@ -61,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;
}
/* }}} */
@@ -82,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;
- const 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;
}
@@ -126,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
index 49f34c6892..49f34c6892 100755..100644
--- a/ext/intl/dateformat/dateformat_format.h
+++ b/ext/intl/dateformat/dateformat_format.h
diff --git a/ext/intl/dateformat/dateformat_format_object.cpp b/ext/intl/dateformat/dateformat_format_object.cpp
new file mode 100644
index 0000000000..e8981faa26
--- /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 <cataphract@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#include "../intl_cppshims.h"
+
+#include <unicode/calendar.h>
+#include <unicode/gregocal.h>
+#include <unicode/datefmt.h>
+#include <unicode/smpdtfmt.h>
+#include <unicode/locid.h>
+
+#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 <ext/date/php_date.h>
+#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 0000000000..d80ea87e0f
--- /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 <cataphract@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+#include <php.h>
+
+PHP_FUNCTION(datefmt_format_object);
diff --git a/ext/intl/dateformat/dateformat_parse.c b/ext/intl/dateformat/dateformat_parse.c
index 4193e89017..4193e89017 100755..100644
--- a/ext/intl/dateformat/dateformat_parse.c
+++ b/ext/intl/dateformat/dateformat_parse.c
diff --git a/ext/intl/dateformat/dateformat_parse.h b/ext/intl/dateformat/dateformat_parse.h
index c74a3d5f15..c74a3d5f15 100755..100644
--- a/ext/intl/dateformat/dateformat_parse.h
+++ b/ext/intl/dateformat/dateformat_parse.h
diff --git a/ext/intl/doc/Tutorial.txt b/ext/intl/doc/Tutorial.txt
index 4a66dc1844..4a66dc1844 100755..100644
--- a/ext/intl/doc/Tutorial.txt
+++ b/ext/intl/doc/Tutorial.txt
diff --git a/ext/intl/doc/collator_api.php b/ext/intl/doc/collator_api.php
index ef7250243b..ef7250243b 100755..100644
--- a/ext/intl/doc/collator_api.php
+++ b/ext/intl/doc/collator_api.php
diff --git a/ext/intl/doc/common_api.php b/ext/intl/doc/common_api.php
index 993dab180b..993dab180b 100755..100644
--- a/ext/intl/doc/common_api.php
+++ b/ext/intl/doc/common_api.php
diff --git a/ext/intl/doc/datefmt_api.php b/ext/intl/doc/datefmt_api.php
index 272abdb57c..272abdb57c 100755..100644
--- a/ext/intl/doc/datefmt_api.php
+++ b/ext/intl/doc/datefmt_api.php
diff --git a/ext/intl/doc/formatter_api.php b/ext/intl/doc/formatter_api.php
index 14d98db66a..14d98db66a 100755..100644
--- a/ext/intl/doc/formatter_api.php
+++ b/ext/intl/doc/formatter_api.php
diff --git a/ext/intl/doc/grapheme_api.php b/ext/intl/doc/grapheme_api.php
index 465453fd32..465453fd32 100755..100644
--- a/ext/intl/doc/grapheme_api.php
+++ b/ext/intl/doc/grapheme_api.php
diff --git a/ext/intl/doc/locale_api.php b/ext/intl/doc/locale_api.php
index c6c41ede0a..c6c41ede0a 100755..100644
--- a/ext/intl/doc/locale_api.php
+++ b/ext/intl/doc/locale_api.php
diff --git a/ext/intl/doc/msgfmt_api.php b/ext/intl/doc/msgfmt_api.php
index e4d047b979..e4d047b979 100755..100644
--- a/ext/intl/doc/msgfmt_api.php
+++ b/ext/intl/doc/msgfmt_api.php
diff --git a/ext/intl/doc/normalizer_api.php b/ext/intl/doc/normalizer_api.php
index a9bb566e67..a9bb566e67 100755..100644
--- a/ext/intl/doc/normalizer_api.php
+++ b/ext/intl/doc/normalizer_api.php
diff --git a/ext/intl/formatter/formatter.c b/ext/intl/formatter/formatter.c
index 1b7922ce03..1b7922ce03 100755..100644
--- a/ext/intl/formatter/formatter.c
+++ b/ext/intl/formatter/formatter.c
diff --git a/ext/intl/formatter/formatter.h b/ext/intl/formatter/formatter.h
index 1f9ebead8e..1f9ebead8e 100755..100644
--- a/ext/intl/formatter/formatter.h
+++ b/ext/intl/formatter/formatter.h
diff --git a/ext/intl/formatter/formatter_attr.c b/ext/intl/formatter/formatter_attr.c
index 448a9db721..448a9db721 100755..100644
--- a/ext/intl/formatter/formatter_attr.c
+++ b/ext/intl/formatter/formatter_attr.c
diff --git a/ext/intl/formatter/formatter_attr.h b/ext/intl/formatter/formatter_attr.h
index c4bc94ce5f..c4bc94ce5f 100755..100644
--- a/ext/intl/formatter/formatter_attr.h
+++ b/ext/intl/formatter/formatter_attr.h
diff --git a/ext/intl/formatter/formatter_class.c b/ext/intl/formatter/formatter_class.c
index 8fcda643bf..2246cd29a5 100755..100644
--- a/ext/intl/formatter/formatter_class.c
+++ b/ext/intl/formatter/formatter_class.c
@@ -24,6 +24,8 @@
#include "formatter_main.h"
#include "formatter_attr.h"
+#include <zend_exceptions.h>
+
zend_class_entry *NumberFormatter_ce_ptr = NULL;
static zend_object_handlers NumberFormatter_handlers;
@@ -62,6 +64,7 @@ zend_object_value NumberFormatter_object_create(zend_class_entry *ce TSRMLS_DC)
intern = ecalloc( 1, sizeof(NumberFormatter_object) );
formatter_data_init( &intern->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,
@@ -82,18 +85,23 @@ zend_object_value NumberFormatter_object_clone(zval *object TSRMLS_DC)
zend_object_handle handle = Z_OBJ_HANDLE_P(object);
NumberFormatter_object *nfo, *new_nfo;
- FORMATTER_METHOD_FETCH_OBJECT;
- new_obj_val = NumberFormatter_ce_ptr->create_object(NumberFormatter_ce_ptr TSRMLS_CC);
+ FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK;
+ new_obj_val = NumberFormatter_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC);
new_nfo = (NumberFormatter_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC);
/* clone standard parts */
zend_objects_clone_members(&new_nfo->zo, new_obj_val, &nfo->zo, handle TSRMLS_CC);
- /* clone formatter object */
- FORMATTER_OBJECT(new_nfo) = unum_clone(FORMATTER_OBJECT(nfo), &INTL_DATA_ERROR_CODE(new_nfo));
- if(U_FAILURE(INTL_DATA_ERROR_CODE(new_nfo))) {
- /* set up error in case error handler is interested */
- intl_error_set( NULL, INTL_DATA_ERROR_CODE(new_nfo), "Failed to clone NumberFormatter object", 0 TSRMLS_CC );
- NumberFormatter_object_dtor(new_nfo, new_obj_val.handle TSRMLS_CC); /* free new object */
- zend_error(E_ERROR, "Failed to clone NumberFormatter object");
+ /* clone formatter object. It may fail, the destruction code must handle this case */
+ if (FORMATTER_OBJECT(nfo) != NULL) {
+ FORMATTER_OBJECT(new_nfo) = unum_clone(FORMATTER_OBJECT(nfo),
+ &INTL_DATA_ERROR_CODE(nfo));
+ if (U_FAILURE(INTL_DATA_ERROR_CODE(nfo))) {
+ /* set up error in case error handler is interested */
+ intl_errors_set(INTL_DATA_ERROR_P(nfo), INTL_DATA_ERROR_CODE(nfo),
+ "Failed to clone NumberFormatter object", 0 TSRMLS_CC);
+ zend_throw_exception(NULL, "Failed to clone NumberFormatter object", 0 TSRMLS_CC);
+ }
+ } else {
+ zend_throw_exception(NULL, "Cannot clone unconstructed NumberFormatter", 0 TSRMLS_CC);
}
return new_obj_val;
}
diff --git a/ext/intl/formatter/formatter_class.h b/ext/intl/formatter/formatter_class.h
index cf1cb060c6..9582866664 100755..100644
--- a/ext/intl/formatter/formatter_class.h
+++ b/ext/intl/formatter/formatter_class.h
@@ -34,8 +34,17 @@ extern zend_class_entry *NumberFormatter_ce_ptr;
/* Auxiliary macros */
-#define FORMATTER_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(NumberFormatter, nfo)
-#define FORMATTER_METHOD_FETCH_OBJECT INTL_METHOD_FETCH_OBJECT(NumberFormatter, nfo)
-#define FORMATTER_OBJECT(nfo) (nfo)->nf_data.unum
+#define FORMATTER_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(NumberFormatter, nfo)
+#define FORMATTER_OBJECT(nfo) (nfo)->nf_data.unum
+#define FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(NumberFormatter, nfo)
+#define FORMATTER_METHOD_FETCH_OBJECT \
+ FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK; \
+ if (FORMATTER_OBJECT(nfo) == NULL) \
+ { \
+ intl_errors_set(&nfo->nf_data.error, U_ILLEGAL_ARGUMENT_ERROR, \
+ "Found unconstructed NumberFormatter", 0 TSRMLS_CC); \
+ RETURN_FALSE; \
+ }
+
#endif // #ifndef FORMATTER_CLASS_H
diff --git a/ext/intl/formatter/formatter_data.c b/ext/intl/formatter/formatter_data.c
index 88f122f7c9..88f122f7c9 100755..100644
--- a/ext/intl/formatter/formatter_data.c
+++ b/ext/intl/formatter/formatter_data.c
diff --git a/ext/intl/formatter/formatter_data.h b/ext/intl/formatter/formatter_data.h
index adc4818afc..adc4818afc 100755..100644
--- a/ext/intl/formatter/formatter_data.h
+++ b/ext/intl/formatter/formatter_data.h
diff --git a/ext/intl/formatter/formatter_format.c b/ext/intl/formatter/formatter_format.c
index ce1c941e19..ce1c941e19 100755..100644
--- a/ext/intl/formatter/formatter_format.c
+++ b/ext/intl/formatter/formatter_format.c
diff --git a/ext/intl/formatter/formatter_format.h b/ext/intl/formatter/formatter_format.h
index 35fafd1ede..35fafd1ede 100755..100644
--- a/ext/intl/formatter/formatter_format.h
+++ b/ext/intl/formatter/formatter_format.h
diff --git a/ext/intl/formatter/formatter_main.c b/ext/intl/formatter/formatter_main.c
index 8fa17560b8..d0671a88b5 100755..100644
--- a/ext/intl/formatter/formatter_main.c
+++ b/ext/intl/formatter/formatter_main.c
@@ -47,7 +47,7 @@ static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value);
object = return_value;
- FORMATTER_METHOD_FETCH_OBJECT;
+ FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK;
/* Convert pattern (if specified) to UTF-16. */
if(pattern && pattern_len) {
@@ -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
index 7669e684ae..7669e684ae 100755..100644
--- a/ext/intl/formatter/formatter_main.h
+++ b/ext/intl/formatter/formatter_main.h
diff --git a/ext/intl/formatter/formatter_parse.c b/ext/intl/formatter/formatter_parse.c
index 6f3a3a12b5..6f3a3a12b5 100755..100644
--- a/ext/intl/formatter/formatter_parse.c
+++ b/ext/intl/formatter/formatter_parse.c
diff --git a/ext/intl/formatter/formatter_parse.h b/ext/intl/formatter/formatter_parse.h
index cb96c72b5d..cb96c72b5d 100755..100644
--- a/ext/intl/formatter/formatter_parse.h
+++ b/ext/intl/formatter/formatter_parse.h
diff --git a/ext/intl/grapheme/grapheme.h b/ext/intl/grapheme/grapheme.h
index 756ce9173e..756ce9173e 100755..100644
--- a/ext/intl/grapheme/grapheme.h
+++ b/ext/intl/grapheme/grapheme.h
diff --git a/ext/intl/grapheme/grapheme_string.c b/ext/intl/grapheme/grapheme_string.c
index 475bbe4184..475bbe4184 100755..100644
--- a/ext/intl/grapheme/grapheme_string.c
+++ b/ext/intl/grapheme/grapheme_string.c
diff --git a/ext/intl/grapheme/grapheme_util.c b/ext/intl/grapheme/grapheme_util.c
index 92008554d4..92008554d4 100755..100644
--- a/ext/intl/grapheme/grapheme_util.c
+++ b/ext/intl/grapheme/grapheme_util.c
diff --git a/ext/intl/grapheme/grapheme_util.h b/ext/intl/grapheme/grapheme_util.h
index c91aeaff7d..c91aeaff7d 100755..100644
--- a/ext/intl/grapheme/grapheme_util.h
+++ b/ext/intl/grapheme/grapheme_util.h
diff --git a/ext/intl/intl_common.h b/ext/intl/intl_common.h
index 9424571d02..9424571d02 100755..100644
--- a/ext/intl/intl_common.h
+++ b/ext/intl/intl_common.h
diff --git a/ext/intl/intl_convert.c b/ext/intl/intl_convert.c
index 92cdc4cef4..92cdc4cef4 100755..100644
--- a/ext/intl/intl_convert.c
+++ b/ext/intl/intl_convert.c
diff --git a/ext/intl/intl_convert.h b/ext/intl/intl_convert.h
index 3fc03f4bb7..3fc03f4bb7 100755..100644
--- a/ext/intl/intl_convert.h
+++ b/ext/intl/intl_convert.h
diff --git a/ext/intl/intl_data.h b/ext/intl/intl_data.h
index 66ca27ae79..66ca27ae79 100755..100644
--- a/ext/intl/intl_data.h
+++ b/ext/intl/intl_data.h
diff --git a/ext/intl/intl_error.c b/ext/intl/intl_error.c
index 99b1c6001c..99b1c6001c 100755..100644
--- a/ext/intl/intl_error.c
+++ b/ext/intl/intl_error.c
diff --git a/ext/intl/intl_error.h b/ext/intl/intl_error.h
index 4d8eb79327..4d8eb79327 100755..100644
--- a/ext/intl/intl_error.h
+++ b/ext/intl/intl_error.h
diff --git a/ext/intl/locale/locale.c b/ext/intl/locale/locale.c
index ffc463f399..ffc463f399 100755..100644
--- a/ext/intl/locale/locale.c
+++ b/ext/intl/locale/locale.c
diff --git a/ext/intl/locale/locale.h b/ext/intl/locale/locale.h
index f3859c7a2a..f3859c7a2a 100755..100644
--- a/ext/intl/locale/locale.h
+++ b/ext/intl/locale/locale.h
diff --git a/ext/intl/locale/locale_class.c b/ext/intl/locale/locale_class.c
index 432cfb28fc..432cfb28fc 100755..100644
--- a/ext/intl/locale/locale_class.c
+++ b/ext/intl/locale/locale_class.c
diff --git a/ext/intl/locale/locale_class.h b/ext/intl/locale/locale_class.h
index cbddccbe17..cbddccbe17 100755..100644
--- a/ext/intl/locale/locale_class.h
+++ b/ext/intl/locale/locale_class.h
diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c
index 936e3142ad..d1a86d8ee2 100755..100644
--- a/ext/intl/locale/locale_methods.c
+++ b/ext/intl/locale/locale_methods.c
@@ -390,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 */
@@ -496,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 ){
@@ -518,7 +518,7 @@ 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;
}
@@ -690,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 */
@@ -1097,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 );
@@ -1145,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);
}
@@ -1251,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){
@@ -1537,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);
diff --git a/ext/intl/locale/locale_methods.h b/ext/intl/locale/locale_methods.h
index e88fac64b7..e88fac64b7 100755..100644
--- a/ext/intl/locale/locale_methods.h
+++ b/ext/intl/locale/locale_methods.h
diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c
index 0a01204fae..6a9f04f32b 100755..100644
--- a/ext/intl/msgformat/msgformat.c
+++ b/ext/intl/msgformat/msgformat.c
@@ -49,7 +49,7 @@ static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
}
INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value);
- MSG_FORMAT_METHOD_FETCH_OBJECT;
+ MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK;
/* Convert pattern (if specified) to UTF-16. */
if(pattern && pattern_len) {
@@ -61,7 +61,7 @@ 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
diff --git a/ext/intl/msgformat/msgformat.h b/ext/intl/msgformat/msgformat.h
index 205c7066fd..205c7066fd 100755..100644
--- a/ext/intl/msgformat/msgformat.h
+++ b/ext/intl/msgformat/msgformat.h
diff --git a/ext/intl/msgformat/msgformat_attr.c b/ext/intl/msgformat/msgformat_attr.c
index c333a24ee1..c333a24ee1 100755..100644
--- a/ext/intl/msgformat/msgformat_attr.c
+++ b/ext/intl/msgformat/msgformat_attr.c
diff --git a/ext/intl/msgformat/msgformat_attr.h b/ext/intl/msgformat/msgformat_attr.h
index 898c4451e1..898c4451e1 100755..100644
--- a/ext/intl/msgformat/msgformat_attr.h
+++ b/ext/intl/msgformat/msgformat_attr.h
diff --git a/ext/intl/msgformat/msgformat_class.c b/ext/intl/msgformat/msgformat_class.c
index d0138854eb..bb3b55f39c 100755..100644
--- a/ext/intl/msgformat/msgformat_class.c
+++ b/ext/intl/msgformat/msgformat_class.c
@@ -24,6 +24,8 @@
#include "msgformat.h"
#include "msgformat_attr.h"
+#include <zend_exceptions.h>
+
zend_class_entry *MessageFormatter_ce_ptr = NULL;
static zend_object_handlers MessageFormatter_handlers;
@@ -60,6 +62,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,
@@ -80,18 +83,24 @@ zend_object_value MessageFormatter_object_clone(zval *object TSRMLS_DC)
zend_object_handle handle = Z_OBJ_HANDLE_P(object);
MessageFormatter_object *mfo, *new_mfo;
- MSG_FORMAT_METHOD_FETCH_OBJECT;
- new_obj_val = MessageFormatter_ce_ptr->create_object(MessageFormatter_ce_ptr TSRMLS_CC);
+ MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK;
+ new_obj_val = MessageFormatter_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC);
new_mfo = (MessageFormatter_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC);
/* clone standard parts */
zend_objects_clone_members(&new_mfo->zo, new_obj_val, &mfo->zo, handle TSRMLS_CC);
+
/* clone formatter object */
- MSG_FORMAT_OBJECT(new_mfo) = umsg_clone(MSG_FORMAT_OBJECT(mfo), &INTL_DATA_ERROR_CODE(new_mfo));
- if(U_FAILURE(INTL_DATA_ERROR_CODE(new_mfo))) {
- /* set up error in case error handler is interested */
- intl_error_set( NULL, INTL_DATA_ERROR_CODE(new_mfo), "Failed to clone MessageFormatter object", 0 TSRMLS_CC );
- MessageFormatter_object_dtor(new_mfo, new_obj_val.handle TSRMLS_CC); /* free new object */
- zend_error(E_ERROR, "Failed to clone MessageFormatter object");
+ if (MSG_FORMAT_OBJECT(mfo) != NULL) {
+ MSG_FORMAT_OBJECT(new_mfo) = umsg_clone(MSG_FORMAT_OBJECT(mfo),
+ &INTL_DATA_ERROR_CODE(mfo));
+
+ if (U_FAILURE(INTL_DATA_ERROR_CODE(mfo))) {
+ intl_errors_set(INTL_DATA_ERROR_P(mfo), INTL_DATA_ERROR_CODE(mfo),
+ "Failed to clone MessageFormatter object", 0 TSRMLS_CC);
+ zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Failed to clone MessageFormatter object");
+ }
+ } else {
+ zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Cannot clone unconstructed MessageFormatter");
}
return new_obj_val;
}
diff --git a/ext/intl/msgformat/msgformat_class.h b/ext/intl/msgformat/msgformat_class.h
index b6b8e33226..337e04e647 100755..100644
--- a/ext/intl/msgformat/msgformat_class.h
+++ b/ext/intl/msgformat/msgformat_class.h
@@ -37,7 +37,15 @@ extern zend_class_entry *MessageFormatter_ce_ptr;
/* Auxiliary macros */
#define MSG_FORMAT_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(MessageFormatter, mfo)
-#define MSG_FORMAT_METHOD_FETCH_OBJECT INTL_METHOD_FETCH_OBJECT(MessageFormatter, mfo)
+#define MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(MessageFormatter, mfo)
+#define MSG_FORMAT_METHOD_FETCH_OBJECT \
+ MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; \
+ if (MSG_FORMAT_OBJECT(mfo) == NULL) { \
+ intl_errors_set(&mfo->mf_data.error, U_ILLEGAL_ARGUMENT_ERROR, \
+ "Found unconstructed MessageFormatter", 0 TSRMLS_CC); \
+ RETURN_FALSE; \
+ }
+
#define MSG_FORMAT_OBJECT(mfo) (mfo)->mf_data.umsgf
#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM < 48
diff --git a/ext/intl/msgformat/msgformat_data.c b/ext/intl/msgformat/msgformat_data.c
index 5d49054473..5d49054473 100755..100644
--- a/ext/intl/msgformat/msgformat_data.c
+++ b/ext/intl/msgformat/msgformat_data.c
diff --git a/ext/intl/msgformat/msgformat_data.h b/ext/intl/msgformat/msgformat_data.h
index 51d7687a3a..51d7687a3a 100755..100644
--- a/ext/intl/msgformat/msgformat_data.h
+++ b/ext/intl/msgformat/msgformat_data.h
diff --git a/ext/intl/msgformat/msgformat_format.c b/ext/intl/msgformat/msgformat_format.c
index 39652327b9..4b81cfe2b4 100755..100644
--- a/ext/intl/msgformat/msgformat_format.c
+++ b/ext/intl/msgformat/msgformat_format.c
@@ -134,7 +134,7 @@ PHP_FUNCTION( msgfmt_format_message )
}
if(slocale_len == 0) {
- slocale = INTL_G(default_locale);
+ slocale = intl_locale_get_default(TSRMLS_C);
}
#ifdef MSG_FORMAT_QUOTE_APOS
diff --git a/ext/intl/msgformat/msgformat_format.h b/ext/intl/msgformat/msgformat_format.h
index b74deab8ff..b74deab8ff 100755..100644
--- a/ext/intl/msgformat/msgformat_format.h
+++ b/ext/intl/msgformat/msgformat_format.h
diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp
index fd8df1a39c..9ee1cdcfb0 100755..100644
--- a/ext/intl/msgformat/msgformat_helpers.cpp
+++ b/ext/intl/msgformat/msgformat_helpers.cpp
@@ -31,6 +31,7 @@
#include <vector>
#include "../intl_convertcpp.h"
+#include "../common/common_date.h"
extern "C" {
#include "php_intl.h"
@@ -38,23 +39,10 @@ extern "C" {
#include "msgformat_format.h"
#include "msgformat_helpers.h"
#include "intl_convert.h"
-#define USE_CALENDAR_POINTER 1
-#include "../calendar/calendar_class.h"
-/* avoid redefinition of int8_t, already defined in unicode/pwin32.h */
-#define _MSC_STDINT_H_ 1
-#include "ext/date/php_date.h"
#define USE_TIMEZONE_POINTER
#include "../timezone/timezone_class.h"
}
-#ifndef INFINITY
-#define INFINITY (DBL_MAX+DBL_MAX)
-#endif
-
-#ifndef NAN
-#define NAN (INFINITY-INFINITY)
-#endif
-
#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48
#define HAS_MESSAGE_PATTERN 1
#endif
@@ -95,66 +83,6 @@ U_CFUNC int32_t umsg_format_arg_count(UMessageFormat *fmt)
return fmt_count;
}
-static double umsg_helper_zval_to_millis(zval *z, UErrorCode *status TSRMLS_DC) {
- double rv = NAN;
- long lv;
- int type;
-
- if (U_FAILURE(*status)) {
- 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 {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- }
- 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)) {
- zval retval;
- zval *zfuncname;
- 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) {
- *status = U_INTERNAL_PROGRAM_ERROR;
- } else {
- rv = U_MILLIS_PER_SECOND * (double)Z_LVAL(retval);
- }
- zval_ptr_dtor(&zfuncname);
- } 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) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- } else {
- rv = (double)co->ucal->getTime(*status);
- }
- } else {
- /* TODO: try with cast(), get() to obtain a number */
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- }
- break;
- default:
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- }
-
- return rv;
-}
-
static HashTable *umsg_get_numeric_types(MessageFormatter_object *mfo,
intl_error& err TSRMLS_DC)
{
@@ -613,7 +541,7 @@ retry_kint64:
}
case Formattable::kDate:
{
- double dd = umsg_helper_zval_to_millis(*elem, &err.code TSRMLS_CC);
+ double dd = intl_zval_to_millis(*elem, &err, "msgfmt_format" TSRMLS_CC);
if (U_FAILURE(err.code)) {
char *message, *key_char;
int key_len;
diff --git a/ext/intl/msgformat/msgformat_helpers.h b/ext/intl/msgformat/msgformat_helpers.h
index e6eda087d2..e6eda087d2 100755..100644
--- a/ext/intl/msgformat/msgformat_helpers.h
+++ b/ext/intl/msgformat/msgformat_helpers.h
diff --git a/ext/intl/msgformat/msgformat_parse.c b/ext/intl/msgformat/msgformat_parse.c
index f540b1d0c4..413d3b1f15 100755..100644
--- a/ext/intl/msgformat/msgformat_parse.c
+++ b/ext/intl/msgformat/msgformat_parse.c
@@ -126,7 +126,7 @@ 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
diff --git a/ext/intl/msgformat/msgformat_parse.h b/ext/intl/msgformat/msgformat_parse.h
index a937235839..a937235839 100755..100644
--- a/ext/intl/msgformat/msgformat_parse.h
+++ b/ext/intl/msgformat/msgformat_parse.h
diff --git a/ext/intl/normalizer/normalizer.c b/ext/intl/normalizer/normalizer.c
index 033b05cd32..033b05cd32 100755..100644
--- a/ext/intl/normalizer/normalizer.c
+++ b/ext/intl/normalizer/normalizer.c
diff --git a/ext/intl/normalizer/normalizer.h b/ext/intl/normalizer/normalizer.h
index eca9abe05a..eca9abe05a 100755..100644
--- a/ext/intl/normalizer/normalizer.h
+++ b/ext/intl/normalizer/normalizer.h
diff --git a/ext/intl/normalizer/normalizer_class.c b/ext/intl/normalizer/normalizer_class.c
index 154d877e3f..154d877e3f 100755..100644
--- a/ext/intl/normalizer/normalizer_class.c
+++ b/ext/intl/normalizer/normalizer_class.c
diff --git a/ext/intl/normalizer/normalizer_class.h b/ext/intl/normalizer/normalizer_class.h
index 4d3f7d2341..4d3f7d2341 100755..100644
--- a/ext/intl/normalizer/normalizer_class.h
+++ b/ext/intl/normalizer/normalizer_class.h
diff --git a/ext/intl/normalizer/normalizer_normalize.c b/ext/intl/normalizer/normalizer_normalize.c
index f46285e9d9..f46285e9d9 100755..100644
--- a/ext/intl/normalizer/normalizer_normalize.c
+++ b/ext/intl/normalizer/normalizer_normalize.c
diff --git a/ext/intl/normalizer/normalizer_normalize.h b/ext/intl/normalizer/normalizer_normalize.h
index 41c31f7949..41c31f7949 100755..100644
--- a/ext/intl/normalizer/normalizer_normalize.h
+++ b/ext/intl/normalizer/normalizer_normalize.h
diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c
index 19896a7108..d3d477c971 100755..100644
--- a/ext/intl/php_intl.c
+++ b/ext/intl/php_intl.c
@@ -62,6 +62,7 @@
#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"
@@ -83,7 +84,7 @@
#include "idn/idn.h"
-#if U_ICU_VERSION_MAJOR_NUM > 3 && U_ICU_VERSION_MINOR_NUM >=2
+#if U_ICU_VERSION_MAJOR_NUM * 1000 + U_ICU_VERSION_MINOR_NUM >= 4002
# include "spoofchecker/spoofchecker_class.h"
# include "spoofchecker/spoofchecker.h"
# include "spoofchecker/spoofchecker_create.h"
@@ -95,6 +96,7 @@
#include "common/common_enum.h"
#include <unicode/uloc.h>
+#include <unicode/uclean.h>
#include <ext/standard/info.h>
#include "php_ini.h"
@@ -350,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)
@@ -706,6 +715,7 @@ zend_function_entry intl_functions[] = {
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 )
@@ -843,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)
@@ -852,7 +861,6 @@ PHP_INI_BEGIN()
PHP_INI_END()
/* }}} */
-
static PHP_GINIT_FUNCTION(intl);
/* {{{ intl_module_entry */
@@ -955,7 +963,7 @@ PHP_MINIT_FUNCTION( intl )
/* Expose IDN constants to PHP scripts. */
idn_register_constants(INIT_FUNC_ARGS_PASSTHRU);
-#if U_ICU_VERSION_MAJOR_NUM > 3 && U_ICU_VERSION_MINOR_NUM >=2
+#if U_ICU_VERSION_MAJOR_NUM * 1000 + U_ICU_VERSION_MINOR_NUM >= 4002
/* Register 'Spoofchecker' PHP class */
spoofchecker_register_Spoofchecker_class( TSRMLS_C );
@@ -978,22 +986,25 @@ PHP_MINIT_FUNCTION( intl )
/* 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;
}
/* }}} */
@@ -1002,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
index 7a7112317d..7a7112317d 100755..100644
--- a/ext/intl/php_intl.h
+++ b/ext/intl/php_intl.h
diff --git a/ext/intl/resourcebundle/TODO b/ext/intl/resourcebundle/TODO
index ace4ceb253..ace4ceb253 100755..100644
--- a/ext/intl/resourcebundle/TODO
+++ b/ext/intl/resourcebundle/TODO
diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c
index 7f1529e519..db46bf5b16 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;
@@ -259,7 +260,14 @@ PHP_FUNCTION( resourcebundle_get )
/* {{{ resourcebundle_array_count */
int resourcebundle_array_count(zval *object, long *count TSRMLS_DC)
{
- ResourceBundle_object *rb = (ResourceBundle_object *) zend_object_store_get_object( object TSRMLS_CC);
+ ResourceBundle_object *rb;
+ RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK;
+
+ if (rb->me == NULL) {
+ intl_errors_set(&rb->error, U_ILLEGAL_ARGUMENT_ERROR,
+ "Found unconstructed ResourceBundle", 0 TSRMLS_CC);
+ return 0;
+ }
*count = ures_getSize( rb->me );
diff --git a/ext/intl/resourcebundle/resourcebundle_class.h b/ext/intl/resourcebundle/resourcebundle_class.h
index 4755d723b8..8da3ed9d47 100644
--- a/ext/intl/resourcebundle/resourcebundle_class.h
+++ b/ext/intl/resourcebundle/resourcebundle_class.h
@@ -33,7 +33,16 @@ typedef struct {
} ResourceBundle_object;
#define RESOURCEBUNDLE_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(ResourceBundle, rb)
-#define RESOURCEBUNDLE_METHOD_FETCH_OBJECT INTL_METHOD_FETCH_OBJECT(ResourceBundle, rb)
+#define RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(ResourceBundle, rb)
+#define RESOURCEBUNDLE_METHOD_FETCH_OBJECT \
+ INTL_METHOD_FETCH_OBJECT(ResourceBundle, rb); \
+ if (RESOURCEBUNDLE_OBJECT(rb) == NULL) { \
+ intl_errors_set(&rb->error, U_ILLEGAL_ARGUMENT_ERROR, \
+ "Found unconstructed ResourceBundle", 0 TSRMLS_CC); \
+ RETURN_FALSE; \
+ }
+
+
#define RESOURCEBUNDLE_OBJECT(rb) (rb)->me
void resourcebundle_register_class( TSRMLS_D );
diff --git a/ext/intl/spoofchecker/spoofchecker.c b/ext/intl/spoofchecker/spoofchecker.c
index 42a014a90e..42a014a90e 100755..100644
--- a/ext/intl/spoofchecker/spoofchecker.c
+++ b/ext/intl/spoofchecker/spoofchecker.c
diff --git a/ext/intl/spoofchecker/spoofchecker.h b/ext/intl/spoofchecker/spoofchecker.h
index f976d639ac..f976d639ac 100755..100644
--- a/ext/intl/spoofchecker/spoofchecker.h
+++ b/ext/intl/spoofchecker/spoofchecker.h
diff --git a/ext/intl/spoofchecker/spoofchecker_class.c b/ext/intl/spoofchecker/spoofchecker_class.c
index 6c19fbb0f6..6c2b79034d 100755..100644
--- 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,
@@ -126,7 +127,7 @@ static zend_object_value spoofchecker_clone_obj(zval *object TSRMLS_DC) /* {{{ *
sfo = (Spoofchecker_object *) zend_object_store_get_object(object TSRMLS_CC);
intl_error_reset(SPOOFCHECKER_ERROR_P(sfo) TSRMLS_CC);
- new_obj_val = Spoofchecker_ce_ptr->create_object(Spoofchecker_ce_ptr TSRMLS_CC);
+ new_obj_val = Spoofchecker_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC);
new_sfo = (Spoofchecker_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC);
/* clone standard parts */
zend_objects_clone_members(&new_sfo->zo, new_obj_val, &sfo->zo, handle TSRMLS_CC);
diff --git a/ext/intl/spoofchecker/spoofchecker_class.h b/ext/intl/spoofchecker/spoofchecker_class.h
index 8db64680ef..ec043d9dc8 100755..100644
--- a/ext/intl/spoofchecker/spoofchecker_class.h
+++ b/ext/intl/spoofchecker/spoofchecker_class.h
@@ -22,6 +22,7 @@
#include "intl_common.h"
#include "spoofchecker_create.h"
#include "intl_error.h"
+#include "intl_data.h"
#include <unicode/uspoof.h>
@@ -55,9 +56,14 @@ extern zend_class_entry *Spoofchecker_ce_ptr;
Spoofchecker_object* co = NULL; \
intl_error_reset(NULL TSRMLS_CC); \
-#define SPOOFCHECKER_METHOD_FETCH_OBJECT \
- co = (Spoofchecker_object *) zend_object_store_get_object(object TSRMLS_CC); \
- intl_error_reset(SPOOFCHECKER_ERROR_P(co) TSRMLS_CC); \
+#define SPOOFCHECKER_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(Spoofchecker, co)
+#define SPOOFCHECKER_METHOD_FETCH_OBJECT \
+ SPOOFCHECKER_METHOD_FETCH_OBJECT_NO_CHECK; \
+ if (co->uspoof == NULL) { \
+ intl_errors_set(&co->err, U_ILLEGAL_ARGUMENT_ERROR, \
+ "Found unconstructed Spoofchecker", 0 TSRMLS_CC); \
+ RETURN_FALSE; \
+ }
// Macro to check return value of a ucol_* function call.
#define SPOOFCHECKER_CHECK_STATUS(co, msg) \
diff --git a/ext/intl/spoofchecker/spoofchecker_create.c b/ext/intl/spoofchecker/spoofchecker_create.c
index 3659551ede..cf0173f997 100755..100644
--- a/ext/intl/spoofchecker/spoofchecker_create.c
+++ b/ext/intl/spoofchecker/spoofchecker_create.c
@@ -35,7 +35,7 @@ PHP_METHOD(Spoofchecker, __construct)
return;
}
- SPOOFCHECKER_METHOD_FETCH_OBJECT;
+ SPOOFCHECKER_METHOD_FETCH_OBJECT_NO_CHECK;
co->uspoof = uspoof_open(SPOOFCHECKER_ERROR_CODE_P(co));
INTL_CTOR_CHECK_STATUS(co, "spoofchecker: unable to open ICU Spoof Checker");
diff --git a/ext/intl/spoofchecker/spoofchecker_create.h b/ext/intl/spoofchecker/spoofchecker_create.h
index 313faab8a3..313faab8a3 100755..100644
--- a/ext/intl/spoofchecker/spoofchecker_create.h
+++ b/ext/intl/spoofchecker/spoofchecker_create.h
diff --git a/ext/intl/spoofchecker/spoofchecker_main.c b/ext/intl/spoofchecker/spoofchecker_main.c
index c37b9186a2..c37b9186a2 100755..100644
--- a/ext/intl/spoofchecker/spoofchecker_main.c
+++ b/ext/intl/spoofchecker/spoofchecker_main.c
diff --git a/ext/intl/spoofchecker/spoofchecker_main.h b/ext/intl/spoofchecker/spoofchecker_main.h
index fb920d7841..fb920d7841 100755..100644
--- a/ext/intl/spoofchecker/spoofchecker_main.h
+++ b/ext/intl/spoofchecker/spoofchecker_main.h
diff --git a/ext/intl/tests/_files/es-bundle.txt b/ext/intl/tests/_files/es-bundle.txt
index 46399a7717..46399a7717 100755..100644
--- a/ext/intl/tests/_files/es-bundle.txt
+++ b/ext/intl/tests/_files/es-bundle.txt
diff --git a/ext/intl/tests/_files/res_index.txt b/ext/intl/tests/_files/res_index.txt
index a39bea58e5..a39bea58e5 100755..100644
--- a/ext/intl/tests/_files/res_index.txt
+++ b/ext/intl/tests/_files/res_index.txt
diff --git a/ext/intl/tests/_files/resourcebundle.txt b/ext/intl/tests/_files/resourcebundle.txt
index 5b081da6cc..5b081da6cc 100755..100644
--- a/ext/intl/tests/_files/resourcebundle.txt
+++ b/ext/intl/tests/_files/resourcebundle.txt
diff --git a/ext/intl/tests/_files/resourcebundle/es.res b/ext/intl/tests/_files/resourcebundle/es.res
index f9d891d6ba..f9d891d6ba 100755..100644
--- a/ext/intl/tests/_files/resourcebundle/es.res
+++ b/ext/intl/tests/_files/resourcebundle/es.res
Binary files differ
diff --git a/ext/intl/tests/_files/resourcebundle/res_index.res b/ext/intl/tests/_files/resourcebundle/res_index.res
index 9dd3df2de3..9dd3df2de3 100755..100644
--- a/ext/intl/tests/_files/resourcebundle/res_index.res
+++ b/ext/intl/tests/_files/resourcebundle/res_index.res
Binary files differ
diff --git a/ext/intl/tests/_files/resourcebundle/root.res b/ext/intl/tests/_files/resourcebundle/root.res
index 62cb48c457..62cb48c457 100755..100644
--- a/ext/intl/tests/_files/resourcebundle/root.res
+++ b/ext/intl/tests/_files/resourcebundle/root.res
Binary files differ
diff --git a/ext/intl/tests/badargs.phpt b/ext/intl/tests/badargs.phpt
index b8f48b371e..b8f48b371e 100755..100644
--- a/ext/intl/tests/badargs.phpt
+++ b/ext/intl/tests/badargs.phpt
diff --git a/ext/intl/tests/breakiter___construct.phpt b/ext/intl/tests/breakiter___construct.phpt
index 9ea6a9cf11..a818075a30 100644
--- a/ext/intl/tests/breakiter___construct.phpt
+++ b/ext/intl/tests/breakiter___construct.phpt
@@ -1,6 +1,7 @@
--TEST--
IntlBreakIterator::__construct() should not be callable
--SKIPIF--
+<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
diff --git a/ext/intl/tests/breakiter_clone_basic.phpt b/ext/intl/tests/breakiter_clone_basic.phpt
index f5bcefc6f7..d838f81217 100644
--- a/ext/intl/tests/breakiter_clone_basic.phpt
+++ b/ext/intl/tests/breakiter_clone_basic.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator: clone handler
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/breakiter_current_basic.phpt b/ext/intl/tests/breakiter_current_basic.phpt
index 515cb555bb..2ce6da7697 100644
--- a/ext/intl/tests/breakiter_current_basic.phpt
+++ b/ext/intl/tests/breakiter_current_basic.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::current(): basic test
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/breakiter_factories_basic.phpt b/ext/intl/tests/breakiter_factories_basic.phpt
index 333023a253..dcfcedef0c 100644
--- a/ext/intl/tests/breakiter_factories_basic.phpt
+++ b/ext/intl/tests/breakiter_factories_basic.phpt
@@ -1,6 +1,7 @@
--TEST--
IntlBreakIterator factories: basic tests
--SKIPIF--
+<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
diff --git a/ext/intl/tests/breakiter_factories_error.phpt b/ext/intl/tests/breakiter_factories_error.phpt
index 6001946ad2..c35339f7a0 100644
--- a/ext/intl/tests/breakiter_factories_error.phpt
+++ b/ext/intl/tests/breakiter_factories_error.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator factory methods: argument errors
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/breakiter_first_basic.phpt b/ext/intl/tests/breakiter_first_basic.phpt
index c8427adc6c..364d5f2fa6 100644
--- a/ext/intl/tests/breakiter_first_basic.phpt
+++ b/ext/intl/tests/breakiter_first_basic.phpt
@@ -1,6 +1,7 @@
--TEST--
IntlBreakIterator::first(): basic test
--SKIPIF--
+<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
diff --git a/ext/intl/tests/breakiter_first_last_previous_current_error.phpt b/ext/intl/tests/breakiter_first_last_previous_current_error.phpt
index 9865cdec58..2ab681228e 100644
--- a/ext/intl/tests/breakiter_first_last_previous_current_error.phpt
+++ b/ext/intl/tests/breakiter_first_last_previous_current_error.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::first()/last()/previous()/current(): arg errors
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/breakiter_following_basic.phpt b/ext/intl/tests/breakiter_following_basic.phpt
index 967ccafb62..30798d99a3 100644
--- a/ext/intl/tests/breakiter_following_basic.phpt
+++ b/ext/intl/tests/breakiter_following_basic.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::following(): basic test
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt b/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt
index a4b60857ab..5550ccf0a0 100644
--- a/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt
+++ b/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::following()/preceding()/isBoundary(): arg errors
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/breakiter_getLocale_basic.phpt b/ext/intl/tests/breakiter_getLocale_basic.phpt
index 499316c169..b0112cc847 100644
--- a/ext/intl/tests/breakiter_getLocale_basic.phpt
+++ b/ext/intl/tests/breakiter_getLocale_basic.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::getLocale(): basic test
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/breakiter_getLocale_error.phpt b/ext/intl/tests/breakiter_getLocale_error.phpt
index 1dec56db08..9acd08ab63 100644
--- a/ext/intl/tests/breakiter_getLocale_error.phpt
+++ b/ext/intl/tests/breakiter_getLocale_error.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::getLocale(): arg errors
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/breakiter_getPartsIterator_basic.phpt b/ext/intl/tests/breakiter_getPartsIterator_basic.phpt
index 794bab3014..36ad80d5fb 100644
--- a/ext/intl/tests/breakiter_getPartsIterator_basic.phpt
+++ b/ext/intl/tests/breakiter_getPartsIterator_basic.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::getPartsIterator(): basic test
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/breakiter_getText_basic.phpt b/ext/intl/tests/breakiter_getText_basic.phpt
index 57f3e32aa3..0e5a26c16a 100644
--- a/ext/intl/tests/breakiter_getText_basic.phpt
+++ b/ext/intl/tests/breakiter_getText_basic.phpt
@@ -1,6 +1,7 @@
--TEST--
IntlBreakIterator::getText(): basic test
--SKIPIF--
+<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
diff --git a/ext/intl/tests/breakiter_getText_error.phpt b/ext/intl/tests/breakiter_getText_error.phpt
index f222002374..91e9919c15 100644
--- a/ext/intl/tests/breakiter_getText_error.phpt
+++ b/ext/intl/tests/breakiter_getText_error.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::getText(): arg errors
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/breakiter_isBoundary_basic.phpt b/ext/intl/tests/breakiter_isBoundary_basic.phpt
index 87d8227352..1f416630a0 100644
--- a/ext/intl/tests/breakiter_isBoundary_basic.phpt
+++ b/ext/intl/tests/breakiter_isBoundary_basic.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::isBoundary(): basic test
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/breakiter_last_basic.phpt b/ext/intl/tests/breakiter_last_basic.phpt
index 0d3aead232..cf816c3670 100644
--- a/ext/intl/tests/breakiter_last_basic.phpt
+++ b/ext/intl/tests/breakiter_last_basic.phpt
@@ -1,6 +1,7 @@
--TEST--
IntlBreakIterator::last(): basic test
--SKIPIF--
+<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
diff --git a/ext/intl/tests/breakiter_next_basic.phpt b/ext/intl/tests/breakiter_next_basic.phpt
index 3d535443b8..4deb4144e3 100644
--- a/ext/intl/tests/breakiter_next_basic.phpt
+++ b/ext/intl/tests/breakiter_next_basic.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::next(): basic test
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/breakiter_next_error.phpt b/ext/intl/tests/breakiter_next_error.phpt
index 40d8f5813b..ed718bc2a5 100644
--- a/ext/intl/tests/breakiter_next_error.phpt
+++ b/ext/intl/tests/breakiter_next_error.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::next(): arg errors
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/breakiter_preceding_basic.phpt b/ext/intl/tests/breakiter_preceding_basic.phpt
index 60695209cc..6fa8dd7fa7 100644
--- a/ext/intl/tests/breakiter_preceding_basic.phpt
+++ b/ext/intl/tests/breakiter_preceding_basic.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::preceding(): basic test
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/breakiter_previous_basic.phpt b/ext/intl/tests/breakiter_previous_basic.phpt
index 6d4f3bce5f..c3343af57c 100644
--- a/ext/intl/tests/breakiter_previous_basic.phpt
+++ b/ext/intl/tests/breakiter_previous_basic.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::previous(): basic test
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/breakiter_setText_basic.phpt b/ext/intl/tests/breakiter_setText_basic.phpt
index 7b3fa2a6e5..a5e4f86b65 100644
--- a/ext/intl/tests/breakiter_setText_basic.phpt
+++ b/ext/intl/tests/breakiter_setText_basic.phpt
@@ -1,6 +1,7 @@
--TEST--
IntlBreakIterator::setText(): basic test
--SKIPIF--
+<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
diff --git a/ext/intl/tests/breakiter_setText_error.phpt b/ext/intl/tests/breakiter_setText_error.phpt
index bfcda8ddaa..a7a73a08d8 100644
--- a/ext/intl/tests/breakiter_setText_error.phpt
+++ b/ext/intl/tests/breakiter_setText_error.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::setText(): arg errors
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/bug12887.phpt b/ext/intl/tests/bug12887.phpt
index e2fc194944..e2fc194944 100755..100644
--- a/ext/intl/tests/bug12887.phpt
+++ b/ext/intl/tests/bug12887.phpt
diff --git a/ext/intl/tests/bug14562.phpt b/ext/intl/tests/bug14562.phpt
index 3256268405..3256268405 100755..100644
--- a/ext/intl/tests/bug14562.phpt
+++ b/ext/intl/tests/bug14562.phpt
diff --git a/ext/intl/tests/bug59597_64.phpt b/ext/intl/tests/bug59597_64.phpt
index f96c72da54..eb70995a25 100644
--- a/ext/intl/tests/bug59597_64.phpt
+++ b/ext/intl/tests/bug59597_64.phpt
@@ -18,4 +18,3 @@ var_dump($value);
--EXPECT--
int(2147483647)
int(2147483650)
-
diff --git a/ext/intl/tests/bug62070.phpt b/ext/intl/tests/bug62070.phpt
index a466b05c24..3ab0078d70 100644
--- a/ext/intl/tests/bug62070.phpt
+++ b/ext/intl/tests/bug62070.phpt
@@ -4,6 +4,8 @@ Bug #62070: Collator::getSortKey() returns garbage
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '49') < 0)
+ die('skip ICU >= 49 only');
--FILE--
<?php
$s1 = 'Hello';
diff --git a/ext/intl/tests/bug62915-2.phpt b/ext/intl/tests/bug62915-2.phpt
new file mode 100644
index 0000000000..bcb069cab6
--- /dev/null
+++ b/ext/intl/tests/bug62915-2.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Bug #62915: cloning of several classes is defective
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
+--FILE--
+<?php
+class A extends IntlDateFormatter {
+ static $ARGS = array("en_US" ,IntlDateFormatter::FULL, IntlDateFormatter::FULL,
+ 'America/Los_Angeles', IntlDateFormatter::GREGORIAN);
+}
+class B extends NumberFormatter {
+ static $ARGS = array('de_DE', NumberFormatter::DECIMAL);
+}
+class C extends MessageFormatter {
+ static $ARGS = array("en_US", "foo");
+}
+class D extends Spoofchecker {
+ static $ARGS = array();
+}
+
+foreach (range('A', 'D') as $subclass) {
+ $rc = new ReflectionClass($subclass);
+ $obj = $rc->newInstanceArgs($subclass::$ARGS);
+ $clone = clone $obj;
+ var_dump(get_class($clone));
+}
+--EXPECT--
+string(1) "A"
+string(1) "B"
+string(1) "C"
+string(1) "D"
diff --git a/ext/intl/tests/bug62915.phpt b/ext/intl/tests/bug62915.phpt
new file mode 100644
index 0000000000..e541d72d63
--- /dev/null
+++ b/ext/intl/tests/bug62915.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #62915: incomplete cloning of IntlTimeZone objects
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
+--FILE--
+<?php
+
+class foo extends IntlTimeZone {
+ public $foo = 'test';
+
+ public function __construct() { }
+}
+
+$x = new foo;
+
+try {
+ $z = clone $x;
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+--EXPECT--
+string(39) "Cannot clone unconstructed IntlTimeZone"
diff --git a/ext/intl/tests/collation_customization.phpt b/ext/intl/tests/collation_customization.phpt
index e380380639..e380380639 100755..100644
--- a/ext/intl/tests/collation_customization.phpt
+++ b/ext/intl/tests/collation_customization.phpt
diff --git a/ext/intl/tests/collator_asort.phpt b/ext/intl/tests/collator_asort.phpt
index a614ddc3f8..a614ddc3f8 100755..100644
--- a/ext/intl/tests/collator_asort.phpt
+++ b/ext/intl/tests/collator_asort.phpt
diff --git a/ext/intl/tests/collator_compare.phpt b/ext/intl/tests/collator_compare.phpt
index f10b5708f4..f10b5708f4 100755..100644
--- a/ext/intl/tests/collator_compare.phpt
+++ b/ext/intl/tests/collator_compare.phpt
diff --git a/ext/intl/tests/collator_create.phpt b/ext/intl/tests/collator_create.phpt
index eed8cf1b23..eed8cf1b23 100755..100644
--- a/ext/intl/tests/collator_create.phpt
+++ b/ext/intl/tests/collator_create.phpt
diff --git a/ext/intl/tests/collator_get_error_code.phpt b/ext/intl/tests/collator_get_error_code.phpt
index 45a8e710f4..45a8e710f4 100755..100644
--- a/ext/intl/tests/collator_get_error_code.phpt
+++ b/ext/intl/tests/collator_get_error_code.phpt
diff --git a/ext/intl/tests/collator_get_error_message.phpt b/ext/intl/tests/collator_get_error_message.phpt
index af4b9c3821..af4b9c3821 100755..100644
--- a/ext/intl/tests/collator_get_error_message.phpt
+++ b/ext/intl/tests/collator_get_error_message.phpt
diff --git a/ext/intl/tests/collator_get_locale.phpt b/ext/intl/tests/collator_get_locale.phpt
index 68440f3ee7..68440f3ee7 100755..100644
--- a/ext/intl/tests/collator_get_locale.phpt
+++ b/ext/intl/tests/collator_get_locale.phpt
diff --git a/ext/intl/tests/collator_get_set_attribute.phpt b/ext/intl/tests/collator_get_set_attribute.phpt
index b234790f81..b234790f81 100755..100644
--- a/ext/intl/tests/collator_get_set_attribute.phpt
+++ b/ext/intl/tests/collator_get_set_attribute.phpt
diff --git a/ext/intl/tests/collator_get_set_strength.phpt b/ext/intl/tests/collator_get_set_strength.phpt
index 1f779441fa..1f779441fa 100755..100644
--- a/ext/intl/tests/collator_get_set_strength.phpt
+++ b/ext/intl/tests/collator_get_set_strength.phpt
diff --git a/ext/intl/tests/collator_get_sort_key.phpt b/ext/intl/tests/collator_get_sort_key.phpt
index a9c4d71348..a9c4d71348 100755..100644
--- a/ext/intl/tests/collator_get_sort_key.phpt
+++ b/ext/intl/tests/collator_get_sort_key.phpt
diff --git a/ext/intl/tests/collator_sort.phpt b/ext/intl/tests/collator_sort.phpt
index 5cefe2fd7c..5cefe2fd7c 100755..100644
--- a/ext/intl/tests/collator_sort.phpt
+++ b/ext/intl/tests/collator_sort.phpt
diff --git a/ext/intl/tests/collator_sort_with_sort_keys.phpt b/ext/intl/tests/collator_sort_with_sort_keys.phpt
index 2f489d745c..2f489d745c 100755..100644
--- a/ext/intl/tests/collator_sort_with_sort_keys.phpt
+++ b/ext/intl/tests/collator_sort_with_sort_keys.phpt
diff --git a/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt b/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt
index 1f682ddb4a..cfd9338717 100644
--- a/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt
+++ b/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlDateFormatter::__construct(): bad timezone or calendar
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/dateformat_clone_bad_obj.phpt b/ext/intl/tests/dateformat_clone_bad_obj.phpt
new file mode 100644
index 0000000000..5e12b96ae8
--- /dev/null
+++ b/ext/intl/tests/dateformat_clone_bad_obj.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Cloning unconstructed IntlDateFormatter
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+class A extends IntlDateFormatter {
+ function __construct() {}
+}
+
+$a = new A;
+try {
+ $b = clone $a;
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+--EXPECTF--
+string(%s) "Cannot clone unconstructed IntlDateFormatter"
diff --git a/ext/intl/tests/dateformat_create_cal_arg.phpt b/ext/intl/tests/dateformat_create_cal_arg.phpt
index 8e5f942a6b..53fb084af9 100644
--- a/ext/intl/tests/dateformat_create_cal_arg.phpt
+++ b/ext/intl/tests/dateformat_create_cal_arg.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlDateFormatter: several forms of the calendar arg
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
@@ -38,12 +42,12 @@ 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
+--EXPECTF--
+domingo%S 1 de enero de 2012 00:00:00 GMT
+domingo%S 8 de Safar de 1433 00:00:00 GMT
+domingo%S 1 de enero de 2012 01:00:00 Hora estándar de Europa Central
+sábado%S 31 de diciembre de 2011 d.C. 23:00:00 Hora %Sde las Azores
+sábado%S 7 de Safar de 1433 AH 23:00:00 Hora %Sde las Azores
+domingo%S 8 de Safar de 1433 AH 00:00:00 GMT
+domingo%S 1 de enero de 2012 00:00:00 GMT
==DONE==
diff --git a/ext/intl/tests/dateformat_format.phpt b/ext/intl/tests/dateformat_format.phpt
index 98f9d34c03..8664eea319 100755..100644
--- a/ext/intl/tests/dateformat_format.phpt
+++ b/ext/intl/tests/dateformat_format.phpt
@@ -399,24 +399,24 @@ Formatted DateTime is : 20001230 05:04 PM
Date is: stdClass::__set_state(array(
))
------------
-Error while formatting as: 'datefmt_format: object must be an instance of DateTime: U_ILLEGAL_ARGUMENT_ERROR'
+Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR'
------------
Date is: stdClass::__set_state(array(
))
------------
-Error while formatting as: 'datefmt_format: object must be an instance of DateTime: U_ILLEGAL_ARGUMENT_ERROR'
+Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR'
------------
Date is: stdClass::__set_state(array(
))
------------
-Error while formatting as: 'datefmt_format: object must be an instance of DateTime: U_ILLEGAL_ARGUMENT_ERROR'
+Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR'
------------
Date is: stdClass::__set_state(array(
))
------------
-Error while formatting as: 'datefmt_format: object must be an instance of DateTime: U_ILLEGAL_ARGUMENT_ERROR'
+Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR'
------------
Date is: stdClass::__set_state(array(
))
------------
-Error while formatting as: 'datefmt_format: object must be an instance of DateTime: U_ILLEGAL_ARGUMENT_ERROR'
+Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR'
diff --git a/ext/intl/tests/dateformat_formatObject_calendar.phpt b/ext/intl/tests/dateformat_formatObject_calendar.phpt
new file mode 100644
index 0000000000..0c61e4f2d0
--- /dev/null
+++ b/ext/intl/tests/dateformat_formatObject_calendar.phpt
@@ -0,0 +1,41 @@
+--TEST--
+IntlDateFormatter::formatObject(): IntlCalendar tests
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+ini_set("date.timezone", "Europe/Lisbon");
+
+$cal = IntlCalendar::fromDateTime('2012-01-01 00:00:00'); //Europe/Lisbon
+echo IntlDateFormatter::formatObject($cal), "\n";
+echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n";
+echo IntlDateFormatter::formatObject($cal, null, "en-US"), "\n";
+echo IntlDateFormatter::formatObject($cal, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n";
+echo IntlDateFormatter::formatObject($cal, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
+
+$cal = IntlCalendar::fromDateTime('2012-01-01 05:00:00+03:00');
+echo datefmt_format_object($cal, IntlDateFormatter::FULL), "\n";
+
+$cal = IntlCalendar::createInstance(null,'en-US@calendar=islamic-civil');
+$cal->setTime(strtotime('2012-01-01 00:00:00')*1000.);
+echo IntlDateFormatter::formatObject($cal), "\n";
+echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n";
+
+?>
+==DONE==
+
+--EXPECTF--
+01/01/2012 00:00:00
+Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental
+Jan 1, 2012 12:00:00 AM
+1/1/12 12:00:00 AM Western European %STime
+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 %STime
+==DONE==
+
diff --git a/ext/intl/tests/dateformat_formatObject_datetime.phpt b/ext/intl/tests/dateformat_formatObject_datetime.phpt
new file mode 100644
index 0000000000..6427ad5a98
--- /dev/null
+++ b/ext/intl/tests/dateformat_formatObject_datetime.phpt
@@ -0,0 +1,34 @@
+--TEST--
+IntlDateFormatter::formatObject(): DateTime tests
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+ini_set("date.timezone", "Europe/Lisbon");
+
+$dt = new DateTime('2012-01-01 00:00:00'); //Europe/Lisbon
+echo IntlDateFormatter::formatObject($dt), "\n";
+echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
+echo IntlDateFormatter::formatObject($dt, null, "en-US"), "\n";
+echo IntlDateFormatter::formatObject($dt, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n";
+echo IntlDateFormatter::formatObject($dt, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
+
+$dt = new DateTime('2012-01-01 05:00:00+03:00');
+echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
+
+?>
+==DONE==
+
+--EXPECTF--
+01/01/2012 00:00:00
+Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental
+Jan 1, 2012 12:00:00 AM
+1/1/12 12:00:00 AM Western European %STime
+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 0000000000..7aaf69e54e
--- /dev/null
+++ b/ext/intl/tests/dateformat_formatObject_error.phpt
@@ -0,0 +1,74 @@
+--TEST--
+IntlDateFormatter::formatObject(): error conditions
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+ini_set("date.timezone", "Europe/Lisbon");
+
+var_dump(IntlDateFormatter::formatObject());
+var_dump(IntlDateFormatter::formatObject(1));
+var_dump(IntlDateFormatter::formatObject(new stdclass));
+
+class A extends IntlCalendar {function __construct(){}}
+var_dump(IntlDateFormatter::formatObject(new A));
+class B extends DateTime {function __construct(){}}
+var_dump(IntlDateFormatter::formatObject(new B));
+
+$cal = IntlCalendar::createInstance();
+var_dump(IntlDateFormatter::formatObject($cal, -2));
+var_dump(IntlDateFormatter::formatObject($cal, array()));
+var_dump(IntlDateFormatter::formatObject($cal, array(1,2,3)));
+var_dump(IntlDateFormatter::formatObject($cal, array(array(), 1)));
+var_dump(IntlDateFormatter::formatObject($cal, array(1, -2)));
+var_dump(IntlDateFormatter::formatObject($cal, ""));
+var_dump(IntlDateFormatter::formatObject($cal, "YYYY", array()));
+
+?>
+==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
index 6bd3d8a8ff..6bd3d8a8ff 100755..100644
--- a/ext/intl/tests/dateformat_format_parse.phpt
+++ b/ext/intl/tests/dateformat_format_parse.phpt
diff --git a/ext/intl/tests/dateformat_getCalendarObject_error.phpt b/ext/intl/tests/dateformat_getCalendarObject_error.phpt
index 22f12cb3fd..d2ad66c829 100644
--- a/ext/intl/tests/dateformat_getCalendarObject_error.phpt
+++ b/ext/intl/tests/dateformat_getCalendarObject_error.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlDateFormatter::getCalendarObject(): bad args
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/dateformat_getTimeZone_error.phpt b/ext/intl/tests/dateformat_getTimeZone_error.phpt
index c9d49fde43..4ac5555d88 100644
--- a/ext/intl/tests/dateformat_getTimeZone_error.phpt
+++ b/ext/intl/tests/dateformat_getTimeZone_error.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlDateFormatter::getTimeZone(): bad args
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/dateformat_get_datetype.phpt b/ext/intl/tests/dateformat_get_datetype.phpt
index 24d03898ea..24d03898ea 100755..100644
--- a/ext/intl/tests/dateformat_get_datetype.phpt
+++ b/ext/intl/tests/dateformat_get_datetype.phpt
diff --git a/ext/intl/tests/dateformat_get_locale.phpt b/ext/intl/tests/dateformat_get_locale.phpt
index 17fcca3551..17fcca3551 100755..100644
--- a/ext/intl/tests/dateformat_get_locale.phpt
+++ b/ext/intl/tests/dateformat_get_locale.phpt
diff --git a/ext/intl/tests/dateformat_get_set_calendar.phpt b/ext/intl/tests/dateformat_get_set_calendar.phpt
index e792ea3799..dbb3e6cd23 100755..100644
--- a/ext/intl/tests/dateformat_get_set_calendar.phpt
+++ b/ext/intl/tests/dateformat_get_set_calendar.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject()
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/dateformat_get_set_pattern.phpt b/ext/intl/tests/dateformat_get_set_pattern.phpt
index bd541c1c93..bd541c1c93 100755..100644
--- a/ext/intl/tests/dateformat_get_set_pattern.phpt
+++ b/ext/intl/tests/dateformat_get_set_pattern.phpt
diff --git a/ext/intl/tests/dateformat_get_set_timezone.phpt b/ext/intl/tests/dateformat_get_set_timezone.phpt
index 50b036e36e..41aa35b9cf 100644
--- a/ext/intl/tests/dateformat_get_set_timezone.phpt
+++ b/ext/intl/tests/dateformat_get_set_timezone.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlDateFormatter: get/setTimeZone()
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
@@ -34,24 +38,24 @@ d($df);
?>
==DONE==
---EXPECT--
+--EXPECTF--
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
+Sábado, 31 de Dezembro de 2011 23:00:00 Hor%s %Sdos 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
+Domingo, 1 de Janeiro de 2012 1:00:00 Hor%s %Sda 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
+Domingo, 1 de Janeiro de 2012 1:00:00 Hor%s %Sda 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
+Domingo, 1 de Janeiro de 2012 1:00:00 Hor%s %Sda Europa Central
string(16) "Europe/Amsterdam"
string(16) "Europe/Amsterdam"
diff --git a/ext/intl/tests/dateformat_get_timetype.phpt b/ext/intl/tests/dateformat_get_timetype.phpt
index 2ddc1172b1..2ddc1172b1 100755..100644
--- a/ext/intl/tests/dateformat_get_timetype.phpt
+++ b/ext/intl/tests/dateformat_get_timetype.phpt
diff --git a/ext/intl/tests/dateformat_get_timezone_id.phpt b/ext/intl/tests/dateformat_get_timezone_id.phpt
index a9701c3868..a9701c3868 100755..100644
--- a/ext/intl/tests/dateformat_get_timezone_id.phpt
+++ b/ext/intl/tests/dateformat_get_timezone_id.phpt
diff --git a/ext/intl/tests/dateformat_is_set_lenient.phpt b/ext/intl/tests/dateformat_is_set_lenient.phpt
index 8492a2e2a8..8492a2e2a8 100755..100644
--- a/ext/intl/tests/dateformat_is_set_lenient.phpt
+++ b/ext/intl/tests/dateformat_is_set_lenient.phpt
diff --git a/ext/intl/tests/dateformat_localtime.phpt b/ext/intl/tests/dateformat_localtime.phpt
index 79f297db74..79f297db74 100755..100644
--- a/ext/intl/tests/dateformat_localtime.phpt
+++ b/ext/intl/tests/dateformat_localtime.phpt
diff --git a/ext/intl/tests/dateformat_parse.phpt b/ext/intl/tests/dateformat_parse.phpt
index ff59773488..ff59773488 100755..100644
--- a/ext/intl/tests/dateformat_parse.phpt
+++ b/ext/intl/tests/dateformat_parse.phpt
diff --git a/ext/intl/tests/dateformat_parse_localtime_parsepos.phpt b/ext/intl/tests/dateformat_parse_localtime_parsepos.phpt
index 03f99f1d92..03f99f1d92 100755..100644
--- a/ext/intl/tests/dateformat_parse_localtime_parsepos.phpt
+++ b/ext/intl/tests/dateformat_parse_localtime_parsepos.phpt
diff --git a/ext/intl/tests/dateformat_parse_timestamp_parsepos.phpt b/ext/intl/tests/dateformat_parse_timestamp_parsepos.phpt
index 0f26643163..0f26643163 100755..100644
--- a/ext/intl/tests/dateformat_parse_timestamp_parsepos.phpt
+++ b/ext/intl/tests/dateformat_parse_timestamp_parsepos.phpt
diff --git a/ext/intl/tests/dateformat_setTimeZoneID_deprecation.phpt b/ext/intl/tests/dateformat_setTimeZoneID_deprecation.phpt
index ccc477d075..5ee5b94d24 100644
--- a/ext/intl/tests/dateformat_setTimeZoneID_deprecation.phpt
+++ b/ext/intl/tests/dateformat_setTimeZoneID_deprecation.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlDateFormatter: setTimeZoneID() deprecation
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/dateformat_setTimeZone_error.phpt b/ext/intl/tests/dateformat_setTimeZone_error.phpt
index 8200197948..bd37031325 100644
--- a/ext/intl/tests/dateformat_setTimeZone_error.phpt
+++ b/ext/intl/tests/dateformat_setTimeZone_error.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlDateFormatter::setTimeZone() bad args
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/dateformat_set_timezone_id.phpt b/ext/intl/tests/dateformat_set_timezone_id.phpt
index 72a9230bdf..72a9230bdf 100755..100644
--- a/ext/intl/tests/dateformat_set_timezone_id.phpt
+++ b/ext/intl/tests/dateformat_set_timezone_id.phpt
diff --git a/ext/intl/tests/dateformat_timezone_arg_variations.phpt b/ext/intl/tests/dateformat_timezone_arg_variations.phpt
index df3ebd853d..ccfb5e1964 100644
--- a/ext/intl/tests/dateformat_timezone_arg_variations.phpt
+++ b/ext/intl/tests/dateformat_timezone_arg_variations.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlDateFormatter: several forms of the timezone arg
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/formatter_clone_bad_obj.phpt b/ext/intl/tests/formatter_clone_bad_obj.phpt
new file mode 100644
index 0000000000..ef7b28a546
--- /dev/null
+++ b/ext/intl/tests/formatter_clone_bad_obj.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Cloning unconstructed numfmt
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+class A extends NumberFormatter {
+ function __construct() {}
+}
+
+$a = new A;
+try {
+ $b = clone $a;
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+--EXPECTF--
+string(42) "Cannot clone unconstructed NumberFormatter"
diff --git a/ext/intl/tests/formatter_fail.phpt b/ext/intl/tests/formatter_fail.phpt
index 295f011008..295f011008 100755..100644
--- a/ext/intl/tests/formatter_fail.phpt
+++ b/ext/intl/tests/formatter_fail.phpt
diff --git a/ext/intl/tests/formatter_format.phpt b/ext/intl/tests/formatter_format.phpt
index 334ef49567..334ef49567 100755..100644
--- a/ext/intl/tests/formatter_format.phpt
+++ b/ext/intl/tests/formatter_format.phpt
diff --git a/ext/intl/tests/formatter_format_conv.phpt b/ext/intl/tests/formatter_format_conv.phpt
index e1d25ef3d9..e1d25ef3d9 100755..100644
--- a/ext/intl/tests/formatter_format_conv.phpt
+++ b/ext/intl/tests/formatter_format_conv.phpt
diff --git a/ext/intl/tests/formatter_format_currency.phpt b/ext/intl/tests/formatter_format_currency.phpt
index be219a5baa..be219a5baa 100755..100644
--- a/ext/intl/tests/formatter_format_currency.phpt
+++ b/ext/intl/tests/formatter_format_currency.phpt
diff --git a/ext/intl/tests/formatter_get_error.phpt b/ext/intl/tests/formatter_get_error.phpt
index acb683e894..acb683e894 100755..100644
--- a/ext/intl/tests/formatter_get_error.phpt
+++ b/ext/intl/tests/formatter_get_error.phpt
diff --git a/ext/intl/tests/formatter_get_locale.phpt b/ext/intl/tests/formatter_get_locale.phpt
index 3d4fb2ae4e..3d4fb2ae4e 100755..100644
--- a/ext/intl/tests/formatter_get_locale.phpt
+++ b/ext/intl/tests/formatter_get_locale.phpt
diff --git a/ext/intl/tests/formatter_get_set_attribute.phpt b/ext/intl/tests/formatter_get_set_attribute.phpt
index 51c7d3658a..51c7d3658a 100755..100644
--- a/ext/intl/tests/formatter_get_set_attribute.phpt
+++ b/ext/intl/tests/formatter_get_set_attribute.phpt
diff --git a/ext/intl/tests/formatter_get_set_pattern.phpt b/ext/intl/tests/formatter_get_set_pattern.phpt
index 0ae5b308b2..0ae5b308b2 100755..100644
--- a/ext/intl/tests/formatter_get_set_pattern.phpt
+++ b/ext/intl/tests/formatter_get_set_pattern.phpt
diff --git a/ext/intl/tests/formatter_get_set_symbol.phpt b/ext/intl/tests/formatter_get_set_symbol.phpt
index 050e8cf9e1..050e8cf9e1 100755..100644
--- a/ext/intl/tests/formatter_get_set_symbol.phpt
+++ b/ext/intl/tests/formatter_get_set_symbol.phpt
diff --git a/ext/intl/tests/formatter_get_set_text_attribute.phpt b/ext/intl/tests/formatter_get_set_text_attribute.phpt
index 539ff52322..539ff52322 100755..100644
--- a/ext/intl/tests/formatter_get_set_text_attribute.phpt
+++ b/ext/intl/tests/formatter_get_set_text_attribute.phpt
diff --git a/ext/intl/tests/formatter_parse.phpt b/ext/intl/tests/formatter_parse.phpt
index 2ab9cce3b6..2ab9cce3b6 100755..100644
--- a/ext/intl/tests/formatter_parse.phpt
+++ b/ext/intl/tests/formatter_parse.phpt
diff --git a/ext/intl/tests/formatter_parse_currency.phpt b/ext/intl/tests/formatter_parse_currency.phpt
index 4ebd1a4174..4ebd1a4174 100755..100644
--- a/ext/intl/tests/formatter_parse_currency.phpt
+++ b/ext/intl/tests/formatter_parse_currency.phpt
diff --git a/ext/intl/tests/grapheme.phpt b/ext/intl/tests/grapheme.phpt
index def9110d0d..def9110d0d 100755..100644
--- a/ext/intl/tests/grapheme.phpt
+++ b/ext/intl/tests/grapheme.phpt
diff --git a/ext/intl/tests/idn.phpt b/ext/intl/tests/idn.phpt
index fde822a560..fde822a560 100755..100644
--- a/ext/intl/tests/idn.phpt
+++ b/ext/intl/tests/idn.phpt
diff --git a/ext/intl/tests/intl_error_name.phpt b/ext/intl/tests/intl_error_name.phpt
index 8f5b2dc198..8f5b2dc198 100755..100644
--- a/ext/intl/tests/intl_error_name.phpt
+++ b/ext/intl/tests/intl_error_name.phpt
diff --git a/ext/intl/tests/intl_get_error_code.phpt b/ext/intl/tests/intl_get_error_code.phpt
index 6cd361ba71..6cd361ba71 100755..100644
--- a/ext/intl/tests/intl_get_error_code.phpt
+++ b/ext/intl/tests/intl_get_error_code.phpt
diff --git a/ext/intl/tests/intl_get_error_message.phpt b/ext/intl/tests/intl_get_error_message.phpt
index f81b5c03d5..f81b5c03d5 100755..100644
--- a/ext/intl/tests/intl_get_error_message.phpt
+++ b/ext/intl/tests/intl_get_error_message.phpt
diff --git a/ext/intl/tests/intl_is_failure.phpt b/ext/intl/tests/intl_is_failure.phpt
index e07df8f2c9..e07df8f2c9 100755..100644
--- a/ext/intl/tests/intl_is_failure.phpt
+++ b/ext/intl/tests/intl_is_failure.phpt
diff --git a/ext/intl/tests/locale_accept.phpt b/ext/intl/tests/locale_accept.phpt
index cf1dc6e675..cf1dc6e675 100755..100644
--- a/ext/intl/tests/locale_accept.phpt
+++ b/ext/intl/tests/locale_accept.phpt
diff --git a/ext/intl/tests/locale_compose_locale.phpt b/ext/intl/tests/locale_compose_locale.phpt
index 2d0ca54e74..2d0ca54e74 100755..100644
--- a/ext/intl/tests/locale_compose_locale.phpt
+++ b/ext/intl/tests/locale_compose_locale.phpt
diff --git a/ext/intl/tests/locale_filter_matches.phpt b/ext/intl/tests/locale_filter_matches.phpt
index cada499b9a..cada499b9a 100755..100644
--- a/ext/intl/tests/locale_filter_matches.phpt
+++ b/ext/intl/tests/locale_filter_matches.phpt
diff --git a/ext/intl/tests/locale_get_all_variants.phpt b/ext/intl/tests/locale_get_all_variants.phpt
index 864b8a2e1a..864b8a2e1a 100755..100644
--- a/ext/intl/tests/locale_get_all_variants.phpt
+++ b/ext/intl/tests/locale_get_all_variants.phpt
diff --git a/ext/intl/tests/locale_get_default.phpt b/ext/intl/tests/locale_get_default.phpt
index 57c46ccd2b..57c46ccd2b 100755..100644
--- a/ext/intl/tests/locale_get_default.phpt
+++ b/ext/intl/tests/locale_get_default.phpt
diff --git a/ext/intl/tests/locale_get_display_language.phpt b/ext/intl/tests/locale_get_display_language.phpt
index 2e00056284..2e00056284 100755..100644
--- a/ext/intl/tests/locale_get_display_language.phpt
+++ b/ext/intl/tests/locale_get_display_language.phpt
diff --git a/ext/intl/tests/locale_get_display_name.phpt b/ext/intl/tests/locale_get_display_name.phpt
index b128734277..b128734277 100755..100644
--- a/ext/intl/tests/locale_get_display_name.phpt
+++ b/ext/intl/tests/locale_get_display_name.phpt
diff --git a/ext/intl/tests/locale_get_display_region.phpt b/ext/intl/tests/locale_get_display_region.phpt
index 9a6e75d94a..9a6e75d94a 100755..100644
--- a/ext/intl/tests/locale_get_display_region.phpt
+++ b/ext/intl/tests/locale_get_display_region.phpt
diff --git a/ext/intl/tests/locale_get_display_script.phpt b/ext/intl/tests/locale_get_display_script.phpt
index 0440dfb204..0440dfb204 100755..100644
--- a/ext/intl/tests/locale_get_display_script.phpt
+++ b/ext/intl/tests/locale_get_display_script.phpt
diff --git a/ext/intl/tests/locale_get_display_variant.phpt b/ext/intl/tests/locale_get_display_variant.phpt
index 9f72ee0498..9f72ee0498 100755..100644
--- a/ext/intl/tests/locale_get_display_variant.phpt
+++ b/ext/intl/tests/locale_get_display_variant.phpt
diff --git a/ext/intl/tests/locale_get_keywords.phpt b/ext/intl/tests/locale_get_keywords.phpt
index 4a09f54d36..4a09f54d36 100755..100644
--- a/ext/intl/tests/locale_get_keywords.phpt
+++ b/ext/intl/tests/locale_get_keywords.phpt
diff --git a/ext/intl/tests/locale_get_primary_language.phpt b/ext/intl/tests/locale_get_primary_language.phpt
index bc92e9266c..bc92e9266c 100755..100644
--- a/ext/intl/tests/locale_get_primary_language.phpt
+++ b/ext/intl/tests/locale_get_primary_language.phpt
diff --git a/ext/intl/tests/locale_get_region.phpt b/ext/intl/tests/locale_get_region.phpt
index 0baae49932..0baae49932 100755..100644
--- a/ext/intl/tests/locale_get_region.phpt
+++ b/ext/intl/tests/locale_get_region.phpt
diff --git a/ext/intl/tests/locale_get_script.phpt b/ext/intl/tests/locale_get_script.phpt
index 6a794fdb12..6a794fdb12 100755..100644
--- a/ext/intl/tests/locale_get_script.phpt
+++ b/ext/intl/tests/locale_get_script.phpt
diff --git a/ext/intl/tests/locale_lookup.phpt b/ext/intl/tests/locale_lookup.phpt
index f0affafa6f..f0affafa6f 100755..100644
--- a/ext/intl/tests/locale_lookup.phpt
+++ b/ext/intl/tests/locale_lookup.phpt
diff --git a/ext/intl/tests/locale_parse_locale.phpt b/ext/intl/tests/locale_parse_locale.phpt
index c8aa2f4123..c8aa2f4123 100755..100644
--- a/ext/intl/tests/locale_parse_locale.phpt
+++ b/ext/intl/tests/locale_parse_locale.phpt
diff --git a/ext/intl/tests/locale_set_default.phpt b/ext/intl/tests/locale_set_default.phpt
index 7debf4d3de..7debf4d3de 100755..100644
--- a/ext/intl/tests/locale_set_default.phpt
+++ b/ext/intl/tests/locale_set_default.phpt
diff --git a/ext/intl/tests/msgfmt_clone_bad_obj.phpt b/ext/intl/tests/msgfmt_clone_bad_obj.phpt
new file mode 100644
index 0000000000..48321094d1
--- /dev/null
+++ b/ext/intl/tests/msgfmt_clone_bad_obj.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Cloning unconstructed MessageFormatter
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+class A extends MessageFormatter {
+ function __construct() {}
+}
+
+$a = new A;
+try {
+ $b = clone $a;
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+--EXPECTF--
+string(%d) "Cannot clone unconstructed MessageFormatter"
diff --git a/ext/intl/tests/msgfmt_fail.phpt b/ext/intl/tests/msgfmt_fail.phpt
index bffb71c56d..bffb71c56d 100755..100644
--- a/ext/intl/tests/msgfmt_fail.phpt
+++ b/ext/intl/tests/msgfmt_fail.phpt
diff --git a/ext/intl/tests/msgfmt_format.phpt b/ext/intl/tests/msgfmt_format.phpt
index c1bf5e9db6..c1bf5e9db6 100755..100644
--- a/ext/intl/tests/msgfmt_format.phpt
+++ b/ext/intl/tests/msgfmt_format.phpt
diff --git a/ext/intl/tests/msgfmt_format_error5.phpt b/ext/intl/tests/msgfmt_format_error5.phpt
index 052d0efd11..ebbd4550e8 100644
--- a/ext/intl/tests/msgfmt_format_error5.phpt
+++ b/ext/intl/tests/msgfmt_format_error5.phpt
@@ -20,6 +20,7 @@ $mf = new MessageFormatter('en_US', $fmt);
var_dump($mf->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_get_locale.phpt b/ext/intl/tests/msgfmt_get_locale.phpt
index 4c2651fe2b..4c2651fe2b 100755..100644
--- a/ext/intl/tests/msgfmt_get_locale.phpt
+++ b/ext/intl/tests/msgfmt_get_locale.phpt
diff --git a/ext/intl/tests/msgfmt_get_set_pattern.phpt b/ext/intl/tests/msgfmt_get_set_pattern.phpt
index 67b1aca459..67b1aca459 100755..100644
--- a/ext/intl/tests/msgfmt_get_set_pattern.phpt
+++ b/ext/intl/tests/msgfmt_get_set_pattern.phpt
diff --git a/ext/intl/tests/msgfmt_parse.phpt b/ext/intl/tests/msgfmt_parse.phpt
index b9ec36374b..b9ec36374b 100755..100644
--- a/ext/intl/tests/msgfmt_parse.phpt
+++ b/ext/intl/tests/msgfmt_parse.phpt
diff --git a/ext/intl/tests/normalizer_normalize.phpt b/ext/intl/tests/normalizer_normalize.phpt
index 238b7423cf..238b7423cf 100755..100644
--- a/ext/intl/tests/normalizer_normalize.phpt
+++ b/ext/intl/tests/normalizer_normalize.phpt
diff --git a/ext/intl/tests/rbbiter___construct_basic.phpt b/ext/intl/tests/rbbiter___construct_basic.phpt
index 2b14d826e3..6fb584fdee 100644
--- a/ext/intl/tests/rbbiter___construct_basic.phpt
+++ b/ext/intl/tests/rbbiter___construct_basic.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlRuleBasedBreakIterator::__construct: basic test
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt b/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt
index a4f3352f9a..a56f6bc488 100644
--- a/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt
+++ b/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlRuleBasedBreakIterator::getRuleStatusVec(): basic test
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt b/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt
index 6199fdee7c..80eedbfba5 100644
--- a/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt
+++ b/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlRuleBasedBreakIterator::getRuleStatus(): basic test
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/rbbiter_getRules_basic.phpt b/ext/intl/tests/rbbiter_getRules_basic.phpt
index e115e9b9e2..2f7a40eb71 100644
--- a/ext/intl/tests/rbbiter_getRules_basic.phpt
+++ b/ext/intl/tests/rbbiter_getRules_basic.phpt
@@ -1,5 +1,9 @@
--TEST--
IntlRuleBasedBreakIterator::getRules(): basic test
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/regression_sort_and_cow.phpt b/ext/intl/tests/regression_sort_and_cow.phpt
index d7ff797705..d7ff797705 100755..100644
--- a/ext/intl/tests/regression_sort_and_cow.phpt
+++ b/ext/intl/tests/regression_sort_and_cow.phpt
diff --git a/ext/intl/tests/regression_sort_eq.phpt b/ext/intl/tests/regression_sort_eq.phpt
index 8676c5c931..8676c5c931 100755..100644
--- a/ext/intl/tests/regression_sort_eq.phpt
+++ b/ext/intl/tests/regression_sort_eq.phpt
diff --git a/ext/intl/tests/regression_sortwsk_and_cow.phpt b/ext/intl/tests/regression_sortwsk_and_cow.phpt
index a4953232ef..a4953232ef 100755..100644
--- a/ext/intl/tests/regression_sortwsk_and_cow.phpt
+++ b/ext/intl/tests/regression_sortwsk_and_cow.phpt
diff --git a/ext/intl/tests/regression_sortwsk_eq.phpt b/ext/intl/tests/regression_sortwsk_eq.phpt
index 945bac300a..945bac300a 100755..100644
--- a/ext/intl/tests/regression_sortwsk_eq.phpt
+++ b/ext/intl/tests/regression_sortwsk_eq.phpt
diff --git a/ext/intl/tests/resourcebundle.build b/ext/intl/tests/resourcebundle.build
index 6a7eeae5eb..6a7eeae5eb 100755..100644
--- a/ext/intl/tests/resourcebundle.build
+++ b/ext/intl/tests/resourcebundle.build
diff --git a/ext/intl/tests/resourcebundle_locales.phpt b/ext/intl/tests/resourcebundle_locales.phpt
index e14a7e5aa1..e14a7e5aa1 100755..100644
--- a/ext/intl/tests/resourcebundle_locales.phpt
+++ b/ext/intl/tests/resourcebundle_locales.phpt
diff --git a/ext/intl/tests/resourcebundle_null_mandatory_args.phpt b/ext/intl/tests/resourcebundle_null_mandatory_args.phpt
index 8fde61bd21..17fab6d630 100644
--- a/ext/intl/tests/resourcebundle_null_mandatory_args.phpt
+++ b/ext/intl/tests/resourcebundle_null_mandatory_args.phpt
@@ -1,11 +1,13 @@
--TEST--
-IntlCalendar::setTime() basic test
+ResourceBundle constructor bundle accepts NULL for first two arguments
--INI--
date.timezone=Atlantic/Azores
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
+if (version_compare(INTL_ICU_VERSION, '4.8') < 0)
+ die('skip ICU >= 4.8 only');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
diff --git a/ext/intl/tests/spoofchecker_001.phpt b/ext/intl/tests/spoofchecker_001.phpt
index 7904b3a4c0..7904b3a4c0 100755..100644
--- a/ext/intl/tests/spoofchecker_001.phpt
+++ b/ext/intl/tests/spoofchecker_001.phpt
diff --git a/ext/intl/tests/spoofchecker_002.phpt b/ext/intl/tests/spoofchecker_002.phpt
index d570917350..d570917350 100755..100644
--- a/ext/intl/tests/spoofchecker_002.phpt
+++ b/ext/intl/tests/spoofchecker_002.phpt
diff --git a/ext/intl/tests/spoofchecker_003.phpt b/ext/intl/tests/spoofchecker_003.phpt
index 0be9bfa409..0be9bfa409 100755..100644
--- a/ext/intl/tests/spoofchecker_003.phpt
+++ b/ext/intl/tests/spoofchecker_003.phpt
diff --git a/ext/intl/tests/spoofchecker_004.phpt b/ext/intl/tests/spoofchecker_004.phpt
index b38c61d717..b38c61d717 100755..100644
--- a/ext/intl/tests/spoofchecker_004.phpt
+++ b/ext/intl/tests/spoofchecker_004.phpt
diff --git a/ext/intl/tests/symfony_format_type_double_intl1.phpt b/ext/intl/tests/symfony_format_type_double_intl1.phpt
new file mode 100644
index 0000000000..13a7ad761f
--- /dev/null
+++ b/ext/intl/tests/symfony_format_type_double_intl1.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #1
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+
+// PHP Unit's code to unserialize data passed as args to #testFormatTypeDoubleIntl
+$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:1:"1";}');
+
+var_dump($unit_test_args);
+
+// execute the code from #testFormatTypeDoubleIntl
+$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
+
+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_double_intl2.phpt b/ext/intl/tests/symfony_format_type_double_intl2.phpt
new file mode 100644
index 0000000000..6bff7cc355
--- /dev/null
+++ b/ext/intl/tests/symfony_format_type_double_intl2.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #2
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+
+// PHP Unit's code to unserialize data passed as args to #testFormatTypeDoubleIntl
+$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:3:"1.1";}');
+
+var_dump($unit_test_args);
+
+// execute the code from #testFormatTypeDoubleIntl
+$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
+
+echo "== didn't crash ==".PHP_EOL;
+
+?>
+--EXPECT--
+array(3) {
+ [0]=>
+ object(NumberFormatter)#1 (0) {
+ }
+ [1]=>
+ float(1.1)
+ [2]=>
+ string(3) "1.1"
+}
+== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_double_intl3.phpt b/ext/intl/tests/symfony_format_type_double_intl3.phpt
new file mode 100644
index 0000000000..3b0d576df7
--- /dev/null
+++ b/ext/intl/tests/symfony_format_type_double_intl3.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #3
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+
+// PHP Unit's code to unserialize data passed as args to #testFormatTypeDoubleIntl
+$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:7:"SFD1.00";}');
+
+var_dump($unit_test_args);
+
+// execute the code from #testFormatTypeDoubleIntl
+$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
+
+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_double_intl4.phpt b/ext/intl/tests/symfony_format_type_double_intl4.phpt
new file mode 100644
index 0000000000..3476e10892
--- /dev/null
+++ b/ext/intl/tests/symfony_format_type_double_intl4.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #4
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+
+// PHP Unit's code to unserialize data passed as args to #testFormatTypeDoubleIntl
+$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:7:"SFD1.10";}');
+
+var_dump($unit_test_args);
+
+// execute the code from #testFormatTypeDoubleIntl
+$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
+
+echo "== didn't crash ==".PHP_EOL;
+
+?>
+--EXPECT--
+array(3) {
+ [0]=>
+ object(NumberFormatter)#1 (0) {
+ }
+ [1]=>
+ float(1.1)
+ [2]=>
+ string(7) "SFD1.10"
+}
+== didn't crash ==
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 0000000000..2867b35690
--- /dev/null
+++ b/ext/intl/tests/symfony_format_type_int32_intl1.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #1
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+// port of Symfony's Symfony\Component\Locale\Tests\Stub\StubNumberFormatterTest#testFormatTypeInt32Intl
+
+
+// Crashes on Windows
+// Windows note: the popup '...program has stopped working'(AEDebug Popup)
+// doesn't always show if you're rapidly running this test repeatedly.
+// regardless of that, the test always crashes every time.
+// (it will show up the first time, or if you wait a while before running it again.)
+// (the popup may also be disabled, which can be done with a registry setting.)
+// you can confirm it crashed by checking the exit code OR
+// the message this test prints at the very end (expected output for pass).
+//
+// Get Exit Code
+// Linux: echo $?
+// Windows: echo %ErrorLevel%
+
+
+
+
+
+// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
+$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:1:"1";}');
+
+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(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 0000000000..6a65a0a809
--- /dev/null
+++ b/ext/intl/tests/symfony_format_type_int32_intl2.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #2
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+// StubNumberFormatterTest#testFormatTypeInt32Intl is tested many times, each with different args.
+// there are 7 sets of args that crash PHP (and other args that don't), each of those 7 is now a separate PHPT test
+// to ensure that each of the 7 args are always tested.
+
+// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
+$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:1:"1";}');
+
+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(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 0000000000..5e657db419
--- /dev/null
+++ b/ext/intl/tests/symfony_format_type_int32_intl3.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #3
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+
+// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
+$unit_test_args = unserialize('a:4:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483648;i:2;s:14:"-2,147,483,648";i:3;s:83:"->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 0000000000..54043d92e9
--- /dev/null
+++ b/ext/intl/tests/symfony_format_type_int32_intl4.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #4
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+
+// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
+$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:7:"SFD1.00";}');
+
+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(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 0000000000..d5f78d7119
--- /dev/null
+++ b/ext/intl/tests/symfony_format_type_int32_intl5.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #5
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+
+// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
+$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:7:"SFD1.00";}');
+
+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(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 0000000000..fa708799d1
--- /dev/null
+++ b/ext/intl/tests/symfony_format_type_int32_intl6.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #6
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+
+// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
+$unit_test_args = unserialize('a:4:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483648;i:2;s:21:"(SFD2,147,483,648.00)";i:3;s:83:"->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 0000000000..5bbe426677
--- /dev/null
+++ b/ext/intl/tests/symfony_format_type_int32_intl7.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #7
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+
+// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
+$unit_test_args = unserialize('a:4:{i:0;O:15:"NumberFormatter":0:{}i:1;d:-2147483649;i:2;s:19:"SFD2,147,483,647.00";i:3;s:83:"->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/symfony_format_type_int64_intl1.phpt b/ext/intl/tests/symfony_format_type_int64_intl1.phpt
new file mode 100644
index 0000000000..01f5820911
--- /dev/null
+++ b/ext/intl/tests/symfony_format_type_int64_intl1.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #1
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+
+// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
+$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:1:"1";}');
+
+var_dump($unit_test_args);
+
+// execute the code from #testFormatTypeInt64Intl
+//$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
+
+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_int64_intl2.phpt b/ext/intl/tests/symfony_format_type_int64_intl2.phpt
new file mode 100644
index 0000000000..13d1cdaee7
--- /dev/null
+++ b/ext/intl/tests/symfony_format_type_int64_intl2.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #2
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+
+// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
+$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:1:"1";}');
+
+var_dump($unit_test_args);
+
+// execute the code from #testFormatTypeInt64Intl
+$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
+
+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_int64_intl3.phpt b/ext/intl/tests/symfony_format_type_int64_intl3.phpt
new file mode 100644
index 0000000000..a7c80b34c3
--- /dev/null
+++ b/ext/intl/tests/symfony_format_type_int64_intl3.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #3
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+
+// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
+$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483648;i:2;s:13:"2,147,483,648";}');
+
+var_dump($unit_test_args);
+
+// execute the code from #testFormatTypeInt64Intl
+$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
+
+echo "== didn't crash ==".PHP_EOL;
+
+?>
+--EXPECT--
+array(3) {
+ [0]=>
+ object(NumberFormatter)#1 (0) {
+ }
+ [1]=>
+ float(2147483648)
+ [2]=>
+ string(13) "2,147,483,648"
+}
+== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_int64_intl4.phpt b/ext/intl/tests/symfony_format_type_int64_intl4.phpt
new file mode 100644
index 0000000000..f1a0801edf
--- /dev/null
+++ b/ext/intl/tests/symfony_format_type_int64_intl4.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #4
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+
+// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
+$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:-2147483649;i:2;s:14:"-2,147,483,649";}');
+
+var_dump($unit_test_args);
+
+// execute the code from #testFormatTypeInt64Intl
+$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
+
+echo "== didn't crash ==".PHP_EOL;
+
+?>
+--EXPECT--
+array(3) {
+ [0]=>
+ object(NumberFormatter)#1 (0) {
+ }
+ [1]=>
+ float(-2147483649)
+ [2]=>
+ string(14) "-2,147,483,649"
+}
+== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_int64_intl5.phpt b/ext/intl/tests/symfony_format_type_int64_intl5.phpt
new file mode 100644
index 0000000000..dad8735b89
--- /dev/null
+++ b/ext/intl/tests/symfony_format_type_int64_intl5.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #5
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+
+// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
+$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:7:"SFD1.00";}');
+
+var_dump($unit_test_args);
+
+// execute the code from #testFormatTypeInt64Intl
+$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
+
+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_int64_intl6.phpt b/ext/intl/tests/symfony_format_type_int64_intl6.phpt
new file mode 100644
index 0000000000..f038cbd0c3
--- /dev/null
+++ b/ext/intl/tests/symfony_format_type_int64_intl6.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #6
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+
+// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
+$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:7:"SFD1.00";}');
+
+var_dump($unit_test_args);
+
+// execute the code from #testFormatTypeInt64Intl
+$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
+
+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_int64_intl7.phpt b/ext/intl/tests/symfony_format_type_int64_intl7.phpt
new file mode 100644
index 0000000000..9c8853cafc
--- /dev/null
+++ b/ext/intl/tests/symfony_format_type_int64_intl7.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #7
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+
+// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
+$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483648;i:2;s:19:"SFD2,147,483,648.00";}');
+
+var_dump($unit_test_args);
+
+// execute the code from #testFormatTypeInt64Intl
+$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
+
+echo "== didn't crash ==".PHP_EOL;
+
+?>
+--EXPECT--
+array(3) {
+ [0]=>
+ object(NumberFormatter)#1 (0) {
+ }
+ [1]=>
+ float(2147483648)
+ [2]=>
+ string(19) "SFD2,147,483,648.00"
+}
+== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_int64_intl8.phpt b/ext/intl/tests/symfony_format_type_int64_intl8.phpt
new file mode 100644
index 0000000000..50524976ab
--- /dev/null
+++ b/ext/intl/tests/symfony_format_type_int64_intl8.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #8
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+
+// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
+$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:-2147483649;i:2;s:21:"(SFD2,147,483,649.00)";}');
+
+var_dump($unit_test_args);
+
+// execute the code from #testFormatTypeInt64Intl
+$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
+
+echo "== didn't crash ==".PHP_EOL;
+
+?>
+--EXPECT--
+array(3) {
+ [0]=>
+ object(NumberFormatter)#1 (0) {
+ }
+ [1]=>
+ float(-2147483649)
+ [2]=>
+ string(21) "(SFD2,147,483,649.00)"
+}
+== didn't crash ==
diff --git a/ext/intl/tests/ut_common.inc b/ext/intl/tests/ut_common.inc
index 09be22bf5a..09be22bf5a 100755..100644
--- a/ext/intl/tests/ut_common.inc
+++ b/ext/intl/tests/ut_common.inc
diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp
index 6e62c34f6d..374b163851 100644
--- a/ext/intl/timezone/timezone_class.cpp
+++ b/ext/intl/timezone/timezone_class.cpp
@@ -25,6 +25,8 @@
#include <unicode/calendar.h>
#include "../intl_convertcpp.h"
+#include "../common/common_date.h"
+
extern "C" {
#include "../intl_convert.h"
#define USE_TIMEZONE_POINTER 1
@@ -54,79 +56,6 @@ U_CFUNC void timezone_object_construct(const TimeZone *zone, zval *object, int o
}
/* }}} */
-/* {{{ 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;
-}
-/* }}} */
-
/* {{{ timezone_convert_to_datetimezone
* Convert from TimeZone to DateTimeZone object */
U_CFUNC zval *timezone_convert_to_datetimezone(const TimeZone *timeZone,
@@ -296,7 +225,7 @@ static zend_object_value TimeZone_clone_obj(zval *object TSRMLS_DC)
to_orig = (TimeZone_object*)zend_object_store_get_object(object TSRMLS_CC);
intl_error_reset(TIMEZONE_ERROR_P(to_orig) TSRMLS_CC);
- ret_val = TimeZone_ce_ptr->create_object(TimeZone_ce_ptr TSRMLS_CC);
+ ret_val = TimeZone_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC);
to_new = (TimeZone_object*)zend_object_store_get_object_by_handle(
ret_val.handle TSRMLS_CC);
diff --git a/ext/intl/timezone/timezone_class.h b/ext/intl/timezone/timezone_class.h
index 0d3c0edde4..a638f6dbf4 100644
--- a/ext/intl/timezone/timezone_class.h
+++ b/ext/intl/timezone/timezone_class.h
@@ -59,7 +59,6 @@ typedef struct {
RETURN_FALSE; \
}
-TimeZone *timezone_convert_datetimezone(int type, void *object, int is_datetime, intl_error *outside_error, 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);
diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp
index caf5dcdedc..9ca6b44c89 100644
--- a/ext/intl/timezone/timezone_methods.cpp
+++ b/ext/intl/timezone/timezone_methods.cpp
@@ -24,6 +24,9 @@
#include <unicode/timezone.h>
#include <unicode/ustring.h>
#include "intl_convertcpp.h"
+
+#include "../common/common_date.h"
+
extern "C" {
#include "../php_intl.h"
#define USE_TIMEZONE_POINTER 1
diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c
index 8d4d0649e9..5ef80fb482 100644
--- a/ext/intl/transliterator/transliterator_class.c
+++ b/ext/intl/transliterator/transliterator_class.c
@@ -162,7 +162,7 @@ static zend_object_value Transliterator_clone_obj( zval *object TSRMLS_DC )
to_orig = zend_object_store_get_object( object TSRMLS_CC );
intl_error_reset( INTL_DATA_ERROR_P( to_orig ) TSRMLS_CC );
- ret_val = Transliterator_ce_ptr->create_object( Transliterator_ce_ptr TSRMLS_CC );
+ ret_val = Transliterator_ce_ptr->create_object( Z_OBJCE_P( object ) TSRMLS_CC );
to_new = zend_object_store_get_object_by_handle( ret_val.handle TSRMLS_CC );
zend_objects_clone_members( &to_new->zo, ret_val,
diff --git a/ext/json/json.c b/ext/json/json.c
index 96690477c9..e4bb8a5d4b 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -47,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)
@@ -126,6 +127,7 @@ static PHP_GINIT_FUNCTION(json)
{
json_globals->encoder_depth = 0;
json_globals->error_code = 0;
+ json_globals->encode_max_depth = 0;
}
/* }}} */
@@ -341,6 +343,9 @@ 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);
@@ -695,20 +700,23 @@ 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", &parameter, &options) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ll", &parameter, &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);
if (JSON_G(error_code) != PHP_JSON_ERROR_NONE && !(options & PHP_JSON_PARTIAL_OUTPUT_ON_ERROR)) {
diff --git a/ext/json/php_json.h b/ext/json/php_json.h
index afeff3f6cc..2b3cf5868a 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
diff --git a/ext/json/tests/bug62369.phpt b/ext/json/tests/bug62369.phpt
new file mode 100644
index 0000000000..a5efd802c5
--- /dev/null
+++ b/ext/json/tests/bug62369.phpt
@@ -0,0 +1,34 @@
+--TEST--
+FR #62369 (Segfault on json_encode(deeply_nested_array)
+--SKIPIF--
+<?php if (!extension_loaded("json")) print "skip"; ?>
+--FILE--
+<?php
+
+$array = array();
+for ($i=0; $i<550; $i++) {
+ $array = array($array);
+}
+
+json_encode($array, 0, 551);
+switch (json_last_error()) {
+ case JSON_ERROR_NONE:
+ echo 'OK'.PHP_EOL;
+ break;
+ case JSON_ERROR_DEPTH:
+ echo 'ERROR'.PHP_EOL;
+ break;
+}
+
+json_encode($array, 0, 540);
+switch (json_last_error()) {
+ case JSON_ERROR_NONE:
+ echo 'OK'.PHP_EOL;
+ break;
+ case JSON_ERROR_DEPTH:
+ echo 'ERROR'.PHP_EOL;
+ break;
+}
+--EXPECTF--
+OK
+ERROR
diff --git a/ext/json/tests/json_encode_error.phpt b/ext/json/tests/json_encode_error.phpt
index d130dd960c..547c8bef17 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_64bit.phpt b/ext/json/tests/pass001.1_64bit.phpt
index 9c3e669952..ff2714436d 100644
--- a/ext/json/tests/pass001.1_64bit.phpt
+++ b/ext/json/tests/pass001.1_64bit.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/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index 47f5fa4def..0861fa6481 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -2715,9 +2715,10 @@ PHP_FUNCTION(mb_substr)
char *str, *encoding;
long from, len;
int mblen, str_len, encoding_len;
+ zval **z_len = NULL;
mbfl_string string, result, *ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|ls", &str, &str_len, &from, &len, &encoding, &encoding_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|Zs", &str, &str_len, &from, &z_len, &encoding, &encoding_len) == FAILURE) {
return;
}
@@ -2736,8 +2737,11 @@ PHP_FUNCTION(mb_substr)
string.val = (unsigned char *)str;
string.len = str_len;
- if (argc < 3) {
+ if (argc < 3 || Z_TYPE_PP(z_len) == IS_NULL) {
len = str_len;
+ } else {
+ convert_to_long_ex(z_len);
+ len = Z_LVAL_PP(z_len);
}
/* measures length */
@@ -2788,13 +2792,14 @@ PHP_FUNCTION(mb_strcut)
char *encoding;
long from, len;
int encoding_len;
+ zval **z_len = NULL;
mbfl_string string, result, *ret;
mbfl_string_init(&string);
string.no_language = MBSTRG(language);
string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|ls", (char **)&string.val, (int **)&string.len, &from, &len, &encoding, &encoding_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|Zs", (char **)&string.val, (int **)&string.len, &from, &z_len, &encoding, &encoding_len) == FAILURE) {
return;
}
@@ -2806,8 +2811,11 @@ PHP_FUNCTION(mb_strcut)
}
}
- if (argc < 3) {
+ if (argc < 3 || Z_TYPE_PP(z_len) == IS_NULL) {
len = string.len;
+ } else {
+ convert_to_long_ex(z_len);
+ len = Z_LVAL_PP(z_len);
}
/* if "from" position is negative, count start position from the end
diff --git a/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt b/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt
new file mode 100644
index 0000000000..5fb642f9b2
--- /dev/null
+++ b/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Optional long parameter might be null
+--FILE--
+<?php
+echo mb_strpos('abb', 'b', null, 'UTF-8') . "\n";
+echo mb_strrpos('abb', 'b', null, 'UTF-8') . "\n";
+echo mb_stripos('abb', 'B', null, 'UTF-8') . "\n";
+echo mb_strripos('abb', 'B', null, 'UTF-8') . "\n";
+echo mb_strstr('foobarbaz', 'ba', null, 'UTF-8') . "\n";
+echo mb_strrchr('foobarbaz', 'ba', null, 'UTF-8') . "\n";
+echo mb_stristr('foobarbaz', 'BA', null, 'UTF-8') . "\n";
+echo mb_strrichr('foobarbaz', 'BA', null, 'UTF-8') . "\n";
+echo mb_substr('foobarbaz', 6, null, 'UTF-8') . "\n";
+echo mb_strcut('foobarbaz', 6, null, 'UTF-8') . "\n";
+echo mb_strimwidth('foobar', 0, 3, null, 'UTF-8') . "\n";
+?>
+==DONE==
+--EXPECT--
+1
+2
+1
+2
+barbaz
+baz
+barbaz
+baz
+baz
+baz
+foo
+==DONE==
diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c
index c573939589..dcac776d02 100644
--- a/ext/mcrypt/mcrypt.c
+++ b/ext/mcrypt/mcrypt.c
@@ -238,10 +238,10 @@ ZEND_END_ARG_INFO()
/* }}} */
const zend_function_entry mcrypt_functions[] = { /* {{{ */
- PHP_FE(mcrypt_ecb, arginfo_mcrypt_ecb)
- PHP_FE(mcrypt_cbc, arginfo_mcrypt_cbc)
- PHP_FE(mcrypt_cfb, arginfo_mcrypt_cfb)
- PHP_FE(mcrypt_ofb, arginfo_mcrypt_ofb)
+ PHP_DEP_FE(mcrypt_ecb, arginfo_mcrypt_ecb)
+ PHP_DEP_FE(mcrypt_cbc, arginfo_mcrypt_cbc)
+ PHP_DEP_FE(mcrypt_cfb, arginfo_mcrypt_cfb)
+ PHP_DEP_FE(mcrypt_ofb, arginfo_mcrypt_ofb)
PHP_FE(mcrypt_get_key_size, arginfo_mcrypt_get_key_size)
PHP_FE(mcrypt_get_block_size, arginfo_mcrypt_get_block_size)
PHP_FE(mcrypt_get_cipher_name, arginfo_mcrypt_get_cipher_name)
diff --git a/ext/mcrypt/tests/mcrypt_cbc.phpt b/ext/mcrypt/tests/mcrypt_cbc.phpt
index f9160db011..27cc5b2224 100644
--- a/ext/mcrypt/tests/mcrypt_cbc.phpt
+++ b/ext/mcrypt/tests/mcrypt_cbc.phpt
@@ -18,6 +18,12 @@ echo trim(mcrypt_cbc($cipher, $key, $enc_data, MCRYPT_DECRYPT, $iv)) . "\n";
mcrypt_cbc($cipher, $key, $enc_data, MCRYPT_DECRYPT);
--EXPECTF--
+
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
+
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
PHP Testfest 2008
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
+
Warning: mcrypt_cbc(): Attempt to use an empty IV, which is NOT recommend in %s on line %d
diff --git a/ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt b/ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt
index 6df3079935..67799a3fdd 100644
--- a/ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt
+++ b/ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt
@@ -72,16 +72,24 @@ function special_var_dump($str) {
--- testing different key lengths
key length=8
+
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
string(32) "736563726574206d6573736167650000"
key length=20
+
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
string(32) "736563726574206d6573736167650000"
key length=24
+
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
string(32) "736563726574206d6573736167650000"
key length=26
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
+
Warning: mcrypt_cbc(): Size of key is too large for this algorithm in %s on line %d
string(32) "736563726574206d6573736167650000"
@@ -89,14 +97,20 @@ string(32) "736563726574206d6573736167650000"
iv length=4
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
+
Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d
string(32) "736563726574206d6573736167650000"
iv length=8
+
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
string(32) "736563726574206d6573736167650000"
iv length=9
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
+
Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d
string(32) "736563726574206d6573736167650000"
===DONE===
diff --git a/ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt b/ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt
index 35fabd9aca..1af094c27b 100644
--- a/ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt
+++ b/ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt
@@ -55,16 +55,24 @@ foreach ($ivs as $iv) {
--- testing different key lengths
key length=8
+
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
string(112) "082b437d039d09418e20dc9de1dafa7ed6da5c6335b78950968441da1faf40c1f886e04da8ca177b80b376811e138c1bf51cb48dae2e7939"
key length=20
+
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
string(112) "0627351e0f8a082bf7981ae2c700a43fd3d44b270ac67b00fded1c5796eea935be0fef2a23da0b3f5e243929e62ac957bf0bf463aa90fc4f"
key length=24
+
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b62617eb2e44213c2d44462d388bc0b8f119384b12c84ac"
key length=26
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
+
Warning: mcrypt_cbc(): Size of key is too large for this algorithm in %s on line %d
string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b62617eb2e44213c2d44462d388bc0b8f119384b12c84ac"
@@ -72,14 +80,20 @@ string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b6
iv length=4
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
+
Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d
string(112) "440a6f54601969b127aad3c217ce7583c7f7b29989693130645569301db0020b29a34a3dcd104b2d0e3ba19d6cbd8a33d352b9c27cc34ef1"
iv length=8
+
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
string(112) "bac347506bf092c5557c4363c301745d78f047028e2953e84fd66b30aeb6005812dadbe8baa871b83278341599b0c448ddaaa52b5a378ce5"
iv length=9
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
+
Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d
string(112) "440a6f54601969b127aad3c217ce7583c7f7b29989693130645569301db0020b29a34a3dcd104b2d0e3ba19d6cbd8a33d352b9c27cc34ef1"
===DONE===
diff --git a/ext/mcrypt/tests/mcrypt_cbc_error.phpt b/ext/mcrypt/tests/mcrypt_cbc_error.phpt
index ec3912b03f..3c22180214 100644
--- a/ext/mcrypt/tests/mcrypt_cbc_error.phpt
+++ b/ext/mcrypt/tests/mcrypt_cbc_error.phpt
@@ -41,11 +41,15 @@ var_dump( mcrypt_cbc($cipher, $key, $data) );
-- Testing mcrypt_cbc() function with more than expected no. of arguments --
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
+
Warning: mcrypt_cbc() expects at most 5 parameters, 6 given in %s on line %d
NULL
-- Testing mcrypt_cbc() function with less than expected no. of arguments --
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
+
Warning: mcrypt_cbc() expects at least 4 parameters, 3 given in %s on line %d
NULL
===DONE===
diff --git a/ext/mcrypt/tests/mcrypt_cbc_variation1.phpt b/ext/mcrypt/tests/mcrypt_cbc_variation1.phpt
index 5482de3e20..eb233e3f92 100644
--- a/ext/mcrypt/tests/mcrypt_cbc_variation1.phpt
+++ b/ext/mcrypt/tests/mcrypt_cbc_variation1.phpt
@@ -124,106 +124,132 @@ fclose($fp);
*** Testing mcrypt_cbc() : usage variation ***
--int 0--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--int 1--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--int 12345--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--int -12345--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--float 10.5--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--float -10.5--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--float 12.3456789000e10--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--float -12.3456789000e10--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--float .5--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--empty array--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 1 to be string, array given, %s(%d)
NULL
--int indexed array--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 1 to be string, array given, %s(%d)
NULL
--associative array--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 1 to be string, array given, %s(%d)
NULL
--nested arrays--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 1 to be string, array given, %s(%d)
NULL
--uppercase NULL--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--lowercase null--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--lowercase true--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--lowercase false--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--uppercase TRUE--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--uppercase FALSE--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--empty string DQ--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--empty string SQ--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--instance of classWithToString--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--instance of classWithoutToString--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 1 to be string, object given, %s(%d)
NULL
--undefined var--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--unset var--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--resource--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 1 to be string, resource given, %s(%d)
NULL
===DONE===
diff --git a/ext/mcrypt/tests/mcrypt_cbc_variation2.phpt b/ext/mcrypt/tests/mcrypt_cbc_variation2.phpt
index f49e80ee93..3d2a061472 100644
--- a/ext/mcrypt/tests/mcrypt_cbc_variation2.phpt
+++ b/ext/mcrypt/tests/mcrypt_cbc_variation2.phpt
@@ -124,87 +124,112 @@ fclose($fp);
*** Testing mcrypt_cbc() : usage variation ***
--int 0--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "bc27b3a4e33b531d5983fc7df693cd09"
--int 1--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "bc27b3a4e33b531d5983fc7df693cd09"
--int 12345--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "d109b7973383127002474ae731c4b3a8"
--int -12345--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "3e82a931cedb03a38b91a637ff8c9f9e"
--float 10.5--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "de71833586c1d7132a289960ebeeca7a"
--float -10.5--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "7d0489dd2e99ae910ecc015573f3dd16"
--float 12.3456789000e10--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "978055b42c0506a8947e3c3c8d994baf"
--float -12.3456789000e10--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "4aa84ba400c2b8ef467d4d98372b4f4e"
--float .5--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "e731dc5059b84e0c8774ac490f77d6e6"
--empty array--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 2 to be string, array given, %s(%d)
string(0) ""
--int indexed array--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 2 to be string, array given, %s(%d)
string(0) ""
--associative array--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 2 to be string, array given, %s(%d)
string(0) ""
--nested arrays--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 2 to be string, array given, %s(%d)
string(0) ""
--uppercase NULL--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "be722a5ffc361d721fbcab1eacc6acf5"
--lowercase null--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "be722a5ffc361d721fbcab1eacc6acf5"
--lowercase true--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "bc27b3a4e33b531d5983fc7df693cd09"
--lowercase false--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "be722a5ffc361d721fbcab1eacc6acf5"
--uppercase TRUE--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "bc27b3a4e33b531d5983fc7df693cd09"
--uppercase FALSE--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "be722a5ffc361d721fbcab1eacc6acf5"
--empty string DQ--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "be722a5ffc361d721fbcab1eacc6acf5"
--empty string SQ--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "be722a5ffc361d721fbcab1eacc6acf5"
--instance of classWithToString--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "19420fa26f561ee82ed84abbcd2d284b"
--instance of classWithoutToString--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 2 to be string, object given, %s(%d)
string(0) ""
--undefined var--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "be722a5ffc361d721fbcab1eacc6acf5"
--unset var--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "be722a5ffc361d721fbcab1eacc6acf5"
--resource--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 2 to be string, resource given, %s(%d)
string(0) ""
===DONE===
-
diff --git a/ext/mcrypt/tests/mcrypt_cbc_variation3.phpt b/ext/mcrypt/tests/mcrypt_cbc_variation3.phpt
index 5b2398ddbd..9a1464b112 100644
--- a/ext/mcrypt/tests/mcrypt_cbc_variation3.phpt
+++ b/ext/mcrypt/tests/mcrypt_cbc_variation3.phpt
@@ -124,87 +124,112 @@ fclose($fp);
*** Testing mcrypt_cbc() : usage variation ***
--int 0--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "ce5fcfe737859795"
--int 1--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "84df495f6cd82dd9"
--int 12345--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "905ab1ae27ee9991"
--int -12345--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "5835174e9c67c3e7"
--float 10.5--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "28ff0601ad9e47fa"
--float -10.5--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "ce9f2b6e2fc3d9f7"
--float 12.3456789000e10--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "24eb882ce9763e4018fba9b7f01b0c3e"
--float -12.3456789000e10--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5eed30e428f32de1d7a7064d0ed4d3eb"
--float .5--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "bebf2a13676e1e30"
--empty array--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 3 to be string, array given, %s(%d)
string(0) ""
--int indexed array--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 3 to be string, array given, %s(%d)
string(0) ""
--associative array--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 3 to be string, array given, %s(%d)
string(0) ""
--nested arrays--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 3 to be string, array given, %s(%d)
string(0) ""
--uppercase NULL--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "206f6d3617a5ab32"
--lowercase null--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "206f6d3617a5ab32"
--lowercase true--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "84df495f6cd82dd9"
--lowercase false--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "206f6d3617a5ab32"
--uppercase TRUE--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "84df495f6cd82dd9"
--uppercase FALSE--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "206f6d3617a5ab32"
--empty string DQ--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "206f6d3617a5ab32"
--empty string SQ--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "206f6d3617a5ab32"
--instance of classWithToString--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "7c91cdf8f8c51485034a9ee528eb016b"
--instance of classWithoutToString--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 3 to be string, object given, %s(%d)
string(0) ""
--undefined var--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "206f6d3617a5ab32"
--unset var--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "206f6d3617a5ab32"
--resource--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 3 to be string, resource given, %s(%d)
string(0) ""
===DONE===
-
diff --git a/ext/mcrypt/tests/mcrypt_cbc_variation4.phpt b/ext/mcrypt/tests/mcrypt_cbc_variation4.phpt
index f9a511f390..a3dd29ba41 100644
--- a/ext/mcrypt/tests/mcrypt_cbc_variation4.phpt
+++ b/ext/mcrypt/tests/mcrypt_cbc_variation4.phpt
@@ -124,82 +124,108 @@ fclose($fp);
*** Testing mcrypt_cbc() : usage variation ***
--float 10.5--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--float -10.5--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--float 12.3456789000e10--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--float -12.3456789000e10--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--float .5--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--empty array--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--int indexed array--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--associative array--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--nested arrays--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--uppercase NULL--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--lowercase null--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--lowercase true--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--lowercase false--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--uppercase TRUE--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--uppercase FALSE--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--empty string DQ--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--empty string SQ--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--string DQ--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--string SQ--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--mixed case string--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--heredoc--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--instance of classWithToString--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 8 - Object of class classWithToString could not be converted to int, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--instance of classWithoutToString--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 8 - Object of class classWithoutToString could not be converted to int, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--undefined var--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--unset var--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--resource--
-string(%d) %s
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
+string(32) "983d5edc5f77fe42e2372a0339dc22b0"
===DONE===
diff --git a/ext/mcrypt/tests/mcrypt_cbc_variation5.phpt b/ext/mcrypt/tests/mcrypt_cbc_variation5.phpt
index 7d49db853d..0c75c97934 100644
--- a/ext/mcrypt/tests/mcrypt_cbc_variation5.phpt
+++ b/ext/mcrypt/tests/mcrypt_cbc_variation5.phpt
@@ -124,106 +124,132 @@ fclose($fp);
*** Testing mcrypt_cbc() : usage variation ***
--int 0--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--int 1--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--int 12345--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--int -12345--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--float 10.5--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--float -10.5--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--float 12.3456789000e10--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--float -12.3456789000e10--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--float .5--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--empty array--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 5 to be string, array given, %s(%d)
string(0) ""
--int indexed array--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 5 to be string, array given, %s(%d)
string(0) ""
--associative array--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 5 to be string, array given, %s(%d)
string(0) ""
--nested arrays--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 5 to be string, array given, %s(%d)
string(0) ""
--uppercase NULL--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--lowercase null--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--lowercase true--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--lowercase false--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--uppercase TRUE--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--uppercase FALSE--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--empty string DQ--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--empty string SQ--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--instance of classWithToString--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--instance of classWithoutToString--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 5 to be string, object given, %s(%d)
string(0) ""
--undefined var--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--unset var--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--resource--
+Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 5 to be string, resource given, %s(%d)
string(0) ""
===DONE===
diff --git a/ext/mcrypt/tests/mcrypt_cbf.phpt b/ext/mcrypt/tests/mcrypt_cfb.phpt
index 8ec3cd7d3e..11120633a5 100644
--- a/ext/mcrypt/tests/mcrypt_cbf.phpt
+++ b/ext/mcrypt/tests/mcrypt_cfb.phpt
@@ -1,5 +1,5 @@
--TEST--
-mcrypt_cbf
+mcrypt_cfb
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
@@ -8,7 +8,7 @@ $key = "FooBar";
$secret = "PHP Testfest 2008";
$cipher = MCRYPT_RIJNDAEL_128;
-$iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_ECB), MCRYPT_RAND);
+$iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_CFB), MCRYPT_RAND);
$enc_data = mcrypt_cfb($cipher, $key, $secret, MCRYPT_ENCRYPT, $iv);
// we have to trim as AES rounds the blocks and decrypt doesnt detect that
@@ -18,6 +18,12 @@ echo trim(mcrypt_cfb($cipher, $key, $enc_data, MCRYPT_DECRYPT, $iv)) . "\n";
mcrypt_cfb($cipher, $key, $enc_data, MCRYPT_DECRYPT);
--EXPECTF--
+
+Deprecated: Function mcrypt_cfb() is deprecated in %s on line %d
+
+Deprecated: Function mcrypt_cfb() is deprecated in %s on line %d
PHP Testfest 2008
-Warning: mcrypt_cfb(): Attempt to use an empty IV, which is NOT recommend in %s on line %d \ No newline at end of file
+Deprecated: Function mcrypt_cfb() is deprecated in %s on line %d
+
+Warning: mcrypt_cfb(): Attempt to use an empty IV, which is NOT recommend in %s on line %d
diff --git a/ext/mcrypt/tests/mcrypt_create_iv.phpt b/ext/mcrypt/tests/mcrypt_create_iv.phpt
index cf6456fef7..1aa48868b0 100644
--- a/ext/mcrypt/tests/mcrypt_create_iv.phpt
+++ b/ext/mcrypt/tests/mcrypt_create_iv.phpt
@@ -5,13 +5,13 @@ mcrypt_create_iv
--FILE--
<?php
$iv1 = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB), MCRYPT_RAND);
-$iv2 = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_192, MCRYPT_MODE_ECB), MCRYPT_DEV_URANDOM);
-$iv3 = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_DEV_RANDOM);
+$iv2 = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB), MCRYPT_DEV_URANDOM);
+$iv3 = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB), MCRYPT_DEV_RANDOM);
echo strlen($iv1) . "\n";
echo strlen($iv2) . "\n";
echo strlen($iv3) . "\n";
--EXPECT--
16
-24
-32
+16
+16
diff --git a/ext/mcrypt/tests/mcrypt_ecb.phpt b/ext/mcrypt/tests/mcrypt_ecb.phpt
index e75d9fa6cd..b6d0a22786 100644
--- a/ext/mcrypt/tests/mcrypt_ecb.phpt
+++ b/ext/mcrypt/tests/mcrypt_ecb.phpt
@@ -18,4 +18,10 @@ echo trim(mcrypt_ecb($cipher, $key, $enc_data, MCRYPT_DECRYPT, $iv)) . "\n";
mcrypt_ecb($cipher, $key, $enc_data, MCRYPT_DECRYPT);
--EXPECTF--
+
+Deprecated: Function mcrypt_ecb() is deprecated in %s on line %d
+
+Deprecated: Function mcrypt_ecb() is deprecated in %s on line %d
PHP Testfest 2008
+
+Deprecated: Function mcrypt_ecb() is deprecated in %s on line %d
diff --git a/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt b/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt
index 7a5cc27f44..82f9608da8 100644
--- a/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt
+++ b/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt
@@ -8,6 +8,8 @@ if (!extension_loaded("mcrypt")) {
?>
--FILE--
<?php
+error_reporting(E_ALL & ~E_DEPRECATED);
+
/* Prototype : string mcrypt_ecb(int cipher, string key, string data, int mode, string iv)
* Description: ECB crypt/decrypt data using key key with cipher cipher starting with iv
* Source code: ext/mcrypt/mcrypt.c
@@ -94,4 +96,4 @@ string(32) "736563726574206d6573736167650000"
iv length=9
string(32) "736563726574206d6573736167650000"
-===DONE=== \ No newline at end of file
+===DONE===
diff --git a/ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt b/ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt
index da26b4ba83..50107b4b0f 100644
--- a/ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt
+++ b/ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt
@@ -8,6 +8,8 @@ if (!extension_loaded("mcrypt")) {
?>
--FILE--
<?php
+error_reporting(E_ALL & ~E_DEPRECATED);
+
/* Prototype : string mcrypt_ecb(int cipher, string key, string data, int mode, string iv)
* Description: ECB crypt/decrypt data using key key with cipher cipher starting with iv
* Source code: ext/mcrypt/mcrypt.c
diff --git a/ext/mcrypt/tests/mcrypt_ecb_error.phpt b/ext/mcrypt/tests/mcrypt_ecb_error.phpt
index b33034afcb..7e521f2225 100644
--- a/ext/mcrypt/tests/mcrypt_ecb_error.phpt
+++ b/ext/mcrypt/tests/mcrypt_ecb_error.phpt
@@ -8,6 +8,8 @@ if (!extension_loaded("mcrypt")) {
?>
--FILE--
<?php
+error_reporting(E_ALL & ~E_DEPRECATED);
+
/* Prototype : string mcrypt_ecb(int cipher, string key, string data, int mode, string iv)
* Description: ECB crypt/decrypt data using key key with cipher cipher starting with iv
* Source code: ext/mcrypt/mcrypt.c
diff --git a/ext/mcrypt/tests/mcrypt_ecb_variation1.phpt b/ext/mcrypt/tests/mcrypt_ecb_variation1.phpt
index 282a0cce1d..7271deec13 100644
--- a/ext/mcrypt/tests/mcrypt_ecb_variation1.phpt
+++ b/ext/mcrypt/tests/mcrypt_ecb_variation1.phpt
@@ -8,6 +8,8 @@ if (!extension_loaded("mcrypt")) {
?>
--FILE--
<?php
+error_reporting(E_ALL & ~E_DEPRECATED);
+
/* Prototype : string mcrypt_ecb(string cipher, string key, string data, int mode, string iv)
* Description: ECB crypt/decrypt data using key key with cipher cipher starting with iv
* Source code: ext/mcrypt/mcrypt.c
@@ -18,7 +20,7 @@ echo "*** Testing mcrypt_ecb() : usage variation ***\n";
// Define error handler
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- if (error_reporting() != 0) {
+ if ($err_no & error_reporting()) {
// report non-silenced errors
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
}
diff --git a/ext/mcrypt/tests/mcrypt_ecb_variation2.phpt b/ext/mcrypt/tests/mcrypt_ecb_variation2.phpt
index 49e0a551f8..ed57400e0f 100644
--- a/ext/mcrypt/tests/mcrypt_ecb_variation2.phpt
+++ b/ext/mcrypt/tests/mcrypt_ecb_variation2.phpt
@@ -8,6 +8,8 @@ if (!extension_loaded("mcrypt")) {
?>
--FILE--
<?php
+error_reporting(E_ALL & ~E_DEPRECATED);
+
/* Prototype : string mcrypt_ecb(string cipher, string key, string data, int mode, string iv)
* Description: ECB crypt/decrypt data using key key with cipher cipher starting with iv
* Source code: ext/mcrypt/mcrypt.c
@@ -18,7 +20,7 @@ echo "*** Testing mcrypt_ecb() : usage variation ***\n";
// Define error handler
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- if (error_reporting() != 0) {
+ if ($err_no & error_reporting()) {
// report non-silenced errors
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
}
diff --git a/ext/mcrypt/tests/mcrypt_ecb_variation3.phpt b/ext/mcrypt/tests/mcrypt_ecb_variation3.phpt
index cedda4930a..2999304563 100644
--- a/ext/mcrypt/tests/mcrypt_ecb_variation3.phpt
+++ b/ext/mcrypt/tests/mcrypt_ecb_variation3.phpt
@@ -8,6 +8,8 @@ if (!extension_loaded("mcrypt")) {
?>
--FILE--
<?php
+error_reporting(E_ALL & ~E_DEPRECATED);
+
/* Prototype : string mcrypt_ecb(string cipher, string key, string data, int mode, string iv)
* Description: ECB crypt/decrypt data using key key with cipher cipher starting with iv
* Source code: ext/mcrypt/mcrypt.c
@@ -18,7 +20,7 @@ echo "*** Testing mcrypt_ecb() : usage variation ***\n";
// Define error handler
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- if (error_reporting() != 0) {
+ if ($err_no & error_reporting()) {
// report non-silenced errors
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
}
diff --git a/ext/mcrypt/tests/mcrypt_ecb_variation4.phpt b/ext/mcrypt/tests/mcrypt_ecb_variation4.phpt
index 599b4fbe70..e52040e295 100644
--- a/ext/mcrypt/tests/mcrypt_ecb_variation4.phpt
+++ b/ext/mcrypt/tests/mcrypt_ecb_variation4.phpt
@@ -8,6 +8,8 @@ if (!extension_loaded("mcrypt")) {
?>
--FILE--
<?php
+error_reporting(E_ALL & ~E_DEPRECATED);
+
/* Prototype : string mcrypt_ecb(string cipher, string key, string data, int mode, string iv)
* Description: ECB crypt/decrypt data using key key with cipher cipher starting with iv
* Source code: ext/mcrypt/mcrypt.c
@@ -18,7 +20,7 @@ echo "*** Testing mcrypt_ecb() : usage variation ***\n";
// Define error handler
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- if (error_reporting() != 0) {
+ if ($err_no & error_reporting()) {
// report non-silenced errors
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
}
diff --git a/ext/mcrypt/tests/mcrypt_ecb_variation5.phpt b/ext/mcrypt/tests/mcrypt_ecb_variation5.phpt
index f64744fcdf..3f4f7f5ddb 100644
--- a/ext/mcrypt/tests/mcrypt_ecb_variation5.phpt
+++ b/ext/mcrypt/tests/mcrypt_ecb_variation5.phpt
@@ -8,6 +8,8 @@ if (!extension_loaded("mcrypt")) {
?>
--FILE--
<?php
+error_reporting(E_ALL & ~E_DEPRECATED);
+
/* Prototype : string mcrypt_ecb(string cipher, string key, string data, int mode, string iv)
* Description: ECB crypt/decrypt data using key key with cipher cipher starting with iv
* Source code: ext/mcrypt/mcrypt.c
@@ -18,7 +20,7 @@ echo "*** Testing mcrypt_ecb() : usage variation ***\n";
// Define error handler
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- if (error_reporting() != 0) {
+ if ($err_no & error_reporting()) {
// report non-silenced errors
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
}
diff --git a/ext/mcrypt/tests/mcrypt_ofb.phpt b/ext/mcrypt/tests/mcrypt_ofb.phpt
index 1532c4cf29..9420353060 100644
--- a/ext/mcrypt/tests/mcrypt_ofb.phpt
+++ b/ext/mcrypt/tests/mcrypt_ofb.phpt
@@ -17,5 +17,11 @@ echo trim(mcrypt_ofb($cipher, $key, $enc_data, MCRYPT_DECRYPT, $iv)) . "\n";
// a warning must be issued if we don't use a IV on a AES cipher, that usually requires an IV
mcrypt_ofb($cipher, $key, $enc_data, MCRYPT_DECRYPT, $iv);
---EXPECT--
-PHP Testfest 2008 \ No newline at end of file
+--EXPECTF--
+
+Deprecated: Function mcrypt_ofb() is deprecated in %s on line %d
+
+Deprecated: Function mcrypt_ofb() is deprecated in %s on line %d
+PHP Testfest 2008
+
+Deprecated: Function mcrypt_ofb() is deprecated in %s on line %d
diff --git a/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt b/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt
index 100352a1c7..e450a69047 100644
--- a/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt
+++ b/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt
@@ -76,24 +76,34 @@ foreach ($ivs as $iv) {
key length=0
string(128) "4fbf24aaa789f5194260ade1acd9499402c1845cc517e8fe43cfb5b90a0df294db33ecd1a836c47d6bf6d8600512ba415e17008a1e1991f81056258d82099397"
+
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
key length=0
string(128) "4fbf24aaa789f5194260ade1acd9499402c1845cc517e8fe43cfb5b90a0df294db33ecd1a836c47d6bf6d8600512ba415e17008a1e1991f81056258d82099397"
+
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
key length=8
string(128) "d6a3042b278fa5816dc6f46152acbe5fd7d1813c3808c27cd969d8e10a64d0238724edfda0322f4512308f22d142df0e92bed861c2b732f7650e234df59183dc"
+
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
key length=16
string(128) "dc8f957ec530acf10cd95ba7da7b6405380fe19a2941e9a8de54680512f18491bc374e5464885ae6c2ae2aa7a6cdd2fbe12a06bbc4bd59dbbfaa15f09044f101"
+
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
--- testing different iv lengths
iv length=0
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
+
Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d
string(128) "c082b3fabaae4c8c410eb8dba64bae10e48d79b5241fb8f24462cad43bd0b35ad2746b00817e9dcbc636b44df0ec60b46a57e7a310a308a0947724e3817a13b4"
@@ -102,6 +112,8 @@ string(128) "546869732069732074686520736563726574206d657373616765207768696368206
iv length=0
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
+
Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d
string(128) "c082b3fabaae4c8c410eb8dba64bae10e48d79b5241fb8f24462cad43bd0b35ad2746b00817e9dcbc636b44df0ec60b46a57e7a310a308a0947724e3817a13b4"
@@ -110,6 +122,8 @@ string(128) "546869732069732074686520736563726574206d657373616765207768696368206
iv length=8
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
+
Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d
string(128) "c082b3fabaae4c8c410eb8dba64bae10e48d79b5241fb8f24462cad43bd0b35ad2746b00817e9dcbc636b44df0ec60b46a57e7a310a308a0947724e3817a13b4"
@@ -117,14 +131,18 @@ Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in
string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
iv length=16
+
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
string(128) "dc8f957ec530acf10cd95ba7da7b6405380fe19a2941e9a8de54680512f18491bc374e5464885ae6c2ae2aa7a6cdd2fbe12a06bbc4bd59dbbfaa15f09044f101"
string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
iv length=17
+Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
+
Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d
string(128) "c082b3fabaae4c8c410eb8dba64bae10e48d79b5241fb8f24462cad43bd0b35ad2746b00817e9dcbc636b44df0ec60b46a57e7a310a308a0947724e3817a13b4"
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in %s on line %d
string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
-===DONE=== \ No newline at end of file
+===DONE===
diff --git a/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt b/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt
index 339d36c934..aa15f5ca12 100644
--- a/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt
+++ b/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt
@@ -2,7 +2,6 @@
LOAD DATA INFILE - open_basedir
--SKIPIF--
<?php
-@include_once("connect.inc");
include_once('skipif.inc');
include_once('skipifconnectfailure.inc');
diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c
index fee65ee290..5e9c01378a 100644
--- a/ext/mysqli/mysqli_nonapi.c
+++ b/ext/mysqli/mysqli_nonapi.c
@@ -778,6 +778,11 @@ PHP_FUNCTION(mysqli_poll)
RETURN_FALSE;
}
+ if (!r_array && !e_array) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No stream arrays were passed");
+ RETURN_FALSE;
+ }
+
if (r_array != NULL) {
mysqlnd_zval_array_to_mysqlnd_array(r_array, &new_r_array TSRMLS_CC);
}
diff --git a/ext/mysqli/tests/bug62885.phpt b/ext/mysqli/tests/bug62885.phpt
new file mode 100644
index 0000000000..9fb0aa0f03
--- /dev/null
+++ b/ext/mysqli/tests/bug62885.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #62885 (mysqli_poll - Segmentation fault)
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once("connect.inc");
+if (!$IS_MYSQLND) {
+ die("skip mysqlnd only test");
+}
+?>
+--FILE--
+<?php
+error_reporting(E_ALL);
+$tablica = array();
+$test1 = mysqli_poll($test2, $test3, $tablica, null);
+
+$test2 = array();
+$test2 = array();
+$test1 = mysqli_poll($test2, $test3, $tablica, null);
+echo "okey";
+?>
+--EXPECTF--
+Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
+
+Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
+okey
diff --git a/ext/mysqli/tests/connect.inc b/ext/mysqli/tests/connect.inc
index 3a9d8ec258..4acc20cb91 100644
--- a/ext/mysqli/tests/connect.inc
+++ b/ext/mysqli/tests/connect.inc
@@ -129,99 +129,6 @@
}
}
- function my_get_charsets($link) {
-
- /* Those tree are set by SET NAMES */
- $charsets = array(
- 'client' => NULL,
- 'results' => NULL,
- 'connection' => NULL,
- );
-
- if (!($res = mysqli_query($link, "SHOW VARIABLES LIKE '%character%'"))) {
- printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link));
- return $charsets;
- }
-
- $names = array();
- while ($row = mysqli_fetch_assoc($res)) {
- $names[$row['Variable_name']] = $row['Value'];
- }
- mysqli_free_result($res);
-
- if (!($res = mysqli_query($link, sprintf("SHOW CHARACTER SET LIKE '%s'", $names['character_set_client']))) ||
- !($details = mysqli_fetch_assoc($res))) {
- printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link));
- return $charsets;
- }
- mysqli_free_result($res);
-
- $charsets['client'] = array(
- 'charset' => $details['Charset'],
- 'desc' => $details['Description'],
- 'collation' => $details['Default collation'],
- 'maxlen' => $details['Maxlen'],
- 'nr' => NULL,
- );
-
- if (!($res = mysqli_query($link, sprintf("SHOW COLLATION LIKE '%s'", $details['Default collation']))) ||
- !($collation = mysqli_fetch_assoc($res))) {
- printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link));
- return $charsets;
- }
- mysqli_free_result($res);
- $charsets['client']['nr'] = $collation['Id'];
-
- if (!($res = mysqli_query($link, sprintf("SHOW CHARACTER SET LIKE '%s'", $names['character_set_results']))) ||
- !($details = mysqli_fetch_assoc($res))) {
- printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link));
- return $charsets;
- }
- mysqli_free_result($res);
-
- $charsets['results'] = array(
- 'charset' => $details['Charset'],
- 'desc' => $details['Description'],
- 'collation' => $details['Default collation'],
- 'maxlen' => $details['Maxlen'],
- 'nr' => NULL,
- );
-
- if (!($res = mysqli_query($link, sprintf("SHOW COLLATION LIKE '%s'", $details['Default collation']))) ||
- !($collation = mysqli_fetch_assoc($res))) {
- printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link));
- return $charsets;
- }
- mysqli_free_result($res);
- $charsets['results']['nr'] = $collation['Id'];
-
-
- if (!($res = mysqli_query($link, sprintf("SHOW CHARACTER SET LIKE '%s'", $names['character_set_connection']))) ||
- !($details = mysqli_fetch_assoc($res))) {
- printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link));
- return $charsets;
- }
- mysqli_free_result($res);
-
- $charsets['connection'] = array(
- 'charset' => $details['Charset'],
- 'desc' => $details['Description'],
- 'collation' => $details['Default collation'],
- 'maxlen' => $details['Maxlen'],
- 'nr' => NULL,
- );
-
- if (!($res = mysqli_query($link, sprintf("SHOW COLLATION LIKE '%s'", $details['Default collation']))) ||
- !($collation = mysqli_fetch_assoc($res))) {
- printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link));
- return $charsets;
- }
- mysqli_free_result($res);
- $charsets['connection']['nr'] = $collation['Id'];
-
- return $charsets;
- }
-
function have_innodb($link) {
if (($res = $link->query("SHOW VARIABLES LIKE 'have_innodb'")) &&
($row = $res->fetch_row()) &&
diff --git a/ext/mysqli/tests/mysqli_fetch_field.phpt b/ext/mysqli/tests/mysqli_fetch_field.phpt
index d1d358b342..2b9108072b 100644
--- a/ext/mysqli/tests/mysqli_fetch_field.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_field.phpt
@@ -22,7 +22,13 @@ require_once('skipifconnectfailure.inc');
require('table.inc');
- $charsets = my_get_charsets($link);
+ // Make sure that client, connection and result charsets are all the
+ // same. Not sure whether this is strictly necessary.
+ if (!mysqli_set_charset($link, 'utf8'))
+ printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+
+ $charsetInfo = mysqli_get_charset($link);
+
if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
@@ -34,19 +40,17 @@ require_once('skipifconnectfailure.inc');
/* label column, result set charset */
$tmp = mysqli_fetch_field($res);
var_dump($tmp);
- if ($tmp->charsetnr != $charsets['results']['nr']) {
+ if ($tmp->charsetnr != $charsetInfo->number) {
printf("[004] Expecting charset %s/%d got %d\n",
- $charsets['results']['charset'],
- $charsets['results']['nr'], $tmp->charsetnr);
+ $charsetInfo->charset, $charsetInfo->number, $tmp->charsetnr);
}
- if ($tmp->length != (1 * $charsets['results']['maxlen'])) {
+ if ($tmp->length != $charsetInfo->max_length) {
printf("[005] Expecting length %d got %d\n",
- $charsets['results']['maxlen'],
- $tmp->max_length);
+ $charsetInfo->max_length, $tmp->max_length);
}
if ($tmp->db != $db) {
printf("011] Expecting database '%s' got '%s'\n",
- $db, $tmp->db);
+ $db, $tmp->db);
}
var_dump(mysqli_fetch_field($res));
@@ -174,4 +178,4 @@ object(stdClass)#%d (13) {
[%u|b%"decimals"]=>
int(0)
}
-done! \ No newline at end of file
+done!
diff --git a/ext/mysqli/tests/mysqli_fetch_field_oo.phpt b/ext/mysqli/tests/mysqli_fetch_field_oo.phpt
index 2d5ad261b1..8c5609b163 100644
--- a/ext/mysqli/tests/mysqli_fetch_field_oo.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_field_oo.phpt
@@ -27,7 +27,12 @@ require_once('skipifconnectfailure.inc');
if (!is_null($tmp = @$res->fetch_field($link)))
printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- $charsets = my_get_charsets($link);
+ // Make sure that client, connection and result charsets are all the
+ // same. Not sure whether this is strictly necessary.
+ if (!$mysqli->set_charset('utf8'))
+ printf("[%d] %s\n", $mysqli->errno, $mysqli->errno);
+
+ $charsetInfo = $mysqli->get_charset();
if (!$res = $mysqli->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
@@ -37,18 +42,16 @@ require_once('skipifconnectfailure.inc');
$tmp = $res->fetch_field();
var_dump($tmp);
- if ($tmp->charsetnr != $charsets['results']['nr']) {
+ if ($tmp->charsetnr != $charsetInfo->number) {
printf("[005] Expecting charset %s/%d got %d\n",
- $charsets['results']['charset'],
- $charsets['results']['nr'], $tmp->charsetnr);
+ $charsetInfo->charset, $charsetInfo->number, $tmp->charsetnr);
}
- if ($tmp->length != (1 * $charsets['results']['maxlen'])) {
+ if ($tmp->length != $charsetInfo->max_length) {
printf("[006] Expecting length %d got %d\n",
- $charsets['results']['maxlen'],
- $tmp->max_length);
+ $charsetInfo->max_length, $tmp->max_length);
}
if ($tmp->db != $db) {
- printf("008] Expecting database '%s' got '%s'\n",
+ printf("[007] Expecting database '%s' got '%s'\n",
$db, $tmp->db);
}
@@ -126,4 +129,4 @@ object(stdClass)#%d (13) {
bool(false)
Warning: mysqli_result::fetch_field(): Couldn't fetch mysqli_result in %s on line %d
-done! \ No newline at end of file
+done!
diff --git a/ext/mysqli/tests/mysqli_fetch_fields.phpt b/ext/mysqli/tests/mysqli_fetch_fields.phpt
index 479c71cbbc..6b66d6f231 100644
--- a/ext/mysqli/tests/mysqli_fetch_fields.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_fields.phpt
@@ -21,7 +21,13 @@ require_once('skipifconnectfailure.inc');
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc');
- $charsets = my_get_charsets($link);
+
+ // Make sure that client, connection and result charsets are all the
+ // same. Not sure whether this is strictly necessary.
+ if (!mysqli_set_charset($link, 'utf8'))
+ printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+
+ $charsetInfo = mysqli_get_charset($link);
if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
@@ -33,14 +39,14 @@ require_once('skipifconnectfailure.inc');
switch ($k) {
case 1:
/* label column, result set charset */
- if ($field->charsetnr != $charsets['results']['nr']) {
+ if ($field->charsetnr != $charsetInfo->number) {
printf("[004] Expecting charset %s/%d got %d\n",
- $charsets['results']['charset'],
- $charsets['results']['nr'], $field->charsetnr);
+ $charsetInfo->charset,
+ $charsetInfo->number, $field->charsetnr);
}
- if ($field->length != (1 * $charsets['results']['maxlen'])) {
+ if ($field->length != $charsetInfo->max_length) {
printf("[005] Expecting length %d got %d\n",
- $charsets['results']['maxlen'],
+ $charsetInfo->max_length,
$field->max_length);
}
break;
@@ -118,4 +124,4 @@ object(stdClass)#%d (13) {
}
Warning: mysqli_fetch_fields(): Couldn't fetch mysqli_result in %s on line %d
-done! \ No newline at end of file
+done!
diff --git a/ext/mysqli/tests/mysqli_field_seek.phpt b/ext/mysqli/tests/mysqli_field_seek.phpt
index a747bdfa01..449d2f90d4 100644
--- a/ext/mysqli/tests/mysqli_field_seek.phpt
+++ b/ext/mysqli/tests/mysqli_field_seek.phpt
@@ -66,7 +66,13 @@ require_once('skipifconnectfailure.inc');
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc');
- $charsets = my_get_charsets($link);
+
+ // Make sure that client, connection and result charsets are all the
+ // same. Not sure whether this is strictly necessary.
+ if (!mysqli_set_charset($link, 'utf8'))
+ printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+
+ $charsetInfo = mysqli_get_charset($link);
if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1", MYSQLI_USE_RESULT)) {
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
@@ -81,15 +87,13 @@ require_once('skipifconnectfailure.inc');
$field = mysqli_fetch_field($res);
var_dump($field);
/* label column, result set charset */
- if ($field->charsetnr != $charsets['results']['nr']) {
+ if ($field->charsetnr != $charsetInfo->number) {
printf("[004] Expecting charset %s/%d got %d\n",
- $charsets['results']['charset'],
- $charsets['results']['nr'], $field->charsetnr);
+ $charsetInfo->charset, $charsetInfo->number, $field->charsetnr);
}
- if ($field->length != (1 * $charsets['results']['maxlen'])) {
+ if ($field->length != $charsetInfo->max_length) {
printf("[005] Expecting length %d got %d\n",
- $charsets['results']['maxlen'],
- $field->max_length);
+ $charsetInfo->max_length, $field->max_length);
}
var_dump(mysqli_field_tell($res));
@@ -217,7 +221,7 @@ bool(false)
Warning: mysqli_field_seek(): Invalid field offset in %s on line %d
bool(false)
bool(true)
-object(stdClass)#3 (13) {
+object(stdClass)#%d (13) {
[%u|b%"name"]=>
%unicode|string%(5) "_null"
[%u|b%"orgname"]=>
@@ -248,4 +252,4 @@ object(stdClass)#3 (13) {
Warning: mysqli_field_seek(): Couldn't fetch mysqli_result in %s on line %d
NULL
-done! \ No newline at end of file
+done!
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt
index afaccaf3c7..739bf56ea1 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt
@@ -12,7 +12,13 @@ if (!function_exists('mysqli_stmt_get_result'))
--FILE--
<?php
require('table.inc');
- $charsets = my_get_charsets($link);
+
+ // Make sure that client, connection and result charsets are all the
+ // same. Not sure whether this is strictly necessary.
+ if (!mysqli_set_charset($link, 'utf8'))
+ printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+
+ $charsetInfo = mysqli_get_charset($link);
if (!($stmt = mysqli_stmt_init($link)) ||
!mysqli_stmt_prepare($stmt, "SELECT id, label, id + 1 as _id, concat(label, '_') ___label FROM test ORDER BY id ASC LIMIT 3") ||
@@ -39,15 +45,14 @@ if (!function_exists('mysqli_stmt_get_result'))
Label column, result set charset.
All of the following columns are "too hot" - too server dependent
*/
- if ($field->charsetnr != $charsets['results']['nr']) {
+ if ($field->charsetnr != $charsetInfo->number) {
printf("[004] Expecting charset %s/%d got %d\n",
- $charsets['results']['charset'],
- $charsets['results']['nr'], $field->charsetnr);
+ $charsetInfo->charset,
+ $charsetInfo->number, $field->charsetnr);
}
- if ($field->length != (1 * $charsets['results']['maxlen'])) {
+ if ($field->length != $charsetInfo->max_length) {
printf("[005] Expecting length %d got %d\n",
- $charsets['results']['maxlen'],
- $field->max_length);
+ $charsetInfo->max_length, $field->max_length);
}
}
}
@@ -173,4 +178,4 @@ object(stdClass)#%d (13) {
[%u|b%"decimals"]=>
int(31)
}
-done! \ No newline at end of file
+done!
diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c
index 9a907a5644..d7462f77a5 100644
--- a/ext/mysqlnd/mysqlnd.c
+++ b/ext/mysqlnd/mysqlnd.c
@@ -622,19 +622,19 @@ mysqlnd_run_authentication(
}
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);
}
-
+end:
+ if (plugin_data) {
+ mnd_efree(plugin_data);
+ }
if (requested_protocol) {
mnd_efree(requested_protocol);
}
-end:
+
DBG_RETURN(ret);
}
/* }}} */
@@ -838,6 +838,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn,
MYSQLND_NET * net = conn->net;
DBG_ENTER("mysqlnd_conn_data::connect");
+ DBG_INF_FMT("conn=%p", conn);
if (PASS != conn->m->local_tx_start(conn, this_func TSRMLS_CC)) {
goto err;
@@ -1149,7 +1150,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, query)(MYSQLND_CONN_DATA * conn, const char *
size_t this_func = STRUCT_OFFSET(struct st_mysqlnd_conn_data_methods, query);
enum_func_status ret = FAIL;
DBG_ENTER("mysqlnd_conn_data::query");
- DBG_INF_FMT("conn=%llu query=%s", conn->thread_id, query);
+ DBG_INF_FMT("conn=%p conn=%llu query=%s", conn, conn->thread_id, query);
if (PASS == conn->m->local_tx_start(conn, this_func TSRMLS_CC)) {
if (PASS == conn->m->send_query(conn, query, query_len TSRMLS_CC) &&
@@ -1883,10 +1884,10 @@ 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 */
+ net->data->m.close_stream(net, conn->stats, conn->error_info TSRMLS_CC);
break;
}
@@ -2446,7 +2447,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, store_result)(MYSQLND_CONN_DATA * const conn T
MYSQLND_RES * result = NULL;
DBG_ENTER("mysqlnd_conn_data::store_result");
- DBG_INF_FMT("conn=%llu", conn->thread_id);
+ DBG_INF_FMT("conn=%llu conn=%p", conn->thread_id, conn);
if (PASS == conn->m->local_tx_start(conn, this_func TSRMLS_CC)) {
do {
diff --git a/ext/mysqlnd/mysqlnd_alloc.c b/ext/mysqlnd/mysqlnd_alloc.c
index 65423e44fa..e681d33856 100644
--- a/ext/mysqlnd/mysqlnd_alloc.c
+++ b/ext/mysqlnd/mysqlnd_alloc.c
@@ -81,9 +81,11 @@ void * _mysqlnd_emalloc(size_t size MYSQLND_MEM_D)
#if PHP_DEBUG
long * threshold = &MYSQLND_G(debug_emalloc_fail_threshold);
#endif
+ char * fn = NULL;
TRACE_ALLOC_ENTER(mysqlnd_emalloc_name);
- TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_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" */
@@ -116,9 +118,10 @@ 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
+ char * fn = NULL;
TRACE_ALLOC_ENTER(mysqlnd_pemalloc_name);
TRACE_ALLOC_INF_FMT("file=%-15s line=%4d persistent=%u",
- strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno,persistent);
+ (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno, persistent);
#if PHP_DEBUG
/* -1 is also "true" */
@@ -154,8 +157,10 @@ void * _mysqlnd_ecalloc(unsigned int nmemb, size_t size MYSQLND_MEM_D)
#if PHP_DEBUG
long * threshold = &MYSQLND_G(debug_ecalloc_fail_threshold);
#endif
+ char * fn = NULL;
TRACE_ALLOC_ENTER(mysqlnd_ecalloc_name);
- TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_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);
TRACE_ALLOC_INF_FMT("before: %lu", zend_memory_usage(FALSE TSRMLS_CC));
#if PHP_DEBUG
@@ -189,9 +194,10 @@ 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
+ char * fn = NULL;
TRACE_ALLOC_ENTER(mysqlnd_pecalloc_name);
TRACE_ALLOC_INF_FMT("file=%-15s line=%4d persistent=%u",
- strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno, persistent);
+ (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno, persistent);
#if PHP_DEBUG
/* -1 is also "true" */
@@ -228,8 +234,10 @@ void * _mysqlnd_erealloc(void *ptr, size_t new_size MYSQLND_MEM_D)
#if PHP_DEBUG
long * threshold = &MYSQLND_G(debug_erealloc_fail_threshold);
#endif
+ char * fn = NULL;
TRACE_ALLOC_ENTER(mysqlnd_erealloc_name);
- TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_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);
TRACE_ALLOC_INF_FMT("ptr=%p old_size=%lu, new_size=%lu", ptr, old_size, new_size);
#if PHP_DEBUG
@@ -263,8 +271,10 @@ 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
+ char * fn = NULL;
TRACE_ALLOC_ENTER(mysqlnd_perealloc_name);
- TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_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);
TRACE_ALLOC_INF_FMT("ptr=%p old_size=%lu new_size=%lu persistent=%u", ptr, old_size, new_size, persistent);
#if PHP_DEBUG
@@ -297,8 +307,10 @@ void _mysqlnd_efree(void *ptr MYSQLND_MEM_D)
{
size_t free_amount = 0;
zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
+ char * fn = NULL;
TRACE_ALLOC_ENTER(mysqlnd_efree_name);
- TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_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);
TRACE_ALLOC_INF_FMT("ptr=%p", ptr);
if (ptr) {
@@ -322,8 +334,10 @@ 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);
+ char * fn = NULL;
TRACE_ALLOC_ENTER(mysqlnd_pefree_name);
- TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_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);
TRACE_ALLOC_INF_FMT("ptr=%p persistent=%u", ptr, persistent);
if (ptr) {
@@ -351,8 +365,10 @@ void * _mysqlnd_malloc(size_t size MYSQLND_MEM_D)
#if PHP_DEBUG
long * threshold = &MYSQLND_G(debug_malloc_fail_threshold);
#endif
+ char * fn = NULL;
TRACE_ALLOC_ENTER(mysqlnd_malloc_name);
- TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_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" */
@@ -384,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
+ char * fn = NULL;
TRACE_ALLOC_ENTER(mysqlnd_calloc_name);
- TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_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" */
@@ -417,8 +435,10 @@ void * _mysqlnd_realloc(void *ptr, size_t new_size MYSQLND_MEM_D)
#if PHP_DEBUG
long * threshold = &MYSQLND_G(debug_realloc_fail_threshold);
#endif
+ char * fn = NULL;
TRACE_ALLOC_ENTER(mysqlnd_realloc_name);
- TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_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);
TRACE_ALLOC_INF_FMT("ptr=%p new_size=%lu ", new_size, ptr);
TRACE_ALLOC_INF_FMT("before: %lu", zend_memory_usage(TRUE TSRMLS_CC));
@@ -450,8 +470,10 @@ void _mysqlnd_free(void *ptr MYSQLND_MEM_D)
{
size_t free_amount = 0;
zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
+ char * fn = NULL;
TRACE_ALLOC_ENTER(mysqlnd_free_name);
- TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_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);
TRACE_ALLOC_INF_FMT("ptr=%p", ptr);
if (ptr) {
@@ -479,8 +501,10 @@ 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);
+ char * fn = NULL;
TRACE_ALLOC_ENTER(mysqlnd_pestrndup_name);
- TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_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);
TRACE_ALLOC_INF_FMT("ptr=%p", ptr);
ret = (persistent) ? __zend_malloc(REAL_SIZE(length + 1)) : _emalloc(REAL_SIZE(length + 1) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
@@ -511,8 +535,10 @@ 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);
+ char * fn = NULL;
TRACE_ALLOC_ENTER(mysqlnd_pestrdup_name);
- TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_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);
TRACE_ALLOC_INF_FMT("ptr=%p", ptr);
do {
smart_str_appendc(&tmp_str, *p);
diff --git a/ext/mysqlnd/mysqlnd_debug.c b/ext/mysqlnd/mysqlnd_debug.c
index cf355d2ffb..5ed2f83731 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) {
diff --git a/ext/mysqlnd/mysqlnd_debug.h b/ext/mysqlnd/mysqlnd_debug.h
index 3441dc74e1..272cdb20e5 100644
--- a/ext/mysqlnd/mysqlnd_debug.h
+++ b/ext/mysqlnd/mysqlnd_debug.h
@@ -126,7 +126,7 @@ PHPAPI char * mysqlnd_get_backtrace(uint max_levels, size_t * length TSRMLS_DC);
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 */\
+ if (dbg_skip_trace); /* shut compiler's mouth */\
do { \
if (((dbg_obj1) && (dbg_obj1)->flags & MYSQLND_DEBUG_PROFILE_CALLS) || \
((dbg_obj2) && (dbg_obj2)->flags & MYSQLND_DEBUG_PROFILE_CALLS)) \
diff --git a/ext/oci8/tests/bind_char_2_11gR1.phpt b/ext/oci8/tests/bind_char_2_11gR1.phpt
index 8bb28733fe..edb2a12ff0 100644
--- a/ext/oci8/tests/bind_char_2_11gR1.phpt
+++ b/ext/oci8/tests/bind_char_2_11gR1.phpt
@@ -5,7 +5,7 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR and dates
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
// The bind buffer size edge cases seem to change each DB version.
-if (preg_match('/Release 11\.1\./', $sv, $matches) !== 1) {
+if (preg_match('/Release 11\.1\./', oci_server_version($c), $matches) !== 1) {
if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) {
die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases");
}
diff --git a/ext/oci8/tests/bind_char_3_11gR1.phpt b/ext/oci8/tests/bind_char_3_11gR1.phpt
index 4c6241ccfd..fea77754d1 100644
--- a/ext/oci8/tests/bind_char_3_11gR1.phpt
+++ b/ext/oci8/tests/bind_char_3_11gR1.phpt
@@ -5,7 +5,7 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to CHAR parameter
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
// The bind buffer size edge cases seem to change each DB version.
-if (preg_match('/Release 11\.1\./', $sv, $matches) !== 1) {
+if (preg_match('/Release 11\.1\./', oci_server_version($c), $matches) !== 1) {
if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) {
die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases");
}
diff --git a/ext/oci8/tests/bind_char_4_11gR1.phpt b/ext/oci8/tests/bind_char_4_11gR1.phpt
index 14d5878856..2bc2f14246 100644
--- a/ext/oci8/tests/bind_char_4_11gR1.phpt
+++ b/ext/oci8/tests/bind_char_4_11gR1.phpt
@@ -5,7 +5,7 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to VARCHAR2 parameter
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
// The bind buffer size edge cases seem to change each DB version.
-if (preg_match('/Release 11\.1\./', $sv, $matches) !== 1) {
+if (preg_match('/Release 11\.1\./', oci_server_version($c), $matches) !== 1) {
if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) {
die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases");
}
diff --git a/ext/oci8/tests/details.inc b/ext/oci8/tests/details.inc
index 0f03c3a65f..9a86c46868 100644
--- a/ext/oci8/tests/details.inc
+++ b/ext/oci8/tests/details.inc
@@ -45,31 +45,34 @@ if (file_exists(dirname(__FILE__)."/details_local.inc")) {
* Used for creating/dropping schema objects used by a test
*/
-function oci8_test_sql_execute($c, $stmtarray)
-{
- foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- if (!$s) {
- $m = oci_error($c);
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- else {
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- , 1918 // user does not exist
- , 2024 // database link not found
- , 2289 // sequence does not exist
- , 4080 // trigger does not exist
- , 38802 // edition does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
- }
- }
+if (!function_exists('oci8_test_sql_execute')) {
+ function oci8_test_sql_execute($c, $stmtarray)
+ {
+ foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ if (!$s) {
+ $m = oci_error($c);
+ echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
+ }
+ else {
+ $r = @oci_execute($s);
+ if (!$r) {
+ $m = oci_error($s);
+ if (!in_array($m['code'], array( // ignore expected errors
+ 942 // table or view does not exist
+ , 1918 // user does not exist
+ , 2024 // database link not found
+ , 2289 // sequence does not exist
+ , 4080 // trigger does not exist
+ , 38802 // edition does not exist
+ ))) {
+ echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
+ }
+ }
+ }
+ }
+ }
+
}
?>
diff --git a/ext/oci8/tests/pecl_bug10194.phpt b/ext/oci8/tests/pecl_bug10194.phpt
index 9947e15dbc..3c1c7887c2 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.phpt b/ext/oci8/tests/pecl_bug10194_blob.phpt
index faf87ab3c1..96f94bcf4c 100644
--- a/ext/oci8/tests/pecl_bug10194_blob.phpt
+++ b/ext/oci8/tests/pecl_bug10194_blob.phpt
@@ -6,6 +6,9 @@ $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on t
require(dirname(__FILE__).'/skipif.inc');
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only");
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=3M
diff --git a/ext/oci8/tests/pecl_bug10194_blob_64.phpt b/ext/oci8/tests/pecl_bug10194_blob_64.phpt
index 45788a41b4..e1a4cc034e 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/oci8/tests/xmltype_01.phpt b/ext/oci8/tests/xmltype_01.phpt
index 21aca6cc12..ebbbb31fac 100644
--- a/ext/oci8/tests/xmltype_01.phpt
+++ b/ext/oci8/tests/xmltype_01.phpt
@@ -5,6 +5,7 @@ Basic XMLType test
if (!extension_loaded("simplexml")) die("skip no simplexml extension");
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 6b0a41fbed..6d393a26a7 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -275,7 +275,8 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
get to the end without encountering a delimiter. */
while (isspace((int)*(unsigned char *)p)) p++;
if (*p == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty regular expression");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,
+ p < regex + regex_len ? "Null byte in regex" : "Empty regular expression");
return NULL;
}
@@ -292,21 +293,18 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
delimiter = pp[5];
end_delimiter = delimiter;
+ pp = p;
+
if (start_delimiter == end_delimiter) {
/* We need to iterate through the pattern, searching for the ending delimiter,
but skipping the backslashed delimiters. If the ending delimiter is not
found, display a warning. */
- pp = p;
while (*pp != 0) {
if (*pp == '\\' && pp[1] != 0) pp++;
else if (*pp == delimiter)
break;
pp++;
}
- if (*pp == 0) {
- php_error_docref(NULL TSRMLS_CC,E_WARNING, "No ending delimiter '%c' found", delimiter);
- return NULL;
- }
} else {
/* We iterate through the pattern, searching for the matching ending
* delimiter. For each matching starting delimiter, we increment nesting
@@ -314,7 +312,6 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
* reach the end of the pattern without matching, display a warning.
*/
int brackets = 1; /* brackets nesting level */
- pp = p;
while (*pp != 0) {
if (*pp == '\\' && pp[1] != 0) pp++;
else if (*pp == end_delimiter && --brackets <= 0)
@@ -323,10 +320,17 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
brackets++;
pp++;
}
- if (*pp == 0) {
- php_error_docref(NULL TSRMLS_CC,E_WARNING, "No ending matching delimiter '%c' found", end_delimiter);
- return NULL;
+ }
+
+ if (*pp == 0) {
+ if (pp < regex + regex_len) {
+ php_error_docref(NULL TSRMLS_CC,E_WARNING, "Null byte in regex");
+ } else if (start_delimiter == end_delimiter) {
+ php_error_docref(NULL TSRMLS_CC,E_WARNING, "No ending delimiter '%c' found", delimiter);
+ } else {
+ php_error_docref(NULL TSRMLS_CC,E_WARNING, "No ending matching delimiter '%c' found", delimiter);
}
+ return NULL;
}
/* Make a copy of the actual pattern. */
@@ -337,7 +341,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
/* Parse through the options, setting appropriate flags. Display
a warning if we encounter an unknown modifier. */
- while (*pp != 0) {
+ while (pp < regex + regex_len) {
switch (*pp++) {
/* Perl compatible options */
case 'i': coptions |= PCRE_CASELESS; break;
@@ -368,7 +372,11 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
break;
default:
- php_error_docref(NULL TSRMLS_CC,E_WARNING, "Unknown modifier '%c'", pp[-1]);
+ if (pp[-1]) {
+ php_error_docref(NULL TSRMLS_CC,E_WARNING, "Unknown modifier '%c'", pp[-1]);
+ } else {
+ php_error_docref(NULL TSRMLS_CC,E_WARNING, "Null byte in regex");
+ }
efree(pattern);
return NULL;
}
diff --git a/ext/pcre/tests/null_bytes.phpt b/ext/pcre/tests/null_bytes.phpt
new file mode 100644
index 0000000000..9a3f433ffb
--- /dev/null
+++ b/ext/pcre/tests/null_bytes.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Zero byte test
+--FILE--
+<?php
+
+preg_match("\0//i", "");
+preg_match("/\0/i", "");
+preg_match("//\0i", "");
+preg_match("//i\0", "");
+preg_match("/\\\0/i", "");
+
+preg_match("\0[]i", "");
+preg_match("[\0]i", "");
+preg_match("[]\0i", "");
+preg_match("[]i\0", "");
+preg_match("[\\\0]i", "");
+
+preg_replace("/foo/e\0/i", "echo('Eek');", "");
+
+?>
+--EXPECTF--
+Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 3
+
+Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 4
+
+Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 5
+
+Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 6
+
+Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 7
+
+Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 9
+
+Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 10
+
+Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 11
+
+Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 12
+
+Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 13
+
+Warning: preg_replace(): Null byte in regex in %snull_bytes.php on line 15
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index b4f383c94f..acdc0dd90d 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/bug_43130.phpt b/ext/pdo/tests/bug_43130.phpt
index a35138a07f..70f8887111 100644
--- a/ext/pdo/tests/bug_43130.phpt
+++ b/ext/pdo/tests/bug_43130.phpt
@@ -8,6 +8,7 @@ if (false == $dir) die('skip no driver');
if (!strncasecmp(getenv('PDOTEST_DSN'), 'sqlite', strlen('sqlite'))) die('skip not relevant for sqlite driver');
if (!strncasecmp(getenv('PDOTEST_DSN'), 'pgsql', strlen('pgsql'))) die('skip not relevant for pgsql driver');
if (!strncasecmp(getenv('PDOTEST_DSN'), 'oci', strlen('oci'))) die('skip not relevant for oci driver - Hyphen is not legal for bind names in Oracle DB');
+if (!strncasecmp(getenv('PDOTEST_DSN'), 'firebird', strlen('firebird'))) die('skip not relevant for firebird driver');
require_once $dir . 'pdo_test.inc';
PDOTest::skip();
?>
diff --git a/ext/pdo/tests/pdo_test.inc b/ext/pdo/tests/pdo_test.inc
index f2e076793a..443c8dd822 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 cedc2c45b2..12cd782f26 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--
<?php extension_loaded("pdo_firebird") or die("skip"); ?>
+<?php function_exists("ibase_query") or die("skip"); ?>
--FILE--
<?php
diff --git a/ext/pdo_firebird/tests/bug_48877.phpt b/ext/pdo_firebird/tests/bug_48877.phpt
index 290cd7a3a0..cbab84b372 100644
--- a/ext/pdo_firebird/tests/bug_48877.phpt
+++ b/ext/pdo_firebird/tests/bug_48877.phpt
@@ -2,6 +2,7 @@
PDO_Firebird: bug 48877 The "bindValue" and "bindParam" do not work for PDO Firebird if we use named parameters (:parameter).
--SKIPIF--
<?php extension_loaded("pdo_firebird") or die("skip"); ?>
+<?php function_exists("ibase_query") or die("skip"); ?>
--FILE--
<?php
diff --git a/ext/pdo_firebird/tests/bug_53280.phpt b/ext/pdo_firebird/tests/bug_53280.phpt
index 1be4e8a826..3139867af1 100644
--- a/ext/pdo_firebird/tests/bug_53280.phpt
+++ b/ext/pdo_firebird/tests/bug_53280.phpt
@@ -2,6 +2,7 @@
PDO_Firebird: bug 53280 segfaults if query column count is less than param count
--SKIPIF--
<?php extension_loaded("pdo_firebird") or die("skip"); ?>
+<?php function_exists("ibase_query") or die("skip"); ?>
--FILE--
<?php
diff --git a/ext/pdo_firebird/tests/connect.phpt b/ext/pdo_firebird/tests/connect.phpt
index e4bb8ef54e..cbe76e6865 100644
--- a/ext/pdo_firebird/tests/connect.phpt
+++ b/ext/pdo_firebird/tests/connect.phpt
@@ -2,6 +2,7 @@
PDO_Firebird: connect/disconnect
--SKIPIF--
<?php include("skipif.inc"); ?>
+<?php function_exists("ibase_query") or die("skip"); ?>
--FILE--
<?php /* $Id$ */
diff --git a/ext/pdo_firebird/tests/ddl.phpt b/ext/pdo_firebird/tests/ddl.phpt
index 9a3ddd1002..9d2a0953ec 100644
--- a/ext/pdo_firebird/tests/ddl.phpt
+++ b/ext/pdo_firebird/tests/ddl.phpt
@@ -2,6 +2,7 @@
PDO_Firebird: DDL/transactions
--SKIPIF--
<?php include("skipif.inc"); ?>
+<?php function_exists("ibase_query") or die("skip"); ?>
--FILE--
<?php /* $Id$ */
diff --git a/ext/pdo_firebird/tests/execute.phpt b/ext/pdo_firebird/tests/execute.phpt
index 3a759fc51b..896347e935 100644
--- a/ext/pdo_firebird/tests/execute.phpt
+++ b/ext/pdo_firebird/tests/execute.phpt
@@ -2,6 +2,7 @@
PDO_Firebird: prepare/execute/binding
--SKIPIF--
<?php include("skipif.inc"); ?>
+<?php function_exists("ibase_query") or die("skip"); ?>
--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 3d7f71c83b..1a009508e0 100644
--- a/ext/pdo_firebird/tests/rowCount.phpt
+++ b/ext/pdo_firebird/tests/rowCount.phpt
@@ -2,6 +2,7 @@
PDO_Firebird: rowCount
--SKIPIF--
<?php extension_loaded("pdo_firebird") or die("skip"); ?>
+<?php function_exists("ibase_query") or die("skip"); ?>
--FILE--
<?php /* $Id$ */
diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c
index 4e039d2a74..e700ef8c3c 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 f64da1a438..276f2b78e3 100644
--- a/ext/pdo_odbc/tests/common.phpt
+++ b/ext/pdo_odbc/tests/common.phpt
@@ -2,17 +2,40 @@
ODBC
--SKIPIF--
<?php # vim:ft=php
-if (!extension_loaded('pdo_odbc')) print 'skip'; ?>
+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 65ec2f96e9..e3430ded47 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--
<?php # vim:ft=php
if (!extension_loaded('pdo_odbc')) print 'skip not loaded';
+// make sure there is an ODBC driver and a DSN, or the test will fail
+include 'ext/pdo/tests/pdo_test.inc';
+$config = PDOTest::get_config('ext/pdo_odbc/tests/common.phpt');
+if (!isset($config['ENV']['PDOTEST_DSN']) || $config['ENV']['PDOTEST_DSN']===false) print 'skip';
?>
--FILE--
<?php
+// setup: set PDOTEST_DSN environment variable
+// for MyODBC (MySQL) and MS SQL Server, you need to also set PDOTEST_USER and PDOTEST_PASS
+//
+// can use MS SQL Server on Linux - using unixODBC
+// -RHEL6.2
+// -download & instructions: http://www.microsoft.com/en-us/download/details.aspx?id=28160
+// -Linux6\sqlncli-11.0.1790.0.tar.gz (it calls RHEL6.x 'Linux6' for some reason)
+// -follow instructions on web page and install script
+// -may have to specify connection info in connection string without using a DSN (DSN-less connection)
+// -for example:
+// set PDOTEST_DSN='odbc:Driver=SQL Server Native Client 11.0;Server=10.200.51.179;Database=testdb'
+// set PDOTEST_USER=sa
+// set PDOTEST_PASS=Password01
+//
+// on Windows, the easy way to do this:
+// 1. install MS Access (part of MS Office) and include ODBC (Development tools feature)
+// install the x86 build of the Drivers. You might not be able to load the x64 drivers.
+// 2. in Control Panel, search for ODBC and open "Setup data sources (ODBC)"
+// 3. click on System DSN tab
+// 4. click Add and choose "Microsoft Access Driver (*.mdb, *.accdb)" driver
+// 5. enter a DSN, ex: accdb12
+// 6. click 'Create' and select a file to save the database as
+// -otherwise, you'll have to open MS Access, create a database, then load that file in this Window to map it to a DSN
+// 7. set the environment variable PDOTEST_DSN="odbc:<system dsn from step 5>" 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/phar/phar.c b/ext/phar/phar.c
index 2a47d3d035..cc7eac717d 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -2647,11 +2647,8 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert,
len = -len;
}
user_stub = 0;
-#if PHP_MAJOR_VERSION >= 6
- if (!(len = php_stream_copy_to_mem(stubfile, (void **) &user_stub, len, 0)) || !user_stub) {
-#else
+
if (!(len = php_stream_copy_to_mem(stubfile, &user_stub, len, 0)) || !user_stub) {
-#endif
if (closeoldfile) {
php_stream_close(oldfile);
}
diff --git a/ext/phar/phar/pharcommand.inc b/ext/phar/phar/pharcommand.inc
index 9e968694c3..cb343675b5 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' => '<method> Selects the hash algorithmn.',
+ 'inf' => '<method> 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' => '<level> Number of preceeding subdirectories to strip from file entries',
+ 'inf' => '<level> 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/phar_object.c b/ext/phar/phar_object.c
index de9fffc115..561ba7bf24 100644
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -58,9 +58,6 @@ static int phar_file_type(HashTable *mimes, char *file, char **mime_type TSRMLS_
static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char *basename, int request_uri_len TSRMLS_DC) /* {{{ */
{
-#if PHP_MAJOR_VERSION >= 6
- int is_unicode = 0;
-#endif
HashTable *_SERVER;
zval **stuff;
char *path_info;
@@ -76,18 +73,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char
_SERVER = Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]);
/* PATH_INFO and PATH_TRANSLATED should always be munged */
-#if PHP_MAJOR_VERSION >= 6
- if (phar_find_key(_SERVER, "PATH_INFO", sizeof("PATH_INFO"), (void **) &stuff TSRMLS_CC)) {
- if (Z_TYPE_PP(stuff) == IS_UNICODE) {
- is_unicode = 1;
- zval_unicode_to_string(*stuff TSRMLS_CC);
- } else {
- is_unicode = 0;
- }
-#else
if (SUCCESS == zend_hash_find(_SERVER, "PATH_INFO", sizeof("PATH_INFO"), (void **) &stuff)) {
-#endif
-
path_info = Z_STRVAL_PP(stuff);
code = Z_STRLEN_PP(stuff);
@@ -96,38 +82,19 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char
MAKE_STD_ZVAL(temp);
ZVAL_STRINGL(temp, path_info, code, 0);
-#if PHP_MAJOR_VERSION >= 6
- if (is_unicode) {
- zval_string_to_unicode(*stuff TSRMLS_CC);
- }
-#endif
+
zend_hash_update(_SERVER, "PHAR_PATH_INFO", sizeof("PHAR_PATH_INFO"), &temp, sizeof(zval **), NULL);
}
}
-#if PHP_MAJOR_VERSION >= 6
- if (phar_find_key(_SERVER, "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"), (void **) &stuff TSRMLS_CC)) {
- if (Z_TYPE_PP(stuff) == IS_UNICODE) {
- is_unicode = 1;
- zval_unicode_to_string(*stuff TSRMLS_CC);
- } else {
- is_unicode = 0;
- }
-#else
if (SUCCESS == zend_hash_find(_SERVER, "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"), (void **) &stuff)) {
-#endif
-
path_info = Z_STRVAL_PP(stuff);
code = Z_STRLEN_PP(stuff);
Z_STRLEN_PP(stuff) = spprintf(&(Z_STRVAL_PP(stuff)), 4096, "phar://%s%s", fname, entry);
MAKE_STD_ZVAL(temp);
ZVAL_STRINGL(temp, path_info, code, 0);
-#if PHP_MAJOR_VERSION >= 6
- if (is_unicode) {
- zval_string_to_unicode(*stuff TSRMLS_CC);
- }
-#endif
+
zend_hash_update(_SERVER, "PHAR_PATH_TRANSLATED", sizeof("PHAR_PATH_TRANSLATED"), (void *) &temp, sizeof(zval **), NULL);
}
@@ -136,18 +103,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char
}
if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_REQUEST_URI) {
-#if PHP_MAJOR_VERSION >= 6
- if (phar_find_key(_SERVER, "REQUEST_URI", sizeof("REQUEST_URI"), (void **) &stuff TSRMLS_CC)) {
- if (Z_TYPE_PP(stuff) == IS_UNICODE) {
- is_unicode = 1;
- zval_unicode_to_string(*stuff TSRMLS_CC);
- } else {
- is_unicode = 0;
- }
-#else
if (SUCCESS == zend_hash_find(_SERVER, "REQUEST_URI", sizeof("REQUEST_URI"), (void **) &stuff)) {
-#endif
-
path_info = Z_STRVAL_PP(stuff);
code = Z_STRLEN_PP(stuff);
@@ -156,29 +112,14 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char
MAKE_STD_ZVAL(temp);
ZVAL_STRINGL(temp, path_info, code, 0);
-#if PHP_MAJOR_VERSION >= 6
- if (is_unicode) {
- zval_string_to_unicode(*stuff TSRMLS_CC);
- }
-#endif
+
zend_hash_update(_SERVER, "PHAR_REQUEST_URI", sizeof("PHAR_REQUEST_URI"), (void *) &temp, sizeof(zval **), NULL);
}
}
}
if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_PHP_SELF) {
-#if PHP_MAJOR_VERSION >= 6
- if (phar_find_key(_SERVER, "PHP_SELF", sizeof("PHP_SELF"), (void **) &stuff TSRMLS_CC)) {
- if (Z_TYPE_PP(stuff) == IS_UNICODE) {
- is_unicode = 1;
- zval_unicode_to_string(*stuff TSRMLS_CC);
- } else {
- is_unicode = 0;
- }
-#else
if (SUCCESS == zend_hash_find(_SERVER, "PHP_SELF", sizeof("PHP_SELF"), (void **) &stuff)) {
-#endif
-
path_info = Z_STRVAL_PP(stuff);
code = Z_STRLEN_PP(stuff);
@@ -187,68 +128,34 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char
MAKE_STD_ZVAL(temp);
ZVAL_STRINGL(temp, path_info, code, 0);
-#if PHP_MAJOR_VERSION >= 6
- if (is_unicode) {
- zval_string_to_unicode(*stuff TSRMLS_CC);
- }
-#endif
+
zend_hash_update(_SERVER, "PHAR_PHP_SELF", sizeof("PHAR_PHP_SELF"), (void *) &temp, sizeof(zval **), NULL);
}
}
}
if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_SCRIPT_NAME) {
-#if PHP_MAJOR_VERSION >= 6
- if (phar_find_key(_SERVER, "SCRIPT_NAME", sizeof("SCRIPT_NAME"), (void **) &stuff TSRMLS_CC)) {
- if (Z_TYPE_PP(stuff) == IS_UNICODE) {
- is_unicode = 1;
- zval_unicode_to_string(*stuff TSRMLS_CC);
- } else {
- is_unicode = 0;
- }
-#else
if (SUCCESS == zend_hash_find(_SERVER, "SCRIPT_NAME", sizeof("SCRIPT_NAME"), (void **) &stuff)) {
-#endif
-
path_info = Z_STRVAL_PP(stuff);
code = Z_STRLEN_PP(stuff);
ZVAL_STRINGL(*stuff, entry, entry_len, 1);
MAKE_STD_ZVAL(temp);
ZVAL_STRINGL(temp, path_info, code, 0);
-#if PHP_MAJOR_VERSION >= 6
- if (is_unicode) {
- zval_string_to_unicode(*stuff TSRMLS_CC);
- }
-#endif
+
zend_hash_update(_SERVER, "PHAR_SCRIPT_NAME", sizeof("PHAR_SCRIPT_NAME"), (void *) &temp, sizeof(zval **), NULL);
}
}
if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_SCRIPT_FILENAME) {
-#if PHP_MAJOR_VERSION >= 6
- if (phar_find_key(_SERVER, "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME"), (void **) &stuff TSRMLS_CC)) {
- if (Z_TYPE_PP(stuff) == IS_UNICODE) {
- is_unicode = 1;
- zval_unicode_to_string(*stuff TSRMLS_CC);
- } else {
- is_unicode = 0;
- }
-#else
if (SUCCESS == zend_hash_find(_SERVER, "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME"), (void **) &stuff)) {
-#endif
-
path_info = Z_STRVAL_PP(stuff);
code = Z_STRLEN_PP(stuff);
Z_STRLEN_PP(stuff) = spprintf(&(Z_STRVAL_PP(stuff)), 4096, "phar://%s%s", fname, entry);
MAKE_STD_ZVAL(temp);
ZVAL_STRINGL(temp, path_info, code, 0);
-#if PHP_MAJOR_VERSION >= 6
- if (is_unicode) {
- zval_string_to_unicode(*stuff TSRMLS_CC);
- }
-#endif
+
zend_hash_update(_SERVER, "PHAR_SCRIPT_FILENAME", sizeof("PHAR_SCRIPT_FILENAME"), (void *) &temp, sizeof(zval **), NULL);
}
}
@@ -942,11 +849,7 @@ PHP_METHOD(Phar, webPhar)
if (ext) {
++ext;
-#if PHP_MAJOR_VERSION >= 6
- if (phar_find_key(Z_ARRVAL_P(mimeoverride), ext, strlen(ext)+1, (void **) &val TSRMLS_CC)) {
-#else
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(mimeoverride), ext, strlen(ext)+1, (void **) &val)) {
-#endif
switch (Z_TYPE_PP(val)) {
case IS_LONG:
if (Z_LVAL_PP(val) == PHAR_MIME_PHP || Z_LVAL_PP(val) == PHAR_MIME_PHPS) {
@@ -960,11 +863,6 @@ PHP_METHOD(Phar, webPhar)
RETURN_FALSE;
}
break;
-#if PHP_MAJOR_VERSION >= 6
- case IS_UNICODE:
- zval_unicode_to_string(*(val) TSRMLS_CC);
- /* break intentionally omitted */
-#endif
case IS_STRING:
mime_type = Z_STRVAL_PP(val);
code = PHAR_MIME_OTHER;
@@ -1015,26 +913,12 @@ PHP_METHOD(Phar, mungServer)
for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(mungvalues)); SUCCESS == zend_hash_has_more_elements(Z_ARRVAL_P(mungvalues)); zend_hash_move_forward(Z_ARRVAL_P(mungvalues))) {
zval **data = NULL;
-#if PHP_MAJOR_VERSION >= 6
- zval *unicopy = NULL;
-#endif
if (SUCCESS != zend_hash_get_current_data(Z_ARRVAL_P(mungvalues), (void **) &data)) {
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "unable to retrieve array value in Phar::mungServer()");
return;
}
-#if PHP_MAJOR_VERSION >= 6
- if (Z_TYPE_PP(data) == IS_UNICODE) {
- MAKE_STD_ZVAL(unicopy);
- *unicopy = **data;
- zval_copy_ctor(unicopy);
- INIT_PZVAL(unicopy);
- zval_unicode_to_string(unicopy TSRMLS_CC);
- data = &unicopy;
- }
-#endif
-
if (Z_TYPE_PP(data) != IS_STRING) {
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Non-string value passed to Phar::mungServer(), expecting an array of any of these strings: PHP_SELF, REQUEST_URI, SCRIPT_FILENAME, SCRIPT_NAME");
return;
@@ -1056,11 +940,6 @@ PHP_METHOD(Phar, mungServer)
if (Z_STRLEN_PP(data) == sizeof("SCRIPT_FILENAME")-1 && !strncmp(Z_STRVAL_PP(data), "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME")-1)) {
PHAR_GLOBALS->phar_SERVER_mung_list |= PHAR_MUNG_SCRIPT_FILENAME;
}
-#if PHP_MAJOR_VERSION >= 6
- if (unicopy) {
- zval_ptr_dtor(&unicopy);
- }
-#endif
}
}
/* }}} */
@@ -5037,11 +4916,7 @@ PHP_METHOD(PharFileInfo, getContent)
phar_seek_efp(link, 0, SEEK_SET, 0, 0 TSRMLS_CC);
Z_TYPE_P(return_value) = IS_STRING;
-#if PHP_MAJOR_VERSION >= 6
- Z_STRLEN_P(return_value) = php_stream_copy_to_mem(fp, (void **) &(Z_STRVAL_P(return_value)), link->uncompressed_filesize, 0);
-#else
Z_STRLEN_P(return_value) = php_stream_copy_to_mem(fp, &(Z_STRVAL_P(return_value)), link->uncompressed_filesize, 0);
-#endif
if (!Z_STRVAL_P(return_value)) {
Z_STRVAL_P(return_value) = estrndup("", 0);
diff --git a/ext/phar/stream.c b/ext/phar/stream.c
index 2f72551262..bf0913d683 100644
--- a/ext/phar/stream.c
+++ b/ext/phar/stream.c
@@ -207,30 +207,19 @@ static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, char *pat
fpf = php_stream_alloc(&phar_ops, idata, NULL, mode);
php_url_free(resource);
efree(internal_file);
-#if PHP_MAJOR_VERSION >= 6
- if (context && context->options && phar_find_key(HASH_OF(context->options), "phar", sizeof("phar"), (void**)&pzoption TSRMLS_CC)) {
-#else
+
if (context && context->options && zend_hash_find(HASH_OF(context->options), "phar", sizeof("phar"), (void**)&pzoption) == SUCCESS) {
-#endif
pharcontext = HASH_OF(*pzoption);
if (idata->internal_file->uncompressed_filesize == 0
&& idata->internal_file->compressed_filesize == 0
-#if PHP_MAJOR_VERSION >= 6
- && phar_find_key(pharcontext, "compress", sizeof("compress"), (void**)&pzoption TSRMLS_CC)
-#else
&& zend_hash_find(pharcontext, "compress", sizeof("compress"), (void**)&pzoption) == SUCCESS
-#endif
&& Z_TYPE_PP(pzoption) == IS_LONG
&& (Z_LVAL_PP(pzoption) & ~PHAR_ENT_COMPRESSION_MASK) == 0
) {
idata->internal_file->flags &= ~PHAR_ENT_COMPRESSION_MASK;
idata->internal_file->flags |= Z_LVAL_PP(pzoption);
}
-#if PHP_MAJOR_VERSION >= 6
- if (phar_find_key(pharcontext, "metadata", sizeof("metadata"), (void**)&pzoption TSRMLS_CC)) {
-#else
if (zend_hash_find(pharcontext, "metadata", sizeof("metadata"), (void**)&pzoption) == SUCCESS) {
-#endif
if (idata->internal_file->metadata) {
zval_ptr_dtor(&idata->internal_file->metadata);
idata->internal_file->metadata = NULL;
diff --git a/ext/phar/tar.c b/ext/phar/tar.c
index 917734c992..43d1ede238 100644
--- a/ext/phar/tar.c
+++ b/ext/phar/tar.c
@@ -986,11 +986,8 @@ int phar_tar_flush(phar_archive_data *phar, char *user_stub, long len, int defau
len = -len;
}
user_stub = 0;
-#if PHP_MAJOR_VERSION >= 6
- if (!(len = php_stream_copy_to_mem(stubfile, (void **) &user_stub, len, 0)) || !user_stub) {
-#else
+
if (!(len = php_stream_copy_to_mem(stubfile, &user_stub, len, 0)) || !user_stub) {
-#endif
if (error) {
spprintf(error, 0, "unable to read resource to copy stub to new tar-based phar \"%s\"", phar->fname);
}
diff --git a/ext/phar/util.c b/ext/phar/util.c
index d5b6a5dd13..5fcb2b6573 100644
--- a/ext/phar/util.c
+++ b/ext/phar/util.c
@@ -210,8 +210,6 @@ int phar_mount_entry(phar_archive_data *phar, char *filename, int filename_len,
return FAILURE;
}
#endif
-
- filename_len = strlen(entry.tmp);
filename = entry.tmp;
/* only check openbasedir for files, not for phar streams */
diff --git a/ext/phar/zip.c b/ext/phar/zip.c
index ced975cb38..3372622552 100644
--- a/ext/phar/zip.c
+++ b/ext/phar/zip.c
@@ -603,11 +603,7 @@ foundit:
php_stream_filter_append(&fp->readfilters, filter);
-#if PHP_MAJOR_VERSION >= 6
- if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, (void **) &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) {
-#else
if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) {
-#endif
pefree(entry.filename, entry.is_persistent);
#if PHP_VERSION_ID < 50207
PHAR_ZIP_FAIL("unable to read in alias, truncated (PHP 5.2.7 and newer has a potential fix for this problem)");
@@ -628,11 +624,7 @@ foundit:
php_stream_filter_append(&fp->readfilters, filter);
-#if PHP_MAJOR_VERSION >= 6
- if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, (void **) &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) {
-#else
if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) {
-#endif
pefree(entry.filename, entry.is_persistent);
#if PHP_VERSION_ID < 50207
PHAR_ZIP_FAIL("unable to read in alias, truncated (PHP 5.2.7 and newer has a potential fix for this problem)");
@@ -643,11 +635,7 @@ foundit:
php_stream_filter_flush(filter, 1);
php_stream_filter_remove(filter, 1 TSRMLS_CC);
} else {
-#if PHP_MAJOR_VERSION >= 6
- if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, (void **) &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) {
-#else
if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) {
-#endif
pefree(entry.filename, entry.is_persistent);
PHAR_ZIP_FAIL("unable to read in alias, truncated");
}
@@ -1252,11 +1240,7 @@ int phar_zip_flush(phar_archive_data *phar, char *user_stub, long len, int defau
user_stub = 0;
-#if PHP_MAJOR_VERSION >= 6
- if (!(len = php_stream_copy_to_mem(stubfile, (void **) &user_stub, len, 0)) || !user_stub) {
-#else
if (!(len = php_stream_copy_to_mem(stubfile, &user_stub, len, 0)) || !user_stub) {
-#endif
if (error) {
spprintf(error, 0, "unable to read resource to copy stub to new zip-based phar \"%s\"", phar->fname);
}
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index ee76afbc02..deabcbe7a4 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -1457,6 +1457,49 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
}
/* }}} */
+/* {{{ _reflection_param_get_default_param */
+static parameter_reference *_reflection_param_get_default_param(INTERNAL_FUNCTION_PARAMETERS)
+{
+ reflection_object *intern;
+ parameter_reference *param;
+
+ intern = (reflection_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+ if (intern == NULL || intern->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,27 +2576,20 @@ 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");
+ param = _reflection_param_get_default_param(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+ if (!param) {
return;
}
- if (param->offset < param->required) {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Parameter is not optional");
- 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;
}
@@ -2569,6 +2603,54 @@ ZEND_METHOD(reflection_parameter, getDefaultValue)
}
/* }}} */
+/* {{{ 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)
@@ -3004,6 +3086,14 @@ ZEND_METHOD(reflection_function, isDeprecated)
}
/* }}} */
+/* {{{ proto public bool ReflectionFunction::isGenerator()
+ Returns whether this function is a generator */
+ZEND_METHOD(reflection_function, isGenerator)
+{
+ _function_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_GENERATOR);
+}
+/* }}} */
+
/* {{{ proto public bool ReflectionFunction::inNamespace()
Returns whether this function is defined in namespace */
ZEND_METHOD(reflection_function, inNamespace)
@@ -4382,8 +4472,10 @@ ZEND_METHOD(reflection_class, getTraitAliases)
int method_name_len;
zend_trait_method_reference *cur_ref = ce->trait_aliases[i]->trait_method;
- method_name_len = spprintf(&method_name, 0, "%s::%s", cur_ref->class_name, cur_ref->method_name);
- add_assoc_stringl_ex(return_value, ce->trait_aliases[i]->alias, ce->trait_aliases[i]->alias_len + 1, method_name, method_name_len, 0);
+ if (ce->trait_aliases[i]->alias) {
+ method_name_len = spprintf(&method_name, 0, "%s::%s", cur_ref->class_name, cur_ref->method_name);
+ add_assoc_stringl_ex(return_value, ce->trait_aliases[i]->alias, ce->trait_aliases[i]->alias_len + 1, method_name, method_name_len, 0);
+ }
i++;
}
}
@@ -5612,6 +5704,7 @@ static const zend_function_entry reflection_function_abstract_functions[] = {
ZEND_ME(reflection_function, isDeprecated, arginfo_reflection__void, 0)
ZEND_ME(reflection_function, isInternal, arginfo_reflection__void, 0)
ZEND_ME(reflection_function, isUserDefined, arginfo_reflection__void, 0)
+ ZEND_ME(reflection_function, isGenerator, arginfo_reflection__void, 0)
ZEND_ME(reflection_function, getClosureThis, arginfo_reflection__void, 0)
ZEND_ME(reflection_function, getClosureScopeClass, arginfo_reflection__void, 0)
ZEND_ME(reflection_function, getDocComment, arginfo_reflection__void, 0)
@@ -5912,6 +6005,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/ReflectionFunction_isGenerator_basic.phpt b/ext/reflection/tests/ReflectionFunction_isGenerator_basic.phpt
new file mode 100644
index 0000000000..c4889b12bc
--- /dev/null
+++ b/ext/reflection/tests/ReflectionFunction_isGenerator_basic.phpt
@@ -0,0 +1,52 @@
+--TEST--
+ReflectionFunction::isGenerator()
+--FILE--
+<?php
+
+$closure1 = function() {return "this is a closure"; };
+$closure2 = function($param) {
+ yield $param;
+};
+
+$rf1 = new ReflectionFunction($closure1);
+var_dump($rf1->isGenerator());
+
+$rf2 = new ReflectionFunction($closure2);
+var_dump($rf2->isGenerator());
+
+function func1() {
+ return 'func1';
+}
+
+function func2() {
+ yield 'func2';
+}
+
+$rf1 = new ReflectionFunction('func1');
+var_dump($rf1->isGenerator());
+
+$rf2 = new ReflectionFunction('func2');
+var_dump($rf2->isGenerator());
+
+
+class Foo {
+ public function f1() {
+ }
+
+ public function f2() {
+ yield;
+ }
+}
+
+$rc = new ReflectionClass('Foo');
+foreach($rc->getMethods() as $m) {
+ var_dump($m->isGenerator());
+}
+?>
+--EXPECTF--
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt
new file mode 100644
index 0000000000..cdd00d2624
--- /dev/null
+++ b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt
@@ -0,0 +1,52 @@
+--TEST--
+ReflectionParameter::isDefaultValueConstant() && getDefaultValueConstantName()
+--FILE--
+<?php
+
+define("CONST_TEST_1", "const1");
+
+function ReflectionParameterTest($test1=array(), $test2 = CONST_TEST_1) {
+ echo $test;
+}
+$reflect = new ReflectionFunction('ReflectionParameterTest');
+foreach($reflect->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 0000000000..1ee9e93735
--- /dev/null
+++ b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt
@@ -0,0 +1,30 @@
+--TEST--
+ReflectionParameter::isDefaultValueConstant() && getDefaultValueConstantName() for namespace
+--FILE--
+<?php
+
+namespace ReflectionTestNamespace {
+ CONST TEST_CONST_1 = "Test Const 1";
+
+ class TestClass {
+ const TEST_CONST_2 = "Test Const 2 in class";
+ }
+}
+
+namespace {
+ function ReflectionParameterTest($test=ReflectionTestNamespace\TestClass::TEST_CONST_2, $test2 = ReflectionTestNamespace\CONST_TEST_1) {
+ echo $test;
+ }
+ $reflect = new ReflectionFunction('ReflectionParameterTest');
+ foreach($reflect->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 0000000000..a2c2d24582
--- /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--
+<?php
+
+define("CONST_TEST_1", "const1");
+
+function ReflectionParameterTest($test, $test2 = CONST_TEST_1) {
+ echo $test;
+}
+$reflect = new ReflectionFunction('ReflectionParameterTest');
+foreach($reflect->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/bug62715.phpt b/ext/reflection/tests/bug62715.phpt
new file mode 100644
index 0000000000..feb67f614b
--- /dev/null
+++ b/ext/reflection/tests/bug62715.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong result)
+--FILE--
+<?php
+
+function test(PDO $a = null, $b = 0, array $c) {}
+$r = new ReflectionFunction('test');
+
+foreach ($r->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/mod_user.c b/ext/session/mod_user.c
index 2ff5302f78..84a28d3427 100644
--- a/ext/session/mod_user.c
+++ b/ext/session/mod_user.c
@@ -63,7 +63,7 @@ static zval *ps_call_handler(zval *func, int argc, zval **argv TSRMLS_DC)
}
#define STDVARS \
- zval *retval; \
+ zval *retval = NULL; \
int ret = FAILURE
#define PSF(a) PS(mod_user_names).name.ps_##a
@@ -99,6 +99,7 @@ PS_OPEN_FUNC(user)
PS_CLOSE_FUNC(user)
{
+ zend_bool bailout = 0;
STDVARS;
if (!PS(mod_user_implemented)) {
@@ -106,9 +107,21 @@ PS_CLOSE_FUNC(user)
return SUCCESS;
}
- retval = ps_call_handler(PSF(close), 0, NULL TSRMLS_CC);
+ zend_try {
+ retval = ps_call_handler(PSF(close), 0, NULL TSRMLS_CC);
+ } zend_catch {
+ bailout = 1;
+ } zend_end_try();
+
PS(mod_user_implemented) = 0;
+ if (bailout) {
+ if (retval) {
+ zval_ptr_dtor(&retval);
+ }
+ zend_bailout();
+ }
+
FINISH;
}
diff --git a/ext/session/tests/bug60634_error_5.phpt b/ext/session/tests/bug60634_error_5.phpt
index 376b65f20b..8081ab988a 100644
--- a/ext/session/tests/bug60634_error_5.phpt
+++ b/ext/session/tests/bug60634_error_5.phpt
@@ -1,7 +1,5 @@
--TEST--
Bug #60634 (Segmentation fault when trying to die() in SessionHandler::write()) - fatal error in close during exec
---XFAIL--
-Long term low priority bug, working on it
--INI--
session.save_path=
session.name=PHPSESSID
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 7236b8a1b3..5514f0fc89 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 {
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index 84d603b591..5addec4ff2 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -1818,11 +1818,12 @@ static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, zval *
zend_hash_internal_pointer_reset_ex(model->u.content, &pos);
while (zend_hash_get_current_data_ex(model->u.content, (void**)&tmp, &pos) == SUCCESS) {
- if (!model_to_xml_object(node, *tmp, object, style, (*tmp)->min_occurs > 0 TSRMLS_CC)) {
- if ((*tmp)->min_occurs > 0) {
+ if (!model_to_xml_object(node, *tmp, object, style, strict && ((*tmp)->min_occurs > 0) TSRMLS_CC)) {
+ if (!strict || (*tmp)->min_occurs > 0) {
return 0;
}
}
+ strict = 1;
zend_hash_move_forward_ex(model->u.content, &pos);
}
return 1;
@@ -1845,7 +1846,7 @@ static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, zval *
return ret;
}
case XSD_CONTENT_GROUP: {
- return model_to_xml_object(node, model->u.group->model, object, style, model->min_occurs > 0 TSRMLS_CC);
+ return model_to_xml_object(node, model->u.group->model, object, style, strict && model->min_occurs > 0 TSRMLS_CC);
}
default:
break;
diff --git a/ext/soap/tests/bugs/bug50997.phpt b/ext/soap/tests/bugs/bug50997.phpt
new file mode 100644
index 0000000000..0508aaccdc
--- /dev/null
+++ b/ext/soap/tests/bugs/bug50997.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #50997 (SOAP Error when trying to submit 2nd Element of a choice)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
+--FILE--
+<?php
+$soapClient = new SoapClient(__DIR__ . '/bug50997.wsdl', array('trace' => 1, 'exceptions'=>0));
+$params = array('code'=>'foo');
+$soapClient->newOperation($params);
+echo $soapClient->__getLastRequest();
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.example.org/service2/"><SOAP-ENV:Body><ns1:NewOperation><code>foo</code></ns1:NewOperation></SOAP-ENV:Body></SOAP-ENV:Envelope>
diff --git a/ext/soap/tests/bugs/bug50997.wsdl b/ext/soap/tests/bugs/bug50997.wsdl
new file mode 100644
index 0000000000..16c6d36752
--- /dev/null
+++ b/ext/soap/tests/bugs/bug50997.wsdl
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.example.org/service2/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="service2" targetNamespace="http://www.example.org/service2/">
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.example.org/service2/">
+ <xsd:element name="NewOperation">
+ <xsd:complexType>
+ <xsd:choice>
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string"> </xsd:element>
+ <xsd:element name="surName" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:element name="code" type="xsd:string"/>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="NewOperationResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="NewOperationRequest">
+ <wsdl:part element="tns:NewOperation" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="NewOperationResponse">
+ <wsdl:part element="tns:NewOperationResponse" name="parameters"/>
+ </wsdl:message>
+ <wsdl:portType name="service2">
+ <wsdl:operation name="NewOperation">
+ <wsdl:input message="tns:NewOperationRequest"/>
+ <wsdl:output message="tns:NewOperationResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="service2SOAP" type="tns:service2">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="NewOperation">
+ <soap:operation soapAction="http://www.example.org/service2/NewOperation"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="service2">
+ <wsdl:port binding="tns:service2SOAP" name="service2SOAP">
+ <soap:address location="test://"/>
+ </wsdl:port>
+ </wsdl:service>
+ </wsdl:definitions>
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 84977c4b9b..3c6b41edbc 100755
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -58,6 +58,10 @@ PHPAPI zend_class_entry *spl_ce_RecursiveArrayIterator;
#define SPL_ARRAY_INT_MASK 0xFFFF0000
#define SPL_ARRAY_CLONE_MASK 0x0300FFFF
+#define SPL_ARRAY_METHOD_NO_ARG 0
+#define SPL_ARRAY_METHOD_USE_ARG 1
+#define SPL_ARRAY_METHOD_MAY_USER_ARG 2
+
typedef struct _spl_array_object {
zend_object std;
zval *array;
@@ -302,41 +306,41 @@ static zval **spl_array_get_dimension_ptr_ptr(int check_inherited, zval *object,
long index;
HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
-/* We cannot get the pointer pointer so we don't allow it here for now
- if (check_inherited && intern->fptr_offset_get) {
- return zend_call_method_with_1_params(&object, Z_OBJCE_P(object), &intern->fptr_offset_get, "offsetGet", NULL, offset);
- }*/
-
if (!offset) {
return &EG(uninitialized_zval_ptr);
}
if ((type == BP_VAR_W || type == BP_VAR_RW) && (ht->nApplyCount > 0)) {
zend_error(E_WARNING, "Modification of ArrayObject during sorting is prohibited");
- return &EG(uninitialized_zval_ptr);;
+ return &EG(error_zval_ptr);;
}
switch(Z_TYPE_P(offset)) {
+ case IS_NULL:
+ Z_STRVAL_P(offset) = "";
+ Z_STRLEN_P(offset) = 0;
case IS_STRING:
if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &retval) == FAILURE) {
- if (type == BP_VAR_W || type == BP_VAR_RW) {
- zval *value;
- ALLOC_INIT_ZVAL(value);
- zend_symtable_update(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)&value, sizeof(void*), NULL);
- if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &retval) != FAILURE) {
- return retval;
- } else {
- return &EG(uninitialized_zval_ptr);
+ switch (type) {
+ case BP_VAR_R:
+ zend_error(E_NOTICE, "Undefined index: %s", Z_STRVAL_P(offset));
+ case BP_VAR_UNSET:
+ case BP_VAR_IS:
+ retval = &EG(uninitialized_zval_ptr);
+ break;
+ case BP_VAR_RW:
+ zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset));
+ case BP_VAR_W: {
+ zval *value;
+ ALLOC_INIT_ZVAL(value);
+ zend_symtable_update(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)&value, sizeof(void*), (void **)&retval);
}
- } else {
- zend_error(E_NOTICE, "Undefined index: %s", Z_STRVAL_P(offset));
- return &EG(uninitialized_zval_ptr);
}
- } else {
- return retval;
}
- case IS_DOUBLE:
+ return retval;
case IS_RESOURCE:
+ zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%ld)", Z_LVAL_P(offset), Z_LVAL_P(offset));
+ case IS_DOUBLE:
case IS_BOOL:
case IS_LONG:
if (offset->type == IS_DOUBLE) {
@@ -345,26 +349,27 @@ static zval **spl_array_get_dimension_ptr_ptr(int check_inherited, zval *object,
index = Z_LVAL_P(offset);
}
if (zend_hash_index_find(ht, index, (void **) &retval) == FAILURE) {
- if (type == BP_VAR_W || type == BP_VAR_RW) {
- zval *value;
- ALLOC_INIT_ZVAL(value);
- zend_hash_index_update(ht, index, (void**)&value, sizeof(void*), NULL);
- if (zend_hash_index_find(ht, index, (void **) &retval) != FAILURE) {
- return retval;
- } else {
- return &EG(uninitialized_zval_ptr);
- }
- } else {
- zend_error(E_NOTICE, "Undefined offset: %ld", index);
- return &EG(uninitialized_zval_ptr);
+ switch (type) {
+ case BP_VAR_R:
+ zend_error(E_NOTICE, "Undefined offset: %ld", index);
+ case BP_VAR_UNSET:
+ case BP_VAR_IS:
+ retval = &EG(uninitialized_zval_ptr);
+ break;
+ case BP_VAR_RW:
+ zend_error(E_NOTICE, "Undefined offset: %ld", index);
+ case BP_VAR_W: {
+ zval *value;
+ ALLOC_INIT_ZVAL(value);
+ zend_hash_index_update(ht, index, (void**)&value, sizeof(void*), (void **)&retval);
+ }
}
- } else {
- return retval;
}
- break;
+ return retval;
default:
zend_error(E_WARNING, "Illegal offset type");
- return &EG(uninitialized_zval_ptr);
+ return (type == BP_VAR_W || type == BP_VAR_RW) ?
+ &EG(error_zval_ptr) : &EG(uninitialized_zval_ptr);
}
} /* }}} */
@@ -515,11 +520,11 @@ static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval
}
if (ht == &EG(symbol_table)) {
if (zend_delete_global_variable(Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC)) {
- zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset));
+ zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset));
}
} else {
if (zend_symtable_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1) == FAILURE) {
- zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset));
+ zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset));
} else {
spl_array_object *obj = intern;
@@ -565,7 +570,7 @@ static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval
return;
}
if (zend_hash_index_del(ht, index) == FAILURE) {
- zend_error(E_NOTICE,"Undefined offset: %ld", Z_LVAL_P(offset));
+ zend_error(E_NOTICE,"Undefined offset: %ld", Z_LVAL_P(offset));
}
break;
default:
@@ -650,6 +655,28 @@ static int spl_array_has_dimension(zval *object, zval *offset, int check_empty T
return spl_array_has_dimension_ex(1, object, offset, check_empty TSRMLS_CC);
} /* }}} */
+/* {{{ spl_array_object_verify_pos_ex */
+static inline int spl_array_object_verify_pos_ex(spl_array_object *object, HashTable *ht, const char *msg_prefix TSRMLS_DC)
+{
+ if (!ht) {
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%sArray was modified outside object and is no longer an array", msg_prefix);
+ return FAILURE;
+ }
+
+ if (object->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. */
@@ -687,7 +714,6 @@ SPL_METHOD(Array, offsetSet)
spl_array_write_dimension_ex(0, getThis(), index, value TSRMLS_CC);
} /* }}} */
-
void spl_array_iterator_append(zval *object, zval *append_value TSRMLS_DC) /* {{{ */
{
spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
@@ -963,17 +989,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");
+ if (spl_array_object_verify_pos_ex(object, aht, "ArrayIterator::valid(): " TSRMLS_CC) == FAILURE) {
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");
- 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 +1023,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;
}
@@ -1416,26 +1430,36 @@ static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fnam
{
spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
- zval *tmp, *arg;
+ zval *tmp, *arg = NULL;
zval *retval_ptr = NULL;
MAKE_STD_ZVAL(tmp);
Z_TYPE_P(tmp) = IS_ARRAY;
Z_ARRVAL_P(tmp) = aht;
- if (use_arg) {
- if (ZEND_NUM_ARGS() != 1 || zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) {
+ if (!use_arg) {
+ aht->nApplyCount++;
+ zend_call_method(NULL, NULL, NULL, fname, fname_len, &retval_ptr, 1, tmp, NULL TSRMLS_CC);
+ aht->nApplyCount--;
+ } else if (use_arg == SPL_ARRAY_METHOD_MAY_USER_ARG) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "|z", &arg) == FAILURE) {
Z_TYPE_P(tmp) = IS_NULL;
zval_ptr_dtor(&tmp);
- zend_throw_exception(spl_ce_BadMethodCallException, "Function expects exactly one argument", 0 TSRMLS_CC);
+ zend_throw_exception(spl_ce_BadMethodCallException, "Function expects one argument at most", 0 TSRMLS_CC);
return;
}
aht->nApplyCount++;
- zend_call_method(NULL, NULL, NULL, fname, fname_len, &retval_ptr, 2, tmp, arg TSRMLS_CC);
+ zend_call_method(NULL, NULL, NULL, fname, fname_len, &retval_ptr, arg? 2 : 1, tmp, arg TSRMLS_CC);
aht->nApplyCount--;
} else {
+ if (ZEND_NUM_ARGS() != 1 || zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) {
+ Z_TYPE_P(tmp) = IS_NULL;
+ zval_ptr_dtor(&tmp);
+ zend_throw_exception(spl_ce_BadMethodCallException, "Function expects exactly one argument", 0 TSRMLS_CC);
+ return;
+ }
aht->nApplyCount++;
- zend_call_method(NULL, NULL, NULL, fname, fname_len, &retval_ptr, 1, tmp, NULL TSRMLS_CC);
+ zend_call_method(NULL, NULL, NULL, fname, fname_len, &retval_ptr, 2, tmp, arg TSRMLS_CC);
aht->nApplyCount--;
}
Z_TYPE_P(tmp) = IS_NULL; /* we want to destroy the zval, not the hashtable */
@@ -1451,35 +1475,35 @@ SPL_METHOD(cname, fname) \
spl_array_method(INTERNAL_FUNCTION_PARAM_PASSTHRU, #fname, sizeof(#fname)-1, use_arg); \
}
-/* {{{ proto int ArrayObject::asort()
- proto int ArrayIterator::asort()
+/* {{{ proto int ArrayObject::asort([int $sort_flags = SORT_REGULAR ])
+ proto int ArrayIterator::asort([int $sort_flags = SORT_REGULAR ])
Sort the entries by values. */
-SPL_ARRAY_METHOD(Array, asort, 0) /* }}} */
+SPL_ARRAY_METHOD(Array, asort, SPL_ARRAY_METHOD_MAY_USER_ARG) /* }}} */
-/* {{{ proto int ArrayObject::ksort()
- proto int ArrayIterator::ksort()
+/* {{{ proto int ArrayObject::ksort([int $sort_flags = SORT_REGULAR ])
+ proto int ArrayIterator::ksort([int $sort_flags = SORT_REGULAR ])
Sort the entries by key. */
-SPL_ARRAY_METHOD(Array, ksort, 0) /* }}} */
+SPL_ARRAY_METHOD(Array, ksort, SPL_ARRAY_METHOD_MAY_USER_ARG) /* }}} */
/* {{{ proto int ArrayObject::uasort(callback cmp_function)
proto int ArrayIterator::uasort(callback cmp_function)
Sort the entries by values user defined function. */
-SPL_ARRAY_METHOD(Array, uasort, 1) /* }}} */
+SPL_ARRAY_METHOD(Array, uasort, SPL_ARRAY_METHOD_USE_ARG) /* }}} */
/* {{{ proto int ArrayObject::uksort(callback cmp_function)
proto int ArrayIterator::uksort(callback cmp_function)
Sort the entries by key using user defined function. */
-SPL_ARRAY_METHOD(Array, uksort, 1) /* }}} */
+SPL_ARRAY_METHOD(Array, uksort, SPL_ARRAY_METHOD_USE_ARG) /* }}} */
/* {{{ proto int ArrayObject::natsort()
proto int ArrayIterator::natsort()
Sort the entries by values using "natural order" algorithm. */
-SPL_ARRAY_METHOD(Array, natsort, 0) /* }}} */
+SPL_ARRAY_METHOD(Array, natsort, SPL_ARRAY_METHOD_NO_ARG) /* }}} */
/* {{{ proto int ArrayObject::natcasesort()
proto int ArrayIterator::natcasesort()
Sort the entries by key using case insensitive "natural order" algorithm. */
-SPL_ARRAY_METHOD(Array, natcasesort, 0) /* }}} */
+SPL_ARRAY_METHOD(Array, natcasesort, SPL_ARRAY_METHOD_NO_ARG) /* }}} */
/* {{{ proto mixed|NULL ArrayIterator::current()
Return current array entry */
@@ -1494,13 +1518,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 +1548,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 +1576,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 +1596,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 +1616,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 +1641,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;
}
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 0fcbd317e3..b86e68659d 100755
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -433,7 +433,6 @@ static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_
if (file_path && !use_copy) {
efree(file_path);
}
- use_copy = 1;
file_path_len = 1;
file_path = "/";
#endif
diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c
index 2b547e8126..8bf61e8688 100644
--- a/ext/spl/spl_fixedarray.c
+++ b/ext/spl/spl_fixedarray.c
@@ -223,10 +223,14 @@ static zend_object_value spl_fixedarray_object_new_ex(zend_class_entry *class_ty
if (orig && clone_orig) {
spl_fixedarray_object *other = (spl_fixedarray_object*)zend_object_store_get_object(orig TSRMLS_CC);
intern->ce_get_iterator = other->ce_get_iterator;
-
- intern->array = emalloc(sizeof(spl_fixedarray));
- spl_fixedarray_init(intern->array, other->array->size TSRMLS_CC);
- spl_fixedarray_copy(intern->array, other->array TSRMLS_CC);
+ if (!other->array) {
+ /* leave a empty object, will be dtor later by CLONE handler */
+ zend_throw_exception(spl_ce_RuntimeException, "The instance wasn't initialized properly", 0 TSRMLS_CC);
+ } else {
+ intern->array = emalloc(sizeof(spl_fixedarray));
+ spl_fixedarray_init(intern->array, other->array->size TSRMLS_CC);
+ spl_fixedarray_copy(intern->array, other->array TSRMLS_CC);
+ }
}
while (parent) {
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 4be82b21e1..7b77cf5bb1 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;
@@ -2818,7 +2820,7 @@ SPL_METHOD(CachingIterator, offsetGet)
}
if (zend_symtable_find(HASH_OF(intern->u.caching.zcache), arKey, nKeyLength+1, (void**)&value) == FAILURE) {
- zend_error(E_NOTICE, "Undefined index: %s", arKey);
+ zend_error(E_NOTICE, "Undefined index: %s", arKey);
return;
}
diff --git a/ext/spl/tests/SplFileObject_current_basic.phpt b/ext/spl/tests/SplFileObject_current_basic.phpt
new file mode 100644
index 0000000000..d3f4802a53
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_current_basic.phpt
@@ -0,0 +1,18 @@
+--TEST--
+SPL: SplFileObject::current basic
+--CREDITS--
+Ricardo Oedietram <ricardo@odracir.nl>
+Erwin Poeze <erwin.poeze@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+echo $s->current();
+
+?>
+--EXPECT--
+<?php
diff --git a/ext/spl/tests/SplFileObject_current_error001.phpt b/ext/spl/tests/SplFileObject_current_error001.phpt
new file mode 100644
index 0000000000..23c126648f
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_current_error001.phpt
@@ -0,0 +1,19 @@
+--TEST--
+SPL: SplFileObject::current variation error
+--CREDITS--
+Ricardo Oedietram <ricardo@odracir.nl>
+Erwin Poeze <erwin.poeze@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+$s->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 0000000000..0cc588a7f0
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_current_variation001.phpt
@@ -0,0 +1,21 @@
+--TEST--
+SPL: SplFileObject::current variation
+--CREDITS--
+Ricardo Oedietram <ricardo@odracir.nl>
+Erwin Poeze <erwin.poeze@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+$s->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 0000000000..065e8eae45
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_getchildren_basic.phpt
@@ -0,0 +1,12 @@
+--TEST--
+SPL: SplFileObject::getchildren basic
+--CREDITS--
+Erwin Poeze <erwin.poeze at gmail.com>
+--FILE--
+<?php
+$s = new SplFileObject( __FILE__ );
+var_dump($s->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 0000000000..9c17a82977
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_getchildren_error001.phpt
@@ -0,0 +1,12 @@
+--TEST--
+SPL: SplFileObject::getchildren error 001
+--CREDITS--
+Erwin Poeze <erwin.poeze at gmail.com>
+--FILE--
+<?php
+$s = new SplFileObject( __FILE__ );
+$s->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 0000000000..5addadf380
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_getflags_basic.phpt
@@ -0,0 +1,22 @@
+--TEST--
+SPL: SplFileObject::getFlags basic
+--CREDITS--
+Ricardo Oedietram <ricardo@odracir.nl>
+Erwin Poeze <erwin.poeze@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+
+file_put_contents('testdata.csv', 'eerste;tweede;derde');
+
+$fo = new SplFileObject('testdata.csv');
+
+$fo->setFlags(SplFileObject::DROP_NEW_LINE);
+var_dump($fo->getFlags());
+?>
+--CLEAN--
+<?php
+unlink('testdata.csv');
+?>
+--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 0000000000..1602f88885
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_getflags_error001.phpt
@@ -0,0 +1,26 @@
+--TEST--
+SPL: SplFileObject::getFlags error 001
+--CREDITS--
+Ricardo Oedietram <ricardo@odracir.nl>
+Erwin Poeze <erwin.poeze@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+
+file_put_contents('testdata.csv', 'eerste;tweede;derde');
+
+
+$fo = new SplFileObject('testdata.csv');
+$fo->setFlags(SplFileObject::READ_CSV);
+
+$fo->setFlags(SplFileObject::DROP_NEW_LINE);
+
+var_dump($fo->getFlags());
+
+?>
+--CLEAN--
+<?php
+unlink('testdata.csv');
+?>
+--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 0000000000..e2c8255f44
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_getflags_error002.phpt
@@ -0,0 +1,21 @@
+--TEST--
+SPL: SplFileObject::getFlags error 001
+--CREDITS--
+Erwin Poeze <erwin.poeze@gmail.com>
+--FILE--
+<?php
+
+file_put_contents('testdata.csv', 'eerste;tweede;derde');
+
+$fo = new SplFileObject('testdata.csv');
+$fo->setFlags(SplFileObject::READ_CSV);
+
+$fo->getFlags('fake');
+
+?>
+--CLEAN--
+<?php
+unlink('testdata.csv');
+?>
+--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 0000000000..640de03511
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_getflags_variation001.phpt
@@ -0,0 +1,29 @@
+--TEST--
+SPL: SplFileObject::getFlags
+--CREDITS--
+Ricardo Oedietram <ricardo@odracir.nl>
+Erwin Poeze <erwin.poeze@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+
+$fo = new SplFileObject(__FILE__);
+
+$fo->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 0000000000..1ce00bfd42
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_haschildren_basic.phpt
@@ -0,0 +1,12 @@
+--TEST--
+SPL: SplFileObject::haschildren basic
+--CREDITS--
+Erwin Poeze <erwin.poeze at gmail.com>
+--FILE--
+<?php
+$s = new SplFileObject( __FILE__ );
+var_dump($s->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 0000000000..0c4e1de3b7
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_haschildren_error001.phpt
@@ -0,0 +1,12 @@
+--TEST--
+SPL: SplFileObject::haschildren error 001
+--CREDITS--
+Erwin Poeze <erwin.poeze at gmail.com>
+--FILE--
+<?php
+$s = new SplFileObject( __FILE__ );
+$s->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 0000000000..4081d314ea
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_key_basic.phpt
@@ -0,0 +1,19 @@
+--TEST--
+SPL: SplFileObject::key basic
+--CREDITS--
+Ricardo Oedietram <ricardo@odracir.nl>
+Erwin Poeze <erwin.poeze@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+
+$s->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 0000000000..b0834f0029
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_key_error001.phpt
@@ -0,0 +1,22 @@
+--TEST--
+SPL: SplFileObject::key error
+--CREDITS--
+Ricardo Oedietram <ricardo@odracir.nl>
+Erwin Poeze <erwin.poeze@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+
+$s->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 0000000000..8fc9b7fef0
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_key_error002.phpt
@@ -0,0 +1,22 @@
+--TEST--
+SPL: SplFileObject::key error
+--CREDITS--
+Ricardo Oedietram <ricardo@odracir.nl>
+Erwin Poeze <erwin.poeze@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+
+$s->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 0000000000..7568cf55f4
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_key_error003.phpt
@@ -0,0 +1,15 @@
+--TEST--
+SPL: SplFileObject::key error
+--CREDITS--
+Erwin Poeze <erwin.poeze AT gmail.com>
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+$s->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 0000000000..59dc7ab58d
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_next_basic.phpt
@@ -0,0 +1,22 @@
+--TEST--
+SPL: SplFileObject::next basic
+--CREDITS--
+Ricardo Oedietram <ricardo@odracir.nl>
+Erwin Poeze <erwin.poeze@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+echo $s->current();
+$s->next();
+
+echo $s->current();
+
+?>
+--EXPECT--
+<?php
+//line 2
diff --git a/ext/spl/tests/SplFileObject_next_variation001.phpt b/ext/spl/tests/SplFileObject_next_variation001.phpt
new file mode 100644
index 0000000000..34771dd523
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_next_variation001.phpt
@@ -0,0 +1,24 @@
+--TEST--
+SPL: SplFileObject::next variation 001
+--CREDITS--
+Ricardo Oedietram <ricardo@odracir.nl>
+Erwin Poeze <erwin.poeze@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+
+$s->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 0000000000..d48ff8c223
--- /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 <ricardo@odracir.nl>
+Erwin Poeze <erwin.poeze@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+$s->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 0000000000..331c587e4a
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_rewind_basic.phpt
@@ -0,0 +1,21 @@
+--TEST--
+SPL: SplFileObject::rewind basic
+--CREDITS--
+Ricardo Oedietram <ricardo@odracir.nl>
+Erwin Poeze <erwin.poeze@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+
+$s->seek(3);
+
+$s->rewind();
+echo $s->current();
+?>
+--EXPECT--
+<?php
diff --git a/ext/spl/tests/SplFileObject_rewind_error001.phpt b/ext/spl/tests/SplFileObject_rewind_error001.phpt
new file mode 100644
index 0000000000..bdb3301e63
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_rewind_error001.phpt
@@ -0,0 +1,18 @@
+--TEST--
+SPL: SplFileObject::rewind() with a parameter.
+--CREDITS--
+Ricardo Oedietram <ricardo@odracir.nl>
+Erwin Poeze <erwin.poeze@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+
+file_put_contents('testdata.csv', 'eerste;tweede;derde');
+
+$fo = new SplFileObject('testdata.csv');
+
+$fo->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 0000000000..d835c443de
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_rewind_variation001.phpt
@@ -0,0 +1,28 @@
+--TEST--
+SPL: SplFileObject::rewind variation 001
+--CREDITS--
+Ricardo Oedietram <ricardo@odracir.nl>
+Erwin Poeze <erwin.poeze@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+
+$s->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)
+<?php
diff --git a/ext/spl/tests/SplFileObject_seek_basic.phpt b/ext/spl/tests/SplFileObject_seek_basic.phpt
new file mode 100644
index 0000000000..7106f70cce
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_seek_basic.phpt
@@ -0,0 +1,19 @@
+--TEST--
+SPL: SplFileObject::seek basic
+--CREDITS--
+Ricardo Oedietram <ricardo@odracir.nl>
+Erwin Poeze <erwin.poeze@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+
+$s->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 0000000000..057c8d3251
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_seek_error002.phpt
@@ -0,0 +1,18 @@
+--TEST--
+SPL: SplFileObject::seek error 001
+--CREDITS--
+Ricardo Oedietram <ricardo@odracir.nl>
+Erwin Poeze <erwin.poeze@gmail.com>
+#PFZ June PHP TestFest 2012
+--FILE--
+<?php
+//line 2
+//line 3
+//line 4
+//line 5
+$s = new SplFileObject(__FILE__);
+
+$s->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 0000000000..b2630606e8
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_setCsvControl_basic.phpt
@@ -0,0 +1,30 @@
+--TEST--
+SPL: SplFileObject::setCsvControl basic
+--CREDITS--
+Erwin Poeze <erwin.poeze at gmail.com>
+--FILE--
+<?php
+file_put_contents('csv_control_data.csv',
+<<<CDATA
+'groene appelen'|10
+'gele bananen'|20
+'rode kersen'|30
+CDATA
+);
+$s = new SplFileObject('csv_control_data.csv');
+$s->setFlags(SplFileObject::READ_CSV);
+$s->setCsvControl('|', '\'', '/');
+foreach ($s as $row) {
+ list($fruit, $quantity) = $row;
+ echo "$fruit : $quantity\n";
+}
+?>
+--CLEAN--
+<?php
+unlink('csv_control_data.csv');
+?>
+--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 0000000000..f582a4a894
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_setCsvControl_error001.phpt
@@ -0,0 +1,24 @@
+--TEST--
+SPL: SplFileObject::setCsvControl error 001
+--CREDITS--
+Erwin Poeze <erwin.poeze at gmail.com>
+--FILE--
+<?php
+file_put_contents('csv_control_data.csv',
+<<<CDATA
+'groene appelen'|10
+'gele bananen'|20
+'rode kersen'|30
+CDATA
+);
+$s = new SplFileObject('csv_control_data.csv');
+$s->setFlags(SplFileObject::READ_CSV);
+$s->setCsvControl('||');
+?>
+--CLEAN--
+<?php
+unlink('csv_control_data.csv');
+?>
+--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 0000000000..bcfd9c4dd6
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_setCsvControl_error002.phpt
@@ -0,0 +1,24 @@
+--TEST--
+SPL: SplFileObject::setCsvControl error 002
+--CREDITS--
+Erwin Poeze <erwin.poeze at gmail.com>
+--FILE--
+<?php
+file_put_contents('csv_control_data.csv',
+<<<CDATA
+'groene appelen'|10
+'gele bananen'|20
+'rode kersen'|30
+CDATA
+);
+$s = new SplFileObject('csv_control_data.csv');
+$s->setFlags(SplFileObject::READ_CSV);
+$s->setCsvControl('|', 'two');
+?>
+--CLEAN--
+<?php
+unlink('csv_control_data.csv');
+?>
+--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 0000000000..8b1f54d5a4
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_setCsvControl_error003.phpt
@@ -0,0 +1,26 @@
+--TEST--
+SPL: SplFileObject::setCsvControl error 003
+--CREDITS--
+Erwin Poeze <erwin.poeze at gmail.com>
+--INI--
+include_path=.
+--FILE--
+<?php
+file_put_contents('csv_control_data.csv',
+<<<CDATA
+'groene appelen'|10
+'gele bananen'|20
+'rode kersen'|30
+CDATA
+);
+$s = new SplFileObject('csv_control_data.csv');
+$s->setFlags(SplFileObject::READ_CSV);
+$s->setCsvControl('|', '\'', 'three');
+?>
+--CLEAN--
+<?php
+unlink('csv_control_data.csv');
+?>
+--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 0000000000..7aaf8a3fe6
--- /dev/null
+++ b/ext/spl/tests/SplFileObject_setCsvControl_variation001.phpt
@@ -0,0 +1,30 @@
+--TEST--
+SPL: SplFileObject::setCsvControl variation 001
+--CREDITS--
+Erwin Poeze <erwin.poeze at gmail.com>
+--FILE--
+<?php
+file_put_contents('csv_control_data.csv',
+<<<CDATA
+"groene appelen",10
+"gele bananen",20
+"rode kersen",30
+CDATA
+);
+$s = new SplFileObject('csv_control_data.csv');
+$s->setFlags(SplFileObject::READ_CSV);
+$s->setCsvControl();
+foreach ($s as $row) {
+ list($fruit, $quantity) = $row;
+ echo "$fruit : $quantity\n";
+}
+?>
+--CLEAN--
+<?php
+unlink('csv_control_data.csv');
+?>
+--EXPECT--
+groene appelen : 10
+gele bananen : 20
+rode kersen : 30
+
diff --git a/ext/spl/tests/arrayObject___construct_basic2.phpt b/ext/spl/tests/arrayObject___construct_basic2.phpt
index 9ff0e4257a..bd27c42774 100644
--- a/ext/spl/tests/arrayObject___construct_basic2.phpt
+++ b/ext/spl/tests/arrayObject___construct_basic2.phpt
@@ -63,7 +63,7 @@ bool(true)
Notice: Undefined property: ArrayObject::$prop in %s on line 40
-Notice: Undefined index: prop in %s on line 40
+Notice: Undefined index: prop in %s on line 40
NULL
NULL
- After:
@@ -91,7 +91,7 @@ bool(true)
Notice: Undefined property: MyArrayObject::$prop in %s on line 40
-Notice: Undefined index: prop in %s on line 40
+Notice: Undefined index: prop in %s on line 40
NULL
NULL
- After:
diff --git a/ext/spl/tests/arrayObject___construct_basic3.phpt b/ext/spl/tests/arrayObject___construct_basic3.phpt
index 1abd1a1ab1..11a17a6dc4 100644
--- a/ext/spl/tests/arrayObject___construct_basic3.phpt
+++ b/ext/spl/tests/arrayObject___construct_basic3.phpt
@@ -63,7 +63,7 @@ bool(true)
Notice: Undefined property: ArrayObject::$prop in %s on line 40
-Notice: Undefined index: prop in %s on line 40
+Notice: Undefined index: prop in %s on line 40
NULL
NULL
- After:
@@ -91,7 +91,7 @@ bool(true)
Notice: Undefined property: MyArrayObject::$prop in %s on line 40
-Notice: Undefined index: prop in %s on line 40
+Notice: Undefined index: prop in %s on line 40
NULL
NULL
- After:
diff --git a/ext/spl/tests/arrayObject___construct_basic4.phpt b/ext/spl/tests/arrayObject___construct_basic4.phpt
index 80f5e0861e..b0809de0d4 100644
--- a/ext/spl/tests/arrayObject___construct_basic4.phpt
+++ b/ext/spl/tests/arrayObject___construct_basic4.phpt
@@ -61,11 +61,11 @@ bool(true)
bool(true)
- Unset:
-Notice: Undefined index: prop in %s on line 39
+Notice: Undefined index: prop in %s on line 39
-Notice: Undefined index: prop in %s on line 40
+Notice: Undefined index: prop in %s on line 40
-Notice: Undefined index: prop in %s on line 40
+Notice: Undefined index: prop in %s on line 40
NULL
NULL
- After:
@@ -91,9 +91,9 @@ bool(true)
bool(true)
- Unset:
-Notice: Undefined index: prop in %s on line 40
+Notice: Undefined index: prop in %s on line 40
-Notice: Undefined index: prop in %s on line 40
+Notice: Undefined index: prop in %s on line 40
NULL
NULL
- After:
diff --git a/ext/spl/tests/arrayObject___construct_basic5.phpt b/ext/spl/tests/arrayObject___construct_basic5.phpt
index 5368d250a1..8c44ee2ce4 100644
--- a/ext/spl/tests/arrayObject___construct_basic5.phpt
+++ b/ext/spl/tests/arrayObject___construct_basic5.phpt
@@ -61,11 +61,11 @@ bool(true)
bool(true)
- Unset:
-Notice: Undefined index: prop in %s on line 39
+Notice: Undefined index: prop in %s on line 39
-Notice: Undefined index: prop in %s on line 40
+Notice: Undefined index: prop in %s on line 40
-Notice: Undefined index: prop in %s on line 40
+Notice: Undefined index: prop in %s on line 40
NULL
NULL
- After:
@@ -91,9 +91,9 @@ bool(true)
bool(true)
- Unset:
-Notice: Undefined index: prop in %s on line 40
+Notice: Undefined index: prop in %s on line 40
-Notice: Undefined index: prop in %s on line 40
+Notice: Undefined index: prop in %s on line 40
NULL
NULL
- After:
diff --git a/ext/spl/tests/arrayObject_asort_basic1.phpt b/ext/spl/tests/arrayObject_asort_basic1.phpt
index ec69049a32..53df1d502b 100644
--- a/ext/spl/tests/arrayObject_asort_basic1.phpt
+++ b/ext/spl/tests/arrayObject_asort_basic1.phpt
@@ -17,12 +17,14 @@ var_dump($ao1->asort());
var_dump($ao1);
var_dump($ao2->asort('blah'));
var_dump($ao2);
+var_dump($ao2->asort(SORT_NUMERIC));
+var_dump($ao2);
?>
===DONE===
--EXPECTF--
*** Testing ArrayObject::asort() : basic functionality ***
bool(true)
-object(ArrayObject)#1 (1) {
+object(ArrayObject)#%d (1) {
["storage":"ArrayObject":private]=>
array(3) {
[1]=>
@@ -33,8 +35,22 @@ object(ArrayObject)#1 (1) {
int(4)
}
}
+
+Warning: asort() expects parameter 2 to be long, string given in %sarrayObject_asort_basic1.php on line %d
+bool(false)
+object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ ["a"]=>
+ int(4)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ }
+}
bool(true)
-object(ArrayObject)#2 (1) {
+object(ArrayObject)#%d (1) {
["storage":"ArrayObject":private]=>
array(3) {
["b"]=>
diff --git a/ext/spl/tests/arrayObject_ksort_basic1.phpt b/ext/spl/tests/arrayObject_ksort_basic1.phpt
index 9c8d1e7345..8f37938126 100644
--- a/ext/spl/tests/arrayObject_ksort_basic1.phpt
+++ b/ext/spl/tests/arrayObject_ksort_basic1.phpt
@@ -16,12 +16,14 @@ var_dump($ao1->ksort());
var_dump($ao1);
var_dump($ao2->ksort('blah'));
var_dump($ao2);
+var_dump($ao2->ksort(SORT_STRING));
+var_dump($ao2);
?>
===DONE===
--EXPECTF--
*** Testing ArrayObject::ksort() : basic functionality ***
bool(true)
-object(ArrayObject)#1 (1) {
+object(ArrayObject)#%d (1) {
["storage":"ArrayObject":private]=>
array(3) {
[0]=>
@@ -32,18 +34,34 @@ object(ArrayObject)#1 (1) {
int(3)
}
}
-bool(true)
+
+Warning: ksort() expects parameter 2 to be long, string given in %sarrayObject_ksort_basic1.php on line %d
+bool(false)
object(ArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
array(4) {
- ["a"]=>
- int(2)
["b"]=>
int(4)
+ ["a"]=>
+ int(2)
["q"]=>
int(3)
[99]=>
string(1) "x"
}
}
+bool(true)
+object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ array(4) {
+ [99]=>
+ string(1) "x"
+ ["a"]=>
+ int(2)
+ ["b"]=>
+ int(4)
+ ["q"]=>
+ int(3)
+ }
+}
===DONE===
diff --git a/ext/spl/tests/arrayObject_magicMethods1.phpt b/ext/spl/tests/arrayObject_magicMethods1.phpt
index b1de4a951e..ec4812f107 100644
--- a/ext/spl/tests/arrayObject_magicMethods1.phpt
+++ b/ext/spl/tests/arrayObject_magicMethods1.phpt
@@ -102,7 +102,7 @@ object(ArrayObject)#2 (1) {
--> Read existent, non-existent and dynamic:
string(7) "changed"
-Notice: Undefined index: nonexistent in %s on line 42
+Notice: Undefined index: nonexistent in %s on line 42
NULL
string(11) "new.changed"
Original wrapped object:
@@ -171,7 +171,7 @@ object(ArrayObject)#2 (1) {
--> Unset existent, non-existent and dynamic:
-Notice: Undefined index: nonexistent in %s on line 60
+Notice: Undefined index: nonexistent in %s on line 60
Original wrapped object:
object(UsesMagic)#1 (3) {
["b"]=>
diff --git a/ext/spl/tests/arrayObject_magicMethods3.phpt b/ext/spl/tests/arrayObject_magicMethods3.phpt
index 16a6a3b80c..6231ceabb7 100644
--- a/ext/spl/tests/arrayObject_magicMethods3.phpt
+++ b/ext/spl/tests/arrayObject_magicMethods3.phpt
@@ -102,7 +102,7 @@ object(ArrayObject)#2 (1) {
--> Read existent, non-existent and dynamic:
string(7) "changed"
-Notice: Undefined index: nonexistent in %s on line 42
+Notice: Undefined index: nonexistent in %s on line 42
NULL
string(11) "new.changed"
Original wrapped object:
@@ -171,7 +171,7 @@ object(ArrayObject)#2 (1) {
--> Unset existent, non-existent and dynamic:
-Notice: Undefined index: nonexistent in %s on line 60
+Notice: Undefined index: nonexistent in %s on line 60
Original wrapped object:
object(UsesMagic)#1 (3) {
["b"]=>
diff --git a/ext/spl/tests/arrayObject_magicMethods4.phpt b/ext/spl/tests/arrayObject_magicMethods4.phpt
index 3c9f78781a..9580dc5ae7 100644
--- a/ext/spl/tests/arrayObject_magicMethods4.phpt
+++ b/ext/spl/tests/arrayObject_magicMethods4.phpt
@@ -107,7 +107,7 @@ object(UsesMagic)#2 (2) {
--> Read existent, non-existent and dynamic:
string(7) "changed"
-Notice: Undefined index: nonexistent in %s on line 45
+Notice: Undefined index: nonexistent in %s on line 45
NULL
string(11) "new.changed"
Original wrapped object:
@@ -180,7 +180,7 @@ object(UsesMagic)#2 (2) {
--> Unset existent, non-existent and dynamic:
-Notice: Undefined index: nonexistent in %s on line 63
+Notice: Undefined index: nonexistent in %s on line 63
Original wrapped object:
object(C)#1 (3) {
["b"]=>
diff --git a/ext/spl/tests/arrayObject_magicMethods6.phpt b/ext/spl/tests/arrayObject_magicMethods6.phpt
index 45a0e4a768..b43f56c2b0 100644
--- a/ext/spl/tests/arrayObject_magicMethods6.phpt
+++ b/ext/spl/tests/arrayObject_magicMethods6.phpt
@@ -107,7 +107,7 @@ object(UsesMagic)#2 (2) {
--> Read existent, non-existent and dynamic:
string(7) "changed"
-Notice: Undefined index: nonexistent in %s on line 45
+Notice: Undefined index: nonexistent in %s on line 45
NULL
string(11) "new.changed"
Original wrapped object:
@@ -180,7 +180,7 @@ object(UsesMagic)#2 (2) {
--> Unset existent, non-existent and dynamic:
-Notice: Undefined index: nonexistent in %s on line 63
+Notice: Undefined index: nonexistent in %s on line 63
Original wrapped object:
object(C)#1 (3) {
["b"]=>
diff --git a/ext/spl/tests/arrayObject_setFlags_basic1.phpt b/ext/spl/tests/arrayObject_setFlags_basic1.phpt
index d8d4f2e96d..391b0eeae7 100644
--- a/ext/spl/tests/arrayObject_setFlags_basic1.phpt
+++ b/ext/spl/tests/arrayObject_setFlags_basic1.phpt
@@ -44,8 +44,8 @@ string(21) "array element.changed"
--> Remove the array element and try access again:
bool(false)
-Notice: Undefined index: p in %s on line 10
+Notice: Undefined index: p in %s on line 10
NULL
-Notice: Undefined index: p in %s on line 12
+Notice: Undefined index: p in %s on line 12
string(8) ".changed"
diff --git a/ext/spl/tests/array_001.phpt b/ext/spl/tests/array_001.phpt
index d9fb57c4ce..b55fcba1fd 100755
--- a/ext/spl/tests/array_001.phpt
+++ b/ext/spl/tests/array_001.phpt
@@ -79,15 +79,15 @@ object(ArrayObject)#%d (1) {
}
int(0)
-Notice: Undefined offset: 6 in %sarray_001.php on line %d
+Notice: Undefined offset: 6 in %sarray_001.php on line %d
NULL
-Notice: Undefined index: b in %sarray_001.php on line %d
+Notice: Undefined index: b in %sarray_001.php on line %d
NULL
-Notice: Undefined offset: 7 in %sarray_001.php on line %d
+Notice: Undefined offset: 7 in %sarray_001.php on line %d
-Notice: Undefined index: c in %sarray_001.php on line %d
+Notice: Undefined index: c in %sarray_001.php on line %d
object(ArrayObject)#%d (1) {
["storage":"ArrayObject":private]=>
array(2) {
diff --git a/ext/spl/tests/array_010.phpt b/ext/spl/tests/array_010.phpt
index 6b331e4b51..d2f3de7f6d 100755
--- a/ext/spl/tests/array_010.phpt
+++ b/ext/spl/tests/array_010.phpt
@@ -94,10 +94,10 @@ int(1)
string(3) "3rd"
int(4)
-Notice: Undefined index: 5th in %sarray_010.php on line %d
+Notice: Undefined index: 5th in %sarray_010.php on line %d
NULL
-Notice: Undefined offset: 6 in %sarray_010.php on line %d
+Notice: Undefined offset: 6 in %sarray_010.php on line %d
NULL
===offsetSet===
WRITE 1
@@ -128,9 +128,9 @@ array(6) {
string(9) "changed 6"
}
-Notice: Undefined offset: 7 in %sarray_010.php on line %d
+Notice: Undefined offset: 7 in %sarray_010.php on line %d
-Notice: Undefined index: 8th in %sarray_010.php on line %d
+Notice: Undefined index: 8th in %sarray_010.php on line %d
array(4) {
[0]=>
string(3) "1st"
diff --git a/ext/spl/tests/bug45622.phpt b/ext/spl/tests/bug45622.phpt
index c47b62cbdf..a8fe2c4641 100644
--- a/ext/spl/tests/bug45622.phpt
+++ b/ext/spl/tests/bug45622.phpt
@@ -42,7 +42,7 @@ bool(true)
--> Remove the array element and try access again:
bool(false)
-Notice: Undefined index: p in %s on line %d
+Notice: Undefined index: p in %s on line %d
NULL
--> Re-add the real property:
diff --git a/ext/spl/tests/bug45622b.phpt b/ext/spl/tests/bug45622b.phpt
index 9d49392111..f101a8459d 100644
--- a/ext/spl/tests/bug45622b.phpt
+++ b/ext/spl/tests/bug45622b.phpt
@@ -25,9 +25,9 @@ isset($ao->prop4);
--EXPECTF--
Doesn't trigger __get.
-Notice: Undefined index: prop1 in %s on line 11
+Notice: Undefined index: prop1 in %s on line 11
Doesn't trigger __set.
Doesn't trigger __unset.
-Notice: Undefined index: prop3 in %s on line 17
+Notice: Undefined index: prop3 in %s on line 17
Shouldn't trigger __isset. \ No newline at end of file
diff --git a/ext/spl/tests/bug54323.phpt b/ext/spl/tests/bug54323.phpt
index 35a16a4637..df6416a0f1 100644
--- a/ext/spl/tests/bug54323.phpt
+++ b/ext/spl/tests/bug54323.phpt
@@ -19,6 +19,6 @@ function testAccess($c, $ao) {
--EXPECTF--
Notice: Undefined property: C::$prop in %sbug54323.php on line 14
-Notice: Undefined index: prop in %sbug54323.php on line 14
+Notice: Undefined index: prop in %sbug54323.php on line 14
NULL
NULL
diff --git a/ext/spl/tests/bug61527.phpt b/ext/spl/tests/bug61527.phpt
new file mode 100644
index 0000000000..ab13c69547
--- /dev/null
+++ b/ext/spl/tests/bug61527.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Bug #61527 (Recursive/ArrayIterator gives misleading notice when array empty or moved to the end)
+--FILE--
+<?php
+$ao = new ArrayObject(array());
+$ai = $ao->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==
+<?php exit(0); ?>
+--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 0000000000..d95caef978
--- /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--
+<?php
+
+function f1($class) { echo "f1: [[$class]]\n"; }
+function f2($class) { echo "f2: [[$class]]\n"; }
+
+spl_autoload_register('f1');
+spl_autoload_register('f2');
+spl_autoload_register(create_function('$class', 'echo "cf1: [[$class]]\n";'));
+spl_autoload_register(create_function('$class', 'echo "cf2: [[$class]]\n";'));
+
+foreach (spl_autoload_functions() AS $func)
+{
+ spl_autoload_unregister($func);
+}
+
+print_r(spl_autoload_functions());
+?>
+--EXPECTF--
+Array
+(
+)
diff --git a/ext/spl/tests/bug62328.phpt b/ext/spl/tests/bug62328.phpt
new file mode 100644
index 0000000000..33a8aeee95
--- /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--
+<?php
+
+class SplFileInfo62328 extends SplFileInfo
+{
+ public function __toString()
+ {
+ return '__toString';
+ }
+}
+
+$fi = new SplFileInfo62328(__FILE__);
+
+echo (string)$fi . PHP_EOL;
+echo (string)$fi->__toString() . PHP_EOL;
+
+?>
+--EXPECT--
+__toString
+__toString
diff --git a/ext/spl/tests/bug62616.phpt b/ext/spl/tests/bug62616.phpt
new file mode 100644
index 0000000000..4e4be94491
--- /dev/null
+++ b/ext/spl/tests/bug62616.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #62616 (ArrayIterator::count() from IteratorIterator instance gives Segmentation fault)
+--FILE--
+<?php
+$ai = new ArrayIterator(array(0,1));
+
+var_dump($ai->count());
+
+$ii = new IteratorIterator($ai);
+
+var_dump($ii->count());
+?>
+--EXPECTF--
+int(2)
+int(2)
diff --git a/ext/spl/tests/bug62904.phpt b/ext/spl/tests/bug62904.phpt
new file mode 100644
index 0000000000..7e392da9ab
--- /dev/null
+++ b/ext/spl/tests/bug62904.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #62904 (Crash when cloning an object which inherits SplFixedArray)
+--FILE--
+<?php
+
+class foo extends SplFixedArray {
+ public function __construct($size) {
+ }
+}
+
+$x = new foo(2);
+
+try {
+ $z = clone $x;
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+--EXPECTF--
+string(40) "The instance wasn't initialized properly"
diff --git a/ext/spl/tests/bug62978.phpt b/ext/spl/tests/bug62978.phpt
new file mode 100644
index 0000000000..0d91609f88
--- /dev/null
+++ b/ext/spl/tests/bug62978.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Bug #62987 (Assigning to ArrayObject[null][something] overrides all undefined variables)
+--FILE--
+<?php
+$a = new ArrayObject();
+
+$b = array();
+
+$a[null]['hurr'] = 'durr';
+
+var_dump($a['epic_magic']);
+var_dump($b['epic_magic']);
+var_dump($c['epic_magic']); // Undefined var!!
+
+$d = array();
+var_dump($a['epic_magic']); // more magic!
+var_dump($d['epic_magic']);
+
+$e = 'srsly?';
+var_dump($a['epic_magic']); // srsly.
+var_dump(isset($a['epic_magic']));
+
+$fp = fopen(__FILE__, 'r');
+var_dump($a[$fp]);
+
+fclose($fp);
+--EXPECTF--
+Notice: Undefined index: epic_magic in %sbug62978.php on line %d
+NULL
+
+Notice: Undefined index: epic_magic in %sbug62978.php on line %d
+NULL
+
+Notice: Undefined variable: c in %sbug62978.php on line %d
+NULL
+
+Notice: Undefined index: epic_magic in %sbug62978.php on line %d
+NULL
+
+Notice: Undefined index: epic_magic in %sbug62978.php on line %d
+NULL
+
+Notice: Undefined index: epic_magic in %sbug62978.php on line %d
+NULL
+bool(false)
+
+Strict Standards: Resource ID#%d used as offset, casting to integer (%d) in %sbug62978.php on line %d
+
+Notice: Undefined offset: %d in %sbug62978.php on line %d
+NULL
diff --git a/ext/spl/tests/fileobject_getmaxlinelen_error001.phpt b/ext/spl/tests/fileobject_getmaxlinelen_error001.phpt
new file mode 100644
index 0000000000..3c0c9eebd5
--- /dev/null
+++ b/ext/spl/tests/fileobject_getmaxlinelen_error001.phpt
@@ -0,0 +1,14 @@
+--TEST--
+SPL: SplFileObject::getMaxLineLen error 001
+--CREDITS--
+Erwin Poeze <erwin.poeze at gmail.com>
+--INI--
+include_path=.
+--FILE--
+<?php
+$s = new SplFileObject( __FILE__ );
+$s->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 0000000000..6bfdfdcf50
--- /dev/null
+++ b/ext/spl/tests/fileobject_setmaxlinelen_error001.phpt
@@ -0,0 +1,17 @@
+--TEST--
+SPL: SplFileObject::setMaxLineLen error 001()
+--CREDITS--
+Erwin Poeze <erwin.poeze at gmail.com>
+--FILE--
+<?php
+$s = new SplFileObject( __FILE__ );
+try {
+ $s->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 0000000000..dad59fca5f
--- /dev/null
+++ b/ext/spl/tests/fileobject_setmaxlinelen_error002.phpt
@@ -0,0 +1,12 @@
+--TEST--
+SPL: SplFileObject::setMaxLineLen error 002
+--CREDITS--
+Erwin Poeze <erwin.poeze at gmail.com>
+--FILE--
+<?php
+$s = new SplFileObject( __FILE__ );
+$s->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 0000000000..8dc50d5fc7
--- /dev/null
+++ b/ext/spl/tests/fileobject_setmaxlinelen_error003.phpt
@@ -0,0 +1,12 @@
+--TEST--
+SPL: SplFileObject::setMaxLineLen error 003
+--CREDITS--
+Erwin Poeze <erwin.poeze at gmail.com>
+--FILE--
+<?php
+$s = new SplFileObject( __FILE__ );
+$s->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/iterator_044.phpt b/ext/spl/tests/iterator_044.phpt
index 6d25531175..1271ccaa64 100755
--- a/ext/spl/tests/iterator_044.phpt
+++ b/ext/spl/tests/iterator_044.phpt
@@ -81,7 +81,7 @@ NULL
int(0)
bool(false)
-Notice: Undefined index: 0 in %siterator_044.php on line %d
+Notice: Undefined index: 0 in %siterator_044.php on line %d
NULL
===1===
object(stdClass)#%d (0) {
@@ -97,31 +97,31 @@ object(MyFoo)#%d (0) {
}
bool(false)
-Notice: Undefined index: foo in %siterator_044.php on line %d
+Notice: Undefined index: foo in %siterator_044.php on line %d
NULL
===3===
NULL
bool(false)
-Notice: Undefined index: in %siterator_044.php on line %d
+Notice: Undefined index: in %siterator_044.php on line %d
NULL
===4===
int(2)
bool(false)
-Notice: Undefined index: 2 in %siterator_044.php on line %d
+Notice: Undefined index: 2 in %siterator_044.php on line %d
NULL
===5===
string(3) "foo"
bool(false)
-Notice: Undefined index: foo in %siterator_044.php on line %d
+Notice: Undefined index: foo in %siterator_044.php on line %d
NULL
===6===
int(3)
bool(false)
-Notice: Undefined index: 3 in %siterator_044.php on line %d
+Notice: Undefined index: 3 in %siterator_044.php on line %d
NULL
===FILL===
===0===
@@ -146,7 +146,7 @@ int(1)
NULL
bool(false)
-Notice: Undefined index: in %siterator_044.php on line %d
+Notice: Undefined index: in %siterator_044.php on line %d
NULL
===4===
int(2)
@@ -160,6 +160,6 @@ int(1)
int(3)
bool(false)
-Notice: Undefined index: 3 in %siterator_044.php on line %d
+Notice: Undefined index: 3 in %siterator_044.php on line %d
NULL
===DONE===
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
index a2c50d5cb6..15fbefd51c 100644
--- a/ext/standard/assert.c
+++ b/ext/standard/assert.c
@@ -136,20 +136,20 @@ PHP_MINFO_FUNCTION(assert) /* {{{ */
}
/* }}} */
-/* {{{ proto int assert(string|bool assertion)
+/* {{{ proto int assert(string|bool assertion[, string description])
Checks if assertion is false */
PHP_FUNCTION(assert)
{
zval **assertion;
- int val;
+ int val, description_len = 0;
char *myeval = NULL;
- char *compiled_string_description;
+ char *compiled_string_description, *description = NULL;
if (! ASSERTG(active)) {
RETURN_TRUE;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &assertion) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|s", &assertion, &description, &description_len) == FAILURE) {
return;
}
@@ -167,7 +167,11 @@ PHP_FUNCTION(assert)
compiled_string_description = zend_make_compiled_string_description("assert code" TSRMLS_CC);
if (zend_eval_stringl(myeval, Z_STRLEN_PP(assertion), &retval, compiled_string_description TSRMLS_CC) == FAILURE) {
efree(compiled_string_description);
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s", PHP_EOL, myeval);
+ if (description_len == 0) {
+ php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s", PHP_EOL, myeval);
+ } else {
+ php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s:\"%s\"", PHP_EOL, description, myeval);
+ }
if (ASSERTG(bail)) {
zend_bailout();
}
@@ -196,7 +200,7 @@ PHP_FUNCTION(assert)
}
if (ASSERTG(callback)) {
- zval *args[3];
+ zval **args = safe_emalloc(description_len == 0 ? 3 : 4, sizeof(zval **), 0);
zval *retval;
int i;
uint lineno = zend_get_executed_lineno(TSRMLS_C);
@@ -214,19 +218,38 @@ PHP_FUNCTION(assert)
ZVAL_FALSE(retval);
/* XXX do we want to check for error here? */
- call_user_function(CG(function_table), NULL, ASSERTG(callback), retval, 3, args TSRMLS_CC);
+ if (description_len == 0) {
+ call_user_function(CG(function_table), NULL, ASSERTG(callback), retval, 3, args TSRMLS_CC);
+ for (i = 0; i <= 2; i++) {
+ zval_ptr_dtor(&(args[i]));
+ }
+ } else {
+ MAKE_STD_ZVAL(args[3]);
+ ZVAL_STRINGL(args[3], SAFE_STRING(description), description_len, 1);
- for (i = 0; i <= 2; i++) {
- zval_ptr_dtor(&(args[i]));
+ call_user_function(CG(function_table), NULL, ASSERTG(callback), retval, 4, args TSRMLS_CC);
+ for (i = 0; i <= 3; i++) {
+ zval_ptr_dtor(&(args[i]));
+ }
}
+
+ efree(args);
zval_ptr_dtor(&retval);
}
if (ASSERTG(warning)) {
- if (myeval) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Assertion \"%s\" failed", myeval);
+ if (description_len == 0) {
+ if (myeval) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Assertion \"%s\" failed", myeval);
+ } else {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Assertion failed");
+ }
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Assertion failed");
+ if (myeval) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s: \"%s\" failed", description, myeval);
+ } else {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s failed", description);
+ }
}
}
@@ -321,3 +344,4 @@ PHP_FUNCTION(assert_options)
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
+
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 1f1b3d366d..ece64f375f 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()
@@ -2742,10 +2730,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)
@@ -3783,8 +3767,6 @@ PHP_RINIT_FUNCTION(basic) /* {{{ */
/* Default to global filters only */
FG(stream_filters) = NULL;
- FG(wrapper_errors) = NULL;
-
return SUCCESS;
}
/* }}} */
@@ -5109,8 +5091,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/file.c b/ext/standard/file.c
index 8bc556653f..5dc91b44b3 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/incomplete_class.c b/ext/standard/incomplete_class.c
index 0ca2f04cf7..f6d3750e2b 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 07e152874a..beb147797d 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("<a href=\"http://www.php.net/\"><img border=\"0\" src=\"");
- php_info_print_request_uri(TSRMLS_C);
- php_info_print("?=");
- logo_guid = php_logo_guid();
- php_info_print(logo_guid);
- efree(logo_guid);
- php_info_print("\" alt=\"PHP Logo\" /></a>");
+ 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("<a href=\"http://www.php.net/\"><img border=\"0\" src=\"");
+ if (ta && (ta->tm_mon==3) && (ta->tm_mday==1)) {
+ php_info_print(PHP_EGG_LOGO_DATA_URI "\" alt=\"PHP logo\" /></a>");
+ } else {
+ php_info_print(PHP_LOGO_DATA_URI "\" alt=\"PHP logo\" /></a>");
+ }
}
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("<a href=\"http://www.zend.com/\"><img border=\"0\" src=\"");
- php_info_print_request_uri(TSRMLS_C);
- php_info_print("?="ZEND_LOGO_GUID"\" alt=\"Zend logo\" /></a>\n");
+ php_info_print(ZEND_LOGO_DATA_URI "\" alt=\"Zend logo\" /></a>\n");
}
php_info_print("This program makes use of the Zend Scripting Language Engine:");
php_info_print(!sapi_module.phpinfo_as_text?"<br />":"\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("<h1><a href=\"");
- php_info_print_request_uri(TSRMLS_C);
- php_info_print("?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000\">");
- php_info_print("PHP Credits");
- php_info_print("</a></h1>\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 & ~PHP_CREDITS_FULLPAGE 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("</div></body></html>");
}
@@ -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 fadde75eb6..9818593664 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 36568c508e..364f7fc399 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 b3e8c6f086..6e934a3857 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -1120,6 +1120,10 @@ static char *_php_math_number_format_ex_len(double d, int dec, char *dec_point,
tmplen = spprintf(&tmpbuf, 0, "%.*F", dec, d);
if (tmpbuf == NULL || !isdigit((int)tmpbuf[0])) {
+ if (result_len) {
+ *result_len = tmplen;
+ }
+
return tmpbuf;
}
diff --git a/ext/standard/pack.c b/ext/standard/pack.c
index 61228a63df..9894746f77 100644
--- a/ext/standard/pack.c
+++ b/ext/standard/pack.c
@@ -676,7 +676,6 @@ PHP_FUNCTION(unpack)
switch ((int) type) {
case 'a': {
/* a will not strip any trailing whitespace or null padding */
- char pad = ' ';
int len = inputlen - inputpos; /* Remaining string */
/* If size was given take minimum of len and size */
diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c
index 1ce7eff052..4eb69d7ef2 100644
--- a/ext/standard/quot_print.c
+++ b/ext/standard/quot_print.c
@@ -162,7 +162,10 @@ PHPAPI unsigned char *php_quot_print_encode(const unsigned char *str, size_t len
lp = 0;
} else {
if (iscntrl (c) || (c == 0x7f) || (c & 0x80) || (c == '=') || ((c == ' ') && (*str == '\015'))) {
- if ((lp += 3) > PHP_QPRINT_MAXL) {
+ if ((((lp+= 3) > PHP_QPRINT_MAXL) && (c <= 0x7f))
+ || ((c > 0x7f) && (c <= 0xdf) && ((lp + 3) > PHP_QPRINT_MAXL))
+ || ((c > 0xdf) && (c <= 0xef) && ((lp + 6) > PHP_QPRINT_MAXL))
+ || ((c > 0xef) && (c <= 0xf4) && ((lp + 9) > PHP_QPRINT_MAXL))) {
*d++ = '=';
*d++ = '\015';
*d++ = '\012';
@@ -283,4 +286,4 @@ PHP_FUNCTION(quoted_printable_encode)
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
- */
+ */ \ No newline at end of file
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 9a64376c27..7a4ae2e222 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -3930,7 +3930,6 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines)
new_char_count--;
}
if (new_char_count > 0) {
- char_count=new_char_count;
begin=new_begin;
}
}
@@ -5376,7 +5375,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/assert/assert04.phpt b/ext/standard/tests/assert/assert04.phpt
index 0da23186e6..bffadcb97c 100644
--- a/ext/standard/tests/assert/assert04.phpt
+++ b/ext/standard/tests/assert/assert04.phpt
@@ -15,7 +15,7 @@ assert(1);
/* Wrong parameter count in assert */
assert_options(ASSERT_ACTIVE, 1);
-assert(2,3);
+assert(2, "failure", 3);
/* Wrong parameter count in assert_options */
assert_options(ASSERT_ACTIVE, 0, 2);
@@ -36,7 +36,7 @@ echo "not reached\n";
?>
--EXPECTF--
-Warning: assert() expects exactly 1 parameter, 2 given in %s on line %d
+Warning: assert() expects at most 2 parameters, 3 given in %s on line %d
Warning: assert_options() expects at most 2 parameters, 3 given in %s on line %d
@@ -45,3 +45,4 @@ Warning: assert_options() expects parameter 1 to be long, %unicode_string_option
Warning: assert(): Assertion failed in %s on line %d
Warning: assert(): Assertion failed in %s on line %d
+
diff --git a/ext/standard/tests/assert/assert_basic6.phpt b/ext/standard/tests/assert/assert_basic6.phpt
new file mode 100644
index 0000000000..2a73713437
--- /dev/null
+++ b/ext/standard/tests/assert/assert_basic6.phpt
@@ -0,0 +1,26 @@
+--TEST--
+assert() - basic - Test that bailout works
+--INI--
+assert.active = 1
+assert.warning = 1
+assert.callback = f1
+assert.quiet_eval = 1
+assert.bail = 0
+--FILE--
+<?php
+function f1($message)
+{
+ echo "f1 called\n";
+}
+
+//bail out on error
+var_dump($rao = assert_options(ASSERT_BAIL, 1));
+$sa = "0 != 0";
+var_dump($r2 = assert($sa, "0 is 0"));
+echo "If this is printed BAIL hasn't worked";
+--EXPECTF--
+int(0)
+f1 called
+
+Warning: assert(): 0 is 0: "0 != 0" failed in %s on line 10
+
diff --git a/ext/standard/tests/assert/assert_error1.phpt b/ext/standard/tests/assert/assert_error1.phpt
index 6211f1c918..657b411f67 100644
--- a/ext/standard/tests/assert/assert_error1.phpt
+++ b/ext/standard/tests/assert/assert_error1.phpt
@@ -20,19 +20,19 @@ function handler($errno, $errstr) {
//Wrong number of parameters for assert_options()
assert_options(ASSERT_WARNING, 1);
-var_dump($rao=assert_options(ASSERT_CALLBACK,"f1",1));
+var_dump($rao = assert_options(ASSERT_CALLBACK, "f1", 1));
//Unknown option for assert_options()
-var_dump($rao=assert_options("F1","f1"));
+var_dump($rao=assert_options("F1", "f1"));
//Wrong number of parameters for assert()
$sa="0 != 0";
-var_dump($r2=assert($sa,1));
+var_dump($r2 = assert($sa, "message", 1));
//Catch recoverable error with handler
-var_dump($rc=assert('aa=sd+as+safsafasfaçsafçsafç'));
+var_dump($rc = assert('aa=sd+as+safsafasfaçsafçsafç'));
--EXPECTF--
Warning: assert_options() expects at most 2 parameters, 3 given in %s on line %d
NULL
@@ -40,5 +40,6 @@ NULL
Warning: assert_options() expects parameter 1 to be long, string given in %s on line %d
NULL
-Warning: assert() expects exactly 1 parameter, 2 given in %s on line %d
+Warning: assert() expects at most 2 parameters, 3 given in %s on line %d
NULL
+
diff --git a/ext/standard/tests/assert/assert_error2.phpt b/ext/standard/tests/assert/assert_error2.phpt
new file mode 100644
index 0000000000..da7c3d9e0b
--- /dev/null
+++ b/ext/standard/tests/assert/assert_error2.phpt
@@ -0,0 +1,30 @@
+--TEST--
+assert() - basic - Test that bailout works
+--INI--
+assert.active = 1
+assert.warning = 1
+assert.callback = f1
+assert.quiet_eval = 1
+assert.bail = 0
+error_reporting = -1
+display_errors = 1
+--FILE--
+<?php
+function f1($script, $line, $message, $user_message)
+{
+ echo "f1 called\n";
+}
+
+//bail out on error
+var_dump($rao = assert_options(ASSERT_BAIL, 1));
+$sa = "0 != 0";
+var_dump($r2 = assert($sa));
+echo "If this is printed BAIL hasn't worked";
+--EXPECTF--
+int(0)
+
+Warning: Missing argument 4 for f1() in %s on line 2
+f1 called
+
+Warning: assert(): Assertion "0 != 0" failed in %s on line 10
+
diff --git a/ext/standard/tests/assert/assert_error3.phpt b/ext/standard/tests/assert/assert_error3.phpt
new file mode 100644
index 0000000000..54b91edd3d
--- /dev/null
+++ b/ext/standard/tests/assert/assert_error3.phpt
@@ -0,0 +1,21 @@
+--TEST--
+assert() - basic - Test recoverable error
+--INI--
+assert.active = 1
+assert.warning = 1
+assert.callback = f1
+assert.quiet_eval = 0
+assert.bail = 0
+error_reporting = -1
+display_errors = 1
+--FILE--
+<?php
+$sa = "0 $ 0";
+var_dump($r2 = assert($sa));
+--EXPECTF--
+
+Parse error: syntax error, unexpected '$' in %s(3) : assert code on line 1
+
+Catchable fatal error: assert(): Failure evaluating code:
+0 $ 0 in %s on line 3
+
diff --git a/ext/standard/tests/assert/assert_error4.phpt b/ext/standard/tests/assert/assert_error4.phpt
new file mode 100644
index 0000000000..264cc8fecf
--- /dev/null
+++ b/ext/standard/tests/assert/assert_error4.phpt
@@ -0,0 +1,21 @@
+--TEST--
+assert() - basic - Test recoverable error
+--INI--
+assert.active = 1
+assert.warning = 1
+assert.callback = f1
+assert.quiet_eval = 0
+assert.bail = 0
+error_reporting = -1
+display_errors = 1
+--FILE--
+<?php
+$sa = "0 $ 0";
+var_dump($r2 = assert($sa, "Describing what was asserted"));
+--EXPECTF--
+
+Parse error: syntax error, unexpected '$' in %s(3) : assert code on line 1
+
+Catchable fatal error: assert(): Failure evaluating code:
+Describing what was asserted:"0 $ 0" in %s on line 3
+
diff --git a/ext/standard/tests/file/realpath_cache.phpt b/ext/standard/tests/file/realpath_cache.phpt
index 92d6fc5b2a..0eb9dc519a 100644
--- a/ext/standard/tests/file/realpath_cache.phpt
+++ b/ext/standard/tests/file/realpath_cache.phpt
@@ -19,7 +19,7 @@ echo "Done\n";
int(%d)
array(4) {
["key"]=>
- %s(%d)
+ %s(%f)
["is_dir"]=>
bool(true)
["realpath"]=>
diff --git a/ext/standard/tests/general_functions/bug27678.phpt b/ext/standard/tests/general_functions/bug27678.phpt
index 5db5890a1c..6f95509e14 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 dd4b5142a1..78f0f03003 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--
+<?php if (PHP_ZTS) { print "skip only for no-zts build"; }
--FILE--
<?php
/* Prototype: void debug_zval_dump ( mixed $variable );
diff --git a/ext/standard/tests/general_functions/uniqid_basic.phpt b/ext/standard/tests/general_functions/uniqid_basic.phpt
index 9a9c573327..2da832b8ed 100644
--- a/ext/standard/tests/general_functions/uniqid_basic.phpt
+++ b/ext/standard/tests/general_functions/uniqid_basic.phpt
@@ -1,73 +1,72 @@
---TEST--
-Test uniqid() function : basic functionality
---FILE--
-<?php
-/* Prototype : string uniqid ([ string $prefix= "" [, bool $more_entropy= false ]] )
- * Description: Gets a prefixed unique identifier based on the current time in microseconds.
- * Source code: ext/standard/uniqid.c
-*/
-echo "*** Testing uniqid() : basic functionality ***\n";
-
-echo "\nuniqid() without a prefix\n";
-var_dump(uniqid());
-var_dump(uniqid(null, true));
-var_dump(uniqid(null, false));
-echo "\n\n";
-
-echo "uniqid() with a prefix\n";
-
-// Use a fixed prefix so we can ensure length of o/p id is fixed
-$prefix = array (
- 99999,
- "99999",
- 10.5e2,
- null,
- true,
- false
- );
-
-for ($i = 0; $i < count($prefix); $i++) {
- var_dump(uniqid($prefix[$i]));
- var_dump(uniqid($prefix[$i], true));
- var_dump(uniqid($prefix[$i], false));
- echo "\n";
-}
-
-?>
-===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--
+<?php
+/* Prototype : string uniqid ([ string $prefix= "" [, bool $more_entropy= false ]] )
+ * Description: Gets a prefixed unique identifier based on the current time in microseconds.
+ * Source code: ext/standard/uniqid.c
+*/
+echo "*** Testing uniqid() : basic functionality ***\n";
+
+echo "\nuniqid() without a prefix\n";
+var_dump(uniqid());
+var_dump(uniqid(null, true));
+var_dump(uniqid(null, false));
+echo "\n\n";
+
+echo "uniqid() with a prefix\n";
+
+// Use a fixed prefix so we can ensure length of o/p id is fixed
+$prefix = array (
+ 99999,
+ "99999",
+ 10.5e2,
+ null,
+ true,
+ false
+ );
+
+for ($i = 0; $i < count($prefix); $i++) {
+ var_dump(uniqid($prefix[$i]));
+ var_dump(uniqid($prefix[$i], true));
+ var_dump(uniqid($prefix[$i], false));
+ echo "\n";
+}
+
+?>
+===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 2b306696a6..a6403e610d 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 03ed496aca..c862691e91 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/php_ini_loaded_file.phpt b/ext/standard/tests/php_ini_loaded_file.phpt
index 747e0196f1..7d441582ee 100644
--- a/ext/standard/tests/php_ini_loaded_file.phpt
+++ b/ext/standard/tests/php_ini_loaded_file.phpt
@@ -10,5 +10,5 @@ precision=12
<?php
var_dump(php_ini_loaded_file());
?>
---EXPECTF--
-string(%d) "%sphp.ini"
+--EXPECTREGEX--
+string\(\d+\) ".*php\.ini"|bool\(false\)
diff --git a/ext/standard/tests/php_logo_guid.phpt b/ext/standard/tests/php_logo_guid.phpt
deleted file mode 100644
index c644b2893b..0000000000
--- 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--
-<?php
-echo php_logo_guid();
-?>
---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 a9fa7d35d5..0000000000
--- 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--
-<?php
-echo php_real_logo_guid();
-?>
---EXPECT--
-PHPE9568F34-D428-11d2-A769-00AA001ACF42
diff --git a/ext/standard/tests/serialize/bug62836_1.phpt b/ext/standard/tests/serialize/bug62836_1.phpt
new file mode 100644
index 0000000000..7291046410
--- /dev/null
+++ b/ext/standard/tests/serialize/bug62836_1.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Bug #62836 (Seg fault or broken object references on unserialize())
+--FILE--
+<?php
+$serialized_object='O:1:"A":4:{s:1:"b";O:1:"B":0:{}s:2:"b1";r:2;s:1:"c";O:1:"B":0:{}s:2:"c1";r:4;}';
+function __autoload($name) {
+ unserialize("i:4;");
+ eval("class $name {} ");
+}
+
+print_r(unserialize($serialized_object));
+echo "okey";
+?>
+--EXPECT--
+A Object
+(
+ [b] => B Object
+ (
+ )
+
+ [b1] => B Object
+ (
+ )
+
+ [c] => B Object
+ (
+ )
+
+ [c1] => B Object
+ (
+ )
+
+)
+okey
diff --git a/ext/standard/tests/serialize/bug62836_2.phpt b/ext/standard/tests/serialize/bug62836_2.phpt
new file mode 100644
index 0000000000..0634b1dac1
--- /dev/null
+++ b/ext/standard/tests/serialize/bug62836_2.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #62836 (Seg fault or broken object references on unserialize())
+--FILE--
+<?php
+$serialized_object='O:1:"A":4:{s:1:"b";O:1:"B":0:{}s:2:"b1";r:2;s:1:"c";O:1:"B":0:{}s:2:"c1";r:4;}';
+
+ini_set('unserialize_callback_func','mycallback');
+
+function mycallback($classname) {
+ unserialize("i:4;");
+ eval ("class $classname {} ");
+}
+
+print_r(unserialize($serialized_object));
+echo "okey";
+?>
+--EXPECT--
+A Object
+(
+ [b] => B Object
+ (
+ )
+
+ [b1] => B Object
+ (
+ )
+
+ [c] => B Object
+ (
+ )
+
+ [c1] => B Object
+ (
+ )
+
+)
+okey
diff --git a/ext/standard/tests/streams/bug40459.phpt b/ext/standard/tests/streams/bug40459.phpt
new file mode 100644
index 0000000000..8ee4363ed9
--- /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--
+<?php
+// Test whether the constructor of the user-space stream wrapper is called when stream functions are called
+class testwrapper {
+ private $constructorCalled = false;
+ function __construct() {
+ $this->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 89374e7353..99e2f7929c 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--
+<?php
+if (getenv("USE_ZEND_ALLOC") === "0") {
+ die("skip Zend MM disabled");
+}
+?>
--FILE--
<?php
diff --git a/ext/standard/tests/strings/bug62462.phpt b/ext/standard/tests/strings/bug62462.phpt
new file mode 100644
index 0000000000..c6eb41a543
--- /dev/null
+++ b/ext/standard/tests/strings/bug62462.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Multibyte characters shouldn't be split by soft line break added by quoted_printable_encode - 4 byte character test
+--FILE--
+<?php
+echo quoted_printable_encode(str_repeat("\xc4\x85", 77));
+?>
+
+==DONE==
+--EXPECT--
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85
+==DONE==
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 0000000000..56d81c9fdd
--- /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 <adam [dot] gegotek [at] gmail [dot] com>
+--FILE--
+<?php
+/* Prototype : string http_build_query ( mixed $query_data [, string $numeric_prefix [, string $arg_separator [, int $enc_type = PHP_QUERY_RFC1738 ]]] )
+ * Description: Generates a URL-encoded query string from the associative (or indexed) array provided.
+ * Source code: ext/standard/http.c
+*/
+
+class UrlBuilder
+{
+ public $name = 'homepage';
+ public $page = 1;
+ protected $sort = 'desc,name';
+ private $access = 'admin';
+}
+
+$obj = new stdClass;
+$obj->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 0000000000..ca1d8f459a
--- /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 <adam [dot] gegotek [at] gmail [dot] com>
+--FILE--
+<?php
+/* Prototype : string http_build_query ( mixed $query_data [, string $numeric_prefix [, string $arg_separator [, int $enc_type = PHP_QUERY_RFC1738 ]]] )
+ * Description: Generates a URL-encoded query string from the associative (or indexed) array provided.
+ * Source code: ext/standard/http.c
+*/
+
+$mDimensional = array(
+ 20,
+ 5 => 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 0000000000..107120e084
--- /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 <adam [dot] gegotek [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (version_compare(PHP_VERSION, '5.4.0', '<')) die("skip this test if PHP_VERSION is less than 5.4.0");
+?>
+--FILE--
+<?php
+/* Prototype : string http_build_query ( mixed $query_data [, string $numeric_prefix [, string $arg_separator [, int $enc_type = PHP_QUERY_RFC1738 ]]] )
+ * Description: Generates a URL-encoded query string from the associative (or indexed) array provided.
+ * Source code: ext/standard/http.c
+*/
+
+$oDimensional = array(
+ "name" => "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/strings/quoted_printable_encode_002.phpt b/ext/standard/tests/strings/quoted_printable_encode_002.phpt
index 5380eb0bff..aaf5608f33 100644
--- a/ext/standard/tests/strings/quoted_printable_encode_002.phpt
+++ b/ext/standard/tests/strings/quoted_printable_encode_002.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/str_pad_variation5.phpt b/ext/standard/tests/strings/str_pad_variation5.phpt
index 4b300c4717..cd979a1c8b 100644
--- a/ext/standard/tests/strings/str_pad_variation5.phpt
+++ b/ext/standard/tests/strings/str_pad_variation5.phpt
@@ -5,6 +5,9 @@ memory_limit=128M
--SKIPIF--
<?php
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+if (getenv("USE_ZEND_ALLOC") === "0") {
+ die("skip Zend MM disabled");
+}
?>
--FILE--
<?php
diff --git a/ext/standard/tests/url/parse_url_relative_scheme.phpt b/ext/standard/tests/url/parse_url_relative_scheme.phpt
new file mode 100644
index 0000000000..7c8952db71
--- /dev/null
+++ b/ext/standard/tests/url/parse_url_relative_scheme.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Test parse_url() function: Checks relative URL schemes (e.g. "//example.com")
+--FILE--
+<?php
+var_dump(parse_url('//example.org'));
+--EXPECT--
+array(1) {
+ ["host"]=>
+ string(11) "example.org"
+}
+
diff --git a/ext/standard/tests/zend_logo_guid.phpt b/ext/standard/tests/zend_logo_guid.phpt
deleted file mode 100644
index d26ed45e9e..0000000000
--- 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--
-<?php
-echo zend_logo_guid();
-?>
---EXPECT--
-PHPE9568F35-D428-11d2-A769-00AA001ACF42
diff --git a/ext/standard/url.c b/ext/standard/url.c
index 8489f42091..44a568032b 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -204,6 +204,8 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
} else {
goto just_path;
}
+ } else if (*s == '/' && *(s+1) == '/') { /* relative-scheme URL */
+ s += 2;
} else {
just_path:
ue = s + length;
@@ -220,14 +222,14 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
if (query && fragment) {
if (query > fragment) {
- p = e = fragment;
+ e = fragment;
} else {
- p = e = query;
+ e = query;
}
} else if (query) {
- p = e = query;
+ e = query;
} else if (fragment) {
- p = e = fragment;
+ e = fragment;
}
} else {
e = p;
diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c
index d106d95a36..dc33b96b8f 100644
--- a/ext/standard/url_scanner_ex.c
+++ b/ext/standard/url_scanner_ex.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Sun Jan 1 10:36:29 2012 */
+/* Generated by re2c 0.13.5 on Tue May 15 13:07:17 2012 */
#line 1 "ext/standard/url_scanner_ex.re"
/*
+----------------------------------------------------------------------+
diff --git a/ext/standard/var.c b/ext/standard/var.c
index 735d0a7cbb..494fb583c7 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);
diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c
index be10bc49dd..21f99582a7 100644
--- a/ext/standard/var_unserializer.c
+++ b/ext/standard/var_unserializer.c
@@ -620,10 +620,13 @@ yy20:
do {
/* Try to find class directly */
+ BG(serialize_lock) = 1;
if (zend_lookup_class(class_name, len2, &pce TSRMLS_CC) == SUCCESS) {
+ BG(serialize_lock) = 0;
ce = *pce;
break;
}
+ BG(serialize_lock) = 0;
/* Check for unserialize callback */
if ((PG(unserialize_callback_func) == NULL) || (PG(unserialize_callback_func)[0] == '\0')) {
@@ -638,7 +641,9 @@ yy20:
args[0] = &arg_func_name;
MAKE_STD_ZVAL(arg_func_name);
ZVAL_STRING(arg_func_name, class_name, 1);
+ BG(serialize_lock) = 1;
if (call_user_function_ex(CG(function_table), NULL, user_func, &retval_ptr, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) {
+ BG(serialize_lock) = 0;
php_error_docref(NULL TSRMLS_CC, E_WARNING, "defined (%s) but not found", user_func->value.str.val);
incomplete_class = 1;
ce = PHP_IC_ENTRY;
@@ -646,6 +651,7 @@ yy20:
zval_ptr_dtor(&arg_func_name);
break;
}
+ BG(serialize_lock) = 0;
if (retval_ptr) {
zval_ptr_dtor(&retval_ptr);
}
diff --git a/ext/tokenizer/tests/bug60097.phpt b/ext/tokenizer/tests/bug60097.phpt
new file mode 100644
index 0000000000..2116866c93
--- /dev/null
+++ b/ext/tokenizer/tests/bug60097.phpt
@@ -0,0 +1,121 @@
+--TEST--
+Bug 60097: token_get_all fails to lex nested heredoc
+--FILE--
+<?php
+
+var_dump(token_get_all('<?php
+<<<DOC1
+{$s(<<<DOC2
+DOC2
+)}
+DOC1;
+'));
+
+?>
+--EXPECT--
+array(14) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(374)
+ [1]=>
+ string(6) "<?php
+"
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(378)
+ [1]=>
+ string(8) "<<<DOC1
+"
+ [2]=>
+ int(2)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(381)
+ [1]=>
+ string(1) "{"
+ [2]=>
+ int(3)
+ }
+ [3]=>
+ array(3) {
+ [0]=>
+ int(310)
+ [1]=>
+ string(2) "$s"
+ [2]=>
+ int(3)
+ }
+ [4]=>
+ string(1) "("
+ [5]=>
+ array(3) {
+ [0]=>
+ int(378)
+ [1]=>
+ string(8) "<<<DOC2
+"
+ [2]=>
+ int(3)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(379)
+ [1]=>
+ string(4) "DOC2"
+ [2]=>
+ int(4)
+ }
+ [7]=>
+ array(3) {
+ [0]=>
+ int(377)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(4)
+ }
+ [8]=>
+ string(1) ")"
+ [9]=>
+ string(1) "}"
+ [10]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(5)
+ }
+ [11]=>
+ array(3) {
+ [0]=>
+ int(379)
+ [1]=>
+ string(4) "DOC1"
+ [2]=>
+ int(6)
+ }
+ [12]=>
+ string(1) ";"
+ [13]=>
+ array(3) {
+ [0]=>
+ int(377)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(6)
+ }
+}
diff --git a/ext/tokenizer/tests/token_get_all_variation11.phpt b/ext/tokenizer/tests/token_get_all_variation11.phpt
index ecc86177a4..98d89961b7 100644
--- a/ext/tokenizer/tests/token_get_all_variation11.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation11.phpt
@@ -130,7 +130,7 @@ array(49) {
[6]=>
array(3) {
[0]=>
- int(283)
+ int(%d)
[1]=>
string(2) "=="
[2]=>
@@ -273,7 +273,7 @@ array(49) {
[27]=>
array(3) {
[0]=>
- int(283)
+ int(%d)
[1]=>
string(2) "=="
[2]=>
diff --git a/ext/tokenizer/tests/token_get_all_variation13.phpt b/ext/tokenizer/tests/token_get_all_variation13.phpt
index 9b2f3bc94f..6f85492a99 100644
--- a/ext/tokenizer/tests/token_get_all_variation13.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation13.phpt
@@ -1005,7 +1005,7 @@ array(145) {
[122]=>
array(3) {
[0]=>
- int(288)
+ int(%d)
[1]=>
string(10) "instanceof"
[2]=>
diff --git a/ext/tokenizer/tests/token_get_all_variation17.phpt b/ext/tokenizer/tests/token_get_all_variation17.phpt
index dccc4c9c23..f71444bc1e 100644
--- a/ext/tokenizer/tests/token_get_all_variation17.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation17.phpt
@@ -145,7 +145,7 @@ array(81) {
[14]=>
array(3) {
[0]=>
- int(283)
+ int(%d)
[1]=>
string(2) "=="
[2]=>
diff --git a/ext/tokenizer/tests/token_get_all_variation4.phpt b/ext/tokenizer/tests/token_get_all_variation4.phpt
index 45e6f8afbd..6bc111efba 100644
--- a/ext/tokenizer/tests/token_get_all_variation4.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation4.phpt
@@ -339,7 +339,7 @@ array(89) {
[38]=>
array(3) {
[0]=>
- int(279)
+ int(%d)
[1]=>
string(2) "&&"
[2]=>
@@ -518,7 +518,7 @@ array(89) {
[60]=>
array(3) {
[0]=>
- int(278)
+ int(%d)
[1]=>
string(2) "||"
[2]=>
diff --git a/ext/tokenizer/tests/token_get_all_variation5.phpt b/ext/tokenizer/tests/token_get_all_variation5.phpt
index 0068f2866f..681fb48e57 100644
--- a/ext/tokenizer/tests/token_get_all_variation5.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation5.phpt
@@ -181,7 +181,7 @@ array(94) {
[18]=>
array(3) {
[0]=>
- int(277)
+ int(%d)
[1]=>
string(2) "+="
[2]=>
@@ -238,7 +238,7 @@ array(94) {
[25]=>
array(3) {
[0]=>
- int(276)
+ int(%d)
[1]=>
string(2) "-="
[2]=>
@@ -295,7 +295,7 @@ array(94) {
[32]=>
array(3) {
[0]=>
- int(275)
+ int(%d)
[1]=>
string(2) "*="
[2]=>
@@ -352,7 +352,7 @@ array(94) {
[39]=>
array(3) {
[0]=>
- int(274)
+ int(%d)
[1]=>
string(2) "/="
[2]=>
@@ -409,7 +409,7 @@ array(94) {
[46]=>
array(3) {
[0]=>
- int(272)
+ int(%d)
[1]=>
string(2) "%="
[2]=>
@@ -466,7 +466,7 @@ array(94) {
[53]=>
array(3) {
[0]=>
- int(271)
+ int(%d)
[1]=>
string(2) "&="
[2]=>
@@ -523,7 +523,7 @@ array(94) {
[60]=>
array(3) {
[0]=>
- int(270)
+ int(%d)
[1]=>
string(2) "|="
[2]=>
@@ -580,7 +580,7 @@ array(94) {
[67]=>
array(3) {
[0]=>
- int(269)
+ int(%d)
[1]=>
string(2) "^="
[2]=>
@@ -637,7 +637,7 @@ array(94) {
[74]=>
array(3) {
[0]=>
- int(267)
+ int(%d)
[1]=>
string(3) ">>="
[2]=>
@@ -694,7 +694,7 @@ array(94) {
[81]=>
array(3) {
[0]=>
- int(268)
+ int(%d)
[1]=>
string(3) "<<="
[2]=>
@@ -751,7 +751,7 @@ array(94) {
[88]=>
array(3) {
[0]=>
- int(273)
+ int(%d)
[1]=>
string(2) ".="
[2]=>
diff --git a/ext/tokenizer/tests/token_get_all_variation6.phpt b/ext/tokenizer/tests/token_get_all_variation6.phpt
index 54936d0c89..6213dab9d0 100644
--- a/ext/tokenizer/tests/token_get_all_variation6.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation6.phpt
@@ -191,7 +191,7 @@ array(50) {
[21]=>
array(3) {
[0]=>
- int(287)
+ int(%d)
[1]=>
string(2) "<<"
[2]=>
@@ -277,7 +277,7 @@ array(50) {
[32]=>
array(3) {
[0]=>
- int(286)
+ int(%d)
[1]=>
string(2) ">>"
[2]=>
diff --git a/ext/tokenizer/tests/token_get_all_variation8.phpt b/ext/tokenizer/tests/token_get_all_variation8.phpt
index 0cf1d63471..c80a5d0f04 100644
--- a/ext/tokenizer/tests/token_get_all_variation8.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation8.phpt
@@ -794,7 +794,7 @@ array(108) {
[103]=>
array(3) {
[0]=>
- int(289)
+ int(%d)
[1]=>
string(7) "(unset)"
[2]=>
diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c
index c5cbf6c7d2..d22fd71243 100644
--- a/ext/tokenizer/tokenizer.c
+++ b/ext/tokenizer/tokenizer.c
@@ -138,11 +138,8 @@ static void tokenize(zval *return_value TSRMLS_DC)
token_line = ++CG(zend_lineno);
CG(increment_lineno) = 0;
}
- add_next_index_stringl(keyword, Z_STRVAL(token), Z_STRLEN(token), 1);
- efree(Z_STRVAL(token));
- } else {
- add_next_index_stringl(keyword, (char *)zendtext, zendleng, 1);
}
+ add_next_index_stringl(keyword, (char *)zendtext, zendleng, 1);
add_next_index_long(keyword, token_line);
add_next_index_zval(return_value, keyword);
} else {
diff --git a/ext/tokenizer/tokenizer_data.c b/ext/tokenizer/tokenizer_data.c
index 85822f1994..c1b3e57662 100644
--- a/ext/tokenizer/tokenizer_data.c
+++ b/ext/tokenizer/tokenizer_data.c
@@ -21,7 +21,7 @@
/*
DO NOT EDIT THIS FILE!
This file is generated using tokenizer_data_gen.sh
-*/
+*/
#include "php.h"
#include "zend.h"
@@ -108,8 +108,10 @@ void tokenizer_register_constants(INIT_FUNC_ARGS) {
REGISTER_LONG_CONSTANT("T_FUNCTION", T_FUNCTION, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("T_CONST", T_CONST, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("T_RETURN", T_RETURN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_YIELD", T_YIELD, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("T_TRY", T_TRY, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("T_CATCH", T_CATCH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_FINALLY", T_FINALLY, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("T_THROW", T_THROW, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("T_USE", T_USE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("T_INSTEADOF", T_INSTEADOF, CONST_CS | CONST_PERSISTENT);
@@ -242,8 +244,10 @@ char *get_token_type_name(int token_type)
case T_FUNCTION: return "T_FUNCTION";
case T_CONST: return "T_CONST";
case T_RETURN: return "T_RETURN";
+ case T_YIELD: return "T_YIELD";
case T_TRY: return "T_TRY";
case T_CATCH: return "T_CATCH";
+ case T_FINALLY: return "T_FINALLY";
case T_THROW: return "T_THROW";
case T_USE: return "T_USE";
case T_INSTEADOF: return "T_INSTEADOF";
diff --git a/ext/xml/tests/bug62328.phpt b/ext/xml/tests/bug62328.phpt
new file mode 100644
index 0000000000..e4c3c59d37
--- /dev/null
+++ b/ext/xml/tests/bug62328.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #62328 (implementing __toString and a cast to string fails)
+--SKIPIF--
+<?php
+require_once("skipif.inc");
+?>
+--FILE--
+<?php
+class UberSimpleXML extends SimpleXMLElement {
+ public function __toString() {
+ return 'stringification';
+ }
+}
+
+$xml = new UberSimpleXML('<xml/>');
+
+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 b1da27f252..24e4b2749c 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--
+<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
--FILE--
<?php
$xml = <<<XML
diff --git a/ext/zip/tests/bug51353.phpt b/ext/zip/tests/bug51353.phpt
new file mode 100644
index 0000000000..560945f9dd
--- /dev/null
+++ b/ext/zip/tests/bug51353.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Bug #51353 ZIP64 problem, archive with 100000 items
+--SKIPIF--
+<?php
+if(!extension_loaded('zip')) die('skip');
+die('skip the test might get very long, activate it manually');
+--FILE--
+<?php
+/* This test might get very long depending on the mashine it's running on. Therefore
+adding an explicit skip, remove it to run this test. */
+set_time_limit(0);
+
+$base_path = dirname(__FILE__);
+
+/* Either we ship a file with 100000 entries which would be >12M big,
+ or create it dynamically. */
+$zip = new ZipArchive;
+$r = $zip->open("$base_path/51353.zip", ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE);
+if ($r) {
+ for ($i = 0; $i < 100000; $i++) {
+ $zip->addFromString("$i.txt", '1');
+ }
+ $zip->close();
+} else {
+ die("failed");
+}
+
+$zip = new ZipArchive;
+$r = $zip->open("$base_path/51353.zip");
+if ($r) {
+ $zip->extractTo("$base_path/51353_unpack");
+ $zip->close();
+
+ $a = glob("$base_path/51353_unpack/*.txt");
+ echo count($a) . "\n";
+} else {
+ die("failed");
+}
+
+echo "OK";
+--CLEAN--
+<?php
+$base_path = dirname(__FILE__);
+
+unlink("$base_path/51353.zip");
+
+$a = glob("$base_path/51353_unpack/*.txt");
+foreach($a as $f) {
+ unlink($f);
+}
+rmdir("$base_path/51353_unpack");
+--EXPECT--
+100000
+OK
diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h
index 3d8c90cbf5..e895e0e482 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-win.phpt b/ext/zlib/tests/bug55544-win.phpt
new file mode 100644
index 0000000000..03fd6b1c90
--- /dev/null
+++ b/ext/zlib/tests/bug55544-win.phpt
Binary files differ
diff --git a/ext/zlib/tests/bug55544.phpt b/ext/zlib/tests/bug55544.phpt
new file mode 100644
index 0000000000..a0d22f4fce
--- /dev/null
+++ b/ext/zlib/tests/bug55544.phpt
Binary files differ
diff --git a/ext/zlib/tests/bug_52944-win.phpt b/ext/zlib/tests/bug_52944-win.phpt
new file mode 100644
index 0000000000..e3919951bc
--- /dev/null
+++ b/ext/zlib/tests/bug_52944-win.phpt
@@ -0,0 +1,161 @@
+--TEST--
+Bug #52944 (segfault with zlib filter and corrupted data)
+--SKIPIF--
+<?php if (!extension_loaded("zlib")) print "skip"; ?>
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die("skip windows only");
+}
+--INI--
+allow_url_fopen=1
+--FILE--
+<?php
+$data =
+'U3XuBFLaJfQAWt4cqi8u8ugXxyDcPTZy8VicbJr50gGTEh0dmo+d8O4uBCTuAf3dHbbDYTieluscWXkKlavfKdMkZZRP3GpTApbb'.
+'mQONJCgdbpPHat6iGOoq34vIGCLKFuD8qiA4ti5AL7bArvDtd7i+5tvn49j1L3bwroIsk1iPS5leATIwp1iwk+VdPLzu7tsexYBf'.
+'giLx7WtQI779GtQIKD1QI4AT1Ihvf0I1Iu1u1Ca+7Vs3TtfqiCXvrm99EuJy/ix5z1VD8atW9sUyvmu/pQn8KU5lZvHUqC5xzgow'.
+'0e8m/e5n5fLH2EPhBn4CA3n0p02/E/hVlAgxNIczOk7H7shAHSyUQ7PIwicPE/xNw7Nq4F+aHj2CowlZQKvhr2+fGIhA1QsSG6SD'.
+'y3MBWfRsWxpYq08oqfievkq2Du7uwO99DGhG4GQrIODp67QfRFEFnrUQWD1qV2R44JVHoEjwt5c6ASus4MdOAtA+2OZAHLLOA9O6'.
+'4kgGY4wOggODnQMWrk6fnTn4s4E/GG/QqEPiOiY+PWvij9MDz+0qM8WlyB6rGiGdVcVbChvQJhcjos7ShfrFxU017nBgsMHx2OON'.
+'NV7mx3AovW/veYYnlUfNlF1TNysBvNPrs5V6ClWzREIaxqSGPIK+EoQEeqBvCarbQHOQnolOl/jMrmXPMBWbIDRkzJPVo3kCD3Us'.
+'NRXjK+Ad8/fMLPiqY7+CulD4Vc/pga9nIEdhGDsx1qvT4Aw9rpW6rGtv5tqvcnMLWCNgtbu7BZ25GYiGMwiStZFNs0jY+uxVFrcG'.
+'rOVt+PaYWLhRRxt3rOCm2E/BUUA75CBa7wmWkSkXFyV7bsA/9NU5TPSC8jU9p/fSqS0u9l44323oNb1h6KfYl1mvAYIzNUX0Csfp'.
+'pozkYa12FecgDSsD86KHnATUwz8uzu3jbL5Bkb9UyUtMjL30feyC0oVBYY/DcR8DYdAnbI1FcItMFuAcIkNLx7498TGqFlN49v/K'.
+'5TdaEbZPfKhWMwvZw5SKGjMvAGm6xBrEIRtYsmfRcY0NfA5ogzyuzS2nO9sCMcVkMlxTpc03vuJcSkv9T4aZkYktzv5j3FUIf9Eu'.
+'EVuPX9ZM2dBAEEEAmEzVXRcbdmMfGoEF0hn+ufCvjZoGXMbSLKGXRkIhYEcJFHzrGphvw7M/YAd1MT/q4b1weBHE7+N+ge1EyDGK'.
+'vT/q0GzHs65w1UpMcFyhKRUsLtZfOj1gG3MMrfijvnyV7gJ6DOJTfsQwogzOuESkGzr2vt7AB5ltDDDgs1YBLCP2Hs4ep/INGvDn'.
+'0gS4x7TeREJvQoEvnXoNF2AxzeJZadBG9nsfE1DhTWy/BU0CvZ/t/8VxK1No7y8OsiarJz7+Z4eP7zN0XqDFE2fBdgcLzaFdGau4'.
+'eCY+NT0bWZiQ9RJ8xXipdAO0oplw23O6CXo1DvAcC7C0VnHjT9+dnveSDURCDL+J058ivgw1MKpyUank1fTE7eD+MYNOtKepW3EM'.
+'5BaeogscRezzQwX74AjxOVQW7QYa4BPofdJVOrFAYE2dq42rbINe19qxXjuXQquNl2liaVckfFge4ywTvwxcfNuyttEveIsC5Efh'.
+'t/0A5I1okwDIHgrUs3fN2x3Q79uewcOW4/dgcJII2THNt84OUqH5dlnqMzEPzLrjLQi4S+MtVgp6vWcf+ZBE33o8admzR8jNW06P'.
+'QldnMQigV9BkjL7s2W0fRg+kbGLKAf78yTVnjHqLJv5Qjv0IeEDy4yPGq0JBW+BDvsVZShTCaCWReUxyexvGUy8LRxw72zipLkfM'.
+'a5oI2gU7/g1j8VDFlbFspQbEOJs7RdSJJDjP95E1IHKcjuHLG4xcDeh/dWXyLkXf/JFL2QJcW2nE5NXi4hT+b7e6jjOGiqHNMbWT'.
+'sLVBvw1MQLgf8dt69bepfRWCHfyDIx4Z+RYGUv6AqwxbGGD5A8YzzGY9+71nbKlzi0glZwx/ABx/NvCnUYMEyJXuvXns4PsG/jQ6'.
+'9kcfPq8j/DqmrZ9xXXoYSLidm1i1f/LA7BI807Pf4oZPYI19F9WRQRAtZJMeRRzCn8DnwMM9PzepeCNEb883OvT9HP0ovLO8UkY9'.
+'/oSSaM+n4dt20Kigx0lBgiPHgQFn4nAVc8ufSMdg4i0Z5mg0oDjD7s0saDFcEhehwEJntB2onT2hGTAXAx8MKgAVNU21E8wQNYXQ'.
+'NFf40yNVQga+Z0+xrAmk7oMUQWOfM/2ZTX758olZiaMm33pQ/X1BtvOrMAnHeJiBSheFXMKD94DNU2mkmsvE3AGrJtVcB2n/4inK'.
+'jwAZCUviQzNQgOMJojl7IF8e6YyJidrAa1HrParr/hwJifakm3TB5m8GqSGxuFhz2Nv4I4tpcyMhr4FeaN2ikWvSsZuGlgZCVWHF'.
+'Np2AKxTgEbXkY+6FyRivfDWrEnEbI0h5C9WhRdKUIws1Ah6PXb/LjqrO8bUMac6wX7iXoKV/qlgtU/vKMP8GXcQaGMxdF4PtMdNP'.
+'ZfKg8U56sg92RdJk2/hHYYCN5zp4Y3bwxvRIDt4rezRJujhIQWXMspk1tCIWF4Fj37holt/deS/w2ZSTfD2cxMJZPbDZ0OYnSf04'.
+'AG019g+HdEw8gKmvDnh0/LSRPjWAIn4zfc2aeSUXcBYeU1jd2I1B897dKS8OKHsMHdJLqeNoVE7kY6f05tQBMfvYtSMfCsHh2TKu'.
+'LJozmKY8Pt2g/m3wGcJKGzaKCYCjQaYqLY9ja5xckLecwnjndoKrMLh2ChaskC6FQQLdYmK3k6T6hmzudB5gliE9wbMKq0ZO2+Kd'.
+'frgGaU2bFYOwh4YbGc/Zhj9Itfsuumm46+8WuYgSemdNDMUOrLF9bIiF1SvIcfVibPsEfwXwEgRSrs4IkLhpCoDTFzjumlOAIgv7'.
+'dHqWGtnCI+BW4UFq1KaFKnGAPM8tcjzFDns13W1tFBMMjlEFXCANwEPGsKQoHiwupo+2BNgoJzXw8Jci0Ug780lYtzhDwyI4bF6x'.
+'tqUz//T3J/sNHcfVGwcG5Bv26+FhQ7/TQV2+UfYjXUmH+PYKvF9nYOAfXIFs05MF0GZuD+I1bxzCPYYAjX94gfYEikCDHljmHIQW'.
+'UdBAG97qgZKGn3X8eYo/z/DnOf58iz/fnZmpI6Hv5tHsjoPB/VhMZvm0zJxnI7sKbVamF/wDJ7XXkHRLpV/PHnqUZUHNI1FjPSox'.
+'M2fsNKtw7xDv3pBTh3Jpx8SUjDoe7Ssr/t9s7tgDz8hKkEz5kxsXB26mjTbLQ5gd0ryBQfK6DbLuACweipYkhxgdULB45bjEIYlj'.
+'hFzVsQOI9LI/eo5Cvzx90cFAgZLOlXo0DtD6ybmilDPD+Gr6DgT5PLw4dFw+wKZQgkwvoxcfLGV8/5ybY+ZeR4R9OdUvJqZS+MKc'.
+'s5i2khnoq5qlU1GEomn7cvac2y5zlAvJ5ekoBXEmmg4vFCRqJWfSDU8FLZagAgvcApwcX4zNnW+3KWE2YAQKUg1bPxdm05UZpCod'.
+'QOJfTouMHbo2uDhDcozKx1ymCZKK+RG2g1QRLvx2xHWCOiqI77EHF3INCaEsyzUz/VZsDo99btQVL3dOHTSHKdSbBiP8BunIxD/Q'.
+'kVOlT56ZzWmO6pBwBb6UZL5nVh1s0o0rPqys8GkNel/5BI5a7+5OBVgHLswDjCWAKA3QjzMQmuDJdZ4xFcc9XYlZf0GhqxmZKhXj'.
+'oLpb2QyUXsI4reNzqEBAwoCl1JXT28ixWewzk2fHsDUVeVTikTHNoQn+mMMZ1hXzRpybchWrwo89E5V7YBNqMbVKXjKa6zlzsufk'.
+'3oVshy4QS3Y9MPPSWuvCHpWGY1C0GsnGl0s+DtMkVYZBwZokYHiw02MjvySnMDkpMz/PzY/0ifyikqkgDvhBfOcL9CYY5bY/jvvi'.
+'0e1jIum7gPac24Oohaeixwlae4FNHGYihuxDmm5vHR6cHB3une9vHv+I6Kpgjt/uvj65F2Jzj7/nJomR+3jKD6fL8tO4vMaEMSSt'.
+'qrMG7I40BA458LMgpdHs7Nht3v3l2z5ZEqYieUvZsMg270hz7W51oW03NT86wygOKgqXRQeupQr6efBYaiBLDapLDYqlHoHOLpfY'.
+'qSwxB0tklaW15xDWlV1D20regqPt5Dtm5Dke7kiQcFviiCUS7AXYS7cA2w+BHXaH7agAmLjOQgbZqYZUqpmk1dxKpxmK9WQGSt0H'.
+'tjq2g344KEC+ySAZGy7LRpNxAezay+C2g3Hgj2kvUAFqoja5MwdSacnEzeM8wUWYAs5xJc4CpIJznOLcA4HSfxO2K+iz7YrmdOaB'.
+'KRi38xiPg/gqiPcL00gA5qRdfRQMonEwH7CeQ1iCXiiAr9E5dNU8uy2bgflDPygWVwCEMo/p9PojsEkKROm6WR8f8ynS1cxwojAD'.
+'jRQ2cAtQu3n2J8DNod+NioAjtzyoUCoWbckOnmzmqVBbfJpZGTAoAO62yjDtAsw+nXxWhusU4A4OyzDdAswxnY5WhgsLcCdBXFFi'.
+'zwOBkGtnVf0vvIyHN30/mgzHlVNpbyXQT7yZsAJIHB+AgBetQjGvMKaPji3BZ4IZFGF+FFXpFz+8UVjqSMR0HIrT5ApW8FTg2PQr'.
+'WzH1ZIgLNqVkSKexLqj0RCSMcioojOCFcTzVeEOD2wkEAs3RijgN/f3mSv15vfb06fOVNfCAFfDC1BXYlzONN8hBk/Dy861WFgiz'.
+'FTu4UpY7BrK5NYLExKnrzT8sbLXEUduODm2ntdo0ydwaoRviC0h6wcXqqjsHP0XD4LDdBhLTgfxi/+BjB6wzgabNaPCkCblpNb/L'.
+'TsD1Ujg2IA2xB/Gxo97KwLDXeJxC7rDERTxU6g8L+fMa9UVcRTdKhzZulFIaImUU3gR9SjGZSNdxCO3VX4SDjoYrmEvixGc8xnIM'.
+'OmQV/myETn396fPaYsepLd44a/oy1HIrhuroi7hsL1bTAZsMLaI1/ewLhyylRig7BACCp2sA/vMR4VrSvChuAeMt1Za061Bf1lt4'.
+'xn19SesG8IItxrfVlzrWHSh57Cyl9ZYnVcd2iLVONibfrj99Wlsc1RaHSwU+gazbGSuF2ymnhHhiG/FKmmiGx8vO0qJfxxPt+bm1'.
+'9FtJ/ocFaPR1oWuXFrtLy7l+xZJOHKiCJKfYO/AteCBvnSpiZgB/WDCMcNcJT9IjZZdWl0xgMgwBMRDtSe5w9nDXNBsiBwcvCDYP'.
+'Tx474dsSLJOgvSS7tqqWZkqqOIN7y3QXDAefl3TZ33pN14gWjl7XNaYBPa6+pPPxxTWEssfwnjy3NTVS+fQNEPbR7aPVJ397sLm/'.
+'g+79uzgYgL6xewnen4LX8y39ccRp50nXBfqdAxmXTDx3lm/aePRodRVd2+NBkr6TPIvpvhdHWyIl8GyJvmU4z9n6A1TsJSriFYEe'.
+'JV1QzJTyIRzKq0i5gEczU+JhJLJq8hrcaoz0NUMploYeyf80BMphPoc+HITjuQj/wBcYprUYdUHmnUOX4iWyg9F4KgjyCLjiG0Mn'.
+'lAwjIlZNnI42sFtGfRc4YPX072or35+tdiy8GEEex//Y0epreM/K43uRCCbkqs2rVu56xQ4OHfUi5KUYJWnzXgx4g5+x9Pk///rv'.
+'Pv+3z//l8z/8+u9+/ftf/8Pnf9A+/wsk/QWS/vHzP//695//n8//7dd//+t/+PXvNUj6LwD7f37+i4apn/9vzPT5L3iJKfSxpNGj'.
+'XIAtd3OJwHGAK3Z0h6mat9RfeB+KobfChDSJbvHtsxlwG1p+jqd6S9glunATWm8pkAyOCu2H48MDQ1/FbJgLhsdIt7ja8N9t+vRo'.
+'KRkkshqNuqUpX9ROW2rIKudSRVdaSq5eAmOkgCketpYaWk40p19nVnbdQnZHKh63mnGGXqKnnhvQFQRlvtnMk1VC434eKMBGc0PS'.
+'4q/nv3sZMC0vz0PiKhNZoeiCbsh4JJuN19AMEj4nNt/gL6ov1U6prag/ixClmCIeXVRaf+G91JdFzZb1F6veS9ytlGsBISD2RE5C'.
+'ZquEqJACxfboSg+WPksKkUGR0uhRlYrEC0QkqMw+E+RWeG0mcK+uziGlvHj3OBoEJ9AF+THMglcIXxvUwygGnXjuTabn3ni+lhi5'.
+'U1x4ovt++cphHs5hykdYxjt3ihJfliQ0Efym/5dKiW8TSs7duSWibvv5o1JglBm5go8kknDYRjTAKrdLYPbCmP35I85OLq/VQMD3'.
+'g/aYk/BpNje/2vklGSmyfZNdt+NFrem8upMeqqrfEoxpUEHTJbpiZskDBrhYMudUSOUkZctDnrj4T8MfSIHfNCQ5r9Yjr0dVo2nw'.
+'aOTAe0pPpJS2oq3Xak0BgXQCwkMbmE9NNgQNc3XNXFl7/gzhkHuQBMIkSOnPxhHK3cwa4jSQt9oSIYLeKKEmvixbGmwEqV0Lv1mn'.
+'Uk2ZFuUKZR06D28GMVNIV7BfwuRdOCTqzUPDHVVZh6wP77dfcoBzjQ++SwrZiyuFOKX4wtubgeJgHNpBu43n2OijST8BZ1HHy3HH'.
+'4ComjXVtZmnPcMsFtvkR3oZId/6xAau939V2KG+i1e1v7bX5NyF/r22+P3l7eHRsj28gUfg2fMPuJOSQUjzQ/OFrkQ34Wdnb3do5'.
+'ON5BZJxDXpZswE/ua3p9cnaJoigc+C2xszt+V9/vrorGrOavKWTyJHd3hjqB0JLpzq04d6mhExF0K3GvguzyhY7V5SgRHCptvETn'.
+'RVfefNWmEyzaRve0ffbYceiGQZy5wuUoPfBtvHfB7QQ2eJUAYXUwQjYZT/vBKb5TBIEFuhOg/roCccBwCfPKNqksEAA4ZZiV1bY6'.
+'vMbtOPo46uBh+3iActsOE0NvAJO2giEGSOPI0Rs6cm168HVnZoEJ98pNgn44LNaftmRa7WZyHdK5TxhYcesDrI7rSQ3cJchXXlHa'.
+'AAqCojHZfqZ+8KLxOBrgh7pIlpemhg7iXO2mNzXIguqyIBQWeqOdLwmYaQzjC5PzJRG7Y3qxoDYdwgkFkeQSjb+9abStaSMEmvKK'.
+'74cY9XCsUJbo2hYLXzBKkaL2JFwRbLdyzTkwVFyqnxR4RieROrdUZKNtw8gK4g8kOcmOtrjR8stbFrj8SW+D7YktIa4Qb3SMLJZo'.
+'LL1ohVcg81w8PauiOhrxp6O3o+F4Be8obNRrtb9peq5/0aGNXQ0KEeKaNtlhbuA+lObAjTvhsFFrjsCUAwe9UdNfvliF0tBplkeL'.
+'yxbyUXZUw1GUhLTvzHRwKyNYSL6OgdSkBeTHhg42Nd16rM/weLv5HzkWWR6ETCXQEibNoiQH7oExwmOhdqEWoVXHTUW4W5Y2ic34'.
+'YiqRi/inKltXZOvKbMW6lhpmQQ0aoYUYG13rEx2NIKE+rdDECHRRqqDmN48Q1RhRDdrKJWcbMHooT9C0/n35UXrSH0LgwHa6Z6dN'.
+'EoXWnETDMxkAgx/lQNfp3t3dzujODxiekCpBLnD9fjIMxw7Jr/fwZPSI3JgIY/tlDbLjYfvi/Ul7mZ4wfFu9AcodhgMYgeQ8NJSt'.
+'lKFFRbAUlftaL4DHJIy+cdEwehu9BolR5tFODlJsrAU4vn9dmmUYBUntKcTpXeJueXyInBabseI43Ei4zjS4dDx2i2b1RFEjKIpv'.
+'ANfxCKcR0gNN+Rkd4cdy2byNMBiYXaQ0caMrXClHJjW66EmlrzM+2xXIfzNGN+F2ZmU2rRBxP4XB9UZVIrroeNcXyJjWMdbc4Bsc'.
+'kBYNPvtzEiOH0EfeNUfFY2VTf45TuC1cWfyseoBp+ox3c/8b1DZfnaoKK+2RtZVKmjadD9Tt04PTGPRzxmmLi5iyuBins6D6fvRJ'.
+'py1/uVRxKaP4wGj6lNWI7QGtPqzSlO5qCFxkPC4lLi4+LogrRMISCz4afVuKlceptAVEWXImhAFVih4lzh0InzvWyHekLlcR5+0l'.
+'HsOAheABymIw4olaVsfKb18UtGmpHqUcEeoIqAQ41cWg0M8wnutBmBHrgSo4ayQ6l/o+hbiPXyVQNdeiYKVrN0aj/pS5DnQhMShd'.
+'+DTDACDlMicgjDyqH22LxUX8BSN2iJfG+GC3OQ6fTbmBHxp8AgcKcAw5CZy20FPVeR/n8hqh3ZrENOuwkT028JRxs9mFkda+Qc9w'.
+'o9YQvdN1nHTn/0a3QQDJKAhayWn37O5OebfPxeATyh3cALffR0MB+KkF+uV1qg3QKOOamuVva/xtrerbOn+DP0L2nqLVB7zVtXpn'.
+'M6jMMBUV56g8G5SET9Y5Gqv8jk/W+bkQkJTEz9a57HVOlW/WudLR/ElJsAQm5auSYLFCVXUhaELlMJTU8zjtnG2oL0Q/Zp/bQTDu'.
+'Rq1GxxL3GjfaqEattAO7liQ2GKEmqSdQxkiBwpbhlBGBbkBf9TXPcfJ4B2PVSPrR9d0wigdu/67tJmNz1bTH4KbkcpuZoUDCleg/'.
+'ZwjQUMwpT2q0Cu1nyC12N9BlsagT/82ahKX/Tk0i14maJNjwv1+jisMq9zUNH1RTQQR4UdQP3KFeJIng/d+JKtLnRLqkQzE3ckK0'.
+'IqW9mQ0XW7X6VPSnt4CnAb4pZT0Tmj8d57hpzlIH919ZGKMql6cqCixSlRjzijSkhmw/VjtgcbFtflFdBGOV6qKUTapnZg2ieNRV'.
+'ZwG6oKx7VTLqATp3BS0b4AoQhjPAzq54oa15NqIKzOEhS3gDOd+FbXO24qAZbdPq8tWBZIaf6nSLwAivq/sbfAALIDM+enimCgXy'.
+'SzPrwiTnwjklI+k1usjQS9ZF3rOA5xR/5v9uoaEFZbDr+4rMoXzaHthK+ZQjtJbySSfRSCb44i/48jiTwslK/clcYMU7DkZ4jFfm'.
+'5fBskI0WW+A42Ch8jsdOAKlBPxjglRfwNGw5nkF/zRl/EBNReChY3PEMffmU71Nxb4z0YpXUhoSsYB8+YQwgIFZEMSRflrMXtDOt'.
+'tWfPTAv+fjG+eoavruKr/0Z8axm+NRXfWg6f3Jts6eayburY3amN5hnisBg6v7IDNkheCNMldJjK9rrjrGfBd2QOOqtA1F+MX6BO'.
+'p7j2fFu31mcmvFpflPSLuQqGTYB7fCXi07SxbUkYJWWtlLJOKWeVtVk2Nhq/2Pxobpi//E2uFl//dW51eWhhhc0na/azZ1Yuda0y'.
+'dV2kyqr/0Th1V9qbK6+JQmsz86H3B0n3vES65yXSPTcryzfnvzxQ7HJ12cvVFVgu1gI60P3FqFma+H8FyTXXVubm0mvDT1uQHA4A'.
+'MH9D9Fl2oA0IC+mSdJqt6LaDN5hP4q3jY/pAYwDcRfAI8Y9SiI4ewRCcEjoHoovCrTVFm4EP1Ws7JcE545N7uk5XzC4dQO7sABFU'.
+'lhzbd+teTtzGaQ2HK/47s9xPkzhonK49VdK8IOxQGrzjvzWQQV4fzWLICf/Dt0nAL5whjq6HjdP682fW0zX4/5nlT91hrpyWG19k'.
+'uerr33OShIOELLETB1PEBkn8L00OGLhGlcC0i657EQLsdwD33Tp8+ZbT8Y6j4RiaioiV8iK8r1Ug+u4ZwltPRZYIeoCaDVWuP01L'.
+'iGIfzExA9GzdegYNqj3l9DhoSewCMnH7A/AiTtfWoSIAWl9b4w9XIVgdY4B++h1dvFBHPeR3k9Dl0gQVO1G/xQlr9WeINGvw2nf4'.
+'Dpo27ESN02+fUZMgRTSfem+9htU+s/qoF5nU9W/XAddz/CbSmd5ra0+znqF0UVT9KXxY/w4QPc0+QF9AnS3xT6SPwuGFoNV3a1b9'.
+'+3WRPg0wSlk0A/+tEaZBILkBapJ2jtL4gRtHSDxqKgIN3aupYJa1784s6jj+LKiR66/nhFip1Pdr0FVQqdEkHvUDiZdQpd2RJVFn'.
+'cm0ATRL2r4IYAL5fs8S/MwuG2DhQ2oWVLjYW8irjOA/M07VJOOzYPTDmhigOxDu9NtMJOplu3baCdkOHl+BwMv7TBLf/E2huWQjs'.
+'0oKRSZlPU+yA5EwBnFmIcHeI+O5D1APFv+qE5pPucpvziErcl2klzWV0V9ZMmXN3eF9eEISUaXXNfFHPyl9de9KlwlPckGIYKytd'.
+'gX2lrhSwNfFC/8vak2vRl+RDwboaQnGUt55v1nwE97ZLbRk3rLvirHEJKuGAavH4S9tV7Kv7c64Um/aku1Iv9dkcHA80rqLj0vY9'.
+'ybPGnybh8CtaWGjjw3kLTSz34HwkDzbynl4s9eRxcUG33B1kg/tRAoWGT9gif7cLhZvLPaXRDyESeGDwl/Go7X64QtiitE4CzRPA'.
+'mR96Ozej6B48QH/woTbaDVGvUXRtgEytYa9it5hK074AVQiolnuAzFhR0K0APqxYsW/nIkQPj3y7dNmNU7LmQymz+QxQbIpoiMoL'.
+'xfqh5MpxxFYY+w8NUO7Ky3hs1FfkMFDJjxLoATSSHySSdDgUBNk8NNVEULhDYO6mNVOpkC+bR0e+m3bwZPu8DMWFzoE8Sr7n1O1v'.
+'a/Vn3zX5Op9ak6fqB7SMXOpEI1x1+qbj1JWeHPC5/3g6e/9JzV6nzn5BVXM9vEQEJy4G8hDG1afZeje+GqK73+2a/ICK1RisdtNF'.
+'W2hZkSPCFaiBmQ1FI3zSX+mB6sqQrV7kmf9/fDrkqIA8Hz5IgeVBfsD+KxABGNcBvptDBgPo8KRuPzN/N2JgTdSRUrOfPflrGGQe'.
+'cb8QBXT0M5XKr9CTKwz0i3SoAw3TnUoYxSHILStxQcq4hyoOisNbJ7orocrFfy12kk89VteyhOWyYP9txQhR1suLsguUU10qDyjo'.
+'GMAMa89MUzZO6YKLnI6vAMeaqiL+FTjp/v3aeiW11CUFKQ8y/krXqhGwSt/5GKWgNl8Y9dU1+9tnpmoHfWs/e772DM0SREe8TAxv'.
+'rM2FxZZi8wQANK+GD4Xs6fc5CNbstRyG79cVHPOyPC/k+e6pyIUhdxkX3EuM7gvUWUXPyFZ7BnM8WRNUpoGS9vXcboEMK6GapScy'.
+'4qK0wQGSvHltdbULPjH5xQ18z0Jb6GQ/uRyQAuU2dKpT+5eTYBIUA2MCx+UVdKvlqJPpdMEzzomXptejkeuH46l+JoRmVgURxGgE'.
+'lmeL1VFaF7+7E+uGTT52PftKE+zw+Y9t+O/773UR6RNwAFaxbDwzKC3LvcKCWnhKkQjO4ly3hTY0+Cxmq4Cs4c+4Om3ntvipQ8v6'.
+'YMeJtcHbti0a7dRmQRpJ0bZuiaR8Zkq2Auylq/kWd34ja7Bwyv0IN3+Pi2uNSpGBCESeZU0W8ajcagFNdKV7JPhCR3uQhIG4Y5qW'.
+'EZSNLKE3wQ2c7bCPgZakYbw0MsC8zZ7nLSHarYB5SIZOFBh1XgjzOw5//v9XKLNoVJpjO8DdHkkDXx7JLvOhv+xeIsKe54xcER3+'.
+'deO2JcetGDLlUdi6dxS2lVFIIel3d8/Sc1zSwJTscXWt4VZEmKyuNUWQshwqKyszuu4oF6eMq2Q0pKXwsGq4hCcGbisdUrfie6MO'.
+'8tkqDhuz2XbaK2tpdJcPhpv/ot30Mfa6AkmtEsmXFjbLN+xL8auhVS25m+Brh5oMlv29G1WI+/raOrUEL+rtGz3fzkwyYHcqb6qQ'.
+'ONp5c76/c8w3/eI6He2zEKl4uK++2e9r7TDotxItBhxxGLR0BWQNQN65SXIdxQDRioZLY43C4FSgdQTqo77VXJyRJqmQ8LEcGki+'.
+'QaJCPwXovagTDrUw0cLhldsPc0U+g+87AzfsF77/YeH1zs52RXNkclV7wpjbk8Ksqdiv42jYYdx/WHh3dPh6d2+nogDlC5UxlyAq'.
+'IBb0+uSd1pdNpcIsbV2ju3i1QQj8MxkUs61XZrO1owADcP0xSF7KL2v9anP7/Hhn82jrraN/jCaa72KNwIJuaa5GO2w0jtzVrsNx'.
+'F2Q5COWpNnJjdwDaME7sF178Ev+9A2WXaC9cjY4HXFrlg71xG+rSSyDqi1X3paWNI4GaqNwPRDXev9s7hHq8PjzaP9/df+Poq8lq'.
+'OOisnuPdyKvBcJV1pd0J25xh5/z4ZPPk/fGrzaPz7Z3Xm+/3Tk52fj7hfX6OtnQc9ANqazvqY1C9top7u9Vcx5s/7ZxneSjXm2Cs'.
+'4emFVbAnh4d7J7vvOIuApRZQjqSY5Wjn9VER/VHQBhp1IUMyroIvFiHhZTHlXFCx3YM3spxH1HL3Co1X2y7CnhyebO4hmxwLeAA+'.
+'icau6IiGxhk2f9j8+fzD5m5a8ew/yLAVDYdAWChBgT7eOdiuhD4G9YqcQ3szZY32j9+c7xwdaVpllp04jmIt8v0JDLzHWY7jo5/O'.
+'63MKweN/xIWFZFfEgR91huEneAH6jUCWBoIY2OeHP84p+jWRGa3UlpZM6E709qTfnyq1qM4rCNMBtTvpk+pNHucKXKvOsykHwf2F'.
+'YtPXKhGcgJgEBu9HuDqkBRnpgHYamAGYiqKUC2lF13SYNJq3eezr1dhxSasNpL12k+EvIBSkCaz2y+bJyRyKgP0KWghjo/OFPeW9'.
+'uI8eKZ0HYmoydKn1odcPNKV+rw/3tneOKvuLhnaSgR4cahI3IT+Ism8fd45z3z4GSa6L1ufzBPfOkpA7b452t2G04mEU5ziacuBH'.
+'Ad5BwvRm9AT+ZufkfG/34McidilvEokcgc7fH+1V1gXSGSdBvT3Z36uConRAmiiwIFff71dSEKzKKJ4M0goIWXrOcuLdztH5u803'.
+'Owxer2Ut2t59t4d0LQ3GLvMic9xtbaataLf1mRa1tdu12VIZwfnJuz0FQf40AC314VGApJfg2OPoPW6v4dAL3qzOx5PUzeUlTewT'.
+'hiFQKn+WVeCE5Ofbww/nr48O9/Mt0NpxNGgsVQGfHKrNHYf9fhnu/at9VXziWEDzTIHb2X938rFIP+JYaqoC+WoHOm+nAAqQeJKS'.
+'Arb5+gT6CqAeKTDY6JpKdLALzk92T1SmJcDP/8fnv3z+p8///Ot/0j7/4+f/S/v8v37+y6//y+d/+PxPGnz63z//Z+3zvwDEv3z+'.
+'r5//UUW3t31UwofoOPs/ahneYq79j/l8kGt/Who3W4d77/cPzunglxyZYJCVwd4d7f60ebKj0CgOr1x/WoY83v1zHuExKIsy2HaG'.
+'TYzAEcpP7KI50Gsq9HYlWElmoIipaMzO0e7htiqNp6MKsP0dcL+3c3wx1TjevaLZOSGAbDnAY2+q6HNSpE9VU7YO3x+cHH1UlSCg'.
+'i6e/udG7B1uHWVcD2O4QdE4F4Kv3H4/zFXQrOWd7r8Dp231VBh1+OEC7syjEtoWirADNCWcA3UutRaEXjk9guJYE7RHPA1VVEI9K'.
+'rSg7qOo/suXUVo/B4kiq6Pj6MFc+nog5D1/90SOqIc45zS20XmOwTW+S3Ae1RlBvaQ5hPtQ6QW0Jc6I/1eKHSn+uVlLzprQnvwy+'.
+'uXWye3igcjgf4FQCPNpXB3eKujy0918dwuPh+3evPqqKO44mI6hGCfTVx+1NhTUBtOVOkwqwDzs7P6pdeR0EF1Vw+8Aeb48zuEE0'.
+'HHcF4NbbzaMTAVnidDQupcVXAV+SL6T3QKmGUnKo0PeNtyJcJmYknHYV9Seyu/KVBlbND09w2LMhX0KdQqeo54GTt5PCp67OPPD1'.
+'2naefOs1Les5FbK+XyA09UgFgY929nNwozi4CqMJOO7VGZ4XEXfdfntlCl50GXbtYwF2TUNAWV0m7u7xu73Nj+cgy/ePC/0M4nyg'.
+'GM7bO3sFES37I8ABKizJzVcABuLq9S546WoW5LY40KbRBFwY8XDtDsfo7bcIA3ohibCLN6rQCcH5RSjFpLqWpD7+XLRgO23tnMvZ'.
+'BcR9H+IJq3fiESmZWBbnilDlCKPe2X5QJA==';
+$fp = fopen('data://text/plain;base64,' . $data, 'r');
+stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ);
+var_dump(fread($fp,1));
+var_dump(fread($fp,1));
+fclose($fp);
+echo "Done.\n";
+--EXPECT--
+string(1) "%"
+string(1) "C"
+Done.
diff --git a/ext/zlib/tests/bug_52944.phpt b/ext/zlib/tests/bug_52944.phpt
index 850371190e..97348418d0 100644
--- a/ext/zlib/tests/bug_52944.phpt
+++ b/ext/zlib/tests/bug_52944.phpt
@@ -2,6 +2,10 @@
Bug #52944 (segfault with zlib filter and corrupted data)
--SKIPIF--
<?php if (!extension_loaded("zlib")) print "skip"; ?>
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die("skip not for windows");
+}
--INI--
allow_url_fopen=1
--FILE--
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 81a6361dd4..7ff2b30c4c 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 <rasmus@lerdorf.on.ca> |
- | Stefan R�hrich <sr@linux.de> |
+ | Stefan Röhrich <sr@linux.de> |
| Zeev Suraski <zeev@zend.com> |
| Jade Nicoletti <nicoletti@nns.ch> |
| Michael Wallner <mike@php.net> |
@@ -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);
}
@@ -690,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])
@@ -701,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);
@@ -890,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);
@@ -914,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()
@@ -958,19 +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)
{
php_zlib_cleanup_ob_gzhandler_mess(TSRMLS_C);
+ ZLIBG(handler_registered) = 0;
return SUCCESS;
}
+/* }}} */
/* {{{ PHP_MINFO_FUNCTION */
static PHP_MINFO_FUNCTION(zlib)
@@ -991,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 3b65cbbcf3..0000000000
--- 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 e52c32c57d..2f40dc91b7 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"
@@ -2159,14 +2158,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);
@@ -2350,7 +2341,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 */
@@ -2398,10 +2388,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/php_logos.c b/main/php_logos.c
deleted file mode 100644
index 3689f71e95..0000000000
--- 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 <hholzgra@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $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 b9e1144c03..0000000000
--- 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_variables.c b/main/php_variables.c
index 427966170c..9952bd80bc 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 cd038d018c..bda110d339 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/userspace.c b/main/streams/userspace.c
index 96a5195ed3..3b277160d6 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/php.ini-development b/php.ini-development
index a5a7a4a81f..a97cd0f9da 100644
--- a/php.ini-development
+++ b/php.ini-development
@@ -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 5d8f26e0fd..dce8fc970c 100644
--- a/php.ini-production
+++ b/php.ini-production
@@ -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 3997a067c7..86527e12ae 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -1481,8 +1481,10 @@ TEST $file
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);
@@ -1749,6 +1751,7 @@ TEST $file
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 */
@@ -1759,6 +1762,7 @@ TEST $file
} else {
$env['USE_ZEND_ALLOC'] = '1';
+ $env['ZEND_DONT_UNLOAD_MODULES'] = 0;
}
if ($DETAILED) echo "
diff --git a/sapi/cgi/tests/apache_request_headers.phpt b/sapi/cgi/tests/apache_request_headers.phpt
index 3dc3580c21..fd36e3024f 100644
--- a/sapi/cgi/tests/apache_request_headers.phpt
+++ b/sapi/cgi/tests/apache_request_headers.phpt
@@ -17,12 +17,12 @@ $file = dirname(__FILE__)."/012.test.php";
file_put_contents($file, '<?php print_r(apache_request_headers()); ?>');
-passthru("$php $file");
+passthru("$php -n $file");
$names = array('HTTP_X_TEST', 'HTTP_X__TEST', 'HTTP_X_');
foreach ($names as $name) {
putenv($name."=".str_repeat("A", 256));
- passthru("$php -q $file");
+ passthru("$php -n -q $file");
putenv($name);
}
unlink($file);
@@ -31,7 +31,7 @@ echo "Done\n";
?>
--EXPECTF--
X-Powered-By: PHP/%s
-Content-type: text/html; charset=UTF-8
+Content-type: text/%s
Array
(
diff --git a/sapi/cli/config.m4 b/sapi/cli/config.m4
index 77fc5e9551..cdfa1f7daf 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 2cdd1aac6d..f9bf3ee60b 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -1167,15 +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 876c57a34d..89262e863d 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) {
@@ -1944,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;
}
/* }}} */
@@ -2403,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/php_http_parser.h b/sapi/cli/php_http_parser.h
index b740a0995e..7e72b78d7d 100644
--- a/sapi/cli/php_http_parser.h
+++ b/sapi/cli/php_http_parser.h
@@ -32,7 +32,10 @@ extern "C" {
# include "win32/php_stdint.h"
# include "config.w32.h"
#else
-# include <stdint.h>
+# include "php_config.h"
+# ifdef HAVE_STDINT_H
+# include <stdint.h>
+# endif
#endif
/* Compile with -DPHP_HTTP_PARSER_STRICT=0 to make less checks, but run
diff --git a/sapi/cli/tests/php_cli_server.inc b/sapi/cli/tests/php_cli_server.inc
index 3479cd0bd0..40c5361995 100644
--- a/sapi/cli/tests/php_cli_server.inc
+++ b/sapi/cli/tests/php_cli_server.inc
@@ -38,7 +38,7 @@ function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE)
// note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.'
// it might not be listening yet...need to wait until fsockopen() call returns
$i = 0;
- while (($i++ < 5) && !($fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT))) {
+ while (($i++ < 30) && !($fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT))) {
usleep(10000);
}
diff --git a/sapi/cli/tests/php_cli_server_011.phpt b/sapi/cli/tests/php_cli_server_011.phpt
deleted file mode 100644
index a957a8ed4c..0000000000
--- a/sapi/cli/tests/php_cli_server_011.phpt
+++ /dev/null
@@ -1,41 +0,0 @@
---TEST--
-Bug #60180 ($_SERVER["PHP_SELF"] incorrect)
---SKIPIF--
-<?php
-include "skipif.inc";
-?>
---FILE--
-<?php
-include "php_cli_server.inc";
-php_cli_server_start('sytanx error;', TRUE);
-
-list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
-$port = intval($port)?:80;
-
-$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
-if (!$fp) {
- die("connect failed");
-}
-
-$logo_id = php_logo_guid();
-
-if(fwrite($fp, <<<HEADER
-GET /?={$logo_id} HTTP/1.1
-Host: {$host}
-
-
-HEADER
-)) {
- while (!feof($fp)) {
- if (("Content-Type: image/gif") == trim(fgets($fp))) {
- echo "okey";
- break;
- }
- }
-}
-
-fclose($fp);
-
-?>
---EXPECTF--
-okey
diff --git a/sapi/fpm/fpm/fpm_php_trace.c b/sapi/fpm/fpm/fpm_php_trace.c
index cd97aebb33..d95d66a754 100644
--- a/sapi/fpm/fpm/fpm_php_trace.c
+++ b/sapi/fpm/fpm/fpm_php_trace.c
@@ -26,6 +26,7 @@
#include "fpm_children.h"
#include "fpm_worker_pool.h"
#include "fpm_process_ctl.h"
+#include "fpm_scoreboard.h"
#include "zlog.h"
@@ -137,6 +138,7 @@ static int fpm_php_trace_dump(struct fpm_child_s *child, FILE *slowlog TSRMLS_DC
void fpm_php_trace(struct fpm_child_s *child) /* {{{ */
{
TSRMLS_FETCH();
+ fpm_scoreboard_update(0, 0, 0, 0, 0, 0, 1, FPM_SCOREBOARD_ACTION_SET, child->wp->scoreboard);
FILE *slowlog;
zlog(ZLOG_NOTICE, "about to trace %d", (int) child->pid);
diff --git a/sapi/fpm/fpm/fpm_process_ctl.c b/sapi/fpm/fpm/fpm_process_ctl.c
index 7840d17f8b..76ea4d358e 100644
--- a/sapi/fpm/fpm/fpm_process_ctl.c
+++ b/sapi/fpm/fpm/fpm_process_ctl.c
@@ -353,7 +353,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now) /* {{{
#endif
}
}
- fpm_scoreboard_update(idle, active, cur_lq, -1, -1, -1, FPM_SCOREBOARD_ACTION_SET, wp->scoreboard);
+ fpm_scoreboard_update(idle, active, cur_lq, -1, -1, -1, 0, FPM_SCOREBOARD_ACTION_SET, wp->scoreboard);
/* this is specific to PM_STYLE_ONDEMAND */
if (wp->config->pm == PM_STYLE_ONDEMAND) {
@@ -388,7 +388,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now) /* {{{
if (idle < wp->config->pm_min_spare_servers) {
if (wp->running_children >= wp->config->pm_max_children) {
if (!wp->warn_max_children) {
- fpm_scoreboard_update(0, 0, 0, 0, 0, 1, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard);
+ fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 0, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard);
zlog(ZLOG_WARNING, "[pool %s] server reached pm.max_children setting (%d), consider raising it", wp->config->name, wp->config->pm_max_children);
wp->warn_max_children = 1;
}
@@ -407,7 +407,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now) /* {{{
children_to_fork = MIN(children_to_fork, wp->config->pm_max_children - wp->running_children);
if (children_to_fork <= 0) {
if (!wp->warn_max_children) {
- fpm_scoreboard_update(0, 0, 0, 0, 0, 1, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard);
+ fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 0, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard);
zlog(ZLOG_WARNING, "[pool %s] server reached pm.max_children setting (%d), consider raising it", wp->config->name, wp->config->pm_max_children);
wp->warn_max_children = 1;
}
@@ -511,7 +511,7 @@ void fpm_pctl_on_socket_accept(struct fpm_event_s *ev, short which, void *arg) /
if (wp->running_children >= wp->config->pm_max_children) {
if (!wp->warn_max_children) {
- fpm_scoreboard_update(0, 0, 0, 0, 0, 1, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard);
+ fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 0, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard);
zlog(ZLOG_WARNING, "[pool %s] server reached max_children setting (%d), consider raising it", wp->config->name, wp->config->pm_max_children);
wp->warn_max_children = 1;
}
diff --git a/sapi/fpm/fpm/fpm_request.c b/sapi/fpm/fpm/fpm_request.c
index 28332d0a92..bf431a08d0 100644
--- a/sapi/fpm/fpm/fpm_request.c
+++ b/sapi/fpm/fpm/fpm_request.c
@@ -54,7 +54,7 @@ void fpm_request_accepting() /* {{{ */
fpm_scoreboard_proc_release(proc);
/* idle++, active-- */
- fpm_scoreboard_update(1, -1, 0, 0, 0, 0, FPM_SCOREBOARD_ACTION_INC, NULL);
+ fpm_scoreboard_update(1, -1, 0, 0, 0, 0, 0, FPM_SCOREBOARD_ACTION_INC, NULL);
}
/* }}} */
@@ -98,7 +98,7 @@ void fpm_request_reading_headers() /* {{{ */
fpm_scoreboard_proc_release(proc);
/* idle--, active++, request++ */
- fpm_scoreboard_update(-1, 1, 0, 0, 1, 0, FPM_SCOREBOARD_ACTION_INC, NULL);
+ fpm_scoreboard_update(-1, 1, 0, 0, 1, 0, 0, FPM_SCOREBOARD_ACTION_INC, NULL);
}
/* }}} */
diff --git a/sapi/fpm/fpm/fpm_scoreboard.c b/sapi/fpm/fpm/fpm_scoreboard.c
index 4222f6037c..24463a90dd 100644
--- a/sapi/fpm/fpm/fpm_scoreboard.c
+++ b/sapi/fpm/fpm/fpm_scoreboard.c
@@ -73,7 +73,7 @@ int fpm_scoreboard_init_main() /* {{{ */
}
/* }}} */
-void fpm_scoreboard_update(int idle, int active, int lq, int lq_len, int requests, int max_children_reached, int action, struct fpm_scoreboard_s *scoreboard) /* {{{ */
+void fpm_scoreboard_update(int idle, int active, int lq, int lq_len, int requests, int max_children_reached, int slow_rq, int action, struct fpm_scoreboard_s *scoreboard) /* {{{ */
{
if (!scoreboard) {
scoreboard = fpm_scoreboard;
@@ -110,6 +110,9 @@ void fpm_scoreboard_update(int idle, int active, int lq, int lq_len, int request
if (max_children_reached >= 0) {
scoreboard->max_children_reached = max_children_reached;
}
+ if (slow_rq > 0) {
+ scoreboard->slow_rq += slow_rq;
+ }
} else {
if (scoreboard->idle + idle > 0) {
scoreboard->idle += idle;
diff --git a/sapi/fpm/fpm/fpm_scoreboard.h b/sapi/fpm/fpm/fpm_scoreboard.h
index 136ea481a4..f58a28737d 100644
--- a/sapi/fpm/fpm/fpm_scoreboard.h
+++ b/sapi/fpm/fpm/fpm_scoreboard.h
@@ -64,13 +64,14 @@ struct fpm_scoreboard_s {
unsigned int lq_len;
unsigned int nprocs;
int free_proc;
+ unsigned long int slow_rq;
struct fpm_scoreboard_proc_s *procs[];
};
int fpm_scoreboard_init_main();
int fpm_scoreboard_init_child(struct fpm_worker_pool_s *wp);
-void fpm_scoreboard_update(int idle, int active, int lq, int lq_len, int requests, int max_children_reached, int action, struct fpm_scoreboard_s *scoreboard);
+void fpm_scoreboard_update(int idle, int active, int lq, int lq_len, int requests, int max_children_reached, int slow_rq, int action, struct fpm_scoreboard_s *scoreboard);
struct fpm_scoreboard_s *fpm_scoreboard_get();
struct fpm_scoreboard_proc_s *fpm_scoreboard_proc_get(struct fpm_scoreboard_s *scoreboard, int child_index);
diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c
index d24dcccc9a..76759e7f25 100644
--- a/sapi/fpm/fpm/fpm_sockets.c
+++ b/sapi/fpm/fpm/fpm_sockets.c
@@ -356,7 +356,7 @@ int fpm_sockets_init_main() /* {{{ */
}
if (wp->listen_address_domain == FPM_AF_INET && fpm_socket_get_listening_queue(wp->listening_socket, NULL, &lq_len) >= 0) {
- fpm_scoreboard_update(-1, -1, -1, (int)lq_len, -1, -1, FPM_SCOREBOARD_ACTION_SET, wp->scoreboard);
+ fpm_scoreboard_update(-1, -1, -1, (int)lq_len, -1, -1, 0, FPM_SCOREBOARD_ACTION_SET, wp->scoreboard);
}
}
@@ -455,11 +455,11 @@ int fpm_socket_get_listening_queue(int sock, unsigned *cur_lq, unsigned *max_lq)
#endif
-int fpm_socket_unix_test_connect(struct sockaddr_un *sun, size_t socklen) /* {{{ */
+int fpm_socket_unix_test_connect(struct sockaddr_un *sock, size_t socklen) /* {{{ */
{
int fd;
- if (!sun || sun->sun_family != AF_UNIX) {
+ if (!sock || sock->sun_family != AF_UNIX) {
return -1;
}
@@ -467,7 +467,7 @@ int fpm_socket_unix_test_connect(struct sockaddr_un *sun, size_t socklen) /* {{{
return -1;
}
- if (connect(fd, (struct sockaddr *)sun, socklen) == -1) {
+ if (connect(fd, (struct sockaddr *)sock, socklen) == -1) {
return -1;
}
diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c
index 5f2c852c7d..b9b9a8c0b6 100644
--- a/sapi/fpm/fpm/fpm_status.c
+++ b/sapi/fpm/fpm/fpm_status.c
@@ -158,6 +158,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
"<tr><th>total processes</th><td>%d</td></tr>\n"
"<tr><th>max active processes</th><td>%d</td></tr>\n"
"<tr><th>max children reached</th><td>%u</td></tr>\n"
+ "<tr><th>slow requests</th><td>%lu</td></tr>\n"
"</table>\n";
if (!full) {
@@ -228,7 +229,8 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
"<active-processes>%d</active-processes>\n"
"<total-processes>%d</total-processes>\n"
"<max-active-processes>%d</max-active-processes>\n"
- "<max-children-reached>%u</max-children-reached>\n";
+ "<max-children-reached>%u</max-children-reached>\n"
+ "<slow-requests>%lu</slow-requests>\n";
if (!full) {
short_post = "</status>";
@@ -277,7 +279,8 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
"\"active processes\":%d,"
"\"total processes\":%d,"
"\"max active processes\":%d,"
- "\"max children reached\":%u";
+ "\"max children reached\":%u,"
+ "\"slow requests\":%lu";
if (!full) {
short_post = "}";
@@ -326,7 +329,8 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
"active processes: %d\n"
"total processes: %d\n"
"max active processes: %d\n"
- "max children reached: %u\n";
+ "max children reached: %u\n"
+ "slow requests: %lu\n";
if (full) {
full_syntax =
@@ -367,7 +371,8 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
scoreboard.active,
scoreboard.idle + scoreboard.active,
scoreboard.active_max,
- scoreboard.max_children_reached);
+ scoreboard.max_children_reached,
+ scoreboard.slow_rq);
PUTS(buffer);
efree(buffer);
diff --git a/tests/basic/php_egg_logo_guid.phpt b/tests/basic/php_egg_logo_guid.phpt
deleted file mode 100644
index b3c5d7bdfd..0000000000
--- a/tests/basic/php_egg_logo_guid.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-Testing php_egg_logo_guid() function
---FILE--
-<?php
-echo php_egg_logo_guid();
-?>
---EXPECT--
-PHPE9568F36-D428-11d2-A769-00AA001ACF42
-
---CREDITS--
-Jason Easter <easter@phpug-wuerzburg.de>
-PHPUG Würzburg <phpug-wuerzburg.de>
-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 b5724a96ab..0000000000
--- a/tests/basic/php_logo_guid.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-Testing php_logo_guid() function
---FILE--
-<?php
-echo php_logo_guid();
-?>
---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 2b9003a350..0000000000
--- a/tests/basic/php_real_logo_guid.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Testing php_real_logo_guid() function
---FILE--
-<?php
-echo php_real_logo_guid();
-?>
---EXPECT--
-PHPE9568F34-D428-11d2-A769-00AA001ACF42
---CREDITS--
-Jason Easter <easter@phpug-wuerzburg.de>
-PHPUG Würzburg <phpug-wuerzburg.de>
-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 23ca0165ae..0000000000
--- a/tests/basic/zend_logo_guid.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-Testing zend_logo_guid() function
---FILE--
-<?php
-echo zend_logo_guid();
-?>
---EXPECT--
-PHPE9568F35-D428-11d2-A769-00AA001ACF42
-
---CREDITS--
-Jason Easter <easter@phpug-wuerzburg.de>
-PHPUG Würzburg <phpug-wuerzburg.de>
-Testfest 2009 2009-06-20 \ No newline at end of file
diff --git a/tests/lang/bug45392.phpt b/tests/lang/bug45392.phpt
index ae84cd9d1d..78876c7c80 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--
+<?php
+if (getenv("USE_ZEND_ALLOC") === "0") {
+ die("skip Zend MM disabled");
+}
--FILE--
<?php
echo __LINE__ . "\n";
diff --git a/tests/lang/compare_objects_basic2.phpt b/tests/lang/compare_objects_basic2.phpt
index a2c34d06ad..7e4786cd28 100644
--- a/tests/lang/compare_objects_basic2.phpt
+++ b/tests/lang/compare_objects_basic2.phpt
@@ -20,9 +20,5 @@ var_dump($obj1 == $obj2);
===DONE===
--EXPECTF--
Simple test comparing two objects with different compare callback handler
-
-Notice: Object of class X could not be converted to int in %s on line %d
-
-Notice: Object of class DateTime could not be converted to int in %s on line %d
-bool(true)
-===DONE=== \ No newline at end of file
+bool(false)
+===DONE===
diff --git a/tests/lang/foreachLoop.007.phpt b/tests/lang/foreachLoop.007.phpt
deleted file mode 100644
index f47fdc735f..0000000000
--- a/tests/lang/foreachLoop.007.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-Foreach loop tests - error case: reference to constant array.
---FILE--
-<?php
-echo "\nReference to constant array\n";
-foreach (array(1,2) as &$v) {
- var_dump($v);
-}
-?>
---EXPECTF--
-Parse error: %s on line 3
diff --git a/tests/lang/foreachLoop.008.phpt b/tests/lang/foreachLoop.008.phpt
deleted file mode 100644
index 787f43b883..0000000000
--- a/tests/lang/foreachLoop.008.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-Foreach loop tests - error case: reference to constant array, with key.
---FILE--
-<?php
-foreach (array(1,2) as $k=>&$v) {
- var_dump($v);
-}
-?>
---EXPECTF--
-Fatal error: Cannot create references to elements of a temporary array expression in %s on line 2
diff --git a/travis/compile.sh b/travis/compile.sh
index a0fc167a15..b48bfe8e24 100755
--- a/travis/compile.sh
+++ b/travis/compile.sh
@@ -1,6 +1,6 @@
#!/bin/bash
./buildconf
-./configure \
+./configure --quiet \
--with-pdo-mysql \
--with-mysql \
--with-mysqli \
@@ -33,7 +33,5 @@
--with-gettext \
--enable-sockets \
--with-bz2 \
---enable-bcmath \
---enable-fastcgi \
---with-mime-magic
-make \ No newline at end of file
+--enable-bcmath
+make --quiet
diff --git a/win32/build/config.w32 b/win32/build/config.w32
index 1a4b834be4..daf0194350 100644
--- a/win32/build/config.w32
+++ b/win32/build/config.w32
@@ -359,7 +359,7 @@ ADD_SOURCES("Zend", "zend_language_parser.c zend_language_scanner.c \
zend_stream.c zend_iterators.c zend_interfaces.c zend_objects.c \
zend_object_handlers.c zend_objects_API.c \
zend_default_classes.c zend_execute.c zend_strtod.c zend_gc.c zend_closures.c \
- zend_float.c zend_string.c");
+ zend_float.c zend_string.c zend_generators.c");
if (VCVERS == 1200) {
AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1);
@@ -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/libs_version.txt b/win32/build/libs_version.txt
index 39281d7387..0d1af3d1b4 100644
--- a/win32/build/libs_version.txt
+++ b/win32/build/libs_version.txt
@@ -6,7 +6,7 @@ jpeglib-6b
libcurl-7.24.0
libiconv-1.11
libmcrypt-2.5.8
-libmpir-1.3.1
+libmpir-2.5.1
libpng-1.2.46
libpq-8.3.6
libssh2-1.3.0
diff --git a/win32/php5dll.dsp b/win32/php5dll.dsp
index 2216d7dfe6..cc56f538af 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 a8e93ec5e7..3755ea79f9 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 45e842b455..638d85ae52 100644
--- a/win32/registry.c
+++ b/win32/registry.c
@@ -77,12 +77,13 @@ 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) {
- return ret;
+ ht = (HashTable*)malloc(sizeof(HashTable));
+ if (!ht) {
+ return ret;
+ }
+ zend_hash_init(ht, 0, NULL, ZVAL_INTERNAL_PTR_DTOR, 1);
}
- zend_hash_init(ht, 0, NULL, ZVAL_INTERNAL_PTR_DTOR, 1);
-
data = (zval*)malloc(sizeof(zval));
if (!data) {
return ret;