diff options
author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:35:48 -0400 |
---|---|---|
committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:35:48 -0400 |
commit | a88a88d0986a4a32288c102cdbfebd78d7e91d99 (patch) | |
tree | 96e2d12c750b8a77b35f14b88f79ab8fda4bc89c /Zend | |
parent | ba50031707469046407a35b77a3cd81351e951b3 (diff) | |
download | php-a88a88d0986a4a32288c102cdbfebd78d7e91d99.tar.gz |
Imported Upstream version 5.1.6upstream/5.1.6
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/acinclude.m4 | 4 | ||||
-rw-r--r-- | Zend/tests/abstract-static.phpt | 24 | ||||
-rw-r--r-- | Zend/tests/bug34873.phpt | 2 | ||||
-rwxr-xr-x | Zend/tests/bug36513.phpt | 22 | ||||
-rwxr-xr-x | Zend/tests/bug37046.phpt | 23 | ||||
-rwxr-xr-x | Zend/tests/bug37138.phpt | 21 | ||||
-rw-r--r-- | Zend/tests/object-null.phpt | 21 | ||||
-rw-r--r-- | Zend/zend_API.c | 36 | ||||
-rw-r--r-- | Zend/zend_alloc.c | 30 | ||||
-rw-r--r-- | Zend/zend_compile.c | 3 | ||||
-rw-r--r-- | Zend/zend_execute_API.c | 4 | ||||
-rw-r--r-- | Zend/zend_ini_parser.c | 118 | ||||
-rw-r--r-- | Zend/zend_ini_parser.output | 403 | ||||
-rw-r--r-- | Zend/zend_ini_parser.y | 15 | ||||
-rwxr-xr-x | Zend/zend_interfaces.c | 4 | ||||
-rw-r--r-- | Zend/zend_language_scanner.c | 6 | ||||
-rw-r--r-- | Zend/zend_language_scanner.l | 6 | ||||
-rw-r--r-- | Zend/zend_opcode.c | 8 | ||||
-rw-r--r-- | Zend/zend_strtod.c | 1 | ||||
-rw-r--r-- | Zend/zend_vm_def.h | 25 | ||||
-rw-r--r-- | Zend/zend_vm_execute.h | 116 |
21 files changed, 576 insertions, 316 deletions
diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4 index 8672e954b..6f2e5b716 100644 --- a/Zend/acinclude.m4 +++ b/Zend/acinclude.m4 @@ -1,10 +1,10 @@ -dnl $Id: acinclude.m4,v 1.15.2.2 2005/11/01 10:31:56 sebastian Exp $ +dnl $Id: acinclude.m4,v 1.15.2.4 2006/08/04 06:48:59 derick Exp $ dnl 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" + bison_version_list="1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3" # for standalone build of Zend Engine test -z "$SED" && SED=sed diff --git a/Zend/tests/abstract-static.phpt b/Zend/tests/abstract-static.phpt new file mode 100644 index 000000000..9db88fc4c --- /dev/null +++ b/Zend/tests/abstract-static.phpt @@ -0,0 +1,24 @@ +--TEST-- +Test for abstract static classes +--FILE-- +<?php +abstract class ezcDbHandler extends PDO +{ + public function __construct( $dbParams, $dsn ) + { + $user = null; + $pass = null; + $driverOptions = null; + } + + abstract static public function getName(); + + static public function hasFeature( $feature ) + { + return false; + } +} +?> +DONE +--EXPECT-- +DONE diff --git a/Zend/tests/bug34873.phpt b/Zend/tests/bug34873.phpt index d8683c991..7d9eb78ab 100644 --- a/Zend/tests/bug34873.phpt +++ b/Zend/tests/bug34873.phpt @@ -1,5 +1,5 @@ --TEST-- -bug #34873 (Segmentation Fault on foreach in object) +Bug #34873 (Segmentation Fault on foreach in object) --FILE-- <?php class pwa { diff --git a/Zend/tests/bug36513.phpt b/Zend/tests/bug36513.phpt new file mode 100755 index 000000000..2c8ca8450 --- /dev/null +++ b/Zend/tests/bug36513.phpt @@ -0,0 +1,22 @@ +--TEST--
+Bug #36513 (comment will be outputed in last line)
+--FILE--
+<?php
+function test($s) {
+ echo "'".trim(str_replace(" ", " ", htmlspecialchars_decode(strip_tags(highlight_string($s,1)))))."'\n";
+}
+
+eval('echo "1";//2');
+eval('echo 3; //{ 4?>5');
+echo "\n";
+
+//test('<?php echo "1";//');
+test('<?php echo "1";//2');
+test('<?php echo "1";//22');
+test('<?php echo 3; // 4 ?>5');
+?>
+--EXPECT--
+135
+'<?php echo "1";//2'
+'<?php echo "1";//22'
+'<?php echo 3; // 4 ?>5'
diff --git a/Zend/tests/bug37046.phpt b/Zend/tests/bug37046.phpt new file mode 100755 index 000000000..8049944ff --- /dev/null +++ b/Zend/tests/bug37046.phpt @@ -0,0 +1,23 @@ +--TEST--
+Bug #37046 (foreach breaks static scope)
+--FILE--
+<?php
+function s() {
+ static $storage = array(array('x', 'y'));
+ return $storage[0];
+}
+
+foreach (s() as $k => $function) {
+ echo "op1 $k\n";
+ if ($k == 0) {
+ foreach (s() as $k => $function) {
+ echo "op2 $k\n";
+ }
+ }
+}
+?>
+--EXPECT--
+op1 0
+op2 0
+op2 1
+op1 1
diff --git a/Zend/tests/bug37138.phpt b/Zend/tests/bug37138.phpt new file mode 100755 index 000000000..f8503f8da --- /dev/null +++ b/Zend/tests/bug37138.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #37138 (__autoload tries to load callback'ed self and parent) +--FILE-- +<?php +function __autoload ($CN) {var_dump ($CN);} +class st { + public static function e () {echo ("EHLO\n");} + public static function e2 () {call_user_func (array ('self', 'e'));} +} +class stch extends st { + public static function g () {call_user_func (array ('parent', 'e'));} +} +st::e (); +st::e2 (); +stch::g (); +?> +--EXPECT-- +EHLO +EHLO +EHLO + diff --git a/Zend/tests/object-null.phpt b/Zend/tests/object-null.phpt new file mode 100644 index 000000000..650178c34 --- /dev/null +++ b/Zend/tests/object-null.phpt @@ -0,0 +1,21 @@ +--TEST-- +Test whether an object is NULL or not. +--FILE-- +<?php + +class Bla +{ +} + +$b = new Bla; + +var_dump($b != null); +var_dump($b == null); +var_dump($b !== null); +var_dump($b === null); +?> +--EXPECT-- +bool(true) +bool(false) +bool(true) +bool(false) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index ece2ede82..a2c8c0031 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.c,v 1.296.2.26 2006/03/23 13:14:55 helly Exp $ */ +/* $Id: zend_API.c,v 1.296.2.27 2006/04/20 07:30:38 dmitry Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -2039,18 +2039,16 @@ static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, ze if ((colon = strstr(Z_STRVAL_P(callable), "::")) != NULL) { clen = colon - Z_STRVAL_P(callable); mlen = Z_STRLEN_P(callable) - clen - 2; - if (zend_lookup_class(Z_STRVAL_P(callable), clen, &pce TSRMLS_CC) == SUCCESS) { + lcname = zend_str_tolower_dup(Z_STRVAL_P(callable), clen); + /* caution: lcname is not '\0' terminated */ + if (clen == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self") - 1) == 0) { + *ce_ptr = EG(scope); + } else if (clen == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) { + *ce_ptr = EG(scope) ? EG(scope)->parent : NULL; + } else if (zend_lookup_class(Z_STRVAL_P(callable), clen, &pce TSRMLS_CC) == SUCCESS) { *ce_ptr = *pce; - } else { - lcname = zend_str_tolower_dup(Z_STRVAL_P(callable), clen); - /* caution: lcname is not '\0' terminated */ - if (clen == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self") - 1) == 0) { - *ce_ptr = EG(scope); - } else if (clen == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) { - *ce_ptr = EG(scope) ? EG(scope)->parent : NULL; - } - efree(lcname); } + efree(lcname); if (!*ce_ptr) { return 0; } @@ -2179,17 +2177,15 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char ** return 1; } - if (zend_lookup_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) { + lcname = zend_str_tolower_dup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj)); + if (Z_STRLEN_PP(obj) == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self")) == 0) { + ce = EG(active_op_array)->scope; + } else if (Z_STRLEN_PP(obj) == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent")) == 0 && EG(active_op_array)->scope) { + ce = EG(active_op_array)->scope->parent; + } else if (zend_lookup_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) { ce = *pce; - } else if (EG(active_op_array)) { - lcname = zend_str_tolower_dup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj)); - if (Z_STRLEN_PP(obj) == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self")) == 0) { - ce = EG(active_op_array)->scope; - } else if (Z_STRLEN_PP(obj) == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent")) == 0 && EG(active_op_array)->scope) { - ce = EG(active_op_array)->scope->parent; - } - efree(lcname); } + efree(lcname); } else { ce = Z_OBJCE_PP(obj); /* TBFixed: what if it's overloaded? */ diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index e50b96f9a..a63d00e97 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_alloc.c,v 1.144.2.3 2006/01/04 23:53:03 andi Exp $ */ +/* $Id: zend_alloc.c,v 1.144.2.4 2006/08/10 17:16:24 iliaa Exp $ */ #include "zend.h" #include "zend_alloc.h" @@ -72,7 +72,15 @@ static long mem_block_end_magic = MEM_BLOCK_END_MAGIC; #define CHECK_MEMORY_LIMIT(s, rs) _CHECK_MEMORY_LIMIT(s, rs, NULL, 0) # endif -#define _CHECK_MEMORY_LIMIT(s, rs, file, lineno) { AG(allocated_memory) += rs;\ +#define _CHECK_MEMORY_LIMIT(s, rs, file, lineno) { if ((ssize_t)(rs) > (ssize_t)(INT_MAX - AG(allocated_memory))) { \ + if (file) { \ + fprintf(stderr, "Integer overflow in memory_limit check detected at %s:%d\n", file, lineno); \ + } else { \ + fprintf(stderr, "Integer overflow in memory_limit check detected\n"); \ + } \ + exit(1); \ + } \ + AG(allocated_memory) += rs;\ if (AG(memory_limit)<AG(allocated_memory)) {\ int php_mem_limit = AG(memory_limit); \ AG(allocated_memory) -= rs; \ @@ -127,7 +135,7 @@ static long mem_block_end_magic = MEM_BLOCK_END_MAGIC; #endif #define DECLARE_CACHE_VARS() \ - unsigned int real_size; \ + size_t real_size; \ unsigned int cache_index #define REAL_SIZE(size) ((size+7) & ~0x7) @@ -142,12 +150,16 @@ static long mem_block_end_magic = MEM_BLOCK_END_MAGIC; ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) { - zend_mem_header *p; + zend_mem_header *p = NULL; DECLARE_CACHE_VARS(); TSRMLS_FETCH(); CALCULATE_REAL_SIZE_AND_CACHE_INDEX(size); + if (size > INT_MAX || SIZE < size) { + goto emalloc_error; + } + #if !ZEND_DISABLE_MEMORY_CACHE if ((CACHE_INDEX < MAX_CACHED_MEMORY) && (AG(cache_count)[CACHE_INDEX] > 0)) { p = AG(cache)[CACHE_INDEX][--AG(cache_count)[CACHE_INDEX]]; @@ -184,6 +196,8 @@ ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) } #endif +emalloc_error: + HANDLE_BLOCK_INTERRUPTIONS(); if (!p) { @@ -357,6 +371,13 @@ ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LIN CALCULATE_REAL_SIZE_AND_CACHE_INDEX(size); HANDLE_BLOCK_INTERRUPTIONS(); + + if (size > INT_MAX || SIZE < size) { + REMOVE_POINTER_FROM_LIST(p); + p = NULL; + goto erealloc_error; + } + #if MEMORY_LIMIT CHECK_MEMORY_LIMIT(size - p->size, SIZE - REAL_SIZE(p->size)); if (AG(allocated_memory) > AG(allocated_memory_peak)) { @@ -365,6 +386,7 @@ ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LIN #endif REMOVE_POINTER_FROM_LIST(p); p = (zend_mem_header *) ZEND_DO_REALLOC(p, sizeof(zend_mem_header)+MEM_HEADER_PADDING+SIZE+END_MAGIC_SIZE); +erealloc_error: if (!p) { if (!allow_failure) { fprintf(stderr,"FATAL: erealloc(): Unable to allocate %ld bytes\n", (long) size); diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 52382c2d1..73c66c511 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.647.2.25 2006/03/27 08:09:18 dmitry Exp $ */ +/* $Id: zend_compile.c,v 1.647.2.27 2006/05/02 15:49:26 dmitry Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -154,6 +154,7 @@ void zend_init_compiler_data_structures(TSRMLS_D) void init_compiler(TSRMLS_D) { + CG(active_op_array) = NULL; zend_init_compiler_data_structures(TSRMLS_C); zend_init_rsrc_list(TSRMLS_C); zend_hash_init(&CG(filenames_table), 5, NULL, (dtor_func_t) free_estring, 0); diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index b3e54cf18..fac0b3f1b 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.331.2.19 2006/03/17 08:47:41 dmitry Exp $ */ +/* $Id: zend_execute_API.c,v 1.331.2.20 2006/04/20 22:49:20 tony2001 Exp $ */ #include <stdio.h> #include <signal.h> @@ -819,7 +819,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS if (EX(function_state).function->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) { if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) { - zend_error_noreturn(E_ERROR, "Cannot call abstract method %v::%v()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name); + zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name); } if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) { zend_error(E_STRICT, "Function %s%s%s() is deprecated", diff --git a/Zend/zend_ini_parser.c b/Zend/zend_ini_parser.c index d8b56479e..00cc274fa 100644 --- a/Zend/zend_ini_parser.c +++ b/Zend/zend_ini_parser.c @@ -116,7 +116,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ini_parser.y,v 1.41.2.1 2006/01/04 23:53:04 andi Exp $ */ +/* $Id: zend_ini_parser.y,v 1.41.2.2 2006/04/12 09:51:54 dmitry Exp $ */ #define DEBUG_CFG_PARSER 0 #include "zend.h" @@ -549,16 +549,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 43 +#define YYLAST 41 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 19 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 8 /* YYNRULES -- Number of rules. */ -#define YYNRULES 26 +#define YYNRULES 27 /* YYNRULES -- Number of states. */ -#define YYNSTATES 36 +#define YYNSTATES 38 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -605,8 +605,8 @@ static const yytype_uint8 yytranslate[] = static const yytype_uint8 yyprhs[] = { 0, 0, 3, 6, 7, 11, 16, 18, 20, 22, - 24, 26, 28, 30, 32, 33, 36, 39, 42, 43, - 47, 49, 53, 57, 60, 63, 67 + 24, 26, 28, 30, 31, 33, 35, 37, 40, 43, + 46, 50, 52, 56, 60, 63, 66, 70 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ @@ -614,19 +614,20 @@ static const yytype_int8 yyrhs[] = { 20, 0, -1, 20, 21, -1, -1, 3, 14, 22, -1, 3, 5, 14, 22, -1, 3, -1, 6, -1, - 15, -1, 25, -1, 7, -1, 8, -1, 23, -1, - 15, -1, -1, 23, 24, -1, 23, 4, -1, 23, - 26, -1, -1, 9, 3, 16, -1, 26, -1, 25, - 10, 25, -1, 25, 11, 25, -1, 12, 25, -1, - 13, 25, -1, 17, 25, 18, -1, 3, -1 + 15, -1, 25, -1, 7, -1, 8, -1, 15, -1, + -1, 24, -1, 4, -1, 26, -1, 23, 24, -1, + 23, 4, -1, 23, 26, -1, 9, 3, 16, -1, + 23, -1, 25, 10, 25, -1, 25, 11, 25, -1, + 12, 25, -1, 13, 25, -1, 17, 25, 18, -1, + 3, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 221, 221, 222, 226, 234, 242, 243, 244, 249, - 250, 251, 252, 253, 254, 259, 260, 261, 262, 266, - 270, 271, 272, 273, 274, 275, 279 + 250, 251, 252, 253, 258, 259, 260, 261, 262, 263, + 267, 271, 272, 273, 274, 275, 276, 280 }; #endif @@ -657,16 +658,16 @@ static const yytype_uint16 yytoknum[] = static const yytype_uint8 yyr1[] = { 0, 19, 20, 20, 21, 21, 21, 21, 21, 22, - 22, 22, 22, 22, 22, 23, 23, 23, 23, 24, - 25, 25, 25, 25, 25, 25, 26 + 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, + 24, 25, 25, 25, 25, 25, 25, 26 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 2, 0, 3, 4, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 2, 2, 2, 0, 3, - 1, 3, 3, 2, 2, 3, 1 + 1, 1, 1, 0, 1, 1, 1, 2, 2, 2, + 3, 1, 3, 3, 2, 2, 3, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -674,56 +675,56 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 3, 0, 1, 6, 7, 8, 2, 0, 14, 14, - 26, 10, 11, 0, 0, 13, 0, 4, 12, 9, - 20, 5, 23, 24, 0, 16, 0, 15, 17, 0, - 0, 25, 0, 21, 22, 19 + 3, 0, 1, 6, 7, 8, 2, 0, 13, 13, + 27, 15, 10, 11, 0, 0, 0, 12, 0, 4, + 21, 14, 9, 16, 5, 0, 24, 25, 0, 18, + 17, 19, 0, 0, 20, 26, 22, 23 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 1, 6, 17, 18, 27, 19, 20 + -1, 1, 6, 19, 20, 21, 22, 23 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -14 +#define YYPACT_NINF -16 static const yytype_int8 yypact[] = { - -14, 4, -14, -3, -14, -14, -14, -2, 17, 17, - -14, -14, -14, 10, 10, -14, 10, -14, 5, -5, - -14, -14, -14, -14, 25, -14, 12, -14, -14, 10, - 10, -14, 2, -14, -14, -14 + -16, 4, -16, -3, -16, -16, -16, -2, 17, 17, + -16, -16, -16, -16, 13, 24, 24, -16, 24, -16, + 5, -16, 12, -16, -16, -1, -16, -16, -5, -16, + -16, -16, 24, 24, -16, -16, -16, -16 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -14, -14, -14, 19, -14, -14, -13, 13 + -16, -16, -16, 22, -16, 15, -15, 18 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -19 -static const yytype_int8 yytable[] = +#define YYTABLE_NINF -1 +static const yytype_uint8 yytable[] = { - 22, 23, 7, 24, 2, 29, 30, 3, 10, 25, - 4, 8, 9, 10, 26, 32, 33, 34, 35, 5, - 10, -18, 13, 14, 11, 12, -18, 16, 21, 13, - 14, 28, 15, 0, 16, 29, 30, 0, 0, 0, - 0, 0, 0, 31 + 26, 27, 7, 28, 2, 32, 33, 3, 10, 29, + 4, 8, 9, 35, 14, 34, 25, 36, 37, 5, + 10, 11, 32, 33, 12, 13, 14, 10, 11, 15, + 16, 24, 17, 14, 18, 30, 15, 16, 31, 0, + 0, 18 }; static const yytype_int8 yycheck[] = { - 13, 14, 5, 16, 0, 10, 11, 3, 3, 4, - 6, 14, 14, 3, 9, 3, 29, 30, 16, 15, - 3, 4, 12, 13, 7, 8, 9, 17, 9, 12, - 13, 18, 15, -1, 17, 10, 11, -1, -1, -1, - -1, -1, -1, 18 + 15, 16, 5, 18, 0, 10, 11, 3, 3, 4, + 6, 14, 14, 18, 9, 16, 3, 32, 33, 15, + 3, 4, 10, 11, 7, 8, 9, 3, 4, 12, + 13, 9, 15, 9, 17, 20, 12, 13, 20, -1, + -1, 17 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -731,9 +732,9 @@ static const yytype_int8 yycheck[] = static const yytype_uint8 yystos[] = { 0, 20, 0, 3, 6, 15, 21, 5, 14, 14, - 3, 7, 8, 12, 13, 15, 17, 22, 23, 25, - 26, 22, 25, 25, 25, 4, 9, 24, 26, 10, - 11, 18, 3, 25, 25, 16 + 3, 4, 7, 8, 9, 12, 13, 15, 17, 22, + 23, 24, 25, 26, 22, 3, 25, 25, 25, 4, + 24, 26, 10, 11, 16, 18, 25, 25 }; #define yyerrok (yyerrstatus = 0) @@ -1598,7 +1599,7 @@ yyreduce: case 12: - { (yyval) = (yyvsp[(1) - (1)]); } + { zend_ini_init_string(&(yyval)); } break; case 13: @@ -1608,66 +1609,71 @@ yyreduce: case 14: - { zend_ini_init_string(&(yyval)); } + { (yyval) = (yyvsp[(1) - (1)]); } break; case 15: - { zend_ini_add_string(&(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)])); free((yyvsp[(2) - (2)]).value.str.val); } + { (yyval) = (yyvsp[(1) - (1)]); } break; case 16: - { zend_ini_add_string(&(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)])); free((yyvsp[(2) - (2)]).value.str.val); } + { (yyval) = (yyvsp[(1) - (1)]); } break; case 17: - { zend_ini_add_string(&(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)])); } + { zend_ini_add_string(&(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)])); free((yyvsp[(2) - (2)]).value.str.val); } break; case 18: - { zend_ini_init_string(&(yyval)); } + { zend_ini_add_string(&(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)])); free((yyvsp[(2) - (2)]).value.str.val); } break; case 19: - { zend_ini_get_var(&(yyval), &(yyvsp[(2) - (3)])); } + { zend_ini_add_string(&(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)])); free((yyvsp[(2) - (2)]).value.str.val); } break; case 20: - { (yyval) = (yyvsp[(1) - (1)]); } + { zend_ini_get_var(&(yyval), &(yyvsp[(2) - (3)])); free((yyvsp[(2) - (3)]).value.str.val); } break; case 21: - { zend_ini_do_op('|', &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)])); } + { (yyval) = (yyvsp[(1) - (1)]); } break; case 22: - { zend_ini_do_op('&', &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)])); } + { zend_ini_do_op('|', &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)])); } break; case 23: - { zend_ini_do_op('~', &(yyval), &(yyvsp[(2) - (2)]), NULL); } + { zend_ini_do_op('&', &(yyval), &(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)])); } break; case 24: - { zend_ini_do_op('!', &(yyval), &(yyvsp[(2) - (2)]), NULL); } + { zend_ini_do_op('~', &(yyval), &(yyvsp[(2) - (2)]), NULL); } break; case 25: - { (yyval) = (yyvsp[(2) - (3)]); } + { zend_ini_do_op('!', &(yyval), &(yyvsp[(2) - (2)]), NULL); } break; case 26: + { (yyval) = (yyvsp[(2) - (3)]); } + break; + + case 27: + { zend_ini_get_constant(&(yyval), &(yyvsp[(1) - (1)])); } break; diff --git a/Zend/zend_ini_parser.output b/Zend/zend_ini_parser.output index 9dc241c0f..74b682733 100644 --- a/Zend/zend_ini_parser.output +++ b/Zend/zend_ini_parser.output @@ -1,6 +1,6 @@ -State 8 conflicts: 2 shift/reduce, 4 reduce/reduce -State 9 conflicts: 2 shift/reduce, 4 reduce/reduce -State 18 conflicts: 1 shift/reduce +State 8 conflicts: 2 shift/reduce +State 9 conflicts: 2 shift/reduce +State 20 conflicts: 1 shift/reduce Grammar @@ -19,47 +19,48 @@ Grammar 8 string_or_value: expr 9 | CFG_TRUE 10 | CFG_FALSE - 11 | var_string_list - 12 | '\n' - 13 | /* empty */ + 11 | '\n' + 12 | /* empty */ - 14 var_string_list: var_string_list cfg_var_ref - 15 | var_string_list TC_ENCAPSULATED_STRING - 16 | var_string_list constant_string - 17 | /* empty */ + 13 var_string_list: cfg_var_ref + 14 | TC_ENCAPSULATED_STRING + 15 | constant_string + 16 | var_string_list cfg_var_ref + 17 | var_string_list TC_ENCAPSULATED_STRING + 18 | var_string_list constant_string - 18 cfg_var_ref: TC_DOLLAR_CURLY TC_STRING '}' + 19 cfg_var_ref: TC_DOLLAR_CURLY TC_STRING '}' - 19 expr: constant_string - 20 | expr '|' expr - 21 | expr '&' expr - 22 | '~' expr - 23 | '!' expr - 24 | '(' expr ')' + 20 expr: var_string_list + 21 | expr '|' expr + 22 | expr '&' expr + 23 | '~' expr + 24 | '!' expr + 25 | '(' expr ')' - 25 constant_string: TC_STRING + 26 constant_string: TC_STRING Terminals, with rules where they appear $end (0) 0 -'\n' (10) 7 12 -'!' (33) 23 -'&' (38) 21 -'(' (40) 24 -')' (41) 24 +'\n' (10) 7 11 +'!' (33) 24 +'&' (38) 22 +'(' (40) 25 +')' (41) 25 '=' (61) 3 4 -'|' (124) 20 -'}' (125) 18 -'~' (126) 22 +'|' (124) 21 +'}' (125) 19 +'~' (126) 23 error (256) -TC_STRING (258) 3 4 5 18 25 -TC_ENCAPSULATED_STRING (259) 15 +TC_STRING (258) 3 4 5 19 26 +TC_ENCAPSULATED_STRING (259) 14 17 BRACK (260) 4 SECTION (261) 6 CFG_TRUE (262) 9 CFG_FALSE (263) 10 -TC_DOLLAR_CURLY (264) 18 +TC_DOLLAR_CURLY (264) 19 Nonterminals, with rules where they appear @@ -71,15 +72,15 @@ statement_list (20) statement (21) on left: 3 4 5 6 7, on right: 1 string_or_value (22) - on left: 8 9 10 11 12 13, on right: 3 4 + on left: 8 9 10 11 12, on right: 3 4 var_string_list (23) - on left: 14 15 16 17, on right: 11 14 15 16 + on left: 13 14 15 16 17 18, on right: 16 17 18 20 cfg_var_ref (24) - on left: 18, on right: 14 + on left: 19, on right: 13 16 expr (25) - on left: 19 20 21 22 23 24, on right: 8 20 21 22 23 24 + on left: 20 21 22 23 24 25, on right: 8 21 22 23 24 25 constant_string (26) - on left: 25, on right: 16 19 + on left: 26, on right: 15 18 state 0 @@ -155,297 +156,321 @@ state 8 3 statement: TC_STRING '=' . string_or_value - TC_STRING shift, and go to state 10 - CFG_TRUE shift, and go to state 11 - CFG_FALSE shift, and go to state 12 - '~' shift, and go to state 13 - '!' shift, and go to state 14 - '\n' shift, and go to state 15 - '(' shift, and go to state 16 - - $end reduce using rule 13 (string_or_value) - $end [reduce using rule 17 (var_string_list)] - TC_STRING [reduce using rule 13 (string_or_value)] - TC_STRING [reduce using rule 17 (var_string_list)] - TC_ENCAPSULATED_STRING reduce using rule 17 (var_string_list) - SECTION reduce using rule 13 (string_or_value) - SECTION [reduce using rule 17 (var_string_list)] - TC_DOLLAR_CURLY reduce using rule 17 (var_string_list) - '\n' [reduce using rule 13 (string_or_value)] - '\n' [reduce using rule 17 (var_string_list)] - $default reduce using rule 13 (string_or_value) - - string_or_value go to state 17 - var_string_list go to state 18 - expr go to state 19 - constant_string go to state 20 + TC_STRING shift, and go to state 10 + TC_ENCAPSULATED_STRING shift, and go to state 11 + CFG_TRUE shift, and go to state 12 + CFG_FALSE shift, and go to state 13 + TC_DOLLAR_CURLY shift, and go to state 14 + '~' shift, and go to state 15 + '!' shift, and go to state 16 + '\n' shift, and go to state 17 + '(' shift, and go to state 18 + + TC_STRING [reduce using rule 12 (string_or_value)] + '\n' [reduce using rule 12 (string_or_value)] + $default reduce using rule 12 (string_or_value) + + string_or_value go to state 19 + var_string_list go to state 20 + cfg_var_ref go to state 21 + expr go to state 22 + constant_string go to state 23 state 9 4 statement: TC_STRING BRACK '=' . string_or_value - TC_STRING shift, and go to state 10 - CFG_TRUE shift, and go to state 11 - CFG_FALSE shift, and go to state 12 - '~' shift, and go to state 13 - '!' shift, and go to state 14 - '\n' shift, and go to state 15 - '(' shift, and go to state 16 - - $end reduce using rule 13 (string_or_value) - $end [reduce using rule 17 (var_string_list)] - TC_STRING [reduce using rule 13 (string_or_value)] - TC_STRING [reduce using rule 17 (var_string_list)] - TC_ENCAPSULATED_STRING reduce using rule 17 (var_string_list) - SECTION reduce using rule 13 (string_or_value) - SECTION [reduce using rule 17 (var_string_list)] - TC_DOLLAR_CURLY reduce using rule 17 (var_string_list) - '\n' [reduce using rule 13 (string_or_value)] - '\n' [reduce using rule 17 (var_string_list)] - $default reduce using rule 13 (string_or_value) - - string_or_value go to state 21 - var_string_list go to state 18 - expr go to state 19 - constant_string go to state 20 + TC_STRING shift, and go to state 10 + TC_ENCAPSULATED_STRING shift, and go to state 11 + CFG_TRUE shift, and go to state 12 + CFG_FALSE shift, and go to state 13 + TC_DOLLAR_CURLY shift, and go to state 14 + '~' shift, and go to state 15 + '!' shift, and go to state 16 + '\n' shift, and go to state 17 + '(' shift, and go to state 18 + + TC_STRING [reduce using rule 12 (string_or_value)] + '\n' [reduce using rule 12 (string_or_value)] + $default reduce using rule 12 (string_or_value) + + string_or_value go to state 24 + var_string_list go to state 20 + cfg_var_ref go to state 21 + expr go to state 22 + constant_string go to state 23 state 10 - 25 constant_string: TC_STRING . + 26 constant_string: TC_STRING . - $default reduce using rule 25 (constant_string) + $default reduce using rule 26 (constant_string) state 11 - 9 string_or_value: CFG_TRUE . + 14 var_string_list: TC_ENCAPSULATED_STRING . - $default reduce using rule 9 (string_or_value) + $default reduce using rule 14 (var_string_list) state 12 - 10 string_or_value: CFG_FALSE . + 9 string_or_value: CFG_TRUE . - $default reduce using rule 10 (string_or_value) + $default reduce using rule 9 (string_or_value) state 13 - 22 expr: '~' . expr - - TC_STRING shift, and go to state 10 - '~' shift, and go to state 13 - '!' shift, and go to state 14 - '(' shift, and go to state 16 + 10 string_or_value: CFG_FALSE . - expr go to state 22 - constant_string go to state 20 + $default reduce using rule 10 (string_or_value) state 14 - 23 expr: '!' . expr - - TC_STRING shift, and go to state 10 - '~' shift, and go to state 13 - '!' shift, and go to state 14 - '(' shift, and go to state 16 + 19 cfg_var_ref: TC_DOLLAR_CURLY . TC_STRING '}' - expr go to state 23 - constant_string go to state 20 + TC_STRING shift, and go to state 25 state 15 - 12 string_or_value: '\n' . + 23 expr: '~' . expr - $default reduce using rule 12 (string_or_value) + TC_STRING shift, and go to state 10 + TC_ENCAPSULATED_STRING shift, and go to state 11 + TC_DOLLAR_CURLY shift, and go to state 14 + '~' shift, and go to state 15 + '!' shift, and go to state 16 + '(' shift, and go to state 18 + + var_string_list go to state 20 + cfg_var_ref go to state 21 + expr go to state 26 + constant_string go to state 23 state 16 - 24 expr: '(' . expr ')' + 24 expr: '!' . expr - TC_STRING shift, and go to state 10 - '~' shift, and go to state 13 - '!' shift, and go to state 14 - '(' shift, and go to state 16 + TC_STRING shift, and go to state 10 + TC_ENCAPSULATED_STRING shift, and go to state 11 + TC_DOLLAR_CURLY shift, and go to state 14 + '~' shift, and go to state 15 + '!' shift, and go to state 16 + '(' shift, and go to state 18 - expr go to state 24 - constant_string go to state 20 + var_string_list go to state 20 + cfg_var_ref go to state 21 + expr go to state 27 + constant_string go to state 23 state 17 - 3 statement: TC_STRING '=' string_or_value . + 11 string_or_value: '\n' . - $default reduce using rule 3 (statement) + $default reduce using rule 11 (string_or_value) state 18 - 11 string_or_value: var_string_list . - 14 var_string_list: var_string_list . cfg_var_ref - 15 | var_string_list . TC_ENCAPSULATED_STRING - 16 | var_string_list . constant_string + 25 expr: '(' . expr ')' TC_STRING shift, and go to state 10 - TC_ENCAPSULATED_STRING shift, and go to state 25 - TC_DOLLAR_CURLY shift, and go to state 26 - - TC_STRING [reduce using rule 11 (string_or_value)] - $default reduce using rule 11 (string_or_value) + TC_ENCAPSULATED_STRING shift, and go to state 11 + TC_DOLLAR_CURLY shift, and go to state 14 + '~' shift, and go to state 15 + '!' shift, and go to state 16 + '(' shift, and go to state 18 - cfg_var_ref go to state 27 - constant_string go to state 28 + var_string_list go to state 20 + cfg_var_ref go to state 21 + expr go to state 28 + constant_string go to state 23 state 19 - 8 string_or_value: expr . - 20 expr: expr . '|' expr - 21 | expr . '&' expr - - '|' shift, and go to state 29 - '&' shift, and go to state 30 + 3 statement: TC_STRING '=' string_or_value . - $default reduce using rule 8 (string_or_value) + $default reduce using rule 3 (statement) state 20 - 19 expr: constant_string . + 16 var_string_list: var_string_list . cfg_var_ref + 17 | var_string_list . TC_ENCAPSULATED_STRING + 18 | var_string_list . constant_string + 20 expr: var_string_list . + + TC_STRING shift, and go to state 10 + TC_ENCAPSULATED_STRING shift, and go to state 29 + TC_DOLLAR_CURLY shift, and go to state 14 + + TC_STRING [reduce using rule 20 (expr)] + $default reduce using rule 20 (expr) - $default reduce using rule 19 (expr) + cfg_var_ref go to state 30 + constant_string go to state 31 state 21 - 4 statement: TC_STRING BRACK '=' string_or_value . + 13 var_string_list: cfg_var_ref . - $default reduce using rule 4 (statement) + $default reduce using rule 13 (var_string_list) state 22 - 20 expr: expr . '|' expr - 21 | expr . '&' expr - 22 | '~' expr . + 8 string_or_value: expr . + 21 expr: expr . '|' expr + 22 | expr . '&' expr - $default reduce using rule 22 (expr) + '|' shift, and go to state 32 + '&' shift, and go to state 33 + + $default reduce using rule 8 (string_or_value) state 23 - 20 expr: expr . '|' expr - 21 | expr . '&' expr - 23 | '!' expr . + 15 var_string_list: constant_string . - $default reduce using rule 23 (expr) + $default reduce using rule 15 (var_string_list) state 24 - 20 expr: expr . '|' expr - 21 | expr . '&' expr - 24 | '(' expr . ')' + 4 statement: TC_STRING BRACK '=' string_or_value . - '|' shift, and go to state 29 - '&' shift, and go to state 30 - ')' shift, and go to state 31 + $default reduce using rule 4 (statement) state 25 - 15 var_string_list: var_string_list TC_ENCAPSULATED_STRING . + 19 cfg_var_ref: TC_DOLLAR_CURLY TC_STRING . '}' - $default reduce using rule 15 (var_string_list) + '}' shift, and go to state 34 state 26 - 18 cfg_var_ref: TC_DOLLAR_CURLY . TC_STRING '}' + 21 expr: expr . '|' expr + 22 | expr . '&' expr + 23 | '~' expr . - TC_STRING shift, and go to state 32 + $default reduce using rule 23 (expr) state 27 - 14 var_string_list: var_string_list cfg_var_ref . + 21 expr: expr . '|' expr + 22 | expr . '&' expr + 24 | '!' expr . - $default reduce using rule 14 (var_string_list) + $default reduce using rule 24 (expr) state 28 - 16 var_string_list: var_string_list constant_string . + 21 expr: expr . '|' expr + 22 | expr . '&' expr + 25 | '(' expr . ')' - $default reduce using rule 16 (var_string_list) + '|' shift, and go to state 32 + '&' shift, and go to state 33 + ')' shift, and go to state 35 state 29 - 20 expr: expr '|' . expr - - TC_STRING shift, and go to state 10 - '~' shift, and go to state 13 - '!' shift, and go to state 14 - '(' shift, and go to state 16 + 17 var_string_list: var_string_list TC_ENCAPSULATED_STRING . - expr go to state 33 - constant_string go to state 20 + $default reduce using rule 17 (var_string_list) state 30 - 21 expr: expr '&' . expr + 16 var_string_list: var_string_list cfg_var_ref . - TC_STRING shift, and go to state 10 - '~' shift, and go to state 13 - '!' shift, and go to state 14 - '(' shift, and go to state 16 - - expr go to state 34 - constant_string go to state 20 + $default reduce using rule 16 (var_string_list) state 31 - 24 expr: '(' expr ')' . + 18 var_string_list: var_string_list constant_string . - $default reduce using rule 24 (expr) + $default reduce using rule 18 (var_string_list) state 32 - 18 cfg_var_ref: TC_DOLLAR_CURLY TC_STRING . '}' + 21 expr: expr '|' . expr + + TC_STRING shift, and go to state 10 + TC_ENCAPSULATED_STRING shift, and go to state 11 + TC_DOLLAR_CURLY shift, and go to state 14 + '~' shift, and go to state 15 + '!' shift, and go to state 16 + '(' shift, and go to state 18 - '}' shift, and go to state 35 + var_string_list go to state 20 + cfg_var_ref go to state 21 + expr go to state 36 + constant_string go to state 23 state 33 - 20 expr: expr . '|' expr - 20 | expr '|' expr . - 21 | expr . '&' expr + 22 expr: expr '&' . expr + + TC_STRING shift, and go to state 10 + TC_ENCAPSULATED_STRING shift, and go to state 11 + TC_DOLLAR_CURLY shift, and go to state 14 + '~' shift, and go to state 15 + '!' shift, and go to state 16 + '(' shift, and go to state 18 - $default reduce using rule 20 (expr) + var_string_list go to state 20 + cfg_var_ref go to state 21 + expr go to state 37 + constant_string go to state 23 state 34 - 20 expr: expr . '|' expr - 21 | expr . '&' expr - 21 | expr '&' expr . + 19 cfg_var_ref: TC_DOLLAR_CURLY TC_STRING '}' . - $default reduce using rule 21 (expr) + $default reduce using rule 19 (cfg_var_ref) state 35 - 18 cfg_var_ref: TC_DOLLAR_CURLY TC_STRING '}' . + 25 expr: '(' expr ')' . + + $default reduce using rule 25 (expr) + - $default reduce using rule 18 (cfg_var_ref) +state 36 + + 21 expr: expr . '|' expr + 21 | expr '|' expr . + 22 | expr . '&' expr + + $default reduce using rule 21 (expr) + + +state 37 + + 21 expr: expr . '|' expr + 22 | expr . '&' expr + 22 | expr '&' expr . + + $default reduce using rule 22 (expr) diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y index a12b59387..6341c4812 100644 --- a/Zend/zend_ini_parser.y +++ b/Zend/zend_ini_parser.y @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ini_parser.y,v 1.41.2.1 2006/01/04 23:53:04 andi Exp $ */ +/* $Id: zend_ini_parser.y,v 1.41.2.2 2006/04/12 09:51:54 dmitry Exp $ */ #define DEBUG_CFG_PARSER 0 #include "zend.h" @@ -249,25 +249,26 @@ string_or_value: expr { $$ = $1; } | CFG_TRUE { $$ = $1; } | CFG_FALSE { $$ = $1; } - | var_string_list { $$ = $1; } | '\n' { zend_ini_init_string(&$$); } | /* empty */ { zend_ini_init_string(&$$); } ; var_string_list: - var_string_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); } + cfg_var_ref { $$ = $1; } + | TC_ENCAPSULATED_STRING { $$ = $1; } + | constant_string { $$ = $1; } + | var_string_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); } | var_string_list TC_ENCAPSULATED_STRING { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); } - | var_string_list constant_string { zend_ini_add_string(&$$, &$1, &$2); } - | /* empty */ { zend_ini_init_string(&$$); } + | var_string_list constant_string { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); } ; cfg_var_ref: - TC_DOLLAR_CURLY TC_STRING '}' { zend_ini_get_var(&$$, &$2); } + TC_DOLLAR_CURLY TC_STRING '}' { zend_ini_get_var(&$$, &$2); free($2.value.str.val); } ; expr: - constant_string { $$ = $1; } + var_string_list { $$ = $1; } | expr '|' expr { zend_ini_do_op('|', &$$, &$1, &$3); } | expr '&' expr { zend_ini_do_op('&', &$$, &$1, &$3); } | '~' expr { zend_ini_do_op('~', &$$, &$2, NULL); } diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 745c7470c..7a1fa5892 100755 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_interfaces.c,v 1.33.2.3 2006/02/26 10:53:38 helly Exp $ */ +/* $Id: zend_interfaces.c,v 1.33.2.4 2006/04/10 22:49:29 helly Exp $ */ #include "zend.h" #include "zend_API.h" @@ -287,7 +287,7 @@ static zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *ce, if (!ce || !ce_it || !ce_it->get_iterator || (ce_it->get_iterator == zend_user_it_get_new_iterator && iterator == object)) { if (!EG(exception)) { - zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Objects returned by %s::getIterator() must be traversable or implement interface Iterator", ce->name); + zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Objects returned by %s::getIterator() must be traversable or implement interface Iterator", ce ? ce->name : Z_OBJCE_P(object)->name); } if (iterator) { diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c index 86bcf336a..32cec06f1 100644 --- a/Zend/zend_language_scanner.c +++ b/Zend/zend_language_scanner.c @@ -372,7 +372,7 @@ static yyconst short int yy_accept[1411] = 145, 159, 118, 142, 145, 141, 158, 159, 143, 159, 157, 155, 140, 159, 118, 38, 37, 101, 100, 127, - 130, 130, 160, 123, 123, 121, 121, 121, 111, 0, + 130, 130, 122, 122, 122, 121, 121, 121, 111, 0, 111, 114, 112, 111, 119, 75, 0, 133, 0, 116, 83, 132, 90, 86, 0, 134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 70, 78, @@ -2699,7 +2699,7 @@ char *yytext; +----------------------------------------------------------------------+ */ -/* $Id: zend_language_scanner.l,v 1.131.2.10 2006/01/17 09:39:57 dmitry Exp $ */ +/* $Id: zend_language_scanner.l,v 1.131.2.11 2006/04/13 13:48:28 dmitry Exp $ */ #define yyleng SCNG(yy_leng) #define yytext SCNG(yy_text) @@ -4675,7 +4675,7 @@ YY_RULE_SETUP { if (CG(asp_tags) || yytext[yyleng-2] != '%') { /* asp comment? */ zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; + zendlval->value.str.len = yyleng-2; zendlval->type = IS_STRING; yyless(yyleng-2); BEGIN(ST_IN_SCRIPTING); diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 2bee00ad9..52465eb6b 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_language_scanner.l,v 1.131.2.10 2006/01/17 09:39:57 dmitry Exp $ */ +/* $Id: zend_language_scanner.l,v 1.131.2.11 2006/04/13 13:48:28 dmitry Exp $ */ #define yyleng SCNG(yy_leng) #define yytext SCNG(yy_text) @@ -1461,7 +1461,7 @@ NEWLINE ("\r"|"\n"|"\r\n") yymore(); } -<ST_ONE_LINE_COMMENT>[^\n\r?%>]+{ANY_CHAR} { +<ST_ONE_LINE_COMMENT>[^\n\r?%>]*{ANY_CHAR} { switch (yytext[yyleng-1]) { case '?': case '%': case '>': yyless(yyleng-1); @@ -1491,7 +1491,7 @@ NEWLINE ("\r"|"\n"|"\r\n") <ST_ONE_LINE_COMMENT>"?>"|"%>" { if (CG(asp_tags) || yytext[yyleng-2] != '%') { /* asp comment? */ zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; + zendlval->value.str.len = yyleng-2; zendlval->type = IS_STRING; yyless(yyleng-2); BEGIN(ST_IN_SCRIPTING); diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index b7e20bd0b..5f2a80391 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_opcode.c,v 1.110.2.5 2006/03/14 11:24:45 dmitry Exp $ */ +/* $Id: zend_opcode.c,v 1.110.2.6 2006/04/10 12:26:53 dmitry Exp $ */ #include <stdio.h> @@ -367,8 +367,10 @@ int pass_two(zend_op_array *op_array TSRMLS_DC) zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_handler, op_array TSRMLS_CC); } - op_array->opcodes = (zend_op *) erealloc(op_array->opcodes, sizeof(zend_op)*op_array->last); - op_array->size = op_array->last; + if (!CG(interactive) && op_array->size != op_array->last) { + op_array->opcodes = (zend_op *) erealloc(op_array->opcodes, sizeof(zend_op)*op_array->last); + op_array->size = op_array->last; + } opline = op_array->opcodes; end = opline + op_array->last; diff --git a/Zend/zend_strtod.c b/Zend/zend_strtod.c index 3ad2c5f15..3a469fd59 100644 --- a/Zend/zend_strtod.c +++ b/Zend/zend_strtod.c @@ -130,6 +130,7 @@ typedef unsigned long int uint32_t; * but the word order is big endian. */ #define IEEE_BIG_ENDIAN +#undef IEEE_LITTLE_ENDIAN #endif #ifdef __vax__ diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index c0cc2cf16..013bd3b03 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.59.2.27 2006/03/15 11:12:45 dmitry Exp $ */ +/* $Id: zend_vm_def.h,v 1.59.2.30 2006/07/06 15:39:23 pollita Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -1158,7 +1158,9 @@ ZEND_VM_HELPER_EX(zend_fetch_property_address_read_helper, VAR|UNUSED|CV, CONST| if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (type != BP_VAR_IS) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); @@ -3017,7 +3019,20 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY) } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { ce = Z_OBJCE_P(array_ptr); } else { - array_ptr->refcount++; + if (OP1_TYPE == IS_VAR && + free_op1.var == NULL && + !array_ptr->is_ref && + array_ptr->refcount > 1) { + /* non-separated return value from function */ + zval *tmp; + + ALLOC_ZVAL(tmp); + INIT_PZVAL_COPY(tmp, array_ptr); + zval_copy_ctor(tmp); + array_ptr = tmp; + } else { + array_ptr->refcount++; + } } } @@ -3223,7 +3238,9 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY) key->value.lval = int_key; key->type = IS_LONG; break; - EMPTY_SWITCH_DEFAULT_CASE() + default: + ZVAL_NULL(key); + break; } } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index a9a3c5c2f..2417f69a7 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -2059,7 +2059,7 @@ static int ZEND_UNSET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - + zend_free_op free_op1; zval *array_ptr, **array_ptr_ptr; HashTable *fe_ht; zend_object_iterator *iter = NULL; @@ -2100,7 +2100,20 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { ce = Z_OBJCE_P(array_ptr); } else { - array_ptr->refcount++; + if (IS_CONST == IS_VAR && + free_op1.var == NULL && + !array_ptr->is_ref && + array_ptr->refcount > 1) { + /* non-separated return value from function */ + zval *tmp; + + ALLOC_ZVAL(tmp); + INIT_PZVAL_COPY(tmp, array_ptr); + zval_copy_ctor(tmp); + array_ptr = tmp; + } else { + array_ptr->refcount++; + } } } @@ -4518,7 +4531,20 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { ce = Z_OBJCE_P(array_ptr); } else { - array_ptr->refcount++; + if (IS_TMP_VAR == IS_VAR && + free_op1.var == NULL && + !array_ptr->is_ref && + array_ptr->refcount > 1) { + /* non-separated return value from function */ + zval *tmp; + + ALLOC_ZVAL(tmp); + INIT_PZVAL_COPY(tmp, array_ptr); + zval_copy_ctor(tmp); + array_ptr = tmp; + } else { + array_ptr->refcount++; + } } } @@ -7518,7 +7544,20 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { ce = Z_OBJCE_P(array_ptr); } else { - array_ptr->refcount++; + if (IS_VAR == IS_VAR && + free_op1.var == NULL && + !array_ptr->is_ref && + array_ptr->refcount > 1) { + /* non-separated return value from function */ + zval *tmp; + + ALLOC_ZVAL(tmp); + INIT_PZVAL_COPY(tmp, array_ptr); + zval_copy_ctor(tmp); + array_ptr = tmp; + } else { + array_ptr->refcount++; + } } } @@ -7724,7 +7763,9 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) key->value.lval = int_key; key->type = IS_LONG; break; - EMPTY_SWITCH_DEFAULT_CASE() + default: + ZVAL_NULL(key); + break; } } @@ -8633,7 +8674,9 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_CONST(int type, ZEND if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (type != BP_VAR_IS) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); @@ -10057,7 +10100,9 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_TMP(int type, ZEND_O if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (type != BP_VAR_IS) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); @@ -11484,7 +11529,9 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_VAR(int type, ZEND_O if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (type != BP_VAR_IS) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); @@ -13356,7 +13403,9 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_CV(int type, ZEND_OP if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (type != BP_VAR_IS) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); @@ -14551,7 +14600,9 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_CONST(int type, Z if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (type != BP_VAR_IS) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); @@ -15628,7 +15679,9 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_TMP(int type, ZEN if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (type != BP_VAR_IS) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); @@ -16666,7 +16719,9 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR(int type, ZEN if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (type != BP_VAR_IS) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); @@ -18069,7 +18124,9 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_CV(int type, ZEND if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (type != BP_VAR_IS) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); @@ -19574,7 +19631,7 @@ static int ZEND_UNSET_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - + zend_free_op free_op1; zval *array_ptr, **array_ptr_ptr; HashTable *fe_ht; zend_object_iterator *iter = NULL; @@ -19615,7 +19672,20 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { ce = Z_OBJCE_P(array_ptr); } else { - array_ptr->refcount++; + if (IS_CV == IS_VAR && + free_op1.var == NULL && + !array_ptr->is_ref && + array_ptr->refcount > 1) { + /* non-separated return value from function */ + zval *tmp; + + ALLOC_ZVAL(tmp); + INIT_PZVAL_COPY(tmp, array_ptr); + zval_copy_ctor(tmp); + array_ptr = tmp; + } else { + array_ptr->refcount++; + } } } @@ -20590,7 +20660,9 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_CONST(int type, ZEND_ if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (type != BP_VAR_IS) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); @@ -22006,7 +22078,9 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_TMP(int type, ZEND_OP if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (type != BP_VAR_IS) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); @@ -23425,7 +23499,9 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_VAR(int type, ZEND_OP if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (type != BP_VAR_IS) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); @@ -25287,7 +25363,9 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_CV(int type, ZEND_OPC if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (type != BP_VAR_IS) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); |