Skip to content
Browse files

Merge remote-tracking branch 'php-src/master' into addGeneratorsSupport

This is just an intial merge. It does not yet make generators and finally
work together.

Conflicts:
	Zend/zend_language_scanner.c
	Zend/zend_language_scanner_defs.h
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h
	Zend/zend_vm_execute.skl
	Zend/zend_vm_opcodes.h
  • Loading branch information...
2 parents 268740d + 80d5ae3 commit f4ce3646285fbdd3354ca86ae67857b6ee8f7e3a @nikic nikic committed
Showing with 8,084 additions and 24,724 deletions.
  1. +1 −0 .gitattributes
  2. +24 −0 .travis.yml
  3. +21 −1 NEWS
  4. +30 −0 README.md
  5. +79 −1 UPGRADING
  6. +28 −1 UPGRADING.INTERNALS
  7. +0 −22,097 Zend/ChangeLog
  8. +1 −1 Zend/acinclude.m4
  9. +37 −0 Zend/tests/bug18556.phpt
  10. +7 −7 Zend/tests/bug39018.phpt
  11. +21 −0 Zend/tests/bug54547.phpt
  12. +6 −0 Zend/tests/bug55509.phpt
  13. +29 −0 Zend/tests/bug61782.phpt
  14. +15 −0 Zend/tests/bug62005.phpt
  15. +17 −0 Zend/tests/bug62097.phpt
  16. +33 −0 Zend/tests/bug62653.phpt
  17. +11 −0 Zend/tests/bug62680.phpt
  18. +23 −0 Zend/tests/bug62763.phpt
  19. +32 −0 Zend/tests/catch_finally_001.phpt
  20. +21 −0 Zend/tests/catch_finally_002.phpt
  21. +40 −0 Zend/tests/catch_finally_003.phpt
  22. +41 −0 Zend/tests/catch_finally_004.phpt
  23. +21 −0 Zend/tests/catch_finally_005.phpt
  24. +28 −0 Zend/tests/catch_finally_006.phpt
  25. +32 −0 Zend/tests/empty_with_expr.phpt
  26. +8 −0 Zend/tests/isset_expr_error.phpt
  27. +8 −0 Zend/tests/isset_func_error.phpt
  28. +4 −4 Zend/tests/offset_string.phpt
  29. +68 −0 Zend/tests/traits/bug61998.phpt
  30. +36 −0 Zend/tests/try_catch_finally_001.phpt
  31. +42 −0 Zend/tests/try_catch_finally_002.phpt
  32. +38 −0 Zend/tests/try_catch_finally_003.phpt
  33. +30 −0 Zend/tests/try_catch_finally_004.phpt
  34. +23 −0 Zend/tests/try_finally_001.phpt
  35. +23 −0 Zend/tests/try_finally_002.phpt
  36. +27 −0 Zend/tests/try_finally_003.phpt
  37. +15 −6 Zend/zend.c
  38. +13 −0 Zend/zend.h
  39. +5 −7 Zend/zend_API.c
  40. +5 −0 Zend/zend_API.h
  41. +2 −2 Zend/zend_alloc.c
  42. +3 −3 Zend/zend_alloc.h
  43. +66 −19 Zend/zend_compile.c
  44. +4 −6 Zend/zend_compile.h
  45. +2 −2 Zend/zend_exceptions.c
  46. +3 −4 Zend/zend_execute.c
  47. +1 −1 Zend/zend_hash.h
  48. +1,302 −1,264 Zend/zend_ini_scanner.c
  49. +27 −6 Zend/zend_ini_scanner.l
  50. +1 −1 Zend/zend_ini_scanner_defs.h
  51. +25 −11 Zend/zend_language_parser.y
  52. +666 −633 Zend/zend_language_scanner.c
  53. +4 −0 Zend/zend_language_scanner.l
  54. +1 −1 Zend/zend_language_scanner_defs.h
  55. +1 −1 Zend/zend_multibyte.c
  56. +11 −17 Zend/zend_object_handlers.c
  57. +3 −0 Zend/zend_object_handlers.h
  58. +13 −13 Zend/zend_objects.c
  59. +6 −0 Zend/zend_opcode.c
  60. +112 −10 Zend/zend_operators.c
  61. +22 −2 Zend/zend_operators.h
  62. +1 −1 Zend/zend_stream.c
  63. +2 −0 Zend/zend_string.h
  64. +187 −19 Zend/zend_vm_def.h
  65. +538 −40 Zend/zend_vm_execute.h
  66. +1 −0 Zend/zend_vm_execute.skl
  67. +3 −2 Zend/zend_vm_opcodes.h
  68. +1 −1 configure.in
  69. +16 −7 ext/calendar/calendar.c
  70. +52 −12 ext/calendar/jewish.c
  71. +3 −0 ext/calendar/sdncal.h
  72. +59 −0 ext/calendar/tests/bug54254.phpt
  73. +4 −4 ext/calendar/tests/cal_info.phpt
  74. +4 −4 ext/calendar/tests/jdmonthname.phpt
  75. +5 −3 ext/calendar/tests/jdtojewish.phpt
  76. +3 −3 ext/com_dotnet/com_misc.c
  77. +2 −2 ext/com_dotnet/com_olechar.c
  78. +1 −1 ext/com_dotnet/com_persist.c
  79. +3 −3 ext/com_dotnet/com_typeinfo.c
  80. +3 −3 ext/com_dotnet/com_variant.c
  81. +2 −2 ext/com_dotnet/com_wrapper.c
  82. +8 −0 ext/com_dotnet/php_com_dotnet.h
  83. +14 −14 ext/com_dotnet/php_com_dotnet_internal.h
  84. +8 −1 ext/curl/interface.c
  85. +25 −0 ext/curl/tests/bug61948-win32.phpt
  86. +5 −2 ext/curl/tests/bug61948.phpt
  87. BIN ext/curl/tests/curl_escape.phpt
  88. +36 −39 ext/date/lib/tm2unixtime.c
  89. +19 −0 ext/date/php_date.c
  90. +62 −0 ext/date/tests/bug61642.phpt
  91. +28 −0 ext/date/tests/bug62500.phpt
  92. +4 −0 ext/dom/documenttype.c
  93. +8 −0 ext/dom/node.c
  94. +2 −2 ext/dom/tests/DOMAttr_value_basic_001.phpt
  95. +2 −2 ext/dom/tests/DOMAttr_value_basic_002.phpt
  96. +2 −2 ext/dom/tests/DOMCharacterData_data_error_002.phpt
  97. +2 −2 ext/dom/tests/DOMCharacterData_length_error_001.phpt
  98. +8 −1 ext/dom/xpath.c
  99. +5 −1 ext/exif/exif.c
  100. +1 −1 ext/fileinfo/fileinfo.c
  101. +334 −116 ext/fileinfo/libmagic.patch
  102. +20 −7 ext/fileinfo/libmagic/apprentice.c
  103. +1 −24 ext/fileinfo/libmagic/softmagic.c
  104. +69 −0 ext/fileinfo/tests/bug61964.phpt
  105. +3 −1 ext/fileinfo/tests/finfo_file_002.phpt
  106. +36 −0 ext/fileinfo/tests/finfo_file_regex-win32.phpt
  107. +32 −0 ext/fileinfo/tests/finfo_file_regex.phpt
  108. +53 −0 ext/fileinfo/tests/finfo_open_error-win32.phpt
  109. +4 −1 ext/fileinfo/tests/finfo_open_error.phpt
  110. +1 −0 ext/fileinfo/tests/resources/test.awk
  111. +90 −0 ext/gmp/tests/022-win32.phpt
  112. +5 −1 ext/gmp/tests/022.phpt
  113. +45 −0 ext/gmp/tests/gmp_nextprime-win32.phpt
  114. +5 −1 ext/gmp/tests/gmp_nextprime.phpt
  115. +178 −32 ext/hash/hash.c
  116. +1 −0 ext/hash/php_hash.h
  117. +37 −0 ext/hash/tests/hash_pbkdf2_basic.phpt
  118. +78 −0 ext/hash/tests/hash_pbkdf2_error.phpt
  119. +66 −62 ext/iconv/iconv.c
  120. +1 −1 ext/imap/tests/imap_errors_basic.phpt
  121. 0 ext/intl/CREDITS
  122. 0 ext/intl/TODO
  123. +397 −0 ext/intl/breakiterator/breakiterator_class.cpp
  124. +71 −0 ext/intl/breakiterator/breakiterator_class.h
  125. +346 −0 ext/intl/breakiterator/breakiterator_iterators.cpp
  126. +42 −0 ext/intl/breakiterator/breakiterator_iterators.h
  127. +452 −0 ext/intl/breakiterator/breakiterator_methods.cpp
  128. +64 −0 ext/intl/breakiterator/breakiterator_methods.h
  129. +291 −0 ext/intl/breakiterator/codepointiterator_internal.cpp
  130. +98 −0 ext/intl/breakiterator/codepointiterator_internal.h
  131. +44 −0 ext/intl/breakiterator/codepointiterator_methods.cpp
  132. +24 −0 ext/intl/breakiterator/codepointiterator_methods.h
  133. +221 −0 ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
  134. +32 −0 ext/intl/breakiterator/rulebasedbreakiterator_methods.h
  135. +20 −4 ext/intl/calendar/calendar_class.cpp
  136. +3 −0 ext/intl/calendar/calendar_class.h
  137. +186 −15 ext/intl/calendar/calendar_methods.cpp
  138. +4 −0 ext/intl/calendar/calendar_methods.h
  139. +4 −4 ext/intl/calendar/gregoriancalendar_methods.cpp
  140. 0 ext/intl/collator/collator.c
  141. 0 ext/intl/collator/collator.h
  142. 0 ext/intl/collator/collator_attr.c
  143. 0 ext/intl/collator/collator_attr.h
  144. +1 −0 ext/intl/collator/collator_class.c
  145. 0 ext/intl/collator/collator_class.h
  146. 0 ext/intl/collator/collator_compare.c
  147. 0 ext/intl/collator/collator_compare.h
  148. 0 ext/intl/collator/collator_convert.c
  149. 0 ext/intl/collator/collator_convert.h
  150. +1 −1 ext/intl/collator/collator_create.c
  151. 0 ext/intl/collator/collator_create.h
  152. 0 ext/intl/collator/collator_error.c
  153. 0 ext/intl/collator/collator_error.h
  154. 0 ext/intl/collator/collator_is_numeric.c
  155. 0 ext/intl/collator/collator_is_numeric.h
  156. 0 ext/intl/collator/collator_locale.c
  157. 0 ext/intl/collator/collator_locale.h
  158. +3 −1 ext/intl/collator/collator_sort.c
  159. 0 ext/intl/collator/collator_sort.h
  160. +250 −0 ext/intl/common/common_date.cpp
  161. +40 −0 ext/intl/common/common_date.h
  162. +12 −41 ext/intl/common/common_enum.cpp
  163. +39 −0 ext/intl/common/common_enum.h
  164. +2 −2 ext/intl/common/common_error.c
  165. 0 ext/intl/common/common_error.h
  166. +17 −5 ext/intl/config.m4
  167. +14 −0 ext/intl/config.w32
  168. +0 −110 ext/intl/dateformat/dateformat.c
  169. 0 ext/intl/dateformat/dateformat.h
