diff options
Diffstat (limited to 'Zend')
29 files changed, 521 insertions, 187 deletions
diff --git a/Zend/tests/bug36071.phpt b/Zend/tests/bug36071.phpt index 72ef78f6d..19e74980e 100755 --- a/Zend/tests/bug36071.phpt +++ b/Zend/tests/bug36071.phpt @@ -6,8 +6,6 @@ error_reporting=4095 <?php
$a = clone 0;
$a[0]->b = 0;
-echo "ok\n";
?>
--EXPECTF--
-Warning: __clone method called on non-object in %sbug36071.php on line 2
-ok
\ No newline at end of file +Fatal error: __clone method called on non-object in %sbug36071.php on line 2
\ No newline at end of file diff --git a/Zend/tests/bug40509.phpt b/Zend/tests/bug40509.phpt index d3352ef5a..4ee8e0061 100755 --- a/Zend/tests/bug40509.phpt +++ b/Zend/tests/bug40509.phpt @@ -1,5 +1,5 @@ --TEST--
-Bug #40509 key() function changed behaviour if global array is used within function
+Bug #40509 (key() function changed behaviour if global array is used within function)
--FILE--
<?php
function foo()
diff --git a/Zend/tests/bug40705.phpt b/Zend/tests/bug40705.phpt index aa150276c..5628b37bf 100755 --- a/Zend/tests/bug40705.phpt +++ b/Zend/tests/bug40705.phpt @@ -1,5 +1,5 @@ --TEST--
-Bug #40705 Iterating within function moves original array pointer
+Bug #40705 (Iterating within function moves original array pointer)
--FILE--
<?php
function doForeach($array)
diff --git a/Zend/tests/bug41929.phpt b/Zend/tests/bug41929.phpt index 47c7118ed..7fa4bbcc8 100755 --- a/Zend/tests/bug41929.phpt +++ b/Zend/tests/bug41929.phpt @@ -1,5 +1,5 @@ --TEST--
-Bug #41929 Foreach on object does not iterate over all visible properties
+Bug #41929 (Foreach on object does not iterate over all visible properties)
--FILE--
<?php
class C {
diff --git a/Zend/tests/bug42767.phpt b/Zend/tests/bug42767.phpt new file mode 100644 index 000000000..0de4dba5f --- /dev/null +++ b/Zend/tests/bug42767.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #42767 (highlight_string() truncates trailing comments) +--FILE-- +<?php +highlight_string('<?php /*some comment..'); +?> +--EXPECT-- +<code><span style="color: #000000"> +<span style="color: #0000BB"><?php </span><span style="color: #FF8000">/*some comment..</span> +</span> +</code> diff --git a/Zend/tests/bug42772.phpt b/Zend/tests/bug42772.phpt new file mode 100755 index 000000000..8887bdbd7 --- /dev/null +++ b/Zend/tests/bug42772.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #42772 (Storing $this in a static var fails while handling a cast to string) +--FILE-- +<?php +class Foo { + static public $foo; + function __toString() { + self::$foo = $this; + return 'foo'; + } +} + +$foo = (string)new Foo(); +var_dump(Foo::$foo); +?> +--EXPECT-- +object(Foo)#1 (0) { +} diff --git a/Zend/tests/bug42817.phpt b/Zend/tests/bug42817.phpt new file mode 100644 index 000000000..b1beca4d0 --- /dev/null +++ b/Zend/tests/bug42817.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #42817 (clone() on a non-object does not result in a fatal error) +--FILE-- +<?php +$a = clone(null); +array_push($a->b, $c); +?> +--EXPECTF-- +Fatal error: __clone method called on non-object in %sbug42817.php on line 2 diff --git a/Zend/tests/bug42818.phpt b/Zend/tests/bug42818.phpt new file mode 100644 index 000000000..09ad693b4 --- /dev/null +++ b/Zend/tests/bug42818.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #42818 ($foo = clone(array()); leaks memory) +--FILE-- +<?php +$foo = clone(array()); +?> +--EXPECTF-- +Fatal error: __clone method called on non-object in %sbug42818.php on line 2 + diff --git a/Zend/tests/magic_by_ref_001.phpt b/Zend/tests/magic_by_ref_001.phpt new file mode 100644 index 000000000..e9bcf8fa2 --- /dev/null +++ b/Zend/tests/magic_by_ref_001.phpt @@ -0,0 +1,17 @@ +--TEST-- +passing first parameter of __set() by ref +--FILE-- +<?php + +class test { + function __set(&$name, $val) { } +} + +$t = new test; +$name = "prop"; +$t->$name = 1; + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Method test::__set() cannot take arguments by reference in %s on line %d diff --git a/Zend/tests/magic_by_ref_002.phpt b/Zend/tests/magic_by_ref_002.phpt new file mode 100644 index 000000000..cb62f67f5 --- /dev/null +++ b/Zend/tests/magic_by_ref_002.phpt @@ -0,0 +1,16 @@ +--TEST-- +passing second parameter of __set() by ref +--FILE-- +<?php + +class test { + function __set($name, &$val) { } +} + +$t = new test; +$t->prop = 1; + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Method test::__set() cannot take arguments by reference in %s on line %d diff --git a/Zend/tests/magic_by_ref_003.phpt b/Zend/tests/magic_by_ref_003.phpt new file mode 100644 index 000000000..022cbd563 --- /dev/null +++ b/Zend/tests/magic_by_ref_003.phpt @@ -0,0 +1,17 @@ +--TEST-- +passing parameter of __get() by ref +--FILE-- +<?php + +class test { + function __get(&$name) { } +} + +$t = new test; +$name = "prop"; +var_dump($t->$name); + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Method test::__get() cannot take arguments by reference in %s on line %d diff --git a/Zend/tests/magic_by_ref_004.phpt b/Zend/tests/magic_by_ref_004.phpt new file mode 100644 index 000000000..aa04d1aee --- /dev/null +++ b/Zend/tests/magic_by_ref_004.phpt @@ -0,0 +1,18 @@ +--TEST-- +passing parameter of __unset() by ref +--FILE-- +<?php + +class test { + function __unset(&$name) { } +} + +$t = new test; +$name = "prop"; + +var_dump($t->$name); + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Method test::__unset() cannot take arguments by reference in %s on line %d diff --git a/Zend/tests/magic_by_ref_005.phpt b/Zend/tests/magic_by_ref_005.phpt new file mode 100644 index 000000000..513c0618d --- /dev/null +++ b/Zend/tests/magic_by_ref_005.phpt @@ -0,0 +1,18 @@ +--TEST-- +passing parameter of __isset() by ref +--FILE-- +<?php + +class test { + function __isset(&$name) { } +} + +$t = new test; +$name = "prop"; + +var_dump(isset($t->$name)); + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Method test::__isset() cannot take arguments by reference in %s on line %d diff --git a/Zend/tests/magic_by_ref_006.phpt b/Zend/tests/magic_by_ref_006.phpt new file mode 100644 index 000000000..14d7d708b --- /dev/null +++ b/Zend/tests/magic_by_ref_006.phpt @@ -0,0 +1,18 @@ +--TEST-- +passing first parameter of __call() by ref +--FILE-- +<?php + +class test { + function __call(&$name, $args) { } +} + +$t = new test; +$func = "foo"; + +$t->$func(); + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Method test::__call() cannot take arguments by reference in %s on line %d diff --git a/Zend/tests/magic_by_ref_007.phpt b/Zend/tests/magic_by_ref_007.phpt new file mode 100644 index 000000000..c962d4581 --- /dev/null +++ b/Zend/tests/magic_by_ref_007.phpt @@ -0,0 +1,19 @@ +--TEST-- +passing second parameter of __call() by ref +--FILE-- +<?php + +class test { + function __call($name, &$args) { } +} + +$t = new test; +$func = "foo"; +$arg = 1; + +$t->$func($arg); + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Method test::__call() cannot take arguments by reference in %s on line %d diff --git a/Zend/tests/magic_by_ref_010.phpt b/Zend/tests/magic_by_ref_010.phpt new file mode 100644 index 000000000..0a45fb911 --- /dev/null +++ b/Zend/tests/magic_by_ref_010.phpt @@ -0,0 +1,30 @@ +--TEST-- +passing arguments by ref to a method handled by __call() +--INI-- +allow_call_time_pass_reference=1 +--FILE-- +<?php + +class Foo { + function __call($method, $args) + { + print $args[0]."\n"; + $args[0] = 5; + print $args[0]."\n"; + return true; + } +} + +$v = 'str'; +$o = new Foo(); +$o->test(&$v); + +var_dump($v); + +echo "Done\n"; +?> +--EXPECTF-- +str +5 +int(5) +Done diff --git a/Zend/zend_API.c b/Zend/zend_API.c index b8480a33f..1634b63e4 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.c,v 1.296.2.27.2.33 2007/08/01 10:56:45 dmitry Exp $ */ +/* $Id: zend_API.c,v 1.296.2.27.2.34 2007/08/31 12:36:13 tony2001 Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -1593,16 +1593,36 @@ ZEND_API void zend_check_magic_method_implementation(zend_class_entry *ce, zend_ zend_error(error_type, "Destructor %s::%s() cannot take arguments", ce->name, ZEND_DESTRUCTOR_FUNC_NAME); } else if (name_len == sizeof(ZEND_CLONE_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)) && fptr->common.num_args != 0) { zend_error(error_type, "Method %s::%s() cannot accept any arguments", ce->name, ZEND_CLONE_FUNC_NAME); - } else if (name_len == sizeof(ZEND_GET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)) && fptr->common.num_args != 1) { - zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ce->name, ZEND_GET_FUNC_NAME); - } else if (name_len == sizeof(ZEND_SET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)) && fptr->common.num_args != 2) { - zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ce->name, ZEND_SET_FUNC_NAME); - } else if (name_len == sizeof(ZEND_UNSET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME)) && fptr->common.num_args != 1) { - zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ce->name, ZEND_UNSET_FUNC_NAME); - } else if (name_len == sizeof(ZEND_ISSET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)) && fptr->common.num_args != 1) { - zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ce->name, ZEND_ISSET_FUNC_NAME); - } else if (name_len == sizeof(ZEND_CALL_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)) && fptr->common.num_args != 2) { - zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ce->name, ZEND_CALL_FUNC_NAME); + } else if (name_len == sizeof(ZEND_GET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME))) { + if (fptr->common.num_args != 1) { + zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ce->name, ZEND_GET_FUNC_NAME); + } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1)) { + zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ce->name, ZEND_GET_FUNC_NAME); + } + } else if (name_len == sizeof(ZEND_SET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME))) { + if (fptr->common.num_args != 2) { + zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ce->name, ZEND_SET_FUNC_NAME); + } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1) || ARG_SHOULD_BE_SENT_BY_REF(fptr, 2)) { + zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ce->name, ZEND_SET_FUNC_NAME); + } + } else if (name_len == sizeof(ZEND_UNSET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME))) { + if (fptr->common.num_args != 1) { + zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ce->name, ZEND_UNSET_FUNC_NAME); + } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1)) { + zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ce->name, ZEND_UNSET_FUNC_NAME); + } + } else if (name_len == sizeof(ZEND_ISSET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME))) { + if (fptr->common.num_args != 1) { + zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ce->name, ZEND_ISSET_FUNC_NAME); + } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1)) { + zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ce->name, ZEND_ISSET_FUNC_NAME); + } + } else if (name_len == sizeof(ZEND_CALL_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME))) { + if (fptr->common.num_args != 2) { + zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ce->name, ZEND_CALL_FUNC_NAME); + } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1) || ARG_SHOULD_BE_SENT_BY_REF(fptr, 2)) { + zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ce->name, ZEND_CALL_FUNC_NAME); + } } } diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 91577b8eb..d0dc0035d 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_alloc.c,v 1.144.2.3.2.43 2007/07/25 11:13:00 dmitry Exp $ */ +/* $Id: zend_alloc.c,v 1.144.2.3.2.44 2007/10/25 07:30:29 dmitry Exp $ */ #include "zend.h" #include "zend_alloc.h" @@ -396,6 +396,7 @@ struct _zend_mm_heap { size_t free_bitmap; size_t large_free_bitmap; size_t block_size; + size_t compact_size; zend_mm_segment *segments_list; zend_mm_storage *storage; size_t real_size; @@ -1028,6 +1029,7 @@ ZEND_API zend_mm_heap *zend_mm_startup_ex(const zend_mm_mem_handlers *handlers, heap->storage = storage; heap->block_size = block_size; + heap->compact_size = 0; heap->segments_list = NULL; zend_mm_init(heap); # if ZEND_MM_CACHE_STAT @@ -1078,6 +1080,7 @@ ZEND_API zend_mm_heap *zend_mm_startup(void) char *mem_type = getenv("ZEND_MM_MEM_TYPE"); char *tmp; const zend_mm_mem_handlers *handlers; + zend_mm_heap *heap; if (mem_type == NULL) { i = 0; @@ -1109,7 +1112,16 @@ ZEND_API zend_mm_heap *zend_mm_startup(void) seg_size = ZEND_MM_SEG_SIZE; } - return zend_mm_startup_ex(handlers, seg_size, ZEND_MM_RESERVE_SIZE, 0, NULL); + heap = zend_mm_startup_ex(handlers, seg_size, ZEND_MM_RESERVE_SIZE, 0, NULL); + if (heap) { + tmp = getenv("ZEND_MM_COMPACT"); + if (tmp) { + heap->compact_size = zend_atoi(tmp, 0); + } else { + heap->compact_size = 2 * 1024 * 1024; + } + } + return heap; } #if ZEND_DEBUG @@ -1563,7 +1575,9 @@ ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, int full_shutdown, int silent #ifdef HAVE_MEM_WIN32 /* FIX for bug #41713 */ /* TODO: add new "compact" handler */ - if (storage->handlers->dtor == zend_mm_mem_win32_dtor && + if (heap->compact_size && + heap->real_peak > heap->compact_size && + storage->handlers->dtor == zend_mm_mem_win32_dtor && storage->handlers->init == zend_mm_mem_win32_init) { HeapDestroy((HANDLE)storage->data); storage->data = (void*)HeapCreate(HEAP_NO_SERIALIZE, 0, 0); diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 44b7fcfea..b05ec7eff 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_builtin_functions.c,v 1.277.2.12.2.24 2007/08/22 13:19:47 dmitry Exp $ */ +/* $Id: zend_builtin_functions.c,v 1.277.2.12.2.25 2007/08/30 07:43:21 sebastian Exp $ */ #include "zend.h" #include "zend_API.h" @@ -2093,15 +2093,17 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int /* }}} */ -/* {{{ proto array debug_backtrace(void) +/* {{{ proto array debug_backtrace([bool provide_object]) Return backtrace as array */ ZEND_FUNCTION(debug_backtrace) { - if (ZEND_NUM_ARGS()) { - ZEND_WRONG_PARAM_COUNT(); + zend_bool provide_object = 1; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &provide_object) == FAILURE) { + return; } - zend_fetch_debug_backtrace(return_value, 1, 1 TSRMLS_CC); + zend_fetch_debug_backtrace(return_value, 1, provide_object TSRMLS_CC); } /* }}} */ diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 5437610d5..befd6d1ff 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.647.2.27.2.40 2007/05/18 13:12:03 dmitry Exp $ */ +/* $Id: zend_compile.c,v 1.647.2.27.2.41 2007/09/20 14:11:31 jani Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -1552,11 +1552,11 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC) if (original_op==ZEND_SEND_REF && !CG(allow_call_time_pass_reference)) { zend_error(E_COMPILE_WARNING, - "Call-time pass-by-reference has been deprecated; " + "Call-time pass-by-reference has been deprecated; " "If you would like to pass it by reference, modify the declaration of %s(). " "If you would like to enable call-time pass-by-reference, you can set " - "allow_call_time_pass_reference to true in your INI file. ", - (function_ptr?function_ptr->common.function_name:"[runtime function name]")); + "allow_call_time_pass_reference to true in your INI file", + (function_ptr ? function_ptr->common.function_name : "[runtime function name]")); } if (function_ptr) { diff --git a/Zend/zend_extensions.c b/Zend/zend_extensions.c index 22322f5a6..0dc99afbf 100644 --- a/Zend/zend_extensions.c +++ b/Zend/zend_extensions.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_extensions.c,v 1.48.2.1.2.2 2007/01/01 09:35:46 sebastian Exp $ */ +/* $Id: zend_extensions.c,v 1.48.2.1.2.3 2007/09/18 09:24:04 jani Exp $ */ #include "zend_extensions.h" @@ -243,7 +243,7 @@ void *zend_mh_bundle_load(char* bundle_path) return NULL; } - bundle_handle = NSLinkModule(bundle_image, bundle_path, NSLINKMODULE_OPTION_PRIVATE); + bundle_handle = NSLinkModule(bundle_image, bundle_path, NSLINKMODULE_OPTION_NONE); NSDestroyObjectFileImage(bundle_image); /* call the init function of the bundle */ diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c index aae51e218..2e5613bef 100644 --- a/Zend/zend_highlight.c +++ b/Zend/zend_highlight.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_highlight.c,v 1.49.2.3.2.1 2007/01/01 09:35:46 sebastian Exp $ */ +/* $Id: zend_highlight.c,v 1.49.2.3.2.2 2007/09/26 15:43:58 iliaa Exp $ */ #include "zend.h" #include <zend_language_parser.h> @@ -177,6 +177,19 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini } token.type = 0; } + + /* handler for trailing comments, see bug #42767 */ + if (LANG_SCNG(yy_leng) && LANG_SCNG(_yy_more_len)) { + if (last_color != syntax_highlighter_ini->highlight_comment) { + if (last_color != syntax_highlighter_ini->highlight_html) { + zend_printf("</span>"); + } + if (syntax_highlighter_ini->highlight_comment != syntax_highlighter_ini->highlight_html) { + zend_printf("<span style=\"color: %s\">", syntax_highlighter_ini->highlight_comment); + } + } + zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(_yy_more_len) TSRMLS_CC); + } done: if (last_color != syntax_highlighter_ini->highlight_html) { zend_printf("</span>\n"); @@ -185,8 +198,6 @@ done: zend_printf("</code>"); } - - ZEND_API void zend_strip(TSRMLS_D) { zval token; diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index f1fc75354..80db6f96d 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ini.c,v 1.39.2.2.2.11 2007/08/23 18:42:42 tony2001 Exp $ */ +/* $Id: zend_ini.c,v 1.39.2.2.2.25 2007/10/01 15:00:15 iliaa Exp $ */ #include "zend.h" #include "zend_qsort.h" @@ -26,7 +26,7 @@ #include "zend_operators.h" #include "zend_strtod.h" -static HashTable *registered_zend_ini_directives; +static HashTable *registered_zend_ini_directives; #define NO_VALUE_PLAINTEXT "no value" #define NO_VALUE_HTML "<i>no value</i>" @@ -34,7 +34,7 @@ static HashTable *registered_zend_ini_directives; /* * hash_apply functions */ -static int zend_remove_ini_entries(zend_ini_entry *ini_entry, int *module_number TSRMLS_DC) +static int zend_remove_ini_entries(zend_ini_entry *ini_entry, int *module_number TSRMLS_DC) /* {{{ */ { if (ini_entry->module_number == *module_number) { return 1; @@ -42,16 +42,16 @@ static int zend_remove_ini_entries(zend_ini_entry *ini_entry, int *module_number return 0; } } +/* }}} */ - -static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS_DC) +static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS_DC) /* {{{ */ { if (ini_entry->modified) { if (ini_entry->on_modify) { zend_try { /* even if on_modify bails out, we have to continue on with restoring, since there can be allocated variables that would be freed on MM shutdown - and would lead to memory corruption later ini entry is modified again */ + and would lead to memory corruption later ini entry is modified again */ ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC); } zend_end_try(); } @@ -66,46 +66,48 @@ static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS } return 0; } +/* }}} */ -static int zend_restore_ini_entry_wrapper(zend_ini_entry **ini_entry TSRMLS_DC) +static int zend_restore_ini_entry_wrapper(zend_ini_entry **ini_entry TSRMLS_DC) /* {{{ */ { zend_restore_ini_entry_cb(*ini_entry, ZEND_INI_STAGE_DEACTIVATE TSRMLS_CC); return 1; } +/* }}} */ /* * Startup / shutdown */ -ZEND_API int zend_ini_startup(TSRMLS_D) +ZEND_API int zend_ini_startup(TSRMLS_D) /* {{{ */ { registered_zend_ini_directives = (HashTable *) malloc(sizeof(HashTable)); EG(ini_directives) = registered_zend_ini_directives; EG(modified_ini_directives) = NULL; - if (zend_hash_init_ex(registered_zend_ini_directives, 100, NULL, NULL, 1, 0)==FAILURE) { + if (zend_hash_init_ex(registered_zend_ini_directives, 100, NULL, NULL, 1, 0) == FAILURE) { return FAILURE; } return SUCCESS; } +/* }}} */ - -ZEND_API int zend_ini_shutdown(TSRMLS_D) +ZEND_API int zend_ini_shutdown(TSRMLS_D) /* {{{ */ { zend_hash_destroy(EG(ini_directives)); free(EG(ini_directives)); return SUCCESS; } +/* }}} */ - -ZEND_API int zend_ini_global_shutdown(TSRMLS_D) +ZEND_API int zend_ini_global_shutdown(TSRMLS_D) /* {{{ */ { zend_hash_destroy(registered_zend_ini_directives); free(registered_zend_ini_directives); return SUCCESS; } +/* }}} */ - -ZEND_API int zend_ini_deactivate(TSRMLS_D) +ZEND_API int zend_ini_deactivate(TSRMLS_D) /* {{{ */ { if (EG(modified_ini_directives)) { zend_hash_apply(EG(modified_ini_directives), (apply_func_t) zend_restore_ini_entry_wrapper TSRMLS_CC); @@ -115,54 +117,54 @@ ZEND_API int zend_ini_deactivate(TSRMLS_D) } return SUCCESS; } - +/* }}} */ #ifdef ZTS -ZEND_API int zend_copy_ini_directives(TSRMLS_D) +ZEND_API int zend_copy_ini_directives(TSRMLS_D) /* {{{ */ { zend_ini_entry ini_entry; EG(modified_ini_directives) = NULL; EG(ini_directives) = (HashTable *) malloc(sizeof(HashTable)); - if (zend_hash_init_ex(EG(ini_directives), registered_zend_ini_directives->nNumOfElements, NULL, NULL, 1, 0)==FAILURE) { + if (zend_hash_init_ex(EG(ini_directives), registered_zend_ini_directives->nNumOfElements, NULL, NULL, 1, 0) == FAILURE) { return FAILURE; } zend_hash_copy(EG(ini_directives), registered_zend_ini_directives, NULL, &ini_entry, sizeof(zend_ini_entry)); return SUCCESS; } +/* }}} */ #endif - -static int ini_key_compare(const void *a, const void *b TSRMLS_DC) +static int ini_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */ { Bucket *f; Bucket *s; - + f = *((Bucket **) a); s = *((Bucket **) b); - if (f->nKeyLength==0 && s->nKeyLength==0) { /* both numeric */ + if (f->nKeyLength == 0 && s->nKeyLength == 0) { /* both numeric */ return ZEND_NORMALIZE_BOOL(f->nKeyLength - s->nKeyLength); - } else if (f->nKeyLength==0) { /* f is numeric, s is not */ + } else if (f->nKeyLength == 0) { /* f is numeric, s is not */ return -1; - } else if (s->nKeyLength==0) { /* s is numeric, f is not */ + } else if (s->nKeyLength == 0) { /* s is numeric, f is not */ return 1; } else { /* both strings */ return zend_binary_strcasecmp(f->arKey, f->nKeyLength, s->arKey, s->nKeyLength); } } +/* }}} */ - -ZEND_API void zend_ini_sort_entries(TSRMLS_D) +ZEND_API void zend_ini_sort_entries(TSRMLS_D) /* {{{ */ { zend_hash_sort(EG(ini_directives), zend_qsort, ini_key_compare, 0 TSRMLS_CC); } +/* }}} */ /* * Registration / unregistration */ - -ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_number TSRMLS_DC) +ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_number TSRMLS_DC) /* {{{ */ { zend_ini_entry *p = ini_entry; zend_ini_entry *hashed_ini_entry; @@ -187,15 +189,15 @@ ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_num while (p->name) { p->module_number = module_number; config_directive_success = 0; - if (zend_hash_add(directives, p->name, p->name_length, p, sizeof(zend_ini_entry), (void **) &hashed_ini_entry)==FAILURE) { + if (zend_hash_add(directives, p->name, p->name_length, p, sizeof(zend_ini_entry), (void **) &hashed_ini_entry) == FAILURE) { zend_unregister_ini_entries(module_number TSRMLS_CC); return FAILURE; } - if ((zend_get_configuration_directive(p->name, p->name_length, &default_value))==SUCCESS) { + if ((zend_get_configuration_directive(p->name, p->name_length, &default_value)) == SUCCESS) { if (!hashed_ini_entry->on_modify - || hashed_ini_entry->on_modify(hashed_ini_entry, default_value.value.str.val, default_value.value.str.len, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC)==SUCCESS) { - hashed_ini_entry->value = default_value.value.str.val; - hashed_ini_entry->value_length = default_value.value.str.len; + || hashed_ini_entry->on_modify(hashed_ini_entry, Z_STRVAL(default_value), Z_STRLEN(default_value), hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC) == SUCCESS) { + hashed_ini_entry->value = Z_STRVAL(default_value); + hashed_ini_entry->value_length = Z_STRLEN(default_value); config_directive_success = 1; } } @@ -207,44 +209,56 @@ ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_num } return SUCCESS; } +/* }}} */ - -ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC) +ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC) /* {{{ */ { zend_hash_apply_with_argument(registered_zend_ini_directives, (apply_func_arg_t) zend_remove_ini_entries, (void *) &module_number TSRMLS_CC); } - +/* }}} */ #ifdef ZTS -static int zend_ini_refresh_cache(zend_ini_entry *p, int stage TSRMLS_DC) +static int zend_ini_refresh_cache(zend_ini_entry *p, int stage TSRMLS_DC) /* {{{ */ { if (p->on_modify) { p->on_modify(p, p->value, p->value_length, p->mh_arg1, p->mh_arg2, p->mh_arg3, stage TSRMLS_CC); } return 0; } +/* }}} */ - -ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC) +ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC) /* {{{ */ { zend_hash_apply_with_argument(EG(ini_directives), (apply_func_arg_t) zend_ini_refresh_cache, (void *)(zend_intptr_t) stage TSRMLS_CC); } +/* }}} */ #endif +ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage) /* {{{ */ +{ + return zend_alter_ini_entry_ex(name, name_length, new_value, new_value_length, modify_type, stage, 0); +} +/* }}} */ -ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage) +ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage, int force_change) /* {{{ */ { zend_ini_entry *ini_entry; char *duplicate; zend_bool modified; TSRMLS_FETCH(); - if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE) { + if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry) == FAILURE) { return FAILURE; } - if (!(ini_entry->modifiable & modify_type)) { - return FAILURE; + if (stage == ZEND_INI_STAGE_ACTIVATE && modify_type == ZEND_INI_SYSTEM) { + ini_entry->modifiable = ZEND_INI_SYSTEM; + } + + if (!force_change) { + if (!(ini_entry->modifiable & modify_type)) { + return FAILURE; + } } modified = ini_entry->modified; @@ -263,7 +277,7 @@ ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, duplicate = estrndup(new_value, new_value_length); if (!ini_entry->on_modify - || ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC)==SUCCESS) { + || ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC) == SUCCESS) { if (modified && ini_entry->orig_value != ini_entry->value) { /* we already changed the value, free the changed value */ efree(ini_entry->value); } @@ -275,15 +289,15 @@ ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, return SUCCESS; } +/* }}} */ - -ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage) +ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage) /* {{{ */ { zend_ini_entry *ini_entry; TSRMLS_FETCH(); - if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE || - (stage == ZEND_INI_STAGE_RUNTIME && (ini_entry->modifiable & ZEND_INI_USER) == 0)) { + if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry) == FAILURE || + (stage == ZEND_INI_STAGE_RUNTIME && (ini_entry->modifiable & ZEND_INI_USER) == 0)) { return FAILURE; } @@ -291,35 +305,34 @@ ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage) zend_restore_ini_entry_cb(ini_entry, stage TSRMLS_CC); zend_hash_del(EG(modified_ini_directives), name, name_length); } - + return SUCCESS; } +/* }}} */ - -ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)) +ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)) /* {{{ */ { zend_ini_entry *ini_entry; - if (zend_hash_find(registered_zend_ini_directives, name, name_length, (void **) &ini_entry)==FAILURE) { + if (zend_hash_find(registered_zend_ini_directives, name, name_length, (void **) &ini_entry) == FAILURE) { return FAILURE; } ini_entry->displayer = displayer; return SUCCESS; } - - +/* }}} */ /* * Data retrieval */ -ZEND_API long zend_ini_long(char *name, uint name_length, int orig) +ZEND_API long zend_ini_long(char *name, uint name_length, int orig) /* {{{ */ { zend_ini_entry *ini_entry; TSRMLS_FETCH(); - if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) { + if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry) == SUCCESS) { if (orig && ini_entry->modified) { return (ini_entry->orig_value ? strtol(ini_entry->orig_value, NULL, 0) : 0); } else if (ini_entry->value) { @@ -329,14 +342,14 @@ ZEND_API long zend_ini_long(char *name, uint name_length, int orig) return 0; } +/* }}} */ - -ZEND_API double zend_ini_double(char *name, uint name_length, int orig) +ZEND_API double zend_ini_double(char *name, uint name_length, int orig) /* {{{ */ { zend_ini_entry *ini_entry; TSRMLS_FETCH(); - if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) { + if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry) == SUCCESS) { if (orig && ini_entry->modified) { return (double) (ini_entry->orig_value ? zend_strtod(ini_entry->orig_value, NULL) : 0.0); } else if (ini_entry->value) { @@ -346,14 +359,14 @@ ZEND_API double zend_ini_double(char *name, uint name_length, int orig) return 0.0; } +/* }}} */ - -ZEND_API char *zend_ini_string(char *name, uint name_length, int orig) +ZEND_API char *zend_ini_string(char *name, uint name_length, int orig) /* {{{ */ { zend_ini_entry *ini_entry; TSRMLS_FETCH(); - if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) { + if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry) == SUCCESS) { if (orig && ini_entry->modified) { return ini_entry->orig_value; } else { @@ -363,9 +376,10 @@ ZEND_API char *zend_ini_string(char *name, uint name_length, int orig) return ""; } +/* }}} */ -#if TONY_20070307 -static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type) +#if TONY_20070307 +static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type) /* {{{ */ { if (ini_entry->displayer) { ini_entry->displayer(ini_entry, type); @@ -373,18 +387,18 @@ static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type) char *display_string; uint display_string_length; - if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { + if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { if (ini_entry->orig_value) { display_string = ini_entry->orig_value; display_string_length = ini_entry->orig_value_length; } else { if (zend_uv.html_errors) { display_string = NO_VALUE_HTML; - display_string_length = sizeof(NO_VALUE_HTML)-1; + display_string_length = sizeof(NO_VALUE_HTML) - 1; } else { display_string = NO_VALUE_PLAINTEXT; - display_string_length = sizeof(NO_VALUE_PLAINTEXT)-1; - } + display_string_length = sizeof(NO_VALUE_PLAINTEXT) - 1; + } } } else if (ini_entry->value && ini_entry->value[0]) { display_string = ini_entry->value; @@ -392,23 +406,24 @@ static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type) } else { if (zend_uv.html_errors) { display_string = NO_VALUE_HTML; - display_string_length = sizeof(NO_VALUE_HTML)-1; + display_string_length = sizeof(NO_VALUE_HTML) - 1; } else { display_string = NO_VALUE_PLAINTEXT; - display_string_length = sizeof(NO_VALUE_PLAINTEXT)-1; - } + display_string_length = sizeof(NO_VALUE_PLAINTEXT) - 1; + } } ZEND_WRITE(display_string, display_string_length); } } +/* }}} */ #endif -ZEND_INI_DISP(zend_ini_boolean_displayer_cb) +ZEND_INI_DISP(zend_ini_boolean_displayer_cb) /* {{{ */ { int value, tmp_value_len; char *tmp_value; - if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { + if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { tmp_value = (ini_entry->orig_value ? ini_entry->orig_value : NULL ); tmp_value_len = ini_entry->orig_value_length; } else if (ini_entry->value) { @@ -419,32 +434,33 @@ ZEND_INI_DISP(zend_ini_boolean_displayer_cb) tmp_value_len = 0; } - if (tmp_value_len == 4 && strcasecmp(tmp_value, "true") == 0) { - value = 1; - } - else if (tmp_value_len == 3 && strcasecmp(tmp_value, "yes") == 0) { - value = 1; - } - else if (tmp_value_len == 2 && strcasecmp(tmp_value, "on") == 0) { - value = 1; - } - else { - value = atoi(tmp_value); + if (tmp_value) { + if (tmp_value_len == 4 && strcasecmp(tmp_value, "true") == 0) { + value = 1; + } else if (tmp_value_len == 3 && strcasecmp(tmp_value, "yes") == 0) { + value = 1; + } else if (tmp_value_len == 2 && strcasecmp(tmp_value, "on") == 0) { + value = 1; + } else { + value = atoi(tmp_value); + } + } else { + value = 0; } - + if (value) { ZEND_PUTS("On"); } else { ZEND_PUTS("Off"); } } +/* }}} */ - -ZEND_INI_DISP(zend_ini_color_displayer_cb) +ZEND_INI_DISP(zend_ini_color_displayer_cb) /* {{{ */ { char *value; - if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { + if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { value = ini_entry->orig_value; } else if (ini_entry->value) { value = ini_entry->value; @@ -456,22 +472,22 @@ ZEND_INI_DISP(zend_ini_color_displayer_cb) zend_printf("<font style=\"color: %s\">%s</font>", value, value); } else { ZEND_PUTS(value); - } + } } else { if (zend_uv.html_errors) { ZEND_PUTS(NO_VALUE_HTML); } else { ZEND_PUTS(NO_VALUE_PLAINTEXT); - } + } } } +/* }}} */ - -ZEND_INI_DISP(display_link_numbers) +ZEND_INI_DISP(display_link_numbers) /* {{{ */ { char *value; - if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { + if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { value = ini_entry->orig_value; } else if (ini_entry->value) { value = ini_entry->value; @@ -480,18 +496,17 @@ ZEND_INI_DISP(display_link_numbers) } if (value) { - if (atoi(value)==-1) { + if (atoi(value) == -1) { ZEND_PUTS("Unlimited"); } else { zend_printf("%s", value); } } } - +/* }}} */ /* Standard message handlers */ - -ZEND_API ZEND_INI_MH(OnUpdateBool) +ZEND_API ZEND_INI_MH(OnUpdateBool) /* {{{ */ { zend_bool *p; #ifndef ZTS @@ -504,23 +519,23 @@ ZEND_API ZEND_INI_MH(OnUpdateBool) p = (zend_bool *) (base+(size_t) mh_arg1); - if (new_value_length==2 && strcasecmp("on", new_value)==0) { + if (new_value_length == 2 && strcasecmp("on", new_value) == 0) { *p = (zend_bool) 1; - } - else if (new_value_length==3 && strcasecmp("yes", new_value)==0) { + } + else if (new_value_length == 3 && strcasecmp("yes", new_value) == 0) { *p = (zend_bool) 1; - } - else if (new_value_length==4 && strcasecmp("true", new_value)==0) { + } + else if (new_value_length == 4 && strcasecmp("true", new_value) == 0) { *p = (zend_bool) 1; - } + } else { *p = (zend_bool) atoi(new_value); } return SUCCESS; } +/* }}} */ - -ZEND_API ZEND_INI_MH(OnUpdateLong) +ZEND_API ZEND_INI_MH(OnUpdateLong) /* {{{ */ { long *p; #ifndef ZTS @@ -536,6 +551,7 @@ ZEND_API ZEND_INI_MH(OnUpdateLong) *p = zend_atoi(new_value, new_value_length); return SUCCESS; } +/* }}} */ ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) { @@ -558,9 +574,9 @@ ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) return SUCCESS; } +/* }}} */ - -ZEND_API ZEND_INI_MH(OnUpdateReal) +ZEND_API ZEND_INI_MH(OnUpdateReal) /* {{{ */ { double *p; #ifndef ZTS @@ -576,9 +592,9 @@ ZEND_API ZEND_INI_MH(OnUpdateReal) *p = zend_strtod(new_value, NULL); return SUCCESS; } +/* }}} */ - -ZEND_API ZEND_INI_MH(OnUpdateString) +ZEND_API ZEND_INI_MH(OnUpdateString) /* {{{ */ { char **p; #ifndef ZTS @@ -594,9 +610,9 @@ ZEND_API ZEND_INI_MH(OnUpdateString) *p = new_value; return SUCCESS; } +/* }}} */ - -ZEND_API ZEND_INI_MH(OnUpdateStringUnempty) +ZEND_API ZEND_INI_MH(OnUpdateStringUnempty) /* {{{ */ { char **p; #ifndef ZTS @@ -616,6 +632,7 @@ ZEND_API ZEND_INI_MH(OnUpdateStringUnempty) *p = new_value; return SUCCESS; } +/* }}} */ /* * Local variables: diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h index 736cec358..a39aca45e 100644 --- a/Zend/zend_ini.h +++ b/Zend/zend_ini.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ini.h,v 1.34.2.1.2.4 2007/08/02 23:57:21 stas Exp $ */ +/* $Id: zend_ini.h,v 1.34.2.1.2.6 2007/09/07 09:55:37 jani Exp $ */ #ifndef ZEND_INI_H #define ZEND_INI_H @@ -96,6 +96,7 @@ ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_num ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC); ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC); ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage); +ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage, int force_change); ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage); ZEND_API void display_ini_entries(zend_module_entry *module); diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c index 91019efdc..99a873a8f 100644 --- a/Zend/zend_language_scanner.c +++ b/Zend/zend_language_scanner.c @@ -3031,7 +3031,7 @@ char *yytext; +----------------------------------------------------------------------+ */ -/* $Id: zend_language_scanner.l,v 1.131.2.11.2.12 2007/05/24 08:56:35 dmitry Exp $ */ +/* $Id: zend_language_scanner.l,v 1.131.2.11.2.13 2007/09/09 16:33:34 iliaa Exp $ */ #define yyleng SCNG(yy_leng) #define yytext SCNG(yy_text) @@ -3839,6 +3839,14 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo *t++ = '\t'; zendlval->value.str.len--; break; + case 'f': + *t++ = '\f'; + zendlval->value.str.len--; + break; + case 'v': + *t++ = '\v'; + zendlval->value.str.len--; + break; case '"': case '`': if (*s != quote_type) { diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 27920d92a..047ac6ef3 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.11.2.12 2007/05/24 08:56:35 dmitry Exp $ */ +/* $Id: zend_language_scanner.l,v 1.131.2.11.2.13 2007/09/09 16:33:34 iliaa Exp $ */ #define yyleng SCNG(yy_leng) #define yytext SCNG(yy_text) @@ -819,6 +819,14 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo *t++ = '\t'; zendlval->value.str.len--; break; + case 'f': + *t++ = '\f'; + zendlval->value.str.len--; + break; + case 'v': + *t++ = '\v'; + zendlval->value.str.len--; + break; case '"': case '`': if (*s != quote_type) { diff --git a/Zend/zend_strtod.c b/Zend/zend_strtod.c index 16dd509ef..77e5c82f4 100644 --- a/Zend/zend_strtod.c +++ b/Zend/zend_strtod.c @@ -89,7 +89,7 @@ * directly -- and assumed always to succeed. */ -/* $Id: zend_strtod.c,v 1.17.2.2.2.12 2007/07/23 16:17:10 jani Exp $ */ +/* $Id: zend_strtod.c,v 1.17.2.2.2.13 2007/09/04 18:46:21 tony2001 Exp $ */ #include <zend_operators.h> #include <zend_strtod.h> @@ -136,6 +136,16 @@ typedef unsigned long int uint32_t; # endif #endif +#if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)) +# if defined(__LITTLE_ENDIAN__) +# undef WORDS_BIGENDIAN +# else +# if defined(__BIG_ENDIAN__) +# define WORDS_BIGENDIAN +# endif +# endif +#endif + #ifdef WORDS_BIGENDIAN #define IEEE_BIG_ENDIAN #else diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 20319c455..dcff366a7 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.29.2.47 2007/07/24 19:24:39 dmitry Exp $ */ +/* $Id: zend_vm_def.h,v 1.59.2.29.2.51 2007/10/04 23:23:41 iliaa Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -2531,7 +2531,7 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMP|VAR|UNUSED|CV, ANY) zend_object_clone_obj_t clone_call; if (!obj || Z_TYPE_P(obj) != IS_OBJECT) { - zend_error(E_WARNING, "__clone method called on non-object"); + zend_error_noreturn(E_ERROR, "__clone method called on non-object"); EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr); EX_T(opline->result.u.var).var.ptr->refcount++; FREE_OP1_IF_VAR(); @@ -2727,9 +2727,11 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY) zval *expr = GET_OP1_ZVAL_PTR(BP_VAR_R); zval *result = &EX_T(opline->result.u.var).tmp_var; - *result = *expr; - if (!IS_OP1_TMP_FREE()) { - zendi_zval_copy_ctor(*result); + if (opline->extended_value != IS_STRING) { + *result = *expr; + if (!IS_OP1_TMP_FREE()) { + zendi_zval_copy_ctor(*result); + } } switch (opline->extended_value) { case IS_NULL: @@ -2748,10 +2750,17 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY) zval var_copy; int use_copy; - zend_make_printable_zval(result, &var_copy, &use_copy); + zend_make_printable_zval(expr, &var_copy, &use_copy); if (use_copy) { - zval_dtor(result); *result = var_copy; + if (IS_OP1_TMP_FREE()) { + FREE_OP1(); + } + } else { + *result = *expr; + if (!IS_OP1_TMP_FREE()) { + zendi_zval_copy_ctor(*result); + } } break; } @@ -3599,7 +3608,7 @@ ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY) } if (EG(error_reporting)) { - zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); + zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1); } ZEND_VM_NEXT_OPCODE(); } @@ -3619,7 +3628,7 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY) Z_TYPE(restored_error_reporting) = IS_LONG; Z_LVAL(restored_error_reporting) = Z_LVAL(EX_T(opline->op1.u.var).tmp_var); convert_to_string(&restored_error_reporting); - zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); + zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1); zendi_zval_dtor(restored_error_reporting); } if (EX(old_error_reporting) == &EX_T(opline->op1.u.var).tmp_var) { @@ -3811,7 +3820,7 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) Z_TYPE(restored_error_reporting) = IS_LONG; Z_LVAL(restored_error_reporting) = Z_LVAL_P(EX(old_error_reporting)); convert_to_string(&restored_error_reporting); - zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); + zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1); zendi_zval_dtor(restored_error_reporting); } EX(old_error_reporting) = NULL; diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 51e18469e..8ce7ef972 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -442,7 +442,7 @@ static int ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (EG(error_reporting)) { - zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); + zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1); } ZEND_VM_NEXT_OPCODE(); } @@ -592,7 +592,7 @@ static int ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) Z_TYPE(restored_error_reporting) = IS_LONG; Z_LVAL(restored_error_reporting) = Z_LVAL_P(EX(old_error_reporting)); convert_to_string(&restored_error_reporting); - zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); + zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1); zendi_zval_dtor(restored_error_reporting); } EX(old_error_reporting) = NULL; @@ -1837,7 +1837,7 @@ static int ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_object_clone_obj_t clone_call; if (!obj || Z_TYPE_P(obj) != IS_OBJECT) { - zend_error(E_WARNING, "__clone method called on non-object"); + zend_error_noreturn(E_ERROR, "__clone method called on non-object"); EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr); EX_T(opline->result.u.var).var.ptr->refcount++; @@ -1895,9 +1895,11 @@ static int ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *expr = &opline->op1.u.constant; zval *result = &EX_T(opline->result.u.var).tmp_var; - *result = *expr; - if (!0) { - zendi_zval_copy_ctor(*result); + if (opline->extended_value != IS_STRING) { + *result = *expr; + if (!0) { + zendi_zval_copy_ctor(*result); + } } switch (opline->extended_value) { case IS_NULL: @@ -1916,10 +1918,17 @@ static int ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval var_copy; int use_copy; - zend_make_printable_zval(result, &var_copy, &use_copy); + zend_make_printable_zval(expr, &var_copy, &use_copy); if (use_copy) { - zval_dtor(result); *result = var_copy; + if (0) { + + } + } else { + *result = *expr; + if (!0) { + zendi_zval_copy_ctor(*result); + } } break; } @@ -4403,7 +4412,7 @@ static int ZEND_CLONE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_object_clone_obj_t clone_call; if (!obj || Z_TYPE_P(obj) != IS_OBJECT) { - zend_error(E_WARNING, "__clone method called on non-object"); + zend_error_noreturn(E_ERROR, "__clone method called on non-object"); EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr); EX_T(opline->result.u.var).var.ptr->refcount++; @@ -4461,9 +4470,11 @@ static int ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *expr = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); zval *result = &EX_T(opline->result.u.var).tmp_var; - *result = *expr; - if (!1) { - zendi_zval_copy_ctor(*result); + if (opline->extended_value != IS_STRING) { + *result = *expr; + if (!1) { + zendi_zval_copy_ctor(*result); + } } switch (opline->extended_value) { case IS_NULL: @@ -4482,10 +4493,17 @@ static int ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval var_copy; int use_copy; - zend_make_printable_zval(result, &var_copy, &use_copy); + zend_make_printable_zval(expr, &var_copy, &use_copy); if (use_copy) { - zval_dtor(result); *result = var_copy; + if (1) { + zval_dtor(free_op1.var); + } + } else { + *result = *expr; + if (!1) { + zendi_zval_copy_ctor(*result); + } } break; } @@ -4922,7 +4940,7 @@ static int ZEND_END_SILENCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) Z_TYPE(restored_error_reporting) = IS_LONG; Z_LVAL(restored_error_reporting) = Z_LVAL(EX_T(opline->op1.u.var).tmp_var); convert_to_string(&restored_error_reporting); - zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); + zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1); zendi_zval_dtor(restored_error_reporting); } if (EX(old_error_reporting) == &EX_T(opline->op1.u.var).tmp_var) { @@ -7541,7 +7559,7 @@ static int ZEND_CLONE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_object_clone_obj_t clone_call; if (!obj || Z_TYPE_P(obj) != IS_OBJECT) { - zend_error(E_WARNING, "__clone method called on non-object"); + zend_error_noreturn(E_ERROR, "__clone method called on non-object"); EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr); EX_T(opline->result.u.var).var.ptr->refcount++; if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -7599,9 +7617,11 @@ static int ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *expr = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); zval *result = &EX_T(opline->result.u.var).tmp_var; - *result = *expr; - if (!0) { - zendi_zval_copy_ctor(*result); + if (opline->extended_value != IS_STRING) { + *result = *expr; + if (!0) { + zendi_zval_copy_ctor(*result); + } } switch (opline->extended_value) { case IS_NULL: @@ -7620,10 +7640,17 @@ static int ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval var_copy; int use_copy; - zend_make_printable_zval(result, &var_copy, &use_copy); + zend_make_printable_zval(expr, &var_copy, &use_copy); if (use_copy) { - zval_dtor(result); *result = var_copy; + if (0) { + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } + } else { + *result = *expr; + if (!0) { + zendi_zval_copy_ctor(*result); + } } break; } @@ -14692,7 +14719,7 @@ static int ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_object_clone_obj_t clone_call; if (!obj || Z_TYPE_P(obj) != IS_OBJECT) { - zend_error(E_WARNING, "__clone method called on non-object"); + zend_error_noreturn(E_ERROR, "__clone method called on non-object"); EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr); EX_T(opline->result.u.var).var.ptr->refcount++; @@ -19604,7 +19631,7 @@ static int ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_object_clone_obj_t clone_call; if (!obj || Z_TYPE_P(obj) != IS_OBJECT) { - zend_error(E_WARNING, "__clone method called on non-object"); + zend_error_noreturn(E_ERROR, "__clone method called on non-object"); EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr); EX_T(opline->result.u.var).var.ptr->refcount++; @@ -19662,9 +19689,11 @@ static int ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *expr = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); zval *result = &EX_T(opline->result.u.var).tmp_var; - *result = *expr; - if (!0) { - zendi_zval_copy_ctor(*result); + if (opline->extended_value != IS_STRING) { + *result = *expr; + if (!0) { + zendi_zval_copy_ctor(*result); + } } switch (opline->extended_value) { case IS_NULL: @@ -19683,10 +19712,17 @@ static int ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval var_copy; int use_copy; - zend_make_printable_zval(result, &var_copy, &use_copy); + zend_make_printable_zval(expr, &var_copy, &use_copy); if (use_copy) { - zval_dtor(result); *result = var_copy; + if (0) { + + } + } else { + *result = *expr; + if (!0) { + zendi_zval_copy_ctor(*result); + } } break; } |