Sorry, we could not display the entire diff because too many files (787) changed.
View
1 .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
View
24 .travis.yml
@@ -0,0 +1,24 @@
+language: php
+
+php:
+ # We only specify one version so we only get one worker
+ - 5.4
+
+notifications:
+ email: false
+
+env:
+ - REPORT_EXIT_STATUS=1 TEST_PHP_EXECUTABLE=./sapi/cli/php
+
+before_script:
+ # Compile PHP
+ - ./travis/compile.sh
+ # Setup Extensions
+ - . ./travis/ext/mysql/setup.sh
+ - . ./travis/ext/mysqli/setup.sh
+ - . ./travis/ext/pdo_mysql/setup.sh
+ - . ./travis/ext/pgsql/setup.sh
+ - . ./travis/ext/pdo_pgsql/setup.sh
+
+# Run PHPs run-tests.php
+script: ./sapi/cli/php run-tests.php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP"
View
22 NEWS
@@ -3,12 +3,22 @@ PHP NEWS
?? ??? 201?, PHP 5.5.0
- General improvements:
+ . Implemented 'finally' keyword (https://wiki.php.net/rfc/finally). (Laruence)
. Drop Windows XP and 2003 support. (Pierre)
. World domination
. Improve set_exception_handler while doing reset.(Laruence)
. Support constant array/string dereferencing. (Laruence)
+ . Add support for using empty() on the result of function calls and
+ other expressions (https://wiki.php.net/rfc/empty_isset_exprs).
+ (Nikita Popov)
+
+- Calendar:
+ . Fixed bug #54254 (cal_from_jd returns month = 6 when there is only one Adar)
+ (Stas, Eitan Mosenkis).
- Core:
+ . Added boolval(). (Jille Timmermans).
+ . Fixed bug #18556 (Engine uses locale rules to handle class names). (Stas)
. Fixed bug #61681 (Malformed grammar). (Nikita Popov, Etienne, Laruence).
. Fixed bug #61038 (unpack("a5", "str\0\0") does not work as expected).
(srgoogleguy, Gustavo)
@@ -35,9 +45,16 @@ PHP NEWS
CURLOPT_TRANSFER_ENCODING, CURLOPT_DNS_SERVERS and CURLOPT_USE_SSL.
(Pierrick)
. Fixed bug #55635 (CURLOPT_BINARYTRANSFER no longer used. The constant
- still exists for backward compatibility but is doing nothing). (Pierrick)
+ still exists for backward compatibility but is doing nothing). (Pierrick)
. Fixed bug #54995 (Missing CURLINFO_RESPONSE_CODE support). (Pierrick)
+- Datetime
+ . Fixed bug #61642 (modify("+5 weekdays") returns Sunday).
+ (Dmitri Iouchtchenko)
+
+- Hash
+ . Added support for PBKDF2 via hash_pbkdf2(). (Anthony Ferrara)
+
- MySQLi
. Dropped support for LOAD DATA LOCAL INFILE handlers when using libmysql.
Known for stability problems. (Andrey)
@@ -49,4 +66,7 @@ PHP NEWS
- pgsql
. Added pg_escape_literal() and pg_escape_identifier() (Yasuo)
+- Zip:
+ . Upgraded libzip to 0.10.1 (Anatoliy)
+
<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>
View
30 README.md
@@ -0,0 +1,30 @@
+The PHP Interpreter
+===================
+
+This is the github mirror of the official PHP repository located at
+http://git.php.net.
+
+[![Build Status](https://secure.travis-ci.org/php/php-src.png?branch=master)](http://travis-ci.org/php/php-src)
+
+Pull Requests
+=============
+PHP accepts pull requests via github. Discussions are done on github, but
+depending on the topic can also be relayed to the official PHP developer
+mailinglist internals@lists.php.net.
+
+New features require an RFC and must be accepted by the developers.
+See https://wiki.php.net/rfc and https://wiki.php.net/rfc/voting for more
+information on the process.
+
+Bug fixes **do not** require an RFC, but require a bugtracker ticket. Always
+open a ticket at http://bugs.php.net and reference the bug id using #NNNNNN.
+
+ Fix #55371: get_magic_quotes_gpc() throws deprecation warning
+
+ After removing magic quotes, the get_magic_quotes_gpc function caused
+ a deprecate warning. get_magic_quotes_gpc can be used to detected
+ the magic_quotes behavior and therefore should not raise a warning at any
+ time. The patch removes this warning
+
+We do not merge pull requests directly on github. All PRs will be
+pulled and pushed through http://git.php.net.
View
80 UPGRADING
@@ -21,13 +21,23 @@ PHP X.Y UPGRADE NOTES
========================================
- Drop Windows XP and 2003 support. (Pierre)
+- All internal case insensitivity handling for class, function and constant
+ names is done according to ASCII rules, current locale settings are ignored.
+- php_logo_guid(), php_egg_logo_guid(), php_real_logo_guid() and
+ zend_logo_guid() have been removed
+- Removal of Logo GUIDs
========================================
2. New Features
========================================
+- Support finally keyword. (Laruence)
+ (wiki.php.net/rfc/finally)
- Support constant array/string dereferencing. (Laruence)
(https://wiki.php.net/rfc/constdereference)
+- Add support for using empty() on the result of function calls and
+ other expressions. Thus it is now possible to write empty(getArray()),
+ for example. (https://wiki.php.net/rfc/empty_isset_exprs)
========================================
2. Changes in SAPI modules
@@ -51,13 +61,63 @@ PHP X.Y UPGRADE NOTES
- Implemented format character "Z": NUL-padded string
- "a" now does not remove trailing NUL characters on unpack() anymore
- "A" will now strip all trailing ASCII whitespace on unpack() (it used to
- remove only trailing spaces.
+ remove only trailing spaces).
+- MessageFormatter::format() and related functions now accepted named arguments
+ and mixed numeric/named arguments in ICU 4.8+.
+- MessageFormatter::format() and related functions now don't error out when
+ an insufficient argument count is provided. Instead, the placeholders will
+ remain unsubstituted.
+- MessageFormatter::parse() and MessageFormat::format() (and their static
+ equivalents) now don't throw away better than second precision in the
+ arguments.
+- IntlDateFormatter::__construct and datefmt_create() now accept for the
+ $timezone argument time zone identifiers, IntlTimeZone objects, DateTimeZone
+ objects and NULL. It used to accept only time zone identifiers and NULL.
+ Invalid time zone identifiers are no longer accepted. Emptry strings are
+ no longer accepted.
+- The default time zone used in IntlDateFormatter::__construct and
+ datefmt_create() (when the corresponding argument is not passed or NULL is
+ passed) is now the one given by date_default_timezone_get(), not the
+ default ICU time zone.
+- The time zone passed to the IntlDateFormatter is ignored if it is NULL and if
+ the calendar passed is an IntlCalendar object -- in this case, the
+ IntlCalendar's time zone will be used instead. Otherwise, the time zone
+ specified in the $timezone argument is used instead. This does not affect
+ old code, as IntlCalendar was introduced in this version.
+- IntlDateFormatter::__construct and datefmt_create() now accept for the
+ $calendar argument also IntlCalendar objects.
+- IntlDateFormatter::getCalendar() and datefmt_get_calendar() return false
+ if the IntlDateFormatter was set up with an IntlCalendar instead of the
+ constants IntlDateFormatter::GREGORIAN/TRADITIONAL. IntlCalendar did not
+ exist before this version.
+- IntlDateFormatter::setCalendar() and datefmt_set_calendar() now also accept
+ an IntlCalendar object, in which case its time zone is taken. Passing a
+ constant is still allowed, and still keeps the time zone.
+- IntlDateFormatter::setTimeZoneID() and datefmt_set_timezone_id() are
+ deprecated. Use IntlDateFormatter::setTimeZone() or datefmt_set_timezone()
+ instead.
+- IntlDateFormatter::format() and datefmt_format() now also accept an
+ IntlCalendar object for formatting.
+- Deprecated mcrypt_ecb() made to produce E_DEPRECATED.
+- php_logo_guid(), php_egg_logo_guid(), php_real_logo_guid() and
+ zend_logo_guid() have been removed
========================================
5. New Functions
========================================
+- Core:
+ - boolval()
+
+- Hash:
+ - hash_pbkdf2()
+
- Intl:
+ - datefmt_format_object()
+ - datefmt_get_calendar_object()
+ - datefmt_get_timezone()
+ - datefmt_set_timezone()
+ - datefmt_get_calendar_object()
- intlcal_create_instance()
- intlcal_get_keyword_values_for_locale()
- intlcal_get_now()
@@ -98,6 +158,8 @@ PHP X.Y UPGRADE NOTES
- intlcal_get_skipped_wall_time_option()
- intlcal_set_repeated_wall_time_option()
- intlcal_set_skipped_wall_time_option()
+ - intlcal_from_date_time()
+ - intlcal_to_date_time()
- intlcal_get_error_code()
- intlcal_get_error_message()
- intlgregcal_create_instance()
@@ -122,9 +184,16 @@ PHP X.Y UPGRADE NOTES
- intltz_has_same_rules()
- intltz_get_display_name()
- intltz_get_dst_savings()
+ - intltz_from_date_time_zone()
+ - intltz_to_date_time_zone()
- intltz_get_error_code()
- intltz_get_error_message()
+ - IntlDateFormatter::formatObject()
+ - IntlDateFormatter::getCalendarObject()
+ - IntlDateFormatter::getTimeZone()
+ - IntlDateFormatter::setTimeZone()
+
- SPL:
- SplFixedArray::__wakeup()
@@ -136,6 +205,9 @@ PHP X.Y UPGRADE NOTES
- IntlCalendar
- IntlGregorianCalendar
- IntlTimeZone
+ - IntlBreakIterator
+ - IntlRuleBasedBreakIterator
+ - IntlCodePointBreakIterator
========================================
7. Removed Extensions
@@ -146,6 +218,10 @@ PHP X.Y UPGRADE NOTES
8. Other Changes to Extensions
========================================
+- Intl:
+ - This extension now requires ICU 4.0+.
+ - Added intl.use_exceptions INI directive, which controls what happens when
+ global errors are set together with intl.error_level.
========================================
9. New Global Constants
@@ -160,3 +236,5 @@ PHP X.Y UPGRADE NOTES
========================================
11. Other Changes
========================================
+
+- Logo GUIDs will no longer work
View
29 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.
View
22,097 Zend/ChangeLog
0 additions, 22,097 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
2 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
View
37 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.
View
14 Zend/tests/bug39018.phpt
@@ -62,17 +62,17 @@ print "\nDone\n";
?>
--EXPECTF--
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
Notice: Uninitialized string offset: 0 in %s on line %d
Notice: Uninitialized string offset: 0 in %s on line %d
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
Notice: Uninitialized string offset: %i in %s on line %d
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
Notice: Uninitialized string offset: %i in %s on line %d
@@ -88,16 +88,16 @@ Notice: Uninitialized string offset: 4 in %s on line %d
Notice: Uninitialized string offset: 4 in %s on line %d
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
Notice: Uninitialized string offset: 12 in %s on line %d
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
Notice: Uninitialized string offset: 12 in %s on line %d
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
b
Done
View
21 Zend/tests/bug54547.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #54547: wrong equality of string numbers near LONG_MAX with 64-bit longs
+--SKIPIF--
+<?php
+if (PHP_INT_MAX !== 9223372036854775807)
+ die("skip for 64-bit long systems only");
+--FILE--
+<?php
+var_dump("9223372036854775807" == "9223372036854775808");
+var_dump("-9223372036854775808" == "-9223372036854775809");
+var_dump("0x7fffffffffffffff" == "9223372036854775808");
+
+/* not exactly what the bug is about, but closely related problem: */
+var_dump("999223372036854775807"=="999223372036854775808");
+var_dump("899223372036854775807">"00999223372036854775807");
+--EXPECT--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
View
6 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') {
View
29 Zend/tests/bug61782.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Bug #61782 (__clone/__destruct do not match other methods when checking access controls)
+--FILE--
+<?php
+ abstract class BaseClass {
+ abstract protected function __clone();
+ }
+
+ class MommasBoy extends BaseClass {
+ protected function __clone() {
+ echo __METHOD__, "\n";
+ }
+ }
+
+ class LatchkeyKid extends BaseClass {
+ public function __construct() {
+ echo 'In ', __CLASS__, ":\n";
+ $kid = new MommasBoy();
+ $kid = clone $kid;
+ }
+ public function __clone() {}
+ }
+
+ $obj = new LatchkeyKid();
+echo "DONE\n";
+--EXPECT--
+In LatchkeyKid:
+MommasBoy::__clone
+DONE
View
15 Zend/tests/bug62005.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #62005 (unexpected behavior when incrementally assigning to a member of a null object)
+--FILE--
+<?php
+function add_points($player, $points) {
+ $player->energy += $points;
+ print_r($player);
+}
+add_points(NULL, 2);
+--EXPECTF--
+Warning: Creating default object from empty value in %sbug62005.php on line %d
+stdClass Object
+(
+ [energy] => 2
+)
View
17 Zend/tests/bug62097.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #62097: fix for bug #54547 is wrong for 32-bit machines
+--SKIPIF--
+<?php
+if (PHP_INT_MAX !== 2147483647)
+ die('skip for system with 32-bit wide longs only');
+--FILE--
+<?php
+var_dump("02147483647" == "2147483647",
+ "02147483648" == "2147483648",
+ "09007199254740991" == "9007199254740991",
+ "09007199254740992" == "9007199254740992");
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(false)
View
33 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
+(
+)
View
11 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)
View
23 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
View
32 Zend/tests/catch_finally_001.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Try catch finally
+--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
View
21 Zend/tests/catch_finally_002.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Try catch finally 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)
View
40 Zend/tests/catch_finally_003.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Try catch finally multi-return
+--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"
View
41 Zend/tests/catch_finally_004.phpt
@@ -0,0 +1,41 @@
+--TEST--
+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"
View
21 Zend/tests/catch_finally_005.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Try catch finally with return
+--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)
View
28 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"
View
32 Zend/tests/empty_with_expr.phpt
@@ -0,0 +1,32 @@
+--TEST--
+empty() with arbitrary expressions
+--FILE--
+<?php
+
+function getEmptyArray() { return []; }
+function getNonEmptyArray() { return [1, 2, 3]; }
+
+var_dump(empty([]));
+var_dump(empty([1, 2, 3]));
+
+var_dump(empty(getEmptyArray()));
+var_dump(empty(getNonEmptyArray()));
+
+var_dump(empty([] + []));
+var_dump(empty([1, 2, 3] + []));
+
+var_dump(empty("string"));
+var_dump(empty(""));
+var_dump(empty(true));
+var_dump(empty(false));
+--EXPECT--
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
View
8 Zend/tests/isset_expr_error.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Error message for isset(func())
+--FILE--
+<?php
+isset(1 + 1);
+?>
+--EXPECTF--
+Fatal error: Cannot use isset() on the result of an expression (you can use "null !== expression" instead) in %s on line %d
View
8 Zend/tests/isset_func_error.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Error message for isset(func())
+--FILE--
+<?php
+isset(abc());
+?>
+--EXPECTF--
+Fatal error: Cannot use isset() on the result of a function call (you can use "null !== func()" instead) in %s on line %d
View
8 Zend/tests/offset_string.phpt
@@ -30,10 +30,10 @@ echo "Done\n";
--EXPECTF--
string(1) "i"
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
string(1) "S"
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
string(1) "S"
Warning: Illegal string offset 'run away' in %s on line %d
@@ -46,10 +46,10 @@ string(1) "o"
Notice: A non well formed numeric value encountered in %s on line %d
string(1) "r"
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
string(1) "i"
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
string(1) "S"
Warning: Illegal offset type in %s on line %d
View
68 Zend/tests/traits/bug61998.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Bug #61998 (Using traits with method aliases appears to result in crash during execution)
+--FILE--
+<?php
+class Foo {
+ use T1 {
+ func as newFunc;
+ }
+
+ public function func() {
+ echo "From Foo\n";
+ }
+}
+
+trait T1 {
+ public function func() {
+ echo "From T1\n";
+ }
+}
+
+class Bar {
+ public function func() {
+ echo "From Bar\n";
+ }
+ public function func2() {
+ echo "From Bar\n";
+ }
+ public function func3() {
+ echo "From Bar\n";
+ }
+ use T1 {
+ func as newFunc;
+ func as func2;
+ }
+ use T2 {
+ func2 as newFunc2;
+ func2 as newFunc3;
+ func2 as func3;
+ }
+}
+
+trait T2 {
+ public function func2() {
+ echo "From T2\n";
+ }
+}
+
+$f = new Foo();
+
+$f->newFunc(); //from T1
+$f->func(); //from Foo
+
+$b = new Bar();
+$b->newFunc(); //from T1
+$b->func(); //from Bar
+$b->func2(); //from Bar
+$b->newFunc2(); //from T2
+$b->newFunc3(); //from T2
+$b->func3(); //from Bar
+--EXPECTF--
+From T1
+From Foo
+From T1
+From Bar
+From Bar
+From T2
+From T2
+From Bar
View
36 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)
View
42 Zend/tests/try_catch_finally_002.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Try catch finally
+--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)
View
38 Zend/tests/try_catch_finally_003.phpt
@@ -0,0 +1,38 @@
+--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) {
+ 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)
View
30 Zend/tests/try_catch_finally_004.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Try catch finally
+--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"
View
23 Zend/tests/try_finally_001.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Try finally
+--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
+
View
23 Zend/tests/try_finally_002.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Try finally
+--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"
View
27 Zend/tests/try_finally_003.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Try finally
+--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
View
21 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;
}
View
13 Zend/zend.h
@@ -133,6 +133,11 @@ char *alloca ();
# endif
#endif
+/* Compatibility with non-clang compilers */
+#ifndef __has_attribute
+# define __has_attribute(x) 0
+#endif
+
/* GCC x.y.z supplies __GNUC__ = x and __GNUC_MINOR__ = y */
#ifdef __GNUC__
# define ZEND_GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
@@ -146,6 +151,14 @@ char *alloca ();
# define ZEND_ATTRIBUTE_MALLOC
#endif
+#if ZEND_GCC_VERSION >= 4003 || __has_attribute(alloc_size)
+# define ZEND_ATTRIBUTE_ALLOC_SIZE(X) __attribute__ ((alloc_size(X)))
+# define ZEND_ATTRIBUTE_ALLOC_SIZE2(X,Y) __attribute__ ((alloc_size(X,Y)))
+#else
+# define ZEND_ATTRIBUTE_ALLOC_SIZE(X)
+# define ZEND_ATTRIBUTE_ALLOC_SIZE2(X,Y)
+#endif
+
#if ZEND_GCC_VERSION >= 2007
# define ZEND_ATTRIBUTE_FORMAT(type, idx, first) __attribute__ ((format(type, idx, first)))
#else
View
12 Zend/zend_API.c
@@ -2547,16 +2547,15 @@ static const zend_function_entry disabled_class_new[] = {
ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_DC) /* {{{ */
{
- zend_class_entry disabled_class;
+ zend_class_entry **disabled_class;
zend_str_tolower(class_name, class_name_length);
- if (zend_hash_del(CG(class_table), class_name, class_name_length+1)==FAILURE) {
+ if (zend_hash_find(CG(class_table), class_name, class_name_length+1, (void **)&disabled_class)==FAILURE) {
return FAILURE;
}
- INIT_OVERLOADED_CLASS_ENTRY_EX(disabled_class, class_name, class_name_length, disabled_class_new, NULL, NULL, NULL, NULL, NULL);
- disabled_class.create_object = display_disabled_class;
- disabled_class.name_length = class_name_length;
- zend_register_internal_class(&disabled_class TSRMLS_CC);
+ INIT_CLASS_ENTRY_INIT_METHODS((**disabled_class), disabled_class_new, NULL, NULL, NULL, NULL, NULL);
+ (*disabled_class)->create_object = display_disabled_class;
+ zend_hash_clean(&((*disabled_class)->function_table));
return SUCCESS;
}
/* }}} */
@@ -2630,7 +2629,6 @@ static int zend_is_callable_check_class(const char *name, int name_len, zend_fca
}
/* }}} */
-
static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fcall_info_cache *fcc, int strict_class, char **error TSRMLS_DC) /* {{{ */
{
zend_class_entry *ce_org = fcc->calling_scope;
View
5 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; \
View
4 Zend/zend_alloc.c
@@ -658,9 +658,9 @@ static unsigned int _mem_block_end_magic = 0;
#define ZEND_MM_LARGE_BUCKET_INDEX(S) zend_mm_high_bit(S)
-static void *_zend_mm_alloc_int(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
+static void *_zend_mm_alloc_int(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_ALLOC_SIZE(2);
static void _zend_mm_free_int(zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_ALLOC_SIZE(3);
static inline unsigned int zend_mm_high_bit(size_t _size)
{
View
6 Zend/zend_alloc.h
@@ -54,12 +54,12 @@ BEGIN_EXTERN_C()
ZEND_API char *zend_strndup(const char *s, unsigned int length) ZEND_ATTRIBUTE_MALLOC;
-ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
+ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_ALLOC_SIZE(1);
ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
ZEND_API void *_safe_malloc(size_t nmemb, size_t size, size_t offset) ZEND_ATTRIBUTE_MALLOC;
ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
-ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_ALLOC_SIZE2(1,2);
+ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_ALLOC_SIZE(2);
ZEND_API void *_safe_erealloc(void *ptr, size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
ZEND_API void *_safe_realloc(void *ptr, size_t nmemb, size_t size, size_t offset);
ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
View
85 Zend/zend_compile.c
@@ -1685,7 +1685,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
zval key;
if (CG(current_namespace)) {
- /* Prefix function name with current namespcae name */
+ /* Prefix function name with current namespace name */
znode tmp;
tmp.u.constant = *CG(current_namespace);
@@ -2731,6 +2731,7 @@ static int zend_add_try_element(zend_uint try_op TSRMLS_DC) /* {{{ */
CG(active_op_array)->try_catch_array = erealloc(CG(active_op_array)->try_catch_array, sizeof(zend_try_catch_element)*CG(active_op_array)->last_try_catch);
CG(active_op_array)->try_catch_array[try_catch_offset].try_op = try_op;
+ CG(active_op_array)->try_catch_array[try_catch_offset].finally_op = 0;
return try_catch_offset;
}
/* }}} */
@@ -2747,7 +2748,7 @@ void zend_do_first_catch(znode *open_parentheses TSRMLS_DC) /* {{{ */
}
/* }}} */
-void zend_initialize_try_catch_element(const znode *try_token TSRMLS_DC) /* {{{ */
+void zend_initialize_try_catch_element(znode *catch_token TSRMLS_DC) /* {{{ */
{
int jmp_op_number = get_next_op_number(CG(active_op_array));
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
@@ -2764,7 +2765,7 @@ void zend_initialize_try_catch_element(const znode *try_token TSRMLS_DC) /* {{{
zend_stack_top(&CG(bp_stack), (void **) &jmp_list_ptr);
zend_llist_add_element(jmp_list_ptr, &jmp_op_number);
- zend_add_catch_element(try_token->u.op.opline_num, get_next_op_number(CG(active_op_array)) TSRMLS_CC);
+ catch_token->EA = get_next_op_number(CG(active_op_array));
}
/* }}} */
@@ -2790,7 +2791,11 @@ void zend_do_try(znode *try_token TSRMLS_DC) /* {{{ */
}
/* }}} */
-void zend_do_begin_catch(znode *try_token, znode *class_name, znode *catch_var, znode *first_catch TSRMLS_DC) /* {{{ */
+void zend_do_finally(znode *finally_token TSRMLS_DC) /* {{{ */ {
+ finally_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
+} /* }}} */
+
+void zend_do_begin_catch(znode *catch_token, znode *class_name, znode *catch_var, znode *first_catch TSRMLS_DC) /* {{{ */
{
long catch_op_number;
zend_op *opline;
@@ -2818,11 +2823,11 @@ void zend_do_begin_catch(znode *try_token, znode *class_name, znode *catch_var,
Z_STRVAL(catch_var->u.constant) = (char*)CG(active_op_array)->vars[opline->op2.var].name;
opline->result.num = 0; /* 1 means it's the last catch in the block */
- try_token->u.op.opline_num = catch_op_number;
+ catch_token->u.op.opline_num = catch_op_number;
}
/* }}} */
-void zend_do_end_catch(const znode *try_token TSRMLS_DC) /* {{{ */
+void zend_do_end_catch(znode *catch_token TSRMLS_DC) /* {{{ */
{
int jmp_op_number = get_next_op_number(CG(active_op_array));
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
@@ -2836,7 +2841,39 @@ void zend_do_end_catch(const znode *try_token TSRMLS_DC) /* {{{ */
zend_stack_top(&CG(bp_stack), (void **) &jmp_list_ptr);
zend_llist_add_element(jmp_list_ptr, &jmp_op_number);
- CG(active_op_array)->opcodes[try_token->u.op.opline_num].extended_value = get_next_op_number(CG(active_op_array));
+ CG(active_op_array)->opcodes[catch_token->u.op.opline_num].extended_value = get_next_op_number(CG(active_op_array));
+}
+/* }}} */
+
+void zend_do_bind_catch(znode *try_token, znode *catch_token TSRMLS_DC) /* {{{ */ {
+ if (catch_token->op_type != IS_UNUSED) {
+ zend_add_catch_element(try_token->u.op.opline_num, catch_token->EA TSRMLS_CC);
+ }
+}
+/* }}} */
+
+
+void zend_do_end_finally(znode *try_token, znode* catch_token, znode *finally_token TSRMLS_DC) /* {{{ */
+{
+ zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+
+ if (catch_token->op_type == IS_UNUSED && finally_token->op_type == IS_UNUSED) {
+ zend_error(E_COMPILE_ERROR, "Cannot use try without catch or finally");
+ }
+ if (finally_token->op_type != IS_UNUSED) {
+ CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].finally_op = finally_token->u.op.opline_num;
+ //try_token->u.op.opline_num = catch_token->u.op.opline_num;
+
+ opline->opcode = ZEND_LEAVE;
+ SET_UNUSED(opline->op1);
+ SET_UNUSED(opline->op2);
+ }
+ if (catch_token->op_type == IS_UNUSED) {
+ CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].catch_op = 0;
+ } //else {
+ // try_token->u.op.opline_num = catch_token->u.op.opline_num;
+ //}
+
}
/* }}} */
@@ -3689,6 +3726,7 @@ ZEND_API void zend_do_implement_trait(zend_class_entry *ce, zend_class_entry *tr
}
}
ce->traits[ce->num_traits++] = trait;
+ trait->refcount++;
}
}
/* }}} */
@@ -3781,7 +3819,7 @@ static int zend_traits_merge_functions(zend_function *fn TSRMLS_DC, int num_args
} else {
/* Add it to result function table */
if (zend_hash_quick_add(resulting_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, fn, sizeof(zend_function), NULL)==FAILURE) {
- zend_error(E_COMPILE_ERROR, "Trait method %s has not been applied, because failure occured during updating resulting trait method table", fn->common.function_name);
+ zend_error(E_COMPILE_ERROR, "Trait method %s has not been applied, because failure occurred during updating resulting trait method table", fn->common.function_name);
}
}
@@ -3898,7 +3936,7 @@ static int zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int
function_add_ref(&fn_copy);
if (zend_hash_quick_update(&ce->function_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, &fn_copy, sizeof(zend_function), (void**)&fn_copy_p)==FAILURE) {
- zend_error(E_COMPILE_ERROR, "Trait method %s has not been applied, because failure occured during updating class method table", hash_key->arKey);
+ zend_error(E_COMPILE_ERROR, "Trait method %s has not been applied, because failure occurred during updating class method table", hash_key->arKey);
}
zend_add_magic_methods(ce, hash_key->arKey, hash_key->nKeyLength, fn_copy_p TSRMLS_CC);
@@ -3940,8 +3978,8 @@ static int zend_traits_copy_functions(zend_function *fn TSRMLS_DC, int num_args,
fn_copy = *fn;
function_add_ref(&fn_copy);
/* this function_name is never destroyed, because its refcount
- greater than 1, classes are always destoyed in reverse order
- and trait is declared early than this class */
+ greater than 1 and classes are always destoyed before the
+ traits they use */
fn_copy.common.function_name = aliases[i]->alias;
/* if it is 0, no modifieres has been changed */
@@ -4146,14 +4184,14 @@ static void zend_do_traits_method_binding(zend_class_entry *ce TSRMLS_DC) /* {{{
size_t i;
/* prepare copies of trait function tables for combination */
- function_tables = malloc(sizeof(HashTable*) * ce->num_traits);
- resulting_table = (HashTable *) malloc(sizeof(HashTable));
+ function_tables = emalloc(sizeof(HashTable*) * ce->num_traits);
+ resulting_table = (HashTable *)emalloc(sizeof(HashTable));
/* TODO: revisit this start size, may be its not optimal */
- zend_hash_init_ex(resulting_table, 10, NULL, NULL, 1, 0);
+ zend_hash_init_ex(resulting_table, 10, NULL, NULL, 0, 0);
for (i = 0; i < ce->num_traits; i++) {
- function_tables[i] = (HashTable *) malloc(sizeof(HashTable));
+ function_tables[i] = (HashTable *)emalloc(sizeof(HashTable));
zend_hash_init_ex(function_tables[i], ce->traits[i]->function_table.nNumOfElements, NULL, NULL, 1, 0);
if (ce->trait_precedences) {
@@ -4186,14 +4224,14 @@ static void zend_do_traits_method_binding(zend_class_entry *ce TSRMLS_DC) /* {{{
for (i = 0; i < ce->num_traits; i++) {
/* zend_hash_destroy(function_tables[i]); */
zend_hash_graceful_destroy(function_tables[i]);
- free(function_tables[i]);
+ efree(function_tables[i]);
}
- free(function_tables);
+ efree(function_tables);
/* free temporary resulting table */
/* zend_hash_destroy(resulting_table); */
zend_hash_graceful_destroy(resulting_table);
- free(resulting_table);
+ efree(resulting_table);
}
/* }}} */
@@ -6159,7 +6197,16 @@ void zend_do_isset_or_isempty(int type, znode *result, znode *variable TSRMLS_DC
zend_do_end_variable_parse(variable, BP_VAR_IS, 0 TSRMLS_CC);
- zend_check_writable_variable(variable);
+ if (zend_is_function_or_method_call(variable)) {
+ if (type == ZEND_ISEMPTY) {
+ /* empty(func()) can be transformed to !func() */
+ zend_do_unary_op(ZEND_BOOL_NOT, result, variable TSRMLS_CC);
+ } else {
+ zend_error(E_COMPILE_ERROR, "Cannot use isset() on the result of a function call (you can use \"null !== func()\" instead)");
+ }
+
+ return;
+ }
if (variable->op_type == IS_CV) {
last_op = get_next_op(CG(active_op_array) TSRMLS_CC);
View
10 Zend/zend_compile.h
@@ -132,6 +132,7 @@ typedef struct _zend_label {
typedef struct _zend_try_catch_element {
zend_uint try_op;
zend_uint catch_op; /* ketchup! */
+ zend_uint finally_op;
} zend_try_catch_element;
#if SIZEOF_LONG == 8
@@ -382,6 +383,7 @@ struct _zend_execute_data {
zend_class_entry *current_called_scope;
zval *current_this;
zval *current_object;
+ zend_bool leaving;
};
#define EX(element) execute_data.element
@@ -499,7 +501,7 @@ void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC);
void zend_do_try(znode *try_token TSRMLS_DC);
void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var, znode *first_catch TSRMLS_DC);
-void zend_do_end_catch(const znode *try_token TSRMLS_DC);
+void zend_do_end_catch(znode *catch_token TSRMLS_DC);
void zend_do_throw(const znode *expr TSRMLS_DC);
ZEND_API int do_bind_function(const zend_op_array *op_array, zend_op *opline, HashTable *function_table, zend_bool compile_time);
@@ -521,10 +523,6 @@ void zend_prepare_trait_precedence(znode *result, znode *method_reference, znode
void zend_prepare_reference(znode *result, znode *class_name, znode *method_name TSRMLS_DC);
void zend_prepare_trait_alias(znode *result, znode *method_reference, znode *modifiers, znode *alias TSRMLS_DC);
-void init_trait_alias_list(znode* result, const znode* trait_alias TSRMLS_DC);
-void add_trait_alias(znode* result, const znode* trait_alias TSRMLS_DC);
-void init_trait_alias(znode* result, const znode* method_name, const znode* alias, const znode* modifiers TSRMLS_DC);
-
ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce TSRMLS_DC);
void zend_do_early_binding(TSRMLS_D);
ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array TSRMLS_DC);
@@ -669,7 +667,7 @@ void print_op_array(zend_op_array *op_array, int optimizations);
ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC);
zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array);
void zend_do_first_catch(znode *open_parentheses TSRMLS_DC);
-void zend_initialize_try_catch_element(const znode *try_token TSRMLS_DC);
+void zend_initialize_try_catch_element(znode *catch_token TSRMLS_DC);
void zend_do_mark_last_catch(const znode *first_catch, const znode *last_additional_catch TSRMLS_DC);
ZEND_API zend_bool zend_is_compiling(TSRMLS_D);
ZEND_API char *zend_make_compiled_string_description(const char *name TSRMLS_DC);
View
4 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);
View
7 Zend/zend_execute.c
@@ -555,11 +555,10 @@ static inline void make_real_object(zval **object_ptr TSRMLS_DC)
|| (Z_TYPE_PP(object_ptr) == IS_BOOL && Z_LVAL_PP(object_ptr) == 0)
|| (Z_TYPE_PP(object_ptr) == IS_STRING && Z_STRLEN_PP(object_ptr) == 0)
) {
- zend_error(E_WARNING, "Creating default object from empty value");
-
SEPARATE_ZVAL_IF_NOT_REF(object_ptr);
zval_dtor(*object_ptr);
object_init(*object_ptr);
+ zend_error(E_WARNING, "Creating default object from empty value");
}
}
@@ -1163,7 +1162,7 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container
case IS_DOUBLE:
case IS_NULL:
case IS_BOOL:
- zend_error(E_NOTICE, "String offset cast occured");
+ zend_error(E_NOTICE, "String offset cast occurred");
break;
default:
zend_error(E_WARNING, "Illegal offset type");
@@ -1286,7 +1285,7 @@ static void zend_fetch_dimension_address_read(temp_variable *result, zval **cont
case IS_NULL:
case IS_BOOL:
if (type != BP_VAR_IS) {
- zend_error(E_NOTICE, "String offset cast occured");
+ zend_error(E_NOTICE, "String offset cast occurred");
}
break;
default:
View
2 Zend/zend_hash.h
@@ -330,7 +330,7 @@ END_EXTERN_C()
if (idx-1 > LONG_MAX) { /* overflow */ \
break; \
} \
- idx = (ulong)(-(long)idx); \
+ idx = 0 - idx; \
} else if (idx > LONG_MAX) { /* overflow */ \
break; \
} \
View
2,566 Zend/zend_ini_scanner.c
1,302 additions, 1,264 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
33 Zend/zend_ini_scanner.l
@@ -347,7 +347,7 @@ DOLLAR_CURLY "${"
SECTION_RAW_CHARS [^\]\n\r]
SINGLE_QUOTED_CHARS [^']
-RAW_VALUE_CHARS [^\n\r;\000]
+RAW_VALUE_CHARS [^"\n\r;\000]
LITERAL_DOLLAR ("$"([^{\000]|("\\"{ANY_CHAR})))
VALUE_CHARS ([^$= \t\n\r;&|~()!"'\000]|{LITERAL_DOLLAR})
@@ -445,12 +445,33 @@ SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
return '=';
}
-<ST_RAW>{RAW_VALUE_CHARS}+ { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */
- /* Eat leading and trailing double quotes */
- if (yytext[0] == '"' && yytext[yyleng - 1] == '"') {
- SCNG(yy_text)++;
- yyleng = yyleng - 2;
+<ST_RAW>["] {
+ while (YYCURSOR < YYLIMIT) {
+ switch (*YYCURSOR++) {
+ case '\n':
+ SCNG(lineno)++;
+ break;
+ case '\r':
+ if (*YYCURSOR != '\n') {
+ SCNG(lineno)++;
+ }
+ break;
+ case '"':
+ yyleng = YYCURSOR - SCNG(yy_text) - 2;
+ SCNG(yy_text)++;
+ RETURN_TOKEN(TC_RAW, yytext, yyleng);
+ case '\\':
+ if (YYCURSOR < YYLIMIT) {
+ YYCURSOR++;
+ }
+ break;
+ }
}
+ yyleng = YYCURSOR - SCNG(yy_text);
+ RETURN_TOKEN(TC_RAW, yytext, yyleng);
+}
+
+<ST_RAW>{RAW_VALUE_CHARS}+ { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */
RETURN_TOKEN(TC_RAW, yytext, yyleng);
}
View
2 Zend/zend_ini_scanner_defs.h
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Sat Feb 25 22:04:14 2012 */
+/* Generated by re2c 0.13.5 on Thu Jun 7 17:55:41 2012 */
#line 3 "Zend/zend_ini_scanner_defs.h"
enum YYCONDTYPE {
View
36 Zend/zend_language_parser.y
@@ -162,6 +162,7 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
%token T_RETURN "return (T_RETURN)"
%token T_TRY "try (T_TRY)"
%token T_CATCH "catch (T_CATCH)"
+%token T_FINALLY "finally (T_FINALLY)"
%token T_THROW "throw (T_THROW)"
%token T_USE "use (T_USE)"
%token T_INSTEADOF "insteadof (T_INSTEADOF)"
@@ -317,15 +318,24 @@ unticked_statement:
| T_DECLARE { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')' declare_statement { zend_do_declare_end(&$1 TSRMLS_CC); }
| ';' /* empty statement */
| T_TRY { zend_do_try(&$1 TSRMLS_CC); } '{' inner_statement_list '}'
- T_CATCH '(' { zend_initialize_try_catch_element(&$1 TSRMLS_CC); }
- fully_qualified_class_name { zend_do_first_catch(&$7 TSRMLS_CC); }
- T_VARIABLE ')' { zend_do_begin_catch(&$1, &$9, &$11, &$7 TSRMLS_CC); }
- '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); }
- additional_catches { zend_do_mark_last_catch(&$7, &$18 TSRMLS_CC); }
+ catch_statement { zend_do_bind_catch(&$1, &$6 TSRMLS_CC); }
+ finally_statement { zend_do_end_finally(&$1, &$6, &$8 TSRMLS_CC); }
| T_THROW expr ';' { zend_do_throw(&$2 TSRMLS_CC); }
| T_GOTO T_STRING ';' { zend_do_goto(&$2 TSRMLS_CC); }
;
+catch_statement:
+ /* empty */ { $$.op_type = IS_UNUSED; }
+ | T_CATCH '(' { zend_initialize_try_catch_element(&$1 TSRMLS_CC); }
+ fully_qualified_class_name { zend_do_first_catch(&$2 TSRMLS_CC); }
+ T_VARIABLE ')' { zend_do_begin_catch(&$1, &$4, &$6, &$2 TSRMLS_CC); }
+ '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); }
+ additional_catches { zend_do_mark_last_catch(&$2, &$13 TSRMLS_CC); $$ = $1;}
+
+finally_statement:
+ /* empty */ { $$.op_type = IS_UNUSED; }
+ | T_FINALLY { zend_do_finally(&$1 TSRMLS_CC); } '{' inner_statement_list '}' { $$ = $1; }
+;
additional_catches:
non_empty_additional_catches { $$ = $1; }
@@ -337,12 +347,10 @@ non_empty_additional_catches:
| non_empty_additional_catches additional_catch { $$ = $2; }
;
-
additional_catch:
T_CATCH '(' fully_qualified_class_name { $$.u.op.opline_num = get_next_op_number(CG(active_op_array)); } T_VARIABLE ')' { zend_do_begin_catch(&$1, &$3, &$5, NULL TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); }
;
-
unset_variables:
unset_variable
| unset_variables ',' unset_variable
@@ -820,7 +828,7 @@ yield_expr:
combined_scalar_offset:
combined_scalar '[' dim_offset ']' { zend_do_begin_variable_parse(TSRMLS_C); fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
| combined_scalar_offset '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
- | T_CONSTANT_ENCAPSED_STRING '[' dim_offset ']' { zend_do_begin_variable_parse(TSRMLS_C); fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
+ | T_CONSTANT_ENCAPSED_STRING '[' dim_offset ']' { $1.EA = 0; zend_do_begin_variable_parse(TSRMLS_C); fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }